FreeRTOS: BLE
BLE
Return to main page ↑
iot_ble_mqtt_transport.h
1 /*
2  * FreeRTOS BLE V2.2.0
3  * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining a copy of
6  * this software and associated documentation files (the "Software"), to deal in
7  * the Software without restriction, including without limitation the rights to
8  * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9  * the Software, and to permit persons to whom the Software is furnished to do so,
10  * subject to the following conditions:
11  *
12  * The above copyright notice and this permission notice shall be included in all
13  * copies or substantial portions of the Software.
14  *
15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17  * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18  * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19  * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21  */
22 
23 
24 #ifndef IOT_BLE_MQTT_TRANSPORT_H
25 #define IOT_BLE_MQTT_TRANSPORT_H
26 
27 /* Standard includes. */
28 #include <stdbool.h>
29 #include <stddef.h>
30 #include <stdint.h>
31 
32 #include "FreeRTOS.h"
33 #include "stream_buffer.h"
34 
35 #include "iot_ble_mqtt_transport_config.h"
36 #include "iot_ble_mqtt_serialize.h"
37 #include "iot_ble_data_transfer.h"
38 
43 typedef struct BleTransportParams
44 {
45  IotBleDataTransferChannel_t * pChannel;
46  StreamBufferHandle_t xStreamBuffer;
47  StaticStreamBuffer_t xStreamBufferStruct;
48  MQTTBLEPublishInfo_t publishInfo;
49  TickType_t receiveTimeout;
51 
57 struct NetworkContext;
58 typedef struct NetworkContext NetworkContext_t;
59 
69 bool IotBleMqttTransportInit( void * pBuffer,
70  size_t bufSize,
71  NetworkContext_t * pContext );
72 
78 void IotBleMqttTransportCleanup( const NetworkContext_t * pContext );
79 
86 MQTTBLEStatus_t IotBleMqttTransportAcceptData( const NetworkContext_t * pContext );
87 
96 int32_t IotBleMqttTransportSend( NetworkContext_t * pContext,
97  const void * pBuffer,
98  size_t bytesToWrite );
99 
108 int32_t IotBleMqttTransportReceive( NetworkContext_t * pContext,
109  void * pBuffer,
110  size_t bytesToRead );
111 
112 
119 void IotBleMqttTransportSetReceiveTimeout( NetworkContext_t * pContext,
120  uint32_t timeoutMS );
121 
122 #endif /* ifndef IOT_BLE_MQTT_TRANSPORT_H */
File exposes types and serializer, deserializer APIs for sending and receiving MQTT messages over BLE...
Definition of the transport parameters for the transport interface implementation that uses MQTT over...
Definition: iot_ble_mqtt_transport.h:43
MQTTBLEStatus_t
Definition: iot_ble_mqtt_serialize.h:249
Definition: iot_ble_mqtt_serialize.h:195