FreeRTOS: FreeRTOS Cellular Library v1.2.0
FreeRTOS Cellular Library
cellular_comm_interface.h File Reference
#include "cellular_types.h"
#include <stdint.h>

Go to the source code of this file.

Data Structures

struct  CellularCommInterface_t
 Represents the functions of a comm interface. More...
 

Typedefs

typedef struct CellularCommInterfaceContext * CellularCommInterfaceHandle_t
 Opaque handle to comm interface.
 
typedef CellularCommInterfaceError_t(* CellularCommInterfaceReceiveCallback_t) (void *pUserData, CellularCommInterfaceHandle_t commInterfaceHandle)
 Provide an asynchronous notification of incoming data. More...
 
typedef CellularCommInterfaceError_t(* CellularCommInterfaceOpen_t) (CellularCommInterfaceReceiveCallback_t receiveCallback, void *pUserData, CellularCommInterfaceHandle_t *pCommInterfaceHandle)
 Open a connection to the comm interface. More...
 
typedef 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. More...
 
typedef 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. More...
 
typedef CellularCommInterfaceError_t(* CellularCommInterfaceClose_t) (CellularCommInterfaceHandle_t commInterfaceHandle)
 Close the connection to the comm interface. More...
 

Enumerations

enum  CellularCommInterfaceError_t {
  IOT_COMM_INTERFACE_SUCCESS = 0 , IOT_COMM_INTERFACE_FAILURE , IOT_COMM_INTERFACE_BAD_PARAMETER , IOT_COMM_INTERFACE_NO_MEMORY ,
  IOT_COMM_INTERFACE_TIMEOUT , IOT_COMM_INTERFACE_DRIVER_ERROR , IOT_COMM_INTERFACE_BUSY
}
 Return codes from various APIs. More...
 

Typedef Documentation

◆ CellularCommInterfaceReceiveCallback_t

typedef CellularCommInterfaceError_t(* CellularCommInterfaceReceiveCallback_t) (void *pUserData, CellularCommInterfaceHandle_t commInterfaceHandle)

Provide an asynchronous notification of incoming data.

A function of this signature is supplied in CellularCommInterfaceOpen_t and is used to notify whenever data is available for reading on the comm interface.

Parameters
[in]pUserDataUserdata to be provided in the callback.
[in]commInterfaceHandleHandle corresponding to the comm interface.
Returns
IOT_COMM_INTERFACE_SUCCESS if the operation is successful, and need to yield from ISR IOT_COMM_INTERFACE_BUSY if the operation is successful, otherwise an error code indicating the cause of the error.

◆ CellularCommInterfaceOpen_t

typedef CellularCommInterfaceError_t(* CellularCommInterfaceOpen_t) (CellularCommInterfaceReceiveCallback_t receiveCallback, void *pUserData, CellularCommInterfaceHandle_t *pCommInterfaceHandle)

Open a connection to the comm interface.

Parameters
[in]receiveCallbackCallback to be invoked whenever there is data available for reading from the comm interface.
[in]pUserDataUserdata to be provided in the callback.
[out]pCommInterfaceHandleOut parameter to provide the comm interface handle.
Returns
IOT_COMM_INTERFACE_SUCCESS if the operation is successful, otherwise an error code indicating the cause of the error.

◆ CellularCommInterfaceSend_t

typedef 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.

Parameters
[in]commInterfaceHandleComm interface handle as returned from the CellularCommInterfaceOpen_t call.
[in]pDataThe data to send.
[in]dataLengthLength of the data to send.
[in]timeoutMillisecondsTimeout in milliseconds for the send operation.
[out]pDataSentLengthOut parameter to provide the length of the actual data sent. Note that it may be less than the dataLength in case complete data could not be sent.
Returns
IOT_COMM_INTERFACE_SUCCESS if the operation is successful, otherwise an error code indicating the cause of the error.

◆ CellularCommInterfaceRecv_t

typedef 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.

Parameters
[in]commInterfaceHandleComm interface handle as returned from the CellularCommInterfaceOpen_t call.
[in]pBufferThe buffer to receive the data into.
[in]bufferLengthThe length of the buffer pBuffer.
[in]timeoutMillisecondsTimeout in milliseconds for the receive operation.
[out]pDataReceivedLengthOut parameter to provide the length of the actual data received in the buffer pBuffer. Note that it may be less than the bufferLength.
Returns
IOT_COMM_INTERFACE_SUCCESS if the operation is successful, otherwise an error code indicating the cause of the error.

◆ CellularCommInterfaceClose_t

typedef CellularCommInterfaceError_t(* CellularCommInterfaceClose_t) (CellularCommInterfaceHandle_t commInterfaceHandle)

Close the connection to the comm interface.

Parameters
[in]commInterfaceHandleComm interface handle as returned from the CellularCommInterfaceOpen_t call.
Returns
IOT_COMM_INTERFACE_SUCCESS if the operation is successful, otherwise an error code indicating the cause of the error.

Enumeration Type Documentation

◆ CellularCommInterfaceError_t

Return codes from various APIs.

Enumerator
IOT_COMM_INTERFACE_SUCCESS 

Function successfully completed.

IOT_COMM_INTERFACE_FAILURE 

Generic failure not covered by other values.

IOT_COMM_INTERFACE_BAD_PARAMETER 

At least one parameter was invalid.

IOT_COMM_INTERFACE_NO_MEMORY 

Memory allocation failed.

IOT_COMM_INTERFACE_TIMEOUT 

Operation timed out.

IOT_COMM_INTERFACE_DRIVER_ERROR 

An error occurred when calling a low level driver API.

IOT_COMM_INTERFACE_BUSY 

The interface is currently busy.