Linux LITE MBIM  MBPL_SDK_R25_ENG3
Data Structures | Macros | Typedefs | Enumerations | Functions
MbimTransport.h File Reference
#include <stdint.h>
#include <pthread.h>
#include "MbimIndicator.h"
#include "MbimTransaction.h"

Go to the source code of this file.

Data Structures

struct  MBIM_TRANSPORT_ERR_INFO
 
struct  MbimTransport
 

Macros

#define MBIM_UUID_SIZE   16
 
#define MBIM_MAX_CIDS   64
 
#define MBIM_MAX_CTRL_TRANSFER   4096
 
#define MBIM_COMMAND_TYPE_QUERY   0
 
#define MBIM_COMMAND_TYPE_SET   1
 
#define MBIM_STATUS_SUCCESS   0
 
#define MBIM_STATUS_FAILURE   2
 
#define MBIM_STATUS_INVALID_PARAMETERS   21
 
#define MBIM_STATUS_READ_FAILURE   22
 
#define MBIM_STATUS_WRITE_FAILURE   23
 
#define MBIM_STATUS_CUSTOM_BUILD_FAILURE   0xfffffff0
 
#define MBIM_STATUS_CUSTOM_PARSE_FAILURE   0xfffffff1
 

Typedefs

typedef void(* MBIM_TRANSPORT_ERR_CALLBACK) (void *pErrCallbackContext, MBIM_TRANSPORT_ERR_INFO err_info)
 
typedef struct MbimTransport MbimTransport
 
typedef uint32_t(* MBIM_PARSE_CALLBACK) (uint8_t *informationBuffer, uint32_t informationBufferLength, void *pParseCallbackContext)
 

Enumerations

enum  MBIM_TRANSPORT_ERR_TYPE { MBIM_TRANSPORT_ERR_UNKNOWN, MBIM_TRANSPORT_ERR_READ, MBIM_TRANSPORT_ERR_WRITE }
 

Functions

int MbimTransport_Initialize (MbimTransport *pThis, char *devicePath, uint32_t maxExpectedInformationLength)
 
void MbimTransport_ShutDown (MbimTransport *pThis)
 
int MbimTransport_SendCommand (MbimTransport *pThis, const uint8_t *deviceServiceId, uint32_t cid, uint32_t commandType, uint8_t *informationBuffer, uint16_t informationBufferLength, MbimTransaction *pTransaction)
 
uint32_t MbimTransport_GetNextTransactionId (MbimTransport *pThis)
 
void MbimTransport_CancelTransaction (MbimTransport *pThis, uint32_t transactionId)
 
void MbimTransport_AttachIndicator (MbimTransport *pThis, MbimIndicator *pIndicator)
 
void MbimTransport_DetachIndicator (MbimTransport *pThis, MbimIndicator *pIndicator)
 
uint32_t MbimTransport_ExecuteCommandSynchronously (MbimTransport *pTransport, const uint8_t *deviceService, uint32_t cid, uint32_t commandType, uint8_t *informationBuffer, uint16_t informationBufferLength, MBIM_PARSE_CALLBACK pParseCallback, void *pParseCallbackContext, time_t timeout)
 
void MbimTransport_RegisterErrCallback (MbimTransport *pThis, MBIM_TRANSPORT_ERR_CALLBACK pErrCallback, void *pErrCallbackContext)
 

Macro Definition Documentation

◆ MBIM_UUID_SIZE

#define MBIM_UUID_SIZE   16

Number of bytes in a MBIM device service's UUID

◆ MBIM_MAX_CIDS

#define MBIM_MAX_CIDS   64

Max CIDs per device service. Chosen with some head-room. Current max is 25.

◆ MBIM_MAX_CTRL_TRANSFER

#define MBIM_MAX_CTRL_TRANSFER   4096

This value should be determined at run-time.

◆ MBIM_COMMAND_TYPE_QUERY

#define MBIM_COMMAND_TYPE_QUERY   0

MBIM query command

◆ MBIM_COMMAND_TYPE_SET

#define MBIM_COMMAND_TYPE_SET   1

MBIM set command

◆ MBIM_STATUS_SUCCESS

#define MBIM_STATUS_SUCCESS   0

The operation succeeded.

◆ MBIM_STATUS_FAILURE

#define MBIM_STATUS_FAILURE   2

The operation failed (a generic failure).

◆ MBIM_STATUS_INVALID_PARAMETERS

#define MBIM_STATUS_INVALID_PARAMETERS   21

The operation failed because of invalid parameters.

◆ MBIM_STATUS_READ_FAILURE

#define MBIM_STATUS_READ_FAILURE   22

The operation failed because of a read failure.

◆ MBIM_STATUS_WRITE_FAILURE

#define MBIM_STATUS_WRITE_FAILURE   23

The operation failed because of a write failure.

◆ MBIM_STATUS_CUSTOM_BUILD_FAILURE

#define MBIM_STATUS_CUSTOM_BUILD_FAILURE   0xfffffff0

Failed to build a command payload.

◆ MBIM_STATUS_CUSTOM_PARSE_FAILURE

#define MBIM_STATUS_CUSTOM_PARSE_FAILURE   0xfffffff1

Failed to parse a response/indication payload.

Typedef Documentation

◆ MBIM_PARSE_CALLBACK

typedef uint32_t(* MBIM_PARSE_CALLBACK) (uint8_t *informationBuffer, uint32_t informationBufferLength, void *pParseCallbackContext)

This function prototype represents the callback which is called to parse a command response or indication.

Parameters
[in]informationBufferTransaction response's informationBuffer.
[in]informationBufferLengthNumber of bytes in transaction response's informationBuffer.
[in]pParseCallbackContextUser context supplied when transaction was initialized.
Returns
MBIM_STATUS_SUCCESS on success. MBIM_STATUS_CUSTOM_PARSE_FAILURE on error.

Function Documentation

◆ MbimTransport_ExecuteCommandSynchronously()

uint32_t MbimTransport_ExecuteCommandSynchronously ( MbimTransport pTransport,
const uint8_t *  deviceService,
uint32_t  cid,
uint32_t  commandType,
uint8_t *  informationBuffer,
uint16_t  informationBufferLength,
MBIM_PARSE_CALLBACK  pParseCallback,
void *  pParseCallbackContext,
time_t  timeout 
)

Convenience function to send a MBIM command and wait for response.

Parameters
[in]pTransportThe primary object of this call.
[in]deviceServiceDevice service UUID which is recipient of command.
[in]cidCommand ID (CID) which is specific to that device service.
[in]commandType1 = set, 0 = get.
[in]informationBufferBuffer of information content.
[in]informationBufferLengthSize in bytes of information content.
[in]pParseCallbackUser supplied callback. This is called only if function returns MBIM_STATUS_SUCCESS.
[in]pParseCallbackContextContext for user supplied callback.
[in]timeoutTimeout in seconds for this command to execute.
Returns
MBIM_STATUS_SUCCESS on success, MBIM_STATUS_WRITE_FAILURE on failure to send command, MBIM_STATUS_READ_FAILURE on response timeout, Any other MBIM_STATUS_xxx as reported by the device.
Note
The caller is required to handle any parsing errors in the context of pParseCallback.

Copyright (c) 2011-2020 Sierra Wireless, Inc. All rights reserved