| 1 | /*****************************************************************************/cxx . . $ `<file>/hdlcutil/fl/xfhdlcchpar_main.cxx`/ |
| 2 | |
| 3 | /* |
| 4 | * xfhdlcchpar_main.C -- kernel hdlc radio modem driver channel parameter setting 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 "xfhdlcchpar.h"cxx . . $ `<file>/hdlcutil/fl/xfhdlcchpar.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 | |
| 52 | /* ---------------------------------------------------------------------- */ |
| 53 | |
| 54 | void cb_updatecxx . . $ cb_update(692bf3e9e3c0137a).(Fl_Widgetcxx . . $ Fl_Widget# *widget, void *udata) |
| 55 | { |
| 56 | int ret; |
| 57 | struct hdrvc_channel_params cp; |
| 58 | |
| 59 | cp.tx_delay = (int)(0.1*txdelaycxx . . $ txdelay.->valuecxx . . $ Fl_Valuator#value(21b6c25e127938e2).()); |
| 60 | cp.tx_tail = (int)(0.1*txtailcxx . . $ txtail.->valuecxx . . $ Fl_Valuator#value(21b6c25e127938e2).()); |
| 61 | cp.slottime = (int)(0.1*slottimecxx . . $ slottime.->valuecxx . . $ Fl_Valuator#value(21b6c25e127938e2).()); |
| 62 | cp.ppersist = (int)(ppersistcxx . . $ ppersist.->valuecxx . . $ Fl_Valuator#value(21b6c25e127938e2).()); |
| 63 | cp.fulldup = !!fulldupcxx . . $ fulldup.->valuecxx . . $ Fl_Button#value(1b8b762cbef9c2c9).(); |
| 64 | ret = hdrvc_set_channel_access_param(cp); |
| 65 | if (ret < 0) |
| 66 | perror("hdrvc_set_channel_access_param"); |
| 67 | } |
| 68 | |
| 69 | /* ---------------------------------------------------------------------- */ |
| 70 | |
| 71 | void cb_quitcxx . . $ cb_quit(a1c60d4e2a3bbb68).(Fl_Buttoncxx . . $ Fl_Button# *, long) |
| 72 | { |
| 73 | exitcxx . . $ exit(44ed87f96534fad7).(0); |
| 74 | } |
| 75 | |
| 76 | /* ---------------------------------------------------------------------- */ |
| 77 | |
| 78 | static const char *usage_strcxx . . $ usage_str. = |
| 79 | "[-i smif]\n" |
| 80 | " -i: specify the name of the baycom kernel driver interface\n\n"; |
| 81 | |
| 82 | /* ---------------------------------------------------------------------- */ |
| 83 | |
| 84 | int maincxx . . $ main(afcd3168fc1188a4).(int argc, char *argv[]) |
| 85 | { |
| 86 | int c, i; |
| 87 | int ret; |
| 88 | struct hdrvc_channel_params cp; |
| 89 | |
| 90 | prognamecxx . . $ progname. = *argv; |
| 91 | printf("%s: Version " FULL_VERcxx . . $ `scm-version.h:6:9`! "; (C) 1996,1997,2000 by Thomas Sailer HB9JNX/AE4WA\n", prognamecxx . . $ progname.); |
| 92 | hdrvc_args(&argc, argv, "bc0"); |
| 93 | for (i = 1; i < argc; ) { |
| 94 | c = i; |
| 95 | Flcxx . . $ Fl#::argcxx . . $ Fl#arg(8593696dd6f7d2b6).(argc, argv, c); |
| 96 | if (c <= 0) { |
| 97 | i++; |
| 98 | continue; |
| 99 | } |
| 100 | memmove(&argv[i], &argv[i+c], (argc-i) * sizeof(char *)); |
| 101 | argc -= c; |
| 102 | } |
| 103 | #if 0 |
| 104 | while ((ret = getopt(argc, argv, "")) != -1) { |
| 105 | switch (ret) { |
| 106 | default: |
| 107 | printf("usage: %s %s", progname, usage_str); |
| 108 | exit(-1); |
| 109 | } |
| 110 | } |
| 111 | #endif |
| 112 | hdrvc_init(); |
| 113 | |
| 114 | create_the_formscxx . . $ create_the_forms(80327a7a60f718d1).(); |
| 115 | ifnamecxx . . $ ifname.->valuecxx . . $ Fl_Input_#value(5c4306d8553b3696).(hdrvc_ifname()); |
| 116 | /* |
| 117 | * set channel params |
| 118 | */ |
| 119 | ret = hdrvc_get_channel_access_param(&cp); |
| 120 | if (ret < 0) { |
| 121 | perror("hdrvc_get_channel_access_param"); |
| 122 | exitcxx . . $ exit(44ed87f96534fad7).(1); |
| 123 | } |
| 124 | txdelaycxx . . $ txdelay.->stepcxx . . $ Fl_Valuator#step(d4f767463ce0a6b3).(10); |
| 125 | txdelaycxx . . $ txdelay.->boundscxx . . $ Fl_Slider#bounds(bc12c9ec15586e6a).(0, 2550); |
| 126 | txdelaycxx . . $ txdelay.->valuecxx . . $ Fl_Valuator#value(620b9ac44d2573a6).(cp.tx_delay*10); |
| 127 | txtailcxx . . $ txtail.->stepcxx . . $ Fl_Valuator#step(d4f767463ce0a6b3).(10); |
| 128 | txtailcxx . . $ txtail.->boundscxx . . $ Fl_Slider#bounds(bc12c9ec15586e6a).(0, 2550); |
| 129 | txtailcxx . . $ txtail.->valuecxx . . $ Fl_Valuator#value(620b9ac44d2573a6).(cp.tx_tail*10); |
| 130 | slottimecxx . . $ slottime.->stepcxx . . $ Fl_Valuator#step(d4f767463ce0a6b3).(10); |
| 131 | slottimecxx . . $ slottime.->boundscxx . . $ Fl_Slider#bounds(bc12c9ec15586e6a).(0, 2550); |
| 132 | slottimecxx . . $ slottime.->valuecxx . . $ Fl_Valuator#value(620b9ac44d2573a6).(cp.slottime*10); |
| 133 | ppersistcxx . . $ ppersist.->stepcxx . . $ Fl_Valuator#step(d4f767463ce0a6b3).(1); |
| 134 | ppersistcxx . . $ ppersist.->boundscxx . . $ Fl_Slider#bounds(bc12c9ec15586e6a).(0, 255); |
| 135 | ppersistcxx . . $ ppersist.->valuecxx . . $ Fl_Valuator#value(620b9ac44d2573a6).(cp.ppersist); |
| 136 | fulldupcxx . . $ fulldup.->valuecxx . . $ Fl_Button#value(7864480464b09eea).(!!cp.fulldup); |
| 137 | chparcxx . . $ chpar.->showcxx . . $ Fl_Window#show(49f6e7a06ebc5aa8).(); |
| 138 | Flcxx . . $ Fl#::runcxx . . $ Fl#run(b126dc7c1de90089).(); |
| 139 | exitcxx . . $ exit(44ed87f96534fad7).(0); |
| 140 | } |