bool RegisterProgDeviceInManager( const QString & className, GDevice*(deviceCreator)(QString, QObject*) ) { bool isOk = DeviceManagerInstance()->Register(className, deviceCreator); if(isOk) DeviceManagerInstance()->RegisterProgDevice(className); return isOk; }
void GWorkBench::RemoveDevice( QString uniqueIdentifierName ) { QList<GDevice*> listDEvTest = DeviceManagerInstance()->AllDevices(); GDevice* pDev = GetDeviceFromDeviceManager(uniqueIdentifierName); if(pDev) RemoveDevice(pDev); }
GDevice::GDevice(QString uniqueIdentifierName, QObject *parent) : QThread(parent) , GSerializable(uniqueIdentifierName) { AddToDeviceManager(); // note that this ReName() call will be overwritten when the device is created through the device manager (see G_REGISTER_HARD_DEVICE_CLASS), // but not if it is created manually or by another device, like in the SrYbExe::DevicesToShelf() or in GPhidgetAdvancedServoModule::CreateSubDevicesServos(). ReName(uniqueIdentifierName); // warn if parent = 0. Added to a cleanup list to insure will be destroyed. if(!parent) { DeviceManagerInstance()->m_CleanUpDevices.add(this); // qDebug() << "device" << metaObject()->className() << UniqueSystemID() << "Created with parent = 0."; } connect(this, SIGNAL(PrivateTriggerLatterInitialization()), this, SLOT(LatterInitialization()), Qt::QueuedConnection); emit PrivateTriggerLatterInitialization(); disconnect(this, SIGNAL(PrivateTriggerLatterInitialization())); m_Color = QColor( (qrand() * 255) / RAND_MAX, (qrand() * 255) / RAND_MAX, (qrand() * 255) / RAND_MAX); }
GDevice::~GDevice() { DeviceManagerInstance()->Remove(UniqueSystemID()); }
void LoadPluginsInDeviceManager() { DeviceManagerInstance()->LoadDevicePlugins(); }
void AddToDeviceShelf( GDevice* pDevice ) { DeviceManagerInstance()->AddDeviceToShelf(pDevice); }
GDevice* GetDeviceFromDeviceManager( QString uniqueIdentifierName ) { return DeviceManagerInstance()->GetDevice(uniqueIdentifierName); }