FreeCalypso > hg > tcs211-fcmodem
comparison gpf/INC/pco_view_framesupp.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 | Project : PCO2 | |
4 | Modul : PCO_VIEW_FRAMESUPP | |
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 viewer class derived directly from the | |
18 | core. | |
19 | It supports decoding of frame SYST_MESSAGEs and of LTS-Header/ | |
20 | TIF-ASCII-DATA-messages. | |
21 | It is still intended to be specialized and extended, e.g. in | |
22 | GUI-server-applications. | |
23 | Some member functions are totally virtual without any | |
24 | standard body and have to be provided by the child class ! | |
25 +----------------------------------------------------------------------------- | |
26 */ | |
27 | |
28 #ifndef _PCO_VIEW_FRAMESUPP_H_ | |
29 #define _PCO_VIEW_FRAMESUPP_H_ | |
30 | |
31 /*==== INCLUDES ===================================================*/ | |
32 #ifndef PCO_VIEW_FRAMESUPP_CPP_CCD | |
33 #include "pco_view_core.h" | |
34 #else | |
35 #include "view/pco_view_core.h" | |
36 #endif | |
37 | |
38 #ifdef USE_CCD | |
39 extern "C" | |
40 { | |
41 #include "ccdtable.h" | |
42 #include "ccddata.h" | |
43 } | |
44 #include "ccdedit.h" | |
45 #include "view/pco_pdi.h" | |
46 #endif /* USE_CCD */ | |
47 | |
48 #include <time.h> | |
49 | |
50 /*==== DEFINES =====================================================*/ | |
51 #define PCO_STR2IND_NOT_LOADED 0 | |
52 #define PCO_STR2IND_AUTO_LOADED 1 | |
53 #define PCO_STR2IND_MAN_LOADED 2 | |
54 #define PCO_STR2IND_SEARCHING 3 | |
55 | |
56 /*==== PROTOTYPES ==================================================*/ | |
57 | |
58 /*==== CLASSES =====================================================*/ | |
59 class PCOView_frameSupp : public PCOView_core | |
60 { | |
61 public: | |
62 PCOView_frameSupp(const char* ini_file, int& err, | |
63 const char* primq_name="", | |
64 const char* ctrlq_name=""); | |
65 virtual ~PCOView_frameSupp(); | |
66 | |
67 /* | |
68 +-------------------------------------------------------------------------------------+ | |
69 | PROJECT : PCO2 MODULE : PCO_VIEW_FRAMESUPP | | |
70 | STATE : code ROUTINE : PCOView_frameSupp::interpret_message | | |
71 +-------------------------------------------------------------------------------------+ | |
72 | |
73 PURPOSE : here interpretation of received raw data takes place | |
74 (has to be implemented by derived classes !) | |
75 | |
76 PARAMS: buffer .. raw data to be interpretated | |
77 bufsize .. size of buffer | |
78 data .. actual data | |
79 size .. size of data | |
80 id .. id of data message | |
81 index .. index of data message (e.g. in logfile) ... 0 means no index!! | |
82 ttype .. type of time stamp - see PCO_TTYPE_XXX constants | |
83 time .. time stamp | |
84 sender .. name of sender | |
85 receiver.. name of original receiver | |
86 | |
87 RETURNS: 0 .. success | |
88 -1 .. interpretation was not possible | |
89 | |
90 */ | |
91 virtual int interpret_message(void* buffer, U16 bufsize, | |
92 void* &data, U16 &size, ULONG &id, ULONG& index, ULONG& ttype, U32 &time, | |
93 char* &sender, char* &receiver); | |
94 | |
95 /* | |
96 +--------------------------------------------------------------------------------+ | |
97 | PROJECT : PCO2 MODULE : PCO_VIEW_FRAMESUPP | | |
98 | STATE : code ROUTINE : PCOView_frameSupp::on_connected | | |
99 +--------------------------------------------------------------------------------+ | |
100 | |
101 PURPOSE : reaction to PCO_CONNECTED from server | |
102 | |
103 PARAMS: buf .. data containing server type | |
104 sender .. server queue name | |
105 | |
106 RETURNS: 0 .. server type supported | |
107 -1 .. server type not supported | |
108 | |
109 */ | |
110 virtual int on_connected(const void *buf,const char* sender); | |
111 | |
112 /* | |
113 +--------------------------------------------------------------------------------------+ | |
114 | PROJECT : PCO2 MODULE : PCO_VIEW_FRAMESUPP | | |
115 | STATE : code ROUTINE : PCOView_frameSupp::decode_tracestring | | |
116 +--------------------------------------------------------------------------------------+ | |
117 | |
118 PURPOSE : tries to decode an OPC in the tracestring (e.g. $<OPC>) | |
119 | |
120 PARAMS: instr .. original tracestring | |
121 size .. max size for outstr | |
122 | |
123 RETURNS: 0 .. success (outstr contains new tracestring) | |
124 -1 .. no success while decoding | |
125 -2 .. no decoding necessary | |
126 | |
127 lastOPC .. in case of success contains last opc found in instr | |
128 | |
129 */ | |
130 int decode_tracestring(const char* instr, char* outstr, U16 size, ULONG &lastOPC); | |
131 | |
132 /* | |
133 +-----------------------------------------------------------------------------------+ | |
134 | PROJECT : PCO2 MODULE : PCO_CTRL_FRAMESUPP | | |
135 | STATE : code ROUTINE : PCOView_frameSupp::check_version | | |
136 +-----------------------------------------------------------------------------------+ | |
137 | |
138 PURPOSE : tries to request the version of a running stack via the server | |
139 -> will result in a SYST-trace starting with '&' | |
140 | |
141 PARAMS: | |
142 | |
143 RETURNS: 0 .. sucess | |
144 -1 .. Server not found | |
145 -2 .. error while contacting Server | |
146 | |
147 */ | |
148 int check_version(); | |
149 | |
150 /* | |
151 +--------------------------------------------------------------------------------------+ | |
152 | PROJECT : PCO2 MODULE : PCO_CTRL_FRAMESUPP | | |
153 | STATE : code ROUTINE : PCOView_frameSupp::check_communication| | |
154 +--------------------------------------------------------------------------------------+ | |
155 | |
156 PURPOSE : tries to send a system primitive to the running stack via the server | |
157 -> will result in SYST-traces if communication is ok | |
158 | |
159 PARAMS: | |
160 | |
161 RETURNS: 0 .. sucess | |
162 -1 .. Server not found | |
163 -2 .. error while contacting Server | |
164 | |
165 */ | |
166 int check_communication(); | |
167 | |
168 /* | |
169 +--------------------------------------------------------------------------------------+ | |
170 | PROJECT : PCO2 MODULE : PCO_VIEW_FRAMESUPP | | |
171 | STATE : code ROUTINE : PCOView_frameSupp::decode_ccd_msg | | |
172 +--------------------------------------------------------------------------------------+ | |
173 | |
174 PURPOSE : tries to decode a given encoded air message | |
175 | |
176 PARAMS: decinfo ... T_PDI_CCDMSG stuct (see pdi.h), | |
177 contains the coded sdu and info about, e.g., msg-type | |
178 decoded_msg ... buffer which will receive the decoded struct | |
179 | |
180 RETURNS: ccdOK, ccdWarning .. sucess | |
181 ccdError .. error while decoding | |
182 | |
183 */ | |
184 int decode_ccd_msg(const void* decinfo, UBYTE **decoded_msg); | |
185 | |
186 /* | |
187 +------------------------------------------------------------------------------------+ | |
188 | PROJECT : PCO2 MODULE : PCO_VIEW_FRAMESUPP | | |
189 | STATE : code ROUTINE : PCOView_frameSupp::free_ccd_msg | | |
190 +------------------------------------------------------------------------------------+ | |
191 | |
192 PURPOSE : frees a msg structure previously allocated using decode_ccd_msg | |
193 | |
194 PARAMS: decoded_msg ... buffer with decoded air message structure | |
195 | |
196 RETURNS: | |
197 | |
198 */ | |
199 void free_ccd_msg(void * decoded_msg); | |
200 | |
201 /* | |
202 +--------------------------------------------------------------------------------------+ | |
203 | PROJECT : PCO2 MODULE : PCO_VIEW_FRAMESUPP | | |
204 | STATE : code ROUTINE : PCOView_frameSupp::load_str2ind_table | | |
205 +--------------------------------------------------------------------------------------+ | |
206 | |
207 PURPOSE : tries to explicitely load a str2ind-table | |
208 | |
209 PARAMS: tname ... name of .tab-file | |
210 | |
211 RETURNS: 0 .. sucess | |
212 -1 .. error while loading | |
213 | |
214 */ | |
215 int load_str2ind_table(const char* tname); | |
216 | |
217 /* | |
218 +--------------------------------------------------------------------------------+ | |
219 | PROJECT : PCO2 MODULE : PCO_VIEW_FRAMESUPP | | |
220 | STATE : code ROUTINE : PCOView_frameSupp::on_inichange | | |
221 +--------------------------------------------------------------------------------+ | |
222 | |
223 PURPOSE : reloads important changes from ini-file | |
224 | |
225 PARAMS: | |
226 | |
227 */ | |
228 virtual void on_inichange(); | |
229 | |
230 /* | |
231 +--------------------------------------------------------------------------------+ | |
232 | PROJECT : PCO2 MODULE : PCO_VIEW_FRAMESUPP | | |
233 | STATE : code ROUTINE : PCOView_frameSupp::self_trace | | |
234 +--------------------------------------------------------------------------------+ | |
235 | |
236 PURPOSE : adds a new trace string to the queue of this viewer | |
237 | |
238 PARAMS: | |
239 | |
240 */ | |
241 virtual void self_trace(const char* trace); | |
242 | |
243 /* | |
244 +--------------------------------------------------------------------------------+ | |
245 | PROJECT : PCO2 MODULE : PCO_VIEW_FRAMESUPP | | |
246 | STATE : code ROUTINE : PCOView_frameSupp::send_syscmd | | |
247 +--------------------------------------------------------------------------------+ | |
248 | |
249 PURPOSE : tries to send a FRAME system command to the server | |
250 who will forward it to a connected protocol stack | |
251 | |
252 PARAMS: receiver ... receiver of the command | |
253 cmd ... the actual command (e.g. "TRACECLASS FF") | |
254 | |
255 RETURNS: 0 .. sucess | |
256 -1 .. Server not found | |
257 -2 .. error while contacting Server | |
258 | |
259 */ | |
260 int send_syscmd(const char* receiver, const char* cmd); | |
261 | |
262 /* | |
263 +--------------------------------------------------------------------------------+ | |
264 | PROJECT : PCO2 MODULE : PCO_VIEW_FRAMESUPP | | |
265 | STATE : code ROUTINE : PCOView_frameSupp::init_ccddata | | |
266 +--------------------------------------------------------------------------------+ | |
267 | |
268 PURPOSE : initialize ccddata from the given path | |
269 | |
270 PARAMS: ccddata_path ... path of the ccddata library | |
271 (if NULL path will be loaded from ini-file) | |
272 force ... 0..keep ccddata-lib loaded if there is one | |
273 1..exchange evtl. existing ccddata-lib | |
274 write ... 1..write new path to ini file if force is 1 | |
275 0..dont write new path to ini file | |
276 | |
277 RETURNS: 0 .. success | |
278 -1 .. error | |
279 | |
280 */ | |
281 int init_ccddata(const char* ccddata_path=NULL, | |
282 int force=0, int write=1); | |
283 | |
284 /* | |
285 +--------------------------------------------------------------------------------+ | |
286 | PROJECT : PCO2 MODULE : PCO_VIEW_FRAMESUPP | | |
287 | STATE : code ROUTINE : PCOView_frameSupp::exit_ccddata | | |
288 +--------------------------------------------------------------------------------+ | |
289 | |
290 PURPOSE : deinitializied ccddata | |
291 | |
292 PARAMS: | |
293 | |
294 RETURNS: 0 .. success | |
295 -1 .. error | |
296 | |
297 */ | |
298 int exit_ccddata(); | |
299 | |
300 /* | |
301 +------------------------------------------------------------------------------------+ | |
302 | PROJECT : PCO2 MODULE : PCO_VIEW_FRAMESUPP | | |
303 | STATE : code ROUTINE : PCOView_frameSupp::collect_pdi_data | | |
304 +------------------------------------------------------------------------------------+ | |
305 | |
306 PURPOSE : run through primitive top-level elements and call pdi_getDecodeInfo to | |
307 collect all potential infos for decoding an evtl. contained aim | |
308 | |
309 PARAMS: prim_data ... data of primitive | |
310 filterinfo_data ... data that holds filter info for the primitive | |
311 handle ... open handle for parsing the primitive | |
312 | |
313 RETURNS: | |
314 | |
315 */ | |
316 void collect_pdi_data(const char* prim_data, const char* filterinfo_data, T_CCDE_HANDLE handle); | |
317 | |
318 /* | |
319 +--------------------------------------------------------------------------------+ | |
320 | PROJECT : PCO2 MODULE : PCO_VIEW_FRAMESUPP | | |
321 | STATE : code ROUTINE : PCOView_frameSupp::elem_present | | |
322 +--------------------------------------------------------------------------------+ | |
323 | |
324 PURPOSE : check if element is present in specified primtive | |
325 | |
326 PARAMS: filterinfo_data ... data that holds filter info for the primitive | |
327 filterinfo_value ... buffer to receive filter info data for current element | |
328 handle ... open handle for parsing the primitive | |
329 desc ... current descriptor for parsing the primitive | |
330 | |
331 RETURNS: 1 ... present | |
332 0 ... not present | |
333 -1 ... error while calling read_elem | |
334 | |
335 */ | |
336 int elem_present(const char* filterinfo_data, char* filterinfo_value, T_CCDE_HANDLE handle, T_CCDE_ELEM_DESCR desc); | |
337 | |
338 /* | |
339 +------------------------------------------------------------------------------------+ | |
340 | PROJECT : PCO2 MODULE : PCO_VIEW_FRAMESUPP | | |
341 | STATE : code ROUTINE : PCOView_frameSupp::decode_pcon_prim | | |
342 +------------------------------------------------------------------------------------+ | |
343 | |
344 PURPOSE : if necessary tries to decode the given primitive using PCON | |
345 | |
346 PARAMS: opc ... primitive opc | |
347 coded_prim ... data of original prim | |
348 decoded_prim ... buffer which will point to the decoded prim | |
349 decoded_len ... length of decoded_prim buffer (without evtl. pointed to data areas) | |
350 filterinfo_prim | |
351 ... buffer which will be evtl. filled with a filterinfo shadow prim | |
352 containing only 0x00-s or 0xff-s per element | |
353 (in default case a NULL pointer is returned) | |
354 errstr ... will be filled with an error string in case of PCON error | |
355 (if NULL, no string will be written, | |
356 otherwise a buffer with min 500 bytes has to be provided!) | |
357 | |
358 RETURNS: PCON_OK .. PCON sucessfully applied | |
359 PCON_NOT_PRES .. PCON was not necessary | |
360 PCON_XXX .. error occured during PCON operation (see constants in pcon.h) | |
361 | |
362 */ | |
363 int decode_pcon_prim(ULONG opc, void * coded_prim, void ** decoded_prim, ULONG * decoded_len, | |
364 void ** filterinfo_prim, char* errstr=NULL); | |
365 | |
366 /* | |
367 +------------------------------------------------------------------------------------+ | |
368 | PROJECT : PCO2 MODULE : PCO_VIEW_FRAMESUPP | | |
369 | STATE : code ROUTINE : PCOView_frameSupp::free_pcon_prim | | |
370 +------------------------------------------------------------------------------------+ | |
371 | |
372 PURPOSE : frees a primitive previously allocated using decode_pcon_prim | |
373 | |
374 PARAMS: decoded_prim ... buffer with decoded prim | |
375 | |
376 RETURNS: | |
377 | |
378 */ | |
379 void free_pcon_prim(void * decoded_prim); | |
380 | |
381 int pcon() const { return m_pcon;} | |
382 int set_pcon(int pcon); | |
383 | |
384 bool ccddata_loaded(const char* ccddata_path=NULL); | |
385 const char* ccddata_path() const; | |
386 | |
387 const char* ind2str_dir() const { return m_ind2str_dir;} | |
388 void set_ind2str_dir(const char* dir); | |
389 | |
390 int ind2str_loaded() const { return m_ind2str_loaded;} | |
391 int unload_str2ind_table(); | |
392 void cancel_str2ind_search() { m_str2ind_continue_search=false;} | |
393 | |
394 long ind2str_version() const { return m_ind2str_version;} | |
395 const char* ind2str_file() const { return m_ind2str_file;} | |
396 | |
397 static long read_elem_save (T_CCDE_HANDLE * handle, | |
398 void * cstruct, | |
399 T_CCDE_ELEM_DESCR * edescr, | |
400 UBYTE * value); | |
401 | |
402 static USHORT prim_first_save (T_CCDE_HANDLE * phandle, | |
403 ULONG primcode, | |
404 char * name); | |
405 | |
406 static USHORT prim_next_save (T_CCDE_HANDLE *phandle, | |
407 UBYTE descent, | |
408 T_CCDE_ELEM_DESCR *pdescr); | |
409 | |
410 protected: | |
411 time_t m_str2ind_time; | |
412 bool m_show_str2ind_errors; | |
413 char m_ind2str_dir[MAX_PATH+1]; | |
414 int m_ind2str_loaded; | |
415 char m_ind2str_file[MAX_PATH+1]; | |
416 long m_ind2str_version; | |
417 bool m_ccddata_attached; | |
418 char m_tracestr_buf[DATA_MSG_MAX_SIZE+1]; | |
419 bool m_str2ind_continue_search; | |
420 int m_pcon; | |
421 | |
422 void (*m_ccddata_init_notify)(void); | |
423 void (*m_ccddata_exit_notify)(void); | |
424 }; | |
425 | |
426 #endif /* _PCO_VIEW_FRAMESUPP_H_ */ |