本文整理汇总了C++中Endpoint::getUnitType方法的典型用法代码示例。如果您正苦于以下问题:C++ Endpoint::getUnitType方法的具体用法?C++ Endpoint::getUnitType怎么用?C++ Endpoint::getUnitType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Endpoint
的用法示例。
在下文中一共展示了Endpoint::getUnitType方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sendMessage
Network::msg_l3_status_t BaseRFApplication::sendMetaReportEndpoint(univmsg_l7_any_t* msg, uint8_t flags, bool cmd_mc_last,
uint8_t clusterID, uint8_t endpointID) {
MW_LOG_DEBUG_TRACE(MW_LOG_BASERF);
bool allEndpoints = flags & BASERF_CMD_METAFLAG_ALL_ENDPOINTS;
uint8_t nextEndpointID = allEndpoints ? 0 : endpointID;
Cluster* cluster = m_device->getCluster(clusterID);
uint8_t lastEndpointID = allEndpoints ? cluster->getEndpointCount() - 1 : endpointID;
Network::msg_l3_status_t result = ERROR_INVALID_DATA;
Endpoint* nextEndpoint = cluster->getEndpoint(nextEndpointID);
do {
msg->data[2] = clusterID;
msg->data[3] = nextEndpointID;
uint16_t temp = nextEndpoint->getType();
msg->data[4] = (temp >> 8) & 0xFF;
msg->data[5] = (temp >> 0) & 0xFF;
temp = nextEndpoint->getUnitType();
msg->data[6] = (temp >> 8) & 0xFF;
msg->data[7] = (temp >> 0) & 0xFF;
msg->msg_header.cmd_id = BASERF_CMD_META_ENDPOINT_REP;
//about the cmd_mc flag:
//a) if cmd_mc_last is false then we are not the last reporter and all our reports have it as true
//a) if cmd_mc_last is true then we are the last reporter in the chain and then:
//b.1) if we are sending just one endpoint report then it is false
//b.2) if we are sending report for all endpoints then it is true for all but the last one
msg->msg_header.cmd_mc = cmd_mc_last ? (allEndpoints ? (nextEndpointID == lastEndpointID) : false) : true;
msg->msg_header.seq_meta = true;
msg->msg_header.dataLen = 8;
result = sendMessage(msg);
MW_LOG_DEBUG_TRACE(MW_LOG_BASERF) << PSTR("result=") << result;
if ( result < Meshwork::L3::Network::OK )
break;
} while ( ++nextEndpointID <= lastEndpointID );
MW_LOG_DEBUG_TRACE(MW_LOG_BASERF) << PSTR("result=") << result;
return result;
}