#include <stdint.h>
#include <pthread.h>
#include "MbimIndicator.h"
#include "MbimTransaction.h"
Go to the source code of this file.
|
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) |
|
◆ MBIM_UUID_SIZE
#define MBIM_UUID_SIZE 16 |
Number of bytes in a MBIM device service's UUID
◆ MBIM_MAX_CIDS
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_COMMAND_TYPE_SET
#define MBIM_COMMAND_TYPE_SET 1 |
◆ MBIM_STATUS_SUCCESS
#define MBIM_STATUS_SUCCESS 0 |
◆ 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.
◆ 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] | informationBuffer | Transaction response's informationBuffer. |
[in] | informationBufferLength | Number of bytes in transaction response's informationBuffer. |
[in] | pParseCallbackContext | User context supplied when transaction was initialized. |
- Returns
- MBIM_STATUS_SUCCESS on success. MBIM_STATUS_CUSTOM_PARSE_FAILURE on error.
◆ 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] | pTransport | The primary object of this call. |
[in] | deviceService | Device service UUID which is recipient of command. |
[in] | cid | Command ID (CID) which is specific to that device service. |
[in] | commandType | 1 = set, 0 = get. |
[in] | informationBuffer | Buffer of information content. |
[in] | informationBufferLength | Size in bytes of information content. |
[in] | pParseCallback | User supplied callback. This is called only if function returns MBIM_STATUS_SUCCESS. |
[in] | pParseCallbackContext | Context for user supplied callback. |
[in] | timeout | Timeout 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.