LinuxQMISDK-Lite  SLQS04.00.08
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
common.h
Go to the documentation of this file.
1 
6 #ifndef __COMMON_H
7 #define __COMMON_H
8 #include <stdint.h>
9 #define SDU_HDR_LEN (3)
10 #define MINREQBKLEN (2048)
11 #define MSGID_AND_LEN (4)
12 #define MSGID_DONT_CARE (0xffff)
13 
14 #ifndef UNUSEDPARAM
15 #define UNUSEDPARAM( x ) (void)x
16 #endif
17 
18 #define DEAULT_LOC_TIMEOUT_IN_SEC 2
19 #define SDK_VALIDATE_INPUT_PACK_PARAM(pCtx, pBuf, pLen ) \
20  if ((pCtx == NULL) || (pBuf == NULL) || (pLen == NULL) ) \
21  {\
22  liteqmi_log(eLOG_DEBUG,"[ pack] %s parameter NULL\n",__func__); \
23  return eQCWWAN_ERR_INVALID_ARG; \
24  }
25 
26 #define SDK_VALIDATE_INPUT_PACK_PARAM_AND_FILL_XID(pCtx, pBuf, pLen ) \
27  if ((pCtx == NULL) || (pBuf == NULL) || (pLen == NULL) ) \
28  {\
29  liteqmi_log(eLOG_DEBUG,"[ pack] %s parameter NULL\n",__func__); \
30  return eQCWWAN_ERR_INVALID_ARG; \
31  } \
32  if (pCtx->xid == 0) \
33  return eQCWWAN_ERR_INVALID_XID; \
34  pBuf[0] = eREQ; \
35  pBuf[1] = pCtx->xid & 0xff; \
36  pBuf[2] = pCtx->xid >> 8;
37 
38 typedef void (* logger)(uint8_t lvl, const char* buff);
39 
40 extern logger glog;
41 extern uint8_t gloglvl;
42 
51 };
52 
57 {
58  eTIMEOUT_2_S = 2000,
59  eTIMEOUT_5_S = 5000,
60  eTIMEOUT_8_S = 8000,
61  eTIMEOUT_10_S = 10000,
62  eTIMEOUT_20_S = 20000,
63  eTIMEOUT_30_S = 30000,
64  eTIMEOUT_60_S = 60000,
65  eTIMEOUT_300_S = 300000,
67 };
68 
72 enum eQMI_SVC{
76  eNAS=3,
78  eSMS=5,
79  ePDS=0x06,
80  eVOICE=0x09,
81  eCAT=0x0A,
82  eUIM=0x0B,
83  eLOC=0x10,
84  eSAR=0x11,
85  eIMS=0x12, // 012 IMS Service
86  eTMD=0x18,
87  eIMSA=0x21,
88  eRMS=225,
89  eSWIOMA=240,
90  eAUDIO=241,
91  eSWIM2MCMD=243, // 0xF3 SWI M2M general commands
93  eSWIAUDIO= 245, // 245 Swi Audio service
94  eSWILOC=246,
95 };
96 
100 enum msgtype{
101  eREQ=0,
102  eRSP=2,
104 };
105 
113 typedef struct{
114  uint16_t xid;
115  int timeout;
116  uint16_t msgid;
117  uint8_t svc;
118 } pack_qmi_t;
119 
126 typedef struct{
127  enum msgtype type;
128  uint16_t msgid;
129  uint16_t xid;
130 } unpack_qmi_t;
131 
132 uint16_t helper_get_xid(uint8_t *qmi_resp);
133 
142 const char* helper_get_resp_ctx(
143  uint8_t svc,
144  uint8_t *pbuf,
145  uint32_t len,
146  unpack_qmi_t *pCtx
147  );
148 
152 unsigned unpack_result_code_only(
153  uint8_t *pMdmResp);
154 
158 int helper_set_log_func(logger func);
159 
160 void liteqmi_log(
161  uint8_t lvl,
162  const char* fmt, ...
163  );
164 
168 int helper_set_log_lvl(uint8_t lvl);
169 
170 //internal helper for pack/unpack function
171 void fill_sdu_hdr(
172  pack_qmi_t *pCtx,
173  uint8_t *pReqBuf
174  );
175 
176 void fill_pack_ctx(
177  pack_qmi_t *pCtx,
178  uint8_t *pReqBuf,
179  uint16_t *pLen,
180  uint8_t svc,
181  int timeout
182  );
186 char* get_version();
187 
191 char* liteqmi_GetVersion();
192 
200  uint8_t *encoded_str,
201  uint8_t encoded_len,
202  uint8_t *decoded_str
203  );
204 
205 #endif
void fill_pack_ctx(pack_qmi_t *pCtx, uint8_t *pReqBuf, uint16_t *pLen, uint8_t svc, int timeout)
Definition: common.h:79
int timeout
Definition: common.h:115
Definition: common.h:84
Definition: common.h:76
Definition: common.h:75
Definition: common.h:85
const char * helper_get_resp_ctx(uint8_t svc, uint8_t *pbuf, uint32_t len, unpack_qmi_t *pCtx)
Definition: common.h:50
Definition: common.h:58
Definition: common.h:86
Definition: common.h:59
int helper_set_log_lvl(uint8_t lvl)
Definition: common.h:103
Definition: common.h:81
Definition: common.h:82
Definition: common.h:61
Definition: common.h:66
Definition: common.h:101
Definition: common.h:94
Definition: common.h:89
logger glog
Definition: common.h:63
uint16_t helper_get_xid(uint8_t *qmi_resp)
Definition: common.h:49
Definition: common.h:78
Definition: common.h:80
Definition: common.h:77
eTimeout
Definition: common.h:56
uint16_t xid
Definition: common.h:129
uint16_t xid
Definition: common.h:114
Definition: common.h:73
void liteqmi_log(uint8_t lvl, const char *fmt,...)
uint16_t msgid
Definition: common.h:116
Definition: common.h:60
Definition: common.h:90
Definition: common.h:74
void liteqmi_helper_decode7bitAsciiEncString(uint8_t *encoded_str, uint8_t encoded_len, uint8_t *decoded_str)
Definition: common.h:47
char * liteqmi_GetVersion()
Definition: common.h:93
Definition: common.h:62
void(* logger)(uint8_t lvl, const char *buff)
Definition: common.h:38
void fill_sdu_hdr(pack_qmi_t *pCtx, uint8_t *pReqBuf)
Definition: common.h:88
Definition: common.h:92
Definition: common.h:126
uint8_t svc
Definition: common.h:117
Definition: common.h:65
Definition: common.h:91
char * get_version()
int helper_set_log_func(logger func)
uint16_t msgid
Definition: common.h:128
unsigned unpack_result_code_only(uint8_t *pMdmResp)
Definition: common.h:87
Definition: common.h:113
Definition: common.h:48
uint8_t gloglvl
Definition: common.h:64
eLOG_LEVEL
Definition: common.h:46
eQMI_SVC
Definition: common.h:72
Definition: common.h:83
msgtype
Definition: common.h:100
Definition: common.h:102

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