1.1.11.3 WDRV_WINC_MQTTPublish

Function

WDRV_WINC_STATUS WDRV_WINC_MQTTPublish
(
DRV_HANDLE handle,
const WDRV_WINC_MQTT_MSG_INFO *pMsgInfo,
const char *pTopicName,
const uint8_t *pTopicData,
size_t topicDataLen,
WDRV_WINC_MQTT_PUB_STATUS_CALLBACK pfPubStatusCb,
uintptr_t pubStatusCbCtx,
WDRV_WINC_MQTT_PUB_HANDLE *pPubHandle
)

Summary

Publish a message to an MQTT topic.

Description

Publishes a message to an MQTT topic.

Precondition

WDRV_WINC_Initialize should have been called. WDRV_WINC_Open should have been called to obtain a valid handle.

Parameters

handle - Client handle obtained by a call to WDRV_WINC_Open.

pMsgInfo - Pointer to message information if required.

pTopicName - Pointer to topic name.

pTopicData - Pointer to data to publish to topic.

topicDataLen - Length of data to publish.

pfPubStatusCb - Pointer to publish status callback.

pubStatusCbCtx - User context to be passed to callback when called.

pPubHandle - Pointer to handle to receive short term publish handle.

Returns

WDRV_WINC_STATUS_OK - A scan was initiated.

WDRV_WINC_STATUS_NOT_OPEN - The driver instance is not open.

WDRV_WINC_STATUS_REQUEST_ERROR - The request to the WINC was rejected.

WDRV_WINC_STATUS_INVALID_ARG - The parameters were incorrect.

Remarks

The publish handle returned is only valid until the callback is called with both a handle and a packet ID, after which the handle is no longer valid and should be discarded. Further updates to the callback will use the packet ID. This is only relevant to QoS 1 and 2.