本文整理汇总了C++中ControllerMessage::protocol方法的典型用法代码示例。如果您正苦于以下问题:C++ ControllerMessage::protocol方法的具体用法?C++ ControllerMessage::protocol怎么用?C++ ControllerMessage::protocol使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ControllerMessage
的用法示例。
在下文中一共展示了ControllerMessage::protocol方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: handleSensorMessage
void DeviceManager::handleSensorMessage(const ControllerMessage &msg) {
TelldusCore::MutexLocker sensorListLocker(&d->lock);
Sensor *sensor = 0;
for (std::list<Sensor *>::iterator it = d->sensorList.begin(); it != d->sensorList.end(); ++it) {
TelldusCore::MutexLocker sensorLocker(*it);
if (!TelldusCore::comparei((*it)->protocol(), msg.protocol())) {
continue;
}
if (!TelldusCore::comparei((*it)->model(), msg.model())) {
continue;
}
if ((*it)->id() != msg.getInt64Parameter("id")) {
continue;
}
sensor = *it;
break;
}
if (!sensor) {
sensor = new Sensor(msg.protocol(), msg.model(), msg.getInt64Parameter("id"));
d->sensorList.push_back(sensor);
}
TelldusCore::MutexLocker sensorLocker(sensor);
time_t t = time(NULL);
setSensorValueAndSignal("temp", TELLSTICK_TEMPERATURE, sensor, msg, t);
setSensorValueAndSignal("humidity", TELLSTICK_HUMIDITY, sensor, msg, t);
setSensorValueAndSignal("rainrate", TELLSTICK_RAINRATE, sensor, msg, t);
setSensorValueAndSignal("raintotal", TELLSTICK_RAINTOTAL, sensor, msg, t);
setSensorValueAndSignal("winddirection", TELLSTICK_WINDDIRECTION, sensor, msg, t);
setSensorValueAndSignal("windaverage", TELLSTICK_WINDAVERAGE, sensor, msg, t);
setSensorValueAndSignal("windgust", TELLSTICK_WINDGUST, sensor, msg, t);
}