当前位置: 首页>>代码示例>>C++>>正文


C++ ControllerMessage::getInt64Parameter方法代码示例

本文整理汇总了C++中ControllerMessage::getInt64Parameter方法的典型用法代码示例。如果您正苦于以下问题:C++ ControllerMessage::getInt64Parameter方法的具体用法?C++ ControllerMessage::getInt64Parameter怎么用?C++ ControllerMessage::getInt64Parameter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ControllerMessage的用法示例。


在下文中一共展示了ControllerMessage::getInt64Parameter方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
开发者ID:4ib3r,项目名称:domoticz,代码行数:34,代码来源:DeviceManager.cpp

示例2: decodeData

std::string ProtocolSartano::decodeData(const ControllerMessage &dataMsg) {
	uint64_t allDataIn;
	uint16_t allData = 0;
	unsigned int code = 0;
	unsigned int method1 = 0;
	unsigned int method2 = 0;
	unsigned int method = 0;

	allDataIn = dataMsg.getInt64Parameter("data");

	uint16_t mask = (1<<11);
	for(int i = 0; i < 12; ++i) {
		allData >>= 1;
		if((allDataIn & mask) == 0) {
			allData |= (1<<11);
		}
		mask >>= 1;
	}

	code = allData & 0xFFC;
	code >>= 2;

	method1 = allData & 0x2;
	method1 >>= 1;

	method2 = allData & 0x1;

	if(method1 == 0 && method2 == 1) {
		method = 0;  // off
	} else if(method1 == 1 && method2 == 0) {
		method = 1;  // on
	} else {
		return "";
	}

	if(code > 1023) {
		// not sartano
		return "";
	}

	std::stringstream retString;
	retString << "class:command;protocol:sartano;model:codeswitch;code:";
	mask = (1<<9);
	for(int i = 0; i < 10; i++) {
		if((code & mask) != 0) {
			retString << 1;
		} else {
			retString << 0;
		}
		mask >>= 1;
	}
	retString << ";method:";

	if(method == 0) {
		retString << "turnoff;";
	} else {
		retString << "turnon;";
	}

	return retString.str();
}
开发者ID:4ib3r,项目名称:domoticz,代码行数:61,代码来源:ProtocolSartano.cpp


注:本文中的ControllerMessage::getInt64Parameter方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。