libpack  SLQS03.03.10
 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  libpack_log(eLOG_DEBUG,"[ pack] %s parameter NULL\n",__func__); \
23  return eQCWWAN_ERR_INVALID_ARG; \
24  }
25 
26 typedef void (* logger)(uint8_t lvl, const char* buff);
27 
28 extern logger glog;
29 extern uint8_t gloglvl;
30 
39 };
40 
45 {
46  eTIMEOUT_2_S = 2000,
47  eTIMEOUT_5_S = 5000,
48  eTIMEOUT_8_S = 8000,
49  eTIMEOUT_10_S = 10000,
50  eTIMEOUT_20_S = 20000,
51  eTIMEOUT_30_S = 30000,
52  eTIMEOUT_60_S = 60000,
53  eTIMEOUT_300_S = 300000,
55 };
56 
60 enum eQMI_SVC{
64  eNAS=3,
66  eSMS=5,
67  eUIM=0x0B,
68  eLOC=0x10,
69  eSWIOMA=240,
70  eSWILOC=246,
71 };
72 
76 enum msgtype{
77  eREQ=0,
78  eRSP=2,
79  eIND=4
80 };
81 
89 typedef struct{
90  uint16_t xid;
91  int timeout;
92  uint16_t msgid;
93  uint8_t svc;
94 } pack_qmi_t;
95 
102 typedef struct{
103  enum msgtype type;
104  uint16_t msgid;
105  uint16_t xid;
106 } unpack_qmi_t;
107 
108 uint16_t helper_get_xid(uint8_t *qmi_resp);
109 
118 const char* helper_get_resp_ctx(
119  uint8_t svc,
120  uint8_t *pbuf,
121  uint32_t len,
122  unpack_qmi_t *pCtx
123  );
124 
128 unsigned unpack_result_code_only(
129  uint8_t *pMdmResp);
130 
134 int helper_set_log_func(logger func);
135 
136 void libpack_log(
137  uint8_t lvl,
138  const char* fmt, ...
139  );
140 
144 int helper_set_log_lvl(uint8_t lvl);
145 
146 //internal helper for pack/unpack function
147 void fill_sdu_hdr(
148  pack_qmi_t *pCtx,
149  uint8_t *pReqBuf
150  );
151 
152 void fill_pack_ctx(
153  pack_qmi_t *pCtx,
154  uint8_t *pReqBuf,
155  uint16_t *pLen,
156  uint8_t svc,
157  int timeout
158  );
162 char* get_version();
163 #endif
void fill_pack_ctx(pack_qmi_t *pCtx, uint8_t *pReqBuf, uint16_t *pLen, uint8_t svc, int timeout)
int timeout
Definition: common.h:91
Definition: common.h:64
Definition: common.h:63
const char * helper_get_resp_ctx(uint8_t svc, uint8_t *pbuf, uint32_t len, unpack_qmi_t *pCtx)
Definition: common.h:38
Definition: common.h:46
void libpack_log(uint8_t lvl, const char *fmt,...)
Definition: common.h:47
int helper_set_log_lvl(uint8_t lvl)
Definition: common.h:79
Definition: common.h:67
Definition: common.h:49
Definition: common.h:54
Definition: common.h:77
Definition: common.h:70
Definition: common.h:69
logger glog
Definition: common.h:51
uint16_t helper_get_xid(uint8_t *qmi_resp)
Definition: common.h:37
Definition: common.h:66
Definition: common.h:65
eTimeout
Definition: common.h:44
uint16_t xid
Definition: common.h:105
uint16_t xid
Definition: common.h:90
Definition: common.h:61
uint16_t msgid
Definition: common.h:92
Definition: common.h:48
Definition: common.h:62
Definition: common.h:35
Definition: common.h:50
void(* logger)(uint8_t lvl, const char *buff)
Definition: common.h:26
void fill_sdu_hdr(pack_qmi_t *pCtx, uint8_t *pReqBuf)
Definition: common.h:102
uint8_t svc
Definition: common.h:93
Definition: common.h:53
char * get_version()
int helper_set_log_func(logger func)
uint16_t msgid
Definition: common.h:104
unsigned unpack_result_code_only(uint8_t *pMdmResp)
Definition: common.h:89
Definition: common.h:36
uint8_t gloglvl
Definition: common.h:52
eLOG_LEVEL
Definition: common.h:34
eQMI_SVC
Definition: common.h:60
Definition: common.h:68
msgtype
Definition: common.h:76
Definition: common.h:78

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