本文整理汇总了C++中Sensor::getSystemName方法的典型用法代码示例。如果您正苦于以下问题:C++ Sensor::getSystemName方法的具体用法?C++ Sensor::getSystemName怎么用?C++ Sensor::getSystemName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sensor
的用法示例。
在下文中一共展示了Sensor::getSystemName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
/**
* Retrieve control information from window and update Light Control
* Returns 'true' if no errors or warnings.
*/
/*private*/ bool AddEditLightDialog::setControlInformation(LightControl* g)
{
// Get control information
if (sensorControl==(typeBox->currentText()))
{
// Set type of control
g->setControlType(Light::SENSOR_CONTROL);
// Get sensor control information
QString sensorName = field1a->text().trimmed();
Sensor* s = NULL;
if (sensorName.length() < 1)
{
// no sensor name entered
g->setControlType(Light::NO_CONTROL);
}
else
{
// name was entered, check for user name first
s = ((ProxySensorManager*)InstanceManager::sensorManagerInstance())->
getByUserName(sensorName);
if (s==NULL)
{
// not user name, try system name
s = ((ProxySensorManager*)InstanceManager::sensorManagerInstance())->
getBySystemName(sensorName);
if (s!=NULL)
{
// update sensor system name in case it changed
sensorName = s->getSystemName();
field1a->setText(sensorName);
}
}
}
int sState = Sensor::ACTIVE;
if ( stateBox->currentText()==(tr("Inactive")) )
{
sState = Sensor::INACTIVE;
}
g->setControlSensorName(sensorName);
g->setControlSensorSense(sState);
if (s==NULL)
{
ui->status1->setText( tr("Error: Sensor could not be provided. Light Control not created.") );
return (false);
}
}
else if (fastClockControl==(typeBox->currentText()))
{
// Set type of control
g->setControlType(Light::FAST_CLOCK_CONTROL);
// read and parse the hours and minutes in the two fields
bool error = false;
int onHour = 0;
int onMin = 0;
int offHour = 0;
int offMin = 0;
bool bOk;
QString s = field1b->text();
if ( (s.length() != 5) || (s.at(2) != ':') )
{
ui->status1->setText( tr("Format error in time entry, please reenter as hh:mm.") );
error = true;
}
if (!error)
{
// try
// {
onHour = s.mid(0,2).toInt(&bOk);
if ( (onHour < 0) || (onHour > 24) )
{
ui->status1->setText( tr("Number out of range in time entry, please reenter as hh:mm.") );
error = true;
}
// }
// catch (Exception e)
if(!bOk)
{
ui->status1->setText( tr("Bad character in time field, please reenter as hh:mm.") );
error = true;
}
}
if (!error)
{
// try {
onMin = s.mid(3,5).toInt(&bOk);
if ( (onMin < 0) || (onMin > 59) )
{
ui->status1->setText( tr("Number out of range in time entry, please reenter as hh:mm.") );
error = true;
}
// }
// catch (Exception e)
if(!bOk)
{
ui->status1->setText( tr("Bad character in time field, please reenter as hh:mm.") );
error = true;
//.........这里部分代码省略.........