Project

General

Profile

New Model #10816 » radioddity_r2_rt24v.py

Jim Unroe, 08/28/2023 10:15 AM

 
1
# Copyright August 2018 Klaus Ruebsam <dg5eau@ruebsam.eu>
2
#
3
# This program is free software: you can redistribute it and/or modify
4
# it under the terms of the GNU General Public License as published by
5
# the Free Software Foundation, either version 2 of the License, or
6
# (at your option) any later version.
7
#
8
# This program is distributed in the hope that it will be useful,
9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11
# GNU General Public License for more details.
12
#
13
# You should have received a copy of the GNU General Public License
14
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
15

    
16
import time
17
import struct
18
import logging
19

    
20
from chirp import chirp_common, directory, memmap
21
from chirp import bitwise, errors, util
22
from chirp.settings import RadioSetting, RadioSettingGroup, \
23
    RadioSettingValueInteger, RadioSettingValueList, \
24
    RadioSettingValueBoolean, RadioSettings
25

    
26
LOG = logging.getLogger(__name__)
27

    
28
# memory map
29
# 0000 copy of channel 16: 0100 - 010F
30
# 0010 Channel 1
31
# 0020 Channel 2
32
# 0030 Channel 3
33
# 0040 Channel 4
34
# 0050 Channel 5
35
# 0060 Channel 6
36
# 0070 Channel 7
37
# 0080 Channel 8
38
# 0090 Channel 9
39
# 00A0 Channel 10
40
# 00B0 Channel 11
41
# 00C0 Channel 12
42
# 00D0 Channel 13
43
# 00E0 Channel 14
44
# 00F0 Channel 15
45
# 0100 Channel 16
46
# 03C0 various settings
47

    
48
# the last three bytes of every channel are identical
49
# to the first three bytes of the next channel in row.
50
# However it will automatically be filled by the radio itself
51

    
52
MEM_FORMAT = """
53
#seekto 0x0010;
54
struct {
55
  lbcd rx_freq[4];
56
  lbcd tx_freq[4];
57
  lbcd rx_tone[2];
58
  lbcd tx_tone[2];
59
  u8 unknown1:1,
60
    compand:1,
61
    scramb:1,
62
    scanadd:1,
63
    power:1,
64
    mode:1,
65
    unknown2:1,
66
    bclo:1;
67
  u8 reserved[3];
68
} memory[%d];
69

    
70
#seekto 0x03C0;
71
struct {
72
  u8 unknown3c08:1,
73
      scanmode:1,
74
      unknown3c06:1,
75
      unknown3c05:1,
76
      voice:2,
77
      save:1,
78
      beep:1;
79
  u8 squelch;
80
  u8 unknown3c2;
81
  u8 timeout;
82
  u8 voxgain;
83
  u8 specialcode;
84
  u8 unknown3c6;
85
  u8 voxdelay;
86
} settings;
87

    
88
"""
89

    
90
CMD_ACK = b"\x06"
91
CMD_ALT_ACK = b"\x53"
92
CMD_STX = b"\x02"
93
CMD_ENQ = b"\x05"
94

    
95
POWER_LEVELS = [chirp_common.PowerLevel("Low",  watts=0.50),
96
                chirp_common.PowerLevel("High", watts=3.00)]
97
TIMEOUT_LIST = ["Off"] + ["%s seconds" % x for x in range(30, 330, 30)]
98
SCANMODE_LIST = ["Carrier", "Timer"]
99
VOICE_LIST = ["Off", "Chinese", "English"]
100
VOX_LIST = ["Off"] + ["%s" % x for x in range(1, 9)]
101
VOXDELAY_LIST = ["0.5", "1.0", "1.5", "2.0", "2.5", "3.0"]
102
MODE_LIST = ["FM", "NFM"]
103

    
104
TONES = chirp_common.TONES
105
DTCS_CODES = chirp_common.DTCS_CODES
106

    
107
FRS16_FREQS = [462562500, 462587500, 462612500, 462637500,
108
               462662500, 462625000, 462725000, 462687500,
109
               462712500, 462550000, 462575000, 462600000,
110
               462650000, 462675000, 462700000, 462725000]
111

    
112
PMR_FREQS1 = [446006250, 446018750, 446031250, 446043750, 446056250,
113
              446068750, 446081250, 446093750]
114
PMR_FREQS2 = [446106250, 446118750, 446131250, 446143750, 446156250,
115
              446168750, 446181250, 446193750]
116

    
117
PMR_FREQS = PMR_FREQS1 + PMR_FREQS2
118

    
119
VALID_CHARS = chirp_common.CHARSET_ALPHANUMERIC + \
120
    "`{|}!\"#$%&'()*+,-./:;<=>?@[]^_"
121

    
122

    
123
def _r2_enter_programming_mode(radio):
124
    serial = radio.pipe
125

    
126
    magic = b"TYOGRAM"
127
    exito = False
128
    serial.write(CMD_STX)
129
    for i in range(0, 5):
130
        for j in range(0, len(magic)):
131
            serial.write(magic[j:j + 1])
132
        ack = serial.read(1)
133
        if ack == CMD_ACK:
134
            exito = True
135
            break
136

    
137
    # check if we had EXITO
138
    if exito is False:
139
        msg = "The radio did not accept program mode after five tries.\n"
140
        msg += "Check your interface cable and power cycle your radio."
141
        raise errors.RadioError(msg)
142

    
143
    try:
144
        serial.write(CMD_STX)
145
        ident = serial.read(8)
146
    except:
147
        _r2_exit_programming_mode(radio)
148
        raise errors.RadioError("Error communicating with radio")
149

    
150
    # No idea yet what the next 7 bytes stand for
151
    # as long as they start with ACK (or ALT_ACK on some devices) we are fine
152
    if not ident.startswith(CMD_ACK) and not ident.startswith(CMD_ALT_ACK):
153
        _r2_exit_programming_mode(radio)
154
        LOG.debug(util.hexprint(ident))
155
        raise errors.RadioError("Radio returned unknown identification string")
156

    
157
    try:
158
        serial.write(CMD_ACK)
159
        ack = serial.read(1)
160
    except:
161
        _r2_exit_programming_mode(radio)
162
        raise errors.RadioError("Error communicating with radio")
163

    
164
    if ack != CMD_ACK:
165
        _r2_exit_programming_mode(radio)
166
        raise errors.RadioError("Radio refused to enter programming mode")
167

    
168
    # the next 6 bytes represent the 6 digit password
169
    # they are somehow coded where '1' becomes x01 and 'a' becomes x25
170
    try:
171
        serial.write(CMD_ENQ)
172
        ack = serial.read(6)
173
    except:
174
        _r2_exit_programming_mode(radio)
175
        raise errors.RadioError("Error communicating with radio")
176

    
177
    # we will only read if no password is set
178
    if ack != b"\xFF\xFF\xFF\xFF\xFF\xFF":
179
        _r2_exit_programming_mode(radio)
180
        raise errors.RadioError("Radio is password protected")
181
    try:
182
        serial.write(CMD_ACK)
183
        ack = serial.read(6)
184

    
185
    except:
186
        _r2_exit_programming_mode(radio)
187
        raise errors.RadioError("Error communicating with radio 2")
188

    
189
    if ack != CMD_ACK:
190
        _r2_exit_programming_mode(radio)
191
        raise errors.RadioError("Radio refused to enter programming mode 2")
192

    
193

    
194
def _r2_exit_programming_mode(radio):
195
    serial = radio.pipe
196
    try:
197
        serial.write(CMD_ACK)
198
    except:
199
        raise errors.RadioError("Radio refused to exit programming mode")
200

    
201

    
202
def _r2_read_block(radio, block_addr, block_size):
203
    serial = radio.pipe
204

    
205
    cmd = struct.pack(">cHb", b'R', block_addr, block_size)
206
    expectedresponse = b"W" + cmd[1:]
207
    LOG.debug("Reading block %04x..." % (block_addr))
208

    
209
    try:
210
        for j in range(0, len(cmd)):
211
            time.sleep(0.005)
212
            serial.write(cmd[j:j + 1])
213

    
214
        response = serial.read(4 + block_size)
215
        if response[:4] != expectedresponse:
216
            _r2_exit_programming_mode(radio)
217
            raise Exception("Error reading block %04x." % (block_addr))
218

    
219
        block_data = response[4:]
220

    
221
        time.sleep(0.005)
222
        serial.write(CMD_ACK)
223
        ack = serial.read(1)
224
    except:
225
        _r2_exit_programming_mode(radio)
226
        raise errors.RadioError("Failed to read block at %04x" % block_addr)
227

    
228
    if ack != CMD_ACK:
229
        _r2_exit_programming_mode(radio)
230
        raise Exception("No ACK reading block %04x." % (block_addr))
231

    
232
    return block_data
233

    
234

    
235
def _r2_write_block(radio, block_addr, block_size):
236
    serial = radio.pipe
237

    
238
    cmd = struct.pack(">cHb", b'W', block_addr, block_size)
239
    data = radio.get_mmap()[block_addr:block_addr + block_size]
240

    
241
    LOG.debug("Writing block %04x..." % (block_addr))
242
    LOG.debug(util.hexprint(cmd + data))
243

    
244
    try:
245
        for j in range(0, len(cmd)):
246
            serial.write(cmd[j:j + 1])
247
        for j in range(0, len(data)):
248
            serial.write(data[j:j + 1])
249
        if serial.read(1) != CMD_ACK:
250
            raise Exception("No ACK")
251
    except:
252
        _r2_exit_programming_mode(radio)
253
        raise errors.RadioError("Failed to send block "
254
                                "%04x to radio" % block_addr)
255

    
256

    
257
def do_download(radio):
258
    LOG.debug("download")
259
    _r2_enter_programming_mode(radio)
260

    
261
    data = b""
262

    
263
    status = chirp_common.Status()
264
    status.msg = "Cloning from radio"
265

    
266
    status.cur = 0
267
    status.max = radio._memsize
268

    
269
    for addr in range(0, radio._memsize, radio._block_size):
270
        status.cur = addr + radio._block_size
271
        radio.status_fn(status)
272

    
273
        block = _r2_read_block(radio, addr, radio._block_size)
274
        data += block
275

    
276
        LOG.debug("Address: %04x" % addr)
277
        LOG.debug(util.hexprint(block))
278

    
279
    _r2_exit_programming_mode(radio)
280

    
281
    return memmap.MemoryMapBytes(data)
282

    
283

    
284
def do_upload(radio):
285
    status = chirp_common.Status()
286
    status.msg = "Uploading to radio"
287

    
288
    _r2_enter_programming_mode(radio)
289

    
290
    status.cur = 0
291
    status.max = radio._memsize
292

    
293
    for start_addr, end_addr, block_size in radio._ranges:
294
        for addr in range(start_addr, end_addr, block_size):
295
            status.cur = addr + block_size
296
            radio.status_fn(status)
297
            _r2_write_block(radio, addr, block_size)
298

    
299
    _r2_exit_programming_mode(radio)
300

    
301

    
302
@directory.register
303
class RadioddityR2(chirp_common.CloneModeRadio):
304
    """Radioddity R2"""
305
    VENDOR = "Radioddity"
306
    MODEL = "R2"
307
    BAUD_RATE = 9600
308
    NEEDS_COMPAT_SERIAL = False
309

    
310
    # definitions on how to read StartAddr EndAddr BlockZize
311
    _ranges = [
312
               (0x0000, 0x01F8, 0x08),
313
               (0x01F8, 0x03F0, 0x08)
314
              ]
315
    _memsize = 0x03F0
316
    # never read more than 8 bytes at once
317
    _block_size = 0x08
318
    # frequency range is 400-470 MHz
319
    _range = [400000000, 470000000]
320
    # maximum 16 channels
321
    _upper = 16
322
    _mem_params = (_upper  # number of channels
323
                   )
324

    
325
    _frs16 = _pmr = False
326

    
327
    def get_features(self):
328
        rf = chirp_common.RadioFeatures()
329
        rf.has_settings = True
330
        rf.has_bank = False
331
        rf.has_tuning_step = False
332
        rf.has_name = False
333
        rf.has_offset = True
334
        rf.has_mode = True
335
        rf.has_dtcs = True
336
        rf.has_rx_dtcs = True
337
        rf.has_dtcs_polarity = True
338
        rf.has_ctone = True
339
        rf.has_cross = True
340
        rf.can_odd_split = False
341
        # FIXME: Is this right? The get_memory() has no checking for
342
        # deleted memories, but set_memory() used to reference a missing
343
        # variable likely copied from another driver
344
        rf.can_delete = False
345
        rf.valid_modes = MODE_LIST
346
        rf.valid_duplexes = ["", "-", "+", "off"]
347
        rf.valid_tmodes = ["", "Tone", "TSQL", "DTCS", "Cross"]
348
        rf.valid_cross_modes = [
349
            "Tone->DTCS",
350
            "DTCS->Tone",
351
            "->Tone",
352
            "Tone->Tone",
353
            "->DTCS",
354
            "DTCS->",
355
            "DTCS->DTCS"]
356
        rf.valid_power_levels = POWER_LEVELS
357
        rf.valid_skips = ["", "S"]
358
        rf.valid_bands = [self._range]
359
        rf.memory_bounds = (1, self._upper)
360
        rf.valid_tuning_steps = [2.5, 5.0, 6.25, 10.0, 12.5, 25.0]
361
        return rf
362

    
363
    def process_mmap(self):
364
        """Process the mem map into the mem object"""
365
        self._memobj = bitwise.parse(MEM_FORMAT % self._mem_params, self._mmap)
366
        # to set the vars on the class to the correct ones
367

    
368
    def sync_in(self):
369
        """Download from radio"""
370
        try:
371
            data = do_download(self)
372
        except errors.RadioError:
373
            # Pass through any real errors we raise
374
            raise
375
        except:
376
            # If anything unexpected happens, make sure we raise
377
            # a RadioError and log the problem
378
            LOG.exception('Unexpected error during download')
379
            raise errors.RadioError('Unexpected error communicating '
380
                                    'with the radio')
381
        self._mmap = data
382
        self.process_mmap()
383

    
384
    def sync_out(self):
385
        """Upload to radio"""
386
        try:
387
            do_upload(self)
388
        except:
389
            # If anything unexpected happens, make sure we raise
390
            # a RadioError and log the problem
391
            LOG.exception('Unexpected error during upload')
392
            raise errors.RadioError('Unexpected error communicating '
393
                                    'with the radio')
394

    
395
    def get_raw_memory(self, number):
396
        return repr(self._memobj.memory[number - 1])
397

    
398
    def decode_tone(self, val):
399
        """Parse the tone data to decode from mem, it returns:
400
        Mode (''|DTCS|Tone), Value (None|###), Polarity (None,N,R)"""
401
        if val.get_raw() == "\xFF\xFF":
402
            return '', None, None
403

    
404
        val = int(val)
405

    
406
        if val >= 12000:
407
            a = val - 12000
408
            return 'DTCS', a, 'R'
409

    
410
        elif val >= 8000:
411
            a = val - 8000
412
            return 'DTCS', a, 'N'
413

    
414
        else:
415
            a = val / 10.0
416
            return 'Tone', a, None
417

    
418
    def encode_tone(self, memval, mode, value, pol):
419
        """Parse the tone data to encode from UI to mem"""
420
        if mode == '':
421
            memval[0].set_raw(0xFF)
422
            memval[1].set_raw(0xFF)
423
        elif mode == 'Tone':
424
            memval.set_value(int(value * 10))
425
        elif mode == 'DTCS':
426
            flag = 0x80 if pol == 'N' else 0xC0
427
            memval.set_value(value)
428
            memval[1].set_bits(flag)
429
        else:
430
            raise Exception("Internal error: invalid mode `%s'" % mode)
431

    
432
    def get_memory(self, number):
433
        bitpos = (1 << ((number - 1) % 8))
434
        bytepos = ((number - 1) / 8)
435
        LOG.debug("bitpos %s" % bitpos)
436
        LOG.debug("bytepos %s" % bytepos)
437

    
438
        _mem = self._memobj.memory[number - 1]
439

    
440
        mem = chirp_common.Memory()
441

    
442
        mem.number = number
443

    
444
        mem.freq = int(_mem.rx_freq) * 10
445

    
446
        # We'll consider any blank (i.e. 0 MHz frequency) to be empty
447
        if mem.freq == 0:
448
            mem.empty = True
449
            return mem
450

    
451
        if _mem.rx_freq.get_raw() == "\xFF\xFF\xFF\xFF":
452
            mem.freq = 0
453
            mem.empty = True
454
            return mem
455

    
456
        txfreq = int(_mem.tx_freq) * 10
457
        if txfreq == mem.freq:
458
            mem.duplex = ""
459
        elif txfreq == 0:
460
            mem.duplex = "off"
461
            mem.offset = 0
462
        # 166666665*10 is the equivalent for FF FF FF FF
463
        # stored in the TX field
464
        elif txfreq == 1666666650:
465
            mem.duplex = "off"
466
            mem.offset = 0
467
        elif txfreq < mem.freq:
468
            mem.duplex = "-"
469
            mem.offset = mem.freq - txfreq
470
        elif txfreq > mem.freq:
471
            mem.duplex = "+"
472
            mem.offset = txfreq - mem.freq
473

    
474
        # get bandwidth FM or NFM
475
        mem.mode = MODE_LIST[_mem.mode]
476

    
477
        # tone data
478
        txtone = self.decode_tone(_mem.tx_tone)
479
        rxtone = self.decode_tone(_mem.rx_tone)
480
        chirp_common.split_tone_decode(mem, txtone, rxtone)
481

    
482
        if not _mem.scanadd:
483
            mem.skip = "S"
484

    
485
        mem.power = POWER_LEVELS[_mem.power]
486

    
487
        # add extra channel settings to the OTHER tab of the properties
488
        # extra settings are unfortunately inverted
489
        mem.extra = RadioSettingGroup("extra", "Extra")
490

    
491
        bclo = RadioSetting("bclo", "Busy Lockout",
492
                            RadioSettingValueBoolean(not bool(_mem.bclo)))
493
        bclo.set_doc("Busy Lockout")
494
        mem.extra.append(bclo)
495

    
496
        scramb = RadioSetting("scramb", "Scramble",
497
                              RadioSettingValueBoolean(not bool(_mem.scramb)))
498
        scramb.set_doc("Scramble Audio Signal")
499
        mem.extra.append(scramb)
500

    
501
        compand = RadioSetting("compand", "Compander",
502
                               RadioSettingValueBoolean(
503
                                   not bool(_mem.compand)))
504
        compand.set_doc("Compress Audio for TX")
505
        mem.extra.append(compand)
506

    
507
        immutable = []
508

    
509
        if self._frs16:
510
            if mem.freq in FRS16_FREQS:
511
                if mem.number >= 1 and mem.number <= 16:
512
                    FRS_FREQ = FRS16_FREQS[mem.number - 1]
513
                    mem.freq = FRS_FREQ
514
                mem.duplex == ''
515
                mem.offset = 0
516
                mem.mode = "NFM"
517
                immutable = ["empty", "freq", "duplex", "offset", "mode"]
518
        elif self._pmr:
519
            if mem.freq in PMR_FREQS:
520
                if mem.number >= 1 and mem.number <= 16:
521
                    PMR_FREQ = PMR_FREQS[mem.number - 1]
522
                    mem.freq = PMR_FREQ
523
                mem.duplex = ''
524
                mem.offset = 0
525
                mem.mode = "NFM"
526
                mem.power = POWER_LEVELS[0]
527
                immutable = ["empty", "freq", "duplex", "offset", "mode",
528
                             "power"]
529

    
530
        mem.immutable = immutable
531

    
532
        return mem
533

    
534
    def set_memory(self, mem):
535
        bitpos = (1 << ((mem.number - 1) % 8))
536
        bytepos = ((mem.number - 1) / 8)
537
        LOG.debug("bitpos %s" % bitpos)
538
        LOG.debug("bytepos %s" % bytepos)
539

    
540
        # Get a low-level memory object mapped to the image
541
        _mem = self._memobj.memory[mem.number - 1]
542

    
543
        _rsvd = _mem.reserved.get_raw()
544

    
545
        if mem.empty:
546
            _mem.set_raw("\xFF" * 13 + _rsvd)
547
            return
548

    
549
        _mem.rx_freq = mem.freq / 10
550

    
551
        if mem.duplex == "off":
552
            for i in range(0, 4):
553
                _mem.tx_freq[i].set_raw("\xFF")
554
        elif mem.duplex == "+":
555
            _mem.tx_freq = (mem.freq + mem.offset) / 10
556
        elif mem.duplex == "-":
557
            _mem.tx_freq = (mem.freq - mem.offset) / 10
558
        else:
559
            _mem.tx_freq = mem.freq / 10
560

    
561
        # power, default power is low
562
        if mem.power:
563
            _mem.power = POWER_LEVELS.index(mem.power)
564
        else:
565
            _mem.power = 0     # low
566

    
567
        # tone data
568
        ((txmode, txtone, txpol), (rxmode, rxtone, rxpol)) = \
569
            chirp_common.split_tone_encode(mem)
570
        self.encode_tone(_mem.tx_tone, txmode, txtone, txpol)
571
        self.encode_tone(_mem.rx_tone, rxmode, rxtone, rxpol)
572

    
573
        _mem.scanadd = mem.skip != "S"
574
        _mem.mode = MODE_LIST.index(mem.mode)
575

    
576
        # extra settings are unfortunately inverted
577
        for setting in mem.extra:
578
            LOG.debug("@set_mem:", setting.get_name(), setting.value)
579
            setattr(_mem, setting.get_name(), not setting.value)
580

    
581
    def get_settings(self):
582
        _settings = self._memobj.settings
583
        basic = RadioSettingGroup("basic", "Basic Settings")
584
        top = RadioSettings(basic)
585

    
586
        rs = RadioSetting("settings.squelch", "Squelch Level",
587
                          RadioSettingValueInteger(0, 9, _settings.squelch))
588
        basic.append(rs)
589

    
590
        rs = RadioSetting("settings.timeout", "Timeout Timer",
591
                          RadioSettingValueList(
592
                              TIMEOUT_LIST, TIMEOUT_LIST[_settings.timeout]))
593

    
594
        basic.append(rs)
595

    
596
        rs = RadioSetting("settings.scanmode", "Scan Mode",
597
                          RadioSettingValueList(
598
                              SCANMODE_LIST,
599
                              SCANMODE_LIST[_settings.scanmode]))
600
        basic.append(rs)
601

    
602
        rs = RadioSetting("settings.voice", "Voice Prompts",
603
                          RadioSettingValueList(
604
                              VOICE_LIST, VOICE_LIST[_settings.voice]))
605
        basic.append(rs)
606

    
607
        rs = RadioSetting("settings.voxgain", "VOX Level",
608
                          RadioSettingValueList(
609
                              VOX_LIST, VOX_LIST[_settings.voxgain]))
610
        basic.append(rs)
611

    
612
        rs = RadioSetting("settings.voxdelay", "VOX Delay Time",
613
                          RadioSettingValueList(
614
                              VOXDELAY_LIST,
615
                              VOXDELAY_LIST[_settings.voxdelay]))
616
        basic.append(rs)
617

    
618
        rs = RadioSetting("settings.save", "Battery Save",
619
                          RadioSettingValueBoolean(_settings.save))
620
        basic.append(rs)
621

    
622
        rs = RadioSetting("settings.beep", "Beep Tone",
623
                          RadioSettingValueBoolean(_settings.beep))
624
        basic.append(rs)
625

    
626
        def _filter(name):
627
            filtered = ""
628
            for char in str(name):
629
                if char in VALID_CHARS:
630
                    filtered += char
631
                else:
632
                    filtered += " "
633
            return filtered
634

    
635
        return top
636

    
637
    def set_settings(self, settings):
638
        for element in settings:
639
            if not isinstance(element, RadioSetting):
640
                self.set_settings(element)
641
                continue
642
            else:
643
                try:
644
                    if "." in element.get_name():
645
                        bits = element.get_name().split(".")
646
                        obj = self._memobj
647
                        for bit in bits[:-1]:
648
                            obj = getattr(obj, bit)
649
                        setting = bits[-1]
650
                    else:
651
                        obj = self._memobj.settings
652
                        setting = element.get_name()
653

    
654
                    LOG.debug("Setting %s = %s" % (setting, element.value))
655
                    setattr(obj, setting, element.value)
656
                except Exception:
657
                    LOG.debug(element.get_name())
658
                    raise
659

    
660
    @classmethod
661
    def match_model(cls, filedata, filename):
662
        # This radio has always been post-metadata, so never do
663
        # old-school detection
664
        return False
665

    
666

    
667
@directory.register
668
class RetevisRT24(RadioddityR2):
669
    """Retevis RT24"""
670
    VENDOR = "Retevis"
671
    MODEL = "RT24"
672

    
673
    _pmr = False  # sold as PMR radio but supports full band TX/RX
674

    
675

    
676
@directory.register
677
class RetevisRT24V(RadioddityR2):
678
    """Retevis RT24V"""
679
    VENDOR = "Retevis"
680
    MODEL = "RT24V"
681

    
682
    # sold as FreeNet radio but supports full band TX/RX
683

    
684
    # frequency range is 136-174 MHz
685
    _range = [136000000, 174000000]
686
    # maximum 6 channels
687
    _upper = 6
688
    _mem_params = (_upper  # number of channels
689
                   )
690

    
691

    
692
@directory.register
693
class RetevisH777S(RadioddityR2):
694
    """Retevis H777S"""
695
    VENDOR = "Retevis"
696
    MODEL = "H777S"
697

    
698
    _frs16 = False  # sold as FRS radio but supports full band TX/RX
(3-3/3)