| 1 |
/* |
| 2 |
* Interface to Anytone D868UV. |
| 3 |
* |
| 4 |
* Copyright (C) 2018 Serge Vakulenko, KK6ABQ |
| 5 |
* |
| 6 |
* Redistribution and use in source and binary forms, with or without |
| 7 |
* modification, are permitted provided that the following conditions are met: |
| 8 |
* |
| 9 |
* 1. Redistributions of source code must retain the above copyright notice, |
| 10 |
* this list of conditions and the following disclaimer. |
| 11 |
* 2. Redistributions in binary form must reproduce the above copyright |
| 12 |
* notice, this list of conditions and the following disclaimer in the |
| 13 |
* documentation and/or other materials provided with the distribution. |
| 14 |
* 3. The name of the author may not be used to endorse or promote products |
| 15 |
* derived from this software without specific prior written permission. |
| 16 |
* |
| 17 |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED |
| 18 |
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
| 19 |
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO |
| 20 |
* EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 21 |
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
| 22 |
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; |
| 23 |
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
| 24 |
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR |
| 25 |
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF |
| 26 |
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 |
*/ |
| 28 |
#include <stdio.h> |
| 29 |
#include <string.h> |
| 30 |
#include <stdlib.h> |
| 31 |
#include <unistd.h> |
| 32 |
#include <stdint.h> |
| 33 |
#include <sys/stat.h> |
| 34 |
#include "radio.h"cxx . . $ `<file>/radio.h`/ |
| 35 |
#include "util.h"cxx . . $ `<file>/util.h`/ |
| 36 |
|
| 37 |
// |
| 38 |
// Sizes of configuration tables. |
| 39 |
// |
| 40 |
#define NCHANcxx . . $ `d868uv.c:40:9`! 4000 |
| 41 |
#define NCONTACTScxx . . $ `d868uv.c:41:9`! 10000 |
| 42 |
#define NZONEScxx . . $ `d868uv.c:42:9`! 250 |
| 43 |
#define NGLISTScxx . . $ `d868uv.c:43:9`! 250 |
| 44 |
#define NSCANLcxx . . $ `d868uv.c:44:9`! 250 |
| 45 |
#define NMESSAGEScxx . . $ `d868uv.c:45:9`! 100 |
| 46 |
#define NCALLSIGNScxx . . $ `d868uv.c:46:9`! 200000 |
| 47 |
#define CALLSIGN_SIZEcxx . . $ `d868uv.c:47:9`! (12*1024*1024) // Size of callsign data |
| 48 |
|
| 49 |
// |
| 50 |
// Offsets in the image file. |
| 51 |
// |
| 52 |
#define OFFSET_BANK1cxx . . $ `d868uv.c:52:9`! 0x000040 // Channels |
| 53 |
#define OFFSET_ZONELISTScxx . . $ `d868uv.c:53:9`! 0x03e8c0 // Channel lists of zones |
| 54 |
#define OFFSET_SCANLISTScxx . . $ `d868uv.c:54:9`! 0x05dcc0 // Scanlists |
| 55 |
#define OFFSET_MESSAGEScxx . . $ `d868uv.c:55:9`! 0x069f40 // Messages |
| 56 |
#define OFFSET_ZONE_MAPcxx . . $ `d868uv.c:56:9`! 0x070940 // Bitmap of valid zones |
| 57 |
#define OFFSET_SCANL_MAPcxx . . $ `d868uv.c:57:9`! 0x070980 // Bitmap of valid scanlists |
| 58 |
#define OFFSET_CHAN_MAPcxx . . $ `d868uv.c:58:9`! 0x070a40 // Bitmap of valid channels |
| 59 |
#define OFFSET_SETTINGScxx . . $ `d868uv.c:59:9`! 0x071600 // General settings |
| 60 |
#define OFFSET_ZCHAN_Acxx . . $ `d868uv.c:60:9`! 0x071700 // Zone A channel |
| 61 |
#define OFFSET_ZCHAN_Bcxx . . $ `d868uv.c:61:9`! 0x071900 // Zone B channel |
| 62 |
#define OFFSET_ZONENAMEScxx . . $ `d868uv.c:62:9`! 0x071dc0 // Names of zones |
| 63 |
#define OFFSET_RADIOIDcxx . . $ `d868uv.c:63:9`! 0x073d00 // Table of radio IDs |
| 64 |
#define OFFSET_CONTACT_LISTcxx . . $ `d868uv.c:64:9`! 0x076500 // List of valid contact indices |
| 65 |
#define OFFSET_CONTACT_MAPcxx . . $ `d868uv.c:65:9`! 0x080140 // Bitmap of invalid contacts |
| 66 |
#define OFFSET_CONTACTScxx . . $ `d868uv.c:66:9`! 0x080640 // Contacts |
| 67 |
#define OFFSET_GLISTScxx . . $ `d868uv.c:67:9`! 0x174b00 // RX group lists |
| 68 |
|
| 69 |
// |
| 70 |
// Addresses in the radio flash memory. |
| 71 |
// |
| 72 |
#define ADDR_CALLDB_LISTcxx . . $ `d868uv.c:72:9`! 0x04000000 // Map of callsign database |
| 73 |
#define ADDR_CONT_ID_LISTcxx . . $ `d868uv.c:73:9`! 0x04280000 // Map of contact IDs to contacts |
| 74 |
#define ADDR_CALLDB_SIZEcxx . . $ `d868uv.c:74:9`! 0x044c0000 // Sizes of callsign database |
| 75 |
#define ADDR_CALLDB_DATAcxx . . $ `d868uv.c:75:9`! 0x04500000 // Data of callsign database |
| 76 |
|
| 77 |
#define GET_SETTINGScxx . . $ `d868uv.c:77:9`!() ((general_settings_t*) &radio_mem[OFFSET_SETTINGScxx . . $ `d868uv.c:59:9`!]) |
| 78 |
#define GET_RADIOIDcxx . . $ `d868uv.c:78:9`!() ((radioid_t*) &radio_mem[OFFSET_RADIOIDcxx . . $ `d868uv.c:63:9`!]) |
| 79 |
#define GET_ZONEMAPcxx . . $ `d868uv.c:79:9`!() (&radio_mem[OFFSET_ZONE_MAPcxx . . $ `d868uv.c:56:9`!]) |
| 80 |
#define GET_CONTACT_MAPcxx . . $ `d868uv.c:80:9`!() (&radio_mem[OFFSET_CONTACT_MAPcxx . . $ `d868uv.c:65:9`!]) |
| 81 |
#define GET_CONTACT_LISTcxx . . $ `d868uv.c:81:9`!() ((uint32_t*) &radio_mem[OFFSET_CONTACT_LISTcxx . . $ `d868uv.c:64:9`!]) |
| 82 |
#define GET_SCANL_MAPcxx . . $ `d868uv.c:82:9`!() (&radio_mem[OFFSET_SCANL_MAPcxx . . $ `d868uv.c:57:9`!]) |
| 83 |
#define GET_ZONENAMEcxx . . $ `d868uv.c:83:9`!(i) (&radio_mem[OFFSET_ZONENAMEScxx . . $ `d868uv.c:62:9`! + (i)*32]) |
| 84 |
#define GET_ZONE_CHAN_Acxx . . $ `d868uv.c:84:9`!(i) ((i) + (uint16_t*) &radio_mem[OFFSET_ZCHAN_Acxx . . $ `d868uv.c:60:9`!]) |
| 85 |
#define GET_ZONE_CHAN_Bcxx . . $ `d868uv.c:85:9`!(i) ((i) + (uint16_t*) &radio_mem[OFFSET_ZCHAN_Bcxx . . $ `d868uv.c:61:9`!]) |
| 86 |
#define GET_ZONELISTcxx . . $ `d868uv.c:86:9`!(i) ((uint16_t*) &radio_mem[OFFSET_ZONELISTScxx . . $ `d868uv.c:53:9`! + (i)*512]) |
| 87 |
#define GET_CONTACTcxx . . $ `d868uv.c:87:9`!(i) ((contact_t*) &radio_mem[OFFSET_CONTACTScxx . . $ `d868uv.c:66:9`! + (i)*100]) |
| 88 |
#define GET_GROUPLISTcxx . . $ `d868uv.c:88:9`!(i) ((grouplist_t*) &radio_mem[OFFSET_GLISTScxx . . $ `d868uv.c:67:9`! + (i)*320]) |
| 89 |
#define GET_SCANLISTcxx . . $ `d868uv.c:89:9`!(i) ((scanlist_t*) &radio_mem[OFFSET_SCANLISTScxx . . $ `d868uv.c:54:9`! + (i)*192]) |
| 90 |
#define GET_MESSAGEcxx . . $ `d868uv.c:90:9`!(i) ((uint8_t*) &radio_mem[OFFSET_MESSAGEScxx . . $ `d868uv.c:55:9`! + (i)*256]) |
| 91 |
|
| 92 |
#define VALID_TEXTcxx . . $ `d868uv.c:92:9`!(txt) (*(txt) != 0 && *(txt) != 0xff) |
| 93 |
#define VALID_GROUPLISTcxx . . $ `d868uv.c:93:9`!(gl) ((gl)->member[0] != 0xffffffff && VALID_TEXTcxx . . $ `d868uv.c:92:9`!((gl)->name)) |
| 94 |
|
| 95 |
// |
| 96 |
// Size of memory image. |
| 97 |
// Essentialy a sum of all fragments defined ind868um-map.h. |
| 98 |
// |
| 99 |
#define MEMSZcxx . . $ `d868uv.c:99:9`! 1606528 |
| 100 |
|
| 101 |
// |
| 102 |
// D868UV radio has a huge internal address space, more than 64 Mbytes. |
| 103 |
// The configuration data are dispersed over this space. |
| 104 |
// Here is a table of fragments: starting address and length. |
| 105 |
// We read these fragments and save them into a file continuously. |
| 106 |
// |
| 107 |
typedef structcxx . . $ $anonymous_type_a44f2f0574113d8d_0# { |
| 108 |
unsigned addresscxx . . $ $anonymous_type_a44f2f0574113d8d_0#address.; |
| 109 |
unsigned lengthcxx . . $ $anonymous_type_a44f2f0574113d8d_0#length.; |
| 110 |
unsigned offsetcxx . . $ $anonymous_type_a44f2f0574113d8d_0#offset.; |
| 111 |
} fragment_tcxx . . $ fragment_t#; |
| 112 |
|
| 113 |
static fragment_tcxx . . $ fragment_t# region_mapcxx . . $ region_map.[] = { |
| 114 |
#include "d868uv-map.h"cxx . . $ `<file>/d868uv-map.h`/ |
| 115 |
}; |
| 116 |
|
| 117 |
// |
| 118 |
// Channel data. |
| 119 |
// |
| 120 |
typedef structcxx . . $ $anonymous_type_a44f2f0574113d8d_1# { |
| 121 |
|
| 122 |
// Bytes 0-7 |
| 123 |
uint32_tcxx . . $ uint32_t# rx_frequencycxx . . $ $anonymous_type_a44f2f0574113d8d_1#rx_frequency.; // RX Frequency: 8 digits BCD |
| 124 |
uint32_tcxx . . $ uint32_t# tx_offsetcxx . . $ $anonymous_type_a44f2f0574113d8d_1#tx_offset.; // TX Offset: 8 digits BCD |
| 125 |
|
| 126 |
// Byte 8 |
| 127 |
uint8_tcxx . . $ uint8_t# channel_modecxx . . $ $anonymous_type_a44f2f0574113d8d_1#channel_mode. : 2, // Mode: Analog or Digital |
| 128 |
#define MODE_ANALOGcxx . . $ `d868uv.c:128:9`! 0 // Analog |
| 129 |
#define MODE_DIGITALcxx . . $ `d868uv.c:129:9`! 1 // Digital |
| 130 |
#define MODE_A_Dcxx . . $ `d868uv.c:130:9`! 2 // A+D, transmit analog |
| 131 |
#define MODE_D_Acxx . . $ `d868uv.c:131:9`! 3 // D+A, transmit digital |
| 132 |
|
| 133 |
powercxx . . $ $anonymous_type_a44f2f0574113d8d_1#power. : 2, // Power: Low, Middle, High, Turbo |
| 134 |
#define POWER_LOWcxx . . $ `d868uv.c:134:9`! 0 |
| 135 |
#define POWER_MIDDLEcxx . . $ `d868uv.c:135:9`! 1 |
| 136 |
#define POWER_HIGHcxx . . $ `d868uv.c:136:9`! 2 |
| 137 |
#define POWER_TURBOcxx . . $ `d868uv.c:137:9`! 3 |
| 138 |
|
| 139 |
bandwidthcxx . . $ $anonymous_type_a44f2f0574113d8d_1#bandwidth. : 1, // Bandwidth: 12.5 or 25 kHz |
| 140 |
#define BW_12_5_KHZcxx . . $ `d868uv.c:140:9`! 0 |
| 141 |
#define BW_25_KHZcxx . . $ `d868uv.c:141:9`! 1 |
| 142 |
|
| 143 |
_unused8cxx . . $ $anonymous_type_a44f2f0574113d8d_1#_unused8. : 1, // 0 |
| 144 |
repeater_modecxx . . $ $anonymous_type_a44f2f0574113d8d_1#repeater_mode. : 2; // Sign of TX frequency offset |
| 145 |
#define RM_SIMPLEXcxx . . $ `d868uv.c:145:9`! 0 // TX frequency = RX frequency |
| 146 |
#define RM_TXPOScxx . . $ `d868uv.c:146:9`! 1 // Positive TX offset |
| 147 |
#define RM_TXNEGcxx . . $ `d868uv.c:147:9`! 2 // Negative TX offset |
| 148 |
|
| 149 |
// Byte 9 |
| 150 |
uint8_tcxx . . $ uint8_t# rx_ctcsscxx . . $ $anonymous_type_a44f2f0574113d8d_1#rx_ctcss. : 1, // CTCSS Decode |
| 151 |
rx_dcscxx . . $ $anonymous_type_a44f2f0574113d8d_1#rx_dcs. : 1, // DCS Decode |
| 152 |
tx_ctcsscxx . . $ $anonymous_type_a44f2f0574113d8d_1#tx_ctcss. : 1, // CTCSS Encode |
| 153 |
tx_dcscxx . . $ $anonymous_type_a44f2f0574113d8d_1#tx_dcs. : 1, // DCS Encode |
| 154 |
reversecxx . . $ $anonymous_type_a44f2f0574113d8d_1#reverse. : 1, // Reverse |
| 155 |
rx_onlycxx . . $ $anonymous_type_a44f2f0574113d8d_1#rx_only. : 1, // TX Prohibit |
| 156 |
call_confirmcxx . . $ $anonymous_type_a44f2f0574113d8d_1#call_confirm. : 1, // Call Confirmation |
| 157 |
talkaroundcxx . . $ $anonymous_type_a44f2f0574113d8d_1#talkaround. : 1; // Talk Around |
| 158 |
|
| 159 |
// Bytes 10-15 |
| 160 |
uint8_tcxx . . $ uint8_t# ctcss_transmitcxx . . $ $anonymous_type_a44f2f0574113d8d_1#ctcss_transmit.; // CTCSS Encode: 0=62.5, 50=254.1, 51=Define |
| 161 |
uint8_tcxx . . $ uint8_t# ctcss_receivecxx . . $ $anonymous_type_a44f2f0574113d8d_1#ctcss_receive.; // CTCSS Decode: 0=62.5, 50=254.1, 51=Define |
| 162 |
uint16_tcxx . . $ uint16_t# dcs_transmitcxx . . $ $anonymous_type_a44f2f0574113d8d_1#dcs_transmit.; // DCS Encode: 0=D000N, 17=D021N, 1023=D777I |
| 163 |
uint16_tcxx . . $ uint16_t# dcs_receivecxx . . $ $anonymous_type_a44f2f0574113d8d_1#dcs_receive.; // DCS Decode: 0=D000N, 17=D021N, 1023=D777I |
| 164 |
|
| 165 |
// Bytes 16-19 |
| 166 |
uint16_tcxx . . $ uint16_t# custom_ctcsscxx . . $ $anonymous_type_a44f2f0574113d8d_1#custom_ctcss.; // 0x09cf=251.1, 0x0a28=260 |
| 167 |
uint8_tcxx . . $ uint8_t# tone2_decodecxx . . $ $anonymous_type_a44f2f0574113d8d_1#tone2_decode.; // 2Tone Decode: 0x00=1, 0x0f=16 |
| 168 |
uint8_tcxx . . $ uint8_t# _unused19cxx . . $ $anonymous_type_a44f2f0574113d8d_1#_unused19.; // 0 |
| 169 |
|
| 170 |
// Bytes 20-23 |
| 171 |
uint16_tcxx . . $ uint16_t# contact_indexcxx . . $ $anonymous_type_a44f2f0574113d8d_1#contact_index.; // Contact: 0=Contact1, 1=Contact2, ... |
| 172 |
uint16_tcxx . . $ uint16_t# _unused22cxx . . $ $anonymous_type_a44f2f0574113d8d_1#_unused22.; // 0 |
| 173 |
|
| 174 |
// Byte 24 |
| 175 |
uint8_tcxx . . $ uint8_t# id_indexcxx . . $ $anonymous_type_a44f2f0574113d8d_1#id_index.; // Index in Radio ID table |
| 176 |
|
| 177 |
// Byte 25 |
| 178 |
uint8_tcxx . . $ uint8_t# ptt_idcxx . . $ $anonymous_type_a44f2f0574113d8d_1#ptt_id. : 2, // PTT ID |
| 179 |
#define PTTID_OFFcxx . . $ `d868uv.c:179:9`! 0 |
| 180 |
#define PTTID_STARTcxx . . $ `d868uv.c:180:9`! 1 |
| 181 |
#define PTTID_ENDcxx . . $ `d868uv.c:181:9`! 2 |
| 182 |
#define PTTID_START_ENDcxx . . $ `d868uv.c:182:9`! 3 |
| 183 |
|
| 184 |
_unused25_1cxx . . $ $anonymous_type_a44f2f0574113d8d_1#_unused25_1. : 2, // 0 |
| 185 |
|
| 186 |
squelch_modecxx . . $ $anonymous_type_a44f2f0574113d8d_1#squelch_mode. : 1, // Squelch Mode |
| 187 |
#define SQ_CARRIERcxx . . $ `d868uv.c:187:9`! 0 // Carrier |
| 188 |
#define SQ_TONEcxx . . $ `d868uv.c:188:9`! 1 // CTCSS/DCS |
| 189 |
|
| 190 |
_unused25_2cxx . . $ $anonymous_type_a44f2f0574113d8d_1#_unused25_2. : 3; // 0 |
| 191 |
|
| 192 |
// Byte 26 |
| 193 |
uint8_tcxx . . $ uint8_t# tx_permitcxx . . $ $anonymous_type_a44f2f0574113d8d_1#tx_permit. : 2, // TX Permit |
| 194 |
#define PERMIT_ALWAYScxx . . $ `d868uv.c:194:9`! 0 // Always |
| 195 |
#define PERMIT_CH_FREEcxx . . $ `d868uv.c:195:9`! 1 // Channel Free |
| 196 |
#define PERMIT_CC_DIFFcxx . . $ `d868uv.c:196:9`! 2 // Different Color Code |
| 197 |
#define PERMIT_CC_SAMEcxx . . $ `d868uv.c:197:9`! 3 // Same Color Code |
| 198 |
|
| 199 |
_unused26_1cxx . . $ $anonymous_type_a44f2f0574113d8d_1#_unused26_1. : 2, // 0 |
| 200 |
|
| 201 |
_opt_signalcxx . . $ $anonymous_type_a44f2f0574113d8d_1#_opt_signal. : 2, // Optional Signal |
| 202 |
#define OPTSIG_OFFcxx . . $ `d868uv.c:202:9`! 0 // Off |
| 203 |
#define OPTSIG_DTMFcxx . . $ `d868uv.c:203:9`! 1 // DTMF |
| 204 |
#define OPTSIG_2TONEcxx . . $ `d868uv.c:204:9`! 2 // 2Tone |
| 205 |
#define OPTSIG_5TONEcxx . . $ `d868uv.c:205:9`! 3 // 5Tone |
| 206 |
|
| 207 |
_unused26_2cxx . . $ $anonymous_type_a44f2f0574113d8d_1#_unused26_2. : 2; // 0 |
| 208 |
|
| 209 |
// Bytes 27-31 |
| 210 |
uint8_tcxx . . $ uint8_t# scan_list_indexcxx . . $ $anonymous_type_a44f2f0574113d8d_1#scan_list_index.; // Scan List: 0xff=None, 0=ScanList1... |
| 211 |
uint8_tcxx . . $ uint8_t# group_list_indexcxx . . $ $anonymous_type_a44f2f0574113d8d_1#group_list_index.; // Receive Group List: 0xff=None, 0=GroupList1... |
| 212 |
uint8_tcxx . . $ uint8_t# id_2tonecxx . . $ $anonymous_type_a44f2f0574113d8d_1#id_2tone.; // 2Tone ID: 0=1, 0x17=24 |
| 213 |
uint8_tcxx . . $ uint8_t# id_5tonecxx . . $ $anonymous_type_a44f2f0574113d8d_1#id_5tone.; // 5Tone ID: 0=1, 0x63=100 |
| 214 |
uint8_tcxx . . $ uint8_t# id_dtmfcxx . . $ $anonymous_type_a44f2f0574113d8d_1#id_dtmf.; // DTMF ID: 0=1, 0x0f=16 |
| 215 |
|
| 216 |
// Byte 32 |
| 217 |
uint8_tcxx . . $ uint8_t# color_codecxx . . $ $anonymous_type_a44f2f0574113d8d_1#color_code.; // Color Code: 0-15 |
| 218 |
|
| 219 |
// Byte 33 |
| 220 |
uint8_tcxx . . $ uint8_t# slot2cxx . . $ $anonymous_type_a44f2f0574113d8d_1#slot2. : 1, // Slot: Slot2 |
| 221 |
_unused33_1cxx . . $ $anonymous_type_a44f2f0574113d8d_1#_unused33_1. : 1, // 0 |
| 222 |
simplex_tdmacxx . . $ $anonymous_type_a44f2f0574113d8d_1#simplex_tdma. : 1, // Simplex TDMA: On |
| 223 |
_unused33_2cxx . . $ $anonymous_type_a44f2f0574113d8d_1#_unused33_2. : 1, // 0 |
| 224 |
tdma_adaptivecxx . . $ $anonymous_type_a44f2f0574113d8d_1#tdma_adaptive. : 1, // TDMA Adaptive: On |
| 225 |
_unused33_3cxx . . $ $anonymous_type_a44f2f0574113d8d_1#_unused33_3. : 1, // 0 |
| 226 |
enh_encryptioncxx . . $ $anonymous_type_a44f2f0574113d8d_1#enh_encryption. : 1, // Encryption Type: Enhanced Encryption |
| 227 |
work_alonecxx . . $ $anonymous_type_a44f2f0574113d8d_1#work_alone. : 1; // Work Alone: On |
| 228 |
|
| 229 |
// Byte 34 |
| 230 |
uint8_tcxx . . $ uint8_t# encryptioncxx . . $ $anonymous_type_a44f2f0574113d8d_1#encryption.; // Digital Encryption: 1-32, 0=Off |
| 231 |
|
| 232 |
// Bytes 35-51 |
| 233 |
uint8_tcxx . . $ uint8_t# namecxx . . $ $anonymous_type_a44f2f0574113d8d_1#name.[16]; // Channel Name, zero filled |
| 234 |
uint8_tcxx . . $ uint8_t# _unused51cxx . . $ $anonymous_type_a44f2f0574113d8d_1#_unused51.; // 0 |
| 235 |
|
| 236 |
// Byte 52 |
| 237 |
uint8_tcxx . . $ uint8_t# rangingcxx . . $ $anonymous_type_a44f2f0574113d8d_1#ranging. : 1, // Ranging: On |
| 238 |
through_modecxx . . $ $anonymous_type_a44f2f0574113d8d_1#through_mode. : 1, // Through Mode: On |
| 239 |
_unused52cxx . . $ $anonymous_type_a44f2f0574113d8d_1#_unused52. : 6; // 0 |
| 240 |
|
| 241 |
// Byte 53 |
| 242 |
uint8_tcxx . . $ uint8_t# aprs_reportcxx . . $ $anonymous_type_a44f2f0574113d8d_1#aprs_report. : 1, // APRS Report: On |
| 243 |
_unused53cxx . . $ $anonymous_type_a44f2f0574113d8d_1#_unused53. : 7; // 0 |
| 244 |
|
| 245 |
// Bytes 54-63 |
| 246 |
uint8_tcxx . . $ uint8_t# aprs_channelcxx . . $ $anonymous_type_a44f2f0574113d8d_1#aprs_channel.; // APRS Report Channel: 0x00=1, ... 0x07=8 |
| 247 |
uint8_tcxx . . $ uint8_t# _unused55cxx . . $ $anonymous_type_a44f2f0574113d8d_1#_unused55.[9]; // 0 |
| 248 |
} channel_tcxx . . $ channel_t#; |
| 249 |
|
| 250 |
// |
| 251 |
// General settings: 0x640 bytes at 0x02500000. |
| 252 |
// |
| 253 |
typedef structcxx . . $ $anonymous_type_a44f2f0574113d8d_2# { |
| 254 |
|
| 255 |
// Bytes 0-5. |
| 256 |
uint8_tcxx . . $ uint8_t# _unused0cxx . . $ $anonymous_type_a44f2f0574113d8d_2#_unused0.[6]; |
| 257 |
|
| 258 |
// Bytes 6-7. |
| 259 |
uint8_tcxx . . $ uint8_t# power_oncxx . . $ $anonymous_type_a44f2f0574113d8d_2#power_on.; // Power-on Interface |
| 260 |
#define PWON_DEFAULTcxx . . $ `d868uv.c:260:9`! 0 // Default |
| 261 |
#define PWON_CUST_CHARcxx . . $ `d868uv.c:261:9`! 1 // Custom Char |
| 262 |
#define PWON_CUST_PICTcxx . . $ `d868uv.c:262:9`! 2 // Custom Picture |
| 263 |
|
| 264 |
uint8_tcxx . . $ uint8_t# _unused7cxx . . $ $anonymous_type_a44f2f0574113d8d_2#_unused7.; |
| 265 |
|
| 266 |
// Bytes 8-0x5ff. |
| 267 |
uint8_tcxx . . $ uint8_t# _unused8cxx . . $ $anonymous_type_a44f2f0574113d8d_2#_unused8.[0x5f8]; |
| 268 |
|
| 269 |
// Bytes 0x600-0x61f |
| 270 |
uint8_tcxx . . $ uint8_t# intro_line1cxx . . $ $anonymous_type_a44f2f0574113d8d_2#intro_line1.[16]; // Up to 14 characters |
| 271 |
uint8_tcxx . . $ uint8_t# intro_line2cxx . . $ $anonymous_type_a44f2f0574113d8d_2#intro_line2.[16]; // Up to 14 characters |
| 272 |
|
| 273 |
// Bytes 0x620-0x63f |
| 274 |
uint8_tcxx . . $ uint8_t# passwordcxx . . $ $anonymous_type_a44f2f0574113d8d_2#password.[16]; // Up to 8 ascii digits |
| 275 |
uint8_tcxx . . $ uint8_t# _unused630cxx . . $ $anonymous_type_a44f2f0574113d8d_2#_unused630.[16]; // 0xff |
| 276 |
|
| 277 |
} general_settings_tcxx . . $ general_settings_t#; |
| 278 |
|
| 279 |
// |
| 280 |
// Radio ID table: 250 entries, 0x1f40 bytes at 0x02580000. |
| 281 |
// |
| 282 |
typedef structcxx . . $ $anonymous_type_a44f2f0574113d8d_3# { |
| 283 |
|
| 284 |
// Bytes 0-3. |
| 285 |
uint8_tcxx . . $ uint8_t# idcxx . . $ $anonymous_type_a44f2f0574113d8d_3#id.[4]; // Up to 8 BCD digits |
| 286 |
#define GET_IDcxx . . $ `d868uv.c:286:9`!(x) (((x)[0] >> 4) * 10000000 +\ |
| 287 |
((x)[0] & 15) * 1000000 +\ |
| 288 |
((x)[1] >> 4) * 100000 +\ |
| 289 |
((x)[1] & 15) * 10000 +\ |
| 290 |
((x)[2] >> 4) * 1000 +\ |
| 291 |
((x)[2] & 15) * 100 +\ |
| 292 |
((x)[3] >> 4) * 10 +\ |
| 293 |
((x)[3] & 15)) |
| 294 |
// Byte 4. |
| 295 |
uint8_tcxx . . $ uint8_t# _unused4cxx . . $ $anonymous_type_a44f2f0574113d8d_3#_unused4.; // 0 |
| 296 |
|
| 297 |
// Bytes 5-20 |
| 298 |
uint8_tcxx . . $ uint8_t# namecxx . . $ $anonymous_type_a44f2f0574113d8d_3#name.[16]; // Name |
| 299 |
|
| 300 |
// Bytes 21-31 |
| 301 |
uint8_tcxx . . $ uint8_t# _unused21cxx . . $ $anonymous_type_a44f2f0574113d8d_3#_unused21.[11]; // 0 |
| 302 |
|
| 303 |
} radioid_tcxx . . $ radioid_t#; |
| 304 |
|
| 305 |
// |
| 306 |
// Contact data: 100 bytes per record. |
| 307 |
// |
| 308 |
typedef structcxx . . $ $anonymous_type_a44f2f0574113d8d_4# { |
| 309 |
|
| 310 |
// Byte 0 |
| 311 |
uint8_tcxx . . $ uint8_t# typecxx . . $ $anonymous_type_a44f2f0574113d8d_4#type.; // Call Type: Group Call, Private Call or All Call |
| 312 |
#define CALL_PRIVATEcxx . . $ `d868uv.c:312:9`! 0 |
| 313 |
#define CALL_GROUPcxx . . $ `d868uv.c:313:9`! 1 |
| 314 |
#define CALL_ALLcxx . . $ `d868uv.c:314:9`! 2 |
| 315 |
|
| 316 |
// Bytes 1-16 |
| 317 |
uint8_tcxx . . $ uint8_t# namecxx . . $ $anonymous_type_a44f2f0574113d8d_4#name.[16]; // Contact Name (ASCII) |
| 318 |
|
| 319 |
// Bytes 17-34 |
| 320 |
uint8_tcxx . . $ uint8_t# _unused17cxx . . $ $anonymous_type_a44f2f0574113d8d_4#_unused17.[18]; // 0 |
| 321 |
|
| 322 |
// Bytes 35-38 |
| 323 |
uint8_tcxx . . $ uint8_t# idcxx . . $ $anonymous_type_a44f2f0574113d8d_4#id.[4]; // Call ID: BCD coded 8 digits |
| 324 |
#define CONTACT_IDcxx . . $ `d868uv.c:324:9`!(ct) GET_IDcxx . . $ `d868uv.c:286:9`!((ct)->id) |
| 325 |
|
| 326 |
// Byte 39 |
| 327 |
uint8_tcxx . . $ uint8_t# call_alertcxx . . $ $anonymous_type_a44f2f0574113d8d_4#call_alert.; // Call Alert: None, Ring, Online Alert |
| 328 |
#define ALERT_NONEcxx . . $ `d868uv.c:328:9`! 0 |
| 329 |
#define ALERT_RINGcxx . . $ `d868uv.c:329:9`! 1 |
| 330 |
#define ALERT_ONLINEcxx . . $ `d868uv.c:330:9`! 2 |
| 331 |
|
| 332 |
// Bytes 40-99 |
| 333 |
uint8_tcxx . . $ uint8_t# _unused40cxx . . $ $anonymous_type_a44f2f0574113d8d_4#_unused40.[60]; // 0 |
| 334 |
|
| 335 |
} contact_tcxx . . $ contact_t#; |
| 336 |
|
| 337 |
// |
| 338 |
// Group list data. |
| 339 |
// |
| 340 |
typedef structcxx . . $ $anonymous_type_a44f2f0574113d8d_5# { |
| 341 |
|
| 342 |
// Bytes 0-255 |
| 343 |
uint32_tcxx . . $ uint32_t# membercxx . . $ $anonymous_type_a44f2f0574113d8d_5#member.[64]; // Contacts: 0=Contact1, 0xffffffff=Empty |
| 344 |
|
| 345 |
// Bytes 256-319 |
| 346 |
uint8_tcxx . . $ uint8_t# namecxx . . $ $anonymous_type_a44f2f0574113d8d_5#name.[35]; // Group List Name (ASCII) |
| 347 |
uint8_tcxx . . $ uint8_t# unusedcxx . . $ $anonymous_type_a44f2f0574113d8d_5#unused.[29]; // 0 |
| 348 |
|
| 349 |
} grouplist_tcxx . . $ grouplist_t#; |
| 350 |
|
| 351 |
// |
| 352 |
// Scan list data: 192 bytes. |
| 353 |
// |
| 354 |
typedef structcxx . . $ $anonymous_type_a44f2f0574113d8d_6# { |
| 355 |
|
| 356 |
// Bytes 0-1 |
| 357 |
uint8_tcxx . . $ uint8_t# _unused0cxx . . $ $anonymous_type_a44f2f0574113d8d_6#_unused0.; // 0 |
| 358 |
uint8_tcxx . . $ uint8_t# prio_ch_selectcxx . . $ $anonymous_type_a44f2f0574113d8d_6#prio_ch_select.; // Priority Channel Select |
| 359 |
#define PRIO_CHAN_OFFcxx . . $ `d868uv.c:359:9`! 0 // Off |
| 360 |
#define PRIO_CHAN_SEL1cxx . . $ `d868uv.c:360:9`! 1 // Priority Channel Select1 |
| 361 |
#define PRIO_CHAN_SEL2cxx . . $ `d868uv.c:361:9`! 2 // Priority Channel Select2 |
| 362 |
#define PRIO_CHAN_SEL12cxx . . $ `d868uv.c:362:9`! 3 // Priority Channel Select1 + Priority Channel Select2 |
| 363 |
|
| 364 |
// Bytes 2-5 |
| 365 |
uint16_tcxx . . $ uint16_t# priority_ch1cxx . . $ $anonymous_type_a44f2f0574113d8d_6#priority_ch1.; // Priority Channel 1: 0=Current Channel, 0xffff=Off |
| 366 |
uint16_tcxx . . $ uint16_t# priority_ch2cxx . . $ $anonymous_type_a44f2f0574113d8d_6#priority_ch2.; // Priority Channel 2: 0=Current Channel, 0xffff=Off |
| 367 |
|
| 368 |
// Bytes 6-13 |
| 369 |
uint16_tcxx . . $ uint16_t# look_back_acxx . . $ $anonymous_type_a44f2f0574113d8d_6#look_back_a.; // Look Back Time A, sec*10 |
| 370 |
uint16_tcxx . . $ uint16_t# look_back_bcxx . . $ $anonymous_type_a44f2f0574113d8d_6#look_back_b.; // Look Back Time B, sec*10 |
| 371 |
uint16_tcxx . . $ uint16_t# dropout_delaycxx . . $ $anonymous_type_a44f2f0574113d8d_6#dropout_delay.; // Dropout Delay Time, sec*10 |
| 372 |
uint16_tcxx . . $ uint16_t# dwellcxx . . $ $anonymous_type_a44f2f0574113d8d_6#dwell.; // Dwell Time, sec*10 |
| 373 |
|
| 374 |
// Byte 14 |
| 375 |
uint8_tcxx . . $ uint8_t# revert_channelcxx . . $ $anonymous_type_a44f2f0574113d8d_6#revert_channel.; // Revert Channel |
| 376 |
#define REVCH_SELECTEDcxx . . $ `d868uv.c:376:9`! 0 // Selected |
| 377 |
#define REVCH_SEL_TBcxx . . $ `d868uv.c:377:9`! 1 // Selected + TalkBack |
| 378 |
#define REVCH_PRIO_CH1cxx . . $ `d868uv.c:378:9`! 2 // Priority Channel Select1 |
| 379 |
#define REVCH_PRIO_CH2cxx . . $ `d868uv.c:379:9`! 3 // Priority Channel Select2 |
| 380 |
#define REVCH_LAST_CALLEDcxx . . $ `d868uv.c:380:9`! 4 // Last Called |
| 381 |
#define REVCH_LAST_USEDcxx . . $ `d868uv.c:381:9`! 5 // Last Used |
| 382 |
#define REVCH_PRIO_CH1_TBcxx . . $ `d868uv.c:382:9`! 6 // Priority Channel Select1 + TalkBack |
| 383 |
#define REVCH_PRIO_CH2_TBcxx . . $ `d868uv.c:383:9`! 7 // Priority Channel Select2 + TalkBack |
| 384 |
|
| 385 |
// Bytes 15-31 |
| 386 |
uint8_tcxx . . $ uint8_t# namecxx . . $ $anonymous_type_a44f2f0574113d8d_6#name.[16]; // Scan List Name (ASCII) |
| 387 |
uint8_tcxx . . $ uint8_t# _unused31cxx . . $ $anonymous_type_a44f2f0574113d8d_6#_unused31.; // 0 |
| 388 |
|
| 389 |
// Bytes 32-131 |
| 390 |
uint16_tcxx . . $ uint16_t# membercxx . . $ $anonymous_type_a44f2f0574113d8d_6#member.[50]; // Channels, 0xffff=empty |
| 391 |
|
| 392 |
// Bytes 132-191 |
| 393 |
uint8_tcxx . . $ uint8_t# _unused132cxx . . $ $anonymous_type_a44f2f0574113d8d_6#_unused132.[60]; // 0 |
| 394 |
|
| 395 |
} scanlist_tcxx . . $ scanlist_t#; |
| 396 |
|
| 397 |
// |
| 398 |
// Entry of callsign map: 8 bytes. |
| 399 |
// |
| 400 |
typedef structcxx . . $ $anonymous_type_a44f2f0574113d8d_7# { |
| 401 |
uint32_tcxx . . $ uint32_t# idcxx . . $ $anonymous_type_a44f2f0574113d8d_7#id.; // DMR ID |
| 402 |
uint32_tcxx . . $ uint32_t# offsetcxx . . $ $anonymous_type_a44f2f0574113d8d_7#offset.; // Offset in the callsign data blob |
| 403 |
} callsign_map_tcxx . . $ callsign_map_t#; |
| 404 |
|
| 405 |
// |
| 406 |
// Sizes of callsign database. |
| 407 |
// |
| 408 |
typedef structcxx . . $ $anonymous_type_a44f2f0574113d8d_8# { |
| 409 |
uint32_tcxx . . $ uint32_t# countcxx . . $ $anonymous_type_a44f2f0574113d8d_8#count.; // Number of records |
| 410 |
uint32_tcxx . . $ uint32_t# lastcxx . . $ $anonymous_type_a44f2f0574113d8d_8#last.; // Last address of data blob |
| 411 |
uint32_tcxx . . $ uint32_t# _unused3cxx . . $ $anonymous_type_a44f2f0574113d8d_8#_unused3.; |
| 412 |
uint32_tcxx . . $ uint32_t# _unused4cxx . . $ $anonymous_type_a44f2f0574113d8d_8#_unused4.; |
| 413 |
} callsign_sizes_tcxx . . $ callsign_sizes_t#; |
| 414 |
|
| 415 |
static const char *POWER_NAMEcxx . . $ POWER_NAME.[] = { "Low", "Mid", "High", "Turbo" }; |
| 416 |
static const char *DIGITAL_ADMIT_NAMEcxx . . $ DIGITAL_ADMIT_NAME.[] = { "-", "Free", "NColor", "Color" }; |
| 417 |
static const char *ANALOG_ADMIT_NAMEcxx . . $ ANALOG_ADMIT_NAME.[] = { "-", "Free", "Tone", "Tone" }; |
| 418 |
static const char *BANDWIDTHcxx . . $ BANDWIDTH.[] = { "12.5", "25" }; |
| 419 |
static const char *CONTACT_TYPEcxx . . $ CONTACT_TYPE.[] = { "Private", "Group", "All", "Unknown" }; |
| 420 |
static const char *ALERT_TYPEcxx . . $ ALERT_TYPE.[] = { "-", "+", "Online", "Unknown" }; |
| 421 |
|
| 422 |
// |
| 423 |
// CTCSS tones, Hz*10. |
| 424 |
// |
| 425 |
#define NCTCSScxx . . $ `d868uv.c:425:9`! 51 |
| 426 |
|
| 427 |
static const int CTCSS_TONEScxx . . $ CTCSS_TONES.[NCTCSScxx . . $ `d868uv.c:425:9`!] = { |
| 428 |
625, 670, 693, 719, 744, 770, 797, 825, 854, 885, |
| 429 |
915, 948, 974, 1000, 1035, 1072, 1109, 1148, 1188, 1230, |
| 430 |
1273, 1318, 1365, 1413, 1462, 1514, 1567, 1598, 1622, 1655, |
| 431 |
1679, 1713, 1738, 1773, 1799, 1835, 1862, 1899, 1928, 1966, |
| 432 |
1995, 2035, 2065, 2107, 2181, 2257, 2291, 2336, 2418, 2503, |
| 433 |
2541, |
| 434 |
}; |
| 435 |
|
| 436 |
// |
| 437 |
// Print a generic information about the device. |
| 438 |
// |
| 439 |
static void d868uv_print_versioncxx . . $ d868uv_print_version(7777599da18afe85).(radio_device_tcxx . . $ radio_device_t# *radio, FILEcxx . . $ FILE# *out) |
| 440 |
{ |
| 441 |
// Empty. |
| 442 |
} |
| 443 |
|
| 444 |
// |
| 445 |
// Return true when the specified region has to be skipped. |
| 446 |
// Skip unused channels, contacts, zones and scanlists. |
| 447 |
// |
| 448 |
static int skip_regioncxx . . $ skip_region(c76a8476b1034cfd).(unsigned addr, unsigned file_offset, uint8_tcxx . . $ uint8_t# *mem, unsigned nbytes) |
| 449 |
{ |
| 450 |
int index; |
| 451 |
|
| 452 |
// Channels. |
| 453 |
if (addr >= 0x00800000 && addr < 0x01000000) { |
| 454 |
index = (file_offset - OFFSET_BANK1cxx . . $ `d868uv.c:52:9`!) / 64; |
| 455 |
if (index < NCHANcxx . . $ `d868uv.c:40:9`!) { |
| 456 |
uint8_tcxx . . $ uint8_t# *bitmap = &radio_memcxx . . $ radio_mem.[OFFSET_CHAN_MAPcxx . . $ `d868uv.c:58:9`!]; |
| 457 |
|
| 458 |
if ((bitmap[index / 8] >> (index & 7)) & 1) { |
| 459 |
// Channel is valid, don't skip. |
| 460 |
return 0; |
| 461 |
} |
| 462 |
|
| 463 |
// Invalid channel: skip it, erase data. |
| 464 |
if (mem) { |
| 465 |
memsetcxx . . $ memset(d1de1e4fb215f1c6).(mem, 0xff, nbytes); |
| 466 |
} |
| 467 |
return 1; |
| 468 |
} |
| 469 |
} |
| 470 |
|
| 471 |
// Contacts. |
| 472 |
if (addr >= 0x02680000 && addr < 0x02900000) { |
| 473 |
index = (file_offset - OFFSET_CONTACTScxx . . $ `d868uv.c:66:9`!) / 100; |
| 474 |
if (index < NCONTACTScxx . . $ `d868uv.c:41:9`!) { |
| 475 |
uint8_tcxx . . $ uint8_t# *cmap = GET_CONTACT_MAPcxx . . $ `d868uv.c:80:9`!(); |
| 476 |
|
| 477 |
if ((cmap[index / 8] >> (index & 7)) & 1) { |
| 478 |
// Invalid contact: skip it, erase data. |
| 479 |
if (mem) { |
| 480 |
memsetcxx . . $ memset(d1de1e4fb215f1c6).(mem, 0xff, nbytes); |
| 481 |
} |
| 482 |
return 1; |
| 483 |
} |
| 484 |
|
| 485 |
// Contact is valid, don't skip. |
| 486 |
return 0; |
| 487 |
} |
| 488 |
} |
| 489 |
|
| 490 |
// Zones. |
| 491 |
if (addr >= 0x01000000 && addr < 0x01080000) { |
| 492 |
index = (file_offset - OFFSET_ZONELISTScxx . . $ `d868uv.c:53:9`!) / 512; |
| 493 |
if (index < NZONEScxx . . $ `d868uv.c:42:9`!) { |
| 494 |
uint8_tcxx . . $ uint8_t# *zmap = GET_ZONEMAPcxx . . $ `d868uv.c:79:9`!(); |
| 495 |
|
| 496 |
if ((zmap[index / 8] >> (index & 7)) & 1) { |
| 497 |
// Zone is valid, don't skip. |
| 498 |
return 0; |
| 499 |
} |
| 500 |
|
| 501 |
// Invalid zone: skip it, erase data. |
| 502 |
if (mem) { |
| 503 |
memsetcxx . . $ memset(d1de1e4fb215f1c6).(mem, 0xff, nbytes); |
| 504 |
} |
| 505 |
return 1; |
| 506 |
} |
| 507 |
} |
| 508 |
|
| 509 |
// Scanlists. |
| 510 |
if (addr >= 0x01080000 && addr < 0x01640000) { |
| 511 |
index = (file_offset - OFFSET_SCANLISTScxx . . $ `d868uv.c:54:9`!) / 192; |
| 512 |
if (index < NSCANLcxx . . $ `d868uv.c:44:9`!) { |
| 513 |
uint8_tcxx . . $ uint8_t# *slmap = GET_SCANL_MAPcxx . . $ `d868uv.c:82:9`!(); |
| 514 |
|
| 515 |
if ((slmap[index / 8] >> (index & 7)) & 1) { |
| 516 |
// Scanlist is valid, don't skip. |
| 517 |
return 0; |
| 518 |
} |
| 519 |
|
| 520 |
// Invalid scanlist: skip it, erase data. |
| 521 |
if (mem) { |
| 522 |
memsetcxx . . $ memset(d1de1e4fb215f1c6).(mem, 0xff, nbytes); |
| 523 |
} |
| 524 |
return 1; |
| 525 |
} |
| 526 |
} |
| 527 |
return 0; |
| 528 |
} |
| 529 |
|
| 530 |
// |
| 531 |
// Read memory image from the device. |
| 532 |
// |
| 533 |
static void d868uv_downloadcxx . . $ d868uv_download(b1c64831c0136140).(radio_device_tcxx . . $ radio_device_t# *radio) |
| 534 |
{ |
| 535 |
fragment_tcxx . . $ fragment_t# *f; |
| 536 |
|
| 537 |
// Read bitmaps first. |
| 538 |
for (f=region_mapcxx . . $ region_map.; f->lengthcxx . . $ $anonymous_type_a44f2f0574113d8d_0#length.; f++) { |
| 539 |
if (f->offsetcxx . . $ $anonymous_type_a44f2f0574113d8d_0#offset. != 0) { |
| 540 |
serial_read_regioncxx . . $ serial_read_region(dde21517a502ab05).(f->addresscxx . . $ $anonymous_type_a44f2f0574113d8d_0#address., &radio_memcxx . . $ radio_mem.[f->offsetcxx . . $ $anonymous_type_a44f2f0574113d8d_0#offset.], f->lengthcxx . . $ $anonymous_type_a44f2f0574113d8d_0#length.); |
| 541 |
} |
| 542 |
} |
| 543 |
|
| 544 |
// Read other regions sequentially. |
| 545 |
unsigned file_offset = 0; |
| 546 |
unsigned bytes_transferred = 0; |
| 547 |
unsigned last_printed = 0; |
| 548 |
//printf("Address Offset\n"); |
| 549 |
for (f=region_mapcxx . . $ region_map.; f->lengthcxx . . $ $anonymous_type_a44f2f0574113d8d_0#length.; f++) { |
| 550 |
unsigned addr = f->addresscxx . . $ $anonymous_type_a44f2f0574113d8d_0#address.; |
| 551 |
unsigned nbytes = f->lengthcxx . . $ $anonymous_type_a44f2f0574113d8d_0#length.; |
| 552 |
|
| 553 |
//printf("%08x %06x\n", addr, file_offset); |
| 554 |
while (nbytes > 0) { |
| 555 |
unsigned n = (nbytes > 64) ? 64 : nbytes; |
| 556 |
|
| 557 |
if (! skip_regioncxx . . $ skip_region(c76a8476b1034cfd).(addr, file_offset, &radio_memcxx . . $ radio_mem.[file_offset], n)) { |
| 558 |
if (f->offsetcxx . . $ $anonymous_type_a44f2f0574113d8d_0#offset. == 0) |
| 559 |
serial_read_regioncxx . . $ serial_read_region(dde21517a502ab05).(addr, &radio_memcxx . . $ radio_mem.[file_offset], n); |
| 560 |
bytes_transferred += n; |
| 561 |
} |
| 562 |
file_offset += n; |
| 563 |
addr += n; |
| 564 |
nbytes -= n; |
| 565 |
|
| 566 |
if (bytes_transferred / (32*1024) != last_printed) { |
| 567 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "#"); |
| 568 |
fflushcxx . . $ fflush(89bc1efcdac0ca22).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!); |
| 569 |
last_printed = bytes_transferred / (32*1024); |
| 570 |
} |
| 571 |
} |
| 572 |
} |
| 573 |
if (file_offset != MEMSZcxx . . $ `d868uv.c:99:9`!) { |
| 574 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "\nWrong MEMSZ=%u for D868UV!\n", MEMSZcxx . . $ `d868uv.c:99:9`!); |
| 575 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Should be %u; check d868uv-map.h!\n", file_offset); |
| 576 |
exitcxx . . $ exit(3ca292c338df9bb3).(-1); |
| 577 |
} |
| 578 |
} |
| 579 |
|
| 580 |
// |
| 581 |
// Get contact by index. |
| 582 |
// |
| 583 |
static contact_tcxx . . $ contact_t# *get_contactcxx . . $ get_contact(94e369325cc5303c).(int i) |
| 584 |
{ |
| 585 |
uint8_tcxx . . $ uint8_t# *cmap = GET_CONTACT_MAPcxx . . $ `d868uv.c:80:9`!(); |
| 586 |
|
| 587 |
if ((cmap[i / 8] >> (i & 7)) & 1) |
| 588 |
return 0; |
| 589 |
|
| 590 |
return GET_CONTACTcxx . . $ `d868uv.c:87:9`!(i); |
| 591 |
} |
| 592 |
|
| 593 |
// |
| 594 |
// Write memory image to the device. |
| 595 |
// |
| 596 |
static void d868uv_uploadcxx . . $ d868uv_upload(3b0819f82d2f8fcd).(radio_device_tcxx . . $ radio_device_t# *radio, int cont_flag) |
| 597 |
{ |
| 598 |
fragment_tcxx . . $ fragment_t# *f; |
| 599 |
unsigned file_offset = 0; |
| 600 |
unsigned bytes_transferred = 0; |
| 601 |
unsigned last_printed = 0; |
| 602 |
|
| 603 |
for (f=region_mapcxx . . $ region_map.; f->lengthcxx . . $ $anonymous_type_a44f2f0574113d8d_0#length.; f++) { |
| 604 |
unsigned addr = f->addresscxx . . $ $anonymous_type_a44f2f0574113d8d_0#address.; |
| 605 |
unsigned nbytes = f->lengthcxx . . $ $anonymous_type_a44f2f0574113d8d_0#length.; |
| 606 |
|
| 607 |
while (nbytes > 0) { |
| 608 |
unsigned n = (nbytes > 64) ? 64 : nbytes; |
| 609 |
|
| 610 |
if (! skip_regioncxx . . $ skip_region(c76a8476b1034cfd).(addr, file_offset, 0, 0)) { |
| 611 |
serial_write_regioncxx . . $ serial_write_region(dde21517a502ab05).(addr, &radio_memcxx . . $ radio_mem.[file_offset], n); |
| 612 |
bytes_transferred += n; |
| 613 |
} |
| 614 |
file_offset += n; |
| 615 |
addr += n; |
| 616 |
nbytes -= n; |
| 617 |
|
| 618 |
if (bytes_transferred / (32*1024) != last_printed) { |
| 619 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "#"); |
| 620 |
fflushcxx . . $ fflush(89bc1efcdac0ca22).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!); |
| 621 |
last_printed = bytes_transferred / (32*1024); |
| 622 |
} |
| 623 |
} |
| 624 |
} |
| 625 |
if (file_offset != MEMSZcxx . . $ `d868uv.c:99:9`!) { |
| 626 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "\nWrong MEMSZ=%u for D868UV!\n", MEMSZcxx . . $ `d868uv.c:99:9`!); |
| 627 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Should be %u; check d868uv-map.h!\n", file_offset); |
| 628 |
exitcxx . . $ exit(3ca292c338df9bb3).(-1); |
| 629 |
} |
| 630 |
|
| 631 |
// |
| 632 |
// Build and upload a map of IDs to contacts. |
| 633 |
// The map has to be sorted by ID. |
| 634 |
// |
| 635 |
uint64_tcxx . . $ uint64_t# map[8*NCONTACTScxx . . $ `d868uv.c:41:9`! + 72]; |
| 636 |
int index, ncontacts = 0; |
| 637 |
|
| 638 |
memsetcxx . . $ memset(d1de1e4fb215f1c6).(map, 0xff, sizeof(map)); |
| 639 |
for (index=0; index<NCONTACTScxx . . $ `d868uv.c:41:9`!; index++) { |
| 640 |
contact_tcxx . . $ contact_t# *ct = get_contactcxx . . $ get_contact(94e369325cc5303c).(index); |
| 641 |
if (!ct) |
| 642 |
continue; |
| 643 |
|
| 644 |
// A map entry consists of 8 bytes. |
| 645 |
// Bit 0: set for groups. |
| 646 |
// Bits 31-1: DMR ID of the contact. |
| 647 |
// Bytes 4-7: contact index. |
| 648 |
uint64_tcxx . . $ uint64_t# item = ct->idcxx . . $ $anonymous_type_a44f2f0574113d8d_4#id.[0] << 25 | ct->idcxx . . $ $anonymous_type_a44f2f0574113d8d_4#id.[1] << 17 | |
| 649 |
ct->idcxx . . $ $anonymous_type_a44f2f0574113d8d_4#id.[2] << 9 | ct->idcxx . . $ $anonymous_type_a44f2f0574113d8d_4#id.[3] << 1; |
| 650 |
if (ct->typecxx . . $ $anonymous_type_a44f2f0574113d8d_4#type. == CALL_GROUPcxx . . $ `d868uv.c:313:9`!) |
| 651 |
item |= 1; |
| 652 |
item |= (uint64_tcxx . . $ uint64_t#) index << 32; |
| 653 |
|
| 654 |
int k; |
| 655 |
for (k=0; k<NCONTACTScxx . . $ `d868uv.c:41:9`!; k++) { |
| 656 |
if (map[k] == item) { |
| 657 |
// The item is already in the list. |
| 658 |
break; |
| 659 |
} |
| 660 |
if (map[k] == 0xffffffffffffffff) { |
| 661 |
// Append to the end of the list. |
| 662 |
map[k] = item; |
| 663 |
ncontacts = k + 1; |
| 664 |
break; |
| 665 |
} |
| 666 |
if ((uint32_tcxx . . $ uint32_t#)map[k] > (uint32_tcxx . . $ uint32_t#)item) { |
| 667 |
// Insert item there and shift the rest. |
| 668 |
uint64_tcxx . . $ uint64_t# prev = map[k]; |
| 669 |
map[k] = item; |
| 670 |
item = prev; |
| 671 |
} |
| 672 |
} |
| 673 |
} |
| 674 |
//printf("\n"); |
| 675 |
//print_hex((uint8_t*)map, ncontacts*8 + 8); |
| 676 |
//printf("\n"); |
| 677 |
serial_write_regioncxx . . $ serial_write_region(dde21517a502ab05).(ADDR_CONT_ID_LISTcxx . . $ `d868uv.c:73:9`!, (uint8_tcxx . . $ uint8_t#*)map, (ncontacts*8 + 8 + 63) / 64 * 64); |
| 678 |
} |
| 679 |
|
| 680 |
// |
| 681 |
// Check whether the memory image is compatible with this device. |
| 682 |
// |
| 683 |
static int d868uv_is_compatiblecxx . . $ d868uv_is_compatible(69c7618638024564).(radio_device_tcxx . . $ radio_device_t# *radio) |
| 684 |
{ |
| 685 |
if (memcmpcxx . . $ memcmp(36f949851efa3055).("D868UVE", (char*)&radio_memcxx . . $ radio_mem.[0], 7) == 0) |
| 686 |
return 1; |
| 687 |
if (memcmpcxx . . $ memcmp(36f949851efa3055).("D878UV", (char*)&radio_memcxx . . $ radio_mem.[0], 6) == 0) |
| 688 |
return 1; |
| 689 |
if (memcmpcxx . . $ memcmp(36f949851efa3055).("D6X2UV", (char*)&radio_memcxx . . $ radio_mem.[0], 6) == 0) |
| 690 |
return 1; |
| 691 |
return 0; |
| 692 |
} |
| 693 |
|
| 694 |
static void print_idcxx . . $ print_id(e780f64711fb334f).(FILEcxx . . $ FILE# *out, int verbose) |
| 695 |
{ |
| 696 |
radioid_tcxx . . $ radioid_t# *ri = GET_RADIOIDcxx . . $ `d868uv.c:78:9`!(); |
| 697 |
unsigned id = GET_IDcxx . . $ `d868uv.c:286:9`!(ri->id); |
| 698 |
|
| 699 |
if (verbose) |
| 700 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, "\n# Unique DMR ID and name of this radio."); |
| 701 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, "\nID: %u\nName: ", id); |
| 702 |
if (VALID_TEXTcxx . . $ `d868uv.c:92:9`!(ri->name)) { |
| 703 |
print_asciicxx . . $ print_ascii(7c5efebaf8d08723).(out, ri->namecxx . . $ $anonymous_type_a44f2f0574113d8d_3#name., 16, 0); |
| 704 |
} else { |
| 705 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, "-"); |
| 706 |
} |
| 707 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, "\n"); |
| 708 |
} |
| 709 |
|
| 710 |
static void print_introcxx . . $ print_intro(e780f64711fb334f).(FILEcxx . . $ FILE# *out, int verbose) |
| 711 |
{ |
| 712 |
general_settings_tcxx . . $ general_settings_t# *gs = GET_SETTINGScxx . . $ `d868uv.c:77:9`!(); |
| 713 |
|
| 714 |
if (verbose) |
| 715 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, "\n# Text displayed when the radio powers up.\n"); |
| 716 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, "Intro Line 1: "); |
| 717 |
if (VALID_TEXTcxx . . $ `d868uv.c:92:9`!(gs->intro_line1)) { |
| 718 |
print_asciicxx . . $ print_ascii(7c5efebaf8d08723).(out, gs->intro_line1cxx . . $ $anonymous_type_a44f2f0574113d8d_2#intro_line1., 14, 0); |
| 719 |
} else { |
| 720 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, "-"); |
| 721 |
} |
| 722 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, "\nIntro Line 2: "); |
| 723 |
if (VALID_TEXTcxx . . $ `d868uv.c:92:9`!(gs->intro_line2)) { |
| 724 |
print_asciicxx . . $ print_ascii(7c5efebaf8d08723).(out, gs->intro_line2cxx . . $ $anonymous_type_a44f2f0574113d8d_2#intro_line2., 14, 0); |
| 725 |
} else { |
| 726 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, "-"); |
| 727 |
} |
| 728 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, "\n"); |
| 729 |
} |
| 730 |
|
| 731 |
// |
| 732 |
// Get channel bank by index. |
| 733 |
// |
| 734 |
static channel_tcxx . . $ channel_t# *get_bankcxx . . $ get_bank(2162c869aea6d4cd).(int i) |
| 735 |
{ |
| 736 |
return (channel_tcxx . . $ channel_t#*) &radio_memcxx . . $ radio_mem.[OFFSET_BANK1cxx . . $ `d868uv.c:52:9`! + i*0x2000]; |
| 737 |
} |
| 738 |
|
| 739 |
// |
| 740 |
// Get channel by index. |
| 741 |
// |
| 742 |
static channel_tcxx . . $ channel_t# *get_channelcxx . . $ get_channel(2162c869aea6d4cd).(int i) |
| 743 |
{ |
| 744 |
channel_tcxx . . $ channel_t# *bank = get_bankcxx . . $ get_bank(2162c869aea6d4cd).(i >> 7); |
| 745 |
uint8_tcxx . . $ uint8_t# *bitmap = &radio_memcxx . . $ radio_mem.[OFFSET_CHAN_MAPcxx . . $ `d868uv.c:58:9`!]; |
| 746 |
|
| 747 |
if ((bitmap[i / 8] >> (i & 7)) & 1) |
| 748 |
return &bank[i % 128]; |
| 749 |
else |
| 750 |
return 0; |
| 751 |
} |
| 752 |
|
| 753 |
// |
| 754 |
// Do we have any channels of given mode? |
| 755 |
// |
| 756 |
static int have_channelscxx . . $ have_channels(7864480464b09eea).(int mode) |
| 757 |
{ |
| 758 |
int i; |
| 759 |
|
| 760 |
for (i=0; i<NCHANcxx . . $ `d868uv.c:40:9`!; i++) { |
| 761 |
channel_tcxx . . $ channel_t# *ch = get_channelcxx . . $ get_channel(2162c869aea6d4cd).(i); |
| 762 |
|
| 763 |
if (!ch) |
| 764 |
continue; |
| 765 |
if (ch->channel_modecxx . . $ $anonymous_type_a44f2f0574113d8d_1#channel_mode. == mode) |
| 766 |
return 1; |
| 767 |
|
| 768 |
// Treat D+A mode as digital. |
| 769 |
if (mode == MODE_DIGITALcxx . . $ `d868uv.c:129:9`! && ch->channel_modecxx . . $ $anonymous_type_a44f2f0574113d8d_1#channel_mode. == MODE_D_Acxx . . $ `d868uv.c:131:9`!) |
| 770 |
return 1; |
| 771 |
|
| 772 |
// Treat A+D mode as analog. |
| 773 |
if (mode == MODE_ANALOGcxx . . $ `d868uv.c:128:9`! && ch->channel_modecxx . . $ $anonymous_type_a44f2f0574113d8d_1#channel_mode. == MODE_A_Dcxx . . $ `d868uv.c:130:9`!) |
| 774 |
return 1; |
| 775 |
} |
| 776 |
return 0; |
| 777 |
} |
| 778 |
|
| 779 |
// |
| 780 |
// Return true when any contacts are present. |
| 781 |
// |
| 782 |
static int have_contactscxx . . $ have_contacts(d1b40a211a1a4e4c).() |
| 783 |
{ |
| 784 |
uint8_tcxx . . $ uint8_t# *cmap = GET_CONTACT_MAPcxx . . $ `d868uv.c:80:9`!(); |
| 785 |
int i; |
| 786 |
|
| 787 |
for (i=0; i<(NCONTACTScxx . . $ `d868uv.c:41:9`!+7)/8; i++) { |
| 788 |
if (cmap[i] != 0xff) |
| 789 |
return 1; |
| 790 |
} |
| 791 |
return 0; |
| 792 |
} |
| 793 |
|
| 794 |
// |
| 795 |
// Print frequency (BCD value). |
| 796 |
// |
| 797 |
static void print_rx_freqcxx . . $ print_rx_freq(601809f6b723505a).(FILEcxx . . $ FILE# *out, unsigned data) |
| 798 |
{ |
| 799 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, "%d%d%d.%d%d%d", (data >> 4) & 15, data & 15, |
| 800 |
(data >> 12) & 15, (data >> 8) & 15, |
| 801 |
(data >> 20) & 15, (data >> 16) & 15); |
| 802 |
|
| 803 |
if (((data >> 24) & 0xff) == 0) { |
| 804 |
fputscxx . . $ fputs(874fa6a5e59ab9bd).(" ", out); |
| 805 |
} else { |
| 806 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, "%d", (data >> 28) & 15); |
| 807 |
if (((data >> 24) & 15) == 0) { |
| 808 |
fputscxx . . $ fputs(874fa6a5e59ab9bd).(" ", out); |
| 809 |
} else { |
| 810 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, "%d", (data >> 24) & 15); |
| 811 |
} |
| 812 |
} |
| 813 |
} |
| 814 |
|
| 815 |
// |
| 816 |
// Convert a 4-byte frequency value from binary coded decimal |
| 817 |
// to integer format (in Hertz). |
| 818 |
// |
| 819 |
static int bcd_to_hzcxx . . $ bcd_to_hz(4c679297bf94b9eb).(unsigned bcd) |
| 820 |
{ |
| 821 |
int a = (bcd >> 4) & 15; |
| 822 |
int b = bcd & 15; |
| 823 |
int c = (bcd >> 12) & 15; |
| 824 |
int d = (bcd >> 8) & 15; |
| 825 |
int e = (bcd >> 20) & 15; |
| 826 |
int f = (bcd >> 16) & 15; |
| 827 |
int g = (bcd >> 28) & 15; |
| 828 |
int h = (bcd >> 24) & 15; |
| 829 |
|
| 830 |
return (((((((a*10 + b) * 10 + c) * 10 + d) * 10 + e) * 10 + f) * 10 + g) * 10 + h) * 10; |
| 831 |
} |
| 832 |
|
| 833 |
// |
| 834 |
// Print the transmit offset or frequency. |
| 835 |
// TX value is a delta. |
| 836 |
// |
| 837 |
static void print_tx_offsetcxx . . $ print_tx_offset(29f4a7eee312bd55).(FILEcxx . . $ FILE# *out, unsigned tx_offset_bcd, unsigned mode) |
| 838 |
{ |
| 839 |
int offset; |
| 840 |
|
| 841 |
switch (mode) { |
| 842 |
default: |
| 843 |
case RM_SIMPLEXcxx . . $ `d868uv.c:145:9`!: // TX frequency = RX frequency |
| 844 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, "+0 "); |
| 845 |
break; |
| 846 |
|
| 847 |
case RM_TXPOScxx . . $ `d868uv.c:146:9`!: // Positive TX offset |
| 848 |
offset = bcd_to_hzcxx . . $ bcd_to_hz(4c679297bf94b9eb).(tx_offset_bcd); |
| 849 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, "+"); |
| 850 |
print_mhzcxx . . $ print_mhz(601809f6b723505a).(out, offset); |
| 851 |
break; |
| 852 |
|
| 853 |
case RM_TXNEGcxx . . $ `d868uv.c:147:9`!: // Negative TX offset |
| 854 |
offset = bcd_to_hzcxx . . $ bcd_to_hz(4c679297bf94b9eb).(tx_offset_bcd); |
| 855 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, "-"); |
| 856 |
print_mhzcxx . . $ print_mhz(601809f6b723505a).(out, offset); |
| 857 |
break; |
| 858 |
} |
| 859 |
} |
| 860 |
|
| 861 |
// |
| 862 |
// Return scan list index for specified channel. |
| 863 |
// It depends on radio type. |
| 864 |
// |
| 865 |
static int get_scanlist_indexcxx . . $ get_scanlist_index(32772cb7319ce0ec).(radio_device_tcxx . . $ radio_device_t# *radio, channel_tcxx . . $ channel_t# *ch) |
| 866 |
{ |
| 867 |
if (radio == &radio_dmr6x2cxx . . $ radio_dmr6x2.) { |
| 868 |
// Radio DMR-6x2 has eight scan lists per channel. |
| 869 |
return ch->aprs_channelcxx . . $ $anonymous_type_a44f2f0574113d8d_1#aprs_channel.; |
| 870 |
} else { |
| 871 |
return ch->scan_list_indexcxx . . $ $anonymous_type_a44f2f0574113d8d_1#scan_list_index.; |
| 872 |
} |
| 873 |
} |
| 874 |
|
| 875 |
// |
| 876 |
// Print base parameters of the channel: |
| 877 |
// Name |
| 878 |
// RX Frequency |
| 879 |
// TX Frequency |
| 880 |
// Power |
| 881 |
// Scan List |
| 882 |
// TOT |
| 883 |
// RX Only |
| 884 |
// |
| 885 |
static void print_chan_basecxx . . $ print_chan_base(56ee65938f5dbcf).(FILEcxx . . $ FILE# *out, radio_device_tcxx . . $ radio_device_t# *radio, channel_tcxx . . $ channel_t# *ch, int cnum) |
| 886 |
{ |
| 887 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, "%5d ", cnum); |
| 888 |
print_asciicxx . . $ print_ascii(7c5efebaf8d08723).(out, ch->namecxx . . $ $anonymous_type_a44f2f0574113d8d_1#name., 16, 1); |
| 889 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, " "); |
| 890 |
print_rx_freqcxx . . $ print_rx_freq(601809f6b723505a).(out, ch->rx_frequencycxx . . $ $anonymous_type_a44f2f0574113d8d_1#rx_frequency.); |
| 891 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, " "); |
| 892 |
print_tx_offsetcxx . . $ print_tx_offset(29f4a7eee312bd55).(out, ch->tx_offsetcxx . . $ $anonymous_type_a44f2f0574113d8d_1#tx_offset., ch->repeater_modecxx . . $ $anonymous_type_a44f2f0574113d8d_1#repeater_mode.); |
| 893 |
|
| 894 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, "%-5s ", POWER_NAMEcxx . . $ POWER_NAME.[ch->powercxx . . $ $anonymous_type_a44f2f0574113d8d_1#power.]); |
| 895 |
|
| 896 |
int scanlist_index = get_scanlist_indexcxx . . $ get_scanlist_index(32772cb7319ce0ec).(radio, ch); |
| 897 |
if (scanlist_index == 0xff) |
| 898 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, "- "); |
| 899 |
else |
| 900 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, "%-4d ", scanlist_index + 1); |
| 901 |
|
| 902 |
// Transmit timeout timer on D868UV is configured globally, |
| 903 |
// not per channel. So we don't print it here. |
| 904 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, "- "); |
| 905 |
|
| 906 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, "%c ", "-+"[ch->rx_onlycxx . . $ $anonymous_type_a44f2f0574113d8d_1#rx_only.]); |
| 907 |
} |
| 908 |
|
| 909 |
static void print_digital_channelscxx . . $ print_digital_channels(af2304a848bd3a17).(FILEcxx . . $ FILE# *out, radio_device_tcxx . . $ radio_device_t# *radio, int verbose) |
| 910 |
{ |
| 911 |
int i; |
| 912 |
|
| 913 |
if (verbose) { |
| 914 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, "# Table of digital channels.\n"); |
| 915 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, "# 1) Channel number: 1-%d\n", NCHANcxx . . $ `d868uv.c:40:9`!); |
| 916 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, "# 2) Name: up to 16 characters, use '_' instead of space\n"); |
| 917 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, "# 3) Receive frequency in MHz\n"); |
| 918 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, "# 4) Transmit frequency or +/- offset in MHz\n"); |
| 919 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, "# 5) Transmit power: High, Mid, Low, Turbo\n"); |
| 920 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, "# 6) Scan list: - or index in Scanlist table\n"); |
| 921 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, "# 7) Transmit timeout timer: (unused)\n"); |
| 922 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, "# 8) Receive only: -, +\n"); |
| 923 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, "# 9) Admit criteria: -, Free, Color, NColor\n"); |
| 924 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, "# 10) Color code: 0, 1, 2, 3... 15\n"); |
| 925 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, "# 11) Time slot: 1 or 2\n"); |
| 926 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, "# 12) Receive group list: - or index in Grouplist table\n"); |
| 927 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, "# 13) Contact for transmit: - or index in Contacts table\n"); |
| 928 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, "#\n"); |
| 929 |
} |
| 930 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, "Digital Name Receive Transmit Power Scan TOT RO Admit Color Slot RxGL TxContact"); |
| 931 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, "\n"); |
| 932 |
for (i=0; i<NCHANcxx . . $ `d868uv.c:40:9`!; i++) { |
| 933 |
channel_tcxx . . $ channel_t# *ch = get_channelcxx . . $ get_channel(2162c869aea6d4cd).(i); |
| 934 |
|
| 935 |
if (!ch) |
| 936 |
continue; |
| 937 |
if (ch->channel_modecxx . . $ $anonymous_type_a44f2f0574113d8d_1#channel_mode. != MODE_DIGITALcxx . . $ `d868uv.c:129:9`! && ch->channel_modecxx . . $ $anonymous_type_a44f2f0574113d8d_1#channel_mode. != MODE_D_Acxx . . $ `d868uv.c:131:9`!) { |
| 938 |
// Select digital channels |
| 939 |
continue; |
| 940 |
} |
| 941 |
print_chan_basecxx . . $ print_chan_base(56ee65938f5dbcf).(out, radio, ch, i+1); |
| 942 |
|
| 943 |
// Print digital parameters of the channel: |
| 944 |
// Admit Criteria |
| 945 |
// Color Code |
| 946 |
// Repeater Slot |
| 947 |
// Group List |
| 948 |
// Contact Name |
| 949 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, "%-6s ", DIGITAL_ADMIT_NAMEcxx . . $ DIGITAL_ADMIT_NAME.[ch->tx_permitcxx . . $ $anonymous_type_a44f2f0574113d8d_1#tx_permit.]); |
| 950 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, "%-5d %-3d ", ch->color_codecxx . . $ $anonymous_type_a44f2f0574113d8d_1#color_code., 1 + ch->slot2cxx . . $ $anonymous_type_a44f2f0574113d8d_1#slot2.); |
| 951 |
|
| 952 |
if (ch->group_list_indexcxx . . $ $anonymous_type_a44f2f0574113d8d_1#group_list_index. == 0xff) |
| 953 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, "- "); |
| 954 |
else |
| 955 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, "%-4d ", ch->group_list_indexcxx . . $ $anonymous_type_a44f2f0574113d8d_1#group_list_index. + 1); |
| 956 |
|
| 957 |
if (ch->contact_indexcxx . . $ $anonymous_type_a44f2f0574113d8d_1#contact_index. == 0xffff) |
| 958 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, "-"); |
| 959 |
else |
| 960 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, "%-4d", ch->contact_indexcxx . . $ $anonymous_type_a44f2f0574113d8d_1#contact_index. + 1); |
| 961 |
|
| 962 |
// Print contact name as a comment. |
| 963 |
if (ch->contact_indexcxx . . $ $anonymous_type_a44f2f0574113d8d_1#contact_index. != 0xffff) { |
| 964 |
contact_tcxx . . $ contact_t# *ct = get_contactcxx . . $ get_contact(94e369325cc5303c).(ch->contact_indexcxx . . $ $anonymous_type_a44f2f0574113d8d_1#contact_index.); |
| 965 |
|
| 966 |
if (ct) { |
| 967 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, " # "); |
| 968 |
print_asciicxx . . $ print_ascii(7c5efebaf8d08723).(out, ct->namecxx . . $ $anonymous_type_a44f2f0574113d8d_4#name., 16, 0); |
| 969 |
} |
| 970 |
} |
| 971 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, "\n"); |
| 972 |
} |
| 973 |
} |
| 974 |
|
| 975 |
// |
| 976 |
// Print CTSS tone. |
| 977 |
// |
| 978 |
static void print_ctcsscxx . . $ print_ctcss(29f4a7eee312bd55).(FILEcxx . . $ FILE# *out, unsigned index, unsigned custom) |
| 979 |
{ |
| 980 |
int dhz = (index < NCTCSScxx . . $ `d868uv.c:425:9`!) ? CTCSS_TONEScxx . . $ CTCSS_TONES.[index] : custom; |
| 981 |
unsigned a = dhz / 1000; |
| 982 |
unsigned b = (dhz / 100) % 10; |
| 983 |
unsigned c = (dhz / 10) % 10; |
| 984 |
unsigned d = dhz % 10; |
| 985 |
|
| 986 |
if (a == 0) |
| 987 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, "%d%d.%d ", b, c, d); |
| 988 |
else |
| 989 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, "%d%d%d.%d", a, b, c, d); |
| 990 |
} |
| 991 |
|
| 992 |
// |
| 993 |
// Print DCS tone. |
| 994 |
// |
| 995 |
static void print_dcscxx . . $ print_dcs(601809f6b723505a).(FILEcxx . . $ FILE# *out, unsigned dcs) |
| 996 |
{ |
| 997 |
unsigned i = (dcs >> 9) & 1; |
| 998 |
unsigned a = (dcs >> 6) & 7; |
| 999 |
unsigned b = (dcs >> 3) & 7; |
| 1000 |
unsigned c = dcs & 7; |
| 1001 |
|
| 1002 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, "D%d%d%d%c", a, b, c, i ? 'I' : 'N'); |
| 1003 |
} |
| 1004 |
|
| 1005 |
static void print_analog_channelscxx . . $ print_analog_channels(af2304a848bd3a17).(FILEcxx . . $ FILE# *out, radio_device_tcxx . . $ radio_device_t# *radio, int verbose) |
| 1006 |
{ |
| 1007 |
int i; |
| 1008 |
|
| 1009 |
if (verbose) { |
| 1010 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, "# Table of analog channels.\n"); |
| 1011 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, "# 1) Channel number: 1-%d\n", NCHANcxx . . $ `d868uv.c:40:9`!); |
| 1012 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, "# 2) Name: up to 16 characters, use '_' instead of space\n"); |
| 1013 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, "# 3) Receive frequency in MHz\n"); |
| 1014 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, "# 4) Transmit frequency or +/- offset in MHz\n"); |
| 1015 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, "# 5) Transmit power: High, Mid, Low, Turbo\n"); |
| 1016 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, "# 6) Scan list: - or index\n"); |
| 1017 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, "# 7) Transmit timeout timer: (unused)\n"); |
| 1018 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, "# 8) Receive only: -, +\n"); |
| 1019 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, "# 9) Admit criteria: -, Free, Tone\n"); |
| 1020 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, "# 10) Squelch level: Normal (unused)\n"); |
| 1021 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, "# 11) Guard tone for receive, or '-' to disable\n"); |
| 1022 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, "# 12) Guard tone for transmit, or '-' to disable\n"); |
| 1023 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, "# 13) Bandwidth in kHz: 12.5, 25\n"); |
| 1024 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, "#\n"); |
| 1025 |
} |
| 1026 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, "Analog Name Receive Transmit Power Scan TOT RO Admit Squelch RxTone TxTone Width"); |
| 1027 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, "\n"); |
| 1028 |
for (i=0; i<NCHANcxx . . $ `d868uv.c:40:9`!; i++) { |
| 1029 |
channel_tcxx . . $ channel_t# *ch = get_channelcxx . . $ get_channel(2162c869aea6d4cd).(i); |
| 1030 |
|
| 1031 |
if (!ch) |
| 1032 |
continue; |
| 1033 |
if (ch->channel_modecxx . . $ $anonymous_type_a44f2f0574113d8d_1#channel_mode. != MODE_ANALOGcxx . . $ `d868uv.c:128:9`! && ch->channel_modecxx . . $ $anonymous_type_a44f2f0574113d8d_1#channel_mode. != MODE_A_Dcxx . . $ `d868uv.c:130:9`!) { |
| 1034 |
// Select analog channels |
| 1035 |
continue; |
| 1036 |
} |
| 1037 |
print_chan_basecxx . . $ print_chan_base(56ee65938f5dbcf).(out, radio, ch, i+1); |
| 1038 |
|
| 1039 |
// Print analog parameters of the channel: |
| 1040 |
// Admit Criteria |
| 1041 |
// Squelch |
| 1042 |
// CTCSS/DCS Dec |
| 1043 |
// CTCSS/DCS Enc |
| 1044 |
// Bandwidth |
| 1045 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, "%-6s ", ANALOG_ADMIT_NAMEcxx . . $ ANALOG_ADMIT_NAME.[ch->tx_permitcxx . . $ $anonymous_type_a44f2f0574113d8d_1#tx_permit.]); |
| 1046 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, "%-7s ", "Normal"); |
| 1047 |
|
| 1048 |
if (ch->rx_ctcsscxx . . $ $anonymous_type_a44f2f0574113d8d_1#rx_ctcss.) |
| 1049 |
print_ctcsscxx . . $ print_ctcss(29f4a7eee312bd55).(out, ch->ctcss_receivecxx . . $ $anonymous_type_a44f2f0574113d8d_1#ctcss_receive., ch->custom_ctcsscxx . . $ $anonymous_type_a44f2f0574113d8d_1#custom_ctcss.); |
| 1050 |
else if (ch->rx_dcscxx . . $ $anonymous_type_a44f2f0574113d8d_1#rx_dcs.) |
| 1051 |
print_dcscxx . . $ print_dcs(601809f6b723505a).(out, ch->dcs_receivecxx . . $ $anonymous_type_a44f2f0574113d8d_1#dcs_receive.); |
| 1052 |
else |
| 1053 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, "- "); |
| 1054 |
|
| 1055 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, " "); |
| 1056 |
if (ch->tx_ctcsscxx . . $ $anonymous_type_a44f2f0574113d8d_1#tx_ctcss.) |
| 1057 |
print_ctcsscxx . . $ print_ctcss(29f4a7eee312bd55).(out, ch->ctcss_transmitcxx . . $ $anonymous_type_a44f2f0574113d8d_1#ctcss_transmit., ch->custom_ctcsscxx . . $ $anonymous_type_a44f2f0574113d8d_1#custom_ctcss.); |
| 1058 |
else if (ch->tx_dcscxx . . $ $anonymous_type_a44f2f0574113d8d_1#tx_dcs.) |
| 1059 |
print_dcscxx . . $ print_dcs(601809f6b723505a).(out, ch->dcs_transmitcxx . . $ $anonymous_type_a44f2f0574113d8d_1#dcs_transmit.); |
| 1060 |
else |
| 1061 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, "- "); |
| 1062 |
|
| 1063 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, " %s", BANDWIDTHcxx . . $ BANDWIDTH.[ch->bandwidthcxx . . $ $anonymous_type_a44f2f0574113d8d_1#bandwidth.]); |
| 1064 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, "\n"); |
| 1065 |
} |
| 1066 |
} |
| 1067 |
|
| 1068 |
// |
| 1069 |
// Return true when any zones are present. |
| 1070 |
// |
| 1071 |
static int have_zonescxx . . $ have_zones(d1b40a211a1a4e4c).() |
| 1072 |
{ |
| 1073 |
uint8_tcxx . . $ uint8_t# *zmap = GET_ZONEMAPcxx . . $ `d868uv.c:79:9`!(); |
| 1074 |
int i; |
| 1075 |
|
| 1076 |
for (i=0; i<(NZONEScxx . . $ `d868uv.c:42:9`!+7)/8; i++) { |
| 1077 |
if (zmap[i] != 0) |
| 1078 |
return 1; |
| 1079 |
} |
| 1080 |
return 0; |
| 1081 |
} |
| 1082 |
|
| 1083 |
// |
| 1084 |
// Return true when any scanlists are present. |
| 1085 |
// |
| 1086 |
static int have_scanlistscxx . . $ have_scanlists(d1b40a211a1a4e4c).() |
| 1087 |
{ |
| 1088 |
uint8_tcxx . . $ uint8_t# *slmap = GET_SCANL_MAPcxx . . $ `d868uv.c:82:9`!(); |
| 1089 |
int i; |
| 1090 |
|
| 1091 |
for (i=0; i<(NSCANLcxx . . $ `d868uv.c:44:9`!+7)/8; i++) { |
| 1092 |
if (slmap[i] != 0) |
| 1093 |
return 1; |
| 1094 |
} |
| 1095 |
return 0; |
| 1096 |
} |
| 1097 |
|
| 1098 |
// |
| 1099 |
// Find a zone with given index. |
| 1100 |
// Return false when zone is not valid. |
| 1101 |
// Set zname and zlist to a zone name and member list. |
| 1102 |
// |
| 1103 |
static int get_zonecxx . . $ get_zone(6880b6aad788d73d).(int i, uint8_tcxx . . $ uint8_t# **zname, uint16_tcxx . . $ uint16_t# **zlist) |
| 1104 |
{ |
| 1105 |
uint8_tcxx . . $ uint8_t# *zmap = GET_ZONEMAPcxx . . $ `d868uv.c:79:9`!(); |
| 1106 |
|
| 1107 |
if ((zmap[i / 8] >> (i & 7)) & 1) { |
| 1108 |
// Zone is valid. |
| 1109 |
*zname = GET_ZONENAMEcxx . . $ `d868uv.c:83:9`!(i); |
| 1110 |
*zlist = GET_ZONELISTcxx . . $ `d868uv.c:86:9`!(i); |
| 1111 |
return 1; |
| 1112 |
} else { |
| 1113 |
return 0; |
| 1114 |
} |
| 1115 |
} |
| 1116 |
|
| 1117 |
// |
| 1118 |
// Get scanlist by index. |
| 1119 |
// |
| 1120 |
static scanlist_tcxx . . $ scanlist_t# *get_scanlistcxx . . $ get_scanlist(c9b8a7001ed875db).(int i) |
| 1121 |
{ |
| 1122 |
uint8_tcxx . . $ uint8_t# *slmap = GET_SCANL_MAPcxx . . $ `d868uv.c:82:9`!(); |
| 1123 |
|
| 1124 |
if ((slmap[i / 8] >> (i & 7)) & 1) |
| 1125 |
return GET_SCANLISTcxx . . $ `d868uv.c:89:9`!(i); |
| 1126 |
|
| 1127 |
return 0; |
| 1128 |
} |
| 1129 |
|
| 1130 |
static void print_chanlist16cxx . . $ print_chanlist16(a284d3077800db4b).(FILEcxx . . $ FILE# *out, uint16_tcxx . . $ uint16_t# *unsorted, int nchan) |
| 1131 |
{ |
| 1132 |
int last = -1; |
| 1133 |
int range = 0; |
| 1134 |
int n; |
| 1135 |
uint16_tcxx . . $ uint16_t# data[nchan]; |
| 1136 |
|
| 1137 |
// Sort the list before printing. |
| 1138 |
memcpycxx . . $ memcpy(cc817cb175f282d).(data, unsorted, nchan * sizeof(uint16_tcxx . . $ uint16_t#)); |
| 1139 |
qsortcxx . . $ qsort(ebb60b13a65e77d7).(data, nchan, sizeof(uint16_tcxx . . $ uint16_t#), compare_index_ffffcxx . . $ compare_index_ffff(9148c8c3ff42c9d8).); |
| 1140 |
for (n=0; n<nchan; n++) { |
| 1141 |
int cnum = data[n]; |
| 1142 |
|
| 1143 |
if (cnum == 0xffff) |
| 1144 |
break; |
| 1145 |
cnum++; |
| 1146 |
|
| 1147 |
if (cnum == last+1) { |
| 1148 |
range = 1; |
| 1149 |
} else { |
| 1150 |
if (range) { |
| 1151 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, "-%d", last); |
| 1152 |
range = 0; |
| 1153 |
} |
| 1154 |
if (n > 0) |
| 1155 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, ","); |
| 1156 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, "%d", cnum); |
| 1157 |
} |
| 1158 |
last = cnum; |
| 1159 |
} |
| 1160 |
if (range) |
| 1161 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, "-%d", last); |
| 1162 |
} |
| 1163 |
|
| 1164 |
static void print_chanlist32cxx . . $ print_chanlist32(d088b1286977bec5).(FILEcxx . . $ FILE# *out, uint32_tcxx . . $ uint32_t# *unsorted, int nchan) |
| 1165 |
{ |
| 1166 |
int last = -1; |
| 1167 |
int range = 0; |
| 1168 |
int n; |
| 1169 |
uint32_tcxx . . $ uint32_t# data[nchan]; |
| 1170 |
|
| 1171 |
// Sort the list before printing. |
| 1172 |
memcpycxx . . $ memcpy(cc817cb175f282d).(data, unsorted, nchan * sizeof(uint32_tcxx . . $ uint32_t#)); |
| 1173 |
qsortcxx . . $ qsort(ebb60b13a65e77d7).(data, nchan, sizeof(uint32_tcxx . . $ uint32_t#), compare_index_ffffffffcxx . . $ compare_index_ffffffff(9148c8c3ff42c9d8).); |
| 1174 |
for (n=0; n<nchan; n++) { |
| 1175 |
int cnum = data[n]; |
| 1176 |
if (cnum == 0xffffffff) |
| 1177 |
break; |
| 1178 |
cnum++; |
| 1179 |
|
| 1180 |
if (cnum == last+1) { |
| 1181 |
range = 1; |
| 1182 |
} else { |
| 1183 |
if (range) { |
| 1184 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, "-%d", last); |
| 1185 |
range = 0; |
| 1186 |
} |
| 1187 |
if (n > 0) |
| 1188 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, ","); |
| 1189 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, "%d", cnum); |
| 1190 |
} |
| 1191 |
last = cnum; |
| 1192 |
} |
| 1193 |
if (range) |
| 1194 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, "-%d", last); |
| 1195 |
} |
| 1196 |
|
| 1197 |
static int have_grouplistscxx . . $ have_grouplists(d1b40a211a1a4e4c).() |
| 1198 |
{ |
| 1199 |
int i; |
| 1200 |
|
| 1201 |
for (i=0; i<NGLISTScxx . . $ `d868uv.c:43:9`!; i++) { |
| 1202 |
grouplist_tcxx . . $ grouplist_t# *gl = GET_GROUPLISTcxx . . $ `d868uv.c:88:9`!(i); |
| 1203 |
|
| 1204 |
if (VALID_GROUPLISTcxx . . $ `d868uv.c:93:9`!(gl)) |
| 1205 |
return 1; |
| 1206 |
} |
| 1207 |
return 0; |
| 1208 |
} |
| 1209 |
|
| 1210 |
static int have_messagescxx . . $ have_messages(d1b40a211a1a4e4c).() |
| 1211 |
{ |
| 1212 |
int i; |
| 1213 |
|
| 1214 |
for (i=0; i<NMESSAGEScxx . . $ `d868uv.c:45:9`!; i++) { |
| 1215 |
uint8_tcxx . . $ uint8_t# *msg = GET_MESSAGEcxx . . $ `d868uv.c:90:9`!(i); |
| 1216 |
|
| 1217 |
if (VALID_TEXTcxx . . $ `d868uv.c:92:9`!(msg)) |
| 1218 |
return 1; |
| 1219 |
} |
| 1220 |
return 0; |
| 1221 |
} |
| 1222 |
|
| 1223 |
// |
| 1224 |
// Print full information about the device configuration. |
| 1225 |
// |
| 1226 |
static void d868uv_print_configcxx . . $ d868uv_print_config(c18371ed0cec106e).(radio_device_tcxx . . $ radio_device_t# *radio, FILEcxx . . $ FILE# *out, int verbose) |
| 1227 |
{ |
| 1228 |
int i; |
| 1229 |
|
| 1230 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, "Radio: %s\n", radio->namecxx . . $ _radio_device_t#name.); |
| 1231 |
if (verbose) |
| 1232 |
d868uv_print_versioncxx . . $ d868uv_print_version(7777599da18afe85).(radio, out); |
| 1233 |
|
| 1234 |
// |
| 1235 |
// Channels. |
| 1236 |
// |
| 1237 |
if (have_channelscxx . . $ have_channels(7864480464b09eea).(MODE_DIGITALcxx . . $ `d868uv.c:129:9`!)) { |
| 1238 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, "\n"); |
| 1239 |
print_digital_channelscxx . . $ print_digital_channels(af2304a848bd3a17).(out, radio, verbose); |
| 1240 |
} |
| 1241 |
if (have_channelscxx . . $ have_channels(7864480464b09eea).(MODE_ANALOGcxx . . $ `d868uv.c:128:9`!)) { |
| 1242 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, "\n"); |
| 1243 |
print_analog_channelscxx . . $ print_analog_channels(af2304a848bd3a17).(out, radio, verbose); |
| 1244 |
} |
| 1245 |
|
| 1246 |
// |
| 1247 |
// Zones. |
| 1248 |
// |
| 1249 |
if (have_zonescxx . . $ have_zones(d1b40a211a1a4e4c).()) { |
| 1250 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, "\n"); |
| 1251 |
if (verbose) { |
| 1252 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, "# Table of channel zones.\n"); |
| 1253 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, "# 1) Zone number: 1-%d\n", NZONEScxx . . $ `d868uv.c:42:9`!); |
| 1254 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, "# 2) Name: up to 16 characters, use '_' instead of space\n"); |
| 1255 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, "# 3) List of channels: numbers and ranges (N-M) separated by comma\n"); |
| 1256 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, "#\n"); |
| 1257 |
} |
| 1258 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, "Zone Name Channels\n"); |
| 1259 |
for (i=0; i<NZONEScxx . . $ `d868uv.c:42:9`!; i++) { |
| 1260 |
uint8_tcxx . . $ uint8_t# *zname; |
| 1261 |
uint16_tcxx . . $ uint16_t# *zlist; |
| 1262 |
|
| 1263 |
if (!get_zonecxx . . $ get_zone(6880b6aad788d73d).(i, &zname, &zlist)) { |
| 1264 |
// Zone is disabled. |
| 1265 |
continue; |
| 1266 |
} |
| 1267 |
|
| 1268 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, "%5d ", i + 1); |
| 1269 |
print_asciicxx . . $ print_ascii(7c5efebaf8d08723).(out, zname, 16, 1); |
| 1270 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, " "); |
| 1271 |
if (*zlist != 0xffff) { |
| 1272 |
print_chanlist16cxx . . $ print_chanlist16(a284d3077800db4b).(out, zlist, 250); |
| 1273 |
} else { |
| 1274 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, "-"); |
| 1275 |
} |
| 1276 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, "\n"); |
| 1277 |
} |
| 1278 |
} |
| 1279 |
|
| 1280 |
// |
| 1281 |
// Scan lists. |
| 1282 |
// |
| 1283 |
if (have_scanlistscxx . . $ have_scanlists(d1b40a211a1a4e4c).()) { |
| 1284 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, "\n"); |
| 1285 |
if (verbose) { |
| 1286 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, "# Table of scan lists.\n"); |
| 1287 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, "# 1) Scan list number: 1-%d\n", NSCANLcxx . . $ `d868uv.c:44:9`!); |
| 1288 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, "# 2) Name: up to 16 characters, use '_' instead of space\n"); |
| 1289 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, "# 3) Priority channel 1: -, Curr or index\n"); |
| 1290 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, "# 4) Priority channel 2: -, Curr or index\n"); |
| 1291 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, "# 5) Designated transmit channel: Sel or Last\n"); |
| 1292 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, "# 6) List of channels: numbers and ranges (N-M) separated by comma\n"); |
| 1293 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, "#\n"); |
| 1294 |
} |
| 1295 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, "Scanlist Name PCh1 PCh2 TxCh Channels\n"); |
| 1296 |
for (i=0; i<NSCANLcxx . . $ `d868uv.c:44:9`!; i++) { |
| 1297 |
scanlist_tcxx . . $ scanlist_t# *sl = get_scanlistcxx . . $ get_scanlist(c9b8a7001ed875db).(i); |
| 1298 |
|
| 1299 |
if (!sl) { |
| 1300 |
// Scan list is disabled. |
| 1301 |
continue; |
| 1302 |
} |
| 1303 |
|
| 1304 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, "%5d ", i + 1); |
| 1305 |
print_asciicxx . . $ print_ascii(7c5efebaf8d08723).(out, sl->namecxx . . $ $anonymous_type_a44f2f0574113d8d_6#name., 16, 1); |
| 1306 |
|
| 1307 |
if ((sl->prio_ch_selectcxx . . $ $anonymous_type_a44f2f0574113d8d_6#prio_ch_select. == PRIO_CHAN_SEL1cxx . . $ `d868uv.c:360:9`! || |
| 1308 |
sl->prio_ch_selectcxx . . $ $anonymous_type_a44f2f0574113d8d_6#prio_ch_select. == PRIO_CHAN_SEL12cxx . . $ `d868uv.c:362:9`!) && |
| 1309 |
sl->priority_ch1cxx . . $ $anonymous_type_a44f2f0574113d8d_6#priority_ch1. != 0xffff) { |
| 1310 |
if (sl->priority_ch1cxx . . $ $anonymous_type_a44f2f0574113d8d_6#priority_ch1. == 0) { |
| 1311 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, " Curr "); |
| 1312 |
} else { |
| 1313 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, " %-4d ", sl->priority_ch1cxx . . $ $anonymous_type_a44f2f0574113d8d_6#priority_ch1.); |
| 1314 |
} |
| 1315 |
} else { |
| 1316 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, " - "); |
| 1317 |
} |
| 1318 |
|
| 1319 |
if ((sl->prio_ch_selectcxx . . $ $anonymous_type_a44f2f0574113d8d_6#prio_ch_select. == PRIO_CHAN_SEL2cxx . . $ `d868uv.c:361:9`! || |
| 1320 |
sl->prio_ch_selectcxx . . $ $anonymous_type_a44f2f0574113d8d_6#prio_ch_select. == PRIO_CHAN_SEL12cxx . . $ `d868uv.c:362:9`!) && |
| 1321 |
sl->priority_ch2cxx . . $ $anonymous_type_a44f2f0574113d8d_6#priority_ch2. != 0xffff) { |
| 1322 |
if (sl->priority_ch2cxx . . $ $anonymous_type_a44f2f0574113d8d_6#priority_ch2. == 0) { |
| 1323 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, "Curr "); |
| 1324 |
} else { |
| 1325 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, "%-4d ", sl->priority_ch2cxx . . $ $anonymous_type_a44f2f0574113d8d_6#priority_ch2.); |
| 1326 |
} |
| 1327 |
} else { |
| 1328 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, "- "); |
| 1329 |
} |
| 1330 |
|
| 1331 |
if (sl->revert_channelcxx . . $ $anonymous_type_a44f2f0574113d8d_6#revert_channel. == REVCH_LAST_CALLEDcxx . . $ `d868uv.c:380:9`!) { |
| 1332 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, "Last "); |
| 1333 |
} else { |
| 1334 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, "Sel "); |
| 1335 |
} |
| 1336 |
|
| 1337 |
if (sl->membercxx . . $ $anonymous_type_a44f2f0574113d8d_6#member.[0] != 0xffff) { |
| 1338 |
print_chanlist16cxx . . $ print_chanlist16(a284d3077800db4b).(out, sl->membercxx . . $ $anonymous_type_a44f2f0574113d8d_6#member., 50); |
| 1339 |
} else { |
| 1340 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, "-"); |
| 1341 |
} |
| 1342 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, "\n"); |
| 1343 |
} |
| 1344 |
} |
| 1345 |
|
| 1346 |
// |
| 1347 |
// Contacts. |
| 1348 |
// |
| 1349 |
if (have_contactscxx . . $ have_contacts(d1b40a211a1a4e4c).()) { |
| 1350 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, "\n"); |
| 1351 |
if (verbose) { |
| 1352 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, "# Table of contacts.\n"); |
| 1353 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, "# 1) Contact number: 1-%d\n", NCONTACTScxx . . $ `d868uv.c:41:9`!); |
| 1354 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, "# 2) Name: up to 16 characters, use '_' instead of space\n"); |
| 1355 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, "# 3) Call type: Group, Private, All\n"); |
| 1356 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, "# 4) Call ID: 1...16777215\n"); |
| 1357 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, "# 5) Incoming call alert: -, +, Online\n"); |
| 1358 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, "#\n"); |
| 1359 |
} |
| 1360 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, "Contact Name Type ID RxTone\n"); |
| 1361 |
for (i=0; i<NCONTACTScxx . . $ `d868uv.c:41:9`!; i++) { |
| 1362 |
contact_tcxx . . $ contact_t# *ct = get_contactcxx . . $ get_contact(94e369325cc5303c).(i); |
| 1363 |
|
| 1364 |
if (!ct) { |
| 1365 |
// Contact is disabled |
| 1366 |
continue; |
| 1367 |
} |
| 1368 |
|
| 1369 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, "%5d ", i+1); |
| 1370 |
print_asciicxx . . $ print_ascii(7c5efebaf8d08723).(out, ct->namecxx . . $ $anonymous_type_a44f2f0574113d8d_4#name., 16, 1); |
| 1371 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, " %-7s %-8d %s\n", CONTACT_TYPEcxx . . $ CONTACT_TYPE.[ct->typecxx . . $ $anonymous_type_a44f2f0574113d8d_4#type. & 3], |
| 1372 |
CONTACT_IDcxx . . $ `d868uv.c:324:9`!(ct), ALERT_TYPEcxx . . $ ALERT_TYPE.[ct->call_alertcxx . . $ $anonymous_type_a44f2f0574113d8d_4#call_alert. & 3]); |
| 1373 |
} |
| 1374 |
} |
| 1375 |
|
| 1376 |
// |
| 1377 |
// Group lists. |
| 1378 |
// |
| 1379 |
if (have_grouplistscxx . . $ have_grouplists(d1b40a211a1a4e4c).()) { |
| 1380 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, "\n"); |
| 1381 |
if (verbose) { |
| 1382 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, "# Table of group lists.\n"); |
| 1383 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, "# 1) Group list number: 1-%d\n", NGLISTScxx . . $ `d868uv.c:43:9`!); |
| 1384 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, "# 2) Name: up to 35 characters, use '_' instead of space\n"); |
| 1385 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, "# 3) List of contacts: numbers and ranges (N-M) separated by comma\n"); |
| 1386 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, "#\n"); |
| 1387 |
} |
| 1388 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, "Grouplist Name Contacts\n"); |
| 1389 |
for (i=0; i<NGLISTScxx . . $ `d868uv.c:43:9`!; i++) { |
| 1390 |
grouplist_tcxx . . $ grouplist_t# *gl = GET_GROUPLISTcxx . . $ `d868uv.c:88:9`!(i); |
| 1391 |
|
| 1392 |
if (!VALID_GROUPLISTcxx . . $ `d868uv.c:93:9`!(gl)) { |
| 1393 |
// Group list is disabled. |
| 1394 |
continue; |
| 1395 |
} |
| 1396 |
|
| 1397 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, "%5d ", i + 1); |
| 1398 |
print_asciicxx . . $ print_ascii(7c5efebaf8d08723).(out, gl->namecxx . . $ $anonymous_type_a44f2f0574113d8d_5#name., 35, 1); |
| 1399 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, " "); |
| 1400 |
print_chanlist32cxx . . $ print_chanlist32(d088b1286977bec5).(out, gl->membercxx . . $ $anonymous_type_a44f2f0574113d8d_5#member., 64); |
| 1401 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, "\n"); |
| 1402 |
} |
| 1403 |
} |
| 1404 |
|
| 1405 |
// |
| 1406 |
// Text messages. |
| 1407 |
// |
| 1408 |
if (have_messagescxx . . $ have_messages(d1b40a211a1a4e4c).()) { |
| 1409 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, "\n"); |
| 1410 |
if (verbose) { |
| 1411 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, "# Table of text messages.\n"); |
| 1412 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, "# 1) Message number: 1-%d\n", NMESSAGEScxx . . $ `d868uv.c:45:9`!); |
| 1413 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, "# 2) Text: up to 200 characters\n"); |
| 1414 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, "#\n"); |
| 1415 |
} |
| 1416 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, "Message Text\n"); |
| 1417 |
for (i=0; i<NMESSAGEScxx . . $ `d868uv.c:45:9`!; i++) { |
| 1418 |
uint8_tcxx . . $ uint8_t# *msg = GET_MESSAGEcxx . . $ `d868uv.c:90:9`!(i); |
| 1419 |
|
| 1420 |
if (!VALID_TEXTcxx . . $ `d868uv.c:92:9`!(msg)) { |
| 1421 |
// Message is disabled |
| 1422 |
continue; |
| 1423 |
} |
| 1424 |
|
| 1425 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, "%5d ", i+1); |
| 1426 |
print_asciicxx . . $ print_ascii(7c5efebaf8d08723).(out, msg, 200, 0); |
| 1427 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, "\n"); |
| 1428 |
} |
| 1429 |
} |
| 1430 |
|
| 1431 |
// General settings. |
| 1432 |
print_idcxx . . $ print_id(e780f64711fb334f).(out, verbose); |
| 1433 |
print_introcxx . . $ print_intro(e780f64711fb334f).(out, verbose); |
| 1434 |
} |
| 1435 |
|
| 1436 |
// |
| 1437 |
// Read memory image from the binary file. |
| 1438 |
// |
| 1439 |
static void d868uv_read_imagecxx . . $ d868uv_read_image(7777599da18afe85).(radio_device_tcxx . . $ radio_device_t# *radio, FILEcxx . . $ FILE# *img) |
| 1440 |
{ |
| 1441 |
struct statcxx . . $ stat# st; |
| 1442 |
|
| 1443 |
// Guess device type by file size. |
| 1444 |
if (fstatcxx . . $ fstat(a43660ce2f600cb5).(filenocxx . . $ fileno(89bc1efcdac0ca22).(img), &st) < 0) { |
| 1445 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Cannot get file size.\n"); |
| 1446 |
exitcxx . . $ exit(3ca292c338df9bb3).(-1); |
| 1447 |
} |
| 1448 |
switch (st.st_sizecxx . . $ stat#st_size.) { |
| 1449 |
case MEMSZcxx . . $ `d868uv.c:99:9`!: |
| 1450 |
// IMG file. |
| 1451 |
if (freadcxx . . $ fread(738fc8ac1d711e58).(&radio_memcxx . . $ radio_mem.[0], 1, MEMSZcxx . . $ `d868uv.c:99:9`!, img) != MEMSZcxx . . $ `d868uv.c:99:9`!) { |
| 1452 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Error reading image data.\n"); |
| 1453 |
exitcxx . . $ exit(3ca292c338df9bb3).(-1); |
| 1454 |
} |
| 1455 |
break; |
| 1456 |
default: |
| 1457 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Unrecognized file size %u bytes.\n", (int) st.st_sizecxx . . $ stat#st_size.); |
| 1458 |
exitcxx . . $ exit(3ca292c338df9bb3).(-1); |
| 1459 |
} |
| 1460 |
} |
| 1461 |
|
| 1462 |
// |
| 1463 |
// Save memory image to the binary file. |
| 1464 |
// |
| 1465 |
static void d868uv_save_imagecxx . . $ d868uv_save_image(7777599da18afe85).(radio_device_tcxx . . $ radio_device_t# *radio, FILEcxx . . $ FILE# *img) |
| 1466 |
{ |
| 1467 |
fwritecxx . . $ fwrite(ab0609fa07c47d6e).(&radio_memcxx . . $ radio_mem.[0], 1, MEMSZcxx . . $ `d868uv.c:99:9`!, img); |
| 1468 |
} |
| 1469 |
|
| 1470 |
// |
| 1471 |
// Parse the scalar parameter. |
| 1472 |
// |
| 1473 |
static void d868uv_parse_parametercxx . . $ d868uv_parse_parameter(581120db4094cbd7).(radio_device_tcxx . . $ radio_device_t# *radio, char *param, char *value) |
| 1474 |
{ |
| 1475 |
if (strcasecmpcxx . . $ strcasecmp(5ae29d726ae57f88).("Radio", param) == 0) { |
| 1476 |
if (!radio_is_compatiblecxx . . $ radio_is_compatible(5c4306d8553b3696).(value)) { |
| 1477 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Incompatible model: %s\n", value); |
| 1478 |
exitcxx . . $ exit(3ca292c338df9bb3).(-1); |
| 1479 |
} |
| 1480 |
return; |
| 1481 |
} |
| 1482 |
|
| 1483 |
radioid_tcxx . . $ radioid_t# *ri = GET_RADIOIDcxx . . $ `d868uv.c:78:9`!(); |
| 1484 |
if (strcasecmpcxx . . $ strcasecmp(5ae29d726ae57f88). ("Name", param) == 0) { |
| 1485 |
ascii_decodecxx . . $ ascii_decode(1872c3fca021760b).(ri->namecxx . . $ $anonymous_type_a44f2f0574113d8d_3#name., value, 16, 0); |
| 1486 |
return; |
| 1487 |
} |
| 1488 |
if (strcasecmpcxx . . $ strcasecmp(5ae29d726ae57f88). ("ID", param) == 0) { |
| 1489 |
uint32_tcxx . . $ uint32_t# id = strtoulcxx . . $ strtoul(31746e8d6ec49860).(value, 0, 0); |
| 1490 |
ri->idcxx . . $ $anonymous_type_a44f2f0574113d8d_3#id.[0] = ((id / 10000000) << 4) | ((id / 1000000) % 10); |
| 1491 |
ri->idcxx . . $ $anonymous_type_a44f2f0574113d8d_3#id.[1] = ((id / 100000 % 10) << 4) | ((id / 10000) % 10); |
| 1492 |
ri->idcxx . . $ $anonymous_type_a44f2f0574113d8d_3#id.[2] = ((id / 1000 % 10) << 4) | ((id / 100) % 10); |
| 1493 |
ri->idcxx . . $ $anonymous_type_a44f2f0574113d8d_3#id.[3] = ((id / 10 % 10) << 4) | (id % 10); |
| 1494 |
return; |
| 1495 |
} |
| 1496 |
|
| 1497 |
general_settings_tcxx . . $ general_settings_t# *gs = GET_SETTINGScxx . . $ `d868uv.c:77:9`!(); |
| 1498 |
if (strcasecmpcxx . . $ strcasecmp(5ae29d726ae57f88). ("Intro Line 1", param) == 0) { |
| 1499 |
ascii_decode_uppercasecxx . . $ ascii_decode_uppercase(1872c3fca021760b).(gs->intro_line1cxx . . $ $anonymous_type_a44f2f0574113d8d_2#intro_line1., value, 14, 0); |
| 1500 |
gs->power_oncxx . . $ $anonymous_type_a44f2f0574113d8d_2#power_on. = PWON_CUST_CHARcxx . . $ `d868uv.c:261:9`!; |
| 1501 |
return; |
| 1502 |
} |
| 1503 |
if (strcasecmpcxx . . $ strcasecmp(5ae29d726ae57f88). ("Intro Line 2", param) == 0) { |
| 1504 |
ascii_decode_uppercasecxx . . $ ascii_decode_uppercase(1872c3fca021760b).(gs->intro_line2cxx . . $ $anonymous_type_a44f2f0574113d8d_2#intro_line2., value, 14, 0); |
| 1505 |
gs->power_oncxx . . $ $anonymous_type_a44f2f0574113d8d_2#power_on. = PWON_CUST_CHARcxx . . $ `d868uv.c:261:9`!; |
| 1506 |
return; |
| 1507 |
} |
| 1508 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Unknown parameter: %s = %s\n", param, value); |
| 1509 |
exitcxx . . $ exit(3ca292c338df9bb3).(-1); |
| 1510 |
} |
| 1511 |
|
| 1512 |
// |
| 1513 |
// Check that the radio does support this frequency. |
| 1514 |
// |
| 1515 |
static int is_valid_frequencycxx . . $ is_valid_frequency(7864480464b09eea).(int mhz) |
| 1516 |
{ |
| 1517 |
if (mhz >= 136 && mhz <= 174) |
| 1518 |
return 1; |
| 1519 |
if (mhz >= 400 && mhz <= 480) |
| 1520 |
return 1; |
| 1521 |
return 0; |
| 1522 |
} |
| 1523 |
|
| 1524 |
// |
| 1525 |
// Find CTCSS value in standard table. |
| 1526 |
// Otherwise return NCTCSS. |
| 1527 |
// |
| 1528 |
static int ctcss_indexcxx . . $ ctcss_index(4c679297bf94b9eb).(unsigned value) |
| 1529 |
{ |
| 1530 |
int i; |
| 1531 |
|
| 1532 |
for (i=0; i<NCTCSScxx . . $ `d868uv.c:425:9`!; i++) |
| 1533 |
if (value == CTCSS_TONEScxx . . $ CTCSS_TONES.[i]) |
| 1534 |
break; |
| 1535 |
return i; |
| 1536 |
} |
| 1537 |
|
| 1538 |
// |
| 1539 |
// Set the parameters for a given memory channel. |
| 1540 |
// |
| 1541 |
static void setup_channelcxx . . $ setup_channel(773bed7e3b707467).(radio_device_tcxx . . $ radio_device_t# *radio, int i, int mode, char *name, |
| 1542 |
double rx_mhz, double tx_mhz, int power, int scanlist, int rxonly, |
| 1543 |
int admit, int colorcode, int timeslot, int grouplist, int contact, |
| 1544 |
int rxtone, int txtone, int width) |
| 1545 |
{ |
| 1546 |
channel_tcxx . . $ channel_t# *ch = get_bankcxx . . $ get_bank(2162c869aea6d4cd).(i >> 7) + (i % 128); |
| 1547 |
uint8_tcxx . . $ uint8_t# *bitmap = &radio_memcxx . . $ radio_mem.[OFFSET_CHAN_MAPcxx . . $ `d868uv.c:58:9`!]; |
| 1548 |
|
| 1549 |
bitmap[i / 8] |= 1 << (i & 7); |
| 1550 |
|
| 1551 |
memsetcxx . . $ memset(d1de1e4fb215f1c6).(ch, 0, sizeof(channel_tcxx . . $ channel_t#)); |
| 1552 |
ascii_decodecxx . . $ ascii_decode(1872c3fca021760b).(ch->namecxx . . $ $anonymous_type_a44f2f0574113d8d_1#name., name, 16, 0); |
| 1553 |
|
| 1554 |
ch->rx_frequencycxx . . $ $anonymous_type_a44f2f0574113d8d_1#rx_frequency. = mhz_to_ghefcdabcxx . . $ mhz_to_ghefcdab(91a40ab43b4b81b).(rx_mhz); |
| 1555 |
if (tx_mhz > rx_mhz) { |
| 1556 |
ch->repeater_modecxx . . $ $anonymous_type_a44f2f0574113d8d_1#repeater_mode. = RM_TXPOScxx . . $ `d868uv.c:146:9`!; |
| 1557 |
ch->tx_offsetcxx . . $ $anonymous_type_a44f2f0574113d8d_1#tx_offset. = mhz_to_ghefcdabcxx . . $ mhz_to_ghefcdab(91a40ab43b4b81b).(tx_mhz - rx_mhz); |
| 1558 |
} else if (tx_mhz < rx_mhz) { |
| 1559 |
ch->repeater_modecxx . . $ $anonymous_type_a44f2f0574113d8d_1#repeater_mode. = RM_TXNEGcxx . . $ `d868uv.c:147:9`!; |
| 1560 |
ch->tx_offsetcxx . . $ $anonymous_type_a44f2f0574113d8d_1#tx_offset. = mhz_to_ghefcdabcxx . . $ mhz_to_ghefcdab(91a40ab43b4b81b).(rx_mhz - tx_mhz); |
| 1561 |
} else { |
| 1562 |
ch->repeater_modecxx . . $ $anonymous_type_a44f2f0574113d8d_1#repeater_mode. = RM_SIMPLEXcxx . . $ `d868uv.c:145:9`!; |
| 1563 |
ch->tx_offsetcxx . . $ $anonymous_type_a44f2f0574113d8d_1#tx_offset. = 0x00000100; |
| 1564 |
} |
| 1565 |
|
| 1566 |
ch->channel_modecxx . . $ $anonymous_type_a44f2f0574113d8d_1#channel_mode. = mode; |
| 1567 |
ch->powercxx . . $ $anonymous_type_a44f2f0574113d8d_1#power. = power; |
| 1568 |
ch->bandwidthcxx . . $ $anonymous_type_a44f2f0574113d8d_1#bandwidth. = width; |
| 1569 |
ch->rx_onlycxx . . $ $anonymous_type_a44f2f0574113d8d_1#rx_only. = rxonly; |
| 1570 |
ch->slot2cxx . . $ $anonymous_type_a44f2f0574113d8d_1#slot2. = (timeslot == 2); |
| 1571 |
ch->color_codecxx . . $ $anonymous_type_a44f2f0574113d8d_1#color_code. = colorcode; |
| 1572 |
ch->tx_permitcxx . . $ $anonymous_type_a44f2f0574113d8d_1#tx_permit. = admit; |
| 1573 |
ch->contact_indexcxx . . $ $anonymous_type_a44f2f0574113d8d_1#contact_index. = contact - 1; |
| 1574 |
ch->group_list_indexcxx . . $ $anonymous_type_a44f2f0574113d8d_1#group_list_index. = grouplist - 1; |
| 1575 |
ch->custom_ctcsscxx . . $ $anonymous_type_a44f2f0574113d8d_1#custom_ctcss. = 251.1 * 10; |
| 1576 |
|
| 1577 |
if (radio == &radio_dmr6x2cxx . . $ radio_dmr6x2.) { |
| 1578 |
// Radio DMR-6x2 has eight scan lists per channel. |
| 1579 |
ch->scan_list_indexcxx . . $ $anonymous_type_a44f2f0574113d8d_1#scan_list_index. = 0; // Channel Measure Mode = Off |
| 1580 |
ch->aprs_channelcxx . . $ $anonymous_type_a44f2f0574113d8d_1#aprs_channel. = scanlist - 1; // Scan list 1 |
| 1581 |
memsetcxx . . $ memset(d1de1e4fb215f1c6).(ch->_unused55cxx . . $ $anonymous_type_a44f2f0574113d8d_1#_unused55., 0xff, 7); // Scan lists 2-8 = Disable |
| 1582 |
} else { |
| 1583 |
ch->scan_list_indexcxx . . $ $anonymous_type_a44f2f0574113d8d_1#scan_list_index. = scanlist - 1; |
| 1584 |
} |
| 1585 |
|
| 1586 |
// rxtone and txtone are positive for DCS and negative for CTCSS. |
| 1587 |
if (rxtone > 0) { // Receive DCS |
| 1588 |
ch->rx_dcscxx . . $ $anonymous_type_a44f2f0574113d8d_1#rx_dcs. = 1; |
| 1589 |
ch->dcs_receivecxx . . $ $anonymous_type_a44f2f0574113d8d_1#dcs_receive. = rxtone - 1; |
| 1590 |
} else if (rxtone < 0) { // Receive CTCSS |
| 1591 |
ch->rx_ctcsscxx . . $ $anonymous_type_a44f2f0574113d8d_1#rx_ctcss. = 1; |
| 1592 |
ch->ctcss_receivecxx . . $ $anonymous_type_a44f2f0574113d8d_1#ctcss_receive. = ctcss_indexcxx . . $ ctcss_index(4c679297bf94b9eb).(-rxtone); |
| 1593 |
if (ch->ctcss_receivecxx . . $ $anonymous_type_a44f2f0574113d8d_1#ctcss_receive. == NCTCSScxx . . $ `d868uv.c:425:9`!) { |
| 1594 |
ch->custom_ctcsscxx . . $ $anonymous_type_a44f2f0574113d8d_1#custom_ctcss. = -rxtone; |
| 1595 |
} |
| 1596 |
} |
| 1597 |
|
| 1598 |
if (ch->rx_ctcsscxx . . $ $anonymous_type_a44f2f0574113d8d_1#rx_ctcss. == 0 && ch->rx_dcscxx . . $ $anonymous_type_a44f2f0574113d8d_1#rx_dcs. == 0) { |
| 1599 |
ch->squelch_modecxx . . $ $anonymous_type_a44f2f0574113d8d_1#squelch_mode. = SQ_CARRIERcxx . . $ `d868uv.c:187:9`!; |
| 1600 |
} else { |
| 1601 |
ch->squelch_modecxx . . $ $anonymous_type_a44f2f0574113d8d_1#squelch_mode. = SQ_TONEcxx . . $ `d868uv.c:188:9`!; |
| 1602 |
} |
| 1603 |
|
| 1604 |
if (txtone > 0) { // Transmit DCS |
| 1605 |
ch->tx_dcscxx . . $ $anonymous_type_a44f2f0574113d8d_1#tx_dcs. = 1; |
| 1606 |
ch->dcs_transmitcxx . . $ $anonymous_type_a44f2f0574113d8d_1#dcs_transmit. = txtone - 1; |
| 1607 |
} else if (txtone < 0) { // Transmit CTCSS |
| 1608 |
ch->tx_ctcsscxx . . $ $anonymous_type_a44f2f0574113d8d_1#tx_ctcss. = 1; |
| 1609 |
ch->ctcss_transmitcxx . . $ $anonymous_type_a44f2f0574113d8d_1#ctcss_transmit. = ctcss_indexcxx . . $ ctcss_index(4c679297bf94b9eb).(-txtone); |
| 1610 |
if (ch->ctcss_transmitcxx . . $ $anonymous_type_a44f2f0574113d8d_1#ctcss_transmit. == NCTCSScxx . . $ `d868uv.c:425:9`!) { |
| 1611 |
ch->custom_ctcsscxx . . $ $anonymous_type_a44f2f0574113d8d_1#custom_ctcss. = -txtone; |
| 1612 |
} |
| 1613 |
} |
| 1614 |
} |
| 1615 |
|
| 1616 |
// |
| 1617 |
// Erase all channels. |
| 1618 |
// |
| 1619 |
static void erase_channelscxx . . $ erase_channels(d878ad36e69247c7).() |
| 1620 |
{ |
| 1621 |
memsetcxx . . $ memset(d1de1e4fb215f1c6).(&radio_memcxx . . $ radio_mem.[OFFSET_BANK1cxx . . $ `d868uv.c:52:9`!], 0xff, NCHANcxx . . $ `d868uv.c:40:9`! * 64); |
| 1622 |
memsetcxx . . $ memset(d1de1e4fb215f1c6).(&radio_memcxx . . $ radio_mem.[OFFSET_CHAN_MAPcxx . . $ `d868uv.c:58:9`!], 0, (NCHANcxx . . $ `d868uv.c:40:9`! + 7) / 8); |
| 1623 |
} |
| 1624 |
|
| 1625 |
// |
| 1626 |
// Erase all zones. |
| 1627 |
// |
| 1628 |
static void erase_zonescxx . . $ erase_zones(d878ad36e69247c7).() |
| 1629 |
{ |
| 1630 |
int i; |
| 1631 |
|
| 1632 |
for (i=0; i<NZONEScxx . . $ `d868uv.c:42:9`!; i++) { |
| 1633 |
memsetcxx . . $ memset(d1de1e4fb215f1c6).(GET_ZONENAMEcxx . . $ `d868uv.c:83:9`!(i), 0xff, 16); |
| 1634 |
memsetcxx . . $ memset(d1de1e4fb215f1c6).(GET_ZONELISTcxx . . $ `d868uv.c:86:9`!(i), 0xff, 2*250); |
| 1635 |
} |
| 1636 |
memsetcxx . . $ memset(d1de1e4fb215f1c6).(GET_ZONEMAPcxx . . $ `d868uv.c:79:9`!(), 0, (NZONEScxx . . $ `d868uv.c:42:9`! + 7) / 8); |
| 1637 |
} |
| 1638 |
|
| 1639 |
// |
| 1640 |
// Erase all scanlists. |
| 1641 |
// |
| 1642 |
static void erase_scanlistscxx . . $ erase_scanlists(d878ad36e69247c7).() |
| 1643 |
{ |
| 1644 |
int i; |
| 1645 |
|
| 1646 |
for (i=0; i<NSCANLcxx . . $ `d868uv.c:44:9`!; i++) { |
| 1647 |
memsetcxx . . $ memset(d1de1e4fb215f1c6).(GET_SCANLISTcxx . . $ `d868uv.c:89:9`!(i), 0xff, 192); |
| 1648 |
} |
| 1649 |
memsetcxx . . $ memset(d1de1e4fb215f1c6).(GET_SCANL_MAPcxx . . $ `d868uv.c:82:9`!(), 0, (NSCANLcxx . . $ `d868uv.c:44:9`! + 7) / 8); |
| 1650 |
} |
| 1651 |
|
| 1652 |
// |
| 1653 |
// Parse one line of Digital channel table. |
| 1654 |
// Start_flag is 1 for the first table row. |
| 1655 |
// Return 0 on failure. |
| 1656 |
// |
| 1657 |
static int parse_digital_channelcxx . . $ parse_digital_channel(603b5a02978e2066).(radio_device_tcxx . . $ radio_device_t# *radio, int first_row, char *line) |
| 1658 |
{ |
| 1659 |
char num_str[256], name_str[256], rxfreq_str[256], offset_str[256]; |
| 1660 |
char power_str[256], scanlist_str[256]; |
| 1661 |
char tot_str[256], rxonly_str[256], admit_str[256], colorcode_str[256]; |
| 1662 |
char slot_str[256], grouplist_str[256], contact_str[256]; |
| 1663 |
int num, power, scanlist, rxonly, admit; |
| 1664 |
int colorcode, timeslot, grouplist, contact; |
| 1665 |
double rx_mhz, tx_mhz; |
| 1666 |
|
| 1667 |
if (sscanfcxx . . $ sscanf(5e8a2c12db2ea735).(line, "%s %s %s %s %s %s %s %s %s %s %s %s %s", |
| 1668 |
num_str, name_str, rxfreq_str, offset_str, |
| 1669 |
power_str, scanlist_str, |
| 1670 |
tot_str, rxonly_str, admit_str, colorcode_str, |
| 1671 |
slot_str, grouplist_str, contact_str) != 13) |
| 1672 |
return 0; |
| 1673 |
|
| 1674 |
num = atoicxx . . $ atoi(5c4306d8553b3696).(num_str); |
| 1675 |
if (num < 1 || num > NCHANcxx . . $ `d868uv.c:40:9`!) { |
| 1676 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Bad channel number.\n"); |
| 1677 |
return 0; |
| 1678 |
} |
| 1679 |
|
| 1680 |
if (sscanfcxx . . $ sscanf(5e8a2c12db2ea735).(rxfreq_str, "%lf", &rx_mhz) != 1 || |
| 1681 |
!is_valid_frequencycxx . . $ is_valid_frequency(7864480464b09eea).(rx_mhz)) { |
| 1682 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Bad receive frequency.\n"); |
| 1683 |
return 0; |
| 1684 |
} |
| 1685 |
if (sscanfcxx . . $ sscanf(5e8a2c12db2ea735).(offset_str, "%lf", &tx_mhz) != 1) { |
| 1686 |
badtx: fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Bad transmit frequency.\n"); |
| 1687 |
return 0; |
| 1688 |
} |
| 1689 |
if (offset_str[0] == '-' || offset_str[0] == '+') |
| 1690 |
tx_mhz += rx_mhz; |
| 1691 |
if (! is_valid_frequencycxx . . $ is_valid_frequency(7864480464b09eea).(tx_mhz)) |
| 1692 |
goto badtx; |
| 1693 |
|
| 1694 |
if (strcasecmpcxx . . $ strcasecmp(5ae29d726ae57f88).("High", power_str) == 0) { |
| 1695 |
power = POWER_HIGHcxx . . $ `d868uv.c:136:9`!; |
| 1696 |
} else if (strcasecmpcxx . . $ strcasecmp(5ae29d726ae57f88).("Low", power_str) == 0) { |
| 1697 |
power = POWER_LOWcxx . . $ `d868uv.c:134:9`!; |
| 1698 |
} else if (strcasecmpcxx . . $ strcasecmp(5ae29d726ae57f88).("Mid", power_str) == 0) { |
| 1699 |
power = POWER_MIDDLEcxx . . $ `d868uv.c:135:9`!; |
| 1700 |
} else if (strcasecmpcxx . . $ strcasecmp(5ae29d726ae57f88).("Turbo", power_str) == 0) { |
| 1701 |
power = POWER_TURBOcxx . . $ `d868uv.c:137:9`!; |
| 1702 |
} else { |
| 1703 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Bad power level.\n"); |
| 1704 |
return 0; |
| 1705 |
} |
| 1706 |
|
| 1707 |
if (*scanlist_str == '-') { |
| 1708 |
scanlist = 0; |
| 1709 |
} else { |
| 1710 |
scanlist = atoicxx . . $ atoi(5c4306d8553b3696).(scanlist_str); |
| 1711 |
if (scanlist == 0 || scanlist > NSCANLcxx . . $ `d868uv.c:44:9`!) { |
| 1712 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Bad scanlist.\n"); |
| 1713 |
return 0; |
| 1714 |
} |
| 1715 |
} |
| 1716 |
|
| 1717 |
// Ignore TOT. |
| 1718 |
|
| 1719 |
if (*rxonly_str == '-') { |
| 1720 |
rxonly = 0; |
| 1721 |
} else if (*rxonly_str == '+') { |
| 1722 |
rxonly = 1; |
| 1723 |
} else { |
| 1724 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Bad receive only flag.\n"); |
| 1725 |
return 0; |
| 1726 |
} |
| 1727 |
|
| 1728 |
if (*admit_str == '-' || strcasecmpcxx . . $ strcasecmp(5ae29d726ae57f88).("Always", admit_str) == 0) { |
| 1729 |
admit = PERMIT_ALWAYScxx . . $ `d868uv.c:194:9`!; |
| 1730 |
} else if (strcasecmpcxx . . $ strcasecmp(5ae29d726ae57f88).("Free", admit_str) == 0) { |
| 1731 |
admit = PERMIT_CH_FREEcxx . . $ `d868uv.c:195:9`!; |
| 1732 |
} else if (strcasecmpcxx . . $ strcasecmp(5ae29d726ae57f88).("Color", admit_str) == 0) { |
| 1733 |
admit = PERMIT_CC_SAMEcxx . . $ `d868uv.c:197:9`!; |
| 1734 |
} else if (strcasecmpcxx . . $ strcasecmp(5ae29d726ae57f88).("NColor", admit_str) == 0) { |
| 1735 |
admit = PERMIT_CC_DIFFcxx . . $ `d868uv.c:196:9`!; |
| 1736 |
} else { |
| 1737 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Bad admit criteria.\n"); |
| 1738 |
return 0; |
| 1739 |
} |
| 1740 |
|
| 1741 |
colorcode = atoicxx . . $ atoi(5c4306d8553b3696).(colorcode_str); |
| 1742 |
if (colorcode < 0 || colorcode > 15) { |
| 1743 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Bad color code.\n"); |
| 1744 |
return 0; |
| 1745 |
} |
| 1746 |
|
| 1747 |
timeslot = atoicxx . . $ atoi(5c4306d8553b3696).(slot_str); |
| 1748 |
if (timeslot < 1 || timeslot > 2) { |
| 1749 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Bad timeslot.\n"); |
| 1750 |
return 0; |
| 1751 |
} |
| 1752 |
|
| 1753 |
if (*grouplist_str == '-') { |
| 1754 |
grouplist = 0; |
| 1755 |
} else { |
| 1756 |
grouplist = atoicxx . . $ atoi(5c4306d8553b3696).(grouplist_str); |
| 1757 |
if (grouplist == 0 || grouplist > NGLISTScxx . . $ `d868uv.c:43:9`!) { |
| 1758 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Bad receive grouplist.\n"); |
| 1759 |
return 0; |
| 1760 |
} |
| 1761 |
} |
| 1762 |
|
| 1763 |
if (*contact_str == '-') { |
| 1764 |
contact = 0; |
| 1765 |
} else { |
| 1766 |
contact = atoicxx . . $ atoi(5c4306d8553b3696).(contact_str); |
| 1767 |
if (contact == 0 || contact > NCONTACTScxx . . $ `d868uv.c:41:9`!) { |
| 1768 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Bad transmit contact.\n"); |
| 1769 |
return 0; |
| 1770 |
} |
| 1771 |
} |
| 1772 |
|
| 1773 |
if (first_row && radio->channel_countcxx . . $ _radio_device_t#channel_count. == 0) { |
| 1774 |
// On first entry, erase all channels, zones and scanlists. |
| 1775 |
erase_channelscxx . . $ erase_channels(d878ad36e69247c7).(); |
| 1776 |
erase_zonescxx . . $ erase_zones(d878ad36e69247c7).(); |
| 1777 |
erase_scanlistscxx . . $ erase_scanlists(d878ad36e69247c7).(); |
| 1778 |
} |
| 1779 |
|
| 1780 |
setup_channelcxx . . $ setup_channel(773bed7e3b707467).(radio, num-1, MODE_DIGITALcxx . . $ `d868uv.c:129:9`!, name_str, rx_mhz, tx_mhz, |
| 1781 |
power, scanlist, rxonly, admit, colorcode, timeslot, |
| 1782 |
grouplist, contact, 0, 0, BW_12_5_KHZcxx . . $ `d868uv.c:140:9`!); |
| 1783 |
|
| 1784 |
radio->channel_countcxx . . $ _radio_device_t#channel_count.++; |
| 1785 |
return 1; |
| 1786 |
} |
| 1787 |
|
| 1788 |
// |
| 1789 |
// Convert tone string to positive for DCS and negative for CTCSS. |
| 1790 |
// On error, return -1. |
| 1791 |
// Four possible formats: |
| 1792 |
// nnn.n - CTCSS frequency |
| 1793 |
// DnnnN - DCS normal |
| 1794 |
// DnnnI - DCS inverted |
| 1795 |
// '-' - Disabled |
| 1796 |
// |
| 1797 |
static int encode_ctcss_dcscxx . . $ encode_ctcss_dcs(1ef8e6ec083aabb9).(char *str) |
| 1798 |
{ |
| 1799 |
int val; |
| 1800 |
|
| 1801 |
if (*str == '-') { |
| 1802 |
// Disabled |
| 1803 |
return 0; |
| 1804 |
|
| 1805 |
} else if (*str == 'D' || *str == 'd') { |
| 1806 |
// |
| 1807 |
// DCS tone |
| 1808 |
// |
| 1809 |
char *e; |
| 1810 |
val = strtoulcxx . . $ strtoul(31746e8d6ec49860).(++str, &e, 8); |
| 1811 |
if (val < 0 || val > 511) { |
| 1812 |
return -1; |
| 1813 |
} |
| 1814 |
|
| 1815 |
if (*e == 'N' || *e == 'n') { |
| 1816 |
val += 1; |
| 1817 |
} else if (*e == 'I' || *e == 'i') { |
| 1818 |
val += 513; |
| 1819 |
} else { |
| 1820 |
return -1; |
| 1821 |
} |
| 1822 |
} else if (*str >= '0' && *str <= '9') { |
| 1823 |
// |
| 1824 |
// CTCSS tone |
| 1825 |
// |
| 1826 |
float hz; |
| 1827 |
if (sscanfcxx . . $ sscanf(5e8a2c12db2ea735).(str, "%f", &hz) != 1) |
| 1828 |
return -1; |
| 1829 |
|
| 1830 |
// Round to integer. |
| 1831 |
val = hz * 10.0 + 0.5; |
| 1832 |
val = -val; |
| 1833 |
} else { |
| 1834 |
return -1; |
| 1835 |
} |
| 1836 |
|
| 1837 |
return val; |
| 1838 |
} |
| 1839 |
|
| 1840 |
// |
| 1841 |
// Parse one line of Analog channel table. |
| 1842 |
// Start_flag is 1 for the first table row. |
| 1843 |
// Return 0 on failure. |
| 1844 |
// |
| 1845 |
static int parse_analog_channelcxx . . $ parse_analog_channel(603b5a02978e2066).(radio_device_tcxx . . $ radio_device_t# *radio, int first_row, char *line) |
| 1846 |
{ |
| 1847 |
char num_str[256], name_str[256], rxfreq_str[256], offset_str[256]; |
| 1848 |
char power_str[256], scanlist_str[256], squelch_str[256]; |
| 1849 |
char tot_str[256], rxonly_str[256], admit_str[256]; |
| 1850 |
char rxtone_str[256], txtone_str[256], width_str[256]; |
| 1851 |
int num, power, scanlist, rxonly, admit; |
| 1852 |
int rxtone, txtone, width; |
| 1853 |
double rx_mhz, tx_mhz; |
| 1854 |
|
| 1855 |
if (sscanfcxx . . $ sscanf(5e8a2c12db2ea735).(line, "%s %s %s %s %s %s %s %s %s %s %s %s %s", |
| 1856 |
num_str, name_str, rxfreq_str, offset_str, |
| 1857 |
power_str, scanlist_str, |
| 1858 |
tot_str, rxonly_str, admit_str, squelch_str, |
| 1859 |
rxtone_str, txtone_str, width_str) != 13) |
| 1860 |
return 0; |
| 1861 |
|
| 1862 |
num = atoicxx . . $ atoi(5c4306d8553b3696).(num_str); |
| 1863 |
if (num < 1 || num > NCHANcxx . . $ `d868uv.c:40:9`!) { |
| 1864 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Bad channel number.\n"); |
| 1865 |
return 0; |
| 1866 |
} |
| 1867 |
|
| 1868 |
if (sscanfcxx . . $ sscanf(5e8a2c12db2ea735).(rxfreq_str, "%lf", &rx_mhz) != 1 || |
| 1869 |
!is_valid_frequencycxx . . $ is_valid_frequency(7864480464b09eea).(rx_mhz)) { |
| 1870 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Bad receive frequency.\n"); |
| 1871 |
return 0; |
| 1872 |
} |
| 1873 |
if (sscanfcxx . . $ sscanf(5e8a2c12db2ea735).(offset_str, "%lf", &tx_mhz) != 1) { |
| 1874 |
badtx: fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Bad transmit frequency.\n"); |
| 1875 |
return 0; |
| 1876 |
} |
| 1877 |
if (offset_str[0] == '-' || offset_str[0] == '+') |
| 1878 |
tx_mhz += rx_mhz; |
| 1879 |
if (! is_valid_frequencycxx . . $ is_valid_frequency(7864480464b09eea).(tx_mhz)) |
| 1880 |
goto badtx; |
| 1881 |
|
| 1882 |
if (strcasecmpcxx . . $ strcasecmp(5ae29d726ae57f88).("High", power_str) == 0) { |
| 1883 |
power = POWER_HIGHcxx . . $ `d868uv.c:136:9`!; |
| 1884 |
} else if (strcasecmpcxx . . $ strcasecmp(5ae29d726ae57f88).("Low", power_str) == 0) { |
| 1885 |
power = POWER_LOWcxx . . $ `d868uv.c:134:9`!; |
| 1886 |
} else if (strcasecmpcxx . . $ strcasecmp(5ae29d726ae57f88).("Mid", power_str) == 0) { |
| 1887 |
power = POWER_MIDDLEcxx . . $ `d868uv.c:135:9`!; |
| 1888 |
} else if (strcasecmpcxx . . $ strcasecmp(5ae29d726ae57f88).("Turbo", power_str) == 0) { |
| 1889 |
power = POWER_TURBOcxx . . $ `d868uv.c:137:9`!; |
| 1890 |
} else { |
| 1891 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Bad power level.\n"); |
| 1892 |
return 0; |
| 1893 |
} |
| 1894 |
|
| 1895 |
if (*scanlist_str == '-') { |
| 1896 |
scanlist = 0; |
| 1897 |
} else { |
| 1898 |
scanlist = atoicxx . . $ atoi(5c4306d8553b3696).(scanlist_str); |
| 1899 |
if (scanlist == 0 || scanlist > NSCANLcxx . . $ `d868uv.c:44:9`!) { |
| 1900 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Bad scanlist.\n"); |
| 1901 |
return 0; |
| 1902 |
} |
| 1903 |
} |
| 1904 |
|
| 1905 |
// Ignore TOT. |
| 1906 |
|
| 1907 |
if (*rxonly_str == '-') { |
| 1908 |
rxonly = 0; |
| 1909 |
} else if (*rxonly_str == '+') { |
| 1910 |
rxonly = 1; |
| 1911 |
} else { |
| 1912 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Bad receive only flag.\n"); |
| 1913 |
return 0; |
| 1914 |
} |
| 1915 |
|
| 1916 |
if (*admit_str == '-' || strcasecmpcxx . . $ strcasecmp(5ae29d726ae57f88).("Always", admit_str) == 0) { |
| 1917 |
admit = PERMIT_ALWAYScxx . . $ `d868uv.c:194:9`!; |
| 1918 |
} else if (strcasecmpcxx . . $ strcasecmp(5ae29d726ae57f88).("Free", admit_str) == 0) { // Busy Lock = Repeater |
| 1919 |
admit = PERMIT_CH_FREEcxx . . $ `d868uv.c:195:9`!; |
| 1920 |
} else if (strcasecmpcxx . . $ strcasecmp(5ae29d726ae57f88).("Tone", admit_str) == 0) { // Busy Lock = Busy |
| 1921 |
admit = PERMIT_CC_SAMEcxx . . $ `d868uv.c:197:9`!; |
| 1922 |
} else { |
| 1923 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Bad admit criteria.\n"); |
| 1924 |
return 0; |
| 1925 |
} |
| 1926 |
|
| 1927 |
// Ignore squelch. |
| 1928 |
|
| 1929 |
rxtone = encode_ctcss_dcscxx . . $ encode_ctcss_dcs(1ef8e6ec083aabb9).(rxtone_str); |
| 1930 |
if (rxtone == -1) { |
| 1931 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Bad receive tone.\n"); |
| 1932 |
return 0; |
| 1933 |
} |
| 1934 |
txtone = encode_ctcss_dcscxx . . $ encode_ctcss_dcs(1ef8e6ec083aabb9).(txtone_str); |
| 1935 |
if (txtone == -1) { |
| 1936 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Bad transmit tone.\n"); |
| 1937 |
return 0; |
| 1938 |
} |
| 1939 |
|
| 1940 |
if (strcasecmpcxx . . $ strcasecmp(5ae29d726ae57f88). ("12.5", width_str) == 0) { |
| 1941 |
width = BW_12_5_KHZcxx . . $ `d868uv.c:140:9`!; |
| 1942 |
} else if (strcasecmpcxx . . $ strcasecmp(5ae29d726ae57f88). ("25", width_str) == 0) { |
| 1943 |
width = BW_25_KHZcxx . . $ `d868uv.c:141:9`!; |
| 1944 |
} else { |
| 1945 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac). (stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Bad width.\n"); |
| 1946 |
return 0; |
| 1947 |
} |
| 1948 |
|
| 1949 |
if (first_row && radio->channel_countcxx . . $ _radio_device_t#channel_count. == 0) { |
| 1950 |
// On first entry, erase all channels, zones and scanlists. |
| 1951 |
erase_channelscxx . . $ erase_channels(d878ad36e69247c7).(); |
| 1952 |
} |
| 1953 |
|
| 1954 |
setup_channelcxx . . $ setup_channel(773bed7e3b707467).(radio, num-1, MODE_ANALOGcxx . . $ `d868uv.c:128:9`!, name_str, rx_mhz, tx_mhz, |
| 1955 |
power, scanlist, rxonly, admit, 0, 1, |
| 1956 |
0, 0, rxtone, txtone, width); |
| 1957 |
|
| 1958 |
radio->channel_countcxx . . $ _radio_device_t#channel_count.++; |
| 1959 |
return 1; |
| 1960 |
} |
| 1961 |
|
| 1962 |
// |
| 1963 |
// Set name for a given zone. |
| 1964 |
// |
| 1965 |
static void setup_zonecxx . . $ setup_zone(66835f578de1bcb3).(int index, const char *name) |
| 1966 |
{ |
| 1967 |
uint8_tcxx . . $ uint8_t# *zmap = GET_ZONEMAPcxx . . $ `d868uv.c:79:9`!(); |
| 1968 |
|
| 1969 |
zmap[index / 8] |= 1 << (index & 7); |
| 1970 |
ascii_decodecxx . . $ ascii_decode(1872c3fca021760b).(GET_ZONENAMEcxx . . $ `d868uv.c:83:9`!(index), name, 16, 0); |
| 1971 |
} |
| 1972 |
|
| 1973 |
// |
| 1974 |
// Add channel to a zone. |
| 1975 |
// Return 0 on failure. |
| 1976 |
// |
| 1977 |
static int zone_appendcxx . . $ zone_append(9b79fb6aee4c0440).(int index, int cnum) |
| 1978 |
{ |
| 1979 |
uint16_tcxx . . $ uint16_t# *zlist = GET_ZONELISTcxx . . $ `d868uv.c:86:9`!(index); |
| 1980 |
uint16_tcxx . . $ uint16_t# *zchan_a = GET_ZONE_CHAN_Acxx . . $ `d868uv.c:84:9`!(index); |
| 1981 |
uint16_tcxx . . $ uint16_t# *zchan_b = GET_ZONE_CHAN_Bcxx . . $ `d868uv.c:85:9`!(index); |
| 1982 |
int i; |
| 1983 |
|
| 1984 |
for (i=0; i<250; i++) { |
| 1985 |
if (zlist[i] == cnum) |
| 1986 |
return 1; |
| 1987 |
if (zlist[i] == 0xffff) { |
| 1988 |
zlist[i] = cnum; |
| 1989 |
|
| 1990 |
if (i == 0) { |
| 1991 |
// Set A and B channels. |
| 1992 |
zchan_a[index] = cnum; |
| 1993 |
zchan_b[index] = cnum; |
| 1994 |
} else if (i == 1) { |
| 1995 |
// Set B channel. |
| 1996 |
zchan_b[index] = cnum; |
| 1997 |
} |
| 1998 |
return 1; |
| 1999 |
} |
| 2000 |
} |
| 2001 |
return 0; |
| 2002 |
} |
| 2003 |
|
| 2004 |
// |
| 2005 |
// Parse one line of Zones table. |
| 2006 |
// Return 0 on failure. |
| 2007 |
// |
| 2008 |
static int parse_zonescxx . . $ parse_zones(3c8082c546dd2ea0).(int first_row, char *line) |
| 2009 |
{ |
| 2010 |
char num_str[256], name_str[256], chan_str[256]; |
| 2011 |
int znum; |
| 2012 |
|
| 2013 |
if (sscanfcxx . . $ sscanf(5e8a2c12db2ea735).(line, "%s %s %s", num_str, name_str, chan_str) != 3) |
| 2014 |
return 0; |
| 2015 |
|
| 2016 |
znum = strtoulcxx . . $ strtoul(31746e8d6ec49860).(num_str, 0, 10); |
| 2017 |
if (znum < 1 || znum > NZONEScxx . . $ `d868uv.c:42:9`!) { |
| 2018 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Bad zone number.\n"); |
| 2019 |
return 0; |
| 2020 |
} |
| 2021 |
|
| 2022 |
if (first_row) { |
| 2023 |
// On first entry, erase the Zones table. |
| 2024 |
erase_zonescxx . . $ erase_zones(d878ad36e69247c7).(); |
| 2025 |
} |
| 2026 |
|
| 2027 |
setup_zonecxx . . $ setup_zone(66835f578de1bcb3).(znum-1, name_str); |
| 2028 |
|
| 2029 |
if (*chan_str != '-') { |
| 2030 |
char *str = chan_str; |
| 2031 |
int nchan = 0; |
| 2032 |
int range = 0; |
| 2033 |
int last = 0; |
| 2034 |
|
| 2035 |
// Parse channel list. |
| 2036 |
for (;;) { |
| 2037 |
char *eptr; |
| 2038 |
int cnum = strtoulcxx . . $ strtoul(31746e8d6ec49860).(str, &eptr, 10); |
| 2039 |
|
| 2040 |
if (eptr == str) { |
| 2041 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Zone %d: wrong channel list '%s'.\n", znum, str); |
| 2042 |
return 0; |
| 2043 |
} |
| 2044 |
if (cnum < 1 || cnum > NCHANcxx . . $ `d868uv.c:40:9`!) { |
| 2045 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Zone %d: wrong channel number %d.\n", znum, cnum); |
| 2046 |
return 0; |
| 2047 |
} |
| 2048 |
|
| 2049 |
if (range) { |
| 2050 |
// Add range. |
| 2051 |
int c; |
| 2052 |
for (c=last+1; c<=cnum; c++) { |
| 2053 |
if (!zone_appendcxx . . $ zone_append(9b79fb6aee4c0440).(znum-1, c-1)) { |
| 2054 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Zone %d: too many channels.\n", znum); |
| 2055 |
return 0; |
| 2056 |
} |
| 2057 |
nchan++; |
| 2058 |
} |
| 2059 |
} else { |
| 2060 |
// Add single channel. |
| 2061 |
if (!zone_appendcxx . . $ zone_append(9b79fb6aee4c0440).(znum-1, cnum-1)) { |
| 2062 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Zone %d: too many channels.\n", znum); |
| 2063 |
return 0; |
| 2064 |
} |
| 2065 |
nchan++; |
| 2066 |
} |
| 2067 |
|
| 2068 |
if (*eptr == 0) |
| 2069 |
break; |
| 2070 |
|
| 2071 |
if (*eptr != ',' && *eptr != '-') { |
| 2072 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Zone %d: wrong channel list '%s'.\n", znum, eptr); |
| 2073 |
return 0; |
| 2074 |
} |
| 2075 |
range = (*eptr == '-'); |
| 2076 |
last = cnum; |
| 2077 |
str = eptr + 1; |
| 2078 |
} |
| 2079 |
} |
| 2080 |
return 1; |
| 2081 |
} |
| 2082 |
|
| 2083 |
// |
| 2084 |
// Set parameters for a given scan list. |
| 2085 |
// |
| 2086 |
static void setup_scanlistcxx . . $ setup_scanlist(36b67d24abe0c786).(int index, const char *name, |
| 2087 |
int prio1, int prio2, int txchan) |
| 2088 |
{ |
| 2089 |
scanlist_tcxx . . $ scanlist_t# *sl = GET_SCANLISTcxx . . $ `d868uv.c:89:9`!(index); |
| 2090 |
uint8_tcxx . . $ uint8_t# *slmap = GET_SCANL_MAPcxx . . $ `d868uv.c:82:9`!(); |
| 2091 |
|
| 2092 |
slmap[index / 8] |= 1 << (index & 7); |
| 2093 |
memsetcxx . . $ memset(d1de1e4fb215f1c6).(sl, 0, 192); |
| 2094 |
memsetcxx . . $ memset(d1de1e4fb215f1c6).(sl->membercxx . . $ $anonymous_type_a44f2f0574113d8d_6#member., 0xff, 100); |
| 2095 |
ascii_decodecxx . . $ ascii_decode(1872c3fca021760b).(sl->namecxx . . $ $anonymous_type_a44f2f0574113d8d_6#name., name, 16, 0); |
| 2096 |
|
| 2097 |
sl->priority_ch1cxx . . $ $anonymous_type_a44f2f0574113d8d_6#priority_ch1. = prio1; // Priority Channel 1: 0=Current Channel, 0xffff=Off |
| 2098 |
sl->priority_ch2cxx . . $ $anonymous_type_a44f2f0574113d8d_6#priority_ch2. = prio2; // Priority Channel 2: 0=Current Channel, 0xffff=Off |
| 2099 |
sl->revert_channelcxx . . $ $anonymous_type_a44f2f0574113d8d_6#revert_channel. = txchan; // Revert Channel: Selected or Last Called |
| 2100 |
|
| 2101 |
if (prio2 != 0xffff) { // Priority Channel Select |
| 2102 |
if (prio1 != 0xffff) { |
| 2103 |
sl->prio_ch_selectcxx . . $ $anonymous_type_a44f2f0574113d8d_6#prio_ch_select. = PRIO_CHAN_SEL12cxx . . $ `d868uv.c:362:9`!; |
| 2104 |
} else { |
| 2105 |
sl->prio_ch_selectcxx . . $ $anonymous_type_a44f2f0574113d8d_6#prio_ch_select. = PRIO_CHAN_SEL2cxx . . $ `d868uv.c:361:9`!; |
| 2106 |
} |
| 2107 |
} else { |
| 2108 |
if (prio1 != 0xffff) { |
| 2109 |
sl->prio_ch_selectcxx . . $ $anonymous_type_a44f2f0574113d8d_6#prio_ch_select. = PRIO_CHAN_SEL1cxx . . $ `d868uv.c:360:9`!; |
| 2110 |
} else { |
| 2111 |
sl->prio_ch_selectcxx . . $ $anonymous_type_a44f2f0574113d8d_6#prio_ch_select. = PRIO_CHAN_OFFcxx . . $ `d868uv.c:359:9`!; |
| 2112 |
} |
| 2113 |
} |
| 2114 |
|
| 2115 |
sl->look_back_acxx . . $ $anonymous_type_a44f2f0574113d8d_6#look_back_a. = 20; // Look Back Time A: 2.0s |
| 2116 |
sl->look_back_bcxx . . $ $anonymous_type_a44f2f0574113d8d_6#look_back_b. = 30; // Look Back Time B: 3.0s |
| 2117 |
sl->dropout_delaycxx . . $ $anonymous_type_a44f2f0574113d8d_6#dropout_delay. = 31; // Dropout Delay Time: 3.1s |
| 2118 |
sl->dwellcxx . . $ $anonymous_type_a44f2f0574113d8d_6#dwell. = 31; // Dwell Time: 3.1s |
| 2119 |
} |
| 2120 |
|
| 2121 |
// |
| 2122 |
// Add channel to a zone. |
| 2123 |
// Return 0 on failure. |
| 2124 |
// |
| 2125 |
static int scanlist_appendcxx . . $ scanlist_append(9b79fb6aee4c0440).(int index, int cnum) |
| 2126 |
{ |
| 2127 |
scanlist_tcxx . . $ scanlist_t# *sl = GET_SCANLISTcxx . . $ `d868uv.c:89:9`!(index); |
| 2128 |
int i; |
| 2129 |
|
| 2130 |
for (i=0; i<50; i++) { |
| 2131 |
if (sl->membercxx . . $ $anonymous_type_a44f2f0574113d8d_6#member.[i] == cnum-1) |
| 2132 |
return 1; |
| 2133 |
if (sl->membercxx . . $ $anonymous_type_a44f2f0574113d8d_6#member.[i] == 0xffff) { |
| 2134 |
sl->membercxx . . $ $anonymous_type_a44f2f0574113d8d_6#member.[i] = cnum-1; |
| 2135 |
return 1; |
| 2136 |
} |
| 2137 |
} |
| 2138 |
return 0; |
| 2139 |
} |
| 2140 |
|
| 2141 |
// |
| 2142 |
// Parse one line of Scanlist table. |
| 2143 |
// Return 0 on failure. |
| 2144 |
// |
| 2145 |
static int parse_scanlistcxx . . $ parse_scanlist(3c8082c546dd2ea0).(int first_row, char *line) |
| 2146 |
{ |
| 2147 |
char num_str[256], name_str[256], prio1_str[256], prio2_str[256]; |
| 2148 |
char tx_str[256], chan_str[256]; |
| 2149 |
int snum, prio1, prio2, txchan; |
| 2150 |
|
| 2151 |
if (sscanfcxx . . $ sscanf(5e8a2c12db2ea735).(line, "%s %s %s %s %s %s", |
| 2152 |
num_str, name_str, prio1_str, prio2_str, tx_str, chan_str) != 6) |
| 2153 |
return 0; |
| 2154 |
|
| 2155 |
snum = atoicxx . . $ atoi(5c4306d8553b3696).(num_str); |
| 2156 |
if (snum < 1 || snum > NSCANLcxx . . $ `d868uv.c:44:9`!) { |
| 2157 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Bad scan list number.\n"); |
| 2158 |
return 0; |
| 2159 |
} |
| 2160 |
|
| 2161 |
if (first_row) { |
| 2162 |
// On first entry, erase the Scanlists table. |
| 2163 |
erase_scanlistscxx . . $ erase_scanlists(d878ad36e69247c7).(); |
| 2164 |
} |
| 2165 |
|
| 2166 |
if (*prio1_str == '-') { |
| 2167 |
prio1 = 0xffff; |
| 2168 |
} else if (strcasecmpcxx . . $ strcasecmp(5ae29d726ae57f88).("Sel", prio1_str) == 0) { |
| 2169 |
prio1 = 0; |
| 2170 |
} else { |
| 2171 |
prio1 = atoicxx . . $ atoi(5c4306d8553b3696).(prio1_str); |
| 2172 |
if (prio1 < 1 || prio1 > NCHANcxx . . $ `d868uv.c:40:9`!) { |
| 2173 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Bad priority channel 1.\n"); |
| 2174 |
return 0; |
| 2175 |
} |
| 2176 |
} |
| 2177 |
|
| 2178 |
if (*prio2_str == '-') { |
| 2179 |
prio2 = 0xffff; |
| 2180 |
} else if (strcasecmpcxx . . $ strcasecmp(5ae29d726ae57f88).("Sel", prio2_str) == 0) { |
| 2181 |
prio2 = 0; |
| 2182 |
} else { |
| 2183 |
prio2 = atoicxx . . $ atoi(5c4306d8553b3696).(prio2_str); |
| 2184 |
if (prio2 < 1 || prio2 > NCHANcxx . . $ `d868uv.c:40:9`!) { |
| 2185 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Bad priority channel 2.\n"); |
| 2186 |
return 0; |
| 2187 |
} |
| 2188 |
} |
| 2189 |
|
| 2190 |
if (strcasecmpcxx . . $ strcasecmp(5ae29d726ae57f88).("Last", tx_str) == 0) { |
| 2191 |
txchan = REVCH_LAST_CALLEDcxx . . $ `d868uv.c:380:9`!; |
| 2192 |
} else if (strcasecmpcxx . . $ strcasecmp(5ae29d726ae57f88).("Sel", tx_str) == 0 || strcasecmpcxx . . $ strcasecmp(5ae29d726ae57f88).("-", tx_str) == 0) { |
| 2193 |
txchan = REVCH_SELECTEDcxx . . $ `d868uv.c:376:9`!; |
| 2194 |
} else { |
| 2195 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Bad transmit channel.\n"); |
| 2196 |
return 0; |
| 2197 |
} |
| 2198 |
|
| 2199 |
setup_scanlistcxx . . $ setup_scanlist(36b67d24abe0c786).(snum-1, name_str, prio1, prio2, txchan); |
| 2200 |
|
| 2201 |
if (*chan_str != '-') { |
| 2202 |
char *str = chan_str; |
| 2203 |
int nchan = 0; |
| 2204 |
int range = 0; |
| 2205 |
int last = 0; |
| 2206 |
|
| 2207 |
// Parse channel list. |
| 2208 |
for (;;) { |
| 2209 |
char *eptr; |
| 2210 |
int cnum = strtoulcxx . . $ strtoul(31746e8d6ec49860).(str, &eptr, 10); |
| 2211 |
|
| 2212 |
if (eptr == str) { |
| 2213 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Scan list %d: wrong channel list '%s'.\n", snum, str); |
| 2214 |
return 0; |
| 2215 |
} |
| 2216 |
if (cnum < 1 || cnum > NCHANcxx . . $ `d868uv.c:40:9`!) { |
| 2217 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Scan list %d: wrong channel number %d.\n", snum, cnum); |
| 2218 |
return 0; |
| 2219 |
} |
| 2220 |
|
| 2221 |
if (range) { |
| 2222 |
// Add range. |
| 2223 |
int c; |
| 2224 |
for (c=last+1; c<=cnum; c++) { |
| 2225 |
if (!scanlist_appendcxx . . $ scanlist_append(9b79fb6aee4c0440).(snum-1, c)) { |
| 2226 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Scan list %d: too many channels.\n", snum); |
| 2227 |
return 0; |
| 2228 |
} |
| 2229 |
nchan++; |
| 2230 |
} |
| 2231 |
} else { |
| 2232 |
// Add single channel. |
| 2233 |
if (!scanlist_appendcxx . . $ scanlist_append(9b79fb6aee4c0440).(snum-1, cnum)) { |
| 2234 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Scan list %d: too many channels.\n", snum); |
| 2235 |
return 0; |
| 2236 |
} |
| 2237 |
nchan++; |
| 2238 |
} |
| 2239 |
|
| 2240 |
if (*eptr == 0) |
| 2241 |
break; |
| 2242 |
|
| 2243 |
if (*eptr != ',' && *eptr != '-') { |
| 2244 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Scan list %d: wrong channel list '%s'.\n", snum, eptr); |
| 2245 |
return 0; |
| 2246 |
} |
| 2247 |
range = (*eptr == '-'); |
| 2248 |
last = cnum; |
| 2249 |
str = eptr + 1; |
| 2250 |
} |
| 2251 |
} |
| 2252 |
return 1; |
| 2253 |
} |
| 2254 |
|
| 2255 |
// |
| 2256 |
// Erase all contacts. |
| 2257 |
// |
| 2258 |
static void erase_contactscxx . . $ erase_contacts(d878ad36e69247c7).() |
| 2259 |
{ |
| 2260 |
memsetcxx . . $ memset(d1de1e4fb215f1c6).(&radio_memcxx . . $ radio_mem.[OFFSET_CONTACTScxx . . $ `d868uv.c:66:9`!], 0xff, NCONTACTScxx . . $ `d868uv.c:41:9`!*100); |
| 2261 |
memsetcxx . . $ memset(d1de1e4fb215f1c6).(GET_CONTACT_LISTcxx . . $ `d868uv.c:81:9`!(), 0xff, NCONTACTScxx . . $ `d868uv.c:41:9`!*4); |
| 2262 |
memsetcxx . . $ memset(d1de1e4fb215f1c6).(GET_CONTACT_MAPcxx . . $ `d868uv.c:80:9`!(), 0xff, (NCONTACTScxx . . $ `d868uv.c:41:9`! + 7) / 8); |
| 2263 |
} |
| 2264 |
|
| 2265 |
static void setup_contactcxx . . $ setup_contact(36b67d24abe0c786).(int index, const char *name, int type, int id, int rxalert) |
| 2266 |
{ |
| 2267 |
// Fill contact record. |
| 2268 |
contact_tcxx . . $ contact_t# *ct = GET_CONTACTcxx . . $ `d868uv.c:87:9`!(index); |
| 2269 |
memsetcxx . . $ memset(d1de1e4fb215f1c6).(ct, 0, 100); |
| 2270 |
ascii_decodecxx . . $ ascii_decode(1872c3fca021760b).(ct->namecxx . . $ $anonymous_type_a44f2f0574113d8d_4#name., name, 16, 0); |
| 2271 |
|
| 2272 |
ct->idcxx . . $ $anonymous_type_a44f2f0574113d8d_4#id.[0] = ((id / 10000000) << 4) | ((id / 1000000) % 10); |
| 2273 |
ct->idcxx . . $ $anonymous_type_a44f2f0574113d8d_4#id.[1] = ((id / 100000 % 10) << 4) | ((id / 10000) % 10); |
| 2274 |
ct->idcxx . . $ $anonymous_type_a44f2f0574113d8d_4#id.[2] = ((id / 1000 % 10) << 4) | ((id / 100) % 10); |
| 2275 |
ct->idcxx . . $ $anonymous_type_a44f2f0574113d8d_4#id.[3] = ((id / 10 % 10) << 4) | (id % 10); |
| 2276 |
|
| 2277 |
ct->typecxx . . $ $anonymous_type_a44f2f0574113d8d_4#type. = type; |
| 2278 |
ct->call_alertcxx . . $ $anonymous_type_a44f2f0574113d8d_4#call_alert. = rxalert; |
| 2279 |
|
| 2280 |
// Update contact map. |
| 2281 |
uint8_tcxx . . $ uint8_t# *cmap = GET_CONTACT_MAPcxx . . $ `d868uv.c:80:9`!(); |
| 2282 |
cmap[index / 8] &= ~(1 << (index & 7)); |
| 2283 |
|
| 2284 |
// Append to the contact list. |
| 2285 |
uint32_tcxx . . $ uint32_t# *clist = GET_CONTACT_LISTcxx . . $ `d868uv.c:81:9`!(); |
| 2286 |
int i; |
| 2287 |
|
| 2288 |
for (i=0; i<NCONTACTScxx . . $ `d868uv.c:41:9`!; i++) { |
| 2289 |
int item = clist[i]; |
| 2290 |
|
| 2291 |
if (item == index) { |
| 2292 |
// The channel is already in the list. |
| 2293 |
break; |
| 2294 |
} |
| 2295 |
if (item == 0xffffffff) { |
| 2296 |
// Append to the end of the list. |
| 2297 |
clist[i] = index; |
| 2298 |
break; |
| 2299 |
} |
| 2300 |
if (item > index) { |
| 2301 |
// Insert index there and shift the rest. |
| 2302 |
clist[i] = index; |
| 2303 |
index = item; |
| 2304 |
} |
| 2305 |
} |
| 2306 |
} |
| 2307 |
|
| 2308 |
// |
| 2309 |
// Parse one line of Contacts table. |
| 2310 |
// Return 0 on failure. |
| 2311 |
// |
| 2312 |
static int parse_contactcxx . . $ parse_contact(3c8082c546dd2ea0).(int first_row, char *line) |
| 2313 |
{ |
| 2314 |
char num_str[256], name_str[256], type_str[256], id_str[256], rxalert_str[256]; |
| 2315 |
int cnum, type, id, rxalert; |
| 2316 |
|
| 2317 |
if (sscanfcxx . . $ sscanf(5e8a2c12db2ea735).(line, "%s %s %s %s %s", |
| 2318 |
num_str, name_str, type_str, id_str, rxalert_str) != 5) |
| 2319 |
return 0; |
| 2320 |
|
| 2321 |
cnum = atoicxx . . $ atoi(5c4306d8553b3696).(num_str); |
| 2322 |
if (cnum < 1 || cnum > NCONTACTScxx . . $ `d868uv.c:41:9`!) { |
| 2323 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Bad contact number.\n"); |
| 2324 |
return 0; |
| 2325 |
} |
| 2326 |
|
| 2327 |
if (first_row) { |
| 2328 |
// On first entry, erase the Contacts table. |
| 2329 |
erase_contactscxx . . $ erase_contacts(d878ad36e69247c7).(); |
| 2330 |
} |
| 2331 |
|
| 2332 |
if (strcasecmpcxx . . $ strcasecmp(5ae29d726ae57f88).("Group", type_str) == 0) { |
| 2333 |
type = CALL_GROUPcxx . . $ `d868uv.c:313:9`!; |
| 2334 |
} else if (strcasecmpcxx . . $ strcasecmp(5ae29d726ae57f88).("Private", type_str) == 0) { |
| 2335 |
type = CALL_PRIVATEcxx . . $ `d868uv.c:312:9`!; |
| 2336 |
} else if (strcasecmpcxx . . $ strcasecmp(5ae29d726ae57f88).("All", type_str) == 0) { |
| 2337 |
type = CALL_ALLcxx . . $ `d868uv.c:314:9`!; |
| 2338 |
} else { |
| 2339 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Bad call type.\n"); |
| 2340 |
return 0; |
| 2341 |
} |
| 2342 |
|
| 2343 |
id = atoicxx . . $ atoi(5c4306d8553b3696).(id_str); |
| 2344 |
if (id < 1 || id > 0xffffff) { |
| 2345 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Bad call ID.\n"); |
| 2346 |
return 0; |
| 2347 |
} |
| 2348 |
|
| 2349 |
if (*rxalert_str == '-' || strcasecmpcxx . . $ strcasecmp(5ae29d726ae57f88).("No", rxalert_str) == 0) { |
| 2350 |
rxalert = ALERT_NONEcxx . . $ `d868uv.c:328:9`!; |
| 2351 |
} else if (*rxalert_str == '+' || strcasecmpcxx . . $ strcasecmp(5ae29d726ae57f88).("Yes", rxalert_str) == 0) { |
| 2352 |
rxalert = ALERT_RINGcxx . . $ `d868uv.c:329:9`!; |
| 2353 |
} else if (strcasecmpcxx . . $ strcasecmp(5ae29d726ae57f88).("Online", rxalert_str) == 0) { |
| 2354 |
rxalert = ALERT_ONLINEcxx . . $ `d868uv.c:330:9`!; |
| 2355 |
} else { |
| 2356 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Bad receive tone flag.\n"); |
| 2357 |
return 0; |
| 2358 |
} |
| 2359 |
|
| 2360 |
setup_contactcxx . . $ setup_contact(36b67d24abe0c786).(cnum-1, name_str, type, id, rxalert); |
| 2361 |
return 1; |
| 2362 |
} |
| 2363 |
|
| 2364 |
static void setup_grouplistcxx . . $ setup_grouplist(66835f578de1bcb3).(int index, const char *name) |
| 2365 |
{ |
| 2366 |
grouplist_tcxx . . $ grouplist_t# *gl = GET_GROUPLISTcxx . . $ `d868uv.c:88:9`!(index); |
| 2367 |
|
| 2368 |
ascii_decodecxx . . $ ascii_decode(1872c3fca021760b).(gl->namecxx . . $ $anonymous_type_a44f2f0574113d8d_5#name., name, 35, 0); |
| 2369 |
memsetcxx . . $ memset(d1de1e4fb215f1c6).(gl->unusedcxx . . $ $anonymous_type_a44f2f0574113d8d_5#unused., 0, sizeof(gl->unusedcxx . . $ $anonymous_type_a44f2f0574113d8d_5#unused.)); |
| 2370 |
} |
| 2371 |
|
| 2372 |
// |
| 2373 |
// Add contact to a grouplist. |
| 2374 |
// Return 0 on failure. |
| 2375 |
// |
| 2376 |
static int grouplist_appendcxx . . $ grouplist_append(9b79fb6aee4c0440).(int index, int cnum) |
| 2377 |
{ |
| 2378 |
grouplist_tcxx . . $ grouplist_t# *gl = GET_GROUPLISTcxx . . $ `d868uv.c:88:9`!(index); |
| 2379 |
int i; |
| 2380 |
|
| 2381 |
for (i=0; i<64; i++) { |
| 2382 |
if (gl->membercxx . . $ $anonymous_type_a44f2f0574113d8d_5#member.[i] == cnum-1) |
| 2383 |
return 1; |
| 2384 |
if (gl->membercxx . . $ $anonymous_type_a44f2f0574113d8d_5#member.[i] == 0xffffffff) { |
| 2385 |
gl->membercxx . . $ $anonymous_type_a44f2f0574113d8d_5#member.[i] = cnum-1; |
| 2386 |
return 1; |
| 2387 |
} |
| 2388 |
} |
| 2389 |
return 0; |
| 2390 |
} |
| 2391 |
|
| 2392 |
// |
| 2393 |
// Parse one line of Grouplist table. |
| 2394 |
// Return 0 on failure. |
| 2395 |
// |
| 2396 |
static int parse_grouplistcxx . . $ parse_grouplist(3c8082c546dd2ea0).(int first_row, char *line) |
| 2397 |
{ |
| 2398 |
char num_str[256], name_str[256], list_str[256]; |
| 2399 |
int glnum; |
| 2400 |
|
| 2401 |
if (sscanfcxx . . $ sscanf(5e8a2c12db2ea735).(line, "%s %s %s", num_str, name_str, list_str) != 3) |
| 2402 |
return 0; |
| 2403 |
|
| 2404 |
glnum = strtoulcxx . . $ strtoul(31746e8d6ec49860).(num_str, 0, 10); |
| 2405 |
if (glnum < 1 || glnum > NGLISTScxx . . $ `d868uv.c:43:9`!) { |
| 2406 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Bad group list number.\n"); |
| 2407 |
return 0; |
| 2408 |
} |
| 2409 |
|
| 2410 |
if (first_row) { |
| 2411 |
// On first entry, erase the Grouplists table. |
| 2412 |
memsetcxx . . $ memset(d1de1e4fb215f1c6).(&radio_memcxx . . $ radio_mem.[OFFSET_GLISTScxx . . $ `d868uv.c:67:9`!], 0xff, NGLISTScxx . . $ `d868uv.c:43:9`!*320); |
| 2413 |
} |
| 2414 |
|
| 2415 |
setup_grouplistcxx . . $ setup_grouplist(66835f578de1bcb3).(glnum-1, name_str); |
| 2416 |
|
| 2417 |
if (*list_str != '-') { |
| 2418 |
char *str = list_str; |
| 2419 |
int range = 0; |
| 2420 |
int last = 0; |
| 2421 |
|
| 2422 |
// Parse contact list. |
| 2423 |
for (;;) { |
| 2424 |
char *eptr; |
| 2425 |
int cnum = strtoulcxx . . $ strtoul(31746e8d6ec49860).(str, &eptr, 10); |
| 2426 |
|
| 2427 |
if (eptr == str) { |
| 2428 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Group list %d: wrong contact list '%s'.\n", glnum, str); |
| 2429 |
return 0; |
| 2430 |
} |
| 2431 |
if (cnum < 1 || cnum > NCONTACTScxx . . $ `d868uv.c:41:9`!) { |
| 2432 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Group list %d: wrong contact number %d.\n", glnum, cnum); |
| 2433 |
return 0; |
| 2434 |
} |
| 2435 |
|
| 2436 |
if (range) { |
| 2437 |
// Add range. |
| 2438 |
int c; |
| 2439 |
for (c=last+1; c<=cnum; c++) { |
| 2440 |
if (!grouplist_appendcxx . . $ grouplist_append(9b79fb6aee4c0440).(glnum-1, c)) { |
| 2441 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Group list %d: too many contacts.\n", glnum); |
| 2442 |
return 0; |
| 2443 |
} |
| 2444 |
} |
| 2445 |
} else { |
| 2446 |
// Add single contact. |
| 2447 |
if (!grouplist_appendcxx . . $ grouplist_append(9b79fb6aee4c0440).(glnum-1, cnum)) { |
| 2448 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Group list %d: too many contacts.\n", glnum); |
| 2449 |
return 0; |
| 2450 |
} |
| 2451 |
} |
| 2452 |
|
| 2453 |
if (*eptr == 0) |
| 2454 |
break; |
| 2455 |
|
| 2456 |
if (*eptr != ',' && *eptr != '-') { |
| 2457 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Group list %d: wrong contact list '%s'.\n", glnum, eptr); |
| 2458 |
return 0; |
| 2459 |
} |
| 2460 |
range = (*eptr == '-'); |
| 2461 |
last = cnum; |
| 2462 |
str = eptr + 1; |
| 2463 |
} |
| 2464 |
} |
| 2465 |
return 1; |
| 2466 |
} |
| 2467 |
|
| 2468 |
// |
| 2469 |
// Set text for a given message. |
| 2470 |
// |
| 2471 |
static void setup_messagecxx . . $ setup_message(66835f578de1bcb3).(int index, const char *text) |
| 2472 |
{ |
| 2473 |
uint8_tcxx . . $ uint8_t# *msg = GET_MESSAGEcxx . . $ `d868uv.c:90:9`!(index); |
| 2474 |
|
| 2475 |
// Skip spaces and tabs. |
| 2476 |
while (*text == ' ' || *text == '\t') |
| 2477 |
text++; |
| 2478 |
ascii_decodecxx . . $ ascii_decode(1872c3fca021760b).(msg, text, 200, 0); |
| 2479 |
} |
| 2480 |
|
| 2481 |
// |
| 2482 |
// Parse one line of Messages table. |
| 2483 |
// Return 0 on failure. |
| 2484 |
// |
| 2485 |
static int parse_messagescxx . . $ parse_messages(3c8082c546dd2ea0).(int first_row, char *line) |
| 2486 |
{ |
| 2487 |
char *text; |
| 2488 |
int mnum; |
| 2489 |
|
| 2490 |
mnum = strtoulcxx . . $ strtoul(31746e8d6ec49860).(line, &text, 10); |
| 2491 |
if (text == line || mnum < 1 || mnum > NMESSAGEScxx . . $ `d868uv.c:45:9`!) { |
| 2492 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Bad message number.\n"); |
| 2493 |
return 0; |
| 2494 |
} |
| 2495 |
|
| 2496 |
if (first_row) { |
| 2497 |
// On first entry, erase the Messages table. |
| 2498 |
memsetcxx . . $ memset(d1de1e4fb215f1c6).(&radio_memcxx . . $ radio_mem.[OFFSET_MESSAGEScxx . . $ `d868uv.c:55:9`!], 0xff, NMESSAGEScxx . . $ `d868uv.c:45:9`!*256); |
| 2499 |
} |
| 2500 |
|
| 2501 |
setup_messagecxx . . $ setup_message(66835f578de1bcb3).(mnum-1, text); |
| 2502 |
return 1; |
| 2503 |
} |
| 2504 |
|
| 2505 |
// |
| 2506 |
// Parse table header. |
| 2507 |
// Return table id, or 0 in case of error. |
| 2508 |
// |
| 2509 |
static int d868uv_parse_headercxx . . $ d868uv_parse_header(641d501f2e215d9b).(radio_device_tcxx . . $ radio_device_t# *radio, char *line) |
| 2510 |
{ |
| 2511 |
if (strncasecmpcxx . . $ strncasecmp(fd278af2f295fa2e).(line, "Digital", 7) == 0) |
| 2512 |
return 'D'; |
| 2513 |
if (strncasecmpcxx . . $ strncasecmp(fd278af2f295fa2e).(line, "Analog", 6) == 0) |
| 2514 |
return 'A'; |
| 2515 |
if (strncasecmpcxx . . $ strncasecmp(fd278af2f295fa2e).(line, "Zone", 4) == 0) |
| 2516 |
return 'Z'; |
| 2517 |
if (strncasecmpcxx . . $ strncasecmp(fd278af2f295fa2e).(line, "Scanlist", 8) == 0) |
| 2518 |
return 'S'; |
| 2519 |
if (strncasecmpcxx . . $ strncasecmp(fd278af2f295fa2e).(line, "Contact", 7) == 0) |
| 2520 |
return 'C'; |
| 2521 |
if (strncasecmpcxx . . $ strncasecmp(fd278af2f295fa2e).(line, "Grouplist", 9) == 0) |
| 2522 |
return 'G'; |
| 2523 |
if (strncasecmpcxx . . $ strncasecmp(fd278af2f295fa2e).(line, "Message", 7) == 0) |
| 2524 |
return 'M'; |
| 2525 |
return 0; |
| 2526 |
} |
| 2527 |
|
| 2528 |
// |
| 2529 |
// Parse one line of table data. |
| 2530 |
// Return 0 on failure. |
| 2531 |
// |
| 2532 |
static int d868uv_parse_rowcxx . . $ d868uv_parse_row(adaf448d3e9fa426).(radio_device_tcxx . . $ radio_device_t# *radio, int table_id, int first_row, char *line) |
| 2533 |
{ |
| 2534 |
switch (table_id) { |
| 2535 |
case 'D': return parse_digital_channelcxx . . $ parse_digital_channel(603b5a02978e2066).(radio, first_row, line); |
| 2536 |
case 'A': return parse_analog_channelcxx . . $ parse_analog_channel(603b5a02978e2066).(radio, first_row, line); |
| 2537 |
case 'Z': return parse_zonescxx . . $ parse_zones(3c8082c546dd2ea0).(first_row, line); |
| 2538 |
case 'S': return parse_scanlistcxx . . $ parse_scanlist(3c8082c546dd2ea0).(first_row, line); |
| 2539 |
case 'C': return parse_contactcxx . . $ parse_contact(3c8082c546dd2ea0).(first_row, line); |
| 2540 |
case 'G': return parse_grouplistcxx . . $ parse_grouplist(3c8082c546dd2ea0).(first_row, line); |
| 2541 |
case 'M': return parse_messagescxx . . $ parse_messages(3c8082c546dd2ea0).(first_row, line); |
| 2542 |
} |
| 2543 |
return 0; |
| 2544 |
} |
| 2545 |
|
| 2546 |
// |
| 2547 |
// Update timestamp. |
| 2548 |
// |
| 2549 |
static void d868uv_update_timestampcxx . . $ d868uv_update_timestamp(b1c64831c0136140).(radio_device_tcxx . . $ radio_device_t# *radio) |
| 2550 |
{ |
| 2551 |
// No timestamp. |
| 2552 |
} |
| 2553 |
|
| 2554 |
// |
| 2555 |
// Check that configuration is correct. |
| 2556 |
// Return 0 on error. |
| 2557 |
// |
| 2558 |
static int d868uv_verify_configcxx . . $ d868uv_verify_config(69c7618638024564).(radio_device_tcxx . . $ radio_device_t# *radio) |
| 2559 |
{ |
| 2560 |
int i, k, nchannels = 0, nzones = 0, nscanlists = 0, ngrouplists = 0; |
| 2561 |
int ncontacts = 0, nerrors = 0; |
| 2562 |
|
| 2563 |
// Channels: check references to scanlists, contacts and grouplists. |
| 2564 |
for (i=0; i<NCHANcxx . . $ `d868uv.c:40:9`!; i++) { |
| 2565 |
channel_tcxx . . $ channel_t# *ch = get_channelcxx . . $ get_channel(2162c869aea6d4cd).(i); |
| 2566 |
|
| 2567 |
if (!ch) |
| 2568 |
continue; |
| 2569 |
|
| 2570 |
nchannels++; |
| 2571 |
int scanlist_index = get_scanlist_indexcxx . . $ get_scanlist_index(32772cb7319ce0ec).(radio, ch); |
| 2572 |
if (scanlist_index != 0xff) { |
| 2573 |
scanlist_tcxx . . $ scanlist_t# *sl = get_scanlistcxx . . $ get_scanlist(c9b8a7001ed875db).(scanlist_index); |
| 2574 |
|
| 2575 |
if (!sl) { |
| 2576 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Channel %d '", i+1); |
| 2577 |
print_asciicxx . . $ print_ascii(7c5efebaf8d08723).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, ch->namecxx . . $ $anonymous_type_a44f2f0574113d8d_1#name., 16, 0); |
| 2578 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "': scanlist %d not found.\n", scanlist_index + 1); |
| 2579 |
nerrors++; |
| 2580 |
} |
| 2581 |
} |
| 2582 |
if (ch->contact_indexcxx . . $ $anonymous_type_a44f2f0574113d8d_1#contact_index. != 0xffff) { |
| 2583 |
contact_tcxx . . $ contact_t# *ct = get_contactcxx . . $ get_contact(94e369325cc5303c).(ch->contact_indexcxx . . $ $anonymous_type_a44f2f0574113d8d_1#contact_index.); |
| 2584 |
|
| 2585 |
if (!ct) { |
| 2586 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Channel %d '", i+1); |
| 2587 |
print_asciicxx . . $ print_ascii(7c5efebaf8d08723).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, ch->namecxx . . $ $anonymous_type_a44f2f0574113d8d_1#name., 16, 0); |
| 2588 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "': contact %d not found.\n", ch->contact_indexcxx . . $ $anonymous_type_a44f2f0574113d8d_1#contact_index. + 1); |
| 2589 |
nerrors++; |
| 2590 |
} |
| 2591 |
} |
| 2592 |
if (ch->group_list_indexcxx . . $ $anonymous_type_a44f2f0574113d8d_1#group_list_index. != 0xff) { |
| 2593 |
grouplist_tcxx . . $ grouplist_t# *gl = GET_GROUPLISTcxx . . $ `d868uv.c:88:9`!(ch->group_list_index); |
| 2594 |
|
| 2595 |
if (!VALID_GROUPLISTcxx . . $ `d868uv.c:93:9`!(gl)) { |
| 2596 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Channel %d '", i+1); |
| 2597 |
print_asciicxx . . $ print_ascii(7c5efebaf8d08723).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, ch->namecxx . . $ $anonymous_type_a44f2f0574113d8d_1#name., 16, 0); |
| 2598 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "': grouplist %d not found.\n", ch->group_list_indexcxx . . $ $anonymous_type_a44f2f0574113d8d_1#group_list_index. + 1); |
| 2599 |
nerrors++; |
| 2600 |
} |
| 2601 |
} |
| 2602 |
} |
| 2603 |
|
| •2604 |
// Zones: check references to channels. |
| 2605 |
for (i=0; i<NZONEScxx . . $ `d868uv.c:42:9`!; i++) { |
| 2606 |
uint8_tcxx . . $ uint8_t# *zname; |
| 2607 |
uint16_tcxx . . $ uint16_t# *zlist; |
| 2608 |
|
| •2609 |
if (!get_zonecxx . . $ get_zone(6880b6aad788d73d).(i, &zname, &zlist)) |
| 2610 |
continue; |
| 2611 |
|
| •2612 |
nzones++; |
| 2613 |
|
| •2614 |
for (k=0; k<250; k++) { |
| 2615 |
int cnum = zlist[k]; |
| 2616 |
|
| •2617 |
if (cnum != 0xffff) { |
| 2618 |
channel_tcxx . . $ channel_t# *ch = get_channelcxx . . $ get_channel(2162c869aea6d4cd).(cnum); |
| 2619 |
|
| •2620 |
if (!ch) { |
| 2621 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Zone %da '", i+1); |
| 2622 |
print_asciicxx . . $ print_ascii(7c5efebaf8d08723).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, zname, 16, 0); |
| 2623 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "': channel %d not found.\n", cnum + 1); // Add +1 to display actual channel number |
| 2624 |
nerrors++; |
| 2625 |
} |
| 2626 |
} |
| 2627 |
} |
| 2628 |
} |
| 2629 |
|
| 2630 |
// Scanlists: check references to channels. |
| 2631 |
for (i=0; i<NSCANLcxx . . $ `d868uv.c:44:9`!; i++) { |
| 2632 |
scanlist_tcxx . . $ scanlist_t# *sl = get_scanlistcxx . . $ get_scanlist(c9b8a7001ed875db).(i); |
| 2633 |
|
| 2634 |
if (!sl) |
| 2635 |
continue; |
| 2636 |
|
| 2637 |
nscanlists++; |
| 2638 |
for (k=0; k<50; k++) { |
| 2639 |
int cindex = sl->membercxx . . $ $anonymous_type_a44f2f0574113d8d_6#member.[k]; |
| 2640 |
|
| 2641 |
if (cindex != 0xffff) { |
| 2642 |
channel_tcxx . . $ channel_t# *ch = get_channelcxx . . $ get_channel(2162c869aea6d4cd).(cindex); |
| 2643 |
|
| 2644 |
if (!ch) { |
| 2645 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Scanlist %d '", i+1); |
| 2646 |
print_asciicxx . . $ print_ascii(7c5efebaf8d08723).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, sl->namecxx . . $ $anonymous_type_a44f2f0574113d8d_6#name., 16, 0); |
| 2647 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "': channel %d not found.\n", cindex+1); |
| 2648 |
nerrors++; |
| 2649 |
} |
| 2650 |
} |
| 2651 |
} |
| 2652 |
} |
| 2653 |
|
| 2654 |
// Grouplists: check references to contacts. |
| 2655 |
for (i=0; i<NGLISTScxx . . $ `d868uv.c:43:9`!; i++) { |
| 2656 |
grouplist_tcxx . . $ grouplist_t# *gl = GET_GROUPLISTcxx . . $ `d868uv.c:88:9`!(i); |
| 2657 |
|
| 2658 |
if (!VALID_GROUPLISTcxx . . $ `d868uv.c:93:9`!(gl)) |
| 2659 |
continue; |
| 2660 |
|
| 2661 |
ngrouplists++; |
| 2662 |
for (k=0; k<64; k++) { |
| 2663 |
int cnum = gl->membercxx . . $ $anonymous_type_a44f2f0574113d8d_5#member.[k]; |
| 2664 |
|
| 2665 |
if (cnum != 0xffffffff) { |
| 2666 |
contact_tcxx . . $ contact_t# *ct = get_contactcxx . . $ get_contact(94e369325cc5303c).(cnum); |
| 2667 |
|
| 2668 |
if (!ct) { |
| 2669 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Grouplist %d '", i+1); |
| 2670 |
print_asciicxx . . $ print_ascii(7c5efebaf8d08723).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, gl->namecxx . . $ $anonymous_type_a44f2f0574113d8d_5#name., 35, 0); |
| 2671 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "': contact %d not found.\n", cnum); |
| 2672 |
nerrors++; |
| 2673 |
} |
| 2674 |
} |
| 2675 |
} |
| 2676 |
} |
| 2677 |
|
| 2678 |
// Count contacts. |
| 2679 |
for (i=0; i<NCONTACTScxx . . $ `d868uv.c:41:9`!; i++) { |
| 2680 |
contact_tcxx . . $ contact_t# *ct = get_contactcxx . . $ get_contact(94e369325cc5303c).(i); |
| 2681 |
|
| 2682 |
if (ct) |
| 2683 |
ncontacts++; |
| 2684 |
} |
| 2685 |
|
| 2686 |
// Contacts have to be continuous for UV380. |
| 2687 |
for (i=0; i<ncontacts; i++) { |
| 2688 |
if (!get_contactcxx . . $ get_contact(94e369325cc5303c).(i)) { |
| 2689 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Contact %d is missing.\n", i+1); |
| 2690 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Contacts must be continuous for %s.\n", radio->namecxx . . $ _radio_device_t#name.); |
| 2691 |
nerrors++; |
| 2692 |
break; |
| 2693 |
} |
| 2694 |
} |
| 2695 |
|
| 2696 |
if (nerrors > 0) { |
| 2697 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Total %d errors.\n", nerrors); |
| 2698 |
return 0; |
| 2699 |
} |
| 2700 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Total %d channels, %d zones, %d scanlists, %d contacts, %d grouplists.\n", |
| 2701 |
nchannels, nzones, nscanlists, ncontacts, ngrouplists); |
| 2702 |
return 1; |
| 2703 |
} |
| 2704 |
|
| 2705 |
// |
| 2706 |
// Read and dump the callsign database. |
| 2707 |
// |
| 2708 |
static void dump_csvcxx . . $ dump_csv(b1c64831c0136140).(radio_device_tcxx . . $ radio_device_t# *radio) |
| 2709 |
{ |
| 2710 |
callsign_sizes_tcxx . . $ callsign_sizes_t# sz = {0}; |
| 2711 |
|
| 2712 |
// |
| 2713 |
// Dump sizes. |
| 2714 |
// |
| 2715 |
serial_read_regioncxx . . $ serial_read_region(dde21517a502ab05).(ADDR_CALLDB_SIZEcxx . . $ `d868uv.c:74:9`!, (uint8_tcxx . . $ uint8_t#*) &sz, 16); |
| 2716 |
printfcxx . . $ printf(581fddd72a8db8fc).("Sizes:\n"); |
| 2717 |
print_hex_addr_datacxx . . $ print_hex_addr_data(367911548f39ed89).(ADDR_CALLDB_SIZEcxx . . $ `d868uv.c:74:9`!, (uint8_tcxx . . $ uint8_t#*)&sz, sizeof(sz)); |
| 2718 |
printfcxx . . $ printf(581fddd72a8db8fc).("\n"); |
| 2719 |
|
| 2720 |
// |
| 2721 |
// Dump callsign map. |
| 2722 |
// |
| 2723 |
unsigned addr = ADDR_CALLDB_LISTcxx . . $ `d868uv.c:72:9`!; |
| 2724 |
unsigned index; |
| 2725 |
|
| 2726 |
printfcxx . . $ printf(581fddd72a8db8fc).("Map:\n"); |
| 2727 |
for (index = 0; index < sz.countcxx . . $ $anonymous_type_a44f2f0574113d8d_8#count.; index += 16000) { |
| 2728 |
unsigned n = (sz.countcxx . . $ $anonymous_type_a44f2f0574113d8d_8#count. - index) * 8; |
| 2729 |
if (n > 128000) |
| 2730 |
n = 128000; |
| 2731 |
|
| 2732 |
uint8_tcxx . . $ uint8_t# map[128000]; |
| 2733 |
serial_read_regioncxx . . $ serial_read_region(dde21517a502ab05).(addr, map, n); |
| 2734 |
print_hex_addr_datacxx . . $ print_hex_addr_data(367911548f39ed89).(addr, map, n); |
| 2735 |
addr += 256*1024; |
| 2736 |
} |
| 2737 |
printfcxx . . $ printf(581fddd72a8db8fc).("\n"); |
| 2738 |
|
| 2739 |
// |
| 2740 |
// Dump data. |
| 2741 |
// |
| 2742 |
printfcxx . . $ printf(581fddd72a8db8fc).("Data:\n"); |
| 2743 |
addr = ADDR_CALLDB_DATAcxx . . $ `d868uv.c:75:9`!; |
| 2744 |
for (index = 0; index < 10000000; index += 100000) { |
| 2745 |
int n = sz.lastcxx . . $ $anonymous_type_a44f2f0574113d8d_8#last. - addr; |
| 2746 |
if (n < 0) |
| 2747 |
break; |
| 2748 |
else if (n > 100000) |
| 2749 |
n = 100000; |
| 2750 |
else |
| 2751 |
n = (n + 15) & ~15; // align |
| 2752 |
|
| 2753 |
uint8_tcxx . . $ uint8_t# data[100000]; |
| 2754 |
serial_read_regioncxx . . $ serial_read_region(dde21517a502ab05).(addr, data, n); |
| 2755 |
print_hex_addr_datacxx . . $ print_hex_addr_data(367911548f39ed89).(addr, data, n); |
| 2756 |
addr += 256*1024; |
| 2757 |
} |
| 2758 |
} |
| 2759 |
|
| 2760 |
// |
| 2761 |
// Sorting callback for callsign map. |
| 2762 |
// |
| 2763 |
static int compare_callsign_mapcxx . . $ compare_callsign_map(9148c8c3ff42c9d8).(const void *ap, const void *bp) |
| 2764 |
{ |
| 2765 |
uint32_tcxx . . $ uint32_t# a = *(uint32_tcxx . . $ uint32_t#*) ap; |
| 2766 |
uint32_tcxx . . $ uint32_t# b = *(uint32_tcxx . . $ uint32_t#*) bp; |
| 2767 |
|
| 2768 |
if (a < b) |
| 2769 |
return -1; |
| 2770 |
if (a > b) |
| 2771 |
return 1; |
| 2772 |
return 0; |
| 2773 |
} |
| 2774 |
|
| 2775 |
// |
| 2776 |
// Write CSV file to the callsign database. |
| 2777 |
// |
| 2778 |
// The callsign database consists of three parts: |
| 2779 |
// (1) Map of DMR IDs to data offsets: 8 bytes per record. |
| 2780 |
// 04000000: 02-60-04-02-00-00-00-00-04-60-04-02-35-00-00-00 .`.......`..5... |
| 2781 |
// 04000010: 06-60-04-02-70-00-00-00-08-60-04-02-a7-00-00-00 .`..p....`...... |
| 2782 |
// ^^^^^^^^^^^ ^^^^^^^^^^^ |
| 2783 |
// radio id<<1 offset |
| 2784 |
// |
| 2785 |
// The map is stored in 128000-byte chunks with 256kbyte step: |
| 2786 |
// 04000000-0401f3ff, 04040000-0405f3ff, 04080000-0409f3ff, 040c0000-040df3ff, |
| 2787 |
// 04100000-0411f3ff, 04140000-0415f3ff, 04180000-0419f3ff, 041c0000-... |
| 2788 |
// |
| 2789 |
// Up to 10 chunks in total. Last range is 04240000-0425f3ff. |
| 2790 |
// Max 160000 callsigns. |
| 2791 |
// |
| 2792 |
// (2) Sizes: count of records and last data address. |
| 2793 |
// 044c0000: bf-b7-01-00-bd-f6-34-05-00-00-00-00-00-00-00-00 ......4......... |
| 2794 |
// ^^^^^^^^^^^ ^^^^^^^^^^^ |
| 2795 |
// count last address |
| 2796 |
// |
| 2797 |
// (3) Data records: radio id, name, city, callsign, state, country, remarks. |
| 2798 |
// 04500000: 00-01-02-30-01-00-57-61-79-6e-65-20-45-64-77-61 ...0..Wayne Edwa |
| 2799 |
// 04500010: 72-64-00-54-6f-72-6f-6e-74-6f-00-56-45-33-54-48 rd.Toronto.VE3TH |
| 2800 |
// 04500020: 57-00-4f-6e-74-61-72-69-6f-00-43-61-6e-61-64-61 W.Ontario.Canada |
| 2801 |
// 04500030: 00-44-4d-52-00- .DMR. |
| 2802 |
// |
| 2803 |
// The data are stored in 100000-byte chunks with 256kbyte step: |
| 2804 |
// 04500000-0451869f, 04540000-0455869f, ... 05340000-0535869f and so on. |
| 2805 |
// |
| 2806 |
static void d868uv_write_csvcxx . . $ d868uv_write_csv(7777599da18afe85).(radio_device_tcxx . . $ radio_device_t# *radio, FILEcxx . . $ FILE# *csv) |
| 2807 |
{ |
| 2808 |
callsign_map_tcxx . . $ callsign_map_t# map[NCALLSIGNScxx . . $ `d868uv.c:46:9`!]; |
| 2809 |
callsign_sizes_tcxx . . $ callsign_sizes_t# sz = {0}; |
| 2810 |
|
| 2811 |
// Allocate data. |
| 2812 |
char *data = malloccxx . . $ malloc(bfcfa4d6b7f7ef64).(CALLSIGN_SIZEcxx . . $ `d868uv.c:47:9`!); |
| 2813 |
if (!data) { |
| 2814 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Out of memory!\n"); |
| 2815 |
return; |
| 2816 |
} |
| 2817 |
memsetcxx . . $ memset(d1de1e4fb215f1c6).(data, 0, CALLSIGN_SIZEcxx . . $ `d868uv.c:47:9`!); |
| 2818 |
memsetcxx . . $ memset(d1de1e4fb215f1c6).(map, 0xff, sizeof(map)); |
| 2819 |
|
| 2820 |
// |
| 2821 |
// Parse CSV file. |
| 2822 |
// |
| 2823 |
// The file has the following format: |
| 2824 |
// Radio ID,Callsign,Name,City,State,Country,Remarks |
| 2825 |
// 3114542,KK6ABQ,Sergey Vakulenko,Santa Clara,California,United States,DMR |
| 2826 |
// |
| 2827 |
// Need to rearrange the fields like: |
| 2828 |
// Radio ID, Name, City, Callsign, State, Country, Remarks |
| 2829 |
// |
| 2830 |
unsigned nbytes = 0; |
| 2831 |
char *radioid, *callsign, *name, *city, *state, *country, *remarks; |
| 2832 |
|
| 2833 |
if (csv_initcxx . . $ csv_init(89bc1efcdac0ca22).(csv) < 0) { |
| 2834 |
freecxx . . $ free(5d22bdacc48458e8).(data); |
| 2835 |
return; |
| 2836 |
} |
| 2837 |
while (csv_readcxx . . $ csv_read(7992758c57b02f75).(csv, &radioid, &callsign, &name, &city, &state, &country, &remarks)) { |
| 2838 |
radioid = trim_spacescxx . . $ trim_spaces(ad13dc7cd1ddbf0a).(radioid, 16); |
| 2839 |
callsign = trim_spacescxx . . $ trim_spaces(ad13dc7cd1ddbf0a).(callsign, 16); |
| 2840 |
name = trim_spacescxx . . $ trim_spaces(ad13dc7cd1ddbf0a).(name, 16); |
| 2841 |
city = trim_spacescxx . . $ trim_spaces(ad13dc7cd1ddbf0a).(city, 15); |
| 2842 |
state = trim_spacescxx . . $ trim_spaces(ad13dc7cd1ddbf0a).(state, 16); |
| 2843 |
country = trim_spacescxx . . $ trim_spaces(ad13dc7cd1ddbf0a).(country, 16); |
| 2844 |
remarks = trim_spacescxx . . $ trim_spaces(ad13dc7cd1ddbf0a).(remarks, 16); |
| 2845 |
//printf("%s,%s,%s,%s,%s,%s,%s\n", radioid, callsign, name, city, state, country, remarks); |
| 2846 |
|
| 2847 |
unsigned id = strtoulcxx . . $ strtoul(31746e8d6ec49860).(radioid, 0, 10); |
| 2848 |
if (id < 1 || id > 0xffffff) { |
| 2849 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Bad id: %d\n", id); |
| 2850 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Line: '%s,%s,%s,%s,%s,%s,%s'\n", |
| 2851 |
radioid, callsign, name, city, state, country, remarks); |
| 2852 |
return; |
| 2853 |
} |
| 2854 |
|
| 2855 |
// Eastern egg: when file contains id 1 with callsign 'dump', |
| 2856 |
// read the callsign database from the radio |
| 2857 |
// and save to a file. |
| 2858 |
if (id == 1 && strcmpcxx . . $ strcmp(5ae29d726ae57f88).(callsign, "dump") == 0) { |
| 2859 |
freecxx . . $ free(5d22bdacc48458e8).(data); |
| 2860 |
dump_csvcxx . . $ dump_csv(b1c64831c0136140).(radio); |
| 2861 |
return; |
| 2862 |
} |
| 2863 |
|
| 2864 |
// Add map record. |
| 2865 |
if (sz.countcxx . . $ $anonymous_type_a44f2f0574113d8d_8#count. >= NCALLSIGNScxx . . $ `d868uv.c:46:9`!) { |
| 2866 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "WARNING: Too many callsigns!\n"); |
| 2867 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Skipping the rest.\n"); |
| 2868 |
break; |
| 2869 |
} |
| 2870 |
callsign_map_tcxx . . $ callsign_map_t# *m = &map[sz.countcxx . . $ $anonymous_type_a44f2f0574113d8d_8#count.]; |
| 2871 |
sz.countcxx . . $ $anonymous_type_a44f2f0574113d8d_8#count.++; |
| 2872 |
m->idcxx . . $ $anonymous_type_a44f2f0574113d8d_7#id. = ((id / 10 % 10) << 5) | (id % 10) << 1 | |
| 2873 |
((id / 1000 % 10) << 13) | ((id / 100) % 10) << 9 | |
| 2874 |
((id / 100000 % 10) << 21) | ((id / 10000) % 10) << 17 | |
| 2875 |
((id / 10000000) << 29) | ((id / 1000000) % 10) << 25; |
| 2876 |
m->offsetcxx . . $ $anonymous_type_a44f2f0574113d8d_7#offset. = nbytes; |
| 2877 |
|
| 2878 |
// Fill data. |
| 2879 |
char *p = &data[nbytes]; |
| 2880 |
|
| 2881 |
// Radio ID. |
| 2882 |
*p++ = 0; |
| 2883 |
*p++ = ((id / 10000000) << 4) | ((id / 1000000) % 10); |
| 2884 |
*p++ = ((id / 100000 % 10) << 4) | ((id / 10000) % 10); |
| 2885 |
*p++ = ((id / 1000 % 10) << 4) | ((id / 100) % 10); |
| 2886 |
*p++ = ((id / 10 % 10) << 4) | (id % 10); |
| 2887 |
*p++ = 0; |
| 2888 |
|
| 2889 |
// Name, city, callsign, state, country, remarks. |
| 2890 |
strcpycxx . . $ strcpy(b7b3a83273496486).(p, name); p += strlencxx . . $ strlen(751346f8406fd082).(p) + 1; |
| 2891 |
strcpycxx . . $ strcpy(b7b3a83273496486).(p, city); p += strlencxx . . $ strlen(751346f8406fd082).(p) + 1; |
| 2892 |
strcpycxx . . $ strcpy(b7b3a83273496486).(p, callsign); p += strlencxx . . $ strlen(751346f8406fd082).(p) + 1; |
| 2893 |
strcpycxx . . $ strcpy(b7b3a83273496486).(p, state); p += strlencxx . . $ strlen(751346f8406fd082).(p) + 1; |
| 2894 |
strcpycxx . . $ strcpy(b7b3a83273496486).(p, country); p += strlencxx . . $ strlen(751346f8406fd082).(p) + 1; |
| 2895 |
strcpycxx . . $ strcpy(b7b3a83273496486).(p, remarks); p += strlencxx . . $ strlen(751346f8406fd082).(p) + 1; |
| 2896 |
|
| 2897 |
nbytes = p - data; |
| 2898 |
} |
| 2899 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Total %d contacts, %d bytes.\n", sz.countcxx . . $ $anonymous_type_a44f2f0574113d8d_8#count., nbytes); |
| 2900 |
|
| 2901 |
sz.lastcxx . . $ $anonymous_type_a44f2f0574113d8d_8#last. = ADDR_CALLDB_DATAcxx . . $ `d868uv.c:75:9`! + (nbytes / 100000) * 256*1024 + (nbytes % 100000); |
| 2902 |
|
| 2903 |
// Append extra zeroes and align. |
| 2904 |
nbytes = (nbytes + 63) & ~15; |
| 2905 |
|
| 2906 |
// Sort the map by DMR ID. |
| 2907 |
qsortcxx . . $ qsort(ebb60b13a65e77d7).(map, sz.countcxx . . $ $anonymous_type_a44f2f0574113d8d_8#count., sizeof(map[0]), compare_callsign_mapcxx . . $ compare_callsign_map(9148c8c3ff42c9d8).); |
| 2908 |
|
| 2909 |
if (! trace_flagcxx . . $ trace_flag.) { |
| 2910 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Write: "); |
| 2911 |
fflushcxx . . $ fflush(89bc1efcdac0ca22).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!); |
| 2912 |
} |
| 2913 |
|
| 2914 |
// |
| 2915 |
// Write callsign map. |
| 2916 |
// |
| 2917 |
unsigned addr = ADDR_CALLDB_LISTcxx . . $ `d868uv.c:72:9`!; |
| 2918 |
unsigned index; |
| 2919 |
|
| 2920 |
//#define DUMP_NO_WRITE |
| 2921 |
#ifdef DUMP_NO_WRITE |
| 2922 |
printf("Map:\n"); |
| 2923 |
#endif |
| 2924 |
for (index = 0; index < sz.countcxx . . $ $anonymous_type_a44f2f0574113d8d_8#count.; index += 16000) { |
| 2925 |
unsigned n = (sz.countcxx . . $ $anonymous_type_a44f2f0574113d8d_8#count. - index) * 8; |
| 2926 |
if (n > 128000) |
| 2927 |
n = 128000; |
| 2928 |
|
| 2929 |
#ifdef DUMP_NO_WRITE |
| 2930 |
// Dump the data, for debugging purposes. |
| 2931 |
print_hex_addr_data(addr, (uint8_t*) &map[index], n); |
| 2932 |
#else |
| 2933 |
serial_write_regioncxx . . $ serial_write_region(dde21517a502ab05).(addr, (uint8_tcxx . . $ uint8_t#*) &map[index], n); |
| 2934 |
#endif |
| 2935 |
addr += 256*1024; |
| 2936 |
|
| 2937 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "#"); |
| 2938 |
fflushcxx . . $ fflush(89bc1efcdac0ca22).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!); |
| 2939 |
} |
| 2940 |
|
| 2941 |
// |
| 2942 |
// Write sizes. |
| 2943 |
// |
| 2944 |
#ifdef DUMP_NO_WRITE |
| 2945 |
printf("\nSizes:\n"); |
| 2946 |
print_hex_addr_data(ADDR_CALLDB_SIZE, (uint8_t*) &sz, 16); |
| 2947 |
#else |
| 2948 |
serial_write_regioncxx . . $ serial_write_region(dde21517a502ab05).(ADDR_CALLDB_SIZEcxx . . $ `d868uv.c:74:9`!, (uint8_tcxx . . $ uint8_t#*) &sz, 16); |
| 2949 |
#endif |
| 2950 |
|
| 2951 |
// |
| 2952 |
// Write data. |
| 2953 |
// |
| 2954 |
addr = ADDR_CALLDB_DATAcxx . . $ `d868uv.c:75:9`!; |
| 2955 |
#ifdef DUMP_NO_WRITE |
| 2956 |
printf("\nData:\n"); |
| 2957 |
#endif |
| 2958 |
for (index = 0; index < nbytes; index += 100000) { |
| 2959 |
unsigned n = nbytes - index; |
| 2960 |
if (n > 100000) |
| 2961 |
n = 100000; |
| 2962 |
|
| 2963 |
#ifdef DUMP_NO_WRITE |
| 2964 |
print_hex_addr_data(addr, (uint8_t*) &data[index], n); |
| 2965 |
#else |
| 2966 |
serial_write_regioncxx . . $ serial_write_region(dde21517a502ab05).(addr, (uint8_tcxx . . $ uint8_t#*) &data[index], n); |
| 2967 |
#endif |
| 2968 |
addr += 256*1024; |
| 2969 |
|
| 2970 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "#"); |
| 2971 |
fflushcxx . . $ fflush(89bc1efcdac0ca22).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!); |
| 2972 |
} |
| 2973 |
|
| 2974 |
if (! trace_flagcxx . . $ trace_flag.) |
| 2975 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "# done.\n"); |
| 2976 |
freecxx . . $ free(5d22bdacc48458e8).(data); |
| 2977 |
} |
| 2978 |
|
| 2979 |
// |
| 2980 |
// Anytone AT-D868UV |
| 2981 |
// |
| 2982 |
radio_device_tcxx . . $ radio_device_t# radio_d868uvcxx . . $ radio_d868uv. = { |
| 2983 |
"Anytone AT-D868UV", |
| 2984 |
d868uv_downloadcxx . . $ d868uv_download(b1c64831c0136140)., |
| 2985 |
d868uv_uploadcxx . . $ d868uv_upload(3b0819f82d2f8fcd)., |
| 2986 |
d868uv_is_compatiblecxx . . $ d868uv_is_compatible(69c7618638024564)., |
| 2987 |
d868uv_read_imagecxx . . $ d868uv_read_image(7777599da18afe85)., |
| 2988 |
d868uv_save_imagecxx . . $ d868uv_save_image(7777599da18afe85)., |
| 2989 |
d868uv_print_versioncxx . . $ d868uv_print_version(7777599da18afe85)., |
| 2990 |
d868uv_print_configcxx . . $ d868uv_print_config(c18371ed0cec106e)., |
| 2991 |
d868uv_verify_configcxx . . $ d868uv_verify_config(69c7618638024564)., |
| 2992 |
d868uv_parse_parametercxx . . $ d868uv_parse_parameter(581120db4094cbd7)., |
| 2993 |
d868uv_parse_headercxx . . $ d868uv_parse_header(641d501f2e215d9b)., |
| 2994 |
d868uv_parse_rowcxx . . $ d868uv_parse_row(adaf448d3e9fa426)., |
| 2995 |
d868uv_update_timestampcxx . . $ d868uv_update_timestamp(b1c64831c0136140)., |
| 2996 |
d868uv_write_csvcxx . . $ d868uv_write_csv(7777599da18afe85)., |
| 2997 |
}; |
| 2998 |
|
| 2999 |
// |
| 3000 |
// Anytone AT-D878UV |
| 3001 |
// |
| 3002 |
radio_device_tcxx . . $ radio_device_t# radio_d878uvcxx . . $ radio_d878uv. = { |
| 3003 |
"Anytone AT-D878UV", |
| 3004 |
d868uv_downloadcxx . . $ d868uv_download(b1c64831c0136140)., |
| 3005 |
d868uv_uploadcxx . . $ d868uv_upload(3b0819f82d2f8fcd)., |
| 3006 |
d868uv_is_compatiblecxx . . $ d868uv_is_compatible(69c7618638024564)., |
| 3007 |
d868uv_read_imagecxx . . $ d868uv_read_image(7777599da18afe85)., |
| 3008 |
d868uv_save_imagecxx . . $ d868uv_save_image(7777599da18afe85)., |
| 3009 |
d868uv_print_versioncxx . . $ d868uv_print_version(7777599da18afe85)., |
| 3010 |
d868uv_print_configcxx . . $ d868uv_print_config(c18371ed0cec106e)., |
| 3011 |
d868uv_verify_configcxx . . $ d868uv_verify_config(69c7618638024564)., |
| 3012 |
d868uv_parse_parametercxx . . $ d868uv_parse_parameter(581120db4094cbd7)., |
| 3013 |
d868uv_parse_headercxx . . $ d868uv_parse_header(641d501f2e215d9b)., |
| 3014 |
d868uv_parse_rowcxx . . $ d868uv_parse_row(adaf448d3e9fa426)., |
| 3015 |
d868uv_update_timestampcxx . . $ d868uv_update_timestamp(b1c64831c0136140)., |
| 3016 |
d868uv_write_csvcxx . . $ d868uv_write_csv(7777599da18afe85)., |
| 3017 |
}; |
| 3018 |
|
| 3019 |
// |
| 3020 |
// BTECH DMR-6x2 |
| 3021 |
// |
| 3022 |
radio_device_tcxx . . $ radio_device_t# radio_dmr6x2cxx . . $ radio_dmr6x2. = { |
| 3023 |
"BTECH DMR-6x2", |
| 3024 |
d868uv_downloadcxx . . $ d868uv_download(b1c64831c0136140)., |
| 3025 |
d868uv_uploadcxx . . $ d868uv_upload(3b0819f82d2f8fcd)., |
| 3026 |
d868uv_is_compatiblecxx . . $ d868uv_is_compatible(69c7618638024564)., |
| 3027 |
d868uv_read_imagecxx . . $ d868uv_read_image(7777599da18afe85)., |
| 3028 |
d868uv_save_imagecxx . . $ d868uv_save_image(7777599da18afe85)., |
| 3029 |
d868uv_print_versioncxx . . $ d868uv_print_version(7777599da18afe85)., |
| 3030 |
d868uv_print_configcxx . . $ d868uv_print_config(c18371ed0cec106e)., |
| 3031 |
d868uv_verify_configcxx . . $ d868uv_verify_config(69c7618638024564)., |
| 3032 |
d868uv_parse_parametercxx . . $ d868uv_parse_parameter(581120db4094cbd7)., |
| 3033 |
d868uv_parse_headercxx . . $ d868uv_parse_header(641d501f2e215d9b)., |
| 3034 |
d868uv_parse_rowcxx . . $ d868uv_parse_row(adaf448d3e9fa426)., |
| 3035 |
d868uv_update_timestampcxx . . $ d868uv_update_timestamp(b1c64831c0136140)., |
| 3036 |
d868uv_write_csvcxx . . $ d868uv_write_csv(7777599da18afe85)., |
| 3037 |
}; |