Exemplo n.º 1
0
    def get_settings(self):
        _mem = self._memobj
        basic = RadioSettingGroup("basic", "Basic")
        top = RadioSettings(basic)

        def _f(val):
            string = ""
            for char in str(val):
                if char == "\xFF":
                    break
                string += char
            return string

        line1 = RadioSetting(
            "messages.line1", "Message Line 1",
            RadioSettingValueString(0,
                                    32,
                                    _f(_mem.messages.line1),
                                    autopad=False))
        basic.append(line1)

        line2 = RadioSetting(
            "messages.line2", "Message Line 2",
            RadioSettingValueString(0,
                                    32,
                                    _f(_mem.messages.line2),
                                    autopad=False))
        basic.append(line2)

        return top
Exemplo n.º 2
0
    def _get_display_settings(self):
        menu = RadioSettingGroup("display", "Display")
        display_settings = self._memobj.settings

        val = RadioSettingValueString(
            0, 8,
            str(display_settings.power_on_msg).rstrip("\xFF"))
        rs = RadioSetting("display.power_on_msg", "Power on message", val)
        rs.set_apply_callback(self.apply_power_on_msg, display_settings)
        menu.append(rs)

        val = RadioSettingValueList(
            self._LCD_CONTRAST,
            self._LCD_CONTRAST[display_settings.contrast - 1])
        rs = RadioSetting("display.contrast", "LCD Contrast", val)
        rs.set_apply_callback(self.apply_lcd_contrast, display_settings)
        menu.append(rs)

        val = RadioSettingValueList(
            self._LAMP_CONTROL,
            self._LAMP_CONTROL[display_settings.lamp_control])
        rs = RadioSetting("display.lamp_control", "Lamp Control", val)
        rs.set_apply_callback(self.apply_lamp_control, display_settings)
        menu.append(rs)

        val = RadioSettingValueList(
            self._LAMP_TIMER,
            self._LAMP_TIMER[display_settings.lamp_timer - 2])
        rs = RadioSetting("display.lamp_timer", "Lamp Timer", val)
        rs.set_apply_callback(self.apply_lamp_timer, display_settings)
        menu.append(rs)

        return menu
Exemplo n.º 3
0
    def _get_dtmf_settings(self):
        menu = RadioSettingGroup("dtmf_settings", "DTMF")
        dtmf = self._memobj.scan_settings

        val = RadioSettingValueList(
            self._DTMF_MODE,
            self._DTMF_MODE[dtmf.dtmf_mode])
        rs = RadioSetting("scan_settings.dtmf_mode", "DTMF Mode", val)
        menu.append(rs)

        val = RadioSettingValueList(
            self._DTMF_DELAY,
            self._DTMF_DELAY[dtmf.dtmf_delay])
        rs = RadioSetting(
            "scan_settings.dtmf_delay", "DTMF Delay", val)
        menu.append(rs)

        val = RadioSettingValueList(
            self._DTMF_SPEED,
            self._DTMF_SPEED[dtmf.dtmf_speed])
        rs = RadioSetting(
            "scan_settings.dtmf_speed", "DTMF Speed", val)
        menu.append(rs)

        for i in range(10):

            name = "dtmf_%02d" % (i + 1)
            if i == 9:
                name = "dtmf_%02d" % 0

            dtmfsetting = self._memobj.dtmf[i]
            dtmfstr = ""
            for c in dtmfsetting.memory:
                if c == 0xFF:
                    break
                if c < len(FT70_DTMF_CHARS):
                    dtmfstr += FT70_DTMF_CHARS[c]
            dtmfentry = RadioSettingValueString(0, 16, dtmfstr)
            dtmfentry.set_charset(
                FT70_DTMF_CHARS + list("abcdef "))  # Allow input in lowercase, space ? validation fails otherwise
            rs = RadioSetting(name, name.upper(), dtmfentry)
            rs.set_apply_callback(self.apply_dtmf, i)
            menu.append(rs)

        return menu
Exemplo n.º 4
0
 def get_string_setting(self, obj, valid_chars, desc1, desc2, group):
     content = ''
     maxlen = len(obj)
     for x in range(0, maxlen):
         content += chr(obj[x])
     val = RadioSettingValueString(0, maxlen, content, True, valid_chars)
     rs = RadioSetting(desc1, desc2, val)
     rs.set_apply_callback(self.apply_str_to_bytearray, obj)
     group.append(rs)
Exemplo n.º 5
0
    def get_settings(self):
        _general = self._memobj.general
        _info = self._memobj.info

        basic = RadioSettingGroup("basic", "Basic")
        info = RadioSettingGroup("info", "Model Info")
        general = RadioSettingGroup("general", "General Settings")

        # top = RadioSettings(identity, basic)
        top = RadioSettings(general)
        general.append(RadioSetting(
            "dmrid", "DMR Radio ID",
            RadioSettingValueInteger(0, 100000000, _general.dmrid)))
        general.append(RadioSetting(
            "line1", "Startup Line 1",
            RadioSettingValueString(0, 10, utftoasc(str(_general.line1)))))
        general.append(RadioSetting(
            "line2", "Startup Line 2",
            RadioSettingValueString(0, 10, utftoasc(str(_general.line2)))))
        return top
Exemplo n.º 6
0
 def _decode_opening_message(self, opening_message):
     msg = ""
     for i in opening_message.message.padded_yaesu:
         if i == 0xFF:
             break
         msg += chr(int(i))
     val = RadioSettingValueString(0, 16, msg)
     rs = RadioSetting("opening_message.message.padded_yaesu",
                       "Opening Message", val)
     rs.set_apply_callback(self._apply_opening_message,
                           opening_message.message.padded_yaesu)
     return rs
Exemplo n.º 7
0
    def _get_ost(self, parent):
        tones = chirp_common.TONES[:]

        def apply_tone(setting, index, which):
            if str(setting.value) == 'Off':
                val = 0xFFFF
            else:
                val = int(float(str(setting.value)) * 10)
            setattr(self._memobj.ost_tones[index], '%stone' % which, val)

        def _tones():
            return ['Off'] + [str(x) for x in tones]

        for i in range(0, 40):
            _ost = self._memobj.ost_tones[i]
            ost = RadioSettingGroup('ost%i' % i,
                                    'OST %i' % (i + 1))

            cur = str(_ost.name).rstrip('\x00')
            name = RadioSetting('name%i' % i, 'Name',
                                RadioSettingValueString(0, 12, cur))
            ost.append(name)

            if _ost.rxtone == 0xFFFF:
                cur = 'Off'
            else:
                cur = round(int(_ost.rxtone) / 10.0, 1)
                if cur not in tones:
                    LOG.debug('Non-standard OST rx tone %i %s' % (i, cur))
                    tones.append(cur)
                    tones.sort()
            rx = RadioSetting('rxtone%i' % i, 'RX Tone',
                              RadioSettingValueList(_tones(),
                                                    str(cur)))
            rx.set_apply_callback(apply_tone, i, 'rx')
            ost.append(rx)

            if _ost.txtone == 0xFFFF:
                cur = 'Off'
            else:
                cur = round(int(_ost.txtone) / 10.0, 1)
                if cur not in tones:
                    LOG.debug('Non-standard OST tx tone %i %s' % (i, cur))
                    tones.append(cur)
                    tones.sort()
            tx = RadioSetting('txtone%i' % i, 'TX Tone',
                              RadioSettingValueList(_tones(),
                                                    str(cur)))
            tx.set_apply_callback(apply_tone, i, 'tx')
            ost.append(tx)

            parent.append(ost)
Exemplo n.º 8
0
    def get_settings(self):
        top = RadioSettings()

        aprs = RadioSettingGroup("aprs", "APRS")
        top.append(aprs)

        myc = self._memobj.aprs_my_callsign
        rs = RadioSetting(
            "aprs_my_callsign.call", "APRS My Callsign",
            RadioSettingValueString(0, 6, aprs_call_to_str(myc.call)))
        aprs.append(rs)

        rs = RadioSetting("aprs_my_callsign.ssid", "APRS My SSID",
                          RadioSettingValueInteger(0, 15, myc.ssid))
        aprs.append(rs)

        return top
Exemplo n.º 9
0
    def get_settings(self):
        _settings = self._memobj.settings
        basic = RadioSettingGroup("basic", "Basic")
        settings = RadioSettings(basic)

        display = ["Frequency", "Channel", "Name"]
        rs = RadioSetting("display", "Display",
                          RadioSettingValueList(display,
                                                display[_settings.display]))
        basic.append(rs)

        apo = ["Off"] + ['%.1f hour(s)' % (0.5 * x) for x in range(1, 25)]
        rs = RadioSetting("apo", "Automatic Power Off",
                          RadioSettingValueList(apo,
                                                apo[_settings.apo]))
        basic.append(rs)

        def filter(s):
            s_ = ""
            for i in range(0, 8):
                c = str(s[i])
                s_ += (c if c in chirp_common.CHARSET_ASCII else "")
            return s_

        rs = RadioSetting("welcome", "Welcome Message",
                          RadioSettingValueString(0, 8,
                                                  filter(_settings.welcome)))
        basic.append(rs)

        rs = RadioSetting("beep", "Beep Enabled",
                          RadioSettingValueBoolean(_settings.beep))
        basic.append(rs)

        mute = ["Off", "TX", "RX", "TX/RX"]
        rs = RadioSetting("mute", "Sub Band Mute",
                          RadioSettingValueList(mute,
                                                mute[_settings.mute]))
        basic.append(rs)

        return settings
Exemplo n.º 10
0
    def _get_settings(self):
        _settings = self._memobj.settings
        basic = RadioSettingGroup("basic", "Basic Settings")
        advanced = RadioSettingGroup("advanced", "Advanced Settings")
        group = RadioSettingGroup("top", "All Settings", basic, advanced)

        rs = RadioSetting("squelch", "Carrier Squelch Level",
                          RadioSettingValueInteger(0, 9, _settings.squelch))
        basic.append(rs)

        rs = RadioSetting("save", "Battery Saver",
                          RadioSettingValueInteger(0, 4, _settings.save))
        basic.append(rs)

        rs = RadioSetting("abr", "Backlight",
                          RadioSettingValueBoolean(_settings.abr))
        basic.append(rs)

        rs = RadioSetting("tdr", "Dual Watch (BDR)",
                          RadioSettingValueBoolean(_settings.tdr))
        advanced.append(rs)

        rs = RadioSetting("tdrab", "Dual Watch TX Priority",
                          RadioSettingValueList(uv5r.TDRAB_LIST,
                          uv5r.TDRAB_LIST[_settings.tdrab]))
        advanced.append(rs)

        rs = RadioSetting("alarm", "Alarm",
                          RadioSettingValueBoolean(_settings.alarm))
        advanced.append(rs)

        rs = RadioSetting("beep", "Beep",
                          RadioSettingValueBoolean(_settings.beep))
        basic.append(rs)

        rs = RadioSetting("timeout", "Timeout Timer",
                          RadioSettingValueList(uv5r.TIMEOUT_LIST,
                          uv5r.TIMEOUT_LIST[_settings.timeout]))
        basic.append(rs)

        rs = RadioSetting("screv", "Scan Resume",
                          RadioSettingValueList(uv5r.RESUME_LIST,
                          uv5r.RESUME_LIST[_settings.screv]))
        advanced.append(rs)

        rs = RadioSetting("mdfa", "Display Mode (A)",
                          RadioSettingValueList(uv5r.MODE_LIST,
                          uv5r.MODE_LIST[_settings.mdfa]))
        basic.append(rs)

        rs = RadioSetting("mdfb", "Display Mode (B)",
                          RadioSettingValueList(uv5r.MODE_LIST,
                          uv5r.MODE_LIST[_settings.mdfb]))
        basic.append(rs)

        rs = RadioSetting("bcl", "Busy Channel Lockout",
                          RadioSettingValueBoolean(_settings.bcl))
        advanced.append(rs)

        rs = RadioSetting("autolk", "Automatic Key Lock",
                          RadioSettingValueBoolean(_settings.autolk))
        advanced.append(rs)

        rs = RadioSetting("fmradio", "Broadcast FM Radio",
                          RadioSettingValueBoolean(_settings.fmradio))
        advanced.append(rs)

        rs = RadioSetting("wtled", "Standby LED Color",
                          RadioSettingValueList(COLOR_LIST,
                          COLOR_LIST[_settings.wtled]))
        basic.append(rs)

        rs = RadioSetting("rxled", "RX LED Color",
                          RadioSettingValueList(COLOR_LIST,
                          COLOR_LIST[_settings.rxled]))
        basic.append(rs)

        rs = RadioSetting("txled", "TX LED Color",
                          RadioSettingValueList(COLOR_LIST,
                          COLOR_LIST[_settings.txled]))
        basic.append(rs)

        rs = RadioSetting("reset", "RESET Menu",
                          RadioSettingValueBoolean(_settings.reset))
        advanced.append(rs)

        rs = RadioSetting("menu", "All Menus",
                          RadioSettingValueBoolean(_settings.menu))
        advanced.append(rs)


        if len(self._mmap.get_packed()) == 0x1808:
            # Old image, without aux block
            return group

        other = RadioSettingGroup("other", "Other Settings")
        group.append(other)

        def _filter(name):
            filtered = ""
            for char in str(name):
                if char in chirp_common.CHARSET_ASCII:
                    filtered += char
                else:
                    filtered += " "
            return filtered

        _msg = self._memobj.poweron_msg
        rs = RadioSetting("poweron_msg.line1", "Power-On Message 1",
                          RadioSettingValueString(0, 7, _filter(_msg.line1)))
        other.append(rs)
        rs = RadioSetting("poweron_msg.line2", "Power-On Message 2",
                          RadioSettingValueString(0, 7, _filter(_msg.line2)))
        other.append(rs)

        limit = "limits"
        vhf_limit = getattr(self._memobj, limit).vhf
        rs = RadioSetting("%s.vhf.lower" % limit, "VHF Lower Limit (MHz)",
                          RadioSettingValueInteger(1, 1000,
                                                   vhf_limit.lower))
        other.append(rs)

        rs = RadioSetting("%s.vhf.upper" % limit, "VHF Upper Limit (MHz)",
                          RadioSettingValueInteger(1, 1000,
                                                   vhf_limit.upper))
        other.append(rs)

        rs = RadioSetting("%s.vhf.enable" % limit, "VHF TX Enabled",
                          RadioSettingValueBoolean(vhf_limit.enable))
        other.append(rs)

        uhf_limit = getattr(self._memobj, limit).uhf
        rs = RadioSetting("%s.uhf.lower" % limit, "UHF Lower Limit (MHz)",
                          RadioSettingValueInteger(1, 1000,
                                                   uhf_limit.lower))
        other.append(rs)
        rs = RadioSetting("%s.uhf.upper" % limit, "UHF Upper Limit (MHz)",
                          RadioSettingValueInteger(1, 1000,
                                                   uhf_limit.upper))
        other.append(rs)
        rs = RadioSetting("%s.uhf.enable" % limit, "UHF TX Enabled",
                          RadioSettingValueBoolean(uhf_limit.enable))
        other.append(rs)

        workmode = RadioSettingGroup("workmode", "Work Mode Settings")
        group.append(workmode)

        options = ["A", "B"]
        rs = RadioSetting("displayab", "Display Selected",
                          RadioSettingValueList(options,
                                                options[_settings.displayab]))
        workmode.append(rs)

        options = ["Frequency", "Channel"]
        rs = RadioSetting("workmode", "VFO/MR Mode",
                          RadioSettingValueList(options,
                                                options[_settings.workmode]))
        workmode.append(rs)

        rs = RadioSetting("keylock", "Keypad Lock",
                          RadioSettingValueBoolean(_settings.keylock))
        workmode.append(rs)

        _mrcna = self._memobj.wmchannel.mrcha
        rs = RadioSetting("wmchannel.mrcha", "MR A Channel",
                          RadioSettingValueInteger(0, 127, _mrcna))
        workmode.append(rs)

        _mrcnb = self._memobj.wmchannel.mrchb
        rs = RadioSetting("wmchannel.mrchb", "MR B Channel",
                          RadioSettingValueInteger(0, 127, _mrcnb))
        workmode.append(rs)

        def convert_bytes_to_freq(bytes):
           real_freq = 0
           for byte in bytes:
               real_freq = (real_freq * 10) + byte
           return chirp_common.format_freq(real_freq * 10)

        def my_validate(value):
            value = chirp_common.parse_freq(value)
            if 17400000 <= value and value < 40000000:
                raise InvalidValueError("Can't be between 174.00000-400.00000")
            return chirp_common.format_freq(value)

        def apply_freq(setting, obj):
            value = chirp_common.parse_freq(str(setting.value)) / 10
            obj.band = value >= 40000000
            for i in range(7, -1, -1):
                obj.freq[i] = value % 10
                value /= 10

        val1a = RadioSettingValueString(0, 10,
            convert_bytes_to_freq(self._memobj.vfoa.freq))
        val1a.set_validate_callback(my_validate)
        rs = RadioSetting("vfoa.freq", "VFO A Frequency", val1a)
        rs.set_apply_callback(apply_freq, self._memobj.vfoa)
        workmode.append(rs)

        val1b = RadioSettingValueString(0, 10,
            convert_bytes_to_freq(self._memobj.vfob.freq))
        val1b.set_validate_callback(my_validate)
        rs = RadioSetting("vfob.freq", "VFO B Frequency", val1b)
        rs.set_apply_callback(apply_freq, self._memobj.vfob)
        workmode.append(rs)

        options = ["Off", "+", "-"]
        rs = RadioSetting("vfoa.sftd", "VFO A Shift",
                          RadioSettingValueList(options,
                                                options[self._memobj.vfoa.sftd]))
        workmode.append(rs)

        rs = RadioSetting("vfob.sftd", "VFO B Shift",
                          RadioSettingValueList(options,
                                                options[self._memobj.vfob.sftd]))
        workmode.append(rs)

        def convert_bytes_to_offset(bytes):
           real_offset = 0
           for byte in bytes:
               real_offset = (real_offset * 10) + byte
           return chirp_common.format_freq(real_offset * 10000)

        def apply_offset(setting, obj):
            value = chirp_common.parse_freq(str(setting.value)) / 10000
            for i in range(3, -1, -1):
                obj.offset[i] = value % 10
                value /= 10

        val1a = RadioSettingValueString(0, 10,
            convert_bytes_to_offset(self._memobj.vfoa.offset))
        rs = RadioSetting("vfoa.offset", "VFO A Offset (0.00-69.95)", val1a)
        rs.set_apply_callback(apply_offset, self._memobj.vfoa)
        workmode.append(rs)

        val1b = RadioSettingValueString(0, 10,
            convert_bytes_to_offset(self._memobj.vfob.offset))
        rs = RadioSetting("vfob.offset", "VFO B Offset (0.00-69.95)", val1b)
        rs.set_apply_callback(apply_offset, self._memobj.vfob)
        workmode.append(rs)

        options = ["High", "Low"]
        rs = RadioSetting("vfoa.txpower", "VFO A Power",
                          RadioSettingValueList(options,
                                                options[self._memobj.vfoa.txpower]))
        workmode.append(rs)

        rs = RadioSetting("vfob.txpower", "VFO B Power",
                          RadioSettingValueList(options,
                                                options[self._memobj.vfob.txpower]))
        workmode.append(rs)

        options = ["Wide", "Narrow"]
        rs = RadioSetting("vfoa.widenarr", "VFO A Bandwidth",
                          RadioSettingValueList(options,
                                                options[self._memobj.vfoa.widenarr]))
        workmode.append(rs)

        rs = RadioSetting("vfob.widenarr", "VFO B Bandwidth",
                          RadioSettingValueList(options,
                                                options[self._memobj.vfob.widenarr]))
        workmode.append(rs)

        options = ["%s" % x for x in range(1, 16)]
        rs = RadioSetting("vfoa.scode", "VFO A PTT-ID",
                          RadioSettingValueList(options,
                                                options[self._memobj.vfoa.scode]))
        workmode.append(rs)

        rs = RadioSetting("vfob.scode", "VFO B PTT-ID",
                          RadioSettingValueList(options,
                                                options[self._memobj.vfob.scode]))
        workmode.append(rs)


        rs = RadioSetting("vfoa.step", "VFO A Tuning Step",
                          RadioSettingValueList(uv5r.STEP291_LIST,
                          uv5r.STEP291_LIST[self._memobj.vfoa.step]))
        workmode.append(rs)
        rs = RadioSetting("vfob.step", "VFO B Tuning Step",
                          RadioSettingValueList(uv5r.STEP291_LIST,
                          uv5r.STEP291_LIST[self._memobj.vfob.step]))
        workmode.append(rs)


        fm_preset = RadioSettingGroup("fm_preset", "FM Radio Preset")
        group.append(fm_preset)

        preset = self._memobj.fm_preset / 10.0 + 87
        rs = RadioSetting("fm_preset", "FM Preset(MHz)",
                      RadioSettingValueFloat(87, 107.5, preset, 0.1, 1))
        fm_preset.append(rs)

        dtmf = RadioSettingGroup("dtmf", "DTMF Settings")
        group.append(dtmf)
        dtmfchars = "0123456789 *#ABCD"

        for i in range(0, 15):
            _codeobj = self._memobj.pttid[i].code
            _code = "".join([dtmfchars[x] for x in _codeobj if int(x) < 0x1F])
            val = RadioSettingValueString(0, 5, _code, False)
            val.set_charset(dtmfchars)
            rs = RadioSetting("pttid/%i.code" % i, "PTT ID Code %i" % (i + 1), val)
            def apply_code(setting, obj):
                code = []
                for j in range(0, 5):
                    try:
                        code.append(dtmfchars.index(str(setting.value)[j]))
                    except IndexError:
                        code.append(0xFF)
                obj.code = code
            rs.set_apply_callback(apply_code, self._memobj.pttid[i])
            dtmf.append(rs)

        _codeobj = self._memobj.ani.code
        _code = "".join([dtmfchars[x] for x in _codeobj if int(x) < 0x1F])
        val = RadioSettingValueString(0, 5, _code, False)
        val.set_charset(dtmfchars)
        rs = RadioSetting("ani.code", "ANI Code", val)
        def apply_code(setting, obj):
            code = []
            for j in range(0, 5):
                try:
                    code.append(dtmfchars.index(str(setting.value)[j]))
                except IndexError:
                    code.append(0xFF)
            obj.code = code
        rs.set_apply_callback(apply_code, self._memobj.ani)
        dtmf.append(rs)

        options = ["Off", "BOT", "EOT", "Both"]
        rs = RadioSetting("ani.aniid", "ANI ID",
                          RadioSettingValueList(options,
                                                options[self._memobj.ani.aniid]))
        dtmf.append(rs)

        _codeobj = self._memobj.ani.alarmcode
        _code = "".join([dtmfchars[x] for x in _codeobj if int(x) < 0x1F])
        val = RadioSettingValueString(0, 5, _code, False)
        val.set_charset(dtmfchars)
        rs = RadioSetting("ani.alarmcode", "Alarm Code", val)
        def apply_code(setting, obj):
            alarmcode = []
            for j in range(5):
                try:
                    alarmcode.append(dtmfchars.index(str(setting.value)[j]))
                except IndexError:
                    alarmcode.append(0xFF)
            obj.alarmcode = alarmcode
        rs.set_apply_callback(apply_code, self._memobj.ani)
        dtmf.append(rs)

        rs = RadioSetting("dtmfst", "DTMF Sidetone",
                          RadioSettingValueList(uv5r.DTMFST_LIST,
                          uv5r.DTMFST_LIST[_settings.dtmfst]))
        dtmf.append(rs)

        rs = RadioSetting("ani.dtmfon", "DTMF Speed (on)",
                          RadioSettingValueList(uv5r.DTMFSPEED_LIST,
                          uv5r.DTMFSPEED_LIST[self._memobj.ani.dtmfon]))
        dtmf.append(rs)

        rs = RadioSetting("ani.dtmfoff", "DTMF Speed (off)",
                          RadioSettingValueList(uv5r.DTMFSPEED_LIST,
                          uv5r.DTMFSPEED_LIST[self._memobj.ani.dtmfoff]))
        dtmf.append(rs)

        return group
Exemplo n.º 11
0
    def get_settings(self):
        _settings = self._memobj.settings
        basic = RadioSettingGroup("basic", "Basic")
        cw = RadioSettingGroup("cw", "CW")
        packet = RadioSettingGroup("packet", "Digital & packet")
        panel = RadioSettingGroup("panel", "Panel settings")
        extended = RadioSettingGroup("extended", "Extended")
        antenna = RadioSettingGroup("antenna", "Antenna selection")
        panelcontr = RadioSettingGroup("panelcontr", "Panel controls")
        top = RadioSettingGroup("top", "All Settings", basic, cw, packet,
                                panelcontr, panel, extended, antenna)

        rs = RadioSetting("ars_144", "144 ARS",
                          RadioSettingValueBoolean(_settings.ars_144))
        basic.append(rs)
        rs = RadioSetting("ars_430", "430 ARS",
                          RadioSettingValueBoolean(_settings.ars_430))
        basic.append(rs)
        rs = RadioSetting("pkt9600_mic", "Paket 9600 mic level",
                          RadioSettingValueInteger(0, 100, _settings.pkt9600_mic))
        packet.append(rs)
        options = ["enable", "disable"]
        rs = RadioSetting("disable_amfm_dial", "AM&FM Dial",
                          RadioSettingValueList(options,
                                        options[_settings.disable_amfm_dial]))
        panel.append(rs)
        rs = RadioSetting("am_mic", "AM mic level",
                          RadioSettingValueInteger(0, 100, _settings.am_mic))
        basic.append(rs)
        options = ["OFF", "1h", "2h", "3h", "4h", "5h", "6h"]
        rs = RadioSetting("apo_time", "APO time",
                          RadioSettingValueList(options,
                                        options[_settings.apo_time]))
        basic.append(rs)
        options = ["OFF", "Range", "All"]
        rs = RadioSetting("arts_beep", "ARTS beep",
                          RadioSettingValueList(options,
                                        options[_settings.arts_beep]))
        basic.append(rs)
        options = ["OFF", "ON", "Auto"]
        rs = RadioSetting("backlight", "Backlight",
                          RadioSettingValueList(options,
                                        options[_settings.backlight]))
        panel.append(rs)
        options = ["6h", "8h", "10h"]
        rs = RadioSetting("batt_chg", "Battery charge",
                          RadioSettingValueList(options,
                                        options[_settings.batt_chg]))
        basic.append(rs)
        options = ["440Hz", "880Hz"]
        rs = RadioSetting("beep_freq", "Beep frequency",
                          RadioSettingValueList(options,
                                        options[_settings.beep_freq]))
        panel.append(rs)
        rs = RadioSetting("beep_volume", "Beep volume",
                          RadioSettingValueInteger(0, 100, _settings.beep_volume))
        panel.append(rs)
        options = ["4800", "9600", "38400"]
        rs = RadioSetting("cat_rate", "CAT rate",
                          RadioSettingValueList(options,
                                        options[_settings.cat_rate]))
        basic.append(rs)
        options = ["Blue", "Amber", "Violet"]
        rs = RadioSetting("color", "Color",
                          RadioSettingValueList(options,
                                        options[_settings.color]))
        panel.append(rs)
        rs = RadioSetting("contrast", "Contrast",
                          RadioSettingValueInteger(1, 12,_settings.contrast-1))
        panel.append(rs)
        rs = RadioSetting("cw_delay", "CW delay (*10 ms)",
                          RadioSettingValueInteger(1, 250, _settings.cw_delay))
        cw.append(rs)
        rs = RadioSetting("cw_id", "CW id",
                          RadioSettingValueBoolean(_settings.cw_id))
        cw.append(rs)
        options = ["Normal", "Reverse"]
        rs = RadioSetting("cw_paddle", "CW paddle",
                          RadioSettingValueList(options,
                                        options[_settings.cw_paddle]))
        cw.append(rs)
        options = ["%i Hz" % i for i in range(300,1001,50)]
        rs = RadioSetting("cw_pitch", "CW pitch",
                          RadioSettingValueList(options,
                                        options[_settings.cw_pitch]))
        cw.append(rs)
        options = ["%i wpm" % i for i in range(4,61)]
        rs = RadioSetting("cw_speed", "CW speed",
                          RadioSettingValueList(options,
                                        options[_settings.cw_speed]))
        cw.append(rs)
        options = ["1:%1.1f" % (i/10) for i in range(25,46,1)]
        rs = RadioSetting("cw_weight", "CW weight",
                          RadioSettingValueList(options,
                                        options[_settings.cw_weight]))
        cw.append(rs)
        rs = RadioSetting("dig_disp", "Dig disp (*10 Hz)",
                          RadioSettingValueInteger(-300, 300, _settings.dig_disp))
        packet.append(rs)
        rs = RadioSetting("dig_mic", "Dig mic",
                          RadioSettingValueInteger(0, 100, _settings.dig_mic))
        packet.append(rs)
        options = ["RTTY", "PSK31-L", "PSK31-U", "USER-L", "USER-U"]
        rs = RadioSetting("dig_mode", "Dig mode",
                          RadioSettingValueList(options,
                                        options[_settings.dig_mode]))
        packet.append(rs)
        rs = RadioSetting("dig_shift", "Dig shift (*10 Hz)",
                          RadioSettingValueInteger(-300, 300, _settings.dig_shift))
        packet.append(rs)
        rs = RadioSetting("fm_mic", "FM mic",
                          RadioSettingValueInteger(0, 100, _settings.fm_mic))
        basic.append(rs)
        options = ["Dial", "Freq", "Panel"]
        rs = RadioSetting("lock_mode", "Lock mode",
                          RadioSettingValueList(options,
                                        options[_settings.lock_mode]))
        panel.append(rs)
        options = ["Fine", "Coarse"]
        rs = RadioSetting("main_step", "Main step",
                          RadioSettingValueList(options,
                                        options[_settings.main_step]))
        panel.append(rs)
        rs = RadioSetting("mem_group", "Mem group",
                          RadioSettingValueBoolean(_settings.mem_group))
        basic.append(rs)
        rs = RadioSetting("mic_key", "Mic key",
                          RadioSettingValueBoolean(_settings.mic_key))
        cw.append(rs)
        rs = RadioSetting("mic_scan", "Mic scan",
                          RadioSettingValueBoolean(_settings.mic_scan))
        basic.append(rs)
        options = ["Off", "SSB", "CW"]
        rs = RadioSetting("op_filter", "Optional filter",
                          RadioSettingValueList(options,
                                        options[_settings.op_filter]))
        basic.append(rs)
        rs = RadioSetting("pkt_mic", "Packet mic",
                          RadioSettingValueInteger(0, 100, _settings.pkt_mic))
        packet.append(rs)
        options = ["1200", "9600"]
        rs = RadioSetting("pkt_rate", "Packet rate",
                          RadioSettingValueList(options,
                                        options[_settings.pkt_rate]))
        packet.append(rs)
        options = ["Off", "3 sec", "5 sec", "10 sec"]
        rs = RadioSetting("resume_scan", "Resume scan",
                          RadioSettingValueList(options,
                                        options[_settings.resume_scan]))
        basic.append(rs)
        options = ["Cont", "Chk"]
        rs = RadioSetting("scope", "Scope",
                          RadioSettingValueList(options,
                                        options[_settings.scope]))
        basic.append(rs)
        rs = RadioSetting("sidetone", "Sidetone",
                          RadioSettingValueInteger(0, 100, _settings.sidetone))
        cw.append(rs)
        options = ["RF-Gain", "Squelch"]
        rs = RadioSetting("sql_rf_gain", "Squelch/RF-Gain",
                          RadioSettingValueList(options,
                                        options[_settings.sql_rf_gain]))
        panel.append(rs)
        rs = RadioSetting("ssb_mic", "SSB Mic",
                          RadioSettingValueInteger(0, 100, _settings.ssb_mic))
        basic.append(rs)
        options = ["%i" % i for i in range(0, 21)]
        options[0] = "Off"
        rs = RadioSetting("tot_time", "Time-out timer",
                          RadioSettingValueList(options,
                                        options[_settings.tot_time]))
        basic.append(rs)
        rs = RadioSetting("vox_delay", "VOX delay (*100 ms)",
                          RadioSettingValueInteger(1, 25, _settings.vox_delay))
        basic.append(rs)
        rs = RadioSetting("vox_gain", "VOX Gain",
                          RadioSettingValueInteger(0, 100, _settings.vox_gain))
        basic.append(rs)
        rs = RadioSetting("extended_menu", "Extended menu",
                          RadioSettingValueBoolean(_settings.extended_menu))
        extended.append(rs)
        options = ["Tn-Rn", "Tn-Riv", "Tiv-Rn", "Tiv-Riv"]
        rs = RadioSetting("dcs_inv", "DCS coding",
                          RadioSettingValueList(options,
                                        options[_settings.dcs_inv]))
        extended.append(rs)
        rs = RadioSetting("r_lsb_car", "LSB Rx carrier point (*10 Hz)",
                          RadioSettingValueInteger(-30, 30, _settings.r_lsb_car))
        extended.append(rs)
        rs = RadioSetting("r_usb_car", "USB Rx carrier point (*10 Hz)",
                          RadioSettingValueInteger(-30, 30, _settings.r_usb_car))
        extended.append(rs)
        rs = RadioSetting("t_lsb_car", "LSB Tx carrier point (*10 Hz)",
                          RadioSettingValueInteger(-30, 30, _settings.t_lsb_car))
        extended.append(rs)
        rs = RadioSetting("t_usb_car", "USB Tx carrier point (*10 Hz)",
                          RadioSettingValueInteger(-30, 30, _settings.t_usb_car))
        extended.append(rs)

        options = ["Hi", "L3", "L2", "L1"]
        rs = RadioSetting("tx_power", "TX power",
                          RadioSettingValueList(options,
                                        options[_settings.tx_power]))
        basic.append(rs)

        options = ["Front", "Rear"]
        rs = RadioSetting("hf_antenna", "HF",
                          RadioSettingValueList(options,
                                        options[_settings.hf_antenna]))
        antenna.append(rs)
        rs = RadioSetting("sixm_antenna", "6M",
                          RadioSettingValueList(options,
                                        options[_settings.sixm_antenna]))
        antenna.append(rs)
        rs = RadioSetting("bc_antenna", "Broadcasting",
                          RadioSettingValueList(options,
                                        options[_settings.bc_antenna]))
        antenna.append(rs)
        rs = RadioSetting("air_antenna", "Air band",
                          RadioSettingValueList(options,
                                        options[_settings.air_antenna]))
        antenna.append(rs)
        rs = RadioSetting("vhf_antenna", "VHF",
                          RadioSettingValueList(options,
                                        options[_settings.vhf_antenna]))
        antenna.append(rs)
        rs = RadioSetting("uhf_antenna", "UHF",
                          RadioSettingValueList(options,
                                        options[_settings.uhf_antenna]))
        antenna.append(rs)

        s = RadioSettingValueString(0, 7, 
                            ''.join([self._CALLSIGN_CHARSET[x] for x in 
                                        self._memobj.callsign]))
        s.set_charset(self._CALLSIGN_CHARSET)
        rs = RadioSetting("callsign", "Callsign", s)
        cw.append(rs)

        rs = RadioSetting("spl", "Split",
                          RadioSettingValueBoolean(_settings.spl))
        panelcontr.append(rs)
        options = ["None", "Up", "Down"]
        rs = RadioSetting("scn_mode", "Scan mode",
                          RadioSettingValueList(options,
                                        options[_settings.scn_mode]))
        panelcontr.append(rs)
        rs = RadioSetting("pri", "Priority",
                          RadioSettingValueBoolean(_settings.pri))
        panelcontr.append(rs)
        rs = RadioSetting("dw", "Dual watch",
                          RadioSettingValueBoolean(_settings.dw))
        panelcontr.append(rs)
        rs = RadioSetting("art", "Auto-range transponder",
                          RadioSettingValueBoolean(_settings.art))
        panelcontr.append(rs)
        rs = RadioSetting("nb", "Noise blanker",
                          RadioSettingValueBoolean(_settings.nb))
        panelcontr.append(rs)
        options = ["Auto", "Fast", "Slow", "Off"]
        rs = RadioSetting("agc", "AGC",
                          RadioSettingValueList(options,
                                        options[_settings.agc]))
        panelcontr.append(rs)
        options = ["PWR", "ALC", "SWR", "MOD"]
        rs = RadioSetting("pwr_meter_mode", "Power meter mode",
                          RadioSettingValueList(options,
                                        options[_settings.pwr_meter_mode]))
        panelcontr.append(rs)
        rs = RadioSetting("vox", "Vox",
                          RadioSettingValueBoolean(_settings.vox))
        panelcontr.append(rs)
        rs = RadioSetting("bk", "Semi break-in",
                          RadioSettingValueBoolean(_settings.bk))
        cw.append(rs)
        rs = RadioSetting("kyr", "Keyer",
                          RadioSettingValueBoolean(_settings.kyr))
        cw.append(rs)
        options = ["enabled", "disabled"]
        rs = RadioSetting("fst", "Fast",
                          RadioSettingValueList(options,
                                        options[_settings.fst]))
        panelcontr.append(rs)
        options = ["enabled", "disabled"]
        rs = RadioSetting("lock", "Lock",
                          RadioSettingValueList(options,
                                        options[_settings.lock]))
        panelcontr.append(rs)

        return top
Exemplo n.º 12
0
    def get_settings(self):
        """Translate the bit in the mem_struct into settings in the UI"""
        sett = self._memobj.settings

        # basic features of the radio
        basic = RadioSettingGroup("basic", "Basic Settings")
        # buttons
        fkeys = RadioSettingGroup("keys", "Front keys config")

        top = RadioSettings(basic, fkeys)

        # Basic
        val = RadioSettingValueString(0, 35, self._VARIANT)
        val.set_mutable(False)
        mod = RadioSetting("not.mod", "Radio version", val)
        basic.append(mod)

        tot = RadioSetting("settings.tot", "Time Out Timer (TOT)",
                           RadioSettingValueList(TOT, TOT[int(sett.tot)]))
        basic.append(tot)

        minvol = RadioSetting("settings.min_vol", "Minimum volume",
                              RadioSettingValueList(VOL,
                                                    VOL[int(sett.min_vol)]))
        basic.append(minvol)

        ptone = RadioSetting("settings.poweron_tone", "Power On tone",
                             RadioSettingValueBoolean(
                                 bool(sett.poweron_tone)))
        basic.append(ptone)

        sprog = RadioSetting("settings.dealer_tuning", "Dealer Tuning",
                             RadioSettingValueBoolean(
                                 bool(sett.dealer_tuning)))
        basic.append(sprog)

        clone = RadioSetting("settings.clone", "Allow clone",
                             RadioSettingValueBoolean(
                                 bool(sett.clone)))
        basic.append(clone)

        # front keys
        mon = RadioSetting("settings.kMON", "MON",
                           RadioSettingValueList(KEYS.values(),
                           KEYS.values()[KEYS.keys().index(
                               int(sett.kMON))]))
        fkeys.append(mon)

        a = RadioSetting("settings.kA", "A",
                         RadioSettingValueList(KEYS.values(),
                         KEYS.values()[KEYS.keys().index(
                             int(sett.kA))]))
        fkeys.append(a)

        scn = RadioSetting("settings.kSCN", "SCN",
                           RadioSettingValueList(KEYS.values(),
                           KEYS.values()[KEYS.keys().index(
                               int(sett.kSCN))]))
        fkeys.append(scn)

        da = RadioSetting("settings.kDA", "D/A",
                          RadioSettingValueList(KEYS.values(),
                          KEYS.values()[KEYS.keys().index(
                              int(sett.kDA))]))
        fkeys.append(da)

        return top
Exemplo n.º 13
0
    def get_settings(self):
        """Translate the bit in the mem_struct into settings in the UI"""
        _mem = self._memobj
        basic = RadioSettingGroup("basic", "Basic Settings")
        advanced = RadioSettingGroup("advanced", "Advanced Settings")
        other = RadioSettingGroup("other", "Other Settings")
        work = RadioSettingGroup("work", "Work Mode Settings")
        fm_preset = RadioSettingGroup("fm_preset", "FM Preset")
        dtmfe = RadioSettingGroup("dtmfe", "DTMF Encode Settings")
        service = RadioSettingGroup("service", "Service Settings")
        top = RadioSettings(basic, advanced, other, work, fm_preset, dtmfe,
                            service)

        # Basic settings
        if _mem.settings.squelch > 0x09:
            val = 0x00
        else:
            val = _mem.settings.squelch
        rs = RadioSetting(
            "settings.squelch", "Squelch",
            RadioSettingValueList(LIST_OFF1TO9, LIST_OFF1TO9[val]))
        basic.append(rs)

        if _mem.settings.save > 0x04:
            val = 0x00
        else:
            val = _mem.settings.save
        rs = RadioSetting("settings.save", "Battery Saver",
                          RadioSettingValueList(LIST_SAVE, LIST_SAVE[val]))
        basic.append(rs)

        if _mem.settings.vox > 0x0A:
            val = 0x00
        else:
            val = _mem.settings.vox
        rs = RadioSetting(
            "settings.vox", "Vox",
            RadioSettingValueList(LIST_OFF1TO10, LIST_OFF1TO10[val]))
        basic.append(rs)

        if _mem.settings.abr > 0x0A:
            val = 0x00
        else:
            val = _mem.settings.abr
        rs = RadioSetting(
            "settings.abr", "Backlight Timeout",
            RadioSettingValueList(LIST_OFF1TO10, LIST_OFF1TO10[val]))
        basic.append(rs)

        rs = RadioSetting("settings.tdr", "Dual Watch",
                          RadioSettingValueBoolean(_mem.settings.tdr))
        basic.append(rs)

        rs = RadioSetting("settings.beep", "Beep",
                          RadioSettingValueBoolean(_mem.settings.beep))
        basic.append(rs)

        if _mem.settings.timeout > 0x27:
            val = 0x03
        else:
            val = _mem.settings.timeout
        rs = RadioSetting(
            "settings.timeout", "Timeout Timer",
            RadioSettingValueList(LIST_TIMEOUT, LIST_TIMEOUT[val]))
        basic.append(rs)

        if _mem.settings.voice > 0x02:
            val = 0x01
        else:
            val = _mem.settings.voice
        rs = RadioSetting("settings.voice", "Voice Prompt",
                          RadioSettingValueList(LIST_VOICE, LIST_VOICE[val]))
        basic.append(rs)

        rs = RadioSetting(
            "settings.dtmfst", "DTMF Sidetone",
            RadioSettingValueList(LIST_DTMFST,
                                  LIST_DTMFST[_mem.settings.dtmfst]))
        basic.append(rs)

        if _mem.settings.screv > 0x02:
            val = 0x01
        else:
            val = _mem.settings.screv
        rs = RadioSetting("settings.screv", "Scan Resume",
                          RadioSettingValueList(LIST_RESUME, LIST_RESUME[val]))
        basic.append(rs)

        rs = RadioSetting(
            "settings.pttid", "When to send PTT ID",
            RadioSettingValueList(LIST_PTTID, LIST_PTTID[_mem.settings.pttid]))
        basic.append(rs)

        if _mem.settings.pttlt > 0x1E:
            val = 0x05
        else:
            val = _mem.settings.pttlt
        rs = RadioSetting("pttlt", "PTT ID Delay",
                          RadioSettingValueInteger(0, 50, val))
        basic.append(rs)

        rs = RadioSetting(
            "settings.mdfa", "Display Mode (A)",
            RadioSettingValueList(LIST_MODE, LIST_MODE[_mem.settings.mdfa]))
        basic.append(rs)

        rs = RadioSetting(
            "settings.mdfb", "Display Mode (B)",
            RadioSettingValueList(LIST_MODE, LIST_MODE[_mem.settings.mdfb]))
        basic.append(rs)

        rs = RadioSetting("settings.sync", "Sync A & B",
                          RadioSettingValueBoolean(_mem.settings.sync))
        basic.append(rs)

        rs = RadioSetting(
            "settings.wtled", "Standby LED Color",
            RadioSettingValueList(LIST_COLOR, LIST_COLOR[_mem.settings.wtled]))
        basic.append(rs)

        rs = RadioSetting(
            "settings.rxled", "RX LED Color",
            RadioSettingValueList(LIST_COLOR, LIST_COLOR[_mem.settings.rxled]))
        basic.append(rs)

        rs = RadioSetting(
            "settings.txled", "TX LED Color",
            RadioSettingValueList(LIST_COLOR, LIST_COLOR[_mem.settings.txled]))
        basic.append(rs)

        val = _mem.settings.almod
        rs = RadioSetting("settings.almod", "Alarm Mode",
                          RadioSettingValueList(LIST_ALMOD, LIST_ALMOD[val]))
        basic.append(rs)

        rs = RadioSetting("settings.dbptt", "Double PTT",
                          RadioSettingValueBoolean(_mem.settings.dbptt))
        basic.append(rs)

        rs = RadioSetting("settings.ste", "Squelch Tail Eliminate (HT to HT)",
                          RadioSettingValueBoolean(_mem.settings.ste))
        basic.append(rs)

        rs = RadioSetting(
            "settings.ponmsg", "Power-On Message",
            RadioSettingValueList(LIST_PONMSG,
                                  LIST_PONMSG[_mem.settings.ponmsg]))
        basic.append(rs)

        rs = RadioSetting("settings.roger", "Roger Beep",
                          RadioSettingValueBoolean(_mem.settings.roger))
        basic.append(rs)

        rs = RadioSetting(
            "settings.rtone", "Tone Burst Frequency",
            RadioSettingValueList(LIST_RTONE, LIST_RTONE[_mem.settings.rtone]))
        basic.append(rs)

        rs = RadioSetting(
            "settings.rogerrx", "Roger Beep (RX)",
            RadioSettingValueList(LIST_OFFAB,
                                  LIST_OFFAB[_mem.settings.rogerrx]))
        basic.append(rs)

        # Advanced settings
        rs = RadioSetting("settings.reset", "RESET Menu",
                          RadioSettingValueBoolean(_mem.settings.reset))
        advanced.append(rs)

        rs = RadioSetting("settings.menu", "All Menus",
                          RadioSettingValueBoolean(_mem.settings.menu))
        advanced.append(rs)

        rs = RadioSetting("settings.fmradio", "Broadcast FM Radio",
                          RadioSettingValueBoolean(_mem.settings.fmradio))
        advanced.append(rs)

        rs = RadioSetting("settings.alarm", "Alarm Sound",
                          RadioSettingValueBoolean(_mem.settings.alarm))
        advanced.append(rs)

        # Other settings
        def _filter(name):
            filtered = ""
            for char in str(name):
                if char in chirp_common.CHARSET_ASCII:
                    filtered += char
                else:
                    filtered += " "
            return filtered

        _msg = _mem.firmware_msg
        val = RadioSettingValueString(0, 7, _filter(_msg.line1))
        val.set_mutable(False)
        rs = RadioSetting("firmware_msg.line1", "Firmware Message 1", val)
        other.append(rs)

        val = RadioSettingValueString(0, 7, _filter(_msg.line2))
        val.set_mutable(False)
        rs = RadioSetting("firmware_msg.line2", "Firmware Message 2", val)
        other.append(rs)

        _msg = _mem.sixpoweron_msg
        val = RadioSettingValueString(0, 7, _filter(_msg.line1))
        val.set_mutable(False)
        rs = RadioSetting("sixpoweron_msg.line1", "6+Power-On Message 1", val)
        other.append(rs)
        val = RadioSettingValueString(0, 7, _filter(_msg.line2))
        val.set_mutable(False)
        rs = RadioSetting("sixpoweron_msg.line2", "6+Power-On Message 2", val)
        other.append(rs)

        _msg = _mem.poweron_msg
        rs = RadioSetting("poweron_msg.line1", "Power-On Message 1",
                          RadioSettingValueString(0, 7, _filter(_msg.line1)))
        other.append(rs)
        rs = RadioSetting("poweron_msg.line2", "Power-On Message 2",
                          RadioSettingValueString(0, 7, _filter(_msg.line2)))
        other.append(rs)

        # Work mode settings
        rs = RadioSetting(
            "settings.displayab", "Display",
            RadioSettingValueList(LIST_AB, LIST_AB[_mem.settings.displayab]))
        work.append(rs)

        rs = RadioSetting("settings.keylock", "Keypad Lock",
                          RadioSettingValueBoolean(_mem.settings.keylock))
        work.append(rs)

        rs = RadioSetting(
            "wmchannel.mrcha", "MR A Channel",
            RadioSettingValueInteger(1, 15, _mem.wmchannel.mrcha))
        work.append(rs)

        rs = RadioSetting(
            "wmchannel.mrchb", "MR B Channel",
            RadioSettingValueInteger(1, 15, _mem.wmchannel.mrchb))
        work.append(rs)

        # broadcast FM settings
        _fm_presets = self._memobj.fm_presets
        if _fm_presets <= 108.0 * 10 - 650:
            preset = _fm_presets / 10.0 + 65
        elif _fm_presets >= 65.0 * 10 and _fm_presets <= 108.0 * 10:
            preset = _fm_presets / 10.0
        else:
            preset = 76.0
        rs = RadioSetting("fm_presets", "FM Preset(MHz)",
                          RadioSettingValueFloat(65, 108.0, preset, 0.1, 1))
        fm_preset.append(rs)

        # DTMF settings
        def apply_code(setting, obj, length):
            code = []
            for j in range(0, length):
                try:
                    code.append(DTMF_CHARS.index(str(setting.value)[j]))
                except IndexError:
                    code.append(0xFF)
            obj.code = code

        for i in range(0, 15):
            _codeobj = self._memobj.pttid[i].code
            _code = "".join([DTMF_CHARS[x] for x in _codeobj if int(x) < 0x1F])
            val = RadioSettingValueString(0, 5, _code, False)
            val.set_charset(DTMF_CHARS)
            pttid = RadioSetting("pttid/%i.code" % i,
                                 "Signal Code %i" % (i + 1), val)
            pttid.set_apply_callback(apply_code, self._memobj.pttid[i], 5)
            dtmfe.append(pttid)

        if _mem.ani.dtmfon > 0xC3:
            val = 0x03
        else:
            val = _mem.ani.dtmfon
        rs = RadioSetting(
            "ani.dtmfon", "DTMF Speed (on)",
            RadioSettingValueList(LIST_DTMFSPEED, LIST_DTMFSPEED[val]))
        dtmfe.append(rs)

        if _mem.ani.dtmfoff > 0xC3:
            val = 0x03
        else:
            val = _mem.ani.dtmfoff
        rs = RadioSetting(
            "ani.dtmfoff", "DTMF Speed (off)",
            RadioSettingValueList(LIST_DTMFSPEED, LIST_DTMFSPEED[val]))
        dtmfe.append(rs)

        _codeobj = self._memobj.ani.code
        _code = "".join([DTMF_CHARS[x] for x in _codeobj if int(x) < 0x1F])
        val = RadioSettingValueString(0, 5, _code, False)
        val.set_charset(DTMF_CHARS)
        rs = RadioSetting("ani.code", "ANI Code", val)
        rs.set_apply_callback(apply_code, self._memobj.ani, 5)
        dtmfe.append(rs)

        rs = RadioSetting(
            "ani.aniid", "When to send ANI ID",
            RadioSettingValueList(LIST_PTTID, LIST_PTTID[_mem.ani.aniid]))
        dtmfe.append(rs)

        # Service settings
        for index in range(0, 10):
            key = "squelch.vhf.sql%i" % (index)
            _obj = self._memobj.squelch.vhf
            val = RadioSettingValueInteger(0, 123,
                                           getattr(_obj, "sql%i" % (index)))
            if index == 0:
                val.set_mutable(False)
            name = "Squelch %i" % (index)
            rs = RadioSetting(key, name, val)
            service.append(rs)

        return top
Exemplo n.º 14
0
    def get_settings(self):
        _settings = self._memobj.settings
        _message = self._memobj.embedded_msg
        basic = RadioSettingGroup("basic", "Basic Settings")
        top = RadioSettings(basic)

        rs = RadioSetting("squelch", "Squelch Level",
                          RadioSettingValueInteger(0, 9, _settings.squelch))
        basic.append(rs)

        rs = RadioSetting("tot", "Time-out timer",
                          RadioSettingValueList(
                              TIMEOUTTIMER_LIST,
                              TIMEOUTTIMER_LIST[_settings.tot]))
        basic.append(rs)

        rs = RadioSetting("voice", "Voice Prompts",
                          RadioSettingValueList(
                              VOICE_LIST, VOICE_LIST[_settings.voice]))
        basic.append(rs)

        rs = RadioSetting("pf2key", "PF2 Key",
                          RadioSettingValueList(
                              PF2KEY_LIST, PF2KEY_LIST[_settings.pf2key]))
        basic.append(rs)

        rs = RadioSetting("vox", "Vox",
                          RadioSettingValueBoolean(_settings.vox))
        basic.append(rs)

        rs = RadioSetting("voxgain", "VOX Level",
                          RadioSettingValueList(
                              VOX_LIST, VOX_LIST[_settings.voxgain]))
        basic.append(rs)

        rs = RadioSetting("voxdelay", "VOX Delay Time",
                          RadioSettingValueList(
                              VOXDELAY_LIST,
                              VOXDELAY_LIST[_settings.voxdelay]))
        basic.append(rs)

        rs = RadioSetting("save", "Battery Save",
                          RadioSettingValueBoolean(_settings.save))
        basic.append(rs)

        rs = RadioSetting("beep", "Beep",
                          RadioSettingValueBoolean(_settings.beep))
        basic.append(rs)

        def _filter(name):
            filtered = ""
            for char in str(name):
                if char in VALID_CHARS:
                    filtered += char
                else:
                    filtered += " "
            return filtered

        rs = RadioSetting("embedded_msg.line1", "Embedded Message 1",
                          RadioSettingValueString(0, 32, _filter(
                              _message.line1)))
        basic.append(rs)

        rs = RadioSetting("embedded_msg.line2", "Embedded Message 2",
                          RadioSettingValueString(0, 32, _filter(
                              _message.line2)))
        basic.append(rs)

        return top
Exemplo n.º 15
0
    def get_settings(self):
        _settings = self._memobj.settings
        _mem = self._memobj
        basic = RadioSettingGroup("basic", "Basic Settings")
        dtmf = RadioSettingGroup("dtmf", "DTMF Settings")
        top = RadioSettings(basic, dtmf)

        if _settings.k1shortp > 5:
            val = 4
        else:
            val = _settings.k1shortp
        rs = RadioSetting("k1shortp", "Key 1 Short Press",
                          RadioSettingValueList(
                              LIST_SHORT_PRESS,
                              LIST_SHORT_PRESS[val]))
        basic.append(rs)

        if _settings.k1longp > 5:
            val = 5
        else:
            val = _settings.k1longp
        rs = RadioSetting("k1longp", "Key 1 Long Press",
                          RadioSettingValueList(
                              LIST_LONG_PRESS,
                              LIST_LONG_PRESS[val]))
        basic.append(rs)

        if _settings.k2shortp > 5:
            val = 1
        else:
            val = _settings.k2shortp
        rs = RadioSetting("k2shortp", "Key 2 Short Press",
                          RadioSettingValueList(
                              LIST_SHORT_PRESS,
                              LIST_SHORT_PRESS[val]))
        basic.append(rs)

        if _settings.k2longp > 5:
            val = 3
        else:
            val = _settings.k2longp
        rs = RadioSetting("k2longp", "Key 2 Long Press",
                          RadioSettingValueList(
                              LIST_LONG_PRESS,
                              LIST_LONG_PRESS[val]))
        basic.append(rs)

        rs = RadioSetting("vox", "VOX",
                          RadioSettingValueBoolean(not _settings.vox))
        basic.append(rs)

        if _settings.voxg > 8:
            val = 4
        else:
            val = _settings.voxg + 1
        rs = RadioSetting("voxg", "VOX Gain",
                          RadioSettingValueInteger(1, 9, val))
        basic.append(rs)

        rs = RadioSetting("voxd", "VOX Delay Time",
                          RadioSettingValueList(
                              LIST_VOXDELAY,
                              LIST_VOXDELAY[_settings.voxd]))
        basic.append(rs)

        rs = RadioSetting("voxi", "VOX Inhibit on Receive",
                          RadioSettingValueBoolean(_settings.voxi))
        basic.append(rs)

        if _settings.squelch > 9:
            val = 5
        else:
            val = _settings.squelch
        rs = RadioSetting("squelch", "Squelch Level",
                          RadioSettingValueInteger(0, 9, val))
        basic.append(rs)

        if _settings.voice == 3:
            val = 1
        else:
            val = _settings.voice
        rs = RadioSetting("voice", "Voice Prompts",
                          RadioSettingValueList(
                              LIST_VOICE,
                              LIST_VOICE[val]))
        basic.append(rs)

        rs = RadioSetting("tone", "Tone",
                          RadioSettingValueBoolean(_settings.tone))
        basic.append(rs)

        rs = RadioSetting("lovoltnotx", "TX Inhibit (when battery < 6 volts)",
                          RadioSettingValueBoolean(_settings.lovoltnotx))
        basic.append(rs)

        rs = RadioSetting("hivoltnotx", "TX Inhibit (when battery > 9 volts)",
                          RadioSettingValueBoolean(_settings.hivoltnotx))
        basic.append(rs)

        if _settings.tot > 0x28:
            val = 6
        else:
            val = _settings.tot
        rs = RadioSetting("tot", "Time-out Timer[s]",
                          RadioSettingValueList(
                              LIST_TIMEOUTTIMER,
                              LIST_TIMEOUTTIMER[val]))
        basic.append(rs)

        if _settings.save < 3:
            val = 0
        else:
            val = _settings.save - 3
        rs = RadioSetting("save", "Battery Saver",
                          RadioSettingValueList(
                              LIST_SAVE,
                              LIST_SAVE[val]))
        basic.append(rs)

        rs = RadioSetting("ssave", "Super Battery Saver[s]",
                          RadioSettingValueList(
                              LIST_SSAVE,
                              LIST_SSAVE[_settings.ssave]))
        basic.append(rs)

        rs = RadioSetting("fmradio", "Broadcast FM",
                          RadioSettingValueBoolean(_settings.fmradio))
        basic.append(rs)

        if _settings.scanspeed > 8:
            val = 4
        else:
            val = _settings.scanspeed
        rs = RadioSetting("scanspeed", "Scan Speed[ms]",
                          RadioSettingValueList(
                          LIST_SCANSPEED,
                          LIST_SCANSPEED[val]))
        basic.append(rs)

        if _settings.scandelay > 27:
            val = 12
        else:
            val = _settings.scandelay
        rs = RadioSetting("scandelay", "Scan Droupout Delay Time[s]",
                          RadioSettingValueList(
                              LIST_SCANDELAY,
                              LIST_SCANDELAY[val]))
        basic.append(rs)

        if _mem.dtmf.dtmfspd > 11:
            val = 2
        else:
            val = _mem.dtmf.dtmfspd + 4
        rs = RadioSetting("dtmf.dtmfspd", "DTMF Speed[digit/s]",
                          RadioSettingValueInteger(4, 15, val))
        dtmf.append(rs)

        if _mem.dtmf.digtime > 10:
            val = 0
        else:
            val = _mem.dtmf.digtime
        rs = RadioSetting("dtmf.digtime", "1st Digit Time[ms]",
                          RadioSettingValueList(
                              LIST_DIGTIME,
                              LIST_DIGTIME[val]))
        dtmf.append(rs)

        if _mem.dtmf.digdelay > 9:
            val = 0
        else:
            val = _mem.dtmf.digdelay
        rs = RadioSetting("dtmf.digdelay", "1st Digit Delay[ms]",
                          RadioSettingValueList(
                              LIST_DIGDELAY,
                              LIST_DIGDELAY[val]))
        dtmf.append(rs)

        rs = RadioSetting("dtmf.starhash", "* and # Time[ms]",
                          RadioSettingValueList(
                              LIST_STARHASH,
                              LIST_STARHASH[_mem.dtmf.starhash]))
        dtmf.append(rs)

        rs = RadioSetting("dtmf.codespace", "Code Space Time[ms]",
                          RadioSettingValueList(
                              LIST_CODESPACE,
                              LIST_CODESPACE[_mem.dtmf.codespace]))
        dtmf.append(rs)

        rs = RadioSetting("dtmf.sidetone", "DTMF Sidetone",
                          RadioSettingValueBoolean(_mem.dtmf.sidetone))
        dtmf.append(rs)

        # setup pttid entries
        for i in range(0, 2):
            objname = "code" + str(i + 1)
            names = ["PTT ID(BOT)", "PTT ID(EOT)"]
            strname = str(names[i])
            dtmfsetting = getattr(_mem.dtmf, objname)
            dtmflen = getattr(_mem.dtmf, objname + "_len")
            dtmfstr = self._bbcd2dtmf(dtmfsetting, dtmflen)
            code = RadioSettingValueString(0, 16, dtmfstr)
            code.set_charset(DTMF_CHARSET + list(" "))
            rs = RadioSetting("dtmf." + objname, strname, code)
            dtmf.append(rs)

        def _filter(name):
            filtered = ""
            for char in str(name):
                if char in NUMERIC_CHARSET:
                    filtered += char
                else:
                    filtered += " "
            return filtered

        # setup id code entry
        codesetting = getattr(_mem.dtmf, "idcode")
        codestr = self._bbcd2num(codesetting, 6)
        code = RadioSettingValueString(0, 6, _filter(codestr))
        code.set_charset(NUMERIC_CHARSET + list(" "))
        rs = RadioSetting("dtmf.idcode", "ID Code", code)
        dtmf.append(rs)

        if _mem.dtmf.groupcode > 6:
            val = 0
        else:
            val = _mem.dtmf.groupcode
        rs = RadioSetting("dtmf.groupcode", "Group Code",
                          RadioSettingValueList(
                              LIST_GROUPCODE,
                              LIST_GROUPCODE[val]))
        dtmf.append(rs)

        if _mem.dtmf.resettime > 60:
            val = 0
        else:
            val = _mem.dtmf.resettime
        rs = RadioSetting("dtmf.resettime", "Auto Reset Time[s]",
                          RadioSettingValueList(
                              LIST_RESETTIME,
                              LIST_RESETTIME[_mem.dtmf.resettime]))
        dtmf.append(rs)

        rs = RadioSetting("dtmf.txdecode", "TX Decode",
                          RadioSettingValueBoolean(_mem.dtmf.txdecode))
        dtmf.append(rs)

        rs = RadioSetting("dtmf.decodeto", "Decode Time Out[ms]",
                          RadioSettingValueList(
                              LIST_DECODETO,
                              LIST_DECODETO[_mem.dtmf.decodeto]))
        dtmf.append(rs)

        rs = RadioSetting("dtmf.decodetone", "Decode Tone",
                          RadioSettingValueBoolean(_mem.dtmf.decodetone))
        dtmf.append(rs)

        rs = RadioSetting("dtmf.resettone", "Reset Tone",
                          RadioSettingValueBoolean(_mem.dtmf.resettone))
        dtmf.append(rs)

        rs = RadioSetting("dtmf.stuntype", "Stun Type",
                          RadioSettingValueList(
                              LIST_STUNTYPE,
                              LIST_STUNTYPE[_mem.dtmf.stuntype]))
        dtmf.append(rs)

        ## setup stun entry
        objname = "code3"
        strname = "Stun Code"
        dtmfsetting = getattr(_mem.dtmf, objname)
        dtmflen = getattr(_mem.dtmf, objname + "_len")
        dtmfstr = self._bbcd2dtmf(dtmfsetting, dtmflen)
        code = RadioSettingValueString(0, 10, dtmfstr)
        code.set_charset(DTMF_CHARSET + list(" "))
        rs = RadioSetting("dtmf." + objname, strname, code)
        dtmf.append(rs)

        return top
Exemplo n.º 16
0
    def get_settings(self):
        """Translate the bit in the mem_struct into settings in the UI"""
        _mem = self._memobj
        basic = RadioSettingGroup("basic", "Basic Settings")
        other = RadioSettingGroup("other", "Other Settings")
        work = RadioSettingGroup("work", "Work Mode Settings")
        dtmf = RadioSettingGroup("dtmf", "DTMF Settings")
        top = RadioSettings(basic, other, work, dtmf)

        # Basic

        # Audio: A01-A04

        aftone = RadioSetting(
            "settings.aftone", "AF tone control",
            RadioSettingValueList(LIST_AFTONE,
                                  LIST_AFTONE[_mem.settings.aftone]))
        basic.append(aftone)

        spkr = RadioSetting(
            "settings.spkr", "Speaker",
            RadioSettingValueList(LIST_SPKR, LIST_SPKR[_mem.settings.spkr]))
        basic.append(spkr)

        audio = RadioSetting(
            "settings.audio", "Stereo/Mono",
            RadioSettingValueList(LIST_AUDIO, LIST_AUDIO[_mem.settings.audio]))
        basic.append(audio)

        sbmute = RadioSetting(
            "settings.sbmute", "Sub band mute",
            RadioSettingValueList(LIST_SBMUTE,
                                  LIST_SBMUTE[_mem.settings.sbmute]))
        basic.append(sbmute)

        # TX/RX: B01-B08

        mgain = RadioSetting(
            "settings.mgain", "Mic gain",
            RadioSettingValueList(LIST_MLNHM, LIST_MLNHM[_mem.settings.mgain]))
        basic.append(mgain)

        ptt = RadioSetting(
            "settings.ptt", "PTT mode",
            RadioSettingValueList(LIST_PTT, LIST_PTT[_mem.settings.ptt]))
        basic.append(ptt)

        # B03 (per channel)
        # B04 (per channel)

        rxexp = RadioSetting(
            "settings.rxexp", "RX expansion",
            RadioSettingValueList(LIST_RXEXP, LIST_RXEXP[_mem.settings.rxexp]))
        basic.append(rxexp)

        vox = RadioSetting(
            "settings.vox", "Vox",
            RadioSettingValueList(LIST_VOX, LIST_VOX[_mem.settings.vox]))
        basic.append(vox)

        voxs = RadioSetting(
            "settings.voxs", "Vox sensitivity",
            RadioSettingValueList(LIST_MLNHM, LIST_MLNHM[_mem.settings.voxs]))
        basic.append(voxs)

        # B08 (per channel)

        # Display: C01-C06

        display = RadioSetting(
            "settings.display", "Display select",
            RadioSettingValueList(LIST_DISPLAY,
                                  LIST_DISPLAY[_mem.settings.display]))
        basic.append(display)

        lcdb = RadioSetting(
            "settings.lcdb", "LCD brightness",
            RadioSettingValueList(LIST_MINMAX,
                                  LIST_MINMAX[_mem.settings.lcdb]))
        basic.append(lcdb)

        color = RadioSetting(
            "settings.color", "LCD color",
            RadioSettingValueList(LIST_COLOR, LIST_COLOR[_mem.settings.color]))
        basic.append(color)

        lcdc = RadioSetting(
            "settings.lcdc", "LCD contrast",
            RadioSettingValueList(LIST_MINMAX,
                                  LIST_MINMAX[_mem.settings.lcdc]))
        basic.append(lcdc)

        btime = RadioSetting(
            "settings.btime", "LCD backlight time",
            RadioSettingValueList(LIST_BTIME, LIST_BTIME[_mem.settings.btime]))
        basic.append(btime)

        keyb = RadioSetting(
            "settings.keyb", "Key brightness",
            RadioSettingValueList(LIST_MINMAX,
                                  LIST_MINMAX[_mem.settings.keyb]))
        basic.append(keyb)

        # Memory: D01-D04

        # D01 (per channel)
        # D02 (per channel)

        mrscan = RadioSetting(
            "settings.mrscan", "Memory scan type",
            RadioSettingValueList(LIST_MRSCAN,
                                  LIST_MRSCAN[_mem.settings.mrscan]))
        basic.append(mrscan)

        # D04 (per channel)

        # Scan: E01-E04

        dwstop = RadioSetting(
            "settings.dwstop", "Dual watch stop",
            RadioSettingValueList(LIST_DWSTOP,
                                  LIST_DWSTOP[_mem.settings.dwstop]))
        basic.append(dwstop)

        scand = RadioSetting(
            "settings.scand", "Scan direction",
            RadioSettingValueList(LIST_SCAND, LIST_SCAND[_mem.settings.scand]))
        basic.append(scand)

        scanr = RadioSetting(
            "settings.scanr", "Scan resume",
            RadioSettingValueList(LIST_SCANR, LIST_SCANR[_mem.settings.scanr]))
        basic.append(scanr)

        scansb = RadioSetting("settings.scansb", "Scan stop beep",
                              RadioSettingValueBoolean(_mem.settings.scansb))
        basic.append(scansb)

        # System: F01-F09

        apo = RadioSetting(
            "settings.apo", "Automatic power off [hours]",
            RadioSettingValueList(LIST_APO, LIST_APO[_mem.settings.apo]))
        basic.append(apo)

        ars = RadioSetting("settings.ars", "Automatic repeater shift",
                           RadioSettingValueBoolean(_mem.settings.ars))
        basic.append(ars)

        beep = RadioSetting(
            "settings.beep", "Beep volume",
            RadioSettingValueList(LIST_BEEP, LIST_BEEP[_mem.settings.beep]))
        basic.append(beep)

        fkey = RadioSetting(
            "settings.fkey", "F key",
            RadioSettingValueList(LIST_FKEY, LIST_FKEY[_mem.settings.fkey]))
        basic.append(fkey)

        pfkey1 = RadioSetting(
            "settings.pfkey1", "Mic P1 key",
            RadioSettingValueList(LIST_PFKEY,
                                  LIST_PFKEY[_mem.settings.pfkey1]))
        basic.append(pfkey1)

        pfkey2 = RadioSetting(
            "settings.pfkey2", "Mic P2 key",
            RadioSettingValueList(LIST_PFKEY,
                                  LIST_PFKEY[_mem.settings.pfkey2]))
        basic.append(pfkey2)

        pfkey3 = RadioSetting(
            "settings.pfkey3", "Mic P3 key",
            RadioSettingValueList(LIST_PFKEY,
                                  LIST_PFKEY[_mem.settings.pfkey3]))
        basic.append(pfkey3)

        pfkey4 = RadioSetting(
            "settings.pfkey4", "Mic P4 key",
            RadioSettingValueList(LIST_PFKEY,
                                  LIST_PFKEY[_mem.settings.pfkey4]))
        basic.append(pfkey4)

        omode = RadioSetting(
            "settings.omode", "Operation mode",
            RadioSettingValueList(LIST_AB, LIST_AB[_mem.settings.omode]))
        basic.append(omode)

        rxcoverm = RadioSetting(
            "settings.rxcoverm", "RX coverage - memory",
            RadioSettingValueList(LIST_COVERAGE,
                                  LIST_COVERAGE[_mem.settings.rxcoverm]))
        basic.append(rxcoverm)

        rxcoverv = RadioSetting(
            "settings.rxcoverv", "RX coverage - VFO",
            RadioSettingValueList(LIST_COVERAGE,
                                  LIST_COVERAGE[_mem.settings.rxcoverv]))
        basic.append(rxcoverv)

        tot = RadioSetting(
            "settings.tot", "Time out timer [min]",
            RadioSettingValueList(LIST_TOT, LIST_TOT[_mem.settings.tot]))
        basic.append(tot)

        # Timer/Clock: G01-G04

        # G01
        datefmt = RadioSetting(
            "settings.datefmt", "Date format",
            RadioSettingValueList(LIST_DATEFMT,
                                  LIST_DATEFMT[_mem.settings.datefmt]))
        basic.append(datefmt)

        timefmt = RadioSetting(
            "settings.timefmt", "Time format",
            RadioSettingValueList(LIST_TIMEFMT,
                                  LIST_TIMEFMT[_mem.settings.timefmt]))
        basic.append(timefmt)

        timesig = RadioSetting("settings.timesig", "Time signal",
                               RadioSettingValueBoolean(_mem.settings.timesig))
        basic.append(timesig)

        tz = RadioSetting(
            "settings.tz", "Time zone",
            RadioSettingValueList(LIST_TZ, LIST_TZ[_mem.settings.tz]))
        basic.append(tz)

        # Signaling: H01-H06

        bell = RadioSetting(
            "settings.bell", "Bell ringer",
            RadioSettingValueList(LIST_BELL, LIST_BELL[_mem.settings.bell]))
        basic.append(bell)

        # H02 (per channel)

        dtmfmodenc = RadioSetting(
            "settings.dtmfmodenc", "DTMF mode encode",
            RadioSettingValueBoolean(_mem.settings.dtmfmodenc))
        basic.append(dtmfmodenc)

        dtmfmoddec = RadioSetting(
            "settings.dtmfmoddec", "DTMF mode decode",
            RadioSettingValueBoolean(_mem.settings.dtmfmoddec))
        basic.append(dtmfmoddec)

        # H04 (per channel)

        decbandsel = RadioSetting(
            "settings.decbandsel", "DTMF band select",
            RadioSettingValueList(LIST_AB, LIST_AB[_mem.settings.decbandsel]))
        basic.append(decbandsel)

        sqlexp = RadioSetting("settings.sqlexp", "SQL expansion",
                              RadioSettingValueBoolean(_mem.settings.sqlexp))
        basic.append(sqlexp)

        # Pkt: I01-I03

        databnd = RadioSetting(
            "settings.databnd", "Packet data band",
            RadioSettingValueList(LIST_DATABND,
                                  LIST_DATABND[_mem.settings.databnd]))
        basic.append(databnd)

        dataspd = RadioSetting(
            "settings.dataspd", "Packet data speed",
            RadioSettingValueList(LIST_DATASPD,
                                  LIST_DATASPD[_mem.settings.dataspd]))
        basic.append(dataspd)

        datasql = RadioSetting(
            "settings.datasql", "Packet data squelch",
            RadioSettingValueList(LIST_DATASQL,
                                  LIST_DATASQL[_mem.settings.datasql]))
        basic.append(datasql)

        # Other

        dw = RadioSetting("settings.dw", "Dual watch",
                          RadioSettingValueBoolean(_mem.settings.dw))
        other.append(dw)

        cpuclk = RadioSetting(
            "settings.cpuclk", "CPU clock frequency",
            RadioSettingValueList(LIST_CPUCLK,
                                  LIST_CPUCLK[_mem.settings.cpuclk]))
        other.append(cpuclk)

        def _filter(name):
            filtered = ""
            for char in str(name):
                if char in VALID_CHARS:
                    filtered += char
                else:
                    filtered += " "
            return filtered

        line16 = RadioSetting(
            "poweron_msg.line16", "Power-on message",
            RadioSettingValueString(0, 16, _filter(_mem.poweron_msg.line16)))
        other.append(line16)

        line32 = RadioSetting(
            "embedded_msg.line32", "Embedded message",
            RadioSettingValueString(0, 32, _filter(_mem.embedded_msg.line32)))
        other.append(line32)

        # Work

        workmoda = RadioSetting(
            "settings.workmoda", "Work mode A",
            RadioSettingValueList(LIST_WORK,
                                  LIST_WORK[_mem.settings.workmoda]))
        work.append(workmoda)

        workmodb = RadioSetting(
            "settings.workmodb", "Work mode B",
            RadioSettingValueList(LIST_WORK,
                                  LIST_WORK[_mem.settings.workmodb]))
        work.append(workmodb)

        wbanda = RadioSetting(
            "settings.wbanda", "Work band A",
            RadioSettingValueList(LIST_WBANDA,
                                  LIST_WBANDA[(_mem.settings.wbanda) - 1]))
        work.append(wbanda)

        wbandb = RadioSetting(
            "settings.wbandb", "Work band B",
            RadioSettingValueList(LIST_WBANDB,
                                  LIST_WBANDB[(_mem.settings.wbandb) - 4]))
        work.append(wbandb)

        sqla = RadioSetting(
            "settings.sqla", "Squelch A",
            RadioSettingValueList(LIST_SQL, LIST_SQL[_mem.settings.sqla]))
        work.append(sqla)

        sqlb = RadioSetting(
            "settings.sqlb", "Squelch B",
            RadioSettingValueList(LIST_SQL, LIST_SQL[_mem.settings.sqlb]))
        work.append(sqlb)

        stepa = RadioSetting(
            "settings.stepa", "Auto step A",
            RadioSettingValueList(LIST_STEP, LIST_STEP[_mem.settings.stepa]))
        work.append(stepa)

        stepb = RadioSetting(
            "settings.stepb", "Auto step B",
            RadioSettingValueList(LIST_STEP, LIST_STEP[_mem.settings.stepb]))
        work.append(stepb)

        mrcha = RadioSetting(
            "settings.mrcha", "Current channel A",
            RadioSettingValueInteger(0, 499, _mem.settings.mrcha))
        work.append(mrcha)

        mrchb = RadioSetting(
            "settings.mrchb", "Current channel B",
            RadioSettingValueInteger(0, 499, _mem.settings.mrchb))
        work.append(mrchb)

        val = _mem.settings.offseta / 100.00
        offseta = RadioSetting("settings.offseta", "Offset A (0-37.95)",
                               RadioSettingValueFloat(0, 38.00, val, 0.05, 2))
        work.append(offseta)

        val = _mem.settings.offsetb / 100.00
        offsetb = RadioSetting("settings.offsetb", "Offset B (0-79.95)",
                               RadioSettingValueFloat(0, 80.00, val, 0.05, 2))
        work.append(offsetb)

        wpricha = RadioSetting(
            "settings.wpricha", "Priority channel A",
            RadioSettingValueInteger(0, 499, _mem.settings.wpricha))
        work.append(wpricha)

        wprichb = RadioSetting(
            "settings.wprichb", "Priority channel B",
            RadioSettingValueInteger(0, 499, _mem.settings.wprichb))
        work.append(wprichb)

        smode = RadioSetting(
            "settings.smode", "Smart function mode",
            RadioSettingValueList(LIST_SMODE, LIST_SMODE[_mem.settings.smode]))
        work.append(smode)

        # dtmf

        ttdkey = RadioSetting(
            "dtmf.ttdkey", "D key function",
            RadioSettingValueList(LIST_TTDKEY, LIST_TTDKEY[_mem.dtmf.ttdkey]))
        dtmf.append(ttdkey)

        ttdgt = RadioSetting(
            "dtmf.ttdgt", "Digit time",
            RadioSettingValueList(LIST_TT200,
                                  LIST_TT200[(_mem.dtmf.ttdgt) - 5]))
        dtmf.append(ttdgt)

        ttint = RadioSetting(
            "dtmf.ttint", "Interval time",
            RadioSettingValueList(LIST_TT200,
                                  LIST_TT200[(_mem.dtmf.ttint) - 5]))
        dtmf.append(ttint)

        tt1stdgt = RadioSetting(
            "dtmf.tt1stdgt", "1st digit time",
            RadioSettingValueList(LIST_TT200,
                                  LIST_TT200[(_mem.dtmf.tt1stdgt) - 5]))
        dtmf.append(tt1stdgt)

        tt1stdly = RadioSetting(
            "dtmf.tt1stdly", "1st digit delay time",
            RadioSettingValueList(LIST_TT1000,
                                  LIST_TT1000[(_mem.dtmf.tt1stdly) - 2]))
        dtmf.append(tt1stdly)

        ttdlyqt = RadioSetting(
            "dtmf.ttdlyqt", "Digit delay when use qt",
            RadioSettingValueList(LIST_TT1000,
                                  LIST_TT1000[(_mem.dtmf.ttdlyqt) - 2]))
        dtmf.append(ttdlyqt)

        ttsig = RadioSetting(
            "dtmf2.ttsig", "Signal",
            RadioSettingValueList(LIST_TTSIG, LIST_TTSIG[_mem.dtmf2.ttsig]))
        dtmf.append(ttsig)

        ttautorst = RadioSetting(
            "dtmf2.ttautorst", "Auto reset time",
            RadioSettingValueList(LIST_TTAUTORST,
                                  LIST_TTAUTORST[_mem.dtmf2.ttautorst]))
        dtmf.append(ttautorst)

        if _mem.dtmf2.ttgrpcode > 0x06:
            val = 0x00
        else:
            val = _mem.dtmf2.ttgrpcode
        ttgrpcode = RadioSetting(
            "dtmf2.ttgrpcode", "Group code",
            RadioSettingValueList(LIST_TTGRPCODE, LIST_TTGRPCODE[val]))
        dtmf.append(ttgrpcode)

        ttintcode = RadioSetting(
            "dtmf2.ttintcode", "Interval code",
            RadioSettingValueList(LIST_TTINTCODE,
                                  LIST_TTINTCODE[_mem.dtmf2.ttintcode]))
        dtmf.append(ttintcode)

        if _mem.dtmf2.ttalert > 0x04:
            val = 0x00
        else:
            val = _mem.dtmf2.ttalert
        ttalert = RadioSetting(
            "dtmf2.ttalert", "Alert tone/transpond",
            RadioSettingValueList(LIST_TTALERT, LIST_TTALERT[val]))
        dtmf.append(ttalert)

        ttautod = RadioSetting(
            "dtmf.ttautod", "Auto dial group",
            RadioSettingValueList(LIST_TTAUTOD,
                                  LIST_TTAUTOD[_mem.dtmf.ttautod]))
        dtmf.append(ttautod)

        # setup 9 dtmf autodial entries
        for i in map(str, range(1, 10)):
            objname = "code" + i
            strname = "Code " + str(i)
            dtmfsetting = getattr(_mem.dtmfcode, objname)
            dtmflen = getattr(_mem.dtmfcode, objname + "_len")
            dtmfstr = self._bbcd2dtmf(dtmfsetting, dtmflen)
            code = RadioSettingValueString(0, 16, dtmfstr)
            code.set_charset(DTMF_CHARS + list(" "))
            rs = RadioSetting("dtmfcode." + objname, strname, code)
            dtmf.append(rs)
        return top
Exemplo n.º 17
0
    def get_settings(self):
        _settings = self._memobj.settings

        repeater = RadioSettingGroup("repeater", "Repeater Settings")
        ctcss = RadioSettingGroup("ctcss", "CTCSS/DCS/DTMF Settings")
        arts = RadioSettingGroup("arts", "ARTS Settings")
        scan = RadioSettingGroup("scan", "Scan Settings")
        power = RadioSettingGroup("power", "Power Saver Settings")
        wires = RadioSettingGroup("wires", "WiRES(tm) Settings")
        eai = RadioSettingGroup("eai", "EAI/EPCS Settings")
        switch = RadioSettingGroup("switch", "Switch/Knob Settings")
        misc = RadioSettingGroup("misc", "Miscellaneous Settings")
        mbls = RadioSettingGroup("banks", "Memory Bank Link Scan")

        setmode = RadioSettings(repeater, ctcss, arts, scan, power,
                                wires, eai, switch, misc, mbls)

        # APO
        opts = ["OFF"] + ["%0.1f" % (x * 0.5) for x in range(1, 24+1)]
        misc.append(
            RadioSetting(
                "apo", "Automatic Power Off",
                RadioSettingValueList(opts, opts[_settings.apo])))

        # AR.BEP
        opts = ["OFF", "INRANG", "ALWAYS"]
        arts.append(
            RadioSetting(
                "ar_bep", "ARTS Beep",
                RadioSettingValueList(opts, opts[_settings.ar_bep])))

        # AR.INT
        opts = ["25 SEC", "15 SEC"]
        arts.append(
            RadioSetting(
                "ar_int", "ARTS Polling Interval",
                RadioSettingValueList(opts, opts[_settings.ar_int])))

        # ARS
        opts = ["OFF", "ON"]
        repeater.append(
            RadioSetting(
                "ars", "Automatic Repeater Shift",
                RadioSettingValueList(opts, opts[_settings.ars])))

        # BCLO
        opts = ["OFF", "ON"]
        misc.append(RadioSetting(
                "bclo", "Busy Channel Lock-Out",
                RadioSettingValueList(opts, opts[_settings.bclo])))

        # BEEP
        opts = ["OFF", "KEY", "KEY+SC"]
        rs = RadioSetting(
                "beep_key", "Enable the Beeper",
                RadioSettingValueList(
                    opts, opts[_settings.beep_key + _settings.beep_sc]))

        def apply_beep(s, obj):
            setattr(obj, "beep_key",
                    (int(s.value) & 1) or ((int(s.value) >> 1) & 1))
            setattr(obj, "beep_sc", (int(s.value) >> 1) & 1)
        rs.set_apply_callback(apply_beep, self._memobj.settings)
        switch.append(rs)

        # BELL
        opts = ["OFF", "1T", "3T", "5T", "8T", "CONT"]
        ctcss.append(RadioSetting("bell", "Bell Repetitions",
                     RadioSettingValueList(opts, opts[_settings.bell])))

        # BSY.LED
        opts = ["ON", "OFF"]
        misc.append(RadioSetting("bsy_led", "Busy LED",
                    RadioSettingValueList(opts, opts[_settings.bsy_led])))

        # DCS.NR
        opts = ["TR/X N", "RX R", "TX R", "T/RX R"]
        ctcss.append(RadioSetting("dcs_nr", "\"Inverted\" DCS Code Decoding",
                     RadioSettingValueList(opts, opts[_settings.dcs_nr])))

        # DT.DLY
        opts = ["50 MS", "100 MS", "250 MS", "450 MS", "750 MS", "1000 MS"]
        ctcss.append(RadioSetting("dt_dly", "DTMF Autodialer Delay Time",
                     RadioSettingValueList(opts, opts[_settings.dt_dly])))

        # DT.SPD
        opts = ["50 MS", "100 MS"]
        ctcss.append(RadioSetting("dt_spd", "DTMF Autodialer Sending Speed",
                     RadioSettingValueList(opts, opts[_settings.dt_spd])))

        # DT.WRT
        for i in range(0, 9):
            dtmf = self._memobj.dtmf[i]
            str = ""
            for c in dtmf.memory:
                if c == 0xFF:
                    break
                if c < len(DTMF_CHARS):
                    str += DTMF_CHARS[c]
            val = RadioSettingValueString(0, 16, str, False)
            val.set_charset(DTMF_CHARS + list("abcd"))
            rs = RadioSetting("dtmf_%i" % i, 
                        "DTMF Autodialer Memory %i" % (i + 1), val)
            def apply_dtmf(s, obj):
                str = s.value.get_value().upper().rstrip()
                val = [DTMF_CHARS.index(x) for x in str]
                for x in range(len(val), 16):
                    val.append(0xFF)
                obj.memory = val
            rs.set_apply_callback(apply_dtmf, dtmf)
            ctcss.append(rs)

        # EDG.BEP
        opts = ["OFF", "ON"]
        misc.append(RadioSetting("edg_bep", "Band Edge Beeper",
                    RadioSettingValueList(opts, opts[_settings.edg_bep])))

        # I.NET
        opts = ["OFF", "COD", "MEM"]
        rs = RadioSetting("inet", "Internet Link Connection",
                          RadioSettingValueList(
                              opts, opts[_settings.inet - 1]))

        def apply_inet(s, obj):
            setattr(obj, s.get_name(), int(s.value) + 1)
        rs.set_apply_callback(apply_inet, self._memobj.settings)
        wires.append(rs)

        # INT.CD
        opts = ["CODE 0", "CODE 1", "CODE 2", "CODE 3", "CODE 4",
                "CODE 5", "CODE 6", "CODE 7", "CODE 8", "CODE 9",
                "CODE A", "CODE B", "CODE C", "CODE D", "CODE E", "CODE F"]
        wires.append(RadioSetting("int_cd", "Access Number for WiRES(TM)",
                     RadioSettingValueList(opts, opts[_settings.int_cd])))

        # INT.MR
        opts = ["d1", "d2", "d3", "d4", "d5", "d6", "d7", "d8", "d9"]
        wires.append(RadioSetting(
                    "int_mr", "Access Number (DTMF) for Non-WiRES(TM)",
                     RadioSettingValueList(opts, opts[_settings.int_mr])))

        # LAMP
        opts = ["KEY", "5SEC", "TOGGLE"]
        switch.append(RadioSetting("lamp", "Lamp Mode",
                      RadioSettingValueList(opts, opts[_settings.lamp])))

        # LOCK
        opts = ["LK KEY", "LKDIAL", "LK K+D", "LK PTT",
                "LP P+K", "LK P+D", "LK ALL"]
        rs = RadioSetting("lock", "Control Locking",
                          RadioSettingValueList(
                              opts, opts[_settings.lock - 1]))

        def apply_lock(s, obj):
            setattr(obj, s.get_name(), int(s.value) + 1)
        rs.set_apply_callback(apply_lock, self._memobj.settings)
        switch.append(rs)

        # M/T-CL
        opts = ["MONI", "T-CALL"]
        switch.append(RadioSetting("mt_cl", "MONI Switch Function",
                      RadioSettingValueList(opts, opts[_settings.mt_cl])))

        # PAG.ABK
        opts = ["OFF", "ON"]
        eai.append(RadioSetting("pag_abk", "Paging Answer Back",
                   RadioSettingValueList(opts, opts[_settings.pag_abk])))

        # RESUME
        opts = ["TIME", "HOLD", "BUSY"]
        scan.append(RadioSetting("resume", "Scan Resume Mode",
                    RadioSettingValueList(opts, opts[_settings.resume])))

        # REV/HM
        opts = ["REV", "HOME"]
        switch.append(RadioSetting("rev_hm", "HM/RV Key Function",
                      RadioSettingValueList(opts, opts[_settings.rev_hm])))

        # RF.SQL
        opts = ["OFF", "S-1", "S-2", "S-3", "S-4", "S-5", "S-6",
                "S-7", "S-8", "S-FULL"]
        misc.append(RadioSetting("rf_sql", "RF Squelch Threshold",
                    RadioSettingValueList(opts, opts[_settings.rf_sql])))

        # PRI.RVT
        opts = ["OFF", "ON"]
        scan.append(RadioSetting("pri_rvt", "Priority Revert",
                    RadioSettingValueList(opts, opts[_settings.pri_rvt])))

        # RXSAVE
        opts = ["OFF", "200 MS", "300 MS", "500 MS", "1 S", "2 S"]
        power.append(RadioSetting(
                    "rxsave", "Receive Mode Batery Savery Interval",
                     RadioSettingValueList(opts, opts[_settings.rxsave])))

        # S.SRCH
        opts = ["SINGLE", "CONT"]
        misc.append(RadioSetting("ssrch", "Smart Search Sweep Mode",
                    RadioSettingValueList(opts, opts[_settings.ssrch])))

        # SCN.MD
        opts = ["MEM", "ONLY"]
        scan.append(RadioSetting(
                    "scn_md", "Memory Scan Channel Selection Mode",
                    RadioSettingValueList(opts, opts[_settings.scn_md])))

        # SCN.LMP
        opts = ["OFF", "ON"]
        scan.append(RadioSetting("scn_lmp", "Scan Lamp",
                    RadioSettingValueList(opts, opts[_settings.scn_lmp])))

        # TOT
        opts = ["OFF"] + ["%dMIN" % (x) for x in range(1, 30+1)]
        misc.append(RadioSetting("tot", "Timeout Timer",
                    RadioSettingValueList(opts, opts[_settings.tot])))

        # TX.LED
        opts = ["ON", "OFF"]
        misc.append(RadioSetting("tx_led", "TX LED",
                    RadioSettingValueList(opts, opts[_settings.tx_led])))

        # TXSAVE
        opts = ["OFF", "ON"]
        power.append(RadioSetting("txsave", "Transmitter Battery Saver",
                     RadioSettingValueList(opts, opts[_settings.txsave])))

        # VFO.BND
        opts = ["BAND", "ALL"]
        misc.append(RadioSetting("vfo_bnd", "VFO Band Edge Limiting",
                    RadioSettingValueList(opts, opts[_settings.vfo_bnd])))

        # WX.ALT
        opts = ["OFF", "ON"]
        scan.append(RadioSetting("wx_alt", "Weather Alert Scan",
                    RadioSettingValueList(opts, opts[_settings.wx_alt])))

        # MBS
        for i in range(0, 10):
            opts = ["OFF", "ON"]
            mbs = (self._memobj.mbs >> i) & 1
            rs = RadioSetting("mbs%i" % i, "Bank %s Scan" % (i + 1),
                              RadioSettingValueList(opts, opts[mbs]))

            def apply_mbs(s, index):
                if int(s.value):
                    self._memobj.mbs |= (1 << index)
                else:
                    self._memobj.mbs &= ~(1 << index)
            rs.set_apply_callback(apply_mbs, i)
            mbls.append(rs)

        return setmode
Exemplo n.º 18
0
    def _get_settings(self):
        _settings = self._memobj.settings
        _vfoa = self._memobj.vfoa
        _vfob = self._memobj.vfob
        cfg_grp = RadioSettingGroup("cfg_grp", "Configuration")
        vfoa_grp = RadioSettingGroup("vfoa_grp", "VFO A Settings")
        vfob_grp = RadioSettingGroup("vfob_grp", "VFO B Settings")
        key_grp = RadioSettingGroup("key_grp", "Key Settings")
        lmt_grp = RadioSettingGroup("lmt_grp", "Frequency Limits")
        uhf_lmt_grp = RadioSettingGroup("uhf_lmt_grp", "UHF")
        vhf_lmt_grp = RadioSettingGroup("vhf_lmt_grp", "VHF")
        oem_grp = RadioSettingGroup("oem_grp", "OEM Info")

        lmt_grp.append(uhf_lmt_grp);
        lmt_grp.append(vhf_lmt_grp);
        group = RadioSettings(cfg_grp, vfoa_grp, vfob_grp,
                              key_grp, lmt_grp, oem_grp)

        #
        # Configuration Settings
        #
        rs = RadioSetting("channel_menu", "Menu available in channel mode",
                          RadioSettingValueBoolean(_settings.channel_menu))
        cfg_grp.append(rs)
        rs = RadioSetting("ponmsg", "Poweron message",
                          RadioSettingValueList(
                              PONMSG_LIST, PONMSG_LIST[_settings.ponmsg]))
        cfg_grp.append(rs)
        rs = RadioSetting("voice", "Voice Guide",
                          RadioSettingValueBoolean(_settings.voice))
        cfg_grp.append(rs)
        rs = RadioSetting("language", "Language",
                          RadioSettingValueList(LANGUAGE_LIST,
                                                LANGUAGE_LIST[_settings.
                                                              language]))
        cfg_grp.append(rs)
        rs = RadioSetting("timeout", "Timeout Timer",
                          RadioSettingValueList(
                              TIMEOUT_LIST, TIMEOUT_LIST[_settings.timeout]))
        cfg_grp.append(rs)
        rs = RadioSetting("toalarm", "Timeout Alarm",
                          RadioSettingValueInteger(0, 10, _settings.toalarm))
        cfg_grp.append(rs)
        rs = RadioSetting("roger_beep", "Roger Beep",
                          RadioSettingValueList(ROGER_LIST, 
                                                ROGER_LIST[_settings.roger_beep]))
        cfg_grp.append(rs)
        rs = RadioSetting("power_save", "Power save",
                          RadioSettingValueBoolean(_settings.power_save))
        cfg_grp.append(rs)
        rs = RadioSetting("autolock", "Autolock",
                          RadioSettingValueBoolean(_settings.autolock))
        cfg_grp.append(rs)
        rs = RadioSetting("keylock", "Keypad Lock",
                          RadioSettingValueBoolean(_settings.keylock))
        cfg_grp.append(rs)
        rs = RadioSetting("beep", "Keypad Beep",
                          RadioSettingValueBoolean(_settings.beep))
        cfg_grp.append(rs)
        rs = RadioSetting("stopwatch", "Stopwatch",
                          RadioSettingValueBoolean(_settings.stopwatch))
        cfg_grp.append(rs)
        rs = RadioSetting("backlight", "Backlight",
                          RadioSettingValueList(BACKLIGHT_LIST,
                                                BACKLIGHT_LIST[_settings.
                                                               backlight]))
        cfg_grp.append(rs)
        rs = RadioSetting("dtmf_st", "DTMF Sidetone",
                          RadioSettingValueList(DTMFST_LIST,
                                                DTMFST_LIST[_settings.
                                                            dtmf_st]))
        cfg_grp.append(rs)
        rs = RadioSetting("ani_sw", "ANI-ID Switch",
                          RadioSettingValueBoolean(_settings.ani_sw))
        cfg_grp.append(rs)
        rs = RadioSetting("ptt_id", "PTT-ID Delay",
                          RadioSettingValueList(PTTID_LIST,
                                                PTTID_LIST[_settings.ptt_id]))
        cfg_grp.append(rs)
        rs = RadioSetting("ring_time", "Ring Time",
                          RadioSettingValueList(LIST_10,
                                                LIST_10[_settings.ring_time]))
        cfg_grp.append(rs)
        rs = RadioSetting("scan_rev", "Scan Mode",
                          RadioSettingValueList(SCANMODE_LIST,
                                                SCANMODE_LIST[_settings.
                                                              scan_rev]))
        cfg_grp.append(rs)
        rs = RadioSetting("vox", "VOX",
                          RadioSettingValueList(LIST_10,
                                                LIST_10[_settings.vox]))
        cfg_grp.append(rs)
        rs = RadioSetting("prich_sw", "Priority Channel Switch",
                          RadioSettingValueBoolean(_settings.prich_sw))
        cfg_grp.append(rs)
        rs = RadioSetting("pri_ch", "Priority Channel",
                          RadioSettingValueInteger(1, 999, _settings.pri_ch))
        cfg_grp.append(rs)
        rs = RadioSetting("rpt_mode", "Radio Mode",
                          RadioSettingValueList(RPTMODE_LIST,
                                                RPTMODE_LIST[_settings.
                                                             rpt_mode]))
        cfg_grp.append(rs)
        rs = RadioSetting("rpt_set", "Repeater Setting",
                          RadioSettingValueList(RPTSET_LIST,
                                                RPTSET_LIST[_settings.
                                                            rpt_set]))
        cfg_grp.append(rs)
        rs = RadioSetting("rpt_spk", "Repeater Mode Speaker",
                          RadioSettingValueBoolean(_settings.rpt_spk))
        cfg_grp.append(rs)
        rs = RadioSetting("rpt_ptt", "Repeater PTT",
                          RadioSettingValueBoolean(_settings.rpt_ptt))
        cfg_grp.append(rs)
        rs = RadioSetting("dtmf_tx_time", "DTMF Tx Duration",
                          RadioSettingValueList(DTMF_TIMES,
                                                DTMF_TIMES[_settings.
                                                           dtmf_tx_time]))
        cfg_grp.append(rs)
        rs = RadioSetting("dtmf_interval", "DTMF Interval",
                          RadioSettingValueList(DTMF_TIMES,
                                                DTMF_TIMES[_settings.
                                                           dtmf_interval]))
        cfg_grp.append(rs)
        rs = RadioSetting("alert", "Alert Tone",
                          RadioSettingValueList(ALERTS_LIST,
                                                ALERTS_LIST[_settings.alert]))
        cfg_grp.append(rs)
        rs = RadioSetting("rpt_tone", "Repeater Tone",
                          RadioSettingValueBoolean(_settings.rpt_tone))
        cfg_grp.append(rs)
        rs = RadioSetting("rpt_hold", "Repeater Hold Time",
                          RadioSettingValueList(HOLD_TIMES,
                                                HOLD_TIMES[_settings.
                                                           rpt_hold]))
        cfg_grp.append(rs)
        rs = RadioSetting("scan_det", "Scan DET",
                          RadioSettingValueBoolean(_settings.scan_det))
        cfg_grp.append(rs)
        rs = RadioSetting("sc_qt", "SC-QT",
                          RadioSettingValueList(SCQT_LIST,
                                                SCQT_LIST[_settings.sc_qt]))
        cfg_grp.append(rs)
        rs = RadioSetting("smuteset", "SubFreq Mute",
                          RadioSettingValueList(SMUTESET_LIST,
                                                SMUTESET_LIST[_settings.
                                                              smuteset]))
        cfg_grp.append(rs)
        
		#
        # VFO A Settings
        #
        rs = RadioSetting("workmode_a", "VFO A Workmode",
                          RadioSettingValueList(WORKMODE_LIST, WORKMODE_LIST[_settings.workmode_a]))
        vfoa_grp.append(rs)
        rs = RadioSetting("work_cha", "VFO A Channel",
                          RadioSettingValueInteger(1, 999, _settings.work_cha))
        vfoa_grp.append(rs)
        rs = RadioSetting("vfoa.rxfreq", "VFO A Rx Frequency",
                          RadioSettingValueInteger(
                              134000000, 520000000, _vfoa.rxfreq * 10, 5000))
        vfoa_grp.append(rs)
        rs = RadioSetting("vfoa.txoffset", "VFO A Tx Offset",
                          RadioSettingValueInteger(
                              0, 520000000, _vfoa.txoffset * 10, 5000))
        vfoa_grp.append(rs)
        #   u16   rxtone;
        #   u16   txtone;
        rs = RadioSetting("vfoa.power", "VFO A Power",
                          RadioSettingValueList(
                              POWER_LIST, POWER_LIST[_vfoa.power]))
        vfoa_grp.append(rs)
        #         shift_dir:2
        rs = RadioSetting("vfoa.iswide", "VFO A NBFM",
                          RadioSettingValueList(
                              BANDWIDTH_LIST, BANDWIDTH_LIST[_vfoa.iswide]))
        vfoa_grp.append(rs)
        rs = RadioSetting("vfoa.mute_mode", "VFO A Mute",
                          RadioSettingValueList(
                              SPMUTE_LIST, SPMUTE_LIST[_vfoa.mute_mode]))
        vfoa_grp.append(rs)
        rs = RadioSetting("vfoa.step", "VFO A Step (kHz)",
                          RadioSettingValueList(
                              STEP_LIST, STEP_LIST[_vfoa.step]))
        vfoa_grp.append(rs)
        rs = RadioSetting("vfoa.squelch", "VFO A Squelch",
                          RadioSettingValueList(
                              LIST_10, LIST_10[_vfoa.squelch]))
        vfoa_grp.append(rs)
        rs = RadioSetting("bcl_a", "Busy Channel Lock-out A",
                          RadioSettingValueBoolean(_settings.bcl_a))
        vfoa_grp.append(rs)
        
		#
        # VFO B Settings
        #
        rs = RadioSetting("workmode_b", "VFO B Workmode",
                          RadioSettingValueList(WORKMODE_LIST, WORKMODE_LIST[_settings.workmode_b]))
        vfob_grp.append(rs)
        rs = RadioSetting("work_chb", "VFO B Channel",
                          RadioSettingValueInteger(1, 999, _settings.work_chb))
        vfob_grp.append(rs)
        rs = RadioSetting("vfob.rxfreq", "VFO B Rx Frequency",
                          RadioSettingValueInteger(
                              134000000, 520000000, _vfob.rxfreq * 10, 5000))
        vfob_grp.append(rs)
        rs = RadioSetting("vfob.txoffset", "VFO B Tx Offset",
                          RadioSettingValueInteger(
                              0, 520000000, _vfob.txoffset * 10, 5000))
        vfob_grp.append(rs)
        #   u16   rxtone;
        #   u16   txtone;
        rs = RadioSetting("vfob.power", "VFO B Power",
                          RadioSettingValueList(
                              POWER_LIST, POWER_LIST[_vfob.power]))
        vfob_grp.append(rs)
        #         shift_dir:2
        rs = RadioSetting("vfob.iswide", "VFO B NBFM",
                          RadioSettingValueList(
                              BANDWIDTH_LIST, BANDWIDTH_LIST[_vfob.iswide]))
        vfob_grp.append(rs)
        rs = RadioSetting("vfob.mute_mode", "VFO B Mute",
                          RadioSettingValueList(
                              SPMUTE_LIST, SPMUTE_LIST[_vfob.mute_mode]))
        vfob_grp.append(rs)
        rs = RadioSetting("vfob.step", "VFO B Step (kHz)",
                          RadioSettingValueList(
                              STEP_LIST, STEP_LIST[_vfob.step]))
        vfob_grp.append(rs)
        rs = RadioSetting("vfob.squelch", "VFO B Squelch",
                          RadioSettingValueList(
                              LIST_10, LIST_10[_vfob.squelch]))
        vfob_grp.append(rs)
        rs = RadioSetting("bcl_b", "Busy Channel Lock-out B",
                          RadioSettingValueBoolean(_settings.bcl_b))
        vfob_grp.append(rs)
        
		#
        # Key Settings
        #
        _msg = str(_settings.dispstr).split("\0")[0]
        val = RadioSettingValueString(0, 15, _msg)
        val.set_mutable(True)
        rs = RadioSetting("dispstr", "Display Message", val)
        key_grp.append(rs)

        dtmfchars = "0123456789"
        _codeobj = _settings.ani_code
        _code = "".join([dtmfchars[x] for x in _codeobj if int(x) < 0x0A])
        val = RadioSettingValueString(3, 6, _code, False)
        val.set_charset(dtmfchars)
        rs = RadioSetting("ani_code", "ANI Code", val)
        def apply_ani_id(setting, obj):
            value = []
            for j in range(0, 6):
                try:
                    value.append(dtmfchars.index(str(setting.value)[j]))
                except IndexError:
                    value.append(0xFF)
            obj.ani_code = value
        rs.set_apply_callback(apply_ani_id, _settings)
        key_grp.append(rs)

        rs = RadioSetting("pf1_func", "PF1 Key function",
                          RadioSettingValueList(
                              PF1KEY_LIST,
                              PF1KEY_LIST[_settings.pf1_func]))
        key_grp.append(rs)
        rs = RadioSetting("pf3_func", "PF3 Key function",
                          RadioSettingValueList(
                              PF3KEY_LIST,
                              PF3KEY_LIST[_settings.pf3_func]))
        key_grp.append(rs)

        #
        # Limits settings
        #
        rs = RadioSetting("uhf_limits.rx_start", "UHF RX Lower Limit",
                          RadioSettingValueInteger(
                              400000000, 520000000,
                              self._memobj.uhf_limits.rx_start * 10, 5000))
        uhf_lmt_grp.append(rs)
        rs = RadioSetting("uhf_limits.rx_stop", "UHF RX Upper Limit",
                          RadioSettingValueInteger(
                              400000000, 520000000,
                              self._memobj.uhf_limits.rx_stop * 10, 5000))
        uhf_lmt_grp.append(rs)
        rs = RadioSetting("uhf_limits.tx_start", "UHF TX Lower Limit",
                          RadioSettingValueInteger(
                              400000000, 520000000,
                              self._memobj.uhf_limits.tx_start * 10, 5000))
        uhf_lmt_grp.append(rs)
        rs = RadioSetting("uhf_limits.tx_stop", "UHF TX Upper Limit",
                          RadioSettingValueInteger(
                              400000000, 520000000,
                              self._memobj.uhf_limits.tx_stop * 10, 5000))
        uhf_lmt_grp.append(rs)
        rs = RadioSetting("vhf_limits.rx_start", "VHF RX Lower Limit",
                          RadioSettingValueInteger(
                              134000000, 174997500,
                              self._memobj.vhf_limits.rx_start * 10, 5000))
        vhf_lmt_grp.append(rs)
        rs = RadioSetting("vhf_limits.rx_stop", "VHF RX Upper Limit",
                          RadioSettingValueInteger(
                              134000000, 174997500,
                              self._memobj.vhf_limits.rx_stop * 10, 5000))
        vhf_lmt_grp.append(rs)
        rs = RadioSetting("vhf_limits.tx_start", "VHF TX Lower Limit",
                          RadioSettingValueInteger(
                              134000000, 174997500,
                              self._memobj.vhf_limits.tx_start * 10, 5000))
        vhf_lmt_grp.append(rs)
        rs = RadioSetting("vhf_limits.tx_stop", "VHF TX Upper Limit",
                          RadioSettingValueInteger(
                              134000000, 174997500,
                              self._memobj.vhf_limits.tx_stop * 10, 5000))
        vhf_lmt_grp.append(rs)

        #
        # OEM info
        #
        def _decode(lst):
            _str = ''.join([chr(c) for c in lst
                            if chr(c) in chirp_common.CHARSET_ASCII])
            return _str

        def do_nothing(setting, obj):
            return

        _str = _decode(self._memobj.oem_info.model)
        val = RadioSettingValueString(0, 15, _str)
        val.set_mutable(False)
        rs = RadioSetting("oem_info.model", "Model", val)
        rs.set_apply_callback(do_nothing, _settings)
        oem_grp.append(rs)
        _str = _decode(self._memobj.oem_info.oem1)
        val = RadioSettingValueString(0, 15, _str)
        val.set_mutable(False)
        rs = RadioSetting("oem_info.oem1", "OEM String 1", val)
        rs.set_apply_callback(do_nothing, _settings)
        oem_grp.append(rs)
        _str = _decode(self._memobj.oem_info.oem2)
        val = RadioSettingValueString(0, 15, _str)
        val.set_mutable(False)
        rs = RadioSetting("oem_info.oem2", "OEM String 2", val)
        rs.set_apply_callback(do_nothing, _settings)
        oem_grp.append(rs)
        _str = _decode(self._memobj.oem_info.version)
        val = RadioSettingValueString(0, 15, _str)
        val.set_mutable(False)
        rs = RadioSetting("oem_info.version", "Software Version", val)
        rs.set_apply_callback(do_nothing, _settings)
        oem_grp.append(rs)
        _str = _decode(self._memobj.oem_info.date)
        val = RadioSettingValueString(0, 15, _str)
        val.set_mutable(False)
        rs = RadioSetting("oem_info.date", "OEM Date", val)
        rs.set_apply_callback(do_nothing, _settings)
        oem_grp.append(rs)

        return group
Exemplo n.º 19
0
    def get_settings(self):
        _settings = self._memobj.settings
        basic = RadioSettingGroup("basic", "Basic")
        sound = RadioSettingGroup("sound", "Sound")
        dtmf = RadioSettingGroup("dtmf", "DTMF")
        arts = RadioSettingGroup("arts", "ARTS")
        eai = RadioSettingGroup("eai", "Emergency")
        msg = RadioSettingGroup("msg", "Messages")

        top = RadioSettings(basic, sound, arts, dtmf, eai, msg)

        basic.append(RadioSetting(
                "att_wx", "Attenuation WX",
                RadioSettingValueBoolean(_settings.att_wx)))

        basic.append(RadioSetting(
                "att_marine", "Attenuation Marine",
                RadioSettingValueBoolean(_settings.att_marine)))

        basic.append(RadioSetting(
                "att_broadcast", "Attenuation Broadcast",
                RadioSettingValueBoolean(_settings.att_broadcast)))

        basic.append(RadioSetting(
                "ars", "Auto Repeater Shift",
                RadioSettingValueBoolean(_settings.ars)))

        basic.append(RadioSetting(
                "home_vfo", "Home->VFO",
                RadioSettingValueBoolean(_settings.home_vfo)))

        basic.append(RadioSetting(
                "bclo", "Busy Channel Lockout",
                RadioSettingValueBoolean(_settings.bclo)))

        basic.append(RadioSetting(
                "busyled", "Busy LED",
                RadioSettingValueBoolean(_settings.busy_led)))

        basic.append(RadioSetting(
                "fast_tone_search", "Fast Tone search",
                RadioSettingValueBoolean(_settings.fast_tone_search)))

        basic.append(RadioSetting(
                "priority_revert", "Priority Revert",
                RadioSettingValueBoolean(_settings.priority_revert)))

        basic.append(RadioSetting(
                "protect_memory", "Protect memory",
                RadioSettingValueBoolean(_settings.protect_memory)))

        basic.append(RadioSetting(
                "scan_lamp", "Scan Lamp",
                RadioSettingValueBoolean(_settings.scan_lamp)))

        basic.append(RadioSetting(
                "split_tone", "Split tone",
                RadioSettingValueBoolean(_settings.split_tone)))

        basic.append(RadioSetting(
                "tone_search_mute", "Tone search mute",
                RadioSettingValueBoolean(_settings.tone_search_mute)))

        basic.append(RadioSetting(
                "txsave", "TX save",
                RadioSettingValueBoolean(_settings.txsave)))

        basic.append(RadioSetting(
                "wx_alert", "WX Alert",
                RadioSettingValueBoolean(_settings.wx_alert)))

        opts = ["Bar Int", "Bar Ext"]
        basic.append(RadioSetting(
                "am_antenna", "AM antenna",
                RadioSettingValueList(opts, opts[_settings.am_antenna])))

        opts = ["Ext Ant", "Earphone"]
        basic.append(RadioSetting(
                "fm_antenna", "FM antenna",
                RadioSettingValueList(opts, opts[_settings.fm_antenna])))

        opts = ["off"] + ["%0.1f" % (t / 60.0) for t in range(30, 750, 30)]
        basic.append(RadioSetting(
                "apo", "APO time (hrs)",
                RadioSettingValueList(opts, opts[_settings.apo])))

        opts = ["+/- 5 MHZ", "+/- 10 MHZ", "+/- 50 MHZ", "+/- 100 MHZ"]
        basic.append(RadioSetting(
                "channel_counter", "Channel counter",
                RadioSettingValueList(opts, opts[_settings.channel_counter])))

        opts = ["0.3", "0.5", "0.7", "1.0", "1.5"]
        basic.append(RadioSetting(
                "fw_key_timer", "FW key timer (s)",
                RadioSettingValueList(opts, opts[_settings.fw_key_timer])))

        opts = ["Home", "Reverse"]
        basic.append(RadioSetting(
                "hm_rv", "HM/RV key",
                RadioSettingValueList(opts, opts[_settings.hm_rv])))

        opts = ["%d" % t for t in range(2, 11)] + ["continuous", "off"]
        basic.append(RadioSetting(
                "lamp", "Lamp Timer (s)",
                RadioSettingValueList(opts, opts[_settings.lamp])))

        basic.append(RadioSetting(
                "lock", "Lock",
                RadioSettingValueBoolean(_settings.lock)))

        opts = ["key", "ptt", "key+ptt"]
        basic.append(RadioSetting(
                "lock_mode", "Lock mode",
                RadioSettingValueList(opts, opts[_settings.lock_mode])))

        opts = ["10", "20", "50", "100"]
        basic.append(RadioSetting(
                "mem_ch_step", "Memory Chan step",
                RadioSettingValueList(opts, opts[_settings.mem_ch_step])))

        opts = ["lower", "next"]
        basic.append(RadioSetting(
                "mem_storage", "Memory storage mode",
                RadioSettingValueList(opts, opts[_settings.mem_storage])))

        opts = ["%d" % t for t in range(1, 10)]
        basic.append(RadioSetting(
                "mic_gain", "Mic gain",
                RadioSettingValueList(opts, opts[_settings.mic_gain])))

        opts = ["monitor", "tone call"]
        basic.append(RadioSetting(
                "moni_tcall", "Moni/TCall button",
                RadioSettingValueList(opts, opts[_settings.moni_tcall])))

        opts = ["off"] + \
               ["%02d:%02d" % (t / 60, t % 60) for t in range(10, 1450, 10)]
        basic.append(RadioSetting(
                "on_timer", "On Timer (hrs)",
                RadioSettingValueList(opts, opts[_settings.on_timer])))

        opts2 = ["off"] + \
                ["0.%d" % t for t in range(1, 10)] + \
                ["%1.1f" % (t / 10.0) for t in range(10, 105, 5)]
        basic.append(RadioSetting(
                "priority_time", "Priority time",
                RadioSettingValueList(opts2, opts2[_settings.priority_time])))

        opts = ["off", "20", "50", "100", "200"]
        basic.append(RadioSetting(
                "ptt_delay", "PTT delay (ms)",
                RadioSettingValueList(opts, opts[_settings.ptt_delay])))

        basic.append(RadioSetting(
                "rx_save", "RX save (s)",
                RadioSettingValueList(opts2, opts2[_settings.rx_save])))

        basic.append(RadioSetting(
                "scan_restart", "Scan restart (s)",
                RadioSettingValueList(opts2, opts2[_settings.scan_restart])))

        opts = ["%1.1f" % (t / 10.0) for t in range(20, 105, 5)] + \
               ["busy", "hold"]
        basic.append(RadioSetting(
                "scan_resume", "Scan resume (s)",
                RadioSettingValueList(opts, opts[_settings.scan_resume])))

        opts = ["single", "continuous"]
        basic.append(RadioSetting(
                "smart_search", "Smart search",
                RadioSettingValueList(opts, opts[_settings.smart_search])))

        opts = ["off"] + ["TRX %d" % t for t in range(1, 11)] + ["hold"] + \
               ["TX %d" % t for t in range(1, 11)]
        basic.append(RadioSetting(
                "sub_rx_timer", "Sub RX timer",
                RadioSettingValueList(opts, opts[_settings.sub_rx_timer])))

        opts = ["C", "F"]
        basic.append(RadioSetting(
                "temp_unit", "Temperature unit",
                RadioSettingValueList(opts, opts[_settings.temp_unit])))

        opts = ["off"] + ["%1.1f" % (t / 10.0) for t in range(5, 105, 5)]
        basic.append(RadioSetting(
                "tot", "Time-out timer (mins)",
                RadioSettingValueList(opts, opts[_settings.tot])))

        opts = ["all", "band"]
        basic.append(RadioSetting(
                "vfo_mode", "VFO mode",
                RadioSettingValueList(opts, opts[_settings.vfo_mode])))

        opts = ["off"] + ["%d" % t for t in range(5, 65, 5)] + ["EAI"]
        basic.append(RadioSetting(
                "wake_up", "Wake up (s)",
                RadioSettingValueList(opts, opts[_settings.wake_up])))

        opts = ["hold", "3 secs"]
        basic.append(RadioSetting(
                "vol_key_mode", "Volume key mode",
                RadioSettingValueList(opts, opts[_settings.vol_key_mode])))

        # subgroup programmable keys

        opts = ["INTNET", "INT MR", "Set Mode (my key)"]
        basic.append(RadioSetting(
                "internet_key", "Internet key",
                RadioSettingValueList(opts, opts[_settings.internet_key])))

        keys = ["Antenna AM", "Antenna FM", "Antenna Attenuator",
                "Auto Power Off", "Auto Repeater Shift", "ARTS Beep",
                "ARTS Interval", "Busy Channel Lockout", "Bell Ringer",
                "Bell Select", "Bank Name", "Band Edge Beep", "Beep Level",
                "Beep Select", "Beep User", "Busy LED", "Channel Counter",
                "Clock Shift", "CW ID", "CW Learning", "CW Pitch",
                "CW Training", "DC Voltage", "DCS Code", "DCS Reverse",
                "DTMF A/M", "DTMF Delay", "DTMF Set", "DTMF Speed",
                "EAI Timer", "Emergency Alarm", "Ext Menu", "FW Key",
                "Half Deviation", "Home/Reverse", "Home > VFO", "INT Code",
                "INT Conn Mode", "INT A/M", "INT Set", "INT Key", "INTNET",
                "Lamp", "LED Light", "Lock", "Moni/T-Call", "Mic Gain",
                "Memory Display", "Memory Write Mode", "Memory Channel Step",
                "Memory Name Write", "Memory Protect", "Memory Skip",
                "Message List", "Message Reg", "Message Set", "On Timer",
                "Open Message", "Pager Answer Back", "Pager Receive Code",
                "Pager Transmit Code", "Pager Frequency", "Priority Revert",
                "Priority Timer", "Password", "PTT Delay",
                "Repeater Shift Direction", "Repeater Shift", "Receive Mode",
                "Smart Search", "Save Rx", "Save Tx", "Scan Lamp",
                "Scan Resume", "Scan Restart", "Speaker Out",
                "Squelch Level", "Squelch Type", "Squelch S Meter",
                "Squelch Split Tone", "Step", "Stereo", "Sub Rx", "Temp",
                "Tone Frequency", "Time Out Timer", "Tone Search Mute",
                "Tone Search Speed", "VFO Band", "VFO Skip", "Volume Mode",
                "Wake Up", "Weather Alert"]
        rs = RadioSetting(
                "my_key", "My key",
                RadioSettingValueList(keys, keys[_settings.my_key - 16]))
        # TODO: fix keys list isnt exactly right order
        # leave disabled in settings for now
        # basic.append(rs)

        # sound tab

        sound.append(RadioSetting(
                "band_edge_beep", "Band edge beep",
                RadioSettingValueBoolean(_settings.band_edge_beep)))

        opts = ["off", "key+scan", "key"]
        sound.append(RadioSetting(
                "beep_mode", "Beep mode",
                RadioSettingValueList(opts, opts[_settings.beep_mode])))

        _volumes = self._memobj.volumes

        opts = map(str, range(0, 33))
        sound.append(RadioSetting(
                "speaker_vol", "Speaker volume",
                RadioSettingValueList(opts, opts[_volumes.speaker])))

        sound.append(RadioSetting(
                "earphone_vol", "Earphone volume",
                RadioSettingValueList(opts, opts[_volumes.earphone])))

        opts = ["auto", "speaker"]
        sound.append(RadioSetting(
                "fm_speaker_out", "FM Speaker out",
                RadioSettingValueList(opts, opts[_settings.fm_speaker_out])))

        opts = ["mono", "stereo"]
        sound.append(RadioSetting(
                "fm_broadcast_mode", "FM broadcast mode",
                RadioSettingValueList(
                    opts, opts[_settings.fm_broadcast_mode])))

        opts = map(str, range(16))
        sound.append(RadioSetting(
                "sql_fm", "Squelch level (FM)",
                RadioSettingValueList(opts, opts[_settings.sql_fm])))

        opts = map(str, range(9))
        sound.append(RadioSetting(
                "sql_wfm", "Squelch level (WFM)",
                RadioSettingValueList(opts, opts[_settings.sql_wfm])))

        opts = map(str, range(16))
        sound.append(RadioSetting(
                "radio_am_sql", "Squelch level (Broadcast Radio AM)",
                RadioSettingValueList(opts, opts[_settings.radio_am_sql])))

        opts = map(str, range(9))
        sound.append(RadioSetting(
                "radio_fm_sql", "Squelch level (Broadcast Radio FM)",
                RadioSettingValueList(opts, opts[_settings.radio_fm_sql])))

        # dtmf tab

        opts = ["manual", "auto"]
        dtmf.append(RadioSetting(
                "dtmf_autodialer", "DTMF autodialer mode",
                RadioSettingValueList(opts, opts[_settings.dtmf_autodialer])))

        opts = ["50", "250", "450", "750", "1000"]
        dtmf.append(RadioSetting(
                "dtmf_delay", "DTMF delay (ms)",
                RadioSettingValueList(opts, opts[_settings.dtmf_delay])))

        opts = ["50", "100"]
        dtmf.append(RadioSetting(
                "dtmf_speed", "DTMF speed (ms)",
                RadioSettingValueList(opts, opts[_settings.dtmf_speed])))

        opts = map(str, range(10))
        dtmf.append(RadioSetting(
                "dtmf_chan_active", "DTMF active",
                RadioSettingValueList(
                    opts, opts[_settings.dtmf_chan_active])))

        for i in range(10):
            name = "dtmf" + str(i)
            dtmfsetting = self._memobj.dtmf[i]
            dtmfstr = ""
            for c in dtmfsetting.memory:
                if c < len(DTMFCHARSET):
                    dtmfstr += DTMFCHARSET[c]
            LOG.debug(dtmfstr)
            dtmfentry = RadioSettingValueString(0, 16, dtmfstr)
            dtmfentry.set_charset(DTMFCHARSET + list(" "))
            rs = RadioSetting(name, name.upper(), dtmfentry)
            dtmf.append(rs)

        # arts tab
        arts.append(RadioSetting(
                "arts", "ARTS",
                RadioSettingValueBoolean(_settings.arts)))

        opts = ["off", "in range", "always"]
        arts.append(RadioSetting(
                "arts_beep", "ARTS beep",
                RadioSettingValueList(opts, opts[_settings.arts_beep])))

        opts = ["15", "25"]
        arts.append(RadioSetting(
                "arts_interval", "ARTS interval",
                RadioSettingValueList(opts, opts[_settings.arts_interval])))

        arts.append(RadioSetting(
                "arts_cwid_enable", "CW ID",
                RadioSettingValueBoolean(_settings.arts_cwid_enable)))

        cwid = RadioSettingValueString(
                0, 16, self._decode_chars(_settings.arts_cwid.get_value()))
        cwid.set_charset(CHARSET)
        arts.append(RadioSetting("arts_cwid", "CW ID", cwid))

        # EAI tab

        eai.append(RadioSetting(
                "emergency_eai", "EAI",
                RadioSettingValueBoolean(_settings.emergency_eai)))

        opts = ["interval %dm" % t for t in range(1, 10)] + \
               ["interval %dm" % t for t in range(10, 55, 5)] + \
               ["continuous %dm" % t for t in range(1, 10)] + \
               ["continuous %dm" % t for t in range(10, 55, 5)]

        eai.append(RadioSetting(
                "emergency_eai_time", "EAI time",
                RadioSettingValueList(
                    opts, opts[_settings.emergency_eai_time])))

        opts = ["beep", "strobe", "beep+strobe", "beam",
                "beep+beam", "cw", "beep+cw", "cwt"]
        eai.append(RadioSetting(
                "emergency_signal", "emergency signal",
                RadioSettingValueList(
                    opts, opts[_settings.emergency_signal])))

        # msg tab

        opts = ["off", "dc voltage", "message"]
        msg.append(RadioSetting(
                "openmsg_mode", "Opening message mode",
                RadioSettingValueList(opts, opts[_settings.openmsg_mode])))

        openmsg = RadioSettingValueString(
                0, 6, self._decode_chars(_settings.openmsg.get_value()))
        openmsg.set_charset(CHARSET)
        msg.append(RadioSetting("openmsg", "Opening Message", openmsg))

        return top
Exemplo n.º 20
0
    def get_settings(self):
        _settings = self._memobj.settings
        basic = RadioSettingGroup("basic", "Basic")
        autodial = RadioSettingGroup("autodial", "AutoDial")
        keymaps = RadioSettingGroup("keymaps", "KeyMaps")

        top = RadioSettings(basic, keymaps, autodial)

        rs = RadioSetting(
                "beep", "Beep",
                RadioSettingValueBoolean(_settings.beep))
        basic.append(rs)
        rs = RadioSetting(
                "lock", "Lock",
                RadioSettingValueBoolean(_settings.lock))
        basic.append(rs)
        rs = RadioSetting(
                "ars", "Auto Repeater Shift",
                RadioSettingValueBoolean(_settings.ars))
        basic.append(rs)
        rs = RadioSetting(
                "txpwrsave", "TX Power Save",
                RadioSettingValueBoolean(_settings.txpwrsave))
        basic.append(rs)
        rs = RadioSetting(
                "txnarrow", "TX Narrow",
                RadioSettingValueBoolean(_settings.txnarrow))
        basic.append(rs)
        options = ["Off", "S-3", "S-5", "S-Full"]
        rs = RadioSetting(
                "rfsqlvl", "RF Squelch Level",
                RadioSettingValueList(options, options[_settings.rfsqlvl]))
        basic.append(rs)
        options = ["Off", "Band A", "Band B", "Both"]
        rs = RadioSetting(
                "pttlock", "PTT Lock",
                RadioSettingValueList(options, options[_settings.pttlock]))
        basic.append(rs)

        rs = RadioSetting(
                "cwid_en", "CWID Enable",
                RadioSettingValueBoolean(_settings.cwid_en))
        basic.append(rs)

        cwid = RadioSettingValueString(0, 7, self._decode_cwid(_settings.cwid))
        cwid.set_charset(FT90_CWID_CHARS)
        rs = RadioSetting("cwid", "CWID", cwid)
        basic.append(rs)

        options = ["OFF"] + map(str, range(1, 12+1))
        rs = RadioSetting(
                "apo", "APO time (hrs)",
                RadioSettingValueList(options, options[_settings.apo]))
        basic.append(rs)

        options = ["Off"] + map(str, range(1, 60+1))
        rs = RadioSetting(
                "tot", "Time Out Timer (mins)",
                RadioSettingValueList(options, options[_settings.tot]))
        basic.append(rs)

        options = ["off", "Auto/TX", "Auto", "TX"]
        rs = RadioSetting(
                "fancontrol", "Fan Control",
                RadioSettingValueList(options, options[_settings.fancontrol]))
        basic.append(rs)

        keyopts = ["Scan Up", "Scan Down", "Repeater", "Reverse", "Tone Burst",
                   "Tx Power", "Home Ch", "VFO/MR", "Tone", "Priority"]
        rs = RadioSetting(
                "key_lt", "Left Key",
                RadioSettingValueList(keyopts, keyopts[_settings.key_lt]))
        keymaps.append(rs)
        rs = RadioSetting(
                "key_rt", "Right Key",
                RadioSettingValueList(keyopts, keyopts[_settings.key_rt]))
        keymaps.append(rs)
        rs = RadioSetting(
                "key_p1", "P1 Key",
                RadioSettingValueList(keyopts, keyopts[_settings.key_p1]))
        keymaps.append(rs)
        rs = RadioSetting(
                "key_p2", "P2 Key",
                RadioSettingValueList(keyopts, keyopts[_settings.key_p2]))
        keymaps.append(rs)
        rs = RadioSetting(
                "key_acc", "ACC Key",
                RadioSettingValueList(keyopts, keyopts[_settings.key_acc]))
        keymaps.append(rs)

        options = map(str, range(0, 12+1))
        rs = RadioSetting(
                "lcdcontrast", "LCD Contrast",
                RadioSettingValueList(options, options[_settings.lcdcontrast]))
        basic.append(rs)

        options = ["off", "d4", "d3", "d2", "d1"]
        rs = RadioSetting(
                "dimmer", "Dimmer",
                RadioSettingValueList(options, options[_settings.dimmer]))
        basic.append(rs)

        options = ["TRX Normal", "RX Reverse", "TX Reverse", "TRX Reverse"]
        rs = RadioSetting(
                "dcsmode", "DCS Mode",
                RadioSettingValueList(options, options[_settings.dcsmode]))
        basic.append(rs)

        options = ["50 ms", "100 ms"]
        rs = RadioSetting(
                "dtmfspeed", "DTMF Speed",
                RadioSettingValueList(options, options[_settings.dtmfspeed]))
        autodial.append(rs)

        options = ["50 ms", "250 ms", "450 ms", "750 ms", "1 sec"]
        rs = RadioSetting(
                "dtmftxdelay", "DTMF TX Delay",
                RadioSettingValueList(options, options[_settings.dtmftxdelay]))
        autodial.append(rs)

        options = map(str, range(1, 8 + 1))
        rs = RadioSetting(
                "dtmf_active", "DTMF Active",
                RadioSettingValueList(options, options[_settings.dtmf_active]))
        autodial.append(rs)

        # setup 8 dtmf autodial entries
        for i in map(str, range(1, 9)):
            objname = "dtmf" + i
            dtmfsetting = getattr(_settings, objname)
            dtmflen = getattr(_settings, objname + "_len")
            dtmfstr = self._bbcd2dtmf(dtmfsetting, dtmflen)
            dtmf = RadioSettingValueString(0, 16, dtmfstr)
            dtmf.set_charset(FT90_DTMF_CHARS + list(" "))
            rs = RadioSetting(objname, objname.upper(), dtmf)
            autodial.append(rs)

        return top
Exemplo n.º 21
0
    def get_settings(self):
        """Translate the bit in the mem_struct into settings in the UI"""
        _mem = self._memobj
        basic = RadioSettingGroup("basic", "Basic Settings")
        other = RadioSettingGroup("other", "Other Settings")
        work = RadioSettingGroup("work", "Work Mode Settings")
        dtmf = RadioSettingGroup("dtmf", "DTMF Settings")
        top = RadioSettings(basic, other, work, dtmf)

        # Basic

        # Audio: A01-A04

        aftone = RadioSetting("settings.aftone", "AF tone control",
                              RadioSettingValueList(LIST_AFTONE, LIST_AFTONE[
                                  _mem.settings.aftone]))
        basic.append(aftone)

        spkr = RadioSetting("settings.spkr", "Speaker",
                            RadioSettingValueList(LIST_SPKR,LIST_SPKR[
                                _mem.settings.spkr]))
        basic.append(spkr)

        audio = RadioSetting("settings.audio", "Stereo/Mono",
                             RadioSettingValueList(LIST_AUDIO, LIST_AUDIO[
                                 _mem.settings.audio]))
        basic.append(audio)

        sbmute = RadioSetting("settings.sbmute", "Sub band mute",
                              RadioSettingValueList(LIST_SBMUTE, LIST_SBMUTE[
                                  _mem.settings.sbmute]))
        basic.append(sbmute)

        # TX/RX: B01-B08

        mgain = RadioSetting("settings.mgain", "Mic gain",
                             RadioSettingValueList(LIST_MLNHM, LIST_MLNHM[
                                 _mem.settings.mgain]))
        basic.append(mgain)

        ptt = RadioSetting("settings.ptt", "PTT mode",
                           RadioSettingValueList(LIST_PTT,LIST_PTT[
                               _mem.settings.ptt]))
        basic.append(ptt)

        # B03 (per channel)
        # B04 (per channel)

        rxexp = RadioSetting("settings.rxexp", "RX expansion",
                             RadioSettingValueList(LIST_RXEXP,LIST_RXEXP[
                                 _mem.settings.rxexp]))
        basic.append(rxexp)

        vox = RadioSetting("settings.vox", "Vox",
                           RadioSettingValueList(LIST_VOX, LIST_VOX[
                               _mem.settings.vox]))
        basic.append(vox)

        voxs = RadioSetting("settings.voxs", "Vox sensitivity",
                            RadioSettingValueList(LIST_MLNHM, LIST_MLNHM[
                                _mem.settings.voxs]))
        basic.append(voxs)

        # B08 (per channel)

        # Display: C01-C06

        display = RadioSetting("settings.display", "Display select",
                               RadioSettingValueList(LIST_DISPLAY,
                                   LIST_DISPLAY[_mem.settings.display]))
        basic.append(display)

        lcdb = RadioSetting("settings.lcdb", "LCD brightness",
                            RadioSettingValueList(LIST_MINMAX, LIST_MINMAX[
                                _mem.settings.lcdb]))
        basic.append(lcdb)

        color = RadioSetting("settings.color", "LCD color",
                             RadioSettingValueList(LIST_COLOR, LIST_COLOR[
                                 _mem.settings.color]))
        basic.append(color)

        lcdc = RadioSetting("settings.lcdc", "LCD contrast",
                            RadioSettingValueList(LIST_MINMAX, LIST_MINMAX[
                                _mem.settings.lcdc]))
        basic.append(lcdc)

        btime = RadioSetting("settings.btime", "LCD backlight time",
                             RadioSettingValueList(LIST_BTIME, LIST_BTIME[
                                 _mem.settings.btime]))
        basic.append(btime)

        keyb = RadioSetting("settings.keyb", "Key brightness",
                            RadioSettingValueList(LIST_MINMAX, LIST_MINMAX[
                                _mem.settings.keyb]))
        basic.append(keyb)

        # Memory: D01-D04

        # D01 (per channel)
        # D02 (per channel)

        mrscan = RadioSetting("settings.mrscan", "Memory scan type",
                              RadioSettingValueList(LIST_MRSCAN, LIST_MRSCAN[
                                  _mem.settings.mrscan]))
        basic.append(mrscan)

        # D04 (per channel)

        # Scan: E01-E04

        dwstop = RadioSetting("settings.dwstop", "Dual watch stop",
                              RadioSettingValueList(LIST_DWSTOP, LIST_DWSTOP[
                                  _mem.settings.dwstop]))
        basic.append(dwstop)

        scand = RadioSetting("settings.scand", "Scan direction",
                             RadioSettingValueList(LIST_SCAND,LIST_SCAND[
                                 _mem.settings.scand]))
        basic.append(scand)

        scanr = RadioSetting("settings.scanr", "Scan resume",
                             RadioSettingValueList(LIST_SCANR,LIST_SCANR[
                                 _mem.settings.scanr]))
        basic.append(scanr)

        scansb = RadioSetting("settings.scansb", "Scan stop beep",
                              RadioSettingValueBoolean(_mem.settings.scansb))
        basic.append(scansb)

        # System: F01-F09

        apo = RadioSetting("settings.apo", "Automatic power off [hours]",
                           RadioSettingValueList(LIST_APO, LIST_APO[
                               _mem.settings.apo]))
        basic.append(apo)

        ars = RadioSetting("settings.ars", "Automatic repeater shift",
                           RadioSettingValueBoolean(_mem.settings.ars))
        basic.append(ars)

        beep = RadioSetting("settings.beep", "Beep volume",
                            RadioSettingValueList(LIST_BEEP,LIST_BEEP[
                                _mem.settings.beep]))
        basic.append(beep)

        fkey = RadioSetting("settings.fkey", "F key",
                            RadioSettingValueList(LIST_FKEY,LIST_FKEY[
                                _mem.settings.fkey]))
        basic.append(fkey)

        pfkey1 = RadioSetting("settings.pfkey1", "Mic P1 key",
                              RadioSettingValueList(LIST_PFKEY, LIST_PFKEY[
                                  _mem.settings.pfkey1]))
        basic.append(pfkey1)

        pfkey2 = RadioSetting("settings.pfkey2", "Mic P2 key",
                              RadioSettingValueList(LIST_PFKEY, LIST_PFKEY[
                                  _mem.settings.pfkey2]))
        basic.append(pfkey2)

        pfkey3 = RadioSetting("settings.pfkey3", "Mic P3 key",
                              RadioSettingValueList(LIST_PFKEY, LIST_PFKEY[
                                  _mem.settings.pfkey3]))
        basic.append(pfkey3)

        pfkey4 = RadioSetting("settings.pfkey4", "Mic P4 key",
                              RadioSettingValueList(LIST_PFKEY, LIST_PFKEY[
                                  _mem.settings.pfkey4]))
        basic.append(pfkey4)

        omode = RadioSetting("settings.omode", "Operation mode",
                             RadioSettingValueList(LIST_AB,LIST_AB[
                                 _mem.settings.omode]))
        basic.append(omode)

        rxcoverm = RadioSetting("settings.rxcoverm", "RX coverage - memory",
                                RadioSettingValueList(LIST_COVERAGE, 
                                    LIST_COVERAGE[_mem.settings.rxcoverm]))
        basic.append(rxcoverm)

        rxcoverv = RadioSetting("settings.rxcoverv", "RX coverage - VFO",
                                RadioSettingValueList(LIST_COVERAGE, 
                                    LIST_COVERAGE[_mem.settings.rxcoverv]))
        basic.append(rxcoverv)

        tot = RadioSetting("settings.tot", "Time out timer [min]",
                           RadioSettingValueList(LIST_TOT, LIST_TOT[
                               _mem.settings.tot]))
        basic.append(tot)

        # Timer/Clock: G01-G04

        # G01
        datefmt = RadioSetting("settings.datefmt", "Date format",
                               RadioSettingValueList(LIST_DATEFMT,
                                   LIST_DATEFMT[_mem.settings.datefmt]))
        basic.append(datefmt)

        timefmt = RadioSetting("settings.timefmt", "Time format",
                               RadioSettingValueList(LIST_TIMEFMT,
                                   LIST_TIMEFMT[_mem.settings.timefmt]))
        basic.append(timefmt)

        timesig = RadioSetting("settings.timesig", "Time signal",
                               RadioSettingValueBoolean(_mem.settings.timesig))
        basic.append(timesig)

        tz = RadioSetting("settings.tz", "Time zone",
                          RadioSettingValueList(LIST_TZ, LIST_TZ[
                              _mem.settings.tz]))
        basic.append(tz)

        # Signaling: H01-H06

        bell = RadioSetting("settings.bell", "Bell ringer",
                            RadioSettingValueList(LIST_BELL, LIST_BELL[
                                _mem.settings.bell]))
        basic.append(bell)

        # H02 (per channel)

        dtmfmodenc = RadioSetting("settings.dtmfmodenc", "DTMF mode encode",
                                  RadioSettingValueBoolean(
                                      _mem.settings.dtmfmodenc))
        basic.append(dtmfmodenc)

        dtmfmoddec = RadioSetting("settings.dtmfmoddec", "DTMF mode decode",
                                  RadioSettingValueBoolean(
                                      _mem.settings.dtmfmoddec))
        basic.append(dtmfmoddec)

        # H04 (per channel)

        decbandsel = RadioSetting("settings.decbandsel", "DTMF band select",
                                  RadioSettingValueList(LIST_AB,LIST_AB[
                                      _mem.settings.decbandsel]))
        basic.append(decbandsel)

        sqlexp = RadioSetting("settings.sqlexp", "SQL expansion",
                              RadioSettingValueBoolean(_mem.settings.sqlexp))
        basic.append(sqlexp)

        # Pkt: I01-I03

        databnd = RadioSetting("settings.databnd", "Packet data band",
                               RadioSettingValueList(LIST_DATABND,LIST_DATABND[
                                   _mem.settings.databnd]))
        basic.append(databnd)

        dataspd = RadioSetting("settings.dataspd", "Packet data speed",
                               RadioSettingValueList(LIST_DATASPD,LIST_DATASPD[
                                   _mem.settings.dataspd]))
        basic.append(dataspd)

        datasql = RadioSetting("settings.datasql", "Packet data squelch",
                               RadioSettingValueList(LIST_DATASQL,LIST_DATASQL[
                                   _mem.settings.datasql]))
        basic.append(datasql)

        # Other

        dw = RadioSetting("settings.dw", "Dual watch",
                          RadioSettingValueBoolean(_mem.settings.dw))
        other.append(dw)

        cpuclk = RadioSetting("settings.cpuclk", "CPU clock frequency",
                              RadioSettingValueList(LIST_CPUCLK,LIST_CPUCLK[
                                  _mem.settings.cpuclk]))
        other.append(cpuclk)

        def _filter(name):
            filtered = ""
            for char in str(name):
                if char in VALID_CHARS:
                    filtered += char
                else:
                    filtered += " "
            return filtered

        line16 = RadioSetting("poweron_msg.line16", "Power-on message",
                              RadioSettingValueString(0, 16, _filter(
                                  _mem.poweron_msg.line16)))
        other.append(line16)

        line32 = RadioSetting("embedded_msg.line32", "Embedded message",
                              RadioSettingValueString(0, 32, _filter(
                                  _mem.embedded_msg.line32)))
        other.append(line32)

        # Work

        workmoda = RadioSetting("settings.workmoda", "Work mode A",
                                RadioSettingValueList(LIST_WORK,LIST_WORK[
                                    _mem.settings.workmoda]))
        work.append(workmoda)

        workmodb = RadioSetting("settings.workmodb", "Work mode B",
                                RadioSettingValueList(LIST_WORK,LIST_WORK[
                                    _mem.settings.workmodb]))
        work.append(workmodb)

        wbanda = RadioSetting("settings.wbanda", "Work band A",
                              RadioSettingValueList(LIST_WBANDA, LIST_WBANDA[
                                  (_mem.settings.wbanda) - 1]))
        work.append(wbanda)

        wbandb = RadioSetting("settings.wbandb", "Work band B",
                              RadioSettingValueList(LIST_WBANDB, LIST_WBANDB[
                                  (_mem.settings.wbandb) - 4]))
        work.append(wbandb)

        sqla = RadioSetting("settings.sqla", "Squelch A",
                            RadioSettingValueList(LIST_SQL, LIST_SQL[
                                _mem.settings.sqla]))
        work.append(sqla)

        sqlb = RadioSetting("settings.sqlb", "Squelch B",
                            RadioSettingValueList(LIST_SQL, LIST_SQL[
                                _mem.settings.sqlb]))
        work.append(sqlb)

        stepa = RadioSetting("settings.stepa", "Auto step A",
                             RadioSettingValueList(LIST_STEP,LIST_STEP[
                                 _mem.settings.stepa]))
        work.append(stepa)

        stepb = RadioSetting("settings.stepb", "Auto step B",
                             RadioSettingValueList(LIST_STEP,LIST_STEP[
                                 _mem.settings.stepb]))
        work.append(stepb)

        mrcha = RadioSetting("settings.mrcha", "Current channel A",
                             RadioSettingValueInteger(0, 499,
                                 _mem.settings.mrcha))
        work.append(mrcha)

        mrchb = RadioSetting("settings.mrchb", "Current channel B",
                             RadioSettingValueInteger(0, 499,
                                 _mem.settings.mrchb))
        work.append(mrchb)

        val = _mem.settings.offseta / 100.00
        offseta = RadioSetting("settings.offseta", "Offset A (0-37.95)",
                               RadioSettingValueFloat(0, 38.00, val, 0.05, 2))
        work.append(offseta)

        val = _mem.settings.offsetb / 100.00
        offsetb = RadioSetting("settings.offsetb", "Offset B (0-79.95)",
                               RadioSettingValueFloat(0, 80.00, val, 0.05, 2))
        work.append(offsetb)

        wpricha = RadioSetting("settings.wpricha", "Priority channel A",
                               RadioSettingValueInteger(0, 499,
                                   _mem.settings.wpricha))
        work.append(wpricha)

        wprichb = RadioSetting("settings.wprichb", "Priority channel B",
                               RadioSettingValueInteger(0, 499,
                                   _mem.settings.wprichb))
        work.append(wprichb)

        smode = RadioSetting("settings.smode", "Smart function mode",
                             RadioSettingValueList(LIST_SMODE,LIST_SMODE[
                                 _mem.settings.smode]))
        work.append(smode)

        # dtmf

        ttdkey = RadioSetting("dtmf.ttdkey", "D key function",
                              RadioSettingValueList(LIST_TTDKEY, LIST_TTDKEY[
                                  _mem.dtmf.ttdkey]))
        dtmf.append(ttdkey)

        ttdgt = RadioSetting("dtmf.ttdgt", "Digit time",
                              RadioSettingValueList(LIST_TT200, LIST_TT200[
                                  (_mem.dtmf.ttdgt) - 5]))
        dtmf.append(ttdgt)

        ttint = RadioSetting("dtmf.ttint", "Interval time",
                              RadioSettingValueList(LIST_TT200, LIST_TT200[
                                  (_mem.dtmf.ttint) - 5]))
        dtmf.append(ttint)

        tt1stdgt = RadioSetting("dtmf.tt1stdgt", "1st digit time",
                                RadioSettingValueList(LIST_TT200, LIST_TT200[
                                    (_mem.dtmf.tt1stdgt) - 5]))
        dtmf.append(tt1stdgt)

        tt1stdly = RadioSetting("dtmf.tt1stdly", "1st digit delay time",
                                RadioSettingValueList(LIST_TT1000, LIST_TT1000[
                                    (_mem.dtmf.tt1stdly) - 2]))
        dtmf.append(tt1stdly)

        ttdlyqt = RadioSetting("dtmf.ttdlyqt", "Digit delay when use qt",
                               RadioSettingValueList(LIST_TT1000, LIST_TT1000[
                                   (_mem.dtmf.ttdlyqt) - 2]))
        dtmf.append(ttdlyqt)

        ttsig = RadioSetting("dtmf2.ttsig", "Signal",
                             RadioSettingValueList(LIST_TTSIG, LIST_TTSIG[
                                 _mem.dtmf2.ttsig]))
        dtmf.append(ttsig)

        ttautorst = RadioSetting("dtmf2.ttautorst", "Auto reset time",
                                 RadioSettingValueList(LIST_TTAUTORST,
                                     LIST_TTAUTORST[_mem.dtmf2.ttautorst]))
        dtmf.append(ttautorst)

        if _mem.dtmf2.ttgrpcode > 0x06:
            val = 0x00
        else:
            val = _mem.dtmf2.ttgrpcode
        ttgrpcode = RadioSetting("dtmf2.ttgrpcode", "Group code",
                                 RadioSettingValueList(LIST_TTGRPCODE,
                                     LIST_TTGRPCODE[val]))
        dtmf.append(ttgrpcode)

        ttintcode = RadioSetting("dtmf2.ttintcode", "Interval code",
                                 RadioSettingValueList(LIST_TTINTCODE,
                                     LIST_TTINTCODE[_mem.dtmf2.ttintcode]))
        dtmf.append(ttintcode)

        if _mem.dtmf2.ttalert > 0x04:
            val = 0x00
        else:
            val = _mem.dtmf2.ttalert
        ttalert = RadioSetting("dtmf2.ttalert", "Alert tone/transpond",
                               RadioSettingValueList(LIST_TTALERT,
                                   LIST_TTALERT[val]))
        dtmf.append(ttalert)

        ttautod = RadioSetting("dtmf.ttautod", "Auto dial group",
                               RadioSettingValueList(LIST_TTAUTOD,
                                   LIST_TTAUTOD[_mem.dtmf.ttautod]))
        dtmf.append(ttautod)

        # setup 9 dtmf autodial entries
        for i in map(str, range(1, 10)):
            objname = "code" + i
            strname = "Code " + str(i)
            dtmfsetting = getattr(_mem.dtmfcode, objname)
            dtmflen = getattr(_mem.dtmfcode, objname + "_len")
            dtmfstr = self._bbcd2dtmf(dtmfsetting, dtmflen)
            code = RadioSettingValueString(0, 16, dtmfstr)
            code.set_charset(DTMF_CHARS + list(" "))
            rs = RadioSetting("dtmfcode." + objname, strname, code)
            dtmf.append(rs)
        return top
Exemplo n.º 22
0
    def get_settings(self):
        _settings = self._memobj.settings
        _dtmf_strings = self._memobj.dtmf_strings
        _passwd = self._memobj.passwd

        repeater = RadioSettingGroup("repeater", "Repeater Settings")
        ctcss = RadioSettingGroup("ctcss", "CTCSS/DCS/EPCS Settings")
        arts = RadioSettingGroup("arts", "ARTS Settings")
        mbls = RadioSettingGroup("banks", "Memory Settings")
        scan = RadioSettingGroup("scan", "Scan Settings")
        dtmf = RadioSettingGroup("dtmf", "DTMF Settings")
        wires = RadioSettingGroup("wires", "WiRES(tm) Settings")
        switch = RadioSettingGroup("switch", "Switch/Knob Settings")
        disp = RadioSettingGroup("disp", "Display Settings")
        misc = RadioSettingGroup("misc", "Miscellaneous Settings")

        setmode = RadioSettings(repeater, ctcss, arts, mbls, scan,
                                dtmf, wires, switch, disp, misc)

        # numbers and names of settings refer to the way they're
        # presented in the set menu, as well as the list starting on
        # page 74 of the manual

        # 1 APO
        opts = ["Off", "30 Min", "1 Hour", "3 Hour", "5 Hour", "8 Hour"]
        misc.append(
            RadioSetting(
                "apo", "Automatic Power Off",
                RadioSettingValueList(opts, opts[_settings.apo])))

        # 2 AR.BEP
        opts = ["Off", "In Range", "Always"]
        arts.append(
            RadioSetting(
                "arts_beep", "ARTS Beep",
                RadioSettingValueList(opts, opts[_settings.arts_beep])))

        # 3 AR.INT
        opts = ["15 Sec", "25 Sec"]
        arts.append(
            RadioSetting(
                "arts_interval", "ARTS Polling Interval",
                RadioSettingValueList(opts, opts[_settings.arts_interval])))

        # 4 ARS
        opts = ["Off", "On"]
        repeater.append(
            RadioSetting(
                "ars", "Automatic Repeater Shift",
                RadioSettingValueList(opts, opts[_settings.ars])))

        # 5 BCLO
        opts = ["Off", "On"]
        misc.append(RadioSetting(
                "busy_lockout", "Busy Channel Lock-Out",
                RadioSettingValueList(opts, opts[_settings.busy_lockout])))

        # 6 BEEP
        opts = ["Off", "Key+Scan", "Key"]
        switch.append(RadioSetting(
                "beep", "Enable the Beeper",
                RadioSettingValueList(opts, opts[_settings.beep])))

        # 7 BELL
        opts = ["Off", "1", "3", "5", "8", "Continuous"]
        ctcss.append(RadioSetting("bell", "Bell Repetitions",
                     RadioSettingValueList(opts, opts[_settings.bell])))

        # 8 BNK.LNK
        for i in range(0, 8):
            opts = ["Off", "On"]
            mbs = (self._memobj.mbs >> i) & 1
            rs = RadioSetting("mbs%i" % i, "Bank %s Scan" % (i + 1),
                              RadioSettingValueList(opts, opts[mbs]))

            def apply_mbs(s, index):
                if int(s.value):
                    self._memobj.mbs |= (1 << index)
                else:
                    self._memobj.mbs &= ~(1 << index)
            rs.set_apply_callback(apply_mbs, i)
            mbls.append(rs)

        # 9 BNK.NM - A per-bank attribute, nothing to do here.

        # 10 CLK.SFT - A per-channel attribute, nothing to do here.

        # 11 CW.ID
        opts = ["Off", "On"]
        arts.append(RadioSetting("cw_id", "CW ID Enable",
                    RadioSettingValueList(opts, opts[_settings.cw_id])))

        cw_id_text = ""
        for i in _settings.cw_id_string:
            try:
                cw_id_text += CHARSET[i & 0x7F]
            except IndexError:
                if i != 0xff:
                    LOG.debug("unknown char index in cw id: %x " % (i))

        val = RadioSettingValueString(0, 16, cw_id_text, True)
        val.set_charset(CHARSET + "abcdefghijklmnopqrstuvwxyz")
        rs = RadioSetting("cw_id_string", "CW Identifier Text", val)

        def apply_cw_id(s):
            str = s.value.get_value().upper().rstrip()
            mval = ""
            mval = [chr(CHARSET.index(x)) for x in str]
            for x in range(len(mval), 16):
                mval.append(chr(0xff))
            for x in range(0, 16):
                _settings.cw_id_string[x] = ord(mval[x])
        rs.set_apply_callback(apply_cw_id)
        arts.append(rs)

        # 12 CWTRNG
        opts = ["Off", "4WPM", "5WPM", "6WPM", "7WPM", "8WPM", "9WPM",
                "10WPM", "11WPM", "12WPM", "13WPM", "15WPM", "17WPM",
                "20WPM", "24WPM", "30WPM", "40WPM"]
        misc.append(RadioSetting("cw_trng", "CW Training",
                    RadioSettingValueList(opts, opts[_settings.cw_trng])))

        # todo: make the setting of the units here affect the display
        # of the speed.  Not critical, but would be slick.
        opts = ["CPM", "WPM"]
        misc.append(RadioSetting("cw_trng_units", "CW Training Units",
                    RadioSettingValueList(opts,
                                          opts[_settings.cw_trng_units])))

        # 13 DC VLT - a read-only status, so nothing to do here

        # 14 DCS CD - A per-channel attribute, nothing to do here

        # 15 DCS.RV
        opts = ["Disabled", "Enabled"]
        ctcss.append(RadioSetting(
                     "inverted_dcs",
                     "\"Inverted\" DCS Code Decoding",
                     RadioSettingValueList(opts,
                                           opts[_settings.inverted_dcs])))

        # 16 DIMMER
        opts = ["Off"] + ["Level %d" % (x) for x in range(1, 11)]
        disp.append(RadioSetting("dimmer", "Dimmer",
                                 RadioSettingValueList(opts,
                                                       opts[_settings
                                                            .dimmer])))

        # 17 DT.A/M
        opts = ["Manual", "Auto"]
        dtmf.append(RadioSetting("dtmf_mode", "DTMF Autodialer",
                                 RadioSettingValueList(opts,
                                                       opts[_settings
                                                            .dtmf_mode])))

        # 18 DT.DLY
        opts = ["50 ms", "250 ms", "450 ms", "750 ms", "1000 ms"]
        dtmf.append(RadioSetting("dtmf_delay", "DTMF Autodialer Delay Time",
                                 RadioSettingValueList(opts,
                                                       opts[_settings
                                                            .dtmf_delay])))

        # 19 DT.SET
        for memslot in range(0, 10):
            dtmf_memory = ""
            for i in _dtmf_strings[memslot].dtmf_string:
                if i != 0xFF:
                    try:
                        dtmf_memory += CHARSET[i]
                    except IndexError:
                        LOG.debug("unknown char index in dtmf: %x " % (i))

            val = RadioSettingValueString(0, 16, dtmf_memory, True)
            val.set_charset(CHARSET + "abcdef")
            rs = RadioSetting("dtmf_string_%d" % memslot,
                              "DTMF Memory %d" % memslot, val)

            def apply_dtmf(s, i):
                LOG.debug("applying dtmf for %x\n" % i)
                str = s.value.get_value().upper().rstrip()
                LOG.debug("str is %s\n" % str)
                mval = ""
                mval = [chr(CHARSET.index(x)) for x in str]
                for x in range(len(mval), 16):
                    mval.append(chr(0xff))
                for x in range(0, 16):
                    _dtmf_strings[i].dtmf_string[x] = ord(mval[x])
            rs.set_apply_callback(apply_dtmf, memslot)
            dtmf.append(rs)

        # 20 DT.SPD
        opts = ["50 ms", "100 ms"]
        dtmf.append(RadioSetting("dtmf_speed",
                                 "DTMF Autodialer Sending Speed",
                                 RadioSettingValueList(opts,
                                                       opts[_settings.
                                                            dtmf_speed])))

        # 21 EDG.BEP
        opts = ["Off", "On"]
        mbls.append(RadioSetting("edge_beep", "Band Edge Beeper",
                                 RadioSettingValueList(opts,
                                                       opts[_settings.
                                                            edge_beep])))

        # 22 INT.CD
        opts = ["DTMF %X" % (x) for x in range(0, 16)]
        wires.append(RadioSetting("int_cd", "Access Number for WiRES(TM)",
                     RadioSettingValueList(opts, opts[_settings.int_cd])))

        # 23 ING MD
        opts = ["Sister Radio Group", "Friends Radio Group"]
        wires.append(RadioSetting("wires_mode",
                                  "Internet Link Connection Mode",
                                  RadioSettingValueList(opts,
                                                        opts[_settings.
                                                             wires_mode])))

        # 24 INT.A/M
        opts = ["Manual", "Auto"]
        wires.append(RadioSetting("wires_auto", "Internet Link Autodialer",
                                  RadioSettingValueList(opts,
                                                        opts[_settings
                                                             .wires_auto])))
        # 25 INT.SET
        opts = ["F%d" % (x) for x in range(0, 10)]

        wires.append(RadioSetting("int_set", "Memory Register for "
                                  "non-WiRES Internet",
                                  RadioSettingValueList(opts,
                                                        opts[_settings
                                                             .int_set])))

        # 26 LOCK
        opts = ["Key", "Dial", "Key + Dial", "PTT",
                "Key + PTT", "Dial + PTT", "All"]
        switch.append(RadioSetting("lock", "Control Locking",
                                   RadioSettingValueList(opts,
                                                         opts[_settings
                                                              .lock])))

        # 27 MCGAIN
        opts = ["Level %d" % (x) for x in range(1, 10)]
        misc.append(RadioSetting("mic_gain", "Microphone Gain",
                                 RadioSettingValueList(opts,
                                                       opts[_settings
                                                            .mic_gain])))

        # 28 MEM.SCN
        opts = ["Tag 1", "Tag 2", "All Channels"]
        rs = RadioSetting("scan_mode", "Memory Scan Mode",
                          RadioSettingValueList(opts,
                                                opts[_settings
                                                     .scan_mode - 1]))
        # this setting is unusual in that it starts at 1 instead of 0.
        # that is, index 1 corresponds to "Tag 1", and index 0 is invalid.
        # so we create a custom callback to handle this.

        def apply_scan_mode(s):
            myopts = ["Tag 1", "Tag 2", "All Channels"]
            _settings.scan_mode = myopts.index(s.value.get_value()) + 1
        rs.set_apply_callback(apply_scan_mode)
        mbls.append(rs)

        # 29 MW MD
        opts = ["Lower", "Next"]
        mbls.append(RadioSetting("mw_mode", "Memory Write Mode",
                                 RadioSettingValueList(opts,
                                                       opts[_settings
                                                            .mw_mode])))

        # 30 NM SET - This is per channel, so nothing to do here

        # 31 OPN.MSG
        opts = ["Off", "DC Supply Voltage", "Text Message"]
        disp.append(RadioSetting("open_msg", "Opening Message Type",
                                 RadioSettingValueList(opts,
                                                       opts[_settings.
                                                            open_msg])))

        openmsg = ""
        for i in _settings.openMsg_Text:
            try:
                openmsg += CHARSET[i & 0x7F]
            except IndexError:
                if i != 0xff:
                    LOG.debug("unknown char index in openmsg: %x " % (i))

        val = RadioSettingValueString(0, 6, openmsg, True)
        val.set_charset(CHARSET + "abcdefghijklmnopqrstuvwxyz")
        rs = RadioSetting("openMsg_Text", "Opening Message Text", val)

        def apply_openmsg(s):
            str = s.value.get_value().upper().rstrip()
            mval = ""
            mval = [chr(CHARSET.index(x)) for x in str]
            for x in range(len(mval), 6):
                mval.append(chr(0xff))
            for x in range(0, 6):
                _settings.openMsg_Text[x] = ord(mval[x])
        rs.set_apply_callback(apply_openmsg)
        disp.append(rs)

        # 32 PAGER - a per-channel attribute

        # 33 PAG.ABK
        opts = ["Off", "On"]
        ctcss.append(RadioSetting("pag_abk", "Paging Answer Back",
                                  RadioSettingValueList(opts,
                                                        opts[_settings
                                                             .pag_abk])))

        # 34 PAG.CDR
        opts = ["%2.2d" % (x) for x in range(1, 50)]
        ctcss.append(RadioSetting("pag_cdr_1", "Receive Page Code 1",
                                  RadioSettingValueList(opts,
                                                        opts[_settings
                                                             .pag_cdr_1])))

        ctcss.append(RadioSetting("pag_cdr_2", "Receive Page Code 2",
                                  RadioSettingValueList(opts,
                                                        opts[_settings
                                                             .pag_cdr_2])))

        # 35 PAG.CDT
        opts = ["%2.2d" % (x) for x in range(1, 50)]
        ctcss.append(RadioSetting("pag_cdt_1", "Transmit Page Code 1",
                                  RadioSettingValueList(opts,
                                                        opts[_settings
                                                             .pag_cdt_1])))

        ctcss.append(RadioSetting("pag_cdt_2", "Transmit Page Code 2",
                                  RadioSettingValueList(opts,
                                                        opts[_settings
                                                             .pag_cdt_2])))

        # Common Button Options
        button_opts = ["Squelch Off", "Weather", "Smart Search",
                       "Tone Scan", "Scan", "T Call", "ARTS"]

        # 36 PRG P1
        opts = button_opts + ["DC Volts"]
        switch.append(RadioSetting(
                "prog_p1", "P1 Button",
                RadioSettingValueList(opts, opts[_settings.prog_p1])))

        # 37 PRG P2
        opts = button_opts + ["Dimmer"]
        switch.append(RadioSetting(
                "prog_p2", "P2 Button",
                RadioSettingValueList(opts, opts[_settings.prog_p2])))

        # 38 PRG P3
        opts = button_opts + ["Mic Gain"]
        switch.append(RadioSetting(
                "prog_p3", "P3 Button",
                RadioSettingValueList(opts, opts[_settings.prog_p3])))

        # 39 PRG P4
        opts = button_opts + ["Skip"]
        switch.append(RadioSetting(
                "prog_p4", "P4 Button",
                RadioSettingValueList(opts, opts[_settings.prog_p4])))

        # 40 PSWD
        password = ""
        for i in _passwd:
            if i != 0xFF:
                try:
                    password += CHARSET[i]
                except IndexError:
                    LOG.debug("unknown char index in password: %x " % (i))

        val = RadioSettingValueString(0, 4, password, True)
        val.set_charset(CHARSET[0:15] + "abcdef ")
        rs = RadioSetting("passwd", "Password", val)

        def apply_password(s):
            str = s.value.get_value().upper().rstrip()
            mval = ""
            mval = [chr(CHARSET.index(x)) for x in str]
            for x in range(len(mval), 4):
                mval.append(chr(0xff))
            for x in range(0, 4):
                _passwd[x] = ord(mval[x])
        rs.set_apply_callback(apply_password)
        misc.append(rs)

        # 41 RESUME
        opts = ["3 Sec", "5 Sec", "10 Sec", "Busy", "Hold"]
        scan.append(RadioSetting("resume", "Scan Resume Mode",
                    RadioSettingValueList(opts, opts[_settings.resume])))

        # 42 RF.SQL
        opts = ["Off"] + ["S-%d" % (x) for x in range(1, 10)]
        misc.append(RadioSetting("rf_sql", "RF Squelch Threshold",
                    RadioSettingValueList(opts, opts[_settings.rf_sql])))

        # 43 RPT - per channel attribute, nothing to do here

        # 44 RVRT
        opts = ["Off", "On"]
        misc.append(RadioSetting("revert", "Priority Revert",
                    RadioSettingValueList(opts, opts[_settings.revert])))

        # 45 S.SRCH
        opts = ["Single", "Continuous"]
        misc.append(RadioSetting("s_search", "Smart Search Sweep Mode",
                    RadioSettingValueList(opts, opts[_settings.s_search])))

        # 46 SHIFT - per channel setting, nothing to do here

        # 47 SKIP = per channel setting, nothing to do here

        # 48 SPLIT - per channel attribute, nothing to do here

        # 49 SQL.TYP - per channel attribute, nothing to do here

        # 50 STEP - per channel attribute, nothing to do here

        # 51 TEMP - read-only status, nothing to do here

        # 52 TN FRQ - per channel attribute, nothing to do here

        # 53 TOT
        opts = ["Off", "1 Min", "3 Min", "5 Min", "10 Min"]
        misc.append(RadioSetting("tot", "Timeout Timer",
                                 RadioSettingValueList(opts,
                                                       opts[_settings.tot])))

        # 54 TS MUT
        opts = ["Off", "On"]
        ctcss.append(RadioSetting("ts_mut", "Tone Search Mute",
                                  RadioSettingValueList(opts,
                                                        opts[_settings
                                                             .ts_mut])))

        # 55 TS SPEED
        opts = ["Fast", "Slow"]
        ctcss.append(RadioSetting("ts_speed", "Tone Search Scanner Speed",
                                  RadioSettingValueList(opts,
                                                        opts[_settings
                                                             .ts_speed])))

        # 56 VFO.SCN
        opts = ["+/- 1MHz", "+/- 2MHz", "+/-5MHz", "All"]
        scan.append(RadioSetting("vfo_scan", "VFO Scanner Width",
                                 RadioSettingValueList(opts,
                                                       opts[_settings
                                                            .vfo_scan])))

        # 57 WX.ALT
        opts = ["Off", "On"]
        misc.append(RadioSetting("wx_alert", "Weather Alert Scan",
                    RadioSettingValueList(opts, opts[_settings.wx_alert])))

        # 58 WX.VOL
        opts = ["Normal", "Maximum"]
        misc.append(RadioSetting("wx_vol_max", "Weather Alert Volume",
                    RadioSettingValueList(opts, opts[_settings.wx_vol_max])))

        # 59 W/N DV - this is a per-channel attribute, nothing to do here

        return setmode
Exemplo n.º 23
0
    def get_settings(self):
        _settings = self._memobj.settings
        basic = RadioSettingGroup("basic", "Basic Settings")

        group = RadioSettings(basic)

        options = ["Time", "Carrier", "Search"]
        rs = RadioSetting(
            "scantype", "Scan Type",
            RadioSettingValueList(options, options[_settings.scantype]))
        basic.append(rs)

        options = ["Off"] + ["%s min" % x for x in range(1, 8)]
        rs = RadioSetting(
            "timeout", "Time Out Timer",
            RadioSettingValueList(options, options[_settings.timeout]))
        basic.append(rs)

        options = ["A", "B"]
        rs = RadioSetting(
            "freqmode_ab", "Frequency Mode",
            RadioSettingValueList(options, options[_settings.freqmode_ab]))
        basic.append(rs)

        options = ["Frequency Mode", "Channel Mode"]
        rs = RadioSetting(
            "workmode_a", "Radio Work Mode(A)",
            RadioSettingValueList(options, options[_settings.workmode_a]))
        basic.append(rs)

        rs = RadioSetting(
            "workmode_b", "Radio Work Mode(B)",
            RadioSettingValueList(options, options[_settings.workmode_b]))
        basic.append(rs)

        options = ["Frequency", "Name", "Channel"]
        rs = RadioSetting(
            "mdf_a", "Display Format(F1)",
            RadioSettingValueList(options, options[_settings.mdf_a]))
        basic.append(rs)

        rs = RadioSetting(
            "mdf_b", "Display Format(F2)",
            RadioSettingValueList(options, options[_settings.mdf_b]))
        basic.append(rs)

        rs = RadioSetting(
            "mem_chan_a", "Mem Channel (A)",
            RadioSettingValueInteger(1, 99, _settings.mem_chan_a))
        basic.append(rs)

        rs = RadioSetting(
            "mem_chan_b", "Mem Channel (B)",
            RadioSettingValueInteger(1, 99, _settings.mem_chan_b))
        basic.append(rs)

        options = ["Off", "BOT", "EOT", "Both"]
        rs = RadioSetting(
            "pttid", "PTT-ID",
            RadioSettingValueList(options, options[_settings.pttid]))
        basic.append(rs)

        dtmfchars = "0123456789ABCD*#"
        _codeobj = self._memobj.pttid.code
        _code = "".join([dtmfchars[x] for x in _codeobj if int(x) < 0x1F])
        val = RadioSettingValueString(0, 6, _code, False)
        val.set_charset(dtmfchars)
        rs = RadioSetting("pttid.code", "PTT-ID Code", val)

        def apply_code(setting, obj):
            code = []
            for j in range(0, 6):
                try:
                    code.append(dtmfchars.index(str(setting.value)[j]))
                except IndexError:
                    code.append(0xFF)
            obj.code = code

        rs.set_apply_callback(apply_code, self._memobj.pttid)
        basic.append(rs)

        rs = RadioSetting("squelch", "Squelch Level",
                          RadioSettingValueInteger(0, 9, _settings.squelch))
        basic.append(rs)

        rs = RadioSetting("vox", "VOX Level",
                          RadioSettingValueInteger(0, 9, _settings.vox))
        basic.append(rs)

        options = ["Frequency Mode", "Channel Mode"]
        rs = RadioSetting(
            "workmode_fm", "FM Work Mode",
            RadioSettingValueList(options, options[_settings.workmode_fm]))
        basic.append(rs)

        options = ["Current Frequency", "F1 Frequency", "F2 Frequency"]
        rs = RadioSetting(
            "txtdr", "Dual Standby TX Priority",
            RadioSettingValueList(options, options[_settings.txtdr]))
        basic.append(rs)

        options = ["English", "Chinese"]
        rs = RadioSetting(
            "language", "Language",
            RadioSettingValueList(options, options[_settings.language]))
        basic.append(rs)

        rs = RadioSetting("tdr", "Dual Standby",
                          RadioSettingValueBoolean(_settings.tdr))
        basic.append(rs)

        rs = RadioSetting("roger", "Roger Beep",
                          RadioSettingValueBoolean(_settings.roger))
        basic.append(rs)

        rs = RadioSetting("backlight", "Backlight",
                          RadioSettingValueBoolean(_settings.backlight))
        basic.append(rs)

        rs = RadioSetting("save_funct", "Save Mode",
                          RadioSettingValueBoolean(_settings.save_funct))
        basic.append(rs)

        rs = RadioSetting("fm", "FM Function",
                          RadioSettingValueBoolean(_settings.fm))
        basic.append(rs)

        rs = RadioSetting(
            "beep_tone_disabled", "Beep Prompt",
            RadioSettingValueBoolean(not _settings.beep_tone_disabled))
        basic.append(rs)

        rs = RadioSetting("voice_prompt", "Voice Prompt",
                          RadioSettingValueBoolean(_settings.voice_prompt))
        basic.append(rs)

        rs = RadioSetting("sidetone", "DTMF Side Tone",
                          RadioSettingValueBoolean(_settings.sidetone))
        basic.append(rs)

        rs = RadioSetting("ste_disabled", "Squelch Tail Eliminate",
                          RadioSettingValueBoolean(not _settings.ste_disabled))
        basic.append(rs)

        _limit = int(self._memobj.limits.lower_vhf) / 10
        rs = RadioSetting("limits.lower_vhf", "VHF Lower Limit (MHz)",
                          RadioSettingValueInteger(128, 270, _limit))

        def apply_limit(setting, obj):
            value = int(setting.value) * 10
            obj.lower_vhf = value

        rs.set_apply_callback(apply_limit, self._memobj.limits)
        basic.append(rs)

        _limit = int(self._memobj.limits.upper_vhf) / 10
        rs = RadioSetting("limits.upper_vhf", "VHF Upper Limit (MHz)",
                          RadioSettingValueInteger(128, 270, _limit))

        def apply_limit(setting, obj):
            value = int(setting.value) * 10
            obj.upper_vhf = value

        rs.set_apply_callback(apply_limit, self._memobj.limits)
        basic.append(rs)

        _limit = int(self._memobj.limits.lower_uhf) / 10
        rs = RadioSetting("limits.lower_uhf", "UHF Lower Limit (MHz)",
                          RadioSettingValueInteger(400, 520, _limit))

        def apply_limit(setting, obj):
            value = int(setting.value) * 10
            obj.lower_uhf = value

        rs.set_apply_callback(apply_limit, self._memobj.limits)
        basic.append(rs)

        _limit = int(self._memobj.limits.upper_uhf) / 10
        rs = RadioSetting("limits.upper_uhf", "UHF Upper Limit (MHz)",
                          RadioSettingValueInteger(400, 520, _limit))

        def apply_limit(setting, obj):
            value = int(setting.value) * 10
            obj.upper_uhf = value

        rs.set_apply_callback(apply_limit, self._memobj.limits)
        basic.append(rs)

        fm_preset = RadioSettingGroup("fm_preset", "FM Radio Presets")
        group.append(fm_preset)

        for i in range(0, 16):
            if self._memobj.fm_presets[i] < 0x01AF:
                used = True
                preset = self._memobj.fm_presets[i] / 10.0 + 65
            else:
                used = False
                preset = 65
            rs = RadioSetting("fm_presets_%1i" % i, "FM Preset %i" % (i + 1),
                              RadioSettingValueBoolean(used),
                              RadioSettingValueFloat(65, 108, preset, 0.1, 1))
            fm_preset.append(rs)

        testmode = RadioSettingGroup("testmode", "Test Mode Settings")
        group.append(testmode)

        vhfdata = [
            "136-139", "140-144", "145-149", "150-154", "155-159", "160-164",
            "165-169", "170-174"
        ]
        uhfdata = [
            "400-409", "410-419", "420-429", "430-439", "440-449", "450-459",
            "460-469", "470-479"
        ]
        powernamedata = ["Hi", "Lo"]
        powerkeydata = ["hipwr", "lopwr"]

        for power in range(0, 2):
            for index in range(0, 8):
                key = "test.vhf%s%i" % (powerkeydata[power], index)
                name = "%s Mhz %s Power" % (vhfdata[index],
                                            powernamedata[power])
                rs = RadioSetting(
                    key, name,
                    RadioSettingValueInteger(
                        0, 255,
                        getattr(self._memobj.test,
                                "vhf%s%i" % (powerkeydata[power], index))))
                testmode.append(rs)

        for power in range(0, 2):
            for index in range(0, 8):
                key = "test.uhf%s%i" % (powerkeydata[power], index)
                name = "%s Mhz %s Power" % (uhfdata[index],
                                            powernamedata[power])
                rs = RadioSetting(
                    key, name,
                    RadioSettingValueInteger(
                        0, 255,
                        getattr(self._memobj.test,
                                "uhf%s%i" % (powerkeydata[power], index))))
                testmode.append(rs)

        for band in ["vhf", "uhf"]:
            for index in range(0, 10):
                key = "test.%ssquelch%i" % (band, index)
                name = "%s Squelch %i" % (band.upper(), index)
                rs = RadioSetting(
                    key, name,
                    RadioSettingValueInteger(
                        0, 255,
                        getattr(self._memobj.test,
                                "%ssquelch%i" % (band, index))))
                testmode.append(rs)

        return group
Exemplo n.º 24
0
    def get_settings(self):
        """Translate the MEM_FORMAT structs into settings in the UI"""
        # Define mem struct write-back shortcuts
        _sets = self._memobj.settings
        _asf = self._memobj.asf
        _ssf = self._memobj.ssf
        _mex = self._memobj.exset
        _chm = self._memobj.ch_mem
        basic = RadioSettingGroup("basic", "Basic Settings")
        pvfo = RadioSettingGroup("pvfo", "VFO Band Edges")
        mena = RadioSettingGroup("mena", "Menu A")
        menb = RadioSettingGroup("menb", "Menu B")
        amode = RadioSettingGroup("amode", "Auto Mode")
        ssc = RadioSettingGroup("ssc", "Slow Scan")
        group = RadioSettings(basic, pvfo, mena, menb, amode, ssc)

        mhz1 = 1000000.

        # Callback functions
        def _my_readonly(setting, obj, atrb):
            """NOP callback, prevents writing the setting"""
            vx = 0
            return

        def my_adjraw(setting, obj, atrb, fix=0, ndx=-1):
            """Callback for Integer add or subtract fix from value."""
            vx = int(str(setting.value))
            value = vx + int(fix)
            if value < 0:
                value = 0
            if ndx < 0:
                setattr(obj, atrb, value)
            else:
                setattr(obj[ndx], atrb, value)
            return

        def my_mhz_val(setting, obj, atrb, ndx=-1):
            """ Callback to set freq back to Htz"""
            vx = float(str(setting.value))
            vx = int(vx * mhz1)
            if ndx < 0:
                setattr(obj, atrb, vx)
            else:
                setattr(obj[ndx], atrb, vx)
            return

        def my_bool(setting, obj, atrb, ndx=-1):
            """ Callback to properly set boolean """
            # set_settings is not setting [indexed] booleans???
            vx = 0
            if str(setting.value) == "True":
                vx = 1
            if ndx < 0:
                setattr(obj, atrb, vx)
            else:
                setattr(obj[ndx], atrb, vx)
            return

        def my_asf_mode(setting, obj, nx=0):
            """ Callback to extract mode and create asmode, asdata """
            v1 = TS480_MODES.index(str(setting.value))
            v2 = 0  # asdata
            vx = v1 + 1  # stored as CAT values, same as xmode
            if v1 == 7:
                vx = 9
            if v1 > 7:  # a Data mode
                v2 = 1
                if v1 == 8:
                    vx = 1  # LSB
                elif v1 == 9:
                    vx = 2  # USB
                elif v1 == 10:
                    vx = 4  # FM
            setattr(obj[nx], "asdata", v2)
            setattr(obj[nx], "asmode", vx)
            return

        def my_fnctns(setting, obj, ndx, atrb):
            """ Filter only valid key function assignments """
            vx = int(str(setting.value))
            if vx > 79:
                vx = 99  # Off
            setattr(obj[ndx], atrb, vx)
            return

        def my_labels(kx):
            lbl = "%03i:" % kx  # SG EX number
            lbl += self.EX_LBL[kx]  # and the label to match
            return lbl

        # ===== BASIC GROUP =====

        options = [
            "TS-480HX (200W)", "TS-480SAT (100W + AT)", "Japanese 50W type",
            "Japanese 20W type"
        ]
        rx = RadioSettingValueString(14, 22, options[_sets.ty])
        rset = RadioSetting("settings.ty", "FirmwareVersion", rx)
        rset.set_apply_callback(_my_readonly, _sets, "ty")
        basic.append(rset)

        rx = RadioSettingValueInteger(0, 255, _sets.ag)
        rset = RadioSetting("settings.ag", "AF Gain", rx)
        #  rset.set_apply_callback(my_adjraw, _sets, "ag", -1)
        basic.append(rset)

        rx = RadioSettingValueInteger(0, 100, _sets.rg)
        rset = RadioSetting("settings.rg", "RF Gain", rx)
        #   rset.set_apply_callback(my_adjraw, _sets, "rg", -1)
        basic.append(rset)

        options = ["ANT1", "ANT2"]
        # CAUTION: an has value of 1 or 2
        rx = RadioSettingValueList(options, options[_sets.an - 1])
        rset = RadioSetting("settings.an", "Antenna Selected", rx)
        # Add 1 to the changed value. S/b 1/2
        rset.set_apply_callback(my_val_list, options, _sets, "an", 1)
        basic.append(rset)

        rx = RadioSettingValueInteger(0, 100, _sets.mg)
        rset = RadioSetting("settings.mg", "Microphone gain", rx)
        basic.append(rset)

        nx = 5  # Coarse step
        if bool(_mex[0].ex021):  # Power Fine enabled in menu A
            nx = 1
        vx = _sets.pc  # Trap invalid values from run_tests.py
        if vx < 5:
            vx = 5
        options = [200, 100, 50, 20]  # subject to firmware
        rx = RadioSettingValueInteger(5, options[_sets.ty], vx, nx)
        sx = "TX Output power (Watts)"
        rset = RadioSetting("settings.pc", sx, rx)
        basic.append(rset)

        val = _sets.fa / mhz1  # valid range is for receiver
        rx = RadioSettingValueFloat(0.05, 60.0, val, 0.001, 3)
        sx = "VFO-A Frequency (MHz)"
        rset = RadioSetting("settings.fa", sx, rx)
        rset.set_apply_callback(my_mhz_val, _sets, "fa")
        basic.append(rset)

        val = _sets.fb / mhz1
        rx = RadioSettingValueFloat(0.05, 60.0, val, 0.001, 3)
        sx = "VFO-B Frequency (MHz)"
        rset = RadioSetting("settings.fb", sx, rx)
        rset.set_apply_callback(my_mhz_val, _sets, "fb")
        basic.append(rset)

        options = ["Menu A", "Menu B"]
        rx = RadioSettingValueList(options, options[_sets.mf])
        sx = "Menu Selected"
        rset = RadioSetting("settings.mf", sx, rx)
        rset.set_apply_callback(my_val_list, options, _sets, "mf")
        basic.append(rset)

        # ==== VFO Edges Group ================

        for mx in range(100, 110):
            val = _chm[mx].rxfreq / mhz1
            if val < 1.8:  # Many operators never use this
                val = 1.8  # So default is 0.0
            rx = RadioSettingValueFloat(1.8, 54.0, val, 0.001, 3)
            sx = "VFO-Band %i lower limit (MHz)" % (mx - 100)
            rset = RadioSetting("ch_mem.rxfreq/%d" % mx, sx, rx)
            rset.set_apply_callback(my_mhz_val, _chm, "rxfreq", mx)
            pvfo.append(rset)

            val = _chm[mx].txfreq / mhz1
            if val < 1.8:
                val = 54.0
            rx = RadioSettingValueFloat(1.8, 54.0, val, 0.001, 3)
            sx = "    VFO-Band %i upper limit (MHz)" % (mx - 100)
            rset = RadioSetting("ch_mem.txfreq/%d" % mx, sx, rx)
            rset.set_apply_callback(my_mhz_val, _chm, "txfreq", mx)
            pvfo.append(rset)

            kx = _chm[mx].xmode
            options = [
                "None", "LSB", "USB", "CW", "FM", "AM", "FSK", "CW-R", "N/A",
                "FSK-R"
            ]
            rx = RadioSettingValueList(options, options[kx])
            sx = "    VFO-Band %i Tx/Rx Mode" % (mx - 100)
            rset = RadioSetting("ch_mem.xmode/%d" % mx, sx, rx)
            rset.set_apply_callback(my_val_list, options, _chm, "xmode", 0, mx)
            pvfo.append(rset)

        # ==== Menu A/B Group =================

        for mx in range(2):  # A/B index
            sx = my_labels(0)
            rx = RadioSettingValueInteger(0, 4, _mex[mx].ex000)
            rset = RadioSetting("exset.ex000", sx, rx)
            if mx == 0:
                mena.append(rset)
            else:
                menb.append(rset)

            rx = RadioSettingValueInteger(0, 9, _mex[mx].ex012)
            sx = my_labels(12)
            rset = RadioSetting("exset.ex012", sx, rx)
            if mx == 0:
                mena.append(rset)
            else:
                menb.append(rset)

            sx = my_labels(13)
            rx = RadioSettingValueInteger(0, 9, _mex[mx].ex013)
            rset = RadioSetting("exset.ex013", sx, rx)
            if mx == 0:
                mena.append(rset)
            else:
                menb.append(rset)

            sx = my_labels(14)
            rx = RadioSettingValueInteger(0, 9, _mex[mx].ex014)
            rset = RadioSetting("exset.ex014", sx, rx)
            if mx == 0:
                mena.append(rset)
            else:
                menb.append(rset)

            options = ["250", "500", "1000"]
            rx = RadioSettingValueList(options, options[_mex[mx].ex003])
            sx = my_labels(3)
            rset = RadioSetting("exset.ex003/%d" % mx, sx, rx)
            rset.set_apply_callback(my_val_list, options, _mex, "ex003", 0, mx)
            if mx == 0:
                mena.append(rset)
            else:
                menb.append(rset)

            rx = RadioSettingValueBoolean(bool(_mex[mx].ex007))
            sx = my_labels(7)
            rset = RadioSetting("exset.ex007/%d" % mx, sx, rx)
            rset.set_apply_callback(my_bool, _mex, "ex007", mx)
            if mx == 0:
                mena.append(rset)
            else:
                menb.append(rset)

            rx = RadioSettingValueBoolean(bool(_mex[mx].ex008))
            sx = my_labels(8)
            rset = RadioSetting("exset.ex008/%d" % mx, sx, rx)
            rset.set_apply_callback(my_bool, _mex, "ex008", mx)
            if mx == 0:
                mena.append(rset)
            else:
                menb.append(rset)

            options = ["100", "200", "300", "400", "500"]
            rx = RadioSettingValueList(options, options[_mex[mx].ex009])
            sx = my_labels(9)
            rset = RadioSetting("exset.ex009/%d" % mx, sx, rx)
            rset.set_apply_callback(my_val_list, options, _mex, "ex009", 0, mx)
            if mx == 0:
                mena.append(rset)
            else:
                menb.append(rset)

            rx = RadioSettingValueBoolean(bool(_mex[mx].ex010))
            sx = my_labels(10)
            rset = RadioSetting("exset.ex010/%d" % mx, sx, rx)
            rset.set_apply_callback(my_bool, _mex, "ex010", mx)
            if mx == 0:
                mena.append(rset)
            else:
                menb.append(rset)

            options = ["TO", "CO"]
            rx = RadioSettingValueList(options, options[_mex[mx].ex011])
            sx = my_labels(11)
            rset = RadioSetting("exset.ex011/%d" % mx, sx, rx)
            rset.set_apply_callback(my_val_list, options, _mex, "ex011", 0, mx)
            if mx == 0:
                mena.append(rset)
            else:
                menb.append(rset)

            rx = RadioSettingValueBoolean(bool(_mex[mx].ex021))
            sx = my_labels(21)
            rset = RadioSetting("exset.ex021/%d" % mx, sx, rx)
            rset.set_apply_callback(my_bool, _mex, "ex021", mx)
            if mx == 0:
                mena.append(rset)
            else:
                menb.append(rset)

            options = ["Off", "3", "5", "10", "20", "30"]
            rx = RadioSettingValueList(options, options[_mex[mx].ex022])
            sx = my_labels(22)
            rset = RadioSetting("exset.ex022/%d" % mx, sx, rx)
            rset.set_apply_callback(my_val_list, options, _mex, "ex022", 0, mx)
            if mx == 0:
                mena.append(rset)
            else:
                menb.append(rset)

            rx = RadioSettingValueInteger(0, 99, _mex[mx].ex048)
            sx = my_labels(48)
            rset = RadioSetting("exset.ex048/%d" % mx, sx, rx)
            rset.set_apply_callback(my_fnctns, _mex, mx, "ex048")
            if mx == 0:
                mena.append(rset)
            else:
                menb.append(rset)

            rx = RadioSettingValueInteger(0, 99, _mex[mx].ex049)
            sx = my_labels(49)
            rset = RadioSetting("exset.ex049/%d" % mx, sx, rx)
            rset.set_apply_callback(my_fnctns, _mex, mx, "ex049")
            if mx == 0:
                mena.append(rset)
            else:
                menb.append(rset)

            rx = RadioSettingValueInteger(0, 99, _mex[mx].ex050)
            sx = my_labels(50)
            rset = RadioSetting("exset.ex050/%d" % mx, sx, rx)
            rset.set_apply_callback(my_fnctns, _mex, mx, "ex050")
            if mx == 0:
                mena.append(rset)
            else:
                menb.append(rset)

            rx = RadioSettingValueInteger(0, 99, _mex[mx].ex051)
            sx = my_labels(51)
            rset = RadioSetting("exset.ex051/%d" % mx, sx, rx)
            rset.set_apply_callback(my_fnctns, _mex, mx, "ex051")
            if mx == 0:
                mena.append(rset)
            else:
                menb.append(rset)

            rx = RadioSettingValueInteger(0, 99, _mex[mx].ex052)
            sx = my_labels(52)
            rset = RadioSetting("exset.ex052/%d" % mx, sx, rx)
            rset.set_apply_callback(my_fnctns, _mex, mx, "ex052")
            if mx == 0:
                mena.append(rset)
            else:
                menb.append(rset)
        # End of for mx loop

        # ==== Auto Scan Params (amode) ==============
        for ix in range(32):
            val = _asf[ix].asfreq / mhz1
            rx = RadioSettingValueFloat(0.03, 60.0, val, 0.001, 3)
            rset = RadioSetting("asf.asfreq/%d" % ix,
                                "Scan %02i Freq (MHz)" % ix, rx)
            rset.set_apply_callback(my_mhz_val, _asf, "asfreq", ix)
            amode.append(rset)

            mx = _asf[ix].asmode - 1  # Same logic as xmode
            if _asf[ix].asmode == 9:
                mx = 7
            rx = RadioSettingValueList(TS480_MODES, TS480_MODES[mx])
            rset = RadioSetting("asf.asmode/%d" % ix, "   Mode", rx)
            rset.set_apply_callback(my_asf_mode, _asf, ix)
            amode.append(rset)

        # ==== Slow Scan Settings ===
        for ix in range(10):  # Chans
            for nx in range(5):  # spots
                px = ((ix * 5) + nx)
                val = _ssf[px].ssfreq / mhz1
                stx = "      -   -   -    Slot %02i Freq (MHz)" % nx
                if nx == 0:
                    stx = "Slow Scan %02i, Slot 0 Freq (MHz" % ix
                rx = RadioSettingValueFloat(0, 54.0, val, 0.001, 3)
                rset = RadioSetting("ssf.ssfreq/%d" % px, stx, rx)
                rset.set_apply_callback(my_mhz_val, _ssf, "ssfreq", px)
                ssc.append(rset)

        return group  # END get_settings()
Exemplo n.º 25
0
Arquivo: ft857.py Projeto: cl4u2/chirp
    def get_settings(self):
        _settings = self._memobj.settings
        basic = RadioSettingGroup("basic", "Basic")
        cw = RadioSettingGroup("cw", "CW")
        packet = RadioSettingGroup("packet", "Digital & packet")
        panel = RadioSettingGroup("panel", "Panel settings")
        extended = RadioSettingGroup("extended", "Extended")
        panelcontr = RadioSettingGroup("panelcontr", "Panel controls")
        top = RadioSettingGroup("top", "All Settings", basic, cw, packet,
                                panelcontr, panel, extended)

        rs = RadioSetting("extended_menu", "Extended menu",
                          RadioSettingValueBoolean(_settings.extended_menu))
        extended.append(rs)
        rs = RadioSetting("ars_144", "144MHz ARS",
                          RadioSettingValueBoolean(_settings.ars_144))
        basic.append(rs)
        rs = RadioSetting("ars_430", "430MHz ARS",
                          RadioSettingValueBoolean(_settings.ars_430))
        basic.append(rs)
        options = ["enable", "disable"]
        rs = RadioSetting("disable_amfm_dial", "AM&FM Dial",
                          RadioSettingValueList(options,
                                        options[_settings.disable_amfm_dial]))
        panel.append(rs)
        rs = RadioSetting("am_mic", "AM mic gain",
                          RadioSettingValueInteger(0, 100, _settings.am_mic))
        basic.append(rs)
        options = ["OFF", "1h", "2h", "3h", "4h", "5h", "6h"]
        rs = RadioSetting("apo_time", "APO time",
                          RadioSettingValueList(options,
                                        options[_settings.apo_time]))
        basic.append(rs)
        options = ["OFF", "Range", "All"]
        rs = RadioSetting("arts_beep", "ARTS beep",
                          RadioSettingValueList(options,
                                        options[_settings.arts_beep]))
        basic.append(rs)
        rs = RadioSetting("arts_id", "ARTS ID",
                          RadioSettingValueBoolean(_settings.arts_id))
        extended.append(rs)
        s = RadioSettingValueString(0, 10, 
                            ''.join([self._CALLSIGN_CHARSET[x] for x in 
                                        self._memobj.arts_idw]))
        s.set_charset(self._CALLSIGN_CHARSET)
        rs = RadioSetting("arts_idw", "ARTS IDW", s)
        extended.append(rs)
        s = RadioSettingValueString(0, 40, 
                            ''.join([self._BEACON_CHARSET[x] for x in 
                                        self._memobj.beacon_text1]))
        s.set_charset(self._BEACON_CHARSET)
        rs = RadioSetting("beacon_text1", "Beacon text1", s)
        extended.append(rs)
        s = RadioSettingValueString(0, 40, 
                            ''.join([self._BEACON_CHARSET[x] for x in 
                                        self._memobj.beacon_text2]))
        s.set_charset(self._BEACON_CHARSET)
        rs = RadioSetting("beacon_text2", "Beacon text2", s)
        extended.append(rs)
        s = RadioSettingValueString(0, 40, 
                            ''.join([self._BEACON_CHARSET[x] for x in 
                                        self._memobj.beacon_text3]))
        s.set_charset(self._BEACON_CHARSET)
        rs = RadioSetting("beacon_text3", "Beacon text3", s)
        extended.append(rs)
        options = ["OFF"]+["%i sec" % i for i in range(1,256)]
        rs = RadioSetting("beacon_time", "Beacon time",
                          RadioSettingValueList(options,
                                        options[_settings.beacon_time]))
        extended.append(rs)
        options = ["440Hz", "880Hz", "1760Hz"]
        rs = RadioSetting("beep_tone", "Beep tone",
                          RadioSettingValueList(options,
                                        options[_settings.beep_tone]))
        panel.append(rs)
        rs = RadioSetting("beep_vol", "Beep volume",
                          RadioSettingValueInteger(0, 100, _settings.beep_vol))
        panel.append(rs)
        rs = RadioSetting("r_lsb_car", "LSB Rx carrier point (*10 Hz)",
                          RadioSettingValueInteger(-30, 30, _settings.r_lsb_car))
        extended.append(rs)
        rs = RadioSetting("r_usb_car", "USB Rx carrier point (*10 Hz)",
                          RadioSettingValueInteger(-30, 30, _settings.r_usb_car))
        extended.append(rs)
        rs = RadioSetting("t_lsb_car", "LSB Tx carrier point (*10 Hz)",
                          RadioSettingValueInteger(-30, 30, _settings.t_lsb_car))
        extended.append(rs)
        rs = RadioSetting("t_usb_car", "USB Tx carrier point (*10 Hz)",
                          RadioSettingValueInteger(-30, 30, _settings.t_usb_car))
        extended.append(rs)
        options = ["4800", "9600", "38400"]
        rs = RadioSetting("cat_rate", "CAT rate",
                          RadioSettingValueList(options,
                                        options[_settings.cat_rate]))
        basic.append(rs)
        options = ["CAT", "Linear", "Tuner"]
        rs = RadioSetting("cat_lin_tun", "CAT/LIN/TUN selection",
                          RadioSettingValueList(options,
                                        options[_settings.cat_lin_tun]))
        extended.append(rs)
        options = ["MAIN", "VFO/MEM", "CLAR"]   # TODO test the 3 options on non D radio
                                                # which have only SEL and MAIN
        rs = RadioSetting("clar_dial_sel", "Clarifier dial selection",
                          RadioSettingValueList(options,
                                        options[_settings.clar_dial_sel]))
        panel.append(rs)
        rs = RadioSetting("cw_auto_mode", "CW Automatic mode",
                          RadioSettingValueBoolean(_settings.cw_auto_mode))
        cw.append(rs)
        options = ["USB", "LSB", "AUTO"]
        rs = RadioSetting("cw_bfo", "CW BFO",
                          RadioSettingValueList(options,
                                        options[_settings.cw_bfo]))
        cw.append(rs)
        options = ["FULL"]+["%i ms" % (i*10) for i in range(3,301)]
        val = (_settings.cw_delay + _settings.cw_delay_hi * 256) - 2
        rs = RadioSetting("cw_delay", "CW delay",
                          RadioSettingValueList(options,
                                        options[val]))
        cw.append(rs)
        options = ["Normal", "Reverse"]
        rs = RadioSetting("cw_key_rev", "CW key reverse",
                          RadioSettingValueList(options,
                                        options[_settings.cw_key_rev]))
        cw.append(rs)
        rs = RadioSetting("cw_paddle", "CW paddle",
                          RadioSettingValueBoolean(_settings.cw_paddle))
        cw.append(rs)
        options = ["%i Hz" % i for i in range(400,801,100)]
        rs = RadioSetting("cw_pitch", "CW pitch",
                          RadioSettingValueList(options,
                                        options[_settings.cw_pitch]))
        cw.append(rs)
        options = ["%i ms" % i for i in range(5,31,5)]
        rs = RadioSetting("cw_qsk", "CW QSK",
                          RadioSettingValueList(options,
                                        options[_settings.cw_qsk]))
        cw.append(rs)
        rs = RadioSetting("cw_sidetone", "CW sidetone volume",
                          RadioSettingValueInteger(0, 100, _settings.cw_sidetone))
        cw.append(rs)
        options = ["%i wpm" % i for i in range(4,61)]
        rs = RadioSetting("cw_speed", "CW speed",
                          RadioSettingValueList(options,
                                        options[_settings.cw_speed]))
        cw.append(rs)
        options = ["Numeric", "Alphabet", "AlphaNumeric"]
        rs = RadioSetting("cw_training", "CW trainig",
                          RadioSettingValueList(options,
                                        options[_settings.cw_training]))
        cw.append(rs)
        options = ["1:%1.1f" % (i/10) for i in range(25,46,1)]
        rs = RadioSetting("cw_weight", "CW weight",
                          RadioSettingValueList(options,
                                        options[_settings.cw_weight]))
        cw.append(rs)
        options = ["Tn-Rn", "Tn-Riv", "Tiv-Rn", "Tiv-Riv"]
        rs = RadioSetting("dcs_inv", "DCS inv",
                          RadioSettingValueList(options,
                                        options[_settings.dcs_inv]))
        extended.append(rs)
        options = ["Fine", "Coarse"]
        rs = RadioSetting("dial_step", "Dial step",
                          RadioSettingValueList(options,
                                        options[_settings.dial_step]))
        panel.append(rs)
        rs = RadioSetting("dig_disp", "Dig disp (*10 Hz)",
                          RadioSettingValueInteger(-300, 300, _settings.dig_disp))
        packet.append(rs)
        rs = RadioSetting("dig_mic", "Dig gain",
                          RadioSettingValueInteger(0, 100, _settings.dig_mic))
        packet.append(rs)
        options = ["RTTYL", "RTTYU", "PSK31-L", "PSK31-U", "USER-L", "USER-U"]
        rs = RadioSetting("dig_mode", "Dig mode",
                          RadioSettingValueList(options,
                                        options[_settings.dig_mode]))
        packet.append(rs)
        rs = RadioSetting("dig_shift", "Dig shift (*10 Hz)",
                          RadioSettingValueInteger(-300, 300, _settings.dig_shift))
        packet.append(rs)
        rs = RadioSetting("dig_vox", "Dig vox",
                          RadioSettingValueInteger(0, 100, _settings.dig_vox))
        packet.append(rs)
        options = ["ARTS", "BAND", "FIX", "MEMGRP", "MODE", "MTR", "VFO"]
        rs = RadioSetting("disp_color", "Display color mode",
                          RadioSettingValueList(options,
                                        options[_settings.disp_color]))
        panel.append(rs)
        rs = RadioSetting("disp_color_arts", "Display color ARTS set",
                          RadioSettingValueInteger(0, 1,_settings.disp_color_arts))
        panel.append(rs)
        rs = RadioSetting("disp_color_band", "Display color band set",
                          RadioSettingValueInteger(0, 1,_settings.disp_color_band))
        panel.append(rs)
        rs = RadioSetting("disp_color_memgrp", "Display color memory group set",
                          RadioSettingValueInteger(0, 1,_settings.disp_color_memgrp))
        panel.append(rs)
        rs = RadioSetting("disp_color_mode", "Display color mode set",
                          RadioSettingValueInteger(0, 1,_settings.disp_color_mode))
        panel.append(rs)
        rs = RadioSetting("disp_color_mtr", "Display color meter set",
                          RadioSettingValueInteger(0, 1,_settings.disp_color_mtr))
        panel.append(rs)
        rs = RadioSetting("disp_color_vfo", "Display color VFO set",
                          RadioSettingValueInteger(0, 1,_settings.disp_color_vfo))
        panel.append(rs)
        rs = RadioSetting("disp_color_fix", "Display color fix set",
                          RadioSettingValueInteger(1, 32,_settings.disp_color_fix+1)) 
        panel.append(rs)
        rs = RadioSetting("disp_contrast", "Contrast",
                          RadioSettingValueInteger(3, 15,_settings.disp_contrast+2))
        panel.append(rs)
        rs = RadioSetting("disp_intensity", "Intensity",
                          RadioSettingValueInteger(1, 3,_settings.disp_intensity))
        panel.append(rs)
        options = ["OFF", "Auto1", "Auto2", "ON"]
        rs = RadioSetting("disp_mode", "Display backlight mode",
                          RadioSettingValueList(options,
                                        options[_settings.disp_mode]))
        panel.append(rs)
        options = ["60Hz", "120Hz", "240Hz"]
        rs = RadioSetting("dsp_bpf", "Dsp band pass filter",
                          RadioSettingValueList(options,
                                        options[_settings.dsp_bpf]))
        cw.append(rs)
        options = ["100Hz", "160Hz", "220Hz", "280Hz", "340Hz", "400Hz", "460Hz", "520Hz",
            "580Hz", "640Hz", "720Hz", "760Hz", "820Hz", "880Hz", "940Hz", "1000Hz"]
        rs = RadioSetting("dsp_hpf", "Dsp hi pass filter cut off",
                          RadioSettingValueList(options,
                                        options[_settings.dsp_hpf]))
        basic.append(rs)
        options = ["1000Hz", "1160Hz", "1320Hz", "1480Hz", "1650Hz", "1800Hz", "1970Hz", "2130Hz",
            "2290Hz", "2450Hz", "2610Hz", "2770Hz", "2940Hz", "3100Hz", "3260Hz", "3420Hz",
            "3580Hz", "3740Hz", "3900Hz", "4060Hz", "4230Hz", "4390Hz", "4550Hz", "4710Hz",
            "4870Hz", "5030Hz", "5190Hz", "5390Hz", "5520Hz", "5680Hz", "5840Hz", "6000Hz"]
        rs = RadioSetting("dsp_lpf", "Dsp low pass filter cut off",
                          RadioSettingValueList(options,
                                        options[_settings.dsp_lpf]))
        basic.append(rs)
        options = ["OFF", "LPF", "HPF", "BOTH"]
        rs = RadioSetting("dsp_mic_eq", "Dsp mic equalization",
                          RadioSettingValueList(options,
                                        options[_settings.dsp_mic_eq]))
        basic.append(rs)
        rs = RadioSetting("dsp_nr", "DSP noise reduction level",
                          RadioSettingValueInteger(1, 16, _settings.dsp_nr+1))
        basic.append(rs)
        # emergency only for US model
        rs = RadioSetting("fm_mic", "FM mic gain",
                          RadioSettingValueInteger(0, 100, _settings.fm_mic))
        basic.append(rs)
        rs = RadioSetting("home_vfo", "Enable HOME to VFO moving",
                          RadioSettingValueBoolean(_settings.home_vfo))
        panel.append(rs)
        options = ["Dial", "Freq", "Panel", "All"]
        rs = RadioSetting("lock_mode", "Lock mode",
                          RadioSettingValueList(options,
                                        options[_settings.lock_mode]))
        panel.append(rs)
        rs = RadioSetting("mem_group", "Mem group",
                          RadioSettingValueBoolean(_settings.mem_group))
        basic.append(rs)
        options = ["CW SIDETONE", "CW SPEED", "MHz/MEM GRP", "MIC GAIN",
            "NB LEVEL", "RF POWER", "STEP"]
        rs = RadioSetting("mem_vfo_dial_mode", "Mem/VFO dial mode",
                          RadioSettingValueList(options,
                                        options[_settings.mem_vfo_dial_mode]))
        panel.append(rs)
        rs = RadioSetting("mic_scan", "Mic scan",
                          RadioSettingValueBoolean(_settings.mic_scan))
        basic.append(rs)
        options = ["NOR", "RMT", "CAT"]
        rs = RadioSetting("mic_sel", "Mic selection",
                          RadioSettingValueList(options,
                                        options[_settings.mic_sel]))
        extended.append(rs)
        options = ["SIG", "CTR", "VLT", "N/A", "FS",  "OFF"]
        rs = RadioSetting("mtr_arx_sel", "Meter receive selection",
                          RadioSettingValueList(options,
                                        options[_settings.mtr_arx_sel]))
        extended.append(rs)
        options = ["PWR", "ALC", "MOD", "SWR", "VLT", "N/A", "OFF"]
        rs = RadioSetting("mtr_atx_sel", "Meter transmit selection",
                          RadioSettingValueList(options,
                                        options[_settings.mtr_atx_sel]))
        extended.append(rs)
        rs = RadioSetting("mtr_peak_hold", "Meter peak hold",
                          RadioSettingValueBoolean(_settings.mtr_peak_hold))
        extended.append(rs)
        rs = RadioSetting("nb_level", "Noise blanking level",
                          RadioSettingValueInteger(0, 100, _settings.nb_level))
        basic.append(rs)
        s = RadioSettingValueString(0, 4, 
                            ''.join([self._CALLSIGN_CHARSET[x] for x in 
                                        self._memobj.op_filter1_name]))
        s.set_charset(self._CALLSIGN_CHARSET)
        rs = RadioSetting("op_filter1_name", "Optional filter1 name", s)
        extended.append(rs)
        s = RadioSettingValueString(0, 4, 
                            ''.join([self._CALLSIGN_CHARSET[x] for x in 
                                        self._memobj.op_filter2_name]))
        s.set_charset(self._CALLSIGN_CHARSET)
        rs = RadioSetting("op_filter2_name", "Optional filter2 name", s)
        extended.append(rs)
        rs = RadioSetting("pg_a", "Programmable key MFq:A",
                          RadioSettingValueList(self.PROGRAMMABLEOPTIONS,
                                        self.PROGRAMMABLEOPTIONS[_settings.pg_a]))
        extended.append(rs)
        rs = RadioSetting("pg_b", "Programmable key MFq:B",
                          RadioSettingValueList(self.PROGRAMMABLEOPTIONS,
                                        self.PROGRAMMABLEOPTIONS[_settings.pg_b]))
        extended.append(rs)
        rs = RadioSetting("pg_c", "Programmable key MFq:C",
                          RadioSettingValueList(self.PROGRAMMABLEOPTIONS,
                                        self.PROGRAMMABLEOPTIONS[_settings.pg_c]))
        extended.append(rs)
        rs = RadioSetting("pg_acc", "Programmable mic key ACC",
                          RadioSettingValueList(self.PROGRAMMABLEOPTIONS,
                                        self.PROGRAMMABLEOPTIONS[_settings.pg_acc]))
        extended.append(rs)
        rs = RadioSetting("pg_p1", "Programmable mic key P1",
                          RadioSettingValueList(self.PROGRAMMABLEOPTIONS,
                                        self.PROGRAMMABLEOPTIONS[_settings.pg_p1]))
        extended.append(rs)
        rs = RadioSetting("pg_p2", "Programmable mic key P2",
                          RadioSettingValueList(self.PROGRAMMABLEOPTIONS,
                                        self.PROGRAMMABLEOPTIONS[_settings.pg_p2]))
        extended.append(rs)
        rs = RadioSetting("pkt1200", "Packet 1200 gain level",
                          RadioSettingValueInteger(0, 100, _settings.pkt1200))
        packet.append(rs)
        rs = RadioSetting("pkt9600", "Packet 9600 gain level",
                          RadioSettingValueInteger(0, 100, _settings.pkt9600))
        packet.append(rs)
        options = ["1200", "9600"]
        rs = RadioSetting("pkt_rate", "Packet rate",
                          RadioSettingValueList(options,
                                        options[_settings.pkt_rate]))
        packet.append(rs)
        rs = RadioSetting("proc_level", "Proc level",
                          RadioSettingValueInteger(0, 100, _settings.proc_level))
        basic.append(rs)
        rs = RadioSetting("rf_power_hf", "Rf power set HF",
                          RadioSettingValueInteger(5, 100, _settings.rf_power_hf))
        basic.append(rs)
        rs = RadioSetting("rf_power_6m", "Rf power set 6m",
                          RadioSettingValueInteger(5, 100, _settings.rf_power_6m))
        basic.append(rs)
        rs = RadioSetting("rf_power_vhf", "Rf power set VHF",
                          RadioSettingValueInteger(5, 50, _settings.rf_power_vhf))
        basic.append(rs)
        rs = RadioSetting("rf_power_uhf", "Rf power set UHF",
                          RadioSettingValueInteger(2, 20, _settings.rf_power_uhf))
        basic.append(rs)
        options = ["TIME", "BUSY", "STOP"]
        rs = RadioSetting("scan_mode", "Scan mode",
                          RadioSettingValueList(options,
                                        options[_settings.scan_mode]))
        basic.append(rs)
        rs = RadioSetting("scan_resume", "Scan resume",
                          RadioSettingValueInteger(1, 10, _settings.scan_resume))
        basic.append(rs)
        rs = RadioSetting("split_tone", "Split tone enable",
                          RadioSettingValueBoolean(_settings.split_tone))
        extended.append(rs)
        options = ["RF-Gain", "Squelch"]
        rs = RadioSetting("sql_rf_gain", "Squelch/RF-Gain",
                          RadioSettingValueList(options,
                                        options[_settings.sql_rf_gain]))
        panel.append(rs)
        rs = RadioSetting("ssb_mic", "SSB Mic gain",
                          RadioSettingValueInteger(0, 100, _settings.ssb_mic))
        basic.append(rs)
        options = ["Off"]+["%i" % i for i in range(1, 21)]
        rs = RadioSetting("tot_time", "Time-out timer",
                          RadioSettingValueList(options,
                                        options[_settings.tot_time]))
        basic.append(rs)
        options = ["OFF", "ATAS(HF)", "ATAS(HF&50)", "ATAS(ALL)", "TUNER"]
        rs = RadioSetting("tuner_atas", "Tuner/ATAS device",
                          RadioSettingValueList(options,
                                        options[_settings.tuner_atas]))
        extended.append(rs)
        rs = RadioSetting("tx_if_filter", "Transmit IF filter",
                          RadioSettingValueList(self.FILTERS,
                                        self.FILTERS[_settings.tx_if_filter]))
        basic.append(rs)
        rs = RadioSetting("vox_delay", "VOX delay (*100 ms)",
                          RadioSettingValueInteger(1, 30, _settings.vox_delay))
        basic.append(rs)
        rs = RadioSetting("vox_gain", "VOX Gain",
                          RadioSettingValueInteger(1, 100, _settings.vox_gain))
        basic.append(rs)
        rs = RadioSetting("xvtr_a", "Xvtr A displacement",
                          RadioSettingValueInteger(-4294967295, 4294967295, self._memobj.xvtr_a_offset * (-1 if _settings.xvtr_a_negative else 1)))
        extended.append(rs)
        rs = RadioSetting("xvtr_b", "Xvtr B displacement",
                          RadioSettingValueInteger(-4294967295, 4294967295, self._memobj.xvtr_b_offset * (-1 if _settings.xvtr_b_negative else 1)))
        extended.append(rs)
        options = ["OFF", "XVTR A", "XVTR B"]
        rs = RadioSetting("xvtr_sel", "Transverter function selection",
                          RadioSettingValueList(options,
                                        options[_settings.xvtr_sel]))
        extended.append(rs)
        
        rs = RadioSetting("disp", "Display large",
                          RadioSettingValueBoolean(_settings.disp))
        panel.append(rs)
        rs = RadioSetting("nb", "Noise blanker",
                          RadioSettingValueBoolean(_settings.nb))
        panelcontr.append(rs)
        options = ["Auto", "Fast", "Slow", "Off"]
        rs = RadioSetting("agc", "AGC",
                          RadioSettingValueList(options,
                                        options[_settings.agc]))
        panelcontr.append(rs)
        options = ["PWR", "ALC", "SWR", "MOD"]
        rs = RadioSetting("pwr_meter_mode", "Power meter mode",
                          RadioSettingValueList(options,
                                        options[_settings.pwr_meter_mode]))
        panelcontr.append(rs)
        rs = RadioSetting("vox", "Vox",
                          RadioSettingValueBoolean(_settings.vox))
        panelcontr.append(rs)
        rs = RadioSetting("bk", "Semi break-in",
                          RadioSettingValueBoolean(_settings.bk))
        cw.append(rs)
        rs = RadioSetting("kyr", "Keyer",
                          RadioSettingValueBoolean(_settings.kyr))
        cw.append(rs)
        options = ["enabled", "disabled"]
        rs = RadioSetting("fst", "Fast",
                          RadioSettingValueList(options,
                                        options[_settings.fst]))
        panelcontr.append(rs)
        options = ["enabled", "disabled"]
        rs = RadioSetting("lock", "Lock",
                          RadioSettingValueList(options,
                                        options[_settings.lock]))
        panelcontr.append(rs)
        rs = RadioSetting("scope_peakhold", "Scope max hold",
                          RadioSettingValueBoolean(_settings.scope_peakhold))
        panelcontr.append(rs)
        options = ["21", "31", "127"]
        rs = RadioSetting("scope_width", "Scope width (channels)",
                          RadioSettingValueList(options,
                                        options[_settings.scope_width]))
        panelcontr.append(rs)
        rs = RadioSetting("proc", "Speech processor",
                          RadioSettingValueBoolean(_settings.proc))
        panelcontr.append(rs)
        
        return top
Exemplo n.º 26
0
    def _get_settings(self):
        _settings = self._memobj.settings
        _freqrange = self._memobj.freqrange
        _slabel = self._memobj.slabel

        basic = RadioSettingGroup("basic","Global Settings")
        freqrange = RadioSettingGroup("freqrange","Frequency Ranges")
        top = RadioSettingGroup("top","All Settings",basic,freqrange)
        settings = RadioSettings(top)

        def _filter(name):
            filtered = ""
            for char in str(name):
                if char in chirp_common.CHARSET_ASCII:
                    filtered += char
                else:
                    filtered += ""
            return filtered
                   
        val = RadioSettingValueString(0,7,_filter(_slabel.startname))
        rs = RadioSetting("startname","Startup Label",val)
        basic.append(rs)

        rs = RadioSetting("bg_color","LCD Color",
                           RadioSettingValueList(BGCOLOR_LIST, BGCOLOR_LIST[_settings.bg_color]))
        basic.append(rs)

        rs = RadioSetting("bg_brightness","LCD Brightness",
                           RadioSettingValueList(BGBRIGHT_LIST, BGBRIGHT_LIST[_settings.bg_brightness]))
        basic.append(rs)

        rs = RadioSetting("squelch","Squelch Level",
                           RadioSettingValueList(SQUELCH_LIST, SQUELCH_LIST[_settings.squelch]))
        basic.append(rs)

        rs = RadioSetting("timeout_timer","Timeout Timer (TOT)",
                           RadioSettingValueList(TIMEOUT_LIST, TIMEOUT_LIST[_settings.timeout_timer]))
        basic.append(rs)

        rs = RadioSetting("auto_power_off","Auto Power Off (APO)",
                           RadioSettingValueList(APO_LIST, APO_LIST[_settings.auto_power_off]))
        basic.append(rs)

        rs = RadioSetting("voice_prompt","Beep Prompt",
                           RadioSettingValueList(BEEP_LIST, BEEP_LIST[_settings.voice_prompt]))
        basic.append(rs)

        rs = RadioSetting("tbst_freq","Tone Burst Frequency",
                           RadioSettingValueList(TBSTFREQ_LIST, TBSTFREQ_LIST[_settings.tbst_freq]))
        basic.append(rs)

        rs = RadioSetting("choose_tx_power","Max Level of TX Power",
                           RadioSettingValueList(TXPWR_LIST, TXPWR_LIST[_settings.choose_tx_power]))
        basic.append(rs)

        (flow,fhigh)  = self.valid_freq[0]
        flow  /= 1000
        fhigh /= 1000
        fmidrange = (fhigh- flow)/2

        rs = RadioSetting("txrangelow","TX Freq, Lower Limit (khz)", RadioSettingValueInteger(flow,
            flow + fmidrange,
            int(_freqrange.txrangelow)/10))
        freqrange.append(rs)

        rs = RadioSetting("txrangehi","TX Freq, Upper Limit (khz)", RadioSettingValueInteger(fhigh-fmidrange,
            fhigh,
            int(_freqrange.txrangehi)/10))
        freqrange.append(rs)

        rs = RadioSetting("rxrangelow","RX Freq, Lower Limit (khz)", RadioSettingValueInteger(flow,
            flow+fmidrange,
            int(_freqrange.rxrangelow)/10))
        freqrange.append(rs)

        rs = RadioSetting("rxrangehi","RX Freq, Upper Limit (khz)", RadioSettingValueInteger(fhigh-fmidrange,
            fhigh,
            int(_freqrange.rxrangehi)/10))
        freqrange.append(rs)

        return settings
Exemplo n.º 27
0
Arquivo: vx2.py Projeto: cl4u2/chirp
    def get_settings(self):
        _settings = self._memobj.settings
        basic = RadioSettingGroup("basic", "Basic")
        dtmf = RadioSettingGroup("dtmf", "DTMF")
        arts = RadioSettingGroup("arts", "ARTS")
        top = RadioSettingGroup("top", "All Settings", basic, arts, dtmf)

        options = [ "off", "30m", "1h", "3h", "5h", "8h" ]
        rs = RadioSetting("apo", "APO time (hrs)",
                          RadioSettingValueList(options,
                                        options[_settings.apo]))
        basic.append(rs)
        
        rs = RadioSetting("ars", "Auto Repeater Shift",
                        RadioSettingValueBoolean(_settings.ars))
        basic.append(rs)
        
        rs = RadioSetting("att", "Attenuation",
                        RadioSettingValueBoolean(_settings.att))
        basic.append(rs)
        
        rs = RadioSetting("bclo", "Busy Channel Lockout",
                        RadioSettingValueBoolean(_settings.bclo))
        basic.append(rs)
                          
        rs = RadioSetting("beep", "Beep",
                        RadioSettingValueBoolean(_settings.beep))
        basic.append(rs)
        
        options = [ "off", "1", "3", "5", "8", "cont"]
        rs = RadioSetting("bell", "Bell",
                          RadioSettingValueList(options,
                                        options[_settings.bell]))
        basic.append(rs)                          
        
        rs = RadioSetting("busyled", "Busy LED",
                        RadioSettingValueBoolean(_settings.busyled))
        basic.append(rs)
        
        options = [ "5", "10", "50", "100" ]
        rs = RadioSetting("chcounter", "Channel Counter (MHz)",
                          RadioSettingValueList(options,
                                        options[_settings.chcounter]))
        basic.append(rs)
        
        rs = RadioSetting("dcsrev", "DCS Reverse",
                        RadioSettingValueBoolean(_settings.dcsrev))
        basic.append(rs)
        
        options = map(str, range(0,12+1))
        rs = RadioSetting("dimmer", "Dimmer",
                        RadioSettingValueList(options, options[_settings.dimmer]))
        basic.append(rs)
        
        rs = RadioSetting("edgebeep", "Edge Beep",
                        RadioSettingValueBoolean(_settings.edgebeep))
        basic.append(rs)
        
        options = [ "beep", "strobe", "bp+str", "beam", "bp+beam", "cw", "bp+cw" ]
        rs = RadioSetting("emergmode", "Emergency Mode",
                          RadioSettingValueList(options,
                                        options[_settings.emergmode]))
        basic.append(rs)
        
        options = ["Home", "Reverse"]
        rs = RadioSetting("hmrv", "HM/RV key",
                        RadioSettingValueList(options, options[_settings.hmrv]))
        basic.append(rs)
        
        options = ["My Menu", "Internet"]
        rs = RadioSetting("internet_key", "Internet key",
                        RadioSettingValueList(options, options[_settings.internet_key]))
        basic.append(rs)
        
        options = ["1 APO","2 AR BEP","3 AR INT","4 ARS","5 ATT","6 BCLO","7 BEEP","8 BELL",
            "9 BSYLED","10 CH CNT","11 CK SFT","12 CW ID","13 DC VLT","14 DCS CD","15 DCS RV",
            "16 DIMMER","17 DTMF","18 DTMF S","19 EDG BP","20 EMG S","21 HLFDEV","22 HM/RV",
            "23 INT MD","24 LAMP","25 LOCK","26 M/T-CL","27 MW MD","28 NAME","29 NM SET",
            "30 OPNMSG","31 RESUME","32 RF SQL","33 RPT","34 RX MD","35 RXSAVE","36 S SCH",
            "37 SCNLMP","38 SHIFT","39 SKIP","40 SPLIT","41 SQL","42 SQL TYP","43 STEP",
            "44 TN FRQ","45 TOT","46 TXSAVE","47 VFO MD", "48 TR SQL (JAPAN)", "48 WX ALT"]
        
        rs = RadioSetting("mymenu", "My Menu function",
                            RadioSettingValueList(options, options[_settings.mymenu - 9]))
        basic.append(rs)
        
        options = ["wires", "link"]
        rs = RadioSetting("internet_mode", "Internet mode",
                        RadioSettingValueList(options, options[_settings.internet_mode]))
        basic.append(rs)
        
        options = ["key", "cont", "off"]
        rs = RadioSetting("lamp", "Lamp mode",
                        RadioSettingValueList(options, options[_settings.lamp]))
        basic.append(rs)
        
        options = ["key", "dial", "key+dial", "ptt", "key+ptt", "dial+ptt", "all"]
        rs = RadioSetting("lock", "Lock mode",
                        RadioSettingValueList(options, options[_settings.lock]))
        basic.append(rs)
        
        options = ["monitor", "tone call"]
        rs = RadioSetting("moni_tcall", "MONI key",
                        RadioSettingValueList(options, options[_settings.moni_tcall]))
        basic.append(rs)
        
        options = ["lower", "next"]
        rs = RadioSetting("mwmode", "Memory write mode",
                        RadioSettingValueList(options, options[_settings.mwmode]))
        basic.append(rs)
        
        options = map(str, range(0,15+1))
        rs = RadioSetting("nfm_sql", "NFM Sql",
                        RadioSettingValueList(options, options[_settings.nfm_sql]))
        basic.append(rs)
        
        options = map(str, range(0,8+1))
        rs = RadioSetting("wfm_sql", "WFM Sql",
                        RadioSettingValueList(options, options[_settings.wfm_sql]))
        basic.append(rs)
        
        options = ["off", "dc", "msg"]
        rs = RadioSetting("openmsgmode", "Opening message",
                        RadioSettingValueList(options, options[_settings.openmsgmode]))
        basic.append(rs)
        
        openmsg = RadioSettingValueString(0, 6, self._decode_chars(_settings.openmsg.get_value()))
        openmsg.set_charset(CHARSET)
        rs = RadioSetting("openmsg", "Opening Message", openmsg)
        basic.append(rs)        
                
        options = ["3s","5s","10s","busy","hold"]
        rs = RadioSetting("resume", "Resume",
                        RadioSettingValueList(options, options[_settings.resume]))
        basic.append(rs)
        
        options = ["off"] + map(str,range(1,9+1))
        rs = RadioSetting("rfsql", "RF Sql",
                 RadioSettingValueList(options,options[_settings.rfsql]))
        basic.append(rs)
        
        options = ["off","200ms","300ms","500ms","1s","2s"]
        rs = RadioSetting("rxsave", "RX pwr save",
                        RadioSettingValueList(options, options[_settings.rxsave]))
        basic.append(rs) 
         
        options = ["single","cont"]
        rs = RadioSetting("smartsearch", "Smart search",
                        RadioSettingValueList(options, options[_settings.smartsearch]))
        basic.append(rs)
        
        rs = RadioSetting("scan_lamp", "Scan lamp",
                        RadioSettingValueBoolean(_settings.scan_lamp))
        basic.append(rs)
        
        rs = RadioSetting("split", "Split",
                        RadioSettingValueBoolean(_settings.split))
        basic.append(rs)
        
        options = ["off","1","3","5","10"]
        rs = RadioSetting("tot", "TOT (mins)",
                        RadioSettingValueList(options, options[_settings.tot]))
        basic.append(rs)
        
        rs = RadioSetting("txsave", "TX pwr save",
                        RadioSettingValueBoolean(_settings.txsave))
        basic.append(rs)
        
        options = ["all", "band"]
        rs = RadioSetting("vfomode", "VFO mode",
                        RadioSettingValueList(options, options[_settings.vfomode]))
        basic.append(rs)
        
        rs = RadioSetting("wx_alert", "WX Alert",
                        RadioSettingValueBoolean(_settings.wx_alert))
        basic.append(rs)
        
        #todo: priority channel
        
        #todo: handle WX ch labels
        
        # arts settings (ar beep, ar int, cwid en, cwid field)
        options = ["15s", "25s"]
        rs = RadioSetting("artsinterval", "ARTS Interval",
                        RadioSettingValueList(options, options[_settings.artsinterval]))
        arts.append(rs)
        
        options = ["off", "in range", "always"]
        rs = RadioSetting("artsbeep", "ARTS Beep",
                        RadioSettingValueList(options, options[_settings.artsbeep]))
        arts.append(rs)
        
        rs = RadioSetting("cwid_en", "CWID Enable",
                        RadioSettingValueBoolean(_settings.cwid_en))
        arts.append(rs)
        
        cwid = RadioSettingValueString(0, 16, self._decode_chars(_settings.cwid.get_value()))
        cwid.set_charset(CHARSET)
        rs = RadioSetting("cwid", "CWID", cwid)
        arts.append(rs)
        
        # setup dtmf
        options = ["manual", "auto"]
        rs = RadioSetting("dtmfmode", "DTMF mode",
                        RadioSettingValueList(options, options[_settings.dtmfmode]))
        dtmf.append(rs)
        
        for i in range(0,8+1):
            name = "dtmf" + str(i+1)
            dtmfsetting = self._memobj.dtmf[i]
            #dtmflen = getattr(_settings, objname + "_len")
            dtmfstr = ""
            for c in dtmfsetting.digits:
                if c < len(DTMFCHARSET):
                    dtmfstr += DTMFCHARSET[c]
            if CHIRP_DEBUG:
                print dtmfstr
            dtmfentry = RadioSettingValueString(0, 16, dtmfstr)
            dtmfentry.set_charset(DTMFCHARSET + list(" "))
            rs = RadioSetting(name, name.upper(), dtmfentry)
            dtmf.append(rs)            
        
        return top
Exemplo n.º 28
0
    def get_settings(self):
        _msg = self._memobj.welcome_msg
        _oem = self._memobj.oem_info
        _settings = self._memobj.settings
        cfg_grp = RadioSettingGroup("cfg_grp", "Function Setup")
        oem_grp = RadioSettingGroup("oem_grp", "OEM Info")

        group = RadioSettings(cfg_grp,
                              oem_grp)

        def _filter(name):
            filtered = ""
            for char in str(name):
                if char in chirp_common.CHARSET_ASCII:
                    filtered += char
                else:
                    filtered += " "
            return filtered

        #
        # Function Setup
        #

        rs = RadioSetting("welcome_msg.line1", "Welcome Message 1",
                          RadioSettingValueString(
                              0, 6, _filter(_msg.line1)))
        cfg_grp.append(rs)

        rs = RadioSetting("welcome_msg.line2", "Welcome Message 2",
                          RadioSettingValueString(
                              0, 6, _filter(_msg.line2)))
        cfg_grp.append(rs)

        rs = RadioSetting("display", "Display Mode",
                          RadioSettingValueList(DISPLAY,
                                                DISPLAY[_settings.display]))
        cfg_grp.append(rs)

        rs = RadioSetting("upvfomr", "Up VFO/MR",
                          RadioSettingValueList(VFOMR,
                                                VFOMR[_settings.upvfomr]))
        cfg_grp.append(rs)

        rs = RadioSetting("dnvfomr", "Down VFO/MR",
                          RadioSettingValueList(VFOMR,
                                                VFOMR[_settings.dnvfomr]))
        cfg_grp.append(rs)

        rs = RadioSetting("upwork", "Up Work Mode",
                          RadioSettingValueList(WORKMODE,
                                                WORKMODE[_settings.upwork]))
        cfg_grp.append(rs)

        rs = RadioSetting("upmrbank", "Up MR Bank",
                          RadioSettingValueList(MRBANK,
                                                MRBANK[_settings.upmrbank]))
        cfg_grp.append(rs)

        rs = RadioSetting("upmrch", "Up MR Channel",
                          RadioSettingValueInteger(0, 200, _settings.upmrch))
        cfg_grp.append(rs)

        rs = RadioSetting("dnwork", "Down Work Mode",
                          RadioSettingValueList(WORKMODE,
                                                WORKMODE[_settings.dnwork]))
        cfg_grp.append(rs)

        rs = RadioSetting("dnmrbank", "Down MR Bank",
                          RadioSettingValueList(MRBANK,
                                                MRBANK[_settings.dnmrbank]))
        cfg_grp.append(rs)

        rs = RadioSetting("dnmrch", "Down MR Channel",
                          RadioSettingValueInteger(0, 200, _settings.dnmrch))
        cfg_grp.append(rs)

        rs = RadioSetting("main", "Main",
                          RadioSettingValueList(MAIN,
                                                MAIN[_settings.main]))
        cfg_grp.append(rs)

        rs = RadioSetting("pause", "Scan Pause Time",
                          RadioSettingValueList(PAUSE,
                                                PAUSE[_settings.pause]))
        cfg_grp.append(rs)

        rs = RadioSetting("stop", "Function Keys Stop Time",
                          RadioSettingValueList(STOP,
                                                STOP[_settings.stop]))
        cfg_grp.append(rs)

        rs = RadioSetting("backlight", "Backlight",
                          RadioSettingValueList(BACKLIGHT,
                                                BACKLIGHT[_settings.backlight]))
        cfg_grp.append(rs)

        rs = RadioSetting("color", "Backlight Color",
                          RadioSettingValueList(COLOR,
                                                COLOR[_settings.color]))
        cfg_grp.append(rs)

        rs = RadioSetting("vdisplay", "Vice-Machine Display",
                          RadioSettingValueList(VDISPLAY,
                                                VDISPLAY[_settings.vdisplay]))
        cfg_grp.append(rs)

        rs = RadioSetting("voxlevel", "Vox Level",
                          RadioSettingValueList(VOXLEVEL,
                                                VOXLEVEL[_settings.voxlevel]))
        cfg_grp.append(rs)

        rs = RadioSetting("voxdelay", "Vox Delay",
                          RadioSettingValueList(VOXDELAY,
                                                VOXDELAY[_settings.voxdelay]))
        cfg_grp.append(rs)

        rs = RadioSetting("tot", "Time Out Timer",
                          RadioSettingValueList(TOT,
                                                TOT[_settings.tot]))
        cfg_grp.append(rs)

        rs = RadioSetting("tbst", "Tone Burst",
                          RadioSettingValueList(TBST,
                                                TBST[_settings.tbst]))
        cfg_grp.append(rs)

        rs = RadioSetting("monikey", "MONI Key Function",
                          RadioSettingValueList(MONI,
                                                MONI[_settings.monikey]))
        cfg_grp.append(rs)

        if self.MODEL == "TERMN-8R":
            rs = RadioSetting("pf1key", "PF1 Key Function",
                              RadioSettingValueList(PFKEYT,
                                                    PFKEYT[_settings.pf1key]))
            cfg_grp.append(rs)

            rs = RadioSetting("pf2key", "PF2 Key Function",
                              RadioSettingValueList(PFKEYT,
                                                    PFKEYT[_settings.pf2key]))
            cfg_grp.append(rs)

        if self.MODEL == "OBLTR-8R":
            rs = RadioSetting("pf1key", "PF1 Key Function",
                              RadioSettingValueList(PFKEYO,
                                                    PFKEYO[_settings.pf1key]))
            cfg_grp.append(rs)

            rs = RadioSetting("fmam", "PF2 Key Function",
                              RadioSettingValueList(PFKEYO,
                                                    PFKEYO[_settings.fmam]))
            cfg_grp.append(rs)

        rs = RadioSetting("apo", "Automatic Power Off",
                          RadioSettingValueList(APO,
                                                APO[_settings.apo]))
        cfg_grp.append(rs)

        rs = RadioSetting("save", "Power Save",
                          RadioSettingValueList(SAVE,
                                                SAVE[_settings.save]))
        cfg_grp.append(rs)

        rs = RadioSetting("tail", "Tail Eliminator Type",
                          RadioSettingValueList(TAIL,
                                                TAIL[_settings.tail]))
        cfg_grp.append(rs)

        rs = RadioSetting("fmvfomr", "FM VFO/MR",
                          RadioSettingValueList(VFOMR,
                                                VFOMR[_settings.fmvfomr]))
        cfg_grp.append(rs)

        rs = RadioSetting("fmmrch", "FM MR Channel",
                          RadioSettingValueInteger(0, 100, _settings.fmmrch))
        cfg_grp.append(rs)

        rs = RadioSetting("noaa", "NOAA",
                          RadioSettingValueList(NOAA,
                                                NOAA[_settings.noaa]))
        cfg_grp.append(rs)

        rs = RadioSetting("noaach", "NOAA Channel",
                          RadioSettingValueList(NOAACH,
                                                NOAACH[_settings.noaach]))
        cfg_grp.append(rs)

        rs = RadioSetting("part95", "PART95",
                          RadioSettingValueList(PART95,
                                                PART95[_settings.part95]))
        cfg_grp.append(rs)

        rs = RadioSetting("gmrs", "GMRS",
                          RadioSettingValueList(GMRS,
                                                GMRS[_settings.gmrs]))
        cfg_grp.append(rs)

        rs = RadioSetting("murs", "MURS",
                          RadioSettingValueList(MURS,
                                                MURS[_settings.murs]))
        cfg_grp.append(rs)

        for i in range(0, 9):
            val = self._memobj.banklink[i].bank
            rs = RadioSetting("banklink/%i.bank" % i,
                              "Bank Link %i" % (i + 1),
                              RadioSettingValueBoolean(val))
            cfg_grp.append(rs)

        val = self._memobj.banklink[9].bank
        rs = RadioSetting("banklink/9.bank", "Bank Link 0",
                          RadioSettingValueBoolean(val))
        cfg_grp.append(rs)

        rs = RadioSetting("allband", "All Band",
                          RadioSettingValueBoolean(_settings.allband))
        cfg_grp.append(rs)

        rs = RadioSetting("alarmoff", "Alarm Function Off",
                          RadioSettingValueBoolean(_settings.alarmoff))
        cfg_grp.append(rs)

        rs = RadioSetting("beep", "Beep",
                          RadioSettingValueBoolean(_settings.beep))
        cfg_grp.append(rs)

        rs = RadioSetting("radio", "Radio",
                          RadioSettingValueBoolean(_settings.radio))
        cfg_grp.append(rs)

        if self.MODEL == "TERMN-8R":
            rs = RadioSetting("keylock", "Keylock",
                              RadioSettingValueBoolean(_settings.keylock))
            cfg_grp.append(rs)

            rs = RadioSetting("fastscan", "Fast Scan",
                              RadioSettingValueBoolean(_settings.fastscan))
            cfg_grp.append(rs)

        if self.MODEL == "OBLTR-8R":
            # "pf2key" is used for OBLTR-8R "keylock"
            rs = RadioSetting("pf2key", "Keylock",
                              RadioSettingValueBoolean(_settings.pf2key))
            cfg_grp.append(rs)

            rs = RadioSetting("fastscano", "Fast Scan",
                              RadioSettingValueBoolean(_settings.fastscano))
            cfg_grp.append(rs)

        rs = RadioSetting("uplink", "Up Bank Link Select",
                          RadioSettingValueBoolean(_settings.uplink))
        cfg_grp.append(rs)

        rs = RadioSetting("downlink", "Down Bank Link Select",
                          RadioSettingValueBoolean(_settings.downlink))
        cfg_grp.append(rs)

        #
        # OEM info
        #

        val = RadioSettingValueString(0, 7, _filter(_oem.model))
        val.set_mutable(False)
        rs = RadioSetting("oem_info.model", "Model", val)
        oem_grp.append(rs)

        val = RadioSettingValueString(0, 9, _filter(_oem.date))
        val.set_mutable(False)
        rs = RadioSetting("oem_info.date", "Date", val)
        oem_grp.append(rs)

        val = RadioSettingValueString(0, 16, _filter(_oem.dealer))
        val.set_mutable(False)
        rs = RadioSetting("oem_info.dealer", "Dealer Code", val)
        oem_grp.append(rs)

        val = RadioSettingValueString(0, 9, _filter(_oem.stockdate))
        val.set_mutable(False)
        rs = RadioSetting("oem_info.stockdate", "Stock Date", val)
        oem_grp.append(rs)

        val = RadioSettingValueString(0, 9, _filter(_oem.selldate))
        val.set_mutable(False)
        rs = RadioSetting("oem_info.selldate", "Sell Date", val)
        oem_grp.append(rs)

        return group
Exemplo n.º 29
0
    def _get_settings(self):
        _settings = self._memobj.settings
        _vfoa = self._memobj.vfoa
        _vfob = self._memobj.vfob
        cfg_grp = RadioSettingGroup("cfg_grp", "Configuration")
        vfoa_grp = RadioSettingGroup("vfoa_grp", "VFO A Settings")
        vfob_grp = RadioSettingGroup("vfob_grp", "VFO B Settings")
        key_grp = RadioSettingGroup("key_grp", "Key Settings")
        lmt_grp = RadioSettingGroup("lmt_grp", "Frequency Limits")
        uhf_lmt_grp = RadioSettingGroup("uhf_lmt_grp", "UHF")
        vhf_lmt_grp = RadioSettingGroup("vhf_lmt_grp", "VHF")
        vhf1_lmt_grp = RadioSettingGroup("vhf1_lmt_grp", "VHF1")
        oem_grp = RadioSettingGroup("oem_grp", "OEM Info")

        lmt_grp.append(vhf_lmt_grp);
        lmt_grp.append(vhf1_lmt_grp);
        lmt_grp.append(uhf_lmt_grp);
        group = RadioSettings(cfg_grp, vfoa_grp, vfob_grp,
                              key_grp, lmt_grp, oem_grp)

        #
        # Configuration Settings
        #
        rs = RadioSetting("channel_menu", "Menu available in channel mode",
                          RadioSettingValueBoolean(_settings.channel_menu))
        cfg_grp.append(rs)
        rs = RadioSetting("ponmsg", "Poweron message",
                          RadioSettingValueList(
                              PONMSG_LIST, PONMSG_LIST[_settings.ponmsg]))
        cfg_grp.append(rs)
        rs = RadioSetting("voice", "Voice Guide",
                          RadioSettingValueBoolean(_settings.voice))
        cfg_grp.append(rs)
        rs = RadioSetting("language", "Language",
                          RadioSettingValueList(LANGUAGE_LIST,
                                                LANGUAGE_LIST[_settings.
                                                              language]))
        cfg_grp.append(rs)
        rs = RadioSetting("timeout", "Timeout Timer",
                          RadioSettingValueList(
                              TIMEOUT_LIST, TIMEOUT_LIST[_settings.timeout]))
        cfg_grp.append(rs)
        rs = RadioSetting("toalarm", "Timeout Alarm",
                          RadioSettingValueInteger(0, 10, _settings.toalarm))
        cfg_grp.append(rs)
        rs = RadioSetting("roger_beep", "Roger Beep",
                          RadioSettingValueList(ROGER_LIST,
                                                ROGER_LIST[_settings.roger_beep]))
        cfg_grp.append(rs)
        rs = RadioSetting("power_save", "Power save",
                          RadioSettingValueBoolean(_settings.power_save))
        cfg_grp.append(rs)
        rs = RadioSetting("autolock", "Autolock",
                          RadioSettingValueBoolean(_settings.autolock))
        cfg_grp.append(rs)
        rs = RadioSetting("keylock", "Keypad Lock",
                          RadioSettingValueBoolean(_settings.keylock))
        cfg_grp.append(rs)
        rs = RadioSetting("beep", "Keypad Beep",
                          RadioSettingValueBoolean(_settings.beep))
        cfg_grp.append(rs)
        rs = RadioSetting("stopwatch", "Stopwatch",
                          RadioSettingValueBoolean(_settings.stopwatch))
        cfg_grp.append(rs)
        rs = RadioSetting("backlight", "Backlight",
                          RadioSettingValueList(BACKLIGHT_LIST,
                                                BACKLIGHT_LIST[_settings.
                                                               backlight]))
        cfg_grp.append(rs)
        rs = RadioSetting("dtmf_st", "DTMF Sidetone",
                          RadioSettingValueList(DTMFST_LIST,
                                                DTMFST_LIST[_settings.
                                                            dtmf_st]))
        cfg_grp.append(rs)
        rs = RadioSetting("ani_sw", "ANI-ID Switch",
                          RadioSettingValueBoolean(_settings.ani_sw))
        cfg_grp.append(rs)
        rs = RadioSetting("ptt_id", "PTT-ID Delay",
                          RadioSettingValueList(PTTID_LIST,
                                                PTTID_LIST[_settings.ptt_id]))
        cfg_grp.append(rs)
        rs = RadioSetting("ring_time", "Ring Time",
                          RadioSettingValueList(LIST_10,
                                                LIST_10[_settings.ring_time]))
        cfg_grp.append(rs)
        rs = RadioSetting("scan_rev", "Scan Mode",
                          RadioSettingValueList(SCANMODE_LIST,
                                                SCANMODE_LIST[_settings.
                                                              scan_rev]))
        cfg_grp.append(rs)
        rs = RadioSetting("vox", "VOX",
                          RadioSettingValueList(LIST_10,
                                                LIST_10[_settings.vox]))
        cfg_grp.append(rs)
        rs = RadioSetting("prich_sw", "Priority Channel Switch",
                          RadioSettingValueBoolean(_settings.prich_sw))
        cfg_grp.append(rs)
        rs = RadioSetting("pri_ch", "Priority Channel",
                          RadioSettingValueInteger(1, 999, _settings.pri_ch))
        cfg_grp.append(rs)
        rs = RadioSetting("rpt_mode", "Radio Mode",
                          RadioSettingValueList(RPTMODE_LIST,
                                                RPTMODE_LIST[_settings.
                                                             rpt_mode]))
        cfg_grp.append(rs)
        rs = RadioSetting("rpt_set", "Repeater Setting",
                          RadioSettingValueList(RPTSET_LIST,
                                                RPTSET_LIST[_settings.
                                                            rpt_set]))
        cfg_grp.append(rs)
        rs = RadioSetting("rpt_spk", "Repeater Mode Speaker",
                          RadioSettingValueBoolean(_settings.rpt_spk))
        cfg_grp.append(rs)
        rs = RadioSetting("rpt_ptt", "Repeater PTT",
                          RadioSettingValueBoolean(_settings.rpt_ptt))
        cfg_grp.append(rs)
        rs = RadioSetting("dtmf_tx_time", "DTMF Tx Duration",
                          RadioSettingValueList(DTMF_TIMES,
                                                DTMF_TIMES[_settings.
                                                           dtmf_tx_time]))
        cfg_grp.append(rs)
        rs = RadioSetting("dtmf_interval", "DTMF Interval",
                          RadioSettingValueList(DTMF_TIMES,
                                                DTMF_TIMES[_settings.
                                                           dtmf_interval]))
        cfg_grp.append(rs)
        rs = RadioSetting("alert", "Alert Tone",
                          RadioSettingValueList(ALERTS_LIST,
                                                ALERTS_LIST[_settings.alert]))
        cfg_grp.append(rs)
        rs = RadioSetting("rpt_tone", "Repeater Tone",
                          RadioSettingValueBoolean(_settings.rpt_tone))
        cfg_grp.append(rs)
        rs = RadioSetting("rpt_hold", "Repeater Hold Time",
                          RadioSettingValueList(HOLD_TIMES,
                                                HOLD_TIMES[_settings.
                                                           rpt_hold]))
        cfg_grp.append(rs)
        rs = RadioSetting("scan_det", "Scan DET",
                          RadioSettingValueBoolean(_settings.scan_det))
        cfg_grp.append(rs)
        rs = RadioSetting("sc_qt", "SC-QT",
                          RadioSettingValueList(SCQT_LIST,
                                                SCQT_LIST[_settings.sc_qt]))
        cfg_grp.append(rs)
        rs = RadioSetting("smuteset", "SubFreq Mute",
                          RadioSettingValueList(SMUTESET_LIST,
                                                SMUTESET_LIST[_settings.
                                                              smuteset]))
        cfg_grp.append(rs)

                #
        # VFO A Settings
        #
        rs = RadioSetting("workmode_a", "VFO A Workmode",
                          RadioSettingValueList(WORKMODE_LIST, WORKMODE_LIST[_settings.workmode_a]))
        vfoa_grp.append(rs)
        rs = RadioSetting("work_cha", "VFO A Channel",
                          RadioSettingValueInteger(1, 999, _settings.work_cha))
        vfoa_grp.append(rs)
        rs = RadioSetting("vfoa.rxfreq", "VFO A Rx Frequency",
                          RadioSettingValueInteger(
                              134000000, 520000000, _vfoa.rxfreq * 10, 5000))
        vfoa_grp.append(rs)
        rs = RadioSetting("vfoa.txoffset", "VFO A Tx Offset",
                          RadioSettingValueInteger(
                              0, 520000000, _vfoa.txoffset * 10, 5000))
        vfoa_grp.append(rs)
        #   u16   rxtone;
        #   u16   txtone;
        rs = RadioSetting("vfoa.power", "VFO A Power",
                          RadioSettingValueList(
                              POWER_LIST, POWER_LIST[_vfoa.power]))
        vfoa_grp.append(rs)
        #         shift_dir:2
        rs = RadioSetting("vfoa.iswide", "VFO A NBFM",
                          RadioSettingValueList(
                              BANDWIDTH_LIST, BANDWIDTH_LIST[_vfoa.iswide]))
        vfoa_grp.append(rs)
        rs = RadioSetting("vfoa.mute_mode", "VFO A Mute",
                          RadioSettingValueList(
                              SPMUTE_LIST, SPMUTE_LIST[_vfoa.mute_mode]))
        vfoa_grp.append(rs)
        rs = RadioSetting("vfoa.step", "VFO A Step (kHz)",
                          RadioSettingValueList(
                              STEP_LIST, STEP_LIST[_vfoa.step]))
        vfoa_grp.append(rs)
        rs = RadioSetting("vfoa.squelch", "VFO A Squelch",
                          RadioSettingValueList(
                              LIST_10, LIST_10[_vfoa.squelch]))
        vfoa_grp.append(rs)
        rs = RadioSetting("bcl_a", "Busy Channel Lock-out A",
                          RadioSettingValueBoolean(_settings.bcl_a))
        vfoa_grp.append(rs)

                #
        # VFO B Settings
        #
        rs = RadioSetting("workmode_b", "VFO B Workmode",
                          RadioSettingValueList(WORKMODE_LIST, WORKMODE_LIST[_settings.workmode_b]))
        vfob_grp.append(rs)
        rs = RadioSetting("work_chb", "VFO B Channel",
                          RadioSettingValueInteger(1, 999, _settings.work_chb))
        vfob_grp.append(rs)
        rs = RadioSetting("vfob.rxfreq", "VFO B Rx Frequency",
                          RadioSettingValueInteger(
                              134000000, 520000000, _vfob.rxfreq * 10, 5000))
        vfob_grp.append(rs)
        rs = RadioSetting("vfob.txoffset", "VFO B Tx Offset",
                          RadioSettingValueInteger(
                              0, 520000000, _vfob.txoffset * 10, 5000))
        vfob_grp.append(rs)
        #   u16   rxtone;
        #   u16   txtone;
        rs = RadioSetting("vfob.power", "VFO B Power",
                          RadioSettingValueList(
                              POWER_LIST, POWER_LIST[_vfob.power]))
        vfob_grp.append(rs)
        #         shift_dir:2
        rs = RadioSetting("vfob.iswide", "VFO B NBFM",
                          RadioSettingValueList(
                              BANDWIDTH_LIST, BANDWIDTH_LIST[_vfob.iswide]))
        vfob_grp.append(rs)
        rs = RadioSetting("vfob.mute_mode", "VFO B Mute",
                          RadioSettingValueList(
                              SPMUTE_LIST, SPMUTE_LIST[_vfob.mute_mode]))
        vfob_grp.append(rs)
        rs = RadioSetting("vfob.step", "VFO B Step (kHz)",
                          RadioSettingValueList(
                              STEP_LIST, STEP_LIST[_vfob.step]))
        vfob_grp.append(rs)
        rs = RadioSetting("vfob.squelch", "VFO B Squelch",
                          RadioSettingValueList(
                              LIST_10, LIST_10[_vfob.squelch]))
        vfob_grp.append(rs)
        rs = RadioSetting("bcl_b", "Busy Channel Lock-out B",
                          RadioSettingValueBoolean(_settings.bcl_b))
        vfob_grp.append(rs)

                #
        # Key Settings
        #
        _msg = str(_settings.dispstr).split("\0")[0]
        val = RadioSettingValueString(0, 15, _msg)
        val.set_mutable(True)
        rs = RadioSetting("dispstr", "Display Message", val)
        key_grp.append(rs)

        dtmfchars = "0123456789"
        _codeobj = _settings.ani_code
        _code = "".join([dtmfchars[x] for x in _codeobj if int(x) < 0x0A])
        val = RadioSettingValueString(3, 6, _code, False)
        val.set_charset(dtmfchars)
        rs = RadioSetting("ani_code", "ANI Code", val)
        def apply_ani_id(setting, obj):
            value = []
            for j in range(0, 6):
                try:
                    value.append(dtmfchars.index(str(setting.value)[j]))
                except IndexError:
                    value.append(0xFF)
            obj.ani_code = value
        rs.set_apply_callback(apply_ani_id, _settings)
        key_grp.append(rs)

        rs = RadioSetting("pf1_func", "PF1 Key function",
                          RadioSettingValueList(
                              PF1KEY_LIST,
                              PF1KEY_LIST[_settings.pf1_func]))
        key_grp.append(rs)
        rs = RadioSetting("pf3_func", "PF3 Key function",
                          RadioSettingValueList(
                              PF3KEY_LIST,
                              PF3KEY_LIST[_settings.pf3_func]))
        key_grp.append(rs)

        #
        # Limits settings
        #
        rs = RadioSetting("vhf_limits.rx_start", "VHF RX Lower Limit",
                          RadioSettingValueInteger(
                              134000000, 174997500,
                              self._memobj.vhf_limits.rx_start * 10, 5000))
        vhf_lmt_grp.append(rs)
        rs = RadioSetting("vhf_limits.rx_stop", "VHF RX Upper Limit",
                          RadioSettingValueInteger(
                              134000000, 174997500,
                              self._memobj.vhf_limits.rx_stop * 10, 5000))
        vhf_lmt_grp.append(rs)
        rs = RadioSetting("vhf_limits.tx_start", "VHF TX Lower Limit",
                          RadioSettingValueInteger(
                              134000000, 174997500,
                              self._memobj.vhf_limits.tx_start * 10, 5000))
        vhf_lmt_grp.append(rs)
        rs = RadioSetting("vhf_limits.tx_stop", "VHF TX Upper Limit",
                          RadioSettingValueInteger(
                              134000000, 174997500,
                              self._memobj.vhf_limits.tx_stop * 10, 5000))
        vhf_lmt_grp.append(rs)

        rs = RadioSetting("vhf1_limits.rx_start", "VHF1 RX Lower Limit",
                          RadioSettingValueInteger(
                              220000000, 265000000,
                              self._memobj.vhf1_limits.rx_start * 10, 5000))
        vhf1_lmt_grp.append(rs)
        rs = RadioSetting("vhf1_limits.rx_stop", "VHF1 RX Upper Limit",
                          RadioSettingValueInteger(
                              220000000, 265000000,
                              self._memobj.vhf1_limits.rx_stop * 10, 5000))
        vhf1_lmt_grp.append(rs)
        rs = RadioSetting("vhf1_limits.tx_start", "VHF1 TX Lower Limit",
                          RadioSettingValueInteger(
                              220000000, 265000000,
                              self._memobj.vhf1_limits.tx_start * 10, 5000))
        vhf1_lmt_grp.append(rs)
        rs = RadioSetting("vhf1_limits.tx_stop", "VHF1 TX Upper Limit",
                          RadioSettingValueInteger(
                              220000000, 265000000,
                              self._memobj.vhf1_limits.tx_stop * 10, 5000))
        vhf1_lmt_grp.append(rs)

        rs = RadioSetting("uhf_limits.rx_start", "UHF RX Lower Limit",
                          RadioSettingValueInteger(
                              400000000, 520000000,
                              self._memobj.uhf_limits.rx_start * 10, 5000))
        uhf_lmt_grp.append(rs)
        rs = RadioSetting("uhf_limits.rx_stop", "UHF RX Upper Limit",
                          RadioSettingValueInteger(
                              400000000, 520000000,
                              self._memobj.uhf_limits.rx_stop * 10, 5000))
        uhf_lmt_grp.append(rs)
        rs = RadioSetting("uhf_limits.tx_start", "UHF TX Lower Limit",
                          RadioSettingValueInteger(
                              400000000, 520000000,
                              self._memobj.uhf_limits.tx_start * 10, 5000))
        uhf_lmt_grp.append(rs)
        rs = RadioSetting("uhf_limits.tx_stop", "UHF TX Upper Limit",
                          RadioSettingValueInteger(
                              400000000, 520000000,
                              self._memobj.uhf_limits.tx_stop * 10, 5000))
        uhf_lmt_grp.append(rs)

        #
        # OEM info
        #
        def _decode(lst):
            _str = ''.join([chr(c) for c in lst
                            if chr(c) in chirp_common.CHARSET_ASCII])
            return _str

        def do_nothing(setting, obj):
            return

        _str = _decode(self._memobj.oem_info.model)
        val = RadioSettingValueString(0, 15, _str)
        val.set_mutable(False)
        rs = RadioSetting("oem_info.model", "Model", val)
        rs.set_apply_callback(do_nothing, _settings)
        oem_grp.append(rs)
        _str = _decode(self._memobj.oem_info.oem1)
        val = RadioSettingValueString(0, 15, _str)
        val.set_mutable(False)
        rs = RadioSetting("oem_info.oem1", "OEM String 1", val)
        rs.set_apply_callback(do_nothing, _settings)
        oem_grp.append(rs)
        _str = _decode(self._memobj.oem_info.oem2)
        val = RadioSettingValueString(0, 15, _str)
        val.set_mutable(False)
        rs = RadioSetting("oem_info.oem2", "OEM String 2", val)
        rs.set_apply_callback(do_nothing, _settings)
        oem_grp.append(rs)
        _str = _decode(self._memobj.oem_info.version)
        val = RadioSettingValueString(0, 15, _str)
        val.set_mutable(False)
        rs = RadioSetting("oem_info.version", "Software Version", val)
        rs.set_apply_callback(do_nothing, _settings)
        oem_grp.append(rs)
        _str = _decode(self._memobj.oem_info.date)
        val = RadioSettingValueString(0, 15, _str)
        val.set_mutable(False)
        rs = RadioSetting("oem_info.date", "OEM Date", val)
        rs.set_apply_callback(do_nothing, _settings)
        oem_grp.append(rs)

        return group
Exemplo n.º 30
0
    def get_settings(self):
        _settings = self._memobj.settings
        _dtmf_strings = self._memobj.dtmf_strings
        _passwd = self._memobj.passwd

        repeater = RadioSettingGroup("repeater", "Repeater Settings")
        ctcss = RadioSettingGroup("ctcss", "CTCSS/DCS/EPCS Settings")
        arts = RadioSettingGroup("arts", "ARTS Settings")
        mbls = RadioSettingGroup("banks", "Memory Settings")
        scan = RadioSettingGroup("scan", "Scan Settings")
        dtmf = RadioSettingGroup("dtmf", "DTMF Settings")
        wires = RadioSettingGroup("wires", "WiRES(tm) Settings")
        switch = RadioSettingGroup("switch", "Switch/Knob Settings")
        disp = RadioSettingGroup("disp", "Display Settings")
        misc = RadioSettingGroup("misc", "Miscellaneous Settings")

        setmode = RadioSettings(repeater, ctcss, arts, mbls, scan, dtmf, wires,
                                switch, disp, misc)

        # numbers and names of settings refer to the way they're
        # presented in the set menu, as well as the list starting on
        # page 74 of the manual

        # 1 APO
        opts = ["Off", "30 Min", "1 Hour", "3 Hour", "5 Hour", "8 Hour"]
        misc.append(
            RadioSetting("apo", "Automatic Power Off",
                         RadioSettingValueList(opts, opts[_settings.apo])))

        # 2 AR.BEP
        opts = ["Off", "In Range", "Always"]
        arts.append(
            RadioSetting(
                "arts_beep", "ARTS Beep",
                RadioSettingValueList(opts, opts[_settings.arts_beep])))

        # 3 AR.INT
        opts = ["15 Sec", "25 Sec"]
        arts.append(
            RadioSetting(
                "arts_interval", "ARTS Polling Interval",
                RadioSettingValueList(opts, opts[_settings.arts_interval])))

        # 4 ARS
        opts = ["Off", "On"]
        repeater.append(
            RadioSetting("ars", "Automatic Repeater Shift",
                         RadioSettingValueList(opts, opts[_settings.ars])))

        # 5 BCLO
        opts = ["Off", "On"]
        misc.append(
            RadioSetting(
                "busy_lockout", "Busy Channel Lock-Out",
                RadioSettingValueList(opts, opts[_settings.busy_lockout])))

        # 6 BEEP
        opts = ["Off", "Key+Scan", "Key"]
        switch.append(
            RadioSetting("beep", "Enable the Beeper",
                         RadioSettingValueList(opts, opts[_settings.beep])))

        # 7 BELL
        opts = ["Off", "1", "3", "5", "8", "Continuous"]
        ctcss.append(
            RadioSetting("bell", "Bell Repetitions",
                         RadioSettingValueList(opts, opts[_settings.bell])))

        # 8 BNK.LNK
        for i in range(0, 8):
            opts = ["Off", "On"]
            mbs = (self._memobj.mbs >> i) & 1
            rs = RadioSetting("mbs%i" % i, "Bank %s Scan" % (i + 1),
                              RadioSettingValueList(opts, opts[mbs]))

            def apply_mbs(s, index):
                if int(s.value):
                    self._memobj.mbs |= (1 << index)
                else:
                    self._memobj.mbs &= ~(1 << index)

            rs.set_apply_callback(apply_mbs, i)
            mbls.append(rs)

        # 9 BNK.NM - A per-bank attribute, nothing to do here.

        # 10 CLK.SFT - A per-channel attribute, nothing to do here.

        # 11 CW.ID
        opts = ["Off", "On"]
        arts.append(
            RadioSetting("cw_id", "CW ID Enable",
                         RadioSettingValueList(opts, opts[_settings.cw_id])))

        cw_id_text = ""
        for i in _settings.cw_id_string:
            try:
                cw_id_text += CHARSET[i & 0x7F]
            except IndexError:
                if i != 0xff:
                    LOG.debug("unknown char index in cw id: %x " % (i))

        val = RadioSettingValueString(0, 16, cw_id_text, True)
        val.set_charset(CHARSET + "abcdefghijklmnopqrstuvwxyz")
        rs = RadioSetting("cw_id_string", "CW Identifier Text", val)

        def apply_cw_id(s):
            str = s.value.get_value().upper().rstrip()
            mval = ""
            mval = [chr(CHARSET.index(x)) for x in str]
            for x in range(len(mval), 16):
                mval.append(chr(0xff))
            for x in range(0, 16):
                _settings.cw_id_string[x] = ord(mval[x])

        rs.set_apply_callback(apply_cw_id)
        arts.append(rs)

        # 12 CWTRNG
        opts = [
            "Off", "4WPM", "5WPM", "6WPM", "7WPM", "8WPM", "9WPM", "10WPM",
            "11WPM", "12WPM", "13WPM", "15WPM", "17WPM", "20WPM", "24WPM",
            "30WPM", "40WPM"
        ]
        misc.append(
            RadioSetting("cw_trng", "CW Training",
                         RadioSettingValueList(opts, opts[_settings.cw_trng])))

        # todo: make the setting of the units here affect the display
        # of the speed.  Not critical, but would be slick.
        opts = ["CPM", "WPM"]
        misc.append(
            RadioSetting(
                "cw_trng_units", "CW Training Units",
                RadioSettingValueList(opts, opts[_settings.cw_trng_units])))

        # 13 DC VLT - a read-only status, so nothing to do here

        # 14 DCS CD - A per-channel attribute, nothing to do here

        # 15 DCS.RV
        opts = ["Disabled", "Enabled"]
        ctcss.append(
            RadioSetting(
                "inverted_dcs", "\"Inverted\" DCS Code Decoding",
                RadioSettingValueList(opts, opts[_settings.inverted_dcs])))

        # 16 DIMMER
        opts = ["Off"] + ["Level %d" % (x) for x in range(1, 11)]
        disp.append(
            RadioSetting("dimmer", "Dimmer",
                         RadioSettingValueList(opts, opts[_settings.dimmer])))

        # 17 DT.A/M
        opts = ["Manual", "Auto"]
        dtmf.append(
            RadioSetting(
                "dtmf_mode", "DTMF Autodialer",
                RadioSettingValueList(opts, opts[_settings.dtmf_mode])))

        # 18 DT.DLY
        opts = ["50 ms", "250 ms", "450 ms", "750 ms", "1000 ms"]
        dtmf.append(
            RadioSetting(
                "dtmf_delay", "DTMF Autodialer Delay Time",
                RadioSettingValueList(opts, opts[_settings.dtmf_delay])))

        # 19 DT.SET
        for memslot in range(0, 10):
            dtmf_memory = ""
            for i in _dtmf_strings[memslot].dtmf_string:
                if i != 0xFF:
                    try:
                        dtmf_memory += CHARSET[i]
                    except IndexError:
                        LOG.debug("unknown char index in dtmf: %x " % (i))

            val = RadioSettingValueString(0, 16, dtmf_memory, True)
            val.set_charset(CHARSET + "abcdef")
            rs = RadioSetting("dtmf_string_%d" % memslot,
                              "DTMF Memory %d" % memslot, val)

            def apply_dtmf(s, i):
                LOG.debug("applying dtmf for %x\n" % i)
                str = s.value.get_value().upper().rstrip()
                LOG.debug("str is %s\n" % str)
                mval = ""
                mval = [chr(CHARSET.index(x)) for x in str]
                for x in range(len(mval), 16):
                    mval.append(chr(0xff))
                for x in range(0, 16):
                    _dtmf_strings[i].dtmf_string[x] = ord(mval[x])

            rs.set_apply_callback(apply_dtmf, memslot)
            dtmf.append(rs)

        # 20 DT.SPD
        opts = ["50 ms", "100 ms"]
        dtmf.append(
            RadioSetting(
                "dtmf_speed", "DTMF Autodialer Sending Speed",
                RadioSettingValueList(opts, opts[_settings.dtmf_speed])))

        # 21 EDG.BEP
        opts = ["Off", "On"]
        mbls.append(
            RadioSetting(
                "edge_beep", "Band Edge Beeper",
                RadioSettingValueList(opts, opts[_settings.edge_beep])))

        # 22 INT.CD
        opts = ["DTMF %X" % (x) for x in range(0, 16)]
        wires.append(
            RadioSetting("int_cd", "Access Number for WiRES(TM)",
                         RadioSettingValueList(opts, opts[_settings.int_cd])))

        # 23 ING MD
        opts = ["Sister Radio Group", "Friends Radio Group"]
        wires.append(
            RadioSetting(
                "wires_mode", "Internet Link Connection Mode",
                RadioSettingValueList(opts, opts[_settings.wires_mode])))

        # 24 INT.A/M
        opts = ["Manual", "Auto"]
        wires.append(
            RadioSetting(
                "wires_auto", "Internet Link Autodialer",
                RadioSettingValueList(opts, opts[_settings.wires_auto])))
        # 25 INT.SET
        opts = ["F%d" % (x) for x in range(0, 10)]

        wires.append(
            RadioSetting("int_set", "Memory Register for "
                         "non-WiRES Internet",
                         RadioSettingValueList(opts, opts[_settings.int_set])))

        # 26 LOCK
        opts = [
            "Key", "Dial", "Key + Dial", "PTT", "Key + PTT", "Dial + PTT",
            "All"
        ]
        switch.append(
            RadioSetting("lock", "Control Locking",
                         RadioSettingValueList(opts, opts[_settings.lock])))

        # 27 MCGAIN
        opts = ["Level %d" % (x) for x in range(1, 10)]
        misc.append(
            RadioSetting("mic_gain", "Microphone Gain",
                         RadioSettingValueList(opts,
                                               opts[_settings.mic_gain])))

        # 28 MEM.SCN
        opts = ["Tag 1", "Tag 2", "All Channels"]
        rs = RadioSetting(
            "scan_mode", "Memory Scan Mode",
            RadioSettingValueList(opts, opts[_settings.scan_mode - 1]))

        # this setting is unusual in that it starts at 1 instead of 0.
        # that is, index 1 corresponds to "Tag 1", and index 0 is invalid.
        # so we create a custom callback to handle this.

        def apply_scan_mode(s):
            myopts = ["Tag 1", "Tag 2", "All Channels"]
            _settings.scan_mode = myopts.index(s.value.get_value()) + 1

        rs.set_apply_callback(apply_scan_mode)
        mbls.append(rs)

        # 29 MW MD
        opts = ["Lower", "Next"]
        mbls.append(
            RadioSetting("mw_mode", "Memory Write Mode",
                         RadioSettingValueList(opts, opts[_settings.mw_mode])))

        # 30 NM SET - This is per channel, so nothing to do here

        # 31 OPN.MSG
        opts = ["Off", "DC Supply Voltage", "Text Message"]
        disp.append(
            RadioSetting("open_msg", "Opening Message Type",
                         RadioSettingValueList(opts,
                                               opts[_settings.open_msg])))

        openmsg = ""
        for i in _settings.openMsg_Text:
            try:
                openmsg += CHARSET[i & 0x7F]
            except IndexError:
                if i != 0xff:
                    LOG.debug("unknown char index in openmsg: %x " % (i))

        val = RadioSettingValueString(0, 6, openmsg, True)
        val.set_charset(CHARSET + "abcdefghijklmnopqrstuvwxyz")
        rs = RadioSetting("openMsg_Text", "Opening Message Text", val)

        def apply_openmsg(s):
            str = s.value.get_value().upper().rstrip()
            mval = ""
            mval = [chr(CHARSET.index(x)) for x in str]
            for x in range(len(mval), 6):
                mval.append(chr(0xff))
            for x in range(0, 6):
                _settings.openMsg_Text[x] = ord(mval[x])

        rs.set_apply_callback(apply_openmsg)
        disp.append(rs)

        # 32 PAGER - a per-channel attribute

        # 33 PAG.ABK
        opts = ["Off", "On"]
        ctcss.append(
            RadioSetting("pag_abk", "Paging Answer Back",
                         RadioSettingValueList(opts, opts[_settings.pag_abk])))

        # 34 PAG.CDR
        opts = ["%2.2d" % (x) for x in range(1, 50)]
        ctcss.append(
            RadioSetting(
                "pag_cdr_1", "Receive Page Code 1",
                RadioSettingValueList(opts, opts[_settings.pag_cdr_1])))

        ctcss.append(
            RadioSetting(
                "pag_cdr_2", "Receive Page Code 2",
                RadioSettingValueList(opts, opts[_settings.pag_cdr_2])))

        # 35 PAG.CDT
        opts = ["%2.2d" % (x) for x in range(1, 50)]
        ctcss.append(
            RadioSetting(
                "pag_cdt_1", "Transmit Page Code 1",
                RadioSettingValueList(opts, opts[_settings.pag_cdt_1])))

        ctcss.append(
            RadioSetting(
                "pag_cdt_2", "Transmit Page Code 2",
                RadioSettingValueList(opts, opts[_settings.pag_cdt_2])))

        # Common Button Options
        button_opts = [
            "Squelch Off", "Weather", "Smart Search", "Tone Scan", "Scan",
            "T Call", "ARTS"
        ]

        # 36 PRG P1
        opts = button_opts + ["DC Volts"]
        switch.append(
            RadioSetting("prog_p1", "P1 Button",
                         RadioSettingValueList(opts, opts[_settings.prog_p1])))

        # 37 PRG P2
        opts = button_opts + ["Dimmer"]
        switch.append(
            RadioSetting("prog_p2", "P2 Button",
                         RadioSettingValueList(opts, opts[_settings.prog_p2])))

        # 38 PRG P3
        opts = button_opts + ["Mic Gain"]
        switch.append(
            RadioSetting("prog_p3", "P3 Button",
                         RadioSettingValueList(opts, opts[_settings.prog_p3])))

        # 39 PRG P4
        opts = button_opts + ["Skip"]
        switch.append(
            RadioSetting("prog_p4", "P4 Button",
                         RadioSettingValueList(opts, opts[_settings.prog_p4])))

        # 40 PSWD
        password = ""
        for i in _passwd:
            if i != 0xFF:
                try:
                    password += CHARSET[i]
                except IndexError:
                    LOG.debug("unknown char index in password: %x " % (i))

        val = RadioSettingValueString(0, 4, password, True)
        val.set_charset(CHARSET[0:15] + "abcdef ")
        rs = RadioSetting("passwd", "Password", val)

        def apply_password(s):
            str = s.value.get_value().upper().rstrip()
            mval = ""
            mval = [chr(CHARSET.index(x)) for x in str]
            for x in range(len(mval), 4):
                mval.append(chr(0xff))
            for x in range(0, 4):
                _passwd[x] = ord(mval[x])

        rs.set_apply_callback(apply_password)
        misc.append(rs)

        # 41 RESUME
        opts = ["3 Sec", "5 Sec", "10 Sec", "Busy", "Hold"]
        scan.append(
            RadioSetting("resume", "Scan Resume Mode",
                         RadioSettingValueList(opts, opts[_settings.resume])))

        # 42 RF.SQL
        opts = ["Off"] + ["S-%d" % (x) for x in range(1, 10)]
        misc.append(
            RadioSetting("rf_sql", "RF Squelch Threshold",
                         RadioSettingValueList(opts, opts[_settings.rf_sql])))

        # 43 RPT - per channel attribute, nothing to do here

        # 44 RVRT
        opts = ["Off", "On"]
        misc.append(
            RadioSetting("revert", "Priority Revert",
                         RadioSettingValueList(opts, opts[_settings.revert])))

        # 45 S.SRCH
        opts = ["Single", "Continuous"]
        misc.append(
            RadioSetting("s_search", "Smart Search Sweep Mode",
                         RadioSettingValueList(opts,
                                               opts[_settings.s_search])))

        # 46 SHIFT - per channel setting, nothing to do here

        # 47 SKIP = per channel setting, nothing to do here

        # 48 SPLIT - per channel attribute, nothing to do here

        # 49 SQL.TYP - per channel attribute, nothing to do here

        # 50 STEP - per channel attribute, nothing to do here

        # 51 TEMP - read-only status, nothing to do here

        # 52 TN FRQ - per channel attribute, nothing to do here

        # 53 TOT
        opts = ["Off", "1 Min", "3 Min", "5 Min", "10 Min"]
        misc.append(
            RadioSetting("tot", "Timeout Timer",
                         RadioSettingValueList(opts, opts[_settings.tot])))

        # 54 TS MUT
        opts = ["Off", "On"]
        ctcss.append(
            RadioSetting("ts_mut", "Tone Search Mute",
                         RadioSettingValueList(opts, opts[_settings.ts_mut])))

        # 55 TS SPEED
        opts = ["Fast", "Slow"]
        ctcss.append(
            RadioSetting("ts_speed", "Tone Search Scanner Speed",
                         RadioSettingValueList(opts,
                                               opts[_settings.ts_speed])))

        # 56 VFO.SCN
        opts = ["+/- 1MHz", "+/- 2MHz", "+/-5MHz", "All"]
        scan.append(
            RadioSetting("vfo_scan", "VFO Scanner Width",
                         RadioSettingValueList(opts,
                                               opts[_settings.vfo_scan])))

        # 57 WX.ALT
        opts = ["Off", "On"]
        misc.append(
            RadioSetting("wx_alert", "Weather Alert Scan",
                         RadioSettingValueList(opts,
                                               opts[_settings.wx_alert])))

        # 58 WX.VOL
        opts = ["Normal", "Maximum"]
        misc.append(
            RadioSetting(
                "wx_vol_max", "Weather Alert Volume",
                RadioSettingValueList(opts, opts[_settings.wx_vol_max])))

        # 59 W/N DV - this is a per-channel attribute, nothing to do here

        return setmode
Exemplo n.º 31
0
    def get_settings(self):
        _settings = self._memobj.settings
        basic = RadioSettingGroup("basic", "Basic")
        cw = RadioSettingGroup("cw", "CW")
        packet = RadioSettingGroup("packet", "Digital & packet")
        panel = RadioSettingGroup("panel", "Panel settings")
        extended = RadioSettingGroup("extended", "Extended")
        antenna = RadioSettingGroup("antenna", "Antenna selection")
        panelcontr = RadioSettingGroup("panelcontr", "Panel controls")

        top = RadioSettings(basic, cw, packet,
                            panelcontr, panel, extended, antenna)

        rs = RadioSetting("ars_144", "144 ARS",
                          RadioSettingValueBoolean(_settings.ars_144))
        basic.append(rs)
        rs = RadioSetting("ars_430", "430 ARS",
                          RadioSettingValueBoolean(_settings.ars_430))
        basic.append(rs)
        rs = RadioSetting("pkt9600_mic", "Paket 9600 mic level",
                          RadioSettingValueInteger(0, 100,
                                                   _settings.pkt9600_mic))
        packet.append(rs)
        options = ["enable", "disable"]
        rs = RadioSetting("disable_amfm_dial", "AM&FM Dial",
                          RadioSettingValueList(options,
                                                options[
                                                    _settings.disable_amfm_dial
                                                    ]))
        panel.append(rs)
        rs = RadioSetting("am_mic", "AM mic level",
                          RadioSettingValueInteger(0, 100, _settings.am_mic))
        basic.append(rs)
        options = ["OFF", "1h", "2h", "3h", "4h", "5h", "6h"]
        rs = RadioSetting("apo_time", "APO time",
                          RadioSettingValueList(options,
                                                options[_settings.apo_time]))
        basic.append(rs)
        options = ["OFF", "Range", "All"]
        rs = RadioSetting("arts_beep", "ARTS beep",
                          RadioSettingValueList(options,
                                                options[_settings.arts_beep]))
        basic.append(rs)
        options = ["OFF", "ON", "Auto"]
        rs = RadioSetting("backlight", "Backlight",
                          RadioSettingValueList(options,
                                                options[_settings.backlight]))
        panel.append(rs)
        options = ["6h", "8h", "10h"]
        rs = RadioSetting("batt_chg", "Battery charge",
                          RadioSettingValueList(options,
                                                options[_settings.batt_chg]))
        basic.append(rs)
        options = ["440Hz", "880Hz"]
        rs = RadioSetting("beep_freq", "Beep frequency",
                          RadioSettingValueList(options,
                                                options[_settings.beep_freq]))
        panel.append(rs)
        rs = RadioSetting("beep_volume", "Beep volume",
                          RadioSettingValueInteger(0, 100,
                                                   _settings.beep_volume))
        panel.append(rs)
        options = ["4800", "9600", "38400"]
        rs = RadioSetting("cat_rate", "CAT rate",
                          RadioSettingValueList(options,
                                                options[_settings.cat_rate]))
        basic.append(rs)
        options = ["Blue", "Amber", "Violet"]
        rs = RadioSetting("color", "Color",
                          RadioSettingValueList(options,
                                                options[_settings.color]))
        panel.append(rs)
        rs = RadioSetting("contrast", "Contrast",
                          RadioSettingValueInteger(1, 12,
                                                   _settings.contrast - 1))
        panel.append(rs)
        rs = RadioSetting("cw_delay", "CW delay (*10 ms)",
                          RadioSettingValueInteger(1, 250,
                                                   _settings.cw_delay))
        cw.append(rs)
        rs = RadioSetting("cw_id", "CW id",
                          RadioSettingValueBoolean(_settings.cw_id))
        cw.append(rs)
        options = ["Normal", "Reverse"]
        rs = RadioSetting("cw_paddle", "CW paddle",
                          RadioSettingValueList(options,
                                                options[_settings.cw_paddle]))
        cw.append(rs)
        options = ["%i Hz" % i for i in range(300, 1001, 50)]
        rs = RadioSetting("cw_pitch", "CW pitch",
                          RadioSettingValueList(options,
                                                options[_settings.cw_pitch]))
        cw.append(rs)
        options = ["%i wpm" % i for i in range(4, 61)]
        rs = RadioSetting("cw_speed", "CW speed",
                          RadioSettingValueList(options,
                                                options[_settings.cw_speed]))
        cw.append(rs)
        options = ["1:%1.1f" % (i / 10) for i in range(25, 46, 1)]
        rs = RadioSetting("cw_weight", "CW weight",
                          RadioSettingValueList(options,
                                                options[_settings.cw_weight]))
        cw.append(rs)
        rs = RadioSetting("dig_disp", "Dig disp (*10 Hz)",
                          RadioSettingValueInteger(-300, 300,
                                                   _settings.dig_disp))
        packet.append(rs)
        rs = RadioSetting("dig_mic", "Dig mic",
                          RadioSettingValueInteger(0, 100,
                                                   _settings.dig_mic))
        packet.append(rs)
        options = ["RTTY", "PSK31-L", "PSK31-U", "USER-L", "USER-U"]
        rs = RadioSetting("dig_mode", "Dig mode",
                          RadioSettingValueList(options,
                                                options[_settings.dig_mode]))
        packet.append(rs)
        rs = RadioSetting("dig_shift", "Dig shift (*10 Hz)",
                          RadioSettingValueInteger(-300, 300,
                                                   _settings.dig_shift))
        packet.append(rs)
        rs = RadioSetting("fm_mic", "FM mic",
                          RadioSettingValueInteger(0, 100,
                                                   _settings.fm_mic))
        basic.append(rs)
        options = ["Dial", "Freq", "Panel"]
        rs = RadioSetting("lock_mode", "Lock mode",
                          RadioSettingValueList(options,
                                                options[_settings.lock_mode]))
        panel.append(rs)
        options = ["Fine", "Coarse"]
        rs = RadioSetting("main_step", "Main step",
                          RadioSettingValueList(options,
                                                options[_settings.main_step]))
        panel.append(rs)
        rs = RadioSetting("mem_group", "Mem group",
                          RadioSettingValueBoolean(_settings.mem_group))
        basic.append(rs)
        rs = RadioSetting("mic_key", "Mic key",
                          RadioSettingValueBoolean(_settings.mic_key))
        cw.append(rs)
        rs = RadioSetting("mic_scan", "Mic scan",
                          RadioSettingValueBoolean(_settings.mic_scan))
        basic.append(rs)
        options = ["Off", "SSB", "CW"]
        rs = RadioSetting("op_filter", "Optional filter",
                          RadioSettingValueList(options,
                                                options[_settings.op_filter]))
        basic.append(rs)
        rs = RadioSetting("pkt_mic", "Packet mic",
                          RadioSettingValueInteger(0, 100, _settings.pkt_mic))
        packet.append(rs)
        options = ["1200", "9600"]
        rs = RadioSetting("pkt_rate", "Packet rate",
                          RadioSettingValueList(options,
                                                options[_settings.pkt_rate]))
        packet.append(rs)
        options = ["Off", "3 sec", "5 sec", "10 sec"]
        rs = RadioSetting("resume_scan", "Resume scan",
                          RadioSettingValueList(options,
                                                options[_settings.resume_scan])
                          )
        basic.append(rs)
        options = ["Cont", "Chk"]
        rs = RadioSetting("scope", "Scope",
                          RadioSettingValueList(options,
                                                options[_settings.scope]))
        basic.append(rs)
        rs = RadioSetting("sidetone", "Sidetone",
                          RadioSettingValueInteger(0, 100, _settings.sidetone))
        cw.append(rs)
        options = ["RF-Gain", "Squelch"]
        rs = RadioSetting("sql_rf_gain", "Squelch/RF-Gain",
                          RadioSettingValueList(options,
                                                options[_settings.sql_rf_gain])
                          )
        panel.append(rs)
        rs = RadioSetting("ssb_mic", "SSB Mic",
                          RadioSettingValueInteger(0, 100, _settings.ssb_mic))
        basic.append(rs)
        options = ["%i" % i for i in range(0, 21)]
        options[0] = "Off"
        rs = RadioSetting("tot_time", "Time-out timer",
                          RadioSettingValueList(options,
                                                options[_settings.tot_time]))
        basic.append(rs)
        rs = RadioSetting("vox_delay", "VOX delay (*100 ms)",
                          RadioSettingValueInteger(1, 25, _settings.vox_delay))
        basic.append(rs)
        rs = RadioSetting("vox_gain", "VOX Gain",
                          RadioSettingValueInteger(0, 100, _settings.vox_gain))
        basic.append(rs)
        rs = RadioSetting("extended_menu", "Extended menu",
                          RadioSettingValueBoolean(_settings.extended_menu))
        extended.append(rs)
        options = ["Tn-Rn", "Tn-Riv", "Tiv-Rn", "Tiv-Riv"]
        rs = RadioSetting("dcs_inv", "DCS coding",
                          RadioSettingValueList(options,
                                                options[_settings.dcs_inv]))
        extended.append(rs)
        rs = RadioSetting("r_lsb_car", "LSB Rx carrier point (*10 Hz)",
                          RadioSettingValueInteger(-30, 30,
                                                   _settings.r_lsb_car))
        extended.append(rs)
        rs = RadioSetting("r_usb_car", "USB Rx carrier point (*10 Hz)",
                          RadioSettingValueInteger(-30, 30,
                                                   _settings.r_usb_car))
        extended.append(rs)
        rs = RadioSetting("t_lsb_car", "LSB Tx carrier point (*10 Hz)",
                          RadioSettingValueInteger(-30, 30,
                                                   _settings.t_lsb_car))
        extended.append(rs)
        rs = RadioSetting("t_usb_car", "USB Tx carrier point (*10 Hz)",
                          RadioSettingValueInteger(-30, 30,
                                                   _settings.t_usb_car))
        extended.append(rs)

        options = ["Hi", "L3", "L2", "L1"]
        rs = RadioSetting("tx_power", "TX power",
                          RadioSettingValueList(options,
                                                options[_settings.tx_power]))
        basic.append(rs)

        options = ["Front", "Rear"]
        rs = RadioSetting("hf_antenna", "HF",
                          RadioSettingValueList(options,
                                                options[_settings.hf_antenna]))
        antenna.append(rs)
        rs = RadioSetting("sixm_antenna", "6M",
                          RadioSettingValueList(options,
                                                options[_settings.sixm_antenna]
                                                ))
        antenna.append(rs)
        rs = RadioSetting("bc_antenna", "Broadcasting",
                          RadioSettingValueList(options,
                                                options[_settings.bc_antenna]))
        antenna.append(rs)
        rs = RadioSetting("air_antenna", "Air band",
                          RadioSettingValueList(options,
                                                options[_settings.air_antenna])
                          )
        antenna.append(rs)
        rs = RadioSetting("vhf_antenna", "VHF",
                          RadioSettingValueList(options,
                                                options[_settings.vhf_antenna])
                          )
        antenna.append(rs)
        rs = RadioSetting("uhf_antenna", "UHF",
                          RadioSettingValueList(options,
                                                options[_settings.uhf_antenna])
                          )
        antenna.append(rs)

        st = RadioSettingValueString(0, 7, ''.join([self._CALLSIGN_CHARSET[x]
                                     for x in self._memobj.callsign]))
        st.set_charset(self._CALLSIGN_CHARSET)
        rs = RadioSetting("callsign", "Callsign", st)
        cw.append(rs)

        rs = RadioSetting("spl", "Split",
                          RadioSettingValueBoolean(_settings.spl))
        panelcontr.append(rs)
        options = ["None", "Up", "Down"]
        rs = RadioSetting("scn_mode", "Scan mode",
                          RadioSettingValueList(options,
                                                options[_settings.scn_mode]))
        panelcontr.append(rs)
        rs = RadioSetting("pri", "Priority",
                          RadioSettingValueBoolean(_settings.pri))
        panelcontr.append(rs)
        rs = RadioSetting("dw", "Dual watch",
                          RadioSettingValueBoolean(_settings.dw))
        panelcontr.append(rs)
        rs = RadioSetting("art", "Auto-range transponder",
                          RadioSettingValueBoolean(_settings.art))
        panelcontr.append(rs)
        rs = RadioSetting("nb", "Noise blanker",
                          RadioSettingValueBoolean(_settings.nb))
        panelcontr.append(rs)
        options = ["Auto", "Fast", "Slow", "Off"]
        rs = RadioSetting("agc", "AGC",
                          RadioSettingValueList(options, options[_settings.agc]
                                                ))
        panelcontr.append(rs)
        options = ["PWR", "ALC", "SWR", "MOD"]
        rs = RadioSetting("pwr_meter_mode", "Power meter mode",
                          RadioSettingValueList(options,
                                                options[
                                                    _settings.pwr_meter_mode
                                                        ]))
        panelcontr.append(rs)
        rs = RadioSetting("vox", "Vox",
                          RadioSettingValueBoolean(_settings.vox))
        panelcontr.append(rs)
        rs = RadioSetting("bk", "Semi break-in",
                          RadioSettingValueBoolean(_settings.bk))
        cw.append(rs)
        rs = RadioSetting("kyr", "Keyer",
                          RadioSettingValueBoolean(_settings.kyr))
        cw.append(rs)
        options = ["enabled", "disabled"]
        rs = RadioSetting("fst", "Fast",
                          RadioSettingValueList(options, options[_settings.fst]
                                                ))
        panelcontr.append(rs)
        options = ["enabled", "disabled"]
        rs = RadioSetting("lock", "Lock",
                          RadioSettingValueList(options,
                                                options[_settings.lock]))
        panelcontr.append(rs)

        return top
Exemplo n.º 32
0
    def get_settings(self):
        _settings = self._memobj.settings
        _info = self._memobj.info
        _bandlimits = self._memobj.bandlimits
        basic = RadioSettingGroup("basic", "Basic")
        info = RadioSettingGroup("info", "Model Info")
        top = RadioSettings(basic, info)
        basic.append(RadioSetting(
                "beep", "Beep",
                RadioSettingValueBoolean(_settings.beep)))
        basic.append(RadioSetting(
                "beep_vol", "Beep Volume",
                RadioSettingValueInteger(0, 15, _settings.beep_vol)))
        basic.append(RadioSetting(
                "keylock", "Key Lock",
                RadioSettingValueBoolean(_settings.keylock)))
        basic.append(RadioSetting(
                "ani_display", "ANI Display",
                RadioSettingValueBoolean(_settings.ani_display)))
        basic.append(RadioSetting(
                "auto_xfer", "Auto Transfer",
                RadioSettingValueBoolean(_settings.auto_xfer)))
        basic.append(RadioSetting(
                "auto_contact", "Auto Contact Always Remind",
                RadioSettingValueBoolean(_settings.auto_contact)))
        basic.append(RadioSetting(
                "auto_am", "Auto AM",
                RadioSettingValueBoolean(_settings.auto_am)))
        basic.append(RadioSetting(
                "left_sql", "Left Squelch",
                RadioSettingValueList(
                    SQLPRESET, SQLPRESET[_settings.left_sql])))
        basic.append(RadioSetting(
                "right_sql", "Right Squelch",
                RadioSettingValueList(
                    SQLPRESET, SQLPRESET[_settings.right_sql])))
#      basic.append(RadioSetting("apo", "Auto Power off (0.1h)",
#              RadioSettingValueInteger(0, 20, _settings.apo)))
        opts = ["Off"] + ["%0.1f" % (t / 10.0) for t in range(1, 21, 1)]
        basic.append(RadioSetting(
                "apo", "Auto Power off (Hours)",
                RadioSettingValueList(opts, opts[_settings.apo])))
        opts = ["Off", "1", "2", "3", "Full"]
        basic.append(RadioSetting(
                "backlight", "Display Backlight",
                RadioSettingValueList(opts, opts[_settings.backlight])))
        opts = ["Off", "Right", "Left", "Both"]
        basic.append(RadioSetting(
                "pttlock", "PTT Lock",
                RadioSettingValueList(opts, opts[_settings.pttlock])))
        opts = ["Manual", "Auto"]
        basic.append(RadioSetting(
                "hyper_chan", "Hyper Channel",
                RadioSettingValueList(opts, opts[_settings.hyper_chan])))
        opts = ["Key 1", "Key 2"]
        basic.append(RadioSetting(
                "right_func_key", "Right Function Key",
                RadioSettingValueList(opts, opts[_settings.right_func_key])))
        opts = ["1000Hz", "1450Hz", "1750Hz", "2100Hz"]
        basic.append(RadioSetting(
                "tbst_freq", "Tone Burst Frequency",
                RadioSettingValueList(opts, opts[_settings.tbst_freq])))
        opts = ["Off", "TX", "RX", "TX RX"]
        basic.append(RadioSetting(
                "mute_mode", "Mute Mode",
                RadioSettingValueList(opts, opts[_settings.mute_mode])))
        opts = ["MEM", "MSM"]
        scanmode = RadioSetting(
                "scan_mode", "Scan Mode",
                RadioSettingValueList(opts, opts[_settings.scan_mode]))
        scanmode.set_doc("MEM = Normal scan, bypass channels marked skip. "
                         " MSM = Scan only channels marked priority.")
        basic.append(scanmode)
        opts = ["TO", "CO"]
        basic.append(RadioSetting(
                "scan_resume", "Scan Resume",
                RadioSettingValueList(opts, opts[_settings.scan_resume])))
        opts = ["%0.1f" % (t / 10.0) for t in range(0, 51, 1)]
        basic.append(RadioSetting(
                "exit_delay", "Span Transit Exit Delay",
                RadioSettingValueList(opts, opts[_settings.exit_delay])))
        basic.append(RadioSetting(
                "tot", "Time Out Timer (minutes)",
                RadioSettingValueInteger(0, 30, _settings.tot)))
        basic.append(RadioSetting(
                "tot_alert", "Time Out Timer Pre Alert(seconds)",
                RadioSettingValueInteger(0, 15, _settings.tot_alert)))
        basic.append(RadioSetting(
                "tot_rekey", "Time Out Rekey (seconds)",
                RadioSettingValueInteger(0, 15, _settings.tot_rekey)))
        basic.append(RadioSetting(
                "tot_reset", "Time Out Reset(seconds)",
                RadioSettingValueInteger(0, 15, _settings.tot_reset)))
        basic.append(RadioSetting(
                "p1", "P1 Function",
                RadioSettingValueList(MICKEYFUNC, MICKEYFUNC[_settings.p1])))
        basic.append(RadioSetting(
                "p2", "P2 Function",
                RadioSettingValueList(MICKEYFUNC, MICKEYFUNC[_settings.p2])))
        basic.append(RadioSetting(
                "p3", "P3 Function",
                RadioSettingValueList(MICKEYFUNC, MICKEYFUNC[_settings.p3])))
        basic.append(RadioSetting(
                "p4", "P4 Function",
                RadioSettingValueList(MICKEYFUNC, MICKEYFUNC[_settings.p4])))
#      opts = ["0", "1"]
#      basic.append(RadioSetting("x", "Desc",
#            RadioSettingValueList(opts, opts[_settings.x])))

        def _filter(name):
            filtered = ""
            for char in str(name):
                if char in chirp_common.CHARSET_ASCII:
                    filtered += char
                else:
                    filtered += " "
            return filtered

        rsvs = RadioSettingValueString(0, 8, _filter(_info.sn))
        rsvs.set_mutable(False)
        rs = RadioSetting("sn", "Serial Number", rsvs)
        info.append(rs)

        rsvs = RadioSettingValueString(0, 8, _filter(_info.model))
        rsvs.set_mutable(False)
        rs = RadioSetting("model", "Model Name", rsvs)
        info.append(rs)

        rsvs = RadioSettingValueString(0, 16, _filter(_info.code))
        rsvs.set_mutable(False)
        rs = RadioSetting("code", "Model Code", rsvs)
        info.append(rs)

        progdate = "%d/%d/%d" % (_info.prog_mon, _info.prog_day,
                                 _info.prog_yr)
        rsvs = RadioSettingValueString(0, 10, progdate)
        rsvs.set_mutable(False)
        rs = RadioSetting("progdate", "Last Program Date", rsvs)
        info.append(rs)

        # 9 band limits
        for i in range(0, 9):
            objname = BANDS[i] + "lorx"
            objnamepp = BANDS[i] + " Rx Start"
            # rsv = RadioSettingValueInteger(0, 100000000,
            #              int(_bandlimits[i].lorx))
            rsv = RadioSettingValueString(
                    0, 10, format_freq(int(_bandlimits[i].lorx)*10))
            rsv.set_mutable(False)
            rs = RadioSetting(objname, objnamepp, rsv)
            info.append(rs)
            objname = BANDS[i] + "hirx"
            objnamepp = BANDS[i] + " Rx end"
            rsv = RadioSettingValueString(
                    0, 10, format_freq(int(_bandlimits[i].hirx)*10))
            rsv.set_mutable(False)
            rs = RadioSetting(objname, objnamepp, rsv)
            info.append(rs)
            objname = BANDS[i] + "lotx"
            objnamepp = BANDS[i] + " Tx Start"
            rsv = RadioSettingValueString(
                    0, 10, format_freq(int(_bandlimits[i].lotx)*10))
            rsv.set_mutable(False)
            rs = RadioSetting(objname, objnamepp, rsv)
            info.append(rs)
            objname = BANDS[i] + "hitx"
            objnamepp = BANDS[i] + " Tx end"
            rsv = RadioSettingValueString(
                    0, 10, format_freq(int(_bandlimits[i].hitx)*10))
            rsv.set_mutable(False)
            rs = RadioSetting(objname, objnamepp, rsv)
            info.append(rs)

        return top
Exemplo n.º 33
0
    def get_settings(self):
        _settings = self._memobj.settings
        basic = RadioSettingGroup("basic", "Basic")
        dtmf = RadioSettingGroup("dtmf", "DTMF Code & Paging")
        arts = RadioSettingGroup("arts", "ARTS")
        autodial = RadioSettingGroup("autodial", "AutoDial")
        top = RadioSettings(basic, autodial, arts, dtmf)

        rs = RadioSetting(
                "squelch", "Squelch",
                RadioSettingValueInteger(0, 15, _settings.squelch))
        basic.append(rs)

        rs = RadioSetting(
                "keybeep", "Keypad Beep",
                RadioSettingValueBoolean(_settings.keybeep))
        basic.append(rs)

        rs = RadioSetting(
                "scnl", "Scan Lamp",
                RadioSettingValueBoolean(_settings.scnl))
        basic.append(rs)

        options = ["off", "30m", "1h", "3h", "5h", "8h"]
        rs = RadioSetting(
                "apo", "APO time (hrs)",
                RadioSettingValueList(options, options[_settings.apo]))
        basic.append(rs)

        options = ["off", "1m", "2.5m", "5m", "10m"]
        rs = RadioSetting(
                "timeout", "Time Out Timer",
                RadioSettingValueList(options, options[_settings.timeout]))
        basic.append(rs)

        options = ["key", "dial", "key+dial", "ptt",
                   "key+ptt", "dial+ptt", "all"]
        rs = RadioSetting(
                "lock", "Lock mode",
                RadioSettingValueList(options, options[_settings.lock]))
        basic.append(rs)

        options = ["off", "0.2", "0.3", "0.5", "1.0", "2.0"]
        rs = RadioSetting(
                "rxsave", "RX Save (sec)",
                RadioSettingValueList(options, options[_settings.rxsave]))
        basic.append(rs)

        options = ["5sec", "key", "tgl"]
        rs = RadioSetting(
                "lamp", "Lamp mode",
                RadioSettingValueList(options, options[_settings.lamp]))
        basic.append(rs)

        options = ["off", "1", "3", "5", "8", "rpt"]
        rs = RadioSetting(
                "bell", "Bell Repetitions",
                RadioSettingValueList(options, options[_settings.bell]))
        basic.append(rs)

        rs = RadioSetting(
                "cwid_en", "CWID Enable",
                RadioSettingValueBoolean(_settings.cwid_en))
        arts.append(rs)

        cwid = RadioSettingValueString(
                0, 16, self._decode_cwid(_settings.cwid.get_value()))
        cwid.set_charset(CHARSET)
        rs = RadioSetting("cwid", "CWID", cwid)
        arts.append(rs)

        options = ["off", "rx", "tx", "trx"]
        rs = RadioSetting(
                "artsmode", "ARTS Mode",
                RadioSettingValueList(
                    options, options[_settings.artsmode]))
        arts.append(rs)

        options = ["off", "in range", "always"]
        rs = RadioSetting(
                "artsbeep", "ARTS Beep",
                RadioSettingValueList(options, options[_settings.artsbeep]))
        arts.append(rs)

        for i in range(0, 8):
            dialsettings = _settings.autodial[i]
            dialstr = ""
            for c in dialsettings.digits:
                if c < len(DTMFCHARSET):
                    dialstr += DTMFCHARSET[c]
            dialentry = RadioSettingValueString(0, 16, dialstr)
            dialentry.set_charset(DTMFCHARSET + list(" "))
            rs = RadioSetting("autodial" + str(i+1),
                              "AutoDial " + str(i+1), dialentry)
            autodial.append(rs)

        dialstr = ""
        for c in _settings.autodial9_ro.digits:
            if c < len(DTMFCHARSET):
                dialstr += DTMFCHARSET[c]
        dialentry = RadioSettingValueString(0, 32, dialstr)
        dialentry.set_mutable(False)
        rs = RadioSetting("autodial9_ro", "AutoDial 9 (read only)", dialentry)
        autodial.append(rs)

        options = ["50ms", "100ms"]
        rs = RadioSetting(
                "pagingspeed", "Paging Speed",
                RadioSettingValueList(options, options[_settings.pagingspeed]))
        dtmf.append(rs)

        options = ["250ms", "450ms", "750ms", "1000ms"]
        rs = RadioSetting(
                "pagingdelay", "Paging Delay",
                RadioSettingValueList(options, options[_settings.pagingdelay]))
        dtmf.append(rs)

        options = ["off", "1", "3", "5", "8", "rpt"]
        rs = RadioSetting(
                "pagingbell", "Paging Bell Repetitions",
                RadioSettingValueList(options, options[_settings.pagingbell]))
        dtmf.append(rs)

        options = ["off", "ans", "for"]
        rs = RadioSetting(
                "paginganswer", "Paging Answerback",
                RadioSettingValueList(options,
                                      options[_settings.paginganswer]))
        dtmf.append(rs)

        rs = RadioSetting(
                "code_dec_c_en", "Paging Code C Decode Enable",
                RadioSettingValueBoolean(_settings.code_dec_c_en))
        dtmf.append(rs)

        _str = str(bitwise.bcd_to_int(_settings.pagingcodec_ro))
        code = RadioSettingValueString(0, 3, _str)
        code.set_charset(NUMERIC_CHARSET + list(" "))
        code.set_mutable(False)
        rs = RadioSetting("pagingcodec_ro", "Paging Code C (read only)", code)
        dtmf.append(rs)

        rs = RadioSetting(
                "code_dec_p_en", "Paging Code P Decode Enable",
                RadioSettingValueBoolean(_settings.code_dec_p_en))
        dtmf.append(rs)

        _str = str(bitwise.bcd_to_int(_settings.pagingcodep))
        code = RadioSettingValueString(0, 3, _str)
        code.set_charset(NUMERIC_CHARSET + list(" "))
        rs = RadioSetting("pagingcodep", "Paging Code P", code)
        dtmf.append(rs)

        for i in range(0, 6):
            num = str(i+1)
            name = "code_dec_" + num + "_en"
            rs = RadioSetting(
                    name, "Paging Code " + num + " Decode Enable",
                    RadioSettingValueBoolean(getattr(_settings, name)))
            dtmf.append(rs)

            _str = str(bitwise.bcd_to_int(_settings.pagingcode[i].digits))
            code = RadioSettingValueString(0, 3, _str)
            code.set_charset(NUMERIC_CHARSET + list(" "))
            rs = RadioSetting("pagingcode" + num, "Paging Code " + num, code)
            dtmf.append(rs)

        return top
Exemplo n.º 34
0
    def _get_settings(self):
        _settings = self._memobj.settings
        basic = RadioSettingGroup("basic", "Basic")
        arts = RadioSettingGroup("arts", "ARTS")
        dtmf = RadioSettingGroup("dtmf", "DTMF")
        wires = RadioSettingGroup("wires", "WIRES")
        misc = RadioSettingGroup("misc", "Misc")
        top = RadioSettings(basic, arts, dtmf, wires, misc)

        # BASIC

        val = RadioSettingValueList(
            self._APO, self._APO[_settings.auto_power_off])
        rs = RadioSetting("auto_power_off", "Auto Power Off", val)
        basic.append(rs)

        val = RadioSettingValueList(
            self._BEEP_LEVEL, self._BEEP_LEVEL[_settings.beep_level])
        rs = RadioSetting("beep_level", "Beep Level", val)
        basic.append(rs)

        val = RadioSettingValueList(
            self._DIM_LEVEL, self._DIM_LEVEL[_settings.lcd_dimmer])
        rs = RadioSetting("lcd_dimmer", "Dimmer Level", val)
        basic.append(rs)

        val = RadioSettingValueList(
            self._LAMP, self._LAMP[_settings.lamp])
        rs = RadioSetting("lamp", "Keypad Lamp", val)
        basic.append(rs)

        val = RadioSettingValueList(
            self._LOCK, self._LOCK[_settings.lock])
        rs = RadioSetting("lock", "Lock", val)
        basic.append(rs)

        val = RadioSettingValueList(
            self._NUM_1_9, self._NUM_1_9[_settings.mic_gain])
        rs = RadioSetting("mic_gain", "Mic Gain", val)
        basic.append(rs)

        val = RadioSettingValueList(
            self._OPEN_MSG, self._OPEN_MSG[_settings.open_message_mode])
        rs = RadioSetting("open_message_mode",
                          "Open Message Mode", val)
        basic.append(rs)

        val = RadioSettingValueString(0, 6,
                                      self._decode_chars(
                                          _settings.open_message))
        val.set_charset(CHARSET)
        rs = RadioSetting("open_message", "Opening Message", val)
        basic.append(rs)

        passstr = ""
        for c in _settings.password:
            if c < len(PASS_CHARSET):
                passstr += PASS_CHARSET[c]
        val = RadioSettingValueString(0, 4, passstr)
        val.set_charset(PASS_CHARSET)
        rs = RadioSetting("password", "Password", val)
        basic.append(rs)

        val = RadioSettingValueList(
            self._RESUME, self._RESUME[_settings.resume])
        rs = RadioSetting("resume", "Scan Resume", val)
        basic.append(rs)

        val = RadioSettingValueList(
            self._MONI_TCALL, self._MONI_TCALL[_settings.moni_tcall])
        rs = RadioSetting("moni_tcall", "MONI/T-CALL switch", val)
        basic.append(rs)

        rs = RadioSetting("scan_lamp", "Scan Lamp",
                          RadioSettingValueBoolean(_settings.scan_lamp))
        basic.append(rs)

        rs = RadioSetting("beep", "Keypad Beep",
                          RadioSettingValueBoolean(_settings.beep))
        basic.append(rs)

        rs = RadioSetting("busy_led", "Busy LED",
                          RadioSettingValueBoolean(_settings.busy_led))
        basic.append(rs)

        rs = RadioSetting("bclo", "Busy Channel Lock-Out",
                          RadioSettingValueBoolean(_settings.bclo))
        basic.append(rs)

        rs = RadioSetting("wx_alert", "WX Alert",
                          RadioSettingValueBoolean(_settings.wx_alert))
        basic.append(rs)

        rs = RadioSetting("att", "Attenuator",
                          RadioSettingValueBoolean(_settings.att))
        basic.append(rs)

        # ARTS

        val = RadioSettingValueList(
            self._ARTS_INT, self._ARTS_INT[_settings.arts_interval])
        rs = RadioSetting("arts_interval", "ARTS Interval", val)
        arts.append(rs)

        val = RadioSettingValueList(
            self._ARTSBEEP, self._ARTSBEEP[_settings.arts_beep])
        rs = RadioSetting("arts_beep", "ARTS Beep", val)
        arts.append(rs)

        rs = RadioSetting("arts_cwid", "ARTS Send CWID",
                          RadioSettingValueBoolean(_settings.arts_cwid))
        arts.append(rs)

        val = RadioSettingValueString(0, 16,
                                      self._decode_chars(
                                          _settings.arts_cwid_alpha))
        val.set_charset(CHARSET)
        rs = RadioSetting("arts_cwid_alpha", "ARTS CW ID", val)
        arts.append(rs)

        # DTMF

        val = RadioSettingValueList(
            self._MAN_AUTO, self._MAN_AUTO[_settings.dtmf_autodial])
        rs = RadioSetting("dtmf_autodial", "DTMF Autodial", val)
        dtmf.append(rs)

        val = RadioSettingValueList(
            self._NUM_0_9, self._NUM_0_9[_settings.last_dtmf])
        rs = RadioSetting("last_dtmf", "Last DTMF Memory Set", val)
        dtmf.append(rs)

        for i in range(10):
            name = "dtmf_" + str(i)
            dtmfsetting = self._memobj.dtmf[i]
            dtmfstr = ""
            for c in dtmfsetting.memory:
                if c < len(DTMFCHARSET):
                    dtmfstr += DTMFCHARSET[c]
            dtmfentry = RadioSettingValueString(0, 16, dtmfstr)
            rs = RadioSetting(name, name.upper(), dtmfentry)
            dtmf.append(rs)

        # WIRES

        val = RadioSettingValueList(
            self._INT_CD, self._INT_CD[_settings.internet_code])
        rs = RadioSetting("internet_code", "Internet Code", val)
        wires.append(rs)

        val = RadioSettingValueList(
            self._INT_MD, self._INT_MD[_settings.internet_mode])
        rs = RadioSetting("internet_mode",
                          "Internet Link Connection mode", val)
        wires.append(rs)

        val = RadioSettingValueList(
            self._MAN_AUTO, self._MAN_AUTO[_settings.int_autodial])
        rs = RadioSetting("int_autodial", "Internet Autodial", val)
        wires.append(rs)

        val = RadioSettingValueList(
            self._NUM_0_63, self._NUM_0_63[_settings.last_internet_dtmf])
        rs = RadioSetting("last_internet_dtmf",
                          "Last Internet DTMF Memory Set", val)
        wires.append(rs)

        for i in range(64):
            name = "wires_dtmf_" + str(i)
            dtmfsetting = self._memobj.internet_dtmf[i]
            dtmfstr = ""
            for c in dtmfsetting.memory:
                if c < len(DTMFCHARSET):
                    dtmfstr += DTMFCHARSET[c]
            dtmfentry = RadioSettingValueString(0, 8, dtmfstr)
            rs = RadioSetting(name, name.upper(), dtmfentry)
            wires.append(rs)

        # MISC

        val = RadioSettingValueList(
            self._BELL, self._BELL[_settings.bell])
        rs = RadioSetting("bell", "CTCSS/DCS Bell", val)
        misc.append(rs)

        val = RadioSettingValueList(
            self._CH_CNT, self._CH_CNT[_settings.channel_counter_width])
        rs = RadioSetting("channel_counter_width",
                          "Channel Counter Search Width", val)
        misc.append(rs)

        val = RadioSettingValueList(
            self._EMERGENCY, self._EMERGENCY[_settings.emergency])
        rs = RadioSetting("emergency", "Emergency alarm", val)
        misc.append(rs)

        val = RadioSettingValueList(
            self._ON_TIMER, self._ON_TIMER[_settings.on_timer])
        rs = RadioSetting("on_timer", "On Timer", val)
        misc.append(rs)

        rs = RadioSetting("pager_answer_back", "Pager Answer Back",
                          RadioSettingValueBoolean(
                              _settings.pager_answer_back))
        misc.append(rs)

        val = RadioSettingValueList(
            self._NUM_1_50, self._NUM_1_50[_settings.pager_rx_tone1])
        rs = RadioSetting("pager_rx_tone1", "Pager RX Tone 1", val)
        misc.append(rs)

        val = RadioSettingValueList(
            self._NUM_1_50, self._NUM_1_50[_settings.pager_rx_tone2])
        rs = RadioSetting("pager_rx_tone2", "Pager RX Tone 2", val)
        misc.append(rs)

        val = RadioSettingValueList(
            self._NUM_1_50, self._NUM_1_50[_settings.pager_tx_tone1])
        rs = RadioSetting("pager_tx_tone1", "Pager TX Tone 1", val)
        misc.append(rs)

        val = RadioSettingValueList(
            self._NUM_1_50, self._NUM_1_50[_settings.pager_tx_tone2])
        rs = RadioSetting("pager_tx_tone2", "Pager TX Tone 2", val)
        misc.append(rs)

        val = RadioSettingValueList(
            self._PTT_DELAY, self._PTT_DELAY[_settings.ptt_delay])
        rs = RadioSetting("ptt_delay", "PTT Delay", val)
        misc.append(rs)

        val = RadioSettingValueList(
            self._RF_SQL, self._RF_SQL[_settings.rf_squelch])
        rs = RadioSetting("rf_squelch", "RF Squelch", val)
        misc.append(rs)

        val = RadioSettingValueList(
            self._RX_SAVE, self._RX_SAVE[_settings.rx_save])
        rs = RadioSetting("rx_save", "RX Save", val)
        misc.append(rs)

        val = RadioSettingValueList(
            self._TOT, self._TOT[_settings.tx_timeout])
        rs = RadioSetting("tx_timeout", "TOT", val)
        misc.append(rs)

        val = RadioSettingValueList(
            self._WAKEUP, self._WAKEUP[_settings.wakeup])
        rs = RadioSetting("wakeup", "Wakeup", val)
        misc.append(rs)

        rs = RadioSetting("edge_beep", "Band-Edge Beep",
                          RadioSettingValueBoolean(_settings.edge_beep))
        misc.append(rs)

        val = RadioSettingValueList(
            self._VFO_MODE, self._VFO_MODE[_settings.vfo_mode])
        rs = RadioSetting("vfo_mode", "VFO Band Edge Limiting", val)
        misc.append(rs)

        rs = RadioSetting("tone_search_mute", "Tone Search Mute",
                          RadioSettingValueBoolean(_settings.tone_search_mute))
        misc.append(rs)

        val = RadioSettingValueList(
            self._TS_SPEED, self._TS_SPEED[_settings.ts_speed])
        rs = RadioSetting("ts_speed", "Tone Search Speed", val)
        misc.append(rs)

        rs = RadioSetting("dmr_wrt", "Direct Memory Recall Overwrite",
                          RadioSettingValueBoolean(_settings.dmr_wrt))
        misc.append(rs)

        rs = RadioSetting("tx_saver", "TX Battery Saver",
                          RadioSettingValueBoolean(_settings.tx_saver))
        misc.append(rs)

        val = RadioSettingValueList(
            self._SMART_SEARCH, self._SMART_SEARCH[_settings.smart_search])
        rs = RadioSetting("smart_search", "Smart Search", val)
        misc.append(rs)

        val = RadioSettingValueList(
            self._HOME_REV, self._HOME_REV[_settings.home_rev])
        rs = RadioSetting("home_rev", "HM/RV(EMG)R/H key", val)
        misc.append(rs)

        val = RadioSettingValueList(
            self._MEM_W_MD, self._MEM_W_MD[_settings.memory_method])
        rs = RadioSetting("memory_method", "Memory Write Method", val)
        misc.append(rs)

        return top
Exemplo n.º 35
0
    def get_settings(self):
        _settings = self._memobj.settings

        group = RadioSettingGroup("basic", "Basic")
        top = RadioSettings(group)

        group.append(
            RadioSetting(
                "mode", "Mode",
                RadioSettingValueList(MODE_LIST, MODE_LIST[_settings.mode])))

        group.append(
            RadioSetting(
                "ab_switch", "A/B",
                RadioSettingValueList(AB_LIST, AB_LIST[_settings.ab_switch])))

        group.append(
            RadioSetting(
                "a_channel", "A Selected Memory",
                RadioSettingValueInteger(1, 128, _settings.a_channel + 1)))

        group.append(
            RadioSetting(
                "b_channel", "B Selected Memory",
                RadioSettingValueInteger(1, 128, _settings.b_channel + 1)))

        group.append(
            RadioSetting(
                "a_display", "A Channel Display",
                RadioSettingValueList(DISPLAY_LIST,
                                      DISPLAY_LIST[_settings.a_display])))
        group.append(
            RadioSetting(
                "b_display", "B Channel Display",
                RadioSettingValueList(DISPLAY_LIST,
                                      DISPLAY_LIST[_settings.b_display])))
        group.append(
            RadioSetting(
                "tx_sel", "Priority Transmit",
                RadioSettingValueList(TXSEL_LIST,
                                      TXSEL_LIST[_settings.tx_sel])))
        group.append(
            RadioSetting(
                "vox_level", "VOX Level",
                RadioSettingValueList(VOX_LIST,
                                      VOX_LIST[_settings.vox_level])))

        group.append(
            RadioSetting("squelch", "Squelch Level",
                         RadioSettingValueInteger(0, 9, _settings.squelch)))

        group.append(
            RadioSetting("dwait", "Dual Wait",
                         RadioSettingValueBoolean(_settings.dwait)))

        group.append(
            RadioSetting(
                "led", "LED Mode",
                RadioSettingValueList(LED_LIST, LED_LIST[_settings.led])))

        group.append(
            RadioSetting(
                "light", "Light Color",
                RadioSettingValueList(LIGHT_LIST,
                                      LIGHT_LIST[_settings.light])))

        group.append(
            RadioSetting("beep", "Beep",
                         RadioSettingValueBoolean(_settings.beep)))

        group.append(
            RadioSetting("ani", "ANI",
                         RadioSettingValueBoolean(_settings.ani)))

        group.append(
            RadioSetting(
                "tot", "Timeout Timer",
                RadioSettingValueList(TOT_LIST, TOT_LIST[_settings.tot])))

        group.append(
            RadioSetting("roger", "Roger Beep",
                         RadioSettingValueBoolean(_settings.roger)))

        group.append(
            RadioSetting("dw", "Dual Watch",
                         RadioSettingValueBoolean(_settings.dw)))

        group.append(
            RadioSetting("rxsave", "RX Save",
                         RadioSettingValueBoolean(_settings.rxsave)))

        def _filter(name):
            return str(name).rstrip("\xFF").rstrip()

        group.append(
            RadioSetting(
                "ponmsg", "Power-On Message",
                RadioSettingValueString(0, 7, _filter(_settings.ponmsg))))

        group.append(
            RadioSetting(
                "scan_mode", "Scan Mode",
                RadioSettingValueList(SCAN_MODE_LIST,
                                      SCAN_MODE_LIST[_settings.scan_mode])))

        group.append(
            RadioSetting("autolk", "Auto Lock",
                         RadioSettingValueBoolean(_settings.autolk)))

        group.append(
            RadioSetting(
                "lock_mode", "Keypad Lock Mode",
                RadioSettingValueList(LOCK_MODE_LIST,
                                      LOCK_MODE_LIST[_settings.lock_mode])))

        group.append(
            RadioSetting("voice", "Voice Prompt",
                         RadioSettingValueBoolean(_settings.voice)))

        group.append(
            RadioSetting(
                "opnmsg", "Opening Message",
                RadioSettingValueList(OPNMSG_LIST,
                                      OPNMSG_LIST[_settings.opnmsg])))

        group.append(
            RadioSetting(
                "tuning_step", "Tuning Step",
                RadioSettingValueList(
                    TUNING_STEPS_LIST,
                    TUNING_STEPS_LIST[_settings.tuning_step])))

        group.append(
            RadioSetting(
                "lamp_t", "Backlight Timeout",
                RadioSettingValueList(
                    BACKLIGHT_TIMEOUT_LIST,
                    BACKLIGHT_TIMEOUT_LIST[_settings.lamp_t])))

        group.append(
            RadioSetting(
                "a_work_area", "A Work Area",
                RadioSettingValueList(AB_LIST,
                                      AB_LIST[_settings.a_work_area])))

        group.append(
            RadioSetting(
                "b_work_area", "B Work Area",
                RadioSettingValueList(AB_LIST,
                                      AB_LIST[_settings.b_work_area])))

        return top

        group.append(
            RadioSetting("disnm", "Display Name",
                         RadioSettingValueBoolean(_settings.disnm)))

        return group
Exemplo n.º 36
0
    def get_settings(self):
        _settings = self._memobj.settings
        basic = RadioSettingGroup("basic", "Basic Settings")

        group = RadioSettings(basic)

        options = ["Time", "Carrier", "Search"]
        rs = RadioSetting("scantype", "Scan Type",
                          RadioSettingValueList(options,
                                                options[_settings.scantype]))
        basic.append(rs)

        options = ["Off"] + ["%s min" % x for x in range(1, 8)]
        rs = RadioSetting("timeout", "Time Out Timer",
                          RadioSettingValueList(
                              options, options[_settings.timeout]))
        basic.append(rs)

        options = ["A", "B"]
        rs = RadioSetting("freqmode_ab", "Frequency Mode",
                          RadioSettingValueList(
                              options, options[_settings.freqmode_ab]))
        basic.append(rs)

        options = ["Frequency Mode", "Channel Mode"]
        rs = RadioSetting("workmode_a", "Radio Work Mode(A)",
                          RadioSettingValueList(
                              options, options[_settings.workmode_a]))
        basic.append(rs)

        rs = RadioSetting("workmode_b", "Radio Work Mode(B)",
                          RadioSettingValueList(
                              options, options[_settings.workmode_b]))
        basic.append(rs)

        options = ["Frequency", "Name", "Channel"]
        rs = RadioSetting("mdf_a", "Display Format(F1)",
                          RadioSettingValueList(
                              options, options[_settings.mdf_a]))
        basic.append(rs)

        rs = RadioSetting("mdf_b", "Display Format(F2)",
                          RadioSettingValueList(
                              options, options[_settings.mdf_b]))
        basic.append(rs)

        rs = RadioSetting("mem_chan_a", "Mem Channel (A)",
                          RadioSettingValueInteger(
                              1, 99, _settings.mem_chan_a))
        basic.append(rs)

        rs = RadioSetting("mem_chan_b", "Mem Channel (B)",
                          RadioSettingValueInteger(
                              1, 99, _settings.mem_chan_b))
        basic.append(rs)

        options = ["Off", "BOT", "EOT", "Both"]
        rs = RadioSetting("pttid", "PTT-ID",
                          RadioSettingValueList(
                              options, options[_settings.pttid]))
        basic.append(rs)

        dtmfchars = "0123456789ABCD*#"
        _codeobj = self._memobj.pttid.code
        _code = "".join([dtmfchars[x] for x in _codeobj if int(x) < 0x1F])
        val = RadioSettingValueString(0, 6, _code, False)
        val.set_charset(dtmfchars)
        rs = RadioSetting("pttid.code", "PTT-ID Code", val)

        def apply_code(setting, obj):
            code = []
            for j in range(0, 6):
                try:
                    code.append(dtmfchars.index(str(setting.value)[j]))
                except IndexError:
                    code.append(0xFF)
            obj.code = code
        rs.set_apply_callback(apply_code, self._memobj.pttid)
        basic.append(rs)

        rs = RadioSetting("squelch", "Squelch Level",
                          RadioSettingValueInteger(0, 9, _settings.squelch))
        basic.append(rs)

        rs = RadioSetting("vox", "VOX Level",
                          RadioSettingValueInteger(0, 9, _settings.vox))
        basic.append(rs)

        options = ["Frequency Mode", "Channel Mode"]
        rs = RadioSetting("workmode_fm", "FM Work Mode",
                          RadioSettingValueList(
                              options, options[_settings.workmode_fm]))
        basic.append(rs)

        options = ["Current Frequency", "F1 Frequency", "F2 Frequency"]
        rs = RadioSetting("txtdr", "Dual Standby TX Priority",
                          RadioSettingValueList(options,
                                                options[_settings.txtdr]))
        basic.append(rs)

        options = ["English", "Chinese"]
        rs = RadioSetting("language", "Language",
                          RadioSettingValueList(options,
                                                options[_settings.language]))
        basic.append(rs)

        rs = RadioSetting("tdr", "Dual Standby",
                          RadioSettingValueBoolean(_settings.tdr))
        basic.append(rs)

        rs = RadioSetting("roger", "Roger Beep",
                          RadioSettingValueBoolean(_settings.roger))
        basic.append(rs)

        rs = RadioSetting("backlight", "Backlight",
                          RadioSettingValueBoolean(_settings.backlight))
        basic.append(rs)

        rs = RadioSetting("save_funct", "Save Mode",
                          RadioSettingValueBoolean(_settings.save_funct))
        basic.append(rs)

        rs = RadioSetting("fm", "FM Function",
                          RadioSettingValueBoolean(_settings.fm))
        basic.append(rs)

        rs = RadioSetting("beep_tone_disabled", "Beep Prompt",
                          RadioSettingValueBoolean(
                              not _settings.beep_tone_disabled))
        basic.append(rs)

        rs = RadioSetting("voice_prompt", "Voice Prompt",
                          RadioSettingValueBoolean(_settings.voice_prompt))
        basic.append(rs)

        rs = RadioSetting("sidetone", "DTMF Side Tone",
                          RadioSettingValueBoolean(_settings.sidetone))
        basic.append(rs)

        rs = RadioSetting("ste_disabled", "Squelch Tail Eliminate",
                          RadioSettingValueBoolean(not _settings.ste_disabled))
        basic.append(rs)

        _limit = int(self._memobj.limits.lower_vhf) / 10
        rs = RadioSetting("limits.lower_vhf", "VHF Lower Limit (MHz)",
                          RadioSettingValueInteger(128, 270, _limit))

        def apply_limit(setting, obj):
            value = int(setting.value) * 10
            obj.lower_vhf = value
        rs.set_apply_callback(apply_limit, self._memobj.limits)
        basic.append(rs)

        _limit = int(self._memobj.limits.upper_vhf) / 10
        rs = RadioSetting("limits.upper_vhf", "VHF Upper Limit (MHz)",
                          RadioSettingValueInteger(128, 270, _limit))

        def apply_limit(setting, obj):
            value = int(setting.value) * 10
            obj.upper_vhf = value
        rs.set_apply_callback(apply_limit, self._memobj.limits)
        basic.append(rs)

        _limit = int(self._memobj.limits.lower_uhf) / 10
        rs = RadioSetting("limits.lower_uhf", "UHF Lower Limit (MHz)",
                          RadioSettingValueInteger(400, 520, _limit))

        def apply_limit(setting, obj):
            value = int(setting.value) * 10
            obj.lower_uhf = value
        rs.set_apply_callback(apply_limit, self._memobj.limits)
        basic.append(rs)

        _limit = int(self._memobj.limits.upper_uhf) / 10
        rs = RadioSetting("limits.upper_uhf", "UHF Upper Limit (MHz)",
                          RadioSettingValueInteger(400, 520, _limit))

        def apply_limit(setting, obj):
            value = int(setting.value) * 10
            obj.upper_uhf = value
        rs.set_apply_callback(apply_limit, self._memobj.limits)
        basic.append(rs)

        fm_preset = RadioSettingGroup("fm_preset", "FM Radio Presets")
        group.append(fm_preset)

        for i in range(0, 16):
            if self._memobj.fm_presets[i] < 0x01AF:
                used = True
                preset = self._memobj.fm_presets[i] / 10.0 + 65
            else:
                used = False
                preset = 65
            rs = RadioSetting("fm_presets_%1i" % i, "FM Preset %i" % (i + 1),
                              RadioSettingValueBoolean(used),
                              RadioSettingValueFloat(65, 108, preset, 0.1, 1))
            fm_preset.append(rs)

        testmode = RadioSettingGroup("testmode", "Test Mode Settings")
        group.append(testmode)

        vhfdata = ["136-139", "140-144", "145-149", "150-154",
                   "155-159", "160-164", "165-169", "170-174"]
        uhfdata = ["400-409", "410-419", "420-429", "430-439",
                   "440-449", "450-459", "460-469", "470-479"]
        powernamedata = ["Hi", "Lo"]
        powerkeydata = ["hipwr", "lopwr"]

        for power in range(0, 2):
            for index in range(0, 8):
                key = "test.vhf%s%i" % (powerkeydata[power], index)
                name = "%s Mhz %s Power" % (vhfdata[index],
                                            powernamedata[power])
                rs = RadioSetting(
                        key, name, RadioSettingValueInteger(
                            0, 255, getattr(
                                self._memobj.test,
                                "vhf%s%i" % (powerkeydata[power], index))))
                testmode.append(rs)

        for power in range(0, 2):
            for index in range(0, 8):
                key = "test.uhf%s%i" % (powerkeydata[power], index)
                name = "%s Mhz %s Power" % (uhfdata[index],
                                            powernamedata[power])
                rs = RadioSetting(
                        key, name, RadioSettingValueInteger(
                            0, 255, getattr(
                                self._memobj.test,
                                "uhf%s%i" % (powerkeydata[power], index))))
                testmode.append(rs)

        for band in ["vhf", "uhf"]:
            for index in range(0, 10):
                key = "test.%ssquelch%i" % (band, index)
                name = "%s Squelch %i" % (band.upper(), index)
                rs = RadioSetting(
                        key, name, RadioSettingValueInteger(
                            0, 255, getattr(
                                self._memobj.test,
                                "%ssquelch%i" % (band, index))))
                testmode.append(rs)

        return group
Exemplo n.º 37
0
    def get_settings(self):
        """Translate the bit in the mem_struct into settings in the UI"""
        _mem = self._memobj
        basic = RadioSettingGroup("basic", "Basic Settings")
        advanced = RadioSettingGroup("advanced", "Advanced Settings")
        other = RadioSettingGroup("other", "Other Settings")
        work = RadioSettingGroup("work", "Work Mode Settings")
        fm_preset = RadioSettingGroup("fm_preset", "FM Preset")
        dtmfe = RadioSettingGroup("dtmfe", "DTMF Encode Settings")
        service = RadioSettingGroup("service", "Service Settings")
        top = RadioSettings(basic, advanced, other, work, fm_preset, dtmfe,
                            service)

        # Basic settings
        if _mem.settings.squelch > 0x09:
            val = 0x00
        else:
            val = _mem.settings.squelch
        rs = RadioSetting("settings.squelch", "Squelch",
                          RadioSettingValueList(
                              LIST_OFF1TO9, LIST_OFF1TO9[val]))
        basic.append(rs)

        if _mem.settings.save > 0x04:
            val = 0x00
        else:
            val = _mem.settings.save
        rs = RadioSetting("settings.save", "Battery Saver",
                          RadioSettingValueList(
                              LIST_SAVE, LIST_SAVE[val]))
        basic.append(rs)

        if _mem.settings.vox > 0x0A:
            val = 0x00
        else:
            val = _mem.settings.vox
        rs = RadioSetting("settings.vox", "Vox",
                          RadioSettingValueList(
                              LIST_OFF1TO10, LIST_OFF1TO10[val]))
        basic.append(rs)

        if _mem.settings.abr > 0x0A:
            val = 0x00
        else:
            val = _mem.settings.abr
        rs = RadioSetting("settings.abr", "Backlight Timeout",
                          RadioSettingValueList(
                              LIST_OFF1TO10, LIST_OFF1TO10[val]))
        basic.append(rs)

        rs = RadioSetting("settings.tdr", "Dual Watch",
                          RadioSettingValueBoolean(_mem.settings.tdr))
        basic.append(rs)

        rs = RadioSetting("settings.beep", "Beep",
                           RadioSettingValueBoolean(_mem.settings.beep))
        basic.append(rs)

        if _mem.settings.timeout > 0x27:
            val = 0x03
        else:
            val = _mem.settings.timeout
        rs = RadioSetting("settings.timeout", "Timeout Timer",
                          RadioSettingValueList(
                              LIST_TIMEOUT, LIST_TIMEOUT[val]))
        basic.append(rs)

        if _mem.settings.voice > 0x02:
            val = 0x01
        else:
            val = _mem.settings.voice
        rs = RadioSetting("settings.voice", "Voice Prompt",
                          RadioSettingValueList(
                              LIST_VOICE, LIST_VOICE[val]))
        basic.append(rs)

        rs = RadioSetting("settings.dtmfst", "DTMF Sidetone",
                          RadioSettingValueList(LIST_DTMFST, LIST_DTMFST[
                              _mem.settings.dtmfst]))
        basic.append(rs)

        if _mem.settings.screv > 0x02:
            val = 0x01
        else:
            val = _mem.settings.screv
        rs = RadioSetting("settings.screv", "Scan Resume",
                          RadioSettingValueList(
                              LIST_RESUME, LIST_RESUME[val]))
        basic.append(rs)

        rs = RadioSetting("settings.pttid", "When to send PTT ID",
                          RadioSettingValueList(LIST_PTTID, LIST_PTTID[
                              _mem.settings.pttid]))
        basic.append(rs)

        if _mem.settings.pttlt > 0x1E:
            val = 0x05
        else:
            val = _mem.settings.pttlt
        rs = RadioSetting("pttlt", "PTT ID Delay",
                          RadioSettingValueInteger(0, 50, val))
        basic.append(rs)

        rs = RadioSetting("settings.mdfa", "Display Mode (A)",
                          RadioSettingValueList(LIST_MODE, LIST_MODE[
                              _mem.settings.mdfa]))
        basic.append(rs)

        rs = RadioSetting("settings.mdfb", "Display Mode (B)",
                          RadioSettingValueList(LIST_MODE, LIST_MODE[
                              _mem.settings.mdfb]))
        basic.append(rs)

        rs = RadioSetting("settings.autolk", "Automatic Key Lock",
                          RadioSettingValueBoolean(_mem.settings.autolk))
        basic.append(rs)

        rs = RadioSetting("settings.wtled", "Standby LED Color",
                          RadioSettingValueList(
                              LIST_COLOR, LIST_COLOR[_mem.settings.wtled]))
        basic.append(rs)

        rs = RadioSetting("settings.rxled", "RX LED Color",
                          RadioSettingValueList(
                              LIST_COLOR, LIST_COLOR[_mem.settings.rxled]))
        basic.append(rs)

        rs = RadioSetting("settings.txled", "TX LED Color",
                          RadioSettingValueList(
                              LIST_COLOR, LIST_COLOR[_mem.settings.txled]))
        basic.append(rs)

        val = _mem.settings.almod
        rs = RadioSetting("settings.almod", "Alarm Mode",
                          RadioSettingValueList(
                              LIST_ALMOD, LIST_ALMOD[val]))
        basic.append(rs)

        if _mem.settings.tdrab > 0x02:
            val = 0x00
        else:
            val = _mem.settings.tdrab
        rs = RadioSetting("settings.tdrab", "Dual Watch TX Priority",
                          RadioSettingValueList(
                              LIST_OFFAB, LIST_OFFAB[val]))
        basic.append(rs)

        rs = RadioSetting("settings.ste", "Squelch Tail Eliminate (HT to HT)",
                          RadioSettingValueBoolean(_mem.settings.ste))
        basic.append(rs)

        if _mem.settings.rpste > 0x0A:
            val = 0x00
        else:
            val = _mem.settings.rpste
        rs = RadioSetting("settings.rpste",
                          "Squelch Tail Eliminate (repeater)",
                              RadioSettingValueList(
                              LIST_RPSTE, LIST_RPSTE[val]))
        basic.append(rs)

        if _mem.settings.rptrl > 0x0A:
            val = 0x00
        else:
            val = _mem.settings.rptrl
        rs = RadioSetting("settings.rptrl", "STE Repeater Delay",
                          RadioSettingValueList(
                              LIST_STEDELAY, LIST_STEDELAY[val]))
        basic.append(rs)

        rs = RadioSetting("settings.ponmsg", "Power-On Message",
                          RadioSettingValueList(LIST_PONMSG, LIST_PONMSG[
                              _mem.settings.ponmsg]))
        basic.append(rs)

        rs = RadioSetting("settings.roger", "Roger Beep",
                          RadioSettingValueBoolean(_mem.settings.roger))
        basic.append(rs)

        # Advanced settings
        rs = RadioSetting("settings.reset", "RESET Menu",
                          RadioSettingValueBoolean(_mem.settings.reset))
        advanced.append(rs)

        rs = RadioSetting("settings.menu", "All Menus",
                          RadioSettingValueBoolean(_mem.settings.menu))
        advanced.append(rs)

        rs = RadioSetting("settings.fmradio", "Broadcast FM Radio",
                          RadioSettingValueBoolean(_mem.settings.fmradio))
        advanced.append(rs)

        rs = RadioSetting("settings.alarm", "Alarm Sound",
                          RadioSettingValueBoolean(_mem.settings.alarm))
        advanced.append(rs)

        # Other settings
        def _filter(name):
            filtered = ""
            for char in str(name):
                if char in chirp_common.CHARSET_ASCII:
                    filtered += char
                else:
                    filtered += " "
            return filtered

        _msg = _mem.firmware_msg
        val = RadioSettingValueString(0, 7, _filter(_msg.line1))
        val.set_mutable(False)
        rs = RadioSetting("firmware_msg.line1", "Firmware Message 1", val)
        other.append(rs)

        val = RadioSettingValueString(0, 7, _filter(_msg.line2))
        val.set_mutable(False)
        rs = RadioSetting("firmware_msg.line2", "Firmware Message 2", val)
        other.append(rs)

        _msg = _mem.sixpoweron_msg
        val = RadioSettingValueString(0, 7, _filter(_msg.line1))
        val.set_mutable(False)
        rs = RadioSetting("sixpoweron_msg.line1", "6+Power-On Message 1", val)
        other.append(rs)
        val = RadioSettingValueString(0, 7, _filter(_msg.line2))
        val.set_mutable(False)
        rs = RadioSetting("sixpoweron_msg.line2", "6+Power-On Message 2", val)
        other.append(rs)

        _msg = _mem.poweron_msg
        rs = RadioSetting("poweron_msg.line1", "Power-On Message 1",
                          RadioSettingValueString(
                              0, 7, _filter(_msg.line1)))
        other.append(rs)
        rs = RadioSetting("poweron_msg.line2", "Power-On Message 2",
                          RadioSettingValueString(
                              0, 7, _filter(_msg.line2)))
        other.append(rs)

        lower = 130
        upper = 179
        rs = RadioSetting("limits.vhf.lower", "VHF Lower Limit (MHz)",
                          RadioSettingValueInteger(
                              lower, upper, _mem.limits.vhf.lower))
        other.append(rs)

        rs = RadioSetting("limits.vhf.upper", "VHF Upper Limit (MHz)",
                          RadioSettingValueInteger(
                              lower, upper, _mem.limits.vhf.upper))
        other.append(rs)

        lower = 400
        upper = 520
        rs = RadioSetting("limits.uhf.lower", "UHF Lower Limit (MHz)",
                          RadioSettingValueInteger(
                              lower, upper, _mem.limits.uhf.lower))
        other.append(rs)

        rs = RadioSetting("limits.uhf.upper", "UHF Upper Limit (MHz)",
                          RadioSettingValueInteger(
                              lower, upper, _mem.limits.uhf.upper))
        other.append(rs)

        # Work mode settings
        rs = RadioSetting("settings.displayab", "Display",
                          RadioSettingValueList(
                              LIST_AB, LIST_AB[_mem.settings.displayab]))
        work.append(rs)

        rs = RadioSetting("settings.workmode", "VFO/MR Mode",
                          RadioSettingValueList(
                              LIST_WORKMODE,
                              LIST_WORKMODE[_mem.settings.workmode]))
        work.append(rs)

        rs = RadioSetting("settings.keylock", "Keypad Lock",
                          RadioSettingValueBoolean(_mem.settings.keylock))
        work.append(rs)

        rs = RadioSetting("wmchannel.mrcha", "MR A Channel",
                          RadioSettingValueInteger(0, 127,
                                                      _mem.wmchannel.mrcha))
        work.append(rs)

        rs = RadioSetting("wmchannel.mrchb", "MR B Channel",
                          RadioSettingValueInteger(0, 127,
                                                      _mem.wmchannel.mrchb))
        work.append(rs)

        def convert_bytes_to_freq(bytes):
            real_freq = 0
            for byte in bytes:
                real_freq = (real_freq * 10) + byte
            return chirp_common.format_freq(real_freq * 10)

        def my_validate(value):
            value = chirp_common.parse_freq(value)
            msg = ("Can't be less than %i.0000")
            if value > 99000000 and value < 130 * 1000000:
                raise InvalidValueError(msg % (130))
            msg = ("Can't be between %i.9975-%i.0000")
            if (179 + 1) * 1000000 <= value and value < 400 * 1000000:
                raise InvalidValueError(msg % (179, 400))
            msg = ("Can't be greater than %i.9975")
            if value > 99000000 and value > (520 + 1) * 1000000:
                raise InvalidValueError(msg % (520))
            return chirp_common.format_freq(value)

        def apply_freq(setting, obj):
            value = chirp_common.parse_freq(str(setting.value)) / 10
            for i in range(7, -1, -1):
                obj.freq[i] = value % 10
                value /= 10

        val1a = RadioSettingValueString(0, 10,
                                        convert_bytes_to_freq(_mem.vfo.a.freq))
        val1a.set_validate_callback(my_validate)
        rs = RadioSetting("vfo.a.freq", "VFO A Frequency", val1a)
        rs.set_apply_callback(apply_freq, _mem.vfo.a)
        work.append(rs)

        val1b = RadioSettingValueString(0, 10,
                                        convert_bytes_to_freq(_mem.vfo.b.freq))
        val1b.set_validate_callback(my_validate)
        rs = RadioSetting("vfo.b.freq", "VFO B Frequency", val1b)
        rs.set_apply_callback(apply_freq, _mem.vfo.b)
        work.append(rs)

        rs = RadioSetting("vfo.a.sftd", "VFO A Shift",
                          RadioSettingValueList(
                              LIST_SHIFTD, LIST_SHIFTD[_mem.vfo.a.sftd]))
        work.append(rs)

        rs = RadioSetting("vfo.b.sftd", "VFO B Shift",
                          RadioSettingValueList(
                              LIST_SHIFTD, LIST_SHIFTD[_mem.vfo.b.sftd]))
        work.append(rs)

        def convert_bytes_to_offset(bytes):
            real_offset = 0
            for byte in bytes:
                real_offset = (real_offset * 10) + byte
            return chirp_common.format_freq(real_offset * 1000)

        def apply_offset(setting, obj):
            value = chirp_common.parse_freq(str(setting.value)) / 1000
            for i in range(5, -1, -1):
                obj.offset[i] = value % 10
                value /= 10

        val1a = RadioSettingValueString(
                    0, 10, convert_bytes_to_offset(_mem.vfo.a.offset))
        rs = RadioSetting("vfo.a.offset",
                          "VFO A Offset", val1a)
        rs.set_apply_callback(apply_offset, _mem.vfo.a)
        work.append(rs)

        val1b = RadioSettingValueString(
                    0, 10, convert_bytes_to_offset(_mem.vfo.b.offset))
        rs = RadioSetting("vfo.b.offset",
                          "VFO B Offset", val1b)
        rs.set_apply_callback(apply_offset, _mem.vfo.b)
        work.append(rs)

        rs = RadioSetting("vfo.a.txpower3", "VFO A Power",
                          RadioSettingValueList(
                              LIST_TXPOWER,
                              LIST_TXPOWER[_mem.vfo.a.txpower3]))
        work.append(rs)

        rs = RadioSetting("vfo.b.txpower3", "VFO B Power",
                          RadioSettingValueList(
                              LIST_TXPOWER,
                              LIST_TXPOWER[_mem.vfo.b.txpower3]))
        work.append(rs)

        rs = RadioSetting("vfo.a.widenarr", "VFO A Bandwidth",
                          RadioSettingValueList(
                              LIST_BANDWIDTH,
                              LIST_BANDWIDTH[_mem.vfo.a.widenarr]))
        work.append(rs)

        rs = RadioSetting("vfo.b.widenarr", "VFO B Bandwidth",
                          RadioSettingValueList(
                              LIST_BANDWIDTH,
                              LIST_BANDWIDTH[_mem.vfo.b.widenarr]))
        work.append(rs)

        rs = RadioSetting("vfo.a.scode", "VFO A S-CODE",
                          RadioSettingValueList(
                              LIST_SCODE,
                              LIST_SCODE[_mem.vfo.a.scode]))
        work.append(rs)

        rs = RadioSetting("vfo.b.scode", "VFO B S-CODE",
                          RadioSettingValueList(
                              LIST_SCODE,
                              LIST_SCODE[_mem.vfo.b.scode]))
        work.append(rs)

        rs = RadioSetting("vfo.a.step", "VFO A Tuning Step",
                          RadioSettingValueList(
                              LIST_STEP, LIST_STEP[_mem.vfo.a.step]))
        work.append(rs)
        rs = RadioSetting("vfo.b.step", "VFO B Tuning Step",
                          RadioSettingValueList(
                              LIST_STEP, LIST_STEP[_mem.vfo.b.step]))
        work.append(rs)

        # broadcast FM settings
        _fm_presets = self._memobj.fm_presets
        if _fm_presets <= 108.0 * 10 - 650:
            preset = _fm_presets / 10.0 + 65
        elif _fm_presets >= 65.0 * 10 and _fm_presets <= 108.0 * 10:
            preset = _fm_presets / 10.0
        else:
            preset = 76.0
        rs = RadioSetting("fm_presets", "FM Preset(MHz)",
                          RadioSettingValueFloat(65, 108.0, preset, 0.1, 1))
        fm_preset.append(rs)

        # DTMF settings
        def apply_code(setting, obj, length):
            code = []
            for j in range(0, length):
                try:
                    code.append(DTMF_CHARS.index(str(setting.value)[j]))
                except IndexError:
                    code.append(0xFF)
            obj.code = code

        for i in range(0, 15):
            _codeobj = self._memobj.pttid[i].code
            _code = "".join([DTMF_CHARS[x] for x in _codeobj if int(x) < 0x1F])
            val = RadioSettingValueString(0, 5, _code, False)
            val.set_charset(DTMF_CHARS)
            pttid = RadioSetting("pttid/%i.code" % i,
                                 "Signal Code %i" % (i + 1), val)
            pttid.set_apply_callback(apply_code, self._memobj.pttid[i], 5)
            dtmfe.append(pttid)

        if _mem.ani.dtmfon > 0xC3:
            val = 0x03
        else:
            val = _mem.ani.dtmfon
        rs = RadioSetting("ani.dtmfon", "DTMF Speed (on)",
                          RadioSettingValueList(LIST_DTMFSPEED,
                                                LIST_DTMFSPEED[val]))
        dtmfe.append(rs)

        if _mem.ani.dtmfoff > 0xC3:
            val = 0x03
        else:
            val = _mem.ani.dtmfoff
        rs = RadioSetting("ani.dtmfoff", "DTMF Speed (off)",
                          RadioSettingValueList(LIST_DTMFSPEED,
                                                LIST_DTMFSPEED[val]))
        dtmfe.append(rs)

        _codeobj = self._memobj.ani.code
        _code = "".join([DTMF_CHARS[x] for x in _codeobj if int(x) < 0x1F])
        val = RadioSettingValueString(0, 5, _code, False)
        val.set_charset(DTMF_CHARS)
        rs = RadioSetting("ani.code", "ANI Code", val)
        rs.set_apply_callback(apply_code, self._memobj.ani, 5)
        dtmfe.append(rs)

        rs = RadioSetting("ani.aniid", "When to send ANI ID",
                          RadioSettingValueList(LIST_PTTID,
                                                LIST_PTTID[_mem.ani.aniid]))
        dtmfe.append(rs)

        # Service settings
        for band in ["vhf", "uhf"]:
            for index in range(0, 10):
                key = "squelch.%s.sql%i" % (band, index)
                if band == "vhf":
                    _obj = self._memobj.squelch.vhf
                elif band == "uhf":
                    _obj = self._memobj.squelch.uhf
                val = RadioSettingValueInteger(0, 123,
                          getattr(_obj, "sql%i" % (index)))
                if index == 0:
                    val.set_mutable(False)
                name = "%s Squelch %i" % (band.upper(), index)
                rs = RadioSetting(key, name, val)
                service.append(rs)

        return top
Exemplo n.º 38
0
    def get_settings(self):
    #    """Translate the bit in the mem_struct into settings in the UI"""
        _mem = self._memobj
        basic = RadioSettingGroup("basic", "Basic Settings")
        advanced = RadioSettingGroup("advanced", "Advanced Settings")
        #other = RadioSettingGroup("other", "Other Settings")
        #work = RadioSettingGroup("work", "Work Mode Settings")
        #fm_preset = RadioSettingGroup("fm_preset", "FM Preset")
        #dtmfe = RadioSettingGroup("dtmfe", "DTMF Encode Settings")
        #dtmfd = RadioSettingGroup("dtmfd", "DTMF Decode Settings")
        #service = RadioSettingGroup("service", "Service Settings")
        #top = RadioSettings(basic, advanced, other, work, fm_preset, dtmfe,
        #                    dtmfd, service)
        top = RadioSettings(basic, advanced, )

        # Basic settings
        rs = RadioSetting("settings.beep", "Beep",
                           RadioSettingValueBoolean(_mem.settings.beep))
        basic.append(rs)

        if _mem.settings.squelcha > 0x09:
            val = 0x00
        else:
            val = _mem.settings.squelcha
        rs = RadioSetting("squelcha", "Squelch Level A",
                          RadioSettingValueInteger(0, 9, _mem.settings.squelcha))
        basic.append(rs)


        if _mem.settings.squelchb > 0x09:
            val = 0x00
        else:
            val = _mem.settings.squelchb
        rs = RadioSetting("squelchb", "Squelch Level B",
                          RadioSettingValueInteger(0, 9, _mem.settings.squelchb))
        basic.append(rs)


        if _mem.settings.voice > 0x02:
            val = 0x01
        else:
            val = _mem.settings.voice
        rs = RadioSetting("settings.voice", "Voice Prompt",
                          RadioSettingValueList(
                              LIST_VOICE, LIST_VOICE[val]))
        basic.append(rs)

        if _mem.settings.vox > 0x0A:
            val = 0x00
        else:
            val = _mem.settings.vox
        rs = RadioSetting("settings.vox", "VOX",
                          RadioSettingValueList(
                              LIST_OFF1TO10, LIST_OFF1TO10[val]))
        basic.append(rs)

        rs = RadioSetting("settings.autolk", "Automatic Key Lock",
                          RadioSettingValueBoolean(_mem.settings.autolk))
        basic.append(rs)

        if _mem.settings.screv > 0x02:
            val = 0x01
        else:
            val = _mem.settings.screv
        rs = RadioSetting("settings.screv", "Scan Resume",
                          RadioSettingValueList(
                              LIST_RESUME, LIST_RESUME[val]))
        basic.append(rs)

        if _mem.settings.toa > 0x0A:
            val = 0x00
        else:
            val = _mem.settings.toa
        rs = RadioSetting("settings.toa", "Time-out Pre-Alert",
                          RadioSettingValueList(
                              LIST_OFF1TO10, LIST_OFF1TO10[val]))
        basic.append(rs)

        if _mem.settings.timeout > 0x28:
            val = 0x03
        else:
            val = _mem.settings.timeout
        rs = RadioSetting("settings.timeout", "Timeout Timer",
                          RadioSettingValueList(
                              LIST_TIMEOUT, LIST_TIMEOUT[val]))
        basic.append(rs)

        rs = RadioSetting("settings.wtled", "Standby LED Color",
                          RadioSettingValueList(
                              LIST_COLOR, LIST_COLOR[_mem.settings.wtled]))
        basic.append(rs)

        rs = RadioSetting("settings.rxled", "RX LED Color",
                          RadioSettingValueList(
                              LIST_COLOR, LIST_COLOR[_mem.settings.rxled]))
        basic.append(rs)

        rs = RadioSetting("settings.txled", "TX LED Color",
                          RadioSettingValueList(
                              LIST_COLOR, LIST_COLOR[_mem.settings.txled]))
        basic.append(rs)

        rs = RadioSetting("settings.roger", "Roger Beep",
                          RadioSettingValueList(LIST_ROGER, LIST_ROGER[
                              _mem.settings.roger]))
        basic.append(rs)

        rs = RadioSetting("settings.mdfa", "Display Mode (A)",
                          RadioSettingValueList(LIST_MODE, LIST_MODE[
                              _mem.settings.mdfa]))
        basic.append(rs)

        rs = RadioSetting("settings.mdfb", "Display Mode (B)",
                          RadioSettingValueList(LIST_MODE, LIST_MODE[
                              _mem.settings.mdfb]))
        basic.append(rs)

        rs = RadioSetting("settings.pf1", "PF1 Key Assignment",
                          RadioSettingValueList(LIST_PF1, LIST_PF1[
                              _mem.settings.pf1]))
        basic.append(rs)

        rs = RadioSetting("settings.tdr", "Dual Watch(TDR)",
                          RadioSettingValueBoolean(_mem.settings.tdr))
        basic.append(rs)

        rs = RadioSetting("settings.ani", "ANI",
                          RadioSettingValueBoolean(_mem.settings.ani))
        basic.append(rs)

        if _mem.settings.pttdly > 0x0A:
            val = 0x00
        else:
            val = _mem.settings.pttdly
        rs = RadioSetting("settings.pttdly", "PTT ID Delay",
                          RadioSettingValueList(
                              LIST_OFF1TO30, LIST_OFF1TO30[val]))
        basic.append(rs)

        rs = RadioSetting("settings.pttid", "When to send PTT ID",
                          RadioSettingValueList(LIST_PTTID,
                                                LIST_PTTID[_mem.settings.pttid]))
        basic.append(rs)

        rs = RadioSetting("settings.dtmfst", "DTMF Sidetone",
                          RadioSettingValueList(LIST_DTMFST, LIST_DTMFST[
                              _mem.settings.dtmfst]))
        basic.append(rs)

        rs = RadioSetting("settings.ponmsg", "Power-On Message",
                          RadioSettingValueList(LIST_PONMSG, LIST_PONMSG[
                              _mem.settings.ponmsg]))
        basic.append(rs)

        rs = RadioSetting("settings.dw", "DW",
                          RadioSettingValueBoolean(_mem.settings.dw))
        basic.append(rs)

        # Advanced settings
        rs = RadioSetting("settings.prioritych", "Priority Channel",
                          RadioSettingValueList(LIST_PRIORITY, LIST_PRIORITY[
                              _mem.settings.prioritych]))
        advanced.append(rs)

        rs = RadioSetting("settings.vfomr", "Work Mode",
                          RadioSettingValueList(LIST_WORKMODE, LIST_WORKMODE[
                              _mem.settings.vfomr]))
        advanced.append(rs)

        dtmfchars = "0123456789"
        _codeobj = _mem.settings.code
        _code = "".join([dtmfchars[x] for x in _codeobj if int(x) < 0x1F])
        val = RadioSettingValueString(0, 3, _code, False)
        val.set_charset(dtmfchars)
        rs = RadioSetting("settings.code", "PTT-ID Code", val)

        def apply_code(setting, obj):
            code = []
            for j in range(0, 3):
                try:
                    code.append(dtmfchars.index(str(setting.value)[j]))
                except IndexError:
                    code.append(0xFF)
            obj.code = code
        rs.set_apply_callback(apply_code, _mem.settings)
        advanced.append(rs)

        _codeobj = _mem.settings.password
        _code = "".join([dtmfchars[x] for x in _codeobj if int(x) < 0x1F])
        val = RadioSettingValueString(0, 6, _code, False)
        val.set_charset(dtmfchars)
        rs = RadioSetting("settings.password", "Control Password", val)

        def apply_code(setting, obj):
            code = []
            for j in range(0, 6):
                try:
                    code.append(dtmfchars.index(str(setting.value)[j]))
                except IndexError:
                    code.append(0xFF)
            obj.password = code
        rs.set_apply_callback(apply_code, _mem.settings)
        advanced.append(rs)

        if _mem.settings.tdrab > 0x01:
            val = 0x00
        else:
            val = _mem.settings.tdrab
        rs = RadioSetting("settings.tdrab", "Dual Watch TX Priority",
                          RadioSettingValueList(
                              LIST_AB, LIST_AB[val]))
        advanced.append(rs)

        rs = RadioSetting("settings.keylk", "Key Lock",
                          RadioSettingValueBoolean(_mem.settings.keylk))
        advanced.append(rs)

        rs = RadioSetting("settings.control", "Control Code",
                          RadioSettingValueBoolean(_mem.settings.control))
        advanced.append(rs)

        return top



        """
Exemplo n.º 39
0
    def get_settings(self):
        """Translate the bit in the mem_struct into settings in the UI"""
        _mem = self._memobj
        basic = RadioSettingGroup("basic", "Basic")
        work = RadioSettingGroup("work", "Work Mode Settings")
        top = RadioSettings(basic, work)

        # Basic
        sql = RadioSetting("settings.sql", "Squelch Level",
                           RadioSettingValueList(LIST_SQL, LIST_SQL[
                               _mem.settings.sql]))
        basic.append(sql)

        tot = RadioSetting("settings.tot", "Time out timer",
                           RadioSettingValueList(LIST_TOT, LIST_TOT[
                               _mem.settings.tot]))
        basic.append(tot)

        power = RadioSetting("settings.power", "Actual Power",
                             RadioSettingValueList(POWER_LEVELS,
                                 POWER_LEVELS[_mem.settings.power]))
        basic.append(power)

        key_lock = RadioSetting("settings.key", "Keyboard Lock",
                                RadioSettingValueList(KEY_LOCK,
                                    KEY_LOCK[_mem.settings.key]))
        basic.append(key_lock)

        bw = RadioSetting("settings.bw", "Bandwidth",
                          RadioSettingValueList(BW, BW[_mem.settings.bw]))
        basic.append(bw)

        powerrank = RadioSetting("settings.powerrank", "Power output adjust",
                                 RadioSettingValueList(POWER_RANK,
                                     POWER_RANK[_mem.settings.powerrank]))
        basic.append(powerrank)

        lamp = RadioSetting("settings.lamp", "LCD Lamp",
                            RadioSettingValueBoolean(_mem.settings.lamp))
        basic.append(lamp)

        lamp_auto = RadioSetting("settings.lamp_auto", "LCD Lamp auto on/off",
                                 RadioSettingValueBoolean(
                                     _mem.settings.lamp_auto))
        basic.append(lamp_auto)

        bs = RadioSetting("settings.bs", "Battery Save",
                          RadioSettingValueBoolean(_mem.settings.bs))
        basic.append(bs)

        warning = RadioSetting("settings.warning", "Warning Alerts",
                               RadioSettingValueBoolean(_mem.settings.warning))
        basic.append(warning)

        monitor = RadioSetting("settings.monitor", "Monitor key",
                               RadioSettingValueBoolean(_mem.settings.monitor))
        basic.append(monitor)

        # Work mode settings
        wmset = RadioSetting("settings.wmem", "VFO/MR Mode",
                             RadioSettingValueList(
                                 W_MODE, W_MODE[_mem.settings.wmem]))
        work.append(wmset)

        active_ch = RadioSetting("settings.active_ch", "Work Channel",
                                 RadioSettingValueList(ACTIVE_CH,
                                     ACTIVE_CH[_mem.settings.active_ch]))
        work.append(active_ch)

        # vfo rx validation
        if _mem.vfo.vrx_freq.get_raw()[0] == "\xFF":
            # if the vfo is not set, the UI cares about the
            # length of the field, so set a default
            LOG.debug("VFO freq not set, setting it to default %s" %
                self._VFO_DEFAULT)
            vfo = self._VFO_DEFAULT
        else:
            vfo = int(_mem.vfo.vrx_freq) * 10

        vf_freq = RadioSetting("vfo.vrx_freq", "VFO frequency",
                               RadioSettingValueString(0, 10,
                                   chirp_common.format_freq(vfo)))
        work.append(vf_freq)

        # shift works
        # VSHIFT = ["None", "-", "+"]
        sset = 0
        if bool(_mem.vfo.shift_minus) is True:
            sset = 1
        elif bool(_mem.vfo.shift_plus) is True:
            sset = 2

        shift = RadioSetting("shift", "VFO Shift",
                             RadioSettingValueList(VSHIFT, VSHIFT[sset]))
        work.append(shift)

        # vfo shift validation if none set it to ZERO
        if _mem.settings.vfo_shift.get_raw()[0] == "\xFF":
            # if the shift is not set, the UI cares about the
            # length of the field, so set to zero
            LOG.debug("VFO shift not set, setting it to zero")
            vfo_shift = 0
        else:
            vfo_shift = int(_mem.settings.vfo_shift) * 10

        offset = RadioSetting("settings.vfo_shift", "VFO Offset",
                              RadioSettingValueString(0, 9,
                                 chirp_common.format_freq(vfo_shift)))
        work.append(offset)

        step = RadioSetting("settings.step", "VFO step",
                            RadioSettingValueList(STEPF,
                                STEPF[_mem.settings.step]))
        work.append(step)

        # at least for FD-268A/B it doesn't work as stated, so disabled
        # by now
        #scamble = RadioSetting("vfo.scramble", "Scramble",
                                #RadioSettingValueList(ONOFF,
                                        #ONOFF[int(_mem.vfo.scramble)]))
        #work.append(scamble)

        #busy_lock = RadioSetting("vfo.busy_lock", "Busy Lock out",
                                #RadioSettingValueList(ONOFF,
                                        #ONOFF[int(_mem.vfo.busy_lock)]))
        #work.append(busy_lock)

        # FD-288 Family ANI settings
        if "FD-288" in self.MODEL:
            ani_mode = RadioSetting("settings.ani_mode", "ANI ID",
                                    RadioSettingValueList(ANI,
                                        ANI[_mem.settings.ani_mode]))
            work.append(ani_mode)

            # it can't be \xFF
            ani_value = str(_mem.settings.ani)
            if ani_value == "\xFF\xFF\xFF":
                ani_value = "200"

            ani_value = "".join(x for x in ani_value
                            if (int(x) >= 2 and int(x) <= 9))

            ani = RadioSetting("settings.ani", "ANI (200-999)",
                               RadioSettingValueString(0, 3, ani_value))
            work.append(ani)

        return top
Exemplo n.º 40
0
    def get_settings(self):
        _settings = self._memobj.settings
        basic = RadioSettingGroup("basic", "Basic")
        dtmf = RadioSettingGroup("dtmf", "DTMF")
        arts = RadioSettingGroup("arts", "ARTS")
        prog = RadioSettingGroup("prog", "Programmable Buttons")

        top = RadioSettings(basic, dtmf, arts, prog)

        basic.append(RadioSetting(
                "priority_revert", "Priority Revert",
                RadioSettingValueBoolean(_settings.priority_revert)))

        basic.append(RadioSetting(
                "memory_only", "Memory Only mode",
                RadioSettingValueBoolean(_settings.memory_only)))

        opts = ["off"] + ["%0.1f" % (t / 60.0) for t in range(30, 750, 30)]
        basic.append(RadioSetting(
                "apo", "APO time (hrs)",
                RadioSettingValueList(opts, opts[_settings.apo])))

        basic.append(RadioSetting(
                "beep_scan", "Beep: Scan",
                RadioSettingValueBoolean(_settings.beep_scan)))

        basic.append(RadioSetting(
                "beep_edge", "Beep: Edge",
                RadioSettingValueBoolean(_settings.beep_edge)))

        basic.append(RadioSetting(
                "beep_key", "Beep: Key",
                RadioSettingValueBoolean(_settings.beep_key)))

        opts = ["T/RX Normal", "RX Reverse", "TX Reverse", "T/RX Reverse"]
        basic.append(RadioSetting(
                "dcs_polarity", "DCS polarity",
                RadioSettingValueList(opts, opts[_settings.dcs_polarity])))

        opts = ["off", "dim 1", "dim 2", "dim 3"]
        basic.append(RadioSetting(
                "dimmer", "Dimmer",
                RadioSettingValueList(opts, opts[_settings.dimmer])))

        opts = ["manual", "auto", "1-auto"]
        basic.append(RadioSetting(
                "hyper_write", "Hyper Write",
                RadioSettingValueList(opts, opts[_settings.hyper_write])))

        opts = ["", "key", "dial", "key+dial", "ptt",
                "ptt+key", "ptt+dial", "all"]
        basic.append(RadioSetting(
                "lock", "Lock mode",
                RadioSettingValueList(opts, opts[_settings.lock])))

        opts = ["MH-42", "MH-48"]
        basic.append(RadioSetting(
                "microphone_type", "Microphone Type",
                RadioSettingValueList(opts, opts[_settings.microphone_type])))

        opts = ["off"] + ["S-%d" % n for n in range(2, 10)] + ["S-Full"]
        basic.append(RadioSetting(
                "rf_sql", "RF Squelch",
                RadioSettingValueList(opts, opts[_settings.rf_sql])))

        opts = ["time", "hold", "busy"]
        basic.append(RadioSetting(
                "scan_resume", "Scan Resume",
                RadioSettingValueList(opts, opts[_settings.scan_resume])))

        opts = ["single", "continuous"]
        basic.append(RadioSetting(
                "smart_search", "Smart Search",
                RadioSettingValueList(opts, opts[_settings.smart_search])))

        opts = ["off"] + ["%d" % t for t in range(1, 31)]
        basic.append(RadioSetting(
                "tot", "Time-out timer (mins)",
                RadioSettingValueList(opts, opts[_settings.tot])))

        # dtmf tab

        opts = ["50", "100", "250", "450", "750", "1000"]
        dtmf.append(RadioSetting(
                "dtmf_delay", "DTMF delay (ms)",
                RadioSettingValueList(opts, opts[_settings.dtmf_delay])))

        opts = ["50", "75", "100"]
        dtmf.append(RadioSetting(
                "dtmf_speed", "DTMF speed (ms)",
                RadioSettingValueList(opts, opts[_settings.dtmf_speed])))

        for i in range(16):
            name = "dtmf%02d" % i
            dtmfsetting = self._memobj.dtmf[i]
            dtmfstr = ""
            for c in dtmfsetting.memory:
                if c == 0xFF:
                    break
                if c < len(DTMFCHARSET):
                    dtmfstr += DTMFCHARSET[c]
            LOG.debug(dtmfstr)
            dtmfentry = RadioSettingValueString(0, 16, dtmfstr)
            dtmfentry.set_charset(DTMFCHARSET + list(" "))
            rs = RadioSetting(name, name.upper(), dtmfentry)
            dtmf.append(rs)

        # arts tab

        opts = ["off", "in range", "always"]
        arts.append(RadioSetting(
                "arts_mode", "ARTS beep",
                RadioSettingValueList(opts, opts[_settings.arts_mode])))

        opts = ["15", "25"]
        arts.append(RadioSetting(
                "arts_interval", "ARTS interval",
                RadioSettingValueList(opts, opts[_settings.arts_interval])))

        arts.append(RadioSetting(
                "arts_cwid_enable", "CW ID",
                RadioSettingValueBoolean(_settings.arts_cwid_enable)))

        _arts_cwid = self._memobj.arts_cwid
        cwid = RadioSettingValueString(
                0, 16, self._decode_chars(_arts_cwid.get_value()))
        cwid.set_charset(CHARSET)
        arts.append(RadioSetting("arts_cwid", "CW ID", cwid))

        # prog buttons

        opts = ["WX", "Reverse", "Repeater", "SQL Off", "Lock", "Dimmer"]
        prog.append(RadioSetting(
                "prog_panel_acc", "Prog Panel - Low(ACC)",
                RadioSettingValueList(opts, opts[_settings.prog_panel_acc])))

        opts = ["Reverse", "Home"]
        prog.append(RadioSetting(
                "prog_tone_vm", "TONE | V/M",
                RadioSettingValueList(opts, opts[_settings.prog_tone_vm])))

        opts = ["" for n in range(26)] + \
            ["Priority", "Low", "Tone", "MHz", "Reverse", "Home", "Band",
             "VFO/MR", "Scan", "Sql Off", "TCall", "SSCH", "ARTS", "Tone Freq",
             "DCSC", "WX", "Repeater"]

        prog.append(RadioSetting(
                "prog_p1", "P1",
                RadioSettingValueList(opts, opts[_settings.prog_p1])))

        prog.append(RadioSetting(
                "prog_p2", "P2",
                RadioSettingValueList(opts, opts[_settings.prog_p2])))

        prog.append(RadioSetting(
                "prog_p3", "P3",
                RadioSettingValueList(opts, opts[_settings.prog_p3])))

        prog.append(RadioSetting(
                "prog_p4", "P4",
                RadioSettingValueList(opts, opts[_settings.prog_p4])))

        return top
Exemplo n.º 41
0
    def get_settings(self):
        _settings = self._memobj.settings
        basic = RadioSettingGroup("basic", "Basic")
        cw = RadioSettingGroup("cw", "CW")
        packet = RadioSettingGroup("packet", "Digital & packet")
        panel = RadioSettingGroup("panel", "Panel settings")
        extended = RadioSettingGroup("extended", "Extended")
        panelcontr = RadioSettingGroup("panelcontr", "Panel controls")
        top = RadioSettingGroup("top", "All Settings", basic, cw, packet,
                                panelcontr, panel, extended)

        rs = RadioSetting("extended_menu", "Extended menu",
                          RadioSettingValueBoolean(_settings.extended_menu))
        extended.append(rs)
        rs = RadioSetting("ars_144", "144MHz ARS",
                          RadioSettingValueBoolean(_settings.ars_144))
        basic.append(rs)
        rs = RadioSetting("ars_430", "430MHz ARS",
                          RadioSettingValueBoolean(_settings.ars_430))
        basic.append(rs)
        options = ["enable", "disable"]
        rs = RadioSetting(
            "disable_amfm_dial", "AM&FM Dial",
            RadioSettingValueList(options,
                                  options[_settings.disable_amfm_dial]))
        panel.append(rs)
        rs = RadioSetting("am_mic", "AM mic gain",
                          RadioSettingValueInteger(0, 100, _settings.am_mic))
        basic.append(rs)
        options = ["OFF", "1h", "2h", "3h", "4h", "5h", "6h"]
        rs = RadioSetting(
            "apo_time", "APO time",
            RadioSettingValueList(options, options[_settings.apo_time]))
        basic.append(rs)
        options = ["OFF", "Range", "All"]
        rs = RadioSetting(
            "arts_beep", "ARTS beep",
            RadioSettingValueList(options, options[_settings.arts_beep]))
        basic.append(rs)
        rs = RadioSetting("arts_id", "ARTS ID",
                          RadioSettingValueBoolean(_settings.arts_id))
        extended.append(rs)
        s = RadioSettingValueString(
            0, 10,
            ''.join([self._CALLSIGN_CHARSET[x]
                     for x in self._memobj.arts_idw]))
        s.set_charset(self._CALLSIGN_CHARSET)
        rs = RadioSetting("arts_idw", "ARTS IDW", s)
        extended.append(rs)
        s = RadioSettingValueString(
            0, 40, ''.join(
                [self._BEACON_CHARSET[x] for x in self._memobj.beacon_text1]))
        s.set_charset(self._BEACON_CHARSET)
        rs = RadioSetting("beacon_text1", "Beacon text1", s)
        extended.append(rs)
        s = RadioSettingValueString(
            0, 40, ''.join(
                [self._BEACON_CHARSET[x] for x in self._memobj.beacon_text2]))
        s.set_charset(self._BEACON_CHARSET)
        rs = RadioSetting("beacon_text2", "Beacon text2", s)
        extended.append(rs)
        s = RadioSettingValueString(
            0, 40, ''.join(
                [self._BEACON_CHARSET[x] for x in self._memobj.beacon_text3]))
        s.set_charset(self._BEACON_CHARSET)
        rs = RadioSetting("beacon_text3", "Beacon text3", s)
        extended.append(rs)
        options = ["OFF"] + ["%i sec" % i for i in range(1, 256)]
        rs = RadioSetting(
            "beacon_time", "Beacon time",
            RadioSettingValueList(options, options[_settings.beacon_time]))
        extended.append(rs)
        options = ["440Hz", "880Hz", "1760Hz"]
        rs = RadioSetting(
            "beep_tone", "Beep tone",
            RadioSettingValueList(options, options[_settings.beep_tone]))
        panel.append(rs)
        rs = RadioSetting("beep_vol", "Beep volume",
                          RadioSettingValueInteger(0, 100, _settings.beep_vol))
        panel.append(rs)
        rs = RadioSetting(
            "r_lsb_car", "LSB Rx carrier point (*10 Hz)",
            RadioSettingValueInteger(-30, 30, _settings.r_lsb_car))
        extended.append(rs)
        rs = RadioSetting(
            "r_usb_car", "USB Rx carrier point (*10 Hz)",
            RadioSettingValueInteger(-30, 30, _settings.r_usb_car))
        extended.append(rs)
        rs = RadioSetting(
            "t_lsb_car", "LSB Tx carrier point (*10 Hz)",
            RadioSettingValueInteger(-30, 30, _settings.t_lsb_car))
        extended.append(rs)
        rs = RadioSetting(
            "t_usb_car", "USB Tx carrier point (*10 Hz)",
            RadioSettingValueInteger(-30, 30, _settings.t_usb_car))
        extended.append(rs)
        options = ["4800", "9600", "38400"]
        rs = RadioSetting(
            "cat_rate", "CAT rate",
            RadioSettingValueList(options, options[_settings.cat_rate]))
        basic.append(rs)
        options = ["CAT", "Linear", "Tuner"]
        rs = RadioSetting(
            "cat_lin_tun", "CAT/LIN/TUN selection",
            RadioSettingValueList(options, options[_settings.cat_lin_tun]))
        extended.append(rs)
        options = ["MAIN", "VFO/MEM",
                   "CLAR"]  # TODO test the 3 options on non D radio
        # which have only SEL and MAIN
        rs = RadioSetting(
            "clar_dial_sel", "Clarifier dial selection",
            RadioSettingValueList(options, options[_settings.clar_dial_sel]))
        panel.append(rs)
        rs = RadioSetting("cw_auto_mode", "CW Automatic mode",
                          RadioSettingValueBoolean(_settings.cw_auto_mode))
        cw.append(rs)
        options = ["USB", "LSB", "AUTO"]
        rs = RadioSetting(
            "cw_bfo", "CW BFO",
            RadioSettingValueList(options, options[_settings.cw_bfo]))
        cw.append(rs)
        options = ["FULL"] + ["%i ms" % (i * 10) for i in range(3, 301)]
        val = (_settings.cw_delay + _settings.cw_delay_hi * 256) - 2
        rs = RadioSetting("cw_delay", "CW delay",
                          RadioSettingValueList(options, options[val]))
        cw.append(rs)
        options = ["Normal", "Reverse"]
        rs = RadioSetting(
            "cw_key_rev", "CW key reverse",
            RadioSettingValueList(options, options[_settings.cw_key_rev]))
        cw.append(rs)
        rs = RadioSetting("cw_paddle", "CW paddle",
                          RadioSettingValueBoolean(_settings.cw_paddle))
        cw.append(rs)
        options = ["%i Hz" % i for i in range(400, 801, 100)]
        rs = RadioSetting(
            "cw_pitch", "CW pitch",
            RadioSettingValueList(options, options[_settings.cw_pitch]))
        cw.append(rs)
        options = ["%i ms" % i for i in range(5, 31, 5)]
        rs = RadioSetting(
            "cw_qsk", "CW QSK",
            RadioSettingValueList(options, options[_settings.cw_qsk]))
        cw.append(rs)
        rs = RadioSetting(
            "cw_sidetone", "CW sidetone volume",
            RadioSettingValueInteger(0, 100, _settings.cw_sidetone))
        cw.append(rs)
        options = ["%i wpm" % i for i in range(4, 61)]
        rs = RadioSetting(
            "cw_speed", "CW speed",
            RadioSettingValueList(options, options[_settings.cw_speed]))
        cw.append(rs)
        options = ["Numeric", "Alphabet", "AlphaNumeric"]
        rs = RadioSetting(
            "cw_training", "CW trainig",
            RadioSettingValueList(options, options[_settings.cw_training]))
        cw.append(rs)
        options = ["1:%1.1f" % (i / 10) for i in range(25, 46, 1)]
        rs = RadioSetting(
            "cw_weight", "CW weight",
            RadioSettingValueList(options, options[_settings.cw_weight]))
        cw.append(rs)
        options = ["Tn-Rn", "Tn-Riv", "Tiv-Rn", "Tiv-Riv"]
        rs = RadioSetting(
            "dcs_inv", "DCS inv",
            RadioSettingValueList(options, options[_settings.dcs_inv]))
        extended.append(rs)
        options = ["Fine", "Coarse"]
        rs = RadioSetting(
            "dial_step", "Dial step",
            RadioSettingValueList(options, options[_settings.dial_step]))
        panel.append(rs)
        rs = RadioSetting(
            "dig_disp", "Dig disp (*10 Hz)",
            RadioSettingValueInteger(-300, 300, _settings.dig_disp))
        packet.append(rs)
        rs = RadioSetting("dig_mic", "Dig gain",
                          RadioSettingValueInteger(0, 100, _settings.dig_mic))
        packet.append(rs)
        options = ["RTTYL", "RTTYU", "PSK31-L", "PSK31-U", "USER-L", "USER-U"]
        rs = RadioSetting(
            "dig_mode", "Dig mode",
            RadioSettingValueList(options, options[_settings.dig_mode]))
        packet.append(rs)
        rs = RadioSetting(
            "dig_shift", "Dig shift (*10 Hz)",
            RadioSettingValueInteger(-300, 300, _settings.dig_shift))
        packet.append(rs)
        rs = RadioSetting("dig_vox", "Dig vox",
                          RadioSettingValueInteger(0, 100, _settings.dig_vox))
        packet.append(rs)
        options = ["ARTS", "BAND", "FIX", "MEMGRP", "MODE", "MTR", "VFO"]
        rs = RadioSetting(
            "disp_color", "Display color mode",
            RadioSettingValueList(options, options[_settings.disp_color]))
        panel.append(rs)
        rs = RadioSetting(
            "disp_color_arts", "Display color ARTS set",
            RadioSettingValueInteger(0, 1, _settings.disp_color_arts))
        panel.append(rs)
        rs = RadioSetting(
            "disp_color_band", "Display color band set",
            RadioSettingValueInteger(0, 1, _settings.disp_color_band))
        panel.append(rs)
        rs = RadioSetting(
            "disp_color_memgrp", "Display color memory group set",
            RadioSettingValueInteger(0, 1, _settings.disp_color_memgrp))
        panel.append(rs)
        rs = RadioSetting(
            "disp_color_mode", "Display color mode set",
            RadioSettingValueInteger(0, 1, _settings.disp_color_mode))
        panel.append(rs)
        rs = RadioSetting(
            "disp_color_mtr", "Display color meter set",
            RadioSettingValueInteger(0, 1, _settings.disp_color_mtr))
        panel.append(rs)
        rs = RadioSetting(
            "disp_color_vfo", "Display color VFO set",
            RadioSettingValueInteger(0, 1, _settings.disp_color_vfo))
        panel.append(rs)
        rs = RadioSetting(
            "disp_color_fix", "Display color fix set",
            RadioSettingValueInteger(1, 32, _settings.disp_color_fix + 1))
        panel.append(rs)
        rs = RadioSetting(
            "disp_contrast", "Contrast",
            RadioSettingValueInteger(3, 15, _settings.disp_contrast + 2))
        panel.append(rs)
        rs = RadioSetting(
            "disp_intensity", "Intensity",
            RadioSettingValueInteger(1, 3, _settings.disp_intensity))
        panel.append(rs)
        options = ["OFF", "Auto1", "Auto2", "ON"]
        rs = RadioSetting(
            "disp_mode", "Display backlight mode",
            RadioSettingValueList(options, options[_settings.disp_mode]))
        panel.append(rs)
        options = ["60Hz", "120Hz", "240Hz"]
        rs = RadioSetting(
            "dsp_bpf", "Dsp band pass filter",
            RadioSettingValueList(options, options[_settings.dsp_bpf]))
        cw.append(rs)
        options = [
            "100Hz", "160Hz", "220Hz", "280Hz", "340Hz", "400Hz", "460Hz",
            "520Hz", "580Hz", "640Hz", "720Hz", "760Hz", "820Hz", "880Hz",
            "940Hz", "1000Hz"
        ]
        rs = RadioSetting(
            "dsp_hpf", "Dsp hi pass filter cut off",
            RadioSettingValueList(options, options[_settings.dsp_hpf]))
        basic.append(rs)
        options = [
            "1000Hz", "1160Hz", "1320Hz", "1480Hz", "1650Hz", "1800Hz",
            "1970Hz", "2130Hz", "2290Hz", "2450Hz", "2610Hz", "2770Hz",
            "2940Hz", "3100Hz", "3260Hz", "3420Hz", "3580Hz", "3740Hz",
            "3900Hz", "4060Hz", "4230Hz", "4390Hz", "4550Hz", "4710Hz",
            "4870Hz", "5030Hz", "5190Hz", "5390Hz", "5520Hz", "5680Hz",
            "5840Hz", "6000Hz"
        ]
        rs = RadioSetting(
            "dsp_lpf", "Dsp low pass filter cut off",
            RadioSettingValueList(options, options[_settings.dsp_lpf]))
        basic.append(rs)
        options = ["OFF", "LPF", "HPF", "BOTH"]
        rs = RadioSetting(
            "dsp_mic_eq", "Dsp mic equalization",
            RadioSettingValueList(options, options[_settings.dsp_mic_eq]))
        basic.append(rs)
        rs = RadioSetting(
            "dsp_nr", "DSP noise reduction level",
            RadioSettingValueInteger(1, 16, _settings.dsp_nr + 1))
        basic.append(rs)
        # emergency only for US model
        rs = RadioSetting("fm_mic", "FM mic gain",
                          RadioSettingValueInteger(0, 100, _settings.fm_mic))
        basic.append(rs)
        rs = RadioSetting("home_vfo", "Enable HOME to VFO moving",
                          RadioSettingValueBoolean(_settings.home_vfo))
        panel.append(rs)
        options = ["Dial", "Freq", "Panel", "All"]
        rs = RadioSetting(
            "lock_mode", "Lock mode",
            RadioSettingValueList(options, options[_settings.lock_mode]))
        panel.append(rs)
        rs = RadioSetting("mem_group", "Mem group",
                          RadioSettingValueBoolean(_settings.mem_group))
        basic.append(rs)
        options = [
            "CW SIDETONE", "CW SPEED", "MHz/MEM GRP", "MIC GAIN", "NB LEVEL",
            "RF POWER", "STEP"
        ]
        rs = RadioSetting(
            "mem_vfo_dial_mode", "Mem/VFO dial mode",
            RadioSettingValueList(options,
                                  options[_settings.mem_vfo_dial_mode]))
        panel.append(rs)
        rs = RadioSetting("mic_scan", "Mic scan",
                          RadioSettingValueBoolean(_settings.mic_scan))
        basic.append(rs)
        options = ["NOR", "RMT", "CAT"]
        rs = RadioSetting(
            "mic_sel", "Mic selection",
            RadioSettingValueList(options, options[_settings.mic_sel]))
        extended.append(rs)
        options = ["SIG", "CTR", "VLT", "N/A", "FS", "OFF"]
        rs = RadioSetting(
            "mtr_arx_sel", "Meter receive selection",
            RadioSettingValueList(options, options[_settings.mtr_arx_sel]))
        extended.append(rs)
        options = ["PWR", "ALC", "MOD", "SWR", "VLT", "N/A", "OFF"]
        rs = RadioSetting(
            "mtr_atx_sel", "Meter transmit selection",
            RadioSettingValueList(options, options[_settings.mtr_atx_sel]))
        extended.append(rs)
        rs = RadioSetting("mtr_peak_hold", "Meter peak hold",
                          RadioSettingValueBoolean(_settings.mtr_peak_hold))
        extended.append(rs)
        rs = RadioSetting("nb_level", "Noise blanking level",
                          RadioSettingValueInteger(0, 100, _settings.nb_level))
        basic.append(rs)
        s = RadioSettingValueString(
            0, 4, ''.join([
                self._CALLSIGN_CHARSET[x] for x in self._memobj.op_filter1_name
            ]))
        s.set_charset(self._CALLSIGN_CHARSET)
        rs = RadioSetting("op_filter1_name", "Optional filter1 name", s)
        extended.append(rs)
        s = RadioSettingValueString(
            0, 4, ''.join([
                self._CALLSIGN_CHARSET[x] for x in self._memobj.op_filter2_name
            ]))
        s.set_charset(self._CALLSIGN_CHARSET)
        rs = RadioSetting("op_filter2_name", "Optional filter2 name", s)
        extended.append(rs)
        rs = RadioSetting(
            "pg_a", "Programmable key MFq:A",
            RadioSettingValueList(self.PROGRAMMABLEOPTIONS,
                                  self.PROGRAMMABLEOPTIONS[_settings.pg_a]))
        extended.append(rs)
        rs = RadioSetting(
            "pg_b", "Programmable key MFq:B",
            RadioSettingValueList(self.PROGRAMMABLEOPTIONS,
                                  self.PROGRAMMABLEOPTIONS[_settings.pg_b]))
        extended.append(rs)
        rs = RadioSetting(
            "pg_c", "Programmable key MFq:C",
            RadioSettingValueList(self.PROGRAMMABLEOPTIONS,
                                  self.PROGRAMMABLEOPTIONS[_settings.pg_c]))
        extended.append(rs)
        rs = RadioSetting(
            "pg_acc", "Programmable mic key ACC",
            RadioSettingValueList(self.PROGRAMMABLEOPTIONS,
                                  self.PROGRAMMABLEOPTIONS[_settings.pg_acc]))
        extended.append(rs)
        rs = RadioSetting(
            "pg_p1", "Programmable mic key P1",
            RadioSettingValueList(self.PROGRAMMABLEOPTIONS,
                                  self.PROGRAMMABLEOPTIONS[_settings.pg_p1]))
        extended.append(rs)
        rs = RadioSetting(
            "pg_p2", "Programmable mic key P2",
            RadioSettingValueList(self.PROGRAMMABLEOPTIONS,
                                  self.PROGRAMMABLEOPTIONS[_settings.pg_p2]))
        extended.append(rs)
        rs = RadioSetting("pkt1200", "Packet 1200 gain level",
                          RadioSettingValueInteger(0, 100, _settings.pkt1200))
        packet.append(rs)
        rs = RadioSetting("pkt9600", "Packet 9600 gain level",
                          RadioSettingValueInteger(0, 100, _settings.pkt9600))
        packet.append(rs)
        options = ["1200", "9600"]
        rs = RadioSetting(
            "pkt_rate", "Packet rate",
            RadioSettingValueList(options, options[_settings.pkt_rate]))
        packet.append(rs)
        rs = RadioSetting(
            "proc_level", "Proc level",
            RadioSettingValueInteger(0, 100, _settings.proc_level))
        basic.append(rs)
        rs = RadioSetting(
            "rf_power_hf", "Rf power set HF",
            RadioSettingValueInteger(5, 100, _settings.rf_power_hf))
        basic.append(rs)
        rs = RadioSetting(
            "rf_power_6m", "Rf power set 6m",
            RadioSettingValueInteger(5, 100, _settings.rf_power_6m))
        basic.append(rs)
        rs = RadioSetting(
            "rf_power_vhf", "Rf power set VHF",
            RadioSettingValueInteger(5, 50, _settings.rf_power_vhf))
        basic.append(rs)
        rs = RadioSetting(
            "rf_power_uhf", "Rf power set UHF",
            RadioSettingValueInteger(2, 20, _settings.rf_power_uhf))
        basic.append(rs)
        options = ["TIME", "BUSY", "STOP"]
        rs = RadioSetting(
            "scan_mode", "Scan mode",
            RadioSettingValueList(options, options[_settings.scan_mode]))
        basic.append(rs)
        rs = RadioSetting(
            "scan_resume", "Scan resume",
            RadioSettingValueInteger(1, 10, _settings.scan_resume))
        basic.append(rs)
        rs = RadioSetting("split_tone", "Split tone enable",
                          RadioSettingValueBoolean(_settings.split_tone))
        extended.append(rs)
        options = ["RF-Gain", "Squelch"]
        rs = RadioSetting(
            "sql_rf_gain", "Squelch/RF-Gain",
            RadioSettingValueList(options, options[_settings.sql_rf_gain]))
        panel.append(rs)
        rs = RadioSetting("ssb_mic", "SSB Mic gain",
                          RadioSettingValueInteger(0, 100, _settings.ssb_mic))
        basic.append(rs)
        options = ["Off"] + ["%i" % i for i in range(1, 21)]
        rs = RadioSetting(
            "tot_time", "Time-out timer",
            RadioSettingValueList(options, options[_settings.tot_time]))
        basic.append(rs)
        options = ["OFF", "ATAS(HF)", "ATAS(HF&50)", "ATAS(ALL)", "TUNER"]
        rs = RadioSetting(
            "tuner_atas", "Tuner/ATAS device",
            RadioSettingValueList(options, options[_settings.tuner_atas]))
        extended.append(rs)
        rs = RadioSetting(
            "tx_if_filter", "Transmit IF filter",
            RadioSettingValueList(self.FILTERS,
                                  self.FILTERS[_settings.tx_if_filter]))
        basic.append(rs)
        rs = RadioSetting("vox_delay", "VOX delay (*100 ms)",
                          RadioSettingValueInteger(1, 30, _settings.vox_delay))
        basic.append(rs)
        rs = RadioSetting("vox_gain", "VOX Gain",
                          RadioSettingValueInteger(1, 100, _settings.vox_gain))
        basic.append(rs)
        rs = RadioSetting(
            "xvtr_a", "Xvtr A displacement",
            RadioSettingValueInteger(
                -4294967295, 4294967295,
                self._memobj.xvtr_a_offset *
                (-1 if _settings.xvtr_a_negative else 1)))
        extended.append(rs)
        rs = RadioSetting(
            "xvtr_b", "Xvtr B displacement",
            RadioSettingValueInteger(
                -4294967295, 4294967295,
                self._memobj.xvtr_b_offset *
                (-1 if _settings.xvtr_b_negative else 1)))
        extended.append(rs)
        options = ["OFF", "XVTR A", "XVTR B"]
        rs = RadioSetting(
            "xvtr_sel", "Transverter function selection",
            RadioSettingValueList(options, options[_settings.xvtr_sel]))
        extended.append(rs)

        rs = RadioSetting("disp", "Display large",
                          RadioSettingValueBoolean(_settings.disp))
        panel.append(rs)
        rs = RadioSetting("nb", "Noise blanker",
                          RadioSettingValueBoolean(_settings.nb))
        panelcontr.append(rs)
        options = ["Auto", "Fast", "Slow", "Off"]
        rs = RadioSetting(
            "agc", "AGC", RadioSettingValueList(options,
                                                options[_settings.agc]))
        panelcontr.append(rs)
        options = ["PWR", "ALC", "SWR", "MOD"]
        rs = RadioSetting(
            "pwr_meter_mode", "Power meter mode",
            RadioSettingValueList(options, options[_settings.pwr_meter_mode]))
        panelcontr.append(rs)
        rs = RadioSetting("vox", "Vox",
                          RadioSettingValueBoolean(_settings.vox))
        panelcontr.append(rs)
        rs = RadioSetting("bk", "Semi break-in",
                          RadioSettingValueBoolean(_settings.bk))
        cw.append(rs)
        rs = RadioSetting("kyr", "Keyer",
                          RadioSettingValueBoolean(_settings.kyr))
        cw.append(rs)
        options = ["enabled", "disabled"]
        rs = RadioSetting(
            "fst", "Fast",
            RadioSettingValueList(options, options[_settings.fst]))
        panelcontr.append(rs)
        options = ["enabled", "disabled"]
        rs = RadioSetting(
            "lock", "Lock",
            RadioSettingValueList(options, options[_settings.lock]))
        panelcontr.append(rs)
        rs = RadioSetting("scope_peakhold", "Scope max hold",
                          RadioSettingValueBoolean(_settings.scope_peakhold))
        panelcontr.append(rs)
        options = ["21", "31", "127"]
        rs = RadioSetting(
            "scope_width", "Scope width (channels)",
            RadioSettingValueList(options, options[_settings.scope_width]))
        panelcontr.append(rs)
        rs = RadioSetting("proc", "Speech processor",
                          RadioSettingValueBoolean(_settings.proc))
        panelcontr.append(rs)

        return top
Exemplo n.º 42
0
    def get_settings(self):
        _settings = self._memobj.settings
        _mem = self._memobj
        basic = RadioSettingGroup("basic", "Basic Settings")
        dtmf = RadioSettingGroup("dtmf", "DTMF Settings")
        top = RadioSettings(basic, dtmf)

        if _settings.k1shortp > 5:
            val = 4
        else:
            val = _settings.k1shortp
        rs = RadioSetting(
            "k1shortp", "Key 1 Short Press",
            RadioSettingValueList(LIST_SHORT_PRESS, LIST_SHORT_PRESS[val]))
        basic.append(rs)

        if _settings.k1longp > 5:
            val = 5
        else:
            val = _settings.k1longp
        rs = RadioSetting(
            "k1longp", "Key 1 Long Press",
            RadioSettingValueList(LIST_LONG_PRESS, LIST_LONG_PRESS[val]))
        basic.append(rs)

        if _settings.k2shortp > 5:
            val = 1
        else:
            val = _settings.k2shortp
        rs = RadioSetting(
            "k2shortp", "Key 2 Short Press",
            RadioSettingValueList(LIST_SHORT_PRESS, LIST_SHORT_PRESS[val]))
        basic.append(rs)

        if _settings.k2longp > 5:
            val = 3
        else:
            val = _settings.k2longp
        rs = RadioSetting(
            "k2longp", "Key 2 Long Press",
            RadioSettingValueList(LIST_LONG_PRESS, LIST_LONG_PRESS[val]))
        basic.append(rs)

        rs = RadioSetting("vox", "VOX",
                          RadioSettingValueBoolean(not _settings.vox))
        basic.append(rs)

        if _settings.voxg > 8:
            val = 4
        else:
            val = _settings.voxg + 1
        rs = RadioSetting("voxg", "VOX Gain",
                          RadioSettingValueInteger(1, 9, val))
        basic.append(rs)

        rs = RadioSetting(
            "voxd", "VOX Delay Time",
            RadioSettingValueList(LIST_VOXDELAY,
                                  LIST_VOXDELAY[_settings.voxd]))
        basic.append(rs)

        rs = RadioSetting("voxi", "VOX Inhibit on Receive",
                          RadioSettingValueBoolean(_settings.voxi))
        basic.append(rs)

        if _settings.squelch > 9:
            val = 5
        else:
            val = _settings.squelch
        rs = RadioSetting("squelch", "Squelch Level",
                          RadioSettingValueInteger(0, 9, val))
        basic.append(rs)

        if _settings.voice == 3:
            val = 1
        else:
            val = _settings.voice
        rs = RadioSetting("voice", "Voice Prompts",
                          RadioSettingValueList(LIST_VOICE, LIST_VOICE[val]))
        basic.append(rs)

        rs = RadioSetting("tone", "Tone",
                          RadioSettingValueBoolean(_settings.tone))
        basic.append(rs)

        rs = RadioSetting("lovoltnotx", "TX Inhibit (when battery < 6 volts)",
                          RadioSettingValueBoolean(_settings.lovoltnotx))
        basic.append(rs)

        rs = RadioSetting("hivoltnotx", "TX Inhibit (when battery > 9 volts)",
                          RadioSettingValueBoolean(_settings.hivoltnotx))
        basic.append(rs)

        if _settings.tot > 0x28:
            val = 6
        else:
            val = _settings.tot
        rs = RadioSetting(
            "tot", "Time-out Timer[s]",
            RadioSettingValueList(LIST_TIMEOUTTIMER, LIST_TIMEOUTTIMER[val]))
        basic.append(rs)

        if _settings.save < 3:
            val = 0
        else:
            val = _settings.save - 3
        rs = RadioSetting("save", "Battery Saver",
                          RadioSettingValueList(LIST_SAVE, LIST_SAVE[val]))
        basic.append(rs)

        rs = RadioSetting(
            "ssave", "Super Battery Saver[s]",
            RadioSettingValueList(LIST_SSAVE, LIST_SSAVE[_settings.ssave]))
        basic.append(rs)

        rs = RadioSetting("fmradio", "Broadcast FM",
                          RadioSettingValueBoolean(_settings.fmradio))
        basic.append(rs)

        if _settings.scanspeed > 8:
            val = 4
        else:
            val = _settings.scanspeed
        rs = RadioSetting(
            "scanspeed", "Scan Speed[ms]",
            RadioSettingValueList(LIST_SCANSPEED, LIST_SCANSPEED[val]))
        basic.append(rs)

        if _settings.scandelay > 27:
            val = 12
        else:
            val = _settings.scandelay
        rs = RadioSetting(
            "scandelay", "Scan Droupout Delay Time[s]",
            RadioSettingValueList(LIST_SCANDELAY, LIST_SCANDELAY[val]))
        basic.append(rs)

        if _mem.dtmf.dtmfspd > 11:
            val = 2
        else:
            val = _mem.dtmf.dtmfspd + 4
        rs = RadioSetting("dtmf.dtmfspd", "DTMF Speed[digit/s]",
                          RadioSettingValueInteger(4, 15, val))
        dtmf.append(rs)

        if _mem.dtmf.digtime > 10:
            val = 0
        else:
            val = _mem.dtmf.digtime
        rs = RadioSetting(
            "dtmf.digtime", "1st Digit Time[ms]",
            RadioSettingValueList(LIST_DIGTIME, LIST_DIGTIME[val]))
        dtmf.append(rs)

        if _mem.dtmf.digdelay > 9:
            val = 0
        else:
            val = _mem.dtmf.digdelay
        rs = RadioSetting(
            "dtmf.digdelay", "1st Digit Delay[ms]",
            RadioSettingValueList(LIST_DIGDELAY, LIST_DIGDELAY[val]))
        dtmf.append(rs)

        rs = RadioSetting(
            "dtmf.starhash", "* and # Time[ms]",
            RadioSettingValueList(LIST_STARHASH,
                                  LIST_STARHASH[_mem.dtmf.starhash]))
        dtmf.append(rs)

        rs = RadioSetting(
            "dtmf.codespace", "Code Space Time[ms]",
            RadioSettingValueList(LIST_CODESPACE,
                                  LIST_CODESPACE[_mem.dtmf.codespace]))
        dtmf.append(rs)

        rs = RadioSetting("dtmf.sidetone", "DTMF Sidetone",
                          RadioSettingValueBoolean(_mem.dtmf.sidetone))
        dtmf.append(rs)

        # setup pttid entries
        for i in range(0, 2):
            objname = "code" + str(i + 1)
            names = ["PTT ID(BOT)", "PTT ID(EOT)"]
            strname = str(names[i])
            dtmfsetting = getattr(_mem.dtmf, objname)
            dtmflen = getattr(_mem.dtmf, objname + "_len")
            dtmfstr = self._bbcd2dtmf(dtmfsetting, dtmflen)
            code = RadioSettingValueString(0, 16, dtmfstr)
            code.set_charset(DTMF_CHARSET + list(" "))
            rs = RadioSetting("dtmf." + objname, strname, code)
            dtmf.append(rs)

        def _filter(name):
            filtered = ""
            for char in str(name):
                if char in NUMERIC_CHARSET:
                    filtered += char
                else:
                    filtered += " "
            return filtered

        # setup id code entry
        codesetting = getattr(_mem.dtmf, "idcode")
        codestr = self._bbcd2num(codesetting, 6)
        code = RadioSettingValueString(0, 6, _filter(codestr))
        code.set_charset(NUMERIC_CHARSET + list(" "))
        rs = RadioSetting("dtmf.idcode", "ID Code", code)
        dtmf.append(rs)

        if _mem.dtmf.groupcode > 6:
            val = 0
        else:
            val = _mem.dtmf.groupcode
        rs = RadioSetting(
            "dtmf.groupcode", "Group Code",
            RadioSettingValueList(LIST_GROUPCODE, LIST_GROUPCODE[val]))
        dtmf.append(rs)

        if _mem.dtmf.resettime > 60:
            val = 0
        else:
            val = _mem.dtmf.resettime
        rs = RadioSetting(
            "dtmf.resettime", "Auto Reset Time[s]",
            RadioSettingValueList(LIST_RESETTIME,
                                  LIST_RESETTIME[_mem.dtmf.resettime]))
        dtmf.append(rs)

        rs = RadioSetting("dtmf.txdecode", "TX Decode",
                          RadioSettingValueBoolean(_mem.dtmf.txdecode))
        dtmf.append(rs)

        rs = RadioSetting(
            "dtmf.decodeto", "Decode Time Out[ms]",
            RadioSettingValueList(LIST_DECODETO,
                                  LIST_DECODETO[_mem.dtmf.decodeto]))
        dtmf.append(rs)

        rs = RadioSetting("dtmf.decodetone", "Decode Tone",
                          RadioSettingValueBoolean(_mem.dtmf.decodetone))
        dtmf.append(rs)

        rs = RadioSetting("dtmf.resettone", "Reset Tone",
                          RadioSettingValueBoolean(_mem.dtmf.resettone))
        dtmf.append(rs)

        rs = RadioSetting(
            "dtmf.stuntype", "Stun Type",
            RadioSettingValueList(LIST_STUNTYPE,
                                  LIST_STUNTYPE[_mem.dtmf.stuntype]))
        dtmf.append(rs)

        ## setup stun entry
        objname = "code3"
        strname = "Stun Code"
        dtmfsetting = getattr(_mem.dtmf, objname)
        dtmflen = getattr(_mem.dtmf, objname + "_len")
        dtmfstr = self._bbcd2dtmf(dtmfsetting, dtmflen)
        code = RadioSettingValueString(0, 10, dtmfstr)
        code.set_charset(DTMF_CHARSET + list(" "))
        rs = RadioSetting("dtmf." + objname, strname, code)
        dtmf.append(rs)

        return top
Exemplo n.º 43
0
    def _get_common2(self):
        settings = self._memobj.settings
        common2 = RadioSettingGroup('common2', 'Common 2')

        def apply_ponmsgtext(setting):
            settings.pon_msgtext = (
                str(setting.value)[:12].strip().ljust(12, '\x00'))

        common2.append(
            self._pure_choice_setting('pon_msgtype', 'Power On Message Type',
                                      STARTUP_MODES))

        _text = str(settings.pon_msgtext).rstrip('\x00')
        text = RadioSetting('settings.pon_msgtext',
                            'Power On Text',
                            RadioSettingValueString(
                                0, 12, _text))
        text.set_apply_callback(apply_ponmsgtext)
        common2.append(text)

        def apply_volume(setting, key):
            setattr(settings, key, VOLUMES[str(setting.value)])

        volumes = {'poweron_tone': 'Power-on Tone',
                   'control_tone': 'Control Tone',
                   'warning_tone': 'Warning Tone',
                   'alert_tone': 'Alert Tone',
                   'sidetone': 'Sidetone',
                   'locator_tone': 'Locator Tone'}
        for value, name in volumes.items():
            setting = getattr(settings, value)
            volume = RadioSetting('settings.%s' % value, name,
                                  RadioSettingValueList(
                                      VOLUMES.keys(),
                                      VOLUMES_REV.get(int(setting), 0)))
            volume.set_apply_callback(apply_volume, value)
            common2.append(volume)

        def apply_vol_level(setting, key):
            setattr(settings, key, int(setting.value))

        levels = {'lo_volume': 'Low Volume Level (Fixed Volume)',
                  'hi_volume': 'High Volume Level (Fixed Volume)',
                  'min_volume': 'Minimum Audio Volume',
                  'max_volume': 'Maximum Audio Volume'}
        for value, name in levels.items():
            setting = getattr(settings, value)
            if 'Audio' in name:
                minimum = 0
            else:
                minimum = 1
            volume = RadioSetting(
                'settings.%s' % value, name,
                RadioSettingValueInteger(minimum, 31, int(setting)))
            volume.set_apply_callback(apply_vol_level, value)
            common2.append(volume)

        def apply_vo(setting):
            val = int(setting.value)
            if val < 0:
                val = abs(val) | 0x80
            settings.tone_volume_offset = val

        _voloffset = int(settings.tone_volume_offset)
        if _voloffset & 0x80:
            _voloffset = abs(_voloffset & 0x7F) * -1
        voloffset = RadioSetting(
            'tvo', 'Tone Volume Offset',
            RadioSettingValueInteger(
                -5, 5,
                _voloffset))
        voloffset.set_apply_callback(apply_vo)
        common2.append(voloffset)

        def apply_mvp(setting):
            settings.min_vol_preset = MIN_VOL_PRESET[str(setting.value)]

        _volpreset = int(settings.min_vol_preset)
        volpreset = RadioSetting(
            'mvp', 'Minimum Volume Type',
            RadioSettingValueList(MIN_VOL_PRESET.keys(),
                                  MIN_VOL_PRESET_REV[_volpreset]))
        volpreset.set_apply_callback(apply_mvp)
        if not self.is_portable and 'mvp' in ONLY_MOBILE_SETTINGS:
            common2.append(volpreset)

        return common2
Exemplo n.º 44
0
    def get_settings(self):
        """Translate the bit in the mem_struct into settings in the UI"""
        sett = self._memobj.settings

        # basic features of the radio
        basic = RadioSettingGroup("basic", "Basic Settings")
        # keys
        fkeys = RadioSettingGroup("keys", "Function keys")

        top = RadioSettings(basic, fkeys)

        # Basic
        val = RadioSettingValueString(0, 35, self._VARIANT)
        val.set_mutable(False)
        mod = RadioSetting("not.mod", "Radio version", val)
        basic.append(mod)

        beep = RadioSetting("settings.beep", "Beep tone",
                             RadioSettingValueBoolean(
                                 bool(sett.beep)))
        basic.append(beep)

        bsave = RadioSetting("settings.batt_save", "Battery save",
                             RadioSettingValueBoolean(
                                 bool(sett.batt_save)))
        basic.append(bsave)

        deal = RadioSetting("settings.dealer", "Dealer & Test",
                             RadioSettingValueBoolean(
                                 bool(sett.dealer)))
        basic.append(deal)

        add = RadioSetting("settings.add", "Del / Add feature",
                             RadioSettingValueBoolean(
                                 bool(sett.add)))
        basic.append(add)

        # In some cases the values that follows can be 0xFF (HARD RESET)
        # so we need to take and validate that
        if int(sett.tot) == 0xff:
            # 120 sec
            sett.tot = 4
        if int(sett.tot_alert) == 0xff:
            # 10 secs
            sett.tot_alert = 1
        if int(sett.tot_rekey) == 0xff:
            # off
            sett.tot_rekey = 0
        if int(sett.tot_reset) == 0xff:
            # off
            sett.tot_reset = 0
        if int(sett.sql) == 0xff:
            # a confortable level ~6
            sett.sql = 6

        tot = RadioSetting("settings.tot", "Time Out Timer (TOT)",
                           RadioSettingValueList(TOT, TOT[int(sett.tot)]))
        basic.append(tot)

        tota = RadioSetting("settings.tot_alert", "TOT pre-plert",
                           RadioSettingValueList(TOT_A, TOT_A[int(sett.tot_alert)]))
        basic.append(tota)

        totrk = RadioSetting("settings.tot_rekey", "TOT rekey time",
                           RadioSettingValueList(TOT_RK, TOT_RK[int(sett.tot_rekey)]))
        basic.append(totrk)

        totrs = RadioSetting("settings.tot_reset", "TOT reset time",
                           RadioSettingValueList(TOT_RS, TOT_RS[int(sett.tot_reset)]))
        basic.append(totrs)

        sql = RadioSetting("settings.sql", "Squelch level",
                           RadioSettingValueList(SQL, SQL[int(sett.sql)]))
        basic.append(sql)

        # front keys
        m = int(sett.kMoni)
        if m > 3:
            m = 1
        mon = RadioSetting("settings.kMoni", "Monitor",
                           RadioSettingValueList(MONI, MONI[m]))
        fkeys.append(mon)

        s = int(sett.kScan)
        if s > 3:
            s = 1
        scn = RadioSetting("settings.kScan", "Scan",
                           RadioSettingValueList(SCAN, SCAN[s]))
        fkeys.append(scn)

        d = int(sett.kDial)
        if d > 1:
            d = 0
        dial = RadioSetting("settings.kDial", "Dial",
                           RadioSettingValueList(YESNO, YESNO[d]))
        fkeys.append(dial)

        t = int(sett.kTa)
        if t > 2:
            t = 2
        ta = RadioSetting("settings.kTa", "Ta",
                           RadioSettingValueList(TA, TA[t]))
        fkeys.append(ta)

        l = int(sett.kLo)
        if l > 1:
            l = 0
        low = RadioSetting("settings.kLo", "Low",
                           RadioSettingValueList(YESNO, YESNO[l]))
        fkeys.append(low)

        return top
Exemplo n.º 45
0
    def get_settings(self):
        common = RadioSettingGroup("common", "Common Settings")
        band = RadioSettingGroup("band", "Band dependent Settings")
        arts = RadioSettingGroup("arts",
                                 "Auto Range Transponder System (ARTS)")
        dtmf = RadioSettingGroup("dtmf", "DTMF Settings")
        mic_button = RadioSettingGroup("mic_button", "Microphone Buttons")
        setmode = RadioSettings(common, band, arts, dtmf, mic_button)

        _overlay = self._memobj.overlay

        # numbers and names of settings refer to the way they're
        # presented in the set menu, as well as the list starting on
        # page 49 of the manual

        # 1 Automatic Power Off
        opts = [
            "Off",
            "30 Min",
            "1 Hour",
            "1.5 Hours",
            "2 Hours",
            "2.5 Hours",
            "3 Hours",
            "3.5 Hours",
            "4 Hours",
            "4.5 Hours",
            "5 Hours",
            "5.5 Hours",
            "6 Hours",
            "6.5 Hours",
            "7 Hours",
            "7.5 Hours",
            "8 Hours",
            "8.5 Hours",
            "9 Hours",
            "9.5 Hours",
            "10 Hours",
            "10.5 Hours",
            "11 Hours",
            "11.5 Hours",
            "12 Hours",
        ]
        common.append(
            RadioSetting("apo", "Automatic Power Off",
                         RadioSettingValueList(opts, opts[_overlay.apo])))

        # 2 Automatic Repeater Shift function
        opts = ["Off", "On"]
        band.append(
            RadioSetting("ars_vhf", "Automatic Repeater Shift VHF",
                         RadioSettingValueList(opts, opts[_overlay.ars_vhf])))
        band.append(
            RadioSetting("ars_uhf", "Automatic Repeater Shift UHF",
                         RadioSettingValueList(opts, opts[_overlay.ars_uhf])))

        # 3  Selects the ARTS mode.
        # -> Only useful to set it on the radio directly

        # 4 Enables/disables the key/button beeper.
        opts = ["Off", "On"]
        common.append(
            RadioSetting("beep", "Key/Button Beep",
                         RadioSettingValueList(opts, opts[_overlay.beep])))

        # 5 Enables/disables the CW IDer during ARTS operation.
        opts = ["Off", "On"]
        arts.append(
            RadioSetting("cwid", "Enables/Disables the CW ID",
                         RadioSettingValueList(opts, opts[_overlay.cwid])))

        # 6  Callsign during ARTS operation.
        cwidw = _overlay.cwidw.get_raw()
        cwidw = cwidw.rstrip('\x00')
        val = RadioSettingValueString(0, 6, cwidw)
        val.set_charset(CHARSET)
        rs = RadioSetting("cwidw", "CW Identifier Callsign", val)

        def apply_cwid(setting):
            value_string = setting.value.get_value()
            _overlay.cwidw.set_value(value_string)

        rs.set_apply_callback(apply_cwid)
        arts.append(rs)

        # 7 Front panel display's illumination level.
        opts = ["0: Off", "1: Max", "2", "3", "4", "5", "6", "7: Min"]
        common.append(
            RadioSetting("dim", "Display Illumination",
                         RadioSettingValueList(opts, opts[_overlay.dim])))

        # 8 Setting the DCS code number.
        #   Note: This Menu item can be set independently for each band,
        #         and independently in each memory.

        # 9 Activates the DCS Code Search
        # -> Only useful if set on radio itself

        # 10 Selects 'Normal' or 'Inverted' DCS coding.
        opts = ["TRX Normal", "RX Reversed", "TX Reversed", "TRX Reversed"]
        band.append(
            RadioSetting("dcsnr_vhf", "DCS coding VHF",
                         RadioSettingValueList(opts,
                                               opts[_overlay.dcsnr_vhf])))
        band.append(
            RadioSetting("dcsnr_uhf", "DCS coding UHF",
                         RadioSettingValueList(opts,
                                               opts[_overlay.dcsnr_uhf])))

        # 11 Selects the 'sub' band display format
        opts = [
            "Frequency", "Off / Sub Band disabled", "DC Input Voltage", "CW ID"
        ]
        common.append(
            RadioSetting("disp", "Sub Band Display Format",
                         RadioSettingValueList(opts, opts[_overlay.disp])))

        # 12 Setting the DTMF Autodialer delay time
        opts = ["50 ms", "250 ms", "450 ms", "750 ms", "1 s"]
        dtmf.append(
            RadioSetting("dtmfd", "Autodialer delay time",
                         RadioSettingValueList(opts, opts[_overlay.dtmfd])))

        # 13 Setting the DTMF Autodialer sending speed
        opts = ["50 ms", "75 ms", "100 ms"]
        dtmf.append(
            RadioSetting("dtmfs", "Autodialer sending speed",
                         RadioSettingValueList(opts, opts[_overlay.dtmfs])))

        # 14 Current DTMF Autodialer memory
        rs = RadioSetting("dtmfw", "Current Autodialer memory",
                          RadioSettingValueInteger(1, 16, _overlay.dtmfw + 1))

        def apply_dtmfw(setting):
            _overlay.dtmfw = setting.value.get_value() - 1

        rs.set_apply_callback(apply_dtmfw)
        dtmf.append(rs)

        # DTMF Memory
        for i in range(16):
            dtmf_string = ""
            for j in range(16):
                dtmf_char = ''
                dtmf_int = int(self._memobj.dtmf_mem[i].dtmf[j])
                if dtmf_int < 10:
                    dtmf_char = str(dtmf_int)
                elif dtmf_int == 14:
                    dtmf_char = '*'
                elif dtmf_int == 15:
                    dtmf_char = '#'
                elif dtmf_int == 255:
                    break
                dtmf_string += dtmf_char
            radio_setting_value_string = RadioSettingValueString(
                0, 16, dtmf_string)
            radio_setting_value_string.set_charset(DTMF_CHARSET)
            rs = RadioSetting("dtmf_{0:02d}".format(i),
                              "DTMF Mem " + str(i + 1),
                              radio_setting_value_string)

            def apply_dtmf(setting, index):
                radio_setting_value_string = setting.value.get_value().rstrip()
                j = 0
                for dtmf_char in radio_setting_value_string:
                    dtmf_int = 255
                    if dtmf_char in "0123456789":
                        dtmf_int = int(dtmf_char)
                    elif dtmf_char == '*':
                        dtmf_int = 14
                    elif dtmf_char == '#':
                        dtmf_int = 15
                    if dtmf_int < 255:
                        self._memobj.dtmf_mem[index].dtmf[j] = dtmf_int
                        j += 1
                if j < 16:
                    self._memobj.dtmf_mem[index].dtmf[j] = 255

            rs.set_apply_callback(apply_dtmf, i)
            dtmf.append(rs)

        # 16 Enables/disables the PTT switch lock
        opts = ["Off", "Band A", "Band B", "Both"]
        common.append(
            RadioSetting("lockt", "PTT switch lock",
                         RadioSettingValueList(opts, opts[_overlay.lockt])))

        # 17 Selects the Microphone type to be used
        opts = ["MH-42", "MH-48"]
        common.append(
            RadioSetting("mic", "Microphone type",
                         RadioSettingValueList(opts, opts[_overlay.mic])))

        # 18 Reduces the audio level on the sub receiver when the
        #    main receiver is active
        opts = ["Off", "On"]
        common.append(
            RadioSetting("mute", "Mute Sub Receiver",
                         RadioSettingValueList(opts, opts[_overlay.mute])))

        # 20 - 23 Programming the microphones button assignment
        buttons = [
            "ACC / P1",
            "P / P2",
            "P1 / P3",
            "P2 / P4",
        ]
        opts_button = [
            "Low", "Tone", "MHz", "Rev", "Home", "Band", "VFO / Memory",
            "Sql Off", "1750 Hz Tone Call", "Repeater", "Priority"
        ]
        for i, button in enumerate(buttons):
            rs = RadioSetting(
                "button" + str(i), button,
                RadioSettingValueList(opts_button,
                                      opts_button[_overlay.button[i]]))

            def apply_button(setting, index):
                value_string = setting.value.get_value()
                value_int = opts_button.index(value_string)
                _overlay.button[index] = value_int

            rs.set_apply_callback(apply_button, i)
            mic_button.append(rs)

        # 24 Adjusts the RF SQL threshold level
        opts = ["Off", "S-1", "S-5", "S-9", "S-FULL"]
        band.append(
            RadioSetting(
                "rf_sql_vhf", "RF Sql VHF",
                RadioSettingValueList(opts, opts[_overlay.rf_sql_vhf])))
        band.append(
            RadioSetting(
                "rf_sql_uhf", "RF Sql UHF",
                RadioSettingValueList(opts, opts[_overlay.rf_sql_uhf])))

        # 25 Selects the Scan-Resume mode
        opts = ["Busy", "Time"]
        band.append(
            RadioSetting("scan_vhf", "Scan-Resume VHF",
                         RadioSettingValueList(opts, opts[_overlay.scan_vhf])))
        band.append(
            RadioSetting("scan_uhf", "Scan-Resume UHF",
                         RadioSettingValueList(opts, opts[_overlay.scan_uhf])))

        # 28 Defining the audio path to the external speaker
        opts = ["Off", "Band A", "Band B", "Both"]
        common.append(
            RadioSetting(
                "speaker_cnt", "External Speaker",
                RadioSettingValueList(opts, opts[_overlay.speaker_cnt])))

        # 31 Sets the Time-Out Timer
        opts = ["Off", "Band A", "Band B", "Both"]
        common.append(
            RadioSetting("tot", "TX Time-Out [Min.] (0 = Off)",
                         RadioSettingValueInteger(0, 30, _overlay.tot)))

        # 32 Reducing the MIC Gain (and Deviation)
        opts = ["Off", "On"]
        band.append(
            RadioSetting("txnar_vhf", "TX Narrowband VHF",
                         RadioSettingValueList(opts,
                                               opts[_overlay.txnar_vhf])))
        band.append(
            RadioSetting("txnar_uhf", "TX Narrowband UHF",
                         RadioSettingValueList(opts,
                                               opts[_overlay.txnar_uhf])))

        # 33 Enables/disables the VFO Tracking feature
        opts = ["Off", "On"]
        common.append(
            RadioSetting("vfotr", "VFO Tracking",
                         RadioSettingValueList(opts, opts[_overlay.vfotr])))

        # 34 Selects the receiving mode on the VHF band
        opts = ["Inhibit (only FM)", "AM", "Auto"]
        common.append(
            RadioSetting("am", "AM Mode",
                         RadioSettingValueList(opts, opts[_overlay.am])))

        # Current Band
        opts = ["VHF", "UHF"]
        common.append(
            RadioSetting(
                "current_band", "Current Band",
                RadioSettingValueList(opts, opts[_overlay.current_band])))

        # Show number of VHF and UHF channels
        val = RadioSettingValueString(0, 7,
                                      str(int(self._memobj.nb_mem_used_vhf)))
        val.set_mutable(False)
        rs = RadioSetting("num_chan_vhf", "Number of VHF channels", val)
        common.append(rs)
        val = RadioSettingValueString(0, 7,
                                      str(int(self._memobj.nb_mem_used_uhf)))
        val.set_mutable(False)
        rs = RadioSetting("num_chan_uhf", "Number of UHF channels", val)
        common.append(rs)

        return setmode
Exemplo n.º 46
0
    def _get_settings(self):
        _ani = self._memobj.ani
        _settings = self._memobj.settings
        _vfoa = self._memobj.vfoa
        _vfob = self._memobj.vfob
        _keymaps = self._memobj.keymaps

        basic = RadioSettingGroup("basic", "Basic Settings")
        advanced = RadioSettingGroup("advanced", "Advanced Settings")
        workmode = RadioSettingGroup("workmode", "Work Mode Settings")
        keymaps = RadioSettingGroup("keymaps", "KeyMaps")
        dtmf = RadioSettingGroup("dtmf", "DTMF Settings")

        group = RadioSettings(basic, advanced, workmode, keymaps, dtmf)

        rs = RadioSetting("squelch", "Carrier Squelch Level",
                          RadioSettingValueInteger(0, 5, _settings.squelch))
        basic.append(rs)

        rs = RadioSetting("battery_saver", "Battery Save",
                          RadioSettingValueBoolean(_settings.battery_saver))
        advanced.append(rs)

        rs = RadioSetting(
            "vox", "VOX Sensitivity",
            RadioSettingValueList(VOX_LIST, VOX_LIST[_settings.vox]))
        basic.append(rs)

        rs = RadioSetting(
            "auto_bl", "Auto Backlight Timeout",
            RadioSettingValueList(AUTOBL_LIST, AUTOBL_LIST[_settings.auto_bl]))
        advanced.append(rs)

        rs = RadioSetting(
            "tot", "TX Timeout Timer",
            RadioSettingValueList(TOT_LIST, TOT_LIST[_settings.tot]))
        basic.append(rs)

        rs = RadioSetting("beep", "Beep",
                          RadioSettingValueBoolean(_settings.beep))
        basic.append(rs)

        rs = RadioSetting("voice", "Voice",
                          RadioSettingValueBoolean(_settings.voice))
        advanced.append(rs)

        rs = RadioSetting(
            "language", "Language",
            RadioSettingValueList(LANGUAGE_LIST,
                                  LANGUAGE_LIST[_settings.language]))
        advanced.append(rs)

        rs = RadioSetting(
            "mdfa", "Display Mode (A)",
            RadioSettingValueList(MODE_LIST, MODE_LIST[_settings.mdfa]))
        basic.append(rs)

        rs = RadioSetting(
            "mdfb", "Display Mode (B)",
            RadioSettingValueList(MODE_LIST, MODE_LIST[_settings.mdfb]))
        basic.append(rs)

        rs = RadioSetting(
            "scan_mode", "Scan Mode",
            RadioSettingValueList(SCAN_MODE_LIST,
                                  SCAN_MODE_LIST[_settings.scan_mode]))
        basic.append(rs)

        rs = RadioSetting("bcl", "Busy Channel Lockout",
                          RadioSettingValueBoolean(_settings.bcl))
        advanced.append(rs)

        rs = RadioSetting("autolk", "Automatic Key Lock",
                          RadioSettingValueBoolean(_settings.autolk))
        advanced.append(rs)

        rs = RadioSetting(
            "almod", "Alarm Mode",
            RadioSettingValueList(ALMOD_LIST, ALMOD_LIST[_settings.almod]))
        advanced.append(rs)

        rs = RadioSetting("alsnd", "Alarm Sound",
                          RadioSettingValueBoolean(_settings.alsnd))
        advanced.append(rs)

        rs = RadioSetting("ste", "Squelch Tail Eliminate (HT to HT)",
                          RadioSettingValueBoolean(_settings.ste))
        advanced.append(rs)

        rs = RadioSetting(
            "rpste", "Squelch Tail Eliminate (repeater)",
            RadioSettingValueList(RPSTE_LIST, RPSTE_LIST[_settings.rpste]))
        advanced.append(rs)

        rs = RadioSetting(
            "rptrl", "STE Repeater Delay",
            RadioSettingValueList(STEDELAY_LIST,
                                  STEDELAY_LIST[_settings.rptrl]))
        advanced.append(rs)

        rs = RadioSetting("fmradio", "Disable Broadcast FM Radio",
                          RadioSettingValueBoolean(_settings.fmradio))
        advanced.append(rs)

        rs = RadioSetting("keylock", "Keypad Lock",
                          RadioSettingValueBoolean(_settings.keylock))
        advanced.append(rs)

        rs = RadioSetting(
            "voxdelay", "VOX Delay",
            RadioSettingValueList(VOX_DELAY_LIST,
                                  VOX_DELAY_LIST[_settings.voxdelay]))
        advanced.append(rs)

        rs = RadioSetting(
            "menu_timeout", "Menu Timeout",
            RadioSettingValueList(MENU_TIMEOUT_LIST,
                                  MENU_TIMEOUT_LIST[_settings.menu_timeout]))
        advanced.append(rs)

        rs = RadioSetting(
            "micgain", "Mic Gain",
            RadioSettingValueList(MICGAIN_LIST,
                                  MICGAIN_LIST[_settings.micgain]))
        advanced.append(rs)

        for entry in KEY_FUNCTIONS:
            if entry[1] == _keymaps.sidekey:
                rs = RadioSetting(
                    "keymaps.sidekey", "Side Key Short Press",
                    RadioSettingValueMap(KEY_FUNCTIONS, _keymaps.sidekey))
                keymaps.append(rs)

        for entry in KEY_FUNCTIONS:
            if entry[1] == _keymaps.sidekeyl:
                rs = RadioSetting(
                    "keymaps.sidekeyl", "Side Key Long Press",
                    RadioSettingValueMap(KEY_FUNCTIONS, _keymaps.sidekeyl))
                keymaps.append(rs)

        rs = RadioSetting(
            "workmodea", "Work Mode (A)",
            RadioSettingValueList(WORKMODE_LIST,
                                  WORKMODE_LIST[_settings.workmodea]))
        workmode.append(rs)

        rs = RadioSetting(
            "workmodeb", "Work Mode (B)",
            RadioSettingValueList(WORKMODE_LIST,
                                  WORKMODE_LIST[_settings.workmodeb]))
        workmode.append(rs)

        def convert_bytes_to_freq(bytes):
            real_freq = 0
            for byte in bytes:
                real_freq = (real_freq * 10) + byte
            return chirp_common.format_freq(real_freq * 10)

        def my_validate(value):
            value = chirp_common.parse_freq(value)
            if 17400000 <= value and value < 40000000:
                msg = ("Can't be between 174.00000-400.00000")
                raise InvalidValueError(msg)
            return chirp_common.format_freq(value)

        def apply_freq(setting, obj):
            value = chirp_common.parse_freq(str(setting.value)) / 10
            obj.band = value >= 40000000
            for i in range(7, -1, -1):
                obj.freq[i] = value % 10
                value /= 10

        val1a = RadioSettingValueString(0, 10,
                                        convert_bytes_to_freq(_vfoa.freq))
        val1a.set_validate_callback(my_validate)
        rs = RadioSetting("vfoa.freq", "VFO A Frequency", val1a)
        rs.set_apply_callback(apply_freq, _vfoa)
        workmode.append(rs)

        val1b = RadioSettingValueString(0, 10,
                                        convert_bytes_to_freq(_vfob.freq))
        val1b.set_validate_callback(my_validate)
        rs = RadioSetting("vfob.freq", "VFO B Frequency", val1b)
        rs.set_apply_callback(apply_freq, _vfob)
        workmode.append(rs)

        rs = RadioSetting(
            "vfoa.sftd", "VFO A Shift",
            RadioSettingValueList(SHIFTD_LIST, SHIFTD_LIST[_vfoa.sftd]))
        workmode.append(rs)

        rs = RadioSetting(
            "vfob.sftd", "VFO B Shift",
            RadioSettingValueList(SHIFTD_LIST, SHIFTD_LIST[_vfob.sftd]))
        workmode.append(rs)

        def convert_bytes_to_offset(bytes):
            real_offset = 0
            for byte in bytes:
                real_offset = (real_offset * 10) + byte
            return chirp_common.format_freq(real_offset * 100)

        def apply_offset(setting, obj):
            value = chirp_common.parse_freq(str(setting.value)) / 100
            for i in range(5, -1, -1):
                obj.offset[i] = value % 10
                value /= 10

        val1a = RadioSettingValueString(0, 10,
                                        convert_bytes_to_offset(_vfoa.offset))
        rs = RadioSetting("vfoa.offset", "VFO A Offset (0.0-999.999)", val1a)
        rs.set_apply_callback(apply_offset, _vfoa)
        workmode.append(rs)

        val1b = RadioSettingValueString(0, 10,
                                        convert_bytes_to_offset(_vfob.offset))
        rs = RadioSetting("vfob.offset", "VFO B Offset (0.0-999.999)", val1b)
        rs.set_apply_callback(apply_offset, _vfob)
        workmode.append(rs)

        rs = RadioSetting(
            "vfoa.txpower", "VFO A Power",
            RadioSettingValueList(TXPOWER_LIST, TXPOWER_LIST[_vfoa.txpower]))
        workmode.append(rs)

        rs = RadioSetting(
            "vfob.txpower", "VFO B Power",
            RadioSettingValueList(TXPOWER_LIST, TXPOWER_LIST[_vfob.txpower]))
        workmode.append(rs)

        rs = RadioSetting(
            "vfoa.widenarr", "VFO A Bandwidth",
            RadioSettingValueList(BANDWIDTH_LIST,
                                  BANDWIDTH_LIST[_vfoa.widenarr]))
        workmode.append(rs)

        rs = RadioSetting(
            "vfob.widenarr", "VFO B Bandwidth",
            RadioSettingValueList(BANDWIDTH_LIST,
                                  BANDWIDTH_LIST[_vfob.widenarr]))
        workmode.append(rs)

        rs = RadioSetting(
            "vfoa.scode", "VFO A PTT-ID",
            RadioSettingValueList(PTTIDCODE_LIST, PTTIDCODE_LIST[_vfoa.scode]))
        workmode.append(rs)

        rs = RadioSetting(
            "vfob.scode", "VFO B PTT-ID",
            RadioSettingValueList(PTTIDCODE_LIST, PTTIDCODE_LIST[_vfob.scode]))
        workmode.append(rs)

        rs = RadioSetting(
            "vfoa.step", "VFO A Tuning Step",
            RadioSettingValueList(STEP_LIST, STEP_LIST[_vfoa.step]))
        workmode.append(rs)
        rs = RadioSetting(
            "vfob.step", "VFO B Tuning Step",
            RadioSettingValueList(STEP_LIST, STEP_LIST[_vfob.step]))
        workmode.append(rs)

        dtmfchars = "0123456789 *#ABCD"

        for i in range(0, 15):
            _codeobj = self._memobj.pttid[i].code
            _code = "".join([dtmfchars[x] for x in _codeobj if int(x) < 0x1F])
            val = RadioSettingValueString(0, 5, _code, False)
            val.set_charset(dtmfchars)
            rs = RadioSetting("pttid/%i.code" % i, "PTT ID Code %i" % (i + 1),
                              val)

            def apply_code(setting, obj):
                code = []
                for j in range(0, 5):
                    try:
                        code.append(dtmfchars.index(str(setting.value)[j]))
                    except IndexError:
                        code.append(0xFF)
                obj.code = code

            rs.set_apply_callback(apply_code, self._memobj.pttid[i])
            dtmf.append(rs)

        rs = RadioSetting(
            "ani.aniid", "ANI ID",
            RadioSettingValueList(PTTID_LIST, PTTID_LIST[_ani.aniid]))
        dtmf.append(rs)

        _codeobj = self._memobj.ani.code
        _code = "".join([dtmfchars[x] for x in _codeobj if int(x) < 0x1F])
        val = RadioSettingValueString(0, 5, _code, False)
        val.set_charset(dtmfchars)
        rs = RadioSetting("ani.code", "ANI Code", val)

        def apply_code(setting, obj):
            code = []
            for j in range(0, 5):
                try:
                    code.append(dtmfchars.index(str(setting.value)[j]))
                except IndexError:
                    code.append(0xFF)
            obj.code = code

        rs.set_apply_callback(apply_code, _ani)
        dtmf.append(rs)

        rs = RadioSetting(
            "dtmfst", "DTMF Sidetone",
            RadioSettingValueList(DTMFST_LIST, DTMFST_LIST[_settings.dtmfst]))
        dtmf.append(rs)

        if _ani.dtmfon > 0xC3:
            val = 0x00
        else:
            val = _ani.dtmfon
        rs = RadioSetting(
            "ani.dtmfon", "DTMF Speed (on)",
            RadioSettingValueList(DTMFSPEED_LIST, DTMFSPEED_LIST[val]))
        dtmf.append(rs)

        if _ani.dtmfoff > 0xC3:
            val = 0x00
        else:
            val = _ani.dtmfoff
        rs = RadioSetting(
            "ani.dtmfoff", "DTMF Speed (off)",
            RadioSettingValueList(DTMFSPEED_LIST, DTMFSPEED_LIST[val]))
        dtmf.append(rs)

        rs = RadioSetting(
            "pttlt", "PTT ID Delay",
            RadioSettingValueList(PTTLT_LIST, PTTLT_LIST[_settings.pttlt]))
        dtmf.append(rs)

        return group
Exemplo n.º 47
0
    def get_settings(self):
        _settings = self._memobj.settings
        _info = self._memobj.info
        _bandlimits = self._memobj.bandlimits
        basic = RadioSettingGroup("basic", "Basic")
        info = RadioSettingGroup("info", "Model Info")
        top = RadioSettings(basic, info)
        add_radio_bool(basic, "beep", "Beep", _settings.beep)
        add_radio_bool(basic, "ars", "Auto Repeater Shift", _settings.ars)
        add_radio_setting(basic, "keylock", "Key Lock",
                          zero_indexed_seq_map(["Manual", "Auto"]),
                          _settings.keylock)
        add_radio_bool(basic, "auto_am", "Auto AM", _settings.auto_am)
        add_radio_setting(basic, "left_sql", "Left Squelch",
                          zero_indexed_seq_map(SQLPRESET),
                          _settings.left_sql)
        add_radio_setting(basic, "right_sql", "Right Squelch",
                          zero_indexed_seq_map(SQLPRESET),
                          _settings.right_sql)
        add_radio_setting(basic, "apo", "Auto Power off (Hours)",
                          [("Off", 0), ("0.5", 5), ("1.0", 10), ("1.5", 15),
                           ("2.0", 20)],
                          _settings.apo)
        add_radio_setting(basic, "backlight", "Display Backlight",
                          zero_indexed_seq_map(["Off", "1", "2", "3", "Full"]),
                          _settings.backlight)
        add_radio_setting(basic, "pttlock", "PTT Lock",
                          zero_indexed_seq_map(["Off", "Right", "Left",
                                                "Both"]),
                          _settings.pttlock)
        add_radio_setting(basic, "hyper_chan", "Hyper Channel",
                          zero_indexed_seq_map(["Manual", "Auto"]),
                          _settings.hyper_chan)
        add_radio_setting(basic, "right_func_key", "Right Function Key",
                          zero_indexed_seq_map(["Key 1", "Key 2"]),
                          _settings.right_func_key)
        add_radio_setting(basic, "mute_mode", "Mute Mode",
                          zero_indexed_seq_map(["Off", "TX", "RX", "TX RX"]),
                          _settings.mute_mode)
        add_radio_setting(basic, "scan_mode", "Scan Mode",
                          zero_indexed_seq_map(["MEM", "MSM"]),
                          _settings.scan_mode,
                          doc="MEM = Normal scan, bypass channels marked "
                          "skip. MSM = Scan only channels marked priority.")
        add_radio_setting(basic, "scan_resume", "Scan Resume",
                          zero_indexed_seq_map(["Time", "Busy"]),
                          _settings.scan_resume)
        basic.append(RadioSetting(
                "tot", "Time Out Timer (minutes)",
                RadioSettingValueInteger(0, 30, _settings.tot)))
        add_radio_setting(basic, "p1", "P1 Function",
                          zero_indexed_seq_map(MICKEYFUNC),
                          _settings.p1)
        add_radio_setting(basic, "p2", "P2 Function",
                          zero_indexed_seq_map(MICKEYFUNC),
                          _settings.p2)
        add_radio_setting(basic, "p3", "P3 Function",
                          zero_indexed_seq_map(MICKEYFUNC),
                          _settings.p3)
        add_radio_setting(basic, "p4", "P4 Function",
                          zero_indexed_seq_map(MICKEYFUNC),
                          _settings.p4)

        def _filter(name):
            filtered = ""
            for char in str(name):
                if char in chirp_common.CHARSET_ASCII:
                    filtered += char
                else:
                    filtered += " "
            return filtered

        rsvs = RadioSettingValueString(0, 8, _filter(_info.sn))
        rsvs.set_mutable(False)
        rs = RadioSetting("sn", "Serial Number", rsvs)
        info.append(rs)

        rsvs = RadioSettingValueString(0, 8, _filter(_info.model))
        rsvs.set_mutable(False)
        rs = RadioSetting("model", "Model Name", rsvs)
        info.append(rs)

        rsvs = RadioSettingValueString(0, 16, _filter(_info.code))
        rsvs.set_mutable(False)
        rs = RadioSetting("code", "Model Code", rsvs)
        info.append(rs)

        progdate = "%d/%d/%d" % (_info.prog_mon, _info.prog_day,
                                 _info.prog_yr)
        rsvs = RadioSettingValueString(0, 10, progdate)
        rsvs.set_mutable(False)
        rs = RadioSetting("progdate", "Last Program Date", rsvs)
        info.append(rs)

        # Band Limits
        for i in range(0, len(BANDS)):
            rx_start = int(_bandlimits[i].lorx) * 10
            if not rx_start == 0:
                objname = BANDS[i] + "lorx"
                objnamepp = BANDS[i] + " Rx Start"
                rsv = RadioSettingValueString(0, 10, format_freq(rx_start))
                rsv.set_mutable(False)
                rs = RadioSetting(objname, objnamepp, rsv)
                info.append(rs)

                rx_end = int(_bandlimits[i].hirx) * 10
                objname = BANDS[i] + "hirx"
                objnamepp = BANDS[i] + " Rx end"
                rsv = RadioSettingValueString(0, 10, format_freq(rx_end))
                rsv.set_mutable(False)
                rs = RadioSetting(objname, objnamepp, rsv)
                info.append(rs)

            tx_start = int(_bandlimits[i].lotx) * 10
            if not tx_start == 0:
                objname = BANDS[i] + "lotx"
                objnamepp = BANDS[i] + " Tx Start"
                rsv = RadioSettingValueString(0, 10, format_freq(tx_start))
                rsv.set_mutable(False)
                rs = RadioSetting(objname, objnamepp, rsv)
                info.append(rs)

                tx_end = int(_bandlimits[i].hitx) * 10
                objname = BANDS[i] + "hitx"
                objnamepp = BANDS[i] + " Tx end"
                rsv = RadioSettingValueString(0, 10, format_freq(tx_end))
                rsv.set_mutable(False)
                rs = RadioSetting(objname, objnamepp, rsv)
                info.append(rs)
        return top
Exemplo n.º 48
0
    def get_settings(self):
        _settings = self._memobj.settings
        _info = self._memobj.info
        _bandlimits = self._memobj.bandlimits
        basic = RadioSettingGroup("basic", "Basic")
        info = RadioSettingGroup("info", "Model Info")
        top = RadioSettings(basic, info)
        basic.append(RadioSetting(
                "beep", "Beep",
                RadioSettingValueBoolean(_settings.beep)))
        basic.append(RadioSetting(
                "beep_vol", "Beep Volume",
                RadioSettingValueInteger(0, 15, _settings.beep_vol)))
        basic.append(RadioSetting(
                "keylock", "Key Lock",
                RadioSettingValueBoolean(_settings.keylock)))
        basic.append(RadioSetting(
                "ani_display", "ANI Display",
                RadioSettingValueBoolean(_settings.ani_display)))
        basic.append(RadioSetting(
                "auto_xfer", "Auto Transfer",
                RadioSettingValueBoolean(_settings.auto_xfer)))
        basic.append(RadioSetting(
                "auto_contact", "Auto Contact Always Remind",
                RadioSettingValueBoolean(_settings.auto_contact)))
        basic.append(RadioSetting(
                "auto_am", "Auto AM",
                RadioSettingValueBoolean(_settings.auto_am)))
        basic.append(RadioSetting(
                "left_sql", "Left Squelch",
                RadioSettingValueList(
                    SQLPRESET, SQLPRESET[_settings.left_sql])))
        basic.append(RadioSetting(
                "right_sql", "Right Squelch",
                RadioSettingValueList(
                    SQLPRESET, SQLPRESET[_settings.right_sql])))
#      basic.append(RadioSetting("apo", "Auto Power off (0.1h)",
#              RadioSettingValueInteger(0, 20, _settings.apo)))
        opts = ["Off"] + ["%0.1f" % (t / 10.0) for t in range(1, 21, 1)]
        basic.append(RadioSetting(
                "apo", "Auto Power off (Hours)",
                RadioSettingValueList(opts, opts[_settings.apo])))
        opts = ["Off", "1", "2", "3", "Full"]
        basic.append(RadioSetting(
                "backlight", "Display Backlight",
                RadioSettingValueList(opts, opts[_settings.backlight])))
        opts = ["Off", "Right", "Left", "Both"]
        basic.append(RadioSetting(
                "pttlock", "PTT Lock",
                RadioSettingValueList(opts, opts[_settings.pttlock])))
        opts = ["Manual", "Auto"]
        basic.append(RadioSetting(
                "hyper_chan", "Hyper Channel",
                RadioSettingValueList(opts, opts[_settings.hyper_chan])))
        opts = ["Key 1", "Key 2"]
        basic.append(RadioSetting(
                "right_func_key", "Right Function Key",
                RadioSettingValueList(opts, opts[_settings.right_func_key])))
        opts = ["1000Hz", "1450Hz", "1750Hz", "2100Hz"]
        basic.append(RadioSetting(
                "tbst_freq", "Tone Burst Frequency",
                RadioSettingValueList(opts, opts[_settings.tbst_freq])))
        opts = ["Off", "TX", "RX", "TX RX"]
        basic.append(RadioSetting(
                "mute_mode", "Mute Mode",
                RadioSettingValueList(opts, opts[_settings.mute_mode])))
        opts = ["MEM", "MSM"]
        scanmode = RadioSetting(
                "scan_mode", "Scan Mode",
                RadioSettingValueList(opts, opts[_settings.scan_mode]))
        scanmode.set_doc("MEM = Normal scan, bypass channels marked skip. "
                         " MSM = Scan only channels marked priority.")
        basic.append(scanmode)
        opts = ["TO", "CO"]
        basic.append(RadioSetting(
                "scan_resume", "Scan Resume",
                RadioSettingValueList(opts, opts[_settings.scan_resume])))
        opts = ["%0.1f" % (t / 10.0) for t in range(0, 51, 1)]
        basic.append(RadioSetting(
                "exit_delay", "Span Transit Exit Delay",
                RadioSettingValueList(opts, opts[_settings.exit_delay])))
        basic.append(RadioSetting(
                "tot", "Time Out Timer (minutes)",
                RadioSettingValueInteger(0, 30, _settings.tot)))
        basic.append(RadioSetting(
                "tot_alert", "Time Out Timer Pre Alert(seconds)",
                RadioSettingValueInteger(0, 15, _settings.tot_alert)))
        basic.append(RadioSetting(
                "tot_rekey", "Time Out Rekey (seconds)",
                RadioSettingValueInteger(0, 15, _settings.tot_rekey)))
        basic.append(RadioSetting(
                "tot_reset", "Time Out Reset(seconds)",
                RadioSettingValueInteger(0, 15, _settings.tot_reset)))
        basic.append(RadioSetting(
                "p1", "P1 Function",
                RadioSettingValueList(MICKEYFUNC, MICKEYFUNC[_settings.p1])))
        basic.append(RadioSetting(
                "p2", "P2 Function",
                RadioSettingValueList(MICKEYFUNC, MICKEYFUNC[_settings.p2])))
        basic.append(RadioSetting(
                "p3", "P3 Function",
                RadioSettingValueList(MICKEYFUNC, MICKEYFUNC[_settings.p3])))
        basic.append(RadioSetting(
                "p4", "P4 Function",
                RadioSettingValueList(MICKEYFUNC, MICKEYFUNC[_settings.p4])))
#      opts = ["0", "1"]
#      basic.append(RadioSetting("x", "Desc",
#            RadioSettingValueList(opts, opts[_settings.x])))

        def _filter(name):
            filtered = ""
            for char in str(name):
                if char in chirp_common.CHARSET_ASCII:
                    filtered += char
                else:
                    filtered += " "
            return filtered

        rsvs = RadioSettingValueString(0, 8, _filter(_info.sn))
        rsvs.set_mutable(False)
        rs = RadioSetting("sn", "Serial Number", rsvs)
        info.append(rs)

        rsvs = RadioSettingValueString(0, 8, _filter(_info.model))
        rsvs.set_mutable(False)
        rs = RadioSetting("model", "Model Name", rsvs)
        info.append(rs)

        rsvs = RadioSettingValueString(0, 16, _filter(_info.code))
        rsvs.set_mutable(False)
        rs = RadioSetting("code", "Model Code", rsvs)
        info.append(rs)

        progdate = "%d/%d/%d" % (_info.prog_mon, _info.prog_day,
                                 _info.prog_yr)
        rsvs = RadioSettingValueString(0, 10, progdate)
        rsvs.set_mutable(False)
        rs = RadioSetting("progdate", "Last Program Date", rsvs)
        info.append(rs)

        # 9 band limits
        for i in range(0, 9):
            objname = BANDS[i] + "lorx"
            objnamepp = BANDS[i] + " Rx Start"
            # rsv = RadioSettingValueInteger(0, 100000000,
            #              int(_bandlimits[i].lorx))
            rsv = RadioSettingValueString(
                    0, 10, format_freq(int(_bandlimits[i].lorx)*10))
            rsv.set_mutable(False)
            rs = RadioSetting(objname, objnamepp, rsv)
            info.append(rs)
            objname = BANDS[i] + "hirx"
            objnamepp = BANDS[i] + " Rx end"
            rsv = RadioSettingValueString(
                    0, 10, format_freq(int(_bandlimits[i].hirx)*10))
            rsv.set_mutable(False)
            rs = RadioSetting(objname, objnamepp, rsv)
            info.append(rs)
            objname = BANDS[i] + "lotx"
            objnamepp = BANDS[i] + " Tx Start"
            rsv = RadioSettingValueString(
                    0, 10, format_freq(int(_bandlimits[i].lotx)*10))
            rsv.set_mutable(False)
            rs = RadioSetting(objname, objnamepp, rsv)
            info.append(rs)
            objname = BANDS[i] + "hitx"
            objnamepp = BANDS[i] + " Tx end"
            rsv = RadioSettingValueString(
                    0, 10, format_freq(int(_bandlimits[i].hitx)*10))
            rsv.set_mutable(False)
            rs = RadioSetting(objname, objnamepp, rsv)
            info.append(rs)

        return top
Exemplo n.º 49
0
    def _get_settings(self):
        _settings = self._memobj.settings
        _vfoa = self._memobj.vfoa
        _vfob = self._memobj.vfob
        cfg_grp = RadioSettingGroup("cfg_grp", "Configuration")
        vfoa_grp = RadioSettingGroup("vfoa_grp", "VFO A Settings")
        vfob_grp = RadioSettingGroup("vfob_grp", "VFO B Settings")
        key_grp = RadioSettingGroup("key_grp", "Key Settings")
        lmt_grp = RadioSettingGroup("lmt_grp", "Frequency Limits")
        oem_grp = RadioSettingGroup("oem_grp", "OEM Info")

        group = RadioSettings(cfg_grp, vfoa_grp, vfob_grp,
                              key_grp, lmt_grp, oem_grp)

        #
        # Configuration Settings
        #
        rs = RadioSetting("channel_menu", "Menu available in channel mode",
                          RadioSettingValueBoolean(_settings.channel_menu))
        cfg_grp.append(rs)
        rs = RadioSetting("ponmsg", "Poweron message",
                          RadioSettingValueList(
                              PONMSG_LIST, PONMSG_LIST[_settings.ponmsg]))
        cfg_grp.append(rs)
        rs = RadioSetting("voice", "Voice Guide",
                          RadioSettingValueBoolean(_settings.voice))
        cfg_grp.append(rs)
        rs = RadioSetting("language", "Language",
                          RadioSettingValueList(LANGUAGE_LIST,
                                                LANGUAGE_LIST[_settings.
                                                              language]))
        cfg_grp.append(rs)
        rs = RadioSetting("timeout", "Timeout Timer",
                          RadioSettingValueInteger(15, 900,
                                                   _settings.timeout * 15, 15))
        cfg_grp.append(rs)
        rs = RadioSetting("toalarm", "Timeout Alarm",
                          RadioSettingValueInteger(0, 10, _settings.toalarm))
        cfg_grp.append(rs)
        rs = RadioSetting("roger_beep", "Roger Beep",
                          RadioSettingValueBoolean(_settings.roger_beep))
        cfg_grp.append(rs)
        rs = RadioSetting("power_save", "Power save",
                          RadioSettingValueBoolean(_settings.power_save))
        cfg_grp.append(rs)
        rs = RadioSetting("autolock", "Autolock",
                          RadioSettingValueBoolean(_settings.autolock))
        cfg_grp.append(rs)
        rs = RadioSetting("keylock", "Keypad Lock",
                          RadioSettingValueBoolean(_settings.keylock))
        cfg_grp.append(rs)
        rs = RadioSetting("beep", "Keypad Beep",
                          RadioSettingValueBoolean(_settings.beep))
        cfg_grp.append(rs)
        rs = RadioSetting("stopwatch", "Stopwatch",
                          RadioSettingValueBoolean(_settings.stopwatch))
        cfg_grp.append(rs)
        rs = RadioSetting("backlight", "Backlight",
                          RadioSettingValueList(BACKLIGHT_LIST,
                                                BACKLIGHT_LIST[_settings.
                                                               backlight]))
        cfg_grp.append(rs)
        rs = RadioSetting("dtmf_st", "DTMF Sidetone",
                          RadioSettingValueList(DTMFST_LIST,
                                                DTMFST_LIST[_settings.
                                                            dtmf_st]))
        cfg_grp.append(rs)
        rs = RadioSetting("ani-id_sw", "ANI-ID Switch",
                          RadioSettingValueBoolean(_settings.ani_sw))
        cfg_grp.append(rs)
        rs = RadioSetting("ptt-id_delay", "PTT-ID Delay",
                          RadioSettingValueList(PTTID_LIST,
                                                PTTID_LIST[_settings.ptt_id]))
        cfg_grp.append(rs)
        rs = RadioSetting("ring_time", "Ring Time",
                          RadioSettingValueList(LIST_10,
                                                LIST_10[_settings.ring_time]))
        cfg_grp.append(rs)
        rs = RadioSetting("scan_rev", "Scan Mode",
                          RadioSettingValueList(SCANMODE_LIST,
                                                SCANMODE_LIST[_settings.
                                                              scan_rev]))
        cfg_grp.append(rs)
        rs = RadioSetting("vox", "VOX",
                          RadioSettingValueList(LIST_10,
                                                LIST_10[_settings.vox]))
        cfg_grp.append(rs)
        rs = RadioSetting("prich_sw", "Priority Channel Switch",
                          RadioSettingValueBoolean(_settings.prich_sw))
        cfg_grp.append(rs)
        rs = RadioSetting("pri_ch", "Priority Channel",
                          RadioSettingValueInteger(1, 999, _settings.pri_ch))
        cfg_grp.append(rs)
        rs = RadioSetting("rpt_mode", "Radio Mode",
                          RadioSettingValueList(RPTMODE_LIST,
                                                RPTMODE_LIST[_settings.
                                                             rpt_mode]))
        cfg_grp.append(rs)
        rs = RadioSetting("rpt_set", "Repeater Setting",
                          RadioSettingValueList(RPTSET_LIST,
                                                RPTSET_LIST[_settings.
                                                            rpt_set]))
        cfg_grp.append(rs)
        rs = RadioSetting("rpt_spk", "Repeater Mode Speaker",
                          RadioSettingValueBoolean(_settings.rpt_spk))
        cfg_grp.append(rs)
        rs = RadioSetting("rpt_ptt", "Repeater PTT",
                          RadioSettingValueBoolean(_settings.rpt_ptt))
        cfg_grp.append(rs)
        rs = RadioSetting("dtmf_tx_time", "DTMF Tx Duration",
                          RadioSettingValueList(DTMF_TIMES,
                                                DTMF_TIMES[_settings.
                                                           dtmf_tx_time]))
        cfg_grp.append(rs)
        rs = RadioSetting("dtmf_interval", "DTMF Interval",
                          RadioSettingValueList(DTMF_TIMES,
                                                DTMF_TIMES[_settings.
                                                           dtmf_interval]))
        cfg_grp.append(rs)
        rs = RadioSetting("alert", "Alert Tone",
                          RadioSettingValueList(ALERTS_LIST,
                                                ALERTS_LIST[_settings.alert]))
        cfg_grp.append(rs)
        rs = RadioSetting("rpt_tone", "Repeater Tone",
                          RadioSettingValueBoolean(_settings.rpt_tone))
        cfg_grp.append(rs)
        rs = RadioSetting("rpt_hold", "Repeater Hold Time",
                          RadioSettingValueList(HOLD_TIMES,
                                                HOLD_TIMES[_settings.
                                                           rpt_hold]))
        cfg_grp.append(rs)
        rs = RadioSetting("scan_det", "Scan DET",
                          RadioSettingValueBoolean(_settings.scan_det))
        cfg_grp.append(rs)
        rs = RadioSetting("sc_qt", "SC-QT",
                          RadioSettingValueList(SCQT_LIST,
                                                SCQT_LIST[_settings.smuteset]))
        cfg_grp.append(rs)
        rs = RadioSetting("smuteset", "SubFreq Mute",
                          RadioSettingValueList(SMUTESET_LIST,
                                                SMUTESET_LIST[_settings.
                                                              smuteset]))
        cfg_grp.append(rs)
        _pwd = "".join(map(chr, _settings.mode_sw_pwd))
        val = RadioSettingValueString(0, 6, _pwd)
        val.set_mutable(True)
        rs = RadioSetting("mode_sw_pwd", "Mode Switch Password", val)
        cfg_grp.append(rs)
        _pwd = "".join(map(chr, _settings.reset_pwd))
        val = RadioSettingValueString(0, 6, _pwd)
        val.set_mutable(True)
        rs = RadioSetting("reset_pwd", "Reset Password", val)
        cfg_grp.append(rs)
        #
        # VFO A Settings
        #
        rs = RadioSetting("vfoa_mode", "VFO A Workmode",
                          RadioSettingValueList(WORKMODE_LIST,
                                                WORKMODE_LIST[_settings.
                                                              workmode_a]))
        vfoa_grp.append(rs)
        rs = RadioSetting("vfoa_chan", "VFO A Channel",
                          RadioSettingValueInteger(1, 999, _settings.work_cha))
        vfoa_grp.append(rs)
        rs = RadioSetting("rxfreqa", "VFO A Rx Frequency",
                          RadioSettingValueInteger(
                              134000000, 520000000, _vfoa.rxfreq * 10, 5000))
        vfoa_grp.append(rs)
        rs = RadioSetting("txoffa", "VFO A Tx Offset",
                          RadioSettingValueInteger(
                              0, 520000000, _vfoa.txoffset * 10, 5000))
        vfoa_grp.append(rs)
        #   u16   rxtone;
        #   u16   txtone;
        rs = RadioSetting("vfoa_power", "VFO A Power",
                          RadioSettingValueList(
                              POWER_LIST, POWER_LIST[_vfoa.power]))
        vfoa_grp.append(rs)
        #         shift_dir:2
        rs = RadioSetting("vfoa_iswide", "VFO A NBFM",
                          RadioSettingValueList(
                              BANDWIDTH_LIST, BANDWIDTH_LIST[_vfoa.iswide]))
        vfoa_grp.append(rs)
        rs = RadioSetting("vfoa_mute_mode", "VFO A Mute",
                          RadioSettingValueList(
                              SPMUTE_LIST, SPMUTE_LIST[_vfoa.mute_mode]))
        vfoa_grp.append(rs)
        rs = RadioSetting("vfoa_step", "VFO A Step (kHz)",
                          RadioSettingValueList(
                              STEP_LIST, STEP_LIST[_vfoa.step]))
        vfoa_grp.append(rs)
        rs = RadioSetting("vfoa_squelch", "VFO A Squelch",
                          RadioSettingValueList(
                              LIST_10, LIST_10[_vfoa.squelch]))
        vfoa_grp.append(rs)
        rs = RadioSetting("bcl_a", "Busy Channel Lock-out A",
                          RadioSettingValueBoolean(_settings.bcl_a))
        vfoa_grp.append(rs)
        #
        # VFO B Settings
        #
        rs = RadioSetting("vfob_mode", "VFO B Workmode",
                          RadioSettingValueList(
                              WORKMODE_LIST,
                              WORKMODE_LIST[_settings.workmode_b]))
        vfob_grp.append(rs)
        rs = RadioSetting("vfob_chan", "VFO B Channel",
                          RadioSettingValueInteger(1, 999, _settings.work_chb))
        vfob_grp.append(rs)
        rs = RadioSetting("rxfreqb", "VFO B Rx Frequency",
                          RadioSettingValueInteger(
                              134000000, 520000000, _vfob.rxfreq * 10, 5000))
        vfob_grp.append(rs)
        rs = RadioSetting("txoffb", "VFO B Tx Offset",
                          RadioSettingValueInteger(
                              0, 520000000, _vfob.txoffset * 10, 5000))
        vfob_grp.append(rs)
        #   u16   rxtone;
        #   u16   txtone;
        rs = RadioSetting("vfob_power", "VFO B Power",
                          RadioSettingValueList(
                              POWER_LIST, POWER_LIST[_vfob.power]))
        vfob_grp.append(rs)
        #         shift_dir:2
        rs = RadioSetting("vfob_iswide", "VFO B NBFM",
                          RadioSettingValueList(
                              BANDWIDTH_LIST, BANDWIDTH_LIST[_vfob.iswide]))
        vfob_grp.append(rs)
        rs = RadioSetting("vfob_mute_mode", "VFO B Mute",
                          RadioSettingValueList(
                              SPMUTE_LIST, SPMUTE_LIST[_vfob.mute_mode]))
        vfob_grp.append(rs)
        rs = RadioSetting("vfob_step", "VFO B Step (kHz)",
                          RadioSettingValueList(
                              STEP_LIST, STEP_LIST[_vfob.step]))
        vfob_grp.append(rs)
        rs = RadioSetting("vfob_squelch", "VFO B Squelch",
                          RadioSettingValueList(
                              LIST_10, LIST_10[_vfob.squelch]))
        vfob_grp.append(rs)
        rs = RadioSetting("bcl_b", "Busy Channel Lock-out B",
                          RadioSettingValueBoolean(_settings.bcl_b))
        vfob_grp.append(rs)
        #
        # Key Settings
        #
        _msg = str(_settings.dispstr).split("\0")[0]
        val = RadioSettingValueString(0, 15, _msg)
        val.set_mutable(True)
        rs = RadioSetting("dispstr", "Display Message", val)
        key_grp.append(rs)
        _ani = ""
        for i in _settings.ani:
            if i < 10:
                _ani += chr(i + 0x30)
            else:
                break
        val = RadioSettingValueString(0, 6, _ani)
        val.set_mutable(True)
        rs = RadioSetting("ani", "ANI code", val)
        key_grp.append(rs)
        rs = RadioSetting("pf1_func", "PF1 Key function",
                          RadioSettingValueList(
                              PF1KEY_LIST,
                              PF1KEY_LIST[self._memobj.settings.pf1_func]))
        key_grp.append(rs)
        rs = RadioSetting("pf3_func", "PF3 Key function",
                          RadioSettingValueList(
                              PF3KEY_LIST,
                              PF3KEY_LIST[self._memobj.settings.pf3_func]))
        key_grp.append(rs)

        #
        # Scan Group Settings
        #
        # settings:
        #   u8    scg_a;
        #   u8    scg_b;
        #
        #   struct {
        #       u16    lower;
        #       u16    upper;
        #   } scan_groups[10];

        #
        # Call group settings
        #

        #
        # Limits settings
        #
        rs = RadioSetting("urx_start", "UHF RX Lower Limit",
                          RadioSettingValueInteger(
                              400000000, 520000000,
                              self._memobj.uhf_limits.rx_start * 10, 5000))
        lmt_grp.append(rs)
        rs = RadioSetting("urx_stop", "UHF RX Upper Limit",
                          RadioSettingValueInteger(
                              400000000, 520000000,
                              self._memobj.uhf_limits.rx_stop * 10, 5000))
        lmt_grp.append(rs)
        rs = RadioSetting("utx_start", "UHF TX Lower Limit",
                          RadioSettingValueInteger(
                              400000000, 520000000,
                              self._memobj.uhf_limits.tx_start * 10, 5000))
        lmt_grp.append(rs)
        rs = RadioSetting("utx_stop", "UHF TX Upper Limit",
                          RadioSettingValueInteger(
                              400000000, 520000000,
                              self._memobj.uhf_limits.tx_stop * 10, 5000))
        lmt_grp.append(rs)
        rs = RadioSetting("vrx_start", "VHF RX Lower Limit",
                          RadioSettingValueInteger(
                              134000000, 174997500,
                              self._memobj.vhf_limits.rx_start * 10, 5000))
        lmt_grp.append(rs)
        rs = RadioSetting("vrx_stop", "VHF RX Upper Limit",
                          RadioSettingValueInteger(
                              134000000, 174997500,
                              self._memobj.vhf_limits.rx_stop * 10, 5000))
        lmt_grp.append(rs)
        rs = RadioSetting("vtx_start", "VHF TX Lower Limit",
                          RadioSettingValueInteger(
                              134000000, 174997500,
                              self._memobj.vhf_limits.tx_start * 10, 5000))
        lmt_grp.append(rs)
        rs = RadioSetting("vtx_stop", "VHF TX Upper Limit",
                          RadioSettingValueInteger(
                              134000000, 174997500,
                              self._memobj.vhf_limits.tx_stop * 10, 5000))
        lmt_grp.append(rs)

        #
        # OEM info
        #
        def _decode(lst):
            _str = ''.join([chr(c) for c in lst
                            if chr(c) in chirp_common.CHARSET_ASCII])
            return _str

        _str = _decode(self._memobj.oem_info.model)
        val = RadioSettingValueString(0, 15, _str)
        val.set_mutable(False)
        rs = RadioSetting("model", "Model", val)
        oem_grp.append(rs)
        _str = _decode(self._memobj.oem_info.oem1)
        val = RadioSettingValueString(0, 15, _str)
        val.set_mutable(False)
        rs = RadioSetting("oem1", "OEM String 1", val)
        oem_grp.append(rs)
        _str = _decode(self._memobj.oem_info.oem2)
        val = RadioSettingValueString(0, 15, _str)
        val.set_mutable(False)
        rs = RadioSetting("oem2", "OEM String 2", val)
        oem_grp.append(rs)
        _str = _decode(self._memobj.oem_info.version)
        val = RadioSettingValueString(0, 15, _str)
        val.set_mutable(False)
        rs = RadioSetting("version", "Software Version", val)
        oem_grp.append(rs)
        _str = _decode(self._memobj.oem_info.date)
        val = RadioSettingValueString(0, 15, _str)
        val.set_mutable(False)
        rs = RadioSetting("date", "OEM Date", val)
        oem_grp.append(rs)

        return group
Exemplo n.º 50
0
    def _get_zones(self):
        zones = RadioSettingGroup('zones', 'Zones')

        zone_count = RadioSetting('_zonecount',
                                  'Number of Zones',
                                  RadioSettingValueInteger(
                                      1, 128, len(self._zones)))
        zone_count.set_doc('Number of zones in the radio. '
                           'Requires a save and re-load of the '
                           'file to take effect. Reducing this number '
                           'will DELETE memories in affected zones!')
        zones.append(zone_count)

        for i in range(len(self._zones)):
            zone = RadioSettingGroup('zone%i' % i, 'Zone %i' % (i + 1))

            _zone = getattr(self._memobj, 'zone%i' % i).zoneinfo
            _name = str(_zone.name).rstrip('\x00')
            name = RadioSetting('name%i' % i, 'Name',
                                RadioSettingValueString(0, 12, _name))
            zone.append(name)

            def apply_timer(setting, key):
                val = int(setting.value)
                if val == 0:
                    val = 0xFFFF
                setattr(_zone, key, val)

            def collapse(val):
                val = int(val)
                if val == 0xFFFF:
                    val = 0
                return val

            timer = RadioSetting(
                'timeout', 'Time-out Timer',
                RadioSettingValueInteger(15, 1200, collapse(_zone.timeout)))
            timer.set_apply_callback(apply_timer, 'timeout')
            zone.append(timer)

            timer = RadioSetting(
                'tot_alert', 'TOT Pre-Alert',
                RadioSettingValueInteger(0, 10, collapse(_zone.tot_alert)))
            timer.set_apply_callback(apply_timer, 'tot_alert')
            zone.append(timer)

            timer = RadioSetting(
                'tot_rekey', 'TOT Re-Key Time',
                RadioSettingValueInteger(0, 60, collapse(_zone.tot_rekey)))
            timer.set_apply_callback(apply_timer, 'tot_rekey')
            zone.append(timer)

            timer = RadioSetting(
                'tot_reset', 'TOT Reset Time',
                RadioSettingValueInteger(0, 15, collapse(_zone.tot_reset)))
            timer.set_apply_callback(apply_timer, 'tot_reset')
            zone.append(timer)

            zone.append(self._inverted_flag_setting(
                'bcl_override', 'BCL Override',
                _zone))

            zones.append(zone)

        return zones
Exemplo n.º 51
0
    def get_settings(self):
        try:
            _squelch = 1
            basic = RadioSettingGroup("basic", "Basic")
            expand_1 = RadioSettingGroup("expand_1", "Expand 1")
            expand_2 = RadioSettingGroup("expand_2", "Expand 2")
            dtmf_autodial = RadioSettingGroup("dtmf_autodial", "DTMF autodial")
            group = RadioSettings(basic, expand_1, expand_2, dtmf_autodial)

            # basic
            basic.append(
                RadioSetting(
                    "mem_channel", "Current memory channel",
                    RadioSettingValueInteger(0, MEM_NUM - 1,
                                             self.memobj.mem_channel)))
            basic.append(
                RadioSetting(
                    "squelch_level", "Squelch level",
                    RadioSettingValueList(
                        SQUELCH_LEVEL,
                        SQUELCH_LEVEL[self.memobj.squelch_level])))
            basic.append(
                RadioSetting(
                    "scan_resume", "Scan resume",
                    RadioSettingValueList(
                        SCAN_RESUME, SCAN_RESUME[self.memobj.scan_resume])))
            basic.append(
                RadioSetting(
                    "scan_pause", "Scan pause",
                    RadioSettingValueList(SCAN_PAUSE,
                                          SCAN_PAUSE[self.memobj.scan_pause])))
            basic.append(
                RadioSetting(
                    "beep_volume", "Beep audio",
                    RadioSettingValueList(
                        BEEP_VOLUME, BEEP_VOLUME[self.memobj.beep_volume])))
            basic.append(
                RadioSetting("beep", "Operation beep",
                             RadioSettingValueBoolean(self.memobj.beep)))
            basic.append(
                RadioSetting(
                    "backlight", "LCD backlight",
                    RadioSettingValueList(BACKLIGHT,
                                          BACKLIGHT[self.memobj.backlight])))
            basic.append(
                RadioSetting("busy_led", "Busy LED",
                             RadioSettingValueBoolean(self.memobj.busy_led)))
            basic.append(
                RadioSetting(
                    "auto_power_off", "Auto power off",
                    RadioSettingValueList(
                        AUTO_POWER_OFF,
                        AUTO_POWER_OFF[self.memobj.auto_power_off])))
            basic.append(
                RadioSetting(
                    "power_save", "Power save",
                    RadioSettingValueList(POWER_SAVE,
                                          POWER_SAVE[self.memobj.power_save])))
            basic.append(
                RadioSetting(
                    "monitor", "Monitor",
                    RadioSettingValueList(MONITOR,
                                          MONITOR[self.memobj.monitor])))
            basic.append(
                RadioSetting(
                    "dial_speedup", "Dial speedup",
                    RadioSettingValueBoolean(self.memobj.dial_speedup)))
            basic.append(
                RadioSetting(
                    "auto_repeater", "Auto repeater",
                    RadioSettingValueList(
                        AUTO_REPEATER,
                        AUTO_REPEATER[self.memobj.auto_repeater])))
            basic.append(
                RadioSetting(
                    "hm_75a_function", "HM-75A function",
                    RadioSettingValueList(
                        HM_75A_FUNCTION,
                        HM_75A_FUNCTION[self.memobj.hm_75a_function])))
            basic.append(
                RadioSetting("wx_alert", "WX alert",
                             RadioSettingValueBoolean(self.memobj.wx_alert)))
            basic.append(
                RadioSetting(
                    "wx_channel", "Current WX channel",
                    RadioSettingValueList(WX_CHANNEL,
                                          WX_CHANNEL[self.memobj.wx_channel])))
            basic.append(
                RadioSetting(
                    "comment", "Comment",
                    RadioSettingValueString(0,
                                            COMMENT_LEN,
                                            str(self.memobj.comment),
                                            autopad=True)))
            basic.append(
                RadioSetting(
                    "tune_step", "Current tune step",
                    RadioSettingValueList(
                        TUNE_STEP_STR, TUNE_STEP_STR[self.memobj.tune_step])))
            basic.append(
                RadioSetting(
                    "band_selected", "Selected band",
                    RadioSettingValueInteger(0, BANDS - 1,
                                             self.memobj.band_selected)))
            basic.append(
                RadioSetting(
                    "memory_display", "Memory display",
                    RadioSettingValueList(
                        MEMORY_DISPLAY,
                        MEMORY_DISPLAY[self.memobj.memory_display])))
            basic.append(
                RadioSetting("memory_name", "Memory name",
                             RadioSettingValueBoolean(
                                 self.memobj.memory_name)))
            basic.append(
                RadioSetting(
                    "dial_select", "Dial select",
                    RadioSettingValueList(
                        DIAL_SELECT, DIAL_SELECT[self.memobj.dial_select])))
            basic.append(
                RadioSetting(
                    "power", "RF power",
                    RadioSettingValueList(POWER, POWER[self.memobj.power])))
            basic.append(
                RadioSetting("vfo", "Current VFO",
                             RadioSettingValueList(VFO, VFO[self.memobj.vfo])))
            basic.append(
                RadioSetting("attenuator", "RF attenuator",
                             RadioSettingValueBoolean(self.memobj.attenuator)))
            basic.append(
                RadioSetting("skip_scan", "Skip scan",
                             RadioSettingValueBoolean(self.memobj.skip_scan)))
            # TODO: this needs to be reverse engineered, because the following commented
            # code does not seem correct
            #            basic.append(RadioSetting("mode", "Current mode",
            #                         RadioSettingValueList(OPERATION_MODE,
            #                         OPERATION_MODE[self.memobj.mode])))
            basic.append(
                RadioSetting(
                    "vfo_scan", "VFO scan",
                    RadioSettingValueList(VFO_SCAN,
                                          VFO_SCAN[self.memobj.vfo_scan])))
            basic.append(
                RadioSetting(
                    "memory_scan", "Memory scan",
                    RadioSettingValueList(
                        MEMORY_SCAN, MEMORY_SCAN[self.memobj.memory_scan])))
            basic.append(
                RadioSetting(
                    "tv_channel", "Current TV channel",
                    RadioSettingValueInteger(0, TV_CHANNELS - 1,
                                             self.memobj.tv_channel)))

            # DTMF auto dial
            dtmf_autodial.append(
                RadioSetting(
                    "autodial", "Autodial",
                    RadioSettingValueList(AUTODIAL,
                                          AUTODIAL[self.memobj.autodial])))
            dtmf_autodial.append(
                RadioSetting(
                    "dtmf_speed", "Speed",
                    RadioSettingValueList(DTMF_SPEED,
                                          DTMF_SPEED[self.memobj.dtmf_speed])))
            for x in range(DTMF_AUTODIAL_NUM):
                rs = RadioSetting(
                    "dtmf_codes[%d].dtmf_digits" % x, "DTMF autodial: %d" % x,
                    RadioSettingValueString(
                        0,
                        DTMF_DIGITS_NUM,
                        self.dtmf_icom2chirp(
                            self.memobj.dtmf_codes[x].dtmf_digits),
                        autopad=True,
                        charset="0123456789ABCD*#abcd "))
                rs.set_apply_callback(self.apply_dtmf_autodial,
                                      self.memobj.dtmf_codes[x].dtmf_digits)
                dtmf_autodial.append(rs)

            # expand 1
            expand_1.append(
                RadioSetting("expand_1", "Expand 1",
                             RadioSettingValueBoolean(self.memobj.expand_1)))
            expand_1.append(
                RadioSetting(
                    "scan_stop_beep", "Scan stop beep",
                    RadioSettingValueBoolean(self.memobj.scan_stop_beep)))
            expand_1.append(
                RadioSetting(
                    "scan_stop_light", "Scan stop light",
                    RadioSettingValueBoolean(self.memobj.scan_stop_light)))
            expand_1.append(
                RadioSetting(
                    "light_postion", "Light position",
                    RadioSettingValueList(
                        LIGHT_POSITION,
                        LIGHT_POSITION[self.memobj.light_position])))
            expand_1.append(
                RadioSetting(
                    "light_color", "Light color",
                    RadioSettingValueList(
                        LIGHT_COLOR, LIGHT_COLOR[self.memobj.light_color])))
            expand_1.append(
                RadioSetting(
                    "band_edge_beep", "Band edge beep",
                    RadioSettingValueBoolean(self.memobj.band_edge_beep)))
            expand_1.append(
                RadioSetting(
                    "auto_power_on", "Auto power on",
                    RadioSettingValueList(
                        AUTO_POWER_ON,
                        AUTO_POWER_ON[self.memobj.auto_power_on])))
            expand_1.append(
                RadioSetting(
                    "key_lock", "Key lock",
                    RadioSettingValueList(KEY_LOCK,
                                          KEY_LOCK[self.memobj.key_lock])))
            expand_1.append(
                RadioSetting("ptt_lock", "PTT lock",
                             RadioSettingValueBoolean(self.memobj.ptt_lock)))
            expand_1.append(
                RadioSetting(
                    "lcd_contrast", "LCD contrast",
                    RadioSettingValueList(
                        LCD_CONTRAST, LCD_CONTRAST[self.memobj.lcd_contrast])))
            expand_1.append(
                RadioSetting(
                    "opening_message", "Opening message",
                    RadioSettingValueBoolean(self.memobj.opening_message)))
            expand_1.append(
                RadioSetting(
                    "opening_message_text", "Opening message",
                    RadioSettingValueString(
                        0,
                        OPENING_MESSAGE_LEN,
                        str(self.memobj.opening_message_text),
                        autopad=True,
                        charset=CHARSET)))

            # expand 2
            expand_2.append(
                RadioSetting("expand_2", "Expand 2",
                             RadioSettingValueBoolean(self.memobj.expand_2)))
            expand_2.append(
                RadioSetting(
                    "busy_lockout", "Busy lock out",
                    RadioSettingValueBoolean(self.memobj.busy_lockout)))
            expand_2.append(
                RadioSetting(
                    "timeout_timer", "Timeout timer",
                    RadioSettingValueList(
                        TIMEOUT_TIMER,
                        TIMEOUT_TIMER[self.memobj.timeout_timer])))
            expand_2.append(
                RadioSetting(
                    "active_band", "Active band",
                    RadioSettingValueList(
                        ACTIVE_BAND, ACTIVE_BAND[self.memobj.active_band])))
            expand_2.append(
                RadioSetting("fm_narrow", "FM narrow",
                             RadioSettingValueBoolean(self.memobj.fm_narrow)))
            expand_2.append(
                RadioSetting("split", "Split",
                             RadioSettingValueBoolean(self.memobj.split)))
            expand_2.append(
                RadioSetting(
                    "morse_code_enable", "Morse code synthesizer",
                    RadioSettingValueBoolean(self.memobj.morse_code_enable)))
            expand_2.append(
                RadioSetting(
                    "morse_code_speed", "Morse code speed",
                    RadioSettingValueList(
                        MORSE_CODE_SPEED,
                        MORSE_CODE_SPEED[self.memobj.morse_code_speed])))

            return group
        except:
            import traceback
            LOG.error("Failed to parse settings: %s", traceback.format_exc())
            return None
Exemplo n.º 52
0
    def _get_settings(self):
        _settings = self._memobj.settings
        _service = self._memobj.service
        _msg = self._memobj.messages
        cfg_grp = RadioSettingGroup("cfg_grp", "Basic Settings")
        adv_grp = RadioSettingGroup("adv_grp", "Advanced Settings")
        key_grp = RadioSettingGroup("key_grp", "Key Assignment")
        group = RadioSettings(cfg_grp, adv_grp, key_grp)

        #
        # Basic Settings
        #
        rs = RadioSetting("apo", "Auto Power Off",
                          RadioSettingValueList(
                              APO_LIST, APO_LIST[_settings.apo]))
        cfg_grp.append(rs)
        rs = RadioSetting("sql", "Squelch Level",
                          RadioSettingValueList(
                              SQL_LIST, SQL_LIST[_settings.sql]))
        cfg_grp.append(rs)
        rs = RadioSetting("scanm", "Scan Mode",
                          RadioSettingValueList(
                              SCANM_LIST, SCANM_LIST[_settings.scanm]))
        cfg_grp.append(rs)
        rs = RadioSetting("tot", "Time Out Timer",
                          RadioSettingValueList(
                              TOT_LIST, TOT_LIST[_settings.tot]))
        cfg_grp.append(rs)
        rs = RadioSetting("step", "Step",
                          RadioSettingValueList(
                              STEP_LIST, STEP_LIST[_settings.step]))
        cfg_grp.append(rs)
        rs = RadioSetting("monitor", "Monitor",
                          RadioSettingValueList(
                              MONITOR_LIST, MONITOR_LIST[_settings.monitor]))
        cfg_grp.append(rs)
        rs = RadioSetting("vfomr", "VFO/MR",
                          RadioSettingValueList(
                              VFOMR_LIST, VFOMR_LIST[_settings.vfomr]))
        cfg_grp.append(rs)
        rs = RadioSetting("mrcha", "MR/CHA",
                          RadioSettingValueList(
                              MRCHA_LIST, MRCHA_LIST[_settings.mrcha]))
        cfg_grp.append(rs)
        rs = RadioSetting("vol", "Volume",
                          RadioSettingValueList(
                              VOL_LIST, VOL_LIST[_settings.vol]))
        cfg_grp.append(rs)
        rs = RadioSetting("opendis", "Open Display",
                          RadioSettingValueList(
                              OPENDIS_LIST, OPENDIS_LIST[_settings.opendis]))
        cfg_grp.append(rs)

        def _filter(name):
            filtered = ""
            for char in str(name):
                if char in chirp_common.CHARSET_ASCII:
                    filtered += char
                else:
                    filtered += " "
            LOG.debug("Filtered: %s" % filtered)
            return filtered

        rs = RadioSetting("messages.user1", "User-defined Message 1",
                          RadioSettingValueString(0, 7, _filter(_msg.user1)))
        cfg_grp.append(rs)
        rs = RadioSetting("messages.user2", "User-defined Message 2",
                          RadioSettingValueString(0, 7, _filter(_msg.user2)))
        cfg_grp.append(rs)

        val = RadioSettingValueString(0, 7, _filter(_msg.system))
        val.set_mutable(False)
        rs = RadioSetting("messages.system", "System Message", val)
        cfg_grp.append(rs)

        rs = RadioSetting("lamp", "Backlight",
                          RadioSettingValueList(
                              LAMP_LIST, LAMP_LIST[_settings.lamp]))
        cfg_grp.append(rs)
        rs = RadioSetting("keylockm", "Key Lock Mode",
                          RadioSettingValueList(
                              KEYLOCKM_LIST,
                              KEYLOCKM_LIST[_settings.keylockm]))
        cfg_grp.append(rs)
        rs = RadioSetting("absel", "A/B Select",
                          RadioSettingValueList(ABSEL_LIST,
                                                ABSEL_LIST[_settings.absel]))
        cfg_grp.append(rs)

        rs = RadioSetting("obeep", "Open Beep",
                          RadioSettingValueBoolean(_settings.obeep))
        cfg_grp.append(rs)
        rs = RadioSetting("rbeep", "Roger Beep",
                          RadioSettingValueBoolean(_settings.rbeep))
        cfg_grp.append(rs)
        rs = RadioSetting("keylock_off", "Key Lock",
                          RadioSettingValueBoolean(not _settings.keylock_off))
        cfg_grp.append(rs)
        rs = RadioSetting("ctdcsb", "CT/DCS Busy Lock",
                          RadioSettingValueBoolean(_settings.ctdcsb))
        cfg_grp.append(rs)
        rs = RadioSetting("alarm", "Alarm Key",
                          RadioSettingValueBoolean(_settings.alarm))
        cfg_grp.append(rs)
        rs = RadioSetting("save", "Battery Save",
                          RadioSettingValueBoolean(_settings.save))
        cfg_grp.append(rs)
        rs = RadioSetting("kbeep", "Key Beep",
                          RadioSettingValueBoolean(_settings.kbeep))
        cfg_grp.append(rs)
        rs = RadioSetting("reset", "Reset Enable",
                          RadioSettingValueBoolean(_settings.reset))
        cfg_grp.append(rs)
        rs = RadioSetting("smfont_off", "Small Font",
                          RadioSettingValueBoolean(not _settings.smfont_off))
        cfg_grp.append(rs)
        rs = RadioSetting("aliasen_off", "Alias Enable",
                          RadioSettingValueBoolean(not _settings.aliasen_off))
        cfg_grp.append(rs)
        rs = RadioSetting("txstop_off", "TX Stop",
                          RadioSettingValueBoolean(not _settings.txstop_off))
        cfg_grp.append(rs)
        rs = RadioSetting("dw_off", "Dual Watch",
                          RadioSettingValueBoolean(not _settings.dw_off))
        cfg_grp.append(rs)
        rs = RadioSetting("fmen_off", "FM Enable",
                          RadioSettingValueBoolean(not _settings.fmen_off))
        cfg_grp.append(rs)
        rs = RadioSetting("fmdw", "FM Dual Watch",
                          RadioSettingValueBoolean(_settings.fmdw))
        cfg_grp.append(rs)
        rs = RadioSetting("fmscan_off", "FM Scan",
                          RadioSettingValueBoolean(
                              not _settings.fmscan_off))
        cfg_grp.append(rs)
        rs = RadioSetting("keypadmic_off", "Keypad MIC",
                          RadioSettingValueBoolean(
                              not _settings.keypadmic_off))
        cfg_grp.append(rs)
        rs = RadioSetting("voxgain", "VOX Gain",
                          RadioSettingValueList(
                              VOXGAIN_LIST, VOXGAIN_LIST[_settings.voxgain]))
        cfg_grp.append(rs)
        rs = RadioSetting("voxdt", "VOX Delay Time",
                          RadioSettingValueList(
                              VOXDT_LIST, VOXDT_LIST[_settings.voxdt]))
        cfg_grp.append(rs)
        rs = RadioSetting("vir", "VOX Inhibit on Receive",
                          RadioSettingValueBoolean(_settings.vir))
        cfg_grp.append(rs)

        #
        # Advanced Settings
        #
        val = (_settings.dtmftime) - 5
        rs = RadioSetting("dtmftime", "DTMF Digit Time",
                          RadioSettingValueList(
                              DTMFTIME_LIST, DTMFTIME_LIST[val]))
        adv_grp.append(rs)
        val = (_settings.dtmfspace) - 5
        rs = RadioSetting("dtmfspace", "DTMF Digit Space Time",
                          RadioSettingValueList(
                              DTMFTIME_LIST, DTMFTIME_LIST[val]))
        adv_grp.append(rs)
        val = (_settings.dtmfdelay) / 5
        rs = RadioSetting("dtmfdelay", "DTMF 1st Digit Delay",
                          RadioSettingValueList(
                              DTMFDELAY_LIST, DTMFDELAY_LIST[val]))
        adv_grp.append(rs)
        val = (_settings.dtmfpretime) / 10 - 1
        rs = RadioSetting("dtmfpretime", "DTMF Pretime",
                          RadioSettingValueList(
                              DTMFPRETIME_LIST, DTMFPRETIME_LIST[val]))
        adv_grp.append(rs)
        val = (_settings.dtmfdelay2) / 5
        rs = RadioSetting("dtmfdelay2", "DTMF * and # Digit Delay",
                          RadioSettingValueList(
                              DTMFDELAY2_LIST, DTMFDELAY2_LIST[val]))
        adv_grp.append(rs)
        rs = RadioSetting("ackdecode", "ACK Decode",
                          RadioSettingValueBoolean(_settings.ackdecode))
        adv_grp.append(rs)
        rs = RadioSetting("dtmfst", "DTMF Sidetone",
                          RadioSettingValueBoolean(_settings.dtmfst))
        adv_grp.append(rs)

        rs = RadioSetting("service.rssi400", "Squelch Base Level (UHF)",
                          RadioSettingValueInteger(0, 255, _service.rssi400))
        adv_grp.append(rs)
        rs = RadioSetting("service.rssi136", "Squelch Base Level (VHF)",
                          RadioSettingValueInteger(0, 255, _service.rssi136))
        adv_grp.append(rs)

        #
        # Key Settings
        #
        val = (_settings.lptime) - 5
        rs = RadioSetting("lptime", "Long Press Time",
                          RadioSettingValueList(
                              LPTIME_LIST, LPTIME_LIST[val]))
        key_grp.append(rs)
        rs = RadioSetting("keyp1long", "P1 Long Key",
                          RadioSettingValueList(
                              PFKEYLONG_LIST,
                              PFKEYLONG_LIST[_settings.keyp1long]))
        key_grp.append(rs)
        rs = RadioSetting("keyp1short", "P1 Short Key",
                          RadioSettingValueList(
                              PFKEYSHORT_LIST,
                              PFKEYSHORT_LIST[_settings.keyp1short]))
        key_grp.append(rs)
        rs = RadioSetting("keyp2long", "P2 Long Key",
                          RadioSettingValueList(
                              PFKEYLONG_LIST,
                              PFKEYLONG_LIST[_settings.keyp2long]))
        key_grp.append(rs)
        rs = RadioSetting("keyp2short", "P2 Short Key",
                          RadioSettingValueList(
                              PFKEYSHORT_LIST,
                              PFKEYSHORT_LIST[_settings.keyp2short]))
        key_grp.append(rs)
        rs = RadioSetting("keyp3long", "P3 Long Key",
                          RadioSettingValueList(
                              PFKEYLONG_LIST,
                              PFKEYLONG_LIST[_settings.keyp3long]))
        key_grp.append(rs)
        rs = RadioSetting("keyp3short", "P3 Short Key",
                          RadioSettingValueList(
                              PFKEYSHORT_LIST,
                              PFKEYSHORT_LIST[_settings.keyp3short]))
        key_grp.append(rs)

        val = RadioSettingValueList(PFKEYSHORT_LIST,
                                    PFKEYSHORT_LIST[_settings.keymshort])
        val.set_mutable(_settings.menuen == 0)
        rs = RadioSetting("keymshort", "M Short Key", val)
        key_grp.append(rs)
        val = RadioSettingValueBoolean(_settings.menuen)
        rs = RadioSetting("menuen", "Menu Enable", val)
        key_grp.append(rs)

        return group
Exemplo n.º 53
0
    def get_settings(self):
        china = RadioSettingGroup("china", "China Map Fix")
        smartbeacon = RadioSettingGroup("smartbeacon", "Smartbeacon")

        aprs = RadioSettingGroup("aprs", "APRS", china, smartbeacon)
        digipeat = RadioSettingGroup("digipeat", "Digipeat")
        system = RadioSettingGroup("system", "System")
        settings = RadioSettings(aprs, digipeat, system)

        aprs.append(
            RadioSetting(
                "callsign", "Callsign",
                RadioSettingValueString(0, 6, self._mmap.callsign[:6])))
        aprs.append(
            RadioSetting(
                "ssid", "SSID",
                RadioSettingValueInteger(0, 15,
                                         ord(self._mmap.callsign[6]) - 0x30)))
        pttdelay = PTT_DELAY[int(self._mmap.pttdelay) - 1]
        aprs.append(
            RadioSetting("pttdelay", "PTT Delay",
                         RadioSettingValueList(PTT_DELAY, pttdelay)))
        output = OUTPUT[int(self._mmap.output) - 1]
        aprs.append(
            RadioSetting("output", "Output",
                         RadioSettingValueList(OUTPUT, output)))
        aprs.append(
            RadioSetting("mice", "Mic-E",
                         RadioSettingValueBoolean(strbool(self._mmap.mice))))
        try:
            mice_msg = MICE_MESSAGE[int(self._mmap.multiple['mice_message'])]
            aprs.append(
                RadioSetting("mice_message", "Mic-E Message",
                             RadioSettingValueList(MICE_MESSAGE, mice_msg)))
        except NotImplementedError:
            pass
        try:
            aprs.append(
                RadioSetting(
                    "path1", "Path 1",
                    RadioSettingValueString(0,
                                            6,
                                            self._mmap.path1[:6],
                                            autopad=True,
                                            charset=CHARSET)))
            ssid1 = ord(self._mmap.path1[6]) - 0x30
            aprs.append(
                RadioSetting("ssid1", "SSID 1",
                             RadioSettingValueInteger(0, 7, ssid1)))
            aprs.append(
                RadioSetting(
                    "path2", "Path 2",
                    RadioSettingValueString(0,
                                            6,
                                            self._mmap.path2[:6],
                                            autopad=True,
                                            charset=CHARSET)))
            ssid2 = ord(self._mmap.path2[6]) - 0x30
            aprs.append(
                RadioSetting("ssid2", "SSID 2",
                             RadioSettingValueInteger(0, 7, ssid2)))
            aprs.append(
                RadioSetting(
                    "path3", "Path 3",
                    RadioSettingValueString(0,
                                            6,
                                            self._mmap.path3[:6],
                                            autopad=True,
                                            charset=CHARSET)))
            ssid3 = ord(self._mmap.path3[6]) - 0x30
            aprs.append(
                RadioSetting("ssid3", "SSID 3",
                             RadioSettingValueInteger(0, 7, ssid3)))
        except NotImplementedError:
            aprs.append(
                RadioSetting(
                    "path", "Path",
                    RadioSettingValueList(PATH, PATH[int(self._mmap.path)])))
        aprs.append(
            RadioSetting("table", "Table or Overlay",
                         RadioSettingValueList(TABLE, self._mmap.symbol[1])))
        aprs.append(
            RadioSetting("symbol", "Symbol",
                         RadioSettingValueList(SYMBOL, self._mmap.symbol[0])))
        aprs.append(
            RadioSetting(
                "beacon", "Beacon Mode",
                RadioSettingValueList(BEACON,
                                      BEACON[int(self._mmap.beacon) - 1])))
        aprs.append(
            RadioSetting("rate", "Beacon Rate (seconds)",
                         RadioSettingValueInteger(10, 9999, self._mmap.rate)))
        aprs.append(
            RadioSetting(
                "comment", "Comment",
                RadioSettingValueString(0,
                                        34,
                                        self._mmap.comment,
                                        autopad=False,
                                        charset=CHARSET)))
        try:
            voltage = self._mmap.multiple['voltage']
            aprs.append(
                RadioSetting("voltage", "Voltage in comment",
                             RadioSettingValueBoolean(voltage)))
            temperature = self._mmap.multiple['temperature']
            aprs.append(
                RadioSetting("temperature", "Temperature in comment",
                             RadioSettingValueBoolean(temperature)))
        except NotImplementedError:
            pass
        aprs.append(
            RadioSetting(
                "status", "Status",
                RadioSettingValueString(0,
                                        34,
                                        self._mmap.status,
                                        autopad=False,
                                        charset=CHARSET)))
        try:
            telemetry = self._mmap.multiple['telemetry']
            aprs.append(
                RadioSetting("telemetry", "Telemetry",
                             RadioSettingValueBoolean(telemetry)))
            telemetry_every = self._mmap.multiple['telemetry_every']
            aprs.append(
                RadioSetting("telemetry_every", "Telemetry every",
                             RadioSettingValueInteger(1, 99, telemetry_every)))
            timeslot_enable = self._mmap.multiple['telemetry']
            aprs.append(
                RadioSetting("timeslot_enable", "Timeslot",
                             RadioSettingValueBoolean(timeslot_enable)))
            timeslot = self._mmap.multiple['timeslot']
            aprs.append(
                RadioSetting("timeslot", "Timeslot (second of minute)",
                             RadioSettingValueInteger(0, 59, timeslot)))
        except NotImplementedError:
            pass

        fields = [
            ("chinamapfix", "China map fix",
             RadioSettingValueBoolean(strbool(self._mmap.chinamapfix[0]))),
            ("chinalat", "Lat",
             RadioSettingValueInteger(-45, 45,
                                      ord(self._mmap.chinamapfix[2]) - 80)),
            ("chinalon", "Lon",
             RadioSettingValueInteger(-45, 45,
                                      ord(self._mmap.chinamapfix[1]) - 80)),
        ]
        for field in fields:
            china.append(RadioSetting(*field))

        try:
            # Sometimes when digipeat is disabled, alias is 0xFF
            alias = ALIAS[int(self._mmap.digipeat[1]) - 1]
        except ValueError:
            alias = ALIAS[0]
        fields = [
            ("digipeat", "Digipeat",
             RadioSettingValueBoolean(strbool(self._mmap.digipeat[0]))),
            ("alias", "Digipeat Alias", RadioSettingValueList(ALIAS, alias)),
            ("virtualgps", "Static Position",
             RadioSettingValueBoolean(strbool(self._mmap.virtualgps[0]))),
            ("btext", "Static Position BTEXT",
             RadioSettingValueString(0,
                                     27,
                                     self._mmap.virtualgps[1:],
                                     autopad=False,
                                     charset=CHARSET)),
        ]
        for field in fields:
            digipeat.append(RadioSetting(*field))

        sb = self._mmap.smartbeacon
        fields = [
            ("lowspeed", "Low Speed"),
            ("highspeed", "High Speed"),
            ("slowrate", "Slow Rate (seconds)"),
            ("fastrate", "Fast Rate (seconds)"),
            ("turnslope", "Turn Slope"),
            ("turnangle", "Turn Angle"),
            ("turntime", "Turn Time (seconds)"),
        ]
        for field in fields:
            smartbeacon.append(
                RadioSetting(field[0], field[1],
                             RadioSettingValueInteger(0, 9999, sb[field[0]])))

        system.append(
            RadioSetting("version", "Version (read-only)",
                         RadioSettingValueString(0, 14, self._mmap.version)))
        system.append(
            RadioSetting("autooff", "Auto off (after 90 minutes)",
                         RadioSettingValueBoolean(strbool(
                             self._mmap.autooff))))
        system.append(
            RadioSetting("beep", "Beep on transmit",
                         RadioSettingValueBoolean(strbool(self._mmap.beep))))
        system.append(
            RadioSetting(
                "highaltitude", "High Altitude",
                RadioSettingValueBoolean(strbool(self._mmap.highaltitude))))
        system.append(
            RadioSetting(
                "busywait", "Wait for clear channel before transmit",
                RadioSettingValueBoolean(strbool(self._mmap.busywait))))
        try:
            system.append(
                RadioSetting(
                    "tx_volume", "Transmit volume",
                    RadioSettingValueList(map(str, range(1, 7)),
                                          self._mmap.tx_volume)))
            system.append(
                RadioSetting(
                    "rx_volume", "Receive volume",
                    RadioSettingValueList(map(str, range(1, 10)),
                                          self._mmap.rx_volume)))
            system.append(
                RadioSetting(
                    "squelch", "Squelch",
                    RadioSettingValueList(map(str, range(
                        0, 9)), str(self._mmap.multiple['squelch']))))
            system.append(
                RadioSetting(
                    "tx_serial_ui_out", "Tx serial UI out",
                    RadioSettingValueBoolean(
                        strbool(self._mmap.tx_serial_ui_out))))
            system.append(
                RadioSetting(
                    "auto_on", "Auto-on with 5V input",
                    RadioSettingValueBoolean(strbool(self._mmap.auto_on[0]))))
            system.append(
                RadioSetting(
                    "auto_on_delay", "Auto-off delay after 5V lost (seconds)",
                    RadioSettingValueInteger(0, 9999,
                                             int(self._mmap.auto_on[1:]))))
            system.append(
                RadioSetting(
                    "tfx", "TF/X",
                    RadioSettingValueBoolean(self._mmap.multiple['tfx'])))
            system.append(
                RadioSetting(
                    "blueled", "Light blue LED on GPS lock",
                    RadioSettingValueBoolean(self._mmap.multiple['blueled'])))
            system.append(
                RadioSetting(
                    "dcd", "Blue LED shows software DCD",
                    RadioSettingValueBoolean(self._mmap.multiple['dcd'])))
            system.append(
                RadioSetting(
                    "tf_card", "TF card format",
                    RadioSettingValueList(
                        TF_CARD,
                        TF_CARD[int(self._mmap.multiple['tf_card'])])))
        except NotImplementedError:
            pass

        return settings