本文整理汇总了C++中DeviceManager::getDeviceById方法的典型用法代码示例。如果您正苦于以下问题:C++ DeviceManager::getDeviceById方法的具体用法?C++ DeviceManager::getDeviceById怎么用?C++ DeviceManager::getDeviceById使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DeviceManager
的用法示例。
在下文中一共展示了DeviceManager::getDeviceById方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getDevice
//--------------------------------------------------------------
Device* Animation::getDevice(string deviceId)
{
DeviceManager* pDeviceManager = GLOBALS->mp_deviceManager;
if (pDeviceManager)
{
return pDeviceManager->getDeviceById(deviceId);
}
return 0;
}
示例2: update
//--------------------------------------------------------------
void oscReceiver::update()
{
DeviceManager* pDeviceManager = Globals::instance()->mp_deviceManager;
if (hasWaitingMessages())
{
while(getNextMessage(&m_oscMessage))
{
int indexArg = 0;
if (m_oscMessage.getAddress() == OSC_ADDRESS_SET_DEVICE_PROP)
{
Device* pDevice = pDeviceManager->getDeviceById( m_oscMessage.getArgAsString(indexArg++) );
if (pDevice)
{
// Property
string propName = m_oscMessage.getArgAsString(indexArg++);
if (propName == "volMax")
{
pDevice->setSoundInputVolumeMaxOSC( m_oscMessage.getArgAsFloat(indexArg) );
}
else
if (propName == "volHistorySize")
{
pDevice->setSoundInputVolHistorySizeOSC( m_oscMessage.getArgAsInt32(indexArg) );
}
else
if (propName == "volHistoryTh")
{
pDevice->setSoundInputVolHistoryThOSC( m_oscMessage.getArgAsFloat(indexArg) );
}
else
if (propName == "enableStandbyMode")
{
pDevice->setEnableStandbyModeOSC( m_oscMessage.getArgAsInt32(indexArg)==1 ? true : false );
}
else
if (propName == "timeStandby")
{
//printf("timeStandby = %.3f - ", m_oscMessage.getArgAsFloat(indexArg));
pDevice->setTimeStandbyOSC( m_oscMessage.getArgAsFloat(indexArg) );
}
else
if (propName == "sampleVolStandby")
{
pDevice->setSampleVolumeStandbyOSC( m_oscMessage.getArgAsFloat(indexArg) );
}
else
if (propName == "nbLEDsStandby")
{
// pDevice->setNbLEDsStandbyOSC( m_oscMessage.getArgAsInt32(indexArg) );
}
else
if (propName == "speedStandby")
{
// pDevice->setSpeedStandbyOSC( m_oscMessage.getArgAsFloat(indexArg) );
}
}
}
else
if (m_oscMessage.getAddress() == OSC_ADDRESS_SEND_PACKETS)
{
if (pDeviceManager)
{
string deviceId = m_oscMessage.getArgAsString(indexArg++);
Device* pDevice = pDeviceManager->getDeviceById( deviceId );
// Not found, create the device now
if (pDevice == 0)
{
// TODO : type ? -> factory
if (Globals::instance()->mp_app->isSimulation == false)
{
int nbLEDs = m_oscMessage.getNumArgs() - indexArg; // WARNING with this
printf("> New Device found ! id=%s, nbLEDs=%d\n", deviceId.c_str(), nbLEDs);
DeviceEcho* pDeviceEcho = new DeviceEcho(deviceId, nbLEDs, 4.0f/float(nbLEDs-1));
pDeviceEcho->setupSenderOSC(m_oscMessage.getRemoteIp(), 1235);
pDeviceEcho->loadXML("Config/devices/");
// Add device to list
pDeviceManager->addDevice(pDeviceEcho);
// TEMP / TODO : attach to surface main
if (Globals::instance()->mp_app->mp_surfaceMain)
Globals::instance()->mp_app->mp_surfaceMain->addDevice(pDeviceEcho);
// Create a node in visualisation scene
Globals::instance()->mp_app->createDeviceNodeInScene(pDeviceEcho);
// Update interface
//Globals::instance()->mp_app->guiMarkUpdateLayout();
Globals::instance()->mp_app->guiUpdateListDevices();
Globals::instance()->mp_app->selectDevice(pDeviceEcho->m_id);
//.........这里部分代码省略.........