本文整理汇总了C++中DeviceManager类的典型用法代码示例。如果您正苦于以下问题:C++ DeviceManager类的具体用法?C++ DeviceManager怎么用?C++ DeviceManager使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了DeviceManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetManager
bool
RedundantDataPath::IsAValidConfiguration( U32 &errorString ){
// the connection # check
if( (GetChildCount() > 2) || (GetChildCount() < 1 ) ){
errorString = CTS_SSAPI_CM_INVALID_CONN_COUNT_FOR_RDP;
return false;
}
// must belong to the same host
HostManager *pHM = (HostManager *)GetObjectManager( GetManager(), SSAPI_MANAGER_CLASS_TYPE_HOST_MANAGER );
if( !pHM->DoConnectionsBelongToSameHost( m_children ) ){
errorString = CTS_SSAPI_CM_CONN_MUST_BELONG_2_SAME_HOST;
return false;
}
// must map to a single primary/fail-over IOP pair
if( GetChildCount() == 2 ){
DeviceManager *pDM = (DeviceManager *)GetObjectManager(GetManager(), SSAPI_MANAGER_CLASS_TYPE_DEVICE_MANAGER );
ConnectionManager *pCM = (ConnectionManager *)GetManager();
DesignatorId id1 = GetChildIdAt( 0 ), id2 = GetChildIdAt( 1 );
id1 = ((ConnectionBase *)pCM->GetManagedObject( &id1 ))->GetGeminiPortId();
id2 = ((ConnectionBase *)pCM->GetManagedObject( &id2 ))->GetGeminiPortId();
if( !pDM->AreThesePortsOnPartneredNacs( id1, id2 ) ){
errorString = CTS_SSAPI_CM_CONN_MUST_BE_ON_PARTNER_NACS;
return false;
}
}
// we made it to here? Gee, it's good then!!!
return true;
}
示例2: getDeviceGroupIdList
/*
* ===================================================================
* Device Emulation
* ===================================================================
* XXX: Streams and Devices are largely non-overlapping from a RPC
* point of view but they *do* intersect e.g. when a stream is trying to
* find its associated device and info from that device such as src/dst
* mac addresses. For this reason, both set of RPCs share the common
* port level locking
* ===================================================================
*/
void MyService::getDeviceGroupIdList(
::google::protobuf::RpcController* controller,
const ::OstProto::PortId* request,
::OstProto::DeviceGroupIdList* response,
::google::protobuf::Closure* done)
{
DeviceManager *devMgr;
int portId;
qDebug("In %s", __PRETTY_FUNCTION__);
portId = request->id();
if ((portId < 0) || (portId >= portInfo.size()))
goto _invalid_port;
devMgr = portInfo[portId]->deviceManager();
response->mutable_port_id()->set_id(portId);
portLock[portId]->lockForRead();
for (int i = 0; i < devMgr->deviceGroupCount(); i++)
{
OstProto::DeviceGroupId *dgid;
dgid = response->add_device_group_id();
dgid->CopyFrom(devMgr->deviceGroupAtIndex(i)->device_group_id());
}
portLock[portId]->unlock();
done->Run();
return;
_invalid_port:
controller->SetFailed("Invalid Port Id");
done->Run();
}
示例3: DeviceManager
int INDIMenu::processClient(QString hostname, QString portnumber)
{
DeviceManager *dev;
INDIDriver *drivers = ksw->getINDIDriver();
dev = new DeviceManager(this, mgrCounter);
if (dev->indiConnect(hostname, portnumber))
{
mgr.append(dev);
if (drivers)
{
connect(dev, SIGNAL(newDevice()), drivers, SLOT(updateMenuActions()));
connect(dev, SIGNAL(newDevice()), this, SLOT(discoverDevice()));
}
}
else
{
delete (dev);
return (-1);
}
mgrCounter++;
return (mgrCounter - 1);
}
示例4: deviceConnected
void IosDeviceManager::deviceConnected(const QString &uid, const QString &name)
{
DeviceManager *devManager = DeviceManager::instance();
Core::Id baseDevId(Constants::IOS_DEVICE_ID);
Core::Id devType(Constants::IOS_DEVICE_TYPE);
Core::Id devId = baseDevId.withSuffix(uid);
IDevice::ConstPtr dev = devManager->find(devId);
if (dev.isNull()) {
IosDevice *newDev = new IosDevice(uid);
if (!name.isNull())
newDev->setDisplayName(name);
qCDebug(detectLog) << "adding ios device " << uid;
devManager->addDevice(IDevice::ConstPtr(newDev));
} else if (dev->deviceState() != IDevice::DeviceConnected &&
dev->deviceState() != IDevice::DeviceReadyToUse) {
qCDebug(detectLog) << "updating ios device " << uid;
IosDevice *newDev = 0;
if (dev->type() == devType) {
const IosDevice *iosDev = static_cast<const IosDevice *>(dev.data());
newDev = new IosDevice(*iosDev);
} else {
newDev = new IosDevice(uid);
}
devManager->addDevice(IDevice::ConstPtr(newDev));
}
updateInfo(uid);
}
示例5: getDeviceNeighbors
void MyService::getDeviceNeighbors(
::google::protobuf::RpcController* controller,
const ::OstProto::PortId* request,
::OstProto::PortNeighborList* response,
::google::protobuf::Closure* done)
{
DeviceManager *devMgr;
int portId;
qDebug("In %s", __PRETTY_FUNCTION__);
portId = request->id();
if ((portId < 0) || (portId >= portInfo.size()))
goto _invalid_port;
devMgr = portInfo[portId]->deviceManager();
response->mutable_port_id()->set_id(portId);
portLock[portId]->lockForRead();
devMgr->getDeviceNeighbors(response);
portLock[portId]->unlock();
done->Run();
return;
_invalid_port:
controller->SetFailed("Invalid Port Id");
done->Run();
}
示例6: Q_UNUSED
bool DeviceCheckBuildStep::init(QList<const BuildStep *> &earlierSteps)
{
Q_UNUSED(earlierSteps);
IDevice::ConstPtr device = DeviceKitInformation::device(target()->kit());
if (!device) {
Core::Id deviceTypeId = DeviceTypeKitInformation::deviceTypeId(target()->kit());
IDeviceFactory *factory = IDeviceFactory::find(deviceTypeId);
if (!factory || !factory->canCreate()) {
emit addOutput(tr("No device configured."), BuildStep::ErrorMessageOutput);
return false;
}
QMessageBox msgBox(QMessageBox::Question, tr("Set Up Device"),
tr("There is no device set up for this kit. Do you want to add a device?"),
QMessageBox::Yes|QMessageBox::No);
msgBox.setDefaultButton(QMessageBox::Yes);
if (msgBox.exec() == QMessageBox::No) {
emit addOutput(tr("No device configured."), BuildStep::ErrorMessageOutput);
return false;
}
IDevice::Ptr newDevice = factory->create(deviceTypeId);
if (newDevice.isNull()) {
emit addOutput(tr("No device configured."), BuildStep::ErrorMessageOutput);
return false;
}
DeviceManager *dm = DeviceManager::instance();
dm->addDevice(newDevice);
DeviceKitInformation::setDevice(target()->kit(), newDevice);
}
return true;
}
示例7: setProxy
SystemEngine::SystemEngine()
{
setProxy();
RemoteStorage::initialize();
DriverManager::initialize();
DeviceManager::initialize();
WatcherManager::initialize();
RemoteStorage *storage = RemoteStorage::instance();
DeviceManager *devManager = DeviceManager::instance();
if (storage)
{
_lastId = -1;
if (devManager)
{
connect(devManager, SIGNAL(newMessageReceived(const IMessage*)),
storage, SLOT(dispatchMessage(const IMessage*)));
devManager->loadDevices();
}
qDebug(">> Fetching pending messages from main server ...");
MessageList pendingMessages(storage->pendingMessages());
foreach (const IMessage *message, pendingMessages)
{
redirectMessage(message);
}
}
示例8: getDeviceCurrent
//--------------------------------------------------------------
Device* Animation::getDeviceCurrent()
{
DeviceManager* pDeviceManager = GLOBALS->mp_deviceManager;
if (pDeviceManager)
{
return pDeviceManager->getDeviceCurrent();
}
return 0;
}
示例9: getDevice
//--------------------------------------------------------------
Device* Animation::getDevice(string deviceId)
{
DeviceManager* pDeviceManager = GLOBALS->mp_deviceManager;
if (pDeviceManager)
{
return pDeviceManager->getDeviceById(deviceId);
}
return 0;
}
示例10: unregisterDevice
bool Device::unregisterDevice() {
DeviceManager* manager = DeviceManager::getInstance();
if (manager->unregisterDevice(getId())) {
this->setId(-1);
return true;
} else {
return false;
}
}
示例11: tr
QString IosRunConfiguration::disabledReason() const
{
if (m_parseInProgress)
return tr("The .pro file \"%1\" is currently being parsed.")
.arg(QFileInfo(m_profilePath).fileName());
if (!m_parseSuccess)
return static_cast<QmakeProject *>(target()->project())
->disabledReasonForRunConfiguration(m_profilePath);
Core::Id devType = DeviceTypeKitInformation::deviceTypeId(target()->kit());
if (devType != Constants::IOS_DEVICE_TYPE && devType != Constants::IOS_SIMULATOR_TYPE)
return tr("Kit has incorrect device type for running on iOS devices.");
IDevice::ConstPtr dev = DeviceKitInformation::device(target()->kit());
QString validDevName;
bool hasConncetedDev = false;
if (devType == Constants::IOS_DEVICE_TYPE) {
DeviceManager *dm = DeviceManager::instance();
for (int idev = 0; idev < dm->deviceCount(); ++idev) {
IDevice::ConstPtr availDev = dm->deviceAt(idev);
if (!availDev.isNull() && availDev->type() == Constants::IOS_DEVICE_TYPE) {
if (availDev->deviceState() == IDevice::DeviceReadyToUse) {
validDevName += QLatin1Char(' ');
validDevName += availDev->displayName();
} else if (availDev->deviceState() == IDevice::DeviceConnected) {
hasConncetedDev = true;
}
}
}
}
if (dev.isNull()) {
if (!validDevName.isEmpty())
return tr("No device chosen. Select %1.").arg(validDevName); // should not happen
else if (hasConncetedDev)
return tr("No device chosen. Enable developer mode on a device."); // should not happen
else
return tr("No device available.");
} else {
switch (dev->deviceState()) {
case IDevice::DeviceReadyToUse:
break;
case IDevice::DeviceConnected:
return tr("To use this device you need to enable developer mode on it.");
case IDevice::DeviceDisconnected:
case IDevice::DeviceStateUnknown:
if (!validDevName.isEmpty())
return tr("%1 is not connected. Select %2?")
.arg(dev->displayName(), validDevName);
else if (hasConncetedDev)
return tr("%1 is not connected. Enable developer mode on a device?")
.arg(dev->displayName());
else
return tr("%1 is not connected.").arg(dev->displayName());
}
}
return RunConfiguration::disabledReason();
}
示例12: main
int main(int argc, char *argv[])
{
QApplication::setGraphicsSystem("raster");
QApplication a(argc, argv);
QTextCodec::setCodecForTr(QTextCodec::codecForLocale());
QString privatePathQt(QApplication::applicationDirPath());
QString path(privatePathQt);
path = QDir::toNativeSeparators(path);
Server server;
if (!server.listen(QHostAddress::Any, 6177)) {
std::cerr << "Failed to bind to port" << std::endl;
return 1;
}
QDeclarativeView view;
view.engine()->setOfflineStoragePath(path);
QObject::connect((QObject*)view.engine(), SIGNAL(quit()), &a, SLOT(quit()));
view.setSource(QUrl("qrc:/qml/main.qml"));
view.show();
QString md5;
QString dbname="DemoDB";
QByteArray ba;
ba = QCryptographicHash::hash (dbname.toAscii(), QCryptographicHash::Md5);
md5.append(ba.toHex());
md5.append(".sqlite");
path.append(QDir::separator()).append("Databases");
path.append(QDir::separator()).append(md5);
QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE");
db.setDatabaseName(path);
if (!db.open()) {
std::cerr << "Cannot open database" << std::endl;
return 1;
}
OrderManager orderManager;
view.rootContext()->setContextProperty("server", &server);
view.rootContext()->setContextProperty("orderManager", &orderManager);
Client client;
QObject::connect(&orderManager, SIGNAL(send()), &client, SLOT(sendOrder()));
QObject::connect(&server, SIGNAL(paied(quint32)), &orderManager, SLOT(payOrder(quint32)));
DeviceManager deviceManager;
QObject::connect(&deviceManager, SIGNAL(registerSignal()), &client, SLOT(sendRegistration()));
view.rootContext()->setContextProperty("deviceManager", &deviceManager);
deviceManager.registerDevice();
return a.exec();
}
示例13: main
int
main(int argc, char **argv)
{
/*Load Plugins*/
DeviceManager *deviceManager = new DeviceManager("ReceiveTestApp");
deviceManager->pluginLoad("Plugins");
deviceManager->pluginSetCommParameter("Minuit", "pluginReceptionPort", "9998");
deviceManager->pluginSetCommParameter("OSC", "pluginReceptionPort", "9999");
deviceManager->pluginLaunch();
cout << endl;
vector<string> plugins = deviceManager->pluginGetLoadedByName();
cout << "Current loaded plugins : " << endl;
for (int i = 0; i < plugins.size(); i++) {
cout << plugins.at(i) << endl;
}
cout << endl;
/***************/
/*Add Devices(1 Minuit device)*/
std::map<std::string, std::string> *deviceParameters = new std::map<std::string, std::string>;
deviceParameters->insert(std::pair<std::string, std::string>("ip", "127.0.0.1"));
deviceParameters->insert(std::pair<std::string, std::string>("port", "7002"));
deviceManager->deviceAdd("SendTestApp", "Minuit", deviceParameters);
/*Display Device names*/
map<string, Device*> *devices = deviceManager->deviceGetCurrent();
cout << "Current devices : " << endl;
map<string, Device*>::iterator it = devices->begin();
while(it != devices->end()){
cout << it->first << endl;
it++;
}
cout << endl;
/***************/
/*test receiveMessage*/
deviceManager->namespaceSetAddCallback(NULL, &receiveCallBack);
cout << "Waiting message..." << endl;
while (true) {
usleep(1000);
}
/***************/
delete devices;
delete deviceParameters;
delete deviceManager;
return EXIT_SUCCESS;
}
示例14: addDeviceGroup
void MyService::addDeviceGroup(
::google::protobuf::RpcController* controller,
const ::OstProto::DeviceGroupIdList* request,
::OstProto::Ack* /*response*/,
::google::protobuf::Closure* done)
{
DeviceManager *devMgr;
int portId;
qDebug("In %s", __PRETTY_FUNCTION__);
portId = request->port_id().id();
if ((portId < 0) || (portId >= portInfo.size()))
goto _invalid_port;
devMgr = portInfo[portId]->deviceManager();
if (portInfo[portId]->isTransmitOn())
goto _port_busy;
portLock[portId]->lockForWrite();
for (int i = 0; i < request->device_group_id_size(); i++)
{
quint32 id = request->device_group_id(i).id();
const OstProto::DeviceGroup *dg = devMgr->deviceGroup(id);
// If device group with same id as in request exists already ==> error!
if (dg)
continue; //! \todo (LOW): Partial status of RPC
devMgr->addDeviceGroup(id);
}
portLock[portId]->unlock();
//! \todo (LOW): fill-in response "Ack"????
done->Run();
return;
_port_busy:
controller->SetFailed("Port Busy");
goto _exit;
_invalid_port:
controller->SetFailed("invalid portid");
_exit:
done->Run();
}
示例15: main
int main()
{
DeviceManager devManager;
devManager.scanDevices();
for(auto &dev: devManager){
dev->setPadReceiver(&padReceiver);
dev->print();
}
devManager.loop();
getchar();
return 0;
}