本文整理汇总了C++中SoftwareSerial::fprintf方法的典型用法代码示例。如果您正苦于以下问题:C++ SoftwareSerial::fprintf方法的具体用法?C++ SoftwareSerial::fprintf怎么用?C++ SoftwareSerial::fprintf使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SoftwareSerial
的用法示例。
在下文中一共展示了SoftwareSerial::fprintf方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: recieveMessageHandler
/* ===================================================
Procedures for Received Messages
=====================================================*/
void MqttsClient::recieveMessageHandler(ZBRxResponse* recvMsg, int* returnCode){
if ( _gwHdl.isSearching() && (recvMsg->getData()[1] != MQTTS_TYPE_GWINFO)){
*returnCode = MQTTS_ERR_NO_ERROR;
/*--------- PUBLISH --------*/
}else if (recvMsg->getData()[1] == MQTTS_TYPE_PUBLISH){
#ifdef DEBUG_MQTTS
#ifdef ARDUINO
debug.println("PUBLISH Received");
#endif
#ifdef MBED
debug.fprintf(stdout,"PUBLISH received\n");
#endif
#ifdef LINUX
fprintf(stdout,"PUBLISH received\n");
#endif
#endif /* DEBUG_MQTTS */
MqttsPublish mqMsg = MqttsPublish();
mqMsg.setFrame(recvMsg);
if ( _gwHdl.getAddress16() == getRxRemoteAddress16()){
*returnCode = _pubHdl.exec(&mqMsg,&_topics);
if (mqMsg.getQos() && MQTTS_FLAG_QOS_1){
pubAck(mqMsg.getTopicId(), mqMsg.getMsgId(), MQTTS_RC_ACCEPTED);
}
}
/*--------- PUBACK ----------*/
}else if (recvMsg->getData()[1] == MQTTS_TYPE_PUBACK && getMsgRequestStatus() == MQTTS_MSG_WAIT_ACK){
MqttsPubAck mqMsg = MqttsPubAck();
copyMsg(&mqMsg, recvMsg);
if (mqMsg.getMsgId() == getLong(_sendQ->getMessage(0)->getBody() + 3)){
if (mqMsg.getReturnCode() == MQTTS_RC_ACCEPTED){
setMsgRequestStatus(MQTTS_MSG_COMPLETE);
}else if (mqMsg.getReturnCode() == MQTTS_RC_REJECTED_CONGESTION){
setMsgRequestStatus(MQTTS_MSG_RESEND_REQ);
}else{
*returnCode = MQTTS_ERR_REJECTED;
setMsgRequestStatus(MQTTS_MSG_REJECTED);
}
}
#ifdef DEBUG_MQTTS
#ifdef ARDUINO
debug.print("\nPUBACK ReturnCode=");
debug.println(mqMsg.getReturnCode(),HEX);
debug.println();
#endif
#ifdef MBED
debug.fprintf(stdout,"\nPUBACK ReturnCode=%d\n", mqMsg.getReturnCode());
#endif
#ifdef LINUX
fprintf(stdout,"\nPUBACK ReturnCode=%d\n", mqMsg.getReturnCode());
#endif
#endif /* DEBUG_MQTTS */
/*--------- PINGRESP ----------*/
}else if (recvMsg->getData()[1] == MQTTS_TYPE_PINGRESP){
_gwHdl.recvPingResp();
if (getMsgRequestType() == MQTTS_TYPE_PINGREQ){
setMsgRequestStatus(MQTTS_MSG_COMPLETE);
}
#ifdef DEBUG_MQTTS
#ifdef ARDUINO
debug.println(" PINGRESP received");
#endif
#ifdef MBED
debug.fprintf(stdout," PINGRESP received\n");
#endif
#ifdef LINUX
fprintf(stdout," PINGRESP received\n");
#endif
#endif /* DEBUG_MQTTS */
/*--------- PINGREQ ----------*/
}else if (recvMsg->getData()[1] == MQTTS_TYPE_PINGREQ){
pingResp();
#ifdef DEBUG_MQTTS
#ifdef ARDUINO
debug.println(" PINGREQ received");
#endif
#ifdef MBED
debug.fprintf(stdout," PINGREQ received\n");
#endif
#ifdef LINUX
fprintf(stdout," PINGREQ received\n");
#endif
#endif /* DEBUG_MQTTS */
/*--------- ADVERTISE ----------*/
}else if (recvMsg->getData()[1] == MQTTS_TYPE_ADVERTISE){
//.........这里部分代码省略.........