Linux LITE QMUX
MBPL_SDK_R25_ENG3
|
Data Structures | |
struct | QmiService |
struct | CtlService |
struct | QmiTransaction |
struct | QMUX_TRANSPORT_ERR_INFO |
struct | QmuxTransport |
struct | QmiSyncObject |
Files | |
file | QmiService.h |
file | CtlService.h |
file | QmiTransaction.h |
file | QmuxTransport.h |
file | QmiSyncObject.h |
Macros | |
#define | MAX_QMI_PACKET_SIZE (2048 - 6) |
Typedefs | |
typedef void(* | QMI_INDICATION_CALLBACK) (uint8_t *qmiPacket, uint16_t qmiPacketSize, void *pIndicationCallbackContext) |
typedef struct QmiService | QmiService |
typedef struct CtlService | CtlService |
typedef void(* | QMI_RESPONSE_CALLBACK) (uint8_t *qmiPacket, uint16_t qmiPacketSize, void *pResponseCallbackContext) |
typedef struct QmiTransaction | QmiTransaction |
typedef void(* | QMUX_TRANSPORT_ERR_CALLBACK) (void *pErrCallbackContext, QMUX_TRANSPORT_ERR_INFO err_info) |
typedef struct QmuxTransport | QmuxTransport |
typedef struct QmiSyncObject | QmiSyncObject |
Enumerations | |
enum | QMUX_TRANSPORT_ERR_TYPE { QMUX_TRANSPORT_ERR_UNKNOWN, QMUX_TRANSPORT_ERR_READ, QMUX_TRANSPORT_ERR_WRITE } |
Functions | |
void | QmiService_Initialize (QmiService *pThis, uint8_t serviceType, uint8_t clientId, struct QmuxTransport *pTransport, QMI_INDICATION_CALLBACK pIndicationCallback, void *pIndicationCallbackContext) |
void | QmiService_ShutDown (QmiService *pThis) |
uint16_t | QmiService_GetNextTransactionId (QmiService *pThis) |
int | QmiService_SendRequest (QmiService *pThis, uint16_t transactionId, uint8_t *qmiRequest, uint16_t qmiRequestSize, QMI_RESPONSE_CALLBACK pResponseCallback, void *pResponseCallbackContext) |
void | QmiService_CancelTransaction (QmiService *pThis, uint16_t transactionId) |
bool | QmiService_HandleQmiPacket (QmiService *pThis, uint8_t serviceType, uint8_t clientId, uint8_t *qmiPacket, uint16_t qmiPacketSize) |
int | CtlService_Initialize_Ex (CtlService *pThis, struct QmuxTransport *pTransport, uint8_t nWaitDelay) |
int | CtlService_Initialize (CtlService *pThis, struct QmuxTransport *pTransport) |
void | CtlService_ShutDown (CtlService *pThis) |
int | CtlService_GetClientId (CtlService *pThis, uint8_t serviceType, uint8_t *clientId) |
int | CtlService_ReleaseClientId (CtlService *pThis, uint8_t serviceType, uint8_t clientId) |
int | CtlService_InitializeRegularService (CtlService *pThis, QmiService *pRegularService, uint8_t serviceType, QMI_INDICATION_CALLBACK pIndicationCallback, void *pIndicationCallbackContext) |
int | CtlService_ShutDownRegularService (CtlService *pThis, QmiService *pRegularService) |
void | QmiTransaction_Initialize (QmiTransaction *pThis, uint16_t transactionId, uint16_t messageId, QMI_RESPONSE_CALLBACK pResponseCallback, void *pResponseCallbackContext) |
int | QmuxTransport_Initialize (QmuxTransport *pThis, char *devicePath, bool useMbim, void *pInterfaceSpecific) |
int | QmuxTransport_InitializeEx (QmuxTransport *pThis, char *destination, int interfaceType, void *pInterfaceSpecific) |
void | QmuxTransport_ShutDown (QmuxTransport *pThis) |
void | QmuxTransport_AttachQmiService (QmuxTransport *pThis, struct QmiService *pQmiService) |
void | QmuxTransport_DetachQmiService (QmuxTransport *pThis, struct QmiService *pQmiService) |
int | QmuxTransport_SendQmiPacket (QmuxTransport *pThis, uint8_t qmiServiceType, uint8_t qmiClientId, uint16_t qmiTransactionId, uint8_t *qmiPacket, uint16_t qmiPacketSize) |
void | QmuxTransport_RegisterErrCallback (QmuxTransport *pThis, QMUX_TRANSPORT_ERR_CALLBACK pErrCallback, void *pErrCallbackContext) |
int | QmiSyncObject_Initialize (QmiSyncObject *pThis) |
int | QmiSyncObject_Destroy (QmiSyncObject *pThis) |
int | QmiSyncObject_Lock (QmiSyncObject *pThis) |
int | QmiSyncObject_Unlock (QmiSyncObject *pThis) |
int | QmiSyncObject_Wait (QmiSyncObject *pThis) |
int | QmiSyncObject_TimedWait (QmiSyncObject *pThis, time_t timeoutSeconds) |
int | QmiSyncObject_Signal (QmiSyncObject *pThis) |
void | QmiSyncObject_ResponseCallback (uint8_t *qmiPacket, uint16_t qmiPacketSize, void *pResponseCallbackContext) |
#define MAX_QMI_PACKET_SIZE (2048 - 6) |
Maximum size in bytes of a QMI packet. This does not include QMUX header. It becomes the maximum SDU of a QMUX packet, MAX_QMUX_PACKET_SIZE - sizeof(QMUX_HDR)
typedef void(* QMI_INDICATION_CALLBACK) (uint8_t *qmiPacket, uint16_t qmiPacketSize, void *pIndicationCallbackContext) |
This funcion prototype represents the callback which is called by the QMI service when a QMI indication is received.
[in] | qmiPacket | indication's QMI packet (note: this does not include QMUX header). |
[in] | qmiPacketSize | Number of bytes in indication's QMI packet. |
[in] | pIndicationCallbackContext | User context supplied when QMI service was initialized. |
typedef struct QmiService QmiService |
This structure abstracts a QMI service. It is responsible issuing transaction IDs. It tracks QMI requests and responses using transaction objects from a pool. It invokes a user callback when QMI indications which match its client ID (or a broadcast ID) are received from the transport layer.
pNext |
|
serviceType |
|
clientId |
|
pTransport |
|
transactionId |
|
transactionIdLock |
|
transactionPool |
|
transactionPoolLock |
|
pIndicationCallback |
|
pIndicationCallbackContext |
|
typedef struct CtlService CtlService |
This structure abstracts a CTL QMI service. It wraps a QMI service which is initialized to type CTL. Synchronous methods are provided for getting and releasing client IDs on behalf of other (regular) QMI services.
service |
|
typedef void(* QMI_RESPONSE_CALLBACK) (uint8_t *qmiPacket, uint16_t qmiPacketSize, void *pResponseCallbackContext) |
This funcion prototype represents the callback which is called by the QMI service when a QMI response is received.
[in] | qmiPacket | Response's QMI packet (note: this does not include QMUX header). |
[in] | qmiPacketSize | Number of bytes in response's QMI packet. |
[in] | pResponseCallbackContext | User context supplied when QMI transaction was initialized. |
typedef struct QmiTransaction QmiTransaction |
This structure abstracts a QMI transaction. It is responsible for tracking a QMI request to its response.
inUse |
|
transactionId |
|
messageId |
|
pResponseCallback |
|
pResponseCallbackContext |
|
typedef void(* QMUX_TRANSPORT_ERR_CALLBACK) (void *pErrCallbackContext, QMUX_TRANSPORT_ERR_INFO err_info) |
QMUX transport error callback function.
[in] | pErrCallbackContext | User context of the callback function |
[in] | err_info | A QMUX_TRANSPORT_ERR_INFO structure which contains the detailed error info. |
typedef struct QmuxTransport QmuxTransport |
This structure abstracts a QMUX transport layer. It is responsible for applying QMUX headers to QMI packets from QMI services and forwarding them to the device. It is responsible for receiving QMUX packets from the device. On the basis of QMUX headers, it distributes the SDUs (QMI packets) to the appropriate QMI service. It maintains a list of connected QMI service objects.
interfaceType |
|
pDataLayer |
|
deviceFd |
|
shutdownFd |
|
devRemoved |
|
qmiServiceList |
|
writeLock |
|
qmiServiceListLock |
|
readThread |
|
pErrCallback |
|
pErrCallbackContext |
|
typedef struct QmiSyncObject QmiSyncObject |
This structure is a wrapper around a mutex and condition object and a buffer. It is a convenience object which may be used to create synchronous QMI APIs.
mutex |
|
condition |
|
buffer |
|
bufferSize |
|
QMUX transport error type definitions
void QmiService_Initialize | ( | QmiService * | pThis, |
uint8_t | serviceType, | ||
uint8_t | clientId, | ||
struct QmuxTransport * | pTransport, | ||
QMI_INDICATION_CALLBACK | pIndicationCallback, | ||
void * | pIndicationCallbackContext | ||
) |
Initialize QMI service.
[in] | pThis | The primary object of this call. |
[in] | serviceType | QMI service e.g. NAS, etc. |
[in] | clientId | Value previously obtained by invoking CtlService_GetClientId |
[in] | pTransport | Pointer to underlying transport layer which is responsible for sending and receiving QMUX packets |
[in] | pIndicationCallback | User function to be be called when QMI indications are received. |
[in] | pIndicationCallbackContext | A user context for callback. |
void QmiService_ShutDown | ( | QmiService * | pThis | ) |
Shut down QMI service. Brings service to an uninitiaized state.
[in] | pThis | The primary object of this call. |
uint16_t QmiService_GetNextTransactionId | ( | QmiService * | pThis | ) |
Returns next transaction ID for a QMI service.
[in] | pThis | The primary object of this call. |
int QmiService_SendRequest | ( | QmiService * | pThis, |
uint16_t | transactionId, | ||
uint8_t * | qmiRequest, | ||
uint16_t | qmiRequestSize, | ||
QMI_RESPONSE_CALLBACK | pResponseCallback, | ||
void * | pResponseCallbackContext | ||
) |
Send a QMI request to the device and return immediately.
[in] | pThis | The primary object of this call. |
[in] | transactionId | transaction ID obtained by previous call to QmiService_GetNextTransactionId. |
[in] | qmiRequest | QMI request (this becomes the QMUX SDU). |
[in] | qmiRequestSize | Size in bytes of QMI request. |
[in] | pResponseCallback | Callback called when QMI request completes. |
[in] | pResponseCallbackContext | Context for callback. |
void QmiService_CancelTransaction | ( | QmiService * | pThis, |
uint16_t | transactionId | ||
) |
Cancel an outstanding QMI request.
[in] | pThis | The primary object of this call. |
[in] | transactionId | Transaction ID of outstanding request. |
bool QmiService_HandleQmiPacket | ( | QmiService * | pThis, |
uint8_t | serviceType, | ||
uint8_t | clientId, | ||
uint8_t * | qmiPacket, | ||
uint16_t | qmiPacketSize | ||
) |
Process a received QMI packet. This function is called by the QMUX transport layer.
[in] | pThis | The primary object of this call. |
[in] | serviceType | QMI service type of received packet. |
[in] | clientId | QMI Client ID of received packet. |
[in] | qmiPacket | Pointer to QMI packet. |
[in] | qmiPacketSize | Pointer to size in bytes of QMI packet. |
int CtlService_Initialize_Ex | ( | CtlService * | pThis, |
struct QmuxTransport * | pTransport, | ||
uint8_t | nWaitDelay | ||
) |
Initialize CTL service.
[in] | pThis | The primary object of this call. |
[in] | pTransport | Pointer to underlying transport layer which is responsible for sending and receiving QMUX packets |
[in] | nWaitDelay | Number of seconds to delay after a CTL_SYNC_REQ/RESP exchange. Zero means no delay. |
int CtlService_Initialize | ( | CtlService * | pThis, |
struct QmuxTransport * | pTransport | ||
) |
Initialize CTL service.
[in] | pThis | The primary object of this call. |
[in] | pTransport | Pointer to underlying transport layer which is responsible for sending and receiving QMUX packets |
void CtlService_ShutDown | ( | CtlService * | pThis | ) |
Shut down CTL service.
[in] | pThis | The primary object of this call. |
int CtlService_GetClientId | ( | CtlService * | pThis, |
uint8_t | serviceType, | ||
uint8_t * | clientId | ||
) |
Get a client ID for a given QMI service type.
[in] | pThis | The primary object of this call. |
[in] | serviceType | QMI service type. |
[out] | clientId | Returned client ID. |
int CtlService_ReleaseClientId | ( | CtlService * | pThis, |
uint8_t | serviceType, | ||
uint8_t | clientId | ||
) |
Release a client ID for a given QMI service type. Client ID will have beeb previously obtained by invoking CtlService_GetClientId.
[in] | pThis | The primary object of this call. |
[in] | serviceType | QMI service type. |
[in] | clientId | Client ID to be released. |
int CtlService_InitializeRegularService | ( | CtlService * | pThis, |
QmiService * | pRegularService, | ||
uint8_t | serviceType, | ||
QMI_INDICATION_CALLBACK | pIndicationCallback, | ||
void * | pIndicationCallbackContext | ||
) |
Convenience function to initialize a QMI service object. Under the hood, it gets a client ID for a given QMI service type.
[in] | pThis | The primary object of this call. |
[in] | pRegularService | Uninitialized QMI service object. |
[in] | serviceType | QMI service type. |
[in] | pIndicationCallback | User function to be be called when QMI indications are received by the service. |
[in] | pIndicationCallbackContext | A user context for callback. |
int CtlService_ShutDownRegularService | ( | CtlService * | pThis, |
QmiService * | pRegularService | ||
) |
Convenience function to shut down a QMI service object. Under the hood, it releases a client ID for a given QMI service type.
[in] | pThis | The primary object of this call. |
[in] | pRegularService | Previously initialized QMI service object. |
void QmiTransaction_Initialize | ( | QmiTransaction * | pThis, |
uint16_t | transactionId, | ||
uint16_t | messageId, | ||
QMI_RESPONSE_CALLBACK | pResponseCallback, | ||
void * | pResponseCallbackContext | ||
) |
Initialize QMI transaction.
[in] | pThis | The primary object of this call. |
[in] | transactionId | Transaction ID obtained from a call to QmiService_GetNextTransactionId. |
[in] | messageId | QMI message ID. |
[in] | pResponseCallback | User function to be be called when QMI response is received. |
[in] | pResponseCallbackContext | A user context for callback. |
int QmuxTransport_Initialize | ( | QmuxTransport * | pThis, |
char * | devicePath, | ||
bool | useMbim, | ||
void * | pInterfaceSpecific | ||
) |
Initialize the transport layer.
[in] | pThis | The primary object of this call. |
[in] | devicePath | Absolute path to device. |
[in] | useMbim | Use MBIM interface as opposed to direct interface for data layer. |
[in] | pInterfaceSpecific | A pointer to an object (may be NULL) related to the specific interface used. Currently ignored for useMbim = false. If useMbim = true, it may point to an already initialized MbimTransport object, in which case, this object will use that object rather than try to create its own MbimTransport object. |
int QmuxTransport_InitializeEx | ( | QmuxTransport * | pThis, |
char * | destination, | ||
int | interfaceType, | ||
void * | pInterfaceSpecific | ||
) |
Initialize the transport layer.
[in] | pThis | The primary object of this call. |
[in] | destination | For direct or MBIM, it is absolute path to device. For router, it is the IP address of router or NULL for localhost |
[in] | interfaceType | Use direct, MBIM, or router interface for data layer. for direct, use QMUX_INTERFACE_DIRECT for MBIM, use QMUX_INTERFACE_MBIM for router, use QMUX_INTERFACE_ROUTER |
[in] | pInterfaceSpecific | A pointer to an object (may be NULL) related to the specific interface used. Currently ignored for useMbim = false. If useMbim = true, it may point to an already initialized MbimTransport object, in which case, this object will use that object rather than try to create its own MbimTransport object. |
void QmuxTransport_ShutDown | ( | QmuxTransport * | pThis | ) |
Shut down the transport layer.
[in] | pThis | The primary object of this call. |
void QmuxTransport_AttachQmiService | ( | QmuxTransport * | pThis, |
struct QmiService * | pQmiService | ||
) |
Attaches a QMI service to the transport layer.
[in] | pThis | The primary object of this call. |
[in] | pQmiService | The QMI service to be attached. |
void QmuxTransport_DetachQmiService | ( | QmuxTransport * | pThis, |
struct QmiService * | pQmiService | ||
) |
Detaches a QMI service from the transport layer.
[in] | pThis | The primary object of this call. |
[in] | pQmiService | The QMI service to be detached. |
int QmuxTransport_SendQmiPacket | ( | QmuxTransport * | pThis, |
uint8_t | qmiServiceType, | ||
uint8_t | qmiClientId, | ||
uint16_t | qmiTransactionId, | ||
uint8_t * | qmiPacket, | ||
uint16_t | qmiPacketSize | ||
) |
Send a QMI request to the device and return immediately.
[in] | pThis | The primary object of this call. |
[in] | qmiServiceType | QMI service type. |
[in] | qmiClientId | QMI client ID. |
[in] | qmiTransactionId | QMI transaction ID. Can be used for tracking purposes. |
[in] | qmiPacket | Pointer to QMI request. |
[in] | qmiPacketSize | Size in bytes of QMI packet. |
void QmuxTransport_RegisterErrCallback | ( | QmuxTransport * | pThis, |
QMUX_TRANSPORT_ERR_CALLBACK | pErrCallback, | ||
void * | pErrCallbackContext | ||
) |
This function is for client applications to register for transport error info callbacks. The most recent callback registration is the only function that is invoked when device is removed.
[in] | pThis | The primary object of this call. |
[in] | pErrCallback | A valid function pointer to be notified when device is removed. NULL to disable callback notifications. |
[in] | pErrCallbackContext | User context when transport error callback is called |
int QmiSyncObject_Initialize | ( | QmiSyncObject * | pThis | ) |
Initialize sync object.
[in] | pThis | The primary object of this call. |
int QmiSyncObject_Destroy | ( | QmiSyncObject * | pThis | ) |
Destroy sync object.
[in] | pThis | The primary object of this call. |
int QmiSyncObject_Lock | ( | QmiSyncObject * | pThis | ) |
Lock sync object.
[in] | pThis | The primary object of this call. |
int QmiSyncObject_Unlock | ( | QmiSyncObject * | pThis | ) |
Unlock sync object.
[in] | pThis | The primary object of this call. |
int QmiSyncObject_Wait | ( | QmiSyncObject * | pThis | ) |
Block, waiting on sync object.
[in] | pThis | The primary object of this call. |
int QmiSyncObject_TimedWait | ( | QmiSyncObject * | pThis, |
time_t | timeoutSeconds | ||
) |
Block, waiting on sync object for a number of seconds.
[in] | pThis | The primary object of this call. |
[in] | timeoutSeconds | Timeout in seconds before abondoning wait. |
int QmiSyncObject_Signal | ( | QmiSyncObject * | pThis | ) |
Signal sync object. Waiting thread should wake up.
[in] | pThis | The primary object of this call. |
void QmiSyncObject_ResponseCallback | ( | uint8_t * | qmiPacket, |
uint16_t | qmiPacketSize, | ||
void * | pResponseCallbackContext | ||
) |
This funcion copies QMI response packet to buffer and signals the waiting thread.
[in] | qmiPacket | Received QMI packet. |
[in] | qmiPacketSize | Received QMI packet size in bytes. |
[in] | pResponseCallbackContext | Pointer to this sync object. |