void RegisterService::subscribeToPushInitiator(const User& user, const QString& token) { // Keep track of the current user's information so it can be stored later // on a success m_currentUser = user; const Configuration config = m_configurationService.configuration(); QUrl url(config.pushInitiatorUrl() + "/subscribe"); url.addQueryItem("appid",config.providerApplicationId()); url.addQueryItem("address",token); url.addQueryItem("osversion",deviceVersion()); url.addQueryItem("model",deviceModel()); url.addQueryItem("username",user.userId()); url.addQueryItem("password",user.password()); if (config.usingPublicPushProxyGateway()) { url.addQueryItem("type","public"); } else { url.addQueryItem("type","bds"); } qDebug() << "URL: " << url; m_reply = m_accessManager.get(QNetworkRequest(url)); // Connect to the reply finished signal. checkConnectResult(connect(m_reply, SIGNAL(finished()), this, SLOT(httpFinished()))); }
void CompositorLauncher::detectHardware() { // Detect Broadcom bool found = deviceModel().startsWith(QStringLiteral("Raspberry")); if (!found) { QStringList paths = QStringList() << QStringLiteral("/usr/bin/vcgencmd") << QStringLiteral("/opt/vc/bin/vcgencmd") << QStringLiteral("/proc/vc-cma"); found = pathsExist(paths); } if (found) { m_hardware = BroadcomHardware; return; } // TODO: Detect Mali // TODO: Detect Vivante // Detect DRM if (QDir(QStringLiteral("/sys/class/drm")).exists()) { m_hardware = DrmHardware; return; } // Unknown hardware m_hardware = UnknownHardware; }
BtDelegateInquiry::~BtDelegateInquiry() { BOstraceFunctionEntry1( DUMMY_DEVLIST, this ); if (isExecuting()) { deviceModel()->cancelSearchDevice(); } BOstraceFunctionExit0( DUMMY_DEVLIST ); }
// must return an invalid QVariant for cases not handled QVariant DeviceExplorerModel::data(const QModelIndex& index, int role) const { const int col = index.column(); if(col < 0 || col >= (int)Column::Count) { return QVariant(); } const Device::Node& n = nodeFromModelIndex(index); switch((Column)col) { case Column::Name: { if(n.is<Device::AddressSettings>()) return Device::nameColumnData(n, role); else { return Device::deviceNameColumnData( n, deviceModel().list().device(n.get<Device::DeviceSettings>().name), role); } } case Column::Value: return Device::valueColumnData(n, role); case Column::Get: return Device::GetColumnData(n, role); case Column::Set: return Device::SetColumnData(n, role); case Column::Min: return Device::minColumnData(n, role); case Column::Max: return Device::maxColumnData(n, role); case Column::Count: default : ISCORE_ABORT; return {}; } return {}; }
void BtDelegateInquiry::exec( const QVariant& params ) { BOstraceFunctionEntry1( DUMMY_DEVLIST, this ); Q_UNUSED(params); BTUI_ASSERT_X(!isExecuting(), "BtDelegateInquiry::exec", "operation ongoing!"); bool ok(false); setExecuting(true); // Inquiry needs BT to be on. if(!isBtPowerOn()) { mPowerDelegate = new BtDelegatePower(settingModel(), deviceModel(), this); ok = connect( mPowerDelegate, SIGNAL(delegateCompleted(int,BtAbstractDelegate*)), this, SLOT(handleManagePowerCompleted(int))); if (ok ) { mPowerDelegate->exec(QVariant(BtPowerOn)); } } else {
//method called when a drop occurs //return true if drop really handled, false otherwise. // // if dropMimeData returns true && action==Qt::MoveAction, removeRows is called immediately after bool DeviceExplorerModel::dropMimeData(const QMimeData* mimeData, Qt::DropAction action, int row, int column, const QModelIndex& parent) { if(action == Qt::IgnoreAction) { return true; } if(action != Qt::MoveAction && action != Qt::CopyAction) { return false; } if(! mimeData || (! mimeData->hasFormat(iscore::mime::device()) && ! mimeData->hasFormat(iscore::mime::address()))) { return false; } QModelIndex parentIndex; //invalid Device::Node* parentNode = &m_rootNode; QString mimeType = iscore::mime::device(); if(mimeData->hasFormat(iscore::mime::address())) { parentIndex = parent; parentNode = &nodeFromModelIndex(parent); mimeType = iscore::mime::address(); if(parentNode == &m_rootNode) { return false; } } else { ISCORE_ASSERT(mimeData->hasFormat(iscore::mime::device())); ISCORE_ASSERT(mimeType == iscore::mime::device()); } if(parentNode) { // Note : when dropping a device, // if there is an existing device that would use the same ports, etc. // we have to open a dialog to change the device settings. Deserializer<JSONObject> deser{QJsonDocument::fromJson(mimeData->data(mimeType)).object()}; Device::Node n; deser.writeTo(n); if(mimeType == iscore::mime::device()) { ISCORE_ASSERT(n.is<Device::DeviceSettings>()); bool deviceOK = checkDeviceInstantiatable(n.get<Device::DeviceSettings>()); if(!deviceOK) { // We ask the user to fix the incompatibilities by himself. DeviceEditDialog dial{ m_devicePlugin.context().app.components.factory<Device::DynamicProtocolList>(), QApplication::activeWindow()}; if(!tryDeviceInstantiation(n.get<Device::DeviceSettings>(), dial)) return false; } // Perform the loading auto cmd = new Command::LoadDevice{ deviceModel(), std::move(n)}; m_cmdQ.redoAndPush(cmd); } return true; } return false; }