diff options
Diffstat (limited to 'FreeRTOS-Plus/Source/FreeRTOS-IoT-Libraries-LTS-Beta2/c_sdk/standard/mqtt/include')
2 files changed, 8 insertions, 35 deletions
diff --git a/FreeRTOS-Plus/Source/FreeRTOS-IoT-Libraries-LTS-Beta2/c_sdk/standard/mqtt/include/mqtt.h b/FreeRTOS-Plus/Source/FreeRTOS-IoT-Libraries-LTS-Beta2/c_sdk/standard/mqtt/include/mqtt.h index 7dfef1285..8db419707 100644 --- a/FreeRTOS-Plus/Source/FreeRTOS-IoT-Libraries-LTS-Beta2/c_sdk/standard/mqtt/include/mqtt.h +++ b/FreeRTOS-Plus/Source/FreeRTOS-IoT-Libraries-LTS-Beta2/c_sdk/standard/mqtt/include/mqtt.h @@ -26,6 +26,8 @@ #include "mqtt_config.h" #include "mqtt_lightweight.h" +#include "transport_interface.h" + /** * @brief Invalid packet identifier. * @@ -42,13 +44,6 @@ typedef struct MQTTPubAckInfo MQTTPubAckInfo_t; struct MQTTContext; typedef struct MQTTContext MQTTContext_t; -struct MQTTTransportInterface; -typedef struct MQTTTransportInterface MQTTTransportInterface_t; - -typedef int32_t (* MQTTTransportSendFunc_t )( NetworkContext_t context, - const void * pMessage, - size_t bytesToSend ); - typedef uint32_t (* MQTTGetCurrentTimeFunc_t )( void ); typedef void (* MQTTEventCallback_t )( MQTTContext_t * pContext, @@ -85,13 +80,6 @@ typedef enum MQTTPubAckType MQTTPubcomp } MQTTPubAckType_t; -struct MQTTTransportInterface -{ - MQTTTransportSendFunc_t send; - MQTTTransportRecvFunc_t recv; - NetworkContext_t networkContext; -}; - struct MQTTApplicationCallbacks { MQTTGetCurrentTimeFunc_t getTime; @@ -112,7 +100,7 @@ struct MQTTContext MQTTPubAckInfo_t incomingPublishRecords[ MQTT_STATE_ARRAY_MAX_COUNT ]; size_t incomingPublishCount; - MQTTTransportInterface_t transportInterface; + TransportInterface_t transportInterface; MQTTFixedBuffer_t networkBuffer; uint16_t nextPacketId; @@ -147,7 +135,7 @@ struct MQTTContext * #MQTTSuccess otherwise. */ MQTTStatus_t MQTT_Init( MQTTContext_t * pContext, - const MQTTTransportInterface_t * pTransportInterface, + const TransportInterface_t * pTransportInterface, const MQTTApplicationCallbacks_t * pCallbacks, const MQTTFixedBuffer_t * pNetworkBuffer ); diff --git a/FreeRTOS-Plus/Source/FreeRTOS-IoT-Libraries-LTS-Beta2/c_sdk/standard/mqtt/include/mqtt_lightweight.h b/FreeRTOS-Plus/Source/FreeRTOS-IoT-Libraries-LTS-Beta2/c_sdk/standard/mqtt/include/mqtt_lightweight.h index f1799febc..73ac80449 100644 --- a/FreeRTOS-Plus/Source/FreeRTOS-IoT-Libraries-LTS-Beta2/c_sdk/standard/mqtt/include/mqtt_lightweight.h +++ b/FreeRTOS-Plus/Source/FreeRTOS-IoT-Libraries-LTS-Beta2/c_sdk/standard/mqtt/include/mqtt_lightweight.h @@ -37,6 +37,8 @@ /* Include config file before other headers. */ #include "mqtt_config.h" +#include "transport_interface.h" + /* MQTT packet types. */ #define MQTT_PACKET_TYPE_CONNECT ( ( uint8_t ) 0x10U ) /**< @brief CONNECT (client-to-server). */ #define MQTT_PACKET_TYPE_CONNACK ( ( uint8_t ) 0x20U ) /**< @brief CONNACK (server-to-client). */ @@ -75,23 +77,6 @@ struct MQTTPacketInfo; typedef struct MQTTPacketInfo MQTTPacketInfo_t; /** - * @brief Signature of the transport interface receive function. - * - * A function with this signature must be provided to the MQTT library to read - * data off the network. - * - * @param[in] context The network context provided with this function. - * @param[out] pBuffer Buffer to receive network data. - * @param[in] bytesToRecv Bytes to receive from the network. pBuffer must be at - * least this size. - * - * @return The number of bytes received; negative value on failure. - */ -typedef int32_t (* MQTTTransportRecvFunc_t )( NetworkContext_t context, - void * pBuffer, - size_t bytesToRecv ); - -/** * @brief Return codes from MQTT functions. */ typedef enum MQTTStatus @@ -539,8 +524,8 @@ MQTTStatus_t MQTT_DeserializeAck( const MQTTPacketInfo_t * pIncomingPacket, * #MQTTBadResponse if an invalid packet is read, and * #MQTTNoDataAvailable if there is nothing to read. */ -MQTTStatus_t MQTT_GetIncomingPacketTypeAndLength( MQTTTransportRecvFunc_t readFunc, - NetworkContext_t networkContext, +MQTTStatus_t MQTT_GetIncomingPacketTypeAndLength( TransportRecv_t readFunc, + NetworkContext_t * pNetworkContext, MQTTPacketInfo_t * pIncomingPacket ); #endif /* ifndef MQTT_LIGHTWEIGHT_H */ |