# HG changeset patch # User jeandet # Date 2014-05-17 23:40:28 # Node ID a265fede2b19108b15d4a130a49f0ad8759e0ffd # Parent 1de6a6ae6ebe57cdb28309e70d5bca90e3718115 Added qint32 SocExplorerEngine::getEnumDeviceCount(socexplorerplugin *plugin, int VID, int PID) function to SocExplorer. diff --git a/src/SocExplorerEngine/SOC/socmodel.cpp b/src/SocExplorerEngine/SOC/socmodel.cpp --- a/src/SocExplorerEngine/SOC/socmodel.cpp +++ b/src/SocExplorerEngine/SOC/socmodel.cpp @@ -45,6 +45,19 @@ qint32 SOCModel::getEnumDeviceBaseAddres return -1; } +qint32 SOCModel::getEnumDeviceCount(int VID, int PID) +{ + qint32 count =0; + for(int i=0;iVID()==VID) && (p_enumeratedDevices.at(i)->PID()==PID)) + { + count++; + } + } + return count; +} + socExplorerEnumDevice *SOCModel::addEnumDevice( int VID, int PID, qint32 baseAddress, const QString &name) { if(enumDeviceExists(baseAddress)) diff --git a/src/SocExplorerEngine/SOC/socmodel.h b/src/SocExplorerEngine/SOC/socmodel.h --- a/src/SocExplorerEngine/SOC/socmodel.h +++ b/src/SocExplorerEngine/SOC/socmodel.h @@ -92,6 +92,7 @@ public: public slots: //void setRegValue(qint32 baseAddress,qint32 value); qint32 getEnumDeviceBaseAddress(int VID,int PID,int count=0); + qint32 getEnumDeviceCount(int VID,int PID); socExplorerEnumDevice* addEnumDevice(int VID, int PID, qint32 baseAddress, const QString& name); int addEnumDevice(socExplorerEnumDevice* device); void writeReg(qint32 address,qint32 value); diff --git a/src/SocExplorerEngine/engine/socexplorerengine.cpp b/src/SocExplorerEngine/engine/socexplorerengine.cpp --- a/src/SocExplorerEngine/engine/socexplorerengine.cpp +++ b/src/SocExplorerEngine/engine/socexplorerengine.cpp @@ -119,6 +119,25 @@ qint32 SocExplorerEngine::getEnumDeviceB return soc->getEnumDeviceBaseAddress(VID,PID,count); } +qint32 SocExplorerEngine::getEnumDeviceCount(socexplorerplugin *plugin, int VID, int PID) +{ + if(plugin==NULL)return 0; + SOCModel* soc = plugin2Soc(plugin); + if(soc==NULL) + return 0; + return soc->getEnumDeviceCount(VID,PID); +} + +qint32 SocExplorerEngine::getEnumDeviceCount(const QString &rootPlugin, int VID, int PID) +{ + socexplorerplugin* plugin = socexplorerproxy::findPlugin(rootPlugin); + if(plugin==NULL)return 0; + SOCModel* soc = plugin2Soc(plugin); + if(soc==NULL) + return 0; + return soc->getEnumDeviceCount(VID,PID); +} + int SocExplorerEngine::addEnumDevice(const QString &rootPlugin, int VID, int PID, qint32 baseAddress, const QString &name) { socexplorerplugin* plugin = socexplorerproxy::findPlugin(rootPlugin); diff --git a/src/SocExplorerEngine/engine/socexplorerengine.h b/src/SocExplorerEngine/engine/socexplorerengine.h --- a/src/SocExplorerEngine/engine/socexplorerengine.h +++ b/src/SocExplorerEngine/engine/socexplorerengine.h @@ -114,6 +114,8 @@ public slots: QString getSocExplorerBranch(){return SocExplorerEngine::SocExplorerBranch();} qint32 getEnumDeviceBaseAddress(const QString& rootPlugin,int VID,int PID,int count=0); qint32 getEnumDeviceBaseAddress(socexplorerplugin* plugin,int VID,int PID,int count=0); + qint32 getEnumDeviceCount(socexplorerplugin* plugin,int VID,int PID); + qint32 getEnumDeviceCount(const QString& rootPlugin,int VID,int PID); int addEnumDevice(const QString& rootPlugin,int VID,int PID,qint32 baseAddress,const QString& name); private: diff --git a/src/SocExplorerEngine/plugins/socexplorerplugin.prf b/src/SocExplorerEngine/plugins/socexplorerplugin.prf --- a/src/SocExplorerEngine/plugins/socexplorerplugin.prf +++ b/src/SocExplorerEngine/plugins/socexplorerplugin.prf @@ -19,7 +19,7 @@ unix { SOCEXPLORER_PLUGINS_INSTALL_PATH = $${SOCEXPLORER_ROOT_PLUGINS_INSTALL_PATH}"/.SocExplorer/plugins" } -isEmpty(SOCEXPLORER_SDK_BUILD){ +isEmpty( SOCEXPLORER_SDK_BUILD ){ message( "building a plugin" ) QT += core gui xml contains(QT_MAJOR_VERSION, 5) {