예제 #1
0
bool RegisterProgDeviceInManager( const QString & className, GDevice*(deviceCreator)(QString, QObject*) )
{
	bool isOk = DeviceManagerInstance()->Register(className, deviceCreator);
	if(isOk)
		DeviceManagerInstance()->RegisterProgDevice(className);
	return isOk;
}
예제 #2
0
void GWorkBench::RemoveDevice( QString uniqueIdentifierName )
{
    QList<GDevice*> listDEvTest = DeviceManagerInstance()->AllDevices();
    GDevice* pDev = GetDeviceFromDeviceManager(uniqueIdentifierName);
    if(pDev)
        RemoveDevice(pDev);
}
예제 #3
0
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);

}
예제 #4
0
GDevice::~GDevice()
{
	DeviceManagerInstance()->Remove(UniqueSystemID());
}
예제 #5
0
void LoadPluginsInDeviceManager()
{
	DeviceManagerInstance()->LoadDevicePlugins();
}
예제 #6
0
void AddToDeviceShelf( GDevice* pDevice )
{
	DeviceManagerInstance()->AddDeviceToShelf(pDevice);
}
예제 #7
0
GDevice* GetDeviceFromDeviceManager( QString uniqueIdentifierName )
{
	return DeviceManagerInstance()->GetDevice(uniqueIdentifierName);
}