File: class_pcomm.html

package info (click to toggle)
icomlib 1.0.1-4
  • links: PTS
  • area: main
  • in suites: woody
  • size: 1,652 kB
  • ctags: 1,363
  • sloc: cpp: 4,849; makefile: 536; sh: 181; ansic: 145
file content (798 lines) | stat: -rw-r--r-- 39,242 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><meta name="robots" content="noindex">
<title>PComm Class Reference</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body bgcolor="#ffffff">
<!-- Generated by Doxygen 1.0.0 on Mon Jan 17 00:45:28 2000 -->
<center>
<a class="qindex"href="index.html">Main Page</a> &nbsp; <a class="qindex"href="annotated.html">Compound List</a> &nbsp; <a class="qindex"href="files.html">File List</a> &nbsp; <a class="qindex"href="headers.html">Header Files</a> &nbsp; <a class="qindex"href="sources.html">Sources</a> &nbsp; <a class="qindex"href="functions.html">Compound Members</a> &nbsp; <a class="qindex"href="globals.html">File Members</a> &nbsp; </center>
<hr><h1>PComm  Class Reference</h1>The Primitive Communications Object. 
<a href="#_details">More...</a>
<p>
<code>#include &lt;<a class="el" href="class_pcomm-include.html">pcomm.h</a>&gt;</code>
<p>
<a href="class_pcomm-members.html">List of all members.</a><table border=0 cellpadding=0 cellspacing=0>
<tr><td colspan=4><br><h2>Public Members</h2></td></tr>
<tr><td><img src="null.gif"></td><td><img src="null.gif"></td><td nowrap align=right valign=top>&nbsp;</td><td valign=top><a class="el" href="class_pcomm.html#a0">PComm</a> (char *pcrDev, tcflag_t baudRate=B9600, const char *name=0)</td></tr>
<tr><td><img src=null.gif></td><td><img src=null.gif></td><td></td><td><font size=-1><em>The PComm Constructor.</em> <a href="#a0">More...</a><em></em></font><br><br></td></tr>

<p>
<tr><td><img src="null.gif"></td><td><img src="null.gif"></td><td nowrap align=right valign=top>&nbsp;</td><td valign=top><a class="el" href="class_pcomm.html#a1">~PComm</a> ()</td></tr>
<tr><td><img src=null.gif></td><td><img src=null.gif></td><td></td><td><font size=-1><em>The PComm Destructor.</em> <a href="#a1">More...</a><em></em></font><br><br></td></tr>

<p>
<tr><td><img src="null.gif"></td><td><img src="null.gif"></td><td nowrap align=right valign=top>bool&nbsp;</td><td valign=top><a class="el" href="class_pcomm.html#a2">PCOpen</a> (const char *pcrDev=PCRDEV, tcflag_t baudRate=B9600)</td></tr>
<tr><td><img src=null.gif></td><td><img src=null.gif></td><td></td><td><font size=-1><em>Opens another file descriptor to the serial device.</em> <a href="#a2">More...</a><em></em></font><br><br></td></tr>

<p>
<tr><td><img src="null.gif"></td><td><img src="null.gif"></td><td nowrap align=right valign=top>void&nbsp;</td><td valign=top><a class="el" href="class_pcomm.html#a3">PCClose</a> ()</td></tr>
<tr><td><img src=null.gif></td><td><img src=null.gif></td><td></td><td><font size=-1><em>Closes the currently active file descriptor.</em> <a href="#a3">More...</a><em></em></font><br><br></td></tr>

<p>
<tr><td><img src="null.gif"></td><td><img src="null.gif"></td><td nowrap align=right valign=top><a class="el" href="pcomm.h.html#a3">size_pc</a>&nbsp;</td><td valign=top><a class="el" href="class_pcomm.html#a4">PCTell</a> (char *)</td></tr>
<tr><td><img src=null.gif></td><td><img src=null.gif></td><td></td><td><font size=-1><em>Issue a command string to the radio.</em> <a href="#a4">More...</a><em></em></font><br><br></td></tr>

<p>
<tr><td><img src="null.gif"></td><td><img src="null.gif"></td><td nowrap align=right valign=top><a class="el" href="pcomm.h.html#a3">size_pc</a>&nbsp;</td><td valign=top><a class="el" href="class_pcomm.html#a5">PCAsk</a> (char *)</td></tr>
<tr><td><img src=null.gif></td><td><img src=null.gif></td><td></td><td><font size=-1><em>Issue a status request from the radio.</em> <a href="#a5">More...</a><em></em></font><br><br></td></tr>

<p>
<tr><td><img src="null.gif"></td><td><img src="null.gif"></td><td nowrap align=right valign=top><a class="el" href="pcomm.h.html#a3">size_pc</a>&nbsp;</td><td valign=top><a class="el" href="class_pcomm.html#a6">PCHear</a> (char *)</td></tr>
<tr><td><img src=null.gif></td><td><img src=null.gif></td><td></td><td><font size=-1><em>Receive a repsonse from the radio.</em> <a href="#a6">More...</a><em></em></font><br><br></td></tr>

<p>
<tr><td><img src="null.gif"></td><td><img src="null.gif"></td><td nowrap align=right valign=top><a class="el" href="pcomm.h.html#a3">size_pc</a>&nbsp;</td><td valign=top><a class="el" href="class_pcomm.html#a7">PCRawWrite</a> (char *)</td></tr>
<tr><td><img src=null.gif></td><td><img src=null.gif></td><td></td><td><font size=-1><em>writes directly to the current socket.</em> <a href="#a7">More...</a><em></em></font><br><br></td></tr>

<p>
<tr><td><img src="null.gif"></td><td><img src="null.gif"></td><td nowrap align=right valign=top><a class="el" href="pcomm.h.html#a3">size_pc</a>&nbsp;</td><td valign=top><a class="el" href="class_pcomm.html#a8">PCRawRead</a> (char *)</td></tr>
<tr><td><img src=null.gif></td><td><img src=null.gif></td><td></td><td><font size=-1><em>reads directly from the current socket.</em> <a href="#a8">More...</a><em></em></font><br><br></td></tr>

<p>
<tr><td colspan=4><br><h2>Private Members</h2></td></tr>
<tr><td><img src="null.gif"></td><td><img src="null.gif"></td><td nowrap align=right valign=top><a class="el" href="pcomm.h.html#a3">size_pc</a>&nbsp;</td><td valign=top><a class="el" href="class_pcomm.html#c0">Write</a> (char *)</td></tr>
<tr><td><img src=null.gif></td><td><img src=null.gif></td><td></td><td><font size=-1><em>Internal function to write to the socket.</em> <a href="#c0">More...</a><em></em></font><br><br></td></tr>

<p>
<tr><td><img src="null.gif"></td><td><img src="null.gif"></td><td nowrap align=right valign=top><a class="el" href="pcomm.h.html#a3">size_pc</a>&nbsp;</td><td valign=top><a class="el" href="class_pcomm.html#c1">Read</a> (char *)</td></tr>
<tr><td><img src=null.gif></td><td><img src=null.gif></td><td></td><td><font size=-1><em>Internal function to read from the socket.</em> <a href="#c1">More...</a><em></em></font><br><br></td></tr>

<p>
<tr><td><img src="null.gif"></td><td><img src="null.gif"></td><td nowrap align=right valign=top>void&nbsp;</td><td valign=top><a class="el" href="class_pcomm.html#c2">resetCall</a> ()</td></tr>
<tr><td><img src=null.gif></td><td><img src=null.gif></td><td></td><td><font size=-1><em>resets the radio and port.</em> <a href="#c2">More...</a><em></em></font><br><br></td></tr>

<p>
<tr><td><img src="null.gif"></td><td><img src="null.gif"></td><td nowrap align=right valign=top>void&nbsp;</td><td valign=top><a class="el" href="class_pcomm.html#c3">countCall</a> ()</td></tr>
<tr><td><img src=null.gif></td><td><img src=null.gif></td><td></td><td><font size=-1><em>function to keep track on the number of calls.</em> <a href="#c3">More...</a><em></em></font><br><br></td></tr>

<p>
<tr><td><img src="null.gif"></td><td><img src="null.gif"></td><td nowrap align=right valign=top>int&nbsp;</td><td valign=top><a class="el" href="class_pcomm.html#c4">callCount</a></td></tr>
<tr><td><img src=null.gif></td><td><img src=null.gif></td><td></td><td><font size=-1><em>Counter for number of times the radio has been written to.</em></font><br><br></td></tr>

<p>
<tr><td><img src="null.gif"></td><td><img src="null.gif"></td><td nowrap align=right valign=top>char&nbsp;</td><td valign=top><a class="el" href="class_pcomm.html#c5">callBuf</a> [256]</td></tr>
<tr><td><img src=null.gif></td><td><img src=null.gif></td><td></td><td><font size=-1><em>Internal buffer for radio reset.</em></font><br><br></td></tr>

<p>
<tr><td><img src="null.gif"></td><td><img src="null.gif"></td><td nowrap align=right valign=top>struct timeval*&nbsp;</td><td valign=top><a class="el" href="class_pcomm.html#c6">timeOut</a></td></tr>
<tr><td><img src=null.gif></td><td><img src=null.gif></td><td></td><td><font size=-1><em>Used in the select for timeout(s).</em></font><br><br></td></tr>

<p>
<tr><td><img src="null.gif"></td><td><img src="null.gif"></td><td nowrap align=right valign=top>fd_set*&nbsp;</td><td valign=top><a class="el" href="class_pcomm.html#c7">FDSet</a></td></tr>
<tr><td><img src=null.gif></td><td><img src=null.gif></td><td></td><td><font size=-1><em>Socket set used in the select.</em></font><br><br></td></tr>

<p>
<tr><td><img src="null.gif"></td><td><img src="null.gif"></td><td nowrap align=right valign=top>int&nbsp;</td><td valign=top><a class="el" href="class_pcomm.html#c8">retVal</a></td></tr>
<tr><td><img src=null.gif></td><td><img src=null.gif></td><td></td><td><font size=-1><em>Select()'s return value.</em></font><br><br></td></tr>

<p>
<tr><td><img src="null.gif"></td><td><img src="null.gif"></td><td nowrap align=right valign=top>struct termios*&nbsp;</td><td valign=top><a class="el" href="class_pcomm.html#c9">oldtio</a></td></tr>
<tr><td><img src=null.gif></td><td><img src=null.gif></td><td></td><td><font size=-1><em>Stores the port's original settings.</em></font><br><br></td></tr>

<p>
<tr><td><img src="null.gif"></td><td><img src="null.gif"></td><td nowrap align=right valign=top>struct termios*&nbsp;</td><td valign=top><a class="el" href="class_pcomm.html#c10">newtio</a></td></tr>
<tr><td><img src=null.gif></td><td><img src=null.gif></td><td></td><td><font size=-1><em>Port settings to be applied for current session.</em></font><br><br></td></tr>

<p>
<tr><td><img src="null.gif"></td><td><img src="null.gif"></td><td nowrap align=right valign=top>int&nbsp;</td><td valign=top><a class="el" href="class_pcomm.html#c11">fd</a></td></tr>
<tr><td><img src=null.gif></td><td><img src=null.gif></td><td></td><td><font size=-1><em>Socket descriptor used for current session.</em></font><br><br></td></tr>

<p>
<tr><td><img src="null.gif"></td><td><img src="null.gif"></td><td nowrap align=right valign=top>char&nbsp;</td><td valign=top><a class="el" href="class_pcomm.html#c12">pcrDevice</a> [256]</td></tr>
<tr><td><img src=null.gif></td><td><img src=null.gif></td><td></td><td><font size=-1><em>Current serial/comm device.</em></font><br><br></td></tr>

<p>
<tr><td><img src="null.gif"></td><td><img src="null.gif"></td><td nowrap align=right valign=top>tcflag_t&nbsp;</td><td valign=top><a class="el" href="class_pcomm.html#c13">pcrSpeed</a></td></tr>
<tr><td><img src=null.gif></td><td><img src=null.gif></td><td></td><td><font size=-1><em>Current baud rate.</em></font><br><br></td></tr>

<p>
<tr><td><img src="null.gif"></td><td><img src="null.gif"></td><td nowrap align=right valign=top>bool&nbsp;</td><td valign=top><a class="el" href="class_pcomm.html#c14">errRead</a></td></tr>
<tr><td><img src=null.gif></td><td><img src=null.gif></td><td></td><td><font size=-1><em>Was there an error reading?</em></font><br><br></td></tr>

<p>
<tr><td><img src="null.gif"></td><td><img src="null.gif"></td><td nowrap align=right valign=top>bool&nbsp;</td><td valign=top><a class="el" href="class_pcomm.html#c15">errWrite</a></td></tr>
<tr><td><img src=null.gif></td><td><img src=null.gif></td><td></td><td><font size=-1><em>Was there an error writing?</em></font><br><br></td></tr>

<p>
<tr><td><img src="null.gif"></td><td><img src="null.gif"></td><td nowrap align=right valign=top>char&nbsp;</td><td valign=top><a class="el" href="class_pcomm.html#c16">askBuf</a> [256]</td></tr>
<tr><td><img src=null.gif></td><td><img src=null.gif></td><td></td><td><font size=-1><em>Buffer for sending data in PCAsk.</em></font><br><br></td></tr>

<p>
<tr><td><img src="null.gif"></td><td><img src="null.gif"></td><td nowrap align=right valign=top>char&nbsp;</td><td valign=top><a class="el" href="class_pcomm.html#c17">hearBuf</a> [256]</td></tr>
<tr><td><img src=null.gif></td><td><img src=null.gif></td><td></td><td><font size=-1><em>Buffer for receiving data in PCHear.</em></font><br><br></td></tr>

<p>
<tr><td><img src="null.gif"></td><td><img src="null.gif"></td><td nowrap align=right valign=top>char&nbsp;</td><td valign=top><a class="el" href="class_pcomm.html#c18">writeBuf</a> [256]</td></tr>
<tr><td><img src=null.gif></td><td><img src=null.gif></td><td></td><td><font size=-1><em>Buffer for writing data used in wrapper <a class="el" href="class_pcomm.html#c0">Write</a>().</em></font><br><br></td></tr>

<p>
<tr><td><img src="null.gif"></td><td><img src="null.gif"></td><td nowrap align=right valign=top>char&nbsp;</td><td valign=top><a class="el" href="class_pcomm.html#c19">readBuf</a> [256]</td></tr>
<tr><td><img src=null.gif></td><td><img src=null.gif></td><td></td><td><font size=-1><em>Buffer for reading data used in wrapper <a class="el" href="class_pcomm.html#c1">Read</a>().</em></font><br><br></td></tr>

<p>
<tr><td><img src="null.gif"></td><td><img src="null.gif"></td><td nowrap align=right valign=top>char&nbsp;</td><td valign=top><a class="el" href="class_pcomm.html#c20">int_name</a> [256]</td></tr>
<tr><td><img src=null.gif></td><td><img src=null.gif></td><td></td><td><font size=-1><em>Internal object name. <b>Warning:</b> not necessarily populated.</em></font><br><br></td></tr>

<p>
<tr><td><img src="null.gif"></td><td><img src="null.gif"></td><td nowrap align=right valign=top><a class="el" href="pcomm.h.html#a3">size_pc</a>&nbsp;</td><td valign=top><a class="el" href="class_pcomm.html#c21">writeCtr</a></td></tr>
<tr><td><img src=null.gif></td><td><img src=null.gif></td><td></td><td><font size=-1><em>Send bytecount used in wrapper function <a class="el" href="class_pcomm.html#c0">Write</a>().</em></font><br><br></td></tr>

<p>
<tr><td><img src="null.gif"></td><td><img src="null.gif"></td><td nowrap align=right valign=top><a class="el" href="pcomm.h.html#a3">size_pc</a>&nbsp;</td><td valign=top><a class="el" href="class_pcomm.html#c22">readCtr</a></td></tr>
<tr><td><img src=null.gif></td><td><img src=null.gif></td><td></td><td><font size=-1><em>Receive bytecount used in wrapper function <a class="el" href="class_pcomm.html#c1">Read</a>().</em></font><br><br></td></tr>

<p>
<tr><td><img src="null.gif"></td><td><img src="null.gif"></td><td nowrap align=right valign=top><a class="el" href="pcomm.h.html#a3">size_pc</a>&nbsp;</td><td valign=top><a class="el" href="class_pcomm.html#c23">askCtr</a></td></tr>
<tr><td><img src=null.gif></td><td><img src=null.gif></td><td></td><td><font size=-1><em>Receive bytecount used in PCAsk.</em></font><br><br></td></tr>

<p>
<tr><td><img src="null.gif"></td><td><img src="null.gif"></td><td nowrap align=right valign=top><a class="el" href="pcomm.h.html#a3">size_pc</a>&nbsp;</td><td valign=top><a class="el" href="class_pcomm.html#c24">tellCtr</a></td></tr>
<tr><td><img src=null.gif></td><td><img src=null.gif></td><td></td><td><font size=-1><em>Send bytecount used in PCTell.</em></font><br><br></td></tr>

<p>
<tr><td><img src="null.gif"></td><td><img src="null.gif"></td><td nowrap align=right valign=top><a class="el" href="pcomm.h.html#a3">size_pc</a>&nbsp;</td><td valign=top><a class="el" href="class_pcomm.html#c25">hearCtr</a></td></tr>
<tr><td><img src=null.gif></td><td><img src=null.gif></td><td></td><td><font size=-1><em>Receive bytecount used in PCHear.</em></font><br><br></td></tr>

<p>
</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
The Primitive Communications Object.
<p>
PComm object is the serial i/o object. It facilitates the low level grunt work for reading and writing to the serial device(s). It handles the string manipulation necessary for communication with the radio. 
<p>
Definition at line <a class="el" href="pcomm.h-source.html#l00047">47</a> of file <a class="el" href="pcomm.h-source.html">pcomm.h</a>.<hr><h2>Member Function Documentation</h2>
<a name="a0" doxytag="PComm::PComm">
<p><table width=100%% cellpadding=2 cellspacing=0 border=0><tr><td class="md"><b>
PComm::PComm (char * <em>pcrDev</em>, tcflag_t <em>baudRate</em> = B9600, const char * <em>name</em> = 0)
</b></td></tr></table>
</a>
<div class="in">

<p>
The PComm Constructor.
<p>
<dl compact><dt>
<b>Parameters: </b><dd>
<table border=0 cellspacing=2 cellpadding=0>
<tr><td valign=top><em>pcrDev</em>
&nbsp;</td><td>
 name of device to be opened (char string) </td></tr>
<tr><td valign=top><em>baudRate</em>
&nbsp;</td><td>
 speed of device to be opened </td></tr>
<tr><td valign=top><em>name</em>
&nbsp;</td><td>
 internal object name (for your use)
<p>
</td></tr>
</table>
</dl>This is the easiest way to open the serial device for communications with the radio. If the serial device cannot be opened for processing the object will abort with a -1 status code to the operating system.
<p>
You must send it at least the device name which is to be opened as the first argument. Optionally, you can send it an initial <em>baudrate</em> and an internal object <em>name.</em> </div>
<a name="a1" doxytag="PComm::~PComm">
<p><table width=100%% cellpadding=2 cellspacing=0 border=0><tr><td class="md"><b>
PComm::~PComm ()
</b></td></tr></table>
</a>
<div class="in">

<p>
The PComm Destructor.
<p>
Destroys the object, and closes any open file descriptors to the serial device. It also restores any old (initial) settings to the serial device. 
<p>
Definition at line <a class="el" href="pcomm.cpp-source.html#l00062">62</a> of file <a class="el" href="pcomm.cpp-source.html">pcomm.cpp</a>.</div>
<a name="a2" doxytag="PComm::PCOpen">
<p><table width=100%% cellpadding=2 cellspacing=0 border=0><tr><td class="md"><b>
PComm::PCOpen (const char * <em>pcrDev</em> = PCRDEV, tcflag_t <em>baudRate</em> = B9600)
</b></td></tr></table>
</a>
<div class="in">

<p>
Opens another file descriptor to the serial device.
<p>
<dl compact><dt>
<b>Parameters: </b><dd>
<table border=0 cellspacing=2 cellpadding=0>
<tr><td valign=top><em>pcrDev</em>
&nbsp;</td><td>
 Serial port device to be opened. </td></tr>
<tr><td valign=top><em>baudRate</em>
&nbsp;</td><td>
 Initial serial speed.
<p>
</td></tr>
</table>
</dl>Opens a file descriptor to the device <em>pcrDev</em> (which is by default your system's PCRDEV define) at the speed <em>baudRate</em> (which is by default as delinated in your termios.h set to 9600 baud).
<p>
<b>Warning:</b> You can only call this as long as the object is alive. If you do destry the object remember to call this function only after setting up the port configuration correctly.
<p>
<dl compact><dt>
<b>Returns: </b><dd>
true or false based on success value. </dl>
<p>
Definition at line <a class="el" href="pcomm.cpp-source.html#l00079">79</a> of file <a class="el" href="pcomm.cpp-source.html">pcomm.cpp</a>.</div>
<a name="a3" doxytag="PComm::PCClose">
<p><table width=100%% cellpadding=2 cellspacing=0 border=0><tr><td class="md"><b>
PComm::PCClose ()
</b></td></tr></table>
</a>
<div class="in">

<p>
Closes the currently active file descriptor.
<p>
Used in conjunction with PCOpen(...) so that you can release and regain the socket after an initialization procedure. 
<p>
Definition at line <a class="el" href="pcomm.cpp-source.html#l00173">173</a> of file <a class="el" href="pcomm.cpp-source.html">pcomm.cpp</a>.</div>
<a name="a4" doxytag="PComm::PCTell">
<p><table width=100%% cellpadding=2 cellspacing=0 border=0><tr><td class="md"><b>
PComm::PCTell (char * <em>mesg</em>)
</b></td></tr></table>
</a>
<div class="in">

<p>
Issue a command string to the radio.
<p>
<dl compact><dt>
<b>Parameters: </b><dd>
<table border=0 cellspacing=2 cellpadding=0>
<tr><td valign=top><em>mesg</em>
&nbsp;</td><td>
 command string from <a class="el" href="pcrdef.h.html">pcrdef.h</a>.
<p>
</td></tr>
</table>
</dl>Sends a command to the radio via the custom made wrapper function <a class="el" href="class_pcomm.html#c0">Write</a>() . This doesnt really alter the message at all for reading and writing to the radio.
<p>
<dl compact><dt>
<b>Returns: </b><dd>
number of bytes actually written gets returned, or (-1) on error.
<p>
</dl><dl compact><dt>
<b>See also: </b><dd>
<a class="el" href="pcrdef.h.html">pcrdef.h</a> </dl>
<p>
Definition at line <a class="el" href="pcomm.cpp-source.html#l00194">194</a> of file <a class="el" href="pcomm.cpp-source.html">pcomm.cpp</a>.</div>
<a name="a5" doxytag="PComm::PCAsk">
<p><table width=100%% cellpadding=2 cellspacing=0 border=0><tr><td class="md"><b>
PComm::PCAsk (char * <em>mesg</em>)
</b></td></tr></table>
</a>
<div class="in">

<p>
Issue a status request from the radio.
<p>
<dl compact><dt>
<b>Parameters: </b><dd>
<table border=0 cellspacing=2 cellpadding=0>
<tr><td valign=top><em>mesg</em>
&nbsp;</td><td>
 a query command string
<p>
</td></tr>
</table>
</dl>This function makes sure that mesg isnt empty, as well as making sure that mesg is two bytes long. Any queries sent to the radio should be the header of the information requested to be returned.
<p>
It then zero's out the ask buffer, and copies the message into the ask buffer. Then it concatenates the PCRQST command terminator, and calls <a class="el" href="class_pcomm.html#c0">Write</a>() sending it the ask buffer.
<p>
<dl compact><dt>
<b>Returns: </b><dd>
the number of bytes asked minus the PCRQST command terminator.
<p>
</dl><dl compact><dt>
<b>See also: </b><dd>
<a class="el" href="pcrdef.h.html#a0">PCRQST</a>() <a class="el" href="pcrdef.h.html">pcrdef.h</a> </dl>
<p>
Definition at line <a class="el" href="pcomm.cpp-source.html#l00217">217</a> of file <a class="el" href="pcomm.cpp-source.html">pcomm.cpp</a>.</div>
<a name="a6" doxytag="PComm::PCHear">
<p><table width=100%% cellpadding=2 cellspacing=0 border=0><tr><td class="md"><b>
PComm::PCHear (char * <em>mesg</em>)
</b></td></tr></table>
</a>
<div class="in">

<p>
Receive a repsonse from the radio.
<p>
<dl compact><dt>
<b>Parameters: </b><dd>
<table border=0 cellspacing=2 cellpadding=0>
<tr><td valign=top><em>mesg</em>
&nbsp;</td><td>
 a character string long enough to hold a reply
<p>
</td></tr>
</table>
</dl>This function makes sure that mesg is pointing to a valid address (ie: is malloc'd) then it zero's out the message string and hearBuffer. It then calls <a class="el" href="class_pcomm.html#c1">Read</a>()... remembering the number of bytes read, it cuts out the end-of-command marker read in (CR-LF) and copies what it heard into the message string.
<p>
If the radio kept spitting out LF chars, it checks for the err bool.
<p>
<dl compact><dt>
<b>Returns: </b><dd>
the number of bytes read, or -1 on err.
<p>
</dl><dl compact><dt>
<b>See also: </b><dd>
<a class="el" href="pcrdef.h.html">pcrdef.h</a> </dl>
<p>
Definition at line <a class="el" href="pcomm.cpp-source.html#l00251">251</a> of file <a class="el" href="pcomm.cpp-source.html">pcomm.cpp</a>.</div>
<a name="a7" doxytag="PComm::PCRawWrite">
<p><table width=100%% cellpadding=2 cellspacing=0 border=0><tr><td class="md"><b>
PComm::PCRawWrite (char * <em>mesg</em>)
</b></td></tr></table>
</a>
<div class="in">

<p>
writes directly to the current socket.
<p>
<dl compact><dt>
<b>Parameters: </b><dd>
<table border=0 cellspacing=2 cellpadding=0>
<tr><td valign=top><em>mesg</em>
&nbsp;</td><td>
 the character string which it will write
<p>
</td></tr>
</table>
</dl>Sends a command directly to the socket without any preprocessing
<p>
<dl compact><dt>
<b>Returns: </b><dd>
number of bytes actually written
<p>
</dl><dl compact><dt>
<b>See also: </b><dd>
<a class="el" href="pcrdef.h.html">pcrdef.h</a> <a class="el" href="class_pcomm.html#a8">PCRawRead</a>(char *mesg) </dl>
<p>
Definition at line <a class="el" href="pcomm.cpp-source.html#l00304">304</a> of file <a class="el" href="pcomm.cpp-source.html">pcomm.cpp</a>.</div>
<a name="a8" doxytag="PComm::PCRawRead">
<p><table width=100%% cellpadding=2 cellspacing=0 border=0><tr><td class="md"><b>
PComm::PCRawRead (char * <em>mesg</em>)
</b></td></tr></table>
</a>
<div class="in">

<p>
reads directly from the current socket.
<p>
<dl compact><dt>
<b>Parameters: </b><dd>
<table border=0 cellspacing=2 cellpadding=0>
<tr><td valign=top><em>mesg</em>
&nbsp;</td><td>
 malloc'd char string big enough to hold a reply
<p>
</td></tr>
</table>
</dl>Reads directly from the socket without any preprocessing
<p>
<dl compact><dt>
<b>Returns: </b><dd>
number of bytes read. </dl><dl compact><dt>
<b>See also: </b><dd>
<a class="el" href="pcrdef.h.html">pcrdef.h</a> <a class="el" href="class_pcomm.html#a7">PCRawWrite</a>(char *mesg) </dl>
<p>
Definition at line <a class="el" href="pcomm.cpp-source.html#l00337">337</a> of file <a class="el" href="pcomm.cpp-source.html">pcomm.cpp</a>.</div>
<a name="c0" doxytag="PComm::Write">
<p><table width=100%% cellpadding=2 cellspacing=0 border=0><tr><td class="md"><b>
PComm::Write (char * <em>submesg</em>)<code> [private]</code>
</b></td></tr></table>
</a>
<div class="in">

<p>
Internal function to write to the socket.
<p>
<dl compact><dt>
<b>Parameters: </b><dd>
<table border=0 cellspacing=2 cellpadding=0>
<tr><td valign=top><em>submesg</em>
&nbsp;</td><td>
 character string to write out to
<p>
</td></tr>
</table>
</dl>sends a command to the radio/socket.
<p>
It zero's out the internal class's write buffer, and copies the message passed in called submesg into the write buffer. It appends the special end-of-command marker to the write buffer, and exec's write(). Select() is used to see if we are ready to write to the socket in the FDSet.
<p>
<dl compact><dt>
<b>Returns: </b><dd>
what was actually written minus two. Since the minus two is to account for the end-of-command marker. On error we return -2
<p>
</dl><dl compact><dt>
<b>See also: </b><dd>
<a class="el" href="class_pcomm.html#c1">Read</a>() </dl>
<p>
Definition at line <a class="el" href="pcomm.cpp-source.html#l00370">370</a> of file <a class="el" href="pcomm.cpp-source.html">pcomm.cpp</a>.</div>
<a name="c1" doxytag="PComm::Read">
<p><table width=100%% cellpadding=2 cellspacing=0 border=0><tr><td class="md"><b>
PComm::Read (char * <em>submesg</em>)<code> [private]</code>
</b></td></tr></table>
</a>
<div class="in">

<p>
Internal function to read from the socket.
<p>
<dl compact><dt>
<b>Parameters: </b><dd>
<table border=0 cellspacing=2 cellpadding=0>
<tr><td valign=top><em>submesg</em>
&nbsp;</td><td>
 a character string long enough to hold data
<p>
</td></tr>
</table>
</dl>It reset's the read counter, and loopbreaker. The read counter keeps track of the number of bytes read in. The loop breaker makes sure that read doesnt get stuck reading New Lines from the radio for ever and ever. Since we are ignoring newlines when we read. The radio has a tendency of sending newlines even when it has nothing to say.
<p>
it executes read() into the internal variable read buffer, and increments the loop breaker. If the number of bytes read is greater than 1, then some useful data was read in... no need to re-loop. When good data is read, it is copied into the submesg string from the read buffer. Select() will determine if the socket in FDSet is ready to read data.
<p>
<dl compact><dt>
<b>Returns: </b><dd>
If after five times, the read() read in anything less than 1, then break, and set errRead to true, while returning the number of bytes read. If after five seconds fd says that it's still not ready, then it will return, setting the read counter to a negative value.
<p>
</dl><dl compact><dt>
<b>See also: </b><dd>
<a class="el" href="class_pcomm.html#c0">Write</a>() </dl>
<p>
Definition at line <a class="el" href="pcomm.cpp-source.html#l00416">416</a> of file <a class="el" href="pcomm.cpp-source.html">pcomm.cpp</a>.</div>
<a name="c2" doxytag="PComm::resetCall">
<p><table width=100%% cellpadding=2 cellspacing=0 border=0><tr><td class="md"><b>
PComm::resetCall ()<code> [private]</code>
</b></td></tr></table>
</a>
<div class="in">

<p>
resets the radio and port.
<p>
This function reset's the radio and the port when called. It is necessary to reset the radio after a certain number of read() and write()'s. In this case we have made it after 200 write() calls.
<p>
It closes the port, and reopens the port. Zero's out the call buffer, and copy's the poweron/ecmd command strings into the call buffer. It then select()'s to see if we are ready to write to the buffer. After which it writes to the radio to tell it, that we are back online and want it to come up. Then it bzero's the call buffer and reads what the radio has to say. It loops in that mode if it received only one character of data (the radio likes to send nothing but newlines sometimes) AND the number of loops is less than 10. We dont want to get stuck there.
<p>
<b>Warning:</b> this function is necessary for the radio to operate properly under the manual update mode. If you override this function make sure to run the radio in auto-update mode.
<p>
<dl compact><dt>
<b>See also: </b><dd>
<a class="el" href="class_pcomm.html#c3">countCall</a>() </dl>
<p>
Definition at line <a class="el" href="pcomm.cpp-source.html#l00496">496</a> of file <a class="el" href="pcomm.cpp-source.html">pcomm.cpp</a>.</div>
<a name="c3" doxytag="PComm::countCall">
<p><table width=100%% cellpadding=2 cellspacing=0 border=0><tr><td class="md"><b>
PComm::countCall ()<code> [private]</code>
</b></td></tr></table>
</a>
<div class="in">

<p>
function to keep track on the number of calls.
<p>
this function keeps track of the number of calls that were sent to the radio before the last reset. it calls <a class="el" href="class_pcomm.html#c2">resetCall</a>() every 200 calls, otherwise it increments the call count.
<p>
<dl compact><dt>
<b>See also: </b><dd>
<a class="el" href="class_pcomm.html#c2">resetCall</a>() </dl>
<p>
Definition at line <a class="el" href="pcomm.cpp-source.html#l00564">564</a> of file <a class="el" href="pcomm.cpp-source.html">pcomm.cpp</a>.</div>
<hr><h2>Member Data Documentation</h2>
<a name="c4" doxytag="PComm::callCount">
<p><table width=100%% cellpadding=2 cellspacing=0 border=0><tr><td class="md"><b>
int PComm::callCount<code> [private]</code>
</b></td></tr></table>
</a>
<div class="in">

<p>
Counter for number of times the radio has been written to.
<p>

<p>
Definition at line <a class="el" href="pcomm.h-source.html#l00068">68</a> of file <a class="el" href="pcomm.h-source.html">pcomm.h</a>.</div>
<a name="c5" doxytag="PComm::callBuf">
<p><table width=100%% cellpadding=2 cellspacing=0 border=0><tr><td class="md"><b>
char PComm::callBuf[256]<code> [private]</code>
</b></td></tr></table>
</a>
<div class="in">

<p>
Internal buffer for radio reset.
<p>

<p>
Definition at line <a class="el" href="pcomm.h-source.html#l00070">70</a> of file <a class="el" href="pcomm.h-source.html">pcomm.h</a>.</div>
<a name="c6" doxytag="PComm::timeOut">
<p><table width=100%% cellpadding=2 cellspacing=0 border=0><tr><td class="md"><b>
struct timeval* PComm::timeOut<code> [private]</code>
</b></td></tr></table>
</a>
<div class="in">

<p>
Used in the select for timeout(s).
<p>

<p>
Definition at line <a class="el" href="pcomm.h-source.html#l00073">73</a> of file <a class="el" href="pcomm.h-source.html">pcomm.h</a>.</div>
<a name="c7" doxytag="PComm::FDSet">
<p><table width=100%% cellpadding=2 cellspacing=0 border=0><tr><td class="md"><b>
fd_set* PComm::FDSet<code> [private]</code>
</b></td></tr></table>
</a>
<div class="in">

<p>
Socket set used in the select.
<p>

<p>
Definition at line <a class="el" href="pcomm.h-source.html#l00075">75</a> of file <a class="el" href="pcomm.h-source.html">pcomm.h</a>.</div>
<a name="c8" doxytag="PComm::retVal">
<p><table width=100%% cellpadding=2 cellspacing=0 border=0><tr><td class="md"><b>
int PComm::retVal<code> [private]</code>
</b></td></tr></table>
</a>
<div class="in">

<p>
Select()'s return value.
<p>

<p>
Definition at line <a class="el" href="pcomm.h-source.html#l00077">77</a> of file <a class="el" href="pcomm.h-source.html">pcomm.h</a>.</div>
<a name="c9" doxytag="PComm::oldtio">
<p><table width=100%% cellpadding=2 cellspacing=0 border=0><tr><td class="md"><b>
struct termios* PComm::oldtio<code> [private]</code>
</b></td></tr></table>
</a>
<div class="in">

<p>
Stores the port's original settings.
<p>

<p>
Definition at line <a class="el" href="pcomm.h-source.html#l00079">79</a> of file <a class="el" href="pcomm.h-source.html">pcomm.h</a>.</div>
<a name="c10" doxytag="PComm::newtio">
<p><table width=100%% cellpadding=2 cellspacing=0 border=0><tr><td class="md"><b>
struct termios* PComm::newtio<code> [private]</code>
</b></td></tr></table>
</a>
<div class="in">

<p>
Port settings to be applied for current session.
<p>

<p>
Definition at line <a class="el" href="pcomm.h-source.html#l00081">81</a> of file <a class="el" href="pcomm.h-source.html">pcomm.h</a>.</div>
<a name="c11" doxytag="PComm::fd">
<p><table width=100%% cellpadding=2 cellspacing=0 border=0><tr><td class="md"><b>
int PComm::fd<code> [private]</code>
</b></td></tr></table>
</a>
<div class="in">

<p>
Socket descriptor used for current session.
<p>

<p>
Definition at line <a class="el" href="pcomm.h-source.html#l00083">83</a> of file <a class="el" href="pcomm.h-source.html">pcomm.h</a>.</div>
<a name="c12" doxytag="PComm::pcrDevice">
<p><table width=100%% cellpadding=2 cellspacing=0 border=0><tr><td class="md"><b>
char PComm::pcrDevice[256]<code> [private]</code>
</b></td></tr></table>
</a>
<div class="in">

<p>
Current serial/comm device.
<p>

<p>
Definition at line <a class="el" href="pcomm.h-source.html#l00085">85</a> of file <a class="el" href="pcomm.h-source.html">pcomm.h</a>.</div>
<a name="c13" doxytag="PComm::pcrSpeed">
<p><table width=100%% cellpadding=2 cellspacing=0 border=0><tr><td class="md"><b>
tcflag_t PComm::pcrSpeed<code> [private]</code>
</b></td></tr></table>
</a>
<div class="in">

<p>
Current baud rate.
<p>

<p>
Definition at line <a class="el" href="pcomm.h-source.html#l00087">87</a> of file <a class="el" href="pcomm.h-source.html">pcomm.h</a>.</div>
<a name="c14" doxytag="PComm::errRead">
<p><table width=100%% cellpadding=2 cellspacing=0 border=0><tr><td class="md"><b>
bool PComm::errRead<code> [private]</code>
</b></td></tr></table>
</a>
<div class="in">

<p>
Was there an error reading?
<p>

<p>
Definition at line <a class="el" href="pcomm.h-source.html#l00090">90</a> of file <a class="el" href="pcomm.h-source.html">pcomm.h</a>.</div>
<a name="c15" doxytag="PComm::errWrite">
<p><table width=100%% cellpadding=2 cellspacing=0 border=0><tr><td class="md"><b>
bool PComm::errWrite<code> [private]</code>
</b></td></tr></table>
</a>
<div class="in">

<p>
Was there an error writing?
<p>

<p>
Definition at line <a class="el" href="pcomm.h-source.html#l00092">92</a> of file <a class="el" href="pcomm.h-source.html">pcomm.h</a>.</div>
<a name="c16" doxytag="PComm::askBuf">
<p><table width=100%% cellpadding=2 cellspacing=0 border=0><tr><td class="md"><b>
char PComm::askBuf[256]<code> [private]</code>
</b></td></tr></table>
</a>
<div class="in">

<p>
Buffer for sending data in PCAsk.
<p>

<p>
Definition at line <a class="el" href="pcomm.h-source.html#l00094">94</a> of file <a class="el" href="pcomm.h-source.html">pcomm.h</a>.</div>
<a name="c17" doxytag="PComm::hearBuf">
<p><table width=100%% cellpadding=2 cellspacing=0 border=0><tr><td class="md"><b>
char PComm::hearBuf[256]<code> [private]</code>
</b></td></tr></table>
</a>
<div class="in">

<p>
Buffer for receiving data in PCHear.
<p>

<p>
Definition at line <a class="el" href="pcomm.h-source.html#l00096">96</a> of file <a class="el" href="pcomm.h-source.html">pcomm.h</a>.</div>
<a name="c18" doxytag="PComm::writeBuf">
<p><table width=100%% cellpadding=2 cellspacing=0 border=0><tr><td class="md"><b>
char PComm::writeBuf[256]<code> [private]</code>
</b></td></tr></table>
</a>
<div class="in">

<p>
Buffer for writing data used in wrapper <a class="el" href="class_pcomm.html#c0">Write</a>().
<p>

<p>
Definition at line <a class="el" href="pcomm.h-source.html#l00098">98</a> of file <a class="el" href="pcomm.h-source.html">pcomm.h</a>.</div>
<a name="c19" doxytag="PComm::readBuf">
<p><table width=100%% cellpadding=2 cellspacing=0 border=0><tr><td class="md"><b>
char PComm::readBuf[256]<code> [private]</code>
</b></td></tr></table>
</a>
<div class="in">

<p>
Buffer for reading data used in wrapper <a class="el" href="class_pcomm.html#c1">Read</a>().
<p>

<p>
Definition at line <a class="el" href="pcomm.h-source.html#l00100">100</a> of file <a class="el" href="pcomm.h-source.html">pcomm.h</a>.</div>
<a name="c20" doxytag="PComm::int_name">
<p><table width=100%% cellpadding=2 cellspacing=0 border=0><tr><td class="md"><b>
char PComm::int_name[256]<code> [private]</code>
</b></td></tr></table>
</a>
<div class="in">

<p>
Internal object name. <b>Warning:</b> not necessarily populated.
<p>

<p>
Definition at line <a class="el" href="pcomm.h-source.html#l00102">102</a> of file <a class="el" href="pcomm.h-source.html">pcomm.h</a>.</div>
<a name="c21" doxytag="PComm::writeCtr">
<p><table width=100%% cellpadding=2 cellspacing=0 border=0><tr><td class="md"><b>
<a class="el" href="pcomm.h.html#a3">size_pc</a> PComm::writeCtr<code> [private]</code>
</b></td></tr></table>
</a>
<div class="in">

<p>
Send bytecount used in wrapper function <a class="el" href="class_pcomm.html#c0">Write</a>().
<p>

<p>
Definition at line <a class="el" href="pcomm.h-source.html#l00104">104</a> of file <a class="el" href="pcomm.h-source.html">pcomm.h</a>.</div>
<a name="c22" doxytag="PComm::readCtr">
<p><table width=100%% cellpadding=2 cellspacing=0 border=0><tr><td class="md"><b>
<a class="el" href="pcomm.h.html#a3">size_pc</a> PComm::readCtr<code> [private]</code>
</b></td></tr></table>
</a>
<div class="in">

<p>
Receive bytecount used in wrapper function <a class="el" href="class_pcomm.html#c1">Read</a>().
<p>

<p>
Definition at line <a class="el" href="pcomm.h-source.html#l00106">106</a> of file <a class="el" href="pcomm.h-source.html">pcomm.h</a>.</div>
<a name="c23" doxytag="PComm::askCtr">
<p><table width=100%% cellpadding=2 cellspacing=0 border=0><tr><td class="md"><b>
<a class="el" href="pcomm.h.html#a3">size_pc</a> PComm::askCtr<code> [private]</code>
</b></td></tr></table>
</a>
<div class="in">

<p>
Receive bytecount used in PCAsk.
<p>

<p>
Definition at line <a class="el" href="pcomm.h-source.html#l00108">108</a> of file <a class="el" href="pcomm.h-source.html">pcomm.h</a>.</div>
<a name="c24" doxytag="PComm::tellCtr">
<p><table width=100%% cellpadding=2 cellspacing=0 border=0><tr><td class="md"><b>
<a class="el" href="pcomm.h.html#a3">size_pc</a> PComm::tellCtr<code> [private]</code>
</b></td></tr></table>
</a>
<div class="in">

<p>
Send bytecount used in PCTell.
<p>

<p>
Definition at line <a class="el" href="pcomm.h-source.html#l00110">110</a> of file <a class="el" href="pcomm.h-source.html">pcomm.h</a>.</div>
<a name="c25" doxytag="PComm::hearCtr">
<p><table width=100%% cellpadding=2 cellspacing=0 border=0><tr><td class="md"><b>
<a class="el" href="pcomm.h.html#a3">size_pc</a> PComm::hearCtr<code> [private]</code>
</b></td></tr></table>
</a>
<div class="in">

<p>
Receive bytecount used in PCHear.
<p>

<p>
Definition at line <a class="el" href="pcomm.h-source.html#l00112">112</a> of file <a class="el" href="pcomm.h-source.html">pcomm.h</a>.</div>
<hr>The documentation for this class was generated from the following files:<ul>
<li><a class="el" href="pcomm.h.html">pcomm.h</a><li><a class="el" href="pcomm.cpp.html">pcomm.cpp</a></ul>
<hr><address><small>Generated at Mon Jan 17 00:45:29 2000 for Icom PCR-1000 Library by
<a href="http://www.stack.nl/~dimitri/doxygen/index.html">
<img src="doxygen.gif" alt="doxygen" align=center border=0 
width=118 height=53></a> 1.0.0 written by <a href="mailto:dimitri@stack.nl">Dimitri van Heesch</a>,
 &copy; 1997-1999</small></address>
</body>
</html>