Example #1
0
void frmnodeMCU::readSettingnodeMCU(int row)
{
    nodeMCU mcu;
    mcu = twc->readSettingnodeMCU(row);
    //qDebug()<<"active "+mcu.Active;

    ui->txtControl1->setText(mcu.Control1);
    ui->txtControl2->setText(mcu.Control2);
    ui->txtControl3->setText(mcu.Control3);
    ui->txtControl4->setText(mcu.Control4);
    ui->txtControl5->setText(mcu.Control5);
    ui->txtControlPort1->setText(mcu.ControlPort1);
    ui->txtControlPort2->setText(mcu.ControlPort2);
    ui->txtControlPort3->setText(mcu.ControlPort3);
    ui->txtControlPort4->setText(mcu.ControlPort4);
    ui->txtControlPort5->setText(mcu.ControlPort5);
    ui->txtDesc->setText(mcu.Description);
    ui->txtId->setText(mcu.Id);
    ui->txtSensor1->setText(mcu.Sensor1);
    ui->txtSensor2->setText(mcu.Sensor2);
    ui->txtSensor3->setText(mcu.Sensor3);
    ui->txtSensor4->setText(mcu.Sensor4);
    ui->txtSensor5->setText(mcu.Sensor5);
    ui->txtSensorPort1->setText(mcu.SensorPort1);
    ui->txtSensorPort2->setText(mcu.SensorPort2);
    ui->txtSensorPort3->setText(mcu.SensorPort3);
    ui->txtSensorPort4->setText(mcu.SensorPort4);
    ui->txtSensorPort5->setText(mcu.SensorPort5);
    genId();
}
LinkLocal::Stream::Stream(Jid jidLocal, BSocket *bs) : jidLocal_(jidLocal), bs_(bs), root(NULL) {
	state = Idle;
	inUse = true;
	proto = new CoreProtocol();
	proto->reset();
	proto->startClientIn(genId(),true);
	connect(bs_, SIGNAL(readyRead()), SLOT(bs_readyRead()));
}
Example #3
0
      void CDatabase::loadParsedDatabase(const pugi::xml_document &doc)
      {
         LOG4CPLUS_TRACE_METHOD(msLogger, __PRETTY_FUNCTION__ );

         mApplications.clear();
         pugi::xml_node appMan = doc.child("app-man");
         pugi::xml_node applications = appMan.child("applications");
         for (pugi::xml_node_iterator it = applications.begin(); it != applications.end(); ++it)
         {
            LOG4CPLUS_INFO(msLogger, "it->name : " + std::string(it->name()));
            if (strcmp(it->name(), "app"))
            {
               continue;
            }
            LOG4CPLUS_INFO(msLogger, "it->child_value(launch-info) : " + std::string(it->child_value("launch-info")));
            std::string trimmedLaunchInfo = mLaunchInfoProcessor->trimLaunchInfo(it->child_value("launch-info"));
            CApplication app(trimmedLaunchInfo);
            LOG4CPLUS_INFO(msLogger, "launch-info : " + trimmedLaunchInfo);
            if (hasAppWithNoLocks(app.launchInfo()))
            {
               LOG4CPLUS_WARN(msLogger, "!!! Application launch info repetition !!!");
               continue;
            }

            if (!mLaunchInfoProcessor->isLaunchInfoValid(app.launchInfo()))
            {
               LOG4CPLUS_ERROR(msLogger, "!!! LAUNCHINFO IS NOT VALID !!!");
               continue;
            }
            else
            {
               LOG4CPLUS_INFO(msLogger, "launchinfo is valid: " + app.launchInfo());
            }
            int id = genId();
            mApplications[id] = app;

            pugi::xml_node services = it->child("services");

            for (pugi::xml_node_iterator srv = services.begin();
                  services.end() != srv; ++srv)
            {
               if (strcmp(srv->name(),"service") || !strcmp(srv->name(), ""))
               {
                  continue;
               }
               std::string uid(srv->attribute("uid").value());
               LOG4CPLUS_INFO(msLogger, "service UID: " + uid);
               mApplications[id].addService(Service::Uid(uid));
            }
         }
      }
Example #4
0
      int CDatabase::addApp(const std::string & launchInfo, const std::list<Service::Uid> & services)
      {
         LOG4CPLUS_TRACE_METHOD(msLogger, __PRETTY_FUNCTION__ );

         std::string trimmedLaunchInfo = mLaunchInfoProcessor->trimLaunchInfo(launchInfo);
         if (hasApp(trimmedLaunchInfo))
         {
            return -1;
         }

         mpMutex->lock();
         int id = genId();
         mApplications[id] = CApplication(trimmedLaunchInfo, services);
         saveWithNoLocks();
         mpMutex->unlock();
         return id;
      }
Example #5
0
 void CDatabase::addApplicationAndServices(const std::string& launchInfo, const std::list<Service::Uid> & services)
 {
    LOG4CPLUS_TRACE_METHOD(msLogger, __PRETTY_FUNCTION__ );
    bool needSave = false;
    std::string trimmedLaunchInfo = mLaunchInfoProcessor->trimLaunchInfo(launchInfo);
    if (!mLaunchInfoProcessor->isLaunchInfoValid(trimmedLaunchInfo))
    {
       LOG4CPLUS_WARN(msLogger, "Invalid launch info provided: " + trimmedLaunchInfo);
       return;
    }
    mpMutex->lock();
    if (!hasAppWithNoLocks(trimmedLaunchInfo))
    {
       LOG4CPLUS_INFO(msLogger, "addApplicationAndServices(): a new application! " + trimmedLaunchInfo);
       needSave = true;
       int id = genId();
       mApplications[id] = CApplication(trimmedLaunchInfo);
    }
    else
    {
       LOG4CPLUS_INFO(msLogger, "addApplicationAndServices(): application already registered! " + trimmedLaunchInfo);
    }
    std::map<int, CApplication>::iterator appsIterator;
    for ( appsIterator = mApplications.begin(); mApplications.end() != appsIterator; ++appsIterator)
    {
       if (appsIterator->second.launchInfo() == trimmedLaunchInfo)
       {
          break;
       }
    }
    std::list<Service::Uid>::const_iterator servicesIterator;
    for (servicesIterator = services.begin(); servicesIterator != services.end(); servicesIterator ++)
    {
       LOG4CPLUS_INFO(msLogger, "addApplicationAndServices(): service " + (*servicesIterator).value());
       needSave = appsIterator->second.addService(*servicesIterator) || needSave;
    }
    if (needSave)
    {
       LOG4CPLUS_INFO(msLogger, "addApplicationAndServices(): database changed! " + trimmedLaunchInfo);
       saveWithNoLocks();
    }
    mpMutex->unlock();
 }
 CError CAppManPmpIpcClient::applicationRequest(iviLink::Service::SessionUid session, iviLink::Service::Uid service)
 {
    LOG4CPLUS_TRACE_METHOD(msLogger, __PRETTY_FUNCTION__);
    UInt32 type = 0;
    UInt32 size = sizeof(type) + sizeof(size);
    size += stringInBufSize(session.value());
    size += stringInBufSize(service.value());
    UInt8 * buf = new UInt8[size];
    memcpy(buf,&size,sizeof(size));
    UInt32 pos = sizeof(size);
    memcpy(buf+pos,&type,sizeof(type));
    pos += sizeof(type);
    stringToBuffer(session.value(),buf+pos,false);
    pos += stringInBufSize(session.value());
    stringToBuffer(service.value(),buf+pos,false);
    UInt8 * resp = new UInt8[1];
    UInt32 rSize;
    CError err = mpIpc->request(genId(),buf,size,resp,rSize);
    delete [] buf;
    delete [] resp;
    return err;
 }
Example #7
0
Object::Object(const shared_ptr<Class> c) : Object(genId(), c) {}
Example #8
0
Object::Object() : Object(genId(), shared_ptr<Class>(nullptr)) {
  name = genName();
}
Example #9
0
Map::Map(std::string terrainId)
    : _name("Map"), _terrainId(terrainId), _contourInterval(5)
{
    _id = genId();
}
Example #10
0
Map::Map(std::string name, std::string terrainId, int contourInterval)
    : _name(name), _terrainId(terrainId), _contourInterval(contourInterval)
{
    _id = genId();
}
Example #11
0
File: main.cpp Project: CCJY/coliru
 Simple() : id(genId()) {}