本文整理汇总了C++中Sensor::getName方法的典型用法代码示例。如果您正苦于以下问题:C++ Sensor::getName方法的具体用法?C++ Sensor::getName怎么用?C++ Sensor::getName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sensor
的用法示例。
在下文中一共展示了Sensor::getName方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getAllSensors
void GUIServer::getAllSensors() {
//errorcode 0
m_UdpServer.write((uint8_t) 0);
//num of sensors
m_UdpServer.write((uint8_t) __aquaduino->getNrOfSensors());
//Serial.println("NrOfSensors()");
// Serial.println(__aquaduino->getNrOfSensors());
//sensor information
Sensor* sensor;
__aquaduino->resetSensorIterator();
while (__aquaduino->getNextSensor(&sensor) != -1) {
m_UdpServer.write(__aquaduino->getSensorID(sensor));
//Name:String
m_UdpServer.write(strlen(sensor->getName()));
m_UdpServer.write(sensor->getName());
//Type:int
m_UdpServer.write(sensor->getType());
//Unit:String
m_UdpServer.write((uint8_t) 8);
m_UdpServer.write("TestUnit");
//visible:Boolean
m_UdpServer.write(true);
//calibrationInterval(days):int
m_UdpServer.write((uint8_t) 0);
}
}
示例2: addSensor
int SensorsList::addSensor(const Sensor& sensor)
{
Sensor *newSensor = sensor.clone();
if( ! newSensor->isValid() )
{
std::cerr << "[ERR] SensorsTree::addSensor error : sensor " << sensor.getName()
<< " isValid() method returns false" << std::endl;
delete newSensor;
return -1;
}
if( !(newSensor->getSensorType() >= 0 && newSensor->getSensorType() < NR_OF_SENSOR_TYPES) )
{
std::cerr << "[ERR] SensorsTree::addSensor error : sensor " << sensor.getName()
<< " has an unknown sensor type " << newSensor->getSensorType() << std::endl;
delete newSensor;
return -1;
}
this->pimpl->VecSensors[newSensor->getSensorType()].push_back(newSensor);
int new_index = this->pimpl->VecSensors[newSensor->getSensorType()].size()-1;
this->pimpl->NamesSensors[newSensor->getSensorType()].insert(std::pair<std::string,int>(newSensor->getName(),new_index));
return new_index;
}
示例3: setupSensors
QWidget* GUI::setupSensors() {
QWidget* sensorList = new QWidget;
QVBoxLayout* sensorListLayout = new QVBoxLayout;
sensorList->setLayout(sensorListLayout);
sensorListLayout->addWidget(new QLabel("Sensors"));
std::map<std::string, Sensor*> sensors = this->entityHandler->sensors;
for(auto o : sensors) {
Sensor* s = o.second;
QWidget* sensorRow = new QWidget;
QHBoxLayout* sensorRowLayout = new QHBoxLayout;
sensorRow->setLayout(sensorRowLayout);
/*
std::ostringstream buff;
buff << s->getValue();
QLabel* sensorValueLabel = new QLabel(buff.str().c_str());
sensorRowLayout->addWidget(sensorValueLabel);
*/
sensorRowLayout->addWidget(new QLabel(s->getName().c_str()));
sensorListLayout->addWidget(sensorRow);
}
return sensorList;
}
示例4: assert
Sensor * BlueprintInstance::detachSensor(unsigned int i)
{
assert(i < mSensorList.size());
Sensor * detached = mSensorList[i];
// detach from list
mSensorList.erase(mSensorList.begin() + i);
// detach from map
map<string, Sensor*>::iterator iter =
mSensorMap.find(detached->getName());
mSensorMap.erase(iter);
return detached;
}