comparison g23m/condat/ms/src/bmi/MmiGprs.h @ 0:509db1a7b7b8

initial import: leo2moko-r1
author Space Falcon <falcon@ivan.Harhan.ORG>
date Mon, 01 Jun 2015 03:24:05 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:509db1a7b7b8
1 /*******************************************************************************
2
3 CONDAT (UK)
4
5 ********************************************************************************
6
7 This software product is the property of Condat (UK) Ltd and may not be
8 disclosed to any third party without the express permission of the owner.
9
10 ********************************************************************************
11
12 $Project name:
13 $Project code:
14 $Module:
15 $File: MmiGprs.h
16 $Revision:
17
18 $Author: Condat(UK)
19 $Date:
20
21 ********************************************************************************
22
23 Description:
24 Header file for GPRS handling for MMI.
25
26
27 ********************************************************************************
28
29 $History: MmiGprs.h
30
31 15/05/2003 - SPR#1983 - SH - Updated to latest from 1.6.3 version.
32
33 $End
34
35 *******************************************************************************/
36
37 #ifndef _MMI_GPRS_H_
38 #define _MMI_GPRS_H_
39
40 #ifndef WIN32 // EF GPRS testing enabled for windows
41 #undef TEST_MMIGPRS /* GPRS testing, gives extra menu functions */
42 #endif
43
44 /*******************************************************************************
45
46 GLOBAL DEFINITIONS
47
48 *******************************************************************************/
49
50 /* GPRS states */
51
52 enum
53 {
54 GPRS_NOTHING = -1, /* Nothing - no event to send */
55 GPRS_OFF = 0, /* GPRS is not attached */
56 GPRS_SEARCHING,
57 GPRS_ATTACHED, /* GPRS is attached */
58 GPRS_CONTEXT_ACTIVATE, /* PDP context is activated */
59 GPRS_CONTEXT_DEACTIVATE, /* PDP context is deactivated */
60 GPRS_ERROR /* General GPRS error */
61 };
62
63 #if (BOARD == 61)
64 /* EDGE states */
65 enum
66 {
67 EDGE_NOTHING = -1, /* Nothing - no event to send */
68 EDGE_OFF = 0, /* EDGE is not attached */
69 EDGE_SEARCHING,
70 EDGE_ATTACHED, /* EDGE is attached */
71 EDGE_CONTEXT_ACTIVATE, /* PDP context is activated */
72 EDGE_CONTEXT_DEACTIVATE, /* PDP context is deactivated */
73 EDGE_ERROR /* General EDGE error */
74 };
75 #endif
76
77 typedef enum
78 {
79 MMI_GPRS_STATUS_IDLE,
80 MMI_GPRS_STATUS_ATTACHING,
81 MMI_GPRS_STATUS_DETACHING,
82 MMI_GPRS_STATUS_DATA_COUNTER
83 };
84
85 /* SMS options */
86
87 enum
88 {
89 SMS_SERVICE_GPRS = 0,
90 SMS_SERVICE_CS,
91 SMS_SERVICE_GPRS_PREF,
92 SMS_SERVICE_CS_PREF,
93 SMS_SERVICE_OMITTED = 0xFF
94 };
95
96 /* Quality of service (QOS) parameters */
97
98 enum
99 {
100 QOS_PRECED_HIGH = 1,
101 QOS_PRECED_NORMAL,
102 QOS_PRECED_LOW
103 };
104
105 enum
106 {
107 QOS_BEST = 1
108 };
109
110 /* Callback function */
111
112 typedef void (*T_GPRS_CB) (int);// Earlier argument not used
113
114 void GPRS_Init(void);
115 void GPRS_Exit(void);
116 void GPRS_SetCallback(T_MFW_HND win, T_GPRS_CB callback);
117
118 /* GPRS functionality */
119
120 int GPRS_Status(void);
121 int GPRS_Attach(T_MFW_HND win);
122 int GPRS_Detach(T_MFW_HND win);
123 int GPRS_ContextDefine(SHORT cid, char *IPAddress, char *APN);
124 int GPRS_ContextActivate(SHORT cid);
125 int GPRS_ContextDeactivate(SHORT cid);
126 int GPRS_SetQOS(SHORT cid, UBYTE preced, UBYTE delay, UBYTE relclass, UBYTE peak, UBYTE mean);
127 int GPRS_SetMinQOS(SHORT cid, UBYTE preced, UBYTE delay, UBYTE relclass, UBYTE peak, UBYTE mean);
128 UBYTE GPRS_SmsService(void);
129 UBYTE GPRS_SetSmsService(UBYTE service);
130
131 /* MMI functionality */
132
133 int GPRS_MenuAttach(MfwMnu* m, MfwMnuItem* i);
134 int GPRS_MenuDetach(MfwMnu* m, MfwMnuItem* i);
135 int GPRS_MenuIncomingDataCount(MfwMnu* m, MfwMnuItem* i);
136 int GPRS_MenuOutgoingDataCount(MfwMnu* m, MfwMnuItem* i);
137 int GPRS_MenuSelectSms(MfwMnu* menu, MfwMnuItem* item);
138 int GPRS_MenuSelectSms_set(MfwMnu* menu, MfwMnuItem* item);
139
140
141 /*******************************************************************************
142
143 LOCAL DATA TYPES
144
145 *******************************************************************************/
146
147 #define ULONG_SIZE_IN_DECIMAL 10 /* Max no. of decimal digits a ULONG can have */
148 #define KILOBYTE 1024 /* No of bytes in a kilobyte, used for data counter calculation. */
149 #define PLEASEWAIT_TIMEOUT 35000 /* Time for "please wait" window to time out */
150
151 /* Counter types */
152
153 typedef enum
154 {
155 MMI_GPRS_COUNTER_UPLINK,
156 MMI_GPRS_COUNTER_DOWNLINK
157 } T_MMI_GPRS_COUNTER;
158
159 /* GPRS data */
160
161 typedef struct
162 {
163 T_MFW_HND mfw_gprs; /* Provide a handle to the GPRS information. */
164 UBYTE cid; /* The context id. Starts at 1 then increments. */
165 UBYTE reg_status; /* Registration status */
166 MfwHnd pleasewait_win; /* Handle for the Please Wait window */
167 MfwHnd edit_win; /* Handle for editor window */
168 MfwHnd menu_win; /* Handler for menu windows */
169 char *counterstring; /* String for counter digits */
170 ULONG uplink_counter; /* Value of uplink counter */
171 ULONG downlink_counter; /* Value of downlink counter */
172 USHORT counter_type; /* TRUE if uplink counter has been requested */
173 UBYTE sms_service; /* Type of SMS service */
174 BOOL display; /* Whether to display "OK" windows or not */
175 USHORT status; /* Current status */
176 T_MFW_HND notify_win; /* Window to which to send notification */
177 T_GPRS_CB callback; /* MMI provided callback function */
178 }
179 T_MMI_GPRS_DATA;
180
181
182 /*******************************************************************************
183
184 LOCAL FUNCTION PROTOTYPES
185
186 *******************************************************************************/
187
188 static T_MFW_HND GPRS_PleaseWait(T_MFW_HND parent_win, USHORT TextId1, USHORT TextId2);
189 static void GPRS_PleaseWaitCb(T_MFW_HND win, UBYTE identifier, UBYTE reason);
190 static void GPRS_PleaseWaitDestroy(void);
191 static void GPRS_ShowCounter(T_MFW_HND win);
192 static void GPRS_ShowCounterCb(T_MFW_HND win, USHORT identifier, USHORT reason);
193 static void GPRS_ResetCounter(T_MFW_HND win, UBYTE identifier, UBYTE reason);
194 static void GPRS_DestroyCounter(void);
195 static void GPRS_UpdateCounter(void);
196 static int GPRS_MfwCb(T_MFW_EVENT event, void* para);
197 #endif