Project

General

Profile

New Model #9633 » h777_gt-22.py

Draft support for Baofeng GT-22 - Jim Unroe, 12/31/2021 10:49 AM

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

    
17
import time
18
import os
19
import struct
20
import unittest
21
import logging
22

    
23
from chirp import chirp_common, directory, memmap
24
from chirp import bitwise, errors, util
25
from chirp.settings import RadioSetting, RadioSettingGroup, \
26
    RadioSettingValueInteger, RadioSettingValueList, \
27
    RadioSettingValueBoolean, RadioSettings
28

    
29
LOG = logging.getLogger(__name__)
30

    
31
MEM_FORMAT = """
32
#seekto 0x0010;
33
struct {
34
    lbcd rxfreq[4];
35
    lbcd txfreq[4];
36
    lbcd rxtone[2];
37
    lbcd txtone[2];
38
    u8 unknown3:1,
39
       unknown2:1,
40
       unknown1:1,
41
       skip:1,
42
       highpower:1,
43
       narrow:1,
44
       beatshift:1,
45
       bcl:1;
46
    u8 unknown4[3];
47
} memory[16];
48
#seekto 0x02B0;
49
struct {
50
    u8 voiceprompt;
51
    u8 voicelanguage;
52
    u8 scan;
53
    u8 vox;
54
    u8 voxlevel;
55
    u8 voxinhibitonrx;
56
    u8 lowvolinhibittx;
57
    u8 highvolinhibittx;
58
    u8 alarm;
59
    u8 fmradio;
60
} settings;
61
#seekto 0x03C0;
62
struct {
63
    u8 unused:6,
64
       batterysaver:1,
65
       beep:1;
66
    u8 squelchlevel;
67
    u8 sidekeyfunction;
68
    u8 timeouttimer;
69
    u8 unused2[3];
70
    u8 unused3:7,
71
       scanmode:1;
72
} settings2;
73
"""
74

    
75
CMD_ACK = "\x06"
76
BLOCK_SIZE = 0x08
77
UPLOAD_BLOCKS = [range(0x0000, 0x0110, 8),
78
                 range(0x02b0, 0x02c0, 8),
79
                 range(0x0380, 0x03e0, 8)]
80

    
81
# TODO: Is it 1 watt?
82
H777_POWER_LEVELS = [chirp_common.PowerLevel("Low", watts=1.00),
83
                     chirp_common.PowerLevel("High", watts=5.00)]
84
VOICE_LIST = ["English", "Chinese"]
85
TIMEOUTTIMER_LIST = ["Off", "30 seconds", "60 seconds", "90 seconds",
86
                     "120 seconds", "150 seconds", "180 seconds",
87
                     "210 seconds", "240 seconds", "270 seconds",
88
                     "300 seconds"]
89
SCANMODE_LIST = ["Carrier", "Time"]
90

    
91
SETTING_LISTS = {
92
    "voice": VOICE_LIST,
93
}
94

    
95

    
96
def _h777_enter_programming_mode(radio):
97
    serial = radio.pipe
98
    # increase default timeout from .25 to .5 for all serial communications
99
    serial.timeout = 0.5
100

    
101
    try:
102
        serial.write("\x02")
103
        time.sleep(0.1)
104
        serial.write("PROGRAM")
105
        ack = serial.read(1)
106
    except:
107
        raise errors.RadioError("Error communicating with radio")
108

    
109
    if not ack:
110
        raise errors.RadioError("No response from radio")
111
    elif ack != CMD_ACK:
112
        raise errors.RadioError("Radio refused to enter programming mode")
113

    
114
    try:
115
        serial.write("\x02")
116
        # At least one version of the Baofeng BF-888S has a consistent
117
        # ~0.33s delay between sending the first five bytes of the
118
        # version data and the last three bytes. We need to raise the
119
        # timeout so that the read doesn't finish early.
120
        ident = serial.read(8)
121
    except:
122
        raise errors.RadioError("Error communicating with radio")
123

    
124
    if not ident.startswith("P3107"):
125
        LOG.debug(util.hexprint(ident))
126
        raise errors.RadioError("Radio returned unknown identification string")
127

    
128
    try:
129
        serial.write(CMD_ACK)
130
        ack = serial.read(1)
131
    except:
132
        raise errors.RadioError("Error communicating with radio")
133

    
134
    if ack != CMD_ACK:
135
        raise errors.RadioError("Radio refused to enter programming mode")
136

    
137

    
138
def _h777_exit_programming_mode(radio):
139
    serial = radio.pipe
140
    try:
141
        serial.write("E")
142
    except:
143
        raise errors.RadioError("Radio refused to exit programming mode")
144

    
145

    
146
def _h777_read_block(radio, block_addr, block_size):
147
    serial = radio.pipe
148

    
149
    cmd = struct.pack(">cHb", 'R', block_addr, BLOCK_SIZE)
150
    expectedresponse = "W" + cmd[1:]
151
    LOG.debug("Reading block %04x..." % (block_addr))
152

    
153
    try:
154
        serial.write(cmd)
155
        response = serial.read(4 + BLOCK_SIZE)
156
        if response[:4] != expectedresponse:
157
            raise Exception("Error reading block %04x." % (block_addr))
158

    
159
        block_data = response[4:]
160

    
161
        serial.write(CMD_ACK)
162
        ack = serial.read(1)
163
    except:
164
        raise errors.RadioError("Failed to read block at %04x" % block_addr)
165

    
166
    if ack != CMD_ACK:
167
        raise Exception("No ACK reading block %04x." % (block_addr))
168

    
169
    return block_data
170

    
171

    
172
def _h777_write_block(radio, block_addr, block_size):
173
    serial = radio.pipe
174

    
175
    cmd = struct.pack(">cHb", 'W', block_addr, BLOCK_SIZE)
176
    data = radio.get_mmap()[block_addr:block_addr + 8]
177

    
178
    LOG.debug("Writing Data:")
179
    LOG.debug(util.hexprint(cmd + data))
180

    
181
    try:
182
        serial.write(cmd + data)
183
        # Time required to write data blocks varies between individual
184
        # radios of the Baofeng BF-888S model. The longest seen is
185
        # ~0.31s.
186
        if serial.read(1) != CMD_ACK:
187
            raise Exception("No ACK")
188
    except:
189
        raise errors.RadioError("Failed to send block "
190
                                "to radio at %04x" % block_addr)
191

    
192

    
193
def do_download(radio):
194
    LOG.debug("download")
195
    _h777_enter_programming_mode(radio)
196

    
197
    data = ""
198

    
199
    status = chirp_common.Status()
200
    status.msg = "Cloning from radio"
201

    
202
    status.cur = 0
203
    status.max = radio._memsize
204

    
205
    for addr in range(0, radio._memsize, BLOCK_SIZE):
206
        status.cur = addr + BLOCK_SIZE
207
        radio.status_fn(status)
208

    
209
        block = _h777_read_block(radio, addr, BLOCK_SIZE)
210
        data += block
211

    
212
        LOG.debug("Address: %04x" % addr)
213
        LOG.debug(util.hexprint(block))
214

    
215
    _h777_exit_programming_mode(radio)
216

    
217
    return memmap.MemoryMap(data)
218

    
219

    
220
def do_upload(radio):
221
    status = chirp_common.Status()
222
    status.msg = "Uploading to radio"
223

    
224
    _h777_enter_programming_mode(radio)
225

    
226
    status.cur = 0
227
    status.max = radio._memsize
228

    
229
    for start_addr, end_addr in radio._ranges:
230
        for addr in range(start_addr, end_addr, BLOCK_SIZE):
231
            status.cur = addr + BLOCK_SIZE
232
            radio.status_fn(status)
233
            _h777_write_block(radio, addr, BLOCK_SIZE)
234

    
235
    _h777_exit_programming_mode(radio)
236

    
237

    
238
class ArcshellAR5(chirp_common.Alias):
239
    VENDOR = 'Arcshell'
240
    MODEL = 'AR-5'
241

    
242

    
243
class ArcshellAR6(chirp_common.Alias):
244
    VENDOR = 'Arcshell'
245
    MODEL = 'AR-6'
246

    
247

    
248
class GV8SAlias(chirp_common.Alias):
249
    VENDOR = 'Greaval'
250
    MODEL = 'GV-8S'
251

    
252

    
253
class GV9SAlias(chirp_common.Alias):
254
    VENDOR = 'Greaval'
255
    MODEL = 'GV-9S'
256

    
257

    
258
class A8SAlias(chirp_common.Alias):
259
    VENDOR = 'Ansoko'
260
    MODEL = 'A-8S'
261

    
262

    
263
class TenwayTW325Alias(chirp_common.Alias):
264
    VENDOR = 'Tenway'
265
    MODEL = 'TW-325'
266

    
267

    
268
class RetevisH777Alias(chirp_common.Alias):
269
    VENDOR = 'Retevis'
270
    MODEL = 'H777'
271

    
272

    
273
@directory.register
274
class H777Radio(chirp_common.CloneModeRadio):
275
    """HST H-777"""
276
    # VENDOR = "Heng Shun Tong (恒顺通)"
277
    # MODEL = "H-777"
278
    VENDOR = "Baofeng"
279
    MODEL = "BF-888"
280
    BAUD_RATE = 9600
281

    
282
    ALIASES = [ArcshellAR5, ArcshellAR6, GV8SAlias, GV9SAlias, A8SAlias,
283
               TenwayTW325Alias, RetevisH777Alias]
284
    SIDEKEYFUNCTION_LIST = ["Off", "Monitor", "Transmit Power", "Alarm"]
285

    
286
    # This code currently requires that ranges start at 0x0000
287
    # and are continious. In the original program 0x0388 and 0x03C8
288
    # are only written (all bytes 0xFF), not read.
289
    # _ranges = [
290
    #       (0x0000, 0x0110),
291
    #       (0x02B0, 0x02C0),
292
    #       (0x0380, 0x03E0)
293
    #       ]
294
    # Memory starts looping at 0x1000... But not every 0x1000.
295

    
296
    _ranges = [
297
        (0x0000, 0x0110),
298
        (0x0380, 0x03E0),
299
        (0x02B0, 0x02C0),
300
    ]
301
    _memsize = 0x03E0
302
    _has_fm = True
303
    _has_sidekey = True
304
    _has_scanmodes = True
305

    
306
    def get_features(self):
307
        rf = chirp_common.RadioFeatures()
308
        rf.has_settings = True
309
        rf.valid_modes = ["NFM", "FM"]  # 12.5 KHz, 25 kHz.
310
        rf.valid_skips = ["", "S"]
311
        rf.valid_tmodes = ["", "Tone", "TSQL", "DTCS", "Cross"]
312
        rf.valid_duplexes = ["", "-", "+", "split", "off"]
313
        rf.can_odd_split = True
314
        rf.has_rx_dtcs = True
315
        rf.has_ctone = True
316
        rf.has_cross = True
317
        rf.valid_cross_modes = [
318
            "Tone->Tone",
319
            "DTCS->",
320
            "->DTCS",
321
            "Tone->DTCS",
322
            "DTCS->Tone",
323
            "->Tone",
324
            "DTCS->DTCS"]
325
        rf.has_tuning_step = False
326
        rf.has_bank = False
327
        rf.has_name = False
328
        rf.memory_bounds = (1, 16)
329
        rf.valid_bands = [(400000000, 470000000)]
330
        rf.valid_power_levels = H777_POWER_LEVELS
331
        rf.valid_tuning_steps = [2.5, 5.0, 6.25, 10.0, 12.5, 15.0, 20.0, 25.0,
332
                                 50.0, 100.0]
333

    
334
        return rf
335

    
336
    def process_mmap(self):
337
        self._memobj = bitwise.parse(MEM_FORMAT, self._mmap)
338

    
339
    def sync_in(self):
340
        self._mmap = do_download(self)
341
        self.process_mmap()
342

    
343
    def sync_out(self):
344
        do_upload(self)
345

    
346
    def get_raw_memory(self, number):
347
        return repr(self._memobj.memory[number - 1])
348

    
349
    def _decode_tone(self, val):
350
        val = int(val)
351
        if val == 16665:
352
            return '', None, None
353
        elif val >= 12000:
354
            return 'DTCS', val - 12000, 'R'
355
        elif val >= 8000:
356
            return 'DTCS', val - 8000, 'N'
357
        else:
358
            return 'Tone', val / 10.0, None
359

    
360
    def _encode_tone(self, memval, mode, value, pol):
361
        if mode == '':
362
            memval[0].set_raw(0xFF)
363
            memval[1].set_raw(0xFF)
364
        elif mode == 'Tone':
365
            memval.set_value(int(value * 10))
366
        elif mode == 'DTCS':
367
            flag = 0x80 if pol == 'N' else 0xC0
368
            memval.set_value(value)
369
            memval[1].set_bits(flag)
370
        else:
371
            raise Exception("Internal error: invalid mode `%s'" % mode)
372

    
373
    def get_memory(self, number):
374
        _mem = self._memobj.memory[number - 1]
375

    
376
        mem = chirp_common.Memory()
377

    
378
        mem.number = number
379
        mem.freq = int(_mem.rxfreq) * 10
380

    
381
        # We'll consider any blank (i.e. 0MHz frequency) to be empty
382
        if mem.freq == 0:
383
            mem.empty = True
384
            return mem
385

    
386
        if _mem.rxfreq.get_raw() == "\xFF\xFF\xFF\xFF":
387
            mem.freq = 0
388
            mem.empty = True
389
            return mem
390

    
391
        if _mem.txfreq.get_raw() == "\xFF\xFF\xFF\xFF":
392
            mem.duplex = "off"
393
            mem.offset = 0
394
        elif int(_mem.rxfreq) == int(_mem.txfreq):
395
            mem.duplex = ""
396
            mem.offset = 0
397
        else:
398
            mem.duplex = int(_mem.rxfreq) > int(_mem.txfreq) and "-" or "+"
399
            mem.offset = abs(int(_mem.rxfreq) - int(_mem.txfreq)) * 10
400

    
401
        mem.mode = not _mem.narrow and "FM" or "NFM"
402
        mem.power = H777_POWER_LEVELS[_mem.highpower]
403

    
404
        mem.skip = _mem.skip and "S" or ""
405

    
406
        txtone = self._decode_tone(_mem.txtone)
407
        rxtone = self._decode_tone(_mem.rxtone)
408
        chirp_common.split_tone_decode(mem, txtone, rxtone)
409

    
410
        mem.extra = RadioSettingGroup("Extra", "extra")
411
        rs = RadioSetting("bcl", "Busy Channel Lockout",
412
                          RadioSettingValueBoolean(not _mem.bcl))
413
        mem.extra.append(rs)
414
        rs = RadioSetting("beatshift", "Beat Shift(scramble)",
415
                          RadioSettingValueBoolean(not _mem.beatshift))
416
        mem.extra.append(rs)
417

    
418
        return mem
419

    
420
    def set_memory(self, mem):
421
        # Get a low-level memory object mapped to the image
422
        _mem = self._memobj.memory[mem.number - 1]
423

    
424
        if mem.empty:
425
            _mem.set_raw("\xFF" * (_mem.size() / 8))
426
            return
427

    
428
        _mem.rxfreq = mem.freq / 10
429

    
430
        if mem.duplex == "off":
431
            for i in range(0, 4):
432
                _mem.txfreq[i].set_raw("\xFF")
433
        elif mem.duplex == "split":
434
            _mem.txfreq = mem.offset / 10
435
        elif mem.duplex == "+":
436
            _mem.txfreq = (mem.freq + mem.offset) / 10
437
        elif mem.duplex == "-":
438
            _mem.txfreq = (mem.freq - mem.offset) / 10
439
        else:
440
            _mem.txfreq = mem.freq / 10
441

    
442
        txtone, rxtone = chirp_common.split_tone_encode(mem)
443
        self._encode_tone(_mem.txtone, *txtone)
444
        self._encode_tone(_mem.rxtone, *rxtone)
445

    
446
        _mem.narrow = 'N' in mem.mode
447
        _mem.highpower = mem.power == H777_POWER_LEVELS[1]
448
        _mem.skip = mem.skip == "S"
449

    
450
        for setting in mem.extra:
451
            # NOTE: Only two settings right now, both are inverted
452
            setattr(_mem, setting.get_name(), not int(setting.value))
453

    
454
        # When set to one, official programming software (BF-480) shows always
455
        # "WFM", even if we choose "NFM". Therefore, for compatibility
456
        # purposes, we will set these to zero.
457
        _mem.unknown1 = 0
458
        _mem.unknown2 = 0
459
        _mem.unknown3 = 0
460

    
461
    def get_settings(self):
462
        _settings = self._memobj.settings
463
        basic = RadioSettingGroup("basic", "Basic Settings")
464
        top = RadioSettings(basic)
465

    
466
        # TODO: Check that all these settings actually do what they
467
        # say they do.
468

    
469
        rs = RadioSetting("voiceprompt", "Voice prompt",
470
                          RadioSettingValueBoolean(_settings.voiceprompt))
471
        basic.append(rs)
472

    
473
        rs = RadioSetting("voicelanguage", "Voice language",
474
                          RadioSettingValueList(
475
                              VOICE_LIST,
476
                              VOICE_LIST[_settings.voicelanguage]))
477
        basic.append(rs)
478

    
479
        if self.MODEL != "GT-22":
480
            rs = RadioSetting("scan", "Scan",
481
                              RadioSettingValueBoolean(_settings.scan))
482
            basic.append(rs)
483

    
484
        if self._has_scanmodes:
485
            rs = RadioSetting("settings2.scanmode", "Scan mode",
486
                              RadioSettingValueList(
487
                                  SCANMODE_LIST,
488
                                  SCANMODE_LIST[
489
                                      self._memobj.settings2.scanmode]))
490
            basic.append(rs)
491

    
492
        rs = RadioSetting("vox", "VOX",
493
                          RadioSettingValueBoolean(_settings.vox))
494
        basic.append(rs)
495

    
496
        rs = RadioSetting("voxlevel", "VOX level",
497
                          RadioSettingValueInteger(
498
                              1, 5, _settings.voxlevel + 1))
499
        basic.append(rs)
500

    
501
        rs = RadioSetting("voxinhibitonrx", "Inhibit VOX on receive",
502
                          RadioSettingValueBoolean(_settings.voxinhibitonrx))
503
        basic.append(rs)
504

    
505
        rs = RadioSetting("lowvolinhibittx", "Low voltage inhibit transmit",
506
                          RadioSettingValueBoolean(_settings.lowvolinhibittx))
507
        basic.append(rs)
508

    
509
        rs = RadioSetting("highvolinhibittx", "High voltage inhibit transmit",
510
                          RadioSettingValueBoolean(_settings.highvolinhibittx))
511
        basic.append(rs)
512

    
513
        if self.MODEL != "GT-22":
514
            rs = RadioSetting("alarm", "Alarm",
515
                              RadioSettingValueBoolean(_settings.alarm))
516
            basic.append(rs)
517

    
518
        # TODO: This should probably be called “FM Broadcast Band Radio”
519
        # or something. I'm not sure if the model actually has one though.
520
        if self._has_fm:
521
            rs = RadioSetting("fmradio", "FM function",
522
                              RadioSettingValueBoolean(_settings.fmradio))
523
            basic.append(rs)
524

    
525
        rs = RadioSetting("settings2.beep", "Beep",
526
                          RadioSettingValueBoolean(
527
                              self._memobj.settings2.beep))
528
        basic.append(rs)
529

    
530
        rs = RadioSetting("settings2.batterysaver", "Battery saver",
531
                          RadioSettingValueBoolean(
532
                              self._memobj.settings2.batterysaver))
533
        basic.append(rs)
534

    
535
        rs = RadioSetting("settings2.squelchlevel", "Squelch level",
536
                          RadioSettingValueInteger(
537
                              0, 9, self._memobj.settings2.squelchlevel))
538
        basic.append(rs)
539

    
540
        if self._has_sidekey:
541
            rs = RadioSetting("settings2.sidekeyfunction", "Side key function",
542
                              RadioSettingValueList(
543
                                  self.SIDEKEYFUNCTION_LIST,
544
                                  self.SIDEKEYFUNCTION_LIST[
545
                                      self._memobj.settings2.sidekeyfunction]))
546
            basic.append(rs)
547

    
548
        rs = RadioSetting("settings2.timeouttimer", "Timeout timer",
549
                          RadioSettingValueList(
550
                              TIMEOUTTIMER_LIST,
551
                              TIMEOUTTIMER_LIST[
552
                                  self._memobj.settings2.timeouttimer]))
553
        basic.append(rs)
554

    
555
        return top
556

    
557
    def set_settings(self, settings):
558
        for element in settings:
559
            if not isinstance(element, RadioSetting):
560
                self.set_settings(element)
561
                continue
562
            else:
563
                try:
564
                    if "." in element.get_name():
565
                        bits = element.get_name().split(".")
566
                        obj = self._memobj
567
                        for bit in bits[:-1]:
568
                            obj = getattr(obj, bit)
569
                        setting = bits[-1]
570
                    else:
571
                        obj = self._memobj.settings
572
                        setting = element.get_name()
573

    
574
                    if element.has_apply_callback():
575
                        LOG.debug("Using apply callback")
576
                        element.run_apply_callback()
577
                    elif setting == "voxlevel":
578
                        setattr(obj, setting, int(element.value) - 1)
579
                    else:
580
                        LOG.debug("Setting %s = %s" % (setting, element.value))
581
                        setattr(obj, setting, element.value)
582
                except Exception, e:
583
                    LOG.debug(element.get_name())
584
                    raise
585

    
586

    
587
class H777TestCase(unittest.TestCase):
588

    
589
    def setUp(self):
590
        self.driver = H777Radio(None)
591
        self.testdata = bitwise.parse("lbcd foo[2];",
592
                                      memmap.MemoryMap("\x00\x00"))
593

    
594
    def test_decode_tone_dtcs_normal(self):
595
        mode, value, pol = self.driver._decode_tone(8023)
596
        self.assertEqual('DTCS', mode)
597
        self.assertEqual(23, value)
598
        self.assertEqual('N', pol)
599

    
600
    def test_decode_tone_dtcs_rev(self):
601
        mode, value, pol = self.driver._decode_tone(12023)
602
        self.assertEqual('DTCS', mode)
603
        self.assertEqual(23, value)
604
        self.assertEqual('R', pol)
605

    
606
    def test_decode_tone_tone(self):
607
        mode, value, pol = self.driver._decode_tone(885)
608
        self.assertEqual('Tone', mode)
609
        self.assertEqual(88.5, value)
610
        self.assertEqual(None, pol)
611

    
612
    def test_decode_tone_none(self):
613
        mode, value, pol = self.driver._decode_tone(16665)
614
        self.assertEqual('', mode)
615
        self.assertEqual(None, value)
616
        self.assertEqual(None, pol)
617

    
618
    def test_encode_tone_dtcs_normal(self):
619
        self.driver._encode_tone(self.testdata.foo, 'DTCS', 23, 'N')
620
        self.assertEqual(8023, int(self.testdata.foo))
621

    
622
    def test_encode_tone_dtcs_rev(self):
623
        self.driver._encode_tone(self.testdata.foo, 'DTCS', 23, 'R')
624
        self.assertEqual(12023, int(self.testdata.foo))
625

    
626
    def test_encode_tone(self):
627
        self.driver._encode_tone(self.testdata.foo, 'Tone', 88.5, 'N')
628
        self.assertEqual(885, int(self.testdata.foo))
629

    
630
    def test_encode_tone_none(self):
631
        self.driver._encode_tone(self.testdata.foo, '', 67.0, 'N')
632
        self.assertEqual(16665, int(self.testdata.foo))
633

    
634

    
635
@directory.register
636
class ROGA2SRadio(H777Radio):
637
    VENDOR = "Radioddity"
638
    MODEL = "GA-2S"
639
    _has_fm = False
640
    SIDEKEYFUNCTION_LIST = ["Off", "Monitor", "Unused", "Alarm"]
641

    
642
    @classmethod
643
    def match_model(cls, filedata, filename):
644
        # This model is only ever matched via metadata
645
        return False
646

    
647

    
648
@directory.register
649
class H777PlusRadio(H777Radio):
650
    VENDOR = "Retevis"
651
    MODEL = "H777 Plus"
652
    _has_fm = False
653
    _has_scanmodes = False
654

    
655
    @classmethod
656
    def match_model(cls, filedata, filename):
657
        # This model is only ever matched via metadata
658
        return False
659

    
660

    
661
@directory.register
662
class GT22Radio(H777Radio):
663
    VENDOR = "Baofeng"
664
    MODEL = "GT-22"
665
    _has_fm = False
666
    _has_scanmodes = False
667
    _has_sidekey = False
668

    
669
    @classmethod
670
    def match_model(cls, filedata, filename):
671
        # This model is only ever matched via metadata
672
        return False
(12-12/12)