LinuxQMISDK  SLQS04.00.05
 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  eTMD=0x18,
86  eRMS=225,
87  eSWIOMA=240,
88  eSWIM2MCMD=243, // 0xF3 SWI M2M general commands
90  eSWILOC=246,
91 };
92 
96 enum msgtype{
97  eREQ=0,
98  eRSP=2,
99  eIND=4
100 };
101 
109 typedef struct{
110  uint16_t xid;
111  int timeout;
112  uint16_t msgid;
113  uint8_t svc;
114 } pack_qmi_t;
115 
122 typedef struct{
123  enum msgtype type;
124  uint16_t msgid;
125  uint16_t xid;
126 } unpack_qmi_t;
127 
128 uint16_t helper_get_xid(uint8_t *qmi_resp);
129 
138 const char* helper_get_resp_ctx(
139  uint8_t svc,
140  uint8_t *pbuf,
141  uint32_t len,
142  unpack_qmi_t *pCtx
143  );
144 
148 unsigned unpack_result_code_only(
149  uint8_t *pMdmResp);
150 
154 int helper_set_log_func(logger func);
155 
156 void liteqmi_log(
157  uint8_t lvl,
158  const char* fmt, ...
159  );
160 
164 int helper_set_log_lvl(uint8_t lvl);
165 
166 //internal helper for pack/unpack function
167 void fill_sdu_hdr(
168  pack_qmi_t *pCtx,
169  uint8_t *pReqBuf
170  );
171 
172 void fill_pack_ctx(
173  pack_qmi_t *pCtx,
174  uint8_t *pReqBuf,
175  uint16_t *pLen,
176  uint8_t svc,
177  int timeout
178  );
182 char* get_version();
183 
187 char* liteqmi_GetVersion();
188 
189 #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:111
Definition: common.h:84
Definition: common.h:76
Definition: common.h:75
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:85
Definition: common.h:59
int helper_set_log_lvl(uint8_t lvl)
Definition: common.h:99
Definition: common.h:81
Definition: common.h:82
Definition: common.h:61
Definition: common.h:66
Definition: common.h:97
Definition: common.h:90
Definition: common.h:87
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:125
uint16_t xid
Definition: common.h:110
Definition: common.h:73
void liteqmi_log(uint8_t lvl, const char *fmt,...)
uint16_t msgid
Definition: common.h:112
Definition: common.h:60
Definition: common.h:74
Definition: common.h:47
char * liteqmi_GetVersion()
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:86
Definition: common.h:89
Definition: common.h:122
uint8_t svc
Definition: common.h:113
Definition: common.h:65
Definition: common.h:88
char * get_version()
int helper_set_log_func(logger func)
uint16_t msgid
Definition: common.h:124
unsigned unpack_result_code_only(uint8_t *pMdmResp)
Definition: common.h:109
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:96
Definition: common.h:98

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