Debian Codegraph @

hdlcutil/fl/xfhdlcst_main.cxx

raw symbols SCIP
1 /*****************************************************************************/cxx . . $ `<file>/hdlcutil/fl/xfhdlcst_main.cxx`/
2
3 /*
4 * xfhdlcst_main.C -- kernel hdlc radio modem driver status display utility.
5 *
6 * Copyright (C) 1996,1997,2000 Thomas Sailer ([email protected])
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
21 * 02110-1301, USA.
22 *
23 * Please note that the GPL allows you to use the driver, NOT the radio.
24 * In order to use the radio, you need a license from the communications
25 * authority of your country.
26 *
27 *
28 * History:
29 * 0.1 14.12.1996 Started
30 * 0.2 11.05.1997 introduced hdrvcomm.h
31 * 0.3 05.01.2000 upgraded to fltk 1.0.7
32 */
33
34 /*****************************************************************************/
35
36 #include <stdlib.h>
37 #include <stdio.h>
38 #include <unistd.h>
39 #include <string.h>
40 #include <sys/types.h>
41 #include <net/if.h>
42 #include "hdrvcomm.h"cxx . . $ `<file>/hdlcutil/hdrvcomm.h`/
43 #include "xfhdlcst.h"cxx . . $ `<file>/hdlcutil/fl/xfhdlcst.h`/
44
45 #include <config.h>cxx . . $ `<file>/config.h`/
46 #include <scm-version.h>cxx . . $ `<file>/scm-version.h`/
47
48 /* ---------------------------------------------------------------------- */
49
50 static char *prognamecxx . . $ progname.;
51 static bool updatecxx . . $ update. = true;
52
53 /* ---------------------------------------------------------------------- */
54
55 void cb_quitcxx . . $ cb_quit(a1c60d4e2a3bbb68).(Fl_Buttoncxx . . $ Fl_Button# *, long)
56 {
57 exitcxx . . $ exit(44ed87f96534fad7).(0);
58 }
59
60 /* ---------------------------------------------------------------------- */
61
62 void cb_timercxx . . $ cb_timer(5d22bdacc48458e8).(void *)
63 {
64 updatecxx . . $ update. = true;
65 }
66
67 /* ---------------------------------------------------------------------- */
68
69 static const char *usage_strcxx . . $ usage_str. =
70 "[-i smif]\n"
71 " -i: specify the name of the baycom kernel driver interface\n\n";
72
73 /* ---------------------------------------------------------------------- */
74
75 int maincxx . . $ main(afcd3168fc1188a4).(int argc, char *argv[])
76 {
77 int c, i;
78 int ret;
79 struct hdrvc_channel_state cs;
80 struct sm_ioctl smi;
81 char buf[32];
82 char name[64];
83
84 prognamecxx . . $ progname. = *argv;
85 printf("%s: Version " FULL_VERcxx . . $ `scm-version.h:6:9`! "; (C) 1996,1997,2000 by Thomas Sailer HB9JNX/AE4WA\n", *argv);
86 hdrvc_args(&argc, argv, "bc0");
87 for (i = 1; i < argc; ) {
88 c = i;
89 Flcxx . . $ Fl#::argcxx . . $ Fl#arg(8593696dd6f7d2b6).(argc, argv, c);
90 if (c <= 0) {
91 i++;
92 continue;
93 }
94 memmove(&argv[i], &argv[i+c], (argc-i) * sizeof(char *));
95 argc -= c;
96 }
97 #if 0
98 while ((ret = getopt(argc, argv, "")) != -1) {
99 switch (ret) {
100 default:
101 printf("usage: %s %s", *argv, usage_str);
102 exit(-1);
103 }
104 }
105 #endif
106 hdrvc_init();
107
108 create_the_formscxx . . $ create_the_forms(80327a7a60f718d1).();
109 Flcxx . . $ Fl#::add_timeoutcxx . . $ Fl#add_timeout(5c1e27f8f85f9ba8).(0.1, cb_timercxx . . $ cb_timer(5d22bdacc48458e8).);
110 /*
111 * set driver and modem name
112 */
113 ret = hdrvc_get_mode_name(name, sizeof(name));
114 if (ret < 0) {
115 perror("hdrvc_get_mode_name");
116 modenamecxx . . $ modename.->hidecxx . . $ Fl_Widget#hide(49f6e7a06ebc5aa8).();
117 } else
118 modenamecxx . . $ modename.->valuecxx . . $ Fl_Input_#value(5c4306d8553b3696).(name);
119 ret = hdrvc_get_driver_name(name, sizeof(name));
120 if (ret < 0) {
121 perror("hdrvc_get_driver_name");
122 drivernamecxx . . $ drivername.->hidecxx . . $ Fl_Widget#hide(49f6e7a06ebc5aa8).();
123 } else
124 drivernamecxx . . $ drivername.->valuecxx . . $ Fl_Input_#value(5c4306d8553b3696).(name);
125 /*
126 * check for soundmodem driver
127 */
128 ret = hdrvc_sm_ioctl(SMCTL_GETDEBUGcxx . . $ `hdlcutil/soundmodem.h:84:9`!, &smi);
129 if (ret < 0) {
130 tdemodcyccxx . . $ tdemodcyc.->hidecxx . . $ Fl_Widget#hide(49f6e7a06ebc5aa8).();
131 tmodcyccxx . . $ tmodcyc.->hidecxx . . $ Fl_Widget#hide(49f6e7a06ebc5aa8).();
132 tintfreqcxx . . $ tintfreq.->hidecxx . . $ Fl_Widget#hide(49f6e7a06ebc5aa8).();
133 tdmarescxx . . $ tdmares.->hidecxx . . $ Fl_Widget#hide(49f6e7a06ebc5aa8).();
134 demodcyccxx . . $ demodcyc.->hidecxx . . $ Fl_Widget#hide(49f6e7a06ebc5aa8).();
135 modcyccxx . . $ modcyc.->hidecxx . . $ Fl_Widget#hide(49f6e7a06ebc5aa8).();
136 intfreqcxx . . $ intfreq.->hidecxx . . $ Fl_Widget#hide(49f6e7a06ebc5aa8).();
137 dmarescxx . . $ dmares.->hidecxx . . $ Fl_Widget#hide(49f6e7a06ebc5aa8).();
138 }
139 hdlcstcxx . . $ hdlcst.->showcxx . . $ Fl_Window#show(49f6e7a06ebc5aa8).();
140 for (;;) {
141 Flcxx . . $ Fl#::waitcxx . . $ Fl#wait(b126dc7c1de90089).();
142 if (!updatecxx . . $ update.)
143 continue;
144 updatecxx . . $ update. = false;
145 Flcxx . . $ Fl#::add_timeoutcxx . . $ Fl#add_timeout(5c1e27f8f85f9ba8).(0.5, cb_timercxx . . $ cb_timer(5d22bdacc48458e8).);
146 /*
147 * display state
148 */
149 ret = hdrvc_get_channel_state(&cs);
150 if (ret >= 0) {
151 pttcxx . . $ ptt.->valuecxx . . $ Fl_Button#value(7864480464b09eea).(cs.ptt);
152 dcdcxx . . $ dcd.->valuecxx . . $ Fl_Button#value(7864480464b09eea).(cs.dcd);
153 sprintf(buf, "%ld", cs.tx_packets);
154 txpacketcxx . . $ txpacket.->valuecxx . . $ Fl_Input_#value(5c4306d8553b3696).(buf);
155 sprintf(buf, "%ld", cs.tx_errors);
156 txerrorcxx . . $ txerror.->valuecxx . . $ Fl_Input_#value(5c4306d8553b3696).(buf);
157 sprintf(buf, "%ld", cs.rx_packets);
158 rxpacketcxx . . $ rxpacket.->valuecxx . . $ Fl_Input_#value(5c4306d8553b3696).(buf);
159 sprintf(buf, "%ld", cs.rx_errors);
160 rxerrorcxx . . $ rxerror.->valuecxx . . $ Fl_Input_#value(5c4306d8553b3696).(buf);
161 }
162 ret = hdrvc_sm_ioctl(SMCTL_GETDEBUGcxx . . $ `hdlcutil/soundmodem.h:84:9`!, &smi);
163 if (ret >= 0) {
164 sprintf(buf, "%d", smi.data.dbg.int_rate);
165 intfreqcxx . . $ intfreq.->valuecxx . . $ Fl_Input_#value(5c4306d8553b3696).(buf);
166 sprintf(buf, "%d", smi.data.dbg.mod_cycles);
167 modcyccxx . . $ modcyc.->valuecxx . . $ Fl_Input_#value(5c4306d8553b3696).(buf);
168 sprintf(buf, "%d", smi.data.dbg.demod_cycles);
169 demodcyccxx . . $ demodcyc.->valuecxx . . $ Fl_Input_#value(5c4306d8553b3696).(buf);
170 sprintf(buf, "%d", smi.data.dbg.dma_residue);
171 dmarescxx . . $ dmares.->valuecxx . . $ Fl_Input_#value(5c4306d8553b3696).(buf);
172 }
173 }
174 exitcxx . . $ exit(44ed87f96534fad7). (0);
175 }