/[dtapublic]/to_be_filed/winprojs/scirfmmon/source/log_packet.c
ViewVC logotype

Contents of /to_be_filed/winprojs/scirfmmon/source/log_packet.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 29 - (show annotations) (download)
Sat Oct 8 07:08:47 2016 UTC (7 years, 11 months ago) by dashley
File MIME type: text/plain
File size: 178386 byte(s)
Directories relocated.
1 //$Header: /home/dashley/cvsrep/e3ft_gpl01/e3ft_gpl01/winprojs/scirfmmon/source/log_packet.c,v 1.24 2009/01/17 22:12:37 dashley Exp $
2 //--------------------------------------------------------------------------------
3 //Copyright 2008 David T. Ashley
4 //-------------------------------------------------------------------------------------------------
5 //This source code and any program in which it is compiled/used is provided under the GNU GENERAL
6 //PUBLIC LICENSE, Version 3, full license text below.
7 //-------------------------------------------------------------------------------------------------
8 // GNU GENERAL PUBLIC LICENSE
9 // Version 3, 29 June 2007
10 //
11 // Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
12 // Everyone is permitted to copy and distribute verbatim copies
13 // of this license document, but changing it is not allowed.
14 //
15 // Preamble
16 //
17 // The GNU General Public License is a free, copyleft license for
18 //software and other kinds of works.
19 //
20 // The licenses for most software and other practical works are designed
21 //to take away your freedom to share and change the works. By contrast,
22 //the GNU General Public License is intended to guarantee your freedom to
23 //share and change all versions of a program--to make sure it remains free
24 //software for all its users. We, the Free Software Foundation, use the
25 //GNU General Public License for most of our software; it applies also to
26 //any other work released this way by its authors. You can apply it to
27 //your programs, too.
28 //
29 // When we speak of free software, we are referring to freedom, not
30 //price. Our General Public Licenses are designed to make sure that you
31 //have the freedom to distribute copies of free software (and charge for
32 //them if you wish), that you receive source code or can get it if you
33 //want it, that you can change the software or use pieces of it in new
34 //free programs, and that you know you can do these things.
35 //
36 // To protect your rights, we need to prevent others from denying you
37 //these rights or asking you to surrender the rights. Therefore, you have
38 //certain responsibilities if you distribute copies of the software, or if
39 //you modify it: responsibilities to respect the freedom of others.
40 //
41 // For example, if you distribute copies of such a program, whether
42 //gratis or for a fee, you must pass on to the recipients the same
43 //freedoms that you received. You must make sure that they, too, receive
44 //or can get the source code. And you must show them these terms so they
45 //know their rights.
46 //
47 // Developers that use the GNU GPL protect your rights with two steps:
48 //(1) assert copyright on the software, and (2) offer you this License
49 //giving you legal permission to copy, distribute and/or modify it.
50 //
51 // For the developers' and authors' protection, the GPL clearly explains
52 //that there is no warranty for this free software. For both users' and
53 //authors' sake, the GPL requires that modified versions be marked as
54 //changed, so that their problems will not be attributed erroneously to
55 //authors of previous versions.
56 //
57 // Some devices are designed to deny users access to install or run
58 //modified versions of the software inside them, although the manufacturer
59 //can do so. This is fundamentally incompatible with the aim of
60 //protecting users' freedom to change the software. The systematic
61 //pattern of such abuse occurs in the area of products for individuals to
62 //use, which is precisely where it is most unacceptable. Therefore, we
63 //have designed this version of the GPL to prohibit the practice for those
64 //products. If such problems arise substantially in other domains, we
65 //stand ready to extend this provision to those domains in future versions
66 //of the GPL, as needed to protect the freedom of users.
67 //
68 // Finally, every program is threatened constantly by software patents.
69 //States should not allow patents to restrict development and use of
70 //software on general-purpose computers, but in those that do, we wish to
71 //avoid the special danger that patents applied to a free program could
72 //make it effectively proprietary. To prevent this, the GPL assures that
73 //patents cannot be used to render the program non-free.
74 //
75 // The precise terms and conditions for copying, distribution and
76 //modification follow.
77 //
78 // TERMS AND CONDITIONS
79 //
80 // 0. Definitions.
81 //
82 // "This License" refers to version 3 of the GNU General Public License.
83 //
84 // "Copyright" also means copyright-like laws that apply to other kinds of
85 //works, such as semiconductor masks.
86 //
87 // "The Program" refers to any copyrightable work licensed under this
88 //License. Each licensee is addressed as "you". "Licensees" and
89 //"recipients" may be individuals or organizations.
90 //
91 // To "modify" a work means to copy from or adapt all or part of the work
92 //in a fashion requiring copyright permission, other than the making of an
93 //exact copy. The resulting work is called a "modified version" of the
94 //earlier work or a work "based on" the earlier work.
95 //
96 // A "covered work" means either the unmodified Program or a work based
97 //on the Program.
98 //
99 // To "propagate" a work means to do anything with it that, without
100 //permission, would make you directly or secondarily liable for
101 //infringement under applicable copyright law, except executing it on a
102 //computer or modifying a private copy. Propagation includes copying,
103 //distribution (with or without modification), making available to the
104 //public, and in some countries other activities as well.
105 //
106 // To "convey" a work means any kind of propagation that enables other
107 //parties to make or receive copies. Mere interaction with a user through
108 //a computer network, with no transfer of a copy, is not conveying.
109 //
110 // An interactive user interface displays "Appropriate Legal Notices"
111 //to the extent that it includes a convenient and prominently visible
112 //feature that (1) displays an appropriate copyright notice, and (2)
113 //tells the user that there is no warranty for the work (except to the
114 //extent that warranties are provided), that licensees may convey the
115 //work under this License, and how to view a copy of this License. If
116 //the interface presents a list of user commands or options, such as a
117 //menu, a prominent item in the list meets this criterion.
118 //
119 // 1. Source Code.
120 //
121 // The "source code" for a work means the preferred form of the work
122 //for making modifications to it. "Object code" means any non-source
123 //form of a work.
124 //
125 // A "Standard Interface" means an interface that either is an official
126 //standard defined by a recognized standards body, or, in the case of
127 //interfaces specified for a particular programming language, one that
128 //is widely used among developers working in that language.
129 //
130 // The "System Libraries" of an executable work include anything, other
131 //than the work as a whole, that (a) is included in the normal form of
132 //packaging a Major Component, but which is not part of that Major
133 //Component, and (b) serves only to enable use of the work with that
134 //Major Component, or to implement a Standard Interface for which an
135 //implementation is available to the public in source code form. A
136 //"Major Component", in this context, means a major essential component
137 //(kernel, window system, and so on) of the specific operating system
138 //(if any) on which the executable work runs, or a compiler used to
139 //produce the work, or an object code interpreter used to run it.
140 //
141 // The "Corresponding Source" for a work in object code form means all
142 //the source code needed to generate, install, and (for an executable
143 //work) run the object code and to modify the work, including scripts to
144 //control those activities. However, it does not include the work's
145 //System Libraries, or general-purpose tools or generally available free
146 //programs which are used unmodified in performing those activities but
147 //which are not part of the work. For example, Corresponding Source
148 //includes interface definition files associated with source files for
149 //the work, and the source code for shared libraries and dynamically
150 //linked subprograms that the work is specifically designed to require,
151 //such as by intimate data communication or control flow between those
152 //subprograms and other parts of the work.
153 //
154 // The Corresponding Source need not include anything that users
155 //can regenerate automatically from other parts of the Corresponding
156 //Source.
157 //
158 // The Corresponding Source for a work in source code form is that
159 //same work.
160 //
161 // 2. Basic Permissions.
162 //
163 // All rights granted under this License are granted for the term of
164 //copyright on the Program, and are irrevocable provided the stated
165 //conditions are met. This License explicitly affirms your unlimited
166 //permission to run the unmodified Program. The output from running a
167 //covered work is covered by this License only if the output, given its
168 //content, constitutes a covered work. This License acknowledges your
169 //rights of fair use or other equivalent, as provided by copyright law.
170 //
171 // You may make, run and propagate covered works that you do not
172 //convey, without conditions so long as your license otherwise remains
173 //in force. You may convey covered works to others for the sole purpose
174 //of having them make modifications exclusively for you, or provide you
175 //with facilities for running those works, provided that you comply with
176 //the terms of this License in conveying all material for which you do
177 //not control copyright. Those thus making or running the covered works
178 //for you must do so exclusively on your behalf, under your direction
179 //and control, on terms that prohibit them from making any copies of
180 //your copyrighted material outside their relationship with you.
181 //
182 // Conveying under any other circumstances is permitted solely under
183 //the conditions stated below. Sublicensing is not allowed; section 10
184 //makes it unnecessary.
185 //
186 // 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
187 //
188 // No covered work shall be deemed part of an effective technological
189 //measure under any applicable law fulfilling obligations under article
190 //11 of the WIPO copyright treaty adopted on 20 December 1996, or
191 //similar laws prohibiting or restricting circumvention of such
192 //measures.
193 //
194 // When you convey a covered work, you waive any legal power to forbid
195 //circumvention of technological measures to the extent such circumvention
196 //is effected by exercising rights under this License with respect to
197 //the covered work, and you disclaim any intention to limit operation or
198 //modification of the work as a means of enforcing, against the work's
199 //users, your or third parties' legal rights to forbid circumvention of
200 //technological measures.
201 //
202 // 4. Conveying Verbatim Copies.
203 //
204 // You may convey verbatim copies of the Program's source code as you
205 //receive it, in any medium, provided that you conspicuously and
206 //appropriately publish on each copy an appropriate copyright notice;
207 //keep intact all notices stating that this License and any
208 //non-permissive terms added in accord with section 7 apply to the code;
209 //keep intact all notices of the absence of any warranty; and give all
210 //recipients a copy of this License along with the Program.
211 //
212 // You may charge any price or no price for each copy that you convey,
213 //and you may offer support or warranty protection for a fee.
214 //
215 // 5. Conveying Modified Source Versions.
216 //
217 // You may convey a work based on the Program, or the modifications to
218 //produce it from the Program, in the form of source code under the
219 //terms of section 4, provided that you also meet all of these conditions:
220 //
221 // a) The work must carry prominent notices stating that you modified
222 // it, and giving a relevant date.
223 //
224 // b) The work must carry prominent notices stating that it is
225 // released under this License and any conditions added under section
226 // 7. This requirement modifies the requirement in section 4 to
227 // "keep intact all notices".
228 //
229 // c) You must license the entire work, as a whole, under this
230 // License to anyone who comes into possession of a copy. This
231 // License will therefore apply, along with any applicable section 7
232 // additional terms, to the whole of the work, and all its parts,
233 // regardless of how they are packaged. This License gives no
234 // permission to license the work in any other way, but it does not
235 // invalidate such permission if you have separately received it.
236 //
237 // d) If the work has interactive user interfaces, each must display
238 // Appropriate Legal Notices; however, if the Program has interactive
239 // interfaces that do not display Appropriate Legal Notices, your
240 // work need not make them do so.
241 //
242 // A compilation of a covered work with other separate and independent
243 //works, which are not by their nature extensions of the covered work,
244 //and which are not combined with it such as to form a larger program,
245 //in or on a volume of a storage or distribution medium, is called an
246 //"aggregate" if the compilation and its resulting copyright are not
247 //used to limit the access or legal rights of the compilation's users
248 //beyond what the individual works permit. Inclusion of a covered work
249 //in an aggregate does not cause this License to apply to the other
250 //parts of the aggregate.
251 //
252 // 6. Conveying Non-Source Forms.
253 //
254 // You may convey a covered work in object code form under the terms
255 //of sections 4 and 5, provided that you also convey the
256 //machine-readable Corresponding Source under the terms of this License,
257 //in one of these ways:
258 //
259 // a) Convey the object code in, or embodied in, a physical product
260 // (including a physical distribution medium), accompanied by the
261 // Corresponding Source fixed on a durable physical medium
262 // customarily used for software interchange.
263 //
264 // b) Convey the object code in, or embodied in, a physical product
265 // (including a physical distribution medium), accompanied by a
266 // written offer, valid for at least three years and valid for as
267 // long as you offer spare parts or customer support for that product
268 // model, to give anyone who possesses the object code either (1) a
269 // copy of the Corresponding Source for all the software in the
270 // product that is covered by this License, on a durable physical
271 // medium customarily used for software interchange, for a price no
272 // more than your reasonable cost of physically performing this
273 // conveying of source, or (2) access to copy the
274 // Corresponding Source from a network server at no charge.
275 //
276 // c) Convey individual copies of the object code with a copy of the
277 // written offer to provide the Corresponding Source. This
278 // alternative is allowed only occasionally and noncommercially, and
279 // only if you received the object code with such an offer, in accord
280 // with subsection 6b.
281 //
282 // d) Convey the object code by offering access from a designated
283 // place (gratis or for a charge), and offer equivalent access to the
284 // Corresponding Source in the same way through the same place at no
285 // further charge. You need not require recipients to copy the
286 // Corresponding Source along with the object code. If the place to
287 // copy the object code is a network server, the Corresponding Source
288 // may be on a different server (operated by you or a third party)
289 // that supports equivalent copying facilities, provided you maintain
290 // clear directions next to the object code saying where to find the
291 // Corresponding Source. Regardless of what server hosts the
292 // Corresponding Source, you remain obligated to ensure that it is
293 // available for as long as needed to satisfy these requirements.
294 //
295 // e) Convey the object code using peer-to-peer transmission, provided
296 // you inform other peers where the object code and Corresponding
297 // Source of the work are being offered to the general public at no
298 // charge under subsection 6d.
299 //
300 // A separable portion of the object code, whose source code is excluded
301 //from the Corresponding Source as a System Library, need not be
302 //included in conveying the object code work.
303 //
304 // A "User Product" is either (1) a "consumer product", which means any
305 //tangible personal property which is normally used for personal, family,
306 //or household purposes, or (2) anything designed or sold for incorporation
307 //into a dwelling. In determining whether a product is a consumer product,
308 //doubtful cases shall be resolved in favor of coverage. For a particular
309 //product received by a particular user, "normally used" refers to a
310 //typical or common use of that class of product, regardless of the status
311 //of the particular user or of the way in which the particular user
312 //actually uses, or expects or is expected to use, the product. A product
313 //is a consumer product regardless of whether the product has substantial
314 //commercial, industrial or non-consumer uses, unless such uses represent
315 //the only significant mode of use of the product.
316 //
317 // "Installation Information" for a User Product means any methods,
318 //procedures, authorization keys, or other information required to install
319 //and execute modified versions of a covered work in that User Product from
320 //a modified version of its Corresponding Source. The information must
321 //suffice to ensure that the continued functioning of the modified object
322 //code is in no case prevented or interfered with solely because
323 //modification has been made.
324 //
325 // If you convey an object code work under this section in, or with, or
326 //specifically for use in, a User Product, and the conveying occurs as
327 //part of a transaction in which the right of possession and use of the
328 //User Product is transferred to the recipient in perpetuity or for a
329 //fixed term (regardless of how the transaction is characterized), the
330 //Corresponding Source conveyed under this section must be accompanied
331 //by the Installation Information. But this requirement does not apply
332 //if neither you nor any third party retains the ability to install
333 //modified object code on the User Product (for example, the work has
334 //been installed in ROM).
335 //
336 // The requirement to provide Installation Information does not include a
337 //requirement to continue to provide support service, warranty, or updates
338 //for a work that has been modified or installed by the recipient, or for
339 //the User Product in which it has been modified or installed. Access to a
340 //network may be denied when the modification itself materially and
341 //adversely affects the operation of the network or violates the rules and
342 //protocols for communication across the network.
343 //
344 // Corresponding Source conveyed, and Installation Information provided,
345 //in accord with this section must be in a format that is publicly
346 //documented (and with an implementation available to the public in
347 //source code form), and must require no special password or key for
348 //unpacking, reading or copying.
349 //
350 // 7. Additional Terms.
351 //
352 // "Additional permissions" are terms that supplement the terms of this
353 //License by making exceptions from one or more of its conditions.
354 //Additional permissions that are applicable to the entire Program shall
355 //be treated as though they were included in this License, to the extent
356 //that they are valid under applicable law. If additional permissions
357 //apply only to part of the Program, that part may be used separately
358 //under those permissions, but the entire Program remains governed by
359 //this License without regard to the additional permissions.
360 //
361 // When you convey a copy of a covered work, you may at your option
362 //remove any additional permissions from that copy, or from any part of
363 //it. (Additional permissions may be written to require their own
364 //removal in certain cases when you modify the work.) You may place
365 //additional permissions on material, added by you to a covered work,
366 //for which you have or can give appropriate copyright permission.
367 //
368 // Notwithstanding any other provision of this License, for material you
369 //add to a covered work, you may (if authorized by the copyright holders of
370 //that material) supplement the terms of this License with terms:
371 //
372 // a) Disclaiming warranty or limiting liability differently from the
373 // terms of sections 15 and 16 of this License; or
374 //
375 // b) Requiring preservation of specified reasonable legal notices or
376 // author attributions in that material or in the Appropriate Legal
377 // Notices displayed by works containing it; or
378 //
379 // c) Prohibiting misrepresentation of the origin of that material, or
380 // requiring that modified versions of such material be marked in
381 // reasonable ways as different from the original version; or
382 //
383 // d) Limiting the use for publicity purposes of names of licensors or
384 // authors of the material; or
385 //
386 // e) Declining to grant rights under trademark law for use of some
387 // trade names, trademarks, or service marks; or
388 //
389 // f) Requiring indemnification of licensors and authors of that
390 // material by anyone who conveys the material (or modified versions of
391 // it) with contractual assumptions of liability to the recipient, for
392 // any liability that these contractual assumptions directly impose on
393 // those licensors and authors.
394 //
395 // All other non-permissive additional terms are considered "further
396 //restrictions" within the meaning of section 10. If the Program as you
397 //received it, or any part of it, contains a notice stating that it is
398 //governed by this License along with a term that is a further
399 //restriction, you may remove that term. If a license document contains
400 //a further restriction but permits relicensing or conveying under this
401 //License, you may add to a covered work material governed by the terms
402 //of that license document, provided that the further restriction does
403 //not survive such relicensing or conveying.
404 //
405 // If you add terms to a covered work in accord with this section, you
406 //must place, in the relevant source files, a statement of the
407 //additional terms that apply to those files, or a notice indicating
408 //where to find the applicable terms.
409 //
410 // Additional terms, permissive or non-permissive, may be stated in the
411 //form of a separately written license, or stated as exceptions;
412 //the above requirements apply either way.
413 //
414 // 8. Termination.
415 //
416 // You may not propagate or modify a covered work except as expressly
417 //provided under this License. Any attempt otherwise to propagate or
418 //modify it is void, and will automatically terminate your rights under
419 //this License (including any patent licenses granted under the third
420 //paragraph of section 11).
421 //
422 // However, if you cease all violation of this License, then your
423 //license from a particular copyright holder is reinstated (a)
424 //provisionally, unless and until the copyright holder explicitly and
425 //finally terminates your license, and (b) permanently, if the copyright
426 //holder fails to notify you of the violation by some reasonable means
427 //prior to 60 days after the cessation.
428 //
429 // Moreover, your license from a particular copyright holder is
430 //reinstated permanently if the copyright holder notifies you of the
431 //violation by some reasonable means, this is the first time you have
432 //received notice of violation of this License (for any work) from that
433 //copyright holder, and you cure the violation prior to 30 days after
434 //your receipt of the notice.
435 //
436 // Termination of your rights under this section does not terminate the
437 //licenses of parties who have received copies or rights from you under
438 //this License. If your rights have been terminated and not permanently
439 //reinstated, you do not qualify to receive new licenses for the same
440 //material under section 10.
441 //
442 // 9. Acceptance Not Required for Having Copies.
443 //
444 // You are not required to accept this License in order to receive or
445 //run a copy of the Program. Ancillary propagation of a covered work
446 //occurring solely as a consequence of using peer-to-peer transmission
447 //to receive a copy likewise does not require acceptance. However,
448 //nothing other than this License grants you permission to propagate or
449 //modify any covered work. These actions infringe copyright if you do
450 //not accept this License. Therefore, by modifying or propagating a
451 //covered work, you indicate your acceptance of this License to do so.
452 //
453 // 10. Automatic Licensing of Downstream Recipients.
454 //
455 // Each time you convey a covered work, the recipient automatically
456 //receives a license from the original licensors, to run, modify and
457 //propagate that work, subject to this License. You are not responsible
458 //for enforcing compliance by third parties with this License.
459 //
460 // An "entity transaction" is a transaction transferring control of an
461 //organization, or substantially all assets of one, or subdividing an
462 //organization, or merging organizations. If propagation of a covered
463 //work results from an entity transaction, each party to that
464 //transaction who receives a copy of the work also receives whatever
465 //licenses to the work the party's predecessor in interest had or could
466 //give under the previous paragraph, plus a right to possession of the
467 //Corresponding Source of the work from the predecessor in interest, if
468 //the predecessor has it or can get it with reasonable efforts.
469 //
470 // You may not impose any further restrictions on the exercise of the
471 //rights granted or affirmed under this License. For example, you may
472 //not impose a license fee, royalty, or other charge for exercise of
473 //rights granted under this License, and you may not initiate litigation
474 //(including a cross-claim or counterclaim in a lawsuit) alleging that
475 //any patent claim is infringed by making, using, selling, offering for
476 //sale, or importing the Program or any portion of it.
477 //
478 // 11. Patents.
479 //
480 // A "contributor" is a copyright holder who authorizes use under this
481 //License of the Program or a work on which the Program is based. The
482 //work thus licensed is called the contributor's "contributor version".
483 //
484 // A contributor's "essential patent claims" are all patent claims
485 //owned or controlled by the contributor, whether already acquired or
486 //hereafter acquired, that would be infringed by some manner, permitted
487 //by this License, of making, using, or selling its contributor version,
488 //but do not include claims that would be infringed only as a
489 //consequence of further modification of the contributor version. For
490 //purposes of this definition, "control" includes the right to grant
491 //patent sublicenses in a manner consistent with the requirements of
492 //this License.
493 //
494 // Each contributor grants you a non-exclusive, worldwide, royalty-free
495 //patent license under the contributor's essential patent claims, to
496 //make, use, sell, offer for sale, import and otherwise run, modify and
497 //propagate the contents of its contributor version.
498 //
499 // In the following three paragraphs, a "patent license" is any express
500 //agreement or commitment, however denominated, not to enforce a patent
501 //(such as an express permission to practice a patent or covenant not to
502 //sue for patent infringement). To "grant" such a patent license to a
503 //party means to make such an agreement or commitment not to enforce a
504 //patent against the party.
505 //
506 // If you convey a covered work, knowingly relying on a patent license,
507 //and the Corresponding Source of the work is not available for anyone
508 //to copy, free of charge and under the terms of this License, through a
509 //publicly available network server or other readily accessible means,
510 //then you must either (1) cause the Corresponding Source to be so
511 //available, or (2) arrange to deprive yourself of the benefit of the
512 //patent license for this particular work, or (3) arrange, in a manner
513 //consistent with the requirements of this License, to extend the patent
514 //license to downstream recipients. "Knowingly relying" means you have
515 //actual knowledge that, but for the patent license, your conveying the
516 //covered work in a country, or your recipient's use of the covered work
517 //in a country, would infringe one or more identifiable patents in that
518 //country that you have reason to believe are valid.
519 //
520 // If, pursuant to or in connection with a single transaction or
521 //arrangement, you convey, or propagate by procuring conveyance of, a
522 //covered work, and grant a patent license to some of the parties
523 //receiving the covered work authorizing them to use, propagate, modify
524 //or convey a specific copy of the covered work, then the patent license
525 //you grant is automatically extended to all recipients of the covered
526 //work and works based on it.
527 //
528 // A patent license is "discriminatory" if it does not include within
529 //the scope of its coverage, prohibits the exercise of, or is
530 //conditioned on the non-exercise of one or more of the rights that are
531 //specifically granted under this License. You may not convey a covered
532 //work if you are a party to an arrangement with a third party that is
533 //in the business of distributing software, under which you make payment
534 //to the third party based on the extent of your activity of conveying
535 //the work, and under which the third party grants, to any of the
536 //parties who would receive the covered work from you, a discriminatory
537 //patent license (a) in connection with copies of the covered work
538 //conveyed by you (or copies made from those copies), or (b) primarily
539 //for and in connection with specific products or compilations that
540 //contain the covered work, unless you entered into that arrangement,
541 //or that patent license was granted, prior to 28 March 2007.
542 //
543 // Nothing in this License shall be construed as excluding or limiting
544 //any implied license or other defenses to infringement that may
545 //otherwise be available to you under applicable patent law.
546 //
547 // 12. No Surrender of Others' Freedom.
548 //
549 // If conditions are imposed on you (whether by court order, agreement or
550 //otherwise) that contradict the conditions of this License, they do not
551 //excuse you from the conditions of this License. If you cannot convey a
552 //covered work so as to satisfy simultaneously your obligations under this
553 //License and any other pertinent obligations, then as a consequence you may
554 //not convey it at all. For example, if you agree to terms that obligate you
555 //to collect a royalty for further conveying from those to whom you convey
556 //the Program, the only way you could satisfy both those terms and this
557 //License would be to refrain entirely from conveying the Program.
558 //
559 // 13. Use with the GNU Affero General Public License.
560 //
561 // Notwithstanding any other provision of this License, you have
562 //permission to link or combine any covered work with a work licensed
563 //under version 3 of the GNU Affero General Public License into a single
564 //combined work, and to convey the resulting work. The terms of this
565 //License will continue to apply to the part which is the covered work,
566 //but the special requirements of the GNU Affero General Public License,
567 //section 13, concerning interaction through a network will apply to the
568 //combination as such.
569 //
570 // 14. Revised Versions of this License.
571 //
572 // The Free Software Foundation may publish revised and/or new versions of
573 //the GNU General Public License from time to time. Such new versions will
574 //be similar in spirit to the present version, but may differ in detail to
575 //address new problems or concerns.
576 //
577 // Each version is given a distinguishing version number. If the
578 //Program specifies that a certain numbered version of the GNU General
579 //Public License "or any later version" applies to it, you have the
580 //option of following the terms and conditions either of that numbered
581 //version or of any later version published by the Free Software
582 //Foundation. If the Program does not specify a version number of the
583 //GNU General Public License, you may choose any version ever published
584 //by the Free Software Foundation.
585 //
586 // If the Program specifies that a proxy can decide which future
587 //versions of the GNU General Public License can be used, that proxy's
588 //public statement of acceptance of a version permanently authorizes you
589 //to choose that version for the Program.
590 //
591 // Later license versions may give you additional or different
592 //permissions. However, no additional obligations are imposed on any
593 //author or copyright holder as a result of your choosing to follow a
594 //later version.
595 //
596 // 15. Disclaimer of Warranty.
597 //
598 // THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
599 //APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
600 //HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
601 //OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
602 //THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
603 //PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
604 //IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
605 //ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
606 //
607 // 16. Limitation of Liability.
608 //
609 // IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
610 //WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
611 //THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
612 //GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
613 //USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
614 //DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
615 //PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
616 //EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
617 //SUCH DAMAGES.
618 //
619 // 17. Interpretation of Sections 15 and 16.
620 //
621 // If the disclaimer of warranty and limitation of liability provided
622 //above cannot be given local legal effect according to their terms,
623 //reviewing courts shall apply local law that most closely approximates
624 //an absolute waiver of all civil liability in connection with the
625 //Program, unless a warranty or assumption of liability accompanies a
626 //copy of the Program in return for a fee.
627 //
628 // END OF TERMS AND CONDITIONS
629 //
630 // How to Apply These Terms to Your New Programs
631 //
632 // If you develop a new program, and you want it to be of the greatest
633 //possible use to the public, the best way to achieve this is to make it
634 //free software which everyone can redistribute and change under these terms.
635 //
636 // To do so, attach the following notices to the program. It is safest
637 //to attach them to the start of each source file to most effectively
638 //state the exclusion of warranty; and each file should have at least
639 //the "copyright" line and a pointer to where the full notice is found.
640 //
641 // <one line to give the program's name and a brief idea of what it does.>
642 // Copyright (C) <year> <name of author>
643 //
644 // This program is free software: you can redistribute it and/or modify
645 // it under the terms of the GNU General Public License as published by
646 // the Free Software Foundation, either version 3 of the License, or
647 // (at your option) any later version.
648 //
649 // This program is distributed in the hope that it will be useful,
650 // but WITHOUT ANY WARRANTY; without even the implied warranty of
651 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
652 // GNU General Public License for more details.
653 //
654 // You should have received a copy of the GNU General Public License
655 // along with this program. If not, see <http://www.gnu.org/licenses/>.
656 //
657 //Also add information on how to contact you by electronic and paper mail.
658 //
659 // If the program does terminal interaction, make it output a short
660 //notice like this when it starts in an interactive mode:
661 //
662 // <program> Copyright (C) <year> <name of author>
663 // This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
664 // This is free software, and you are welcome to redistribute it
665 // under certain conditions; type `show c' for details.
666 //
667 //The hypothetical commands `show w' and `show c' should show the appropriate
668 //parts of the General Public License. Of course, your program's commands
669 //might be different; for a GUI interface, you would use an "about box".
670 //
671 // You should also get your employer (if you work as a programmer) or school,
672 //if any, to sign a "copyright disclaimer" for the program, if necessary.
673 //For more information on this, and how to apply and follow the GNU GPL, see
674 //<http://www.gnu.org/licenses/>.
675 //
676 // The GNU General Public License does not permit incorporating your program
677 //into proprietary programs. If your program is a subroutine library, you
678 //may consider it more useful to permit linking proprietary applications with
679 //the library. If this is what you want to do, use the GNU Lesser General
680 //Public License instead of this License. But first, please read
681 //<http://www.gnu.org/philosophy/why-not-lgpl.html>.
682 //-------------------------------------------------------------------------------------------------
683 //--------------------------------------------------------------------------------
684 //This file is part of scirfmmon.
685 //
686 //scirfmmon is free software: you can redistribute it and/or modify
687 //it under the terms of the GNU General Public License as published by
688 //the Free Software Foundation, either version 3 of the License, or
689 //(at your option) any later version.
690 //
691 //scirfmmon is distributed in the hope that it will be useful,
692 //but WITHOUT ANY WARRANTY; without even the implied warranty of
693 //MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
694 //GNU General Public License for more details.
695 //
696 //You should have received a copy of the GNU General Public License
697 //along with scirfmmon (see the file copying.txt). If not,
698 //see <http://www.gnu.org/licenses/>.
699 //--------------------------------------------------------------------------------
700 #define MODULE_LOG_PACKET
701
702 #include <stdio.h>
703 #include <sys/timeb.h>
704 #include <time.h>
705
706 #include "log_packet.h"
707
708 #include "c_main.h"
709 #include "ccmfatal.h"
710 #include "log.h"
711 #include "miscfunc.h"
712 #include "qchar.h"
713
714
715 static void LOG_PACKET_log_f_setpanid (int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console);
716 static void LOG_PACKET_log_f_acksetpanid (int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console);
717 static void LOG_PACKET_log_f_querypanid (int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console);
718 static void LOG_PACKET_log_f_resppanid (int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console);
719 static void LOG_PACKET_log_f_settransad (int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console);
720 static void LOG_PACKET_log_f_acksettransad (int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console);
721 static void LOG_PACKET_log_f_querytransad (int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console);
722 static void LOG_PACKET_log_f_resptransad (int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console);
723 static void LOG_PACKET_log_f_setrfchannel (int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console);
724 static void LOG_PACKET_log_f_acksetrfchannel (int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console);
725 static void LOG_PACKET_log_f_queryrfchannel (int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console);
726 static void LOG_PACKET_log_f_resprfchannel (int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console);
727 static void LOG_PACKET_log_f_endisallrfmsgs (int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console);
728 static void LOG_PACKET_log_f_ackendisallrfmsgs (int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console);
729 static void LOG_PACKET_log_f_queryrxallrfmsgsstatus (int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console);
730 static void LOG_PACKET_log_f_resprxallrfmsgsstatus (int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console);
731 static void LOG_PACKET_log_f_endisrfacksretries (int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console);
732 static void LOG_PACKET_log_f_ackendisrfacksretries (int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console);
733 static void LOG_PACKET_log_f_queryrfacksretriesstatus (int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console);
734 static void LOG_PACKET_log_f_resprfacksretriesstatus (int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console);
735 static void LOG_PACKET_log_f_setradiofeaturesoptions (int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console);
736 static void LOG_PACKET_log_f_acksetradiofeaturesoptions (int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console);
737 static void LOG_PACKET_log_f_queryradiofeaturesoptions (int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console);
738 static void LOG_PACKET_log_f_respradiofeaturesoptions (int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console);
739 static void LOG_PACKET_log_f_querystatistics (int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console);
740 static void LOG_PACKET_log_f_respstatistics (int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console);
741 static void LOG_PACKET_log_f_clearstatistics (int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console);
742 static void LOG_PACKET_log_f_ackclearstatistics (int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console);
743 static void LOG_PACKET_log_f_settxpowerlevel (int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console);
744 static void LOG_PACKET_log_f_acksettxpowerlevel (int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console);
745 static void LOG_PACKET_log_f_querytxpowerlevel (int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console);
746 static void LOG_PACKET_log_f_resptxpowerlevel (int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console);
747 static void LOG_PACKET_log_f_savecfgnvm (int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console);
748 static void LOG_PACKET_log_f_acksavecfgnvm (int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console);
749 static void LOG_PACKET_log_f_queryfirmwareversion (int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console);
750 static void LOG_PACKET_log_f_respfirmwareversion (int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console);
751 static void LOG_PACKET_log_f_setlowpowermode (int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console);
752 static void LOG_PACKET_log_f_acksetlowpowermode (int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console);
753 static void LOG_PACKET_log_f_senddata (int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console);
754 static void LOG_PACKET_log_f_acksenddata (int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console);
755 static void LOG_PACKET_log_f_rxeddata (int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console);
756 static void LOG_PACKET_log_f_resetrequest (int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console);
757 static void LOG_PACKET_log_f_ackresetrequest (int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console);
758 static void LOG_PACKET_log_f_sendmsgapp (int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console);
759 static void LOG_PACKET_log_f_acksendmsgapp (int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console);
760 static void LOG_PACKET_log_f_rxedmsgapp (int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console);
761 static void LOG_PACKET_log_f_initfirmwaredownload (int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console);
762 static void LOG_PACKET_log_f_ackinitfirmwaredownload (int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console);
763 static void LOG_PACKET_log_f_transferfirmwareblock (int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console);
764 static void LOG_PACKET_log_f_acktransferfirmwareblock (int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console);
765 static void LOG_PACKET_log_f_terminatedownload (int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console);
766 static void LOG_PACKET_log_f_ackterminatedownload (int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console);
767 static void LOG_PACKET_log_f_setdigpincfg (int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console);
768 static void LOG_PACKET_log_f_acksetdigpincfg (int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console);
769 static void LOG_PACKET_log_f_querydigpincfg (int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console);
770 static void LOG_PACKET_log_f_respdigpincfg (int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console);
771 static void LOG_PACKET_log_f_setdigpinstate (int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console);
772 static void LOG_PACKET_log_f_acksetdigpinstate (int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console);
773 static void LOG_PACKET_log_f_querydigpinstate (int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console);
774 static void LOG_PACKET_log_f_respdigpinstate (int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console);
775 static void LOG_PACKET_log_f_queryanalogpinvalues (int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console);
776 static void LOG_PACKET_log_f_respanalogpinvalues (int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console);
777 static void LOG_PACKET_log_f_setanalogpinsleepstate (int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console);
778 static void LOG_PACKET_log_f_acksetanalogpinsleepstate (int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console);
779 static void LOG_PACKET_log_f_queryanalogpinsleepstate (int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console);
780 static void LOG_PACKET_log_f_respanalogpinsleepstate (int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console);
781 static void LOG_PACKET_log_f_setdigpinsleepstate (int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console);
782 static void LOG_PACKET_log_f_acksetdigpinsleepstate (int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console);
783 static void LOG_PACKET_log_f_querydigpinsleepstate (int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console);
784 static void LOG_PACKET_log_f_respdigpinsleepstate (int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console);
785 static void LOG_PACKET_log_f_setdebugmode (int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console);
786 static void LOG_PACKET_log_f_acksetdebugmode (int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console);
787 static void LOG_PACKET_log_f_setledfunctionality (int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console);
788 static void LOG_PACKET_log_f_acksetledfunctionality (int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console);
789 static void LOG_PACKET_log_f_rxbytesidtoid (int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console);
790 static void LOG_PACKET_log_f_setprogrammablesettings (int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console);
791 static void LOG_PACKET_log_f_acksetprogrammablesettings (int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console);
792 static void LOG_PACKET_log_f_queryprogrammablesettings (int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console);
793 static void LOG_PACKET_log_f_respprogrammablesettings (int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console);
794
795
796 struct LOG_PACKET_pkt_types_struct
797 {
798 char *tag_terse; //Terse tag for the log file and so on identifying this packet type.
799 int type_byte; //The type byte value.
800 int length_byte_min; //The minimum length byte value.
801 int length_byte_max; //The maximum length byte value.
802 int valid_from_host; //TRUE if this is valid transmitted from the host microcontroller.
803 int valid_from_rf_mod; //TRUE if this is valid transmitted from the RF module.
804 void (*logptr)(int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console);
805 //Function that will parse the full packet and log any errors,
806 //then log the contents of the packet. Note that gross packet formatting
807 //errors (bad type, length, or checksum) are handled at a higher level. This
808 //only needs to flag errors in a packet with a correct type, length,
809 //and checksum.
810 };
811
812
813 static const struct LOG_PACKET_pkt_types_struct LOG_PACKET_pkt_type_lut_a[] =
814 {
815 //Tabulated in same order that appear in LSR documentation.
816 //p. 9
817 {
818 "SET_PAN_ID (0x01)",
819 0x01,
820 0x07,
821 0x07,
822 TRUE,
823 FALSE,
824 LOG_PACKET_log_f_setpanid
825 },
826 //p. 9
827 {
828 "ACK_SET_PAN_ID (0x81)",
829 0x81,
830 0x05,
831 0x05,
832 FALSE,
833 TRUE,
834 LOG_PACKET_log_f_acksetpanid
835 },
836 //p. 10
837 {
838 "QUERY_PAN_ID (0x02)",
839 0x02,
840 0x05,
841 0x05,
842 TRUE,
843 FALSE,
844 LOG_PACKET_log_f_querypanid
845 },
846 //p. 10
847 {
848 "RESP_PAN_ID (0x82)",
849 0x82,
850 0x07,
851 0x07,
852 FALSE,
853 TRUE,
854 LOG_PACKET_log_f_resppanid
855 },
856 //p. 11
857 {
858 "SET_TRANS_AD (0x03)",
859 0x03,
860 0x0F,
861 0x0F,
862 TRUE,
863 FALSE,
864 LOG_PACKET_log_f_settransad
865 },
866 //p. 11
867 {
868 "ACK_SET_TRANS_AD (0x83)",
869 0x83,
870 0x05,
871 0x05,
872 FALSE,
873 TRUE,
874 LOG_PACKET_log_f_acksettransad
875 },
876 //p. 12
877 {
878 "QUERY_TRANS_AD (0x04)",
879 0x04,
880 0x05,
881 0x05,
882 TRUE,
883 FALSE,
884 LOG_PACKET_log_f_querytransad
885 },
886 //p. 12
887 {
888 "RESP_TRANS_AD (0x84)",
889 0x84,
890 0x0F,
891 0x0F,
892 FALSE,
893 TRUE,
894 LOG_PACKET_log_f_resptransad
895 },
896 //p. 13
897 {
898 "SET_RF_CHANNEL (0x05)",
899 0x05,
900 0x06,
901 0x06,
902 TRUE,
903 FALSE,
904 LOG_PACKET_log_f_setrfchannel
905 },
906 //p. 13
907 {
908 "ACK_SET_RF_CHANNEL (0x85)",
909 0x85,
910 0x05,
911 0x05,
912 FALSE,
913 TRUE,
914 LOG_PACKET_log_f_acksetrfchannel
915 },
916 //p. 14
917 {
918 "QUERY_RF_CHANNEL (0x06)",
919 0x06,
920 0x05,
921 0x05,
922 TRUE,
923 FALSE,
924 LOG_PACKET_log_f_queryrfchannel
925 },
926 //p. 14
927 {
928 "RESP_RF_CHANNEL (0x86)",
929 0x86,
930 0x06,
931 0x06,
932 FALSE,
933 TRUE,
934 LOG_PACKET_log_f_resprfchannel
935 },
936 //p. 15
937 {
938 "EN_DIS_ALL_RF_MSGS (0x07)",
939 0x07,
940 0x06,
941 0x06,
942 TRUE,
943 FALSE,
944 LOG_PACKET_log_f_endisallrfmsgs
945 },
946 //p. 15
947 {
948 "ACK_EN_DIS_ALL_RF_MSGS (0x87)",
949 0x87,
950 0x05,
951 0x05,
952 FALSE,
953 TRUE,
954 LOG_PACKET_log_f_ackendisallrfmsgs
955 },
956 //p. 16
957 {
958 "QUERY_RX_ALL_RF_MSGS_STATUS (0x08)",
959 0x08,
960 0x05,
961 0x05,
962 TRUE,
963 FALSE,
964 LOG_PACKET_log_f_queryrxallrfmsgsstatus
965 },
966 //p. 16
967 {
968 "RESP_RX_ALL_RF_MSGS_STATUS (0x88)",
969 0x88,
970 0x06,
971 0x06,
972 FALSE,
973 TRUE,
974 LOG_PACKET_log_f_resprxallrfmsgsstatus
975 },
976 //p. 17
977 {
978 "EN_DIS_RF_ACKS_RETRIES (0x09)",
979 0x09,
980 0x06,
981 0x06,
982 TRUE,
983 FALSE,
984 LOG_PACKET_log_f_endisrfacksretries
985 },
986 //p. 17
987 {
988 "ACK_EN_DIS_RF_ACKS_RETRIES (0x89)",
989 0x89,
990 0x05,
991 0x05,
992 FALSE,
993 TRUE,
994 LOG_PACKET_log_f_ackendisrfacksretries
995 },
996 //p. 18
997 {
998 "QUERY_RF_ACKS_RETRIES_STATUS (0x0A)",
999 0x0A,
1000 0x05,
1001 0x05,
1002 TRUE,
1003 FALSE,
1004 LOG_PACKET_log_f_queryrfacksretriesstatus
1005 },
1006 //p. 18
1007 {
1008 "RESP_RF_ACKS_RETRIES_STATUS (0x8A)",
1009 0x8A,
1010 0x06,
1011 0x06,
1012 FALSE,
1013 TRUE,
1014 LOG_PACKET_log_f_resprfacksretriesstatus
1015 },
1016 //p. 19
1017 {
1018 "SET_RADIO_FEATURES_OPTIONS (0x0B)",
1019 0x0B,
1020 0x07,
1021 0x07,
1022 TRUE,
1023 FALSE,
1024 LOG_PACKET_log_f_setradiofeaturesoptions
1025 },
1026 //p. 19
1027 {
1028 "ACK_SET_RADIO_FEATURES_OPTIONS (0x8B)",
1029 0x8B,
1030 0x05,
1031 0x05,
1032 FALSE,
1033 TRUE,
1034 LOG_PACKET_log_f_acksetradiofeaturesoptions
1035 },
1036 //p. 20
1037 {
1038 "QUERY_RADIO_FEATURES_OPTIONS (0x0C)",
1039 0x0C,
1040 0x05,
1041 0x05,
1042 TRUE,
1043 FALSE,
1044 LOG_PACKET_log_f_queryradiofeaturesoptions
1045 },
1046 //p. 20
1047 {
1048 "RESP_RADIO_FEATURES_OPTIONS (0x8C)",
1049 0x8C,
1050 0x07,
1051 0x07,
1052 FALSE,
1053 TRUE,
1054 LOG_PACKET_log_f_respradiofeaturesoptions
1055 },
1056 //p. 21
1057 {
1058 "QUERY_STATISTICS (0x0D)",
1059 0x0D,
1060 0x05,
1061 0x05,
1062 TRUE,
1063 FALSE,
1064 LOG_PACKET_log_f_querystatistics
1065 },
1066 //p. 21
1067 {
1068 "RESP_STATISTICS (0x8D)",
1069 0x8D,
1070 0x15,
1071 0x15,
1072 FALSE,
1073 TRUE,
1074 LOG_PACKET_log_f_respstatistics
1075 },
1076 //p. 22
1077 {
1078 "CLEAR_STATISTICS (0x0E)",
1079 0x0E,
1080 0x05,
1081 0x05,
1082 TRUE,
1083 FALSE,
1084 LOG_PACKET_log_f_clearstatistics
1085 },
1086 //p. 22
1087 {
1088 "ACK_CLEAR_STATISTICS (0x8E)",
1089 0x8E,
1090 0x05,
1091 0x05,
1092 FALSE,
1093 TRUE,
1094 LOG_PACKET_log_f_ackclearstatistics
1095 },
1096 //p. 23
1097 {
1098 "SET_TX_POWER_LEVEL (0x0F)",
1099 0x0F,
1100 0x06,
1101 0x06,
1102 TRUE,
1103 FALSE,
1104 LOG_PACKET_log_f_settxpowerlevel
1105 },
1106 //p. 23
1107 {
1108 "ACK_SET_TX_POWER_LEVEL (0x8F)",
1109 0x8F,
1110 0x05,
1111 0x05,
1112 FALSE,
1113 TRUE,
1114 LOG_PACKET_log_f_acksettxpowerlevel
1115 },
1116 //p. 24
1117 {
1118 "QUERY_TX_POWER_LEVEL (0x10)",
1119 0x10,
1120 0x05,
1121 0x05,
1122 TRUE,
1123 FALSE,
1124 LOG_PACKET_log_f_querytxpowerlevel
1125 },
1126 //p. 24
1127 {
1128 "RESP_TX_POWER_LEVEL (0x90)",
1129 0x90,
1130 0x06,
1131 0x06,
1132 FALSE,
1133 TRUE,
1134 LOG_PACKET_log_f_resptxpowerlevel
1135 },
1136 //p. 25
1137 {
1138 "SAVE_CFG_NVM (0x11)",
1139 0x11,
1140 0x05,
1141 0x05,
1142 TRUE,
1143 FALSE,
1144 LOG_PACKET_log_f_savecfgnvm
1145 },
1146 //p. 25
1147 {
1148 "ACK_SAVE_CFG_NVM (0x91)",
1149 0x91,
1150 0x05,
1151 0x05,
1152 FALSE,
1153 TRUE,
1154 LOG_PACKET_log_f_acksavecfgnvm
1155 },
1156 //p. 26
1157 {
1158 "QUERY_FIRMWARE_VERSION (0x12)",
1159 0x12,
1160 0x05,
1161 0x05,
1162 TRUE,
1163 FALSE,
1164 LOG_PACKET_log_f_queryfirmwareversion
1165 },
1166 //p. 26
1167 {
1168 "RESP_FIRMWARE_VERSION (0x92)",
1169 0x92,
1170 11,
1171 43,
1172 FALSE,
1173 TRUE,
1174 LOG_PACKET_log_f_respfirmwareversion
1175 },
1176 //p. 27
1177 {
1178 "SET_LOW_POWER_MODE (0x13)",
1179 0x13,
1180 0x06,
1181 0x06,
1182 TRUE,
1183 FALSE,
1184 LOG_PACKET_log_f_setlowpowermode
1185 },
1186 //p. 27
1187 {
1188 "ACK_SET_LOW_POWER_MODE (0x93)",
1189 0x93,
1190 0x05,
1191 0x05,
1192 FALSE,
1193 TRUE,
1194 LOG_PACKET_log_f_acksetlowpowermode
1195 },
1196 //p. 28
1197 {
1198 "SEND_DATA (0x14)",
1199 0x14,
1200 11,
1201 255,
1202 TRUE,
1203 FALSE,
1204 LOG_PACKET_log_f_senddata
1205 },
1206 //p. 28
1207 {
1208 "ACK_SEND_DATA (0x94)",
1209 0x94,
1210 0x08,
1211 0x08,
1212 FALSE,
1213 TRUE,
1214 LOG_PACKET_log_f_acksenddata
1215 },
1216 //p. 29
1217 {
1218 "RXED_DATA (0x95)",
1219 0x95,
1220 14,
1221 255,
1222 FALSE,
1223 TRUE,
1224 LOG_PACKET_log_f_rxeddata
1225 },
1226
1227 //p. 30
1228 {
1229 "RESET_REQUEST (0x18)",
1230 0x18,
1231 0x05,
1232 0x05,
1233 TRUE,
1234 FALSE,
1235 LOG_PACKET_log_f_resetrequest
1236 },
1237 //p. 30
1238 {
1239 "ACK_RESET_REQUEST (0x98)",
1240 0x98,
1241 0x05,
1242 0x05,
1243 FALSE,
1244 TRUE,
1245 LOG_PACKET_log_f_ackresetrequest
1246 },
1247 //p. 31
1248 {
1249 "SEND_MSG_APP (0x19)",
1250 0x19,
1251 6,
1252 255,
1253 TRUE,
1254 FALSE,
1255 LOG_PACKET_log_f_sendmsgapp
1256 },
1257 //p. 31
1258 {
1259 "ACK_SEND_MSG_APP (0x99)",
1260 0x99,
1261 0x05,
1262 0x05,
1263 FALSE,
1264 TRUE,
1265 LOG_PACKET_log_f_acksendmsgapp
1266 },
1267 //p. 32
1268 {
1269 "RXED_MSG_APP (0x9A)",
1270 0x9A,
1271 6,
1272 255,
1273 FALSE,
1274 TRUE,
1275 LOG_PACKET_log_f_rxedmsgapp
1276 },
1277 //p. 33
1278 {
1279 "INIT_FIRMWARE_DOWNLOAD (0x1B)",
1280 0x1B,
1281 0x0F,
1282 0x0F,
1283 TRUE,
1284 FALSE,
1285 LOG_PACKET_log_f_initfirmwaredownload
1286 },
1287 //p. 33
1288 {
1289 "ACK_INIT_FIRMWARE_DOWNLOAD (0x9B)",
1290 0x9B,
1291 0x0E,
1292 0x0E,
1293 FALSE,
1294 TRUE,
1295 LOG_PACKET_log_f_ackinitfirmwaredownload
1296 },
1297 //p. 34
1298 {
1299 "TRANSFER_FIRMWARE_BLOCK (0x1C)",
1300 0x1C,
1301 0x4F,
1302 0x4F,
1303 TRUE,
1304 FALSE,
1305 LOG_PACKET_log_f_transferfirmwareblock
1306 },
1307 //p. 34
1308 {
1309 "ACK_TRANSFER_FIRMWARE_BLOCK (0x9C)",
1310 0x9C,
1311 0x10,
1312 0x10,
1313 FALSE,
1314 TRUE,
1315 LOG_PACKET_log_f_acktransferfirmwareblock
1316 },
1317 //p. 35
1318 {
1319 "TERMINATE_DOWNLOAD (0x1D)",
1320 0x1D,
1321 0x0D,
1322 0x0D,
1323 TRUE,
1324 FALSE,
1325 LOG_PACKET_log_f_terminatedownload
1326 },
1327 //p. 35
1328 {
1329 "ACK_TERMINATE_DOWNLOAD (0x9D)",
1330 0x9D,
1331 0x0D,
1332 0x0D,
1333 FALSE,
1334 TRUE,
1335 LOG_PACKET_log_f_ackterminatedownload
1336 },
1337 //p. 36
1338 {
1339 "SET_DIG_PIN_CFG (0x1E)",
1340 0x1E,
1341 0x08,
1342 0x08,
1343 TRUE,
1344 FALSE,
1345 LOG_PACKET_log_f_setdigpincfg
1346 },
1347 //p. 36
1348 {
1349 "ACK_SET_DIG_PIN_CFG (0x9E)",
1350 0x9E,
1351 0x05,
1352 0x05,
1353 FALSE,
1354 TRUE,
1355 LOG_PACKET_log_f_acksetdigpincfg
1356 },
1357 //p. 37
1358 {
1359 "QUERY_DIG_PIN_CFG (0x1F)",
1360 0x1F,
1361 0x05,
1362 0x05,
1363 TRUE,
1364 FALSE,
1365 LOG_PACKET_log_f_querydigpincfg
1366 },
1367 //p. 37
1368 {
1369 "RESP_DIG_PIN_CFG (0x9F)",
1370 0x9F,
1371 0x08,
1372 0x08,
1373 FALSE,
1374 TRUE,
1375 LOG_PACKET_log_f_respdigpincfg
1376 },
1377 //p. 38
1378 {
1379 "SET_DIG_PIN_STATE (0x20)",
1380 0x20,
1381 0x06,
1382 0x06,
1383 TRUE,
1384 FALSE,
1385 LOG_PACKET_log_f_setdigpinstate
1386 },
1387 //p. 38
1388 {
1389 "ACK_SET_DIG_PIN_STATE (0xA0)",
1390 0xA0,
1391 0x05,
1392 0x05,
1393 FALSE,
1394 TRUE,
1395 LOG_PACKET_log_f_acksetdigpinstate
1396 },
1397 //p. 39
1398 {
1399 "QUERY_DIG_PIN_STATE (0x21)",
1400 0x21,
1401 0x05,
1402 0x05,
1403 TRUE,
1404 FALSE,
1405 LOG_PACKET_log_f_querydigpinstate
1406 },
1407 //p. 39
1408 {
1409 "RESP_DIG_PIN_STATE (0xA1)",
1410 0xA1,
1411 0x06,
1412 0x06,
1413 FALSE,
1414 TRUE,
1415 LOG_PACKET_log_f_respdigpinstate
1416 },
1417 //p. 40
1418 {
1419 "QUERY_ANALOG_PIN_VALUES (0x22)",
1420 0x22,
1421 0x05,
1422 0x05,
1423 TRUE,
1424 FALSE,
1425 LOG_PACKET_log_f_queryanalogpinvalues
1426 },
1427 //p. 40
1428 {
1429 "RESP_ANALOG_PIN_VALUES (0xA2)",
1430 0xA2,
1431 0x09,
1432 0x09,
1433 FALSE,
1434 TRUE,
1435 LOG_PACKET_log_f_respanalogpinvalues
1436 },
1437 //p. 41
1438 {
1439 "SET_ANALOG_PIN_SLEEP_STATE (0x23)",
1440 0x23,
1441 0x07,
1442 0x07,
1443 TRUE,
1444 FALSE,
1445 LOG_PACKET_log_f_setanalogpinsleepstate
1446 },
1447 //p. 41
1448 {
1449 "ACK_SET_ANALOG_PIN_SLEEP_STATE (0xA3)",
1450 0xA3,
1451 0x05,
1452 0x05,
1453 FALSE,
1454 TRUE,
1455 LOG_PACKET_log_f_acksetanalogpinsleepstate
1456 },
1457 //p. 42
1458 {
1459 "QUERY_ANALOG_PIN_SLEEP_STATE (0x24)",
1460 0x24,
1461 0x05,
1462 0x05,
1463 TRUE,
1464 FALSE,
1465 LOG_PACKET_log_f_queryanalogpinsleepstate
1466 },
1467 //p. 42
1468 {
1469 "RESP_ANALOG_PIN_SLEEP_STATE (0xA4)",
1470 0xA4,
1471 0x07,
1472 0x07,
1473 FALSE,
1474 TRUE,
1475 LOG_PACKET_log_f_respanalogpinsleepstate
1476 },
1477 //p. 43
1478 {
1479 "SET_DIG_PIN_SLEEP_STATE (0x25)",
1480 0x25,
1481 0x08,
1482 0x08,
1483 TRUE,
1484 FALSE,
1485 LOG_PACKET_log_f_setdigpinsleepstate
1486 },
1487 //p. 43
1488 {
1489 "ACK_SET_DIG_PIN_SLEEP_STATE (0xA5)",
1490 0xA5,
1491 0x05,
1492 0x05,
1493 FALSE,
1494 TRUE,
1495 LOG_PACKET_log_f_acksetdigpinsleepstate
1496 },
1497 //p. 44
1498 {
1499 "QUERY_DIG_PIN_SLEEP_STATE (0x26)",
1500 0x26,
1501 0x05,
1502 0x05,
1503 TRUE,
1504 FALSE,
1505 LOG_PACKET_log_f_querydigpinsleepstate
1506 },
1507 //p. 44
1508 {
1509 "RESP_DIG_PIN_SLEEP_STATE (0xA6)",
1510 0xA6,
1511 0x08,
1512 0x08,
1513 FALSE,
1514 TRUE,
1515 LOG_PACKET_log_f_respdigpinsleepstate
1516 },
1517 //p. 45
1518 {
1519 "SET_DEBUG_MODE (0x27)",
1520 0x27,
1521 0x06,
1522 0x06,
1523 TRUE,
1524 FALSE,
1525 LOG_PACKET_log_f_setdebugmode
1526 },
1527 //p. 45
1528 {
1529 "ACK_SET_DEBUG_MODE (0xA7)",
1530 0xA7,
1531 0x05,
1532 0x05,
1533 FALSE,
1534 TRUE,
1535 LOG_PACKET_log_f_acksetdebugmode
1536 },
1537 //p. 47
1538 {
1539 "SET_LED_FUNCTIONALITY (0x28)",
1540 0x28,
1541 0x06,
1542 0x06,
1543 TRUE,
1544 FALSE,
1545 LOG_PACKET_log_f_setledfunctionality
1546 },
1547 //p. 47
1548 {
1549 "ACK_SET_LED_FUNCTIONALITY (0xA8)",
1550 0xA8,
1551 0x05,
1552 0x05,
1553 FALSE,
1554 TRUE,
1555 LOG_PACKET_log_f_acksetledfunctionality
1556 },
1557 //p. 49
1558 {
1559 "RX_BYTES_ID_TO_ID (0xA9)",
1560 0xA9,
1561 14,
1562 255,
1563 FALSE,
1564 TRUE,
1565 LOG_PACKET_log_f_rxbytesidtoid
1566 },
1567 //p. 50
1568 {
1569 "SET_PROGRAMMABLE_SETTINGS (0x2A)",
1570 0x2A,
1571 0x15,
1572 0x15,
1573 TRUE,
1574 FALSE,
1575 LOG_PACKET_log_f_setprogrammablesettings
1576 },
1577 //p. 50
1578 {
1579 "ACK_SET_PROGRAMMABLE_SETTINGS (0xAA)",
1580 0xAA,
1581 0x07,
1582 0x07,
1583 FALSE,
1584 TRUE,
1585 LOG_PACKET_log_f_acksetprogrammablesettings
1586 },
1587 //p. 51
1588 {
1589 "QUERY_PROGRAMMABLE_SETTINGS (0x2B)",
1590 0x2B,
1591 0x05,
1592 0x05,
1593 TRUE,
1594 FALSE,
1595 LOG_PACKET_log_f_queryprogrammablesettings
1596 },
1597 //p. 51
1598 {
1599 "RESP_PROGRAMMABLE_SETTINGS (0xAB)",
1600 0xAB,
1601 0x15,
1602 0x15,
1603 FALSE,
1604 TRUE,
1605 LOG_PACKET_log_f_respprogrammablesettings
1606 },
1607 };
1608
1609 //Given a type and length byte, returns either:
1610 // a)The table index in the lookup table LOG_PACKET_pkt_type_lut_a[] corresponding to the
1611 // information table entry. This will be a non-negative number.
1612 // b)-1 to signal that the type byte is invalid.
1613 // c)-2 to signal that the type byte is valid but the length is invalid.
1614 //
1615 static int LOG_PACKET_type_length_lookup_a(int in_type, int in_length)
1616 {
1617 int i;
1618
1619 for (i=0; i < (sizeof(LOG_PACKET_pkt_type_lut_a)/sizeof(LOG_PACKET_pkt_type_lut_a[0])); i++)
1620 {
1621 if (LOG_PACKET_pkt_type_lut_a[i].type_byte == in_type)
1622 {
1623 if (
1624 (in_length >= LOG_PACKET_pkt_type_lut_a[i].length_byte_min)
1625 &&
1626 (in_length <= LOG_PACKET_pkt_type_lut_a[i].length_byte_max)
1627 )
1628 {
1629 //Type and length are consistent. Return the index.
1630 return(i);
1631 }
1632 else
1633 {
1634 //Type is OK, but length is not.
1635 return(-2);
1636 }
1637 }
1638 }
1639
1640 //If we're here, couldn't find a match on the type.
1641 return(-1);
1642 }
1643
1644
1645 //Logs the bytes of a message.
1646 static void LOG_PACKET_log_bytes(const struct __timeb64 *in_ts,
1647 QCHAR_TSE *in_pkts,
1648 int in_npkts,
1649 unsigned in_messagetype,
1650 unsigned in_whichlogs)
1651 {
1652 int i, j, k;
1653 const int bytes_per_line = 14;
1654 int nlines;
1655 char buf[250];
1656 char buf_sub[250];
1657
1658 nlines = (in_npkts + bytes_per_line - 1) / bytes_per_line;
1659
1660 for (i=0; i<nlines; i++)
1661 {
1662 strcpy_s(buf, sizeof(buf), " ");
1663
1664 for (j=0; j<bytes_per_line; j++)
1665 {
1666 k = i * bytes_per_line + j;
1667
1668 if (k >= in_npkts)
1669 break;
1670
1671 sprintf_s(buf_sub, sizeof(buf_sub), "<%02X>", ((int)in_pkts[k].c) & 0xFF);
1672 strcat_s(buf, sizeof(buf), buf_sub);
1673 }
1674
1675 LOG_write_ls(in_ts,
1676 in_messagetype,
1677 in_whichlogs,
1678 buf);
1679 }
1680 }
1681
1682
1683 //This is the generic packet printer. It is called when no more specific handler has been written.
1684 //
1685 static void LOG_PACKET_log_f_generic(int in_channel,
1686 const struct __timeb64 *in_ts,
1687 QCHAR_TSE *in_pkts,
1688 int in_npkts,
1689 int in_lutblentry,
1690 int in_mirror_to_console,
1691 struct __timeb64 *t_last_msg, //Static time of last message.
1692 int *first_time //Static version of whether this is the first time.
1693 )
1694 {
1695 int cspan;
1696 int mdelta;
1697 char buf[250];
1698
1699 if (*first_time)
1700 {
1701 memcpy(t_last_msg, &(in_pkts[0].ts), sizeof(*t_last_msg));
1702 *first_time = FALSE;
1703 }
1704
1705 cspan = MISCFUNC_timb64_diff_bounded_ms(&(in_pkts[0].ts), &(in_pkts[in_npkts-1].ts));
1706 mdelta = MISCFUNC_timb64_diff_bounded_ms(t_last_msg, &(in_pkts[0].ts));
1707 memcpy(t_last_msg, &(in_pkts[0].ts), sizeof(*t_last_msg));
1708
1709 sprintf_s(buf, sizeof(buf), "CH%02d:%s.", in_channel, LOG_PACKET_pkt_type_lut_a[in_lutblentry].tag_terse);
1710
1711 LOG_write_ls(&(in_pkts[0].ts),
1712 LOG_MT_ROUTINE,
1713 (in_mirror_to_console) ? (LOG_LI_PKT | LOG_LI_COMP | LOG_LI_STDOUT) : (LOG_LI_PKT | LOG_LI_COMP),
1714 buf);
1715
1716 sprintf_s(buf, sizeof(buf), " cspan=%d, mdelta=%d.", cspan, mdelta);
1717
1718 LOG_write_ls(&(in_pkts[0].ts),
1719 LOG_MT_ROUTINE,
1720 (in_mirror_to_console) ? (LOG_LI_PKT | LOG_LI_COMP | LOG_LI_STDOUT) : (LOG_LI_PKT | LOG_LI_COMP),
1721 buf);
1722
1723 //The header.
1724 LOG_PACKET_log_bytes(&(in_pkts[0].ts),
1725 in_pkts,
1726 3,
1727 LOG_MT_ROUTINE,
1728 (in_mirror_to_console) ? (LOG_LI_PKT | LOG_LI_COMP | LOG_LI_STDOUT) : (LOG_LI_PKT | LOG_LI_COMP));
1729 //The payload.
1730 LOG_PACKET_log_bytes(&(in_pkts[0].ts),
1731 in_pkts+3,
1732 in_npkts-5,
1733 LOG_MT_ROUTINE,
1734 (in_mirror_to_console) ? (LOG_LI_PKT | LOG_LI_COMP | LOG_LI_STDOUT) : (LOG_LI_PKT | LOG_LI_COMP));
1735 //The trailer.
1736 LOG_PACKET_log_bytes(&(in_pkts[0].ts),
1737 in_pkts+in_npkts-2,
1738 2,
1739 LOG_MT_ROUTINE,
1740 (in_mirror_to_console) ? (LOG_LI_PKT | LOG_LI_COMP | LOG_LI_STDOUT) : (LOG_LI_PKT | LOG_LI_COMP));
1741 }
1742
1743
1744 static void LOG_PACKET_log_f_setpanid(int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console)
1745 {
1746 static struct __timeb64 t_last_msg;
1747 static int first_time = TRUE;
1748
1749 LOG_PACKET_log_f_generic(in_channel,
1750 in_ts,
1751 in_pkts,
1752 in_npkts,
1753 in_lutblentry,
1754 in_mirror_to_console,
1755 &t_last_msg,
1756 &first_time);
1757 }
1758
1759
1760 static void LOG_PACKET_log_f_acksetpanid(int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console)
1761 {
1762 static struct __timeb64 t_last_msg;
1763 static int first_time = TRUE;
1764
1765 LOG_PACKET_log_f_generic(in_channel,
1766 in_ts,
1767 in_pkts,
1768 in_npkts,
1769 in_lutblentry,
1770 in_mirror_to_console,
1771 &t_last_msg,
1772 &first_time);
1773 }
1774
1775
1776 static void LOG_PACKET_log_f_querypanid(int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console)
1777 {
1778 static struct __timeb64 t_last_msg;
1779 static int first_time = TRUE;
1780
1781 LOG_PACKET_log_f_generic(in_channel,
1782 in_ts,
1783 in_pkts,
1784 in_npkts,
1785 in_lutblentry,
1786 in_mirror_to_console,
1787 &t_last_msg,
1788 &first_time);
1789 }
1790
1791
1792 static void LOG_PACKET_log_f_resppanid(int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console)
1793 {
1794 static struct __timeb64 t_last_msg;
1795 static int first_time = TRUE;
1796
1797 LOG_PACKET_log_f_generic(in_channel,
1798 in_ts,
1799 in_pkts,
1800 in_npkts,
1801 in_lutblentry,
1802 in_mirror_to_console,
1803 &t_last_msg,
1804 &first_time);
1805 }
1806
1807
1808 static void LOG_PACKET_log_f_settransad(int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console)
1809 {
1810 int cspan;
1811 int mdelta;
1812 int translongad[8];
1813 int transshortad[2];
1814 static struct __timeb64 t_last_msg;
1815 static int first_time = TRUE;
1816 char buf[250];
1817
1818 if (first_time)
1819 {
1820 memcpy(&t_last_msg, &(in_pkts[0].ts), sizeof(t_last_msg));
1821 first_time = FALSE;
1822 }
1823
1824 cspan = MISCFUNC_timb64_diff_bounded_ms(&(in_pkts[0].ts), &(in_pkts[in_npkts-1].ts));
1825 mdelta = MISCFUNC_timb64_diff_bounded_ms(&t_last_msg, &(in_pkts[0].ts));
1826 memcpy(&t_last_msg, &(in_pkts[0].ts), sizeof(t_last_msg));
1827
1828 sprintf_s(buf, sizeof(buf), "CH%02d:%s.", in_channel, LOG_PACKET_pkt_type_lut_a[in_lutblentry].tag_terse);
1829
1830 LOG_write_ls(&(in_pkts[0].ts),
1831 LOG_MT_ROUTINE,
1832 (in_mirror_to_console) ? (LOG_LI_PKT | LOG_LI_COMP | LOG_LI_STDOUT) : (LOG_LI_PKT | LOG_LI_COMP),
1833 buf);
1834
1835 sprintf_s(buf, sizeof(buf), " cspan=%d, mdelta=%d.", cspan, mdelta);
1836
1837 LOG_write_ls(&(in_pkts[0].ts),
1838 LOG_MT_ROUTINE,
1839 (in_mirror_to_console) ? (LOG_LI_PKT | LOG_LI_COMP | LOG_LI_STDOUT) : (LOG_LI_PKT | LOG_LI_COMP),
1840 buf);
1841
1842 //The header.
1843 LOG_PACKET_log_bytes(&(in_pkts[0].ts),
1844 in_pkts,
1845 3,
1846 LOG_MT_ROUTINE,
1847 (in_mirror_to_console) ? (LOG_LI_PKT | LOG_LI_COMP | LOG_LI_STDOUT) : (LOG_LI_PKT | LOG_LI_COMP));
1848 //The payload.
1849 LOG_PACKET_log_bytes(&(in_pkts[0].ts),
1850 in_pkts+3,
1851 in_npkts-5,
1852 LOG_MT_ROUTINE,
1853 (in_mirror_to_console) ? (LOG_LI_PKT | LOG_LI_COMP | LOG_LI_STDOUT) : (LOG_LI_PKT | LOG_LI_COMP));
1854 //The trailer.
1855 LOG_PACKET_log_bytes(&(in_pkts[0].ts),
1856 in_pkts+in_npkts-2,
1857 2,
1858 LOG_MT_ROUTINE,
1859 (in_mirror_to_console) ? (LOG_LI_PKT | LOG_LI_COMP | LOG_LI_STDOUT) : (LOG_LI_PKT | LOG_LI_COMP));
1860
1861 translongad[7] = ((int)in_pkts[ 3].c) & 0xFF;
1862 translongad[6] = ((int)in_pkts[ 4].c) & 0xFF;
1863 translongad[5] = ((int)in_pkts[ 5].c) & 0xFF;
1864 translongad[4] = ((int)in_pkts[ 6].c) & 0xFF;
1865 translongad[3] = ((int)in_pkts[ 7].c) & 0xFF;
1866 translongad[2] = ((int)in_pkts[ 8].c) & 0xFF;
1867 translongad[1] = ((int)in_pkts[ 9].c) & 0xFF;
1868 translongad[0] = ((int)in_pkts[10].c) & 0xFF;
1869
1870 transshortad[1] = ((int)in_pkts[11].c) & 0xFF;
1871 transshortad[0] = ((int)in_pkts[12].c) & 0xFF;
1872
1873 sprintf_s(buf, sizeof(buf), " TRANS_LONG_AD: 0x%02X%02X%02X%02X%02X%02X%02X%02X, TRANS_SHORT_AD: 0x%02X%02X.",
1874 translongad[0],
1875 translongad[1],
1876 translongad[2],
1877 translongad[3],
1878 translongad[4],
1879 translongad[5],
1880 translongad[6],
1881 translongad[7],
1882 transshortad[0],
1883 transshortad[1]);
1884
1885 LOG_write_ls(&(in_pkts[0].ts),
1886 LOG_MT_ROUTINE,
1887 (in_mirror_to_console) ? (LOG_LI_PKT | LOG_LI_COMP | LOG_LI_STDOUT) : (LOG_LI_PKT | LOG_LI_COMP),
1888 buf);
1889 }
1890
1891
1892 static void LOG_PACKET_log_f_acksettransad(int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console)
1893 {
1894 static struct __timeb64 t_last_msg;
1895 static int first_time = TRUE;
1896
1897 LOG_PACKET_log_f_generic(in_channel,
1898 in_ts,
1899 in_pkts,
1900 in_npkts,
1901 in_lutblentry,
1902 in_mirror_to_console,
1903 &t_last_msg,
1904 &first_time);
1905 }
1906
1907
1908 static void LOG_PACKET_log_f_querytransad(int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console)
1909 {
1910 static struct __timeb64 t_last_msg;
1911 static int first_time = TRUE;
1912
1913 LOG_PACKET_log_f_generic(in_channel,
1914 in_ts,
1915 in_pkts,
1916 in_npkts,
1917 in_lutblentry,
1918 in_mirror_to_console,
1919 &t_last_msg,
1920 &first_time);
1921 }
1922
1923
1924 static void LOG_PACKET_log_f_resptransad(int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console)
1925 {
1926 static struct __timeb64 t_last_msg;
1927 static int first_time = TRUE;
1928
1929 LOG_PACKET_log_f_generic(in_channel,
1930 in_ts,
1931 in_pkts,
1932 in_npkts,
1933 in_lutblentry,
1934 in_mirror_to_console,
1935 &t_last_msg,
1936 &first_time);
1937 }
1938
1939
1940 static void LOG_PACKET_log_f_setrfchannel(int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console)
1941 {
1942 static struct __timeb64 t_last_msg;
1943 static int first_time = TRUE;
1944
1945 LOG_PACKET_log_f_generic(in_channel,
1946 in_ts,
1947 in_pkts,
1948 in_npkts,
1949 in_lutblentry,
1950 in_mirror_to_console,
1951 &t_last_msg,
1952 &first_time);
1953 }
1954
1955
1956 static void LOG_PACKET_log_f_acksetrfchannel(int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console)
1957 {
1958 static struct __timeb64 t_last_msg;
1959 static int first_time = TRUE;
1960
1961 LOG_PACKET_log_f_generic(in_channel,
1962 in_ts,
1963 in_pkts,
1964 in_npkts,
1965 in_lutblentry,
1966 in_mirror_to_console,
1967 &t_last_msg,
1968 &first_time);
1969 }
1970
1971
1972 static void LOG_PACKET_log_f_queryrfchannel(int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console)
1973 {
1974 static struct __timeb64 t_last_msg;
1975 static int first_time = TRUE;
1976
1977 LOG_PACKET_log_f_generic(in_channel,
1978 in_ts,
1979 in_pkts,
1980 in_npkts,
1981 in_lutblentry,
1982 in_mirror_to_console,
1983 &t_last_msg,
1984 &first_time);
1985 }
1986
1987
1988 static void LOG_PACKET_log_f_resprfchannel(int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console)
1989 {
1990 static struct __timeb64 t_last_msg;
1991 static int first_time = TRUE;
1992
1993 LOG_PACKET_log_f_generic(in_channel,
1994 in_ts,
1995 in_pkts,
1996 in_npkts,
1997 in_lutblentry,
1998 in_mirror_to_console,
1999 &t_last_msg,
2000 &first_time);
2001 }
2002
2003
2004 static void LOG_PACKET_log_f_endisallrfmsgs(int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console)
2005 {
2006 static struct __timeb64 t_last_msg;
2007 static int first_time = TRUE;
2008
2009 LOG_PACKET_log_f_generic(in_channel,
2010 in_ts,
2011 in_pkts,
2012 in_npkts,
2013 in_lutblentry,
2014 in_mirror_to_console,
2015 &t_last_msg,
2016 &first_time);
2017 }
2018
2019
2020 static void LOG_PACKET_log_f_ackendisallrfmsgs(int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console)
2021 {
2022 static struct __timeb64 t_last_msg;
2023 static int first_time = TRUE;
2024
2025 LOG_PACKET_log_f_generic(in_channel,
2026 in_ts,
2027 in_pkts,
2028 in_npkts,
2029 in_lutblentry,
2030 in_mirror_to_console,
2031 &t_last_msg,
2032 &first_time);
2033 }
2034
2035
2036 static void LOG_PACKET_log_f_queryrxallrfmsgsstatus(int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console)
2037 {
2038 static struct __timeb64 t_last_msg;
2039 static int first_time = TRUE;
2040
2041 LOG_PACKET_log_f_generic(in_channel,
2042 in_ts,
2043 in_pkts,
2044 in_npkts,
2045 in_lutblentry,
2046 in_mirror_to_console,
2047 &t_last_msg,
2048 &first_time);
2049 }
2050
2051
2052 static void LOG_PACKET_log_f_resprxallrfmsgsstatus(int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console)
2053 {
2054 static struct __timeb64 t_last_msg;
2055 static int first_time = TRUE;
2056
2057 LOG_PACKET_log_f_generic(in_channel,
2058 in_ts,
2059 in_pkts,
2060 in_npkts,
2061 in_lutblentry,
2062 in_mirror_to_console,
2063 &t_last_msg,
2064 &first_time);
2065 }
2066
2067
2068 static void LOG_PACKET_log_f_endisrfacksretries(int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console)
2069 {
2070 static struct __timeb64 t_last_msg;
2071 static int first_time = TRUE;
2072
2073 LOG_PACKET_log_f_generic(in_channel,
2074 in_ts,
2075 in_pkts,
2076 in_npkts,
2077 in_lutblentry,
2078 in_mirror_to_console,
2079 &t_last_msg,
2080 &first_time);
2081 }
2082
2083 static void LOG_PACKET_log_f_ackendisrfacksretries(int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console)
2084 {
2085 static struct __timeb64 t_last_msg;
2086 static int first_time = TRUE;
2087
2088 LOG_PACKET_log_f_generic(in_channel,
2089 in_ts,
2090 in_pkts,
2091 in_npkts,
2092 in_lutblentry,
2093 in_mirror_to_console,
2094 &t_last_msg,
2095 &first_time);
2096 }
2097
2098
2099 static void LOG_PACKET_log_f_queryrfacksretriesstatus(int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console)
2100 {
2101 static struct __timeb64 t_last_msg;
2102 static int first_time = TRUE;
2103
2104 LOG_PACKET_log_f_generic(in_channel,
2105 in_ts,
2106 in_pkts,
2107 in_npkts,
2108 in_lutblentry,
2109 in_mirror_to_console,
2110 &t_last_msg,
2111 &first_time);
2112 }
2113
2114
2115 static void LOG_PACKET_log_f_resprfacksretriesstatus(int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console)
2116 {
2117 static struct __timeb64 t_last_msg;
2118 static int first_time = TRUE;
2119
2120 LOG_PACKET_log_f_generic(in_channel,
2121 in_ts,
2122 in_pkts,
2123 in_npkts,
2124 in_lutblentry,
2125 in_mirror_to_console,
2126 &t_last_msg,
2127 &first_time);
2128 }
2129
2130
2131 static void LOG_PACKET_log_f_setradiofeaturesoptions(int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console)
2132 {
2133 static struct __timeb64 t_last_msg;
2134 static int first_time = TRUE;
2135
2136 LOG_PACKET_log_f_generic(in_channel,
2137 in_ts,
2138 in_pkts,
2139 in_npkts,
2140 in_lutblentry,
2141 in_mirror_to_console,
2142 &t_last_msg,
2143 &first_time);
2144 }
2145
2146
2147 static void LOG_PACKET_log_f_acksetradiofeaturesoptions(int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console)
2148 {
2149 static struct __timeb64 t_last_msg;
2150 static int first_time = TRUE;
2151
2152 LOG_PACKET_log_f_generic(in_channel,
2153 in_ts,
2154 in_pkts,
2155 in_npkts,
2156 in_lutblentry,
2157 in_mirror_to_console,
2158 &t_last_msg,
2159 &first_time);
2160 }
2161
2162
2163 static void LOG_PACKET_log_f_queryradiofeaturesoptions(int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console)
2164 {
2165 static struct __timeb64 t_last_msg;
2166 static int first_time = TRUE;
2167
2168 LOG_PACKET_log_f_generic(in_channel,
2169 in_ts,
2170 in_pkts,
2171 in_npkts,
2172 in_lutblentry,
2173 in_mirror_to_console,
2174 &t_last_msg,
2175 &first_time);
2176 }
2177
2178
2179 static void LOG_PACKET_log_f_respradiofeaturesoptions(int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console)
2180 {
2181 static struct __timeb64 t_last_msg;
2182 static int first_time = TRUE;
2183
2184 LOG_PACKET_log_f_generic(in_channel,
2185 in_ts,
2186 in_pkts,
2187 in_npkts,
2188 in_lutblentry,
2189 in_mirror_to_console,
2190 &t_last_msg,
2191 &first_time);
2192 }
2193
2194
2195 static void LOG_PACKET_log_f_querystatistics(int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console)
2196 {
2197 static struct __timeb64 t_last_msg;
2198 static int first_time = TRUE;
2199
2200 LOG_PACKET_log_f_generic(in_channel,
2201 in_ts,
2202 in_pkts,
2203 in_npkts,
2204 in_lutblentry,
2205 in_mirror_to_console,
2206 &t_last_msg,
2207 &first_time);
2208 }
2209
2210
2211 static void LOG_PACKET_log_f_respstatistics(int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console)
2212 {
2213 static struct __timeb64 t_last_msg;
2214 static int first_time = TRUE;
2215
2216 LOG_PACKET_log_f_generic(in_channel,
2217 in_ts,
2218 in_pkts,
2219 in_npkts,
2220 in_lutblentry,
2221 in_mirror_to_console,
2222 &t_last_msg,
2223 &first_time);
2224 }
2225
2226
2227 static void LOG_PACKET_log_f_clearstatistics(int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console)
2228 {
2229 static struct __timeb64 t_last_msg;
2230 static int first_time = TRUE;
2231
2232 LOG_PACKET_log_f_generic(in_channel,
2233 in_ts,
2234 in_pkts,
2235 in_npkts,
2236 in_lutblentry,
2237 in_mirror_to_console,
2238 &t_last_msg,
2239 &first_time);
2240 }
2241
2242
2243 static void LOG_PACKET_log_f_ackclearstatistics(int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console)
2244 {
2245 static struct __timeb64 t_last_msg;
2246 static int first_time = TRUE;
2247
2248 LOG_PACKET_log_f_generic(in_channel,
2249 in_ts,
2250 in_pkts,
2251 in_npkts,
2252 in_lutblentry,
2253 in_mirror_to_console,
2254 &t_last_msg,
2255 &first_time);
2256 }
2257
2258
2259 static void LOG_PACKET_log_f_settxpowerlevel(int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console)
2260 {
2261 static struct __timeb64 t_last_msg;
2262 static int first_time = TRUE;
2263
2264 LOG_PACKET_log_f_generic(in_channel,
2265 in_ts,
2266 in_pkts,
2267 in_npkts,
2268 in_lutblentry,
2269 in_mirror_to_console,
2270 &t_last_msg,
2271 &first_time);
2272 }
2273
2274
2275 static void LOG_PACKET_log_f_acksettxpowerlevel(int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console)
2276 {
2277 static struct __timeb64 t_last_msg;
2278 static int first_time = TRUE;
2279
2280 LOG_PACKET_log_f_generic(in_channel,
2281 in_ts,
2282 in_pkts,
2283 in_npkts,
2284 in_lutblentry,
2285 in_mirror_to_console,
2286 &t_last_msg,
2287 &first_time);
2288 }
2289
2290
2291 static void LOG_PACKET_log_f_querytxpowerlevel(int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console)
2292 {
2293 static struct __timeb64 t_last_msg;
2294 static int first_time = TRUE;
2295
2296 LOG_PACKET_log_f_generic(in_channel,
2297 in_ts,
2298 in_pkts,
2299 in_npkts,
2300 in_lutblentry,
2301 in_mirror_to_console,
2302 &t_last_msg,
2303 &first_time);
2304 }
2305
2306
2307 static void LOG_PACKET_log_f_resptxpowerlevel(int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console)
2308 {
2309 static struct __timeb64 t_last_msg;
2310 static int first_time = TRUE;
2311
2312 LOG_PACKET_log_f_generic(in_channel,
2313 in_ts,
2314 in_pkts,
2315 in_npkts,
2316 in_lutblentry,
2317 in_mirror_to_console,
2318 &t_last_msg,
2319 &first_time);
2320 }
2321
2322
2323 static void LOG_PACKET_log_f_savecfgnvm(int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console)
2324 {
2325 static struct __timeb64 t_last_msg;
2326 static int first_time = TRUE;
2327
2328 LOG_PACKET_log_f_generic(in_channel,
2329 in_ts,
2330 in_pkts,
2331 in_npkts,
2332 in_lutblentry,
2333 in_mirror_to_console,
2334 &t_last_msg,
2335 &first_time);
2336 }
2337
2338
2339 static void LOG_PACKET_log_f_acksavecfgnvm(int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console)
2340 {
2341 static struct __timeb64 t_last_msg;
2342 static int first_time = TRUE;
2343
2344 LOG_PACKET_log_f_generic(in_channel,
2345 in_ts,
2346 in_pkts,
2347 in_npkts,
2348 in_lutblentry,
2349 in_mirror_to_console,
2350 &t_last_msg,
2351 &first_time);
2352 }
2353
2354
2355 static void LOG_PACKET_log_f_queryfirmwareversion(int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console)
2356 {
2357 static struct __timeb64 t_last_msg;
2358 static int first_time = TRUE;
2359
2360 LOG_PACKET_log_f_generic(in_channel,
2361 in_ts,
2362 in_pkts,
2363 in_npkts,
2364 in_lutblentry,
2365 in_mirror_to_console,
2366 &t_last_msg,
2367 &first_time);
2368 }
2369
2370
2371 static void LOG_PACKET_log_f_respfirmwareversion(int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console)
2372 {
2373 static struct __timeb64 t_last_msg;
2374 static int first_time = TRUE;
2375
2376 LOG_PACKET_log_f_generic(in_channel,
2377 in_ts,
2378 in_pkts,
2379 in_npkts,
2380 in_lutblentry,
2381 in_mirror_to_console,
2382 &t_last_msg,
2383 &first_time);
2384 }
2385
2386
2387 static void LOG_PACKET_log_f_setlowpowermode(int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console)
2388 {
2389 static struct __timeb64 t_last_msg;
2390 static int first_time = TRUE;
2391
2392 LOG_PACKET_log_f_generic(in_channel,
2393 in_ts,
2394 in_pkts,
2395 in_npkts,
2396 in_lutblentry,
2397 in_mirror_to_console,
2398 &t_last_msg,
2399 &first_time);
2400 }
2401
2402
2403 static void LOG_PACKET_log_f_acksetlowpowermode(int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console)
2404 {
2405 static struct __timeb64 t_last_msg;
2406 static int first_time = TRUE;
2407
2408 LOG_PACKET_log_f_generic(in_channel,
2409 in_ts,
2410 in_pkts,
2411 in_npkts,
2412 in_lutblentry,
2413 in_mirror_to_console,
2414 &t_last_msg,
2415 &first_time);
2416 }
2417
2418
2419 static void LOG_PACKET_log_f_senddata(int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console)
2420 {
2421 int idx;
2422 int cspan;
2423 int mdelta;
2424 int packetid;
2425 int targetsender;
2426 int addressmode;
2427 int desttransad[8];
2428 static struct __timeb64 t_last_msg;
2429 static int first_time = TRUE;
2430 char buf[250];
2431
2432 if (first_time)
2433 {
2434 memcpy(&t_last_msg, &(in_pkts[0].ts), sizeof(t_last_msg));
2435 first_time = FALSE;
2436 }
2437
2438 cspan = MISCFUNC_timb64_diff_bounded_ms(&(in_pkts[0].ts), &(in_pkts[in_npkts-1].ts));
2439 mdelta = MISCFUNC_timb64_diff_bounded_ms(&t_last_msg, &(in_pkts[0].ts));
2440 memcpy(&t_last_msg, &(in_pkts[0].ts), sizeof(t_last_msg));
2441
2442 sprintf_s(buf, sizeof(buf), "CH%02d:%s.", in_channel, LOG_PACKET_pkt_type_lut_a[in_lutblentry].tag_terse);
2443
2444 LOG_write_ls(&(in_pkts[0].ts),
2445 LOG_MT_ROUTINE,
2446 (in_mirror_to_console) ? (LOG_LI_PKT | LOG_LI_COMP | LOG_LI_STDOUT) : (LOG_LI_PKT | LOG_LI_COMP),
2447 buf);
2448
2449 sprintf_s(buf, sizeof(buf), " cspan=%d, mdelta=%d.", cspan, mdelta);
2450
2451 LOG_write_ls(&(in_pkts[0].ts),
2452 LOG_MT_ROUTINE,
2453 (in_mirror_to_console) ? (LOG_LI_PKT | LOG_LI_COMP | LOG_LI_STDOUT) : (LOG_LI_PKT | LOG_LI_COMP),
2454 buf);
2455
2456 //The header.
2457 LOG_PACKET_log_bytes(&(in_pkts[0].ts),
2458 in_pkts,
2459 3,
2460 LOG_MT_ROUTINE,
2461 (in_mirror_to_console) ? (LOG_LI_PKT | LOG_LI_COMP | LOG_LI_STDOUT) : (LOG_LI_PKT | LOG_LI_COMP));
2462 //The payload.
2463 LOG_PACKET_log_bytes(&(in_pkts[0].ts),
2464 in_pkts+3,
2465 in_npkts-5,
2466 LOG_MT_ROUTINE,
2467 (in_mirror_to_console) ? (LOG_LI_PKT | LOG_LI_COMP | LOG_LI_STDOUT) : (LOG_LI_PKT | LOG_LI_COMP));
2468 //The trailer.
2469 LOG_PACKET_log_bytes(&(in_pkts[0].ts),
2470 in_pkts+in_npkts-2,
2471 2,
2472 LOG_MT_ROUTINE,
2473 (in_mirror_to_console) ? (LOG_LI_PKT | LOG_LI_COMP | LOG_LI_STDOUT) : (LOG_LI_PKT | LOG_LI_COMP));
2474
2475 packetid = ((int)in_pkts[3].c) & 0xFF;
2476 targetsender = ((int)in_pkts[4].c) & 0xFF;
2477 addressmode = ((int)in_pkts[5].c) & 0xFF;
2478
2479 sprintf_s(buf, sizeof(buf), " PACKET_ID: 0x%02X, TARGET_SENDER: 0x%02X, ADDRESS_MODE: 0x%02X.",
2480 packetid,
2481 targetsender,
2482 addressmode
2483 );
2484
2485 LOG_write_ls(&(in_pkts[0].ts),
2486 LOG_MT_ROUTINE,
2487 (in_mirror_to_console) ? (LOG_LI_PKT | LOG_LI_COMP | LOG_LI_STDOUT) : (LOG_LI_PKT | LOG_LI_COMP),
2488 buf);
2489
2490 //Flag a bad address mode if it exists.
2491 if ((addressmode != 0x00) && (addressmode != 0x10))
2492 {
2493 sprintf_s(buf, sizeof(buf), "CH%02d:ADDRESS_MODE error in %s.", in_channel, LOG_PACKET_pkt_type_lut_a[in_lutblentry].tag_terse);
2494
2495 LOG_write_ls(&(in_pkts[0].ts),
2496 LOG_MT_ALERT,
2497 LOG_LI_PKT | LOG_LI_ALERT | LOG_LI_COMP | LOG_LI_STDOUT,
2498 buf);
2499
2500 sprintf_s(buf, sizeof(buf), " ADDRESS_MODE: 0x%02X.", addressmode);
2501
2502 LOG_write_ls(&(in_pkts[0].ts),
2503 LOG_MT_ALERT,
2504 LOG_LI_PKT | LOG_LI_ALERT | LOG_LI_COMP | LOG_LI_STDOUT,
2505 buf);
2506 }
2507
2508 //Form up the destination address. It may be short or long.
2509 FillMemory(desttransad, sizeof(desttransad), 0);
2510
2511 idx = 6;
2512 if (in_npkts > idx)
2513 {
2514 desttransad[7] = ((int)in_pkts[idx].c) & 0xFF;
2515 }
2516 idx++;
2517 if (in_npkts > idx)
2518 {
2519 desttransad[6] = ((int)in_pkts[idx].c) & 0xFF;
2520 }
2521 idx++;
2522
2523 if (addressmode & 0xf0) //Long address.
2524 {
2525 if (in_npkts > idx)
2526 {
2527 desttransad[5] = ((int)in_pkts[idx].c) & 0xFF;
2528 }
2529 idx++;
2530 if (in_npkts > idx)
2531 {
2532 desttransad[4] = ((int)in_pkts[idx].c) & 0xFF;
2533 }
2534 idx++;
2535 if (in_npkts > idx)
2536 {
2537 desttransad[3] = ((int)in_pkts[idx].c) & 0xFF;
2538 }
2539 idx++;
2540 if (in_npkts > idx)
2541 {
2542 desttransad[2] = ((int)in_pkts[idx].c) & 0xFF;
2543 }
2544 idx++;
2545 if (in_npkts > idx)
2546 {
2547 desttransad[1] = ((int)in_pkts[idx].c) & 0xFF;
2548 }
2549 idx++;
2550 if (in_npkts > idx)
2551 {
2552 desttransad[0] = ((int)in_pkts[idx].c) & 0xFF;
2553 }
2554 idx++;
2555 }
2556
2557 //If we've overshot the data area (and the assumption is made that there is at least one
2558 //byte of data), this means that the address modes were inconsistent with the message length.
2559 //This is an error.
2560 if (idx > (in_npkts - 3))
2561 {
2562 sprintf_s(buf, sizeof(buf), "CH%02d:ADDRESS_MODE and message length error in %s.", in_channel, LOG_PACKET_pkt_type_lut_a[in_lutblentry].tag_terse);
2563
2564 LOG_write_ls(&(in_pkts[0].ts),
2565 LOG_MT_ALERT,
2566 LOG_LI_PKT | LOG_LI_ALERT | LOG_LI_COMP | LOG_LI_STDOUT,
2567 buf);
2568 }
2569
2570 //Emit the destination transceiver address. There is some variability due
2571 //to the address mode.
2572 if (addressmode & 0xf0) //Destination transceiver long address.
2573 {
2574 sprintf_s(buf,
2575 sizeof(buf),
2576 " DST_TRANS_AD: 0x%02X%02X%02X%02X02X%02X%02X%02X.",
2577 ((int)desttransad[0]) & 0xFF,
2578 ((int)desttransad[1]) & 0xFF,
2579 ((int)desttransad[2]) & 0xFF,
2580 ((int)desttransad[3]) & 0xFF,
2581 ((int)desttransad[4]) & 0xFF,
2582 ((int)desttransad[5]) & 0xFF,
2583 ((int)desttransad[6]) & 0xFF,
2584 ((int)desttransad[7]) & 0xFF);
2585 }
2586 else
2587 {
2588 sprintf_s(buf,
2589 sizeof(buf),
2590 " DST_TRANS_AD: 0x%02X%02X.",
2591 ((int)desttransad[6]) & 0xFF,
2592 ((int)desttransad[7]) & 0xFF);
2593 }
2594
2595 //And write the line to the log.
2596 LOG_write_ls(&(in_pkts[0].ts),
2597 LOG_MT_ROUTINE,
2598 (in_mirror_to_console) ? (LOG_LI_PKT | LOG_LI_COMP | LOG_LI_STDOUT) : (LOG_LI_PKT | LOG_LI_COMP),
2599 buf);
2600
2601 //Write the data bytes.
2602 LOG_write_ls(&(in_pkts[0].ts),
2603 LOG_MT_ROUTINE,
2604 (in_mirror_to_console) ? (LOG_LI_PKT | LOG_LI_COMP | LOG_LI_STDOUT) : (LOG_LI_PKT | LOG_LI_COMP),
2605 " DATA:");
2606
2607 LOG_PACKET_log_bytes(&(in_pkts[0].ts),
2608 in_pkts + idx,
2609 in_npkts - idx - 2,
2610 LOG_MT_ROUTINE,
2611 (in_mirror_to_console) ? (LOG_LI_PKT | LOG_LI_COMP | LOG_LI_STDOUT) : (LOG_LI_PKT | LOG_LI_COMP));
2612 }
2613
2614
2615 static void LOG_PACKET_log_f_acksenddata(int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console)
2616 {
2617 int cspan;
2618 int mdelta;
2619 int packetid;
2620 int acknack;
2621 int nretries;
2622 static struct __timeb64 t_last_msg;
2623 static int first_time = TRUE;
2624 char buf[250];
2625
2626 if (first_time)
2627 {
2628 memcpy(&t_last_msg, &(in_pkts[0].ts), sizeof(t_last_msg));
2629 first_time = FALSE;
2630 }
2631
2632 cspan = MISCFUNC_timb64_diff_bounded_ms(&(in_pkts[0].ts), &(in_pkts[in_npkts-1].ts));
2633 mdelta = MISCFUNC_timb64_diff_bounded_ms(&t_last_msg, &(in_pkts[0].ts));
2634 memcpy(&t_last_msg, &(in_pkts[0].ts), sizeof(t_last_msg));
2635
2636 sprintf_s(buf, sizeof(buf), "CH%02d:%s.", in_channel, LOG_PACKET_pkt_type_lut_a[in_lutblentry].tag_terse);
2637
2638 LOG_write_ls(&(in_pkts[0].ts),
2639 LOG_MT_ROUTINE,
2640 (in_mirror_to_console) ? (LOG_LI_PKT | LOG_LI_COMP | LOG_LI_STDOUT) : (LOG_LI_PKT | LOG_LI_COMP),
2641 buf);
2642
2643 sprintf_s(buf, sizeof(buf), " cspan=%d, mdelta=%d.", cspan, mdelta);
2644
2645 LOG_write_ls(&(in_pkts[0].ts),
2646 LOG_MT_ROUTINE,
2647 (in_mirror_to_console) ? (LOG_LI_PKT | LOG_LI_COMP | LOG_LI_STDOUT) : (LOG_LI_PKT | LOG_LI_COMP),
2648 buf);
2649
2650 //The header.
2651 LOG_PACKET_log_bytes(&(in_pkts[0].ts),
2652 in_pkts,
2653 3,
2654 LOG_MT_ROUTINE,
2655 (in_mirror_to_console) ? (LOG_LI_PKT | LOG_LI_COMP | LOG_LI_STDOUT) : (LOG_LI_PKT | LOG_LI_COMP));
2656 //The payload.
2657 LOG_PACKET_log_bytes(&(in_pkts[0].ts),
2658 in_pkts+3,
2659 in_npkts-5,
2660 LOG_MT_ROUTINE,
2661 (in_mirror_to_console) ? (LOG_LI_PKT | LOG_LI_COMP | LOG_LI_STDOUT) : (LOG_LI_PKT | LOG_LI_COMP));
2662 //The trailer.
2663 LOG_PACKET_log_bytes(&(in_pkts[0].ts),
2664 in_pkts+in_npkts-2,
2665 2,
2666 LOG_MT_ROUTINE,
2667 (in_mirror_to_console) ? (LOG_LI_PKT | LOG_LI_COMP | LOG_LI_STDOUT) : (LOG_LI_PKT | LOG_LI_COMP));
2668
2669 packetid = ((int)in_pkts[ 3].c) & 0xFF;
2670 acknack = ((int)in_pkts[ 4].c) & 0xFF;
2671 nretries = ((int)in_pkts[ 5].c) & 0xFF;
2672
2673 sprintf_s(buf, sizeof(buf), " PACKET_ID: 0x%02X, ACK_NACK: 0x%02X, NUM_RETRIES: 0x%02X.",
2674 packetid,
2675 acknack,
2676 nretries
2677 );
2678
2679 LOG_write_ls(&(in_pkts[0].ts),
2680 LOG_MT_ROUTINE,
2681 (in_mirror_to_console) ? (LOG_LI_PKT | LOG_LI_COMP | LOG_LI_STDOUT) : (LOG_LI_PKT | LOG_LI_COMP),
2682 buf);
2683
2684 if (acknack != 0x01)
2685 {
2686 sprintf_s(buf, sizeof(buf), "CH%02d:ACK_NACK error in %s.", in_channel, LOG_PACKET_pkt_type_lut_a[in_lutblentry].tag_terse);
2687
2688 LOG_write_ls(&(in_pkts[0].ts),
2689 LOG_MT_ALERT,
2690 LOG_LI_PKT | LOG_LI_ALERT | LOG_LI_COMP | LOG_LI_STDOUT,
2691 buf);
2692
2693 sprintf_s(buf, sizeof(buf), " ACK_NACK: 0x%02X.", acknack);
2694
2695 LOG_write_ls(&(in_pkts[0].ts),
2696 LOG_MT_ALERT,
2697 LOG_LI_PKT | LOG_LI_ALERT | LOG_LI_COMP | LOG_LI_STDOUT,
2698 buf);
2699 }
2700 }
2701
2702
2703 static void LOG_PACKET_log_f_rxeddata(int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console)
2704 {
2705 int idx;
2706 int cspan;
2707 int mdelta;
2708 int packetid;
2709 int targetsender;
2710 int lqi;
2711 int addressmode;
2712 int desttransad[8];
2713 int srctransad[8];
2714 static struct __timeb64 t_last_msg;
2715 static int first_time = TRUE;
2716 char buf[250];
2717
2718 if (first_time)
2719 {
2720 memcpy(&t_last_msg, &(in_pkts[0].ts), sizeof(t_last_msg));
2721 first_time = FALSE;
2722 }
2723
2724 cspan = MISCFUNC_timb64_diff_bounded_ms(&(in_pkts[0].ts), &(in_pkts[in_npkts-1].ts));
2725 mdelta = MISCFUNC_timb64_diff_bounded_ms(&t_last_msg, &(in_pkts[0].ts));
2726 memcpy(&t_last_msg, &(in_pkts[0].ts), sizeof(t_last_msg));
2727
2728 sprintf_s(buf, sizeof(buf), "CH%02d:%s.", in_channel, LOG_PACKET_pkt_type_lut_a[in_lutblentry].tag_terse);
2729
2730 LOG_write_ls(&(in_pkts[0].ts),
2731 LOG_MT_ROUTINE,
2732 (in_mirror_to_console) ? (LOG_LI_PKT | LOG_LI_COMP | LOG_LI_STDOUT) : (LOG_LI_PKT | LOG_LI_COMP),
2733 buf);
2734
2735 sprintf_s(buf, sizeof(buf), " cspan=%d, mdelta=%d.", cspan, mdelta);
2736
2737 LOG_write_ls(&(in_pkts[0].ts),
2738 LOG_MT_ROUTINE,
2739 (in_mirror_to_console) ? (LOG_LI_PKT | LOG_LI_COMP | LOG_LI_STDOUT) : (LOG_LI_PKT | LOG_LI_COMP),
2740 buf);
2741
2742 //The header.
2743 LOG_PACKET_log_bytes(&(in_pkts[0].ts),
2744 in_pkts,
2745 3,
2746 LOG_MT_ROUTINE,
2747 (in_mirror_to_console) ? (LOG_LI_PKT | LOG_LI_COMP | LOG_LI_STDOUT) : (LOG_LI_PKT | LOG_LI_COMP));
2748 //The payload.
2749 LOG_PACKET_log_bytes(&(in_pkts[0].ts),
2750 in_pkts+3,
2751 in_npkts-5,
2752 LOG_MT_ROUTINE,
2753 (in_mirror_to_console) ? (LOG_LI_PKT | LOG_LI_COMP | LOG_LI_STDOUT) : (LOG_LI_PKT | LOG_LI_COMP));
2754 //The trailer.
2755 LOG_PACKET_log_bytes(&(in_pkts[0].ts),
2756 in_pkts+in_npkts-2,
2757 2,
2758 LOG_MT_ROUTINE,
2759 (in_mirror_to_console) ? (LOG_LI_PKT | LOG_LI_COMP | LOG_LI_STDOUT) : (LOG_LI_PKT | LOG_LI_COMP));
2760
2761 packetid = ((int)in_pkts[3].c) & 0xFF;
2762 targetsender = ((int)in_pkts[4].c) & 0xFF;
2763 lqi = ((int)in_pkts[5].c) & 0xFF;
2764
2765 sprintf_s(buf, sizeof(buf), " PACKET_ID: 0x%02X, TARGET_SENDER: 0x%02X, LQI: 0x%02X.",
2766 packetid,
2767 targetsender,
2768 lqi
2769 );
2770
2771 LOG_write_ls(&(in_pkts[0].ts),
2772 LOG_MT_ROUTINE,
2773 (in_mirror_to_console) ? (LOG_LI_PKT | LOG_LI_COMP | LOG_LI_STDOUT) : (LOG_LI_PKT | LOG_LI_COMP),
2774 buf);
2775
2776 addressmode = ((int)in_pkts[6].c) & 0xFF;
2777
2778 sprintf_s(buf, sizeof(buf), " ADDRESS_MODE: 0x%02X.",
2779 addressmode);
2780
2781 LOG_write_ls(&(in_pkts[0].ts),
2782 LOG_MT_ROUTINE,
2783 (in_mirror_to_console) ? (LOG_LI_PKT | LOG_LI_COMP | LOG_LI_STDOUT) : (LOG_LI_PKT | LOG_LI_COMP),
2784 buf);
2785
2786 //Flag a bad address mode if it exists.
2787 if ((addressmode != 0x00) && (addressmode != 0x01) && (addressmode != 0x10) && (addressmode != 0x11))
2788 {
2789 sprintf_s(buf, sizeof(buf), "CH%02d:ADDRESS_MODE error in %s.", in_channel, LOG_PACKET_pkt_type_lut_a[in_lutblentry].tag_terse);
2790
2791 LOG_write_ls(&(in_pkts[0].ts),
2792 LOG_MT_ALERT,
2793 LOG_LI_PKT | LOG_LI_ALERT | LOG_LI_COMP | LOG_LI_STDOUT,
2794 buf);
2795
2796 sprintf_s(buf, sizeof(buf), " ADDRESS_MODE: 0x%02X.", addressmode);
2797
2798 LOG_write_ls(&(in_pkts[0].ts),
2799 LOG_MT_ALERT,
2800 LOG_LI_PKT | LOG_LI_ALERT | LOG_LI_COMP | LOG_LI_STDOUT,
2801 buf);
2802 }
2803
2804 //Form up the destination address. It may be short or long.
2805 FillMemory(desttransad, sizeof(desttransad), 0);
2806
2807 idx = 7;
2808 if (in_npkts > idx)
2809 {
2810 desttransad[7] = ((int)in_pkts[idx].c) & 0xFF;
2811 }
2812 idx++;
2813 if (in_npkts > idx)
2814 {
2815 desttransad[6] = ((int)in_pkts[idx].c) & 0xFF;
2816 }
2817 idx++;
2818
2819 if (addressmode & 0xf0) //Long address.
2820 {
2821 if (in_npkts > idx)
2822 {
2823 desttransad[5] = ((int)in_pkts[idx].c) & 0xFF;
2824 }
2825 idx++;
2826 if (in_npkts > idx)
2827 {
2828 desttransad[4] = ((int)in_pkts[idx].c) & 0xFF;
2829 }
2830 idx++;
2831 if (in_npkts > idx)
2832 {
2833 desttransad[3] = ((int)in_pkts[idx].c) & 0xFF;
2834 }
2835 idx++;
2836 if (in_npkts > idx)
2837 {
2838 desttransad[2] = ((int)in_pkts[idx].c) & 0xFF;
2839 }
2840 idx++;
2841 if (in_npkts > idx)
2842 {
2843 desttransad[1] = ((int)in_pkts[idx].c) & 0xFF;
2844 }
2845 idx++;
2846 if (in_npkts > idx)
2847 {
2848 desttransad[0] = ((int)in_pkts[idx].c) & 0xFF;
2849 }
2850 idx++;
2851 }
2852
2853 //Form up the source address. It may be short or long.
2854 FillMemory(srctransad, sizeof(srctransad), 0);
2855
2856 if (in_npkts > idx)
2857 {
2858 srctransad[7] = ((int)in_pkts[idx].c) & 0xFF;
2859 }
2860 idx++;
2861 if (in_npkts > idx)
2862 {
2863 srctransad[6] = ((int)in_pkts[idx].c) & 0xFF;
2864 }
2865 idx++;
2866
2867 if (addressmode & 0x0f) //Long address.
2868 {
2869 if (in_npkts > idx)
2870 {
2871 srctransad[5] = ((int)in_pkts[idx].c) & 0xFF;
2872 }
2873 idx++;
2874 if (in_npkts > idx)
2875 {
2876 srctransad[4] = ((int)in_pkts[idx].c) & 0xFF;
2877 }
2878 idx++;
2879 if (in_npkts > idx)
2880 {
2881 srctransad[3] = ((int)in_pkts[idx].c) & 0xFF;
2882 }
2883 idx++;
2884 if (in_npkts > idx)
2885 {
2886 srctransad[2] = ((int)in_pkts[idx].c) & 0xFF;
2887 }
2888 idx++;
2889 if (in_npkts > idx)
2890 {
2891 srctransad[1] = ((int)in_pkts[idx].c) & 0xFF;
2892 }
2893 idx++;
2894 if (in_npkts > idx)
2895 {
2896 srctransad[0] = ((int)in_pkts[idx].c) & 0xFF;
2897 }
2898 idx++;
2899 }
2900
2901 //If we've overshot the data area (and the assumption is made that there is at least one
2902 //byte of data), this means that the address modes were inconsistent with the message length.
2903 //This is an error.
2904 if (idx > (in_npkts - 3))
2905 {
2906 sprintf_s(buf, sizeof(buf), "CH%02d:ADDRESS_MODE and message length error in %s.", in_channel, LOG_PACKET_pkt_type_lut_a[in_lutblentry].tag_terse);
2907
2908 LOG_write_ls(&(in_pkts[0].ts),
2909 LOG_MT_ALERT,
2910 LOG_LI_PKT | LOG_LI_ALERT | LOG_LI_COMP | LOG_LI_STDOUT,
2911 buf);
2912 }
2913
2914 //Emit the destination transceiver and source transceiver address. There is some variability due
2915 //to the address mode.
2916 {
2917 char minibuf[250];
2918
2919 strcpy_s(buf, sizeof(buf), " ");
2920
2921 if (addressmode & 0xf0) //Destination transceiver long address.
2922 {
2923 sprintf_s(minibuf,
2924 sizeof(minibuf),
2925 "DST_TRANS_AD: 0x%02X%02X%02X%02X02X%02X%02X%02X,",
2926 ((int)desttransad[0]) & 0xFF,
2927 ((int)desttransad[1]) & 0xFF,
2928 ((int)desttransad[2]) & 0xFF,
2929 ((int)desttransad[3]) & 0xFF,
2930 ((int)desttransad[4]) & 0xFF,
2931 ((int)desttransad[5]) & 0xFF,
2932 ((int)desttransad[6]) & 0xFF,
2933 ((int)desttransad[7]) & 0xFF);
2934 }
2935 else
2936 {
2937 sprintf_s(minibuf,
2938 sizeof(minibuf),
2939 "DST_TRANS_AD: 0x%02X%02X,",
2940 ((int)desttransad[6]) & 0xFF,
2941 ((int)desttransad[7]) & 0xFF);
2942 }
2943
2944 //Add in the string and some space.
2945 strcat_s(buf, sizeof(buf), minibuf);
2946 strcat_s(buf, sizeof(buf), " ");
2947
2948 if (addressmode & 0x0f) //Source transceiver long address.
2949 {
2950 sprintf_s(minibuf,
2951 sizeof(minibuf),
2952 "SRC_TRANS_AD: 0x%02X%02X%02X%02X02X%02X%02X%02X.",
2953 ((int)srctransad[0]) & 0xFF,
2954 ((int)srctransad[1]) & 0xFF,
2955 ((int)srctransad[2]) & 0xFF,
2956 ((int)srctransad[3]) & 0xFF,
2957 ((int)srctransad[4]) & 0xFF,
2958 ((int)srctransad[5]) & 0xFF,
2959 ((int)srctransad[6]) & 0xFF,
2960 ((int)srctransad[7]) & 0xFF);
2961 }
2962 else
2963 {
2964 sprintf_s(minibuf,
2965 sizeof(minibuf),
2966 "SRC_TRANS_AD: 0x%02X%02X.",
2967 ((int)srctransad[6]) & 0xFF,
2968 ((int)srctransad[7]) & 0xFF);
2969 }
2970
2971 //Add in the string.
2972 strcat_s(buf, sizeof(buf), minibuf);
2973
2974 //And write the line to the log.
2975 LOG_write_ls(&(in_pkts[0].ts),
2976 LOG_MT_ROUTINE,
2977 (in_mirror_to_console) ? (LOG_LI_PKT | LOG_LI_COMP | LOG_LI_STDOUT) : (LOG_LI_PKT | LOG_LI_COMP),
2978 buf);
2979 }
2980
2981 //Write the data bytes.
2982 LOG_write_ls(&(in_pkts[0].ts),
2983 LOG_MT_ROUTINE,
2984 (in_mirror_to_console) ? (LOG_LI_PKT | LOG_LI_COMP | LOG_LI_STDOUT) : (LOG_LI_PKT | LOG_LI_COMP),
2985 " DATA:");
2986
2987 LOG_PACKET_log_bytes(&(in_pkts[0].ts),
2988 in_pkts + idx,
2989 in_npkts - idx - 2,
2990 LOG_MT_ROUTINE,
2991 (in_mirror_to_console) ? (LOG_LI_PKT | LOG_LI_COMP | LOG_LI_STDOUT) : (LOG_LI_PKT | LOG_LI_COMP));
2992 }
2993
2994
2995 static void LOG_PACKET_log_f_resetrequest(int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console)
2996 {
2997 static struct __timeb64 t_last_msg;
2998 static int first_time = TRUE;
2999
3000 LOG_PACKET_log_f_generic(in_channel,
3001 in_ts,
3002 in_pkts,
3003 in_npkts,
3004 in_lutblentry,
3005 in_mirror_to_console,
3006 &t_last_msg,
3007 &first_time);
3008 }
3009
3010
3011 static void LOG_PACKET_log_f_ackresetrequest(int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console)
3012 {
3013 static struct __timeb64 t_last_msg;
3014 static int first_time = TRUE;
3015
3016 LOG_PACKET_log_f_generic(in_channel,
3017 in_ts,
3018 in_pkts,
3019 in_npkts,
3020 in_lutblentry,
3021 in_mirror_to_console,
3022 &t_last_msg,
3023 &first_time);
3024 }
3025
3026
3027 static void LOG_PACKET_log_f_sendmsgapp(int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console)
3028 {
3029 static struct __timeb64 t_last_msg;
3030 static int first_time = TRUE;
3031
3032 LOG_PACKET_log_f_generic(in_channel,
3033 in_ts,
3034 in_pkts,
3035 in_npkts,
3036 in_lutblentry,
3037 in_mirror_to_console,
3038 &t_last_msg,
3039 &first_time);
3040 }
3041
3042
3043 static void LOG_PACKET_log_f_acksendmsgapp(int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console)
3044 {
3045 static struct __timeb64 t_last_msg;
3046 static int first_time = TRUE;
3047
3048 LOG_PACKET_log_f_generic(in_channel,
3049 in_ts,
3050 in_pkts,
3051 in_npkts,
3052 in_lutblentry,
3053 in_mirror_to_console,
3054 &t_last_msg,
3055 &first_time);
3056 }
3057
3058
3059 static void LOG_PACKET_log_f_rxedmsgapp(int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console)
3060 {
3061 static struct __timeb64 t_last_msg;
3062 static int first_time = TRUE;
3063
3064 LOG_PACKET_log_f_generic(in_channel,
3065 in_ts,
3066 in_pkts,
3067 in_npkts,
3068 in_lutblentry,
3069 in_mirror_to_console,
3070 &t_last_msg,
3071 &first_time);
3072 }
3073
3074
3075 static void LOG_PACKET_log_f_initfirmwaredownload(int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console)
3076 {
3077 static struct __timeb64 t_last_msg;
3078 static int first_time = TRUE;
3079
3080 LOG_PACKET_log_f_generic(in_channel,
3081 in_ts,
3082 in_pkts,
3083 in_npkts,
3084 in_lutblentry,
3085 in_mirror_to_console,
3086 &t_last_msg,
3087 &first_time);
3088 }
3089
3090
3091 static void LOG_PACKET_log_f_ackinitfirmwaredownload(int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console)
3092 {
3093 static struct __timeb64 t_last_msg;
3094 static int first_time = TRUE;
3095
3096 LOG_PACKET_log_f_generic(in_channel,
3097 in_ts,
3098 in_pkts,
3099 in_npkts,
3100 in_lutblentry,
3101 in_mirror_to_console,
3102 &t_last_msg,
3103 &first_time);
3104 }
3105
3106
3107 static void LOG_PACKET_log_f_transferfirmwareblock(int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console)
3108 {
3109 static struct __timeb64 t_last_msg;
3110 static int first_time = TRUE;
3111
3112 LOG_PACKET_log_f_generic(in_channel,
3113 in_ts,
3114 in_pkts,
3115 in_npkts,
3116 in_lutblentry,
3117 in_mirror_to_console,
3118 &t_last_msg,
3119 &first_time);
3120 }
3121
3122
3123 static void LOG_PACKET_log_f_acktransferfirmwareblock(int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console)
3124 {
3125 static struct __timeb64 t_last_msg;
3126 static int first_time = TRUE;
3127
3128 LOG_PACKET_log_f_generic(in_channel,
3129 in_ts,
3130 in_pkts,
3131 in_npkts,
3132 in_lutblentry,
3133 in_mirror_to_console,
3134 &t_last_msg,
3135 &first_time);
3136 }
3137
3138
3139 static void LOG_PACKET_log_f_terminatedownload(int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console)
3140 {
3141 static struct __timeb64 t_last_msg;
3142 static int first_time = TRUE;
3143
3144 LOG_PACKET_log_f_generic(in_channel,
3145 in_ts,
3146 in_pkts,
3147 in_npkts,
3148 in_lutblentry,
3149 in_mirror_to_console,
3150 &t_last_msg,
3151 &first_time);
3152 }
3153
3154
3155 static void LOG_PACKET_log_f_ackterminatedownload(int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console)
3156 {
3157 static struct __timeb64 t_last_msg;
3158 static int first_time = TRUE;
3159
3160 LOG_PACKET_log_f_generic(in_channel,
3161 in_ts,
3162 in_pkts,
3163 in_npkts,
3164 in_lutblentry,
3165 in_mirror_to_console,
3166 &t_last_msg,
3167 &first_time);
3168 }
3169
3170
3171 static void LOG_PACKET_log_f_setdigpincfg(int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console)
3172 {
3173 static struct __timeb64 t_last_msg;
3174 static int first_time = TRUE;
3175
3176 LOG_PACKET_log_f_generic(in_channel,
3177 in_ts,
3178 in_pkts,
3179 in_npkts,
3180 in_lutblentry,
3181 in_mirror_to_console,
3182 &t_last_msg,
3183 &first_time);
3184 }
3185
3186
3187 static void LOG_PACKET_log_f_acksetdigpincfg(int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console)
3188 {
3189 static struct __timeb64 t_last_msg;
3190 static int first_time = TRUE;
3191
3192 LOG_PACKET_log_f_generic(in_channel,
3193 in_ts,
3194 in_pkts,
3195 in_npkts,
3196 in_lutblentry,
3197 in_mirror_to_console,
3198 &t_last_msg,
3199 &first_time);
3200 }
3201
3202
3203 static void LOG_PACKET_log_f_querydigpincfg(int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console)
3204 {
3205 static struct __timeb64 t_last_msg;
3206 static int first_time = TRUE;
3207
3208 LOG_PACKET_log_f_generic(in_channel,
3209 in_ts,
3210 in_pkts,
3211 in_npkts,
3212 in_lutblentry,
3213 in_mirror_to_console,
3214 &t_last_msg,
3215 &first_time);
3216 }
3217
3218
3219 static void LOG_PACKET_log_f_respdigpincfg(int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console)
3220 {
3221 static struct __timeb64 t_last_msg;
3222 static int first_time = TRUE;
3223
3224 LOG_PACKET_log_f_generic(in_channel,
3225 in_ts,
3226 in_pkts,
3227 in_npkts,
3228 in_lutblentry,
3229 in_mirror_to_console,
3230 &t_last_msg,
3231 &first_time);
3232 }
3233
3234
3235 static void LOG_PACKET_log_f_setdigpinstate(int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console)
3236 {
3237 static struct __timeb64 t_last_msg;
3238 static int first_time = TRUE;
3239
3240 LOG_PACKET_log_f_generic(in_channel,
3241 in_ts,
3242 in_pkts,
3243 in_npkts,
3244 in_lutblentry,
3245 in_mirror_to_console,
3246 &t_last_msg,
3247 &first_time);
3248 }
3249
3250
3251 static void LOG_PACKET_log_f_acksetdigpinstate(int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console)
3252 {
3253 static struct __timeb64 t_last_msg;
3254 static int first_time = TRUE;
3255
3256 LOG_PACKET_log_f_generic(in_channel,
3257 in_ts,
3258 in_pkts,
3259 in_npkts,
3260 in_lutblentry,
3261 in_mirror_to_console,
3262 &t_last_msg,
3263 &first_time);
3264 }
3265
3266
3267 static void LOG_PACKET_log_f_querydigpinstate(int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console)
3268 {
3269 static struct __timeb64 t_last_msg;
3270 static int first_time = TRUE;
3271
3272 LOG_PACKET_log_f_generic(in_channel,
3273 in_ts,
3274 in_pkts,
3275 in_npkts,
3276 in_lutblentry,
3277 in_mirror_to_console,
3278 &t_last_msg,
3279 &first_time);
3280 }
3281
3282
3283 static void LOG_PACKET_log_f_respdigpinstate(int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console)
3284 {
3285 static struct __timeb64 t_last_msg;
3286 static int first_time = TRUE;
3287
3288 LOG_PACKET_log_f_generic(in_channel,
3289 in_ts,
3290 in_pkts,
3291 in_npkts,
3292 in_lutblentry,
3293 in_mirror_to_console,
3294 &t_last_msg,
3295 &first_time);
3296 }
3297
3298
3299 static void LOG_PACKET_log_f_queryanalogpinvalues(int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console)
3300 {
3301 static struct __timeb64 t_last_msg;
3302 static int first_time = TRUE;
3303
3304 LOG_PACKET_log_f_generic(in_channel,
3305 in_ts,
3306 in_pkts,
3307 in_npkts,
3308 in_lutblentry,
3309 in_mirror_to_console,
3310 &t_last_msg,
3311 &first_time);
3312 }
3313
3314
3315 static void LOG_PACKET_log_f_respanalogpinvalues(int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console)
3316 {
3317 static struct __timeb64 t_last_msg;
3318 static int first_time = TRUE;
3319
3320 LOG_PACKET_log_f_generic(in_channel,
3321 in_ts,
3322 in_pkts,
3323 in_npkts,
3324 in_lutblentry,
3325 in_mirror_to_console,
3326 &t_last_msg,
3327 &first_time);
3328 }
3329
3330
3331 static void LOG_PACKET_log_f_setanalogpinsleepstate(int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console)
3332 {
3333 static struct __timeb64 t_last_msg;
3334 static int first_time = TRUE;
3335
3336 LOG_PACKET_log_f_generic(in_channel,
3337 in_ts,
3338 in_pkts,
3339 in_npkts,
3340 in_lutblentry,
3341 in_mirror_to_console,
3342 &t_last_msg,
3343 &first_time);
3344 }
3345
3346
3347 static void LOG_PACKET_log_f_acksetanalogpinsleepstate(int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console)
3348 {
3349 static struct __timeb64 t_last_msg;
3350 static int first_time = TRUE;
3351
3352 LOG_PACKET_log_f_generic(in_channel,
3353 in_ts,
3354 in_pkts,
3355 in_npkts,
3356 in_lutblentry,
3357 in_mirror_to_console,
3358 &t_last_msg,
3359 &first_time);
3360 }
3361
3362
3363 static void LOG_PACKET_log_f_queryanalogpinsleepstate(int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console)
3364 {
3365 static struct __timeb64 t_last_msg;
3366 static int first_time = TRUE;
3367
3368 LOG_PACKET_log_f_generic(in_channel,
3369 in_ts,
3370 in_pkts,
3371 in_npkts,
3372 in_lutblentry,
3373 in_mirror_to_console,
3374 &t_last_msg,
3375 &first_time);
3376 }
3377
3378
3379 static void LOG_PACKET_log_f_respanalogpinsleepstate(int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console)
3380 {
3381 static struct __timeb64 t_last_msg;
3382 static int first_time = TRUE;
3383
3384 LOG_PACKET_log_f_generic(in_channel,
3385 in_ts,
3386 in_pkts,
3387 in_npkts,
3388 in_lutblentry,
3389 in_mirror_to_console,
3390 &t_last_msg,
3391 &first_time);
3392 }
3393
3394
3395 static void LOG_PACKET_log_f_setdigpinsleepstate(int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console)
3396 {
3397 static struct __timeb64 t_last_msg;
3398 static int first_time = TRUE;
3399
3400 LOG_PACKET_log_f_generic(in_channel,
3401 in_ts,
3402 in_pkts,
3403 in_npkts,
3404 in_lutblentry,
3405 in_mirror_to_console,
3406 &t_last_msg,
3407 &first_time);
3408 }
3409
3410
3411 static void LOG_PACKET_log_f_acksetdigpinsleepstate(int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console)
3412 {
3413 static struct __timeb64 t_last_msg;
3414 static int first_time = TRUE;
3415
3416 LOG_PACKET_log_f_generic(in_channel,
3417 in_ts,
3418 in_pkts,
3419 in_npkts,
3420 in_lutblentry,
3421 in_mirror_to_console,
3422 &t_last_msg,
3423 &first_time);
3424 }
3425
3426
3427 static void LOG_PACKET_log_f_querydigpinsleepstate(int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console)
3428 {
3429 static struct __timeb64 t_last_msg;
3430 static int first_time = TRUE;
3431
3432 LOG_PACKET_log_f_generic(in_channel,
3433 in_ts,
3434 in_pkts,
3435 in_npkts,
3436 in_lutblentry,
3437 in_mirror_to_console,
3438 &t_last_msg,
3439 &first_time);
3440 }
3441
3442
3443 static void LOG_PACKET_log_f_respdigpinsleepstate(int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console)
3444 {
3445 static struct __timeb64 t_last_msg;
3446 static int first_time = TRUE;
3447
3448 LOG_PACKET_log_f_generic(in_channel,
3449 in_ts,
3450 in_pkts,
3451 in_npkts,
3452 in_lutblentry,
3453 in_mirror_to_console,
3454 &t_last_msg,
3455 &first_time);
3456 }
3457
3458
3459 static void LOG_PACKET_log_f_setdebugmode(int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console)
3460 {
3461 static struct __timeb64 t_last_msg;
3462 static int first_time = TRUE;
3463
3464 LOG_PACKET_log_f_generic(in_channel,
3465 in_ts,
3466 in_pkts,
3467 in_npkts,
3468 in_lutblentry,
3469 in_mirror_to_console,
3470 &t_last_msg,
3471 &first_time);
3472 }
3473
3474
3475 static void LOG_PACKET_log_f_acksetdebugmode(int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console)
3476 {
3477 static struct __timeb64 t_last_msg;
3478 static int first_time = TRUE;
3479
3480 LOG_PACKET_log_f_generic(in_channel,
3481 in_ts,
3482 in_pkts,
3483 in_npkts,
3484 in_lutblentry,
3485 in_mirror_to_console,
3486 &t_last_msg,
3487 &first_time);
3488 }
3489
3490
3491 static void LOG_PACKET_log_f_setledfunctionality(int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console)
3492 {
3493 int cspan;
3494 int mdelta;
3495 int ledmode;
3496 static struct __timeb64 t_last_msg;
3497 static int first_time = TRUE;
3498 char buf[250];
3499
3500 if (first_time)
3501 {
3502 memcpy(&t_last_msg, &(in_pkts[0].ts), sizeof(t_last_msg));
3503 first_time = FALSE;
3504 }
3505
3506 cspan = MISCFUNC_timb64_diff_bounded_ms(&(in_pkts[0].ts), &(in_pkts[in_npkts-1].ts));
3507 mdelta = MISCFUNC_timb64_diff_bounded_ms(&t_last_msg, &(in_pkts[0].ts));
3508 memcpy(&t_last_msg, &(in_pkts[0].ts), sizeof(t_last_msg));
3509
3510 sprintf_s(buf, sizeof(buf), "CH%02d:%s.", in_channel, LOG_PACKET_pkt_type_lut_a[in_lutblentry].tag_terse);
3511
3512 LOG_write_ls(&(in_pkts[0].ts),
3513 LOG_MT_ROUTINE,
3514 (in_mirror_to_console) ? (LOG_LI_PKT | LOG_LI_COMP | LOG_LI_STDOUT) : (LOG_LI_PKT | LOG_LI_COMP),
3515 buf);
3516
3517 sprintf_s(buf, sizeof(buf), " cspan=%d, mdelta=%d.", cspan, mdelta);
3518
3519 LOG_write_ls(&(in_pkts[0].ts),
3520 LOG_MT_ROUTINE,
3521 (in_mirror_to_console) ? (LOG_LI_PKT | LOG_LI_COMP | LOG_LI_STDOUT) : (LOG_LI_PKT | LOG_LI_COMP),
3522 buf);
3523
3524 //The header.
3525 LOG_PACKET_log_bytes(&(in_pkts[0].ts),
3526 in_pkts,
3527 3,
3528 LOG_MT_ROUTINE,
3529 (in_mirror_to_console) ? (LOG_LI_PKT | LOG_LI_COMP | LOG_LI_STDOUT) : (LOG_LI_PKT | LOG_LI_COMP));
3530 //The payload.
3531 LOG_PACKET_log_bytes(&(in_pkts[0].ts),
3532 in_pkts+3,
3533 in_npkts-5,
3534 LOG_MT_ROUTINE,
3535 (in_mirror_to_console) ? (LOG_LI_PKT | LOG_LI_COMP | LOG_LI_STDOUT) : (LOG_LI_PKT | LOG_LI_COMP));
3536 //The trailer.
3537 LOG_PACKET_log_bytes(&(in_pkts[0].ts),
3538 in_pkts+in_npkts-2,
3539 2,
3540 LOG_MT_ROUTINE,
3541 (in_mirror_to_console) ? (LOG_LI_PKT | LOG_LI_COMP | LOG_LI_STDOUT) : (LOG_LI_PKT | LOG_LI_COMP));
3542
3543 ledmode = ((int)in_pkts[3].c) & 0xFF;
3544
3545 sprintf_s(buf, sizeof(buf), " LED_MODE: 0x%02X.",
3546 ledmode);
3547
3548 LOG_write_ls(&(in_pkts[0].ts),
3549 LOG_MT_ROUTINE,
3550 (in_mirror_to_console) ? (LOG_LI_PKT | LOG_LI_COMP | LOG_LI_STDOUT) : (LOG_LI_PKT | LOG_LI_COMP),
3551 buf);
3552 if (ledmode & 0xF8) //Bits set in the mode that shouldn't be.
3553 {
3554 sprintf_s(buf, sizeof(buf), "CH%02d:LED_MODE error in %s.", in_channel, LOG_PACKET_pkt_type_lut_a[in_lutblentry].tag_terse);
3555
3556 LOG_write_ls(&(in_pkts[0].ts),
3557 LOG_MT_ALERT,
3558 LOG_LI_PKT | LOG_LI_ALERT | LOG_LI_COMP | LOG_LI_STDOUT,
3559 buf);
3560
3561 sprintf_s(buf, sizeof(buf), " LED_MODE: 0x%02X.", ledmode);
3562
3563 LOG_write_ls(&(in_pkts[0].ts),
3564 LOG_MT_ALERT,
3565 LOG_LI_PKT | LOG_LI_ALERT | LOG_LI_COMP | LOG_LI_STDOUT,
3566 buf);
3567 }
3568 }
3569
3570
3571 static void LOG_PACKET_log_f_acksetledfunctionality(int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console)
3572 {
3573 static struct __timeb64 t_last_msg;
3574 static int first_time = TRUE;
3575
3576 LOG_PACKET_log_f_generic(in_channel,
3577 in_ts,
3578 in_pkts,
3579 in_npkts,
3580 in_lutblentry,
3581 in_mirror_to_console,
3582 &t_last_msg,
3583 &first_time);
3584 }
3585
3586
3587 static void LOG_PACKET_log_f_rxbytesidtoid(int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console)
3588 {
3589 static struct __timeb64 t_last_msg;
3590 static int first_time = TRUE;
3591
3592 LOG_PACKET_log_f_generic(in_channel,
3593 in_ts,
3594 in_pkts,
3595 in_npkts,
3596 in_lutblentry,
3597 in_mirror_to_console,
3598 &t_last_msg,
3599 &first_time);
3600 }
3601
3602
3603 static void LOG_PACKET_log_f_setprogrammablesettings(int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console)
3604 {
3605 int cspan;
3606 int mdelta;
3607 int panidlsb, panidmsb, panid;
3608 int rfchannel;
3609 int receive_all;
3610 int rfacksretries;
3611 int rfpowerlevel;
3612 int txcvrlongad[8];
3613 int txcvrshortad[2];
3614 static struct __timeb64 t_last_msg;
3615 static int first_time = TRUE;
3616 char buf[250];
3617
3618 if (first_time)
3619 {
3620 memcpy(&t_last_msg, &(in_pkts[0].ts), sizeof(t_last_msg));
3621 first_time = FALSE;
3622 }
3623
3624 cspan = MISCFUNC_timb64_diff_bounded_ms(&(in_pkts[0].ts), &(in_pkts[in_npkts-1].ts));
3625 mdelta = MISCFUNC_timb64_diff_bounded_ms(&t_last_msg, &(in_pkts[0].ts));
3626 memcpy(&t_last_msg, &(in_pkts[0].ts), sizeof(t_last_msg));
3627
3628 sprintf_s(buf, sizeof(buf), "CH%02d:%s.", in_channel, LOG_PACKET_pkt_type_lut_a[in_lutblentry].tag_terse);
3629
3630 LOG_write_ls(&(in_pkts[0].ts),
3631 LOG_MT_ROUTINE,
3632 (in_mirror_to_console) ? (LOG_LI_PKT | LOG_LI_COMP | LOG_LI_STDOUT) : (LOG_LI_PKT | LOG_LI_COMP),
3633 buf);
3634
3635 sprintf_s(buf, sizeof(buf), " cspan=%d, mdelta=%d.", cspan, mdelta);
3636
3637 LOG_write_ls(&(in_pkts[0].ts),
3638 LOG_MT_ROUTINE,
3639 (in_mirror_to_console) ? (LOG_LI_PKT | LOG_LI_COMP | LOG_LI_STDOUT) : (LOG_LI_PKT | LOG_LI_COMP),
3640 buf);
3641
3642 //The header.
3643 LOG_PACKET_log_bytes(&(in_pkts[0].ts),
3644 in_pkts,
3645 3,
3646 LOG_MT_ROUTINE,
3647 (in_mirror_to_console) ? (LOG_LI_PKT | LOG_LI_COMP | LOG_LI_STDOUT) : (LOG_LI_PKT | LOG_LI_COMP));
3648 //The payload.
3649 LOG_PACKET_log_bytes(&(in_pkts[0].ts),
3650 in_pkts+3,
3651 in_npkts-5,
3652 LOG_MT_ROUTINE,
3653 (in_mirror_to_console) ? (LOG_LI_PKT | LOG_LI_COMP | LOG_LI_STDOUT) : (LOG_LI_PKT | LOG_LI_COMP));
3654 //The trailer.
3655 LOG_PACKET_log_bytes(&(in_pkts[0].ts),
3656 in_pkts+in_npkts-2,
3657 2,
3658 LOG_MT_ROUTINE,
3659 (in_mirror_to_console) ? (LOG_LI_PKT | LOG_LI_COMP | LOG_LI_STDOUT) : (LOG_LI_PKT | LOG_LI_COMP));
3660
3661 panidlsb = ((int)in_pkts[3].c) & 0xFF;
3662 panidmsb = ((int)in_pkts[4].c) & 0xFF;
3663 panid = 256 * panidmsb + panidlsb;
3664
3665 txcvrlongad[7] = ((int)in_pkts[ 5].c) & 0xFF;
3666 txcvrlongad[6] = ((int)in_pkts[ 6].c) & 0xFF;
3667 txcvrlongad[5] = ((int)in_pkts[ 7].c) & 0xFF;
3668 txcvrlongad[4] = ((int)in_pkts[ 8].c) & 0xFF;
3669 txcvrlongad[3] = ((int)in_pkts[ 9].c) & 0xFF;
3670 txcvrlongad[2] = ((int)in_pkts[10].c) & 0xFF;
3671 txcvrlongad[1] = ((int)in_pkts[11].c) & 0xFF;
3672 txcvrlongad[0] = ((int)in_pkts[12].c) & 0xFF;
3673
3674 sprintf_s(buf, sizeof(buf), " PANID: 0x%04X, TXCVR_LONG_AD: 0x%02X%02X%02X%02X%02X%02X%02X%02X.",
3675 panid,
3676 txcvrlongad[0],
3677 txcvrlongad[1],
3678 txcvrlongad[2],
3679 txcvrlongad[3],
3680 txcvrlongad[4],
3681 txcvrlongad[5],
3682 txcvrlongad[6],
3683 txcvrlongad[7]
3684 );
3685
3686 LOG_write_ls(&(in_pkts[0].ts),
3687 LOG_MT_ROUTINE,
3688 (in_mirror_to_console) ? (LOG_LI_PKT | LOG_LI_COMP | LOG_LI_STDOUT) : (LOG_LI_PKT | LOG_LI_COMP),
3689 buf);
3690
3691 txcvrshortad[1] = ((int)in_pkts[13].c) & 0xFF;
3692 txcvrshortad[0] = ((int)in_pkts[14].c) & 0xFF;
3693
3694 rfchannel = ((int)in_pkts[15].c) & 0xFF;
3695
3696 sprintf_s(buf, sizeof(buf), " TXCVR_SHORT_AD: 0x%02X%02X, RF_CHANNEL: 0x%02X.",
3697 txcvrshortad[0],
3698 txcvrshortad[1],
3699 rfchannel
3700 );
3701
3702 LOG_write_ls(&(in_pkts[0].ts),
3703 LOG_MT_ROUTINE,
3704 (in_mirror_to_console) ? (LOG_LI_PKT | LOG_LI_COMP | LOG_LI_STDOUT) : (LOG_LI_PKT | LOG_LI_COMP),
3705 buf);
3706
3707 receive_all = ((int)in_pkts[16].c) & 0xFF;
3708 rfacksretries = ((int)in_pkts[17].c) & 0xFF;
3709
3710 sprintf_s(buf, sizeof(buf), " RECEIVE_ALL: 0x%02X, RF_ACKS_RETRIES: 0x%02X.",
3711 receive_all,
3712 rfacksretries
3713 );
3714
3715 LOG_write_ls(&(in_pkts[0].ts),
3716 LOG_MT_ROUTINE,
3717 (in_mirror_to_console) ? (LOG_LI_PKT | LOG_LI_COMP | LOG_LI_STDOUT) : (LOG_LI_PKT | LOG_LI_COMP),
3718 buf);
3719
3720 rfpowerlevel = ((int)in_pkts[18].c) & 0xFF;
3721
3722 sprintf_s(buf, sizeof(buf), " RF_POWER_LEVEL: 0x%02X.",
3723 rfpowerlevel
3724 );
3725
3726 LOG_write_ls(&(in_pkts[0].ts),
3727 LOG_MT_ROUTINE,
3728 (in_mirror_to_console) ? (LOG_LI_PKT | LOG_LI_COMP | LOG_LI_STDOUT) : (LOG_LI_PKT | LOG_LI_COMP),
3729 buf);
3730 }
3731
3732
3733 static void LOG_PACKET_log_f_acksetprogrammablesettings(int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console)
3734 {
3735 int cspan;
3736 int mdelta;
3737 int acknack;
3738 int status;
3739 static struct __timeb64 t_last_msg;
3740 static int first_time = TRUE;
3741 char buf[250];
3742
3743 if (first_time)
3744 {
3745 memcpy(&t_last_msg, &(in_pkts[0].ts), sizeof(t_last_msg));
3746 first_time = FALSE;
3747 }
3748
3749 cspan = MISCFUNC_timb64_diff_bounded_ms(&(in_pkts[0].ts), &(in_pkts[in_npkts-1].ts));
3750 mdelta = MISCFUNC_timb64_diff_bounded_ms(&t_last_msg, &(in_pkts[0].ts));
3751 memcpy(&t_last_msg, &(in_pkts[0].ts), sizeof(t_last_msg));
3752
3753 sprintf_s(buf, sizeof(buf), "CH%02d:%s.", in_channel, LOG_PACKET_pkt_type_lut_a[in_lutblentry].tag_terse);
3754
3755 LOG_write_ls(&(in_pkts[0].ts),
3756 LOG_MT_ROUTINE,
3757 (in_mirror_to_console) ? (LOG_LI_PKT | LOG_LI_COMP | LOG_LI_STDOUT) : (LOG_LI_PKT | LOG_LI_COMP),
3758 buf);
3759
3760 sprintf_s(buf, sizeof(buf), " cspan=%d, mdelta=%d.", cspan, mdelta);
3761
3762 LOG_write_ls(&(in_pkts[0].ts),
3763 LOG_MT_ROUTINE,
3764 (in_mirror_to_console) ? (LOG_LI_PKT | LOG_LI_COMP | LOG_LI_STDOUT) : (LOG_LI_PKT | LOG_LI_COMP),
3765 buf);
3766
3767 //The header.
3768 LOG_PACKET_log_bytes(&(in_pkts[0].ts),
3769 in_pkts,
3770 3,
3771 LOG_MT_ROUTINE,
3772 (in_mirror_to_console) ? (LOG_LI_PKT | LOG_LI_COMP | LOG_LI_STDOUT) : (LOG_LI_PKT | LOG_LI_COMP));
3773 //The payload.
3774 LOG_PACKET_log_bytes(&(in_pkts[0].ts),
3775 in_pkts+3,
3776 in_npkts-5,
3777 LOG_MT_ROUTINE,
3778 (in_mirror_to_console) ? (LOG_LI_PKT | LOG_LI_COMP | LOG_LI_STDOUT) : (LOG_LI_PKT | LOG_LI_COMP));
3779 //The trailer.
3780 LOG_PACKET_log_bytes(&(in_pkts[0].ts),
3781 in_pkts+in_npkts-2,
3782 2,
3783 LOG_MT_ROUTINE,
3784 (in_mirror_to_console) ? (LOG_LI_PKT | LOG_LI_COMP | LOG_LI_STDOUT) : (LOG_LI_PKT | LOG_LI_COMP));
3785
3786 acknack = ((int)in_pkts[ 3].c) & 0xFF;
3787 status = ((int)in_pkts[ 4].c) & 0xFF;
3788
3789 sprintf_s(buf, sizeof(buf), " ACK_NACK: 0x%02X, STATUS: 0x%02X.",
3790 acknack,
3791 status
3792 );
3793
3794 LOG_write_ls(&(in_pkts[0].ts),
3795 LOG_MT_ROUTINE,
3796 (in_mirror_to_console) ? (LOG_LI_PKT | LOG_LI_COMP | LOG_LI_STDOUT) : (LOG_LI_PKT | LOG_LI_COMP),
3797 buf);
3798
3799 if (acknack != 0x01)
3800 {
3801 sprintf_s(buf, sizeof(buf), "CH%02d:ACK_NACK error in %s.", in_channel, LOG_PACKET_pkt_type_lut_a[in_lutblentry].tag_terse);
3802
3803 LOG_write_ls(&(in_pkts[0].ts),
3804 LOG_MT_ALERT,
3805 LOG_LI_PKT | LOG_LI_ALERT | LOG_LI_COMP | LOG_LI_STDOUT,
3806 buf);
3807
3808 sprintf_s(buf, sizeof(buf), " ACK_NACK: 0x%02X, STATUS: 0x%02X.", acknack, status);
3809
3810 LOG_write_ls(&(in_pkts[0].ts),
3811 LOG_MT_ALERT,
3812 LOG_LI_PKT | LOG_LI_ALERT | LOG_LI_COMP | LOG_LI_STDOUT,
3813 buf);
3814 }
3815 }
3816
3817
3818 static void LOG_PACKET_log_f_queryprogrammablesettings(int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console)
3819 {
3820 int cspan;
3821 int mdelta;
3822 static struct __timeb64 t_last_msg;
3823 static int first_time = TRUE;
3824 char buf[250];
3825
3826 if (first_time)
3827 {
3828 memcpy(&t_last_msg, &(in_pkts[0].ts), sizeof(t_last_msg));
3829 first_time = FALSE;
3830 }
3831
3832 cspan = MISCFUNC_timb64_diff_bounded_ms(&(in_pkts[0].ts), &(in_pkts[in_npkts-1].ts));
3833 mdelta = MISCFUNC_timb64_diff_bounded_ms(&t_last_msg, &(in_pkts[0].ts));
3834 memcpy(&t_last_msg, &(in_pkts[0].ts), sizeof(t_last_msg));
3835
3836 sprintf_s(buf, sizeof(buf), "CH%02d:%s.", in_channel, LOG_PACKET_pkt_type_lut_a[in_lutblentry].tag_terse);
3837
3838 LOG_write_ls(in_ts,
3839 LOG_MT_ROUTINE,
3840 (in_mirror_to_console) ? (LOG_LI_PKT | LOG_LI_COMP | LOG_LI_STDOUT) : (LOG_LI_PKT | LOG_LI_COMP),
3841 buf);
3842
3843 sprintf_s(buf, sizeof(buf), " cspan=%d, mdelta=%d.", cspan, mdelta);
3844
3845 LOG_write_ls(in_ts,
3846 LOG_MT_ROUTINE,
3847 (in_mirror_to_console) ? (LOG_LI_PKT | LOG_LI_COMP | LOG_LI_STDOUT) : (LOG_LI_PKT | LOG_LI_COMP),
3848 buf);
3849
3850 //The header.
3851 LOG_PACKET_log_bytes(&(in_pkts[0].ts),
3852 in_pkts,
3853 3,
3854 LOG_MT_ROUTINE,
3855 (in_mirror_to_console) ? (LOG_LI_PKT | LOG_LI_COMP | LOG_LI_STDOUT) : (LOG_LI_PKT | LOG_LI_COMP));
3856 //The payload.
3857 LOG_PACKET_log_bytes(&(in_pkts[0].ts),
3858 in_pkts+3,
3859 in_npkts-5,
3860 LOG_MT_ROUTINE,
3861 (in_mirror_to_console) ? (LOG_LI_PKT | LOG_LI_COMP | LOG_LI_STDOUT) : (LOG_LI_PKT | LOG_LI_COMP));
3862 //The trailer.
3863 LOG_PACKET_log_bytes(&(in_pkts[0].ts),
3864 in_pkts+in_npkts-2,
3865 2,
3866 LOG_MT_ROUTINE,
3867 (in_mirror_to_console) ? (LOG_LI_PKT | LOG_LI_COMP | LOG_LI_STDOUT) : (LOG_LI_PKT | LOG_LI_COMP));
3868 }
3869
3870
3871 static void LOG_PACKET_log_f_respprogrammablesettings(int in_channel, const struct __timeb64 *in_ts, QCHAR_TSE *in_pkts, int in_npkts, int in_lutblentry, int in_mirror_to_console)
3872 {
3873 int cspan;
3874 int mdelta;
3875 int panidlsb, panidmsb, panid;
3876 int rfchannel;
3877 int receive_all;
3878 int rfacksretries;
3879 int rfpowerlevel;
3880 int txcvrlongad[8];
3881 int txcvrshortad[2];
3882 static struct __timeb64 t_last_msg;
3883 static int first_time = TRUE;
3884 char buf[250];
3885
3886 if (first_time)
3887 {
3888 memcpy(&t_last_msg, &(in_pkts[0].ts), sizeof(t_last_msg));
3889 first_time = FALSE;
3890 }
3891
3892 cspan = MISCFUNC_timb64_diff_bounded_ms(&(in_pkts[0].ts), &(in_pkts[in_npkts-1].ts));
3893 mdelta = MISCFUNC_timb64_diff_bounded_ms(&t_last_msg, &(in_pkts[0].ts));
3894 memcpy(&t_last_msg, &(in_pkts[0].ts), sizeof(t_last_msg));
3895
3896 sprintf_s(buf, sizeof(buf), "CH%02d:%s.", in_channel, LOG_PACKET_pkt_type_lut_a[in_lutblentry].tag_terse);
3897
3898 LOG_write_ls(in_ts,
3899 LOG_MT_ROUTINE,
3900 (in_mirror_to_console) ? (LOG_LI_PKT | LOG_LI_COMP | LOG_LI_STDOUT) : (LOG_LI_PKT | LOG_LI_COMP),
3901 buf);
3902
3903 sprintf_s(buf, sizeof(buf), " cspan=%d, mdelta=%d.", cspan, mdelta);
3904
3905 LOG_write_ls(in_ts,
3906 LOG_MT_ROUTINE,
3907 (in_mirror_to_console) ? (LOG_LI_PKT | LOG_LI_COMP | LOG_LI_STDOUT) : (LOG_LI_PKT | LOG_LI_COMP),
3908 buf);
3909
3910 //The header.
3911 LOG_PACKET_log_bytes(&(in_pkts[0].ts),
3912 in_pkts,
3913 3,
3914 LOG_MT_ROUTINE,
3915 (in_mirror_to_console) ? (LOG_LI_PKT | LOG_LI_COMP | LOG_LI_STDOUT) : (LOG_LI_PKT | LOG_LI_COMP));
3916 //The payload.
3917 LOG_PACKET_log_bytes(&(in_pkts[0].ts),
3918 in_pkts+3,
3919 in_npkts-5,
3920 LOG_MT_ROUTINE,
3921 (in_mirror_to_console) ? (LOG_LI_PKT | LOG_LI_COMP | LOG_LI_STDOUT) : (LOG_LI_PKT | LOG_LI_COMP));
3922 //The trailer.
3923 LOG_PACKET_log_bytes(&(in_pkts[0].ts),
3924 in_pkts+in_npkts-2,
3925 2,
3926 LOG_MT_ROUTINE,
3927 (in_mirror_to_console) ? (LOG_LI_PKT | LOG_LI_COMP | LOG_LI_STDOUT) : (LOG_LI_PKT | LOG_LI_COMP));
3928
3929 panidlsb = ((int)in_pkts[3].c) & 0xFF;
3930 panidmsb = ((int)in_pkts[4].c) & 0xFF;
3931 panid = 256 * panidmsb + panidlsb;
3932
3933 txcvrlongad[7] = ((int)in_pkts[ 5].c) & 0xFF;
3934 txcvrlongad[6] = ((int)in_pkts[ 6].c) & 0xFF;
3935 txcvrlongad[5] = ((int)in_pkts[ 7].c) & 0xFF;
3936 txcvrlongad[4] = ((int)in_pkts[ 8].c) & 0xFF;
3937 txcvrlongad[3] = ((int)in_pkts[ 9].c) & 0xFF;
3938 txcvrlongad[2] = ((int)in_pkts[10].c) & 0xFF;
3939 txcvrlongad[1] = ((int)in_pkts[11].c) & 0xFF;
3940 txcvrlongad[0] = ((int)in_pkts[12].c) & 0xFF;
3941
3942 sprintf_s(buf, sizeof(buf), " PANID: 0x%04X, TXCVR_LONG_AD: 0x%02X%02X%02X%02X%02X%02X%02X%02X.",
3943 panid,
3944 txcvrlongad[0],
3945 txcvrlongad[1],
3946 txcvrlongad[2],
3947 txcvrlongad[3],
3948 txcvrlongad[4],
3949 txcvrlongad[5],
3950 txcvrlongad[6],
3951 txcvrlongad[7]
3952 );
3953
3954 LOG_write_ls(in_ts,
3955 LOG_MT_ROUTINE,
3956 (in_mirror_to_console) ? (LOG_LI_PKT | LOG_LI_COMP | LOG_LI_STDOUT) : (LOG_LI_PKT | LOG_LI_COMP),
3957 buf);
3958
3959 txcvrshortad[1] = ((int)in_pkts[13].c) & 0xFF;
3960 txcvrshortad[0] = ((int)in_pkts[14].c) & 0xFF;
3961
3962 rfchannel = ((int)in_pkts[15].c) & 0xFF;
3963
3964 sprintf_s(buf, sizeof(buf), " TXCVR_SHORT_AD: 0x%02X%02X, RF_CHANNEL: 0x%02X.",
3965 txcvrshortad[0],
3966 txcvrshortad[1],
3967 rfchannel
3968 );
3969
3970 LOG_write_ls(in_ts,
3971 LOG_MT_ROUTINE,
3972 (in_mirror_to_console) ? (LOG_LI_PKT | LOG_LI_COMP | LOG_LI_STDOUT) : (LOG_LI_PKT | LOG_LI_COMP),
3973 buf);
3974
3975 receive_all = ((int)in_pkts[16].c) & 0xFF;
3976 rfacksretries = ((int)in_pkts[17].c) & 0xFF;
3977
3978 sprintf_s(buf, sizeof(buf), " RECEIVE_ALL: 0x%02X, RF_ACKS_RETRIES: 0x%02X.",
3979 receive_all,
3980 rfacksretries
3981 );
3982
3983 LOG_write_ls(in_ts,
3984 LOG_MT_ROUTINE,
3985 (in_mirror_to_console) ? (LOG_LI_PKT | LOG_LI_COMP | LOG_LI_STDOUT) : (LOG_LI_PKT | LOG_LI_COMP),
3986 buf);
3987
3988 rfpowerlevel = ((int)in_pkts[18].c) & 0xFF;
3989
3990 sprintf_s(buf, sizeof(buf), " RF_POWER_LEVEL: 0x%02X.",
3991 rfpowerlevel
3992 );
3993
3994 LOG_write_ls(in_ts,
3995 LOG_MT_ROUTINE,
3996 (in_mirror_to_console) ? (LOG_LI_PKT | LOG_LI_COMP | LOG_LI_STDOUT) : (LOG_LI_PKT | LOG_LI_COMP),
3997 buf);
3998 }
3999
4000
4001 //Returns a pointer to a string describing an event. The string is made for announcing events
4002 //that can't be used for a particular intended purpose.
4003 //
4004 //This function is not thread-safe.
4005 //
4006 const char *LOG_PACKET_event_text_desc_a(const QCHAR_TSE *in_ev)
4007 {
4008 static char buf[250];
4009
4010 switch (in_ev->ev)
4011 {
4012 case QCHAR_EV_CHAR:
4013 sprintf_s(buf, sizeof(buf), "Character: 0x%02X", ((int)in_ev->c) & 0xFF);
4014 break;
4015 case QCHAR_EV_BREAK:
4016 sprintf_s(buf, sizeof(buf), "Event: BREAK");
4017 break;
4018 case QCHAR_EV_FRAME:
4019 sprintf_s(buf, sizeof(buf), "Event: FRAMING_ERROR");
4020 break;
4021 case QCHAR_EV_OVERRUN:
4022 sprintf_s(buf, sizeof(buf), "Event: LOW_LEVEL_OVERRUN");
4023 break;
4024 case QCHAR_EV_RXOVER:
4025 sprintf_s(buf, sizeof(buf), "Event: RECEIVE_Q_OVERFLOW");
4026 break;
4027 case QCHAR_EV_RXPARITY:
4028 sprintf_s(buf, sizeof(buf), "Event: PARITY_ERROR");
4029 break;
4030 default:
4031 sprintf_s(buf, sizeof(buf), "Event: INTERNAL_SOFTWARE_ERROR");
4032 break;
4033 }
4034
4035 return(buf);
4036 }
4037
4038
4039 //Discards events that can't be the start of a packet.
4040 //
4041 static void LOG_PACKET_non_start_discard(int in_channel, QCHAR_CCEQ *in_q, const struct __timeb64 *in_ts, int in_mirror_to_console)
4042 {
4043 int done = FALSE;
4044 QCHAR_TSE item;
4045
4046 while (!done)
4047 {
4048 //Can't proceed if no elements in queue.
4049 if (! QCHAR_cceq_nelem(in_q))
4050 {
4051 done = TRUE;
4052 }
4053
4054 //Peek at the first element.
4055 if (!done)
4056 QCHAR_cceq_peek(in_q, &item);
4057
4058 //If the first element is invalid, discard it, else we're done.
4059 if (!done)
4060 {
4061 if ((item.ev != QCHAR_EV_CHAR) || (item.c != 0x01))
4062 {
4063 char buf[250];
4064
4065 sprintf_s(buf, sizeof(buf), "CH%02d:Non-packet start event discarded: %s.", in_channel, LOG_PACKET_event_text_desc_a(&item));
4066
4067 LOG_write_ls(&(item.ts),
4068 LOG_MT_ALERT,
4069 (in_mirror_to_console) ? (LOG_LI_PKT | LOG_LI_COMP | LOG_LI_ALERT | LOG_LI_STDOUT) : (LOG_LI_PKT | LOG_LI_COMP | LOG_LI_ALERT | LOG_LI_STDOUT),
4070 buf);
4071 QCHAR_cceq_get(in_q, &item);
4072 }
4073 else
4074 {
4075 //First element is apparently a start element. We're good.
4076 done = TRUE;
4077 }
4078 }
4079 }
4080 }
4081
4082
4083 //Resynchronizes by discarding an apparent start element that can't be used and then looking for another
4084 //start element.
4085 //
4086 static void LOG_PACKET_non_start_resync_discard(int in_channel, QCHAR_CCEQ *in_q, const struct __timeb64 *in_ts, int in_mirror_to_console)
4087 {
4088 QCHAR_TSE item;
4089
4090 //Can't proceed if no elements in queue.
4091 if (! QCHAR_cceq_nelem(in_q))
4092 {
4093 return;
4094 }
4095
4096 //Peek at the first element.
4097 QCHAR_cceq_peek(in_q, &item);
4098
4099 //If the first element is a start element, discard it.
4100 if ((item.ev == QCHAR_EV_CHAR) && (item.c == 0x01))
4101 {
4102 char buf[250];
4103
4104 sprintf_s(buf, sizeof(buf), "CH%02d:SOH start event discarded to resynchronize.", in_channel);
4105
4106 LOG_write_ls(&(item.ts),
4107 LOG_MT_ALERT,
4108 (in_mirror_to_console) ? (LOG_LI_PKT | LOG_LI_COMP | LOG_LI_ALERT | LOG_LI_STDOUT) : (LOG_LI_PKT | LOG_LI_COMP | LOG_LI_ALERT | LOG_LI_STDOUT),
4109 buf);
4110 QCHAR_cceq_get(in_q, &item);
4111 }
4112
4113 //Discard characters beyond the SOH that can't be the start.
4114 LOG_PACKET_non_start_discard(in_channel, in_q, in_ts, in_mirror_to_console);
4115 }
4116
4117
4118 //Figures out whether a range is all characters and what the checksum is. Note that end index is 1+.
4119 //
4120 static void LOG_PACKET_q_range_all_chars_cksum8(QCHAR_CCEQ *in_q, int in_sidx, int in_eidx, int *out_all_chars, int *out_cksum8)
4121 {
4122 int i;
4123 QCHAR_TSE item;
4124 int cksum8 = 0;
4125 int all_chars = TRUE;
4126
4127 for (i=in_sidx; i<in_eidx; i++)
4128 {
4129 QCHAR_cceq_peek_n(in_q, i, &item);
4130
4131 if (item.ev == QCHAR_EV_CHAR)
4132 {
4133 cksum8 += (((int)item.c) & 0xFF);
4134 cksum8 &= 0xFF;
4135 }
4136 else
4137 {
4138 all_chars = FALSE;
4139 }
4140 }
4141
4142 *out_all_chars = all_chars;
4143 *out_cksum8 = cksum8;
4144 }
4145
4146
4147 static void LOG_PACKET_emit(int in_channel, QCHAR_CCEQ *in_q, const struct __timeb64 *in_ts, int in_mirror_to_console)
4148 {
4149 int lut_index;
4150 int declared_length;
4151 int declared_checksum;
4152 int nqueue;
4153 int must_resync = FALSE;
4154 int done = FALSE;
4155 int packet_found;
4156 QCHAR_TSE item_soh;
4157 QCHAR_TSE item_length;
4158 QCHAR_TSE item_type;
4159 QCHAR_TSE item_checksum;
4160 QCHAR_TSE item_endbyte;
4161 QCHAR_TSE event_buf[256];
4162 char buf[250];
4163
4164 while (! done)
4165 {
4166 packet_found = FALSE;
4167 must_resync = FALSE;
4168
4169 //All packets have to start with a character 0x01. Trash anything that is not a character and/or not
4170 //a 0x01.
4171 LOG_PACKET_non_start_discard(in_channel, in_q, in_ts, in_mirror_to_console);
4172
4173 //If there is nothing left in the queue, we can't go further.
4174 nqueue = QCHAR_cceq_nelem(in_q);
4175 if (!nqueue)
4176 return;
4177
4178 if (nqueue >= 3)
4179 //We can begin looking for anomalies as soon as 3 characters.
4180 {
4181 //Grab the presumed SOH.
4182 QCHAR_cceq_peek_n(in_q, 0, &item_soh);
4183
4184 //Grab the presumed length.
4185 QCHAR_cceq_peek_n(in_q, 1, &item_length);
4186
4187 //Grab the presumed type.
4188 QCHAR_cceq_peek_n(in_q, 2, &item_type);
4189
4190 //If the SOH is not as expected, must resynchronize.
4191 if ((item_soh.ev != QCHAR_EV_CHAR) || (item_soh.c != 0x01))
4192 {
4193 sprintf_s(buf, sizeof(buf), "CH%02d:Expected: SOH. Actual: %s.", in_channel, LOG_PACKET_event_text_desc_a(&item_soh));
4194
4195 LOG_write_ls(in_ts,
4196 LOG_MT_ALERT,
4197 (in_mirror_to_console) ? (LOG_LI_PKT | LOG_LI_COMP | LOG_LI_ALERT | LOG_LI_STDOUT) : (LOG_LI_PKT | LOG_LI_COMP | LOG_LI_ALERT | LOG_LI_STDOUT),
4198 buf);
4199
4200 must_resync = TRUE;
4201 }
4202
4203 //If the length is not a received character, must resynchronize.
4204 if (item_length.ev != QCHAR_EV_CHAR)
4205 {
4206 sprintf_s(buf, sizeof(buf), "CH%02d:Expected: Length. Actual: %s.", in_channel, LOG_PACKET_event_text_desc_a(&item_length));
4207
4208 LOG_write_ls(in_ts,
4209 LOG_MT_ALERT,
4210 (in_mirror_to_console) ? (LOG_LI_PKT | LOG_LI_COMP | LOG_LI_ALERT | LOG_LI_STDOUT) : (LOG_LI_PKT | LOG_LI_COMP | LOG_LI_ALERT | LOG_LI_STDOUT),
4211 buf);
4212
4213 must_resync = TRUE;
4214 }
4215
4216 //If the type is not a received character, must resynchronize.
4217 if (item_type.ev != QCHAR_EV_CHAR)
4218 {
4219 sprintf_s(buf, sizeof(buf), "CH%02d:Expected: Type. Actual: %s.", in_channel, LOG_PACKET_event_text_desc_a(&item_type));
4220
4221 LOG_write_ls(in_ts,
4222 LOG_MT_ALERT,
4223 (in_mirror_to_console) ? (LOG_LI_PKT | LOG_LI_COMP | LOG_LI_ALERT | LOG_LI_STDOUT) : (LOG_LI_PKT | LOG_LI_COMP | LOG_LI_ALERT | LOG_LI_STDOUT),
4224 buf);
4225
4226 must_resync = TRUE;
4227 }
4228
4229 //Try to look up the length and type and get a table index. This may result in an error.
4230 lut_index = LOG_PACKET_type_length_lookup_a(((int)item_type.c) & 0xFF, ((int)item_length.c) & 0xFF);
4231
4232 if (lut_index < 0)
4233 {
4234 if (lut_index == -2)
4235 {
4236 //Type is invalid. Must resync.
4237 sprintf_s(buf, sizeof(buf), "CH%02d:Type byte has invalid value (0x%02X).", in_channel, ((int)item_type.c) & 0xFF);
4238
4239 LOG_write_ls(in_ts,
4240 LOG_MT_ALERT,
4241 (in_mirror_to_console) ? (LOG_LI_PKT | LOG_LI_COMP | LOG_LI_ALERT | LOG_LI_STDOUT) : (LOG_LI_PKT | LOG_LI_COMP | LOG_LI_ALERT | LOG_LI_STDOUT),
4242 buf);
4243
4244 must_resync = TRUE;
4245 }
4246 else if (lut_index == -1)
4247 {
4248 //Length is inconsistent with type.
4249 sprintf_s(buf,
4250 sizeof(buf),
4251 "CH%02d:Type is acceptable(0x%02X) but length is inconsistent (0x%02X).",
4252 in_channel,
4253 ((int)item_type.c) & 0xFF,
4254 ((int)item_length.c) & 0xFF);
4255
4256 LOG_write_ls(in_ts,
4257 LOG_MT_ALERT,
4258 (in_mirror_to_console) ? (LOG_LI_PKT | LOG_LI_COMP | LOG_LI_ALERT | LOG_LI_STDOUT) : (LOG_LI_PKT | LOG_LI_COMP | LOG_LI_ALERT | LOG_LI_STDOUT),
4259 buf);
4260
4261 must_resync = TRUE;
4262 }
4263 else
4264 {
4265 //Negative value but don't know why. This is an impossible internal software error.
4266 CCMFATAL_fatal("Unexpected internal software error.", __FILE__, __LINE__);
4267 }
4268 }
4269 else
4270 {
4271 //Index >= 0, so it is a valid table index.
4272 //
4273 //Look to see if we have at least as many characters as the declared length.
4274 declared_length = ((int)item_length.c) & 0xFF;
4275
4276 if (nqueue >= declared_length)
4277 {
4278 //We have enough characters. Peek at the end byte. If it is wrong, can't continue.
4279 QCHAR_cceq_peek_n(in_q, declared_length-1, &item_endbyte);
4280
4281 if ((item_endbyte.ev != QCHAR_EV_CHAR) || (item_endbyte.c != 0x04))
4282 {
4283 sprintf_s(buf, sizeof(buf), "CH%02d:Expected: 0x04 endbyte. Actual: %s.", in_channel, LOG_PACKET_event_text_desc_a(&item_endbyte));
4284
4285 LOG_write_ls(in_ts,
4286 LOG_MT_ALERT,
4287 (in_mirror_to_console) ? (LOG_LI_PKT | LOG_LI_COMP | LOG_LI_ALERT | LOG_LI_STDOUT) : (LOG_LI_PKT | LOG_LI_COMP | LOG_LI_ALERT | LOG_LI_STDOUT),
4288 buf);
4289
4290 must_resync = TRUE;
4291 }
4292 else
4293 {
4294 //Gotta look at checksum.
4295 QCHAR_cceq_peek_n(in_q, declared_length-2, &item_checksum);
4296
4297 if (item_checksum.ev != QCHAR_EV_CHAR)
4298 {
4299 sprintf_s(buf, sizeof(buf), "CH%02d:Expected: checksum is character. Actual: %s.", in_channel, LOG_PACKET_event_text_desc_a(&item_checksum));
4300
4301 LOG_write_ls(in_ts,
4302 LOG_MT_ALERT,
4303 (in_mirror_to_console) ? (LOG_LI_PKT | LOG_LI_COMP | LOG_LI_ALERT | LOG_LI_STDOUT) : (LOG_LI_PKT | LOG_LI_COMP | LOG_LI_ALERT | LOG_LI_STDOUT),
4304 buf);
4305
4306 must_resync = TRUE;
4307 }
4308 else
4309 {
4310 int calculated_checksum;
4311 int all_chars;
4312
4313 declared_checksum = ((int)item_checksum.c) & 0xFF;
4314
4315 LOG_PACKET_q_range_all_chars_cksum8(in_q, 0, declared_length-2, &all_chars, &calculated_checksum);
4316
4317 if (! all_chars)
4318 {
4319 //Not everything was a character. Must resync.
4320 sprintf_s(buf, sizeof(buf), "CH%02d:Some packet items not characters. Resynchronizing.", in_channel);
4321
4322 LOG_write_ls(in_ts,
4323 LOG_MT_ALERT,
4324 (in_mirror_to_console) ? (LOG_LI_PKT | LOG_LI_COMP | LOG_LI_ALERT | LOG_LI_STDOUT) : (LOG_LI_PKT | LOG_LI_COMP | LOG_LI_ALERT | LOG_LI_STDOUT),
4325 buf);
4326
4327 must_resync = TRUE;
4328 }
4329 else
4330 {
4331 if (calculated_checksum != declared_checksum)
4332 {
4333 //Checksum error. Must resync.
4334 sprintf_s(buf,
4335 sizeof(buf),
4336 "CH%02d:Packet checksum mismatch. Declared: 0x%02X. Actual: 0x%02X. Resynchronizing.",
4337 in_channel,
4338 declared_checksum,
4339 calculated_checksum);
4340
4341 LOG_write_ls(in_ts,
4342 LOG_MT_ALERT,
4343 (in_mirror_to_console) ? (LOG_LI_PKT | LOG_LI_COMP | LOG_LI_ALERT | LOG_LI_STDOUT) : (LOG_LI_PKT | LOG_LI_COMP | LOG_LI_ALERT | LOG_LI_STDOUT),
4344 buf);
4345
4346 must_resync = TRUE;
4347 }
4348 else
4349 {
4350 //Everything looks OK. Issue a warning if the packet type is inconsistent with what is allowed. By convention, channel 0 is the
4351 //line from the host micro to the RF module, and channel 1 is the one back.
4352 //
4353 if ((in_channel == 0) && (!LOG_PACKET_pkt_type_lut_a[lut_index].valid_from_host))
4354 {
4355 //Packet not allowed from host.
4356 sprintf_s(buf,
4357 sizeof(buf),
4358 "CH%02d:Packet type not allowed from host.",
4359 in_channel);
4360
4361 LOG_write_ls(in_ts,
4362 LOG_MT_ALERT,
4363 (in_mirror_to_console) ? (LOG_LI_PKT | LOG_LI_COMP | LOG_LI_ALERT | LOG_LI_STDOUT) : (LOG_LI_PKT | LOG_LI_COMP | LOG_LI_ALERT | LOG_LI_STDOUT),
4364 buf);
4365 }
4366 else if ((in_channel == 1) && (!LOG_PACKET_pkt_type_lut_a[lut_index].valid_from_rf_mod))
4367 {
4368 //Packet not allowed from RF module.
4369 sprintf_s(buf,
4370 sizeof(buf),
4371 "CH%02d:Packet type not allowed from RF module.",
4372 in_channel);
4373
4374 LOG_write_ls(in_ts,
4375 LOG_MT_ALERT,
4376 (in_mirror_to_console) ? (LOG_LI_PKT | LOG_LI_COMP | LOG_LI_ALERT | LOG_LI_STDOUT) : (LOG_LI_PKT | LOG_LI_COMP | LOG_LI_ALERT | LOG_LI_STDOUT),
4377 buf);
4378 }
4379
4380 //We are in the green to call the function to handle the packet. At the same time we get the
4381 //characters ready for this function, we pull them from the queue.
4382 //
4383 {
4384 int i;
4385
4386 //Be sure we're consistent. Everybody gets a clean copy.
4387 FillMemory(event_buf, sizeof(event_buf), 0);
4388
4389 //Do the copy and queue removal.
4390 for (i=0; i<declared_length; i++)
4391 {
4392 QCHAR_cceq_get(in_q, &(event_buf[i]));
4393 }
4394
4395 //Call the function to handle it.
4396 (*LOG_PACKET_pkt_type_lut_a[lut_index].logptr)(in_channel,
4397 in_ts,
4398 event_buf,
4399 declared_length,
4400 lut_index,
4401 in_mirror_to_console);
4402
4403 //We did find a packet.
4404 packet_found = TRUE;
4405 }
4406 }
4407 }
4408
4409 }
4410 }
4411 }
4412 }
4413 } //End if nqueue >= 3.
4414
4415 //If the terminal event in the queue has aged out, must resync.
4416 nqueue = QCHAR_cceq_nelem(in_q);
4417 if (!nqueue)
4418 return;
4419
4420 QCHAR_cceq_peek_n(in_q, nqueue-1, &item_endbyte);
4421 if (MISCFUNC_timb64_diff_bounded_ms(&(item_endbyte.ts), in_ts) > LOG_PACKET_CHAR_STRAGGLER_TIME)
4422 {
4423 must_resync = TRUE;
4424 }
4425
4426 //Resync if requested.
4427 if (must_resync)
4428 {
4429 LOG_PACKET_non_start_resync_discard(in_channel, in_q, in_ts, in_mirror_to_console);
4430 }
4431
4432 //We are not done if we found a packet or had to resync.
4433 if (!packet_found && !must_resync)
4434 done = TRUE;
4435 } //End while(! done)
4436 }
4437
4438
4439 void LOG_PACKET_advance(QCHAR_CCEQ *in_q0, QCHAR_CCEQ *in_q1, const struct __timeb64 *in_ts, int in_mirror_to_console)
4440 {
4441 //All we need to do is gather as many characters as we can and group them by timestamp. We need to do this
4442 //once for each channel.
4443 LOG_PACKET_emit(0, in_q0, in_ts, in_mirror_to_console);
4444 LOG_PACKET_emit(1, in_q1, in_ts, in_mirror_to_console);
4445 }
4446
4447
4448 const char *LOG_PACKET_cvcinfo(void)
4449 {
4450 return("$Header: /home/dashley/cvsrep/e3ft_gpl01/e3ft_gpl01/winprojs/scirfmmon/source/log_packet.c,v 1.24 2009/01/17 22:12:37 dashley Exp $");
4451 }
4452
4453
4454 const char *LOG_PACKET_hvcinfo(void)
4455 {
4456 return(LOG_PACKET_H_VERSION);
4457 }
4458
4459
4460 //**************************************************************************
4461 // $Log: log_packet.c,v $
4462 // Revision 1.24 2009/01/17 22:12:37 dashley
4463 // Issue where some errors not logged to console fixed.
4464 //
4465 // Revision 1.23 2009/01/16 17:56:16 dashley
4466 // 0xAB data presentation completed.
4467 //
4468 // Revision 1.22 2009/01/16 17:46:45 dashley
4469 // 0x03 data presentation completed.
4470 //
4471 // Revision 1.21 2009/01/16 17:33:39 dashley
4472 // 0x28 data presentation completed.
4473 //
4474 // Revision 1.20 2009/01/16 17:06:42 dashley
4475 // 0x94 data presentation completed.
4476 //
4477 // Revision 1.19 2009/01/16 05:19:25 dashley
4478 // 0x14 data presentation completed.
4479 //
4480 // Revision 1.18 2009/01/16 04:49:50 dashley
4481 // 0x95 data presentation completed.
4482 //
4483 // Revision 1.17 2009/01/15 21:43:11 dashley
4484 // Edits.
4485 //
4486 // Revision 1.16 2009/01/15 20:11:58 dashley
4487 // Edits.
4488 //
4489 // Revision 1.15 2009/01/15 19:14:38 dashley
4490 // Edits.
4491 //**************************************************************************
4492 // End of $RCSfile: log_packet.c,v $.

dashley@gmail.com
ViewVC Help
Powered by ViewVC 1.1.25