本文整理汇总了C++中Endpoint::setProperty方法的典型用法代码示例。如果您正苦于以下问题:C++ Endpoint::setProperty方法的具体用法?C++ Endpoint::setProperty怎么用?C++ Endpoint::setProperty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Endpoint
的用法示例。
在下文中一共展示了Endpoint::setProperty方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: returnACKPayload
//returns 0 for no payload or number of bytes written in the payload buffer
int BaseRFApplication::returnACKPayload(uint8_t src, uint8_t port, void* buf, uint8_t len, void* bufACK, size_t lenACK) {
MW_LOG_DEBUG_TRACE(MW_LOG_BASERF) << PSTR("[ACK] Src=") << src << PSTR(", Len=") << len << endl;
MW_LOG_ARRAY(MW_LOG_BASERF, PSTR("\t...L7 DATA RECV: "), buf, len);
MW_LOG_DEBUG_TRACE(MW_LOG_BASERF) << endl << endl;
setLastMessageValid(false);
if ( src != BASERF_MESSAGE_PORT ) {
return handleCustomReturnACKPayload(src, port, buf, len, bufACK, lenACK);
} else {
m_last_message.msg_header.src = src;
m_last_message.msg_header.port = port;
//3) parse the L7 payload structure (Seq, ID, Data)
getMessageFromData(&m_last_message, len, (uint8_t*) buf);
//3.1) update m_last_recv_request
m_last_recv_request_time = RTT::millis();
//3.2) update m_recv_request_count
m_recv_request_count ++;
if ( m_last_message.msg_header.cmd_id == BASERF_CMD_PROPERTY_GET || m_last_message.msg_header.cmd_id == BASERF_CMD_PROPERTY_SET ) {
m_last_message_clusterID = m_last_message.data[0];
m_last_message_endpointID = m_last_message.data[1];
Endpoint* endpoint = m_device->getEndpoint(m_last_message_clusterID, m_last_message_endpointID);
if ( endpoint != NULL ) {
setLastMessageValid(true);//really needed?
//4.b.1) if SET then continue
Endpoint::endpoint_set_status_t status;
Endpoint::endpoint_value_t value;
value.len = m_last_message.msg_header.dataLen;
value.pvalue = m_last_message.data;
//6.b.1) SET: read data into empty endpoint_value_t, create empty endpoint_set_status_t and call setProperty
endpoint->setProperty(&value, &status);
//6.b.2) send back ACK(endpoint_set_status_t)
return prepareACKPayload(&m_last_message, status.status, status.pvalue, status.len, &bufACK, lenACK);
} else {
return prepareACKPayload(&m_last_message, BASERF_CMD_ACK_STATUS_INVALID, NULL, 0, &bufACK, lenACK);
}
#ifdef MW_SUPPORT_BASERF_SUPPORTED_META
} else if ( m_last_message.msg_header.cmd_id == BASERF_CMD_META_ENDPOINT_GET ) {
m_last_message_meta_flags = m_last_message.data[0];
m_last_message_clusterID = m_last_message.data[1];
m_last_message_endpointID = m_last_message.data[2];
if ( m_device->getEndpoint(m_last_message_clusterID, m_last_message_endpointID) ) {
setLastMessageValid(true);
return prepareACKPayload(&m_last_message, BASERF_CMD_ACK_STATUS_PROCESSED, NULL, 0, &bufACK, lenACK);
} else {
return prepareACKPayload(&m_last_message, BASERF_CMD_ACK_STATUS_INVALID, NULL, 0, &bufACK, lenACK);
}
} else if ( m_last_message.msg_header.cmd_id == BASERF_CMD_META_CLUSTER_GET ) {
m_last_message_meta_flags = m_last_message.data[0];
m_last_message_clusterID = m_last_message.data[1];
if ( m_device->getCluster(m_last_message_clusterID) ) {
setLastMessageValid(true);
return prepareACKPayload(&m_last_message, BASERF_CMD_ACK_STATUS_PROCESSED, NULL, 0, &bufACK, lenACK);
} else {
return prepareACKPayload(&m_last_message, BASERF_CMD_ACK_STATUS_INVALID, NULL, 0, &bufACK, lenACK);
}
} else if ( m_last_message.msg_header.cmd_id == BASERF_CMD_META_DEVICE_GET ) {
m_last_message_meta_flags = m_last_message.data[0];
setLastMessageValid(true);
return prepareACKPayload(&m_last_message, BASERF_CMD_ACK_STATUS_PROCESSED, NULL, 0, &bufACK, lenACK);
#endif
} else if ( m_last_message.msg_header.cmd_id == BASERF_CMD_ACK ) {
//4.c.1) else return
MW_LOG_DEBUG_TRACE(MW_LOG_BASERF) << PSTR("INVALID") << m_last_message.msg_header.cmd_id << endl;
return prepareACKPayload(&m_last_message, BASERF_CMD_ACK_STATUS_INVALID, NULL, 0, &bufACK, lenACK);
} else {
//4.c.1) else return
if ( handleCustomCommand(&m_last_message) == BASERF_CMD_ACK_STATUS_NOT_SUPPORTED ) {
MW_LOG_DEBUG_TRACE(MW_LOG_BASERF) << PSTR("NOT_SUPPORTED: ") << m_last_message.msg_header.cmd_id << endl;
return prepareACKPayload(&m_last_message, BASERF_CMD_ACK_STATUS_NOT_SUPPORTED, NULL, 0, &bufACK, lenACK);
} else {//else no ACK
return 0;
}
}
}
}