@@ -1,99 +1,112 | |||||
1 | /*------------------------------------------------------------------------------ |
|
1 | /*------------------------------------------------------------------------------ | |
2 | -- This file is a part of the SocExplorer Software |
|
2 | -- This file is a part of the SocExplorer Software | |
3 | -- Copyright (C) 2013, Plasma Physics Laboratory - CNRS |
|
3 | -- Copyright (C) 2013, Plasma Physics Laboratory - CNRS | |
4 | -- |
|
4 | -- | |
5 | -- This program is free software; you can redistribute it and/or modify |
|
5 | -- This program is free software; you can redistribute it and/or modify | |
6 | -- it under the terms of the GNU General Public License as published by |
|
6 | -- it under the terms of the GNU General Public License as published by | |
7 | -- the Free Software Foundation; either version 2 of the License, or |
|
7 | -- the Free Software Foundation; either version 2 of the License, or | |
8 | -- (at your option) any later version. |
|
8 | -- (at your option) any later version. | |
9 | -- |
|
9 | -- | |
10 | -- This program is distributed in the hope that it will be useful, |
|
10 | -- This program is distributed in the hope that it will be useful, | |
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | -- GNU General Public License for more details. |
|
13 | -- GNU General Public License for more details. | |
14 | -- |
|
14 | -- | |
15 | -- You should have received a copy of the GNU General Public License |
|
15 | -- You should have received a copy of the GNU General Public License | |
16 | -- along with this program; if not, write to the Free Software |
|
16 | -- along with this program; if not, write to the Free Software | |
17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
18 | -------------------------------------------------------------------------------*/ |
|
18 | -------------------------------------------------------------------------------*/ | |
19 | /*-- Author : Alexis Jeandet |
|
19 | /*-- Author : Alexis Jeandet | |
20 | -- Mail : alexis.jeandet@lpp.polytechnique.fr |
|
20 | -- Mail : alexis.jeandet@lpp.polytechnique.fr | |
21 | ----------------------------------------------------------------------------*/ |
|
21 | ----------------------------------------------------------------------------*/ | |
22 | #include "socmodel.h" |
|
22 | #include "socmodel.h" | |
23 | #include <socexplorerenumdevice.h> |
|
23 | #include <socexplorerenumdevice.h> | |
24 |
|
24 | |||
25 |
|
25 | |||
26 | SOCModel::SOCModel(socexplorerplugin *rootDev, QObject *parent): |
|
26 | SOCModel::SOCModel(socexplorerplugin *rootDev, QObject *parent): | |
27 | QObject(parent) |
|
27 | QObject(parent) | |
28 | { |
|
28 | { | |
29 | p_rootDev = rootDev; |
|
29 | p_rootDev = rootDev; | |
30 | } |
|
30 | } | |
31 |
|
31 | |||
32 | qint32 SOCModel::getEnumDeviceBaseAddress(int VID, int PID, int count) |
|
32 | qint32 SOCModel::getEnumDeviceBaseAddress(int VID, int PID, int count) | |
33 | { |
|
33 | { | |
34 | for(int i=0;i<p_enumeratedDevices.count();i++) |
|
34 | for(int i=0;i<p_enumeratedDevices.count();i++) | |
35 | { |
|
35 | { | |
36 | if((p_enumeratedDevices.at(i)->VID()==VID) && (p_enumeratedDevices.at(i)->PID()==PID)) |
|
36 | if((p_enumeratedDevices.at(i)->VID()==VID) && (p_enumeratedDevices.at(i)->PID()==PID)) | |
37 | { |
|
37 | { | |
38 | if(count==0) |
|
38 | if(count==0) | |
39 | { |
|
39 | { | |
40 | return p_enumeratedDevices.at(i)->baseAddress(); |
|
40 | return p_enumeratedDevices.at(i)->baseAddress(); | |
41 | } |
|
41 | } | |
42 | count--; |
|
42 | count--; | |
43 | } |
|
43 | } | |
44 | } |
|
44 | } | |
45 | return -1; |
|
45 | return -1; | |
46 | } |
|
46 | } | |
47 |
|
47 | |||
|
48 | qint32 SOCModel::getEnumDeviceCount(int VID, int PID) | |||
|
49 | { | |||
|
50 | qint32 count =0; | |||
|
51 | for(int i=0;i<p_enumeratedDevices.count();i++) | |||
|
52 | { | |||
|
53 | if((p_enumeratedDevices.at(i)->VID()==VID) && (p_enumeratedDevices.at(i)->PID()==PID)) | |||
|
54 | { | |||
|
55 | count++; | |||
|
56 | } | |||
|
57 | } | |||
|
58 | return count; | |||
|
59 | } | |||
|
60 | ||||
48 | socExplorerEnumDevice *SOCModel::addEnumDevice( int VID, int PID, qint32 baseAddress, const QString &name) |
|
61 | socExplorerEnumDevice *SOCModel::addEnumDevice( int VID, int PID, qint32 baseAddress, const QString &name) | |
49 | { |
|
62 | { | |
50 | if(enumDeviceExists(baseAddress)) |
|
63 | if(enumDeviceExists(baseAddress)) | |
51 | return getEnumDevice(baseAddress); |
|
64 | return getEnumDevice(baseAddress); | |
52 | socExplorerEnumDevice* device= new socExplorerEnumDevice(this,VID,PID,baseAddress,name); |
|
65 | socExplorerEnumDevice* device= new socExplorerEnumDevice(this,VID,PID,baseAddress,name); | |
53 | p_enumeratedDevices.append(device); |
|
66 | p_enumeratedDevices.append(device); | |
54 | return device; |
|
67 | return device; | |
55 | } |
|
68 | } | |
56 |
|
69 | |||
57 | int SOCModel::addEnumDevice(socExplorerEnumDevice *device) |
|
70 | int SOCModel::addEnumDevice(socExplorerEnumDevice *device) | |
58 | { |
|
71 | { | |
59 | if(enumDeviceExists(device->baseAddress())) |
|
72 | if(enumDeviceExists(device->baseAddress())) | |
60 | return 0; |
|
73 | return 0; | |
61 | p_enumeratedDevices.append(device); |
|
74 | p_enumeratedDevices.append(device); | |
62 | return 1; |
|
75 | return 1; | |
63 | } |
|
76 | } | |
64 |
|
77 | |||
65 |
|
78 | |||
66 |
|
79 | |||
67 | bool SOCModel::enumDeviceExists(qint32 baseAddress) |
|
80 | bool SOCModel::enumDeviceExists(qint32 baseAddress) | |
68 | { |
|
81 | { | |
69 | for(int i=0;i<p_enumeratedDevices.count();i++) |
|
82 | for(int i=0;i<p_enumeratedDevices.count();i++) | |
70 | { |
|
83 | { | |
71 | if(p_enumeratedDevices.at(i)->baseAddress()==baseAddress) |
|
84 | if(p_enumeratedDevices.at(i)->baseAddress()==baseAddress) | |
72 | return true; |
|
85 | return true; | |
73 | } |
|
86 | } | |
74 | return false; |
|
87 | return false; | |
75 | } |
|
88 | } | |
76 |
|
89 | |||
77 | socExplorerEnumDevice *SOCModel::getEnumDevice(qint32 baseAddress) |
|
90 | socExplorerEnumDevice *SOCModel::getEnumDevice(qint32 baseAddress) | |
78 | { |
|
91 | { | |
79 | for(int i=0;i<p_enumeratedDevices.count();i++) |
|
92 | for(int i=0;i<p_enumeratedDevices.count();i++) | |
80 | { |
|
93 | { | |
81 | if(p_enumeratedDevices.at(i)->baseAddress()==baseAddress) |
|
94 | if(p_enumeratedDevices.at(i)->baseAddress()==baseAddress) | |
82 | return p_enumeratedDevices.at(i); |
|
95 | return p_enumeratedDevices.at(i); | |
83 | } |
|
96 | } | |
84 | return NULL; |
|
97 | return NULL; | |
85 | } |
|
98 | } | |
86 |
|
99 | |||
87 |
|
100 | |||
88 | void SOCModel::writeReg(qint32 address, qint32 value) |
|
101 | void SOCModel::writeReg(qint32 address, qint32 value) | |
89 | { |
|
102 | { | |
90 | uint valueInt=value,addressInt=address; |
|
103 | uint valueInt=value,addressInt=address; | |
91 | p_rootDev->Write(&valueInt,1,addressInt); |
|
104 | p_rootDev->Write(&valueInt,1,addressInt); | |
92 | } |
|
105 | } | |
93 |
|
106 | |||
94 | qint32 SOCModel::readReg(qint32 address) |
|
107 | qint32 SOCModel::readReg(qint32 address) | |
95 | { |
|
108 | { | |
96 | uint valueInt=0,addressInt=address; |
|
109 | uint valueInt=0,addressInt=address; | |
97 | p_rootDev->Read(&valueInt,1,addressInt); |
|
110 | p_rootDev->Read(&valueInt,1,addressInt); | |
98 | return (qint32)valueInt; |
|
111 | return (qint32)valueInt; | |
99 | } |
|
112 | } |
@@ -1,115 +1,116 | |||||
1 | /*------------------------------------------------------------------------------ |
|
1 | /*------------------------------------------------------------------------------ | |
2 | -- This file is a part of the SocExplorer Software |
|
2 | -- This file is a part of the SocExplorer Software | |
3 | -- Copyright (C) 2013, Plasma Physics Laboratory - CNRS |
|
3 | -- Copyright (C) 2013, Plasma Physics Laboratory - CNRS | |
4 | -- |
|
4 | -- | |
5 | -- This program is free software; you can redistribute it and/or modify |
|
5 | -- This program is free software; you can redistribute it and/or modify | |
6 | -- it under the terms of the GNU General Public License as published by |
|
6 | -- it under the terms of the GNU General Public License as published by | |
7 | -- the Free Software Foundation; either version 2 of the License, or |
|
7 | -- the Free Software Foundation; either version 2 of the License, or | |
8 | -- (at your option) any later version. |
|
8 | -- (at your option) any later version. | |
9 | -- |
|
9 | -- | |
10 | -- This program is distributed in the hope that it will be useful, |
|
10 | -- This program is distributed in the hope that it will be useful, | |
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | -- GNU General Public License for more details. |
|
13 | -- GNU General Public License for more details. | |
14 | -- |
|
14 | -- | |
15 | -- You should have received a copy of the GNU General Public License |
|
15 | -- You should have received a copy of the GNU General Public License | |
16 | -- along with this program; if not, write to the Free Software |
|
16 | -- along with this program; if not, write to the Free Software | |
17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
18 | -------------------------------------------------------------------------------*/ |
|
18 | -------------------------------------------------------------------------------*/ | |
19 | /*-- Author : Alexis Jeandet |
|
19 | /*-- Author : Alexis Jeandet | |
20 | -- Mail : alexis.jeandet@lpp.polytechnique.fr |
|
20 | -- Mail : alexis.jeandet@lpp.polytechnique.fr | |
21 | ----------------------------------------------------------------------------*/ |
|
21 | ----------------------------------------------------------------------------*/ | |
22 |
|
22 | |||
23 | #ifndef REGISTERSMODEL_H |
|
23 | #ifndef REGISTERSMODEL_H | |
24 | #define REGISTERSMODEL_H |
|
24 | #define REGISTERSMODEL_H | |
25 | #include <QString> |
|
25 | #include <QString> | |
26 | #include <QList> |
|
26 | #include <QList> | |
27 | #include <QObject> |
|
27 | #include <QObject> | |
28 | #include <QDomDocument> |
|
28 | #include <QDomDocument> | |
29 | #include <QDomElement> |
|
29 | #include <QDomElement> | |
30 | #include "registerdata.h" |
|
30 | #include "registerdata.h" | |
31 | #include <socclk.h> |
|
31 | #include <socclk.h> | |
32 | #include <socexplorerplugin.h> |
|
32 | #include <socexplorerplugin.h> | |
33 | //#include <socexplorerenumdevice.h> |
|
33 | //#include <socexplorerenumdevice.h> | |
34 | class socExplorerEnumDevice; |
|
34 | class socExplorerEnumDevice; | |
35 |
|
35 | |||
36 | class registerBitFieldModel |
|
36 | class registerBitFieldModel | |
37 | { |
|
37 | { | |
38 | public: |
|
38 | public: | |
39 | registerBitFieldModel(const QString& name,const QString& description, |
|
39 | registerBitFieldModel(const QString& name,const QString& description, | |
40 | int size, int offset, bool rw) |
|
40 | int size, int offset, bool rw) | |
41 | { |
|
41 | { | |
42 | this->name = name; |
|
42 | this->name = name; | |
43 | this->description = description; |
|
43 | this->description = description; | |
44 | this->size = size; |
|
44 | this->size = size; | |
45 | this->offset = offset; |
|
45 | this->offset = offset; | |
46 | this->rw = rw; |
|
46 | this->rw = rw; | |
47 | } |
|
47 | } | |
48 | QString name; |
|
48 | QString name; | |
49 | QString description; |
|
49 | QString description; | |
50 | int size; |
|
50 | int size; | |
51 | int offset; |
|
51 | int offset; | |
52 | bool rw; |
|
52 | bool rw; | |
53 | }; |
|
53 | }; | |
54 |
|
54 | |||
55 | class registerModel |
|
55 | class registerModel | |
56 | { |
|
56 | { | |
57 | public: |
|
57 | public: | |
58 | registerModel(const QString& name,qint32 offset) |
|
58 | registerModel(const QString& name,qint32 offset) | |
59 | { |
|
59 | { | |
60 | this->name = name; |
|
60 | this->name = name; | |
61 | this->offset = offset; |
|
61 | this->offset = offset; | |
62 | } |
|
62 | } | |
63 | QString name; |
|
63 | QString name; | |
64 | qint32 offset; |
|
64 | qint32 offset; | |
65 | QList<registerBitFieldModel> bitfields; |
|
65 | QList<registerBitFieldModel> bitfields; | |
66 | }; |
|
66 | }; | |
67 |
|
67 | |||
68 | class peripheralModel |
|
68 | class peripheralModel | |
69 | { |
|
69 | { | |
70 | public: |
|
70 | public: | |
71 | peripheralModel(const QString& name) |
|
71 | peripheralModel(const QString& name) | |
72 | { |
|
72 | { | |
73 | this->name = name; |
|
73 | this->name = name; | |
74 | } |
|
74 | } | |
75 | QString name; |
|
75 | QString name; | |
76 | QList<registerModel> registers; |
|
76 | QList<registerModel> registers; | |
77 | }; |
|
77 | }; | |
78 |
|
78 | |||
79 |
|
79 | |||
80 | class SOCEXPLORER_EXPORT SOCModel :public QObject |
|
80 | class SOCEXPLORER_EXPORT SOCModel :public QObject | |
81 | { |
|
81 | { | |
82 | Q_OBJECT |
|
82 | Q_OBJECT | |
83 | public: |
|
83 | public: | |
84 | SOCModel(socexplorerplugin* rootDev,QObject* parent=0); |
|
84 | SOCModel(socexplorerplugin* rootDev,QObject* parent=0); | |
85 | // qint32 getRegValue(qint32 baseAddress); |
|
85 | // qint32 getRegValue(qint32 baseAddress); | |
86 | bool isRootDev(socexplorerplugin* rootDev) |
|
86 | bool isRootDev(socexplorerplugin* rootDev) | |
87 | { |
|
87 | { | |
88 | return rootDev==p_rootDev; |
|
88 | return rootDev==p_rootDev; | |
89 | } |
|
89 | } | |
90 | bool enumDeviceExists(qint32 baseAddress); |
|
90 | bool enumDeviceExists(qint32 baseAddress); | |
91 | socExplorerEnumDevice *getEnumDevice(qint32 baseAddress); |
|
91 | socExplorerEnumDevice *getEnumDevice(qint32 baseAddress); | |
92 | public slots: |
|
92 | public slots: | |
93 | //void setRegValue(qint32 baseAddress,qint32 value); |
|
93 | //void setRegValue(qint32 baseAddress,qint32 value); | |
94 | qint32 getEnumDeviceBaseAddress(int VID,int PID,int count=0); |
|
94 | qint32 getEnumDeviceBaseAddress(int VID,int PID,int count=0); | |
|
95 | qint32 getEnumDeviceCount(int VID,int PID); | |||
95 | socExplorerEnumDevice* addEnumDevice(int VID, int PID, qint32 baseAddress, const QString& name); |
|
96 | socExplorerEnumDevice* addEnumDevice(int VID, int PID, qint32 baseAddress, const QString& name); | |
96 | int addEnumDevice(socExplorerEnumDevice* device); |
|
97 | int addEnumDevice(socExplorerEnumDevice* device); | |
97 | void writeReg(qint32 address,qint32 value); |
|
98 | void writeReg(qint32 address,qint32 value); | |
98 | qint32 readReg(qint32 address); |
|
99 | qint32 readReg(qint32 address); | |
99 | private: |
|
100 | private: | |
100 | socexplorerplugin* p_rootDev; |
|
101 | socexplorerplugin* p_rootDev; | |
101 | QList<socExplorerEnumDevice*> p_enumeratedDevices; |
|
102 | QList<socExplorerEnumDevice*> p_enumeratedDevices; | |
102 | QList<SOCclk*> clktree; |
|
103 | QList<SOCclk*> clktree; | |
103 | }; |
|
104 | }; | |
104 |
|
105 | |||
105 |
|
106 | |||
106 |
|
107 | |||
107 |
|
108 | |||
108 | #endif // REGISTERSMODEL_H |
|
109 | #endif // REGISTERSMODEL_H | |
109 |
|
110 | |||
110 |
|
111 | |||
111 |
|
112 | |||
112 |
|
113 | |||
113 |
|
114 | |||
114 |
|
115 | |||
115 |
|
116 |
@@ -1,232 +1,251 | |||||
1 | /*------------------------------------------------------------------------------ |
|
1 | /*------------------------------------------------------------------------------ | |
2 | -- This file is a part of the SocExplorer Software |
|
2 | -- This file is a part of the SocExplorer Software | |
3 | -- Copyright (C) 2012, Plasma Physics Laboratory - CNRS |
|
3 | -- Copyright (C) 2012, Plasma Physics Laboratory - CNRS | |
4 | -- |
|
4 | -- | |
5 | -- This program is free software; you can redistribute it and/or modify |
|
5 | -- This program is free software; you can redistribute it and/or modify | |
6 | -- it under the terms of the GNU General Public License as published by |
|
6 | -- it under the terms of the GNU General Public License as published by | |
7 | -- the Free Software Foundation; either version 2 of the License, or |
|
7 | -- the Free Software Foundation; either version 2 of the License, or | |
8 | -- (at your option) any later version. |
|
8 | -- (at your option) any later version. | |
9 | -- |
|
9 | -- | |
10 | -- This program is distributed in the hope that it will be useful, |
|
10 | -- This program is distributed in the hope that it will be useful, | |
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | -- GNU General Public License for more details. |
|
13 | -- GNU General Public License for more details. | |
14 | -- |
|
14 | -- | |
15 | -- You should have received a copy of the GNU General Public License |
|
15 | -- You should have received a copy of the GNU General Public License | |
16 | -- along with this program; if not, write to the Free Software |
|
16 | -- along with this program; if not, write to the Free Software | |
17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
18 | -------------------------------------------------------------------------------*/ |
|
18 | -------------------------------------------------------------------------------*/ | |
19 | /*-- Author : Alexis Jeandet |
|
19 | /*-- Author : Alexis Jeandet | |
20 | -- Mail : alexis.jeandet@lpp.polytechnique.fr |
|
20 | -- Mail : alexis.jeandet@lpp.polytechnique.fr | |
21 | ----------------------------------------------------------------------------*/ |
|
21 | ----------------------------------------------------------------------------*/ | |
22 | #include "socexplorerengine.h" |
|
22 | #include "socexplorerengine.h" | |
23 | #include <proxy/socexplorerproxy.h> |
|
23 | #include <proxy/socexplorerproxy.h> | |
24 |
|
24 | |||
25 | SocExplorerEngine* SocExplorerEngine::_self = NULL; |
|
25 | SocExplorerEngine* SocExplorerEngine::_self = NULL; | |
26 | socExplorerXmlModel* SocExplorerEngine::p_xmlmodel=NULL; |
|
26 | socExplorerXmlModel* SocExplorerEngine::p_xmlmodel=NULL; | |
27 | QMainWindow* SocExplorerEngine::mainWindow=NULL; |
|
27 | QMainWindow* SocExplorerEngine::mainWindow=NULL; | |
28 | QList<SOCModel*>* SocExplorerEngine::SOCs=NULL; |
|
28 | QList<SOCModel*>* SocExplorerEngine::SOCs=NULL; | |
29 | int SocExplorerEngine::loglvl=1; |
|
29 | int SocExplorerEngine::loglvl=1; | |
30 |
|
30 | |||
31 | SocExplorerEngine::SocExplorerEngine(QObject *parent) : |
|
31 | SocExplorerEngine::SocExplorerEngine(QObject *parent) : | |
32 | QObject(parent) |
|
32 | QObject(parent) | |
33 | { |
|
33 | { | |
34 | if(SOCs==NULL) |
|
34 | if(SOCs==NULL) | |
35 | { |
|
35 | { | |
36 | SOCs = new QList<SOCModel*>; |
|
36 | SOCs = new QList<SOCModel*>; | |
37 | } |
|
37 | } | |
38 |
|
38 | |||
39 | } |
|
39 | } | |
40 |
|
40 | |||
41 |
|
41 | |||
42 | void SocExplorerEngine::init() |
|
42 | void SocExplorerEngine::init() | |
43 | { |
|
43 | { | |
44 | QDir dir; |
|
44 | QDir dir; | |
45 | if(!_self) |
|
45 | if(!_self) | |
46 | { |
|
46 | { | |
47 | _self= new SocExplorerEngine; |
|
47 | _self= new SocExplorerEngine; | |
48 | } |
|
48 | } | |
49 | if(!dir.exists(configFolder())) |
|
49 | if(!dir.exists(configFolder())) | |
50 | dir.mkdir(configFolder()); |
|
50 | dir.mkdir(configFolder()); | |
51 | p_xmlmodel = new socExplorerXmlModel(_self); |
|
51 | p_xmlmodel = new socExplorerXmlModel(_self); | |
52 | p_xmlmodel->updateSOClist(); |
|
52 | p_xmlmodel->updateSOClist(); | |
53 | } |
|
53 | } | |
54 |
|
54 | |||
55 | QString SocExplorerEngine::configFolder() |
|
55 | QString SocExplorerEngine::configFolder() | |
56 | { |
|
56 | { | |
57 | return QString(SOCEXPLORER_CONFIG_PATH); |
|
57 | return QString(SOCEXPLORER_CONFIG_PATH); | |
58 | } |
|
58 | } | |
59 |
|
59 | |||
60 | SOCModel *SocExplorerEngine::plugin2Soc(socexplorerplugin *plugin) |
|
60 | SOCModel *SocExplorerEngine::plugin2Soc(socexplorerplugin *plugin) | |
61 | { |
|
61 | { | |
62 | if(!_self) |
|
62 | if(!_self) | |
63 | init(); |
|
63 | init(); | |
64 | if(plugin) |
|
64 | if(plugin) | |
65 | { |
|
65 | { | |
66 | while (plugin->parent!=NULL) { |
|
66 | while (plugin->parent!=NULL) { | |
67 | plugin = plugin->parent; |
|
67 | plugin = plugin->parent; | |
68 | } |
|
68 | } | |
69 | for(int i=0;i<SOCs->count();i++) |
|
69 | for(int i=0;i<SOCs->count();i++) | |
70 | { |
|
70 | { | |
71 | if(SOCs->at(i)->isRootDev(plugin)) |
|
71 | if(SOCs->at(i)->isRootDev(plugin)) | |
72 | return SOCs->at(i); |
|
72 | return SOCs->at(i); | |
73 | } |
|
73 | } | |
74 | //no soc found so create a new one |
|
74 | //no soc found so create a new one | |
75 | SOCModel* soc=new SOCModel(plugin); |
|
75 | SOCModel* soc=new SOCModel(plugin); | |
76 | SOCs->append(soc); |
|
76 | SOCs->append(soc); | |
77 | return soc; |
|
77 | return soc; | |
78 | } |
|
78 | } | |
79 | return NULL; |
|
79 | return NULL; | |
80 | } |
|
80 | } | |
81 |
|
81 | |||
82 |
|
82 | |||
83 | int SocExplorerEngine::addEnumDevice(socexplorerplugin* rootPlugin,int VID, int PID, qint32 baseAddress, const QString &name) |
|
83 | int SocExplorerEngine::addEnumDevice(socexplorerplugin* rootPlugin,int VID, int PID, qint32 baseAddress, const QString &name) | |
84 | { |
|
84 | { | |
85 | if(!_self) |
|
85 | if(!_self) | |
86 | init(); |
|
86 | init(); | |
87 | SOCModel* soc = plugin2Soc(rootPlugin); |
|
87 | SOCModel* soc = plugin2Soc(rootPlugin); | |
88 | if(soc && !soc->enumDeviceExists(baseAddress)) |
|
88 | if(soc && !soc->enumDeviceExists(baseAddress)) | |
89 | { |
|
89 | { | |
90 | emit _self->enumDeviceAdded(soc->addEnumDevice(VID,PID,baseAddress,name)); |
|
90 | emit _self->enumDeviceAdded(soc->addEnumDevice(VID,PID,baseAddress,name)); | |
91 | return 1; |
|
91 | return 1; | |
92 | } |
|
92 | } | |
93 | return 0; |
|
93 | return 0; | |
94 | } |
|
94 | } | |
95 |
|
95 | |||
96 | QList<SOCModel *> *SocExplorerEngine::getSOCs() |
|
96 | QList<SOCModel *> *SocExplorerEngine::getSOCs() | |
97 | { |
|
97 | { | |
98 | if(!_self) |
|
98 | if(!_self) | |
99 | init(); |
|
99 | init(); | |
100 | return SOCs; |
|
100 | return SOCs; | |
101 | } |
|
101 | } | |
102 |
|
102 | |||
103 | qint32 SocExplorerEngine::getEnumDeviceBaseAddress(const QString& rootPlugin,int VID, int PID, int count) |
|
103 | qint32 SocExplorerEngine::getEnumDeviceBaseAddress(const QString& rootPlugin,int VID, int PID, int count) | |
104 | { |
|
104 | { | |
105 | socexplorerplugin* plugin = socexplorerproxy::findPlugin(rootPlugin); |
|
105 | socexplorerplugin* plugin = socexplorerproxy::findPlugin(rootPlugin); | |
106 | if(plugin==NULL)return -1; |
|
106 | if(plugin==NULL)return -1; | |
107 | SOCModel* soc = plugin2Soc(plugin); |
|
107 | SOCModel* soc = plugin2Soc(plugin); | |
108 | if(soc==NULL) |
|
108 | if(soc==NULL) | |
109 | return -1; |
|
109 | return -1; | |
110 | return soc->getEnumDeviceBaseAddress(VID,PID,count); |
|
110 | return soc->getEnumDeviceBaseAddress(VID,PID,count); | |
111 | } |
|
111 | } | |
112 |
|
112 | |||
113 | qint32 SocExplorerEngine::getEnumDeviceBaseAddress(socexplorerplugin *plugin, int VID, int PID, int count) |
|
113 | qint32 SocExplorerEngine::getEnumDeviceBaseAddress(socexplorerplugin *plugin, int VID, int PID, int count) | |
114 | { |
|
114 | { | |
115 | if(plugin==NULL)return -1; |
|
115 | if(plugin==NULL)return -1; | |
116 | SOCModel* soc = plugin2Soc(plugin); |
|
116 | SOCModel* soc = plugin2Soc(plugin); | |
117 | if(soc==NULL) |
|
117 | if(soc==NULL) | |
118 | return -1; |
|
118 | return -1; | |
119 | return soc->getEnumDeviceBaseAddress(VID,PID,count); |
|
119 | return soc->getEnumDeviceBaseAddress(VID,PID,count); | |
120 | } |
|
120 | } | |
121 |
|
121 | |||
|
122 | qint32 SocExplorerEngine::getEnumDeviceCount(socexplorerplugin *plugin, int VID, int PID) | |||
|
123 | { | |||
|
124 | if(plugin==NULL)return 0; | |||
|
125 | SOCModel* soc = plugin2Soc(plugin); | |||
|
126 | if(soc==NULL) | |||
|
127 | return 0; | |||
|
128 | return soc->getEnumDeviceCount(VID,PID); | |||
|
129 | } | |||
|
130 | ||||
|
131 | qint32 SocExplorerEngine::getEnumDeviceCount(const QString &rootPlugin, int VID, int PID) | |||
|
132 | { | |||
|
133 | socexplorerplugin* plugin = socexplorerproxy::findPlugin(rootPlugin); | |||
|
134 | if(plugin==NULL)return 0; | |||
|
135 | SOCModel* soc = plugin2Soc(plugin); | |||
|
136 | if(soc==NULL) | |||
|
137 | return 0; | |||
|
138 | return soc->getEnumDeviceCount(VID,PID); | |||
|
139 | } | |||
|
140 | ||||
122 | int SocExplorerEngine::addEnumDevice(const QString &rootPlugin, int VID, int PID, qint32 baseAddress, const QString &name) |
|
141 | int SocExplorerEngine::addEnumDevice(const QString &rootPlugin, int VID, int PID, qint32 baseAddress, const QString &name) | |
123 | { |
|
142 | { | |
124 | socexplorerplugin* plugin = socexplorerproxy::findPlugin(rootPlugin); |
|
143 | socexplorerplugin* plugin = socexplorerproxy::findPlugin(rootPlugin); | |
125 | if(plugin==NULL)return -1; |
|
144 | if(plugin==NULL)return -1; | |
126 | SOCModel* soc = plugin2Soc(plugin); |
|
145 | SOCModel* soc = plugin2Soc(plugin); | |
127 | if(soc==NULL) |
|
146 | if(soc==NULL) | |
128 | return -1; |
|
147 | return -1; | |
129 | soc->addEnumDevice(VID,PID,baseAddress,name); |
|
148 | soc->addEnumDevice(VID,PID,baseAddress,name); | |
130 | return 1; |
|
149 | return 1; | |
131 | } |
|
150 | } | |
132 |
|
151 | |||
133 |
|
152 | |||
134 | QString SocExplorerEngine::getDevName(int VID, int PID) |
|
153 | QString SocExplorerEngine::getDevName(int VID, int PID) | |
135 | { |
|
154 | { | |
136 | QList<QDomNodeList> list=p_xmlmodel->getAllNodes("peripheral"); |
|
155 | QList<QDomNodeList> list=p_xmlmodel->getAllNodes("peripheral"); | |
137 | for(int i=0;i<list.count();i++) |
|
156 | for(int i=0;i<list.count();i++) | |
138 | { |
|
157 | { | |
139 | QDomNodeList nodes=list.at(i); |
|
158 | QDomNodeList nodes=list.at(i); | |
140 | for(int l=0;l<nodes.count();l++) |
|
159 | for(int l=0;l<nodes.count();l++) | |
141 | { |
|
160 | { | |
142 | QDomElement node=nodes.at(l).toElement(); |
|
161 | QDomElement node=nodes.at(l).toElement(); | |
143 | int nodeVID=node.attribute("vid","0").toInt(); |
|
162 | int nodeVID=node.attribute("vid","0").toInt(); | |
144 | int nodePID=node.attribute("pid","0").toInt(); |
|
163 | int nodePID=node.attribute("pid","0").toInt(); | |
145 | if((nodeVID==VID)&&(nodePID==PID)) |
|
164 | if((nodeVID==VID)&&(nodePID==PID)) | |
146 | { |
|
165 | { | |
147 | return node.attribute("name","Unknow device"); |
|
166 | return node.attribute("name","Unknow device"); | |
148 | } |
|
167 | } | |
149 | } |
|
168 | } | |
150 | } |
|
169 | } | |
151 | return QString("Unknow device"); |
|
170 | return QString("Unknow device"); | |
152 | } |
|
171 | } | |
153 |
|
172 | |||
154 | QString SocExplorerEngine::SocExplorerVersion(){return QString(SOCEXPLORER_VERSION);} |
|
173 | QString SocExplorerEngine::SocExplorerVersion(){return QString(SOCEXPLORER_VERSION);} | |
155 |
|
174 | |||
156 | QString SocExplorerEngine::SocExplorerChangeset(){return QString(SOCEXPLORER_CHAGESET).split(" ").at(0);} |
|
175 | QString SocExplorerEngine::SocExplorerChangeset(){return QString(SOCEXPLORER_CHAGESET).split(" ").at(0);} | |
157 |
|
176 | |||
158 | QString SocExplorerEngine::SocExplorerBranch(){return QString(SOCEXPLORER_BRANCH);} |
|
177 | QString SocExplorerEngine::SocExplorerBranch(){return QString(SOCEXPLORER_BRANCH);} | |
159 |
|
178 | |||
160 | socExplorerXmlModel *SocExplorerEngine::xmlModel() |
|
179 | socExplorerXmlModel *SocExplorerEngine::xmlModel() | |
161 | { |
|
180 | { | |
162 | if(!_self) |
|
181 | if(!_self) | |
163 | init(); |
|
182 | init(); | |
164 | return p_xmlmodel; |
|
183 | return p_xmlmodel; | |
165 | } |
|
184 | } | |
166 |
|
185 | |||
167 | void SocExplorerEngine::setMainWindow(QMainWindow *Mainwindow) |
|
186 | void SocExplorerEngine::setMainWindow(QMainWindow *Mainwindow) | |
168 | { |
|
187 | { | |
169 | if(!_self) |
|
188 | if(!_self) | |
170 | init(); |
|
189 | init(); | |
171 | mainWindow=Mainwindow; |
|
190 | mainWindow=Mainwindow; | |
172 | } |
|
191 | } | |
173 |
|
192 | |||
174 | QProgressBar *SocExplorerEngine::getProgressBar(const QString& format, int max) |
|
193 | QProgressBar *SocExplorerEngine::getProgressBar(const QString& format, int max) | |
175 | { |
|
194 | { | |
176 | if(!_self) |
|
195 | if(!_self) | |
177 | init(); |
|
196 | init(); | |
178 | QProgressBar* progressBar; |
|
197 | QProgressBar* progressBar; | |
179 | if(mainWindow!=NULL) |
|
198 | if(mainWindow!=NULL) | |
180 | { |
|
199 | { | |
181 | progressBar = new QProgressBar(mainWindow); |
|
200 | progressBar = new QProgressBar(mainWindow); | |
182 | mainWindow->statusBar()->addWidget(progressBar); |
|
201 | mainWindow->statusBar()->addWidget(progressBar); | |
183 | } |
|
202 | } | |
184 | else |
|
203 | else | |
185 | { |
|
204 | { | |
186 | progressBar = new QProgressBar(); |
|
205 | progressBar = new QProgressBar(); | |
187 | } |
|
206 | } | |
188 | progressBar->setMaximum(max); |
|
207 | progressBar->setMaximum(max); | |
189 | progressBar->setFormat(format); |
|
208 | progressBar->setFormat(format); | |
190 | return progressBar; |
|
209 | return progressBar; | |
191 | } |
|
210 | } | |
192 |
|
211 | |||
193 | void SocExplorerEngine::deleteProgressBar(QProgressBar *progressBar) |
|
212 | void SocExplorerEngine::deleteProgressBar(QProgressBar *progressBar) | |
194 | { |
|
213 | { | |
195 | if(mainWindow!=NULL) |
|
214 | if(mainWindow!=NULL) | |
196 | { |
|
215 | { | |
197 | mainWindow->statusBar()->removeWidget(progressBar); |
|
216 | mainWindow->statusBar()->removeWidget(progressBar); | |
198 | } |
|
217 | } | |
199 | delete progressBar; |
|
218 | delete progressBar; | |
200 | } |
|
219 | } | |
201 |
|
220 | |||
202 | void SocExplorerEngine::addSOC(socexplorerplugin *rootPlugin) |
|
221 | void SocExplorerEngine::addSOC(socexplorerplugin *rootPlugin) | |
203 | { |
|
222 | { | |
204 | plugin2Soc(rootPlugin); |
|
223 | plugin2Soc(rootPlugin); | |
205 | } |
|
224 | } | |
206 |
|
225 | |||
207 | void SocExplorerEngine::removeSOC(socexplorerplugin *rootPlugin) |
|
226 | void SocExplorerEngine::removeSOC(socexplorerplugin *rootPlugin) | |
208 | { |
|
227 | { | |
209 | SOCModel* soc=plugin2Soc(rootPlugin); |
|
228 | SOCModel* soc=plugin2Soc(rootPlugin); | |
210 | SOCs->removeAll(soc); |
|
229 | SOCs->removeAll(soc); | |
211 | delete soc; |
|
230 | delete soc; | |
212 | } |
|
231 | } | |
213 |
|
232 | |||
214 | void SocExplorerEngine::message(socexplorerplugin *sender, const QString &message, int debugLevel) |
|
233 | void SocExplorerEngine::message(socexplorerplugin *sender, const QString &message, int debugLevel) | |
215 | { |
|
234 | { | |
216 | // TODO add multi output message manager IE also log in files |
|
235 | // TODO add multi output message manager IE also log in files | |
217 | if(!_self) |
|
236 | if(!_self) | |
218 | init(); |
|
237 | init(); | |
219 | if(loglvl>=debugLevel) |
|
238 | if(loglvl>=debugLevel) | |
220 | qDebug()<< QTime::currentTime().toString()+" " + sender->instanceName()+":"+message; |
|
239 | qDebug()<< QTime::currentTime().toString()+" " + sender->instanceName()+":"+message; | |
221 | } |
|
240 | } | |
222 |
|
241 | |||
223 | void SocExplorerEngine::setLogLevel(int level) |
|
242 | void SocExplorerEngine::setLogLevel(int level) | |
224 | { |
|
243 | { | |
225 | if(!_self) |
|
244 | if(!_self) | |
226 | init(); |
|
245 | init(); | |
227 | printf("Set log level to %d\n",level); |
|
246 | printf("Set log level to %d\n",level); | |
228 | loglvl = level; |
|
247 | loglvl = level; | |
229 | } |
|
248 | } | |
230 |
|
249 | |||
231 |
|
250 | |||
232 |
|
251 |
@@ -1,134 +1,136 | |||||
1 | /*------------------------------------------------------------------------------ |
|
1 | /*------------------------------------------------------------------------------ | |
2 | -- This file is a part of the SocExplorer Software |
|
2 | -- This file is a part of the SocExplorer Software | |
3 | -- Copyright (C) 2012, Plasma Physics Laboratory - CNRS |
|
3 | -- Copyright (C) 2012, Plasma Physics Laboratory - CNRS | |
4 | -- |
|
4 | -- | |
5 | -- This program is free software; you can redistribute it and/or modify |
|
5 | -- This program is free software; you can redistribute it and/or modify | |
6 | -- it under the terms of the GNU General Public License as published by |
|
6 | -- it under the terms of the GNU General Public License as published by | |
7 | -- the Free Software Foundation; either version 2 of the License, or |
|
7 | -- the Free Software Foundation; either version 2 of the License, or | |
8 | -- (at your option) any later version. |
|
8 | -- (at your option) any later version. | |
9 | -- |
|
9 | -- | |
10 | -- This program is distributed in the hope that it will be useful, |
|
10 | -- This program is distributed in the hope that it will be useful, | |
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | -- GNU General Public License for more details. |
|
13 | -- GNU General Public License for more details. | |
14 | -- |
|
14 | -- | |
15 | -- You should have received a copy of the GNU General Public License |
|
15 | -- You should have received a copy of the GNU General Public License | |
16 | -- along with this program; if not, write to the Free Software |
|
16 | -- along with this program; if not, write to the Free Software | |
17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
18 | -------------------------------------------------------------------------------*/ |
|
18 | -------------------------------------------------------------------------------*/ | |
19 | /*-- Author : Alexis Jeandet |
|
19 | /*-- Author : Alexis Jeandet | |
20 | -- Mail : alexis.jeandet@lpp.polytechnique.fr |
|
20 | -- Mail : alexis.jeandet@lpp.polytechnique.fr | |
21 | ----------------------------------------------------------------------------*/ |
|
21 | ----------------------------------------------------------------------------*/ | |
22 | #ifndef SOCEXPLORERENGINE_H |
|
22 | #ifndef SOCEXPLORERENGINE_H | |
23 | #define SOCEXPLORERENGINE_H |
|
23 | #define SOCEXPLORERENGINE_H | |
24 |
|
24 | |||
25 | #include <stdint.h> |
|
25 | #include <stdint.h> | |
26 | #include <QObject> |
|
26 | #include <QObject> | |
27 | #include <QtWidgets> |
|
27 | #include <QtWidgets> | |
28 | #include <QStringList> |
|
28 | #include <QStringList> | |
29 | #include <QDomDocument> |
|
29 | #include <QDomDocument> | |
30 | #include <QDomElement> |
|
30 | #include <QDomElement> | |
31 | #include <QDomNodeList> |
|
31 | #include <QDomNodeList> | |
32 | #include <QFile> |
|
32 | #include <QFile> | |
33 | #include <QTextStream> |
|
33 | #include <QTextStream> | |
34 | #include <QDir> |
|
34 | #include <QDir> | |
35 | #include <QApplication> |
|
35 | #include <QApplication> | |
36 | #include <QtCore/qglobal.h> |
|
36 | #include <QtCore/qglobal.h> | |
37 | #include <QFileDialog> |
|
37 | #include <QFileDialog> | |
38 | #include <socexplorerxmlfile.h> |
|
38 | #include <socexplorerxmlfile.h> | |
39 | #include <socexplorerenumdevice.h> |
|
39 | #include <socexplorerenumdevice.h> | |
40 | #include <XMLmodel.h> |
|
40 | #include <XMLmodel.h> | |
41 | #include <peripheralwidget.h> |
|
41 | #include <peripheralwidget.h> | |
42 | #include <registerwidget.h> |
|
42 | #include <registerwidget.h> | |
43 | #include <socmodel.h> |
|
43 | #include <socmodel.h> | |
44 |
|
44 | |||
45 | #if defined(SOCEXPLORER_SDK_BUILD) |
|
45 | #if defined(SOCEXPLORER_SDK_BUILD) | |
46 | # define SOCEXPLORER_SDK_EXPORT Q_DECL_EXPORT |
|
46 | # define SOCEXPLORER_SDK_EXPORT Q_DECL_EXPORT | |
47 | #else |
|
47 | #else | |
48 | # define SOCEXPLORER_SDK_EXPORT Q_DECL_IMPORT |
|
48 | # define SOCEXPLORER_SDK_EXPORT Q_DECL_IMPORT | |
49 | #endif |
|
49 | #endif | |
50 |
|
50 | |||
51 |
|
51 | |||
52 | class SOCEXPLORER_SDK_EXPORT SocExplorerAutoProgressBar |
|
52 | class SOCEXPLORER_SDK_EXPORT SocExplorerAutoProgressBar | |
53 | { |
|
53 | { | |
54 | public: |
|
54 | public: | |
55 | SocExplorerAutoProgressBar(QProgressBar* progressBar=NULL) |
|
55 | SocExplorerAutoProgressBar(QProgressBar* progressBar=NULL) | |
56 | { |
|
56 | { | |
57 | this->p_progressbar=progressBar; |
|
57 | this->p_progressbar=progressBar; | |
58 | } |
|
58 | } | |
59 | ~SocExplorerAutoProgressBar() |
|
59 | ~SocExplorerAutoProgressBar() | |
60 | { |
|
60 | { | |
61 | if(p_progressbar) |
|
61 | if(p_progressbar) | |
62 | { |
|
62 | { | |
63 | delete p_progressbar; |
|
63 | delete p_progressbar; | |
64 | } |
|
64 | } | |
65 | } |
|
65 | } | |
66 | void setProgressBar(QProgressBar* progressBar) |
|
66 | void setProgressBar(QProgressBar* progressBar) | |
67 | { |
|
67 | { | |
68 | this->p_progressbar=progressBar; |
|
68 | this->p_progressbar=progressBar; | |
69 | } |
|
69 | } | |
70 | void setValue(int value) |
|
70 | void setValue(int value) | |
71 | { |
|
71 | { | |
72 | p_progressbar->setValue(value); |
|
72 | p_progressbar->setValue(value); | |
73 | } |
|
73 | } | |
74 | private: |
|
74 | private: | |
75 | QProgressBar* p_progressbar; |
|
75 | QProgressBar* p_progressbar; | |
76 | }; |
|
76 | }; | |
77 |
|
77 | |||
78 | //! SocExplorerEngine is a pure static class which aims to provide services for both SocExplorer software and plugins. |
|
78 | //! SocExplorerEngine is a pure static class which aims to provide services for both SocExplorer software and plugins. | |
79 |
|
79 | |||
80 | class SOCEXPLORER_SDK_EXPORT SocExplorerEngine : public QObject |
|
80 | class SOCEXPLORER_SDK_EXPORT SocExplorerEngine : public QObject | |
81 | { |
|
81 | { | |
82 | Q_OBJECT |
|
82 | Q_OBJECT | |
83 | private: |
|
83 | private: | |
84 | static SocExplorerEngine* _self; |
|
84 | static SocExplorerEngine* _self; | |
85 | SocExplorerEngine(QObject *parent = 0); |
|
85 | SocExplorerEngine(QObject *parent = 0); | |
86 | static void init(); |
|
86 | static void init(); | |
87 |
|
87 | |||
88 | public: |
|
88 | public: | |
89 | static SocExplorerEngine* self(){ if(!_self){_self= new SocExplorerEngine;}return _self;} |
|
89 | static SocExplorerEngine* self(){ if(!_self){_self= new SocExplorerEngine;}return _self;} | |
90 | //! Return the configuration folder path, OS dependant. |
|
90 | //! Return the configuration folder path, OS dependant. | |
91 | SOCEXPLORER_SDK_EXPORT static QString configFolder(); |
|
91 | SOCEXPLORER_SDK_EXPORT static QString configFolder(); | |
92 | //! Return the default plugin folder path, OS dependant. |
|
92 | //! Return the default plugin folder path, OS dependant. | |
93 | static QString pluginFolder(){return QString(SOCEXPLORER_PLUGINS_INSTALL_PATH);} |
|
93 | static QString pluginFolder(){return QString(SOCEXPLORER_PLUGINS_INSTALL_PATH);} | |
94 |
|
94 | |||
95 | static int addEnumDevice(socexplorerplugin* rootPlugin,int VID,int PID,qint32 baseAddress,const QString& name); |
|
95 | static int addEnumDevice(socexplorerplugin* rootPlugin,int VID,int PID,qint32 baseAddress,const QString& name); | |
96 | static QList<SOCModel*>* getSOCs(); |
|
96 | static QList<SOCModel*>* getSOCs(); | |
97 | static QString getDevName(int VID, int PID); |
|
97 | static QString getDevName(int VID, int PID); | |
98 | static QString SocExplorerVersion(); |
|
98 | static QString SocExplorerVersion(); | |
99 | static QString SocExplorerChangeset(); |
|
99 | static QString SocExplorerChangeset(); | |
100 | static QString SocExplorerBranch(); |
|
100 | static QString SocExplorerBranch(); | |
101 | static socExplorerXmlModel* xmlModel(); |
|
101 | static socExplorerXmlModel* xmlModel(); | |
102 | static void setMainWindow(QMainWindow* Mainwindow); |
|
102 | static void setMainWindow(QMainWindow* Mainwindow); | |
103 | static QProgressBar* getProgressBar(const QString &format, int max); |
|
103 | static QProgressBar* getProgressBar(const QString &format, int max); | |
104 | static void deleteProgressBar(QProgressBar* progressBar); |
|
104 | static void deleteProgressBar(QProgressBar* progressBar); | |
105 | static void addSOC(socexplorerplugin* rootPlugin); |
|
105 | static void addSOC(socexplorerplugin* rootPlugin); | |
106 | static void removeSOC(socexplorerplugin* rootPlugin); |
|
106 | static void removeSOC(socexplorerplugin* rootPlugin); | |
107 | static void message(socexplorerplugin* sender,const QString& message,int debugLevel=0); |
|
107 | static void message(socexplorerplugin* sender,const QString& message,int debugLevel=0); | |
108 | static void setLogLevel(int level); |
|
108 | static void setLogLevel(int level); | |
109 | signals: |
|
109 | signals: | |
110 | void enumDeviceAdded(socExplorerEnumDevice* device); |
|
110 | void enumDeviceAdded(socExplorerEnumDevice* device); | |
111 | public slots: |
|
111 | public slots: | |
112 | QString getSocExplorerVersion(){return SocExplorerEngine::SocExplorerVersion();} |
|
112 | QString getSocExplorerVersion(){return SocExplorerEngine::SocExplorerVersion();} | |
113 | QString getSocExplorerChangeset(){return SocExplorerEngine::SocExplorerChangeset();} |
|
113 | QString getSocExplorerChangeset(){return SocExplorerEngine::SocExplorerChangeset();} | |
114 | QString getSocExplorerBranch(){return SocExplorerEngine::SocExplorerBranch();} |
|
114 | QString getSocExplorerBranch(){return SocExplorerEngine::SocExplorerBranch();} | |
115 | qint32 getEnumDeviceBaseAddress(const QString& rootPlugin,int VID,int PID,int count=0); |
|
115 | qint32 getEnumDeviceBaseAddress(const QString& rootPlugin,int VID,int PID,int count=0); | |
116 | qint32 getEnumDeviceBaseAddress(socexplorerplugin* plugin,int VID,int PID,int count=0); |
|
116 | qint32 getEnumDeviceBaseAddress(socexplorerplugin* plugin,int VID,int PID,int count=0); | |
|
117 | qint32 getEnumDeviceCount(socexplorerplugin* plugin,int VID,int PID); | |||
|
118 | qint32 getEnumDeviceCount(const QString& rootPlugin,int VID,int PID); | |||
117 | int addEnumDevice(const QString& rootPlugin,int VID,int PID,qint32 baseAddress,const QString& name); |
|
119 | int addEnumDevice(const QString& rootPlugin,int VID,int PID,qint32 baseAddress,const QString& name); | |
118 |
|
120 | |||
119 | private: |
|
121 | private: | |
120 | static SOCModel* plugin2Soc(socexplorerplugin* plugin); |
|
122 | static SOCModel* plugin2Soc(socexplorerplugin* plugin); | |
121 | static socExplorerXmlModel* p_xmlmodel; |
|
123 | static socExplorerXmlModel* p_xmlmodel; | |
122 | static QMainWindow* mainWindow; |
|
124 | static QMainWindow* mainWindow; | |
123 | static QList<SOCModel*>* SOCs; |
|
125 | static QList<SOCModel*>* SOCs; | |
124 | static int loglvl; |
|
126 | static int loglvl; | |
125 | }; |
|
127 | }; | |
126 |
|
128 | |||
127 | #endif // SOCEXPLORERENGINE_H |
|
129 | #endif // SOCEXPLORERENGINE_H | |
128 |
|
130 | |||
129 |
|
131 | |||
130 |
|
132 | |||
131 |
|
133 | |||
132 |
|
134 | |||
133 |
|
135 | |||
134 |
|
136 |
@@ -1,70 +1,70 | |||||
1 |
|
1 | |||
2 |
|
2 | |||
3 | win32 { |
|
3 | win32 { | |
4 | DEFINES += WIN32 |
|
4 | DEFINES += WIN32 | |
5 | DEFINES += WINTRANSLATIONPATH |
|
5 | DEFINES += WINTRANSLATIONPATH | |
6 | DEFINES += SOCEXPLORER_TRANSLATION_PATH="\"\\\"./translations"\\\"\" |
|
6 | DEFINES += SOCEXPLORER_TRANSLATION_PATH="\"\\\"./translations"\\\"\" | |
7 | SOCEXPLORER_TRANSLATION_INSTALL_PATH = translations |
|
7 | SOCEXPLORER_TRANSLATION_INSTALL_PATH = translations | |
8 | SOCEXPLORER_INSTALL_PATH = |
|
8 | SOCEXPLORER_INSTALL_PATH = | |
9 | SOCEXPLORER_PLUGINS_INSTALL_PATH = $$SOCEXPLORER_PLUGIN_PATH |
|
9 | SOCEXPLORER_PLUGINS_INSTALL_PATH = $$SOCEXPLORER_PLUGIN_PATH | |
10 | } |
|
10 | } | |
11 |
|
11 | |||
12 | unix { |
|
12 | unix { | |
13 | DEFINES += UNIX |
|
13 | DEFINES += UNIX | |
14 | DEFINES += UNIXTRANSLATIONPATH |
|
14 | DEFINES += UNIXTRANSLATIONPATH | |
15 | DEFINES += SOCEXPLORER_TRANSLATION_PATH="\"\\\"/etc/SocExplorer/translations"\\\"\" |
|
15 | DEFINES += SOCEXPLORER_TRANSLATION_PATH="\"\\\"/etc/SocExplorer/translations"\\\"\" | |
16 | SOCEXPLORER_TRANSLATION_INSTALL_PATH = /etc/SocExplorer/translations |
|
16 | SOCEXPLORER_TRANSLATION_INSTALL_PATH = /etc/SocExplorer/translations | |
17 | SOCEXPLORER_INSTALL_PATH = /usr/local/SocExplorer |
|
17 | SOCEXPLORER_INSTALL_PATH = /usr/local/SocExplorer | |
18 | SOCEXPLORER_ROOT_PLUGINS_INSTALL_PATH = $$system(echo $HOME) |
|
18 | SOCEXPLORER_ROOT_PLUGINS_INSTALL_PATH = $$system(echo $HOME) | |
19 | SOCEXPLORER_PLUGINS_INSTALL_PATH = $${SOCEXPLORER_ROOT_PLUGINS_INSTALL_PATH}"/.SocExplorer/plugins" |
|
19 | SOCEXPLORER_PLUGINS_INSTALL_PATH = $${SOCEXPLORER_ROOT_PLUGINS_INSTALL_PATH}"/.SocExplorer/plugins" | |
20 | } |
|
20 | } | |
21 |
|
21 | |||
22 | isEmpty(SOCEXPLORER_SDK_BUILD){ |
|
22 | isEmpty( SOCEXPLORER_SDK_BUILD ){ | |
23 | message( "building a plugin" ) |
|
23 | message( "building a plugin" ) | |
24 | QT += core gui xml |
|
24 | QT += core gui xml | |
25 | contains(QT_MAJOR_VERSION, 5) { |
|
25 | contains(QT_MAJOR_VERSION, 5) { | |
26 | QT += widgets |
|
26 | QT += widgets | |
27 | } |
|
27 | } | |
28 | CONFIG += pythonqt |
|
28 | CONFIG += pythonqt | |
29 | TEMPLATE = lib |
|
29 | TEMPLATE = lib | |
30 | win32:CONFIG += dll |
|
30 | win32:CONFIG += dll | |
31 | win32:CONFIG -= static |
|
31 | win32:CONFIG -= static | |
32 | OBJECTS_DIR = obj |
|
32 | OBJECTS_DIR = obj | |
33 | MOC_DIR = moc |
|
33 | MOC_DIR = moc | |
34 | DESTDIR = bin |
|
34 | DESTDIR = bin | |
35 | CONFIG(debug, debug|release) { |
|
35 | CONFIG(debug, debug|release) { | |
36 | DEBUG_EXT = _d |
|
36 | DEBUG_EXT = _d | |
37 | } else { |
|
37 | } else { | |
38 | DEBUG_EXT = |
|
38 | DEBUG_EXT = | |
39 | } |
|
39 | } | |
40 | unix{ |
|
40 | unix{ | |
41 | target.path = $${SOCEXPLORER_PLUGINS_INSTALL_PATH} |
|
41 | target.path = $${SOCEXPLORER_PLUGINS_INSTALL_PATH} | |
42 | INSTALLS += target |
|
42 | INSTALLS += target | |
43 | LIBS+= -lsocexplorerengine$${DEBUG_EXT} -lsocexplorercommon$${DEBUG_EXT} |
|
43 | LIBS+= -lsocexplorerengine$${DEBUG_EXT} -lsocexplorercommon$${DEBUG_EXT} | |
44 | } |
|
44 | } | |
45 | win32{ |
|
45 | win32{ | |
46 | INCLUDEPATH += $$[QT_INSTALL_HEADERS]/SocExplorer/common/libelf |
|
46 | INCLUDEPATH += $$[QT_INSTALL_HEADERS]/SocExplorer/common/libelf | |
47 | LIBS+=$$[QT_INSTALL_LIBS]/socexplorerengine$${DEBUG_EXT}.dll $$[QT_INSTALL_LIBS]/socexplorercommon$${DEBUG_EXT}.dll |
|
47 | LIBS+=$$[QT_INSTALL_LIBS]/socexplorerengine$${DEBUG_EXT}.dll $$[QT_INSTALL_LIBS]/socexplorercommon$${DEBUG_EXT}.dll | |
48 | } |
|
48 | } | |
49 | DEFINES += SOCEXPLORER_LIBRARY |
|
49 | DEFINES += SOCEXPLORER_LIBRARY | |
50 |
|
50 | |||
51 | SOURCES += \ |
|
51 | SOURCES += \ | |
52 | $$[QT_INSTALL_HEADERS]/SocExplorer/pluginsInterface/socexplorerplugininterface.cpp |
|
52 | $$[QT_INSTALL_HEADERS]/SocExplorer/pluginsInterface/socexplorerplugininterface.cpp | |
53 |
|
53 | |||
54 | HEADERS += \ |
|
54 | HEADERS += \ | |
55 | $$[QT_INSTALL_HEADERS]/SocExplorer/genericPySysdriver.h \ |
|
55 | $$[QT_INSTALL_HEADERS]/SocExplorer/genericPySysdriver.h \ | |
56 | $$[QT_INSTALL_HEADERS]/SocExplorer/socexplorerplugin.h |
|
56 | $$[QT_INSTALL_HEADERS]/SocExplorer/socexplorerplugin.h | |
57 |
|
57 | |||
58 | INCLUDEPATH += $$[QT_INSTALL_HEADERS]/SocExplorer/common \ |
|
58 | INCLUDEPATH += $$[QT_INSTALL_HEADERS]/SocExplorer/common \ | |
59 | $$[QT_INSTALL_HEADERS]/SocExplorer \ |
|
59 | $$[QT_INSTALL_HEADERS]/SocExplorer \ | |
60 | $$[QT_INSTALL_HEADERS]/SocExplorer/pluginsInterface |
|
60 | $$[QT_INSTALL_HEADERS]/SocExplorer/pluginsInterface | |
61 |
|
61 | |||
62 |
|
62 | |||
63 | }else{ |
|
63 | }else{ | |
64 | message( "building SocExplorer" ) |
|
64 | message( "building SocExplorer" ) | |
65 | HEADERS += \ |
|
65 | HEADERS += \ | |
66 | $$[QT_INSTALL_HEADERS]/SocExplorer/genericPySysdriver.h \ |
|
66 | $$[QT_INSTALL_HEADERS]/SocExplorer/genericPySysdriver.h \ | |
67 | $$[QT_INSTALL_HEADERS]/SocExplorer/socexplorerplugin.h |
|
67 | $$[QT_INSTALL_HEADERS]/SocExplorer/socexplorerplugin.h | |
68 | } |
|
68 | } | |
69 |
|
69 | |||
70 |
|
70 |
General Comments 0
You need to be logged in to leave comments.
Login now