version 1.1.2.2, 2011/11/21 14:40:56
|
version 1.1.2.3, 2011/11/21 14:51:23
|
Line 11
|
Line 11
|
* @msgID = MessageID >0, if QOS != MQTT_QOS_ONCE |
* @msgID = MessageID >0, if QOS != MQTT_QOS_ONCE |
* @Dup = Duplicate message |
* @Dup = Duplicate message |
* @QOS = QoS |
* @QOS = QoS |
* @Retain = Retain message |
|
* return: -1 error or >-1 message size for send |
* return: -1 error or >-1 message size for send |
*/ |
*/ |
int |
int |
mqtt_msgPUBLISH(mqtt_msg_t * __restrict buf, const char *csTopic, u_short msgID, |
mqtt_msgPUBLISH(mqtt_msg_t * __restrict buf, const char *csTopic, u_short msgID, |
u_char Dup, u_char QOS, u_char Retain) | u_char Dup, u_char QOS) |
{ |
{ |
int siz = 0; |
int siz = 0; |
struct mqtthdr *hdr; |
struct mqtthdr *hdr; |
Line 57 mqtt_msgPUBLISH(mqtt_msg_t * __restrict buf, const cha
|
Line 56 mqtt_msgPUBLISH(mqtt_msg_t * __restrict buf, const cha
|
hdr->mqtt_msg.type = MQTT_TYPE_PUBLISH; |
hdr->mqtt_msg.type = MQTT_TYPE_PUBLISH; |
hdr->mqtt_msg.qos = QOS; |
hdr->mqtt_msg.qos = QOS; |
hdr->mqtt_msg.dup = Dup ? 1 : 0; |
hdr->mqtt_msg.dup = Dup ? 1 : 0; |
hdr->mqtt_msg.retain = Retain ? 1 : 0; | hdr->mqtt_msg.retain = 0; |
*hdr->mqtt_len = mqtt_encodeLen(siz - sizeof(struct mqtthdr)); |
*hdr->mqtt_len = mqtt_encodeLen(siz - sizeof(struct mqtthdr)); |
|
|
mqtt_msgRealloc(buf, siz); |
mqtt_msgRealloc(buf, siz); |