comparison gsm-fw/gpf/inc/pco_view_templ.h @ 316:79080922d8e4

GPF: FRAME C sources and include files imported from LoCosto source
author Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
date Thu, 10 Apr 2014 04:06:05 +0000
parents
children
comparison
equal deleted inserted replaced
315:1b4beffc8055 316:79080922d8e4
1 /*
2 +-----------------------------------------------------------------------------
3 | Project : PCO2
4 | Modul : PCO_VIEW_TEMPLATE
5 +-----------------------------------------------------------------------------
6 | Copyright 2002 Texas Instruments Berlin, AG
7 | All rights reserved.
8 |
9 | This file is confidential and a trade secret of Texas
10 | Instruments Berlin, AG
11 | The receipt of or possession of this file does not convey
12 | any rights to reproduce or disclose its contents or to
13 | manufacture, use, or sell anything it may describe, in
14 | whole, or in part, without the specific written consent of
15 | Texas Instruments Berlin, AG.
16 +-----------------------------------------------------------------------------
17 | Purpose : This Modul contains a template of a PCO viewer class
18 | with basic functions for several PCO control messages.
19 | It can either be used just to connect to a PCO server or
20 | can be specialized and extended like in PCOView_templ.
21 +-----------------------------------------------------------------------------
22 */
23
24 #ifndef _PCO_VIEW_TEMPL_H_
25 #define _PCO_VIEW_TEMPL_H_
26
27 /*==== INCLUDES ===================================================*/
28 #include "pco_const.h"
29
30 /*==== DEFINES =====================================================*/
31
32 /*==== PROTOTYPES ==================================================*/
33
34 /*==== CLASSES =====================================================*/
35 class PCOView_templ
36 {
37 public:
38 /*
39 +-------------------------------------------------------------------------------+
40 | PROJECT : PCO2 MODULE : PCO_VIEW_TEMPL |
41 | STATE : code ROUTINE : PCOView_templ::PCOView_templ |
42 +-------------------------------------------------------------------------------+
43
44 PURPOSE : initilizes viewer process
45
46 PARAMS: primq .. name of primitive queue
47 ctrlq .. name of control queue
48
49 RETURNS:
50
51 */
52 PCOView_templ(const char* primq_name="", const char* ctrlq_name="");
53 virtual ~PCOView_templ();
54
55 /*
56 +-------------------------------------------------------------------------------+
57 | PROJECT : PCO2 MODULE : PCO_VIEW_TEMPL |
58 | STATE : code ROUTINE : PCOView_templ::connect |
59 +-------------------------------------------------------------------------------+
60
61 PURPOSE : tries to connect with server
62
63 PARAMS:
64
65 RETURNS: 0 .. sucess
66 -1 .. Server not found
67 -2 .. error while contacting Server
68
69 */
70 int connect(void);
71
72 /*
73 +-------------------------------------------------------------------------------+
74 | PROJECT : PCO2 MODULE : PCO_VIEW_TEMPL |
75 | STATE : code ROUTINE : PCOView_templ::subscribe |
76 +-------------------------------------------------------------------------------+
77
78 PURPOSE : tries to subscribe for live data from server
79
80 PARAMS: mobileId .. name of mobile to receive live data from (may be empty)
81
82 RETURNS: 0 .. sucess
83 -1 .. Server not found
84 -2 .. error while contacting Server
85
86 */
87 int subscribe(const char* mobileId);
88
89 /*
90 +-------------------------------------------------------------------------------+
91 | PROJECT : PCO2 MODULE : PCO_VIEW_TEMPL |
92 | STATE : code ROUTINE : PCOView_templ::send2srv |
93 +-------------------------------------------------------------------------------+
94
95 PURPOSE : tries to send a data buffer to the server
96
97 PARAMS: buf ... pointer to buffer
98 size .. size of buffer
99 id ... message id
100
101 RETURNS: 0 .. sucess
102 -1 .. Server not found
103 -2 .. error while contacting Server
104
105 */
106 int send2srv(void* buf, U16 size, U16 id);
107
108 /*
109 +-------------------------------------------------------------------------------+
110 | PROJECT : PCO2 MODULE : PCO_VIEW_TEMPL |
111 | STATE : code ROUTINE : PCOView_templ::disconnect |
112 +-------------------------------------------------------------------------------+
113
114 PURPOSE : tries to disconnect from server
115
116 PARAMS:
117
118 RETURNS: 0 .. sucess
119 -1 .. Server not found
120 -2 .. error while contacting Server
121
122 */
123 int disconnect(void);
124
125 /*
126 +-------------------------------------------------------------------------------+
127 | PROJECT : PCO2 MODULE : PCO_VIEW_TEMPL |
128 | STATE : code ROUTINE : PCOView_templ::unsubscribe |
129 +-------------------------------------------------------------------------------+
130
131 PURPOSE : tries to unsubscribe from livedata stream from server
132
133 PARAMS:
134
135 RETURNS: 0 .. sucess
136 -1 .. Server not found
137 -2 .. error while contacting Server
138
139 */
140 int unsubscribe(void);
141
142 /*
143 +-------------------------------------------------------------------------------+
144 | PROJECT : PCO2 MODULE : PCO_VIEW_TEMPL |
145 | STATE : code ROUTINE : PCOView_templ::on_connected |
146 +-------------------------------------------------------------------------------+
147
148 PURPOSE : reaction to PCO_CONNECTED from server
149
150 PARAMS: buf .. data containing server type
151 sender .. server queue name
152
153 RETURNS: 0 .. server type supported
154 -1 .. server type not supported
155
156 */
157 virtual int on_connected(const void *buf,const char* sender);
158
159 /*
160 +---------------------------------------------------------------------------------+
161 | PROJECT : PCO2 MODULE : PCO_VIEW_TEMPL |
162 | STATE : code ROUTINE : PCOView_templ::req_logfile_info |
163 +---------------------------------------------------------------------------------+
164
165 PURPOSE : contacts server to request info about a specified logfile
166
167 PARAMS: fname .. name of logfile (can be full path)
168
169 RETURNS: 0 .. sucess
170 -1 .. Server not found
171 -2 .. error while contacting Server
172
173 */
174 int req_logfile_info(const char* fname);
175
176 /*
177 +-------------------------------------------------------------------------------+
178 | PROJECT : PCO2 MODULE : PCO_VIEW_TEMPL |
179 | STATE : code ROUTINE : PCOView_templ::get_logdata |
180 +-------------------------------------------------------------------------------+
181
182 PURPOSE : contacts server to request logged data
183
184 PARAMS: begin, end .. index area requested
185
186 RETURNS: 0 .. sucess
187 -1 .. Server not found
188 -2 .. error while contacting Server
189
190 */
191 int get_logdata(ULONG begin, ULONG end);
192
193 /*
194 +-------------------------------------------------------------------------------+
195 | PROJECT : PCO2 MODULE : PCO_VIEW_TEMPL |
196 | STATE : code ROUTINE : PCOView_templ::open_logfile |
197 +-------------------------------------------------------------------------------+
198
199 PURPOSE : contacts server to request logged data from a specified logfile
200
201 PARAMS: fname .. name of logfile (full path)
202 begin, end .. index area requested
203
204 RETURNS: 0 .. sucess
205 -1 .. Server not found
206 -2 .. error while contacting Server
207
208 */
209 int open_logfile(const char* fname, ULONG begin=0, ULONG end=0);
210
211 /*
212 +-------------------------------------------------------------------------------+
213 | PROJECT : PCO2 MODULE : PCO_VIEW_TEMPL |
214 | STATE : code ROUTINE : PCOView_templ::set_filter |
215 +-------------------------------------------------------------------------------+
216
217 PURPOSE : contacts server to change filter settings
218
219 PARAMS: list .. '\0'-separated list of names of entitities
220 (terminated by "\0\0")
221 primitives/traces from entities in -list-
222 should not be forwarded
223
224 prim_trace
225 .. parameter to disable/enable general forwarding of
226 primitives/traces:
227 0 .. fowarding of everything (default)
228 1 .. no primitives
229 2 .. no traces
230 positiv_list
231 .. if true, only primitives/traces from entities in -list-
232 will be forwarded
233
234 RETURNS: 0 .. sucess
235 -1 .. Server not found
236 -2 .. error while contacting Server
237
238 */
239 int set_filter(const char* list, char prim_trace=0, bool positiv_list=false);
240
241 /*
242 +-------------------------------------------------------------------------------+
243 | PROJECT : PCO2 MODULE : PCO_VIEW_TEMPL |
244 | STATE : code ROUTINE : PCOView_templ::self_send |
245 +-------------------------------------------------------------------------------+
246
247 PURPOSE : tries to send a data buffer to the control queue of this viewer
248
249 PARAMS: buf ... pointer to buffer
250 size .. size of buffer
251 id ... message id
252
253 RETURNS: 0 .. sucess
254 -1 .. receiver not found
255 -2 .. error while contacting receiver
256
257 */
258 int self_send(void* buf, U16 size, U16 id);
259
260 const char *primq_name() { return m_primq_name;}
261 const char *ctrlq_name() { return m_ctrlq_name;}
262
263 /*
264 +-------------------------------------------------------------------------------+
265 | PROJECT : PCO2 MODULE : PCO_VIEW_TEMPL |
266 | STATE : code ROUTINE : PCOView_templ::start_logfile |
267 +-------------------------------------------------------------------------------+
268
269 PURPOSE : contacts server to start logging data received in the given queue
270 into the given logfile
271
272 PARAMS: logfile .. name of the logfile
273 (if no path is given the current server-path is used)
274 queue .. name of the queue the server shall receive data
275 (it will be created by the server)
276 (if no queue is given, m_ctrlq_name+"_LF" is used)
277
278 RETURNS: 0 .. sucess
279 -1 .. receiver not found
280 -2 .. error while contacting receiver
281 */
282 int start_logfile(const char* logfile, const char* queue=NULL);
283
284 /*
285 +-------------------------------------------------------------------------------+
286 | PROJECT : PCO2 MODULE : PCO_VIEW_TEMPL |
287 | STATE : code ROUTINE : PCOView_templ::stop_logfile |
288 +-------------------------------------------------------------------------------+
289
290 PURPOSE : contacts server to stop logging data received in the given queue
291
292 PARAMS: queue .. name of the queue the server received data
293 (if no queue is given, m_ctrlq_name+"_LF" is used)
294
295 RETURNS: 0 .. sucess
296 -1 .. receiver not found
297 -2 .. error while contacting receiver
298 */
299 int stop_logfile(const char* queue=NULL);
300
301 /*
302 +-------------------------------------------------------------------------------+
303 | PROJECT : PCO2 MODULE : PCO_VIEW_TEMPL |
304 | STATE : code ROUTINE : PCOView_templ::send_raw_data |
305 +-------------------------------------------------------------------------------+
306
307 PURPOSE : sends raw data to the given queue
308
309 PARAMS: rawdata .. the data
310 rawsize .. size of rawdata
311 queue .. name of the queue the data will be sent to
312 (if no queue is given, m_ctrlq_name+"_LF" is used)
313
314 RETURNS: 0 .. sucess
315 -1 .. receiver not found
316 -2 .. error while contacting receiver
317 */
318 int send_raw_data(const void* rawdata, U16 rawsize, const char* queue=NULL);
319
320 /*
321 +-------------------------------------------------------------------------------+
322 | PROJECT : PCO2 MODULE : PCO_VIEW_TEMPL |
323 | STATE : code ROUTINE : PCOView_templ::set_srv_name |
324 +-------------------------------------------------------------------------------+
325
326 PURPOSE : change the name of the server queue
327
328 PARAMS: sname ... new name of server queue
329
330 */
331 void set_srv_name(const char* sname);
332
333 U8 srv_type() const { return m_srv_type;}
334
335 protected:
336 char m_primq_name[MAX_QNAME_LEN+1],m_ctrlq_name[MAX_QNAME_LEN+1];
337 char m_srvq_name[MAX_QNAME_LEN+1];
338 U8 m_srv_type;
339 };
340
341 #endif /* _PCO_VIEW_TEMPL_H_ */