FreeRTOS: FreeRTOS Cellular Library v1.2.0
FreeRTOS Cellular Library
cellular_comm_interface.h
Go to the documentation of this file.
1/*
2 * FreeRTOS-Cellular-Interface v1.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 * https://www.FreeRTOS.org
23 * https://github.com/FreeRTOS
24 */
25
30#ifndef __CELLULAR_COMM_INTERFACE_H__
31#define __CELLULAR_COMM_INTERFACE_H__
32
33/* *INDENT-OFF* */
34#ifdef __cplusplus
35 extern "C" {
36#endif
37/* *INDENT-ON* */
38
39#include "cellular_types.h"
40
41/* Standard includes. */
42#include <stdint.h>
43
47typedef enum CellularCommInterfaceError
48{
57
58struct CellularCommInterfaceContext;
59
63typedef struct CellularCommInterfaceContext * CellularCommInterfaceHandle_t;
64
79 CellularCommInterfaceHandle_t commInterfaceHandle );
80
94 void * pUserData,
95 CellularCommInterfaceHandle_t * pCommInterfaceHandle );
96
113 const uint8_t * pData,
114 uint32_t dataLength,
115 uint32_t timeoutMilliseconds,
116 uint32_t * pDataSentLength );
117
135 uint8_t * pBuffer,
136 uint32_t bufferLength,
137 uint32_t timeoutMilliseconds,
138 uint32_t * pDataReceivedLength );
139
150
157typedef struct CellularCommInterface
158{
164
165/* *INDENT-OFF* */
166#ifdef __cplusplus
167 }
168#endif
169/* *INDENT-ON* */
170
171#endif /* __CELLULAR_COMM_INTERFACE_H__ */
CellularCommInterfaceError_t(* CellularCommInterfaceRecv_t)(CellularCommInterfaceHandle_t commInterfaceHandle, uint8_t *pBuffer, uint32_t bufferLength, uint32_t timeoutMilliseconds, uint32_t *pDataReceivedLength)
Receive data from the comm interface.
Definition: cellular_comm_interface.h:134
CellularCommInterfaceError_t(* CellularCommInterfaceReceiveCallback_t)(void *pUserData, CellularCommInterfaceHandle_t commInterfaceHandle)
Provide an asynchronous notification of incoming data.
Definition: cellular_comm_interface.h:78
CellularCommInterfaceError_t(* CellularCommInterfaceClose_t)(CellularCommInterfaceHandle_t commInterfaceHandle)
Close the connection to the comm interface.
Definition: cellular_comm_interface.h:149
CellularCommInterfaceError_t(* CellularCommInterfaceSend_t)(CellularCommInterfaceHandle_t commInterfaceHandle, const uint8_t *pData, uint32_t dataLength, uint32_t timeoutMilliseconds, uint32_t *pDataSentLength)
Send data to the comm interface.
Definition: cellular_comm_interface.h:112
CellularCommInterfaceError_t(* CellularCommInterfaceOpen_t)(CellularCommInterfaceReceiveCallback_t receiveCallback, void *pUserData, CellularCommInterfaceHandle_t *pCommInterfaceHandle)
Open a connection to the comm interface.
Definition: cellular_comm_interface.h:93
CellularCommInterfaceError_t
Return codes from various APIs.
Definition: cellular_comm_interface.h:48
@ IOT_COMM_INTERFACE_SUCCESS
Definition: cellular_comm_interface.h:49
@ IOT_COMM_INTERFACE_NO_MEMORY
Definition: cellular_comm_interface.h:52
@ IOT_COMM_INTERFACE_BAD_PARAMETER
Definition: cellular_comm_interface.h:51
@ IOT_COMM_INTERFACE_FAILURE
Definition: cellular_comm_interface.h:50
@ IOT_COMM_INTERFACE_DRIVER_ERROR
Definition: cellular_comm_interface.h:54
@ IOT_COMM_INTERFACE_TIMEOUT
Definition: cellular_comm_interface.h:53
@ IOT_COMM_INTERFACE_BUSY
Definition: cellular_comm_interface.h:55
struct CellularCommInterfaceContext * CellularCommInterfaceHandle_t
Opaque handle to comm interface.
Definition: cellular_comm_interface.h:63
Represents the functions of a comm interface.
Definition: cellular_comm_interface.h:158
CellularCommInterfaceRecv_t recv
Definition: cellular_comm_interface.h:161
CellularCommInterfaceSend_t send
Definition: cellular_comm_interface.h:160
CellularCommInterfaceClose_t close
Definition: cellular_comm_interface.h:162
CellularCommInterfaceOpen_t open
Definition: cellular_comm_interface.h:159