Service *Action::getService() { CyberXML::Node *node = getServiceNode(); ServiceData *data = (ServiceData *)node->getUserData(); if (data == NULL) return NULL; return data->getService(); }
void plugin::requestProperties(int sessionid) { Q_UNUSED(sessionid); changeProperty(ServiceData::createModelReset("udpio.sensor", "sensorid").getData()); if (m_read) { ServiceData sc = ServiceData::createModelChangeItem("udpio.sensor"); for (int id=0;id<m_sensors.size();++id) { sc.setData("sensorid", id); sc.setData("value", m_sensors[id]); changeProperty(sc.getData()); } } return l; }
void plugin::watchpinChanged(const unsigned char port, const unsigned char pinmask) { qDebug() << "WATCH PIN CHANGED" << port << pinmask; ServiceData sc = ServiceData::createModelChangeItem("udpio.sensor"); for (int i=0;i<8;++i) { bool newvalue = (1 << i) & pinmask; if (!m_read || m_sensors[i] != newvalue) { m_sensors[i] = newvalue; sc.setData("sensorid", i); sc.setData("value", m_sensors[i]); changeProperty(sc.getData()); m_events.triggerEvent(i, m_serverCollectionController); } } m_read = true; }
void ServiceManager::prepareServices(const string& serviceFiles) { #ifdef DEBUG Logger::debug2() << "ServiceManager: in prepareServices, serviceFiles= '" << serviceFiles << "'" << endl; #endif stringstream sstr; sstr << serviceFiles; string servFile; // read all service files while( sstr >> servFile ) { #ifdef DEBUG Logger::debug3() << "ServiceManager: processing file " << servFile << endl; #endif ServiceData::Reader reader(servFile); while (reader.MoreData()) { ServiceData data = reader.ReadData(); #ifdef DEBUG Logger::debug3() << "ServiceManager: preparing service, data=" << data << endl; #endif // get input object and fill it with data boost::shared_ptr<Input> input = fInputHandler.createInput( data.getClassType(), data.getProfileId(), data.getData() ); SMART_ASSERT( input ); // store the info for later use pair<ServiceInfoMap::iterator, bool> insRes = fServiceInfoMap.insert( make_pair( data.getName(), ServiceInfoItem(data.getClassType(), input) ) ); if( !insRes.second ) { Logger::warn() << "ServiceManager: service with name '" << data.getName() << "' (ClassType=" << data.getClassType() << ") collides with another" << endl; } } // while(MoreData) } // (filenames) }
void plugin::requestProperties(int sessionid) { Q_UNUSED(sessionid); { ServiceData sc = ServiceData::createNotification(PLUGIN_ID, "pulse.version" ); sc.setData("protocol", getProtocolVersion()); sc.setData("server", getServerVersion()); changeProperty(sc.getData()); } { ServiceData sc = ServiceData::createModelReset( "pulse.channels", "sinkid" ); changeProperty(sc.getData()); } QList<PulseChannel> channels = getAllChannels(); foreach(PulseChannel channel, channels) { ServiceData sc = ServiceData::createModelChangeItem( "pulse.channels" ); sc.setData("sinkid", channel.sinkid); sc.setData("mute", channel.mute); sc.setData("volume", channel.volume); changeProperty(sc.getData()); }