|
|
| version 1.1.2.7, 2012/05/10 09:06:42 | version 1.1.2.8, 2012/06/19 15:55:01 |
|---|---|
| Line 239 mqtt_cli_Unsubscribe(mqtt_cli_t * __restrict cli, mqtt | Line 239 mqtt_cli_Unsubscribe(mqtt_cli_t * __restrict cli, mqtt |
| * @csTopic = Topic | * @csTopic = Topic |
| * @pData = Data | * @pData = Data |
| * @datLen = Data length | * @datLen = Data length |
| * return: -1 error or 0 ok | * return: -1 error or > -1 sended bytes |
| */ | */ |
| int | int |
| mqtt_cli_Publish(mqtt_cli_t * __restrict cli, u_short msgID, u_char Dup, u_char QoS, u_char Retain, | mqtt_cli_Publish(mqtt_cli_t * __restrict cli, u_short msgID, u_char Dup, u_char QoS, u_char Retain, |
| const char *csTopic, const void *pData, int datLen) | const char *csTopic, const void *pData, int datLen) |
| { | { |
| int siz = 0; | int wlen = 0, siz = 0; |
| if (!cli || !csTopic) | if (!cli || !csTopic) |
| return -1; | return -1; |
| Line 258 mqtt_cli_Publish(mqtt_cli_t * __restrict cli, u_short | Line 258 mqtt_cli_Publish(mqtt_cli_t * __restrict cli, u_short |
| if (siz == -1) { | if (siz == -1) { |
| LOGERR; | LOGERR; |
| return -1; | return -1; |
| } | } else |
| wlen = siz; | |
| if (QoS == MQTT_QOS_ONCE) /* no reply */ | if (QoS == MQTT_QOS_ONCE) /* no reply */ |
| goto end; | goto end; |
| Line 328 mqtt_cli_Publish(mqtt_cli_t * __restrict cli, u_short | Line 329 mqtt_cli_Publish(mqtt_cli_t * __restrict cli, u_short |
| } while (0); | } while (0); |
| end: | end: |
| return 0; | return wlen; |
| } | } |