From 91dbf844ad923e3c4bca1252dd104d8fc8ce5475 Mon Sep 17 00:00:00 2001 From: Dave Hibberd Date: Mon, 16 Oct 2023 21:37:27 +0100 Subject: New upstream version 20231016 --- .github/actions/py2-tox/action.yaml | 29 - .github/actions/py3-tox/action.yaml | 20 - .github/workflows/py2-test.yaml | 57 - .github/workflows/py3-pr.yaml | 51 - .github/workflows/py3-test.yaml | 74 - .github/workflows/test-py3-merge.yaml | 35 - .hgignore | 21 - .hgtags | 17 - .pylintrc | 308 - INSTALL | 52 - MANIFEST.in | 16 +- PKG-INFO | 15 + README.chirpc | 104 - README.developers | 64 - README.md | 5 +- README.rpttool | 23 - build/chirp.app/Contents/Info.plist | 26 - build/chirp.app/Contents/MacOS/chirp | 19 - build/chirp.app/Contents/PkgInfo | 1 - build/chirp.app/Contents/Resources/.placeholder | 0 build/macos/make_pango.sh | 51 - build/make_source_release.sh | 23 - build/version | 1 - chirp.egg-info/PKG-INFO | 15 + chirp.egg-info/SOURCES.txt | 611 + chirp.egg-info/dependency_links.txt | 1 + chirp.egg-info/entry_points.txt | 3 + chirp.egg-info/requires.txt | 11 + chirp.egg-info/top_level.txt | 1 + chirp/__init__.py | 28 +- chirp/bandplan.py | 37 +- chirp/bandplan_iaru_r1.py | 9 +- chirp/bandplan_iaru_r3.py | 2 +- chirp/bandplan_na.py | 36 +- chirp/bitwise.py | 13 +- chirp/chirp_common.py | 718 +- chirp/cli/__init__.py | 0 chirp/cli/main.py | 402 + chirp/detect.py | 17 +- chirp/directory.py | 115 +- chirp/dmrmarc.py | 139 - chirp/drivers/__init__.py | 173 +- chirp/drivers/alinco.py | 151 +- chirp/drivers/anytone.py | 42 +- chirp/drivers/anytone778uv.py | 63 +- chirp/drivers/anytone_ht.py | 47 +- chirp/drivers/anytone_iii.py | 67 +- chirp/drivers/ap510.py | 27 +- chirp/drivers/baofeng_common.py | 222 +- chirp/drivers/baofeng_uv3r.py | 18 +- chirp/drivers/baofeng_wp970i.py | 142 +- chirp/drivers/bf-t1.py | 917 - chirp/drivers/bf-t8.py | 1024 - chirp/drivers/bf_t1.py | 927 + chirp/drivers/bf_t8.py | 971 + chirp/drivers/bj9900.py | 35 +- chirp/drivers/bjuv55.py | 8 +- chirp/drivers/boblov_x3plus.py | 29 +- chirp/drivers/btech.py | 1785 +- chirp/drivers/fake.py | 64 +- chirp/drivers/fd268.py | 54 +- chirp/drivers/ft1500m.py | 29 +- chirp/drivers/ft1802.py | 29 +- chirp/drivers/ft1d.py | 935 +- chirp/drivers/ft2800.py | 85 +- chirp/drivers/ft2900.py | 81 +- chirp/drivers/ft2d.py | 129 +- chirp/drivers/ft4.py | 95 +- chirp/drivers/ft450d.py | 2986 ++- chirp/drivers/ft50.py | 45 +- chirp/drivers/ft60.py | 78 +- chirp/drivers/ft70.py | 308 +- chirp/drivers/ft7100.py | 123 +- chirp/drivers/ft7800.py | 107 +- chirp/drivers/ft8100.py | 4 +- chirp/drivers/ft817.py | 70 +- chirp/drivers/ft818.py | 8 +- chirp/drivers/ft857.py | 83 +- chirp/drivers/ft90.py | 84 +- chirp/drivers/ftlx011.py | 144 +- chirp/drivers/ftm3200d.py | 51 +- chirp/drivers/ftm350.py | 26 +- chirp/drivers/ftm7250d.py | 48 +- chirp/drivers/ga510.py | 386 +- chirp/drivers/generic_csv.py | 44 +- chirp/drivers/generic_tpe.py | 5 +- chirp/drivers/gmrsuv1.py | 194 +- chirp/drivers/gmrsv2.py | 217 +- chirp/drivers/h777.py | 156 +- chirp/drivers/hf90.py | 571 + chirp/drivers/hg_uv98.py | 21 +- chirp/drivers/hobbypcb.py | 36 +- chirp/drivers/ic208.py | 2 +- chirp/drivers/ic2100.py | 15 +- chirp/drivers/ic2300.py | 9 +- chirp/drivers/ic2720.py | 2 +- chirp/drivers/ic2730.py | 62 +- chirp/drivers/ic2820.py | 8 +- chirp/drivers/ic9x.py | 170 +- chirp/drivers/ic9x_icf.py | 4 +- chirp/drivers/ic9x_ll.py | 138 +- chirp/drivers/icf.py | 565 +- chirp/drivers/icomciv.py | 85 +- chirp/drivers/icp7.py | 20 +- chirp/drivers/icq7.py | 12 +- chirp/drivers/ict8.py | 2 +- chirp/drivers/icv80.py | 520 + chirp/drivers/icv86.py | 39 +- chirp/drivers/icx8x.py | 276 +- chirp/drivers/icx8x_ll.py | 539 - chirp/drivers/icx90.py | 153 +- chirp/drivers/id31.py | 70 +- chirp/drivers/id51.py | 10 +- chirp/drivers/id5100.py | 340 + chirp/drivers/id51plus.py | 35 +- chirp/drivers/id800.py | 17 +- chirp/drivers/id880.py | 26 +- chirp/drivers/idrp.py | 1 + chirp/drivers/iradio_uv-5118.py | 1119 - chirp/drivers/iradio_uv_5118.py | 1117 + chirp/drivers/iradio_uv_5118plus.py | 1071 + chirp/drivers/kenwood_d7.py | 2331 +++ chirp/drivers/kenwood_itm.py | 2 +- chirp/drivers/kenwood_live.py | 330 +- chirp/drivers/kg935g.py | 1360 +- chirp/drivers/kguv8d.py | 41 +- chirp/drivers/kguv8dplus.py | 136 +- chirp/drivers/kguv8e.py | 140 +- chirp/drivers/kguv920pa.py | 66 +- chirp/drivers/kguv980p.py | 2607 +++ chirp/drivers/kguv9dplus.py | 2303 +- chirp/drivers/kyd.py | 21 +- chirp/drivers/kyd_IP620.py | 96 +- chirp/drivers/leixen.py | 71 +- chirp/drivers/lt725uv.py | 197 +- chirp/drivers/mml_jc8810.py | 1417 ++ chirp/drivers/mursv1.py | 95 +- chirp/drivers/puxing.py | 41 +- chirp/drivers/puxing_px888k.py | 66 +- chirp/drivers/radioddity_r2.py | 158 +- chirp/drivers/radtel_t18.py | 454 +- chirp/drivers/repeaterbook.py | 36 - chirp/drivers/retevis_rb15.py | 109 +- chirp/drivers/retevis_rb17p.py | 122 +- chirp/drivers/retevis_rb28.py | 732 + chirp/drivers/retevis_rt1.py | 61 +- chirp/drivers/retevis_rt21.py | 653 +- chirp/drivers/retevis_rt22.py | 111 +- chirp/drivers/retevis_rt23.py | 49 +- chirp/drivers/retevis_rt26.py | 64 +- chirp/drivers/retevis_rt76p.py | 76 +- chirp/drivers/retevis_rt87.py | 29 +- chirp/drivers/retevis_rt98.py | 195 +- chirp/drivers/rfinder.py | 331 - chirp/drivers/rh5r_v2.py | 10 +- chirp/drivers/tdh8.py | 2059 ++ chirp/drivers/tdxone_tdq8a.py | 39 +- chirp/drivers/template.py | 15 +- chirp/drivers/tg_uv2p.py | 87 +- chirp/drivers/th350.py | 1 - chirp/drivers/th7800.py | 47 +- chirp/drivers/th9000.py | 96 +- chirp/drivers/th9800.py | 55 +- chirp/drivers/th_uv3r.py | 9 +- chirp/drivers/th_uv3r25.py | 11 +- chirp/drivers/th_uv8000.py | 94 +- chirp/drivers/th_uv88.py | 107 +- chirp/drivers/th_uvf8d.py | 50 +- chirp/drivers/thd72.py | 130 +- chirp/drivers/thd74.py | 526 + chirp/drivers/thuv1f.py | 35 +- chirp/drivers/tk270.py | 124 +- chirp/drivers/tk3140.py | 687 + chirp/drivers/tk760.py | 208 +- chirp/drivers/tk760g.py | 448 +- chirp/drivers/tk8102.py | 91 +- chirp/drivers/tk8160.py | 669 + chirp/drivers/tk8180.py | 39 +- chirp/drivers/tmd710.py | 62 +- chirp/drivers/tmv71_ll.py | 3 +- chirp/drivers/ts2000.py | 9 + chirp/drivers/ts480.py | 69 +- chirp/drivers/ts590.py | 69 +- chirp/drivers/ts850.py | 4 +- chirp/drivers/uv5r.py | 443 +- chirp/drivers/uv5x3.py | 51 +- chirp/drivers/uv6r.py | 53 +- chirp/drivers/uvb5.py | 44 +- chirp/drivers/uvk5.py | 2058 ++ chirp/drivers/vgc.py | 109 +- chirp/drivers/vx170.py | 38 +- chirp/drivers/vx2.py | 13 +- chirp/drivers/vx3.py | 40 +- chirp/drivers/vx5.py | 34 +- chirp/drivers/vx510.py | 5 +- chirp/drivers/vx6.py | 89 +- chirp/drivers/vx7.py | 36 +- chirp/drivers/vx8.py | 47 +- chirp/drivers/vxa700.py | 3 +- chirp/drivers/wouxun.py | 107 +- chirp/drivers/wouxun_common.py | 21 +- chirp/drivers/yaesu_clone.py | 24 +- chirp/elib_intl.py | 520 - chirp/import_logic.py | 80 +- chirp/locale/de/LC_MESSAGES/CHIRP.mo | Bin 0 -> 1540 bytes chirp/locale/el/LC_MESSAGES/CHIRP.mo | Bin 0 -> 14527 bytes chirp/locale/en_US/LC_MESSAGES/CHIRP.mo | Bin 0 -> 423 bytes chirp/locale/es/LC_MESSAGES/CHIRP.mo | Bin 0 -> 67328 bytes chirp/locale/fr/LC_MESSAGES/CHIRP.mo | Bin 0 -> 1442 bytes chirp/locale/hu/LC_MESSAGES/CHIRP.mo | Bin 0 -> 1567 bytes chirp/locale/it/LC_MESSAGES/CHIRP.mo | Bin 0 -> 1399 bytes chirp/locale/nl/LC_MESSAGES/CHIRP.mo | Bin 0 -> 1382 bytes chirp/locale/pl/LC_MESSAGES/CHIRP.mo | Bin 0 -> 23520 bytes chirp/locale/pt_BR/LC_MESSAGES/CHIRP.mo | Bin 0 -> 1364 bytes chirp/locale/ru/LC_MESSAGES/CHIRP.mo | Bin 0 -> 89179 bytes chirp/locale/tr_TR/LC_MESSAGES/CHIRP.mo | Bin 0 -> 59122 bytes chirp/locale/uk_UA/LC_MESSAGES/CHIRP.mo | Bin 0 -> 1207 bytes chirp/locale/zh_CN/LC_MESSAGES/CHIRP.mo | Bin 0 -> 1538 bytes chirp/logger.py | 7 +- chirp/memmap.py | 4 +- chirp/platform.py | 253 +- chirp/pyPEG.py | 36 +- chirp/radioreference.py | 224 - chirp/settings.py | 59 +- chirp/share/chirp.desktop | 13 + chirp/share/chirp.ico | Bin 0 -> 119911 bytes chirp/share/chirp.png | Bin 0 -> 9687 bytes chirp/share/chirp.svg | 224 + chirp/share/chirpw.1 | 46 + chirp/share/plus-icon.png | Bin 0 -> 9552 bytes chirp/share/welcome_screen.png | Bin 0 -> 25877 bytes chirp/sources/__init__.py | 0 chirp/sources/base.py | 61 + chirp/sources/dmrmarc.py | 118 + chirp/sources/przemienniki.py | 71 + chirp/sources/radioreference.py | 263 + chirp/sources/repeaterbook.py | 393 + chirp/stock_configs/AU NZ UHF Citizens Band.csv | 82 + chirp/stock_configs/DE Freenet Frequencies.csv | 7 + chirp/stock_configs/EU LPD and PMR Channels.csv | 86 + chirp/stock_configs/FR Marine VHF Channels.csv | 58 + .../PL Calling Frequencies and Simplex.csv | 51 + chirp/stock_configs/SE Jaktradio 155MHz.csv | 8 + chirp/stock_configs/SE NO KDR444.csv | 9 + .../UK Business Radio Simple Light Frequencies.csv | 16 + .../US 60 meter channels (Center).csv | 6 + .../stock_configs/US 60 meter channels (Dial).csv | 6 + chirp/stock_configs/US CA Railroad Channels.csv | 187 + chirp/stock_configs/US Calling Frequencies.csv | 5 + chirp/stock_configs/US FRS and GMRS Channels.csv | 53 + chirp/stock_configs/US MURS Channels.csv | 6 + chirp/stock_configs/US Marine VHF Channels.csv | 61 + chirp/stock_configs/US NOAA Weather Alert.csv | 11 + chirp/ui/__init__.py | 14 - chirp/ui/bandplans.py | 51 - chirp/ui/bankedit.py | 419 - chirp/ui/clone.py | 277 - chirp/ui/cloneprog.py | 66 - chirp/ui/common.py | 451 - chirp/ui/compat.py | 82 - chirp/ui/config.py | 131 - chirp/ui/dstaredit.py | 202 - chirp/ui/editorset.py | 419 - chirp/ui/fips.py | 6605 ------ chirp/ui/importdialog.py | 655 - chirp/ui/inputdialog.py | 160 - chirp/ui/mainapp.py | 2379 --- chirp/ui/memdetail.py | 449 - chirp/ui/memedit.py | 1757 -- chirp/ui/miscwidgets.py | 883 - chirp/ui/radiobrowser.py | 350 - chirp/ui/reporting.py | 195 - chirp/ui/settingsedit.py | 233 - chirp/ui/shiftdialog.py | 162 - chirp/util.py | 73 +- chirp/wxui/__init__.py | 214 + chirp/wxui/__main__.py | 6 + chirp/wxui/bankedit.py | 305 + chirp/wxui/clone.py | 357 +- chirp/wxui/common.py | 306 +- chirp/wxui/config.py | 174 + chirp/wxui/developer.py | 381 +- chirp/wxui/fips.py | 6620 ++++++ chirp/wxui/main.py | 1339 +- chirp/wxui/memedit.py | 1993 +- chirp/wxui/printing.py | 117 + chirp/wxui/query_sources.py | 890 +- chirp/wxui/radioinfo.py | 104 + chirp/wxui/radiothread.py | 29 +- chirp/wxui/report.py | 118 + chirp/wxui/settingsedit.py | 97 +- chirpc | 403 - chirpw | 170 - chirpwx.py | 64 - locale/Makefile | 28 - locale/check_parameters.py | 31 - locale/de.po | 1081 - locale/en_US.po | 955 - locale/es_ES.po | 1335 -- locale/fr.po | 944 - locale/hu.po | 1216 -- locale/it.po | 944 - locale/nl.po | 945 - locale/pl.po | 987 - locale/pt_BR.po | 897 - locale/ru.po | 907 - locale/tr_TR.po | 2220 -- locale/uk_UA.po | 917 - locale/zh_CN.po | 1275 -- pylintrc | 249 - requirements.txt | 7 +- rpttool | 148 - run_all_tests.bat | 3 - setup.cfg | 5 + setup.py | 189 +- share/chirp.desktop | 13 - share/chirp.icns | Bin 80528 -> 0 bytes share/chirp.ico | Bin 119911 -> 0 bytes share/chirp.png | Bin 9687 -> 0 bytes share/chirp.svg | 224 - share/chirpw.1 | 46 - share/contrib/chirp.rnc | 28 - share/contrib/chirp.rng | 58 - share/contrib/chirp_banks.rnc | 3 - share/contrib/chirp_banks.rng | 11 - share/contrib/chirp_memory.rnc | 64 - share/contrib/chirp_memory.rng | 193 - share/make_supported.py | 179 - snap/snapcraft.yaml | 118 - stock_configs/DE Freenet Frequencies.csv | 7 - stock_configs/EU LPD and PMR Channels.csv | 86 - stock_configs/FR Marine VHF Channels.csv | 58 - stock_configs/KDR444.csv | 9 - stock_configs/NOAA Weather Alert.csv | 11 - stock_configs/SE Jaktradio 155MHz.csv | 8 - .../UK Business Radio Simple Light Frequencies.csv | 16 - stock_configs/US 60 meter channels (Center).csv | 6 - stock_configs/US 60 meter channels (Dial).csv | 6 - stock_configs/US CA Railroad Channels.csv | 187 - stock_configs/US Calling Frequencies.csv | 5 - stock_configs/US FRS and GMRS Channels.csv | 53 - stock_configs/US MURS Channels.csv | 6 - stock_configs/US Marine VHF Channels.csv | 61 - test-requirements.txt | 8 +- tests/Python3_Driver_Testing.md | 815 +- tests/__init__.py | 221 +- tests/__pycache__/__init__.cpython-310.pyc | Bin 0 -> 3240 bytes tests/__pycache__/base.cpython-310.pyc | Bin 0 -> 4347 bytes .../icom_clone_simulator.cpython-310.pyc | Bin 0 -> 5436 bytes .../test_banks.cpython-310-pytest-7.1.3.pyc | Bin 0 -> 3723 bytes .../test_brute_force.cpython-310-pytest-7.1.3.pyc | Bin 0 -> 5083 bytes .../test_clone.cpython-310-pytest-7.1.3.pyc | Bin 0 -> 4646 bytes .../test_copy_all.cpython-310-pytest-7.1.3.pyc | Bin 0 -> 1715 bytes .../test_detect.cpython-310-pytest-7.1.3.pyc | Bin 0 -> 1952 bytes .../test_drivers.cpython-310-pytest-7.1.3.pyc | Bin 0 -> 1290 bytes .../test_edges.cpython-310-pytest-7.1.3.pyc | Bin 0 -> 5762 bytes .../test_features.cpython-310-pytest-7.1.3.pyc | Bin 0 -> 1065 bytes .../test_settings.cpython-310-pytest-7.1.3.pyc | Bin 0 -> 1635 bytes tests/base.py | 193 + tests/icom_clone_simulator.py | 59 +- tests/images/Abbree_AR-730.img | Bin 0 -> 46353 bytes tests/images/Abbree_AR-F5.img | Bin 0 -> 7413 bytes tests/images/Alinco_DJ-G7EG.img | Bin 108480 -> 108645 bytes tests/images/Anysecu_UV-A37.img | Bin 0 -> 46333 bytes tests/images/BTECH_GMRS-50V2.img | Bin 0 -> 16561 bytes tests/images/BTECH_MURS-V2.img | Bin 0 -> 8361 bytes tests/images/BTECH_UV-25X2_G2.img | Bin 0 -> 16565 bytes tests/images/BTECH_UV-25X4_G2.img | Bin 0 -> 16565 bytes tests/images/BTECH_UV-50X2_G2.img | Bin 0 -> 16545 bytes tests/images/Baofeng_BF-1904.img | Bin 0 -> 1181 bytes tests/images/Baofeng_UV-9G.img | Bin 0 -> 8365 bytes tests/images/Baofeng_UV-S9X3.img | Bin 0 -> 8385 bytes tests/images/Baofeng_W31E.img | Bin 0 -> 689 bytes tests/images/CRT_Micron_UV.img | Bin 13121 -> 13125 bytes tests/images/Hiroyasu_HI-8811.img | Bin 0 -> 46017 bytes tests/images/Icom_IC-2820H.img | Bin 44224 -> 44389 bytes tests/images/Icom_IC-E90.img | Bin 0 -> 11757 bytes tests/images/Icom_IC-U82.img | Bin 0 -> 6464 bytes tests/images/Icom_IC-V80.img | Bin 0 -> 3885 bytes tests/images/Icom_IC-V82.img | Bin 0 -> 6617 bytes tests/images/Icom_IC-V82_U82.img | Bin 6464 -> 0 bytes tests/images/Icom_IC-V86.img | Bin 0 -> 5677 bytes tests/images/Icom_ID-4100.img | Bin 0 -> 172992 bytes tests/images/Icom_ID-5100.img | Bin 0 -> 173085 bytes tests/images/Icom_ID-51_Plus2.img | Bin 0 -> 130021 bytes tests/images/Icom_ID-80H.img | Bin 0 -> 63149 bytes tests/images/Kenwood_TH-D74_clone_mode.img | Bin 0 -> 500653 bytes tests/images/Kenwood_TK-3140K.img | Bin 0 -> 33065 bytes tests/images/Kenwood_TK-7160K.img | Bin 0 -> 16629 bytes tests/images/Midland_DBR2500.img | Bin 13121 -> 13125 bytes tests/images/Q-MAC_HF-90_v300_or_earlier.img | Bin 0 -> 8393 bytes tests/images/Q-MAC_HF-90_v301_or_later.img | Bin 0 -> 8389 bytes tests/images/Quansheng_UV-K5.img | Bin 0 -> 8361 bytes tests/images/Radioddity_GS-5B.img | Bin 0 -> 7433 bytes tests/images/Radtel_RT-470.img | Bin 0 -> 46009 bytes tests/images/Radtel_RT-470L.img | Bin 0 -> 46013 bytes tests/images/Radtel_RT-470X.img | Bin 0 -> 46013 bytes tests/images/Retevis_H777S.img | Bin 0 -> 1165 bytes tests/images/Retevis_RA685.img | Bin 0 -> 7409 bytes tests/images/Retevis_RB17A.img | Bin 933 -> 933 bytes tests/images/Retevis_RB26.img | Bin 965 -> 965 bytes tests/images/Retevis_RB28.img | Bin 0 -> 537 bytes tests/images/Retevis_RB28B.img | Bin 0 -> 689 bytes tests/images/Retevis_RB29.img | Bin 0 -> 1169 bytes tests/images/Retevis_RB628.img | Bin 0 -> 537 bytes tests/images/Retevis_RB628B.img | Bin 0 -> 693 bytes tests/images/Retevis_RB629.img | Bin 0 -> 1173 bytes tests/images/Retevis_RB87.img | Bin 0 -> 1181 bytes tests/images/Retevis_RT15.img | Bin 0 -> 1181 bytes tests/images/Retevis_RT20.img | Bin 0 -> 1193 bytes tests/images/Retevis_RT24.img | Bin 0 -> 1161 bytes tests/images/Retevis_RT24V.img | Bin 0 -> 1197 bytes tests/images/Retevis_RT76.img | Bin 645 -> 645 bytes tests/images/Retevis_RT86.img | Bin 0 -> 589 bytes tests/images/Retevis_RT95.img | Bin 13121 -> 13121 bytes tests/images/Ruyage_UV58Plus.img | Bin 0 -> 41161 bytes tests/images/SenhaiX_8800.img | Bin 0 -> 7329 bytes tests/images/TIDRADIO_TD-H8-GMRS.img | Bin 0 -> 8129 bytes tests/images/TIDRADIO_TD-H8-HAM.img | Bin 0 -> 8125 bytes tests/images/TIDRADIO_TD-H8.img | Bin 0 -> 8113 bytes tests/images/TYT_TH-UVF8D.img | Bin 0 -> 16585 bytes tests/images/Talkpod_A36plus.img | Bin 0 -> 46337 bytes tests/images/Wouxun_KG-1000G.img | Bin 0 -> 32961 bytes tests/images/Wouxun_KG-1000G_Plus.img | Bin 0 -> 32973 bytes tests/images/Wouxun_KG-935G_Plus.img | Bin 0 -> 32969 bytes tests/images/Wouxun_KG-UV8E.img | Bin 32768 -> 32949 bytes tests/images/Wouxun_KG-UV8H.img | Bin 0 -> 32949 bytes tests/images/Wouxun_KG-UV980P.img | Bin 0 -> 32969 bytes tests/images/Wouxun_KG-UV9GX.img | Bin 0 -> 33033 bytes tests/images/Wouxun_KG-UV9G_Pro.img | Bin 0 -> 32957 bytes tests/images/Wouxun_KG-UV9K.img | Bin 0 -> 33005 bytes tests/images/Wouxun_KG-UV9PX.img | Bin 0 -> 32937 bytes tests/images/Yaesu_FT-4XE.img | Bin 8697 -> 8689 bytes tests/images/Yaesu_FT-65E.img | Bin 8697 -> 8689 bytes tests/images/Yaesu_FT-90.img | Bin 0 -> 4244 bytes tests/model_stats.tsv | 515 + tests/py3_driver_testers.txt | 341 +- tests/py3_remaining.txt | 17 - tests/run_tests | 3 - tests/run_tests.py | 1377 -- tests/test_banks.py | 114 + tests/test_brute_force.py | 194 + tests/test_clone.py | 103 + tests/test_copy_all.py | 52 + tests/test_detect.py | 42 + tests/test_drivers.py | 7 +- tests/test_edges.py | 156 + tests/test_features.py | 14 + tests/test_settings.py | 36 + tests/unit/__pycache__/__init__.cpython-310.pyc | Bin 0 -> 168 bytes tests/unit/__pycache__/base.cpython-310.pyc | Bin 0 -> 962 bytes .../test_alinco_clone.cpython-310-pytest-7.1.3.pyc | Bin 0 -> 4993 bytes .../test_bandplan.cpython-310-pytest-7.1.3.pyc | Bin 0 -> 1752 bytes ...st_baofeng_fmradio.cpython-310-pytest-7.1.3.pyc | Bin 0 -> 4510 bytes .../test_bitwise.cpython-310-pytest-7.1.3.pyc | Bin 0 -> 13541 bytes .../test_chirp_common.cpython-310-pytest-7.1.3.pyc | Bin 0 -> 28607 bytes .../test_cli.cpython-310-pytest-7.1.3.pyc | Bin 0 -> 1700 bytes .../test_csv.cpython-310-pytest-7.1.3.pyc | Bin 0 -> 6717 bytes .../test_directory.cpython-310-pytest-7.1.3.pyc | Bin 0 -> 5474 bytes .../test_icf.cpython-310-pytest-7.1.3.pyc | Bin 0 -> 5394 bytes .../test_icom_clone.cpython-310-pytest-7.1.3.pyc | Bin 0 -> 4367 bytes .../test_import_logic.cpython-310-pytest-7.1.3.pyc | Bin 0 -> 14279 bytes .../test_kguv8d.cpython-310-pytest-7.1.3.pyc | Bin 0 -> 3556 bytes .../test_kguv920.cpython-310-pytest-7.1.3.pyc | Bin 0 -> 2527 bytes .../test_mappingmodel.cpython-310-pytest-7.1.3.pyc | Bin 0 -> 11857 bytes ...st_network_sources.cpython-310-pytest-7.1.3.pyc | Bin 0 -> 1030 bytes .../test_repeaterbook.cpython-310-pytest-7.1.3.pyc | Bin 0 -> 7727 bytes .../test_settings.cpython-310-pytest-7.1.3.pyc | Bin 0 -> 7332 bytes .../test_th9800.cpython-310-pytest-7.1.3.pyc | Bin 0 -> 3100 bytes .../test_util.cpython-310-pytest-7.1.3.pyc | Bin 0 -> 1360 bytes ...t_wxui_radiothread.cpython-310-pytest-7.1.3.pyc | Bin 0 -> 3082 bytes .../test_yaesu_clone.cpython-310-pytest-7.1.3.pyc | Bin 0 -> 7324 bytes tests/unit/base.py | 54 +- tests/unit/rb-united_states-oregon.json | 20795 +++++++++++++++++++ tests/unit/test_alinco_clone.py | 152 + tests/unit/test_bandplan.py | 33 + tests/unit/test_baofeng_fmradio.py | 165 + tests/unit/test_bitwise.py | 9 - tests/unit/test_chirp_common.py | 490 +- tests/unit/test_cli.py | 42 + tests/unit/test_csv.py | 170 + tests/unit/test_directory.py | 77 +- tests/unit/test_icf.py | 161 + tests/unit/test_icom_clone.py | 19 +- tests/unit/test_import_logic.py | 210 +- tests/unit/test_kguv8d.py | 82 + tests/unit/test_kguv920.py | 65 + tests/unit/test_mappingmodel.py | 95 +- tests/unit/test_memedit_edits.py | 74 - tests/unit/test_network_sources.py | 28 + tests/unit/test_platform.py | 62 - tests/unit/test_repeaterbook.py | 271 +- tests/unit/test_settings.py | 9 + tests/unit/test_shiftdialog.py | 105 - tests/unit/test_th9800.py | 55 + tests/unit/test_util.py | 19 + tests/unit/test_utils.py | 21 - tests/unit/test_wxui_radiothread.py | 12 +- tests/unit/test_yaesu_clone.py | 141 + tools/Makefile | 1 - tools/bitdiff.py | 166 - tools/check_commit.sh | 93 + tools/cpep8.blacklist | 18 + tools/cpep8.manifest | 144 +- tools/cpep8.py | 82 +- tools/fast-driver.py | 104 + tools/icomsio.sh | 1 - tools/img2thd72.py | 127 - tools/py3_driver_progress.py | 164 +- tools/serialsniff.c | 2 +- tox.ini | 81 - 511 files changed, 73171 insertions(+), 52067 deletions(-) delete mode 100644 .github/actions/py2-tox/action.yaml delete mode 100644 .github/actions/py3-tox/action.yaml delete mode 100644 .github/workflows/py2-test.yaml delete mode 100644 .github/workflows/py3-pr.yaml delete mode 100644 .github/workflows/py3-test.yaml delete mode 100644 .github/workflows/test-py3-merge.yaml delete mode 100644 .hgignore delete mode 100644 .hgtags delete mode 100644 .pylintrc delete mode 100644 INSTALL create mode 100644 PKG-INFO delete mode 100644 README.chirpc delete mode 100644 README.developers delete mode 100644 README.rpttool delete mode 100644 build/chirp.app/Contents/Info.plist delete mode 100755 build/chirp.app/Contents/MacOS/chirp delete mode 100644 build/chirp.app/Contents/PkgInfo delete mode 100644 build/chirp.app/Contents/Resources/.placeholder delete mode 100644 build/macos/make_pango.sh delete mode 100755 build/make_source_release.sh delete mode 100644 build/version create mode 100644 chirp.egg-info/PKG-INFO create mode 100644 chirp.egg-info/SOURCES.txt create mode 100644 chirp.egg-info/dependency_links.txt create mode 100644 chirp.egg-info/entry_points.txt create mode 100644 chirp.egg-info/requires.txt create mode 100644 chirp.egg-info/top_level.txt create mode 100644 chirp/cli/__init__.py create mode 100644 chirp/cli/main.py delete mode 100644 chirp/dmrmarc.py delete mode 100644 chirp/drivers/bf-t1.py delete mode 100644 chirp/drivers/bf-t8.py create mode 100644 chirp/drivers/bf_t1.py create mode 100644 chirp/drivers/bf_t8.py create mode 100644 chirp/drivers/hf90.py create mode 100644 chirp/drivers/icv80.py delete mode 100644 chirp/drivers/icx8x_ll.py create mode 100644 chirp/drivers/id5100.py delete mode 100644 chirp/drivers/iradio_uv-5118.py create mode 100644 chirp/drivers/iradio_uv_5118.py create mode 100644 chirp/drivers/iradio_uv_5118plus.py create mode 100644 chirp/drivers/kenwood_d7.py create mode 100644 chirp/drivers/kguv980p.py create mode 100644 chirp/drivers/mml_jc8810.py delete mode 100644 chirp/drivers/repeaterbook.py create mode 100644 chirp/drivers/retevis_rb28.py delete mode 100644 chirp/drivers/rfinder.py create mode 100644 chirp/drivers/tdh8.py create mode 100644 chirp/drivers/thd74.py create mode 100644 chirp/drivers/tk3140.py create mode 100644 chirp/drivers/tk8160.py create mode 100644 chirp/drivers/uvk5.py delete mode 100644 chirp/elib_intl.py create mode 100644 chirp/locale/de/LC_MESSAGES/CHIRP.mo create mode 100644 chirp/locale/el/LC_MESSAGES/CHIRP.mo create mode 100644 chirp/locale/en_US/LC_MESSAGES/CHIRP.mo create mode 100644 chirp/locale/es/LC_MESSAGES/CHIRP.mo create mode 100644 chirp/locale/fr/LC_MESSAGES/CHIRP.mo create mode 100644 chirp/locale/hu/LC_MESSAGES/CHIRP.mo create mode 100644 chirp/locale/it/LC_MESSAGES/CHIRP.mo create mode 100644 chirp/locale/nl/LC_MESSAGES/CHIRP.mo create mode 100644 chirp/locale/pl/LC_MESSAGES/CHIRP.mo create mode 100644 chirp/locale/pt_BR/LC_MESSAGES/CHIRP.mo create mode 100644 chirp/locale/ru/LC_MESSAGES/CHIRP.mo create mode 100644 chirp/locale/tr_TR/LC_MESSAGES/CHIRP.mo create mode 100644 chirp/locale/uk_UA/LC_MESSAGES/CHIRP.mo create mode 100644 chirp/locale/zh_CN/LC_MESSAGES/CHIRP.mo delete mode 100644 chirp/radioreference.py create mode 100644 chirp/share/chirp.desktop create mode 100755 chirp/share/chirp.ico create mode 100644 chirp/share/chirp.png create mode 100644 chirp/share/chirp.svg create mode 100644 chirp/share/chirpw.1 create mode 100644 chirp/share/plus-icon.png create mode 100644 chirp/share/welcome_screen.png create mode 100644 chirp/sources/__init__.py create mode 100644 chirp/sources/base.py create mode 100644 chirp/sources/dmrmarc.py create mode 100644 chirp/sources/przemienniki.py create mode 100644 chirp/sources/radioreference.py create mode 100644 chirp/sources/repeaterbook.py create mode 100644 chirp/stock_configs/AU NZ UHF Citizens Band.csv create mode 100644 chirp/stock_configs/DE Freenet Frequencies.csv create mode 100644 chirp/stock_configs/EU LPD and PMR Channels.csv create mode 100644 chirp/stock_configs/FR Marine VHF Channels.csv create mode 100644 chirp/stock_configs/PL Calling Frequencies and Simplex.csv create mode 100644 chirp/stock_configs/SE Jaktradio 155MHz.csv create mode 100644 chirp/stock_configs/SE NO KDR444.csv create mode 100644 chirp/stock_configs/UK Business Radio Simple Light Frequencies.csv create mode 100644 chirp/stock_configs/US 60 meter channels (Center).csv create mode 100644 chirp/stock_configs/US 60 meter channels (Dial).csv create mode 100644 chirp/stock_configs/US CA Railroad Channels.csv create mode 100644 chirp/stock_configs/US Calling Frequencies.csv create mode 100644 chirp/stock_configs/US FRS and GMRS Channels.csv create mode 100644 chirp/stock_configs/US MURS Channels.csv create mode 100644 chirp/stock_configs/US Marine VHF Channels.csv create mode 100644 chirp/stock_configs/US NOAA Weather Alert.csv delete mode 100644 chirp/ui/__init__.py delete mode 100644 chirp/ui/bandplans.py delete mode 100644 chirp/ui/bankedit.py delete mode 100644 chirp/ui/clone.py delete mode 100644 chirp/ui/cloneprog.py delete mode 100644 chirp/ui/common.py delete mode 100644 chirp/ui/compat.py delete mode 100644 chirp/ui/config.py delete mode 100644 chirp/ui/dstaredit.py delete mode 100644 chirp/ui/editorset.py delete mode 100644 chirp/ui/fips.py delete mode 100644 chirp/ui/importdialog.py delete mode 100644 chirp/ui/inputdialog.py delete mode 100644 chirp/ui/mainapp.py delete mode 100644 chirp/ui/memdetail.py delete mode 100644 chirp/ui/memedit.py delete mode 100644 chirp/ui/miscwidgets.py delete mode 100644 chirp/ui/radiobrowser.py delete mode 100644 chirp/ui/reporting.py delete mode 100644 chirp/ui/settingsedit.py delete mode 100644 chirp/ui/shiftdialog.py create mode 100755 chirp/wxui/__main__.py create mode 100644 chirp/wxui/bankedit.py create mode 100644 chirp/wxui/config.py create mode 100644 chirp/wxui/fips.py create mode 100644 chirp/wxui/printing.py create mode 100644 chirp/wxui/radioinfo.py create mode 100644 chirp/wxui/report.py delete mode 100644 chirpc delete mode 100755 chirpw delete mode 100755 chirpwx.py delete mode 100644 locale/Makefile delete mode 100755 locale/check_parameters.py delete mode 100644 locale/de.po delete mode 100644 locale/en_US.po delete mode 100644 locale/es_ES.po delete mode 100644 locale/fr.po delete mode 100644 locale/hu.po delete mode 100644 locale/it.po delete mode 100644 locale/nl.po delete mode 100644 locale/pl.po delete mode 100644 locale/pt_BR.po delete mode 100644 locale/ru.po delete mode 100644 locale/tr_TR.po delete mode 100644 locale/uk_UA.po delete mode 100644 locale/zh_CN.po delete mode 100644 pylintrc delete mode 100755 rpttool delete mode 100644 run_all_tests.bat delete mode 100644 share/chirp.desktop delete mode 100644 share/chirp.icns delete mode 100755 share/chirp.ico delete mode 100644 share/chirp.png delete mode 100644 share/chirp.svg delete mode 100644 share/chirpw.1 delete mode 100644 share/contrib/chirp.rnc delete mode 100644 share/contrib/chirp.rng delete mode 100644 share/contrib/chirp_banks.rnc delete mode 100644 share/contrib/chirp_banks.rng delete mode 100644 share/contrib/chirp_memory.rnc delete mode 100644 share/contrib/chirp_memory.rng delete mode 100755 share/make_supported.py delete mode 100644 snap/snapcraft.yaml delete mode 100644 stock_configs/DE Freenet Frequencies.csv delete mode 100644 stock_configs/EU LPD and PMR Channels.csv delete mode 100644 stock_configs/FR Marine VHF Channels.csv delete mode 100644 stock_configs/KDR444.csv delete mode 100644 stock_configs/NOAA Weather Alert.csv delete mode 100644 stock_configs/SE Jaktradio 155MHz.csv delete mode 100644 stock_configs/UK Business Radio Simple Light Frequencies.csv delete mode 100644 stock_configs/US 60 meter channels (Center).csv delete mode 100644 stock_configs/US 60 meter channels (Dial).csv delete mode 100644 stock_configs/US CA Railroad Channels.csv delete mode 100644 stock_configs/US Calling Frequencies.csv delete mode 100644 stock_configs/US FRS and GMRS Channels.csv delete mode 100644 stock_configs/US MURS Channels.csv delete mode 100644 stock_configs/US Marine VHF Channels.csv create mode 100644 tests/__pycache__/__init__.cpython-310.pyc create mode 100644 tests/__pycache__/base.cpython-310.pyc create mode 100644 tests/__pycache__/icom_clone_simulator.cpython-310.pyc create mode 100644 tests/__pycache__/test_banks.cpython-310-pytest-7.1.3.pyc create mode 100644 tests/__pycache__/test_brute_force.cpython-310-pytest-7.1.3.pyc create mode 100644 tests/__pycache__/test_clone.cpython-310-pytest-7.1.3.pyc create mode 100644 tests/__pycache__/test_copy_all.cpython-310-pytest-7.1.3.pyc create mode 100644 tests/__pycache__/test_detect.cpython-310-pytest-7.1.3.pyc create mode 100644 tests/__pycache__/test_drivers.cpython-310-pytest-7.1.3.pyc create mode 100644 tests/__pycache__/test_edges.cpython-310-pytest-7.1.3.pyc create mode 100644 tests/__pycache__/test_features.cpython-310-pytest-7.1.3.pyc create mode 100644 tests/__pycache__/test_settings.cpython-310-pytest-7.1.3.pyc create mode 100644 tests/base.py create mode 100644 tests/images/Abbree_AR-730.img create mode 100644 tests/images/Abbree_AR-F5.img create mode 100644 tests/images/Anysecu_UV-A37.img create mode 100644 tests/images/BTECH_GMRS-50V2.img create mode 100644 tests/images/BTECH_MURS-V2.img create mode 100644 tests/images/BTECH_UV-25X2_G2.img create mode 100644 tests/images/BTECH_UV-25X4_G2.img create mode 100644 tests/images/BTECH_UV-50X2_G2.img create mode 100644 tests/images/Baofeng_BF-1904.img create mode 100644 tests/images/Baofeng_UV-9G.img create mode 100644 tests/images/Baofeng_UV-S9X3.img create mode 100644 tests/images/Baofeng_W31E.img create mode 100644 tests/images/Hiroyasu_HI-8811.img create mode 100644 tests/images/Icom_IC-E90.img create mode 100644 tests/images/Icom_IC-U82.img create mode 100755 tests/images/Icom_IC-V80.img create mode 100644 tests/images/Icom_IC-V82.img delete mode 100644 tests/images/Icom_IC-V82_U82.img create mode 100644 tests/images/Icom_IC-V86.img create mode 100644 tests/images/Icom_ID-4100.img create mode 100644 tests/images/Icom_ID-5100.img create mode 100644 tests/images/Icom_ID-51_Plus2.img create mode 100755 tests/images/Icom_ID-80H.img create mode 100755 tests/images/Kenwood_TH-D74_clone_mode.img create mode 100644 tests/images/Kenwood_TK-3140K.img create mode 100644 tests/images/Kenwood_TK-7160K.img create mode 100644 tests/images/Q-MAC_HF-90_v300_or_earlier.img create mode 100644 tests/images/Q-MAC_HF-90_v301_or_later.img create mode 100644 tests/images/Quansheng_UV-K5.img create mode 100644 tests/images/Radioddity_GS-5B.img create mode 100644 tests/images/Radtel_RT-470.img create mode 100644 tests/images/Radtel_RT-470L.img create mode 100644 tests/images/Radtel_RT-470X.img create mode 100644 tests/images/Retevis_H777S.img create mode 100644 tests/images/Retevis_RA685.img create mode 100644 tests/images/Retevis_RB28.img create mode 100644 tests/images/Retevis_RB28B.img create mode 100644 tests/images/Retevis_RB29.img create mode 100644 tests/images/Retevis_RB628.img create mode 100644 tests/images/Retevis_RB628B.img create mode 100644 tests/images/Retevis_RB629.img create mode 100644 tests/images/Retevis_RB87.img create mode 100644 tests/images/Retevis_RT15.img create mode 100644 tests/images/Retevis_RT20.img create mode 100644 tests/images/Retevis_RT24.img create mode 100644 tests/images/Retevis_RT24V.img create mode 100644 tests/images/Retevis_RT86.img create mode 100644 tests/images/Ruyage_UV58Plus.img create mode 100644 tests/images/SenhaiX_8800.img create mode 100644 tests/images/TIDRADIO_TD-H8-GMRS.img create mode 100644 tests/images/TIDRADIO_TD-H8-HAM.img create mode 100644 tests/images/TIDRADIO_TD-H8.img create mode 100644 tests/images/TYT_TH-UVF8D.img create mode 100644 tests/images/Talkpod_A36plus.img create mode 100644 tests/images/Wouxun_KG-1000G.img create mode 100644 tests/images/Wouxun_KG-1000G_Plus.img create mode 100644 tests/images/Wouxun_KG-935G_Plus.img create mode 100644 tests/images/Wouxun_KG-UV8H.img create mode 100644 tests/images/Wouxun_KG-UV980P.img create mode 100644 tests/images/Wouxun_KG-UV9GX.img create mode 100644 tests/images/Wouxun_KG-UV9G_Pro.img create mode 100644 tests/images/Wouxun_KG-UV9K.img create mode 100644 tests/images/Wouxun_KG-UV9PX.img create mode 100644 tests/images/Yaesu_FT-90.img create mode 100644 tests/model_stats.tsv delete mode 100644 tests/py3_remaining.txt delete mode 100755 tests/run_tests delete mode 100644 tests/run_tests.py create mode 100644 tests/test_banks.py create mode 100644 tests/test_brute_force.py create mode 100644 tests/test_clone.py create mode 100644 tests/test_copy_all.py create mode 100644 tests/test_detect.py create mode 100644 tests/test_edges.py create mode 100644 tests/test_features.py create mode 100644 tests/test_settings.py create mode 100644 tests/unit/__pycache__/__init__.cpython-310.pyc create mode 100644 tests/unit/__pycache__/base.cpython-310.pyc create mode 100644 tests/unit/__pycache__/test_alinco_clone.cpython-310-pytest-7.1.3.pyc create mode 100644 tests/unit/__pycache__/test_bandplan.cpython-310-pytest-7.1.3.pyc create mode 100644 tests/unit/__pycache__/test_baofeng_fmradio.cpython-310-pytest-7.1.3.pyc create mode 100644 tests/unit/__pycache__/test_bitwise.cpython-310-pytest-7.1.3.pyc create mode 100644 tests/unit/__pycache__/test_chirp_common.cpython-310-pytest-7.1.3.pyc create mode 100644 tests/unit/__pycache__/test_cli.cpython-310-pytest-7.1.3.pyc create mode 100644 tests/unit/__pycache__/test_csv.cpython-310-pytest-7.1.3.pyc create mode 100644 tests/unit/__pycache__/test_directory.cpython-310-pytest-7.1.3.pyc create mode 100644 tests/unit/__pycache__/test_icf.cpython-310-pytest-7.1.3.pyc create mode 100644 tests/unit/__pycache__/test_icom_clone.cpython-310-pytest-7.1.3.pyc create mode 100644 tests/unit/__pycache__/test_import_logic.cpython-310-pytest-7.1.3.pyc create mode 100644 tests/unit/__pycache__/test_kguv8d.cpython-310-pytest-7.1.3.pyc create mode 100644 tests/unit/__pycache__/test_kguv920.cpython-310-pytest-7.1.3.pyc create mode 100644 tests/unit/__pycache__/test_mappingmodel.cpython-310-pytest-7.1.3.pyc create mode 100644 tests/unit/__pycache__/test_network_sources.cpython-310-pytest-7.1.3.pyc create mode 100644 tests/unit/__pycache__/test_repeaterbook.cpython-310-pytest-7.1.3.pyc create mode 100644 tests/unit/__pycache__/test_settings.cpython-310-pytest-7.1.3.pyc create mode 100644 tests/unit/__pycache__/test_th9800.cpython-310-pytest-7.1.3.pyc create mode 100644 tests/unit/__pycache__/test_util.cpython-310-pytest-7.1.3.pyc create mode 100644 tests/unit/__pycache__/test_wxui_radiothread.cpython-310-pytest-7.1.3.pyc create mode 100644 tests/unit/__pycache__/test_yaesu_clone.cpython-310-pytest-7.1.3.pyc create mode 100644 tests/unit/rb-united_states-oregon.json create mode 100644 tests/unit/test_alinco_clone.py create mode 100644 tests/unit/test_bandplan.py create mode 100644 tests/unit/test_baofeng_fmradio.py create mode 100644 tests/unit/test_cli.py create mode 100644 tests/unit/test_csv.py create mode 100644 tests/unit/test_icf.py create mode 100644 tests/unit/test_kguv8d.py create mode 100644 tests/unit/test_kguv920.py delete mode 100644 tests/unit/test_memedit_edits.py create mode 100644 tests/unit/test_network_sources.py delete mode 100644 tests/unit/test_platform.py delete mode 100644 tests/unit/test_shiftdialog.py create mode 100644 tests/unit/test_th9800.py create mode 100644 tests/unit/test_util.py delete mode 100644 tests/unit/test_utils.py delete mode 100644 tools/bitdiff.py create mode 100755 tools/check_commit.sh create mode 100755 tools/fast-driver.py delete mode 100644 tools/img2thd72.py delete mode 100644 tox.ini diff --git a/.github/actions/py2-tox/action.yaml b/.github/actions/py2-tox/action.yaml deleted file mode 100644 index 2ff11b1..0000000 --- a/.github/actions/py2-tox/action.yaml +++ /dev/null @@ -1,29 +0,0 @@ -name: Python2 tox runner -description: Runs tox py2 targets -inputs: - tox_target: - required: true - type: string - -runs: - using: "composite" - steps: - - name: Install dependencies - shell: bash - run: | - sudo apt-get update - sudo apt-get remove -y python3-libxml2 - sudo apt-get install -y libxml2-dev python-dev python-libxml2 - curl https://bootstrap.pypa.io/pip/2.7/get-pip.py --output get-pip.py - python get-pip.py - pip --version - python -m pip install --upgrade --no-deps --force-reinstall lxml - python -m pip install \ - future \ - pep8 \ - pyserial \ - tox - - name: Run tox - shell: bash - run: | - tox -e ${{ inputs.tox_target }} diff --git a/.github/actions/py3-tox/action.yaml b/.github/actions/py3-tox/action.yaml deleted file mode 100644 index 6eff4df..0000000 --- a/.github/actions/py3-tox/action.yaml +++ /dev/null @@ -1,20 +0,0 @@ -name: Python3 tox runner -description: Runs tox py3 targets -inputs: - tox_target: - required: true - type: string - -runs: - using: "composite" - steps: - - name: Install dependencies - shell: bash - run: | - sudo apt-get update - sudo apt-get install python3-pip python3-wxgtk4.0 - sudo python3 -mpip install tox - - name: Run tox - shell: bash - run: | - tox -e ${{ inputs.tox_target }} diff --git a/.github/workflows/py2-test.yaml b/.github/workflows/py2-test.yaml deleted file mode 100644 index b1a3b43..0000000 --- a/.github/workflows/py2-test.yaml +++ /dev/null @@ -1,57 +0,0 @@ -name: Tests -on: - pull_request: - branches: - - master - push: - branches: - - master -jobs: - style: - name: Style checks - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v2 - - name: Run tox - uses: ./.github/actions/py2-tox - with: - tox_target: style - - unit: - name: Unit tests - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v2 - - name: Run tox - uses: ./.github/actions/py2-tox - with: - tox_target: unit - - driver: - name: Driver tests - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v2 - - name: Run tox - uses: ./.github/actions/py2-tox - with: - tox_target: driver - - matrix: - name: Create support matrix - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v2 - - name: Run tox - uses: ./.github/actions/py2-tox - with: - tox_target: makesupported - - name: Archive support matrix - uses: actions/upload-artifact@v3 - with: - name: support-matrix - path: model_support.html diff --git a/.github/workflows/py3-pr.yaml b/.github/workflows/py3-pr.yaml deleted file mode 100644 index e6e5a65..0000000 --- a/.github/workflows/py3-pr.yaml +++ /dev/null @@ -1,51 +0,0 @@ -name: Sync to py3 branch -on: - push: - branches: - - master -jobs: - makepr: - name: Generate PR - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - name: Merge with py3 - run: | - git fetch origin py3 - git checkout origin/py3 -b py3-sync - git config --global user.email "bot@chirp.danplanet.com" - git config --global user.name "Merge Bot" - git merge $GITHUB_SHA --allow-unrelated-histories --no-edit || { - git add -u - git commit --no-edit - } - git checkout -b auto-py3-$GITHUB_SHA - - name: Update support matrix if needed - run: | - sudo apt-get update - sudo apt-get install python3-pip python3-wxgtk4.0 - sudo python3 -mpip install tox - tox -e makesupported || git commit -m "Update support matrix" tests/Python3_Driver_Testing.md - - name: Push changes - run: | - git push origin auto-py3-$GITHUB_SHA:auto-py3-$GITHUB_SHA - - name: Update support matrix if needed - run: | - sudo apt-get update - sudo apt-get install python3-pip python3-wxgtk4.0 - sudo python3 -mpip install tox - tox -e makesupported || git commit -m "Update support matrix" tests/Python3_Driver_Testing.md - - name: Push changes - run: | - git push origin auto-py3-$GITHUB_SHA:auto-py3-$GITHUB_SHA - - name: Create PR - uses: repo-sync/pull-request@v2 - with: - github_token: ${{ secrets.PR_SYNC }} - source_branch: auto-py3-${{ github.sha }} - destination_branch: py3 - pr_title: "[Automated] Sync master with py3" - pr_body: "Automated pull request to sync py3 with changes from master" diff --git a/.github/workflows/py3-test.yaml b/.github/workflows/py3-test.yaml deleted file mode 100644 index 91d5bd3..0000000 --- a/.github/workflows/py3-test.yaml +++ /dev/null @@ -1,74 +0,0 @@ -name: Tests -on: - pull_request: - push: -jobs: - style: - name: Style checks - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v2 - - name: Run tox - uses: ./.github/actions/py3-tox - with: - tox_target: style - - unit: - name: Unit tests - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v2 - - name: Run tox - uses: ./.github/actions/py3-tox - with: - tox_target: py3unit - - name: Archive results - uses: actions/upload-artifact@v3 - with: - name: unit_report - path: unit_report.html - - driver: - name: Driver tests - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v2 - - name: Run tox - uses: ./.github/actions/py3-tox - with: - tox_target: py3driver - - name: Archive results - uses: actions/upload-artifact@v3 - with: - name: driver_report - path: driver_report.html - - driver-py310: - name: Driver tests (Python 3.10) - runs-on: ubuntu-22.04 - steps: - - name: Checkout - uses: actions/checkout@v2 - - name: Run tox - uses: ./.github/actions/py3-tox - with: - tox_target: py3driver - - matrix: - name: Create support matrix - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v2 - - name: Run tox - uses: ./.github/actions/py3-tox - with: - tox_target: makesupported - - name: Archive support matrix - uses: actions/upload-artifact@v3 - with: - name: support-matrix - path: model_support.html diff --git a/.github/workflows/test-py3-merge.yaml b/.github/workflows/test-py3-merge.yaml deleted file mode 100644 index bdd7c9b..0000000 --- a/.github/workflows/test-py3-merge.yaml +++ /dev/null @@ -1,35 +0,0 @@ -name: Test merging against py3 -on: - pull_request: - branches: - - master - push: - branches: - - master -jobs: - test: - name: Merge and run all tests - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - name: Merge with py3 - run: | - echo SHA $GITHUB_SHA - echo REF $GITHUB_REF - git fetch origin py3 - git branch -a - git checkout origin/py3 -b py3-test - echo HEAD $(git rev-parse HEAD) - git config --global user.email "bot@chirp.danplanet.com" - git config --global user.name "Merge Bot" - git merge $GITHUB_SHA --allow-unrelated-histories --no-edit - - name: install dependencies - run: | - sudo apt-get update - sudo apt-get install python3-pip gobject-introspection python3-gi libgirepository1.0-dev - sudo python3 -mpip install tox - - name: Run tests - run: tox -e py3unit,py3driver,style diff --git a/.hgignore b/.hgignore deleted file mode 100644 index 6a9ef40..0000000 --- a/.hgignore +++ /dev/null @@ -1,21 +0,0 @@ -.*\~$ -.*\.pyc$ -.*\.orig$ -.*\.rej$ -dist -build/bdist -tools/cpep8.venv/ -tests/logs/ -logs/ -ignored/ -patch_queue/ -archived_builds/ -.tox/ -.*\.mo$ -.*\.pot$ -locale/.files -MANIFEST -.pytest_cache -# for visual studio and visual studio code editors -.vs/ -.vscode/ diff --git a/.hgtags b/.hgtags deleted file mode 100644 index 3192edf..0000000 --- a/.hgtags +++ /dev/null @@ -1,17 +0,0 @@ -1428729c41b76d9e88023a8d9073bd947b1f64e4 release_0_1_1 -b6d7fbb63c67b431afb526c1c5682198884050e7 release_0_1_2 -1ed337baf81ee9e3a8cf80c095c79fda40f09000 release_0_1_3 -05dd19dd4db874ae9b94fd2ce4b81a9fe1a7b279 release_0_1_4 -5ab503b39a8609f428b4d44389507672090ddee6 release_0_1_5 -f31a4c4d772dfb9f0519586bfc683ac0c095e8a8 release_0_1_6 -61ed9897712816f2959ecda8135526e15ec7a046 release_0_1_7 -22c1e4d0f349c13e8a9e02cd2f0c4ba58033824e release_0_1_8 -c6f153e861ddca4b2568f83ef8d20c9ef3d6565e release_0_1_9 -03e812a988209069d5de9ff744a7c5d77bca4b94 release_0_1_10 -629e127c61ded83612f322d86b960c4fcbb5df7d release_0_1_11 -3dd33f5175ca34b06fd118a63c692297b5eb2550 release_0_1_12 -df5342f5ce3d3615dff38238d3112711c3628be6 release_0_2_0 -744ce08c8bea0868ce756e270043dbef59b5eb7f release_0_2_1 -30eeb96b77fb90ca88689cc2f76af379123e5e6e release_0_2_2 -e4901095dc40aa73cc9eb95105e7b32c756f53b0 release_0_3_0 -e91f09ca03d07a9f565291a60e8b84073298b8ac release_0_4_0 diff --git a/.pylintrc b/.pylintrc deleted file mode 100644 index 8a8f0a3..0000000 --- a/.pylintrc +++ /dev/null @@ -1,308 +0,0 @@ -# lint Python modules using external checkers. -# -# This is the main checker controling the other ones and the reports -# generation. It is itself both a raw checker and an astng checker in order -# to: -# * handle message activation / deactivation at the module level -# * handle some basic but necessary stats'data (number of classes, methods...) -# -[MASTER] - -# Specify a configuration file. -#rcfile= - -# Python code to execute, usually for sys.path manipulation such as -# pygtk.require(). -#init-hook= - -# Profiled execution. -profile=no - -# Add to the black list. It should be a base name, not a -# path. You may set this option multiple times. -ignore=dist -ignore=icons -ignore=.hg - -# Pickle collected data for later comparisons. -persistent=yes - -# Set the cache size for astng objects. -cache-size=500 - -# List of plugins (as comma separated values of python modules names) to load, -# usually to register additional checkers. -load-plugins= - - -[MESSAGES CONTROL] - -# Enable only checker(s) with the given id(s). This option conflicts with the -# disable-checker option -#enable-checker= - -# Enable all checker(s) except those with the given id(s). This option -# conflicts with the enable-checker option -disable-checker=SIMILARITIES - -# Enable all messages in the listed categories. -#enable-msg-cat= - -# Disable all messages in the listed categories. -#disable-msg-cat= - -# Enable the message(s) with the given id(s). -#enable-msg= - -# Disable the message(s) with the given id(s). -disable-msg=W0142,C0111 - - -[REPORTS] - -# set the output format. Available formats are text, parseable, colorized, msvs -# (visual studio) and html -output-format=text - -# Include message's id in output -include-ids=no - -# Put messages in a separate file for each module / package specified on the -# command line instead of printing them on stdout. Reports (if any) will be -# written in a file name "pylint_global.[txt|html]". -files-output=no - -# Tells wether to display a full report or only the messages -reports=yes - -# Python expression which should return a note less than 10 (10 is the highest -# note).You have access to the variables errors warning, statement which -# respectivly contain the number of errors / warnings messages and the total -# number of statements analyzed. This is used by the global evaluation report -# (R0004). -evaluation=10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10) - -# Add a comment according to your evaluation note. This is used by the global -# evaluation report (R0004). -comment=no - -# Enable the report(s) with the given id(s). -#enable-report= - -# Disable the report(s) with the given id(s). -#disable-report= - - -# checks for : -# * doc strings -# * modules / classes / functions / methods / arguments / variables name -# * number of arguments, local variables, branchs, returns and statements in -# functions, methods -# * required module attributes -# * dangerous default values as arguments -# * redefinition of function / method / class -# * uses of the global statement -# -[BASIC] - -# Required attributes for module, separated by a comma -required-attributes= - -# Regular expression which should only match functions or classes name which do -# not require a docstring -#no-docstring-rgx=__.*__ -no-docstring-rgx=.* - -# Regular expression which should only match correct module names -module-rgx=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$ - -# Regular expression which should only match correct module level names -const-rgx=(([A-Z_][A-Z0-9_]*)|(__.*__))$ - -# Regular expression which should only match correct class names -class-rgx=[A-Z_][a-zA-Z0-9]+$ - -# Regular expression which should only match correct function names -function-rgx=[a-z_][a-z0-9_]{1,30}$ - -# Regular expression which should only match correct method names -method-rgx=[a-z_][a-z0-9_]{1,30}$ - -# Regular expression which should only match correct instance attribute names -attr-rgx=[a-z_][a-z0-9_]{1,30}$ - -# Regular expression which should only match correct argument names -argument-rgx=[a-z_][a-z0-9_]{1,30}$ - -# Regular expression which should only match correct variable names -variable-rgx=[a-z_][a-z0-9_]{1,30}$ - -# Regular expression which should only match correct list comprehension / -# generator expression variable names -inlinevar-rgx=[A-Za-z_][A-Za-z0-9_]*$ - -# Good variable names which should always be accepted, separated by a comma -good-names=i,j,k,ex,Run,_,e - -# Bad variable names which should always be refused, separated by a comma -bad-names=foo,bar,baz,toto,tutu,tata - -# List of builtins function names that should not be used, separated by a comma -bad-functions=map,filter,apply,input - - -# try to find bugs in the code using type inference -# -[TYPECHECK] - -# Tells wether missing members accessed in mixin class should be ignored. A -# mixin class is detected if its name ends with "mixin" (case insensitive). -ignore-mixin-members=yes - -# When zope mode is activated, consider the acquired-members option to ignore -# access to some undefined attributes. -zope=no - -# List of members which are usually get through zope's acquisition mecanism and -# so shouldn't trigger E0201 when accessed (need zope=yes to be considered). -acquired-members=REQUEST,acl_users,aq_parent - - -# checks for -# * unused variables / imports -# * undefined variables -# * redefinition of variable from builtins or from an outer scope -# * use of variable before assigment -# -[VARIABLES] - -# Tells wether we should check for unused import in __init__ files. -init-import=no - -# A regular expression matching names used for dummy variables (i.e. not used). -dummy-variables-rgx=_|dummy - -# List of additional names supposed to be defined in builtins. Remember that -# you should avoid to define new builtins when possible. -additional-builtins= - - -# checks for sign of poor/misdesign: -# * number of methods, attributes, local variables... -# * size, complexity of functions, methods -# -[DESIGN] - -# Maximum number of arguments for function / method -max-args=5 - -# Maximum number of locals for function / method body -max-locals=15 - -# Maximum number of return / yield for function / method body -max-returns=6 - -# Maximum number of branch for function / method body -max-branchs=12 - -# Maximum number of statements in function / method body -max-statements=50 - -# Maximum number of parents for a class (see R0901). -max-parents=7 - -# Maximum number of attributes for a class (see R0902). -max-attributes=7 - -# Minimum number of public methods for a class (see R0903). -min-public-methods=2 - -# Maximum number of public methods for a class (see R0904). -max-public-methods=20 - - -# checks for : -# * methods without self as first argument -# * overridden methods signature -# * access only to existant members via self -# * attributes not defined in the __init__ method -# * supported interfaces implementation -# * unreachable code -# -[CLASSES] - -# List of interface methods to ignore, separated by a comma. This is used for -# instance to not check methods defines in Zope's Interface base class. -ignore-iface-methods=isImplementedBy,deferred,extends,names,namesAndDescriptions,queryDescriptionFor,getBases,getDescriptionFor,getDoc,getName,getTaggedValue,getTaggedValueTags,isEqualOrExtendedBy,setTaggedValue,isImplementedByInstancesOf,adaptWith,is_implemented_by - -# List of method names used to declare (i.e. assign) instance attributes. -defining-attr-methods=__init__,__new__,setUp - - -# checks for -# * external modules dependencies -# * relative / wildcard imports -# * cyclic imports -# * uses of deprecated modules -# -[IMPORTS] - -# Deprecated modules which should not be used, separated by a comma -deprecated-modules=regsub,string,TERMIOS,Bastion,rexec - -# Create a graph of every (i.e. internal and external) dependencies in the -# given file (report R0402 must not be disabled) -import-graph= - -# Create a graph of external dependencies in the given file (report R0402 must -# not be disabled) -ext-import-graph= - -# Create a graph of internal dependencies in the given file (report R0402 must -# not be disabled) -int-import-graph= - - -# checks for: -# * warning notes in the code like FIXME, XXX -# * PEP 263: source code with non ascii character but no encoding declaration -# -[MISCELLANEOUS] - -# List of note tags to take in consideration, separated by a comma. -notes=FIXME,XXX,TODO - - -# checks for : -# * unauthorized constructions -# * strict indentation -# * line length -# * use of <> instead of != -# -[FORMAT] - -# Maximum number of characters on a single line. -max-line-length=80 - -# Maximum number of lines in a module -max-module-lines=1000 - -# String used as indentation unit. This is usually " " (4 spaces) or "\t" (1 -# tab). -indent-string=' ' - - -# checks for similarities and duplicated code. This computation may be -# memory / CPU intensive, so you should disable it if you experiments some -# problems. -# -[SIMILARITIES] - -# Minimum lines number of a similarity. -min-similarity-lines=4 - -# Ignore comments when computing similarities. -ignore-comments=yes - -# Ignore docstrings when computing similarities. -ignore-docstrings=yes diff --git a/INSTALL b/INSTALL deleted file mode 100644 index a55c4d4..0000000 --- a/INSTALL +++ /dev/null @@ -1,52 +0,0 @@ -This file describes the installation of Chirp without package management -on Linux and other Unix-like operating systems. This sort of thing may -be your only choice because 1) a package has not yet been made for your -OS or distribution, 2) the packaged version is obsolete, or 3) you want -to try a daily build. - - -For Debian, Ubuntu, and related systems, the following packages are required: -python -python-gtk2 -python-libxml2 -python-libxslt1 -python-serial -python-suds (optional) -python-support - -For Redhat, Fedora, CentOS and related systems, the following packages -are required: (This list is incomplete. Please submit corrections.) -python -pygtk2 -libxml2-python -python-libxslt - -For openSUSE, the following packages are required: -python -python-gtk -python-pyserial -python-libxml2 -libxslt-python -python-suds-jurko - -Once these packages are installed, you can run Chirp directly from the -distribution directory by typing "./chirpw". If you want to install it -properly, type this: - - sudo python setup.py install --record files.txt - -This will install the package and create a list of files that were -added to your system. If you want to deinstall Chirp, type this: - - sudo xargs -0 rm -rf < files.txt - -This will cause rm(1) to take its list of arguments from the file named -"files.txt" and remove those files from the system. If you forgot to -create "files.txt", you can simply reinstall the way it is shown here -and continue on your way. - -Note: This will not uninstall directories created by the installation of -Chirp. Presence of these empty directories shouldn't be a problem, but -if they are, it's easy to go through the files.txt file, identify them, -and remove them. - diff --git a/MANIFEST.in b/MANIFEST.in index 77a5f3a..197ad12 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,8 +1,12 @@ -include *.xsd -include share/*.desktop -include share/chirp.png -include share/chirp.ico -include share/*.1 -include stock_configs/* +include chirp/share/*.desktop +include chirp/share/*.png +include chirp/share/*.svg +include chirp/share/*.ico +include chirp/share/*.1 +include chirp/stock_configs/* +include chirp/locale/*/LC_MESSAGES/*.mo +exclude chirp/locale/* include COPYING include *requirements.txt +graft tests +graft tools diff --git a/PKG-INFO b/PKG-INFO new file mode 100644 index 0000000..693752e --- /dev/null +++ b/PKG-INFO @@ -0,0 +1,15 @@ +Metadata-Version: 2.1 +Name: chirp +Version: 20231016 +Summary: A cross-platform cross-radio programming tool +Home-page: https://chirp.danplanet.com +Requires-Python: >=3.7,<4 +License-File: COPYING +Requires-Dist: pyserial +Requires-Dist: requests +Requires-Dist: six +Requires-Dist: future +Requires-Dist: importlib-resources; python_version < "3.10" +Requires-Dist: yattag +Provides-Extra: wx +Requires-Dist: wxPython; extra == "wx" diff --git a/README.chirpc b/README.chirpc deleted file mode 100644 index f6e176f..0000000 --- a/README.chirpc +++ /dev/null @@ -1,104 +0,0 @@ -chirpc: CHIRP Command-line interface -==================================== - -CHIRP provides a CLI tool (chirpc) to interact with your radio and -memory image files. It has been designed to be used from programs or -scripts written in other languages, providing facilities for automating -queries and transformations. - - -WARNING: All modifications are made in-place, overwriting the original -file with new contents. Be sure to make a backup copy of any files -that you want unchanged. - - -======== -Cookbook -======== - -This section provides copy-and-paste recipes for accomplishing some -tasks using the CLI. - - -List Radios ------------ - -To see the list of supported names that can be passed to the --r/--radio option: - - chirpc --list-radios - - -Download from Radio -------------------- - -To download a new image from your radio: - - chirpc -r --serial= --mmap= --download-mmap - -This will connect to the specified on , saving the image -obtained from the radio into the specified . - - -Upload to Radio ---------------- - -To upload an existing image to your radio: - - chirpc -r --serial= --mmap= --upload-mmap - -This will connect to the specified on , loading the image -in the specified onto the radio. - - -List Settings -------------- - -For radios that support settings, you can list the current settings -in a saved image: - - chirpc --mmap= --list-settings - - -Show Memory Channels --------------------- - -You can list all current memory channels in a saved image: - - chirpc --mmap= --list-mem - -That command only lists the currently programmed channels. To see the -complete list (including empty channels), add '--verbose'. - -To view only a single channel, use the --get-mem option: - - chirpc --mmap= --get-mem - - -Set a Memory Channel --------------------- - - chirpc --mmap= --set-mem-name= ... - -See the --help text for a complete list of options that can be used -to configure the channel. Any settings that are not configured using -a command option will be left unchanged. - - -Clearing a Memory Channel -------------------------- - -You can clear a memory channel, discarding all settings: - - chirpc --mmap= --clear-mem - - -Copying a Memory Channel ------------------------- - -You can copy a memory channel: - - chirpc --mmap= --copy-mem - -Note: The contents of will be overwritten with -the contents from diff --git a/README.developers b/README.developers deleted file mode 100644 index e784b2a..0000000 --- a/README.developers +++ /dev/null @@ -1,64 +0,0 @@ -This file describes some features in the Chirp Developer's Functions -that allow some customization of their behavior, but are only -accessible through editing the chirp.config file before starting -Chirp, and are not accessible through the GUI. - -The Developer Functions are enabled in the GUI by checking the box -in the "Help" tab. They enable the Image Browser tab in the left -sidebar, several tools under the View -> Developer tab, and some others. - -These directives are similar to other chirp.config entries in syntax. -They reside in the [developer] section in chirp.config. -This section, and all the directives, are not required to be present; -all the options have defaults. - -Here is an example [developer] section listing all the directives, -followed by an explanation of each directive: - -=================================== -[developer] -diff_fontsize = 16 -browser_fontsize = 13 -hexdump_addrfmt = %(addr)04i x%(addr)04X - -=================================== -browser_fontsize = -This specifies the fontsize used in the file browser, invoked by selecting -the "Browser" tab in the left sidebar, which is visible when the Developer -tools are enabled. - -The default size is 10. Values less than 4, greater than 144, or not -recognized as an integer will result in a log message and the default -size will be used. - -======== -diff_fontize = -This specifies the fontsize used in the hex dump/diff display which is -invoked by selecting View -> Developer -> Diff tabs. - -The default size is 11. Values less than 4, greater than 144, or not -recognized as an integer will result in a log message and the default -size will be used. - -======== -hexdump_addrfmt = -This specifies the format of the address printed during some hexdump -operations. The default is %(addr)03i which prints the byte offset -of the first byte of each line in decimal, producing lines such as - 064: 00 00 00 ... - -Any of the variables in local scope of chirp/util.py::hexdump() are -valid for substitution, including block and block_size. Any may -be used more than once. The example above, %(addr)04i x%(addr)04X -produces lines such as - 0064 x0040: 00 00 00 ... - -0x%(addr)04x specifies lower case hex, and wwould produce lines such as - 0x0040: 00 00 00 ... - -Exceptions that have been observed in testing formats which are -invalid in this context are caught, and the default format is used. - -======== - - diff --git a/README.md b/README.md index d752a18..2a97f2f 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,7 @@ # CHIRP Project This is the official git repository for the -__[CHIRP](https://chirp.danplanet.com)__ project. This repo is mirrored to -the legacy mercurial repo and patches are still accepted via the mailing list -against that repository for existing contributors. New contributions are -preferred as PRs here. +__[CHIRP](https://chirp.danplanet.com)__ project. When submitting PRs, please squash commits into logical units in a fashion similar to what is currently expected by the project on the mailing list. diff --git a/README.rpttool b/README.rpttool deleted file mode 100644 index 9968348..0000000 --- a/README.rpttool +++ /dev/null @@ -1,23 +0,0 @@ - *** KK7DS ID-RP* Frequency Tool *** - -This is a simple tool that allows setting of the frequency parameters -on ICOM D-STAR Repeaters. It has been tested on the following -modules: - - - ID-RP2000V and ID-RP4000V - - ID-RP2D (the ID-RP2V is expected to work as well) - -To run the tool, connect one of the repeater's SERVICE ports to a USB -port on this machine and then run the tool as root: - - # ./rpttool - -WARNING: Do not connect or try to program the ID-RP2C controller -module. This tool should be safe to use, but no guarantees are made. -The author believes that the ICOM devices are smart enough to prevent -bricking, but you're on your own if anything happens. - -If you have any other devices connected that are using an FTDI -USB-to-Serial device, they must be disconnected prior to running this -tool. The FTDI driver module will be re-loaded with a special -parameter to allow it to recognize the ICOM device. diff --git a/build/chirp.app/Contents/Info.plist b/build/chirp.app/Contents/Info.plist deleted file mode 100644 index 673eeeb..0000000 --- a/build/chirp.app/Contents/Info.plist +++ /dev/null @@ -1,26 +0,0 @@ - - - - - CFBundleDevelopmentRegion - English - CFBundleExecutable - chirp - CFBundleIconFile - Chirp - CFBundleIdentifier - com.danplanet.chirp - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - chirp - CFBundleShortVersionString - 0.1 - CFBundleVersion - 0.1 - LSHasLocalizedDisplayName - - LSMinimumSystemVersion - 10.5 - - diff --git a/build/chirp.app/Contents/MacOS/chirp b/build/chirp.app/Contents/MacOS/chirp deleted file mode 100755 index d0ff86e..0000000 --- a/build/chirp.app/Contents/MacOS/chirp +++ /dev/null @@ -1,19 +0,0 @@ -#!/usr/bin/env bash - -LOCATION=$(dirname "${BASH_SOURCE}") - -PYTHON=/opt/kk7ds/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python - -not_translocated () { - security translocate-status-check "${LOCATION}" 2>&1 | grep -q -e NOT -e unknown -e "not found" -} - -if [ ! -x $PYTHON ]; then - PYTHON=/opt/kk7ds/bin/python2.7 -elif not_translocated; then - ln -s $PYTHON "${LOCATION}/../CHIRP" - PYTHON=${LOCATION}/../CHIRP - export PYTHONPATH=/opt/kk7ds/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages -fi - -exec "$PYTHON" "${LOCATION}/../Resources/chirp/chirpw" diff --git a/build/chirp.app/Contents/PkgInfo b/build/chirp.app/Contents/PkgInfo deleted file mode 100644 index bd04210..0000000 --- a/build/chirp.app/Contents/PkgInfo +++ /dev/null @@ -1 +0,0 @@ -APPL???? \ No newline at end of file diff --git a/build/chirp.app/Contents/Resources/.placeholder b/build/chirp.app/Contents/Resources/.placeholder deleted file mode 100644 index e69de29..0000000 diff --git a/build/macos/make_pango.sh b/build/macos/make_pango.sh deleted file mode 100644 index 57d3429..0000000 --- a/build/macos/make_pango.sh +++ /dev/null @@ -1,51 +0,0 @@ -#!/usr/bin/env bash - -make_pango_modules() { - local src=$1 - local dst=$2 - local sf=${src}/etc/pango/pango.modules - local df=${dst}/etc/pango/pango.modules - - cat $sf | sed 's/\/opt\/.*\/lib/..\/Resources/' > $df -} - -make_pango_rc() { - local src=$1 - local dst=$2 - local sf=${src}/etc/pango/pangorc - local df=${dst}/etc/pango/pangorc - - cat $sf | sed 's/\/opt\/.*\/etc/.\/etc/' > $df -} - -make_pangox_aliases() { - local src=$1 - local dst=$2 - - cp ${src}/etc/pango/pangox.aliases ${dst}/etc/pango -} - -usage() { - echo 'Usage: make_pango.sh [PATH_TO_MACPORTS] [PATH_TO_APP]' - echo 'Example:' - echo ' make_pango.sh /opt/local dist/d-rats.app' -} - -if [ -z "$1" ]; then - usage - exit 1 -fi - -if [ -z "$2" ]; then - usage - exit 1 -fi - -base=$1 -app="$2/Contents/Resources" - -mkdir -p ${app}/etc/pango - -make_pango_modules $base $app -make_pango_rc $base $app -make_pangox_aliases $base $app diff --git a/build/make_source_release.sh b/build/make_source_release.sh deleted file mode 100755 index 2a5af86..0000000 --- a/build/make_source_release.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/usr/bin/env bash - -VERSION=$(cat build/version) -INCLUDE="COPYING" -TMP=$(mktemp -d) -EXCLUDE="" - -sed -i 's/^CHIRP_VERSION.*$/CHIRP_VERSION=\"'$VERSION'\"/' chirp/__init__.py - -RELDIR=chirp-${VERSION} - -DST="${TMP}/${RELDIR}" - -mkdir -p $DST - -cp -rav --parents chirp/*.py chirp/drivers/*.py csvdump/*.py chirp/ui/* $DST -cp -av *.py ${DST} - -cp -rav $INCLUDE ${DST} - -(cd $TMP && tar czf - $RELDIR) > ${RELDIR}.tar.gz - -rm -Rf ${TMP}/${RELDIR} diff --git a/build/version b/build/version deleted file mode 100644 index 8508cef..0000000 --- a/build/version +++ /dev/null @@ -1 +0,0 @@ -0.3.0dev diff --git a/chirp.egg-info/PKG-INFO b/chirp.egg-info/PKG-INFO new file mode 100644 index 0000000..693752e --- /dev/null +++ b/chirp.egg-info/PKG-INFO @@ -0,0 +1,15 @@ +Metadata-Version: 2.1 +Name: chirp +Version: 20231016 +Summary: A cross-platform cross-radio programming tool +Home-page: https://chirp.danplanet.com +Requires-Python: >=3.7,<4 +License-File: COPYING +Requires-Dist: pyserial +Requires-Dist: requests +Requires-Dist: six +Requires-Dist: future +Requires-Dist: importlib-resources; python_version < "3.10" +Requires-Dist: yattag +Provides-Extra: wx +Requires-Dist: wxPython; extra == "wx" diff --git a/chirp.egg-info/SOURCES.txt b/chirp.egg-info/SOURCES.txt new file mode 100644 index 0000000..acf2745 --- /dev/null +++ b/chirp.egg-info/SOURCES.txt @@ -0,0 +1,611 @@ +COPYING +MANIFEST.in +README.md +requirements.txt +setup.cfg +setup.py +test-requirements.txt +chirp/__init__.py +chirp/bandplan.py +chirp/bandplan_au.py +chirp/bandplan_iaru_r1.py +chirp/bandplan_iaru_r2.py +chirp/bandplan_iaru_r3.py +chirp/bandplan_na.py +chirp/bitwise.py +chirp/bitwise_grammar.py +chirp/chirp_common.py +chirp/detect.py +chirp/directory.py +chirp/errors.py +chirp/import_logic.py +chirp/logger.py +chirp/memmap.py +chirp/platform.py +chirp/pyPEG.py +chirp/settings.py +chirp/util.py +chirp.egg-info/PKG-INFO +chirp.egg-info/SOURCES.txt +chirp.egg-info/dependency_links.txt +chirp.egg-info/entry_points.txt +chirp.egg-info/requires.txt +chirp.egg-info/top_level.txt +chirp/cli/__init__.py +chirp/cli/main.py +chirp/drivers/__init__.py +chirp/drivers/alinco.py +chirp/drivers/anytone.py +chirp/drivers/anytone778uv.py +chirp/drivers/anytone_ht.py +chirp/drivers/anytone_iii.py +chirp/drivers/ap510.py +chirp/drivers/baofeng_common.py +chirp/drivers/baofeng_uv3r.py +chirp/drivers/baofeng_wp970i.py +chirp/drivers/bf_t1.py +chirp/drivers/bf_t8.py +chirp/drivers/bj9900.py +chirp/drivers/bjuv55.py +chirp/drivers/boblov_x3plus.py +chirp/drivers/btech.py +chirp/drivers/fake.py +chirp/drivers/fd268.py +chirp/drivers/ft1500m.py +chirp/drivers/ft1802.py +chirp/drivers/ft1d.py +chirp/drivers/ft2800.py +chirp/drivers/ft2900.py +chirp/drivers/ft2d.py +chirp/drivers/ft4.py +chirp/drivers/ft450d.py +chirp/drivers/ft50.py +chirp/drivers/ft60.py +chirp/drivers/ft70.py +chirp/drivers/ft7100.py +chirp/drivers/ft7800.py +chirp/drivers/ft8100.py +chirp/drivers/ft817.py +chirp/drivers/ft818.py +chirp/drivers/ft857.py +chirp/drivers/ft90.py +chirp/drivers/ftlx011.py +chirp/drivers/ftm3200d.py +chirp/drivers/ftm350.py +chirp/drivers/ftm7250d.py +chirp/drivers/ga510.py +chirp/drivers/generic_csv.py +chirp/drivers/generic_tpe.py +chirp/drivers/gmrsuv1.py +chirp/drivers/gmrsv2.py +chirp/drivers/h777.py +chirp/drivers/hf90.py +chirp/drivers/hg_uv98.py +chirp/drivers/hobbypcb.py +chirp/drivers/ic208.py +chirp/drivers/ic2100.py +chirp/drivers/ic2200.py +chirp/drivers/ic2300.py +chirp/drivers/ic2720.py +chirp/drivers/ic2730.py +chirp/drivers/ic2820.py +chirp/drivers/ic9x.py +chirp/drivers/ic9x_icf.py +chirp/drivers/ic9x_icf_ll.py +chirp/drivers/ic9x_ll.py +chirp/drivers/icf.py +chirp/drivers/icomciv.py +chirp/drivers/icp7.py +chirp/drivers/icq7.py +chirp/drivers/ict70.py +chirp/drivers/ict7h.py +chirp/drivers/ict8.py +chirp/drivers/icv80.py +chirp/drivers/icv86.py +chirp/drivers/icw32.py +chirp/drivers/icx8x.py +chirp/drivers/icx90.py +chirp/drivers/id31.py +chirp/drivers/id51.py +chirp/drivers/id5100.py +chirp/drivers/id51plus.py +chirp/drivers/id800.py +chirp/drivers/id880.py +chirp/drivers/idrp.py +chirp/drivers/iradio_uv_5118.py +chirp/drivers/iradio_uv_5118plus.py +chirp/drivers/kenwood_d7.py +chirp/drivers/kenwood_hmk.py +chirp/drivers/kenwood_itm.py +chirp/drivers/kenwood_live.py +chirp/drivers/kg935g.py +chirp/drivers/kguv8d.py +chirp/drivers/kguv8dplus.py +chirp/drivers/kguv8e.py +chirp/drivers/kguv920pa.py +chirp/drivers/kguv980p.py +chirp/drivers/kguv9dplus.py +chirp/drivers/kyd.py +chirp/drivers/kyd_IP620.py +chirp/drivers/leixen.py +chirp/drivers/lt725uv.py +chirp/drivers/mml_jc8810.py +chirp/drivers/mursv1.py +chirp/drivers/puxing.py +chirp/drivers/puxing_px888k.py +chirp/drivers/radioddity_r2.py +chirp/drivers/radtel_t18.py +chirp/drivers/retevis_rb15.py +chirp/drivers/retevis_rb17p.py +chirp/drivers/retevis_rb28.py +chirp/drivers/retevis_rt1.py +chirp/drivers/retevis_rt21.py +chirp/drivers/retevis_rt22.py +chirp/drivers/retevis_rt23.py +chirp/drivers/retevis_rt26.py +chirp/drivers/retevis_rt76p.py +chirp/drivers/retevis_rt87.py +chirp/drivers/retevis_rt98.py +chirp/drivers/rh5r_v2.py +chirp/drivers/tdh8.py +chirp/drivers/tdxone_tdq8a.py +chirp/drivers/template.py +chirp/drivers/tg_uv2p.py +chirp/drivers/th350.py +chirp/drivers/th7800.py +chirp/drivers/th9000.py +chirp/drivers/th9800.py +chirp/drivers/th_uv3r.py +chirp/drivers/th_uv3r25.py +chirp/drivers/th_uv8000.py +chirp/drivers/th_uv88.py +chirp/drivers/th_uvf8d.py +chirp/drivers/thd72.py +chirp/drivers/thd74.py +chirp/drivers/thuv1f.py +chirp/drivers/tk270.py +chirp/drivers/tk3140.py +chirp/drivers/tk760.py +chirp/drivers/tk760g.py +chirp/drivers/tk8102.py +chirp/drivers/tk8160.py +chirp/drivers/tk8180.py +chirp/drivers/tmd710.py +chirp/drivers/tmv71.py +chirp/drivers/tmv71_ll.py +chirp/drivers/ts2000.py +chirp/drivers/ts480.py +chirp/drivers/ts590.py +chirp/drivers/ts850.py +chirp/drivers/uv5r.py +chirp/drivers/uv5x3.py +chirp/drivers/uv6r.py +chirp/drivers/uvb5.py +chirp/drivers/uvk5.py +chirp/drivers/vgc.py +chirp/drivers/vx170.py +chirp/drivers/vx2.py +chirp/drivers/vx3.py +chirp/drivers/vx5.py +chirp/drivers/vx510.py +chirp/drivers/vx6.py +chirp/drivers/vx7.py +chirp/drivers/vx8.py +chirp/drivers/vxa700.py +chirp/drivers/wouxun.py +chirp/drivers/wouxun_common.py +chirp/drivers/yaesu_clone.py +chirp/locale/de/LC_MESSAGES/CHIRP.mo +chirp/locale/el/LC_MESSAGES/CHIRP.mo +chirp/locale/en_US/LC_MESSAGES/CHIRP.mo +chirp/locale/es/LC_MESSAGES/CHIRP.mo +chirp/locale/fr/LC_MESSAGES/CHIRP.mo +chirp/locale/hu/LC_MESSAGES/CHIRP.mo +chirp/locale/it/LC_MESSAGES/CHIRP.mo +chirp/locale/nl/LC_MESSAGES/CHIRP.mo +chirp/locale/pl/LC_MESSAGES/CHIRP.mo +chirp/locale/pt_BR/LC_MESSAGES/CHIRP.mo +chirp/locale/ru/LC_MESSAGES/CHIRP.mo +chirp/locale/tr_TR/LC_MESSAGES/CHIRP.mo +chirp/locale/uk_UA/LC_MESSAGES/CHIRP.mo +chirp/locale/zh_CN/LC_MESSAGES/CHIRP.mo +chirp/share/chirp.desktop +chirp/share/chirp.ico +chirp/share/chirp.png +chirp/share/chirp.svg +chirp/share/chirpw.1 +chirp/share/plus-icon.png +chirp/share/welcome_screen.png +chirp/sources/__init__.py +chirp/sources/base.py +chirp/sources/dmrmarc.py +chirp/sources/przemienniki.py +chirp/sources/radioreference.py +chirp/sources/repeaterbook.py +chirp/stock_configs/AU NZ UHF Citizens Band.csv +chirp/stock_configs/DE Freenet Frequencies.csv +chirp/stock_configs/EU LPD and PMR Channels.csv +chirp/stock_configs/FR Marine VHF Channels.csv +chirp/stock_configs/PL Calling Frequencies and Simplex.csv +chirp/stock_configs/SE Jaktradio 155MHz.csv +chirp/stock_configs/SE NO KDR444.csv +chirp/stock_configs/UK Business Radio Simple Light Frequencies.csv +chirp/stock_configs/US 60 meter channels (Center).csv +chirp/stock_configs/US 60 meter channels (Dial).csv +chirp/stock_configs/US CA Railroad Channels.csv +chirp/stock_configs/US Calling Frequencies.csv +chirp/stock_configs/US FRS and GMRS Channels.csv +chirp/stock_configs/US MURS Channels.csv +chirp/stock_configs/US Marine VHF Channels.csv +chirp/stock_configs/US NOAA Weather Alert.csv +chirp/wxui/__init__.py +chirp/wxui/__main__.py +chirp/wxui/bankedit.py +chirp/wxui/clone.py +chirp/wxui/common.py +chirp/wxui/config.py +chirp/wxui/developer.py +chirp/wxui/fips.py +chirp/wxui/main.py +chirp/wxui/memedit.py +chirp/wxui/printing.py +chirp/wxui/query_sources.py +chirp/wxui/radioinfo.py +chirp/wxui/radiothread.py +chirp/wxui/report.py +chirp/wxui/settingsedit.py +tests/Python3_Driver_Testing.md +tests/__init__.py +tests/base.py +tests/icom_clone_simulator.py +tests/model_stats.tsv +tests/py3_driver_testers.txt +tests/test_banks.py +tests/test_brute_force.py +tests/test_clone.py +tests/test_copy_all.py +tests/test_detect.py +tests/test_drivers.py +tests/test_edges.py +tests/test_features.py +tests/test_settings.py +tests/__pycache__/__init__.cpython-310.pyc +tests/__pycache__/base.cpython-310.pyc +tests/__pycache__/icom_clone_simulator.cpython-310.pyc +tests/__pycache__/test_banks.cpython-310-pytest-7.1.3.pyc +tests/__pycache__/test_brute_force.cpython-310-pytest-7.1.3.pyc +tests/__pycache__/test_clone.cpython-310-pytest-7.1.3.pyc +tests/__pycache__/test_copy_all.cpython-310-pytest-7.1.3.pyc +tests/__pycache__/test_detect.cpython-310-pytest-7.1.3.pyc +tests/__pycache__/test_drivers.cpython-310-pytest-7.1.3.pyc +tests/__pycache__/test_edges.cpython-310-pytest-7.1.3.pyc +tests/__pycache__/test_features.cpython-310-pytest-7.1.3.pyc +tests/__pycache__/test_settings.cpython-310-pytest-7.1.3.pyc +tests/images/Abbree_AR-518.img +tests/images/Abbree_AR-63.img +tests/images/Abbree_AR-730.img +tests/images/Abbree_AR-F5.img +tests/images/Alinco_DJ-G7EG.img +tests/images/Alinco_DJ175.img +tests/images/Alinco_DJ596.img +tests/images/Alinco_DR235T.img +tests/images/AnyTone_5888UV.img +tests/images/AnyTone_5888UVIII.img +tests/images/AnyTone_778UV.img +tests/images/AnyTone_OBLTR-8R.img +tests/images/AnyTone_TERMN-8R.img +tests/images/Anysecu_UV-A37.img +tests/images/Anysecu_WP-9900.img +tests/images/BTECH_FRS-A1.img +tests/images/BTECH_FRS-B1.img +tests/images/BTECH_GMRS-20V2.img +tests/images/BTECH_GMRS-50V2.img +tests/images/BTECH_GMRS-50X1.img +tests/images/BTECH_GMRS-V1.img +tests/images/BTECH_GMRS-V2.img +tests/images/BTECH_MURS-V1.img +tests/images/BTECH_MURS-V2.img +tests/images/BTECH_UV-2501+220.img +tests/images/BTECH_UV-25X2.img +tests/images/BTECH_UV-25X2_G2.img +tests/images/BTECH_UV-25X4.img +tests/images/BTECH_UV-25X4_G2.img +tests/images/BTECH_UV-5001.img +tests/images/BTECH_UV-50X2.img +tests/images/BTECH_UV-50X2_G2.img +tests/images/BTECH_UV-50X3.img +tests/images/BTECH_UV-5X3.img +tests/images/Baofeng_BF-1904.img +tests/images/Baofeng_BF-888.img +tests/images/Baofeng_BF-A58S.img +tests/images/Baofeng_BF-T1.img +tests/images/Baofeng_BF-T8.img +tests/images/Baofeng_F-11.img +tests/images/Baofeng_UV-3R.img +tests/images/Baofeng_UV-5R.img +tests/images/Baofeng_UV-6R.img +tests/images/Baofeng_UV-9G.img +tests/images/Baofeng_UV-B5.img +tests/images/Baofeng_UV-S9X3.img +tests/images/Baofeng_W31E.img +tests/images/Baojie_BJ-9900.img +tests/images/Boblov_X3Plus.img +tests/images/CRT_Micron_UV.img +tests/images/Explorer_QRZ-1.img +tests/images/Feidaxin_FD-268A.img +tests/images/Feidaxin_FD-268B.img +tests/images/Feidaxin_FD-288B.img +tests/images/Generic_CSV.csv +tests/images/Hiroyasu_HI-8811.img +tests/images/Icom_IC-208H.img +tests/images/Icom_IC-2100H.img +tests/images/Icom_IC-2200H.img +tests/images/Icom_IC-2300H.img +tests/images/Icom_IC-2720H.img +tests/images/Icom_IC-2730A.img +tests/images/Icom_IC-2820H.img +tests/images/Icom_IC-E90.img +tests/images/Icom_IC-P7.img +tests/images/Icom_IC-Q7A.img +tests/images/Icom_IC-T70.img +tests/images/Icom_IC-T7H.img +tests/images/Icom_IC-T8A.img +tests/images/Icom_IC-U82.img +tests/images/Icom_IC-V80.img +tests/images/Icom_IC-V82.img +tests/images/Icom_IC-V86.img +tests/images/Icom_IC-W32A.img +tests/images/Icom_IC-W32E.img +tests/images/Icom_ID-31A.img +tests/images/Icom_ID-4100.img +tests/images/Icom_ID-51.img +tests/images/Icom_ID-5100.img +tests/images/Icom_ID-51_Plus.img +tests/images/Icom_ID-51_Plus2.img +tests/images/Icom_ID-800H_v2.img +tests/images/Icom_ID-80H.img +tests/images/Icom_ID-880H.img +tests/images/Jetstream_JT220M.img +tests/images/Jetstream_JT270M.img +tests/images/Jetstream_JT270MH.img +tests/images/KYD_IP-620.img +tests/images/KYD_NC-630A.img +tests/images/Kenwood_HMK.hmk +tests/images/Kenwood_TH-D72_clone_mode.img +tests/images/Kenwood_TH-D74_clone_mode.img +tests/images/Kenwood_TK-272G.img +tests/images/Kenwood_TK-3140K.img +tests/images/Kenwood_TK-3180K2.img +tests/images/Kenwood_TK-7160K.img +tests/images/Kenwood_TK-760G.img +tests/images/Kenwood_TK-8102.img +tests/images/Kenwood_TK-8180.img +tests/images/Kenwood_TM-D710G_CloneMode.img +tests/images/Kenwood_TM-D710_CloneMode.img +tests/images/Kenwood_TS-480_CloneMode.img +tests/images/LUITON_LT-580_UHF.img +tests/images/LUITON_LT-580_VHF.img +tests/images/LUITON_LT-725UV.img +tests/images/Lanchonlh_HG-UV98.img +tests/images/Leixen_VV-898.img +tests/images/Leixen_VV-898S.img +tests/images/Midland_DBR2500.img +tests/images/Polmar_DB-50M.img +tests/images/Puxing_PX-2R.img +tests/images/Puxing_PX-777.img +tests/images/Puxing_PX-888K.img +tests/images/Q-MAC_HF-90_v300_or_earlier.img +tests/images/Q-MAC_HF-90_v301_or_later.img +tests/images/QYT_KT-8R.img +tests/images/QYT_KT-WP12.img +tests/images/QYT_KT7900D.img +tests/images/QYT_KT8900D.img +tests/images/Quansheng_TG-UV2+.img +tests/images/Quansheng_UV-K5.img +tests/images/Radioddity_GA-510.img +tests/images/Radioddity_GS-5B.img +tests/images/Radioddity_R2.img +tests/images/Radioddity_UV-5G.img +tests/images/Radtel_RT-470.img +tests/images/Radtel_RT-470L.img +tests/images/Radtel_RT-470X.img +tests/images/Radtel_T18.img +tests/images/Retevis_H777S.img +tests/images/Retevis_RA685.img +tests/images/Retevis_RA85.img +tests/images/Retevis_RB15.img +tests/images/Retevis_RB17.img +tests/images/Retevis_RB17A.img +tests/images/Retevis_RB17P.img +tests/images/Retevis_RB17V.img +tests/images/Retevis_RB18.img +tests/images/Retevis_RB19.img +tests/images/Retevis_RB19P.img +tests/images/Retevis_RB23.img +tests/images/Retevis_RB26.img +tests/images/Retevis_RB27.img +tests/images/Retevis_RB27B.img +tests/images/Retevis_RB27V.img +tests/images/Retevis_RB28.img +tests/images/Retevis_RB28B.img +tests/images/Retevis_RB29.img +tests/images/Retevis_RB615.img +tests/images/Retevis_RB617.img +tests/images/Retevis_RB618.img +tests/images/Retevis_RB619.img +tests/images/Retevis_RB627B.img +tests/images/Retevis_RB628.img +tests/images/Retevis_RB628B.img +tests/images/Retevis_RB629.img +tests/images/Retevis_RB75.img +tests/images/Retevis_RB85.img +tests/images/Retevis_RB87.img +tests/images/Retevis_RT1.img +tests/images/Retevis_RT15.img +tests/images/Retevis_RT16.img +tests/images/Retevis_RT19.img +tests/images/Retevis_RT20.img +tests/images/Retevis_RT21.img +tests/images/Retevis_RT22.img +tests/images/Retevis_RT22FRS.img +tests/images/Retevis_RT22S.img +tests/images/Retevis_RT23.img +tests/images/Retevis_RT24.img +tests/images/Retevis_RT24V.img +tests/images/Retevis_RT26.img +tests/images/Retevis_RT29_UHF.img +tests/images/Retevis_RT29_VHF.img +tests/images/Retevis_RT40B.img +tests/images/Retevis_RT47.img +tests/images/Retevis_RT47V.img +tests/images/Retevis_RT619.img +tests/images/Retevis_RT622.img +tests/images/Retevis_RT647.img +tests/images/Retevis_RT668.img +tests/images/Retevis_RT68.img +tests/images/Retevis_RT76.img +tests/images/Retevis_RT86.img +tests/images/Retevis_RT87.img +tests/images/Retevis_RT9000D_136-174.img +tests/images/Retevis_RT9000D_220-260.img +tests/images/Retevis_RT9000D_400-490.img +tests/images/Retevis_RT9000D_66-88.img +tests/images/Retevis_RT95.img +tests/images/Rugged_RH5R-V2.img +tests/images/Ruyage_UV58Plus.img +tests/images/SenhaiX_8800.img +tests/images/TDXone_TD-Q8A.img +tests/images/TIDRADIO_TD-H8-GMRS.img +tests/images/TIDRADIO_TD-H8-HAM.img +tests/images/TIDRADIO_TD-H8.img +tests/images/TYT_TH-350.img +tests/images/TYT_TH-7800.img +tests/images/TYT_TH-9800.img +tests/images/TYT_TH-UV3R-25.img +tests/images/TYT_TH-UV3R.img +tests/images/TYT_TH-UV8000.img +tests/images/TYT_TH-UV88.img +tests/images/TYT_TH-UVF1.img +tests/images/TYT_TH-UVF8D.img +tests/images/TYT_TH9000_144.img +tests/images/Talkpod_A36plus.img +tests/images/Vertex_Standard_FTL-2011.img +tests/images/Vertex_Standard_VXA-700.img +tests/images/WACCOM_MINI-8900.img +tests/images/Wouxun_KG-1000G.img +tests/images/Wouxun_KG-1000G_Plus.img +tests/images/Wouxun_KG-816.img +tests/images/Wouxun_KG-818.img +tests/images/Wouxun_KG-935G.img +tests/images/Wouxun_KG-935G_Plus.img +tests/images/Wouxun_KG-UV6.img +tests/images/Wouxun_KG-UV8D.img +tests/images/Wouxun_KG-UV8D_Plus.img +tests/images/Wouxun_KG-UV8E.img +tests/images/Wouxun_KG-UV8H.img +tests/images/Wouxun_KG-UV920P-A.img +tests/images/Wouxun_KG-UV980P.img +tests/images/Wouxun_KG-UV9D_Plus.img +tests/images/Wouxun_KG-UV9GX.img +tests/images/Wouxun_KG-UV9G_Pro.img +tests/images/Wouxun_KG-UV9K.img +tests/images/Wouxun_KG-UV9PX.img +tests/images/Wouxun_KG-UVD1P.img +tests/images/Yaesu_FT-1500M.img +tests/images/Yaesu_FT-1802M.img +tests/images/Yaesu_FT-1D_R.img +tests/images/Yaesu_FT-25R.img +tests/images/Yaesu_FT-2800M.img +tests/images/Yaesu_FT-2900R_1900R.img +tests/images/Yaesu_FT-450D.img +tests/images/Yaesu_FT-4VR.img +tests/images/Yaesu_FT-4XE.img +tests/images/Yaesu_FT-4XR.img +tests/images/Yaesu_FT-50.img +tests/images/Yaesu_FT-60.img +tests/images/Yaesu_FT-65E.img +tests/images/Yaesu_FT-65R.img +tests/images/Yaesu_FT-70D.img +tests/images/Yaesu_FT-7100M.img +tests/images/Yaesu_FT-7800_7900.img +tests/images/Yaesu_FT-817.img +tests/images/Yaesu_FT-817ND.img +tests/images/Yaesu_FT-817ND_US.img +tests/images/Yaesu_FT-818.img +tests/images/Yaesu_FT-857_897.img +tests/images/Yaesu_FT-857_897_US.img +tests/images/Yaesu_FT-8800.img +tests/images/Yaesu_FT-8900.img +tests/images/Yaesu_FT-90.img +tests/images/Yaesu_FT2D_R.img +tests/images/Yaesu_FT3D_R.img +tests/images/Yaesu_FTM-3200D_R.img +tests/images/Yaesu_FTM-350.img +tests/images/Yaesu_FTM-7250D_R.img +tests/images/Yaesu_VX-2.img +tests/images/Yaesu_VX-3.img +tests/images/Yaesu_VX-5.img +tests/images/Yaesu_VX-6.img +tests/images/Yaesu_VX-7.img +tests/images/Yaesu_VX-8DR.img +tests/images/Yaesu_VX-8GE.img +tests/images/Yaesu_VX-8R.img +tests/unit/__init__.py +tests/unit/base.py +tests/unit/rb-united_states-oregon.json +tests/unit/test_alinco_clone.py +tests/unit/test_bandplan.py +tests/unit/test_baofeng_fmradio.py +tests/unit/test_bitwise.py +tests/unit/test_chirp_common.py +tests/unit/test_cli.py +tests/unit/test_csv.py +tests/unit/test_directory.py +tests/unit/test_icf.py +tests/unit/test_icom_clone.py +tests/unit/test_import_logic.py +tests/unit/test_kguv8d.py +tests/unit/test_kguv920.py +tests/unit/test_mappingmodel.py +tests/unit/test_network_sources.py +tests/unit/test_repeaterbook.py +tests/unit/test_settings.py +tests/unit/test_th9800.py +tests/unit/test_util.py +tests/unit/test_wxui_radiothread.py +tests/unit/test_yaesu_clone.py +tests/unit/__pycache__/__init__.cpython-310.pyc +tests/unit/__pycache__/base.cpython-310.pyc +tests/unit/__pycache__/test_alinco_clone.cpython-310-pytest-7.1.3.pyc +tests/unit/__pycache__/test_bandplan.cpython-310-pytest-7.1.3.pyc +tests/unit/__pycache__/test_baofeng_fmradio.cpython-310-pytest-7.1.3.pyc +tests/unit/__pycache__/test_bitwise.cpython-310-pytest-7.1.3.pyc +tests/unit/__pycache__/test_chirp_common.cpython-310-pytest-7.1.3.pyc +tests/unit/__pycache__/test_cli.cpython-310-pytest-7.1.3.pyc +tests/unit/__pycache__/test_csv.cpython-310-pytest-7.1.3.pyc +tests/unit/__pycache__/test_directory.cpython-310-pytest-7.1.3.pyc +tests/unit/__pycache__/test_icf.cpython-310-pytest-7.1.3.pyc +tests/unit/__pycache__/test_icom_clone.cpython-310-pytest-7.1.3.pyc +tests/unit/__pycache__/test_import_logic.cpython-310-pytest-7.1.3.pyc +tests/unit/__pycache__/test_kguv8d.cpython-310-pytest-7.1.3.pyc +tests/unit/__pycache__/test_kguv920.cpython-310-pytest-7.1.3.pyc +tests/unit/__pycache__/test_mappingmodel.cpython-310-pytest-7.1.3.pyc +tests/unit/__pycache__/test_network_sources.cpython-310-pytest-7.1.3.pyc +tests/unit/__pycache__/test_repeaterbook.cpython-310-pytest-7.1.3.pyc +tests/unit/__pycache__/test_settings.cpython-310-pytest-7.1.3.pyc +tests/unit/__pycache__/test_th9800.cpython-310-pytest-7.1.3.pyc +tests/unit/__pycache__/test_util.cpython-310-pytest-7.1.3.pyc +tests/unit/__pycache__/test_wxui_radiothread.cpython-310-pytest-7.1.3.pyc +tests/unit/__pycache__/test_yaesu_clone.cpython-310-pytest-7.1.3.pyc +tools/Makefile +tools/check_commit.sh +tools/check_for_bug.sh +tools/checkpatch.sh +tools/cpep8.blacklist +tools/cpep8.exceptions +tools/cpep8.manifest +tools/cpep8.py +tools/fast-driver.py +tools/icomsio.sh +tools/py3_driver_progress.py +tools/serialsniff.c \ No newline at end of file diff --git a/chirp.egg-info/dependency_links.txt b/chirp.egg-info/dependency_links.txt new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/chirp.egg-info/dependency_links.txt @@ -0,0 +1 @@ + diff --git a/chirp.egg-info/entry_points.txt b/chirp.egg-info/entry_points.txt new file mode 100644 index 0000000..f0f50af --- /dev/null +++ b/chirp.egg-info/entry_points.txt @@ -0,0 +1,3 @@ +[console_scripts] +chirp = chirp.wxui:chirpmain +chirpc = chirp.cli.main:main diff --git a/chirp.egg-info/requires.txt b/chirp.egg-info/requires.txt new file mode 100644 index 0000000..03fb3aa --- /dev/null +++ b/chirp.egg-info/requires.txt @@ -0,0 +1,11 @@ +pyserial +requests +six +future +yattag + +[:python_version < "3.10"] +importlib-resources + +[wx] +wxPython diff --git a/chirp.egg-info/top_level.txt b/chirp.egg-info/top_level.txt new file mode 100644 index 0000000..97b1c6f --- /dev/null +++ b/chirp.egg-info/top_level.txt @@ -0,0 +1 @@ +chirp diff --git a/chirp/__init__.py b/chirp/__init__.py index 7b48821..b60d59b 100644 --- a/chirp/__init__.py +++ b/chirp/__init__.py @@ -1,27 +1 @@ -# Copyright 2008 Dan Smith -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -import os -import sys -from glob import glob - -CHIRP_VERSION = "0.3.0dev" - -module_dir = os.path.dirname(sys.modules["chirp"].__file__) -__all__ = [] -for i in glob(os.path.join(module_dir, "*.py")): - name = os.path.basename(i)[:-3] - if not name.startswith("__"): - __all__.append(name) +CHIRP_VERSION = "next-20231016" diff --git a/chirp/bandplan.py b/chirp/bandplan.py index 21b3661..6a38424 100644 --- a/chirp/bandplan.py +++ b/chirp/bandplan.py @@ -114,11 +114,6 @@ class BandPlans(object): rpt_inputs = [] for band in plan.BANDS: - # Check for duplicates. - duplicates = [x for x in plan.BANDS if x == band] - if len(duplicates) > 1: - LOG.info("Bandplan %s has duplicates %s" % - (name, duplicates)) # Add repeater inputs. rpt_input = band.inverse() if rpt_input not in plan.BANDS: @@ -152,3 +147,35 @@ class BandPlans(object): break return result + + def get_enabled_plan(self): + for shortname, details in self.plans.items(): + if self._config.get_bool(shortname, "bandplan"): + return details[1] + + def get_repeater_bands(self): + bands_with_repeaters = [] + current_plan = self.get_enabled_plan() + + # For now, assume anything above 28 MHz could have a repeater. + # Alternately, we could scan for bands with repeater sub-bands and only + # include those. + min_freq = chirp_common.to_MHz(28) + + def add_nodupes(b): + for existing in bands_with_repeaters: + if b.name == existing.name: + if sum(b.limits) < sum(existing.limits): + # Don't add, this is smaller + return + else: + bands_with_repeaters.remove(existing) + break + bands_with_repeaters.append(b) + + for band in current_plan.bands: + if (band.limits[0] >= min_freq and + band.name.lower().endswith('meter band')): + add_nodupes(band) + return sorted(bands_with_repeaters, + key=lambda b: b.limits[0]) diff --git a/chirp/bandplan_iaru_r1.py b/chirp/bandplan_iaru_r1.py index e41b0ee..c0f39ae 100644 --- a/chirp/bandplan_iaru_r1.py +++ b/chirp/bandplan_iaru_r1.py @@ -27,7 +27,7 @@ DESC = { # Bands are broken up like this so that other plans can import bits. BANDS_2100M = ( - bandplan.Band((135700, 137800), "137khz Band", mode="CW"), + bandplan.Band((135700, 137800), "137 kHz Band", mode="CW"), ) BANDS_160M = ( @@ -145,3 +145,10 @@ BANDS_10M = ( BANDS = BANDS_2100M + BANDS_160M + BANDS_80M + BANDS_40M + BANDS_30M BANDS = BANDS + BANDS_20M + BANDS_17M + BANDS_15M + BANDS_12M + BANDS_10M + + +# EU Analogue/DMR PMR446 Frequencies +PMR446_FREQS = [446006250, 446018750, 446031250, 446043750, + 446056250, 446068750, 446081250, 446093750, + 446106250, 446118750, 446131250, 446143750, + 446156250, 446168750, 446181250, 446193750] diff --git a/chirp/bandplan_iaru_r3.py b/chirp/bandplan_iaru_r3.py index 08bb56e..582bd8a 100644 --- a/chirp/bandplan_iaru_r3.py +++ b/chirp/bandplan_iaru_r3.py @@ -26,7 +26,7 @@ DESC = { # Bands are broken up like this so that other plans can import bits. BANDS_2100M = ( - bandplan.Band((135700, 137800), "137khz Band", mode="CW"), + bandplan.Band((135700, 137800), "137 kHz Band", mode="CW"), ) BANDS_160M = ( diff --git a/chirp/bandplan_na.py b/chirp/bandplan_na.py index 0ddc781..ba32aa5 100644 --- a/chirp/bandplan_na.py +++ b/chirp/bandplan_na.py @@ -143,7 +143,7 @@ BANDS_2M = ( ) BANDS_1_25M = ( - bandplan.Band((222000000, 225000000), "1.25 Meters"), + bandplan.Band((222000000, 225000000), "1.25 Meter Band"), bandplan.Band((222000000, 222150000), "Weak-signal modes"), bandplan.Band((222000000, 222025000), "EME"), bandplan.Band((222050000, 222060000), "Propagation beacons"), @@ -158,7 +158,7 @@ BANDS_1_25M = ( ) BANDS_70CM = ( - bandplan.Band((420000000, 450000000), "70cm Band"), + bandplan.Band((420000000, 450000000), "70 Centimeter Band"), bandplan.Band((420000000, 426000000), "ATV repeater or simplex"), bandplan.Band((426000000, 432000000), "ATV simplex"), bandplan.Band((432000000, 432070000), "EME (Earth-Moon-Earth)"), @@ -235,17 +235,17 @@ BANDS_13CM = ( bandplan.Band((2300000000, 2450000000), "13 Centimeter Band"), bandplan.Band((2300000000, 2303000000), "Analog & Digital 0.05-1.0 MHz, " "including full duplex; paired with 2390-2393"), - bandplan.Band((2303000000, 2303750000), "Analog & Digital <50kHz; " + bandplan.Band((2303000000, 2303750000), "Analog & Digital <50 kHz; " "paired with 2393 - 2393.750"), bandplan.Band((2303750000, 2304000000), "SSB, CW, digital weak-signal"), - bandplan.Band((2304000000, 2304100000), "Weak Signal EME Band, <3kHz"), + bandplan.Band((2304000000, 2304100000), "Weak Signal EME Band, <3 kHz"), bandplan.Band((2304100000, 2304300000), - "SSB, CW, digital weak-signal, <3kHz"), - bandplan.Band((2304300000, 2304400000), "Beacons, <3kHz"), + "SSB, CW, digital weak-signal, <3 kHz"), + bandplan.Band((2304300000, 2304400000), "Beacons, <3 kHz"), bandplan.Band((2304400000, 2304750000), "SSB, CW, digital weak-signal and " - "NBFM, <6kHz"), + "NBFM, <6 kHz"), bandplan.Band((2304750000, 2305000000), "Analog & Digital; paired with " - "2394.750-2395, <50kHz"), + "2394.750-2395, <50 kHz"), bandplan.Band((2305000000, 2310000000), "Analog & Digital, paired with " "2395-2400, 0.05 - 1.0 MHz"), bandplan.Band((2310000000, 2390000000), "NON-AMATEUR"), @@ -259,8 +259,8 @@ BANDS_13CM = ( bandplan.Band((2395000000, 2400000000), "Analog & Digital, including full " "duplex; paired with 2305-2310, 0.05-1.0 MHz"), bandplan.Band((2400000000, 2410000000), "Amateur Satellite Communications, " - "<6kHz"), - bandplan.Band((2410000000, 2450000000), "Broadband Modes, 22MHz max."), + "<6 kHz"), + bandplan.Band((2410000000, 2450000000), "Broadband Modes, 22 MHz max."), ) BANDS = bandplan_iaru_r2.BANDS @@ -268,3 +268,19 @@ BANDS += BANDS_160M + BANDS_80M + BANDS_40M + BANDS_30M + BANDS_20M BANDS += BANDS_17M + BANDS_15M + BANDS_12M + BANDS_10M + BANDS_6M BANDS += BANDS_2M + BANDS_1_25M + BANDS_70CM + BANDS_33CM + BANDS_23CM BANDS += BANDS_13CM + + +# US 2017+ GMRS/FRS Frequencies +GMRS_LOW = [462562500, 462587500, 462612500, 462637500, 462662500, + 462687500, 462712500] +GMRS_HHONLY = [467562500, 467587500, 467612500, 467637500, 467662500, + 467687500, 467712500] +GMRS_HIRPT = [462550000, 462575000, 462600000, 462625000, 462650000, + 462675000, 462700000, 462725000] +ALL_GMRS_FREQS = GMRS_LOW + GMRS_HHONLY + GMRS_HIRPT + + +# US MURS Frequencies +MURS_NFM = [151820000, 151880000, 151940000] +MURS_FM = [154570000, 154600000] +ALL_MURS_FREQS = MURS_NFM + MURS_FM diff --git a/chirp/bitwise.py b/chirp/bitwise.py index 39fc852..f004449 100644 --- a/chirp/bitwise.py +++ b/chirp/bitwise.py @@ -198,10 +198,10 @@ class DataElement: self._count = count def size(self): - return self._size * 8 + return int(self._size * 8) def get_offset(self): - return self._offset + return int(self._offset) def _get_value(self, data): raise Exception("Not implemented") @@ -282,7 +282,7 @@ class arrayDataElement(DataElement): # NOTE: All the values should be strings coming out of py3. # and on py2 they could be a mix of unicode and str, the latter # for non-ASCII values. On py2 we can just coerce all of these - # types to a string for compatbility. + # types to a string for compatibility. return "".join([str(x.get_value()) for x in self.__items]) else: return str(self.__items) @@ -354,7 +354,7 @@ class arrayDataElement(DataElement): size = 0 for i in self.__items: size += i.size() - return size + return int(size) class intDataElement(DataElement): @@ -715,7 +715,7 @@ class bitDataElement(intDataElement): self._subgen(self._data, self._offset).set_value(value) def size(self): - return self._nbits + return int(self._nbits) class structDataElement(DataElement): @@ -790,7 +790,7 @@ class structDataElement(DataElement): for el in gen: i += 1 size += el.size() - return size + return int(size) def get_raw(self, asbytes=False): size = self.size() // 8 @@ -989,6 +989,7 @@ def parse(spec, data, offset=0): p = Processor(data, offset) return p.parse(ast) + if __name__ == "__main__": defn = """ struct mytype { u8 foo; }; diff --git a/chirp/chirp_common.py b/chirp/chirp_common.py index 6b057ec..3b81cc2 100644 --- a/chirp/chirp_common.py +++ b/chirp/chirp_common.py @@ -18,8 +18,10 @@ from future import standard_library import base64 import json +import inspect import logging import math +import re import sys from chirp import errors, memmap, CHIRP_VERSION @@ -29,25 +31,29 @@ LOG = logging.getLogger(__name__) SEPCHAR = "," # 50 Tones -TONES = [67.0, 69.3, 71.9, 74.4, 77.0, 79.7, 82.5, - 85.4, 88.5, 91.5, 94.8, 97.4, 100.0, 103.5, - 107.2, 110.9, 114.8, 118.8, 123.0, 127.3, - 131.8, 136.5, 141.3, 146.2, 151.4, 156.7, - 159.8, 162.2, 165.5, 167.9, 171.3, 173.8, - 177.3, 179.9, 183.5, 186.2, 189.9, 192.8, - 196.6, 199.5, 203.5, 206.5, 210.7, 218.1, - 225.7, 229.1, 233.6, 241.8, 250.3, 254.1, - ] - -TONES_EXTRA = [56.0, 57.0, 58.0, 59.0, 60.0, 61.0, 62.0, - 62.5, 63.0, 64.0] +TONES = ( + 67.0, 69.3, 71.9, 74.4, 77.0, 79.7, 82.5, + 85.4, 88.5, 91.5, 94.8, 97.4, 100.0, 103.5, + 107.2, 110.9, 114.8, 118.8, 123.0, 127.3, + 131.8, 136.5, 141.3, 146.2, 151.4, 156.7, + 159.8, 162.2, 165.5, 167.9, 171.3, 173.8, + 177.3, 179.9, 183.5, 186.2, 189.9, 192.8, + 196.6, 199.5, 203.5, 206.5, 210.7, 218.1, + 225.7, 229.1, 233.6, 241.8, 250.3, 254.1, +) OLD_TONES = list(TONES) [OLD_TONES.remove(x) for x in [159.8, 165.5, 171.3, 177.3, 183.5, 189.9, 196.6, 199.5, 206.5, 229.1, 254.1]] +OLD_TONES = tuple(OLD_TONES) + + +def VALIDTONE(v): + return isinstance(v, float) and 50 < v < 300 + # 104 DTCS Codes -DTCS_CODES = [ +DTCS_CODES = ( 23, 25, 26, 31, 32, 36, 43, 47, 51, 53, 54, 65, 71, 72, 73, 74, 114, 115, 116, 122, 125, 131, 132, 134, 143, 145, 152, 155, 156, 162, 165, 172, 174, @@ -58,7 +64,7 @@ DTCS_CODES = [ 465, 466, 503, 506, 516, 523, 526, 532, 546, 565, 606, 612, 624, 627, 631, 632, 654, 662, 664, 703, 712, 723, 731, 732, 734, 743, 754, -] +) # 512 Possible DTCS Codes ALL_DTCS_CODES = [] @@ -66,8 +72,9 @@ for a in range(0, 8): for b in range(0, 8): for c in range(0, 8): ALL_DTCS_CODES.append((a * 100) + (b * 10) + c) +ALL_DTCS_CODES = tuple(ALL_DTCS_CODES) -CROSS_MODES = [ +CROSS_MODES = ( "Tone->Tone", "DTCS->", "->DTCS", @@ -76,13 +83,13 @@ CROSS_MODES = [ "->Tone", "DTCS->DTCS", "Tone->" -] +) -MODES = ["WFM", "FM", "NFM", "AM", "NAM", "DV", "USB", "LSB", "CW", "RTTY", +MODES = ("WFM", "FM", "NFM", "AM", "NAM", "DV", "USB", "LSB", "CW", "RTTY", "DIG", "PKT", "NCW", "NCWR", "CWR", "P25", "Auto", "RTTYR", - "FSK", "FSKR", "DMR"] + "FSK", "FSKR", "DMR", "DN") -TONE_MODES = [ +TONE_MODES = ( "", "Tone", "TSQL", @@ -90,24 +97,28 @@ TONE_MODES = [ "DTCS-R", "TSQL-R", "Cross", -] +) -TUNING_STEPS = [ +TUNING_STEPS = ( 5.0, 6.25, 10.0, 12.5, 15.0, 20.0, 25.0, 30.0, 50.0, 100.0, 125.0, 200.0, # Need to fix drivers using this list as an index! 9.0, 1.0, 2.5, -] -# These are the default for RadioFeatures.valid_tuning_steps -COMMON_TUNING_STEPS = [5.0, 10.0, 15.0, 20.0, 25.0, 30.0, 50.0, 100.0] +) +# These are the default for RadioFeatures.valid_tuning_steps +COMMON_TUNING_STEPS = (5.0, 10.0, 15.0, 20.0, 25.0, 30.0, 50.0, 100.0) -SKIP_VALUES = ["", "S", "P"] +SKIP_VALUES = ("", "S", "P") CHARSET_UPPER_NUMERIC = "ABCDEFGHIJKLMNOPQRSTUVWXYZ 1234567890" CHARSET_ALPHANUMERIC = \ "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz 1234567890" CHARSET_ASCII = "".join([chr(x) for x in range(ord(" "), ord("~") + 1)]) +CHARSET_1252 = bytes( + [x for x in range(0x20, 0x100) + if x not in [0x7F, 0x81, 0x8D, 0x8F, 0x90, 0x9D, 0xA0, 0xAD]] +).decode('cp1252') # http://aprs.org/aprs11/SSIDs.txt APRS_SSID = ( @@ -158,12 +169,12 @@ APRS_SYMBOLS = ( def watts_to_dBm(watts): """Converts @watts in watts to dBm""" - return int(10 * math.log10(int(watts * 1000))) + return 10 * math.log10(watts) + 30 def dBm_to_watts(dBm): """Converts @dBm from dBm to watts""" - return int(math.pow(10, (dBm - 30) / 10)) + return round(math.pow(10, dBm / 10) / 1000, 1) class PowerLevel: @@ -172,31 +183,34 @@ class PowerLevel: def __init__(self, label, watts=0, dBm=0): if watts: dBm = watts_to_dBm(watts) - self._power = int(dBm) + self._power = float(dBm) self._label = label def __str__(self): return str(self._label) def __int__(self): + return int(self._power) + + def __float__(self): return self._power def __sub__(self, val): - return int(self) - int(val) + return float(self) - float(val) def __add__(self, val): - return int(self) + int(val) + return float(self) + float(val) def __eq__(self, val): if val is not None: - return int(self) == int(val) + return float(self) == float(val) return False def __lt__(self, val): - return int(self) < int(val) + return float(self) < float(val) def __gt__(self, val): - return int(self) > int(val) + return float(self) > float(val) def __bool__(self): return int(self) != 0 @@ -205,6 +219,30 @@ class PowerLevel: return "%s (%i dBm)" % (self._label, self._power) +class AutoNamedPowerLevel(PowerLevel): + """A power level that is simply named by its value in watts""" + + def __init__(self, watts): + fmt = ('%iW' if watts >= 10 else '%.1fW') + super().__init__(fmt % watts, watts=watts) + + +def parse_power(powerstr): + if powerstr.isdigit(): + # All digits means watts + watts = int(powerstr) + else: + match = re.match(r'^\s*([0-9.]+)\s*([Ww]?)\s*$', powerstr) + if not match: + raise ValueError('Invalid power specification: %r' % powerstr) + if match.group(2).lower() in ('', 'w'): + watts = float(match.group(1)) + else: + raise ValueError('Unknown power units in %r' % powerstr) + + return AutoNamedPowerLevel(watts) + + def parse_freq(freqstr): """Parse a frequency string and return the value in integral Hz""" freqstr = freqstr.strip() @@ -299,8 +337,8 @@ class Memory: self.immutable = [] _valid_map = { - "rtone": TONES + TONES_EXTRA, - "ctone": TONES + TONES_EXTRA, + "rtone": VALIDTONE, + "ctone": VALIDTONE, "dtcs": ALL_DTCS_CODES, "rx_dtcs": ALL_DTCS_CODES, "tmode": TONE_MODES, @@ -314,7 +352,7 @@ class Memory: } def __repr__(self): - return "Memory[%i]" % self.number + return str(self) def dupe(self): """Return a deep copy of @self""" @@ -332,8 +370,10 @@ class Memory: CSV_FORMAT = ["Location", "Name", "Frequency", "Duplex", "Offset", "Tone", "rToneFreq", "cToneFreq", "DtcsCode", - "DtcsPolarity", "Mode", "TStep", - "Skip", "Comment", + "DtcsPolarity", "RxDtcsCode", + "CrossMode", + "Mode", "TStep", + "Skip", "Power", "Comment", "URCALL", "RPT1CALL", "RPT2CALL", "DVCODE"] def __setattr__(self, name, val): @@ -344,9 +384,15 @@ class Memory: raise ImmutableValueError("Field %s is not " % name + "mutable on this memory") - if name in self._valid_map and val not in self._valid_map[name]: - raise ValueError("`%s' is not in valid list: %s" % - (val, self._valid_map[name])) + if name in self._valid_map: + valid = self._valid_map[name] + if callable(valid): + if not valid(val): + raise ValueError("`%s' is not a valid value for `%s'" % ( + val, name)) + elif val not in self._valid_map[name]: + raise ValueError("`%s' is not in valid list: %s" % + (val, self._valid_map[name])) self.__dict__[name] = val @@ -410,9 +456,12 @@ class Memory: "%.1f" % self.ctone, "%03i" % self.dtcs, "%s" % self.dtcs_polarity, + "%03i" % self.rx_dtcs, + "%s" % self.cross_mode, "%s" % self.mode, "%.2f" % self.tuning_step, "%s" % self.skip, + "%s" % self.power, "%s" % self.comment, "", "", "", ""] @@ -439,7 +488,7 @@ class Memory: """Careful parsing of split-out @vals""" try: self.number = int(vals[0]) - except: + except Exception: raise errors.InvalidDataError( "Location '%s' is not a valid integer" % vals[0]) @@ -447,7 +496,7 @@ class Memory: try: self.freq = float(vals[2]) - except: + except Exception: raise errors.InvalidDataError("Frequency is not a valid number") if vals[3].strip() in ["+", "-", ""]: @@ -457,7 +506,7 @@ class Memory: try: self.offset = float(vals[4]) - except: + except Exception: raise errors.InvalidDataError("Offset is not a valid number") self.tmode = vals[5] @@ -467,28 +516,28 @@ class Memory: try: self.rtone = float(vals[6]) - except: + except Exception: raise errors.InvalidDataError("rTone is not a valid number") if self.rtone not in TONES: raise errors.InvalidDataError("rTone is not valid") try: self.ctone = float(vals[7]) - except: + except Exception: raise errors.InvalidDataError("cTone is not a valid number") if self.ctone not in TONES: raise errors.InvalidDataError("cTone is not valid") try: self.dtcs = int(vals[8], 10) - except: + except Exception: raise errors.InvalidDataError("DTCS code is not a valid number") if self.dtcs not in DTCS_CODES: raise errors.InvalidDataError("DTCS code is not valid") try: self.rx_dtcs = int(vals[8], 10) - except: + except Exception: raise errors.InvalidDataError("DTCS Rx code is not a valid number") if self.rx_dtcs not in DTCS_CODES: raise errors.InvalidDataError("DTCS Rx code is not valid") @@ -505,12 +554,12 @@ class Memory: try: self.tuning_step = float(vals[11]) - except: + except Exception: raise errors.InvalidDataError("Tuning step is invalid") try: self.skip = vals[12] - except: + except Exception: raise errors.InvalidDataError("Skip value is not valid") return True @@ -565,6 +614,38 @@ class DVMemory(Memory): self.dv_code = 0 +def FrozenMemory(source): + class _FrozenMemory(source.__class__): + def __init__(self, source): + self.__dict__['_frozen'] = False + for k, v in source.__dict__.items(): + if k == '_frozen': + continue + setattr(self, k, v) + + self.__dict__['_frozen'] = True + + def __setattr__(self, k, v): + if self._frozen: + # This should really be an error, but we have a number of + # drivers that make modifications during set_memory(). So this + # just has to be a warning for now. Later it could turn into + # a TypeError. + caller = inspect.getframeinfo(inspect.stack()[1][0]) + LOG.warning( + '%s@%i: Illegal set on attribute %s - Fix this driver!' % ( + caller.filename, caller.lineno, k)) + super().__setattr__(k, v) + + def dupe(self): + m = Memory() + m.clone(self) + delattr(m, '_frozen') + return m + + return _FrozenMemory(source) + + class MemoryMapping(object): """Base class for a memory mapping""" @@ -695,7 +776,37 @@ class RadioPrompts: display_pre_upload_prompt_before_opening_port = True -BOOLEAN = [True, False] +def BOOLEAN(v): + assert v in (True, False) + + +def LIST(v): + assert hasattr(v, '__iter__') + + +def INT(min=0, max=None): + def checkint(v): + assert isinstance(v, int) + assert v >= min + if max is not None: + assert v <= max + + return checkint + + +def STRING(v): + assert isinstance(v, str) + + +def NTUPLE(size): + def checktuple(v): + assert len(v) == size + + return checktuple + + +def TONELIST(v): + assert all(VALIDTONE(x) for x in v) class RadioFeatures: @@ -718,24 +829,26 @@ class RadioFeatures: "has_nostep_tuning": BOOLEAN, "has_comment": BOOLEAN, "has_settings": BOOLEAN, + "has_variable_power": BOOLEAN, # Attributes - "valid_modes": [], - "valid_tmodes": [], - "valid_duplexes": [], - "valid_tuning_steps": [], - "valid_bands": [], - "valid_skips": [], - "valid_power_levels": [], - "valid_characters": "", - "valid_name_length": 0, - "valid_cross_modes": [], - "valid_dtcs_pols": [], - "valid_dtcs_codes": [], - "valid_special_chans": [], + "valid_modes": LIST, + "valid_tmodes": LIST, + "valid_duplexes": LIST, + "valid_tuning_steps": LIST, + "valid_bands": LIST, + "valid_skips": LIST, + "valid_power_levels": LIST, + "valid_characters": STRING, + "valid_name_length": INT(), + "valid_cross_modes": LIST, + "valid_tones": TONELIST, + "valid_dtcs_pols": LIST, + "valid_dtcs_codes": LIST, + "valid_special_chans": LIST, "has_sub_devices": BOOLEAN, - "memory_bounds": (0, 0), + "memory_bounds": NTUPLE(2), "can_odd_split": BOOLEAN, "can_delete": BOOLEAN, @@ -751,28 +864,12 @@ class RadioFeatures: elif name not in list(self._valid_map.keys()): raise ValueError("No such attribute `%s'" % name) - if type(self._valid_map[name]) == tuple: - # Tuple, cardinality must match - if type(val) != tuple or len(val) != len(self._valid_map[name]): - raise ValueError("Invalid value `%s' for attribute `%s'" % - (val, name)) - elif type(self._valid_map[name]) == list and not self._valid_map[name]: - # Empty list, must be another list - if type(val) != list: - raise ValueError("Invalid value `%s' for attribute `%s'" % - (val, name)) - elif type(self._valid_map[name]) == str: - if type(val) != str: - raise ValueError("Invalid value `%s' for attribute `%s'" % - (val, name)) - elif type(self._valid_map[name]) == int: - if type(val) != int: - raise ValueError("Invalid value `%s' for attribute `%s'" % - (val, name)) - elif val not in self._valid_map[name]: - # Value not in the list of valid values - raise ValueError("Invalid value `%s' for attribute `%s'" % (val, - name)) + try: + self._valid_map[name](val) + except AssertionError: + raise ValueError('Invalid value %r for attribute %r' % ( + val, name)) + self.__dict__[name] = val def __getattr__(self, name): @@ -829,6 +926,9 @@ class RadioFeatures: "with each memory") self.init("has_settings", False, "Indicates that the radio supports general settings") + self.init("has_variable_power", False, + "Indicates the radio supports any power level between the " + "min and max in valid_power_levels") self.init("valid_modes", list(MODES), "Supported emission (or receive) modes") @@ -851,6 +951,8 @@ class RadioFeatures: "alphanumeric tag") self.init("valid_cross_modes", list(CROSS_MODES), "Supported tone cross modes") + self.init("valid_tones", list(TONES), + "Support Tones") self.init("valid_dtcs_pols", ["NN", "RN", "NR", "RR"], "Supported DTCS polarities") self.init("valid_dtcs_codes", list(DTCS_CODES), @@ -884,7 +986,7 @@ class RadioFeatures: return self.__dict__[name] def validate_memory(self, mem): - """Return a list of warnings and errors that will be encoundered + """Return a list of warnings and errors that will be encountered if trying to set @mem on the current radio""" msgs = [] @@ -912,6 +1014,13 @@ class RadioFeatures: mem.cross_mode) msgs.append(msg) + if self.valid_tones and mem.rtone not in self.valid_tones: + msg = ValidationError("Tone %.1f not supported" % mem.rtone) + msgs.append(msg) + if self.valid_tones and mem.ctone not in self.valid_tones: + msg = ValidationError("Tone %.1f not supported" % mem.ctone) + msgs.append(msg) + if self.has_dtcs_polarity and \ mem.dtcs_polarity not in self.valid_dtcs_pols: msg = ValidationError("DTCS Polarity %s not supported" % @@ -921,9 +1030,11 @@ class RadioFeatures: if self.valid_dtcs_codes and \ mem.dtcs not in self.valid_dtcs_codes: msg = ValidationError("DTCS Code %03i not supported" % mem.dtcs) + msgs.append(msg) if self.valid_dtcs_codes and \ mem.rx_dtcs not in self.valid_dtcs_codes: msg = ValidationError("DTCS Code %03i not supported" % mem.rx_dtcs) + msgs.append(msg) if self.valid_duplexes and mem.duplex not in self.valid_duplexes: msg = ValidationError("Duplex %s not supported" % mem.duplex) @@ -967,21 +1078,24 @@ class RadioFeatures: "of supported range").format(freq=format_freq(freq))) msgs.append(msg) - if mem.power and \ - self.valid_power_levels and \ - mem.power not in self.valid_power_levels: - msg = ValidationWarning("Power level %s not supported" % mem.power) - msgs.append(msg) + if mem.power and self.valid_power_levels: + if self.has_variable_power: + if (mem.power < min(self.valid_power_levels) or + mem.power > max(self.valid_power_levels)): + msg = ValidationWarning( + "Power level %s is out of radio's range" % mem.power) + msgs.append(msg) + else: + if mem.power not in self.valid_power_levels: + msg = ValidationWarning( + "Power level %s not supported" % mem.power) + msgs.append(msg) if self.valid_tuning_steps and not self.has_nostep_tuning: try: - step = required_step(mem.freq) - if step not in self.valid_tuning_steps: - msg = ValidationError("Frequency requires %.2fkHz step" % - required_step(mem.freq)) - msgs.append(msg) + required_step(mem.freq, self.valid_tuning_steps) except errors.InvalidDataError as e: - msgs.append(str(e)) + msgs.append(ValidationError(e)) if self.valid_characters: for char in mem.name: @@ -1009,6 +1123,12 @@ class ValidationError(ValidationMessage): pass +def split_validation_msgs(msgs): + """Split a list of msgs into warnings,errors""" + return ([x for x in msgs if isinstance(x, ValidationWarning)], + [x for x in msgs if isinstance(x, ValidationError)]) + + class Alias(object): VENDOR = "Unknown" MODEL = "Unknown" @@ -1018,9 +1138,15 @@ class Alias(object): class Radio(Alias): """Base class for all Radio drivers""" BAUD_RATE = 9600 + # Whether or not we should use RTS/CTS flow control HARDWARE_FLOW = False + # Whether or not we should assert DTR when opening the serial port + WANTS_DTR = True + # Whether or not we should assert RTS when opening the serial port + WANTS_RTS = True ALIASES = [] NEEDS_COMPAT_SERIAL = True + FORMATS = [] def status_fn(self, status): """Deliver @status to the UI""" @@ -1049,7 +1175,17 @@ class Radio(Alias): self.pipe = pipe def get_memory(self, number): - """Return a Memory object for the memory at location @number""" + """Return a Memory object for the memory at location @number + + Constructs and returns a generic Memory object for the given location + in the radio's memory. The memory should accurately represent what is + actually stored in the radio as closely as possible. If the radio + does not support changing some attributes of the location in question, + the Memory.immutable list should be set appropriately. + + NB: No changes to the radio's memory should occur as a result of + calling get_memory(). + """ pass def erase_memory(self, number): @@ -1064,7 +1200,16 @@ class Radio(Alias): pass def set_memory(self, memory): - """Set the memory object @memory""" + """Set the memory object @memory + + This method should copy generic attributes from @memory to the + radio's memory. It should not modify @memory and it should reproduce + the generic attributes on @memory in the radio's memory as faithfully + as the radio allows. Attributes that can't be copied exactly should + be warned in validate_memory() with ValidationWarnings if a + substitution will be made, or ValidationError if truly incompatible. + In the latter case, set_memory() will not be called. + """ pass def get_mapping_models(self): @@ -1095,7 +1240,7 @@ class Radio(Alias): return [] def validate_memory(self, mem): - """Return a list of warnings and errors that will be encoundered + """Return a list of warnings and errors that will be encountered if trying to set @mem on the current radio""" rf = self.get_features() return rf.validate_memory(mem) @@ -1116,17 +1261,146 @@ class Radio(Alias): should be True and get_settings() must be implemented as well.""" pass + @classmethod + def supports_format(cls, fmt): + """Returns true if file format @fmt is supported by this radio. + + This really should not be overridden by implementations + without a good reason (like excluding one). + """ + return fmt in cls.FORMATS + + def check_set_memory_immutable_policy(self, existing, new): + """Checks whether or not a new memory will violate policy. + + Some radios have complex requirements for which fields of which + memories can be modified at any given point. For the most part, radios + require certain physical memory slots to have immutable fields + (such as labels on call channels), and this default implementation + checks that policy. However, other radios have more fine-grained + rules in order to comply with FCC type acceptance, which requires + overriding this behavior. + + ** This should almost never be overridden in your driver. + + ** This must not communicate with the radio, if implemented on a live- + mode driver. + """ + for field in existing.immutable: + if getattr(existing, field) != getattr(new, field): + raise ImmutableValueError( + 'Field %s is not mutable on this memory' % field) + + +class ExternalMemoryProperties: + """A mixin class that provides external memory property support. + + This is for use by drivers that have some way of storing additional + memory properties externally (i.e. in metadata or a separate region) + that cannot be loaded/updated during get_memory()/set_memory(). + Implementing this is much less ideal than supporting those properties + directly, so this should only be used when absolutely necessary. + """ + + def get_memory_extra(self, memory): + """Update @memory with extra fields. + + This is called after get_memory() and is passed the result + for augmentation from external storage. + """ + return memory + + def set_memory_extra(self, memory): + """Update external storage of properties from @memory. + + This is called after set_memory() with the same memory object + to record additional properties in external storage. + """ + pass + + def erase_memory_extra(self, number): + """Erase external storage for @memory. + + This is called after erase_memory() to clear external storage + for memory @number. + """ + pass + + def link_device_metadata(self, devices): + """Link sub-device metadata with parent. + + This is called after get_sub_devices() to make sure that the + sub-device instances use a reference into the main radio's + metadata. In most cases, this does not need to be overridden. + """ + # Link metadata of the sub-devices into the main by variant name + # so that they are both included in a later save of the parent. + for sub in devices: + self._metadata.setdefault(sub.VARIANT, {}) + sub._metadata = self._metadata[sub.VARIANT] + class FileBackedRadio(Radio): """A file-backed radio stores its data in a file""" + FILE_EXTENSION = 'dat' + + def save(self, filename): + """Save the radio's memory map to @filename""" + pass + + def load(self, filename): + """Load the radio's memory map object from @filename""" + pass + + +class CloneModeRadio(FileBackedRadio, ExternalMemoryProperties): + """A clone-mode radio does a full memory dump in and out and we store + an image of the radio into an image file""" FILE_EXTENSION = "img" MAGIC = b'\x00\xffchirp\xeeimg\x00\x01' - def __init__(self, *args, **kwargs): - Radio.__init__(self, *args, **kwargs) + _memsize = 0 + + def __init__(self, pipe): + self.errors = [] + self._mmap = None self._memobj = None self._metadata = {} + if isinstance(pipe, str): + self.pipe = None + self.load_mmap(pipe) + elif isinstance(pipe, memmap.MemoryMapBytes): + self.pipe = None + self._mmap = pipe + self.process_mmap() + else: + FileBackedRadio.__init__(self, pipe) + + def get_memsize(self): + """Return the radio's memory size""" + return self._memsize + + @classmethod + def match_model(cls, filedata, filename): + """Given contents of a stored file (@filedata), return True if + this radio driver handles the represented model""" + + # Unless the radio driver does something smarter, claim + # support if the data is the same size as our memory. + # Ideally, each radio would perform an intelligent analysis to + # make this determination to avoid model conflicts with + # memories of the same size. + return cls._memsize and len(filedata) == cls._memsize + + def sync_in(self): + """Initiate a radio-to-PC clone operation""" + pass + + def sync_out(self): + """Initiate a PC-to-radio clone operation""" + pass + def save(self, filename): """Save the radio's memory map to @filename""" self.save_mmap(filename) @@ -1162,15 +1436,21 @@ class FileBackedRadio(Radio): return raw_data[:idx], metadata - @classmethod - def _make_metadata(cls): - return base64.b64encode(json.dumps( - {'rclass': cls.__name__, - 'vendor': cls.VENDOR, - 'model': cls.MODEL, - 'variant': cls.VARIANT, - 'chirp_version': CHIRP_VERSION, - }).encode()) + def _make_metadata(self): + # Always generate these directly from our in-memory state + base = { + 'rclass': self.__class__.__name__, + 'vendor': self.VENDOR, + 'model': self.MODEL, + 'variant': self.VARIANT, + 'chirp_version': CHIRP_VERSION, + } + + # Any other properties take a back seat to the above + extra = {k: v for k, v in self._metadata.items() if k not in base} + extra.update(base) + + return base64.b64encode(json.dumps(extra).encode()) def load_mmap(self, filename): """Load the radio's memory map from @filename""" @@ -1213,53 +1493,32 @@ class FileBackedRadio(Radio): return dict(self._metadata) @metadata.setter - def metadata(self, value): + def metadata(self, values): self._metadata.update(values) + def get_memory_extra(self, memory): + rf = self.get_features() + if not rf.has_comment and isinstance(memory.number, int): + self._metadata.setdefault('mem_extra', {}) + memory.comment = self._metadata['mem_extra'].get( + '%04i_comment' % memory.number, '') + return memory -class CloneModeRadio(FileBackedRadio): - """A clone-mode radio does a full memory dump in and out and we store - an image of the radio into an image file""" - - _memsize = 0 - - def __init__(self, pipe): - self.errors = [] - self._mmap = None - - if isinstance(pipe, str): - self.pipe = None - self.load_mmap(pipe) - elif isinstance(pipe, memmap.MemoryMapBytes): - self.pipe = None - self._mmap = pipe - self.process_mmap() - else: - FileBackedRadio.__init__(self, pipe) - - def get_memsize(self): - """Return the radio's memory size""" - return self._memsize - - @classmethod - def match_model(cls, filedata, filename): - """Given contents of a stored file (@filedata), return True if - this radio driver handles the represented model""" - - # Unless the radio driver does something smarter, claim - # support if the data is the same size as our memory. - # Ideally, each radio would perform an intelligent analysis to - # make this determination to avoid model conflicts with - # memories of the same size. - return cls._memsize and len(filedata) == cls._memsize - - def sync_in(self): - "Initiate a radio-to-PC clone operation" - pass - - def sync_out(self): - "Initiate a PC-to-radio clone operation" - pass + def set_memory_extra(self, memory): + rf = self.get_features() + if not rf.has_comment and isinstance(memory.number, int): + self._metadata.setdefault('mem_extra', {}) + key = '%04i_comment' % memory.number + if not memory.comment: + self._metadata['mem_extra'].pop(key, None) + else: + self._metadata['mem_extra'][key] = memory.comment + + def erase_memory_extra(self, number): + rf = self.get_features() + if not rf.has_comment and isinstance(number, int): + self._metadata.setdefault('mem_extra', {}) + self._metadata['mem_extra'].pop('%04i_comment' % number, None) class LiveRadio(Radio): @@ -1334,55 +1593,84 @@ class Status: def is_fractional_step(freq): - """Returns True if @freq requires a 12.5kHz or 6.25kHz step""" + """Returns True if @freq requires a 12.5 kHz or 6.25 kHz step""" return not is_5_0(freq) and (is_12_5(freq) or is_6_25(freq)) def is_5_0(freq): - """Returns True if @freq is reachable by a 5kHz step""" + """Returns True if @freq is reachable by a 5 kHz step""" return (freq % 5000) == 0 +def is_10_0(freq): + """Returns True if @freq is reachable by a 10 kHz step""" + return (freq % 10000) == 0 + + def is_12_5(freq): - """Returns True if @freq is reachable by a 12.5kHz step""" + """Returns True if @freq is reachable by a 12.5 kHz step""" return (freq % 12500) == 0 def is_6_25(freq): - """Returns True if @freq is reachable by a 6.25kHz step""" + """Returns True if @freq is reachable by a 6.25 kHz step""" return (freq % 6250) == 0 def is_2_5(freq): - """Returns True if @freq is reachable by a 2.5kHz step""" + """Returns True if @freq is reachable by a 2.5 kHz step""" return (freq % 2500) == 0 def is_8_33(freq): - """Returns True if @freq is reachable by a 8.33kHz step""" + """Returns True if @freq is reachable by a 8.33 kHz step""" return (freq % 25000) in [0, 8330, 16660] -def required_step(freq): +def is_1_0(freq): + """Returns True if @freq is reachable by a 1.0 kHz step""" + return (freq % 1000) == 0 + + +def is_0_5(freq): + """Returns True if @freq is reachable by a 0.5 kHz step""" + return (freq % 500) == 0 + + +def make_is(stephz): + def validator(freq): + return freq % stephz == 0 + return validator + + +def required_step(freq, allowed=None): """Returns the simplest tuning step that is required to reach @freq""" - if is_5_0(freq): - return 5.0 - elif is_12_5(freq): - return 12.5 - elif is_6_25(freq): - return 6.25 - elif is_2_5(freq): - return 2.5 - elif is_8_33(freq): - return 8.33 - else: - raise errors.InvalidDataError("Unable to calculate the required " + - "tuning step for %i.%5i" % - (freq / 1000000, freq % 1000000)) + if allowed is None: + allowed = [5.0, 10.0, 12.5, 6.25, 2.5, 8.33] + + # These should be in order of most common to least common + steps = { + 5.0: make_is(5000), + 10.0: make_is(10000), + 12.5: make_is(12500), + 6.25: make_is(6250), + 2.5: make_is(2500), + 1.0: make_is(1000), + 0.5: make_is(500), + 0.25: make_is(250), + 8.33: is_8_33, + } + + for step, validate in steps.items(): + if step in allowed and validate(freq): + return step + + raise errors.InvalidDataError("Unable to find a supported " + + "tuning step for %s" % format_freq(freq)) def fix_rounded_step(freq): - """Some radios imply the last bit of 12.5kHz and 6.25kHz step + """Some radios imply the last bit of 12.5 kHz and 6.25 kHz step frequencies. Take the base @freq and return the corrected one""" try: required_step(freq) @@ -1476,6 +1764,23 @@ def from_kHz(val): return val // 100 +def split_to_offset(mem, rxfreq, txfreq): + """Set the freq, offset, and duplex fields of a memory based on + a separate rx/tx frequency. + """ + if abs(txfreq - rxfreq) > to_MHz(70): + mem.freq = rxfreq + mem.offset = txfreq + mem.duplex = 'split' + else: + offset = txfreq - rxfreq + if offset < 0: + mem.duplex = '-' + elif offset > 0: + mem.duplex = '+' + mem.offset = abs(offset) + + def split_tone_decode(mem, txtone, rxtone): """ Set tone mode and values on @mem based on txtone and rxtone specs like: @@ -1629,3 +1934,58 @@ def urlretrieve(url, fn): resp = urllib.request.urlopen(req) with open(fn, 'wb') as f: f.write(resp.read()) + + +def mem_from_text(text): + m = Memory() + freqs = re.findall(r'\b(\d{1,3}\.\d{2,6})\b', text) + if not freqs: + raise ValueError('Unable to find a frequency') + m.freq = parse_freq(freqs[0]) + offset = re.search(r'([+-])\s*(\d\.\d{1,3}|\d)\b', text) + duplex = re.search(r'\W([+-])\W', text[text.index(freqs[0]):]) + if len(freqs) > 1 and not offset: + split_to_offset(m, m.freq, parse_freq(freqs[1])) + else: + if offset: + m.duplex = offset.group(1) + m.offset = parse_freq(offset.group(2)) + # Only look for the first +/- after the frequency, which would be + # by far the most common arrangement + if offset is None and duplex: + m.duplex = duplex.group(1) + tones = re.findall(r'\b(\d{2,3}\.\d|D\d{3})\b', text) + if tones and len(tones) <= 2: + txrx = [] + for val in tones: + if '.' in val: + mode = 'Tone' + tone = float(val) + elif 'D' in val: + mode = 'DTCS' + tone = int(val[1:]) + else: + continue + txrx.append((mode, tone, 'N')) + if len(txrx) == 1: + txrx.append(('', 88.5, 'N')) + split_tone_decode(m, txrx[0], txrx[1]) + + return m + + +def mem_to_text(mem): + pieces = [format_freq(mem.freq)] + if mem.duplex == 'split': + pieces.append(format_freq(mem.offset)) + elif mem.duplex in ('-', '+'): + pieces.append('%s%i.%3.3s' % (mem.duplex, + mem.offset / 1000000, + '%03i' % (mem.offset % 1000000))) + txrx = split_tone_encode(mem) + for mode, tone, pol in txrx: + if mode == 'Tone': + pieces.append('%.1f' % tone) + elif mode == 'DTCS': + pieces.append('D%03i' % tone) + return '[%s]' % '/'.join(pieces) diff --git a/chirp/cli/__init__.py b/chirp/cli/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/chirp/cli/main.py b/chirp/cli/main.py new file mode 100644 index 0000000..473ceee --- /dev/null +++ b/chirp/cli/main.py @@ -0,0 +1,402 @@ +#!/usr/bin/env python +# +# Copyright 2008 Dan Smith +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +import serial +import os +import sys +import argparse +import logging + +from chirp import logger +from chirp import chirp_common, errors, directory, util + +directory.import_drivers() + +LOG = logging.getLogger("chirpc") +RADIOS = directory.DRV_TO_RADIO + + +def fail_unsupported(): + LOG.error("Operation not supported by selected radio") + sys.exit(1) + + +def fail_missing_mmap(): + LOG.error("mmap-only operation requires specification of an mmap file") + sys.exit(1) + + +class ToneAction(argparse.Action): + def __call__(self, parser, namespace, values, option_string=None): + value = values[0] + if value not in chirp_common.TONES: + raise argparse.ArgumentError( + self, "Invalid tone value: %.1f" % value) + setattr(namespace, self.dest, value) + + +class DTCSAction(argparse.Action): + def __call__(self, parser, namespace, values, option_string=None): + value = values[0] + if value not in chirp_common.DTCS_CODES: + raise argparse.ArgumentError( + self, "Invalid DTCS value: %03i" % value) + setattr(namespace, self.dest, value) + + +class DTCSPolarityAction(argparse.Action): + def __call__(self, parser, namespace, values, option_string=None): + value = values[0] + if value not in ["NN", "RN", "NR", "RR"]: + raise argparse.ArgumentError( + self, "Invalid DTCS polarity: %s" % value) + setattr(namespace, self.dest, value) + + +def parse_memory_number(radio, args): + if len(args) < 1: + LOG.error("You must provide an argument specifying the memory number.") + sys.exit(1) + + try: + memnum = int(args[0]) + except ValueError: + memnum = args[0] + + rf = radio.get_features() + start, end = rf.memory_bounds + if not (start <= memnum <= end or memnum in rf.valid_special_chans): + if len(rf.valid_special_chans) > 0: + LOG.error( + "memory number must be between %d and %d or one of %s" + " (got %s)", + start, end, ", ".join(rf.valid_special_chans), memnum) + else: + LOG.error("memory number must be between %d and %d (got %s)", + start, end, memnum) + sys.exit(1) + return memnum + + +def main(args=None): + parser = argparse.ArgumentParser() + logger.add_version_argument(parser) + parser.add_argument("-s", "--serial", dest="serial", + default="mmap", + help="Serial port (default: mmap)") + + parser.add_argument("--list-settings", action="store_true", + help="List settings") + + parser.add_argument("-i", "--id", dest="id", + default=False, + action="store_true", + help="Request radio ID string") + + memarg = parser.add_argument_group("Memory/Channel Options") + memarg.add_argument("--list-mem", action="store_true", + help="List all memory locations") + + memarg.add_argument("--list-special-mem", action="store_true", + help="List all special memory locations") + + memarg.add_argument("--raw", action="store_true", + help="Dump raw memory location") + + memarg.add_argument("--get-mem", action="store_true", + help="Get and print memory location") + memarg.add_argument("--copy-mem", action="store_true", + help="Copy memory location") + memarg.add_argument("--clear-mem", action="store_true", + help="Clear memory location") + + memarg.add_argument("--set-mem-name", help="Set memory name") + memarg.add_argument("--set-mem-freq", type=float, + help="Set memory frequency") + + memarg.add_argument("--set-mem-tencon", action="store_true", + help="Set tone encode enabled flag") + memarg.add_argument("--set-mem-tencoff", action="store_true", + help="Set tone decode disabled flag") + memarg.add_argument("--set-mem-tsqlon", action="store_true", + help="Set tone squelch enabled flag") + memarg.add_argument("--set-mem-tsqloff", action="store_true", + help="Set tone squelch disabled flag") + memarg.add_argument("--set-mem-dtcson", action="store_true", + help="Set DTCS enabled flag") + memarg.add_argument("--set-mem-dtcsoff", action="store_true", + help="Set DTCS disabled flag") + + memarg.add_argument("--set-mem-tenc", + type=float, action=ToneAction, nargs=1, + help="Set memory encode tone") + memarg.add_argument("--set-mem-tsql", + type=float, action=ToneAction, nargs=1, + help="Set memory squelch tone") + + memarg.add_argument("--set-mem-dtcs", + type=int, action=DTCSAction, nargs=1, + help="Set memory DTCS code") + memarg.add_argument("--set-mem-dtcspol", + action=DTCSPolarityAction, nargs=1, + help="Set memory DTCS polarity (NN, NR, RN, RR)") + + memarg.add_argument("--set-mem-dup", + help="Set memory duplex (+,-, or blank)") + memarg.add_argument("--set-mem-offset", type=float, + help="Set memory duplex offset (in MHz)") + + memarg.add_argument("--set-mem-mode", + help="Set mode (%s)" % ",".join(chirp_common.MODES)) + + parser.add_argument("-r", "--radio", dest="radio", + default=None, + help="Radio model (see --list-radios)") + parser.add_argument("--list-radios", action="store_true", + help="List radio models") + parser.add_argument("--mmap", dest="mmap", + default=None, + help="Radio memory map file location") + parser.add_argument("--download-mmap", dest="download_mmap", + action="store_true", + default=False, + help="Download memory map from radio") + parser.add_argument("--upload-mmap", dest="upload_mmap", + action="store_true", + default=False, + help="Upload memory map to radio") + logger.add_arguments(parser) + parser.add_argument("args", metavar="arg", nargs='*', + help="Some commands require additional arguments") + + if len(sys.argv) <= 1: + parser.print_help() + sys.exit(0) + + options = parser.parse_args(args) + args = options.args + + logger.handle_options(options) + + if options.list_radios: + print("Supported Radios:\n\t", "\n\t".join(sorted(RADIOS.keys()))) + sys.exit(0) + + if options.id: + from chirp import detect + md = detect.detect_icom_radio(options.serial) + print("Model:\n%s" % md.MODEL) + sys.exit(0) + + if not options.radio: + if options.mmap: + rclass = directory.get_radio_by_image(options.mmap).__class__ + else: + print("You must specify a radio model. See --list-radios.") + sys.exit(1) + else: + rclass = directory.get_radio(options.radio) + + if options.serial == "mmap": + if options.mmap: + s = options.mmap + else: + s = options.radio + ".img" + if not os.path.exists(s): + LOG.error("Image file '%s' does not exist" % s) + sys.exit(1) + else: + LOG.info("opening %s at %i" % (options.serial, rclass.BAUD_RATE)) + if '://' in options.serial: + s = serial.serial_for_url(options.serial, do_not_open=True) + s.timeout = 0.5 + s.open() + else: + s = serial.Serial(port=options.serial, timeout=0.5) + + radio = rclass(s) + + if options.list_settings: + print(radio.get_settings()) + sys.exit(0) + + if options.list_mem: + rf = radio.get_features() + start, end = rf.memory_bounds + for i in range(start, end + 1): + mem = radio.get_memory(i) + if mem.empty and not logger.is_visible(logging.INFO): + continue + print(mem) + sys.exit(0) + + if options.list_special_mem: + rf = radio.get_features() + for i in sorted(rf.valid_special_chans): + mem = radio.get_memory(i) + if mem.empty and not logger.is_visible(logging.INFO): + continue + print(mem) + sys.exit(0) + + if options.copy_mem: + src = parse_memory_number(radio, args) + dst = parse_memory_number(radio, args[1:]) + try: + mem = radio.get_memory(src) + except errors.InvalidMemoryLocation as e: + LOG.exception(e) + sys.exit(1) + LOG.info("copying memory %s to %s", src, dst) + mem.number = dst + radio.set_memory(mem) + + if options.clear_mem: + memnum = parse_memory_number(radio, args) + try: + mem = radio.get_memory(memnum) + except errors.InvalidMemoryLocation as e: + LOG.exception(e) + sys.exit(1) + if mem.empty: + LOG.warn("memory %s is already empty, deleting again", memnum) + mem.empty = True + radio.set_memory(mem) + + if options.raw: + memnum = parse_memory_number(radio, args) + data = radio.get_raw_memory(memnum) + for i in data: + if ord(i) > 0x7F: + print("Memory location %s (%i):\n%s" % + (memnum, len(data), util.hexprint(data))) + sys.exit(0) + print(data) + sys.exit(0) + + if options.set_mem_dup is not None: + if options.set_mem_dup != "+" and \ + options.set_mem_dup != "-" and \ + options.set_mem_dup != "": + LOG.error("Invalid duplex value `%s'" % options.set_mem_dup) + LOG.error("Valid values are: '+', '-', ''") + sys.exit(1) + else: + _dup = options.set_mem_dup + else: + _dup = None + + if options.set_mem_mode: + LOG.info("Set mode: %s" % options.set_mem_mode) + if options.set_mem_mode not in chirp_common.MODES: + LOG.error("Invalid mode `%s'") + sys.exit(1) + else: + _mode = options.set_mem_mode + else: + _mode = None + + if options.set_mem_name or options.set_mem_freq or \ + options.set_mem_tencon or options.set_mem_tencoff or \ + options.set_mem_tsqlon or options.set_mem_tsqloff or \ + options.set_mem_dtcson or options.set_mem_dtcsoff or \ + options.set_mem_tenc or options.set_mem_tsql or \ + options.set_mem_dtcs or options.set_mem_dup is not None or \ + options.set_mem_mode or options.set_mem_dtcspol or\ + options.set_mem_offset: + memnum = parse_memory_number(radio, args) + try: + mem = radio.get_memory(memnum) + except errors.InvalidMemoryLocation as e: + LOG.exception(e) + sys.exit(1) + + if mem.empty: + LOG.info("creating new memory (#%s)", memnum) + mem = chirp_common.Memory() + mem.number = memnum + + mem.name = options.set_mem_name or mem.name + mem.freq = options.set_mem_freq or mem.freq + mem.rtone = options.set_mem_tenc or mem.rtone + mem.ctone = options.set_mem_tsql or mem.ctone + mem.dtcs = options.set_mem_dtcs or mem.dtcs + mem.dtcs_polarity = options.set_mem_dtcspol or mem.dtcs_polarity + if _dup is not None: + mem.duplex = _dup + mem.offset = options.set_mem_offset or mem.offset + mem.mode = _mode or mem.mode + + if options.set_mem_tencon: + mem.tmode = "Tone" + elif options.set_mem_tencoff: + mem.tmode = "" + + if options.set_mem_tsqlon: + mem.tmode = "TSQL" + elif options.set_mem_tsqloff: + mem.tmode = "" + + if options.set_mem_dtcson: + mem.tmode = "DTCS" + elif options.set_mem_dtcsoff: + mem.tmode = "" + + radio.set_memory(mem) + + if options.get_mem: + pos = parse_memory_number(radio, args) + try: + mem = radio.get_memory(pos) + except errors.InvalidMemoryLocation: + mem = chirp_common.Memory() + mem.number = pos + + print(mem) + sys.exit(0) + + if options.download_mmap: + if not issubclass(rclass, chirp_common.CloneModeRadio): + LOG.error("%s is not a clone mode radio" % options.radio) + sys.exit(1) + if not options.mmap: + LOG.error("You must specify the destination file name with --mmap") + sys.exit(1) + try: + radio.sync_in() + radio.save_mmap(options.mmap) + except Exception as e: + LOG.exception(e) + sys.exit(1) + + if options.upload_mmap: + if not issubclass(rclass, chirp_common.CloneModeRadio): + LOG.error("%s is not a clone mode radio" % options.radio) + sys.exit(1) + if not options.mmap: + LOG.error("You must specify the source file name with --mmap") + sys.exit(1) + try: + radio.load_mmap(options.mmap) + radio.sync_out() + print("Upload successful") + except Exception as e: + LOG.exception(e) + sys.exit(1) + + if options.mmap and isinstance(radio, chirp_common.CloneModeRadio): + radio.save_mmap(options.mmap) diff --git a/chirp/detect.py b/chirp/detect.py index 1811fb6..9f97a31 100644 --- a/chirp/detect.py +++ b/chirp/detect.py @@ -24,7 +24,6 @@ LOG = logging.getLogger(__name__) class DetectorRadio(chirp_common.Radio): """Minimal radio for model detection""" - MUNCH_CLONE_RESP = False def get_payload(self, data, raw, checksum): return data @@ -78,7 +77,12 @@ def _detect_icom_radio(ser): def detect_icom_radio(port): """Detect which Icom model is connected to @port""" - ser = serial.Serial(port=port, timeout=0.5) + if '://' in port: + ser = serial.serial_for_url(port, do_not_open=True) + ser.timeout = 0.5 + ser.open() + else: + ser = serial.Serial(port=port, timeout=0.5) try: result = _detect_icom_radio(ser) @@ -96,7 +100,13 @@ def detect_icom_radio(port): def detect_kenwoodlive_radio(port): """Detect which Kenwood model is connected to @port""" - ser = serial.Serial(port=port, baudrate=9600, timeout=0.5) + if '://' in port: + ser = serial.serial_for_url(port, do_not_open=True) + ser.timeout = 0.5 + ser.open() + else: + ser = serial.Serial(port=port, baudrate=9600, timeout=0.5) + r_id = kenwood_live.get_id(ser) ser.close() @@ -110,6 +120,7 @@ def detect_kenwoodlive_radio(port): else: raise errors.RadioError("Unsupported model `%s'" % r_id) + DETECT_FUNCTIONS = { "Icom": detect_icom_radio, "Kenwood": detect_kenwoodlive_radio, diff --git a/chirp/directory.py b/chirp/directory.py index 7678fd6..e25ae10 100644 --- a/chirp/directory.py +++ b/chirp/directory.py @@ -16,14 +16,10 @@ import glob import os -import tempfile import logging import sys -import six - -from chirp.drivers import icf # , rfinder -from chirp import chirp_common, util, radioreference, errors +from chirp import chirp_common, errors LOG = logging.getLogger(__name__) @@ -62,15 +58,35 @@ def register(cls): LOG.warn("Replacing existing driver id `%s'" % ident) else: raise Exception("Duplicate radio driver id `%s'" % ident) + elif ALLOW_DUPS: + LOG.info("Registered %s = %s" % (ident, cls.__name__)) DRV_TO_RADIO[ident] = cls RADIO_TO_DRV[cls] = ident - LOG.info("Registered %s = %s" % (ident, cls.__name__)) return cls DRV_TO_RADIO = {} RADIO_TO_DRV = {} +AUX_FORMATS = set() + + +def register_format(name, pattern, readonly=False): + """Register a named format and file pattern. + + The name and pattern must not exist in the directory already + (except together). The name should be something like "CSV" or + "Icom ICF" and the pattern should be a glob like "*.icf". + + Returns a unique name to go in Radio.FORMATS so the UI knows what + additional formats a driver can read (and write unless readonly is + set). + """ + if (name, pattern) not in [(n, p) for n, p, r in AUX_FORMATS]: + if name in [x[0] for x in AUX_FORMATS]: + raise Exception('Duplicate format name %r' % name) + AUX_FORMATS.add((name, pattern, readonly)) + return name def get_radio(driver): @@ -91,29 +107,6 @@ def get_driver(rclass): raise Exception("Unknown radio type `%s'" % rclass) -def icf_to_image(icf_file, img_file): - # FIXME: Why is this here? - """Convert an ICF file to a .img file""" - mdata, mmap = icf.read_file(icf_file) - img_data = None - - for model in list(DRV_TO_RADIO.values()): - try: - if model._model == mdata: - img_data = mmap.get_packed()[:model._memsize] - break - except Exception: - pass # Skip non-Icoms - - if img_data: - f = file(img_file, "wb") - f.write(img_data) - f.close() - else: - LOG.error("Unsupported model data: %s" % util.hexprint(mdata)) - raise Exception("Unsupported model") - - # This is a mapping table of radio models that have changed in the past. # ideally we would never do this, but in the case where a radio was added # as the wrong model name, or a model has to be split, we need to be able @@ -121,43 +114,19 @@ def icf_to_image(icf_file, img_file): MODEL_COMPAT = { ('Retevis', 'RT-5R'): ('Retevis', 'RT5R'), ('Retevis', 'RT-5RV'): ('Retevis', 'RT5RV'), + ('Signus', 'XTR-5'): ('Cignus', 'XTR-5'), } def get_radio_by_image(image_file): """Attempt to get the radio class that owns @image_file""" - if image_file.startswith("radioreference://"): - _, _, zipcode, username, password, country = image_file.split("/", 5) - rr = radioreference.RadioReferenceRadio(None) - rr.set_params(zipcode, username, password, country) - return rr - - # FIXME: Disable rfinder until the module is fixed - if image_file.startswith("rfinder://") and False: - _, _, email, passwd, lat, lon, miles = image_file.split("/") - rf = rfinder.RFinderRadio(None) - rf.set_params((float(lat), float(lon)), int(miles), email, passwd) - return rf - - if os.path.exists(image_file) and icf.is_icf_file(image_file): - tempf = tempfile.mktemp() - icf_to_image(image_file, tempf) - LOG.info("Auto-converted %s -> %s" % (image_file, tempf)) - image_file = tempf - if os.path.exists(image_file): with open(image_file, "rb") as f: filedata = f.read() else: filedata = b"" - data, metadata = chirp_common.FileBackedRadio._strip_metadata(filedata) - - # NOTE: See warning below - if six.PY3: - filestring = ''.join(chr(c) for c in filedata) - else: - filestring = filedata + data, metadata = chirp_common.CloneModeRadio._strip_metadata(filedata) for rclass in list(DRV_TO_RADIO.values()): if not issubclass(rclass, chirp_common.FileBackedRadio): @@ -165,40 +134,28 @@ def get_radio_by_image(image_file): if not metadata: # If no metadata, we do the old thing - error = None try: if rclass.match_model(filedata, image_file): return rclass(image_file) except Exception as e: - error = e - - # NOTE: For compatibility, try a straight up conversion to - # string and log a warning - if six.PY3: - try: - if rclass.match_model(filestring, image_file): - LOG.warning(('Radio driver %s needs py3 ' - 'match_model conversion!') % ( - rclass.__name__)) - return rclass(image_file) - except Exception as e: - error = e - - if error: LOG.error('Radio class %s failed during detection: %s' % ( - rclass.__name__, error)) + rclass.__name__, e)) + pass meta_vendor = metadata.get('vendor') meta_model = metadata.get('model') + meta_variant = metadata.get('variant') meta_vendor, meta_model = MODEL_COMPAT.get((meta_vendor, meta_model), (meta_vendor, meta_model)) # If metadata, then it has to match one of the aliases or the parent for alias in rclass.ALIASES + [rclass]: - if (alias.VENDOR == meta_vendor and alias.MODEL == meta_model): + if (alias.VENDOR == meta_vendor and alias.MODEL == meta_model and + (meta_variant is None or alias.VARIANT == meta_variant)): class DynamicRadioAlias(rclass): + _orig_rclass = rclass VENDOR = meta_vendor MODEL = meta_model VARIANT = metadata.get('variant') @@ -214,9 +171,10 @@ def get_radio_by_image(image_file): raise errors.ImageDetectFailed("Unknown file format") -def safe_import_drivers(limit=None): - if sys.platform == 'win32': - # Assume we are in a frozen win32 build, so we can not glob +def import_drivers(limit=None): + frozen = getattr(sys, 'frozen', False) + if sys.platform == 'win32' and frozen: + # We are in a frozen win32 build, so we can not glob # the driver files, but we do not need to anyway import chirp.drivers for module in chirp.drivers.__all__: @@ -237,7 +195,4 @@ def safe_import_drivers(limit=None): driver_module = os.path.basename(module) if limit and driver_module not in limit: continue - try: - __import__('chirp.drivers.%s' % driver_module) - except Exception as e: - print('Failed to import %s: %s' % (module, e)) + __import__('chirp.drivers.%s' % driver_module) diff --git a/chirp/dmrmarc.py b/chirp/dmrmarc.py deleted file mode 100644 index d66328f..0000000 --- a/chirp/dmrmarc.py +++ /dev/null @@ -1,139 +0,0 @@ -# Copyright 2016 Tom Hayward -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -import json -import logging -import tempfile -import urllib -from chirp import chirp_common, errors -from chirp.settings import RadioSetting, RadioSettingGroup, \ - RadioSettingValueList - -LOG = logging.getLogger(__name__) - - -def list_filter(haystack, attr, needles): - if not needles or not needles[0]: - return haystack - return [x for x in haystack if x[attr] in needles] - - -class DMRMARCRadio(chirp_common.NetworkSourceRadio): - """DMR-MARC data source""" - VENDOR = "DMR-MARC" - MODEL = "Repeater database" - - URL = "http://www.dmr-marc.net/cgi-bin/trbo-database/datadump.cgi?" \ - "table=repeaters&format=json" - - def __init__(self, *args, **kwargs): - chirp_common.NetworkSourceRadio.__init__(self, *args, **kwargs) - self._repeaters = None - - def set_params(self, city, state, country): - """Set the parameters to be used for a query""" - self._city = city and [x.strip() for x in city.split(",")] or [''] - self._state = state and [x.strip() for x in state.split(",")] or [''] - self._country = country and [x.strip() for x in country.split(",")] \ - or [''] - - def do_fetch(self): - fn = tempfile.mktemp(".json") - filename, headers = urllib.urlretrieve(self.URL, fn) - with open(fn, 'r') as f: - try: - self._repeaters = json.load(f)['repeaters'] - except AttributeError: - raise errors.RadioError( - "Unexpected response from %s" % self.URL) - except ValueError as e: - raise errors.RadioError( - "Invalid JSON from %s. %s" % (self.URL, str(e))) - - self._repeaters = list_filter(self._repeaters, "city", self._city) - self._repeaters = list_filter(self._repeaters, "state", self._state) - self._repeaters = list_filter(self._repeaters, "country", - self._country) - - def get_features(self): - if not self._repeaters: - self.do_fetch() - - rf = chirp_common.RadioFeatures() - rf.memory_bounds = (0, len(self._repeaters)-1) - rf.has_bank = False - rf.has_comment = True - rf.has_ctone = False - rf.valid_tmodes = [""] - return rf - - def get_raw_memory(self, number): - return repr(self._repeaters[number]) - - def get_memory(self, number): - if not self._repeaters: - self.do_fetch() - - repeater = self._repeaters[number] - - mem = chirp_common.Memory() - mem.number = number - - mem.name = repeater.get('city') - mem.freq = chirp_common.parse_freq(repeater.get('frequency')) - offset = chirp_common.parse_freq(repeater.get('offset', '0')) - if offset > 0: - mem.duplex = "+" - elif offset < 0: - mem.duplex = "-" - else: - mem.duplex = "" - mem.offset = abs(offset) - mem.mode = 'DMR' - mem.comment = repeater.get('map_info') - - mem.extra = RadioSettingGroup("Extra", "extra") - - rs = RadioSetting( - "color_code", "Color Code", RadioSettingValueList( - range(16), int(repeater.get('color_code', 0)))) - mem.extra.append(rs) - - return mem - - -def main(): - import argparse - from pprint import PrettyPrinter - - parser = argparse.ArgumentParser(description="Fetch DMR-MARC repeater " - "database and filter by city, state, and/or country. Multiple items " - "combined with a , will be filtered with logical OR.") - parser.add_argument("-c", "--city", - help="Comma-separated list of cities to include in output.") - parser.add_argument("-s", "--state", - help="Comma-separated list of states to include in output.") - parser.add_argument("--country", - help="Comma-separated list of countries to include in output.") - args = parser.parse_args() - - dmrmarc = DMRMARCRadio(None) - dmrmarc.set_params(**vars(args)) - dmrmarc.do_fetch() - pp = PrettyPrinter(indent=2) - pp.pprint(dmrmarc._repeaters) - -if __name__ == "__main__": - main() diff --git a/chirp/drivers/__init__.py b/chirp/drivers/__init__.py index ea9dd2c5..ff7562b 100644 --- a/chirp/drivers/__init__.py +++ b/chirp/drivers/__init__.py @@ -1,10 +1,163 @@ -import os -import sys -from glob import glob - -module_dir = os.path.dirname(sys.modules["chirp.drivers"].__file__) -__all__ = [] -for i in sorted(glob(os.path.join(module_dir, "*.py"))): - name = os.path.basename(i)[:-3] - if not name.startswith("__"): - __all__.append(name) +from chirp.drivers import __init__ +from chirp.drivers import bj9900 +from chirp.drivers import anytone +from chirp.drivers import anytone778uv +from chirp.drivers import anytone_ht +from chirp.drivers import anytone_iii +from chirp.drivers import ap510 +from chirp.drivers import baofeng_common +from chirp.drivers import baofeng_uv3r +from chirp.drivers import baofeng_wp970i +from chirp.drivers import bjuv55 +from chirp.drivers import boblov_x3plus +from chirp.drivers import btech +from chirp.drivers import fake +from chirp.drivers import fd268 +from chirp.drivers import ft1500m +from chirp.drivers import ft1802 +from chirp.drivers import ft1d +from chirp.drivers import ft2900 +from chirp.drivers import ft2d +from chirp.drivers import ft4 +from chirp.drivers import ft2800 +from chirp.drivers import ft450d +from chirp.drivers import ft50 +from chirp.drivers import ft60 +from chirp.drivers import ft70 +from chirp.drivers import ft7100 +from chirp.drivers import ft7800 +from chirp.drivers import ft8100 +from chirp.drivers import ft817 +from chirp.drivers import ft818 +from chirp.drivers import ft857 +from chirp.drivers import ft90 +from chirp.drivers import ftlx011 +from chirp.drivers import ftm3200d +from chirp.drivers import ftm350 +from chirp.drivers import ftm7250d +from chirp.drivers import ga510 +from chirp.drivers import generic_csv +from chirp.drivers import generic_tpe +from chirp.drivers import gmrsuv1 +from chirp.drivers import gmrsv2 +from chirp.drivers import h777 +from chirp.drivers import hf90 +from chirp.drivers import bf_t1 +from chirp.drivers import ic208 +from chirp.drivers import hg_uv98 +from chirp.drivers import hobbypcb +from chirp.drivers import ic2300 +from chirp.drivers import ic2100 +from chirp.drivers import ic2200 +from chirp.drivers import ic2720 +from chirp.drivers import ic2730 +from chirp.drivers import ic9x_icf +from chirp.drivers import ic2820 +from chirp.drivers import ic9x +from chirp.drivers import ic9x_ll +from chirp.drivers import ic9x_icf_ll +from chirp.drivers import icf +from chirp.drivers import icomciv +from chirp.drivers import icp7 +from chirp.drivers import ict8 +from chirp.drivers import icq7 +from chirp.drivers import ict70 +from chirp.drivers import ict7h +from chirp.drivers import icv80 +from chirp.drivers import id31 +from chirp.drivers import icv86 +from chirp.drivers import icw32 +from chirp.drivers import icx8x +from chirp.drivers import icx90 +from chirp.drivers import id5100 +from chirp.drivers import id51 +from chirp.drivers import id51plus +from chirp.drivers import id880 +from chirp.drivers import id800 +from chirp.drivers import idrp +from chirp.drivers import kg935g +from chirp.drivers import iradio_uv_5118 +from chirp.drivers import kenwood_hmk +from chirp.drivers import kenwood_itm +from chirp.drivers import kenwood_live +from chirp.drivers import kguv8d +from chirp.drivers import kguv980p +from chirp.drivers import kguv8dplus +from chirp.drivers import kguv8e +from chirp.drivers import kguv920pa +from chirp.drivers import kguv9dplus +from chirp.drivers import leixen +from chirp.drivers import kyd +from chirp.drivers import kyd_IP620 +from chirp.drivers import lt725uv +from chirp.drivers import mursv1 +from chirp.drivers import alinco +from chirp.drivers import puxing +from chirp.drivers import puxing_px888k +from chirp.drivers import radioddity_r2 +from chirp.drivers import radtel_t18 +from chirp.drivers import retevis_rb15 +from chirp.drivers import retevis_rb17p +from chirp.drivers import retevis_rb28 +from chirp.drivers import retevis_rt1 +from chirp.drivers import retevis_rt21 +from chirp.drivers import retevis_rt22 +from chirp.drivers import retevis_rt23 +from chirp.drivers import retevis_rt26 +from chirp.drivers import retevis_rt76p +from chirp.drivers import retevis_rt87 +from chirp.drivers import retevis_rt98 +from chirp.drivers import bf_t8 +from chirp.drivers import rh5r_v2 +from chirp.drivers import tdxone_tdq8a +from chirp.drivers import template +from chirp.drivers import tg_uv2p +from chirp.drivers import th350 +from chirp.drivers import th7800 +from chirp.drivers import th9000 +from chirp.drivers import th9800 +from chirp.drivers import th_uv3r +from chirp.drivers import th_uv3r25 +from chirp.drivers import th_uv8000 +from chirp.drivers import th_uv88 +from chirp.drivers import th_uvf8d +from chirp.drivers import thd72 +from chirp.drivers import thd74 +from chirp.drivers import thuv1f +from chirp.drivers import tk270 +from chirp.drivers import tk3140 +from chirp.drivers import tk760 +from chirp.drivers import tk760g +from chirp.drivers import tk8102 +from chirp.drivers import tk8160 +from chirp.drivers import tk8180 +from chirp.drivers import tmd710 +from chirp.drivers import tmv71 +from chirp.drivers import tmv71_ll +from chirp.drivers import ts2000 +from chirp.drivers import ts480 +from chirp.drivers import ts590 +from chirp.drivers import ts850 +from chirp.drivers import uv5r +from chirp.drivers import uv5x3 +from chirp.drivers import uv6r +from chirp.drivers import uvb5 +from chirp.drivers import vgc +from chirp.drivers import vx170 +from chirp.drivers import vx2 +from chirp.drivers import vx3 +from chirp.drivers import vx5 +from chirp.drivers import vx510 +from chirp.drivers import vx6 +from chirp.drivers import vx7 +from chirp.drivers import vx8 +from chirp.drivers import vxa700 +from chirp.drivers import wouxun +from chirp.drivers import wouxun_common +from chirp.drivers import yaesu_clone +from chirp.drivers import iradio_uv_5118plus +from chirp.drivers import kenwood_d7 +from chirp.drivers import tdh8 +from chirp.drivers import mml_jc8810 +from chirp.drivers import uvk5 +__all__ = ['__init__', 'bj9900', 'anytone', 'anytone778uv', 'anytone_ht', 'anytone_iii', 'ap510', 'baofeng_common', 'baofeng_uv3r', 'baofeng_wp970i', 'bjuv55', 'boblov_x3plus', 'btech', 'fake', 'fd268', 'ft1500m', 'ft1802', 'ft1d', 'ft2900', 'ft2d', 'ft4', 'ft2800', 'ft450d', 'ft50', 'ft60', 'ft70', 'ft7100', 'ft7800', 'ft8100', 'ft817', 'ft818', 'ft857', 'ft90', 'ftlx011', 'ftm3200d', 'ftm350', 'ftm7250d', 'ga510', 'generic_csv', 'generic_tpe', 'gmrsuv1', 'gmrsv2', 'h777', 'hf90', 'bf_t1', 'ic208', 'hg_uv98', 'hobbypcb', 'ic2300', 'ic2100', 'ic2200', 'ic2720', 'ic2730', 'ic9x_icf', 'ic2820', 'ic9x', 'ic9x_ll', 'ic9x_icf_ll', 'icf', 'icomciv', 'icp7', 'ict8', 'icq7', 'ict70', 'ict7h', 'icv80', 'id31', 'icv86', 'icw32', 'icx8x', 'icx90', 'id5100', 'id51', 'id51plus', 'id880', 'id800', 'idrp', 'kg935g', 'iradio_uv_5118', 'kenwood_hmk', 'kenwood_itm', 'kenwood_live', 'kguv8d', 'kguv980p', 'kguv8dplus', 'kguv8e', 'kguv920pa', 'kguv9dplus', 'leixen', 'kyd', 'kyd_IP620', 'lt725uv', 'mursv1', 'alinco', 'puxing', 'puxing_px888k', 'radioddity_r2', 'radtel_t18', 'retevis_rb15', 'retevis_rb17p', 'retevis_rb28', 'retevis_rt1', 'retevis_rt21', 'retevis_rt22', 'retevis_rt23', 'retevis_rt26', 'retevis_rt76p', 'retevis_rt87', 'retevis_rt98', 'bf_t8', 'rh5r_v2', 'tdxone_tdq8a', 'template', 'tg_uv2p', 'th350', 'th7800', 'th9000', 'th9800', 'th_uv3r', 'th_uv3r25', 'th_uv8000', 'th_uv88', 'th_uvf8d', 'thd72', 'thd74', 'thuv1f', 'tk270', 'tk3140', 'tk760', 'tk760g', 'tk8102', 'tk8160', 'tk8180', 'tmd710', 'tmv71', 'tmv71_ll', 'ts2000', 'ts480', 'ts590', 'ts850', 'uv5r', 'uv5x3', 'uv6r', 'uvb5', 'vgc', 'vx170', 'vx2', 'vx3', 'vx5', 'vx510', 'vx6', 'vx7', 'vx8', 'vxa700', 'wouxun', 'wouxun_common', 'yaesu_clone', 'iradio_uv_5118plus', 'kenwood_d7', 'tdh8', 'mml_jc8810', 'uvk5'] diff --git a/chirp/drivers/alinco.py b/chirp/drivers/alinco.py index df8622d..5313b7d 100644 --- a/chirp/drivers/alinco.py +++ b/chirp/drivers/alinco.py @@ -16,12 +16,12 @@ from chirp import chirp_common, bitwise, memmap, errors, directory, util from chirp.settings import RadioSettingGroup, RadioSetting -from chirp.settings import RadioSettingValueBoolean, RadioSettings +from chirp.settings import RadioSettingValueBoolean -from textwrap import dedent import time import logging +import codecs LOG = logging.getLogger(__name__) @@ -75,54 +75,36 @@ RLENGTH = 2 + 5 + 32 + 2 STEPS = [5.0, 10.0, 12.5, 15.0, 20.0, 25.0, 30.0] -def isascii(data): - for byte in data: - if (ord(byte) < ord(" ") or ord(byte) > ord("~")) and \ - byte not in "\r\n": - return False - return True - - -def tohex(data): - if isascii(data): - return repr(data) - string = "" - for byte in data: - string += "%02X" % ord(byte) - return string - - class AlincoStyleRadio(chirp_common.CloneModeRadio): """Base class for all known Alinco radios""" _memsize = 0 _model = b"NONE" + NEEDS_COMPAT_SERIAL = False def _send(self, data): - LOG.debug("PC->R: (%2i) %s" % (len(data), tohex(data))) + LOG.debug("PC->R: (%2i)\n%s" % (len(data), util.hexprint(data))) self.pipe.write(data) self.pipe.read(len(data)) def _read(self, length): data = self.pipe.read(length) - LOG.debug("R->PC: (%2i) %s" % (len(data), tohex(data))) + LOG.debug("R->PC: (%2i)\n%s" % (len(data), util.hexprint(data))) return data def _download_chunk(self, addr): if addr % 16: raise Exception("Addr 0x%04x not on 16-byte boundary" % addr) - cmd = "AL~F%04XR\r\n" % addr + cmd = b"AL~F%04XR\r\n" % addr self._send(cmd) resp = self._read(RLENGTH).strip() if len(resp) == 0: raise errors.RadioError("No response from radio") - if ":" not in resp: + if b":" not in resp: raise errors.RadioError("Unexpected response from radio") - addr, _data = resp.split(":", 1) - data = "" - for i in range(0, len(_data), 2): - data += chr(int(_data[i:i+2], 16)) + addr, _data = resp.split(b":", 1) + data = codecs.decode(_data, 'hex') if len(data) != 16: LOG.debug("Response was:") @@ -136,10 +118,10 @@ class AlincoStyleRadio(chirp_common.CloneModeRadio): def _download(self, limit): self._identify() - data = "" + data = b"" for addr in range(0, limit, 16): - data += self._download_chunk(addr) time.sleep(0.1) + data += self._download_chunk(addr) if self.status_fn: status = chirp_common.Status() @@ -148,16 +130,16 @@ class AlincoStyleRadio(chirp_common.CloneModeRadio): status.msg = "Downloading from radio" self.status_fn(status) - self._send("AL~E\r\n") + self._send(b"AL~E\r\n") self._read(20) return memmap.MemoryMap(data) def _identify(self): for _i in range(0, 3): - self._send("%s\r\n" % self._model) + self._send(b"%s\r\n" % self._model) resp = self._read(6) - if resp.strip() == "OK": + if resp.strip() == b"OK": return True time.sleep(1) @@ -168,9 +150,9 @@ class AlincoStyleRadio(chirp_common.CloneModeRadio): raise Exception("Addr 0x%04x not on 16-byte boundary" % addr) _data = self._mmap[addr:addr+16] - data = "".join(["%02X" % ord(x) for x in _data]) + data = codecs.encode(_data, 'hex').upper() - cmd = "AL~F%04XW%s\r\n" % (addr, data) + cmd = b"AL~F%04XW%s\r\n" % (addr, data) self._send(cmd) def _upload(self, limit): @@ -178,8 +160,8 @@ class AlincoStyleRadio(chirp_common.CloneModeRadio): raise Exception("I can't talk to this model") for addr in range(0x100, limit, 16): - self._upload_chunk(addr) time.sleep(0.1) + self._upload_chunk(addr) if self.status_fn: status = chirp_common.Status() @@ -188,8 +170,8 @@ class AlincoStyleRadio(chirp_common.CloneModeRadio): status.msg = "Uploading to radio" self.status_fn(status) - self._send("AL~E\r\n") - self.pipe._read(20) + self._send(b"AL~E\r\n") + self._read(20) def process_mmap(self): self._memobj = bitwise.parse(DRX35_MEM_FORMAT, self._mmap) @@ -220,7 +202,7 @@ TMODES = ["", "Tone", "", "TSQL"] + [""] * 12 TMODES[12] = "DTCS" DCS_CODES = { "Alinco": chirp_common.DTCS_CODES, - "Jetstream": [17] + chirp_common.DTCS_CODES, + "Jetstream": (17,) + chirp_common.DTCS_CODES, } CHARSET = (["\x00"] * 0x30) + \ @@ -251,6 +233,7 @@ def _set_name(mem, _mem): pass return name + ALINCO_TONES = list(chirp_common.TONES) ALINCO_TONES.remove(159.8) ALINCO_TONES.remove(165.5) @@ -333,6 +316,8 @@ class DRx35Radio(AlincoStyleRadio): if not self._get_used(number) and self.MODEL != "JT220M": mem.empty = True return mem + elif self.MODEL == 'JT220M': + mem.immutable = ['empty'] mem.freq = int(_mem.freq) * 100 mem.rtone = self._valid_tones[_mem.rtone] @@ -552,20 +537,18 @@ class DJ175Radio(DRx35Radio): if addr % 16: raise Exception("Addr 0x%04x not on 16-byte boundary" % addr) - cmd = "AL~F%04XR\r\n" % addr + cmd = b"AL~F%04XR\r\n" % addr self._send(cmd) _data = self._read(34).strip() if len(_data) == 0: raise errors.RadioError("No response from radio") - data = "" - for i in range(0, len(_data), 2): - data += chr(int(_data[i:i+2], 16)) + data = codecs.decode(_data, 'hex') if len(data) != 16: LOG.debug("Response was:") - LOG.debug("|%s|") + LOG.debug("|%r|" % _data) LOG.debug("Which I converted to:") LOG.debug(util.hexprint(data)) raise Exception("Radio returned less than 16 bytes") @@ -573,7 +556,7 @@ class DJ175Radio(DRx35Radio): return data -DJG7EG_MEM_FORMAT = """ +DJG7_MEM_FORMAT = """ #seekto 0x200; ul16 bank[50]; ul16 special_bank[7]; @@ -599,8 +582,7 @@ struct { """ -@directory.register -class AlincoDJG7EG(AlincoStyleRadio): +class AlincoDJG7(AlincoStyleRadio): """Alinco DJ-G7EG""" VENDOR = "Alinco" MODEL = "DJ-G7EG" @@ -614,33 +596,30 @@ class AlincoDJG7EG(AlincoStyleRadio): TMODES = ["", "??1", "Tone", "TSQL", "TSQL-R", "DTCS"] # This is a bit of a hack to avoid overwriting _identify() - _model = b"AL~DJ-G7EG" _memsize = 0x1a7c0 _range = [(500000, 1300000000)] @classmethod def get_prompts(cls): rp = chirp_common.RadioPrompts() - rp.pre_download = _(dedent("""\ - 1. Ensure your firmware version is 4_10 or higher - 2. Turn radio off - 3. Connect your interface cable - 4. Turn radio on - 5. Press and release PTT 3 times while holding MONI key - 6. Supported baud rates: 57600 (default) and 19200 - (rotate dial while holding MONI to change) - 7. Click OK - """)) - rp.pre_upload = _(dedent("""\ - 1. Ensure your firmware version is 4_10 or higher - 2. Turn radio off - 3. Connect your interface cable - 4. Turn radio on - 5. Press and release PTT 3 times while holding MONI key - 6. Supported baud rates: 57600 (default) and 19200 - (rotate dial while holding MONI to change) - 7. Click OK - """)) + rp.pre_download = _( + "1. Ensure your firmware version is 4_10 or higher\n" + "2. Turn radio off\n" + "3. Connect your interface cable\n" + "4. Turn radio on\n" + "5. Press and release PTT 3 times while holding MONI key\n" + "6. Supported baud rates: 57600 (default) and 19200\n" + " (rotate dial while holding MONI to change)\n" + "7. Click OK\n") + rp.pre_upload = _( + "1. Ensure your firmware version is 4_10 or higher\n" + "2. Turn radio off\n" + "3. Connect your interface cable\n" + "4. Turn radio on\n" + "5. Press and release PTT 3 times while holding MONI key\n" + "6. Supported baud rates: 57600 (default) and 19200\n" + " (rotate dial while holding MONI to change)\n" + "7. Click OK\n") return rp def get_features(self): @@ -664,7 +643,7 @@ class AlincoDJG7EG(AlincoStyleRadio): if addr % 0x40: raise Exception("Addr 0x%04x not on 64-byte boundary" % addr) - cmd = "AL~F%05XR\r" % addr + cmd = b"AL~F%05XR\r" % addr self._send(cmd) # Response: "\r\n[ ... data ... ]\r\n @@ -673,13 +652,11 @@ class AlincoDJG7EG(AlincoStyleRadio): if len(_data) == 0: raise errors.RadioError("No response from radio") - data = "" - for i in range(0, len(_data), 2): - data += chr(int(_data[i:i+2], 16)) + data = codecs.decode(_data, "hex") if len(data) != 64: LOG.debug("Response was:") - LOG.debug("|%s|") + LOG.debug("|%s|" % _data) LOG.debug("Which I converted to:") LOG.debug(util.hexprint(data)) raise Exception("Chunk from radio has wrong size") @@ -699,7 +676,7 @@ class AlincoDJG7EG(AlincoStyleRadio): def _download(self, limit): self._detect_baudrate_and_identify() - data = "\x00"*0x200 + data = b"\x00"*0x200 for addr in range(0x200, limit, 0x40): data += self._download_chunk(addr) @@ -712,20 +689,20 @@ class AlincoDJG7EG(AlincoStyleRadio): status.max = limit status.msg = "Downloading from radio" self.status_fn(status) - return memmap.MemoryMap(data) + return memmap.MemoryMapBytes(data) def _upload_chunk(self, addr): if addr % 0x40: raise Exception("Addr 0x%04x not on 64-byte boundary" % addr) _data = self._mmap[addr:addr+0x40] - data = "".join(["%02X" % ord(x) for x in _data]) + data = codecs.encode(_data, "hex").upper() - cmd = "AL~F%05XW%s\r" % (addr, data) + cmd = b"AL~F%05XW%s\r" % (addr, data) self._send(cmd) resp = self._read(6) - if resp.strip() != "OK": + if resp.strip() != b"OK": raise Exception("Unexpected response from radio: %s" % resp) def _upload(self, limit): @@ -778,7 +755,7 @@ class AlincoDJG7EG(AlincoStyleRadio): "frequency. Touch channel to fix." % number) def process_mmap(self): - self._memobj = bitwise.parse(DJG7EG_MEM_FORMAT, self._mmap) + self._memobj = bitwise.parse(DJG7_MEM_FORMAT, self._mmap) # We check all channels for corruption (see bug #5275) but we don't fix # it automatically because it would be unpolite to modify something on # a read operation. A log message is emitted though for the user to @@ -841,7 +818,7 @@ class AlincoDJG7EG(AlincoStyleRadio): elif mem.tmode == "TSQL": _mem.squelch_type = self.TMODES.index("TSQL") # Note how the same TSQL tone is copied to both memory - # locaations + # locations try: _mem.tx_tone = ALINCO_TONES.index(mem.ctone)+1 _mem.rx_tone = ALINCO_TONES.index(mem.ctone)+1 @@ -862,8 +839,22 @@ class AlincoDJG7EG(AlincoStyleRadio): "This radio does not support tone %.1fHz" % mem.ctone) _mem.dcs = DCS_CODES[self.VENDOR].index(mem.dtcs) _mem.skip = (mem.skip == "S") - _mem.name = "\x00".join(mem.name).ljust(32, "\x00") + _mem.name = "\x00".join(mem.name.rstrip()).ljust(32, "\x00") _mem.unknown1 = 0x3e001c _mem.unknown2 = 0x0000000a _mem.unknown3 = 0x00000000 _mem.unknown4 = 0x00000000 + + +@directory.register +class AlincoDJG7EG(AlincoDJG7): + """Alinco DJ-G7EG""" + MODEL = "DJ-G7EG" + _model = b"AL~DJ-G7EG" + + +@directory.register +class AlincoDJG7T(AlincoDJG7): + """Alinco DJ-G7T""" + MODEL = "DJ-G7T" + _model = b"AL~DJ-G7T" diff --git a/chirp/drivers/anytone.py b/chirp/drivers/anytone.py index 876583d..e99b5d7 100644 --- a/chirp/drivers/anytone.py +++ b/chirp/drivers/anytone.py @@ -13,9 +13,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import os import struct -import time import logging from chirp import bitwise @@ -231,17 +229,18 @@ def _read(radio, length): raise errors.RadioError("Short read from radio") return data -valid_model = ['QX588UV', 'HR-2040', 'DB-50M\x00', 'DB-750X'] + +valid_model = [b'QX588UV', b'HR-2040', b'DB-50M\x00', b'DB-750X'] def _ident(radio): radio.pipe.timeout = 1 - _echo_write(radio, "PROGRAM") + _echo_write(radio, b"PROGRAM") response = radio.pipe.read(3) - if response != "QX\x06": + if response != b"QX\x06": LOG.debug("Response was:\n%s" % util.hexprint(response)) raise errors.RadioError("Unsupported model or bad connection") - _echo_write(radio, "\x02") + _echo_write(radio, b"\x02") response = radio.pipe.read(16) LOG.debug(util.hexprint(response)) if response[1:8] not in valid_model: @@ -250,10 +249,10 @@ def _ident(radio): def _finish(radio): - endframe = "\x45\x4E\x44" + endframe = b"\x45\x4E\x44" _echo_write(radio, endframe) result = radio.pipe.read(1) - if result != "\x06": + if result != b"\x06": LOG.debug("Got:\n%s" % util.hexprint(result)) raise errors.RadioError("Radio did not finish cleanly") @@ -261,7 +260,7 @@ def _finish(radio): def _checksum(data): cs = 0 for byte in data: - cs += ord(byte) + cs += byte return cs % 256 @@ -269,13 +268,12 @@ def _send(radio, cmd, addr, length, data=None): frame = struct.pack(">cHb", cmd, addr, length) if data: frame += data - frame += chr(_checksum(frame[1:])) - frame += "\x06" + frame += struct.pack('BB', _checksum(frame[1:]), 0x06) _echo_write(radio, frame) LOG.debug("Sent:\n%s" % util.hexprint(frame)) if data: result = radio.pipe.read(1) - if result != "\x06": + if result != b'\x06': LOG.debug("Ack was: %s" % repr(result)) raise errors.RadioError( "Radio did not accept block at %04x" % addr) @@ -285,7 +283,7 @@ def _send(radio, cmd, addr, length, data=None): header = result[0:4] data = result[4:-2] ack = result[-1] - if ack != "\x06": + if ack != 0x06: LOG.debug("Ack was: %s" % repr(ack)) raise errors.RadioError("Radio NAK'd block at %04x" % addr) _cmd, _addr, _length = struct.unpack(">cHb", header) @@ -295,9 +293,9 @@ def _send(radio, cmd, addr, length, data=None): LOG.debug(" Addr: %04x/%04x" % (addr, _addr)) raise errors.RadioError("Radio send unexpected block") cs = _checksum(result[1:-2]) - if cs != ord(result[-2]): + if cs != result[-2]: LOG.debug("Calculated: %02x" % cs) - LOG.debug("Actual: %02x" % ord(result[-2])) + LOG.debug("Actual: %02x" % result[-2]) raise errors.RadioError("Block at 0x%04x failed checksum" % addr) return data @@ -307,13 +305,13 @@ def _download(radio): memobj = None - data = "" + data = b"" for start, end in radio._ranges: for addr in range(start, end, BLOCK_SIZE): if memobj is not None and not _should_send_addr(memobj, addr): - block = "\xFF" * BLOCK_SIZE + block = b"\xFF" * BLOCK_SIZE else: - block = _send(radio, 'R', addr, BLOCK_SIZE) + block = _send(radio, b'R', addr, BLOCK_SIZE) data += block status = chirp_common.Status() @@ -327,7 +325,7 @@ def _download(radio): _finish(radio) - return memmap.MemoryMap(data) + return memmap.MemoryMapBytes(data) def _upload(radio): @@ -340,7 +338,7 @@ def _upload(radio): if not _should_send_addr(radio._memobj, addr): continue block = radio._mmap[addr:addr + BLOCK_SIZE] - _send(radio, 'W', addr, len(block), block) + _send(radio, b'W', addr, len(block), block) status = chirp_common.Status() status.cur = addr @@ -351,7 +349,7 @@ def _upload(radio): _finish(radio) -TONES = [62.5] + list(chirp_common.TONES) +TONES = tuple(sorted([62.5] + list(chirp_common.TONES))) TMODES = ['', 'Tone', 'DTCS', ''] DUPLEXES = ['', '-', '+', 'off'] MODES = ["FM", "FM", "NFM"] @@ -382,6 +380,7 @@ class AnyTone5888UVRadio(chirp_common.CloneModeRadio, MODEL = "5888UV" BAUD_RATE = 9600 _file_ident = [b"QX588UV", b"588UVN"] + NEEDS_COMPAT_SERIAL = False # May try to mirror the OEM behavior later _ranges = [ @@ -409,6 +408,7 @@ class AnyTone5888UVRadio(chirp_common.CloneModeRadio, rf.valid_tmodes = ['', 'Tone', 'TSQL', 'DTCS', 'Cross'] rf.valid_cross_modes = ['Tone->DTCS', 'DTCS->Tone', '->Tone', '->DTCS', 'Tone->Tone'] + rf.valid_tones = TONES rf.valid_dtcs_codes = chirp_common.ALL_DTCS_CODES rf.valid_bands = [(108000000, 500000000)] rf.valid_characters = chirp_common.CHARSET_UPPER_NUMERIC + "-" diff --git a/chirp/drivers/anytone778uv.py b/chirp/drivers/anytone778uv.py index ace5ab5..d06f645 100644 --- a/chirp/drivers/anytone778uv.py +++ b/chirp/drivers/anytone778uv.py @@ -24,18 +24,18 @@ # * Tx off # * Duplex (+ve, -ve, odd, and off splits) # * Transmit power -# * Channel width (25kHz and 12.5kHz) +# * Channel width (25 kHz and 12.5 kHz) # * Retevis RT95, CRT Micron UV, and Midland DBR2500 radios # * Full range of frequencies for tx and rx, supported band read from radio # during download, not verified on upload. Radio will refuse to TX if out of # band. +# * Busy channel lock out (for each memory) # # Unsupported features # * VFO1, VFO2, and TRF memories # * custom CTCSS tones # * Any non-memory radio settings # * Reverse, talkaround, scramble -# * busy channel lock out # * probably other things too - like things encoded by the unknown bits in the # memory struct @@ -43,8 +43,7 @@ from chirp import chirp_common, directory, memmap, errors, util from chirp import bitwise from chirp.settings import RadioSettingGroup, RadioSetting, \ RadioSettingValueBoolean, RadioSettingValueList, \ - RadioSettingValueString, RadioSettingValueInteger, \ - RadioSettingValueFloat, RadioSettings, InvalidValueError + RadioSettingValueString, RadioSettings import struct import time @@ -457,10 +456,10 @@ def exit_program_mode(radio): def parse_read_response(resp): addr = resp[:4] data = bytes(resp[4:-2]) - cs = checksum(ord(d) for d in resp[1:-2]) - valid = cs == ord(resp[-2]) + cs = checksum(d for d in resp[1:-2]) + valid = cs == resp[-2] if not valid: - LOG.error('checksumfail: %02x, expected %02x' % (cs, ord(resp[-2]))) + LOG.error('checksumfail: %02x, expected %02x' % (cs, resp[-2])) LOG.error('msg data: %s' % util.hexprint(resp)) return addr, data, valid @@ -481,7 +480,7 @@ def do_download(radio): status = chirp_common.Status() status.cur = 0 status.max = (MEMORY_ADDRESS_RANGE[1] - - MEMORY_ADDRESS_RANGE[0])/MEMORY_RW_BLOCK_SIZE + MEMORY_ADDRESS_RANGE[0]) // MEMORY_RW_BLOCK_SIZE status.msg = 'Cloning from radio...' radio.status_fn(status) @@ -499,7 +498,7 @@ def do_download(radio): # update UI status.cur = (addr - MEMORY_ADDRESS_RANGE[0])\ - / MEMORY_RW_BLOCK_SIZE + // MEMORY_RW_BLOCK_SIZE radio.status_fn(status) exit_program_mode(radio) @@ -515,7 +514,7 @@ def do_download(radio): def make_write_data_cmd(addr, data, datalen): cmd = struct.pack('>BHB', 0x57, addr, datalen) cmd += data - cs = checksum(ord(c) for c in cmd[1:]) + cs = checksum(c for c in cmd[1:]) cmd += struct.pack('>BB', cs, 0x06) return cmd @@ -569,7 +568,7 @@ def do_upload(radio): bptr += MEMORY_RW_BLOCK_SIZE if write_response == '\x0a': - # NACK from radio, e.g. checksum wrongn + # NACK from radio, e.g. checksum wrong LOG.debug('Radio returned 0x0a - NACK:') LOG.debug(' * write cmd:\n%s' % util.hexprint(write_command)) LOG.debug(' * write response:\n%s' % @@ -642,7 +641,7 @@ def dtcs_code_val_to_bits(code): class AnyTone778UVBase(chirp_common.CloneModeRadio, chirp_common.ExperimentalRadio): - '''AnyTone 778UV and probably Retivis RT95 and others''' + '''AnyTone 778UV and probably Retevis RT95 and others''' BAUD_RATE = 9600 NEEDS_COMPAT_SERIAL = False NAME_LENGTH = 5 @@ -691,11 +690,12 @@ class AnyTone778UVBase(chirp_common.CloneModeRadio, try: rf.valid_bands = get_band_limits_Hz( int(self._memobj.radio_settings.bandlimit)) - except TypeError as e: + except AttributeError: # If we're asked without memory loaded, assume the most permissive rf.valid_bands = get_band_limits_Hz(1) except Exception as e: - LOG.error('Failed to get band limits for anytone778uv: %s' % e) + LOG.exception( + 'Failed to get band limits for anytone778uv: %s' % e) rf.valid_bands = get_band_limits_Hz(1) rf.valid_modes = ['FM', 'NFM'] rf.valid_power_levels = POWER_LEVELS @@ -778,7 +778,7 @@ class AnyTone778UVBase(chirp_common.CloneModeRadio, mem.mode = 'FM' elif _mem.channel_width == CHANNEL_WIDTH_20kHz: LOG.info( - '%s: get_mem: promoting 20kHz channel width to 25kHz' % + '%s: get_mem: promoting 20 kHz channel width to 25 kHz' % mem.name) mem.mode = 'FM' elif _mem.channel_width == CHANNEL_WIDTH_12d5kHz: @@ -887,7 +887,7 @@ class AnyTone778UVBase(chirp_common.CloneModeRadio, mem.rx_dtcs = rxcode # #8327 Not sure this is the correct interpretation of # DevelopersToneModes, but it seems to make it work round - # tripping with the anytone software. DTM implies that we + # tripping with the Anytone software. DTM implies that we # might not need to set mem.dtcs, but if we do it only DTCS # rx works (as if we were Cross:None->DTCS). mem.dtcs = rxcode @@ -921,6 +921,16 @@ class AnyTone778UVBase(chirp_common.CloneModeRadio, (dtcs_pol_bit_to_str[_mem.dtcs_encode_invert == 1], dtcs_pol_bit_to_str[_mem.dtcs_decode_invert == 1]) + # Extra + mem.extra = RadioSettingGroup("Extra", "extra") + + # Busy channel lockout + bcl_options = ['Off', 'Repeater', 'Busy'] + bcl_option = bcl_options[_mem.busy_channel_lockout] + rs = RadioSetting("busy_channel_lockout", "Busy Channel Lockout", + RadioSettingValueList(bcl_options, bcl_option)) + mem.extra.append(rs) + return mem # Store details about a high-level memory to the memory map @@ -959,9 +969,6 @@ class AnyTone778UVBase(chirp_common.CloneModeRadio, # new VOX models with 6-character name length _mem.name = mem.name.ljust(self.NAME_LENGTH)[:self.NAME_LENGTH] - # TODO support busy channel lockout - disabled for now - _mem.busy_channel_lockout = BUSY_CHANNEL_LOCKOUT_OFF - # Set duplex bitfields if mem.duplex == '+': _mem.duplex = DUPLEX_POSSPLIT @@ -981,7 +988,7 @@ class AnyTone778UVBase(chirp_common.CloneModeRadio, if mem.duplex == 'off': _mem.tx_off = 1 - # Set the channel width - remember we promote 20kHz channels to FM + # Set the channel width - remember we promote 20 kHz channels to FM # on import # , so don't handle them here if mem.mode == 'FM': @@ -1091,6 +1098,10 @@ class AnyTone778UVBase(chirp_common.CloneModeRadio, _mem.unknown8 = 0x00 _mem.unknown9 = 0x00 + # Extra settings (eg. Busy channel lockout) + for setting in mem.extra: + setattr(_mem, setting.get_name(), setting.value) + def get_settings(self): """Translate the MEM_FORMAT structs into setstuf in the UI""" _settings = self._memobj.settings @@ -1308,7 +1319,7 @@ class AnyTone778UVBase(chirp_common.CloneModeRadio, rset = RadioSetting("settings.tbstFrequency", "TBST frequency", rs) function.append(rset) - # Save Channel Perameter + # Save Channel Parameter rs = RadioSettingValueBoolean(_settings.saveChParameter) rset = RadioSetting("settings.saveChParameter", "Save channel parameter", rs) @@ -1321,8 +1332,8 @@ class AnyTone778UVBase(chirp_common.CloneModeRadio, function.append(rset) # Frequency Step - options = ["2.5 KHz", "5 KHz", "6.25 KHz", "10 KHz", "12.5 KHz", - "20 KHz", "25 KHz", "30 KHz", "50 KHz"] + options = ["2.5 kHz", "5 kHz", "6.25 kHz", "10 kHz", "12.5 kHz", + "20 kHz", "25 kHz", "30 kHz", "50 kHz"] rs = RadioSettingValueList(options, options[_settings.frequencyStep]) rset = RadioSetting("settings.frequencyStep", "Frequency step", rs) function.append(rset) @@ -1713,10 +1724,11 @@ class AnyTone778UVBase(chirp_common.CloneModeRadio, elif element.value.get_mutable(): LOG.debug("Setting %s = %s" % (setting, element.value)) setattr(obj, setting, element.value) - except Exception as e: + except Exception: LOG.debug(element.get_name()) raise + # Original non-VOX models if has_future: @directory.register @@ -1761,10 +1773,11 @@ if has_future: class AnyTone778UVvoxBase(AnyTone778UVBase): - '''AnyTone 778UV VOX, Retivis RT95 VOX and others''' + '''AnyTone 778UV VOX, Retevis RT95 VOX and others''' NAME_LENGTH = 6 HAS_VOX = True + # New VOX models if has_future: @directory.register diff --git a/chirp/drivers/anytone_ht.py b/chirp/drivers/anytone_ht.py index 4290800..69fdda4 100644 --- a/chirp/drivers/anytone_ht.py +++ b/chirp/drivers/anytone_ht.py @@ -13,9 +13,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import os import struct -import time import logging from chirp import bitwise @@ -27,7 +25,7 @@ from chirp import util from chirp.settings import RadioSetting, RadioSettingGroup, \ RadioSettingValueInteger, RadioSettingValueList, \ RadioSettingValueBoolean, RadioSettingValueString, \ - RadioSettingValueFloat, InvalidValueError, RadioSettings + RadioSettings LOG = logging.getLogger(__name__) @@ -252,17 +250,18 @@ def _read(radio, length): raise errors.RadioError("Short read from radio") return data -valid_model = ['TERMN8R', 'OBLTR8R'] + +valid_model = [b'TERMN8R', b'OBLTR8R'] def _ident(radio): radio.pipe.timeout = 1 - _echo_write(radio, "PROGRAM") + _echo_write(radio, b"PROGRAM") response = radio.pipe.read(3) - if response != "QX\x06": + if response != b"QX\x06": LOG.debug("Response was:\n%s" % util.hexprint(response)) raise errors.RadioError("Radio did not respond. Check connection.") - _echo_write(radio, "\x02") + _echo_write(radio, b"\x02") response = radio.pipe.read(16) LOG.debug(util.hexprint(response)) if radio._file_ident not in response: @@ -271,10 +270,10 @@ def _ident(radio): def _finish(radio): - endframe = "\x45\x4E\x44" + endframe = b"\x45\x4E\x44" _echo_write(radio, endframe) result = radio.pipe.read(1) - if result != "\x06": + if result != b"\x06": LOG.debug("Got:\n%s" % util.hexprint(result)) raise errors.RadioError("Radio did not finish cleanly") @@ -282,7 +281,7 @@ def _finish(radio): def _checksum(data): cs = 0 for byte in data: - cs += ord(byte) + cs += byte return cs % 256 @@ -290,23 +289,23 @@ def _send(radio, cmd, addr, length, data=None): frame = struct.pack(">cHb", cmd, addr, length) if data: frame += data - frame += chr(_checksum(frame[1:])) - frame += "\x06" + frame += bytes([_checksum(frame[1:])]) + frame += b"\x06" _echo_write(radio, frame) LOG.debug("Sent:\n%s" % util.hexprint(frame)) if data: result = radio.pipe.read(1) - if result != "\x06": + if result != b"\x06": LOG.debug("Ack was: %s" % repr(result)) raise errors.RadioError( "Radio did not accept block at %04x" % addr) return result = _read(radio, length + 6) LOG.debug("Got:\n%s" % util.hexprint(result)) - header = result[0:4] + header = result[:4] data = result[4:-2] - ack = result[-1] - if ack != "\x06": + ack = result[-1:] + if ack != b"\x06": LOG.debug("Ack was: %s" % repr(ack)) raise errors.RadioError("Radio NAK'd block at %04x" % addr) _cmd, _addr, _length = struct.unpack(">cHb", header) @@ -316,9 +315,9 @@ def _send(radio, cmd, addr, length, data=None): LOG.debug(" Addr: %04x/%04x" % (addr, _addr)) raise errors.RadioError("Radio send unexpected block") cs = _checksum(result[1:-2]) - if cs != ord(result[-2]): + if cs != result[-2]: LOG.debug("Calculated: %02x" % cs) - LOG.debug("Actual: %02x" % ord(result[-2])) + LOG.debug("Actual: %02x" % result[-2]) raise errors.RadioError("Block at 0x%04x failed checksum" % addr) return data @@ -328,10 +327,10 @@ def _download(radio): memobj = None - data = "" + data = b"" for start, end in radio._ranges: for addr in range(start, end, 0x10): - block = _send(radio, 'R', addr, 0x10) + block = _send(radio, b'R', addr, 0x10) data += block status = chirp_common.Status() @@ -342,7 +341,7 @@ def _download(radio): _finish(radio) - return memmap.MemoryMap(data) + return memmap.MemoryMapBytes(data) def _upload(radio): @@ -353,7 +352,7 @@ def _upload(radio): if addr < 0x0100: continue block = radio._mmap[addr:addr + 0x10] - _send(radio, 'W', addr, len(block), block) + _send(radio, b'W', addr, len(block), block) status = chirp_common.Status() status.cur = addr @@ -410,6 +409,7 @@ class AnyToneTERMN8RRadio(chirp_common.CloneModeRadio, VENDOR = "AnyTone" MODEL = "TERMN-8R" BAUD_RATE = 9600 + NEEDS_COMPAT_SERIAL = False _file_ident = b"TERMN8R" # May try to mirror the OEM behavior later @@ -438,6 +438,7 @@ class AnyToneTERMN8RRadio(chirp_common.CloneModeRadio, rf.valid_tmodes = ['', 'Tone', 'TSQL', 'DTCS', 'Cross'] rf.valid_cross_modes = ["Tone->Tone", "Tone->DTCS", "DTCS->Tone", "->Tone", "->DTCS", "DTCS->", "DTCS->DTCS"] + rf.valid_tones = TONES rf.valid_dtcs_codes = chirp_common.ALL_DTCS_CODES rf.valid_bands = [(136000000, 174000000), (400000000, 520000000)] @@ -938,7 +939,7 @@ class AnyToneTERMN8RRadio(chirp_common.CloneModeRadio, else: LOG.debug("Setting %s = %s" % (setting, element.value)) setattr(obj, setting, element.value) - except Exception as e: + except Exception: LOG.debug(element.get_name()) raise diff --git a/chirp/drivers/anytone_iii.py b/chirp/drivers/anytone_iii.py index b72a4b6..48a74a1 100644 --- a/chirp/drivers/anytone_iii.py +++ b/chirp/drivers/anytone_iii.py @@ -13,9 +13,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import os import struct -import time import logging import string @@ -28,18 +26,19 @@ from chirp import util from chirp.settings import RadioSetting, RadioSettingGroup, \ RadioSettingValueInteger, RadioSettingValueList, \ RadioSettingValueBoolean, RadioSettingValueString, \ - RadioSettingValueFloat, InvalidValueError, RadioSettings + RadioSettingValueFloat, RadioSettings class ATBankModel(chirp_common.BankModel): - """Anytone Banks A-J, Each chan in zero or one bank""" + """AnyTone Banks A-J, Each chan in zero or one bank""" def __init__(self, radio, name='Banks'): super(ATBankModel, self).__init__(radio, name) self._banks = [] self._memBounds = list(range(0, 750)) for i in range(0, 10): - self._banks.append(chirp_common.Bank(self, i, string.ascii_uppercase[i])) + self._banks.append( + chirp_common.Bank(self, i, string.ascii_uppercase[i])) def get_num_mappings(self): return len(self._banks) @@ -132,7 +131,7 @@ struct memory { txdcsextra:1, // use with txcode for index of tx DCS to use rxdcsinv:1, // inverse DCS rx polarity txdcsinv:1, // inverse DCS tx polarity - channel_width:2, // [25kHz, 20kHz, 12.5kHz] + channel_width:2, // [25 kHz, 20 kHz, 12.5 kHz] rev:1, // reverse the tx and rx frequencies & tones txoff:1; // prevent tx u8 talkaround:1, // Use the rx freq & tone when transmitting @@ -538,33 +537,34 @@ def _read(radio, length): raise errors.RadioError("Short read from radio") return data -valid_model = ['I588UVP'] + +valid_model = [b'I588UVP'] def _ident(radio): radio.pipe.timeout = 1 - _echo_write(radio, "PROGRAM") + _echo_write(radio, b"PROGRAM") response = radio.pipe.read(3) - if response != "QX\x06": + if response != b"QX\x06": LOG.debug("Response was:\n%s" % util.hexprint(response)) raise errors.RadioError("Unsupported model") - _echo_write(radio, "\x02") + _echo_write(radio, b"\x02") response = radio.pipe.read(16) LOG.debug(util.hexprint(response)) - if response[15] != "\x06": + if response[-1:] != b"\x06": LOG.debug("Response was:\n%s" % util.hexprint(response)) raise errors.RadioError("Missing ack") if response[0:7] not in valid_model: LOG.debug("Response was:\n%s" % util.hexprint(response)) raise errors.RadioError("Unsupported model") - # Manufacturer software does this also: _send(radio, 'R', 0x0080, 0x10) + # Manufacturer software does this also: _send(radio, b'R', 0x0080, 0x10) def _finish(radio): - endframe = "\x45\x4E\x44" + endframe = b"\x45\x4E\x44" _echo_write(radio, endframe) result = radio.pipe.read(1) - if result != "\x06": + if result != b"\x06": LOG.debug("Got:\n%s" % util.hexprint(result)) raise errors.RadioError("Radio did not finish cleanly") @@ -572,7 +572,7 @@ def _finish(radio): def _checksum(data): cs = 0 for byte in data: - cs += ord(byte) + cs += byte return cs % 256 @@ -580,14 +580,14 @@ def _send(radio, cmd, addr, length, data=None): frame = struct.pack(">cHb", cmd, addr, length) if data: frame += data - frame += chr(_checksum(frame[1:])) - frame += "\x06" + frame += bytes([_checksum(frame[1:])]) + frame += b"\x06" _echo_write(radio, frame) LOG.debug("Sent:\n%s" % util.hexprint(frame)) if data: result = radio.pipe.read(1) - if result != "\x06": - LOG.debug("Ack was: %s" % repr(result)) + if result != b"\x06": + LOG.debug("Ack was: %s" % util.hexprint(result)) raise errors.RadioError( "Radio did not accept block at %04x" % addr) return @@ -595,8 +595,8 @@ def _send(radio, cmd, addr, length, data=None): LOG.debug("Got:\n%s" % util.hexprint(result)) header = result[0:4] data = result[4:-2] - ack = result[-1] - if ack != "\x06": + ack = result[-1:] + if ack != b"\x06": LOG.debug("Ack was: %s" % repr(ack)) raise errors.RadioError("Radio NAK'd block at %04x" % addr) _cmd, _addr, _length = struct.unpack(">cHb", header) @@ -606,9 +606,9 @@ def _send(radio, cmd, addr, length, data=None): LOG.debug(" Addr: %04x/%04x" % (addr, _addr)) raise errors.RadioError("Radio send unexpected block") cs = _checksum(result[1:-2]) - if cs != ord(result[-2]): + if cs != result[-2]: LOG.debug("Calculated: %02x" % cs) - LOG.debug("Actual: %02x" % ord(result[-2])) + LOG.debug("Actual: %02x" % result[-2]) raise errors.RadioError("Block at 0x%04x failed checksum" % addr) return data @@ -618,13 +618,13 @@ def _download(radio): memobj = None - data = "" + data = b"" for start, end in radio._ranges: for addr in range(start, end, 0x10): if memobj is not None and not _should_send_addr(memobj, addr): - block = "\x00" * 0x10 + block = b"\x00" * 0x10 else: - block = _send(radio, 'R', addr, 0x10) + block = _send(radio, b'R', addr, 0x10) data += block status = chirp_common.Status() @@ -638,7 +638,7 @@ def _download(radio): _finish(radio) - return memmap.MemoryMap(data) + return memmap.MemoryMapBytes(data) def _upload(radio): @@ -649,7 +649,7 @@ def _upload(radio): if not _should_send_addr(radio._memobj, addr): continue block = radio._mmap[addr:addr + 0x10] - _send(radio, 'W', addr, len(block), block) + _send(radio, b'W', addr, len(block), block) status = chirp_common.Status() status.cur = addr @@ -712,7 +712,7 @@ T_MODES = ['', 'Tone', 'DTCS', ''] TONE2_SLOTS = ['%d' % x for x in range(0, 24)] TONE5_SLOTS = ['%d' % x for x in range(0, 100)] # Future: chirp_common should present TONES instead of hard-coded list -TONES = [62.5] + chirp_common.TONES +TONES = (62.5,) + chirp_common.TONES TOT = ['Off'] + ['%s Minutes' % x for x in range(1, 31)] TUNING_STEPS = [2.5, 5, 6.25, 8.33, 10, 12.5, 15, 20, 25, 30] PTT_KEY_LOCKS = ["Off", "Right", "Left", "Both"] @@ -798,6 +798,7 @@ class AnyTone5888UVIIIRadio(chirp_common.CloneModeRadio, VENDOR = "AnyTone" MODEL = "5888UVIII" BAUD_RATE = 9600 + NEEDS_COMPAT_SERIAL = False _file_ident = b"588UVP" _ranges = [ @@ -1100,7 +1101,9 @@ class AnyTone5888UVIIIRadio(chirp_common.CloneModeRadio, "band.") _mem.set_raw("\x00" * 32) - _flg.unused = 0 + if _flg: + # Only non-special memories track this + _flg.unused = 0 _mem.freq = mem.freq @@ -1110,7 +1113,9 @@ class AnyTone5888UVIIIRadio(chirp_common.CloneModeRadio, _mem.band = band_idx break - _flg.left_only = 0 + if _flg: + # Only non-special memories have this + _flg.left_only = 0 if (not is_hyper_chan): if mem.mode == "AM": _flg.left_only = 1 diff --git a/chirp/drivers/ap510.py b/chirp/drivers/ap510.py index 36df4c0..c233d51 100644 --- a/chirp/drivers/ap510.py +++ b/chirp/drivers/ap510.py @@ -44,7 +44,7 @@ def decode_base100(u16): def drain(pipe): """Chew up any data waiting on @pipe""" - for x in xrange(3): + for x in range(3): buf = pipe.read(4096) if not buf: return @@ -53,7 +53,7 @@ def drain(pipe): def enter_setup(pipe): """Put AP510 in configuration mode.""" - for x in xrange(30): + for x in range(30): if x % 2: pipe.write("@SETUP") else: @@ -84,7 +84,7 @@ def download(radio): radio.pipe.write("@DISP") buf = "" - for status.cur in xrange(status.cur, status.max): + for status.cur in range(status.cur, status.max): buf += radio.pipe.read(1024) if buf.endswith("\r\n"): status.cur = status.max @@ -140,7 +140,7 @@ def boolstr(b): class AP510Memory(object): """Parses and generates AP510 key/value format - The AP510 sends it's configuration as a set of keys and values. There + The AP510 sends its configuration as a set of keys and values. There is one key/value pair per line. Line separators are \r\n. Keys are deliminated from values with the = symbol. @@ -242,7 +242,7 @@ class AP510Memory(object): class AP510Memory20141215(AP510Memory): """Compatible with firmware version 20141215""" - ATTR_MAP = dict(AP510Memory.ATTR_MAP.items() + { + ATTR_MAP = dict(list(AP510Memory.ATTR_MAP.items()) + list({ 'tx_volume': '21', # 1-6 'rx_volume': '22', # 1-9 'tx_power': '23', # 1: 1 watt, 0: 0.5 watt @@ -252,7 +252,7 @@ class AP510Memory20141215(AP510Memory): 'path3': '27', # like "WIDE1 1" else "0" 'multiple': '28', 'auto_on': '29', - }.items()) + }.items())) def get_multiple(self): return dict(zip( @@ -327,7 +327,7 @@ PATH = [ 'TEMP1-1,WIDE 2-1', 'WIDE2-1', ] -TABLE = "/\#&0>AW^_acnsuvz" +TABLE = r"/\#&0>AW^_acnsuvz" SYMBOL = "".join(map(chr, range(ord("!"), ord("~")+1))) BEACON = ['manual', 'auto', 'auto + manual', 'smart', 'smart + manual'] ALIAS = ['WIDE1-N', 'WIDE2-N', 'WIDE1-N + WIDE2-N'] @@ -343,13 +343,14 @@ RP_IMMUTABLE = ["number", "skip", "bank", "extd_number", "name", "rtone", "offset", "mode", "tuning_step", "bank_index"] +@directory.register class AP510Radio(chirp_common.CloneModeRadio): """Sainsonic AP510""" BAUD_RATE = 9600 VENDOR = "Sainsonic" MODEL = "AP510" - _model = "AVRT5" + _model = b"AVRT5" mem_upper_limit = 0 def get_features(self): @@ -380,7 +381,7 @@ class AP510Radio(chirp_common.CloneModeRadio): data = download(self) except errors.RadioError: raise - except Exception, e: + except Exception as e: raise errors.RadioError("Failed to communicate with radio: %s" % e) # _mmap isn't a Chirp MemoryMap, but since AP510Memory implements @@ -398,12 +399,12 @@ class AP510Radio(chirp_common.CloneModeRadio): upload(self) except errors.RadioError: raise - except Exception, e: + except Exception as e: raise errors.RadioError("Failed to communicate with radio: %s" % e) def load_mmap(self, filename): """Load the radio's memory map from @filename""" - mapfile = file(filename, "rb") + mapfile = open(filename, "rb") data = mapfile.read() if data.startswith('\r\n00=%s 20141215' % self._model): self._mmap = AP510Memory20141215(data) @@ -752,7 +753,7 @@ class AP510Radio(chirp_common.CloneModeRadio): multiple = self._mmap.multiple multiple['tf_card'] = TF_CARD.index(str(setting.value)) self._mmap.multiple = multiple - except: + except Exception: LOG.debug(setting.get_name()) raise @@ -804,4 +805,4 @@ class AP510Radio(chirp_common.CloneModeRadio): @classmethod def match_model(cls, filedata, filename): - return filedata.startswith('\r\n00=' + cls._model) + return filedata.startswith(b'\r\n00=' + cls._model) diff --git a/chirp/drivers/baofeng_common.py b/chirp/drivers/baofeng_common.py index 384e922..072d4e6 100644 --- a/chirp/drivers/baofeng_common.py +++ b/chirp/drivers/baofeng_common.py @@ -19,14 +19,17 @@ import time import struct import logging -from chirp import chirp_common, directory, memmap -from chirp import bitwise, errors, util +from chirp import chirp_common, memmap +from chirp import errors, util +from chirp import bandplan_na from chirp.settings import RadioSettingGroup, RadioSetting, \ RadioSettingValueBoolean, RadioSettingValueList LOG = logging.getLogger(__name__) STIMEOUT = 1.5 +TXPOWER_HIGH = 0x00 +TXPOWER_LOW = 0x02 def _clean_buffer(radio): @@ -62,7 +65,7 @@ def _rawsend(radio, data): def _make_frame(cmd, addr, length, data=""): - """Pack the info in the headder format""" + """Pack the info in the header format""" frame = struct.pack(">BHB", ord(cmd), addr, length) # add the data if set if len(data) != 0: @@ -93,13 +96,35 @@ def _recv(radio, addr, length): def _get_radio_firmware_version(radio): - msg = struct.pack(">BHB", ord("S"), radio._fw_ver_start, - radio._recv_block_size) - radio.pipe.write(msg) - block = _recv(radio, radio._fw_ver_start, radio._recv_block_size) - _rawsend(radio, "\x06") - time.sleep(0.05) - version = block[0:16] + # There is a problem in new radios where a different firmware version is + # received when directly reading a single block as compared to what is + # received when reading sequential blocks. This causes a mismatch between + # the image firmware version and the radio firmware version when uploading + # an image that came from the same radio. The workaround is to read 1 or + # more consecutive blocks prior to reading the block with the firmware + # version. + # + # Read 2 consecutive blocks to get the radio firmware version. + for addr in range(0x1E80, 0x1F00, radio._recv_block_size): + frame = _make_frame("S", addr, radio._recv_block_size) + + # sending the read request + _rawsend(radio, frame) + + if radio._ack_block and addr != 0x1E80: + ack = _rawrecv(radio, 1) + if ack != b"\x06": + raise errors.RadioError( + "Radio refused to send block 0x%04x" % addr) + + # now we read + block = _recv(radio, addr, radio._recv_block_size) + + _rawsend(radio, b"\x06") + time.sleep(0.05) + + # get firmware version from the last block read + version = block[48:64] return version @@ -126,18 +151,18 @@ def _do_ident(radio, magic): _rawsend(radio, magic) ack = _rawrecv(radio, 1) - if ack != "\x06": + if ack != b"\x06": if ack: LOG.debug(repr(ack)) raise errors.RadioError("Radio did not respond") - _rawsend(radio, "\x02") + _rawsend(radio, b"\x02") # Ok, get the response ident = _rawrecv(radio, radio._magic_response_length) # check if response is OK - if not ident.startswith("\xaa") or not ident.endswith("\xdd"): + if not ident.startswith(b"\xaa") or not ident.endswith(b"\xdd"): # bad response msg = "Unexpected response, got this:" msg += util.hexprint(ident) @@ -148,9 +173,9 @@ def _do_ident(radio, magic): LOG.info("Valid response, got this:") LOG.debug(util.hexprint(ident)) - _rawsend(radio, "\x06") + _rawsend(radio, b"\x06") ack = _rawrecv(radio, 1) - if ack != "\x06": + if ack != b"\x06": if ack: LOG.debug(repr(ack)) raise errors.RadioError("Radio refused clone") @@ -185,7 +210,7 @@ def _download(radio): if radio_ident == "\xFF" * 16: ident += radio.MODEL.ljust(8) - elif radio.MODEL in ("GMRS-V1", "MURS-V1"): + elif radio.MODEL in ("GMRS-V1", "GMRS-V2", "MURS-V1", "MURS-V2"): # check if radio_ident is OK if not radio_ident[:7] in radio._fileid: msg = "Incorrect model ID, got this:\n\n" @@ -196,11 +221,11 @@ def _download(radio): # UI progress status = chirp_common.Status() status.cur = 0 - status.max = radio._mem_size / radio._recv_block_size + status.max = radio._mem_size // radio._recv_block_size status.msg = "Cloning from radio..." radio.status_fn(status) - data = "" + data = b"" for addr in range(0, radio._mem_size, radio._recv_block_size): frame = _make_frame("S", addr, radio._recv_block_size) # DEBUG @@ -212,21 +237,21 @@ def _download(radio): if radio._ack_block: ack = _rawrecv(radio, 1) - if ack != "\x06": + if ack != b"\x06": raise errors.RadioError( "Radio refused to send block 0x%04x" % addr) # now we read d = _recv(radio, addr, radio._recv_block_size) - _rawsend(radio, "\x06") + _rawsend(radio, b"\x06") time.sleep(0.05) # aggregate the data data += d # UI Update - status.cur = addr / radio._recv_block_size + status.cur = addr // radio._recv_block_size status.msg = "Cloning from radio..." radio.status_fn(status) @@ -257,7 +282,7 @@ def _upload(radio): LOG.debug(msg) raise errors.RadioError("Image not supported by radio") - if radio_ident != "0xFF" * 16 and image_ident == radio_ident: + if radio_ident != b"0xFF" * 16 and image_ident == radio_ident: _ranges = radio._ranges else: _ranges = [(0x0000, 0x0DF0), @@ -266,7 +291,7 @@ def _upload(radio): # UI progress status = chirp_common.Status() status.cur = 0 - status.max = radio._mem_size / radio._send_block_size + status.max = radio._mem_size // radio._send_block_size status.msg = "Cloning to radio..." radio.status_fn(status) @@ -283,12 +308,12 @@ def _upload(radio): # receiving the response ack = _rawrecv(radio, 1) - if ack != "\x06": + if ack != b"\x06": msg = "Bad ack writing block 0x%04x" % addr raise errors.RadioError(msg) # UI Update - status.cur = addr / radio._send_block_size + status.cur = addr // radio._send_block_size status.msg = "Cloning to radio..." radio.status_fn(status) @@ -315,14 +340,9 @@ class BaofengCommonHT(chirp_common.CloneModeRadio, MODEL = "" IDENT = "" - GMRS_FREQS1 = [462.5625, 462.5875, 462.6125, 462.6375, 462.6625, - 462.6875, 462.7125] - GMRS_FREQS2 = [467.5625, 467.5875, 467.6125, 467.6375, 467.6625, - 467.6875, 467.7125] - GMRS_FREQS3 = [462.5500, 462.5750, 462.6000, 462.6250, 462.6500, - 462.6750, 462.7000, 462.7250] - GMRS_FREQS = GMRS_FREQS1 + GMRS_FREQS2 + GMRS_FREQS3 * 2 _gmrs = False + _bw_shift = False + _tri_band = False def sync_in(self): """Download from radio""" @@ -337,7 +357,7 @@ class BaofengCommonHT(chirp_common.CloneModeRadio, LOG.exception('Unexpected error during download') raise errors.RadioError('Unexpected error communicating ' 'with the radio') - self._mmap = memmap.MemoryMap(data) + self._mmap = memmap.MemoryMapBytes(data) self.process_mmap() def sync_out(self): @@ -346,7 +366,7 @@ class BaofengCommonHT(chirp_common.CloneModeRadio, _upload(self) except errors.RadioError: raise - except Exception as e: + except Exception: # If anything unexpected happens, make sure we raise # a RadioError and log the problem LOG.exception('Unexpected error during upload') @@ -372,7 +392,10 @@ class BaofengCommonHT(chirp_common.CloneModeRadio, rf.valid_modes = self.MODES rf.valid_characters = self.VALID_CHARS rf.valid_name_length = self.LENGTH_NAME - rf.valid_duplexes = ["", "-", "+", "split", "off"] + if self._gmrs: + rf.valid_duplexes = ["", "+", "off"] + else: + rf.valid_duplexes = ["", "-", "+", "split", "off"] rf.valid_tmodes = ['', 'Tone', 'TSQL', 'DTCS', 'Cross'] rf.valid_cross_modes = [ "Tone->Tone", @@ -487,12 +510,22 @@ class BaofengCommonHT(chirp_common.CloneModeRadio, mem.skip = "S" levels = self.POWER_LEVELS - try: - mem.power = levels[_mem.lowpower] - except IndexError: - LOG.error("Radio reported invalid power level %s (in %s)" % - (_mem.power, levels)) - mem.power = levels[0] + if self._tri_band: + if _mem.lowpower == TXPOWER_HIGH: + mem.power = levels[0] + elif _mem.lowpower == TXPOWER_LOW: + mem.power = levels[1] + else: + LOG.error("Radio reported invalid power level %s (in %s)" % + (_mem.power, levels)) + mem.power = levels[0] + else: + try: + mem.power = levels[_mem.lowpower] + except IndexError: + LOG.error("Radio reported invalid power level %s (in %s)" % + (_mem.power, levels)) + mem.power = levels[0] mem.mode = _mem.wide and "FM" or "NFM" @@ -512,6 +545,63 @@ class BaofengCommonHT(chirp_common.CloneModeRadio, self.SCODE_LIST[_mem.scode])) mem.extra.append(rs) + immutable = [] + + if self._gmrs: + if self.MODEL == "UV-9G": + if mem.number >= 1 and mem.number <= 30: + # 30 GMRS fixed channels + GMRS_30_FIXED_FREQS = \ + bandplan_na.ALL_GMRS_FREQS + \ + bandplan_na.GMRS_HIRPT + GMRS_FREQ = GMRS_30_FIXED_FREQS[mem.number - 1] + mem.freq = GMRS_FREQ + immutable = ["empty", "freq"] + if mem.number <= 22: + # GMRS simplex only channels + mem.duplex = '' + mem.offset = 0 + immutable += ["duplex", "offset"] + if mem.number >= 8 and mem.number <= 14: + # GMRS 467 MHz interstitial channels + # must be narrow FM and low power + mem.mode = "NFM" + mem.power = self.POWER_LEVELS[2] + immutable += ["mode", "power"] + if mem.number > 22: + # GMRS repeater only channels + mem.duplex = '+' + mem.offset = 5000000 + immutable += ["duplex", "offset"] + elif mem.freq in bandplan_na.ALL_GMRS_FREQS: + # 98 GMRS customizable channels + if mem.freq in bandplan_na.GMRS_LOW: + # GMRS 462 MHz interstitial frequencies + mem.duplex = '' + mem.offset = 0 + immutable = ["duplex", "offset"] + if mem.freq in bandplan_na.GMRS_HHONLY: + # GMRS 467 MHz interstitial frequencies + mem.duplex = '' + mem.offset = 0 + mem.mode = "NFM" + mem.power = self.POWER_LEVELS[2] + immutable = ["duplex", "offset", "mode", "power"] + if mem.freq in bandplan_na.GMRS_HIRPT: + # GMRS 462 MHz main frequencies + # GMRS 467 MHz main frequencies (repeater input) + if mem.duplex == '': + mem.offset = 0 + if mem.duplex == '+': + mem.offset = 5000000 + else: + # Not a GMRS frequency - disable TX + mem.duplex = 'off' + mem.offset = 0 + immutable = ["duplex", "offset"] + + mem.immutable = immutable + return mem def set_memory(self, mem): @@ -525,33 +615,6 @@ class BaofengCommonHT(chirp_common.CloneModeRadio, _mem.set_raw("\x00" * 16) - if self._gmrs: - if mem.number >= 1 and mem.number <= 30: - GMRS_FREQ = int(self.GMRS_FREQS[mem.number - 1] * 1000000) - mem.freq = GMRS_FREQ - if mem.number <= 22: - mem.duplex = '' - mem.offset = 0 - if mem.number >= 8 and mem.number <= 14: - mem.mode = "NFM" - mem.power = self.POWER_LEVELS[2] - if mem.number > 22: - mem.duplex = '+' - mem.offset = 5000000 - elif float(mem.freq) / 1000000 in self.GMRS_FREQS: - if float(mem.freq) / 1000000 in self.GMRS_FREQS2: - mem.offset = 0 - mem.mode = "NFM" - mem.power = self.POWER_LEVELS[2] - if float(mem.freq) / 1000000 in self.GMRS_FREQS3: - if mem.duplex == '+': - mem.offset = 5000000 - else: - mem.offset = 0 - else: - mem.duplex = 'off' - mem.offset = 0 - _mem.rxfreq = mem.freq / 10 if mem.duplex == "off": @@ -610,10 +673,21 @@ class BaofengCommonHT(chirp_common.CloneModeRadio, _mem.scan = mem.skip != "S" _mem.wide = mem.mode == "FM" - if mem.power: - _mem.lowpower = self.POWER_LEVELS.index(mem.power) + if self._tri_band: + levels = self.POWER_LEVELS + if mem.power is None: + _mem.lowpower = TXPOWER_HIGH + elif mem.power == levels[0]: + _mem.lowpower = TXPOWER_HIGH + elif mem.power == levels[1]: + _mem.lowpower = TXPOWER_LOW + else: + _mem.lowpower = TXPOWER_HIGH else: - _mem.lowpower = 0 + if mem.power: + _mem.lowpower = self.POWER_LEVELS.index(mem.power) + else: + _mem.lowpower = 0 # extra settings if len(mem.extra) > 0: @@ -660,7 +734,7 @@ class BaofengCommonHT(chirp_common.CloneModeRadio, elif element.value.get_mutable(): LOG.debug("Setting %s = %s" % (setting, element.value)) setattr(obj, setting, element.value) - except Exception as e: + except Exception: LOG.debug(element.get_name()) raise @@ -673,7 +747,9 @@ class BaofengCommonHT(chirp_common.CloneModeRadio, else: value = int(val.get_value() * 10) LOG.debug("Setting fm_presets = %s" % (value)) + if self._bw_shift: + value = ((value & 0x00FF) << 8) | ((value & 0xFF00) >> 8) self._memobj.fm_presets = value - except Exception as e: + except Exception: LOG.debug(element.get_name()) raise diff --git a/chirp/drivers/baofeng_uv3r.py b/chirp/drivers/baofeng_uv3r.py index c02bdd6..4ea476d 100644 --- a/chirp/drivers/baofeng_uv3r.py +++ b/chirp/drivers/baofeng_uv3r.py @@ -16,7 +16,6 @@ """Baofeng UV3r radio management module""" import time -import os import logging from chirp.drivers.wouxun_common import do_download, do_upload @@ -30,19 +29,19 @@ LOG = logging.getLogger(__name__) def _uv3r_prep(radio): - radio.pipe.write("\x05PROGRAM") + radio.pipe.write(b"\x05PROGRAM") ack = radio.pipe.read(1) - if ack != "\x06": + if ack != b"\x06": raise errors.RadioError("Radio did not ACK first command") - radio.pipe.write("\x02") + radio.pipe.write(b"\x02") ident = radio.pipe.read(8) if len(ident) != 8: LOG.debug(util.hexprint(ident)) raise errors.RadioError("Radio did not send identification") - radio.pipe.write("\x06") - if radio.pipe.read(1) != "\x06": + radio.pipe.write(b"\x06") + if radio.pipe.read(1) != b"\x06": raise errors.RadioError("Radio did not ACK ident") @@ -51,7 +50,7 @@ def uv3r_prep(radio): for _i in range(0, 10): try: return _uv3r_prep(radio) - except errors.RadioError as e: + except errors.RadioError: time.sleep(1) raise e @@ -198,6 +197,7 @@ class UV3RRadio(chirp_common.CloneModeRadio): """Baofeng UV-3R""" VENDOR = "Baofeng" MODEL = "UV-3R" + NEEDS_COMPAT_SERIAL = False def get_features(self): rf = chirp_common.RadioFeatures() @@ -623,7 +623,7 @@ class UV3RRadio(chirp_common.CloneModeRadio): else: LOG.debug("Setting %s = %s" % (setting, element.value)) setattr(obj, setting, element.value) - except Exception as e: + except Exception: LOG.debug(element.get_name()) raise @@ -639,7 +639,7 @@ class UV3RRadio(chirp_common.CloneModeRadio): LOG.debug("Setting fm_presets[%1i] = %s" % (index, value)) setting = self._memobj.fm_presets setting[index] = value - except Exception as e: + except Exception: LOG.debug(element.get_name()) raise diff --git a/chirp/drivers/baofeng_wp970i.py b/chirp/drivers/baofeng_wp970i.py index 0c3b88a..4a29c18 100644 --- a/chirp/drivers/baofeng_wp970i.py +++ b/chirp/drivers/baofeng_wp970i.py @@ -14,30 +14,29 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import time -import struct import logging -import re from chirp.drivers import baofeng_common -from chirp import chirp_common, directory, memmap -from chirp import bitwise, errors, util +from chirp import chirp_common, directory +from chirp import bitwise from chirp.settings import RadioSettingGroup, RadioSetting, \ RadioSettingValueBoolean, RadioSettingValueList, \ RadioSettingValueString, RadioSettingValueInteger, \ RadioSettingValueFloat, RadioSettings, \ InvalidValueError -from textwrap import dedent LOG = logging.getLogger(__name__) # #### MAGICS ######################################################### # Baofeng WP970I magic string -MSTRING_WP970I = "\x50\xBB\xFF\x20\x14\x04\x13" +MSTRING_WP970I = b"\x50\xBB\xFF\x20\x14\x04\x13" # Baofeng UV-9G magic string -MSTRING_UV9G = "\x50\xBB\xFF\x20\x12\x05\x25" +MSTRING_UV9G = b"\x50\xBB\xFF\x20\x12\x05\x25" + +# Baofeng UV-S9X3 magic string +MSTRING_UVS9X3 = b"\x50\xBB\xFF\x20\x12\x07\x25" DTMF_CHARS = "0123456789 *#ABCD" @@ -67,6 +66,9 @@ LIST_TXPOWER = ["High", "Mid", "Low"] LIST_VOICE = ["Off", "English", "Chinese"] LIST_WORKMODE = ["Frequency", "Channel"] +TXP_CHOICES = ["High", "Low"] +TXP_VALUES = [0x00, 0x02] + def model_match(cls, data): """Match the opened/downloaded image to the correct version""" @@ -85,6 +87,7 @@ class WP970I(baofeng_common.BaofengCommonHT): """Baofeng WP970I""" VENDOR = "Baofeng" MODEL = "WP970I" + NEEDS_COMPAT_SERIAL = False _tri_band = False _fileid = [] @@ -108,7 +111,7 @@ class WP970I(baofeng_common.BaofengCommonHT): "!@#$%^&*()+-=[]:\";'<>?,./" LENGTH_NAME = 6 SKIP_VALUES = ["", "S"] - DTCS_CODES = sorted(chirp_common.DTCS_CODES + [645]) + DTCS_CODES = tuple(sorted(chirp_common.DTCS_CODES + (645,))) POWER_LEVELS = [chirp_common.PowerLevel("High", watts=5.00), chirp_common.PowerLevel("Med", watts=3.00), chirp_common.PowerLevel("Low", watts=1.00)] @@ -321,22 +324,18 @@ class WP970I(baofeng_common.BaofengCommonHT): 'Please save an unedited copy of your first successful\n' 'download to a CHIRP Radio Images(*.img) file.' ) - rp.pre_download = _(dedent("""\ - Follow these instructions to download your info: - - 1 - Turn off your radio - 2 - Connect your interface cable - 3 - Turn on your radio - 4 - Do the download of your radio data - """)) - rp.pre_upload = _(dedent("""\ - Follow this instructions to upload your info: - - 1 - Turn off your radio - 2 - Connect your interface cable - 3 - Turn on your radio - 4 - Do the upload of your radio data - """)) + rp.pre_download = _( + "Follow these instructions to download your info:\n" + "1 - Turn off your radio\n" + "2 - Connect your interface cable\n" + "3 - Turn on your radio\n" + "4 - Do the download of your radio data\n") + rp.pre_upload = _( + "Follow this instructions to upload your info:\n" + "1 - Turn off your radio\n" + "2 - Connect your interface cable\n" + "3 - Turn on your radio\n" + "4 - Do the upload of your radio data\n") return rp def get_features(self): @@ -723,17 +722,48 @@ class WP970I(baofeng_common.BaofengCommonHT): 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) + def apply_txpower_listvalue(setting, obj): + LOG.debug("Setting value: " + str( + setting.value) + " from list") + val = str(setting.value) + index = TXP_CHOICES.index(val) + val = TXP_VALUES[index] + obj.set_value(val) - rs = RadioSetting("vfo.b.txpower3", "VFO B Power", - RadioSettingValueList( - LIST_TXPOWER, - LIST_TXPOWER[_mem.vfo.b.txpower3])) - work.append(rs) + if self._tri_band: + if _mem.vfo.a.txpower3 in TXP_VALUES: + idx = TXP_VALUES.index(_mem.vfo.a.txpower3) + else: + idx = TXP_VALUES.index(0x00) + rs = RadioSettingValueList(TXP_CHOICES, TXP_CHOICES[idx]) + rset = RadioSetting("vfo.a.txpower3", "VFO A Power", rs) + rset.set_apply_callback(apply_txpower_listvalue, + _mem.vfo.a.txpower3) + work.append(rset) + + if _mem.vfo.b.txpower3 in TXP_VALUES: + idx = TXP_VALUES.index(_mem.vfo.b.txpower3) + else: + idx = TXP_VALUES.index(0x00) + rs = RadioSettingValueList(TXP_CHOICES, TXP_CHOICES[idx]) + rset = RadioSetting("vfo.b.txpower3", "VFO B Power", rs) + rset.set_apply_callback(apply_txpower_listvalue, + _mem.vfo.b.txpower3) + work.append(rset) + else: + rs = RadioSetting("vfo.a.txpower3", "VFO A Power", + RadioSettingValueList( + LIST_TXPOWER, + LIST_TXPOWER[min(_mem.vfo.a.txpower3, 0x02)] + )) + work.append(rs) + + rs = RadioSetting("vfo.b.txpower3", "VFO B Power", + RadioSettingValueList( + LIST_TXPOWER, + LIST_TXPOWER[min(_mem.vfo.b.txpower3, 0x02)] + )) + work.append(rs) rs = RadioSetting("vfo.a.widenarr", "VFO A Bandwidth", RadioSettingValueList( @@ -769,16 +799,25 @@ class WP970I(baofeng_common.BaofengCommonHT): 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 + value = self._memobj.fm_presets + value_shifted = ((value & 0x00FF) << 8) | ((value & 0xFF00) >> 8) + if value_shifted >= 65.0 * 10 and value_shifted <= 108.0 * 10: + # storage method 3 (discovered 2022) + self._bw_shift = True + preset = value_shifted / 10.0 + elif value >= 65.0 * 10 and value <= 108.0 * 10: + # storage method 2 + preset = value / 10.0 + elif value <= 108.0 * 10 - 650: + # original storage method (2012) + preset = value / 10.0 + 65 else: - preset = 76.0 - rs = RadioSetting("fm_presets", "FM Preset(MHz)", - RadioSettingValueFloat(65, 108.0, preset, 0.1, 1)) - fm_preset.append(rs) + # unknown (undiscovered method or no FM chip?) + preset = False + if preset: + rs = RadioSettingValueFloat(65, 108.0, preset, 0.1, 1) + rset = RadioSetting("fm_presets", "FM Preset(MHz)", rs) + fm_preset.append(rset) # DTMF settings def apply_code(setting, obj, length): @@ -888,6 +927,7 @@ class BFA58(WP970I): """Baofeng BF-A58""" VENDOR = "Baofeng" MODEL = "BF-A58" + LENGTH_NAME = 7 ALIASES = [RH5XAlias, UV9RPROAlias] _fileid = ["BFT515 ", "BFT517 "] @@ -920,6 +960,8 @@ class BFA58S(WP970I): VENDOR = "Baofeng" MODEL = "BF-A58S" LENGTH_NAME = 7 + POWER_LEVELS = [chirp_common.PowerLevel("High", watts=5.00), + chirp_common.PowerLevel("Low", watts=1.00)] ALIASES = [UV82IIIAlias] _tri_band = True @@ -931,6 +973,14 @@ class BFA58S(WP970I): return rf +@directory.register +class UVS9X3(BFA58S): + VENDOR = "Baofeng" + MODEL = "UV-S9X3" + ALIASES = [] + _magic = [MSTRING_UVS9X3, ] + + @directory.register class UV9R(WP970I): """Baofeng UV-9R""" @@ -947,10 +997,10 @@ class UV9G(WP970I): LENGTH_NAME = 7 POWER_LEVELS = [chirp_common.PowerLevel("High", watts=5.00), - chirp_common.PowerLevel("Med", watts=0.50), + chirp_common.PowerLevel("Med", watts=1.00), chirp_common.PowerLevel("Low", watts=0.50)] _magic = [MSTRING_UV9G, ] - _gmrs = True + _gmrs = False # sold as GMRS radio but supports full band TX/RX @classmethod def match_model(cls, filedata, filename): diff --git a/chirp/drivers/bf-t1.py b/chirp/drivers/bf-t1.py deleted file mode 100644 index 66a00cc..0000000 --- a/chirp/drivers/bf-t1.py +++ /dev/null @@ -1,917 +0,0 @@ -# Copyright 2017 Pavel Milanes, CO7WT, -# -# This driver is a community effort as I don't have the radio on my hands, so -# I was only the director of the orchestra, without the players this may never -# came true, so special thanks to the following hams for their contribution: -# - Henk van der Laan, PA3CQN -# - Setting Discovery. -# - Special channels for RELAY and EMERGENCY. -# - Harold Hankins -# - Memory limits, testing & bug hunting. -# - Dmitry Milkov -# - Testing & bug hunting. -# - Many others participants in the issue page on Chirp's site. -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -from time import sleep -from chirp import chirp_common, directory, memmap -from chirp import bitwise, errors, util -from chirp.settings import RadioSetting, RadioSettingGroup, \ - RadioSettingValueBoolean, RadioSettingValueList, \ - RadioSettingValueInteger, RadioSettingValueString, \ - RadioSettingValueFloat, RadioSettings -from textwrap import dedent - -import struct -import logging - -LOG = logging.getLogger(__name__) - -# A note about the memory in these radios -# -# The '9100' OEM software only manipulates the lower 0x0180 bytes on read/write -# operations as we know, the file generated by the OEM software IS NOT an exact -# eeprom image, it's a crude text file with a pseudo csv format -# -# Later investigations by Harold Hankins found that the eeprom extend up to 2k -# consistent with a hardware chip K24C16 a 2k x 8 bit serial eeprom - -MEM_SIZE = 0x0800 # 2048 bytes -WRITE_SIZE = 0x0180 # 384 bytes -BLOCK_SIZE = 0x10 -ACK_CMD = "\x06" -MODES = ["NFM", "FM"] -SKIP_VALUES = ["S", ""] -TONES = chirp_common.TONES -DTCS = sorted(chirp_common.DTCS_CODES + [645]) - -# Special channels -SPECIALS = { - "EMG": -2, - "RLY": -1 - } - -# Settings vars -TOT_LIST = ["Off"] + ["%s" % x for x in range(30, 210, 30)] -SCAN_TYPE_LIST = ["Time", "Carrier", "Search"] -LANGUAGE_LIST = ["Off", "English", "Chinese"] -TIMER_LIST = ["Off"] + ["%s h" % (x * 0.5) for x in range(1, 17)] -FM_RANGE_LIST = ["76-108", "65-76"] -RELAY_MODE_LIST = ["Off", "RX sync", "TX sync"] -BACKLIGHT_LIST = ["Off", "Key", "On"] -POWER_LIST = ["0.5 Watt", "1.0 Watt"] - -# This is a general serial timeout for all serial read functions. -# Practice has show that about 0.07 sec will be enough to cover all radios. -STIMEOUT = 0.07 - -# this var controls the verbosity in the debug and by default it's low (False) -# make it True and you will to get a very verbose debug.log -debug = False - -# #### ID strings ##################################################### - -# BF-T1 handheld -BFT1_magic = "\x05PROGRAM" -BFT1_ident = b" BF9100S" - - -def _clean_buffer(radio): - """Cleaning the read serial buffer, hard timeout to survive an infinite - data stream""" - - dump = "1" - datacount = 0 - - try: - while len(dump) > 0: - dump = radio.pipe.read(100) - datacount += len(dump) - # hard limit to survive a infinite serial data stream - # 5 times bigger than a normal rx block (20 bytes) - if datacount > 101: - seriale = "Please check your serial port selection." - raise errors.RadioError(seriale) - - except Exception: - raise errors.RadioError("Unknown error cleaning the serial buffer") - - -def _rawrecv(radio, amount=0): - """Raw read from the radio device""" - - # var to hold the data to return - data = "" - - try: - if amount == 0: - data = radio.pipe.read() - else: - data = radio.pipe.read(amount) - - # DEBUG - if debug is True: - LOG.debug("<== (%d) bytes:\n\n%s" % - (len(data), util.hexprint(data))) - - # fail if no data is received - if len(data) == 0: - raise errors.RadioError("No data received from radio") - - except: - raise errors.RadioError("Error reading data from radio") - - return data - - -def _send(radio, data): - """Send data to the radio device""" - - try: - radio.pipe.write(data) - - # DEBUG - if debug is True: - LOG.debug("==> (%d) bytes:\n\n%s" % - (len(data), util.hexprint(data))) - except: - raise errors.RadioError("Error sending data to radio") - - -def _make_frame(cmd, addr, data=""): - """Pack the info in the header format""" - frame = struct.pack(">BHB", ord(cmd), addr, BLOCK_SIZE) - - # add the data if set - if len(data) != 0: - frame += data - - return frame - - -def _recv(radio, addr): - """Get data from the radio""" - - # Get the full 20 bytes at a time - # 4 bytes header + 16 bytes of data (BLOCK_SIZE) - - # get the whole block - block = _rawrecv(radio, BLOCK_SIZE + 4) - - # short answer - if len(block) < (BLOCK_SIZE + 4): - raise errors.RadioError("Wrong block length (short) at 0x%04x" % addr) - - # long answer - if len(block) > (BLOCK_SIZE + 4): - raise errors.RadioError("Wrong block length (long) at 0x%04x" % addr) - - # header validation - c, a, l = struct.unpack(">cHB", block[0:4]) - if c != "W" or a != addr or l != BLOCK_SIZE: - LOG.debug("Invalid header for block 0x%04x:" % addr) - LOG.debug("CMD: %s ADDR: %04x SIZE: %02x" % (c, a, l)) - raise errors.RadioError("Invalid header for block 0x%04x:" % addr) - - # return the data, 16 bytes of payload - return block[4:] - - -def _start_clone_mode(radio, status): - """Put the radio in clone mode, 3 tries""" - - # cleaning the serial buffer - _clean_buffer(radio) - - # prep the data to show in the UI - status.cur = 0 - status.msg = "Identifying the radio..." - status.max = 3 - radio.status_fn(status) - - try: - for a in range(0, status.max): - # Update the UI - status.cur = a + 1 - radio.status_fn(status) - - # send the magic word - _send(radio, radio._magic) - - # Now you get a x06 of ACK if all goes well - ack = _rawrecv(radio, 1) - - if ack == ACK_CMD: - # DEBUG - LOG.info("Magic ACK received") - status.cur = status.max - radio.status_fn(status) - - return True - - return False - - except errors.RadioError: - raise - except Exception as e: - raise errors.RadioError("Error sending Magic to radio:\n%s" % e) - - -def _do_ident(radio, status): - """Put the radio in PROGRAM mode & identify it""" - # set the serial discipline (default) - radio.pipe.baudrate = 9600 - radio.pipe.parity = "N" - radio.pipe.bytesize = 8 - radio.pipe.stopbits = 1 - radio.pipe.timeout = STIMEOUT - - # open the radio into program mode - if _start_clone_mode(radio, status) is False: - raise errors.RadioError("Radio did not enter clone mode, wrong model?") - - # Ok, poke it to get the ident string - _send(radio, "\x02") - ident = _rawrecv(radio, len(radio._id)) - - # basic check for the ident - if len(ident) != len(radio._id): - raise errors.RadioError("Radio send a odd identification block.") - - # check if ident is OK - if ident != radio._id: - LOG.debug("Incorrect model ID, got this:\n\n" + util.hexprint(ident)) - raise errors.RadioError("Radio identification failed.") - - # handshake - _send(radio, ACK_CMD) - ack = _rawrecv(radio, 1) - - # checking handshake - if len(ack) == 1 and ack == ACK_CMD: - # DEBUG - LOG.info("ID ACK received") - else: - LOG.debug("Radio handshake failed.") - raise errors.RadioError("Radio handshake failed.") - - # DEBUG - LOG.info("Positive ident, this is a %s %s" % (radio.VENDOR, radio.MODEL)) - - return True - - -def _download(radio): - """Get the memory map""" - - # UI progress - status = chirp_common.Status() - - # put radio in program mode and identify it - _do_ident(radio, status) - - # reset the progress bar in the UI - status.max = MEM_SIZE / BLOCK_SIZE - status.msg = "Cloning from radio..." - status.cur = 0 - radio.status_fn(status) - - # cleaning the serial buffer - _clean_buffer(radio) - - data = "" - for addr in range(0, MEM_SIZE, BLOCK_SIZE): - # sending the read request - _send(radio, _make_frame("R", addr)) - - # read - d = _recv(radio, addr) - - # aggregate the data - data += d - - # UI Update - status.cur = addr / BLOCK_SIZE - status.msg = "Cloning from radio..." - radio.status_fn(status) - - # close comms with the radio - _send(radio, "\x62") - # DEBUG - LOG.info("Close comms cmd sent, radio must reboot now.") - - return data - - -def _upload(radio): - """Upload procedure, we only upload to the radio the Writable space""" - - # UI progress - status = chirp_common.Status() - - # put radio in program mode and identify it - _do_ident(radio, status) - - # get the data to upload to radio - data = radio.get_mmap() - - # Reset the UI progress - status.max = WRITE_SIZE / BLOCK_SIZE - status.cur = 0 - status.msg = "Cloning to radio..." - radio.status_fn(status) - - # cleaning the serial buffer - _clean_buffer(radio) - - # the fun start here, we use WRITE_SIZE instead of the full MEM_SIZE - for addr in range(0, WRITE_SIZE, BLOCK_SIZE): - # getting the block of data to send - d = data[addr:addr + BLOCK_SIZE] - - # build the frame to send - frame = _make_frame("W", addr, d) - - # send the frame - _send(radio, frame) - - # receiving the response - ack = _rawrecv(radio, 1) - - # basic check - if len(ack) != 1: - raise errors.RadioError("No ACK when writing block 0x%04x" % addr) - - if ack != ACK_CMD: - raise errors.RadioError("Bad ACK writing block 0x%04x:" % addr) - - # UI Update - status.cur = addr / BLOCK_SIZE - status.msg = "Cloning to radio..." - radio.status_fn(status) - - # close comms with the radio - _send(radio, "\x62") - # DEBUG - LOG.info("Close comms cmd sent, radio must reboot now.") - - -def _model_match(cls, data): - """Match the opened/downloaded image to the correct version""" - - # a reliable fingerprint: the model name at - rid = data[0x06f8:0x0700] - - if rid == BFT1_ident: - return True - - return False - - -def _decode_ranges(low, high): - """Unpack the data in the ranges zones in the memmap and return - a tuple with the integer corresponding to the Mhz it means""" - return (int(low) * 100000, int(high) * 100000) - - -MEM_FORMAT = """ - -struct channel { - lbcd rxfreq[4]; // rx freq. - u8 rxtone; // x00 = none - // x01 - x32 = index of the analog tones - // x33 - x9b = index of Digital tones - // Digital tone polarity is handled below by - // ttondinv & ttondinv settings - lbcd txoffset[4]; // the difference against RX, direction handled by - // offplus & offminus - u8 txtone; // Idem to rxtone - u8 noskip:1, // if true is included in the scan - wide:1, // 1 = Wide, 0 = Narrow - ttondinv:1, // if true TX tone is Digital & Inverted - unA:1, // - rtondinv:1, // if true RX tone is Digital & Inverted - unB:1, // - offplus:1, // TX = RX + offset - offminus:1; // TX = RX - offset - u8 empty[5]; -}; - -#seekto 0x0000; -struct channel emg; // channel 0 is Emergent CH -#seekto 0x0010; -struct channel channels[20]; // normal 1-20 mem channels - -#seekto 0x0150; // Settings -struct { - lbcd vhfl[2]; // VHF low limit - lbcd vhfh[2]; // VHF high limit - lbcd uhfl[2]; // UHF low limit - lbcd uhfh[2]; // UHF high limit - u8 unk0[8]; - u8 unk1[2]; // start of 0x0160 <======= - u8 squelch; // byte: 0-9 - u8 vox; // byte: 0-9 - u8 timeout; // tot, 0 off, then 30 sec increments up to 180 - u8 batsave:1, // battery save 0 = off, 1 = on - fm_funct:1, // fm-radio 0=off, 1=on ( off disables fm button on set ) - ste:1, // squelch tail 0 = off, 1 = on - blo:1, // busy lockout 0 = off, 1 = on - beep:1, // key beep 0 = off, 1 = on - lock:1, // keylock 0 = ff, = on - backlight:2; // backlight 00 = off, 01 = key, 10 = on - u8 scantype; // scan type 0 = timed, 1 = carrier, 2 = stop - u8 channel; // active channel 1-20, setting it works on upload - u8 fmrange; // fm range 1 = low[65-76](ASIA), 0 = high[76-108](AMERICA) - u8 alarm; // alarm (count down timer) - // d0 - d16 in half hour increments => off, 0.5 - 8.0 h - u8 voice; // voice prompt 0 = off, 1 = english, 2 = chinese - u8 volume; // volume 1-7 as per the radio steps - // set to #FF by original software on upload - // chirp uploads actual value and works. - u16 fm_vfo; // the frequency of the fm receiver. - // resulting frequency is 65 + value * 0.1 MHz - // 0x145 is then 65 + 325*0.1 = 97.5 MHz - u8 relaym; // relay mode, d0 = off, d2 = re-tx, d1 = re-rx - // still a mystery on how it works - u8 tx_pwr; // tx pwr 0 = low (0.5W), 1 = high(1.0W) -} settings; - -#seekto 0x0170; // Relay CH -struct channel rly; - -""" - - -@directory.register -class BFT1(chirp_common.CloneModeRadio, chirp_common.ExperimentalRadio): - """Baofeng BT-F1 radio & possibly alike radios""" - VENDOR = "Baofeng" - MODEL = "BF-T1" - _vhf_range = (130000000, 174000000) - _uhf_range = (400000000, 520000000) - _upper = 20 - _magic = BFT1_magic - _id = BFT1_ident - - @classmethod - def get_prompts(cls): - rp = chirp_common.RadioPrompts() - rp.experimental = \ - ('This driver is experimental.\n' - '\n' - 'Please keep a copy of your memories with the original software ' - 'if you treasure them, this driver is new and may contain' - ' bugs.\n' - '\n' - '"Emergent CH" & "Relay CH" are implemented via special channels,' - 'be sure to click on the button on the interface to access them.' - ) - rp.pre_download = _(dedent("""\ - Follow these instructions to download your info: - - 1 - Turn off your radio - 2 - Connect your interface cable - 3 - Turn on your radio - 4 - Do the download of your radio data - - """)) - rp.pre_upload = _(dedent("""\ - Follow these instructions to upload your info: - - 1 - Turn off your radio - 2 - Connect your interface cable - 3 - Turn on your radio - 4 - Do the upload of your radio data - - """)) - return rp - - def get_features(self): - """Get the radio's features""" - - rf = chirp_common.RadioFeatures() - rf.valid_special_chans = list(SPECIALS.keys()) - rf.has_settings = True - rf.has_bank = False - rf.has_tuning_step = False - rf.can_odd_split = True - rf.has_name = False - rf.has_offset = True - rf.has_mode = True - rf.valid_modes = MODES - rf.has_dtcs = True - rf.has_rx_dtcs = True - rf.has_dtcs_polarity = True - rf.has_ctone = True - rf.has_cross = True - rf.valid_duplexes = ["", "-", "+", "split"] - rf.valid_tmodes = ['', 'Tone', 'TSQL', 'DTCS', 'Cross'] - rf.valid_cross_modes = [ - "Tone->Tone", - "DTCS->", - "->DTCS", - "Tone->DTCS", - "DTCS->Tone", - "->Tone", - "DTCS->DTCS"] - rf.valid_skips = SKIP_VALUES - rf.valid_dtcs_codes = DTCS - rf.memory_bounds = (1, self._upper) - rf.valid_tuning_steps = [2.5, 5., 6.25, 10., 12.5, 25.] - - # normal dual bands - rf.valid_bands = [self._vhf_range, self._uhf_range] - - return rf - - def process_mmap(self): - """Process the mem map into the mem object""" - - # Get it - self._memobj = bitwise.parse(MEM_FORMAT, self._mmap) - - # set the band limits as the memmap - settings = self._memobj.settings - self._vhf_range = _decode_ranges(settings.vhfl, settings.vhfh) - self._uhf_range = _decode_ranges(settings.uhfl, settings.uhfh) - - def sync_in(self): - """Download from radio""" - data = _download(self) - self._mmap = memmap.MemoryMap(data) - self.process_mmap() - - def sync_out(self): - """Upload to radio""" - - try: - _upload(self) - except errors.RadioError: - raise - except Exception as e: - raise errors.RadioError("Error: %s" % e) - - def _decode_tone(self, val, inv): - """Parse the tone data to decode from mem, it returns: - Mode (''|DTCS|Tone), Value (None|###), Polarity (None,N,R)""" - - if val == 0: - return '', None, None - elif val < 51: # analog tone - return 'Tone', TONES[val - 1], None - elif val > 50: # digital tone - pol = "N" - # polarity? - if inv == 1: - pol = "R" - - return 'DTCS', DTCS[val - 51], pol - - def _encode_tone(self, memtone, meminv, mode, tone, pol): - """Parse the tone data to encode from UI to mem""" - - if mode == '' or mode is None: - memtone.set_value(0) - meminv.set_value(0) - elif mode == 'Tone': - # caching errors for analog tones. - try: - memtone.set_value(TONES.index(tone) + 1) - meminv.set_value(0) - except: - msg = "TCSS Tone '%d' is not supported" % tone - LOG.error(msg) - raise errors.RadioError(msg) - - elif mode == 'DTCS': - # caching errors for digital tones. - try: - memtone.set_value(DTCS.index(tone) + 51) - if pol == "R": - meminv.set_value(True) - else: - meminv.set_value(False) - except: - msg = "Digital Tone '%d' is not supported" % tone - LOG.error(msg) - raise errors.RadioError(msg) - else: - msg = "Internal error: invalid mode '%s'" % mode - LOG.error(msg) - raise errors.InvalidDataError(msg) - - def get_raw_memory(self, number): - return repr(self._memobj.memory[number]) - - def _get_special(self, number): - if isinstance(number, str): - return (getattr(self._memobj, number.lower())) - elif number < 0: - for k, v in SPECIALS.items(): - if number == v: - return (getattr(self._memobj, k.lower())) - else: - return self._memobj.channels[number-1] - - def get_memory(self, number): - """Get the mem representation from the radio image""" - _mem = self._get_special(number) - - # Create a high-level memory object to return to the UI - mem = chirp_common.Memory() - - # Check if special or normal - if isinstance(number, str): - mem.number = SPECIALS[number] - mem.extd_number = number - else: - mem.number = number - - if _mem.get_raw()[0] == "\xFF": - mem.empty = True - return mem - - # Freq and offset - mem.freq = int(_mem.rxfreq) * 10 - - # TX freq (Stored as a difference) - mem.offset = int(_mem.txoffset) * 10 - mem.duplex = "" - - # must work out the polarity - if mem.offset != 0: - if _mem.offminus == 1: - mem.duplex = "-" - # tx below RX - - if _mem.offplus == 1: - # tx above RX - mem.duplex = "+" - - # split RX/TX in different bands - if mem.offset > 71000000: - mem.duplex = "split" - - # show the actual value in the offset, depending on the shift - if _mem.offminus == 1: - mem.offset = mem.freq - mem.offset - if _mem.offplus == 1: - mem.offset = mem.freq + mem.offset - - # wide/narrow - mem.mode = MODES[int(_mem.wide)] - - # skip - mem.skip = SKIP_VALUES[_mem.noskip] - - # tone data - rxtone = txtone = None - txtone = self._decode_tone(_mem.txtone, _mem.ttondinv) - rxtone = self._decode_tone(_mem.rxtone, _mem.rtondinv) - chirp_common.split_tone_decode(mem, txtone, rxtone) - - return mem - - def set_memory(self, mem): - """Set the memory data in the eeprom img from the UI""" - # get the eprom representation of this channel - _mem = self._get_special(mem.number) - - # if empty memory - if mem.empty: - # the channel itself - _mem.set_raw("\xFF" * 16) - # return it - return mem - - # frequency - _mem.rxfreq = mem.freq / 10 - - # duplex/ offset Offset is an absolute value - _mem.txoffset = mem.offset / 10 - - # must work out the polarity - if mem.duplex == "": - _mem.offplus = 0 - _mem.offminus = 0 - elif mem.duplex == "+": - _mem.offplus = 1 - _mem.offminus = 0 - elif mem.duplex == "-": - _mem.offplus = 0 - _mem.offminus = 1 - elif mem.duplex == "split": - if mem.freq > mem.offset: - _mem.offplus = 0 - _mem.offminus = 1 - _mem.txoffset = (mem.freq - mem.offset) / 10 - else: - _mem.offplus = 1 - _mem.offminus = 0 - _mem.txoffset = (mem.offset - mem.freq) / 10 - - # wide/narrow - _mem.wide = MODES.index(mem.mode) - - # skip - _mem.noskip = SKIP_VALUES.index(mem.skip) - - # tone data - ((txmode, txtone, txpol), (rxmode, rxtone, rxpol)) = \ - chirp_common.split_tone_encode(mem) - self._encode_tone(_mem.txtone, _mem.ttondinv, txmode, txtone, txpol) - self._encode_tone(_mem.rxtone, _mem.rtondinv, rxmode, rxtone, rxpol) - - return mem - - def get_settings(self): - _settings = self._memobj.settings - basic = RadioSettingGroup("basic", "Basic Settings") - fm = RadioSettingGroup("fm", "FM Radio") - adv = RadioSettingGroup("adv", "Advanced Settings") - group = RadioSettings(basic, fm, adv) - - # ## Basic Settings - rs = RadioSetting("tx_pwr", "TX Power", - RadioSettingValueList( - POWER_LIST, POWER_LIST[_settings.tx_pwr])) - basic.append(rs) - - rs = RadioSetting("channel", "Active Channel", - RadioSettingValueInteger(1, 20, _settings.channel)) - 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) - - # volume validation, as the OEM software set 0xFF on write - _volume = _settings.volume - if _volume > 7: - _volume = 7 - rs = RadioSetting("volume", "Volume Level", - RadioSettingValueInteger(0, 7, _volume)) - basic.append(rs) - - rs = RadioSetting("scantype", "Scan Type", - RadioSettingValueList(SCAN_TYPE_LIST, SCAN_TYPE_LIST[ - _settings.scantype])) - basic.append(rs) - - rs = RadioSetting("timeout", "Time Out Timer (seconds)", - RadioSettingValueList( - TOT_LIST, TOT_LIST[_settings.timeout])) - basic.append(rs) - - rs = RadioSetting("voice", "Voice Prompt", - RadioSettingValueList( - LANGUAGE_LIST, LANGUAGE_LIST[_settings.voice])) - basic.append(rs) - - rs = RadioSetting("alarm", "Alarm Time", - RadioSettingValueList( - TIMER_LIST, TIMER_LIST[_settings.alarm])) - basic.append(rs) - - rs = RadioSetting("backlight", "Backlight", - RadioSettingValueList( - BACKLIGHT_LIST, - BACKLIGHT_LIST[_settings.backlight])) - basic.append(rs) - - rs = RadioSetting("blo", "Busy Lockout", - RadioSettingValueBoolean(_settings.blo)) - basic.append(rs) - - rs = RadioSetting("ste", "Squelch Tail Eliminate", - RadioSettingValueBoolean(_settings.ste)) - basic.append(rs) - - rs = RadioSetting("batsave", "Battery Save", - RadioSettingValueBoolean(_settings.batsave)) - basic.append(rs) - - rs = RadioSetting("lock", "Key Lock", - RadioSettingValueBoolean(_settings.lock)) - basic.append(rs) - - rs = RadioSetting("beep", "Key Beep", - RadioSettingValueBoolean(_settings.beep)) - basic.append(rs) - - # ## FM Settings - rs = RadioSetting("fm_funct", "FM Function", - RadioSettingValueBoolean(_settings.fm_funct)) - fm.append(rs) - - rs = RadioSetting("fmrange", "FM Range", - RadioSettingValueList( - FM_RANGE_LIST, FM_RANGE_LIST[_settings.fmrange])) - fm.append(rs) - - # callbacks for the FM VFO - def apply_fm_freq(setting, obj): - setattr(obj, setting.get_name(), int(setting.value. - get_value() * 10) - 650) - - _fm_vfo = int(_settings.fm_vfo) * 0.1 + 65 - rs = RadioSetting("fm_vfo", "FM Station", - RadioSettingValueFloat(65, 108, _fm_vfo)) - rs.set_apply_callback(apply_fm_freq, _settings) - fm.append(rs) - - # ## Advanced - def apply_limit(setting, obj): - setattr(obj, setting.get_name(), int(setting.value) * 10) - - rs = RadioSetting("vhfl", "VHF Low Limit", - RadioSettingValueInteger(130, 174, int( - _settings.vhfl) / 10)) - rs.set_apply_callback(apply_limit, _settings) - adv.append(rs) - - rs = RadioSetting("vhfh", "VHF High Limit", - RadioSettingValueInteger(130, 174, int( - _settings.vhfh) / 10)) - rs.set_apply_callback(apply_limit, _settings) - adv.append(rs) - - rs = RadioSetting("uhfl", "UHF Low Limit", - RadioSettingValueInteger(400, 520, int( - _settings.uhfl) / 10)) - rs.set_apply_callback(apply_limit, _settings) - adv.append(rs) - - rs = RadioSetting("uhfh", "UHF High Limit", - RadioSettingValueInteger(400, 520, int( - _settings.uhfh) / 10)) - rs.set_apply_callback(apply_limit, _settings) - adv.append(rs) - - rs = RadioSetting("relaym", "Relay Mode", - RadioSettingValueList(RELAY_MODE_LIST, - RELAY_MODE_LIST[_settings.relaym])) - adv.append(rs) - - return group - - def set_settings(self, uisettings): - _settings = self._memobj.settings - - for element in uisettings: - if not isinstance(element, RadioSetting): - self.set_settings(element) - continue - if not element.changed(): - continue - - try: - name = element.get_name() - value = element.value - - if element.has_apply_callback(): - LOG.debug("Using apply callback") - element.run_apply_callback() - else: - obj = getattr(_settings, name) - setattr(_settings, name, value) - - LOG.debug("Setting %s: %s" % (name, value)) - except Exception as e: - LOG.debug(element.get_name()) - raise - - @classmethod - def match_model(cls, filedata, filename): - match_size = False - match_model = False - - # testing the file data size - if len(filedata) == MEM_SIZE: - match_size = True - - # DEBUG - if debug is True: - LOG.debug("BF-T1 matched!") - - # testing the firmware model fingerprint - match_model = _model_match(cls, filedata) - - return match_size and match_model diff --git a/chirp/drivers/bf-t8.py b/chirp/drivers/bf-t8.py deleted file mode 100644 index 27fbbbf..0000000 --- a/chirp/drivers/bf-t8.py +++ /dev/null @@ -1,1024 +0,0 @@ -# Copyright 2022 Jim Unroe -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -import time -import os -import struct -import logging - -from chirp import ( - bitwise, - chirp_common, - directory, - errors, - memmap, - util, -) -from chirp.settings import ( - RadioSetting, - RadioSettingGroup, - RadioSettings, - RadioSettingValueBoolean, - RadioSettingValueFloat, - RadioSettingValueInteger, - RadioSettingValueList, - RadioSettingValueString, -) - -LOG = logging.getLogger(__name__) - -MEM_FORMAT = """ -#seekto 0x0000; -struct { - lbcd rxfreq[4]; // RX Frequency - lbcd txfreq[4]; // TX Frequency - u8 rx_tmode; // RX Tone Mode - u8 rx_tone; // PL/DPL Decode - u8 tx_tmode; // TX Tone Mode - u8 tx_tone; // PL/DPL Encode - u8 unknown1:3, // - skip:1, // Scan Add: 1 = Skip, 0 = Scan - unknown2:2, - isnarrow:1, // W/N: 1 = Narrow, 0 = Wide - lowpower:1; // TX Power: 1 = Low, 0 = High - u8 unknown3[3]; // -} memory[%d]; - -#seekto 0x0630; -struct { - u8 squelch; // SQL - u8 vox; // Vox Lv - u8 tot; // TOT - u8 unk1:3, // - ste:1, // Tail Clear - bcl:1, // BCL - save:1, // Save - tdr:1, // TDR - beep:1; // Beep - u8 voice; // Voice - u8 abr; // Back Light - u8 ring; // Ring - u8 mdf; // Display Type - u8 mra; // MR Channel A - u8 mrb; // MR Channel B - u8 disp_ab; // Display A/B Selected - u16 fmcur; // Broadcast FM station - u8 workmode; // Work Mode - u8 wx; // NOAA WX ch# - u8 area; // Area Selected -} settings; - -#seekto 0x0D00; -struct { - char name[6]; - u8 unknown1[2]; -} names[%d]; -""" - -CMD_ACK = "\x06" - -TONES = chirp_common.TONES -TMODES = ["", "Tone", "DTCS", "DTCS"] - -AB_LIST = ["A", "B"] -ABR_LIST = ["OFF", "ON", "Key"] -AREA_LIST = ["China", "Japan", "Korea", "Malaysia", "American", - "Australia", "Iran", "Taiwan", "Europe", "Russia"] -MDF_LIST = ["Frequency", "Channel #", "Name"] -RING_LIST = ["OFF"] + ["%s" % x for x in range(1, 11)] -TOT_LIST = ["OFF"] + ["%s seconds" % x for x in range(30, 210, 30)] -TOT2_LIST = TOT_LIST[1:] -VOICE_LIST = ["Off", "Chinese", "English"] -VOX_LIST = ["OFF"] + ["%s" % x for x in range(1, 6)] -WORKMODE_LIST = ["General", "PMR"] -WX_LIST = ["CH01 - 162.550", - "CH02 - 162.400", - "CH03 - 162.475", - "CH04 - 162.425", - "CH05 - 162.450", - "CH06 - 162.500", - "CH07 - 162.525", - "CH08 - 161.650", - "CH09 - 161.775", - "CH10 - 161.750", - "CH11 - 162.000" - ] - -SETTING_LISTS = { - "ab": AB_LIST, - "abr": ABR_LIST, - "area": AREA_LIST, - "mdf": MDF_LIST, - "ring": RING_LIST, - "tot": TOT_LIST, - "tot": TOT2_LIST, - "voice": VOICE_LIST, - "vox": VOX_LIST, - "workmode": WORKMODE_LIST, - "wx": WX_LIST, - } - -FRS_FREQS1 = [462.5625, 462.5875, 462.6125, 462.6375, 462.6625, - 462.6875, 462.7125] -FRS_FREQS2 = [467.5625, 467.5875, 467.6125, 467.6375, 467.6625, - 467.6875, 467.7125] -FRS_FREQS3 = [462.5500, 462.5750, 462.6000, 462.6250, 462.6500, - 462.6750, 462.7000, 462.7250] -FRS_FREQS = FRS_FREQS1 + FRS_FREQS2 + FRS_FREQS3 - -GMRS_FREQS = FRS_FREQS + FRS_FREQS3 - -MURS_FREQS = [151.820, 151.880, 151.940, 154.570, 154.600] - -PMR_FREQS1 = [446.00625, 446.01875, 446.03125, 446.04375, 446.05625, - 446.06875, 446.08125, 446.09375] -PMR_FREQS2 = [446.10625, 446.11875, 446.13125, 446.14375, 446.15625, - 446.16875, 446.18125, 446.19375] -PMR_FREQS = PMR_FREQS1 + PMR_FREQS2 - -VOICE_CHOICES = ["Off", "On"] -VOICE_VALUES = [0x00, 0x02] - - -def _enter_programming_mode(radio): - serial = radio.pipe - - exito = False - for i in range(0, 5): - serial.write(radio._magic) - ack = serial.read(1) - - try: - if ack == CMD_ACK: - exito = True - break - except: - LOG.debug("Attempt #%s, failed, trying again" % i) - pass - - # check if we had EXITO - if exito is False: - _exit_programming_mode(radio) - msg = "The radio did not accept program mode after five tries.\n" - msg += "Check you interface cable and power cycle your radio." - raise errors.RadioError(msg) - - try: - serial.write("\x02") - ident = serial.read(len(radio._fingerprint)) - except: - _exit_programming_mode(radio) - raise errors.RadioError("Error communicating with radio") - - if not ident == radio._fingerprint: - _exit_programming_mode(radio) - LOG.debug(util.hexprint(ident)) - raise errors.RadioError("Radio returned unknown identification string") - - try: - serial.write(CMD_ACK) - ack = serial.read(1) - except: - _exit_programming_mode(radio) - raise errors.RadioError("Error communicating with radio") - - if ack != CMD_ACK: - _exit_programming_mode(radio) - raise errors.RadioError("Radio refused to enter programming mode") - - -def _exit_programming_mode(radio): - serial = radio.pipe - try: - serial.write("E") - except: - raise errors.RadioError("Radio refused to exit programming mode") - - -def _read_block(radio, block_addr, block_size): - serial = radio.pipe - - cmd = struct.pack(">cHb", 'R', block_addr, block_size) - expectedresponse = "W" + cmd[1:] - LOG.debug("Reading block %04x..." % (block_addr)) - - try: - serial.write(cmd) - response = serial.read(4 + block_size) - if response[:4] != expectedresponse: - raise Exception("Error reading block %04x." % (block_addr)) - - block_data = response[4:] - - serial.write(CMD_ACK) - ack = serial.read(1) - except: - _exit_programming_mode(radio) - raise errors.RadioError("Failed to read block at %04x" % block_addr) - - if ack != CMD_ACK: - _exit_programming_mode(radio) - raise Exception("No ACK reading block %04x." % (block_addr)) - - return block_data - - -def _write_block(radio, block_addr, block_size): - serial = radio.pipe - - cmd = struct.pack(">cHb", 'W', block_addr, block_size) - data = radio.get_mmap()[block_addr:block_addr + block_size] - - LOG.debug("Writing Data:") - LOG.debug(util.hexprint(cmd + data)) - - try: - serial.write(cmd + data) - if serial.read(1) != CMD_ACK: - raise Exception("No ACK") - except: - _exit_programming_mode(radio) - raise errors.RadioError("Failed to send block " - "to radio at %04x" % block_addr) - - -def do_download(radio): - LOG.debug("download") - _enter_programming_mode(radio) - - data = "" - - status = chirp_common.Status() - status.msg = "Cloning from radio" - - status.cur = 0 - status.max = radio._memsize - - for addr in range(0, radio._memsize, radio.BLOCK_SIZE): - status.cur = addr + radio.BLOCK_SIZE - radio.status_fn(status) - - block = _read_block(radio, addr, radio.BLOCK_SIZE) - data += block - - LOG.debug("Address: %04x" % addr) - LOG.debug(util.hexprint(block)) - - _exit_programming_mode(radio) - - return memmap.MemoryMap(data) - - -def do_upload(radio): - status = chirp_common.Status() - status.msg = "Uploading to radio" - - _enter_programming_mode(radio) - - status.cur = 0 - status.max = radio._memsize - - for start_addr, end_addr in radio._ranges: - for addr in range(start_addr, end_addr, radio.BLOCK_SIZE_UP): - status.cur = addr + radio.BLOCK_SIZE_UP - radio.status_fn(status) - _write_block(radio, addr, radio.BLOCK_SIZE_UP) - - _exit_programming_mode(radio) - - -class BFT8Radio(chirp_common.CloneModeRadio): - """Baofeng BF-T8""" - VENDOR = "Baofeng" - MODEL = "BF-T8" - BAUD_RATE = 9600 - BLOCK_SIZE = BLOCK_SIZE_UP = 0x10 - ODD_SPLIT = True - HAS_NAMES = False - NAME_LENGTH = 0 - VALID_CHARS = "" - CH_OFFSET = False - SKIP_VALUES = [] - DTCS_CODES = sorted(chirp_common.DTCS_CODES) - DUPLEXES = ["", "-", "+", "split", "off"] - - POWER_LEVELS = [chirp_common.PowerLevel("High", watts=2.00), - chirp_common.PowerLevel("Low", watts=0.50)] - VALID_BANDS = [(400000000, 470000000)] - - _magic = "\x02" + "PROGRAM" - _fingerprint = "\x2E" + "BF-T6" + "\x2E" - _upper = 99 - _mem_params = (_upper, # number of channels - _upper # number of names - ) - _frs = _gmrs = _murs = _pmr = False - - _ranges = [ - (0x0000, 0x0B60), - ] - _memsize = 0x0B60 - - def get_features(self): - rf = chirp_common.RadioFeatures() - rf.has_settings = True - rf.has_bank = False - rf.has_ctone = True - rf.has_cross = True - rf.has_rx_dtcs = True - rf.has_tuning_step = False - rf.has_name = self.HAS_NAMES - rf.can_odd_split = self.ODD_SPLIT - rf.valid_name_length = self.NAME_LENGTH - rf.valid_characters = self.VALID_CHARS - rf.valid_skips = self.SKIP_VALUES - rf.valid_tmodes = ["", "Tone", "TSQL", "DTCS", "Cross"] - rf.valid_cross_modes = ["Tone->Tone", "Tone->DTCS", "DTCS->Tone", - "->Tone", "->DTCS", "DTCS->", "DTCS->DTCS"] - rf.valid_dtcs_codes = self.DTCS_CODES - rf.valid_power_levels = self.POWER_LEVELS - rf.valid_duplexes = self.DUPLEXES - rf.valid_modes = ["FM", "NFM"] # 25 kHz, 12.5 KHz. - rf.memory_bounds = (1, self._upper) - rf.valid_tuning_steps = [2.5, 5., 6.25, 10., 12.5, 25.] - rf.valid_bands = self.VALID_BANDS - - return rf - - def process_mmap(self): - self._memobj = bitwise.parse(MEM_FORMAT % self._mem_params, self._mmap) - - def validate_memory(self, mem): - msgs = "" - msgs = chirp_common.CloneModeRadio.validate_memory(self, mem) - - _msg_freq = 'Memory location cannot change frequency' - _msg_simplex = 'Memory location only supports Duplex:(None)' - _msg_duplex = 'Memory location only supports Duplex: +' - _msg_nfm = 'Memory location only supports Mode: NFM' - _msg_txp = 'Memory location only supports Power: Low' - - # FRS only models - if self._frs: - # range of memories with values set by FCC rules - if mem.freq != int(FRS_FREQS[mem.number - 1] * 1000000): - # warn user can't change frequency - msgs.append(chirp_common.ValidationError(_msg_freq)) - - # channels 1 - 22 are simplex only - if str(mem.duplex) != "": - # warn user can't change duplex - msgs.append(chirp_common.ValidationError(_msg_simplex)) - - # channels 1 - 22 are NFM only - if str(mem.mode) != "NFM": - # warn user can't change mode - msgs.append(chirp_common.ValidationError(_msg_nfm)) - - # channels 8 - 14 are low power only - if mem.number >= 8 and mem.number <= 14: - if str(mem.power) != "Low": - # warn user can't change power - msgs.append(chirp_common.ValidationError(_msg_txp)) - - # MURS only models - if self._murs: - # range of memories with values set by FCC rules - if mem.freq != int(MURS_FREQS[mem.number - 1] * 1000000): - # warn user can't change frequency - msgs.append(chirp_common.ValidationError(_msg_freq)) - - # channels 1 - 5 are simplex only - if str(mem.duplex) != "": - # warn user can't change duplex - msgs.append(chirp_common.ValidationError(_msg_simplex)) - - # channels 1 - 3 are NFM only - if mem.number <= 3: - if mem.mode != "NFM": - # warn user can't change mode - msgs.append(chirp_common.ValidationError(_msg_nfm)) - - # PMR only models - if self._pmr: - # range of memories with values set by governmental rules - if mem.freq != int(PMR_FREQS[mem.number - 1] * 1000000): - # warn user can't change frequency - msgs.append(chirp_common.ValidationError(_msg_freq)) - - # channels 1 - 16 are simplex only - if str(mem.duplex) != "": - # warn user can't change duplex - msgs.append(chirp_common.ValidationError(_msg_simplex)) - - # channels 1 - 16 are NFM only - if mem.mode != "NFM": - # warn user can't change mode - msgs.append(chirp_common.ValidationError(_msg_nfm)) - - # channels 1 - 16 are low power only - if str(mem.power) != "Low": - # warn user can't change power - msgs.append(chirp_common.ValidationError(_msg_txp)) - - return msgs - - def sync_in(self): - """Download from radio""" - try: - data = do_download(self) - except errors.RadioError: - # Pass through any real errors we raise - raise - except: - # If anything unexpected happens, make sure we raise - # a RadioError and log the problem - LOG.exception('Unexpected error during download') - raise errors.RadioError('Unexpected error communicating ' - 'with the radio') - self._mmap = data - self.process_mmap() - - def sync_out(self): - """Upload to radio""" - try: - do_upload(self) - except: - # If anything unexpected happens, make sure we raise - # a RadioError and log the problem - LOG.exception('Unexpected error during upload') - raise errors.RadioError('Unexpected error communicating ' - 'with the radio') - - def get_raw_memory(self, number): - return repr(self._memobj.memory[number - 1]) - - def _get_tone(self, mem, _mem): - rx_tone = tx_tone = None - - tx_tmode = TMODES[_mem.tx_tmode] - rx_tmode = TMODES[_mem.rx_tmode] - - if tx_tmode == "Tone": - tx_tone = TONES[_mem.tx_tone] - elif tx_tmode == "DTCS": - tx_tone = self.DTCS_CODES[_mem.tx_tone] - - if rx_tmode == "Tone": - rx_tone = TONES[_mem.rx_tone] - elif rx_tmode == "DTCS": - rx_tone = self.DTCS_CODES[_mem.rx_tone] - - tx_pol = _mem.tx_tmode == 0x03 and "R" or "N" - rx_pol = _mem.rx_tmode == 0x03 and "R" or "N" - - chirp_common.split_tone_decode(mem, (tx_tmode, tx_tone, tx_pol), - (rx_tmode, rx_tone, rx_pol)) - - def _is_txinh(self, _mem): - raw_tx = "" - for i in range(0, 4): - raw_tx += _mem.txfreq[i].get_raw() - return raw_tx == "\xFF\xFF\xFF\xFF" - - def _get_mem(self, number): - return self._memobj.memory[number - 1] - - def _get_nam(self, number): - return self._memobj.names[number - 1] - - def get_memory(self, number): - _mem = self._get_mem(number) - if self.HAS_NAMES: - _nam = self._get_nam(number) - - mem = chirp_common.Memory() - - mem.number = number - mem.freq = int(_mem.rxfreq) * 10 - - # We'll consider any blank (i.e. 0MHz frequency) to be empty - if mem.freq == 0: - mem.empty = True - return mem - - if _mem.rxfreq.get_raw() == "\xFF\xFF\xFF\xFF": - mem.freq = 0 - mem.empty = True - return mem - - if _mem.get_raw() == ("\xFF" * 16): - LOG.debug("Initializing empty memory") - _mem.set_raw("\x00" * 13 + "\xFF" * 3) - - if self._is_txinh(_mem): - mem.duplex = "off" - mem.offset = 0 - elif int(_mem.rxfreq) == int(_mem.txfreq): - mem.duplex = "" - mem.offset = 0 - else: - mem.duplex = int(_mem.rxfreq) > int(_mem.txfreq) and "-" or "+" - mem.offset = abs(int(_mem.rxfreq) - int(_mem.txfreq)) * 10 - - # wide/narrow - mem.mode = _mem.isnarrow and "NFM" or "FM" - - mem.skip = _mem.skip and "S" or "" - - if self.HAS_NAMES: - for char in _nam.name: - if str(char) == "\xFF": - char = " " # The OEM software may have 0xFF mid-name - mem.name += str(char) - mem.name = mem.name.rstrip() - - # tone data - self._get_tone(mem, _mem) - - # tx power - levels = self.POWER_LEVELS - try: - mem.power = levels[_mem.lowpower] - except IndexError: - LOG.error("Radio reported invalid power level %s (in %s)" % - (_mem.lowpower, levels)) - mem.power = levels[0] - - if mem.number <= 22 and self._frs: - FRS_IMMUTABLE = ["freq", "duplex", "offset", "mode"] - if mem.number >= 8 and mem.number <= 14: - mem.immutable = FRS_IMMUTABLE + ["power"] - else: - mem.immutable = FRS_IMMUTABLE - - if mem.number <= 30 and self._gmrs: - GMRS_IMMUTABLE = ["freq", "duplex", "offset"] - if mem.number >= 8 and mem.number <= 14: - mem.immutable = GMRS_IMMUTABLE + ["mode", "power"] - else: - mem.immutable = GMRS_IMMUTABLE - - if mem.number <= 5 and self._murs: - MURS_IMMUTABLE = ["freq", "duplex", "offset"] - if mem.number <= 3: - mem.immutable = MURS_IMMUTABLE + ["mode"] - else: - mem.immutable = MURS_IMMUTABLE - - if mem.number <= 16 and self._pmr: - PMR_IMMUTABLE = ["freq", "duplex", "offset", "mode", "power"] - mem.immutable = PMR_IMMUTABLE - - return mem - - def _set_tone(self, mem, _mem): - ((txmode, txtone, txpol), - (rxmode, rxtone, rxpol)) = chirp_common.split_tone_encode(mem) - - _mem.tx_tmode = TMODES.index(txmode) - _mem.rx_tmode = TMODES.index(rxmode) - if txmode == "Tone": - _mem.tx_tone = TONES.index(txtone) - elif txmode == "DTCS": - _mem.tx_tmode = txpol == "R" and 0x03 or 0x02 - _mem.tx_tone = self.DTCS_CODES.index(txtone) - if rxmode == "Tone": - _mem.rx_tone = TONES.index(rxtone) - elif rxmode == "DTCS": - _mem.rx_tmode = rxpol == "R" and 0x03 or 0x02 - _mem.rx_tone = self.DTCS_CODES.index(rxtone) - - def _set_mem(self, number): - return self._memobj.memory[number - 1] - - def _set_nam(self, number): - return self._memobj.names[number - 1] - - def set_memory(self, mem): - _mem = self._set_mem(mem.number) - if self.HAS_NAMES: - _nam = self._set_nam(mem.number) - - # if empty memory - if mem.empty: - if mem.number <= 22 and self._frs: - _mem.set_raw("\xFF" * 8 + "\x00" * 5 + "\xFF" * 3) - FRS_FREQ = int(FRS_FREQS[mem.number - 1] * 100000) - _mem.rxfreq = _mem.txfreq = FRS_FREQ - _mem.isnarrow = True - if mem.number >= 8 and mem.number <= 14: - _mem.lowpower = True - else: - _mem.lowpower = False - elif self._murs: - if mem.number <= 5: - _mem.set_raw("\xFF" * 8 + "\x00" * 5 + "\xFF" * 3) - MURS_FREQ = int(MURS_FREQS[mem.number - 1] * 100000) - _mem.rxfreq = _mem.txfreq = MURS_FREQ - _mem.lowpower = False - if mem.number <= 3: - _mem.isnarrow = True - else: - _mem.isnarrow = False - elif self._pmr: - if mem.number <= 16: - _mem.set_raw("\xFF" * 8 + "\x00" * 5 + "\xFF" * 3) - PMR_FREQ = int(PMR_FREQS[mem.number - 1] * 100000) - _mem.rxfreq = _mem.txfreq = PMR_FREQ - _mem.lowpower = True - _mem.isnarrow = True - else: - _mem.set_raw("\xFF" * 8 + "\x00" * 4 + "\x03" + "\xFF" * 3) - - if self.HAS_NAMES: - for i in range(0, self.NAME_LENGTH): - _nam.name[i].set_raw("\xFF") - - return mem - - _mem.set_raw("\x00" * 13 + "\xFF" * 3) - - if self._gmrs: - if mem.number >= 1 and mem.number <= 30: - GMRS_FREQ = int(GMRS_FREQS[mem.number - 1] * 1000000) - mem.freq = GMRS_FREQ - if mem.number <= 22: - mem.duplex = '' - mem.offset = 0 - if mem.number >= 8 and mem.number <= 14: - mem.mode = "NFM" - mem.power = self.POWER_LEVELS[1] - if mem.number > 22: - mem.duplex = '+' - mem.offset = 5000000 - elif float(mem.freq) / 1000000 in GMRS_FREQS: - if float(mem.freq) / 1000000 in FRS_FREQS1: - mem.duplex = '' - mem.offset = 0 - if float(mem.freq) / 1000000 in FRS_FREQS2: - mem.duplex = '' - mem.offset = 0 - mem.mode = "NFM" - mem.power = self.POWER_LEVELS[1] - if float(mem.freq) / 1000000 in FRS_FREQS3: - if mem.duplex == '+': - mem.offset = 5000000 - else: - mem.duplex = '' - mem.offset = 0 - else: - mem.duplex = 'off' - mem.offset = 0 - - # frequency - _mem.rxfreq = mem.freq / 10 - - if mem.duplex == "off": - for i in range(0, 4): - _mem.txfreq[i].set_raw("\xFF") - elif mem.duplex == "split": - _mem.txfreq = mem.offset / 10 - elif mem.duplex == "+": - _mem.txfreq = (mem.freq + mem.offset) / 10 - elif mem.duplex == "-": - _mem.txfreq = (mem.freq - mem.offset) / 10 - else: - _mem.txfreq = mem.freq / 10 - - # wide/narrow - _mem.isnarrow = mem.mode == "NFM" - - _mem.skip = mem.skip == "S" - - if self.HAS_NAMES: - for i in range(self.NAME_LENGTH): - try: - _nam.name[i] = mem.name[i] - except IndexError: - _nam.name[i] = "\xFF" - - # tone data - self._set_tone(mem, _mem) - - # tx power - if mem.power: - _mem.lowpower = self.POWER_LEVELS.index(mem.power) - else: - _mem.lowpower = 0 - - return mem - - def get_settings(self): - _settings = self._memobj.settings - basic = RadioSettingGroup("basic", "Basic Settings") - top = RadioSettings(basic) - - # Menu 03 - rs = RadioSettingValueInteger(0, 9, _settings.squelch) - rset = RadioSetting("squelch", "Squelch Level", rs) - basic.append(rset) - - model_list = ["RB27B", "RB27V", "RB627B"] - if self.MODEL in model_list: - # Menu 09 (RB27x/RB627x) - rs = RadioSettingValueList(TOT2_LIST, TOT2_LIST[_settings.tot]) - else: - # Menu 11 / 09 (RB27) - rs = RadioSettingValueList(TOT_LIST, TOT_LIST[_settings.tot]) - rset = RadioSetting("tot", "Time-out timer", rs) - basic.append(rset) - - # Menu 06 - rs = RadioSettingValueList(VOX_LIST, VOX_LIST[_settings.vox]) - rset = RadioSetting("vox", "VOX Level", rs) - basic.append(rset) - - # Menu 15 (BF-T8) / Menu 14 (FRS-A1) - if self.MODEL == "FRS-A1": - # Menu 14 (FRS-A1) - def apply_voice_listvalue(setting, obj): - LOG.debug("Setting value: " + str(setting.value) + - " from list") - val = str(setting.value) - index = VOICE_CHOICES.index(val) - val = VOICE_VALUES[index] - obj.set_value(val) - - if _settings.voice in VOICE_VALUES: - idx = VOICE_VALUES.index(_settings.voice) - else: - idx = VOICE_VALUES.index(0x00) - rs = RadioSettingValueList(VOICE_CHOICES, VOICE_CHOICES[idx]) - rset = RadioSetting("voice", "Voice", rs) - rset.set_apply_callback(apply_voice_listvalue, _settings.voice) - basic.append(rset) - else: - # Menu 15 (BF-T8) - rs = RadioSettingValueList(VOICE_LIST, VOICE_LIST[_settings.voice]) - rset = RadioSetting("voice", "Voice", rs) - basic.append(rset) - - # Menu 12 - rs = RadioSettingValueBoolean(_settings.bcl) - rset = RadioSetting("bcl", "Busy Channel Lockout", rs) - basic.append(rset) - - # Menu 10 / 08 (RB27/RB627) - rs = RadioSettingValueBoolean(_settings.save) - rset = RadioSetting("save", "Battery Saver", rs) - basic.append(rset) - - # Menu 08 / 07 (RB-27/RB627) - rs = RadioSettingValueBoolean(_settings.tdr) - rset = RadioSetting("tdr", "Dual Watch", rs) - basic.append(rset) - - # Menu 05 - rs = RadioSettingValueBoolean(_settings.beep) - rset = RadioSetting("beep", "Beep", rs) - basic.append(rset) - - # Menu 04 - rs = RadioSettingValueList(ABR_LIST, ABR_LIST[_settings.abr]) - rset = RadioSetting("abr", "Back Light", rs) - basic.append(rset) - - # Menu 13 / 11 (RB-27/RB627) - rs = RadioSettingValueList(RING_LIST, RING_LIST[_settings.ring]) - rset = RadioSetting("ring", "Ring", rs) - basic.append(rset) - - rs = RadioSettingValueBoolean(not _settings.ste) - rset = RadioSetting("ste", "Squelch Tail Eliminate", rs) - basic.append(rset) - - # Menu 15 (FRS-A1) - if self.MODEL == "FRS-A1": - rs = RadioSettingValueList(MDF_LIST, MDF_LIST[_settings.mdf]) - rset = RadioSetting("mdf", "Display Type", rs) - basic.append(rset) - - if self.CH_OFFSET: - rs = RadioSettingValueInteger(1, self._upper, _settings.mra + 1) - else: - rs = RadioSettingValueInteger(1, self._upper, _settings.mra) - rset = RadioSetting("mra", "MR A Channel #", rs) - basic.append(rset) - - if self.CH_OFFSET: - rs = RadioSettingValueInteger(1, self._upper, _settings.mrb + 1) - else: - rs = RadioSettingValueInteger(1, self._upper, _settings.mrb) - rset = RadioSetting("mrb", "MR B Channel #", rs) - basic.append(rset) - - rs = RadioSettingValueList(AB_LIST, AB_LIST[_settings.disp_ab]) - rset = RadioSetting("disp_ab", "Selected Display Line", rs) - basic.append(rset) - - if not self.MODEL.startswith("RB627"): - if self.MODEL == "FRS-A1": - del WX_LIST[7:] - rs = RadioSettingValueList(WX_LIST, WX_LIST[_settings.wx]) - rset = RadioSetting("wx", "NOAA WX Radio", rs) - basic.append(rset) - - def myset_freq(setting, obj, atrb, mult): - """ Callback to set frequency by applying multiplier""" - value = int(float(str(setting.value)) * mult) - setattr(obj, atrb, value) - return - - # FM Broadcast Settings - val = _settings.fmcur - val = val / 10.0 - val_low = 76.0 - if self.MODEL == "FRS-A1": - val_low = 87.0 - if val < val_low or val > 108.0: - val = 90.4 - rx = RadioSettingValueFloat(val_low, 108.0, val, 0.1, 1) - rset = RadioSetting("settings.fmcur", "Broadcast FM Radio (MHz)", rx) - rset.set_apply_callback(myset_freq, _settings, "fmcur", 10) - basic.append(rset) - - model_list = ["BF-T8", "BF-U9", "AR-8"] - if self.MODEL in model_list: - rs = RadioSettingValueList(WORKMODE_LIST, - WORKMODE_LIST[_settings.workmode]) - rset = RadioSetting("workmode", "Work Mode", rs) - basic.append(rset) - - rs = RadioSettingValueList(AREA_LIST, AREA_LIST[_settings.area]) - rs.set_mutable(False) - rset = RadioSetting("area", "Area", rs) - basic.append(rset) - - return top - - def set_settings(self, settings): - for element in settings: - if not isinstance(element, RadioSetting): - self.set_settings(element) - continue - else: - try: - if "." in element.get_name(): - bits = element.get_name().split(".") - obj = self._memobj - for bit in bits[:-1]: - obj = getattr(obj, bit) - setting = bits[-1] - else: - obj = self._memobj.settings - setting = element.get_name() - - if element.has_apply_callback(): - LOG.debug("Using apply callback") - element.run_apply_callback() - elif setting == "mra" and self.CH_OFFSET: - setattr(obj, setting, int(element.value) - 1) - elif setting == "mrb" and self.CH_OFFSET: - setattr(obj, setting, int(element.value) - 1) - elif setting == "ste": - setattr(obj, setting, not int(element.value)) - elif element.value.get_mutable(): - LOG.debug("Setting %s = %s" % (setting, element.value)) - setattr(obj, setting, element.value) - except Exception as e: - LOG.debug(element.get_name()) - raise - - @classmethod - def match_model(cls, filedata, filename): - # This radio has always been post-metadata, so never do - # old-school detection - return False - - -class BFU9Alias(chirp_common.Alias): - VENDOR = "Baofeng" - MODEL = "BF-U9" - - -class AR8Alias(chirp_common.Alias): - VENDOR = "Arcshell" - MODEL = "AR-8" - - -@directory.register -class BaofengBFT8Generic(BFT8Radio): - ALIASES = [BFU9Alias, AR8Alias, ] - - -@directory.register -class RetevisRT16(BFT8Radio): - VENDOR = "Retevis" - MODEL = "RT16" - - _upper = 22 - _frs = True - - -@directory.register -class RetevisRB27B(BFT8Radio): - VENDOR = "Retevis" - MODEL = "RB27B" - DTCS_CODES = sorted(chirp_common.DTCS_CODES + [645]) - HAS_NAMES = True - NAME_LENGTH = 6 - VALID_CHARS = chirp_common.CHARSET_UPPER_NUMERIC + "-" - CH_OFFSET = True - SKIP_VALUES = ["", "S"] - POWER_LEVELS = [chirp_common.PowerLevel("High", watts=2.00), - chirp_common.PowerLevel("Low", watts=0.50)] - VALID_BANDS = [(400000000, 520000000)] - - _upper = 22 - _frs = True - _gmrs = _murs = _pmr = False - - _ranges = [ - (0x0000, 0x0640), - (0x0D00, 0x1040), - ] - _memsize = 0x1040 - - -@directory.register -class RetevisRB27(RetevisRB27B): - VENDOR = "Retevis" - MODEL = "RB27" - POWER_LEVELS = [chirp_common.PowerLevel("High", watts=5.00), - chirp_common.PowerLevel("Low", watts=0.50)] - VALID_BANDS = [(136000000, 174000000), - (400000000, 520000000)] - - _upper = 99 - _gmrs = True - _frs = _murs = _pmr = False - - -@directory.register -class RetevisRB27V(RetevisRB27B): - VENDOR = "Retevis" - MODEL = "RB27V" - VALID_BANDS = [(136000000, 174000000)] - - _upper = 5 - _murs = True - _frs = _gmrs = _pmr = False - - -@directory.register -class RetevisRB627B(RetevisRB27B): - VENDOR = "Retevis" - MODEL = "RB627B" - POWER_LEVELS = [chirp_common.PowerLevel("High", watts=0.50), - chirp_common.PowerLevel("Low", watts=0.50)] - - _upper = 16 - _pmr = True - _frs = _gmrs = _murs = False - - -@directory.register -class FRSA1Radio(BFT8Radio): - """BTECH FRS-A1""" - VENDOR = "BTECH" - MODEL = "FRS-A1" - ODD_SPLIT = False - HAS_NAMES = True - NAME_LENGTH = 6 - SKIP_VALUES = ["", "S"] - DTCS_CODES = sorted(chirp_common.DTCS_CODES + [645]) - DUPLEXES = ["", "-", "+", "off"] - - _fingerprint = "BF-T8A" + "\x2E" - _upper = 22 - _frs = _upper == 22 - - _ranges = [ - (0x0000, 0x0640), - (0x0D00, 0x0DC0), - ] - _memsize = 0x0DC0 - - def get_features(self): - rf = BFT8Radio.get_features(self) - rf.valid_name_length = 6 - rf.valid_characters = chirp_common.CHARSET_UPPER_NUMERIC + "-" - return rf diff --git a/chirp/drivers/bf_t1.py b/chirp/drivers/bf_t1.py new file mode 100644 index 0000000..496af8d --- /dev/null +++ b/chirp/drivers/bf_t1.py @@ -0,0 +1,927 @@ +# Copyright 2017 Pavel Milanes, CO7WT, +# +# This driver is a community effort as I don't have the radio on my hands, so +# I was only the director of the orchestra, without the players this may never +# came true, so special thanks to the following hams for their contribution: +# - Henk van der Laan, PA3CQN +# - Setting Discovery. +# - Special channels for RELAY and EMERGENCY. +# - Harold Hankins +# - Memory limits, testing & bug hunting. +# - Dmitry Milkov +# - Testing & bug hunting. +# - Many others participants in the issue page on Chirp's site. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +from chirp import chirp_common, directory, memmap +from chirp import bitwise, errors, util +from chirp.settings import RadioSetting, RadioSettingGroup, \ + RadioSettingValueBoolean, RadioSettingValueList, \ + RadioSettingValueInteger, RadioSettingValueFloat, \ + RadioSettings + +import struct +import logging + +LOG = logging.getLogger(__name__) + +# A note about the memory in these radios +# +# The '9100' OEM software only manipulates the lower 0x0180 bytes on read/write +# operations as we know, the file generated by the OEM software IS NOT an exact +# eeprom image, it's a crude text file with a pseudo csv format +# +# Later investigations by Harold Hankins found that the eeprom extend up to 2k +# consistent with a hardware chip K24C16 a 2k x 8 bit serial eeprom + +MEM_SIZE = 0x0800 # 2048 bytes +WRITE_SIZE = 0x0180 # 384 bytes +BLOCK_SIZE = 0x10 +ACK_CMD = b"\x06" +MODES = ["NFM", "FM"] +SKIP_VALUES = ["S", ""] +TONES = chirp_common.TONES +DTCS = tuple(sorted(chirp_common.DTCS_CODES + (645,))) + +# Special channels +SPECIALS = { + "EMG": -2, + "RLY": -1 + } + +# Settings vars +TOT_LIST = ["Off"] + ["%s" % x for x in range(30, 210, 30)] +SCAN_TYPE_LIST = ["Time", "Carrier", "Search"] +LANGUAGE_LIST = ["Off", "English", "Chinese"] +TIMER_LIST = ["Off"] + ["%s h" % (x * 0.5) for x in range(1, 17)] +FM_RANGE_LIST = ["76-108", "65-76"] +RELAY_MODE_LIST = ["Off", "RX sync", "TX sync"] +BACKLIGHT_LIST = ["Off", "Key", "On"] +POWER_LIST = ["0.5 Watt", "1.0 Watt"] + +# This is a general serial timeout for all serial read functions. +# Practice has show that about 0.07 sec will be enough to cover all radios. +STIMEOUT = 0.07 + +# this var controls the verbosity in the debug and by default it's low (False) +# make it True and you will to get a very verbose debug.log +debug = False + +# #### ID strings ##################################################### + +# BF-T1 handheld +BFT1_magic = b"\x05PROGRAM" +BFT1_ident = b" BF9100S" + + +def _clean_buffer(radio): + """Cleaning the read serial buffer, hard timeout to survive an infinite + data stream""" + + dump = "1" + datacount = 0 + + try: + while len(dump) > 0: + dump = radio.pipe.read(100) + datacount += len(dump) + # hard limit to survive a infinite serial data stream + # 5 times bigger than a normal rx block (20 bytes) + if datacount > 101: + seriale = "Please check your serial port selection." + raise errors.RadioError(seriale) + + except Exception: + raise errors.RadioError("Unknown error cleaning the serial buffer") + + +def _rawrecv(radio, amount=0): + """Raw read from the radio device""" + + # var to hold the data to return + data = b"" + + try: + if amount == 0: + data = radio.pipe.read() + else: + data = radio.pipe.read(amount) + + # DEBUG + if debug is True: + LOG.debug("<== (%d) bytes:\n\n%s" % + (len(data), util.hexprint(data))) + + # fail if no data is received + if len(data) == 0: + raise errors.RadioError("No data received from radio") + + except: + raise errors.RadioError("Error reading data from radio") + + return data + + +def _send(radio, data): + """Send data to the radio device""" + + try: + radio.pipe.write(data) + + # DEBUG + if debug is True: + LOG.debug("==> (%d) bytes:\n\n%s" % + (len(data), util.hexprint(data))) + except: + raise errors.RadioError("Error sending data to radio") + + +def _make_frame(cmd, addr, data=""): + """Pack the info in the header format""" + frame = struct.pack(">BHB", ord(cmd), addr, BLOCK_SIZE) + + # add the data if set + if len(data) != 0: + frame += data + + return frame + + +def _recv(radio, addr): + """Get data from the radio""" + + # Get the full 20 bytes at a time + # 4 bytes header + 16 bytes of data (BLOCK_SIZE) + + # get the whole block + block = _rawrecv(radio, BLOCK_SIZE + 4) + + # short answer + if len(block) < (BLOCK_SIZE + 4): + raise errors.RadioError("Wrong block length (short) at 0x%04x" % addr) + + # long answer + if len(block) > (BLOCK_SIZE + 4): + raise errors.RadioError("Wrong block length (long) at 0x%04x" % addr) + + # header validation + c, a, l = struct.unpack(">cHB", block[0:4]) + if c != b"W" or a != addr or l != BLOCK_SIZE: + LOG.debug("Invalid header for block 0x%04x:" % addr) + LOG.debug("CMD: %s ADDR: %04x SIZE: %02x" % (c, a, l)) + raise errors.RadioError("Invalid header for block 0x%04x:" % addr) + + # return the data, 16 bytes of payload + return block[4:] + + +def _start_clone_mode(radio, status): + """Put the radio in clone mode, 3 tries""" + + # cleaning the serial buffer + _clean_buffer(radio) + + # prep the data to show in the UI + status.cur = 0 + status.msg = "Identifying the radio..." + status.max = 3 + radio.status_fn(status) + + try: + for a in range(0, status.max): + # Update the UI + status.cur = a + 1 + radio.status_fn(status) + + # send the magic word + _send(radio, radio._magic) + + # Now you get a x06 of ACK if all goes well + ack = _rawrecv(radio, 1) + + if ack == ACK_CMD: + # DEBUG + LOG.info("Magic ACK received") + status.cur = status.max + radio.status_fn(status) + + return True + + return False + + except errors.RadioError: + raise + except Exception as e: + raise errors.RadioError("Error sending Magic to radio:\n%s" % e) + + +def _do_ident(radio, status): + """Put the radio in PROGRAM mode & identify it""" + # set the serial discipline (default) + radio.pipe.baudrate = 9600 + radio.pipe.parity = "N" + radio.pipe.bytesize = 8 + radio.pipe.stopbits = 1 + radio.pipe.timeout = STIMEOUT + + # open the radio into program mode + if _start_clone_mode(radio, status) is False: + raise errors.RadioError("Radio did not enter clone mode, wrong model?") + + # Ok, poke it to get the ident string + _send(radio, b"\x02") + ident = _rawrecv(radio, len(radio._id)) + + # basic check for the ident + if len(ident) != len(radio._id): + raise errors.RadioError("Radio send a odd identification block.") + + # check if ident is OK + if ident != radio._id: + LOG.debug("Incorrect model ID, got this:\n\n" + util.hexprint(ident)) + raise errors.RadioError("Radio identification failed.") + + # handshake + _send(radio, ACK_CMD) + ack = _rawrecv(radio, 1) + + # checking handshake + if len(ack) == 1 and ack == ACK_CMD: + # DEBUG + LOG.info("ID ACK received") + else: + LOG.debug("Radio handshake failed.") + raise errors.RadioError("Radio handshake failed.") + + # DEBUG + LOG.info("Positive ident, this is a %s %s" % (radio.VENDOR, radio.MODEL)) + + return True + + +def _download(radio): + """Get the memory map""" + + # UI progress + status = chirp_common.Status() + + # put radio in program mode and identify it + _do_ident(radio, status) + + # reset the progress bar in the UI + status.max = MEM_SIZE // BLOCK_SIZE + status.msg = "Cloning from radio..." + status.cur = 0 + radio.status_fn(status) + + # cleaning the serial buffer + _clean_buffer(radio) + + data = b"" + for addr in range(0, MEM_SIZE, BLOCK_SIZE): + # sending the read request + _send(radio, _make_frame(b"R", addr)) + + # read + d = _recv(radio, addr) + + # aggregate the data + data += d + + # UI Update + status.cur = addr // BLOCK_SIZE + status.msg = "Cloning from radio..." + radio.status_fn(status) + + # close comms with the radio + _send(radio, b"\x62") + # DEBUG + LOG.info("Close comms cmd sent, radio must reboot now.") + + return data + + +def _upload(radio): + """Upload procedure, we only upload to the radio the Writable space""" + + # UI progress + status = chirp_common.Status() + + # put radio in program mode and identify it + _do_ident(radio, status) + + # get the data to upload to radio + data = radio.get_mmap() + + # Reset the UI progress + status.max = WRITE_SIZE // BLOCK_SIZE + status.cur = 0 + status.msg = "Cloning to radio..." + radio.status_fn(status) + + # cleaning the serial buffer + _clean_buffer(radio) + + # the fun start here, we use WRITE_SIZE instead of the full MEM_SIZE + for addr in range(0, WRITE_SIZE, BLOCK_SIZE): + # getting the block of data to send + d = data[addr:addr + BLOCK_SIZE] + + # build the frame to send + frame = _make_frame(b"W", addr, d) + + # send the frame + _send(radio, frame) + + # receiving the response + ack = _rawrecv(radio, 1) + + # basic check + if len(ack) != 1: + raise errors.RadioError("No ACK when writing block 0x%04x" % addr) + + if ack != ACK_CMD: + raise errors.RadioError("Bad ACK writing block 0x%04x:" % addr) + + # UI Update + status.cur = addr // BLOCK_SIZE + status.msg = "Cloning to radio..." + radio.status_fn(status) + + # close comms with the radio + _send(radio, b"\x62") + # DEBUG + LOG.info("Close comms cmd sent, radio must reboot now.") + + +def _model_match(cls, data): + """Match the opened/downloaded image to the correct version""" + + # a reliable fingerprint: the model name at + rid = data[0x06f8:0x0700] + + if rid == BFT1_ident: + return True + + return False + + +def _decode_ranges(low, high): + """Unpack the data in the ranges zones in the memmap and return + a tuple with the integer corresponding to the MHz it means""" + return (int(low) * 100000, int(high) * 100000) + + +MEM_FORMAT = """ + +struct channel { + lbcd rxfreq[4]; // rx freq. + u8 rxtone; // x00 = none + // x01 - x32 = index of the analog tones + // x33 - x9b = index of Digital tones + // Digital tone polarity is handled below by + // ttondinv & ttondinv settings + lbcd txoffset[4]; // the difference against RX, direction handled by + // offplus & offminus + u8 txtone; // Idem to rxtone + u8 noskip:1, // if true is included in the scan + wide:1, // 1 = Wide, 0 = Narrow + ttondinv:1, // if true TX tone is Digital & Inverted + unA:1, // + rtondinv:1, // if true RX tone is Digital & Inverted + unB:1, // + offplus:1, // TX = RX + offset + offminus:1; // TX = RX - offset + u8 empty[5]; +}; + +#seekto 0x0000; +struct channel emg; // channel 0 is Emergent CH +#seekto 0x0010; +struct channel channels[20]; // normal 1-20 mem channels + +#seekto 0x0150; // Settings +struct { + lbcd vhfl[2]; // VHF low limit + lbcd vhfh[2]; // VHF high limit + lbcd uhfl[2]; // UHF low limit + lbcd uhfh[2]; // UHF high limit + u8 unk0[8]; + u8 unk1[2]; // start of 0x0160 <======= + u8 squelch; // byte: 0-9 + u8 vox; // byte: 0-9 + u8 timeout; // tot, 0 off, then 30 sec increments up to 180 + u8 batsave:1, // battery save 0 = off, 1 = on + fm_funct:1, // fm-radio 0=off, 1=on ( off disables fm button on set ) + ste:1, // squelch tail 0 = off, 1 = on + blo:1, // busy lockout 0 = off, 1 = on + beep:1, // key beep 0 = off, 1 = on + lock:1, // keylock 0 = ff, = on + backlight:2; // backlight 00 = off, 01 = key, 10 = on + u8 scantype; // scan type 0 = timed, 1 = carrier, 2 = stop + u8 channel; // active channel 1-20, setting it works on upload + u8 fmrange; // fm range 1 = low[65-76](ASIA), 0 = high[76-108](AMERICA) + u8 alarm; // alarm (count down timer) + // d0 - d16 in half hour increments => off, 0.5 - 8.0 h + u8 voice; // voice prompt 0 = off, 1 = English, 2 = Chinese + u8 volume; // volume 1-7 as per the radio steps + // set to #FF by original software on upload + // chirp uploads actual value and works. + u16 fm_vfo; // the frequency of the fm receiver. + // resulting frequency is 65 + value * 0.1 MHz + // 0x145 is then 65 + 325*0.1 = 97.5 MHz + u8 relaym; // relay mode, d0 = off, d2 = re-tx, d1 = re-rx + // still a mystery on how it works + u8 tx_pwr; // tx pwr 0 = low (0.5W), 1 = high(1.0W) +} settings; + +#seekto 0x0170; // Relay CH +struct channel rly; + +""" + + +@directory.register +class BFT1(chirp_common.CloneModeRadio, chirp_common.ExperimentalRadio): + """Baofeng BT-F1 radio & possibly alike radios""" + VENDOR = "Baofeng" + MODEL = "BF-T1" + NEEDS_COMPAT_SERIAL = False + _vhf_range = (130000000, 174000000) + _uhf_range = (400000000, 520000000) + _upper = 20 + _magic = BFT1_magic + _id = BFT1_ident + _bw_shift = False + + @classmethod + def get_prompts(cls): + rp = chirp_common.RadioPrompts() + rp.experimental = \ + ('This driver is experimental.\n' + '\n' + 'Please keep a copy of your memories with the original software ' + 'if you treasure them, this driver is new and may contain' + ' bugs.\n' + '\n' + '"Emergent CH" & "Relay CH" are implemented via special channels,' + 'be sure to click on the button on the interface to access them.' + ) + rp.pre_download = _( + "Follow these instructions to download your info:\n" + "1 - Turn off your radio\n" + "2 - Connect your interface cable\n" + "3 - Turn on your radio\n" + "4 - Do the download of your radio data\n") + rp.pre_upload = _( + "Follow these instructions to upload your info:\n" + "1 - Turn off your radio\n" + "2 - Connect your interface cable\n" + "3 - Turn on your radio\n" + "4 - Do the upload of your radio data\n") + return rp + + def get_features(self): + """Get the radio's features""" + + rf = chirp_common.RadioFeatures() + rf.valid_special_chans = list(SPECIALS.keys()) + rf.has_settings = True + rf.has_bank = False + rf.has_tuning_step = False + rf.can_odd_split = True + rf.has_name = False + rf.has_offset = True + rf.has_mode = True + rf.valid_modes = MODES + rf.has_dtcs = True + rf.has_rx_dtcs = True + rf.has_dtcs_polarity = True + rf.has_ctone = True + rf.has_cross = True + rf.valid_duplexes = ["", "-", "+", "split"] + rf.valid_tmodes = ['', 'Tone', 'TSQL', 'DTCS', 'Cross'] + rf.valid_cross_modes = [ + "Tone->Tone", + "DTCS->", + "->DTCS", + "Tone->DTCS", + "DTCS->Tone", + "->Tone", + "DTCS->DTCS"] + rf.valid_skips = SKIP_VALUES + rf.valid_dtcs_codes = DTCS + rf.memory_bounds = (1, self._upper) + rf.valid_tuning_steps = [2.5, 5., 6.25, 10., 12.5, 25.] + + # normal dual bands + rf.valid_bands = [self._vhf_range, self._uhf_range] + + return rf + + def process_mmap(self): + """Process the mem map into the mem object""" + + # Get it + self._memobj = bitwise.parse(MEM_FORMAT, self._mmap) + + # set the band limits as the memmap + settings = self._memobj.settings + self._vhf_range = _decode_ranges(settings.vhfl, settings.vhfh) + self._uhf_range = _decode_ranges(settings.uhfl, settings.uhfh) + + def sync_in(self): + """Download from radio""" + data = _download(self) + self._mmap = memmap.MemoryMapBytes(data) + self.process_mmap() + + def sync_out(self): + """Upload to radio""" + + try: + _upload(self) + except errors.RadioError: + raise + except Exception as e: + raise errors.RadioError("Error: %s" % e) + + def _decode_tone(self, val, inv): + """Parse the tone data to decode from mem, it returns: + Mode (''|DTCS|Tone), Value (None|###), Polarity (None,N,R)""" + + if val == 0: + return '', None, None + elif val < 51: # analog tone + return 'Tone', TONES[val - 1], None + elif val > 50: # digital tone + pol = "N" + # polarity? + if inv == 1: + pol = "R" + + return 'DTCS', DTCS[val - 51], pol + + def _encode_tone(self, memtone, meminv, mode, tone, pol): + """Parse the tone data to encode from UI to mem""" + + if mode == '' or mode is None: + memtone.set_value(0) + meminv.set_value(0) + elif mode == 'Tone': + # caching errors for analog tones. + try: + memtone.set_value(TONES.index(tone) + 1) + meminv.set_value(0) + except: + msg = "TCSS Tone '%d' is not supported" % tone + LOG.error(msg) + raise errors.RadioError(msg) + + elif mode == 'DTCS': + # caching errors for digital tones. + try: + memtone.set_value(DTCS.index(tone) + 51) + if pol == "R": + meminv.set_value(True) + else: + meminv.set_value(False) + except: + msg = "Digital Tone '%d' is not supported" % tone + LOG.error(msg) + raise errors.RadioError(msg) + else: + msg = "Internal error: invalid mode '%s'" % mode + LOG.error(msg) + raise errors.InvalidDataError(msg) + + def get_raw_memory(self, number): + return repr(self._memobj.memory[number]) + + def _get_special(self, number): + if isinstance(number, str): + return (getattr(self._memobj, number.lower())) + elif number < 0: + for k, v in SPECIALS.items(): + if number == v: + return (getattr(self._memobj, k.lower())) + else: + return self._memobj.channels[number-1] + + def get_memory(self, number): + """Get the mem representation from the radio image""" + _mem = self._get_special(number) + + # Create a high-level memory object to return to the UI + mem = chirp_common.Memory() + + # Check if special or normal + if isinstance(number, str): + mem.number = SPECIALS[number] + mem.extd_number = number + else: + mem.number = number + + if _mem.get_raw()[0] == "\xFF": + mem.empty = True + return mem + + # Freq and offset + mem.freq = int(_mem.rxfreq) * 10 + + # TX freq (Stored as a difference) + mem.offset = int(_mem.txoffset) * 10 + mem.duplex = "" + + # must work out the polarity + if mem.offset != 0: + if _mem.offminus == 1: + mem.duplex = "-" + # tx below RX + + if _mem.offplus == 1: + # tx above RX + mem.duplex = "+" + + # split RX/TX in different bands + if mem.offset > 71000000: + mem.duplex = "split" + + # show the actual value in the offset, depending on the shift + if _mem.offminus == 1: + mem.offset = mem.freq - mem.offset + if _mem.offplus == 1: + mem.offset = mem.freq + mem.offset + + # wide/narrow + mem.mode = MODES[int(_mem.wide)] + + # skip + mem.skip = SKIP_VALUES[_mem.noskip] + + # tone data + rxtone = txtone = None + txtone = self._decode_tone(_mem.txtone, _mem.ttondinv) + rxtone = self._decode_tone(_mem.rxtone, _mem.rtondinv) + chirp_common.split_tone_decode(mem, txtone, rxtone) + + return mem + + def set_memory(self, mem): + """Set the memory data in the eeprom img from the UI""" + # get the eprom representation of this channel + _mem = self._get_special(mem.number) + + # if empty memory + if mem.empty: + # the channel itself + _mem.set_raw("\xFF" * 16) + # return it + return mem + + # frequency + _mem.rxfreq = mem.freq / 10 + + # duplex/ offset Offset is an absolute value + _mem.txoffset = mem.offset / 10 + + # must work out the polarity + if mem.duplex == "": + _mem.offplus = 0 + _mem.offminus = 0 + elif mem.duplex == "+": + _mem.offplus = 1 + _mem.offminus = 0 + elif mem.duplex == "-": + _mem.offplus = 0 + _mem.offminus = 1 + elif mem.duplex == "split": + if mem.freq > mem.offset: + _mem.offplus = 0 + _mem.offminus = 1 + _mem.txoffset = (mem.freq - mem.offset) / 10 + else: + _mem.offplus = 1 + _mem.offminus = 0 + _mem.txoffset = (mem.offset - mem.freq) / 10 + + # wide/narrow + _mem.wide = MODES.index(mem.mode) + + # skip + _mem.noskip = SKIP_VALUES.index(mem.skip) + + # tone data + ((txmode, txtone, txpol), (rxmode, rxtone, rxpol)) = \ + chirp_common.split_tone_encode(mem) + self._encode_tone(_mem.txtone, _mem.ttondinv, txmode, txtone, txpol) + self._encode_tone(_mem.rxtone, _mem.rtondinv, rxmode, rxtone, rxpol) + + return mem + + def get_settings(self): + _settings = self._memobj.settings + basic = RadioSettingGroup("basic", "Basic Settings") + fm = RadioSettingGroup("fm", "FM Radio") + adv = RadioSettingGroup("adv", "Advanced Settings") + group = RadioSettings(basic, fm, adv) + + # ## Basic Settings + rs = RadioSetting("tx_pwr", "TX Power", + RadioSettingValueList( + POWER_LIST, POWER_LIST[_settings.tx_pwr])) + basic.append(rs) + + rs = RadioSetting("channel", "Active Channel", + RadioSettingValueInteger(1, 20, _settings.channel)) + 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) + + # volume validation, as the OEM software set 0xFF on write + _volume = _settings.volume + if _volume > 7: + _volume = 7 + rs = RadioSetting("volume", "Volume Level", + RadioSettingValueInteger(0, 7, _volume)) + basic.append(rs) + + rs = RadioSetting("scantype", "Scan Type", + RadioSettingValueList(SCAN_TYPE_LIST, SCAN_TYPE_LIST[ + _settings.scantype])) + basic.append(rs) + + rs = RadioSetting("timeout", "Time Out Timer (seconds)", + RadioSettingValueList( + TOT_LIST, TOT_LIST[_settings.timeout])) + basic.append(rs) + + rs = RadioSetting("voice", "Voice Prompt", + RadioSettingValueList( + LANGUAGE_LIST, LANGUAGE_LIST[_settings.voice])) + basic.append(rs) + + rs = RadioSetting("alarm", "Alarm Time", + RadioSettingValueList( + TIMER_LIST, TIMER_LIST[_settings.alarm])) + basic.append(rs) + + rs = RadioSetting("backlight", "Backlight", + RadioSettingValueList( + BACKLIGHT_LIST, + BACKLIGHT_LIST[_settings.backlight])) + basic.append(rs) + + rs = RadioSetting("blo", "Busy Lockout", + RadioSettingValueBoolean(_settings.blo)) + basic.append(rs) + + rs = RadioSetting("ste", "Squelch Tail Eliminate", + RadioSettingValueBoolean(_settings.ste)) + basic.append(rs) + + rs = RadioSetting("batsave", "Battery Save", + RadioSettingValueBoolean(_settings.batsave)) + basic.append(rs) + + rs = RadioSetting("lock", "Key Lock", + RadioSettingValueBoolean(_settings.lock)) + basic.append(rs) + + rs = RadioSetting("beep", "Key Beep", + RadioSettingValueBoolean(_settings.beep)) + basic.append(rs) + + # ## FM Settings + rs = RadioSetting("fm_funct", "FM Function", + RadioSettingValueBoolean(_settings.fm_funct)) + fm.append(rs) + + rs = RadioSetting("fmrange", "FM Range", + RadioSettingValueList( + FM_RANGE_LIST, FM_RANGE_LIST[_settings.fmrange])) + fm.append(rs) + + # callbacks for the FM VFO + def apply_fm_freq(setting, obj): + value = int(setting.value.get_value() * 10) - 650 + LOG.debug("Setting fm_vfo = %s" % (value)) + if self._bw_shift: + value = ((value & 0x00FF) << 8) | ((value & 0xFF00) >> 8) + setattr(obj, setting.get_name(), value) + + # broadcast FM setting + value = _settings.fm_vfo + value_shifted = ((value & 0x00FF) << 8) | ((value & 0xFF00) >> 8) + if value_shifted <= 108.0 * 10 - 650: + # storage method 3 (discovered 2022) + self._bw_shift = True + _fm_vfo = value_shifted / 10.0 + 65 + elif value <= 108.0 * 10 - 650: + # original storage method (2012) + _fm_vfo = value / 10.0 + 65 + else: + # unknown (undiscovered method or no FM chip?) + _fm_vfo = False + if _fm_vfo: + rs = RadioSetting("fm_vfo", "FM Station", + RadioSettingValueFloat(65, 108, _fm_vfo)) + rs.set_apply_callback(apply_fm_freq, _settings) + fm.append(rs) + + # ## Advanced + def apply_limit(setting, obj): + setattr(obj, setting.get_name(), int(setting.value) * 10) + + rs = RadioSetting("vhfl", "VHF Low Limit", + RadioSettingValueInteger(130, 174, int( + _settings.vhfl) / 10)) + rs.set_apply_callback(apply_limit, _settings) + adv.append(rs) + + rs = RadioSetting("vhfh", "VHF High Limit", + RadioSettingValueInteger(130, 174, int( + _settings.vhfh) / 10)) + rs.set_apply_callback(apply_limit, _settings) + adv.append(rs) + + rs = RadioSetting("uhfl", "UHF Low Limit", + RadioSettingValueInteger(400, 520, int( + _settings.uhfl) / 10)) + rs.set_apply_callback(apply_limit, _settings) + adv.append(rs) + + rs = RadioSetting("uhfh", "UHF High Limit", + RadioSettingValueInteger(400, 520, int( + _settings.uhfh) / 10)) + rs.set_apply_callback(apply_limit, _settings) + adv.append(rs) + + rs = RadioSetting("relaym", "Relay Mode", + RadioSettingValueList(RELAY_MODE_LIST, + RELAY_MODE_LIST[_settings.relaym])) + adv.append(rs) + + return group + + def set_settings(self, uisettings): + _settings = self._memobj.settings + + for element in uisettings: + if not isinstance(element, RadioSetting): + self.set_settings(element) + continue + if not element.changed(): + continue + + try: + name = element.get_name() + value = element.value + + if element.has_apply_callback(): + LOG.debug("Using apply callback") + element.run_apply_callback() + else: + obj = getattr(_settings, name) + setattr(_settings, name, value) + + LOG.debug("Setting %s: %s" % (name, value)) + except Exception: + LOG.debug(element.get_name()) + raise + + @classmethod + def match_model(cls, filedata, filename): + match_size = False + match_model = False + + # testing the file data size + if len(filedata) == MEM_SIZE: + match_size = True + + # DEBUG + if debug is True: + LOG.debug("BF-T1 matched!") + + # testing the firmware model fingerprint + match_model = _model_match(cls, filedata) + + return match_size and match_model diff --git a/chirp/drivers/bf_t8.py b/chirp/drivers/bf_t8.py new file mode 100644 index 0000000..88880ff --- /dev/null +++ b/chirp/drivers/bf_t8.py @@ -0,0 +1,971 @@ +# Copyright 2022 Jim Unroe +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +import struct +import logging + +from chirp import ( + bitwise, + chirp_common, + directory, + errors, + memmap, + util, +) +from chirp.settings import ( + RadioSetting, + RadioSettingGroup, + RadioSettings, + RadioSettingValueBoolean, + RadioSettingValueFloat, + RadioSettingValueInteger, + RadioSettingValueList, +) + +LOG = logging.getLogger(__name__) + +MEM_FORMAT = """ +#seekto 0x0000; +struct { + lbcd rxfreq[4]; // RX Frequency + lbcd txfreq[4]; // TX Frequency + u8 rx_tmode; // RX Tone Mode + u8 rx_tone; // PL/DPL Decode + u8 tx_tmode; // TX Tone Mode + u8 tx_tone; // PL/DPL Encode + u8 unknown1:3, // + skip:1, // Scan Add: 1 = Skip, 0 = Scan + unknown2:2, + isnarrow:1, // W/N: 1 = Narrow, 0 = Wide + lowpower:1; // TX Power: 1 = Low, 0 = High + u8 unknown3[3]; // +} memory[%d]; + +#seekto 0x0630; +struct { + u8 squelch; // SQL + u8 vox; // Vox Lv + u8 tot; // TOT + u8 unk1:3, // + ste:1, // Tail Clear + bcl:1, // BCL + save:1, // Save + tdr:1, // TDR + beep:1; // Beep + u8 voice; // Voice + u8 abr; // Back Light + u8 ring; // Ring + u8 mdf; // Display Type + u8 mra; // MR Channel A + u8 mrb; // MR Channel B + u8 disp_ab; // Display A/B Selected +} settings; + +#seekto 0x063D; +struct { + u8 workmode; // Work Mode + u8 wx; // NOAA WX ch# + u8 area; // Area Selected +} settings2; + +#seekto 0x0D00; +struct { + char name[6]; + u8 unknown1[2]; +} names[%d]; +""" + +MEM_FM_U_FORMAT = """ +#seekto 0x063B; +struct { + u16 fmcur; // Broadcast FM station +} fmpreset; +""" + +MEM_FM_UL_FORMAT = """ +#seekto 0x063B; +struct { + ul16 fmcur; // Broadcast FM station +} fmpreset; +""" + +CMD_ACK = b"\x06" + +TONES = chirp_common.TONES +TMODES = ["", "Tone", "DTCS", "DTCS"] + +AB_LIST = ["A", "B"] +ABR_LIST = ["OFF", "ON", "Key"] +AREA_LIST = ["China", "Japan", "Korea", "Malaysia", "American", + "Australia", "Iran", "Taiwan", "Europe", "Russia"] +MDF_LIST = ["Frequency", "Channel #", "Name"] +RING_LIST = ["OFF"] + ["%s" % x for x in range(1, 11)] +TOT_LIST = ["OFF"] + ["%s seconds" % x for x in range(30, 210, 30)] +TOT2_LIST = ["OFF"] + ["%s seconds" % x for x in range(60, 240, 30)] +VOICE_LIST = ["Off", "Chinese", "English"] +VOX_LIST = ["OFF"] + ["%s" % x for x in range(1, 6)] +WORKMODE_LIST = ["General", "PMR"] +WX_LIST = ["CH01 - 162.550", + "CH02 - 162.400", + "CH03 - 162.475", + "CH04 - 162.425", + "CH05 - 162.450", + "CH06 - 162.500", + "CH07 - 162.525", + "CH08 - 161.650", + "CH09 - 161.775", + "CH10 - 161.750", + "CH11 - 162.000" + ] + +FRS_FREQS1 = [462562500, 462587500, 462612500, 462637500, 462662500, + 462687500, 462712500] +FRS_FREQS2 = [467562500, 467587500, 467612500, 467637500, 467662500, + 467687500, 467712500] +FRS_FREQS3 = [462550000, 462575000, 462600000, 462625000, 462650000, + 462675000, 462700000, 462725000] +FRS_FREQS = FRS_FREQS1 + FRS_FREQS2 + FRS_FREQS3 + +GMRS_FREQS = FRS_FREQS + FRS_FREQS3 + +MURS_FREQS = [151820000, 151880000, 151940000, 154570000, 154600000] + +PMR_FREQS1 = [446006250, 446018750, 446031250, 446043750, 446056250, + 446068750, 446081250, 446093750] +PMR_FREQS2 = [446106250, 446118750, 446131250, 446143750, 446156250, + 446168750, 446181250, 446193750] +PMR_FREQS = PMR_FREQS1 + PMR_FREQS2 + +VOICE_CHOICES = ["Off", "On"] +VOICE_VALUES = [0x00, 0x02] + + +def _enter_programming_mode(radio): + serial = radio.pipe + + exito = False + for i in range(0, 5): + serial.write(radio._magic) + ack = serial.read(1) + + try: + if ack == CMD_ACK: + exito = True + break + except: + LOG.debug("Attempt #%s, failed, trying again" % i) + pass + + # check if we had EXITO + if exito is False: + _exit_programming_mode(radio) + msg = "The radio did not accept program mode after five tries.\n" + msg += "Check you interface cable and power cycle your radio." + raise errors.RadioError(msg) + + try: + serial.write(b"\x02") + ident = serial.read(len(radio._fingerprint)) + except: + _exit_programming_mode(radio) + raise errors.RadioError("Error communicating with radio") + + if not ident == radio._fingerprint: + _exit_programming_mode(radio) + LOG.debug(util.hexprint(ident)) + raise errors.RadioError("Radio returned unknown identification string") + + try: + serial.write(CMD_ACK) + ack = serial.read(1) + except: + _exit_programming_mode(radio) + raise errors.RadioError("Error communicating with radio") + + if ack != CMD_ACK: + _exit_programming_mode(radio) + raise errors.RadioError("Radio refused to enter programming mode") + + +def _exit_programming_mode(radio): + serial = radio.pipe + try: + serial.write(b"E") + except: + raise errors.RadioError("Radio refused to exit programming mode") + + +def _read_block(radio, block_addr, block_size): + serial = radio.pipe + + cmd = struct.pack(">cHb", b'R', block_addr, block_size) + expectedresponse = b"W" + cmd[1:] + LOG.debug("Reading block %04x..." % (block_addr)) + + try: + serial.write(cmd) + response = serial.read(4 + block_size) + if response[:4] != expectedresponse: + raise Exception("Error reading block %04x." % (block_addr)) + + block_data = response[4:] + + serial.write(CMD_ACK) + ack = serial.read(1) + except: + _exit_programming_mode(radio) + raise errors.RadioError("Failed to read block at %04x" % block_addr) + + if ack != CMD_ACK: + _exit_programming_mode(radio) + raise Exception("No ACK reading block %04x." % (block_addr)) + + return block_data + + +def _write_block(radio, block_addr, block_size): + serial = radio.pipe + + cmd = struct.pack(">cHb", b'W', block_addr, block_size) + data = radio.get_mmap()[block_addr:block_addr + block_size] + + LOG.debug("Writing Data:") + LOG.debug(util.hexprint(cmd + data)) + + try: + serial.write(cmd + data) + if serial.read(1) != CMD_ACK: + raise Exception("No ACK") + except: + _exit_programming_mode(radio) + raise errors.RadioError("Failed to send block " + "to radio at %04x" % block_addr) + + +def do_download(radio): + LOG.debug("download") + _enter_programming_mode(radio) + + data = b"" + + status = chirp_common.Status() + status.msg = "Cloning from radio" + + status.cur = 0 + status.max = radio._memsize + + for addr in range(0, radio._memsize, radio.BLOCK_SIZE): + status.cur = addr + radio.BLOCK_SIZE + radio.status_fn(status) + + block = _read_block(radio, addr, radio.BLOCK_SIZE) + data += block + + LOG.debug("Address: %04x" % addr) + LOG.debug(util.hexprint(block)) + + _exit_programming_mode(radio) + + return memmap.MemoryMapBytes(data) + + +def do_upload(radio): + status = chirp_common.Status() + status.msg = "Uploading to radio" + + _enter_programming_mode(radio) + + status.cur = 0 + status.max = radio._memsize + + for start_addr, end_addr in radio._ranges: + for addr in range(start_addr, end_addr, radio.BLOCK_SIZE_UP): + status.cur = addr + radio.BLOCK_SIZE_UP + radio.status_fn(status) + _write_block(radio, addr, radio.BLOCK_SIZE_UP) + + _exit_programming_mode(radio) + + +class BFT8Radio(chirp_common.CloneModeRadio): + """Baofeng BF-T8""" + VENDOR = "Baofeng" + MODEL = "BF-T8" + BAUD_RATE = 9600 + NEEDS_COMPAT_SERIAL = False + BLOCK_SIZE = BLOCK_SIZE_UP = 0x10 + ODD_SPLIT = True + HAS_NAMES = False + NAME_LENGTH = 0 + VALID_CHARS = "" + CH_OFFSET = False + SKIP_VALUES = [] + DTCS_CODES = sorted(chirp_common.DTCS_CODES) + DUPLEXES = ["", "-", "+", "split", "off"] + + POWER_LEVELS = [chirp_common.PowerLevel("High", watts=2.00), + chirp_common.PowerLevel("Low", watts=0.50)] + VALID_BANDS = [(400000000, 470000000)] + + _magic = b"\x02" + b"PROGRAM" + _fingerprint = b"\x2E" + b"BF-T6" + b"\x2E" + _upper = 99 + _mem_params = (_upper, # number of channels + _upper # number of names + ) + _frs = _gmrs = _murs = _pmr = False + + _ranges = [ + (0x0000, 0x0B60), + ] + _memsize = 0x0B60 + + def get_features(self): + rf = chirp_common.RadioFeatures() + rf.has_settings = True + rf.has_bank = False + rf.has_ctone = True + rf.has_cross = True + rf.has_rx_dtcs = True + rf.has_tuning_step = False + rf.has_name = self.HAS_NAMES + rf.can_odd_split = self.ODD_SPLIT + rf.valid_name_length = self.NAME_LENGTH + rf.valid_characters = self.VALID_CHARS + rf.valid_skips = self.SKIP_VALUES + rf.valid_tmodes = ["", "Tone", "TSQL", "DTCS", "Cross"] + rf.valid_cross_modes = ["Tone->Tone", "Tone->DTCS", "DTCS->Tone", + "->Tone", "->DTCS", "DTCS->", "DTCS->DTCS"] + rf.valid_dtcs_codes = self.DTCS_CODES + rf.valid_power_levels = self.POWER_LEVELS + rf.valid_duplexes = self.DUPLEXES + rf.valid_modes = ["FM", "NFM"] # 25 kHz, 12.5 kHz. + rf.memory_bounds = (1, self._upper) + rf.valid_tuning_steps = [2.5, 5., 6.25, 10., 12.5, 25.] + rf.valid_bands = self.VALID_BANDS + + return rf + + def process_mmap(self): + mem_format = MEM_FORMAT + MEM_FM_UL_FORMAT + self._memobj = bitwise.parse(mem_format % self._mem_params, self._mmap) + + def sync_in(self): + """Download from radio""" + try: + data = do_download(self) + except errors.RadioError: + # Pass through any real errors we raise + raise + except: + # If anything unexpected happens, make sure we raise + # a RadioError and log the problem + LOG.exception('Unexpected error during download') + raise errors.RadioError('Unexpected error communicating ' + 'with the radio') + self._mmap = data + self.process_mmap() + + def sync_out(self): + """Upload to radio""" + try: + do_upload(self) + except: + # If anything unexpected happens, make sure we raise + # a RadioError and log the problem + LOG.exception('Unexpected error during upload') + raise errors.RadioError('Unexpected error communicating ' + 'with the radio') + + def get_raw_memory(self, number): + return repr(self._memobj.memory[number - 1]) + + def _get_tone(self, mem, _mem): + rx_tone = tx_tone = None + + tx_tmode = TMODES[_mem.tx_tmode] + rx_tmode = TMODES[_mem.rx_tmode] + + if tx_tmode == "Tone": + tx_tone = TONES[_mem.tx_tone] + elif tx_tmode == "DTCS": + tx_tone = self.DTCS_CODES[_mem.tx_tone] + + if rx_tmode == "Tone": + rx_tone = TONES[_mem.rx_tone] + elif rx_tmode == "DTCS": + rx_tone = self.DTCS_CODES[_mem.rx_tone] + + tx_pol = _mem.tx_tmode == 0x03 and "R" or "N" + rx_pol = _mem.rx_tmode == 0x03 and "R" or "N" + + chirp_common.split_tone_decode(mem, (tx_tmode, tx_tone, tx_pol), + (rx_tmode, rx_tone, rx_pol)) + + def _is_txinh(self, _mem): + raw_tx = "" + for i in range(0, 4): + raw_tx += _mem.txfreq[i].get_raw() + return raw_tx == "\xFF\xFF\xFF\xFF" + + def _get_mem(self, number): + return self._memobj.memory[number - 1] + + def _get_nam(self, number): + return self._memobj.names[number - 1] + + def get_memory(self, number): + _mem = self._get_mem(number) + if self.HAS_NAMES: + _nam = self._get_nam(number) + + mem = chirp_common.Memory() + + mem.number = number + mem.freq = int(_mem.rxfreq) * 10 + + # We'll consider any blank (i.e. 0 MHz frequency) to be empty + if mem.freq == 0: + mem.empty = True + return mem + + if _mem.rxfreq.get_raw() == "\xFF\xFF\xFF\xFF": + mem.freq = 0 + mem.empty = True + return mem + + if _mem.get_raw() == ("\xFF" * 16): + LOG.debug("Initializing empty memory") + _mem.set_raw("\x00" * 13 + "\xFF" * 3) + + if self._is_txinh(_mem): + mem.duplex = "off" + mem.offset = 0 + elif int(_mem.rxfreq) == int(_mem.txfreq): + mem.duplex = "" + mem.offset = 0 + else: + mem.duplex = int(_mem.rxfreq) > int(_mem.txfreq) and "-" or "+" + mem.offset = abs(int(_mem.rxfreq) - int(_mem.txfreq)) * 10 + + # wide/narrow + mem.mode = _mem.isnarrow and "NFM" or "FM" + + mem.skip = _mem.skip and "S" or "" + + if self.HAS_NAMES: + for char in _nam.name: + if str(char) == "\xFF": + char = " " # The OEM software may have 0xFF mid-name + mem.name += str(char) + mem.name = mem.name.rstrip() + + # tone data + self._get_tone(mem, _mem) + + # tx power + levels = self.POWER_LEVELS + try: + mem.power = levels[_mem.lowpower] + except IndexError: + LOG.error("Radio reported invalid power level %s (in %s)" % + (_mem.lowpower, levels)) + mem.power = levels[0] + + immutable = [] + + if self._frs: + if mem.freq in FRS_FREQS: + if mem.number >= 1 and mem.number <= 22: + FRS_FREQ = FRS_FREQS[mem.number - 1] + mem.freq = FRS_FREQ + mem.duplex == '' + mem.offset = 0 + mem.mode = "NFM" + if mem.number >= 8 and mem.number <= 14: + mem.power = self.POWER_LEVELS[1] + immutable = ["empty", "freq", "duplex", "offset", "mode", + "power"] + else: + immutable = ["empty", "freq", "duplex", "offset", "mode"] + elif self._murs: + if mem.freq in MURS_FREQS: + if mem.number >= 1 and mem.number <= 5: + MURS_FREQ = MURS_FREQS[mem.number - 1] + mem.freq = MURS_FREQ + mem.duplex = '' + mem.offset = 0 + if mem.number <= 3: + mem.mode = "NFM" + immutable = ["empty", "freq", "duplex", "offset", "mode"] + else: + immutable = ["empty", "freq", "duplex", "offset"] + elif self._pmr: + if mem.freq in PMR_FREQS: + if mem.number >= 1 and mem.number <= 16: + PMR_FREQ = PMR_FREQS[mem.number - 1] + mem.freq = PMR_FREQ + mem.duplex = '' + mem.offset = 0 + mem.mode = "NFM" + mem.power = self.POWER_LEVELS[1] + immutable = ["empty", "freq", "duplex", "offset", "mode", + "power"] + elif self._gmrs: + if mem.freq in GMRS_FREQS: + if mem.number >= 1 and mem.number <= 30: + GMRS_FREQ = GMRS_FREQS[mem.number - 1] + mem.freq = GMRS_FREQ + immutable = ["empty", "freq"] + if mem.number >= 1 and mem.number <= 7: + mem.duplex = '' + mem.offset = 0 + immutable += ["duplex", "offset"] + elif mem.number >= 8 and mem.number <= 14: + mem.duplex = '' + mem.offset = 0 + mem.mode = "NFM" + mem.power = self.POWER_LEVELS[1] + immutable += ["duplex", "offset", "mode", "power"] + elif mem.number >= 15 and mem.number <= 22: + mem.duplex = '' + mem.offset = 0 + immutable += ["duplex", "offset"] + elif mem.number >= 23 and mem.number <= 30: + mem.duplex = '+' + mem.offset = 5000000 + immutable += ["duplex", "offset"] + elif mem.freq in FRS_FREQS1: + mem.duplex = '' + mem.offset = 0 + immutable += ["duplex", "offset"] + elif mem.freq in FRS_FREQS2: + mem.duplex = '' + mem.offset = 0 + mem.mode = "NFM" + mem.power = self.POWER_LEVELS[1] + immutable += ["duplex", "offset", "mode", "power"] + elif mem.freq in FRS_FREQS3: + if mem.duplex == '': + mem.offset = 0 + if mem.duplex == '+': + mem.offset = 5000000 + else: + if mem.freq not in GMRS_FREQS: + mem.duplex = 'off' + mem.offset = 0 + immutable = ["duplex", "offset"] + + mem.immutable = immutable + + return mem + + def _set_tone(self, mem, _mem): + ((txmode, txtone, txpol), + (rxmode, rxtone, rxpol)) = chirp_common.split_tone_encode(mem) + + _mem.tx_tmode = TMODES.index(txmode) + _mem.rx_tmode = TMODES.index(rxmode) + if txmode == "Tone": + _mem.tx_tone = TONES.index(txtone) + elif txmode == "DTCS": + _mem.tx_tmode = txpol == "R" and 0x03 or 0x02 + _mem.tx_tone = self.DTCS_CODES.index(txtone) + if rxmode == "Tone": + _mem.rx_tone = TONES.index(rxtone) + elif rxmode == "DTCS": + _mem.rx_tmode = rxpol == "R" and 0x03 or 0x02 + _mem.rx_tone = self.DTCS_CODES.index(rxtone) + + def _set_mem(self, number): + return self._memobj.memory[number - 1] + + def _set_nam(self, number): + return self._memobj.names[number - 1] + + def set_memory(self, mem): + _mem = self._set_mem(mem.number) + if self.HAS_NAMES: + _nam = self._set_nam(mem.number) + + # if empty memory + if mem.empty: + _mem.set_raw("\xFF" * (_mem.size() // 8)) + + if self.HAS_NAMES: + for i in range(0, self.NAME_LENGTH): + _nam.name[i].set_raw("\xFF") + + return mem + + _mem.set_raw("\x00" * 13 + "\xFF" * 3) + + # frequency + _mem.rxfreq = mem.freq / 10 + + if mem.duplex == "off": + for i in range(0, 4): + _mem.txfreq[i].set_raw("\xFF") + elif mem.duplex == "split": + _mem.txfreq = mem.offset / 10 + elif mem.duplex == "+": + _mem.txfreq = (mem.freq + mem.offset) / 10 + elif mem.duplex == "-": + _mem.txfreq = (mem.freq - mem.offset) / 10 + else: + _mem.txfreq = mem.freq / 10 + + # wide/narrow + _mem.isnarrow = mem.mode == "NFM" + + _mem.skip = mem.skip == "S" + + if self.HAS_NAMES: + for i in range(self.NAME_LENGTH): + try: + _nam.name[i] = mem.name[i] + except IndexError: + _nam.name[i] = "\xFF" + + # tone data + self._set_tone(mem, _mem) + + # tx power + if str(mem.power) == "High": + _mem.lowpower = 0 + elif str(mem.power) == "Low": + _mem.lowpower = 1 + else: + _mem.lowpower = 0 + + return mem + + def get_settings(self): + _fmpreset = self._memobj.fmpreset + _settings = self._memobj.settings + _settings2 = self._memobj.settings2 + basic = RadioSettingGroup("basic", "Basic Settings") + top = RadioSettings(basic) + + # Menu 03 + rs = RadioSettingValueInteger(0, 9, _settings.squelch) + rset = RadioSetting("squelch", "Squelch Level", rs) + basic.append(rset) + + model_list = ["RB27B", "RB27V", "RB627B"] + if self.MODEL in model_list: + # Menu 09 (RB27x/RB627x) + rs = RadioSettingValueList(TOT2_LIST, TOT2_LIST[_settings.tot]) + else: + # Menu 11 / 09 (RB27) + rs = RadioSettingValueList(TOT_LIST, TOT_LIST[_settings.tot]) + rset = RadioSetting("tot", "Time-out timer", rs) + basic.append(rset) + + # Menu 06 + rs = RadioSettingValueList(VOX_LIST, VOX_LIST[_settings.vox]) + rset = RadioSetting("vox", "VOX Level", rs) + basic.append(rset) + + # Menu 15 (BF-T8) / Menu 14 (FRS-A1) + if self.MODEL == "FRS-A1": + # Menu 14 (FRS-A1) + def apply_voice_listvalue(setting, obj): + LOG.debug("Setting value: " + str(setting.value) + + " from list") + val = str(setting.value) + index = VOICE_CHOICES.index(val) + val = VOICE_VALUES[index] + obj.set_value(val) + + if _settings.voice in VOICE_VALUES: + idx = VOICE_VALUES.index(_settings.voice) + else: + idx = VOICE_VALUES.index(0x00) + rs = RadioSettingValueList(VOICE_CHOICES, VOICE_CHOICES[idx]) + rset = RadioSetting("voice", "Voice", rs) + rset.set_apply_callback(apply_voice_listvalue, _settings.voice) + basic.append(rset) + else: + # Menu 15 (BF-T8) + rs = RadioSettingValueList(VOICE_LIST, VOICE_LIST[_settings.voice]) + rset = RadioSetting("voice", "Voice", rs) + basic.append(rset) + + # Menu 12 + rs = RadioSettingValueBoolean(_settings.bcl) + rset = RadioSetting("bcl", "Busy Channel Lockout", rs) + basic.append(rset) + + # Menu 10 / 08 (RB27/RB627) + rs = RadioSettingValueBoolean(_settings.save) + rset = RadioSetting("save", "Battery Saver", rs) + basic.append(rset) + + # Menu 08 / 07 (RB-27/RB627) + rs = RadioSettingValueBoolean(_settings.tdr) + rset = RadioSetting("tdr", "Dual Watch", rs) + basic.append(rset) + + # Menu 05 + rs = RadioSettingValueBoolean(_settings.beep) + rset = RadioSetting("beep", "Beep", rs) + basic.append(rset) + + # Menu 04 + rs = RadioSettingValueList(ABR_LIST, ABR_LIST[_settings.abr]) + rset = RadioSetting("abr", "Back Light", rs) + basic.append(rset) + + # Menu 13 / 11 (RB-27/RB627) + rs = RadioSettingValueList(RING_LIST, RING_LIST[_settings.ring]) + rset = RadioSetting("ring", "Ring", rs) + basic.append(rset) + + rs = RadioSettingValueBoolean(not _settings.ste) + rset = RadioSetting("ste", "Squelch Tail Eliminate", rs) + basic.append(rset) + + # Menu 15 (FRS-A1) + if self.MODEL == "FRS-A1": + rs = RadioSettingValueList(MDF_LIST, MDF_LIST[_settings.mdf]) + rset = RadioSetting("mdf", "Display Type", rs) + basic.append(rset) + + if self.CH_OFFSET: + rs = RadioSettingValueInteger(1, self._upper, _settings.mra + 1) + else: + rs = RadioSettingValueInteger(1, self._upper, _settings.mra) + rset = RadioSetting("mra", "MR A Channel #", rs) + basic.append(rset) + + if self.CH_OFFSET: + rs = RadioSettingValueInteger(1, self._upper, _settings.mrb + 1) + else: + rs = RadioSettingValueInteger(1, self._upper, _settings.mrb) + rset = RadioSetting("mrb", "MR B Channel #", rs) + basic.append(rset) + + rs = RadioSettingValueList(AB_LIST, AB_LIST[_settings.disp_ab]) + rset = RadioSetting("disp_ab", "Selected Display Line", rs) + basic.append(rset) + + if not self.MODEL.startswith("RB627"): + if self.MODEL == "FRS-A1": + del WX_LIST[7:] + rs = RadioSettingValueList(WX_LIST, WX_LIST[_settings2.wx]) + rset = RadioSetting("settings2.wx", "NOAA WX Radio", rs) + basic.append(rset) + + def myset_freq(setting, obj, atrb, mult): + """ Callback to set frequency by applying multiplier""" + value = int(float(str(setting.value)) * mult) + setattr(obj, atrb, value) + return + + # FM Broadcast Settings + val = _fmpreset.fmcur + val = val / 10.0 + val_low = 76.0 + if self.MODEL == "FRS-A1": + val_low = 87.0 + if val < val_low or val > 108.0: + val = 90.4 + rx = RadioSettingValueFloat(val_low, 108.0, val, 0.1, 1) + rset = RadioSetting("fmpreset.fmcur", "Broadcast FM Radio (MHz)", rx) + rset.set_apply_callback(myset_freq, _fmpreset, "fmcur", 10) + basic.append(rset) + + model_list = ["BF-T8", "BF-U9", "AR-8"] + if self.MODEL in model_list: + rs = RadioSettingValueList(WORKMODE_LIST, + WORKMODE_LIST[_settings2.workmode]) + rset = RadioSetting("settings2.workmode", "Work Mode", rs) + basic.append(rset) + + rs = RadioSettingValueList(AREA_LIST, AREA_LIST[_settings2.area]) + rs.set_mutable(False) + rset = RadioSetting("settings2.area", "Area", rs) + basic.append(rset) + + return top + + def set_settings(self, settings): + for element in settings: + if not isinstance(element, RadioSetting): + self.set_settings(element) + continue + else: + try: + if "." in element.get_name(): + bits = element.get_name().split(".") + obj = self._memobj + for bit in bits[:-1]: + obj = getattr(obj, bit) + setting = bits[-1] + else: + obj = self._memobj.settings + setting = element.get_name() + + if element.has_apply_callback(): + LOG.debug("Using apply callback") + element.run_apply_callback() + elif setting == "mra" and self.CH_OFFSET: + setattr(obj, setting, int(element.value) - 1) + elif setting == "mrb" and self.CH_OFFSET: + setattr(obj, setting, int(element.value) - 1) + elif setting == "ste": + setattr(obj, setting, not int(element.value)) + elif element.value.get_mutable(): + LOG.debug("Setting %s = %s" % (setting, element.value)) + setattr(obj, setting, element.value) + except Exception: + LOG.debug(element.get_name()) + raise + + @classmethod + def match_model(cls, filedata, filename): + # This radio has always been post-metadata, so never do + # old-school detection + return False + + +class BFU9Alias(chirp_common.Alias): + VENDOR = "Baofeng" + MODEL = "BF-U9" + + +class AR8Alias(chirp_common.Alias): + VENDOR = "Arcshell" + MODEL = "AR-8" + + +@directory.register +class BaofengBFT8Generic(BFT8Radio): + ALIASES = [BFU9Alias, AR8Alias, ] + + +@directory.register +class RetevisRT16(BFT8Radio): + VENDOR = "Retevis" + MODEL = "RT16" + + _upper = 22 + _frs = True + + +@directory.register +class RetevisRB27B(BFT8Radio): + VENDOR = "Retevis" + MODEL = "RB27B" + DTCS_CODES = tuple(sorted(chirp_common.DTCS_CODES + (645,))) + HAS_NAMES = True + NAME_LENGTH = 6 + VALID_CHARS = chirp_common.CHARSET_UPPER_NUMERIC + "-" + CH_OFFSET = True + SKIP_VALUES = ["", "S"] + POWER_LEVELS = [chirp_common.PowerLevel("High", watts=2.00), + chirp_common.PowerLevel("Low", watts=0.50)] + VALID_BANDS = [(400000000, 520000000)] + + _upper = 22 + _frs = True + _gmrs = _murs = _pmr = False + + _ranges = [ + (0x0000, 0x0640), + (0x0D00, 0x1040), + ] + _memsize = 0x1040 + + def process_mmap(self): + mem_format = MEM_FORMAT + MEM_FM_U_FORMAT + self._memobj = bitwise.parse(mem_format % self._mem_params, self._mmap) + + +@directory.register +class RetevisRB27(RetevisRB27B): + VENDOR = "Retevis" + MODEL = "RB27" + DUPLEXES = ['', '-', '+', 'off'] + POWER_LEVELS = [chirp_common.PowerLevel("High", watts=5.00), + chirp_common.PowerLevel("Low", watts=0.50)] + VALID_BANDS = [(136000000, 174000000), + (400000000, 520000000)] + ODD_SPLIT = False + + _upper = 99 + _gmrs = False # sold as GMRS radio but supports full band TX/RX + _frs = _murs = _pmr = False + + def process_mmap(self): + mem_format = MEM_FORMAT + MEM_FM_U_FORMAT + self._memobj = bitwise.parse(mem_format % self._mem_params, self._mmap) + + +@directory.register +class RetevisRB27V(RetevisRB27B): + VENDOR = "Retevis" + MODEL = "RB27V" + VALID_BANDS = [(136000000, 174000000)] + + _upper = 5 + _murs = True + _frs = _gmrs = _pmr = False + + def process_mmap(self): + mem_format = MEM_FORMAT + MEM_FM_U_FORMAT + self._memobj = bitwise.parse(mem_format % self._mem_params, self._mmap) + + +@directory.register +class RetevisRB627B(RetevisRB27B): + VENDOR = "Retevis" + MODEL = "RB627B" + POWER_LEVELS = [chirp_common.PowerLevel("High", watts=0.50), + chirp_common.PowerLevel("Low", watts=0.50)] + + _upper = 16 + _pmr = True + _frs = _gmrs = _murs = False + + +@directory.register +class FRSA1Radio(BFT8Radio): + """BTECH FRS-A1""" + VENDOR = "BTECH" + MODEL = "FRS-A1" + ODD_SPLIT = False + HAS_NAMES = True + NAME_LENGTH = 6 + SKIP_VALUES = ["", "S"] + DTCS_CODES = tuple(sorted(chirp_common.DTCS_CODES + (645,))) + DUPLEXES = ['', '-', '+', 'off'] + + _fingerprint = b"BF-T8A" + b"\x2E" + _upper = 22 + _frs = _upper == 22 + + _ranges = [ + (0x0000, 0x0640), + (0x0D00, 0x0DC0), + ] + _memsize = 0x0DC0 + + def get_features(self): + rf = BFT8Radio.get_features(self) + rf.valid_name_length = 6 + rf.valid_characters = chirp_common.CHARSET_UPPER_NUMERIC + "-" + return rf diff --git a/chirp/drivers/bj9900.py b/chirp/drivers/bj9900.py index ca9197a..4c278e4 100644 --- a/chirp/drivers/bj9900.py +++ b/chirp/drivers/bj9900.py @@ -17,22 +17,18 @@ """Baojie BJ-9900 management module""" from chirp import chirp_common, util, memmap, errors, directory, bitwise -from chirp.settings import RadioSetting, RadioSettingGroup, \ - RadioSettingValueInteger, RadioSettingValueList, \ - RadioSettingValueBoolean, RadioSettingValueString, \ - RadioSettings import struct import time import logging -from textwrap import dedent LOG = logging.getLogger(__name__) CMD_ACK = 0x06 + @directory.register class BJ9900Radio(chirp_common.CloneModeRadio, - chirp_common.ExperimentalRadio): + chirp_common.ExperimentalRadio): """Baojie BJ-9900""" VENDOR = "Baojie" MODEL = "BJ-9900" @@ -43,10 +39,10 @@ class BJ9900Radio(chirp_common.CloneModeRadio, MODES = ["NFM", "FM"] TMODES = ["", "Tone", "TSQL", "DTCS", "Cross"] CROSS_MODES = ["Tone->Tone", "Tone->DTCS", "DTCS->Tone", - "->Tone", "->DTCS", "DTCS->", "DTCS->DTCS"] + "->Tone", "->DTCS", "DTCS->", "DTCS->DTCS"] STEPS = [5.0, 6.25, 10.0, 12.5, 25.0] VALID_BANDS = [(109000000, 136000000), (136000000, 174000000), - (400000000, 470000000)] + (400000000, 470000000)] CHARSET = list(chirp_common.CHARSET_ALPHANUMERIC) CHARSET.remove(" ") @@ -102,12 +98,12 @@ class BJ9900Radio(chirp_common.CloneModeRadio, @classmethod def get_prompts(cls): rp = chirp_common.RadioPrompts() - rp.pre_upload = rp.pre_download = _(dedent("""\ - 1. Turn radio off. - 2. Remove front head. - 3. Connect data cable to radio, use the same connector where - head was connected to, not the mic connector. - 4. Click OK.""")) + rp.pre_upload = rp.pre_download = _( + "1. Turn radio off.\n" + "2. Remove front head.\n" + "3. Connect data cable to radio, use the same connector where\n" + " head was connected to, not the mic connector.\n" + "4. Click OK.\n") rp.experimental = _( 'This is experimental support for BJ-9900 ' 'which is still under development.\n' @@ -178,7 +174,7 @@ class BJ9900Radio(chirp_common.CloneModeRadio, self._mmap = self._clone_in() except errors.RadioError: raise - except Exception, e: + except Exception as e: raise errors.RadioError("Failed to communicate with radio: %s" % e) self.process_mmap() @@ -187,7 +183,7 @@ class BJ9900Radio(chirp_common.CloneModeRadio, self._clone_out() except errors.RadioError: raise - except Exception, e: + except Exception as e: raise errors.RadioError("Failed to communicate with radio: %s" % e) def process_mmap(self): @@ -240,7 +236,7 @@ class BJ9900Radio(chirp_common.CloneModeRadio, _mem = self._memobj.memory[mem.number - 1] if mem.empty: - _mem.set_raw("\xff" * (_mem.size() / 8)) # clean up + _mem.set_raw("\xff" * (_mem.size() // 8)) # clean up _mem.namelen = 0 return @@ -256,7 +252,7 @@ class BJ9900Radio(chirp_common.CloneModeRadio, _mem.namelen = len(mem.name) for i in range(_mem.namelen): - _mem.name[i] = ord(mem.name[i]) + _mem.name[i] = ord(mem.name[i]) rxmode = "" txmode = "" @@ -342,7 +338,7 @@ class BJ9900Radio(chirp_common.CloneModeRadio, mem.duplex = int(_mem.rxfreq) > int(_mem.txfreq) and "-" or "+" mem.offset = abs(int(_mem.rxfreq) - int(_mem.txfreq)) * 10 - for char in _mem.name[:_mem.namelen]: + for char in _mem.name[0:_mem.namelen]: mem.name += chr(char) dtcs_pol = ["N", "N"] @@ -395,6 +391,7 @@ class BJ9900Radio(chirp_common.CloneModeRadio, return len(filedata) == cls._memsize or \ (len(filedata) == cls._datsize and filedata[-4:] == "\r\n\r\n") + class BJ9900RadioLeft(BJ9900Radio): """Baojie BJ-9900 Left VFO subdevice""" VARIANT = "Left" diff --git a/chirp/drivers/bjuv55.py b/chirp/drivers/bjuv55.py index fc29170..5be6cd6 100644 --- a/chirp/drivers/bjuv55.py +++ b/chirp/drivers/bjuv55.py @@ -15,19 +15,15 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import struct -import time -import os import logging from chirp.drivers import uv5r -from chirp import chirp_common, errors, util, directory, memmap +from chirp import chirp_common, directory from chirp import bitwise from chirp.settings import RadioSetting, RadioSettingGroup, \ RadioSettingValueInteger, RadioSettingValueList, \ RadioSettingValueBoolean, RadioSettingValueString, \ RadioSettingValueFloat, InvalidValueError, RadioSettings -from textwrap import dedent LOG = logging.getLogger(__name__) @@ -647,6 +643,6 @@ class BaojieBJUV55Radio(uv5r.BaofengUV5R): value = int(val.get_value() * 10 - 870) LOG.debug("Setting fm_preset = %s" % (value)) self._memobj.fm_preset = value - except Exception as e: + except Exception: LOG.debug(element.get_name()) raise diff --git a/chirp/drivers/boblov_x3plus.py b/chirp/drivers/boblov_x3plus.py index 76283ee..ff8cb01 100644 --- a/chirp/drivers/boblov_x3plus.py +++ b/chirp/drivers/boblov_x3plus.py @@ -21,7 +21,6 @@ import struct import time from datetime import datetime -from textwrap import dedent from chirp import ( bitwise, @@ -115,14 +114,12 @@ class BoblovX3Plus(chirp_common.CloneModeRadio, @classmethod def get_prompts(cls): rp = chirp_common.RadioPrompts() - rp.experimental = _(dedent("""\ - The X3Plus driver is currently experimental. - - There are no known issues but you should proceed with caution. - - Please save an unedited copy of your first successful - download to a CHIRP Radio Images (*.img) file. - """)) + rp.experimental = _( + "The X3Plus driver is currently experimental.\n" + "There are no known issues but you should proceed with" + " caution.\n" + "Please save an unedited copy of your first successful\n" + "download to a CHIRP Radio Images (*.img) file.\n") return rp @classmethod @@ -131,24 +128,16 @@ class BoblovX3Plus(chirp_common.CloneModeRadio, this radio driver handles the represented model""" if len(filedata) != cls._memsize: - LOG.debug('Boblov_x3plus: match_model: size mismatch') return False - LOG.debug('Boblov_x3plus: match_model: size matches') - - if b'P310' in filedata[0x03D0:0x03D8]: - LOG.debug('Boblov_x3plus: match_model: radio ID matches') - return True - - LOG.debug('Boblov_x3plus: match_model: no radio ID match') - return False + return b'P310' in filedata[0x03D0:0x03D8] def get_features(self): """Return a RadioFeatures object for this radio""" rf = chirp_common.RadioFeatures() rf.has_settings = True - rf.valid_modes = ['NFM', 'FM'] # 12.5 KHz, 25 kHz. + rf.valid_modes = ['NFM', 'FM'] # 12.5 kHz, 25 kHz. rf.valid_power_levels = self.X3P_POWER_LEVELS rf.valid_skips = ['', 'S'] rf.valid_tmodes = ['', 'Tone', 'TSQL', 'DTCS', 'Cross'] @@ -270,7 +259,7 @@ class BoblovX3Plus(chirp_common.CloneModeRadio, mem.number = number mem.freq = int(rmem.rxfreq) * 10 - # A blank (0MHz) or 0xFFFFFFFF frequency is considered empty + # A blank (0 MHz) or 0xFFFFFFFF frequency is considered empty if mem.freq == 0 or rmem.rxfreq.get_raw() == '\xFF\xFF\xFF\xFF': LOG.debug('empty channel %d', number) mem.freq = 0 diff --git a/chirp/drivers/btech.py b/chirp/drivers/btech.py index 7b5c9d6..90c13c4 100644 --- a/chirp/drivers/btech.py +++ b/chirp/drivers/btech.py @@ -1,4 +1,4 @@ -# Copyright 2016-2022: +# Copyright 2016-2023: # * Pavel Milanes CO7WT, # * Jim Unroe KC9HI, # @@ -18,7 +18,6 @@ from builtins import bytes import struct -import time import logging from time import sleep @@ -28,7 +27,6 @@ from chirp.settings import RadioSettingGroup, RadioSetting, \ RadioSettingValueBoolean, RadioSettingValueList, \ RadioSettingValueString, RadioSettingValueInteger, \ RadioSettingValueFloat, RadioSettings, InvalidValueError -from textwrap import dedent LOG = logging.getLogger(__name__) @@ -43,11 +41,11 @@ LOG = logging.getLogger(__name__) MEM_SIZE = 0x4000 BLOCK_SIZE = 0x40 TX_BLOCK_SIZE = 0x10 -ACK_CMD = b"\x06" +ACK_CMD = 0x06 MODES = ["FM", "NFM"] SKIP_VALUES = ["S", ""] TONES = chirp_common.TONES -DTCS = sorted(chirp_common.DTCS_CODES + [645]) +DTCS = tuple(sorted(chirp_common.DTCS_CODES + (645,))) # lists related to "extra" settings PTTID_LIST = ["OFF", "BOT", "EOT", "BOTH"] @@ -66,6 +64,7 @@ LIST_COLOR8 = ["White", "Red", "Blue", "Green", "Yellow", "Indigo", "Purple", "Gray"] LIST_COLOR9 = ["Black"] + LIST_COLOR8 LIST_DTMFST = ["OFF", "Keyboard", "ANI", "Keyboard + ANI"] +LIST_EARPH = ["Off", "Earphone", "Earphone + Speaker"] LIST_EMCTP = ["TX alarm sound", "TX ANI", "Both"] LIST_EMCTPX = ["Off"] + LIST_EMCTP LIST_LANGUA = ["English", "Chinese"] @@ -76,7 +75,7 @@ LIST_OFF1TO50 = ["Off"] + ["%s seconds" % x for x in range(1, 51)] LIST_OFF1TO60 = ["Off"] + ["%s seconds" % x for x in range(1, 61)] LIST_PONMSG = ["Full", "Message", "Battery voltage"] LIST_REPM = ["Off", "Carrier", "CTCSS or DCS", "Tone", "DTMF"] -LIST_REPS = ["1000 Hz", "1450 Hz", "1750 Hz", "2100Hz"] +LIST_REPS = ["1000 Hz", "1450 Hz", "1750 Hz", "2100 Hz"] LIST_REPSW = ["Off", "RX", "TX"] LIST_RPTDL = ["Off"] + ["%s ms" % x for x in range(1, 11)] LIST_SCMODE = ["Off", "PTT-SC", "MEM-SC", "PON-SC"] @@ -151,12 +150,12 @@ debug = False VALID_CHARS = chirp_common.CHARSET_ALPHANUMERIC + \ "`{|}!\"#$%&'()*+,-./:;<=>?@[]^_" -GMRS_FREQS1 = [462.5625, 462.5875, 462.6125, 462.6375, 462.6625, - 462.6875, 462.7125] -GMRS_FREQS2 = [467.5625, 467.5875, 467.6125, 467.6375, 467.6625, - 467.6875, 467.7125] -GMRS_FREQS3 = [462.5500, 462.5750, 462.6000, 462.6250, 462.6500, - 462.6750, 462.7000, 462.7250] +GMRS_FREQS1 = [462562500, 462587500, 462612500, 462637500, 462662500, + 462687500, 462712500] +GMRS_FREQS2 = [467562500, 467587500, 467612500, 467637500, 467662500, + 467687500, 467712500] +GMRS_FREQS3 = [462550000, 462575000, 462600000, 462625000, 462650000, + 462675000, 462700000, 462725000] GMRS_FREQS = GMRS_FREQS1 + GMRS_FREQS2 + GMRS_FREQS3 * 2 @@ -173,9 +172,6 @@ UV2501G3_fp = b"BTG324" # B-TECH UV-2501+220 pre-production units UV2501_220pp_fp = b"M3C281" -# extra block read for the 2501+220 pre-production units -# the same for all of this radios so far -UV2501_220pp_id = b" 280528" # B-TECH UV-2501+220 UV2501_220_fp = b"M3G201" # new variant, let's call it Generation 2 @@ -197,20 +193,26 @@ UV5001G3_fp = b"BTG304" # B-TECH UV-25X2 UV25X2_fp = b"UC2012" +# B-TECH UV-25X2 Second Generation (G2) +UV25X2G2_fp = b"UCB282" + # B-TECH UV-25X4 UV25X4_fp = b"UC4014" +# B-TECH UV-25X4 Second Generation (G2) +UV25X4G2_fp = b"UCB284" + # B-TECH UV-50X2 UV50X2_fp = b"UC2M12" # B-TECH GMRS-50X1 -GMRS50X1_fp = "NC1802" -GMRS50X1_fp1 = "NC1932" +GMRS50X1_fp = b"NC1802" +GMRS50X1_fp1 = b"NC1932" # B-TECH GMRS-20V2 -GMRS20V2_fp = "WP4204" -GMRS20V2_fp1 = "VW2112" -GMRS20V2_fp2 = "VWG728" +GMRS20V2_fp = b"WP4204" +GMRS20V2_fp1 = b"VW2112" +GMRS20V2_fp2 = b"VWG728" # special var to know when we found a BTECH Gen 3 BTECH3 = [UV2501G3_fp, UV2501_220G3_fp, UV5001G3_fp] @@ -233,8 +235,6 @@ KT8900_fp4 = b"M2G304" KT8900_fp5 = b"M2G314" KT8900_fp6 = b"M2G424" KT8900_fp7 = b"M27184" -# this radio has an extra ID -KT8900_id = b"303688" # KT8900R KT8900R_fp = b"M3G1F4" @@ -259,6 +259,7 @@ KT7900D_fp5 = b"VC4254" KT7900D_fp6 = b"VC5264" KT7900D_fp7 = b"VC9204" KT7900D_fp8 = b"VC9214" +KT7900D_fp9 = b"VC5302" # QB25 (quad band) - a clone of KT7900D QB25_fp = b"QB-25" @@ -275,26 +276,26 @@ LT588UV_fp = b"V2G1F4" LT588UV_fp1 = b"V2G214" # QYT KT-8R (quad band ht) -KT8R_fp = "MCB264" -KT8R_fp1 = "MCB284" -KT8R_fp2 = "MC5264" +KT8R_fp = b"MCB264" +KT8R_fp1 = b"MCB284" +KT8R_fp2 = b"MC5264" # QYT KT5800 (dual band) -KT5800_fp = "VCB222" +KT5800_fp = b"VCB222" # QYT KT980Plus (dual band) -KT980PLUS_fp = "VC2002" -KT980PLUS_fp1 = "VC6042" +KT980PLUS_fp = b"VC2002" +KT980PLUS_fp1 = b"VC6042" # Radioddity DB25-G (gmrs) -DB25G_fp = "VC6182" -DB25G_fp1 = "VC7062" +DB25G_fp = b"VC6182" +DB25G_fp1 = b"VC7062" # QYT KT-WP12 and KT-9900 -KTWP12_fp = "WP3094" +KTWP12_fp = b"WP3094" # Anysecu WP-9900 -WP9900_fp = "WP3094" +WP9900_fp = b"WP3094" # ### MAGICS @@ -312,15 +313,15 @@ MSTRING_KT8900D = b"\x55\x20\x16\x08\x01\xFF\xDC\x02" # for the BTECH UV-25X2 and UV-50X2 MSTRING_UV25X2 = b"\x55\x20\x16\x12\x28\xFF\xDC\x02" # for the BTECH UV-25X4 -MSTRING_UV25X4 = "\x55\x20\x16\x11\x18\xFF\xDC\x02" +MSTRING_UV25X4 = b"\x55\x20\x16\x11\x18\xFF\xDC\x02" # for the BTECH GMRS-50X1 -MSTRING_GMRS50X1 = "\x55\x20\x18\x10\x18\xFF\xDC\x02" +MSTRING_GMRS50X1 = b"\x55\x20\x18\x10\x18\xFF\xDC\x02" # for the BTECH GMRS-20V2 -MSTRING_GMRS20V2 = "\x55\x20\x21\x03\x27\xFF\xDC\x02" +MSTRING_GMRS20V2 = b"\x55\x20\x21\x03\x27\xFF\xDC\x02" # for the QYT KT-8R -MSTRING_KT8R = "\x55\x20\x17\x07\x03\xFF\xDC\x02" +MSTRING_KT8R = b"\x55\x20\x17\x07\x03\xFF\xDC\x02" # for the QYT KT-WP12, KT-9900 and Anysecu WP-9900 -MSTRING_KTWP12 = "\x55\x20\x18\x11\x02\xFF\xDC\x02" +MSTRING_KTWP12 = b"\x55\x20\x18\x11\x02\xFF\xDC\x02" def _clean_buffer(radio): @@ -393,7 +394,7 @@ def _send(radio, data): def _make_frame(cmd, addr, length, data=""): - """Pack the info in the headder format""" + """Pack the info in the header format""" frame = b"\x06" + struct.pack(">BHB", ord(cmd), addr, length) # add the data if set if len(data) != 0: @@ -416,7 +417,7 @@ def _recv(radio, addr): raise errors.RadioError("Short read of the block 0x%04x" % addr) # checking for the ack - if block[:1] != ACK_CMD: + if block[0] != ACK_CMD: raise errors.RadioError("Bad ack from radio in block 0x%04x" % addr) # header validation @@ -484,7 +485,7 @@ def _do_ident(radio, status, upload=False): radio.pipe.timeout = STIMEOUT # checking for the ack - if id2[0] not in "\x06\x05": + if id2[:1] not in b"\x06\x05": raise errors.RadioError("Bad ack from radio") # basic check for the additional block @@ -498,7 +499,7 @@ def _do_ident(radio, status, upload=False): # see _upload for this. if upload is True: # send an ACK - _send(radio, ACK_CMD) + _send(radio, b"\x06") # the amount of data depend on the radio, so far we have two radios # reading two bytes with an ACK at the end and just ONE with just @@ -513,7 +514,7 @@ def _do_ident(radio, status, upload=False): ack = _rawrecv(radio, 2) # checking - if len(ack) == 0 or ack[-1:] != ACK_CMD: + if len(ack) == 0 or ack[-1] != ACK_CMD: raise errors.RadioError("Radio didn't ACK the upload") # DEBUG @@ -532,7 +533,7 @@ def _download(radio): _do_ident(radio, status) # reset the progress bar in the UI - status.max = MEM_SIZE / BLOCK_SIZE + status.max = MEM_SIZE // BLOCK_SIZE status.msg = "Cloning from radio..." status.cur = 0 radio.status_fn(status) @@ -549,7 +550,7 @@ def _download(radio): data += d # UI Update - status.cur = addr / BLOCK_SIZE + status.cur = addr // BLOCK_SIZE status.msg = "Cloning from radio..." radio.status_fn(status) @@ -560,7 +561,7 @@ def _upload(radio): """Upload procedure""" # The UPLOAD mem is restricted to lower than 0x3100, - # so we will override that here localy + # so we will override that here locally MEM_SIZE = radio.UPLOAD_MEM_SIZE # UI progress @@ -573,7 +574,7 @@ def _upload(radio): data = radio.get_mmap().get_byte_compatible() # Reset the UI progress - status.max = MEM_SIZE / TX_BLOCK_SIZE + status.max = MEM_SIZE // TX_BLOCK_SIZE status.cur = 0 status.msg = "Cloning to radio..." radio.status_fn(status) @@ -605,7 +606,7 @@ def _upload(radio): raise errors.RadioError("Bad ACK writing block 0x%04x:" % addr) # UI Update - status.cur = addr / TX_BLOCK_SIZE + status.cur = addr // TX_BLOCK_SIZE status.msg = "Cloning to radio..." radio.status_fn(status) @@ -622,7 +623,7 @@ def model_match(cls, data): def _decode_ranges(low, high): """Unpack the data in the ranges zones in the memmap and return - a tuple with the integer corresponding to the Mhz it means""" + a tuple with the integer corresponding to the MHz it means""" ilow = int(low[0]) * 100 + int(low[1]) * 10 + int(low[2]) ihigh = int(high[0]) * 100 + int(high[1]) * 10 + int(high[2]) ilow *= 1000000 @@ -684,24 +685,18 @@ class BTechMobileCommon(chirp_common.CloneModeRadio, ' bugs.\n' '\n' ) - rp.pre_download = _(dedent("""\ - Follow these instructions to download your info: - - 1 - Turn off your radio - 2 - Connect your interface cable - 3 - Turn on your radio - 4 - Do the download of your radio data - - """)) - rp.pre_upload = _(dedent("""\ - Follow these instructions to upload your info: - - 1 - Turn off your radio - 2 - Connect your interface cable - 3 - Turn on your radio - 4 - Do the upload of your radio data - - """)) + rp.pre_download = _( + "Follow these instructions to download your info:\n" + "1 - Turn off your radio\n" + "2 - Connect your interface cable\n" + "3 - Turn on your radio\n" + "4 - Do the download of your radio data\n") + rp.pre_upload = _( + "Follow these instructions to upload your info:\n" + "1 - Turn off your radio\n" + "2 - Connect your interface cable\n" + "3 - Turn on your radio\n" + "4 - Do the upload of your radio data\n") return rp def get_features(self): @@ -758,15 +753,6 @@ class BTechMobileCommon(chirp_common.CloneModeRadio, return rf - def validate_memory(self, mem): - msgs = chirp_common.CloneModeRadio.validate_memory(self, mem) - - _msg_duplex1 = 'Memory location only supports "Low"' - _msg_duplex2 = 'Memory location only supports "off"' - _msg_duplex3 = 'Memory location only supports "(None)", "+" or "off"' - - return msgs - def sync_in(self): """Download from radio""" data = _download(self) @@ -822,7 +808,7 @@ class BTechMobileCommon(chirp_common.CloneModeRadio, index += 0x6A memval.set_value(index) except: - msg = "Digital Tone '%d' is not supported" % value + msg = "Digital Tone '%d' is not supported" % val LOG.error(msg) raise errors.RadioError(msg) else: @@ -926,6 +912,88 @@ class BTechMobileCommon(chirp_common.CloneModeRadio, SPMUTE_LIST[_mem.spmute])) mem.extra.append(spmute) + immutable = [] + + if self._gmrs: + if self.MODEL == "GMRS-50X1": + if mem.number >= 1 and mem.number <= 30: + if mem.freq in GMRS_FREQS: + GMRS_FREQ = GMRS_FREQS[mem.number - 1] + mem.freq = GMRS_FREQ + immutable = ["empty", "freq"] + if mem.number >= 1 and mem.number <= 7: + mem.duplex = '' + mem.offset = 0 + mem.power = POWER_LEVELS[2] + immutable += ["duplex", "offset", "power"] + elif mem.number >= 8 and mem.number <= 14: + mem.duplex = 'off' + mem.offset = 0 + immutable += ["duplex", "offset"] + elif mem.number >= 15 and mem.number <= 22: + mem.duplex = '' + mem.offset = 0 + immutable += ["duplex", "offset"] + elif mem.number >= 23 and mem.number <= 30: + mem.duplex = '+' + mem.offset = 5000000 + immutable += ["duplex", "offset"] + else: + # Not a GMRS channel, so restrict duplex since it will be + # forced to off. + mem.duplex = 'off' + mem.offset = 0 + immutable = ["duplex", "offset"] + elif self.MODEL in ["GMRS-20V2", "GMRS-50V2"]: + if mem.freq in GMRS_FREQS: + if mem.freq in GMRS_FREQS1: + # Non-repeater GMRS channels (limit duplex) + mem.duplex = '' + mem.offset = 0 + mem.power = POWER_LEVELS[2] + immutable = ["duplex", "offset", "power"] + elif mem.freq in GMRS_FREQS2: + # Non-repeater FRS channels (receive only) + mem.duplex = 'off' + mem.offset = 0 + immutable = ["duplex", "offset"] + elif mem.freq in GMRS_FREQS3: + # GMRS repeater channels, always either simplex or + # +5 MHz + if mem.duplex != '+': + mem.duplex = '' + mem.offset = 0 + else: + mem.offset = 5000000 + else: + # Not a GMRS channel, so restrict duplex since it will be + # forced to off. + mem.duplex = 'off' + mem.offset = 0 + immutable = ["duplex", "offset"] + elif self.MODEL == "DB25-G": + if mem.freq in GMRS_FREQS: + if mem.freq in GMRS_FREQS1: + # Non-repeater GMRS channels (limit duplex) + mem.duplex = '' + mem.offset = 0 + immutable = ["duplex", "offset"] + elif mem.freq in GMRS_FREQS2: + # Non-repeater FRS channels (receive only) + mem.duplex = 'off' + mem.offset = 0 + immutable = ["duplex", "offset"] + elif mem.freq in GMRS_FREQS3: + # GMRS repeater channels, always either simplex or + # +5 MHz + if mem.duplex != '+': + mem.duplex = '' + mem.offset = 0 + else: + mem.offset = 5000000 + + mem.immutable = immutable + return mem def set_memory(self, mem): @@ -955,49 +1023,6 @@ class BTechMobileCommon(chirp_common.CloneModeRadio, LOG.debug('Zeroing new memory') _mem.set_raw('\x00' * 16) - if self._gmrs: - if self.MODEL == "GMRS-50X1": - if mem.number >= 1 and mem.number <= 30: - GMRS_FREQ = int(GMRS_FREQS[mem.number - 1] * 1000000) - mem.freq = GMRS_FREQ - if mem.number <= 22: - mem.duplex = '' - mem.offset = 0 - if mem.number <= 7: - mem.power = POWER_LEVELS[2] - if mem.number >= 8 and mem.number <= 14: - mem.duplex = 'off' - mem.offset = 0 - mem.mode = 'NFM' - mem.power = POWER_LEVELS[2] - if mem.number > 22: - mem.duplex = '+' - mem.offset = 5000000 - else: - mem.duplex = 'off' - mem.offset = 0 - if self.MODEL == "GMRS-20V2": - if float(mem.freq) / 1000000 in GMRS_FREQS1: - mem.duplex = '' - mem.offset = 0 - mem.power = POWER_LEVELS[2] - elif float(mem.freq) / 1000000 in GMRS_FREQS2: - mem.duplex = 'off' - mem.offset = 0 - mem.mode = "NFM" - mem.power = POWER_LEVELS[2] - elif float(mem.freq) / 1000000 in GMRS_FREQS3: - if mem.power == POWER_LEVELS[1]: - mem.power = POWER_LEVELS[0] - if mem.duplex == '+': - mem.offset = 5000000 - else: - mem.duplex == '' - mem.offset = 0 - else: - mem.duplex = 'off' - mem.offset = 0 - # frequency _mem.rxfreq = mem.freq / 10 @@ -1021,10 +1046,7 @@ class BTechMobileCommon(chirp_common.CloneModeRadio, self._encode_tone(_mem.rxtone, rxmode, rxtone, rxpol) # name TAG of the channel - if len(mem.name) < self.NAME_LENGTH: - # we must pad to self.NAME_LENGTH chars, " " = "\xFF" - mem.name = str(mem.name).ljust(self.NAME_LENGTH, " ") - _names.name = str(mem.name).replace(" ", "\xFF") + _names.name = mem.name.rstrip(' ').ljust(self.NAME_LENGTH, "\xFF") # power, # default power level is high _mem.power = 0 if mem.power is None else POWER_LEVELS.index(mem.power) @@ -1070,7 +1092,7 @@ class BTechMobileCommon(chirp_common.CloneModeRadio, LOG.debug("New mem is empty.") else: LOG.debug("New mem is NOT empty") - # set extra-settings to default ONLY when apreviously empty or + # set extra-settings to default ONLY when a previously empty or # deleted memory was edited to prevent errors such as #4121 if mem_was_empty: LOG.debug("old mem was empty. Setting default for extras.") @@ -1089,637 +1111,557 @@ class BTechMobileCommon(chirp_common.CloneModeRadio, # Basic if self.COLOR_LCD: - tmr = RadioSetting("settings.tmr", "Transceiver multi-receive", - RadioSettingValueList( - self.LIST_TMR, - self.LIST_TMR[_mem.settings.tmr])) + val = min(_mem.settings.tmr, len(self.LIST_TMR) - 1) + rs = RadioSettingValueList(self.LIST_TMR, self.LIST_TMR[val]) + tmr = RadioSetting("settings.tmr", "Transceiver multi-receive", rs) basic.append(tmr) else: tdr = RadioSetting("settings.tdr", "Transceiver dual receive", RadioSettingValueBoolean(_mem.settings.tdr)) basic.append(tdr) - sql = RadioSetting("settings.sql", "Squelch level", - RadioSettingValueInteger(0, 9, _mem.settings.sql)) + val = min(_mem.settings.sql, 9) + rs = RadioSettingValueInteger(0, 9, val) + sql = RadioSetting("settings.sql", "Squelch level", rs) basic.append(sql) - if self.MODEL == "GMRS-50X1": - autolk = RadioSetting("settings.autolk", "Auto keylock", - RadioSettingValueBoolean( - _mem.settings.autolk)) + if self.MODEL == "GMRS-50X1" or self.MODEL == "GMRS-50V2": + rs = RadioSettingValueBoolean(_mem.settings.autolk) + autolk = RadioSetting("settings.autolk", "Auto keylock", rs) basic.append(autolk) if self.MODEL == "DB25-G": - rs = RadioSettingValueInteger(0, 127, _mem.settings.mgain2) + val = min(_mem.settings.mgain2, 127) + rs = RadioSettingValueInteger(0, 127, val) mgain2 = RadioSetting("settings.mgain2", "Mic gain", rs) basic.append(mgain2) - tot = RadioSetting("settings.tot", "Time out timer", - RadioSettingValueList( - LIST_TOT, - LIST_TOT[_mem.settings.tot])) + val = min(_mem.settings.tot, len(LIST_TOT) - 1) + rs = RadioSettingValueList(LIST_TOT, LIST_TOT[val]) + tot = RadioSetting("settings.tot", "Time out timer", rs) basic.append(tot) if self.MODEL == "KT-8R": - save = RadioSetting("settings.save", "Battery Save", - RadioSettingValueBoolean( - _mem.settings.save)) - basic.append(save) + rs = RadioSettingValueBoolean(_mem.settings.save) + save = RadioSetting("settings.save", "Battery Save", rs) + basic.append(save) model_list = ["KT-8R", "KT-WP12", "WP-9900"] if self.MODEL not in model_list: if self.VENDOR == "BTECH" or self.COLOR_LCD: - apo = RadioSetting("settings.apo", "Auto power off timer", - RadioSettingValueList( - LIST_APO, - LIST_APO[_mem.settings.apo])) + val = min(_mem.settings.apo, len(LIST_APO) - 1) + rs = RadioSettingValueList(LIST_APO, LIST_APO[val]) + apo = RadioSetting("settings.apo", "Auto power off timer", rs) basic.append(apo) else: - toa = RadioSetting("settings.apo", "Time out alert timer", - RadioSettingValueList( - LIST_OFF1TO10, - LIST_OFF1TO10[_mem.settings.apo])) + val = min(_mem.settings.apo, len(LIST_OFF1TO10) - 1) + rs = RadioSettingValueList(LIST_OFF1TO10, LIST_OFF1TO10[val]) + toa = RadioSetting("settings.apo", "Time out alert timer", rs) basic.append(toa) - abr = RadioSetting("settings.abr", "Backlight timer", - RadioSettingValueList( - LIST_OFF1TO50, - LIST_OFF1TO50[_mem.settings.abr])) + val = min(_mem.settings.abr, len(LIST_OFF1TO50) - 1) + rs = RadioSettingValueList(LIST_OFF1TO50, LIST_OFF1TO50[val]) + abr = RadioSetting("settings.abr", "Backlight timer", rs) basic.append(abr) - beep = RadioSetting("settings.beep", "Key beep", - RadioSettingValueBoolean(_mem.settings.beep)) + rs = RadioSettingValueBoolean(_mem.settings.beep) + beep = RadioSetting("settings.beep", "Key beep", rs) basic.append(beep) if self.MODEL == "GMRS-20V2": - rs = RadioSettingValueInteger(0, 58, _mem.settings.volume) + val = min(_mem.settings.volume, 58) + rs = RadioSettingValueInteger(0, 58, val) volume = RadioSetting("settings.volume", "Volume", rs) basic.append(volume) if self.MODEL == "KT-WP12" or self.MODEL == "WP-9900": - rs = RadioSettingValueInteger(1, 51, _mem.settings.volume + 1) + val = min(_mem.settings.volume, 50) + rs = RadioSettingValueInteger(1, 51, val + 1) volume = RadioSetting("settings.volume", "Volume", rs) basic.append(volume) if self.MODEL == "KT-8R": - dsub = RadioSetting("settings.dsub", "CTCSS/DCS code display", - RadioSettingValueBoolean( - _mem.settings.dsub)) + rs = RadioSettingValueBoolean(_mem.settings.dsub) + dsub = RadioSetting("settings.dsub", "CTCSS/DCS code display", rs) basic.append(dsub) if self.MODEL == "KT-8R" or self.COLOR_LCD4: - dtmfst = RadioSetting("settings.dtmfst", "DTMF side tone", - RadioSettingValueBoolean( - _mem.settings.dtmfst)) + rs = RadioSettingValueBoolean(_mem.settings.dtmfst) + dtmfst = RadioSetting("settings.dtmfst", "DTMF side tone", rs) basic.append(dtmfst) else: - dtmfst = RadioSetting("settings.dtmfst", "DTMF side tone", - RadioSettingValueList( - LIST_DTMFST, - LIST_DTMFST[_mem.settings.dtmfst])) + val = min(_mem.settings.dtmfst, len(LIST_DTMFST) - 1) + rs = RadioSettingValueList(LIST_DTMFST, LIST_DTMFST[val]) + dtmfst = RadioSetting("settings.dtmfst", "DTMF side tone", rs) basic.append(dtmfst) if not self.COLOR_LCD: - prisc = RadioSetting("settings.prisc", "Priority scan", - RadioSettingValueBoolean( - _mem.settings.prisc)) + rs = RadioSettingValueBoolean(_mem.settings.prisc) + prisc = RadioSetting("settings.prisc", "Priority scan", rs) basic.append(prisc) - prich = RadioSetting("settings.prich", "Priority channel", - RadioSettingValueInteger(0, self._upper, - _mem.settings.prich)) + val = min(_mem.settings.prich, self._upper) + rs = RadioSettingValueInteger(0, self._upper, val) + prich = RadioSetting("settings.prich", "Priority channel", rs) basic.append(prich) - screv = RadioSetting("settings.screv", "Scan resume method", - RadioSettingValueList( - LIST_SCREV, - LIST_SCREV[_mem.settings.screv])) + val = min(_mem.settings.screv, len(LIST_SCREV) - 1) + rs = RadioSettingValueList(LIST_SCREV, LIST_SCREV[val]) + screv = RadioSetting("settings.screv", "Scan resume method", rs) basic.append(screv) - pttlt = RadioSetting("settings.pttlt", "PTT transmit delay", - RadioSettingValueInteger(0, 30, - _mem.settings.pttlt)) + val = min(_mem.settings.pttlt, 30) + rs = RadioSettingValueInteger(0, 30, val) + pttlt = RadioSetting("settings.pttlt", "PTT transmit delay", rs) basic.append(pttlt) if self.VENDOR == "BTECH" and self.COLOR_LCD and not \ self.MODEL == "GMRS-20V2": - emctp = RadioSetting("settings.emctp", "Alarm mode", - RadioSettingValueList( - LIST_EMCTPX, - LIST_EMCTPX[_mem.settings.emctp])) + val = min(_mem.settings.emctp, len(LIST_EMCTPX) - 1) + rs = RadioSettingValueList(LIST_EMCTPX, LIST_EMCTPX[val]) + emctp = RadioSetting("settings.emctp", "Alarm mode", rs) basic.append(emctp) else: - emctp = RadioSetting("settings.emctp", "Alarm mode", - RadioSettingValueList( - LIST_EMCTP, - LIST_EMCTP[_mem.settings.emctp])) + val = min(_mem.settings.emctp, len(LIST_EMCTP) - 1) + rs = RadioSettingValueList(LIST_EMCTP, LIST_EMCTP[val]) + emctp = RadioSetting("settings.emctp", "Alarm mode", rs) basic.append(emctp) - emcch = RadioSetting("settings.emcch", "Alarm channel", - RadioSettingValueInteger(0, self._upper, - _mem.settings.emcch)) + val = min(_mem.settings.emcch, self._upper) + rs = RadioSettingValueInteger(0, self._upper, val) + emcch = RadioSetting("settings.emcch", "Alarm channel", rs) basic.append(emcch) if self.COLOR_LCD: - if _mem.settings.sigbp > 0x01: - val = 0x00 - else: - val = _mem.settings.sigbp - sigbp = RadioSetting("settings.sigbp", "Signal beep", - RadioSettingValueBoolean(val)) + rs = RadioSettingValueBoolean(_mem.settings.sigbp) + sigbp = RadioSetting("settings.sigbp", "Signal beep", rs) basic.append(sigbp) else: - ringt = RadioSetting("settings.ringt", "Ring time", - RadioSettingValueList( - LIST_OFF1TO9, - LIST_OFF1TO9[_mem.settings.ringt])) + val = min(_mem.settings.ringt, len(LIST_OFF1TO9) - 1) + rs = RadioSettingValueList(LIST_OFF1TO9, LIST_OFF1TO9[val]) + ringt = RadioSetting("settings.ringt", "Ring time", rs) basic.append(ringt) - camdf = RadioSetting("settings.camdf", "Display mode A", - RadioSettingValueList( - LIST_MDF, - LIST_MDF[_mem.settings.camdf])) + val = min(_mem.settings.camdf, len(LIST_MDF) - 1) + rs = RadioSettingValueList(LIST_MDF, LIST_MDF[val]) + camdf = RadioSetting("settings.camdf", "Display mode A", rs) basic.append(camdf) - cbmdf = RadioSetting("settings.cbmdf", "Display mode B", - RadioSettingValueList( - LIST_MDF, - LIST_MDF[_mem.settings.cbmdf])) + val = min(_mem.settings.cbmdf, len(LIST_MDF) - 1) + rs = RadioSettingValueList(LIST_MDF, LIST_MDF[val]) + cbmdf = RadioSetting("settings.cbmdf", "Display mode B", rs) basic.append(cbmdf) if self.COLOR_LCD: - ccmdf = RadioSetting("settings.ccmdf", "Display mode C", - RadioSettingValueList( - LIST_MDF, - LIST_MDF[_mem.settings.ccmdf])) + val = min(_mem.settings.ccmdf, len(LIST_MDF) - 1) + rs = RadioSettingValueList(LIST_MDF, LIST_MDF[val]) + ccmdf = RadioSetting("settings.ccmdf", "Display mode C", rs) basic.append(ccmdf) if not self.COLOR_LCD4: - cdmdf = RadioSetting("settings.cdmdf", "Display mode D", - RadioSettingValueList( - LIST_MDF, - LIST_MDF[_mem.settings.cdmdf])) + val = min(_mem.settings.cdmdf, len(LIST_MDF) - 1) + rs = RadioSettingValueList(LIST_MDF, LIST_MDF[val]) + cdmdf = RadioSetting("settings.cdmdf", "Display mode D", rs) basic.append(cdmdf) - langua = RadioSetting("settings.langua", "Language", - RadioSettingValueList( - LIST_LANGUA, - LIST_LANGUA[_mem.settings.langua])) - basic.append(langua) - + if self.MODEL in ["UV-50X2_G2", "UV-25X2_G2", "UV-25X4_G2"]: + val = min(_mem.settings.langua, len(LIST_VOX) - 1) + rs = RadioSettingValueList(LIST_VOX, LIST_VOX[val]) + vox = RadioSetting("settings.langua", "VOX", rs) + basic.append(vox) + elif self.MODEL == "GMRS-50V2": + val = min(_mem.settings.vox, len(LIST_VOX) - 1) + rs = RadioSettingValueList(LIST_VOX, LIST_VOX[val]) + vox = RadioSetting("settings.vox", "VOX", rs) + basic.append(vox) + else: + val = min(_mem.settings.langua, len(LIST_LANGUA) - 1) + rs = RadioSettingValueList(LIST_LANGUA, LIST_LANGUA[val]) + langua = RadioSetting("settings.langua", "Language", rs) + basic.append(langua) if self.MODEL == "KT-8R": - voice = RadioSetting("settings.voice", "Voice prompt", - RadioSettingValueList( - LIST_VOICE, - LIST_VOICE[_mem.settings.voice])) + val = min(_mem.settings.voice, len(LIST_VOICE) - 1) + rs = RadioSettingValueList(LIST_VOICE, LIST_VOICE[val]) + voice = RadioSetting("settings.voice", "Voice prompt", rs) basic.append(voice) if self.MODEL == "KT-8R" or self.COLOR_LCD4: - vox = RadioSetting("settings.vox", "VOX", - RadioSettingValueList( - LIST_VOX, - LIST_VOX[_mem.settings.vox])) + val = min(_mem.settings.vox, len(LIST_VOX) - 1) + rs = RadioSettingValueList(LIST_VOX, LIST_VOX[val]) + vox = RadioSetting("settings.vox", "VOX", rs) basic.append(vox) - voxt = RadioSetting("settings.voxt", "VOX delay time", - RadioSettingValueList( - LIST_VOXT, - LIST_VOXT[_mem.settings.voxt])) + val = min(_mem.settings.voxt, len(LIST_VOX) - 1) + rs = RadioSettingValueList(LIST_VOXT, LIST_VOXT[val]) + voxt = RadioSetting("settings.voxt", "VOX delay time", rs) basic.append(voxt) if self.VENDOR == "BTECH": if self.COLOR_LCD: if self.MODEL == "GMRS-20V2": - val = RadioSettingValueList(LIST_SYNCV2, - LIST_SYNCV2[ - _mem.settings.sync]) + val = min(_mem.settings.sync, len(LIST_SYNCV2) - 1) + rs = RadioSettingValueList(LIST_SYNCV2, LIST_SYNCV2[val]) sync = RadioSetting("settings.sync", - "Channel display sync", val) + "Channel display sync", rs) basic.append(sync) else: - val = RadioSettingValueList(LIST_SYNC, - LIST_SYNC[_mem.settings.sync]) + val = min(_mem.settings.sync, len(LIST_SYNC) - 1) + rs = RadioSettingValueList(LIST_SYNC, LIST_SYNC[val]) sync = RadioSetting("settings.sync", - "Channel display sync", val) + "Channel display sync", rs) basic.append(sync) else: - sync = RadioSetting("settings.sync", "A/B channel sync", - RadioSettingValueBoolean( - _mem.settings.sync)) + rs = RadioSettingValueBoolean(_mem.settings.sync) + sync = RadioSetting("settings.sync", "A/B channel sync", rs) basic.append(sync) if self.COLOR_LCD4: - autolk = RadioSetting("settings.autolock", "Auto keylock", - RadioSettingValueBoolean( - _mem.settings.autolock)) + rs = RadioSettingValueBoolean(_mem.settings.autolock) + autolk = RadioSetting("settings.autolock", "Auto keylock", rs) basic.append(autolk) if not self.COLOR_LCD: - ponmsg = RadioSetting("settings.ponmsg", "Power-on message", - RadioSettingValueList( - LIST_PONMSG, - LIST_PONMSG[_mem.settings.ponmsg])) + val = min(_mem.settings.ponmsg, len(LIST_PONMSG) - 1) + rs = RadioSettingValueList(LIST_PONMSG, LIST_PONMSG[val]) + ponmsg = RadioSetting("settings.ponmsg", "Power-on message", rs) basic.append(ponmsg) if self.COLOR_LCD and not (self.COLOR_LCD2 or self.COLOR_LCD3 or self.COLOR_LCD4): + val = min(_mem.settings.mainfc, len(LIST_COLOR9) - 1) + rs = RadioSettingValueList(LIST_COLOR9, LIST_COLOR9[val]) mainfc = RadioSetting("settings.mainfc", - "Main LCD foreground color", - RadioSettingValueList( - LIST_COLOR9, - LIST_COLOR9[_mem.settings.mainfc])) + "Main LCD foreground color", rs) basic.append(mainfc) if not self.COLOR_LCD4: + val = min(_mem.settings.mainbc, len(LIST_COLOR9) - 1) + rs = RadioSettingValueList(LIST_COLOR9, LIST_COLOR9[val]) mainbc = RadioSetting("settings.mainbc", - "Main LCD background color", - RadioSettingValueList( - LIST_COLOR9, - LIST_COLOR9[_mem.settings.mainbc])) + "Main LCD background color", rs) basic.append(mainbc) - menufc = RadioSetting("settings.menufc", "Menu foreground color", - RadioSettingValueList( - LIST_COLOR9, - LIST_COLOR9[_mem.settings.menufc])) + val = min(_mem.settings.menufc, len(LIST_COLOR9) - 1) + rs = RadioSettingValueList(LIST_COLOR9, LIST_COLOR9[val]) + menufc = RadioSetting("settings.menufc", + "Menu foreground color", rs) basic.append(menufc) if not self.COLOR_LCD4: - val = RadioSettingValueList(LIST_COLOR9, - LIST_COLOR9[_mem.settings.menubc]) + val = min(_mem.settings.menubc, len(LIST_COLOR9) - 1) + rs = RadioSettingValueList(LIST_COLOR9, LIST_COLOR9[val]) menubc = RadioSetting("settings.menubc", - "Menu background color", val) + "Menu background color", rs) basic.append(menubc) + val = min(_mem.settings.stafc, len(LIST_COLOR9) - 1) + rs = RadioSettingValueList(LIST_COLOR9, LIST_COLOR9[val]) stafc = RadioSetting("settings.stafc", - "Top status foreground color", - RadioSettingValueList( - LIST_COLOR9, - LIST_COLOR9[_mem.settings.stafc])) + "Top status foreground color", rs) basic.append(stafc) if not self.COLOR_LCD4: + val = min(_mem.settings.stabc, len(LIST_COLOR9) - 1) + rs = RadioSettingValueList(LIST_COLOR9, LIST_COLOR9[val]) stabc = RadioSetting("settings.stabc", - "Top status background color", - RadioSettingValueList( - LIST_COLOR9, - LIST_COLOR9[_mem.settings.stabc])) + "Top status background color", rs) basic.append(stabc) + val = min(_mem.settings.sigfc, len(LIST_COLOR9) - 1) + rs = RadioSettingValueList(LIST_COLOR9, LIST_COLOR9[val]) sigfc = RadioSetting("settings.sigfc", - "Bottom status foreground color", - RadioSettingValueList( - LIST_COLOR9, - LIST_COLOR9[_mem.settings.sigfc])) + "Bottom status foreground color", rs) basic.append(sigfc) if not self.COLOR_LCD4: + val = min(_mem.settings.sigbc, len(LIST_COLOR9) - 1) + rs = RadioSettingValueList(LIST_COLOR9, LIST_COLOR9[val]) sigbc = RadioSetting("settings.sigbc", - "Bottom status background color", - RadioSettingValueList( - LIST_COLOR9, - LIST_COLOR9[_mem.settings.sigbc])) + "Bottom status background color", rs) basic.append(sigbc) - rxfc = RadioSetting("settings.rxfc", "Receiving character color", - RadioSettingValueList( - LIST_COLOR9, - LIST_COLOR9[_mem.settings.rxfc])) + val = min(_mem.settings.rxfc, len(LIST_COLOR9) - 1) + rs = RadioSettingValueList(LIST_COLOR9, LIST_COLOR9[val]) + rxfc = RadioSetting("settings.rxfc", + "Receiving character color", rs) basic.append(rxfc) + val = min(_mem.settings.txfc, len(LIST_COLOR9) - 1) + rs = RadioSettingValueList(LIST_COLOR9, LIST_COLOR9[val]) txfc = RadioSetting("settings.txfc", - "Transmitting character color", - RadioSettingValueList( - LIST_COLOR9, - LIST_COLOR9[_mem.settings.txfc])) + "Transmitting character color", rs) basic.append(txfc) if not self.COLOR_LCD4: + val = min(_mem.settings.txdisp, len(LIST_TXDISP) - 1) + rs = RadioSettingValueList(LIST_TXDISP, LIST_TXDISP[val]) txdisp = RadioSetting("settings.txdisp", - "Transmitting status display", - RadioSettingValueList( - LIST_TXDISP, - LIST_TXDISP[_mem.settings.txdisp])) + "Transmitting status display", rs) basic.append(txdisp) elif self.COLOR_LCD2 or self.COLOR_LCD3: - stfc = RadioSetting("settings.stfc", - "ST-FC", - RadioSettingValueList( - LIST_COLOR8, - LIST_COLOR8[_mem.settings.stfc])) + val = min(_mem.settings.stfc, len(LIST_COLOR8) - 1) + rs = RadioSettingValueList(LIST_COLOR8, LIST_COLOR8[val]) + stfc = RadioSetting("settings.stfc", "ST-FC", rs) basic.append(stfc) - mffc = RadioSetting("settings.mffc", - "MF-FC", - RadioSettingValueList( - LIST_COLOR8, - LIST_COLOR8[_mem.settings.mffc])) + val = min(_mem.settings.mffc, len(LIST_COLOR8) - 1) + rs = RadioSettingValueList(LIST_COLOR8, LIST_COLOR8[val]) + mffc = RadioSetting("settings.mffc", "MF-FC", rs) basic.append(mffc) - sfafc = RadioSetting("settings.sfafc", - "SFA-FC", - RadioSettingValueList( - LIST_COLOR8, - LIST_COLOR8[_mem.settings.sfafc])) + val = min(_mem.settings.sfafc, len(LIST_COLOR8) - 1) + rs = RadioSettingValueList(LIST_COLOR8, LIST_COLOR8[val]) + sfafc = RadioSetting("settings.sfafc", "SFA-FC", rs) basic.append(sfafc) - sfbfc = RadioSetting("settings.sfbfc", - "SFB-FC", - RadioSettingValueList( - LIST_COLOR8, - LIST_COLOR8[_mem.settings.sfbfc])) + val = min(_mem.settings.sfbfc, len(LIST_COLOR8) - 1) + rs = RadioSettingValueList(LIST_COLOR8, LIST_COLOR8[val]) + sfbfc = RadioSetting("settings.sfbfc", "SFB-FC", rs) basic.append(sfbfc) - sfcfc = RadioSetting("settings.sfcfc", - "SFC-FC", - RadioSettingValueList( - LIST_COLOR8, - LIST_COLOR8[_mem.settings.sfcfc])) + val = min(_mem.settings.sfcfc, len(LIST_COLOR8) - 1) + rs = RadioSettingValueList(LIST_COLOR8, LIST_COLOR8[val]) + sfcfc = RadioSetting("settings.sfcfc", "SFC-FC", rs) basic.append(sfcfc) - sfdfc = RadioSetting("settings.sfdfc", - "SFD-FC", - RadioSettingValueList( - LIST_COLOR8, - LIST_COLOR8[_mem.settings.sfdfc])) + val = min(_mem.settings.sfdfc, len(LIST_COLOR8) - 1) + rs = RadioSettingValueList(LIST_COLOR8, LIST_COLOR8[val]) + sfdfc = RadioSetting("settings.sfdfc", "SFD-FC", rs) basic.append(sfdfc) - subfc = RadioSetting("settings.subfc", - "SUB-FC", - RadioSettingValueList( - LIST_COLOR8, - LIST_COLOR8[_mem.settings.subfc])) + val = min(_mem.settings.subfc, len(LIST_COLOR8) - 1) + rs = RadioSettingValueList(LIST_COLOR8, LIST_COLOR8[val]) + subfc = RadioSetting("settings.subfc", "SUB-FC", rs) basic.append(subfc) - fmfc = RadioSetting("settings.fmfc", - "FM-FC", - RadioSettingValueList( - LIST_COLOR8, - LIST_COLOR8[_mem.settings.fmfc])) + val = min(_mem.settings.fmfc, len(LIST_COLOR8) - 1) + rs = RadioSettingValueList(LIST_COLOR8, LIST_COLOR8[val]) + fmfc = RadioSetting("settings.fmfc", "FM-FC", rs) basic.append(fmfc) - sigfc = RadioSetting("settings.sigfc", - "SIG-FC", - RadioSettingValueList( - LIST_COLOR8, - LIST_COLOR8[_mem.settings.sigfc])) + val = min(_mem.settings.sigfc, len(LIST_COLOR8) - 1) + rs = RadioSettingValueList(LIST_COLOR8, LIST_COLOR8[val]) + sigfc = RadioSetting("settings.sigfc", "SIG-FC", rs) basic.append(sigfc) if not self.MODEL == "KT-8R": - modfc = RadioSetting("settings.modfc", - "MOD-FC", - RadioSettingValueList( - LIST_COLOR8, - LIST_COLOR8[_mem.settings.modfc])) + val = min(_mem.settings.modfc, len(LIST_COLOR8) - 1) + rs = RadioSettingValueList(LIST_COLOR8, LIST_COLOR8[val]) + modfc = RadioSetting("settings.modfc", "MOD-FC", rs) basic.append(modfc) - menufc = RadioSetting("settings.menufc", - "MENUFC", - RadioSettingValueList( - LIST_COLOR8, - LIST_COLOR8[_mem.settings.menufc])) + val = min(_mem.settings.menufc, len(LIST_COLOR8) - 1) + rs = RadioSettingValueList(LIST_COLOR8, LIST_COLOR8[val]) + menufc = RadioSetting("settings.menufc", "MENUFC", rs) basic.append(menufc) - txfc = RadioSetting("settings.txfc", - "TX-FC", - RadioSettingValueList( - LIST_COLOR8, - LIST_COLOR8[_mem.settings.txfc])) + val = min(_mem.settings.txfc, len(LIST_COLOR8) - 1) + rs = RadioSettingValueList(LIST_COLOR8, LIST_COLOR8[val]) + txfc = RadioSetting("settings.txfc", "TX-FC", rs) basic.append(txfc) if self.MODEL == "KT-8R": - rxfc = RadioSetting("settings.rxfc", - "RX-FC", - RadioSettingValueList( - LIST_COLOR8, - LIST_COLOR8[_mem.settings.rxfc])) + val = min(_mem.settings.rxfc, len(LIST_COLOR8) - 1) + rs = RadioSettingValueList(LIST_COLOR8, LIST_COLOR8[val]) + rxfc = RadioSetting("settings.rxfc", "RX-FC", rs) basic.append(rxfc) - if not self.MODEL == "KT-8R": + if not self.MODEL == "KT-8R" and not self.MODEL == "GMRS-50V2": + val = min(_mem.settings.txdisp, len(LIST_TXDISP) - 1) + rs = RadioSettingValueList(LIST_TXDISP, LIST_TXDISP[val]) txdisp = RadioSetting("settings.txdisp", - "Transmitting status display", - RadioSettingValueList( - LIST_TXDISP, - LIST_TXDISP[_mem.settings.txdisp])) + "Transmitting status display", rs) basic.append(txdisp) elif self.COLOR_LCD4: - asfc = RadioSetting("settings.asfc", - "Above Stat fore color", - RadioSettingValueList( - LIST_COLOR8, - LIST_COLOR8[_mem.settings.asfc])) + val = min(_mem.settings.asfc, len(LIST_COLOR8) - 1) + rs = RadioSettingValueList(LIST_COLOR8, LIST_COLOR8[val]) + asfc = RadioSetting("settings.asfc", "Above Stat fore color", rs) basic.append(asfc) - mainfc = RadioSetting("settings.mainfc", - "Main fore color", - RadioSettingValueList( - LIST_COLOR8, - LIST_COLOR8[_mem.settings.mainfc])) + val = min(_mem.settings.mainfc, len(LIST_COLOR8) - 1) + rs = RadioSettingValueList(LIST_COLOR8, LIST_COLOR8[val]) + mainfc = RadioSetting("settings.mainfc", "Main fore color", rs) basic.append(mainfc) - a_fc = RadioSetting("settings.a_fc", - "A - fore color", - RadioSettingValueList( - LIST_COLOR8, - LIST_COLOR8[_mem.settings.a_fc])) + val = min(_mem.settings.a_fc, len(LIST_COLOR8) - 1) + rs = RadioSettingValueList(LIST_COLOR8, LIST_COLOR8[val]) + a_fc = RadioSetting("settings.a_fc", "A - fore color", rs) basic.append(a_fc) - b_fc = RadioSetting("settings.b_fc", - "B - fore color", - RadioSettingValueList( - LIST_COLOR8, - LIST_COLOR8[_mem.settings.b_fc])) + val = min(_mem.settings.b_fc, len(LIST_COLOR8) - 1) + rs = RadioSettingValueList(LIST_COLOR8, LIST_COLOR8[val]) + b_fc = RadioSetting("settings.b_fc", "B - fore color", rs) basic.append(b_fc) - c_fc = RadioSetting("settings.c_fc", - "C - fore color", - RadioSettingValueList( - LIST_COLOR8, - LIST_COLOR8[_mem.settings.c_fc])) + val = min(_mem.settings.c_fc, len(LIST_COLOR8) - 1) + rs = RadioSettingValueList(LIST_COLOR8, LIST_COLOR8[val]) + c_fc = RadioSetting("settings.c_fc", "C - fore color", rs) basic.append(c_fc) - subfc = RadioSetting("settings.subfc", - "Sub fore color", - RadioSettingValueList( - LIST_COLOR8, - LIST_COLOR8[_mem.settings.subfc])) + val = min(_mem.settings.subfc, len(LIST_COLOR8) - 1) + rs = RadioSettingValueList(LIST_COLOR8, LIST_COLOR8[val]) + subfc = RadioSetting("settings.subfc", "Sub fore color", rs) basic.append(subfc) - battfc = RadioSetting("settings.battfc", - "Battery fore color", - RadioSettingValueList( - LIST_COLOR8, - LIST_COLOR8[_mem.settings.battfc])) + val = min(_mem.settings.battfc, len(LIST_COLOR8) - 1) + rs = RadioSettingValueList(LIST_COLOR8, LIST_COLOR8[val]) + battfc = RadioSetting("settings.battfc", "Battery fore color", rs) basic.append(battfc) - sigfc = RadioSetting("settings.sigfc", - "Signal fore color", - RadioSettingValueList( - LIST_COLOR8, - LIST_COLOR8[_mem.settings.sigfc])) + val = min(_mem.settings.sigfc, len(LIST_COLOR8) - 1) + rs = RadioSettingValueList(LIST_COLOR8, LIST_COLOR8[val]) + sigfc = RadioSetting("settings.sigfc", "Signal fore color", rs) basic.append(sigfc) - menufc = RadioSetting("settings.menufc", - "Menu fore color", - RadioSettingValueList( - LIST_COLOR8, - LIST_COLOR8[_mem.settings.menufc])) + val = min(_mem.settings.menufc, len(LIST_COLOR8) - 1) + rs = RadioSettingValueList(LIST_COLOR8, LIST_COLOR8[val]) + menufc = RadioSetting("settings.menufc", "Menu fore color", rs) basic.append(menufc) - txfc = RadioSetting("settings.txfc", - "TX fore color", - RadioSettingValueList( - LIST_COLOR8, - LIST_COLOR8[_mem.settings.txfc])) + val = min(_mem.settings.txfc, len(LIST_COLOR8) - 1) + rs = RadioSettingValueList(LIST_COLOR8, LIST_COLOR8[val]) + txfc = RadioSetting("settings.txfc", "TX fore color", rs) basic.append(txfc) - rxfc = RadioSetting("settings.rxfc", - "RX fore color", - RadioSettingValueList( - LIST_COLOR8, - LIST_COLOR8[_mem.settings.rxfc])) + val = min(_mem.settings.rxfc, len(LIST_COLOR8) - 1) + rs = RadioSettingValueList(LIST_COLOR8, LIST_COLOR8[val]) + rxfc = RadioSetting("settings.rxfc", "RX fore color", rs) basic.append(rxfc) else: - wtled = RadioSetting("settings.wtled", "Standby backlight Color", - RadioSettingValueList( - LIST_COLOR4, - LIST_COLOR4[_mem.settings.wtled])) + val = min(_mem.settings.wtled, len(LIST_COLOR4) - 1) + rs = RadioSettingValueList(LIST_COLOR4, LIST_COLOR4[val]) + wtled = RadioSetting("settings.wtled", + "Standby backlight Color", rs) basic.append(wtled) - rxled = RadioSetting("settings.rxled", "RX backlight Color", - RadioSettingValueList( - LIST_COLOR4, - LIST_COLOR4[_mem.settings.rxled])) + val = min(_mem.settings.rxled, len(LIST_COLOR4) - 1) + rs = RadioSettingValueList(LIST_COLOR4, LIST_COLOR4[val]) + rxled = RadioSetting("settings.rxled", "RX backlight Color", rs) basic.append(rxled) - txled = RadioSetting("settings.txled", "TX backlight Color", - RadioSettingValueList( - LIST_COLOR4, - LIST_COLOR4[_mem.settings.txled])) + val = min(_mem.settings.txled, len(LIST_COLOR4) - 1) + rs = RadioSettingValueList(LIST_COLOR4, LIST_COLOR4[val]) + txled = RadioSetting("settings.txled", "TX backlight Color", rs) basic.append(txled) - anil = RadioSetting("settings.anil", "ANI length", - RadioSettingValueList( - LIST_ANIL, - LIST_ANIL[_mem.settings.anil])) + val = min(_mem.settings.anil, len(LIST_ANIL) - 1) + rs = RadioSettingValueList(LIST_ANIL, LIST_ANIL[val]) + anil = RadioSetting("settings.anil", "ANI length", rs) basic.append(anil) - reps = RadioSetting("settings.reps", "Relay signal (tone burst)", - RadioSettingValueList( - LIST_REPS, - LIST_REPS[_mem.settings.reps])) + val = min(_mem.settings.reps, len(LIST_REPS) - 1) + rs = RadioSettingValueList(LIST_REPS, LIST_REPS[val]) + reps = RadioSetting("settings.reps", "Relay signal (tone burst)", rs) basic.append(reps) if self.COLOR_LCD4: - dsub = RadioSetting("settings.dsub", "Subtone display", - RadioSettingValueBoolean( - _mem.settings.dsub)) + rs = RadioSettingValueBoolean(_mem.settings.dsub) + dsub = RadioSetting("settings.dsub", "Subtone display", rs) basic.append(dsub) if self.MODEL == "GMRS-20V2": - repsw = RadioSetting("settings.repsw", "Repeater SW", - RadioSettingValueList( - LIST_REPSW, - LIST_REPSW[_mem.settings.repsw])) + val = min(_mem.settings.repsw, len(LIST_REPSW) - 1) + rs = RadioSettingValueList(LIST_REPSW, LIST_REPSW[val]) + repsw = RadioSetting("settings.repsw", "Repeater SW", rs) basic.append(repsw) - model_list = ["GMRS-50X1", "KT-8R", "KT-WP12", "WP-9900"] + model_list = ["KT-8R", "KT-WP12", "WP-9900"] if self.MODEL not in model_list: - repm = RadioSetting("settings.repm", "Relay condition", - RadioSettingValueList( - LIST_REPM, - LIST_REPM[_mem.settings.repm])) + val = min(_mem.settings.repm, len(LIST_REPM) - 1) + rs = RadioSettingValueList(LIST_REPM, LIST_REPM[val]) + repm = RadioSetting("settings.repm", "Relay condition", rs) basic.append(repm) if self.VENDOR == "BTECH" or self.COLOR_LCD: if self.COLOR_LCD: - tmrmr = RadioSetting("settings.tmrmr", "TMR return time", - RadioSettingValueList( - LIST_OFF1TO50, - LIST_OFF1TO50[_mem.settings.tmrmr])) + val = min(_mem.settings.tmrmr, len(LIST_OFF1TO50) - 1) + rs = RadioSettingValueList(LIST_OFF1TO50, LIST_OFF1TO50[val]) + tmrmr = RadioSetting("settings.tmrmr", "TMR return time", rs) basic.append(tmrmr) else: - tdrab = RadioSetting("settings.tdrab", "TDR return time", - RadioSettingValueList( - LIST_OFF1TO50, - LIST_OFF1TO50[_mem.settings.tdrab])) + val = min(_mem.settings.tdrab, len(LIST_OFF1TO50) - 1) + rs = RadioSettingValueList(LIST_OFF1TO50, LIST_OFF1TO50[val]) + tdrab = RadioSetting("settings.tdrab", "TDR return time", rs) basic.append(tdrab) - ste = RadioSetting("settings.ste", "Squelch tail eliminate", - RadioSettingValueBoolean(_mem.settings.ste)) + rs = RadioSettingValueBoolean(_mem.settings.ste) + ste = RadioSetting("settings.ste", "Squelch tail eliminate", rs) basic.append(ste) if self.COLOR_LCD4: - rpste = RadioSetting("settings.rpste", "Repeater STE", - RadioSettingValueList( - LIST_OFF1TO10, - LIST_OFF1TO10[_mem.settings.rpste])) + val = min(_mem.settings.rpste, len(LIST_OFF1TO10) - 1) + rs = RadioSettingValueList(LIST_OFF1TO10, LIST_OFF1TO10[val]) + rpste = RadioSetting("settings.rpste", "Repeater STE", rs) basic.append(rpste) else: - rpste = RadioSetting("settings.rpste", "Repeater STE", - RadioSettingValueList( - LIST_OFF1TO9, - LIST_OFF1TO9[_mem.settings.rpste])) + val = min(_mem.settings.rpste, len(LIST_OFF1TO9) - 1) + rs = RadioSettingValueList(LIST_OFF1TO9, LIST_OFF1TO9[val]) + rpste = RadioSetting("settings.rpste", "Repeater STE", rs) basic.append(rpste) if self.COLOR_LCD4: - rptdl = RadioSetting("settings.rptdl", "Repeater STE delay", - RadioSettingValueList( - LIST_OFF1TO60, - LIST_OFF1TO60[_mem.settings.rptdl])) + val = min(_mem.settings.rptdl, len(LIST_OFF1TO60) - 1) + rs = RadioSettingValueList(LIST_OFF1TO60, LIST_OFF1TO60[val]) + rptdl = RadioSetting("settings.rptdl", + "Repeater STE delay", rs) basic.append(rptdl) else: - rptdl = RadioSetting("settings.rptdl", "Repeater STE delay", - RadioSettingValueList( - LIST_RPTDL, - LIST_RPTDL[_mem.settings.rptdl])) + val = min(_mem.settings.rptdl, len(LIST_RPTDL) - 1) + rs = RadioSettingValueList(LIST_RPTDL, LIST_RPTDL[val]) + rptdl = RadioSetting("settings.rptdl", + "Repeater STE delay", rs) basic.append(rptdl) if self.MODEL == "DB25-G": - mgain = RadioSetting("settings.mgain", "Auto power-on", - RadioSettingValueBoolean(_mem.settings.mgain)) + val = min(_mem.settings.mgain, 1) + rs = RadioSettingValueBoolean(val) + mgain = RadioSetting("settings.mgain", "Auto power-on", rs) basic.append(mgain) if str(_mem.fingerprint.fp) in BTECH3: - mgain = RadioSetting("settings.mgain", "Mic gain", - RadioSettingValueInteger(0, 120, - _mem.settings.mgain)) + val = min(_mem.settings.mgain, 120) + rs = RadioSettingValueInteger(0, 120, val) + mgain = RadioSetting("settings.mgain", "Mic gain", rs) basic.append(mgain) if str(_mem.fingerprint.fp) in BTECH3 or self.COLOR_LCD: - dtmfg = RadioSetting("settings.dtmfg", "DTMF gain", - RadioSettingValueInteger(0, 60, - _mem.settings.dtmfg)) + val = min(_mem.settings.dtmfg, 60) + rs = RadioSettingValueInteger(0, 60, val) + dtmfg = RadioSetting("settings.dtmfg", "DTMF gain", rs) basic.append(dtmfg) if self.VENDOR == "BTECH" and self.COLOR_LCD: - mgain = RadioSetting("settings.mgain", "Mic gain", - RadioSettingValueInteger(0, 127, - _mem.settings.mgain)) + val = min(_mem.settings.mgain, 127) + rs = RadioSettingValueInteger(0, 127, val) + mgain = RadioSetting("settings.mgain", "Mic gain", rs) basic.append(mgain) - skiptx = RadioSetting("settings.skiptx", "Skip TX", - RadioSettingValueList( - LIST_SKIPTX, - LIST_SKIPTX[_mem.settings.skiptx])) + val = min(_mem.settings.skiptx, len(LIST_SKIPTX) - 1) + rs = RadioSettingValueList(LIST_SKIPTX, LIST_SKIPTX[val]) + skiptx = RadioSetting("settings.skiptx", "Skip TX", rs) basic.append(skiptx) - scmode = RadioSetting("settings.scmode", "Scan mode", - RadioSettingValueList( - LIST_SCMODE, - LIST_SCMODE[_mem.settings.scmode])) + val = min(_mem.settings.scmode, len(LIST_SCMODE) - 1) + rs = RadioSettingValueList(LIST_SCMODE, LIST_SCMODE[val]) + scmode = RadioSetting("settings.scmode", "Scan mode", rs) basic.append(scmode) - if self.MODEL == "KT-8R" or self.MODEL == "UV-25X2" \ - or self.MODEL == "UV-25X4" or self.MODEL == "UV-50X2" \ - or self.MODEL == "GMRS-50X1" or self.MODEL == "GMRS-20V2": - tmrtx = RadioSetting("settings.tmrtx", "TX in multi-standby", - RadioSettingValueList( - LIST_TMRTX, - LIST_TMRTX[_mem.settings.tmrtx])) + if self.MODEL in ["KT-8R", "UV-25X2", "UV-25X4", "UV-50X2", + "GMRS-20V2", "UV-50X2_G2", "GMRS-50V2", + "UV-25X2_G2", "UV-25X4_G2"]: + val = min(_mem.settings.tmrtx, len(LIST_TMRTX) - 1) + rs = RadioSettingValueList(LIST_TMRTX, LIST_TMRTX[val]) + tmrtx = RadioSetting("settings.tmrtx", "TX in multi-standby", rs) basic.append(tmrtx) + if self.MODEL in ["UV-50X2_G2", "GMRS-50V2", "UV-25X2_G2", + "UV-25X4_G2"]: + val = min(_mem.settings.earpho, len(LIST_EARPH) - 1) + rs = RadioSettingValueList(LIST_EARPH, LIST_EARPH[val]) + earpho = RadioSetting("settings.earpho", "Earphone", rs) + basic.append(earpho) + # Advanced def _filter(name): filtered = "" @@ -1881,81 +1823,72 @@ class BTechMobileCommon(chirp_common.CloneModeRadio, # Work if self.COLOR_LCD4: - dispab = RadioSetting("settings2.dispab", "Display", - RadioSettingValueList( - LIST_ABC, - LIST_ABC[_mem.settings2.dispab])) + val = min(_mem.settings2.dispab, len(LIST_ABC) - 1) + rs = RadioSettingValueList(LIST_ABC, LIST_ABC[val]) + dispab = RadioSetting("settings2.dispab", "Display", rs) work.append(dispab) elif self.COLOR_LCD: - dispab = RadioSetting("settings2.dispab", "Display", - RadioSettingValueList( - LIST_ABCD, - LIST_ABCD[_mem.settings2.dispab])) + val = min(_mem.settings2.dispab, len(LIST_ABCD) - 1) + rs = RadioSettingValueList(LIST_ABCD, LIST_ABCD[val]) + dispab = RadioSetting("settings2.dispab", "Display", rs) work.append(dispab) else: - dispab = RadioSetting("settings2.dispab", "Display", - RadioSettingValueList( - LIST_AB, - LIST_AB[_mem.settings2.dispab])) + val = min(_mem.settings2.dispab, len(LIST_AB) - 1) + rs = RadioSettingValueList(LIST_AB, LIST_AB[val]) + dispab = RadioSetting("settings2.dispab", "Display", rs) work.append(dispab) if self.COLOR_LCD: - vfomra = RadioSetting("settings2.vfomra", "VFO/MR A mode", - RadioSettingValueList( - LIST_VFOMR, - LIST_VFOMR[_mem.settings2.vfomra])) + val = min(_mem.settings2.vfomra, len(LIST_VFOMR) - 1) + rs = RadioSettingValueList(LIST_VFOMR, LIST_VFOMR[val]) + vfomra = RadioSetting("settings2.vfomra", "VFO/MR A mode", rs) work.append(vfomra) - vfomrb = RadioSetting("settings2.vfomrb", "VFO/MR B mode", - RadioSettingValueList( - LIST_VFOMR, - LIST_VFOMR[_mem.settings2.vfomrb])) + val = min(_mem.settings2.vfomrb, len(LIST_VFOMR) - 1) + rs = RadioSettingValueList(LIST_VFOMR, LIST_VFOMR[val]) + vfomrb = RadioSetting("settings2.vfomrb", "VFO/MR B mode", rs) work.append(vfomrb) - vfomrc = RadioSetting("settings2.vfomrc", "VFO/MR C mode", - RadioSettingValueList( - LIST_VFOMR, - LIST_VFOMR[_mem.settings2.vfomrc])) + val = min(_mem.settings2.vfomrc, len(LIST_VFOMR) - 1) + rs = RadioSettingValueList(LIST_VFOMR, LIST_VFOMR[val]) + vfomrc = RadioSetting("settings2.vfomrc", "VFO/MR C mode", rs) work.append(vfomrc) if not self.COLOR_LCD4: - vfomrd = RadioSetting("settings2.vfomrd", "VFO/MR D mode", - RadioSettingValueList( - LIST_VFOMR, - LIST_VFOMR[_mem.settings2.vfomrd])) + val = min(_mem.settings2.vfomrd, len(LIST_VFOMR) - 1) + rs = RadioSettingValueList(LIST_VFOMR, LIST_VFOMR[val]) + vfomrd = RadioSetting("settings2.vfomrd", "VFO/MR D mode", rs) work.append(vfomrd) else: - vfomr = RadioSetting("settings2.vfomr", "VFO/MR mode", - RadioSettingValueList( - LIST_VFOMR, - LIST_VFOMR[_mem.settings2.vfomr])) + val = min(_mem.settings2.vfomr, len(LIST_VFOMR) - 1) + rs = RadioSettingValueList(LIST_VFOMR, LIST_VFOMR[val]) + vfomr = RadioSetting("settings2.vfomr", "VFO/MR mode", rs) work.append(vfomr) - keylock = RadioSetting("settings2.keylock", "Keypad lock", - RadioSettingValueBoolean( - _mem.settings2.keylock)) + rs = RadioSettingValueBoolean(_mem.settings2.keylock) + keylock = RadioSetting("settings2.keylock", "Keypad lock", rs) work.append(keylock) - mrcha = RadioSetting("settings2.mrcha", "MR A channel", - RadioSettingValueInteger(0, self._upper, - _mem.settings2.mrcha)) + val = min(_mem.settings2.mrcha, self._upper) + rs = RadioSettingValueInteger(0, self._upper, val) + mrcha = RadioSetting("settings2.mrcha", "MR A channel", rs) work.append(mrcha) - mrchb = RadioSetting("settings2.mrchb", "MR B channel", - RadioSettingValueInteger(0, self._upper, - _mem.settings2.mrchb)) + val = min(_mem.settings2.mrchb, self._upper) + rs = RadioSettingValueInteger(0, self._upper, val) + mrchb = RadioSetting("settings2.mrchb", "MR B channel", rs) work.append(mrchb) if self.COLOR_LCD: - mrchc = RadioSetting("settings2.mrchc", "MR C channel", - RadioSettingValueInteger( - 0, self._upper, _mem.settings2.mrchc)) + val = min(_mem.settings2.mrchc, self._upper) + rs = RadioSettingValueInteger(0, self._upper, val) + mrchc = RadioSetting("settings2.mrchc", "MR C channel", rs) work.append(mrchc) if not self.COLOR_LCD4: - mrchd = RadioSetting("settings2.mrchd", "MR D channel", - RadioSettingValueInteger( - 0, self._upper, _mem.settings2.mrchd)) + val = min(_mem.settings2.mrchd, self._upper) + rs = RadioSettingValueInteger(0, self._upper, val) + mrchd = RadioSetting("settings2.mrchd", "MR D channel", rs) work.append(mrchd) def convert_bytes_to_freq(bytes): @@ -2013,6 +1946,9 @@ class BTechMobileCommon(chirp_common.CloneModeRadio, obj.freq[i] = value % 10 value /= 10 + _vhf_upper = (convert_bytes_to_limit(_ranges.vhf_high)) + _uhf_lower = (convert_bytes_to_limit(_ranges.uhf_low)) + val1a = RadioSettingValueString(0, 10, convert_bytes_to_freq( _mem.vfo.a.freq)) val1a.set_validate_callback(my_validate) @@ -2020,8 +1956,11 @@ class BTechMobileCommon(chirp_common.CloneModeRadio, vfoafreq.set_apply_callback(apply_freq, _mem.vfo.a) work.append(vfoafreq) - val1b = RadioSettingValueString(0, 10, convert_bytes_to_freq( - _mem.vfo.b.freq)) + val = convert_bytes_to_freq(_mem.vfo.b.freq) + if self.MODEL in ["GMRS-50V2", "GMRS-50X1"]: + if val[:3] > _vhf_upper and val[:3] < _uhf_lower: + val = "462.562500" + val1b = RadioSettingValueString(0, 10, val) val1b.set_validate_callback(my_validate) vfobfreq = RadioSetting("vfo.b.freq", "VFO B frequency", val1b) vfobfreq.set_apply_callback(apply_freq, _mem.vfo.b) @@ -2036,38 +1975,38 @@ class BTechMobileCommon(chirp_common.CloneModeRadio, work.append(vfocfreq) if not self.COLOR_LCD4: - val1d = RadioSettingValueString(0, 10, convert_bytes_to_freq( - _mem.vfo.d.freq)) + val = convert_bytes_to_freq(_mem.vfo.d.freq) + if self.MODEL in ["GMRS-50V2", "GMRS-50X1"]: + if val[:3] > _vhf_upper and val[:3] < _uhf_lower: + val = "462.562500" + val1d = RadioSettingValueString(0, 10, val) val1d.set_validate_callback(my_validate) vfodfreq = RadioSetting("vfo.d.freq", "VFO D frequency", val1d) vfodfreq.set_apply_callback(apply_freq, _mem.vfo.d) work.append(vfodfreq) if not self.MODEL == "GMRS-50X1": - vfoashiftd = RadioSetting("vfo.a.shiftd", "VFO A shift", - RadioSettingValueList( - LIST_SHIFT, - LIST_SHIFT[_mem.vfo.a.shiftd])) + val = min(_mem.vfo.a.shiftd, len(LIST_SHIFT) - 1) + rs = RadioSettingValueList(LIST_SHIFT, LIST_SHIFT[val]) + vfoashiftd = RadioSetting("vfo.a.shiftd", "VFO A shift", rs) work.append(vfoashiftd) - vfobshiftd = RadioSetting("vfo.b.shiftd", "VFO B shift", - RadioSettingValueList( - LIST_SHIFT, - LIST_SHIFT[_mem.vfo.b.shiftd])) + val = min(_mem.vfo.b.shiftd, len(LIST_SHIFT) - 1) + rs = RadioSettingValueList(LIST_SHIFT, LIST_SHIFT[val]) + vfobshiftd = RadioSetting("vfo.b.shiftd", "VFO B shift", rs) work.append(vfobshiftd) if self.COLOR_LCD: - vfocshiftd = RadioSetting("vfo.c.shiftd", "VFO C shift", - RadioSettingValueList( - LIST_SHIFT, - LIST_SHIFT[_mem.vfo.c.shiftd])) + val = min(_mem.vfo.c.shiftd, len(LIST_SHIFT) - 1) + rs = RadioSettingValueList(LIST_SHIFT, LIST_SHIFT[val]) + vfocshiftd = RadioSetting("vfo.c.shiftd", "VFO C shift", rs) work.append(vfocshiftd) if not self.COLOR_LCD4: - val = RadioSettingValueList(LIST_SHIFT, - LIST_SHIFT[_mem.vfo.d.shiftd]) - vfodshiftd = RadioSetting("vfo.d.shiftd", "VFO D shift", - val) + val = min(_mem.vfo.d.shiftd, len(LIST_SHIFT) - 1) + rs = RadioSettingValueList(LIST_SHIFT, LIST_SHIFT[val]) + vfodshiftd = RadioSetting("vfo.d.shiftd", + "VFO D shift", rs) work.append(vfodshiftd) def convert_bytes_to_offset(bytes): @@ -2133,193 +2072,168 @@ class BTechMobileCommon(chirp_common.CloneModeRadio, work.append(vfoboffset) if not self.MODEL == "GMRS-50X1": - vfoatxp = RadioSetting("vfo.a.power", "VFO A power", - RadioSettingValueList( - LIST_TXP, - LIST_TXP[_mem.vfo.a.power])) + val = min(_mem.vfo.a.power, len(LIST_TXP) - 1) + rs = RadioSettingValueList(LIST_TXP, LIST_TXP[val]) + vfoatxp = RadioSetting("vfo.a.power", "VFO A power", rs) work.append(vfoatxp) - vfobtxp = RadioSetting("vfo.b.power", "VFO B power", - RadioSettingValueList( - LIST_TXP, - LIST_TXP[_mem.vfo.b.power])) + val = min(_mem.vfo.b.power, len(LIST_TXP) - 1) + rs = RadioSettingValueList(LIST_TXP, LIST_TXP[val]) + vfobtxp = RadioSetting("vfo.b.power", "VFO B power", rs) work.append(vfobtxp) if self.COLOR_LCD: - vfoctxp = RadioSetting("vfo.c.power", "VFO C power", - RadioSettingValueList( - LIST_TXP, - LIST_TXP[_mem.vfo.c.power])) + val = min(_mem.vfo.c.power, len(LIST_TXP) - 1) + rs = RadioSettingValueList(LIST_TXP, LIST_TXP[val]) + vfoctxp = RadioSetting("vfo.c.power", "VFO C power", rs) work.append(vfoctxp) if not self.COLOR_LCD4: - vfodtxp = RadioSetting("vfo.d.power", "VFO D power", - RadioSettingValueList( - LIST_TXP, - LIST_TXP[_mem.vfo.d.power])) + val = min(_mem.vfo.d.power, len(LIST_TXP) - 1) + rs = RadioSettingValueList(LIST_TXP, LIST_TXP[val]) + vfodtxp = RadioSetting("vfo.d.power", "VFO D power", rs) work.append(vfodtxp) if not self.MODEL == "GMRS-50X1": - vfoawide = RadioSetting("vfo.a.wide", "VFO A bandwidth", - RadioSettingValueList( - LIST_WIDE, - LIST_WIDE[_mem.vfo.a.wide])) + val = min(_mem.vfo.a.wide, len(LIST_WIDE) - 1) + rs = RadioSettingValueList(LIST_WIDE, LIST_WIDE[val]) + vfoawide = RadioSetting("vfo.a.wide", "VFO A bandwidth", rs) work.append(vfoawide) - vfobwide = RadioSetting("vfo.b.wide", "VFO B bandwidth", - RadioSettingValueList( - LIST_WIDE, - LIST_WIDE[_mem.vfo.b.wide])) + val = min(_mem.vfo.b.wide, len(LIST_WIDE) - 1) + rs = RadioSettingValueList(LIST_WIDE, LIST_WIDE[val]) + vfobwide = RadioSetting("vfo.b.wide", "VFO B bandwidth", rs) work.append(vfobwide) if self.COLOR_LCD: - vfocwide = RadioSetting("vfo.c.wide", "VFO C bandwidth", - RadioSettingValueList( - LIST_WIDE, - LIST_WIDE[_mem.vfo.c.wide])) + val = min(_mem.vfo.c.wide, len(LIST_WIDE) - 1) + rs = RadioSettingValueList(LIST_WIDE, LIST_WIDE[val]) + vfocwide = RadioSetting("vfo.c.wide", "VFO C bandwidth", rs) work.append(vfocwide) if not self.COLOR_LCD4: - vfodwide = RadioSetting("vfo.d.wide", "VFO D bandwidth", - RadioSettingValueList( - LIST_WIDE, - LIST_WIDE[_mem.vfo.d.wide])) + val = min(_mem.vfo.d.wide, len(LIST_WIDE) - 1) + rs = RadioSettingValueList(LIST_WIDE, LIST_WIDE[val]) + vfodwide = RadioSetting("vfo.d.wide", + "VFO D bandwidth", rs) work.append(vfodwide) - vfoastep = RadioSetting("vfo.a.step", "VFO A step", - RadioSettingValueList( - LIST_STEP, - LIST_STEP[_mem.vfo.a.step])) + val = min(_mem.vfo.a.step, len(LIST_STEP) - 1) + rs = RadioSettingValueList(LIST_STEP, LIST_STEP[val]) + vfoastep = RadioSetting("vfo.a.step", "VFO A step", rs) work.append(vfoastep) - vfobstep = RadioSetting("vfo.b.step", "VFO B step", - RadioSettingValueList( - LIST_STEP, - LIST_STEP[_mem.vfo.b.step])) + val = min(_mem.vfo.b.step, len(LIST_STEP) - 1) + rs = RadioSettingValueList(LIST_STEP, LIST_STEP[val]) + vfobstep = RadioSetting("vfo.b.step", "VFO B step", rs) work.append(vfobstep) if self.COLOR_LCD: - vfocstep = RadioSetting("vfo.c.step", "VFO C step", - RadioSettingValueList( - LIST_STEP, - LIST_STEP[_mem.vfo.c.step])) + val = min(_mem.vfo.c.step, len(LIST_STEP) - 1) + rs = RadioSettingValueList(LIST_STEP, LIST_STEP[val]) + vfocstep = RadioSetting("vfo.c.step", "VFO C step", rs) work.append(vfocstep) if not self.COLOR_LCD4: - vfodstep = RadioSetting("vfo.d.step", "VFO D step", - RadioSettingValueList( - LIST_STEP, - LIST_STEP[_mem.vfo.d.step])) + val = min(_mem.vfo.d.step, len(LIST_STEP) - 1) + rs = RadioSettingValueList(LIST_STEP, LIST_STEP[val]) + vfodstep = RadioSetting("vfo.d.step", "VFO D step", rs) work.append(vfodstep) - vfoaoptsig = RadioSetting("vfo.a.optsig", "VFO A optional signal", - RadioSettingValueList( - OPTSIG_LIST, - OPTSIG_LIST[_mem.vfo.a.optsig])) + val = min(_mem.vfo.a.optsig, len(OPTSIG_LIST) - 1) + rs = RadioSettingValueList(OPTSIG_LIST, OPTSIG_LIST[val]) + vfoaoptsig = RadioSetting("vfo.a.optsig", "VFO A optional signal", rs) work.append(vfoaoptsig) - vfoboptsig = RadioSetting("vfo.b.optsig", "VFO B optional signal", - RadioSettingValueList( - OPTSIG_LIST, - OPTSIG_LIST[_mem.vfo.b.optsig])) + val = min(_mem.vfo.b.optsig, len(OPTSIG_LIST) - 1) + rs = RadioSettingValueList(OPTSIG_LIST, OPTSIG_LIST[val]) + vfoboptsig = RadioSetting("vfo.b.optsig", "VFO B optional signal", rs) work.append(vfoboptsig) if self.COLOR_LCD: - vfocoptsig = RadioSetting("vfo.c.optsig", "VFO C optional signal", - RadioSettingValueList( - OPTSIG_LIST, - OPTSIG_LIST[_mem.vfo.c.optsig])) + val = min(_mem.vfo.c.optsig, len(OPTSIG_LIST) - 1) + rs = RadioSettingValueList(OPTSIG_LIST, OPTSIG_LIST[val]) + vfocoptsig = RadioSetting("vfo.c.optsig", + "VFO C optional signal", rs) work.append(vfocoptsig) if not self.COLOR_LCD4: - val = RadioSettingValueList(OPTSIG_LIST, - OPTSIG_LIST[_mem.vfo.d.optsig]) + val = min(_mem.vfo.d.optsig, len(OPTSIG_LIST) - 1) + rs = RadioSettingValueList(OPTSIG_LIST, OPTSIG_LIST[val]) vfodoptsig = RadioSetting("vfo.d.optsig", - "VFO D optional signal", val) + "VFO D optional signal", rs) work.append(vfodoptsig) - vfoaspmute = RadioSetting("vfo.a.spmute", "VFO A speaker mute", - RadioSettingValueList( - SPMUTE_LIST, - SPMUTE_LIST[_mem.vfo.a.spmute])) + val = min(_mem.vfo.a.spmute, len(SPMUTE_LIST) - 1) + rs = RadioSettingValueList(SPMUTE_LIST, SPMUTE_LIST[val]) + vfoaspmute = RadioSetting("vfo.a.spmute", "VFO A speaker mute", rs) work.append(vfoaspmute) - vfobspmute = RadioSetting("vfo.b.spmute", "VFO B speaker mute", - RadioSettingValueList( - SPMUTE_LIST, - SPMUTE_LIST[_mem.vfo.b.spmute])) + val = min(_mem.vfo.b.spmute, len(SPMUTE_LIST) - 1) + rs = RadioSettingValueList(SPMUTE_LIST, SPMUTE_LIST[val]) + vfobspmute = RadioSetting("vfo.b.spmute", "VFO B speaker mute", rs) work.append(vfobspmute) if self.COLOR_LCD: - vfocspmute = RadioSetting("vfo.c.spmute", "VFO C speaker mute", - RadioSettingValueList( - SPMUTE_LIST, - SPMUTE_LIST[_mem.vfo.c.spmute])) + val = min(_mem.vfo.c.spmute, len(SPMUTE_LIST) - 1) + rs = RadioSettingValueList(SPMUTE_LIST, SPMUTE_LIST[val]) + vfocspmute = RadioSetting("vfo.c.spmute", "VFO C speaker mute", rs) work.append(vfocspmute) if not self.COLOR_LCD4: - vfodspmute = RadioSetting("vfo.d.spmute", "VFO D speaker mute", - RadioSettingValueList( - SPMUTE_LIST, - SPMUTE_LIST[_mem.vfo.d.spmute])) + val = min(_mem.vfo.d.spmute, len(SPMUTE_LIST) - 1) + rs = RadioSettingValueList(SPMUTE_LIST, SPMUTE_LIST[val]) + vfodspmute = RadioSetting("vfo.d.spmute", + "VFO D speaker mute", rs) work.append(vfodspmute) if not self.COLOR_LCD or \ (self.COLOR_LCD and not self.VENDOR == "BTECH"): - vfoascr = RadioSetting("vfo.a.scramble", "VFO A scramble", - RadioSettingValueBoolean( - _mem.vfo.a.scramble)) + rs = RadioSettingValueBoolean(_mem.vfo.a.scramble) + vfoascr = RadioSetting("vfo.a.scramble", "VFO A scramble", rs) work.append(vfoascr) - vfobscr = RadioSetting("vfo.b.scramble", "VFO B scramble", - RadioSettingValueBoolean( - _mem.vfo.b.scramble)) + rs = RadioSettingValueBoolean(_mem.vfo.b.scramble) + vfobscr = RadioSetting("vfo.b.scramble", "VFO B scramble", rs) work.append(vfobscr) if self.COLOR_LCD and not self.VENDOR == "BTECH": - vfocscr = RadioSetting("vfo.c.scramble", "VFO C scramble", - RadioSettingValueBoolean( - _mem.vfo.c.scramble)) + rs = RadioSettingValueBoolean(_mem.vfo.c.scramble) + vfocscr = RadioSetting("vfo.c.scramble", "VFO C scramble", rs) work.append(vfocscr) - vfodscr = RadioSetting("vfo.d.scramble", "VFO D scramble", - RadioSettingValueBoolean( - _mem.vfo.d.scramble)) + rs = RadioSettingValueBoolean(_mem.vfo.d.scramble) + vfodscr = RadioSetting("vfo.d.scramble", "VFO D scramble", rs) work.append(vfodscr) if not self.MODEL == "GMRS-50X1": - vfoascode = RadioSetting("vfo.a.scode", "VFO A PTT-ID", - RadioSettingValueList( - PTTIDCODE_LIST, - PTTIDCODE_LIST[_mem.vfo.a.scode])) + val = min(_mem.vfo.a.scode, len(PTTIDCODE_LIST) - 1) + rs = RadioSettingValueList(PTTIDCODE_LIST, PTTIDCODE_LIST[val]) + vfoascode = RadioSetting("vfo.a.scode", "VFO A PTT-ID", rs) work.append(vfoascode) - vfobscode = RadioSetting("vfo.b.scode", "VFO B PTT-ID", - RadioSettingValueList( - PTTIDCODE_LIST, - PTTIDCODE_LIST[_mem.vfo.b.scode])) + val = min(_mem.vfo.b.scode, len(PTTIDCODE_LIST) - 1) + rs = RadioSettingValueList(PTTIDCODE_LIST, PTTIDCODE_LIST[val]) + vfobscode = RadioSetting("vfo.b.scode", "VFO B PTT-ID", rs) work.append(vfobscode) if self.COLOR_LCD: - vfocscode = RadioSetting("vfo.c.scode", "VFO C PTT-ID", - RadioSettingValueList( - PTTIDCODE_LIST, - PTTIDCODE_LIST[_mem.vfo.c.scode])) + val = min(_mem.vfo.c.scode, len(PTTIDCODE_LIST) - 1) + rs = RadioSettingValueList(PTTIDCODE_LIST, PTTIDCODE_LIST[val]) + vfocscode = RadioSetting("vfo.c.scode", "VFO C PTT-ID", rs) work.append(vfocscode) if not self.COLOR_LCD4: - val = RadioSettingValueList(PTTIDCODE_LIST, - PTTIDCODE_LIST[ - _mem.vfo.d.scode]) - vfodscode = RadioSetting("vfo.d.scode", "VFO D PTT-ID", - val) + val = min(_mem.vfo.d.scode, len(PTTIDCODE_LIST) - 1) + rs = RadioSettingValueList(PTTIDCODE_LIST, + PTTIDCODE_LIST[val]) + vfodscode = RadioSetting("vfo.d.scode", "VFO D PTT-ID", rs) work.append(vfodscode) if not self.MODEL == "GMRS-50X1": - pttid = RadioSetting("settings.pttid", "PTT ID", - RadioSettingValueList( - PTTID_LIST, - PTTID_LIST[_mem.settings.pttid])) + val = min(_mem.settings.pttid, len(PTTID_LIST) - 1) + rs = RadioSettingValueList(PTTID_LIST, PTTID_LIST[val]) + pttid = RadioSetting("settings.pttid", "PTT ID", rs) work.append(pttid) if not self.COLOR_LCD: @@ -2330,7 +2244,7 @@ class BTechMobileCommon(chirp_common.CloneModeRadio, def fm_validate(value): if value == 0: return chirp_common.format_freq(value) - if not (87.5 <= value and value <= 108.0): # 87.5-108MHz + if not (87.5 <= value and value <= 108.0): # 87.5-108 MHz msg = ("FM-Preset-Frequency: " + "Must be between 87.5 and 108 MHz") raise InvalidValueError(msg) @@ -3150,7 +3064,7 @@ class BTechMobileCommon(chirp_common.CloneModeRadio, if tmp == 65535: tmp = 0 if tmp != 0: - expected = int(round(2304000.0/tmp)) + expected = int(round(2304000.0/int(tmp))) from_mem = freq["derived_from_" + setting_name] if expected != from_mem: LOG.error("Expected " + str(expected) + @@ -3206,7 +3120,7 @@ class BTechMobileCommon(chirp_common.CloneModeRadio, elif element.value.get_mutable(): LOG.debug("Setting %s = %s" % (setting, element.value)) setattr(obj, setting, element.value) - except Exception as e: + except Exception: LOG.debug(element.get_name()) raise @@ -3255,7 +3169,8 @@ struct { #seekto 0x0E00; struct { - u8 tdr; + u8 unusedE00:7, + tdr:1; u8 unknown1; u8 sql; u8 unknown2[2]; @@ -3264,11 +3179,13 @@ struct { // other radios use this as pre-Time Out Alert u8 unknown3; u8 abr; - u8 beep; + u8 unusedE09:7, + beep:1; u8 unknown4[4]; u8 dtmfst; u8 unknown5[2]; - u8 prisc; + u8 unusedE11:7, + prisc:1; u8 prich; u8 screv; u8 unknown6[2]; @@ -3281,7 +3198,8 @@ struct { u8 unknown8; u8 camdf; u8 cbmdf; - u8 sync; // BTech radios use this as the display sync setting + u8 unusedE1F:7, + sync:1; // BTech radios use this as the display sync setting // other radios use this as the auto keypad lock setting u8 ponmsg; u8 wtled; @@ -3292,7 +3210,8 @@ struct { u8 reps; u8 repm; u8 tdrab; - u8 ste; + u8 unusedE2D:7, + ste:1; u8 rpste; u8 rptdl; u8 mgain; @@ -3303,7 +3222,8 @@ struct { struct { u8 unknown1; u8 vfomr; - u8 keylock; + u8 unusedE82:7, + keylock:1; u8 unknown2; u8 unknown3:4, vfomren:1, @@ -3332,7 +3252,8 @@ struct settings_vfo { u8 scode; u8 spmute; u8 optsig; - u8 scramble; + u8 unused1:7, + scramble:1; u8 wide; u8 power; u8 shiftd; @@ -3542,7 +3463,7 @@ class BTech(BTechMobileCommon): LOG.info("Radio ranges: VHF %d to %d" % vhf) LOG.info("Radio ranges: UHF %d to %d" % uhf) - # 220Mhz radios case + # 220 MHz radios case if self.MODEL in ["UV-2501+220", "KT8900R"]: vhf2 = _decode_ranges(ranges.vhf2_low, ranges.vhf2_high) LOG.info("Radio ranges: VHF(220) %d to %d" % vhf2) @@ -3630,9 +3551,9 @@ class MINI8900(BTech): VENDOR = "WACCOM" MODEL = "MINI-8900" _magic = MSTRING_MINI8900 - _fileid = [MINI8900_fp, ] + _fileid = [MINI8900_fp] # Clones - ALIASES = [JT6188Plus, ] + ALIASES = [JT6188Plus] @directory.register @@ -3643,9 +3564,9 @@ class KTUV980(BTech): _vhf_range = (136000000, 175000000) _uhf_range = (400000000, 481000000) _magic = MSTRING_MINI8900 - _fileid = [KTUV980_fp, ] + _fileid = [KTUV980_fp] # Clones - ALIASES = [JT2705M, ] + ALIASES = [JT2705M] # Please note that there is a version of this radios that is a clone of the # Waccom Mini8900, maybe an early version? @@ -3744,7 +3665,8 @@ struct { u8 apo; u8 unknown3; u8 abr; - u8 beep; + u8 unusedE09:7, + beep:1; u8 unknown4[4]; u8 dtmfst; u8 unknown5[2]; @@ -3755,13 +3677,15 @@ struct { u8 unknown7; u8 emctp; u8 emcch; - u8 sigbp; + u8 unusedE19:7, + sigbp:1; u8 unknown8; u8 camdf; u8 cbmdf; u8 ccmdf; u8 cdmdf; - u8 langua; + u8 langua; // BTech Gen2 radios have removed the Language setting + // use this as the VOX setting u8 sync; // BTech radios use this as the display sync // setting, other radios use this as the auto // keypad lock setting @@ -3781,7 +3705,8 @@ struct { u8 reps; u8 repm; u8 tmrmr; - u8 ste; + u8 unusedE35:7, + ste:1; u8 rpste; u8 rptdl; u8 dtmfg; @@ -3789,13 +3714,15 @@ struct { u8 skiptx; u8 scmode; u8 tmrtx; + u8 earpho; } settings; #seekto 0x0E80; struct { u8 unknown1; u8 vfomr; - u8 keylock; + u8 unusedE82:7, + keylock:1; u8 unknown2; u8 unknown3:4, vfomren:1, @@ -3826,7 +3753,8 @@ struct settings_vfo { u8 scode; u8 spmute; u8 optsig; - u8 scramble; + u8 unused1:7, + scramble:1; u8 wide; u8 power; u8 shiftd; @@ -4042,12 +3970,12 @@ class BTechColor(BTechMobileCommon): # the additional bands if self.MODEL in ["UV-25X4", "KT7900D"]: - # 200Mhz band + # 200 MHz band vhf2 = _decode_ranges(ranges.vhf2_low, ranges.vhf2_high) LOG.info("Radio ranges: VHF(220) %d to %d" % vhf2) self._220_range = vhf2 - # 350Mhz band + # 350 MHz band uhf2 = _decode_ranges(ranges.uhf2_low, ranges.uhf2_high) LOG.info("Radio ranges: UHF(350) %d to %d" % uhf2) self._350_range = uhf2 @@ -4077,7 +4005,14 @@ class UV25X2(BTechColor): _vhf_range = (130000000, 180000000) _uhf_range = (400000000, 521000000) _magic = MSTRING_UV25X2 - _fileid = [UV25X2_fp, ] + _fileid = [UV25X2_fp] + + +@directory.register +class UV25X2_G2(UV25X2): + """Baofeng Tech UV25X2_G2""" + MODEL = "UV-25X2_G2" + _fileid = [UV25X2G2_fp] @directory.register @@ -4090,7 +4025,14 @@ class UV25X4(BTechColor): _uhf_range = (400000000, 521000000) _350_range = (350000000, 391000000) _magic = MSTRING_UV25X4 - _fileid = [UV25X4_fp, ] + _fileid = [UV25X4_fp] + + +@directory.register +class UV25X4_G2(UV25X4): + """Baofeng Tech UV25X4_G2""" + MODEL = "UV-25X4_G2" + _fileid = [UV25X4G2_fp] @directory.register @@ -4101,11 +4043,29 @@ class UV50X2(BTechColor): _vhf_range = (130000000, 180000000) _uhf_range = (400000000, 521000000) _magic = MSTRING_UV25X2 - _fileid = [UV50X2_fp, ] + _fileid = [UV50X2_fp] _power_levels = [chirp_common.PowerLevel("High", watts=50), chirp_common.PowerLevel("Low", watts=10)] +@directory.register +class UV50X2_G2(BTechColor): + """Baofeng Tech UV50X2_G2""" + MODEL = "UV-50X2_G2" + BANDS = 2 + _vhf_range = (130000000, 180000000) + _uhf_range = (400000000, 521000000) + _magic = MSTRING_UV25X2 + _fileid = [UV50X2_fp] + _power_levels = [chirp_common.PowerLevel("High", watts=50), + chirp_common.PowerLevel("Low", watts=10)] + + @classmethod + def match_model(cls, filedata, filename): + # This model is only ever matched via metadata + return False + + @directory.register class KT7900D(BTechColor): """QYT KT7900D""" @@ -4119,9 +4079,10 @@ class KT7900D(BTechColor): _350_range = (350000000, 371000000) _magic = MSTRING_KT8900D _fileid = [KT7900D_fp, KT7900D_fp1, KT7900D_fp2, KT7900D_fp3, KT7900D_fp4, - KT7900D_fp5, KT7900D_fp6, KT7900D_fp7, KT7900D_fp8, QB25_fp, ] + KT7900D_fp5, KT7900D_fp6, KT7900D_fp7, KT7900D_fp8, KT7900D_fp9, + QB25_fp] # Clones - ALIASES = [SKT8900D, QB25, ] + ALIASES = [SKT8900D, QB25] @directory.register @@ -4150,7 +4111,7 @@ class KT5800(BTechColor): _vhf_range = (136000000, 175000000) _uhf_range = (400000000, 481000000) _magic = MSTRING_KT8900D - _fileid = [KT5800_fp, ] + _fileid = [KT5800_fp] @directory.register @@ -4189,6 +4150,24 @@ class DB25G(BTechColor): chirp_common.PowerLevel("Mid", watts=15), chirp_common.PowerLevel("Low", watts=5)] + def validate_memory(self, mem): + msgs = super().validate_memory(mem) + + _msg_duplex = 'Duplex must be "off" for this frequency' + _msg_offset = 'Only simplex or +5 MHz offset allowed on GMRS' + + if mem.freq in GMRS_FREQS3: + if mem.duplex and mem.offset != 5000000: + msgs.append(chirp_common.ValidationWarning(_msg_offset)) + if mem.duplex and mem.duplex != "+": + msgs.append(chirp_common.ValidationWarning(_msg_offset)) + + return msgs + + def check_set_memory_immutable_policy(self, existing, new): + existing.immutable = [] + super().check_set_memory_immutable_policy(existing, new) + @classmethod def match_model(cls, filedata, filename): # This model is only ever matched via metadata @@ -4356,71 +4335,12 @@ struct { u8 unknown[2]; } fm_radio_preset[16]; -#seekto 0x3200; -struct { - u8 tmr; - u8 unknown1; - u8 sql; - u8 unknown2; - u8 autolk; - u8 tot; - u8 apo; - u8 unknown3; - u8 abr; - u8 beep; - u8 unknown4[4]; - u8 dtmfst; - u8 unknown5[2]; - u8 screv; - u8 unknown6[2]; - u8 pttid; - u8 pttlt; - u8 unknown7; - u8 emctp; - u8 emcch; - u8 sigbp; - u8 unknown8; - u8 camdf; - u8 cbmdf; - u8 ccmdf; - u8 cdmdf; - u8 langua; - u8 sync; - - - u8 stfc; - u8 mffc; - u8 sfafc; - u8 sfbfc; - u8 sfcfc; - u8 sfdfc; - u8 subfc; - u8 fmfc; - u8 sigfc; - u8 modfc; - u8 menufc; - u8 txfc; - u8 txdisp; - u8 unknown9[5]; - u8 anil; - u8 reps; - u8 repm; - u8 tmrmr; - u8 ste; - u8 rpste; - u8 rptdl; - u8 dtmfg; - u8 mgain; - u8 skiptx; - u8 scmode; - u8 tmrtx; -} settings; - #seekto 0x3280; struct { u8 unknown1; u8 vfomr; - u8 keylock; + u8 unused3281:7, + keylock:1; u8 unknown2; u8 unknown3:4, vfomren:1, @@ -4451,7 +4371,8 @@ struct settings_vfo { u8 scode; u8 spmute; u8 optsig; - u8 scramble; + u8 unused1:7, + scramble:1; u8 wide; u8 power; u8 shiftd; @@ -4498,6 +4419,139 @@ struct { """ +GMRS_ORIG_MEM_FORMAT = """ +#seekto 0x3200; +struct { + u8 tmr; + u8 unknown1; + u8 sql; + u8 unknown2; + u8 unused3204:7, + autolk:1; + u8 tot; + u8 apo; + u8 unknown3; + u8 abr; + u8 unused3209:7, + beep:1; + u8 unknown4[4]; + u8 dtmfst; + u8 unknown5[2]; + u8 screv; + u8 unknown6[2]; + u8 pttid; + u8 pttlt; + u8 unknown7; + u8 emctp; + u8 emcch; + u8 unusedE19:7, + sigbp:1; + u8 vox; + u8 camdf; + u8 cbmdf; + u8 ccmdf; + u8 cdmdf; + u8 langua; + u8 sync; + u8 stfc; + u8 mffc; + u8 sfafc; + u8 sfbfc; + u8 sfcfc; + u8 sfdfc; + u8 subfc; + u8 fmfc; + u8 sigfc; + u8 modfc; + u8 menufc; + u8 txfc; + u8 txdisp; + u8 unknown9[5]; + u8 anil; + u8 reps; + u8 repm; + u8 tmrmr; + u8 unusedE37:7, + ste:1; + u8 rpste; + u8 rptdl; + u8 dtmfg; + u8 mgain; + u8 skiptx; + u8 scmode; + u8 tmrtx; + u8 unknown10; + u8 earpho; +} settings; +""" + + +GMRS_V2_MEM_FORMAT = """ +#seekto 0x3200; +struct { + u8 tmr; + u8 unknown1; + u8 sql; + u8 unknown2; + u8 unused3204:7, + autolk:1; + u8 tot; + u8 apo; + u8 unknown3; + u8 abr; + u8 unused3209:7, + beep:1; + u8 unknown4[4]; + u8 dtmfst; + u8 unknown5[2]; + u8 screv; + u8 unknown6[2]; + u8 pttid; + u8 pttlt; + u8 unknown7; + u8 emctp; + u8 emcch; + u8 unusedE19:7, + sigbp:1; + u8 unknown8; // vox + u8 camdf; + u8 cbmdf; + u8 ccmdf; + u8 cdmdf; + u8 vox; // langua + u8 sync; + u8 stfc; + u8 mffc; + u8 sfafc; + u8 sfbfc; + u8 sfcfc; + u8 sfdfc; + u8 subfc; + u8 fmfc; + u8 sigfc; + u8 modfc; + u8 menufc; + u8 txfc; + u8 unknown9[5]; + u8 anil; + u8 reps; + u8 repm; + u8 tmrmr; + u8 unusedE37:7, + ste:1; + u8 rpste; + u8 rptdl; + u8 dtmfg; + u8 mgain; + u8 skiptx; + u8 scmode; + u8 tmrtx; + u8 unknown10[2]; + u8 earpho; +} settings; +""" + + class BTechGMRS(BTechMobileCommon): """BTECH's GMRS Mobile""" COLOR_LCD = True @@ -4509,7 +4563,8 @@ class BTechGMRS(BTechMobileCommon): """Process the mem map into the mem object""" # Get it - self._memobj = bitwise.parse(GMRS_MEM_FORMAT, self._mmap) + mem_format = GMRS_MEM_FORMAT + GMRS_ORIG_MEM_FORMAT + self._memobj = bitwise.parse(mem_format, self._mmap) # load specific parameters from the radio image self.set_options() @@ -4549,9 +4604,77 @@ class GMRS50X1(BTechGMRS): _uhf_range = (400000000, 521000000) _upper = 255 _magic = MSTRING_GMRS50X1 - _fileid = [GMRS50X1_fp1, GMRS50X1_fp, ] + _fileid = [GMRS50X1_fp1, GMRS50X1_fp] _gmrs = True + def validate_memory(self, mem): + msgs = super().validate_memory(mem) + + _msg_duplex = 'Duplex must be "off" for this frequency' + _msg_offset = 'Only simplex or +5 MHz offset allowed on GMRS' + + if not (mem.number >= 1 and mem.number <= 30): + if mem.duplex != "off": + msgs.append(chirp_common.ValidationWarning(_msg_duplex)) + + return msgs + + def check_set_memory_immutable_policy(self, existing, new): + if not (new.number >= 1 and new.number <= 30): + existing.immutable = [] + super().check_set_memory_immutable_policy(existing, new) + + +@directory.register +class GMRS50V2(BTechGMRS): + """Baofeng Tech GMRS50V2""" + MODEL = "GMRS-50V2" + BANDS = 2 + LIST_TMR = LIST_TMR16 + _power_levels = [chirp_common.PowerLevel("High", watts=50), + chirp_common.PowerLevel("Mid", watts=10), + chirp_common.PowerLevel("Low", watts=5)] + _vhf_range = (136000000, 175000000) + _uhf_range = (400000000, 521000000) + _upper = 255 + _magic = MSTRING_GMRS50X1 + _fileid = [GMRS50X1_fp1, GMRS50X1_fp] + _gmrs = True + + def process_mmap(self): + """Process the mem map into the mem object""" + + # Get it + mem_format = GMRS_MEM_FORMAT + GMRS_V2_MEM_FORMAT + self._memobj = bitwise.parse(mem_format, self._mmap) + + # load specific parameters from the radio image + self.set_options() + + def validate_memory(self, mem): + msgs = super().validate_memory(mem) + + _msg_duplex = 'Duplex must be "off" for this frequency' + _msg_offset = 'Only simplex or +5 MHz offset allowed on GMRS' + + if mem.freq not in GMRS_FREQS: + if mem.duplex != "off": + msgs.append(chirp_common.ValidationWarning(_msg_duplex)) + elif mem.duplex: + if mem.duplex and mem.offset != 5000000: + msgs.append(chirp_common.ValidationWarning(_msg_offset)) + + return msgs + + def check_set_memory_immutable_policy(self, existing, new): + existing.immutable = [] + super().check_set_memory_immutable_policy(existing, new) + + @classmethod + def match_model(cls, filedata, filename): + # This model is only ever matched via metadata + return False + COLORHT_MEM_FORMAT = """ #seekto 0x0000; @@ -4585,13 +4708,17 @@ struct { u8 sql; u8 unknownE03[2]; u8 tot; - u8 save; + u8 unusedE06:7, + save:1; u8 unknownE07; u8 abr; - u8 beep; + u8 unusedE09:7, + beep:1; u8 unknownE0A[4]; - u8 dsub; - u8 dtmfst; + u8 unusedE0E:7, + dsub:1; + u8 unusedE0F:7, + dtmfst:1; u8 screv; u8 unknownE11[3]; u8 pttid; @@ -4600,7 +4727,8 @@ struct { u8 unknownE17; u8 emctp; u8 emcch; - u8 sigbp; + u8 unusedE1A:7, + sigbp:1; u8 unknownE1B; u8 camdf; u8 cbmdf; @@ -4628,7 +4756,8 @@ struct { u8 anil; u8 reps; u8 tmrmr; - u8 ste; + u8 unusedE39:7, + ste:1; u8 rpste; u8 rptdl; u8 dtmfg; @@ -4639,7 +4768,8 @@ struct { struct { u8 unknown1; u8 vfomr; - u8 keylock; + u8 unusedE82:7, + keylock:1; u8 unknown2; u8 unknown3:4, vfomren:1, @@ -4670,7 +4800,8 @@ struct settings_vfo { u8 scode; u8 spmute; u8 optsig; - u8 scramble; + u8 unused1:7, + scramble:1; u8 wide; u8 power; u8 shiftd; @@ -4880,12 +5011,12 @@ class QYTColorHT(BTechMobileCommon): # the additional bands if self.MODEL in ["KT-8R"]: - # 200Mhz band + # 200 MHz band vhf2 = _decode_ranges(ranges.vhf2_low, ranges.vhf2_high) LOG.info("Radio ranges: VHF(220) %d to %d" % vhf2) self._220_range = vhf2 - # 350Mhz band + # 350 MHz band uhf2 = _decode_ranges(ranges.uhf2_low, ranges.uhf2_high) LOG.info("Radio ranges: UHF(350) %d to %d" % uhf2) self._350_range = uhf2 @@ -4908,7 +5039,7 @@ class KT8R(QYTColorHT): _uhf_range = (400000000, 481000000) _350_range = (350000000, 391000000) _magic = MSTRING_KT8R - _fileid = [KT8R_fp2, KT8R_fp1, KT8R_fp, ] + _fileid = [KT8R_fp2, KT8R_fp1, KT8R_fp] _power_levels = [chirp_common.PowerLevel("High", watts=5), chirp_common.PowerLevel("Low", watts=1)] @@ -4948,10 +5079,13 @@ struct { u8 volume; u8 unknown3; u8 abr; - u8 beep; + u8 unusedE09:7, + beep:1; u8 unknown4[4]; - u8 dsub; - u8 dtmfst; + u8 unusedE0E:7, + dsub:1; + u8 unusedE0F:7, + dtmfst:1; u8 unknown_e10; u8 unknown_e11; u8 screv; @@ -4962,7 +5096,8 @@ struct { u8 unknown7; u8 emctp; u8 emcch; - u8 sigbp; + u8 unusedE1A:7, + sigbp:1; u8 unknown8; u8 camdf; u8 cbmdf; @@ -4971,7 +5106,8 @@ struct { u8 tmrtx; u8 vox; u8 voxt; - u8 autolock; + u8 unusedE23:7, + autolock:1; u8 asfc; u8 mainfc; u8 a_fc; @@ -4989,7 +5125,8 @@ struct { u8 anil; u8 reps; u8 tmrmr; - u8 ste; + u8 unusedE37:7, + ste:1; u8 rpste; u8 rptdl; u8 dtmfg; @@ -4999,7 +5136,8 @@ struct { struct { u8 unknown1; u8 vfomr; - u8 keylock; + u8 unusedE82:7, + keylock:1; u8 unknown2; u8 unknown3:4, vfomren:1, @@ -5030,7 +5168,8 @@ struct settings_vfo { u8 scode; u8 spmute; u8 optsig; - u8 scramble; + u8 unused1:7, + scramble:1; u8 wide; u8 power; u8 shiftd; @@ -5249,14 +5388,17 @@ struct { u8 unknown1; u8 sql; u8 unknown2; - u8 autolock; + u8 unusedE04:7, + autolock:1; u8 tot; u8 apo; u8 unknown3; u8 abr; - u8 beep; + u8 unusedE09:7, + beep:1; u8 unknown4[4]; - u8 dtmfst; + u8 unusedE0E:7, + dtmfst:1; u8 unknown5[2]; u8 screv; u8 unknown6[2]; @@ -5265,7 +5407,8 @@ struct { u8 unknown7; u8 emctp; u8 emcch; - u8 sigbp; + u8 unusedE19:7, + sigbp:1; u8 unknown8; u8 camdf; u8 cbmdf; @@ -5285,13 +5428,15 @@ struct { u8 txfc; u8 rxfc; u8 repsw; - u8 dsub; + u8 unusedE2D:7, + dsub:1; u8 unknown9[5]; u8 anil; u8 reps; u8 repm; u8 tmrmr; - u8 ste; + u8 unusedE37:7, + ste:1; u8 rpste; u8 rptdl; u8 dtmfg; @@ -5301,14 +5446,16 @@ struct { u8 tmrtx; u8 volume; u8 unknown_10; - u8 save; + u8 unusedE41:7, + save:1; } settings; #seekto 0x0E80; struct { u8 unknown1; u8 vfomr; - u8 keylock; + u8 unusedE82:7, + keylock:1; u8 unknown2; u8 unknown3:4, vfomren:1, @@ -5339,7 +5486,8 @@ struct settings_vfo { u8 scode; u8 spmute; u8 optsig; - u8 scramble; + u8 unused1:7, + scramble:1; u8 wide; u8 power; u8 shiftd; @@ -5567,7 +5715,7 @@ class KTWP12(BTechColorWP): chirp_common.PowerLevel("Low", watts=5)] _upper = 199 _magic = MSTRING_KTWP12 - _fileid = [KTWP12_fp, ] + _fileid = [KTWP12_fp] _gmrs = False def process_mmap(self): @@ -5591,7 +5739,7 @@ class WP9900(BTechColorWP): chirp_common.PowerLevel("Low", watts=5)] _upper = 199 _magic = MSTRING_KTWP12 - _fileid = [WP9900_fp, ] + _fileid = [WP9900_fp] _gmrs = False def process_mmap(self): @@ -5615,9 +5763,28 @@ class GMRS20V2(BTechColorWP): chirp_common.PowerLevel("Low", watts=5)] _upper = 199 _magic = MSTRING_GMRS20V2 - _fileid = [GMRS20V2_fp2, GMRS20V2_fp1, GMRS20V2_fp, ] + _fileid = [GMRS20V2_fp2, GMRS20V2_fp1, GMRS20V2_fp] _gmrs = True + def validate_memory(self, mem): + msgs = super().validate_memory(mem) + + _msg_duplex = 'Duplex must be "off" for this frequency' + _msg_offset = 'Only simplex or +5 MHz offset allowed on GMRS' + + if mem.freq not in GMRS_FREQS: + if mem.duplex != "off": + msgs.append(chirp_common.ValidationWarning(_msg_duplex)) + elif mem.duplex: + if mem.duplex and mem.offset != 5000000: + msgs.append(chirp_common.ValidationWarning(_msg_offset)) + + return msgs + + def check_set_memory_immutable_policy(self, existing, new): + existing.immutable = [] + super().check_set_memory_immutable_policy(existing, new) + def process_mmap(self): """Process the mem map into the mem object""" diff --git a/chirp/drivers/fake.py b/chirp/drivers/fake.py index e03eea0..0872ae9 100644 --- a/chirp/drivers/fake.py +++ b/chirp/drivers/fake.py @@ -17,23 +17,36 @@ class FakeLiveRadio(chirp_common.LiveRadio): super().__init__(*a, **k) self.settings = {'knob': 5} self.memories = [] - for i in range (1, 11): + for i in range(1, 12): m = chirp_common.Memory(i, empty=i > 5, name='channel %i' % i) m.freq = 146520000 self.memories.append(m) + self.memories[-1].extd_number = 'Special' def get_features(self): rf = chirp_common.RadioFeatures() rf.memory_bounds = (1, 10) rf.has_settings = True + # We don't even implement this interface, but the point of this + # is to make sure the GUI doesn't choke on live radios. + rf.has_bank = True + rf.valid_name_length = 8 + rf.valid_characters = chirp_common.CHARSET_ASCII + rf.valid_special_chans = ['Special'] return rf def get_memory(self, number): - return self.memories[number - 1] + if number == 'Special': + number = len(self.memories) + m = self.memories[number - 1] + if isinstance(m, chirp_common.Memory) and m.number != number: + LOG.error('fake driver found %i instead of %i', + m.number, number) + return m def set_memory(self, mem): LOG.info('Set memory %s' % mem) - self.memories[mem.number - 1] = mem + self.memories[mem.number - 1] = mem.dupe() def get_settings(self): g = settings.RadioSettingGroup('top', 'Some Settings') @@ -83,18 +96,59 @@ class FakeLiveRadioWithErrors(FakeLiveRadio): def get_memory(self, number): m = super().get_memory(number) if isinstance(m, type): - raise m('Error') + raise m('Error getting %i' % number) else: return m def set_memory(self, mem): - if mem.freq < 145000000: + if not mem.empty and mem.freq < 145000000: raise errors.RadioError('Out of range') else: return super().set_memory(mem) +class FakeCloneFail(chirp_common.CloneModeRadio): + VENDOR = 'CHIRP' + MODEL = 'Fake Clone Radio' + VARIANT = 'Errors' + + def sync_in(self): + s = chirp_common.Status() + s.max = 100 + s.cur = 10 + s.msg = 'Gonna fail...' + self.status_fn(s) + raise errors.RadioError('This always fails') + + +class FakeKenwoodSerial: + def __init__(self, *a, **k): + self._rbuf = b'' + + def write(self, buffer): + LOG.debug('Write: %r' % buffer) + if buffer.startswith(b'ID'): + self._rbuf += b'ID TH-F7\r' + elif buffer.startswith(b'MR 0,001'): + self._rbuf += \ + b'MR 0,001,00146520000,0,0,0,0,0,0,00,00,000,000000000,0,0\r' + elif buffer.startswith(b'MNA 001\r'): + self._rbuf += b'MNA 001,Foo\r' + elif buffer.startswith(b'MNA 0'): + self._rbuf += buffer + elif buffer.startswith(b'MW 0'): + self._rbuf += b'MW\r' + else: + self._rbuf += b'N\r' + + def read(self, n): + ret = self._rbuf[:n] + self._rbuf = self._rbuf[n:] + return ret + + def register_fakes(): directory.register(FakeLiveRadio) directory.register(FakeLiveSlowRadio) directory.register(FakeLiveRadioWithErrors) + directory.register(FakeCloneFail) diff --git a/chirp/drivers/fd268.py b/chirp/drivers/fd268.py index 7d4f726..5d73d5f 100644 --- a/chirp/drivers/fd268.py +++ b/chirp/drivers/fd268.py @@ -14,11 +14,9 @@ # along with this program. If not, see . import struct -import os import logging from chirp import chirp_common, directory, memmap, errors, util, bitwise -from textwrap import dedent from chirp.settings import RadioSettingGroup, RadioSetting, \ RadioSettingValueBoolean, RadioSettingValueList, \ RadioSettingValueString, RadioSettings @@ -179,7 +177,7 @@ def do_magic(radio): status.msg = "Linking to radio, please wait." radio.status_fn(status) - # every byte of this magic chain must be send separatedly + # every byte of this magic chain must be send separately magic = "\x02PROGRA" # start the fun, finger crossed please... @@ -280,13 +278,7 @@ def model_match(cls, data): # bytes it's like the model fingerprint, so we have to testing the # model type with this experimental method so far. fp = data[0:4] - if fp == cls._IDENT: - return True - else: - LOG.debug("Unknowd Feidaxing radio, ID:") - LOG.debug(util.hexprint(fp)) - - return False + return fp == cls._IDENT class FeidaxinFD2x8yRadio(chirp_common.CloneModeRadio): @@ -306,24 +298,18 @@ class FeidaxinFD2x8yRadio(chirp_common.CloneModeRadio): rp.experimental = \ ('The program mode of this radio has his tricks, ' 'so this driver is *completely experimental*.') - rp.pre_download = _(dedent("""\ - This radio has a tricky way of enter into program mode, - even the original software has a few tries to get inside. - - I will try 8 times (most of the time ~3 will doit) and this - can take a few seconds, if don't work, try again a few times. - - If you can get into it, please check the radio and cable. - """)) - rp.pre_upload = _(dedent("""\ - This radio has a tricky way of enter into program mode, - even the original software has a few tries to get inside. - - I will try 8 times (most of the time ~3 will doit) and this - can take a few seconds, if don't work, try again a few times. - - If you can get into it, please check the radio and cable. - """)) + rp.pre_download = _( + "This radio has a tricky way of enter into program mode,\n" + "even the original software has a few tries to get inside.\n" + "I will try 8 times (most of the time ~3 will doit) and this\n" + "can take a few seconds, if don't work, try again a few times.\n" + "If you can get into it, please check the radio and cable.\n") + rp.pre_upload = _( + "This radio has a tricky way of enter into program mode,\n" + "even the original software has a few tries to get inside.\n" + "I will try 8 times (most of the time ~3 will doit) and this\n" + "can take a few seconds, if don't work, try again a few times.\n" + "If you can get into it, please check the radio and cable.\n") return rp def get_features(self): @@ -598,7 +584,7 @@ class FeidaxinFD2x8yRadio(chirp_common.CloneModeRadio): # preparing for callback on vrxfreq (handled also in a special ) vf_freq = RadioSetting("none.vrx_freq", "VFO frequency", RadioSettingValueString(0, 10, chirp_common. - format_freq(vfo))) + format_freq(vfo))) vf_freq.set_apply_callback(apply_freq, _mem.vfo.vrx_freq) work.append(vf_freq) @@ -625,7 +611,7 @@ class FeidaxinFD2x8yRadio(chirp_common.CloneModeRadio): offset = RadioSetting("none.vfo_shift", "VFO Offset", RadioSettingValueString(0, 9, chirp_common. - format_freq(vfo_shift))) + format_freq(vfo_shift))) work.append(offset) step = RadioSetting("settings", "VFO step", @@ -646,7 +632,7 @@ class FeidaxinFD2x8yRadio(chirp_common.CloneModeRadio): ani_value = "200" ani_value = "".join(x for x in ani_value if (int(x) >= 2 and - int(x) <= 9)) + int(x) <= 9)) ani = RadioSetting("ani", "ANI (200-999)", RadioSettingValueString(0, 3, ani_value)) @@ -772,7 +758,7 @@ class FeidaxinFD2x8yRadio(chirp_common.CloneModeRadio): try: element.run_apply_callback() continue - except NotImplementedError as e: + except NotImplementedError: raise elif sett == "none": @@ -790,11 +776,11 @@ class FeidaxinFD2x8yRadio(chirp_common.CloneModeRadio): obj = getattr(_mem, sett) setattr(obj, name, element.value) - except AttributeError as e: + except AttributeError: m = "Setting %s is not in this setting block" % name LOG.debug(m) - except Exception as e: + except Exception: LOG.debug(element.get_name()) raise diff --git a/chirp/drivers/ft1500m.py b/chirp/drivers/ft1500m.py index 3f12ff0..7fd215a 100644 --- a/chirp/drivers/ft1500m.py +++ b/chirp/drivers/ft1500m.py @@ -28,8 +28,7 @@ from chirp.drivers import yaesu_clone from chirp import chirp_common, bitwise, directory from chirp.settings import RadioSetting, RadioSettingGroup, \ - RadioSettingValueBoolean, RadioSettings -from textwrap import dedent + RadioSettingValueBoolean MEM_FORMAT = """ #seekto 0x002a; @@ -93,18 +92,20 @@ class FT1500Radio(yaesu_clone.YaesuCloneModeRadio): @classmethod def get_prompts(cls): rp = chirp_common.RadioPrompts() - rp.pre_download = _(dedent("""\ -1. Turn radio off. -2. Connect cable to mic jack. -3. Press and hold in the [MHz], [LOW], and [D/MR] keys - while turning the radio on. -4. After clicking OK, press the [MHz(SET)] key to send image.""")) - rp.pre_upload = _(dedent("""\ -1. Turn radio off. -2. Connect cable to mic jack. -3. Press and hold in the [MHz], [LOW], and [D/MR] keys - while turning the radio on. -4. Press the [D/MR(MW)] key ("--WAIT--" will appear on the LCD).""")) + rp.pre_download = _( + "1. Turn radio off.\n" + "2. Connect cable to mic jack.\n" + "3. Press and hold in the [MHz], [LOW], and [D/MR] keys\n" + " while turning the radio on.\n" + "4. After clicking OK, press the [MHz(SET)] key to send" + " image.\n") + rp.pre_upload = _( + "1. Turn radio off.\n" + "2. Connect cable to mic jack.\n" + "3. Press and hold in the [MHz], [LOW], and [D/MR] keys\n" + " while turning the radio on.\n" + "4. Press the [D/MR(MW)] key (\"--WAIT--\" will appear on the" + " LCD).\n") return rp def get_features(self): diff --git a/chirp/drivers/ft1802.py b/chirp/drivers/ft1802.py index bad0863..e1d55d6 100644 --- a/chirp/drivers/ft1802.py +++ b/chirp/drivers/ft1802.py @@ -26,8 +26,7 @@ from chirp.drivers import yaesu_clone from chirp import chirp_common, bitwise, directory from chirp.settings import RadioSetting, RadioSettingGroup, \ - RadioSettingValueBoolean, RadioSettings -from textwrap import dedent + RadioSettingValueBoolean MEM_FORMAT = """ #seekto 0x06ea; @@ -86,23 +85,27 @@ class FT1802Radio(yaesu_clone.YaesuCloneModeRadio): MODEL = "FT-1802M" BAUD_RATE = 19200 - _model = "AH023" + _model = b"AH023" _block_lengths = [10, 8001] _memsize = 8011 @classmethod def get_prompts(cls): rp = chirp_common.RadioPrompts() - rp.pre_download = _(dedent("""\ -1. Turn radio off. -2. Connect cable to mic jack. -3. Press and hold in the [LOW(A/N)] key while turning the radio on. -4. After clicking OK, press the [MHz(SET)] key to send image.""")) - rp.pre_upload = _(dedent("""\ -1. Turn radio off. -2. Connect cable to mic jack. -3. Press and hold in the [LOW(A/N)] key while turning the radio on. -4. Press the [D/MR(MW)] key ("--WAIT--" will appear on the LCD).""")) + rp.pre_download = _( + "1. Turn radio off.\n" + "2. Connect cable to mic jack.\n" + "3. Press and hold in the [LOW(A/N)] key while turning the radio" + " on.\n" + "4. After clicking OK, press the [MHz(SET)] key to send" + " image.\n") + rp.pre_upload = _( + "1. Turn radio off.\n" + "2. Connect cable to mic jack.\n" + "3. Press and hold in the [LOW(A/N)] key while turning the radio" + " on.\n" + "4. Press the [D/MR(MW)] key (\"--WAIT--\" will appear on the" + " LCD).\n") return rp def get_features(self): diff --git a/chirp/drivers/ft1d.py b/chirp/drivers/ft1d.py index 9f325e6..1cd77c6 100644 --- a/chirp/drivers/ft1d.py +++ b/chirp/drivers/ft1d.py @@ -1,5 +1,8 @@ # Copyright 2010 Dan Smith # Copyright 2014 Angus Ainslie +# Copyright 2023 Declan Rieb +# Sections of digital settings applied from ft70.py, thus +# Copyright 2017 Nicolas Pike # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -20,11 +23,12 @@ import logging from chirp.drivers import yaesu_clone from chirp import chirp_common, directory, bitwise +from chirp import memmap from chirp.settings import RadioSettingGroup, RadioSetting, RadioSettings, \ RadioSettingValueInteger, RadioSettingValueString, \ RadioSettingValueList, RadioSettingValueBoolean, \ InvalidValueError -from textwrap import dedent +from chirp import util LOG = logging.getLogger(__name__) @@ -42,30 +46,50 @@ struct { #seekto 0x04ce; struct { - u8 lcd_dimmer; - u8 dtmf_delay; + u8 lcd_dimmer; // 14 DIMMER + u8 dtmf_delay; // 18 DT DLY u8 unknown0[3]; u8 unknown1:4 lcd_contrast:4; - u8 lamp; - u8 unknown2[7]; - u8 scan_restart; + u8 lamp; // 28 LAMP + u8 lock; // 30 LOCK + u8 unknown2; + u8 mic_gain; // 31 MCGAIN + u8 unknown2_3; + u8 dw_interval; // 21 DW INT + u8 ptt_delay; // 42 PTT.DLY + u8 rx_save; // 48 RX.SAVE + u8 scan_restart; // 53 SCN.STR u8 unknown3; u8 scan_resume; u8 unknown4[5]; u8 tot; u8 unknown5[3]; - u8 unknown6:2, - scan_lamp:1, - unknown7:2, - dtmf_speed:1, + u8 vfo_mode:1, // 60 VFO.MOD + unknown6:1, + scan_lamp:1, // 51 SCN.LMP + unknown7:1, + ars:1, // 45 RPT.ARS + dtmf_speed:1, // 20 DT SPD unknown8:1, dtmf_mode:1; u8 busy_led:1, - unknown9:7; - u8 unknown10[2]; + unknown9:2, + bclo:1, // 03 BCLO + beep_edge:1 // 06 BEP.EDG + unknown9_1:3; + u8 unknown10:5, + password:1, + home_rev:1, // 26 HOME/REV + moni:1; // 32 MON/T-Call + u8 gm_interval:4, // 25 GM INT + unknown11:4; u8 vol_mode:1, - unknown11:7; + unknown11_1:7; + u8 unknown12:4, + home_vfo:1, // 27 HOME->VFO + unknown12_1:2, + dw_rt:1; // 23 DW RVT; } scan_settings; #seekto 0x064a; @@ -122,7 +146,7 @@ struct { } message; } opening_message; -#seekto 0x%04X; // FT-1D:0e4a, FT2D:094a +#seekto 0x%(dtmadd)04X; // FT-1D:0e4a, FT2D:094a struct { u8 memory[16]; } dtmf[10]; @@ -154,37 +178,51 @@ struct { """ MEM_FORMAT = """ -#seekto 0x2D4A; -struct { +struct memslot { u8 unknown0:2, mode_alt:1, // mode for FTM-3200D - unknown1:5; + clock_shift:1, + unknown1:4; u8 mode:2, duplex:2, tune_step:4; bbcd freq[3]; u8 power:2, - unknown2:2, + digmode:2, // 0=Analog, 1=AMS, 2=DN, 3=VW tone_mode:4; - u8 charsetbits[2]; + u16 charsetbits; char label[16]; bbcd offset[3]; u8 unknown5:2, tone:6; u8 unknown6:1, dcs:7; - u8 unknown7[3]; -} memory[%d]; + u16 unknown7; + u8 unknown8:2, + att:1, + autostep:1, + automode:1, + unknown9:3; +}; +#seekto 0x2D4A; +struct memslot memory[%(memnum)d]; +struct memslot Skip[99]; +struct memslot PMS[100]; +#seekto 0x10ca; +struct memslot Home[11]; -#seekto 0x280A; -struct { +struct flagslot { u8 nosubvfo:1, unknown:3, pskip:1, skip:1, used:1, valid:1; -} flag[%d]; +}; +#seekto 0x280A; +struct flagslot flag[%(memnum)d]; +struct flagslot flagskp[99]; +struct flagslot flagPMS[100]; """ MEM_APRS_FORMAT = """ @@ -311,7 +349,7 @@ struct { char padded_string[60]; } aprs_beacon_status_txt[5]; -#seekto 0x%04X; +#seekto 0xFECA; struct { bbcd date[3]; bbcd time[2]; @@ -331,16 +369,16 @@ struct { u16 unknown8; u16 unknown9; u16 unknown10; -} aprs_beacon_meta[%d]; +} aprs_beacon_meta[60]; -#seekto 0x%04X; +#seekto 0x1064A; struct { char dst_callsign[9]; char path[30]; u16 flags; u8 separator; - char body[%d]; -} aprs_beacon_pkt[%d]; + char body[134]; +} aprs_beacon_pkt[60]; #seekto 0x137c4; struct { @@ -376,6 +414,99 @@ struct { } backtrack[3]; """ + +MEM_GM_FORMAT = """ +#seekto 0x04ba; +struct { + u8 unknown:3, + scan_resume:5; // 52 SCN.RSM + u8 unknown1:3, + dw_resume_interval:5; // 22 DW RSM + u8 unknown2; + u8 unknown3:3, + apo:5; // 02 APO + u8 unknown4:6, + gm_ring:2; // 24 GM RNG + u8 temp_cf; // Placeholder as not found + u8 unknown5; + } first_settings; + +#seekto 0x04ed; +struct { + u8 unknown1:1, + unknown2:1, + unknown3:1, + unknown4:1, + unknown5:1, + unknown6:1, + unknown7:1, + unknown8:1; + } test_bit_field; + +#seekto 0x04c0; +struct { + u8 unknown1:5, + beep_level:3; // 05 BEP.LVL + u8 unknown2:6, + beep_select:2; // 04 BEEP + } beep_settings; + +#seekto 0xCF30; +struct { + u8 unknown0; + u8 unknown1; + u8 unknown2; + u8 unknown3; + u8 unknown4; + u8 unknown5; + u8 unknown6; + u8 digital_popup; // 15 DIG.POP + } digital_settings_more; + +#seekto 0xCF7C; +struct { + u8 unknown0:6, + ams_tx_mode:2; // AMS TX Mode + u8 unknown1; + u8 unknown2:7, + standby_beep:1; // 07 BEP.STB + u8 unknown3; + u8 unknown4:6, + gm_ring:2; // 24 GM RNG + u8 unknown5; + u8 rx_dg_id; // RX DG-ID + u8 tx_dg_id; // TX DG-ID + u8 unknown6:7, + vw_mode:1; // 16 DIG VW + u8 unknown7; + } digital_settings; + +#seekto 0x1d6d3; +struct { + char message[32]; + } GM[10]; + +#seekto 0x0ced0; +struct { + char callsign[10]; // 63 MYCALL + u16 charset; // character set ID + } my_call; + +#seekto 0x1ddca; +struct { + struct { + char name[16]; + } Category[5]; + struct { + struct { + char ID[5]; // ASCII numerals + char name[16]; // blank-fill + u8 unknown[3]; + } Rooms[20]; + } RoomsPerCategory[5]; +} WiresX_settings; +""" + MEM_CHECKSUM_FORMAT = """ #seekto 0x1FDC9; u8 checksum; @@ -401,6 +532,31 @@ POWER_LEVELS = [chirp_common.PowerLevel("Hi", watts=5.00), chirp_common.PowerLevel("L3", watts=2.50), chirp_common.PowerLevel("L2", watts=1.00), chirp_common.PowerLevel("L1", watts=0.05)] +SKIPNAMES = ["Skip%i" % i for i in range(901, 1000)] +PMSNAMES = ["%s%i" % (c, i) for i in range(1, 51) for c in ['L', 'U']] +HOMENAMES = ["Home%i" % i for i in range(1, 12)] +ALLNAMES = SKIPNAMES + PMSNAMES + HOMENAMES +# list of (array name, (list of memories in that array)) +# array names must match names of memories defined for radio +SPECIALS = [ + ("Skip", SKIPNAMES), + ("PMS", PMSNAMES), + ("Home", HOMENAMES) +] +# Band edges are integer Hz. +VALID_BANDS = [ + (510000, 1790000), + (1800000, 50490000), + (50500000, 75990000), + (76000000, 107990000), + (108000000, 136990000), + (145000000, 169920000), + (174000000, 221950000), + (222000000, 419990000), + (420000000, 469990000), + (470000000, 773990000), + (810010000, 999000000) +] class FT1Bank(chirp_common.NamedBank): @@ -557,24 +713,24 @@ class FT1Radio(yaesu_clone.YaesuCloneModeRadio): VENDOR = "Yaesu" MODEL = "FT-1D" VARIANT = "R" - - _model = "AH44M" + FORMATS = [directory.register_format('FT1D ADMS-6', '*.ft1d')] + class_specials = SPECIALS + _model = b"AH44M" _memsize = 130507 _block_lengths = [10, 130497] _block_size = 32 - _mem_params = (0xe4a, # location of DTMF storage - 900, # size of memories array - 900, # size of flags array - 0xFECA, # APRS beacon metadata address. - 60, # Number of beacons stored. - 0x1064A, # APRS beacon content address. - 134, # Length of beacon data stored. - 60) # Number of beacons stored. + MAX_MEM_SLOT = 900 + _mem_params = { + "memnum": 900, # size of memories array + "flgnum": 900, # size of flags array + "dtmadd": 0xe4a, # location of DTMF storage + } _has_vibrate = False _has_af_dual = True + _adms_ext = '.ft1d' _SG_RE = re.compile(r"(?P[-+NESW]?)(?P[\d]+)[\s\.,]*" - "(?P[\d]*)[\s\']*(?P[\d]*)") + r"(?P[\d]*)[\s\']*(?P[\d]*)") _RX_BAUD = ("off", "1200 baud", "9600 baud") _TX_DELAY = ("100ms", "150ms", "200ms", "250ms", "300ms", @@ -642,34 +798,126 @@ class FT1Radio(yaesu_clone.YaesuCloneModeRadio): _NS_HEMI = ("N", "S") _WE_HEMI = ("W", "E") _APRS_HIGH_SPEED_MAX = 70 + _MIC_GAIN = ("Level %d" % i for i in range(1, 10)) + _AMS_TX_MODE = ("TX Auto", "TX DIGITAL", "TX FM") + _VW_MODE = ("On", "Off") + _DIG_POP_UP = ("Off", "2sec", "4sec", "6sec", "8sec", "10sec", + "20sec", "30sec", "60sec", "Continuous") + _STANDBY_BEEP = ("On", "Off") + _ON_OFF = ("On", "Off") + _TEMP_CF = ("Centigrade", "Fahrenheit") + _APO_SELECT = ("Off", "0.5H", "1.0H", "1.5H", "2.0H", "2.5H", + "3.0H", "3.5H", "4.0H", "4.5H", "5.0H", + "5.5H", "6.0H", "6.5H", "7.0H", "7.5H", "8.0H", + "8.5H", "9.0H", "9.5H", "10.0H", "10.5H", + "11.0H", "11.5H", "12.0H") + _MONI_TCALL = ("Monitor", "Tone-CALL") + _HOME_REV = ("Home", "Reverse") + _LOCK = ("KEY", "DIAL", "Key+Dial", "PTT", "Key+PTT", "Dial+PTT", "ALL") + _PTT_DELAY = ("Off", "20 ms", "50 ms", "100 ms", "200 ms") + _BEEP_LEVEL = ("Level %i" % i for i in range(1, 7)) + _SET_MODE = ("Level %i" % i for i in range(1, 8)) + _RX_SAVE = ("OFF", "0.2s", ".3s", ".4s", ".5s", ".6s", + ".7s", ".8s", ".9s", "1.0s", "1.5s", + "2.0s", "2.5s", "3.0s", "3.5s", "4.0s", "4.5s", + "5.0s", "5.5s", "6.0s", "6.5s", "7.0s", + "7.5s", "8.0s", "8.5s", "9.0s", "10.0s", "15s", + "20s", "25s", "30s", "35s", "40s", "45s", "50s", "55s", + "60s") + _VFO_MODE = ("ALL", "BAND") + _VFO_SCAN_MODE = ("BAND", "ALL") + _MEMORY_SCAN_MODE = ("BAND", "ALL") + + _SG_RE = re.compile(r"(?P[-+NESW]?)(?P[\d]+)[\s\.,]*" + "(?P[\d]*)[\s\']*(?P[\d]*)") + + _RX_BAUD = ("off", "1200 baud", "9600 baud") + _TX_DELAY = ("100ms", "150ms", "200ms", "250ms", "300ms", + "400ms", "500ms", "750ms", "1000ms") + _WIND_UNITS = ("m/s", "mph") + _RAIN_UNITS = ("mm", "inch") + _TEMP_UNITS = ("C", "F") + _ALT_UNITS = ("m", "ft") + _DIST_UNITS = ("km", "mile") + _POS_UNITS = ("dd.mmmm'", "dd mm'ss\"") + _SPEED_UNITS = ("km/h", "knot", "mph") + _TIME_SOURCE = ("manual", "GPS") + _TZ = ("-13:00", "-13:30", "-12:00", "-12:30", "-11:00", "-11:30", + "-10:00", "-10:30", "-09:00", "-09:30", "-08:00", "-08:30", + "-07:00", "-07:30", "-06:00", "-06:30", "-05:00", "-05:30", + "-04:00", "-04:30", "-03:00", "-03:30", "-02:00", "-02:30", + "-01:00", "-01:30", "-00:00", "-00:30", "+01:00", "+01:30", + "+02:00", "+02:30", "+03:00", "+03:30", "+04:00", "+04:30", + "+05:00", "+05:30", "+06:00", "+06:30", "+07:00", "+07:30", + "+08:00", "+08:30", "+09:00", "+09:30", "+10:00", "+10:30", + "+11:00", "+11:30") + _BEACON_TYPE = ("Off", "Interval", "SmartBeaconing") + _SMARTBEACON_PROFILE = ("Off", "Type 1", "Type 2", "Type 3") + _BEACON_INT = ("30s", "1m", "2m", "3m", "5m", "10m", "15m", + "20m", "30m", "60m") + _DIGI_PATHS = ("OFF", "WIDE1-1", "WIDE1-1, WIDE2-1", "Digi Path 4", + "Digi Path 5", "Digi Path 6", "Digi Path 7", "Digi Path 8") + _MSG_GROUP_NAMES = ("Message Group 1", "Message Group 2", + "Message Group 3", "Message Group 4", + "Message Group 5", "Message Group 6", + "Message Group 7", "Message Group 8") + _POSITIONS = ("GPS", "Manual Latitude/Longitude", + "Manual Latitude/Longitude", "P1", "P2", "P3", "P4", + "P5", "P6", "P7", "P8", "P9") + _FLASH = ("OFF", "2 seconds", "4 seconds", "6 seconds", "8 seconds", + "10 seconds", "20 seconds", "30 seconds", "60 seconds", + "CONTINUOUS", "every 2 seconds", "every 3 seconds", + "every 4 seconds", "every 5 seconds", "every 6 seconds", + "every 7 seconds", "every 8 seconds", "every 9 seconds", + "every 10 seconds", "every 20 seconds", "every 30 seconds", + "every 40 seconds", "every 50 seconds", "every minute", + "every 2 minutes", "every 3 minutes", "every 4 minutes", + "every 5 minutes", "every 6 minutes", "every 7 minutes", + "every 8 minutes", "every 9 minutes", "every 10 minutes") + _BEEP_SELECT = ("Off", "Key+Scan", "Key") + _SQUELCH = ["%d" % x for x in range(0, 16)] + _VOLUME = ["%d" % x for x in range(0, 33)] + _DG_ID = ["%d" % x for x in range(0, 100)] + _GM_RING = ("OFF", "IN RING", "AlWAYS") + _GM_INTERVAL = ("LONG", "NORMAL", "OFF") + + _MYCALL_CHR_SET = list(string.ascii_uppercase) + \ + list(string.digits) + ['-', '/'] + + @classmethod + def match_model(cls, filedata, filename): + if filename.endswith(cls._adms_ext): + return True + else: + return super().match_model(filedata, filename) @classmethod def get_prompts(cls): rp = chirp_common.RadioPrompts() - rp.pre_download = _(dedent("""\ - 1. Turn radio off. - 2. Connect cable to DATA terminal. - 3. Press and hold in the [F] key while turning the radio on - ("CLONE" will appear on the display). - 4. After clicking OK, press the [BAND] key to send image.""" - )) - rp.pre_upload = _(dedent("""\ - 1. Turn radio off. - 2. Connect cable to DATA terminal. - 3. Press and hold in the [F] key while turning the radio on - ("CLONE" will appear on the display). - 4. Press the [Dx] key ("-WAIT-" will appear on the LCD).""")) + rp.pre_download = _( + "1. Turn radio off.\n" + "2. Connect cable to DATA terminal.\n" + "3. Press and hold in the [F] key while turning the radio on\n" + " (\"CLONE\" will appear on the display).\n" + "4. After clicking OK, press the [BAND] key to send" + " image.\n") + rp.pre_upload = _( + "1. Turn radio off.\n" + "2. Connect cable to DATA terminal.\n" + "3. Press and hold in the [F] key while turning the radio on\n" + " (\"CLONE\" will appear on the display).\n" + "4. Press the [Dx] key (\"-WAIT-\" will appear on the LCD).\n") return rp def process_mmap(self): mem_format = MEM_SETTINGS_FORMAT + MEM_FORMAT + MEM_APRS_FORMAT + \ - MEM_BACKTRACK_FORMAT + MEM_CHECKSUM_FORMAT + MEM_BACKTRACK_FORMAT + MEM_GM_FORMAT + MEM_CHECKSUM_FORMAT self._memobj = bitwise.parse(mem_format % self._mem_params, self._mmap) def get_features(self): rf = chirp_common.RadioFeatures() rf.has_dtcs_polarity = False - rf.valid_modes = list(MODES) + rf.valid_modes = list(MODES) + ['NFM', 'DN'] rf.valid_tmodes = list(TMODES) rf.valid_duplexes = list(DUPLEX) rf.valid_tuning_steps = list(STEPS) @@ -683,6 +931,7 @@ class FT1Radio(yaesu_clone.YaesuCloneModeRadio): rf.has_ctone = False rf.has_bank_names = True rf.has_settings = True + rf.valid_special_chans = [name for s in SPECIALS for name in s[1]] return rf def get_raw_memory(self, number): @@ -698,7 +947,7 @@ class FT1Radio(yaesu_clone.YaesuCloneModeRadio): @staticmethod def _add_ff_pad(val, length): - return val.ljust(length, "\xFF")[:length] + return val.ljust(length, b"\xFF")[:length] @classmethod def _strip_ff_pads(cls, messages): @@ -707,57 +956,175 @@ class FT1Radio(yaesu_clone.YaesuCloneModeRadio): result.append(str(msg_text).rstrip("\xFF")) return result +# Called with a "memref" index to CHIRP memory (int or str) +# and optionally with a "extref" extended name. +# Find and return the corresponding memobj +# Returns: +# Corresponding radio memory object +# Corresponding radio alag structure (if any) +# index into the specific memory object structure (int) ndx +# overall index into memory & specials (int) num +# an indicator of the specific radio object structure (str) + def slotloc(self, memref, extref=None): + array = None + num = memref + ename = "" + mstr = isinstance(memref, str) + specials = ALLNAMES + extr = False + if extref is not None: + extr = extref in specials + if mstr or extr: # named special? + ename = memref + num = self.MAX_MEM_SLOT + 1 + # num = -1 + sname = memref if mstr else extref + # Find name of appropriate memory and index into that memory + for x in self.class_specials: + try: + ndx = x[1].index(sname) + array = x[0] + break + except Exception: + num += len(x[1]) + # num -= len(x[1]) + if array is None: + raise IndexError("Unknown special %s", memref) + num += ndx + # num -= ndx + elif memref > self.MAX_MEM_SLOT: # numbered special + ename = extref + ndx = memref - (self.MAX_MEM_SLOT + 1) + # Find name of appropriate memory and index into that memory + # But assumes specials are in reverse-quantity order + for x in self.class_specials: + if ndx < len(x[1]): + array = x[0] + break + ndx -= len(x[1]) + if array is None: + raise IndexError("Unknown memref number %s", memref) + else: + array = "memory" + ndx = memref - 1 + _flag = self._memobj.flag[ndx] + if array == "Skip": + _flag = self._memobj.flagskp[ndx] + elif array == "PMS": + _flag = self._memobj.flagPMS[ndx] + elif array == "Home": + _flag = None + _mem = getattr(self._memobj, array)[ndx] + return (_mem, _flag, ndx, num, array, ename) + + # Build CHIRP version (mem) of radio's memory (_mem) def get_memory(self, number): - flag = self._memobj.flag[number - 1] - _mem = self._memobj.memory[number - 1] - + _mem, _flag, ndx, num, array, ename = self.slotloc(number) mem = chirp_common.Memory() - mem.number = number - if not flag.used: - mem.empty = True - if not flag.valid: - mem.empty = True - return mem - mem.freq = chirp_common.fix_rounded_step(int(_mem.freq) * 1000) - mem.offset = int(_mem.offset) * 1000 - mem.rtone = mem.ctone = chirp_common.TONES[_mem.tone] - self._get_tmode(mem, _mem) - mem.duplex = DUPLEX[_mem.duplex] - if mem.duplex == "split": - mem.offset = chirp_common.fix_rounded_step(mem.offset) - mem.mode = self._decode_mode(_mem) - mem.dtcs = chirp_common.DTCS_CODES[_mem.dcs] - mem.tuning_step = STEPS[_mem.tune_step] - mem.power = self._decode_power_level(_mem) - mem.skip = flag.pskip and "P" or flag.skip and "S" or "" - - mem.name = self._decode_label(_mem) - + mem.number = num + if array == "Home": + mem.empty = False + mem.extd_number = ename + mem.name = self._decode_label(_mem) + mem.immutable += ["empty", "number", "extd_number", "skip"] + elif array != "memory": + mem.extd_number = ename + mem.immutable += ["name", "extd_number"] + else: + mem.name = self._decode_label(_mem) + + if _flag is not None: + mem.skip = _flag.pskip and "P" or _flag.skip and "S" or "" + mem.empty = False + if not _flag.used: + mem.empty = True + if not _flag.valid: + mem.empty = True + if mem.empty: + mem.freq = 0 + mem.offset = 0 + mem.duplex = "" + mem.power = POWER_LEVELS[0] + mem.mode = "FM" + mem.tuning_step = 0 + else: + mem.freq = chirp_common.fix_rounded_step(int(_mem.freq) * 1000) + mem.offset = int(_mem.offset) * 1000 + mem.rtone = mem.ctone = chirp_common.TONES[_mem.tone] + self._get_tmode(mem, _mem) + if mem.duplex is None: + mem.duplex = DUPLEX[""] + else: + mem.duplex = DUPLEX[_mem.duplex] + if mem.duplex == "split": + mem.offset = chirp_common.fix_rounded_step(mem.offset) + mem.mode = self._decode_mode(_mem) + mem.dtcs = chirp_common.DTCS_CODES[_mem.dcs] + mem.tuning_step = STEPS[_mem.tune_step] + mem.power = self._decode_power_level(_mem) + self._get_mem_extra(mem, _mem) return mem + def _get_mem_extra(self, mem, _mem): + mem.extra = RadioSettingGroup('Extra', 'extra') + + ams = _mem.digmode == 1 + rs = RadioSetting('ysf_ams', 'AMS mode', + RadioSettingValueBoolean(ams)) + mem.extra.append(rs) + + def _set_mem_extra(self, mem, _mem): + if 'ysf_ams' in mem.extra: + # We only set AMS if the memory mode is DN. If it is FM, + # then that takes precedence as "analog-only". + if mem.mode == 'DN': + orig = int(_mem.digmode) + _mem.digmode = int(mem.extra['ysf_ams'].value) and 1 or 2 + LOG.debug('Changed digmode from %i to %i' % ( + orig, _mem.digmode)) + def _decode_label(self, mem): charset = ''.join(CHARSET).ljust(256, '.') return str(mem.label).rstrip("\xFF").translate(charset) def _encode_label(self, mem): - label = "".join([chr(CHARSET.index(x)) for x in mem.name.rstrip()]) + label = "".join([chr(CHARSET.index(x)) + for x in mem.name.rstrip()]).encode() return self._add_ff_pad(label, 16) def _encode_charsetbits(self, mem): - # We only speak english here in chirpville - return [0x00, 0x00] + # We only speak English here in chirpville + return 0x0000 def _decode_power_level(self, mem): return POWER_LEVELS[3 - mem.power] def _encode_power_level(self, mem): - return 3 - POWER_LEVELS.index(mem.power) + if mem.power is None: + return 3 # Choose lowest power + else: + return 3 - POWER_LEVELS.index(mem.power) def _decode_mode(self, mem): - return MODES[mem.mode] + mode = MODES[mem.mode] + if mode == 'FM' and int(mem.digmode): + # DN mode is FM with a digital flag. Since digmode can be AMS or + # DN, either will be called 'DN' in chirp + return 'DN' + if mode == 'FM' and int(mem.mode_alt): + return 'NFM' + else: + return mode def _encode_mode(self, mem): - return MODES.index(mem.mode) + mode = mem.mode + if mode == 'NFM': + # Narrow is handled by a separate flag + mode = 'FM' + elif mode == 'DN': + # DN mode is FM with a digital flag + mode = 'FM' + return MODES.index(mode) def _get_tmode(self, mem, _mem): mem.tmode = TMODES[_mem.tone_mode] @@ -766,61 +1133,89 @@ class FT1Radio(yaesu_clone.YaesuCloneModeRadio): _mem.tone_mode = TMODES.index(mem.tmode) def _set_mode(self, _mem, mem): + _mem.mode_alt = mem.mode == 'NFM' + if mem.mode == 'DN' and int(_mem.digmode) == 0: + # If we are going to DN mode, default to AMS + LOG.debug('New mode DN, setting AMS') + if 'ysf_ams' not in mem.extra: + _mem.digmode = 1 + else: + # If we have the extra setting, use that, since it will be + # applied at the end of set_memory() and we want it to apply + # the right value. + mem.extra['ysf_ams'].value = True + elif mem.mode == 'FM' and int(_mem.digmode): + # If we are going back to FM, that means analog-only, so AMS + # is disabled + LOG.debug('New mode FM, disabling AMS') + _mem.digmode = 0 _mem.mode = self._encode_mode(mem) + bm = self.get_bank_model() + for bank in bm.get_memory_mappings(mem): + bm.remove_memory_from_mapping(mem, bank) def _debank(self, mem): bm = self.get_bank_model() for bank in bm.get_memory_mappings(mem): bm.remove_memory_from_mapping(mem, bank) + def validate_memory(self, mem): + # Only check the home registers for appropriate bands + msgs = super().validate_memory(mem) + ndx = mem.number - ALLNAMES.index("Home1") - self.MAX_MEM_SLOT - 1 + if 10 >= ndx >= 0: + f = VALID_BANDS[ndx] + if not(f[0] < mem.freq < f[1]): + msgs.append(chirp_common.ValidationError( + "Frequency outside of band for Home%2d" % + (ndx + 1))) + return msgs + + # Modify radio's memory (_mem) corresponding to CHIRP version at 'mem' def set_memory(self, mem): - _mem = self._memobj.memory[mem.number - 1] - flag = self._memobj.flag[mem.number - 1] - - self._debank(mem) - - if not mem.empty and not flag.valid: - self._wipe_memory(_mem) - - if mem.empty and flag.valid and not flag.used: - flag.valid = False - return - flag.used = not mem.empty - flag.valid = flag.used - + _mem, flag, ndx, num, regtype, ename = self.slotloc(mem.number, + mem.extd_number) if mem.empty: + self._wipe_memory(_mem) + if flag is not None: + flag.used = False return - - if mem.freq < 30000000 or \ - (mem.freq > 88000000 and mem.freq < 108000000) or \ - mem.freq > 580000000: - flag.nosubvfo = True # Masked from VFO B - else: - flag.nosubvfo = False # Available in both VFOs - - _mem.freq = int(mem.freq / 1000) - _mem.offset = int(mem.offset / 1000) + _mem.power = self._encode_power_level(mem) _mem.tone = chirp_common.TONES.index(mem.rtone) self._set_tmode(_mem, mem) - _mem.duplex = DUPLEX.index(mem.duplex) - self._set_mode(_mem, mem) _mem.dcs = chirp_common.DTCS_CODES.index(mem.dtcs) _mem.tune_step = STEPS.index(mem.tuning_step) - if mem.power: - _mem.power = self._encode_power_level(mem) + # duplex "off" is equivalent to "" and may show up in tox test. + if mem.duplex is None: + _mem.duplex = DUPLEX.index("") else: - _mem.power = 0 - + _mem.duplex = DUPLEX.index(mem.duplex) + self._set_mode(_mem, mem) + if flag is not None: + if mem.freq < 30000000 or \ + (mem.freq > 88000000 and mem.freq < 108000000) or \ + mem.freq > 580000000: + flag.nosubvfo = True # Masked from VFO B + else: + flag.nosubvfo = False # Available in both VFOs + if regtype != "Home": + self._debank(mem) + ndx = num - 1 + flag.used = not mem.empty + flag.valid = True + flag.skip = mem.skip == "S" + flag.pskip = mem.skip == "P" + freq = mem.freq + _mem.freq = int(freq / 1000) + _mem.offset = int(mem.offset / 1000) _mem.label = self._encode_label(mem) - charsetbits = self._encode_charsetbits(mem) - _mem.charsetbits[0], _mem.charsetbits[1] = charsetbits - - flag.skip = mem.skip == "S" - flag.pskip = mem.skip == "P" + _mem.charsetbits = self._encode_charsetbits(mem) + self._set_mem_extra(mem, _mem) + return @classmethod def _wipe_memory(cls, mem): - mem.set_raw("\x00" * (mem.size() / 8)) + mem.set_raw("\x00" * (mem.size() // 8)) mem.unknown1 = 0x05 def get_bank_model(self): @@ -902,6 +1297,16 @@ class FT1Radio(yaesu_clone.YaesuCloneModeRadio): return cls._latlong_sanity(sign, result[0], result[1], result[2], is_lat) + def _get_aprs_settings(self): + menu = RadioSettingGroup("aprs_top", "APRS") + menu.append(self._get_aprs_general_settings()) + menu.append(self._get_aprs_rx_settings()) + menu.append(self._get_aprs_tx_settings()) + menu.append(self._get_aprs_smartbeacon()) + menu.append(self._get_aprs_msgs()) + menu.append(self._get_aprs_beacons()) + return menu + def _get_aprs_general_settings(self): menu = RadioSettingGroup("aprs_general", "APRS General") aprs = self._memobj.aprs @@ -1077,9 +1482,10 @@ class FT1Radio(yaesu_clone.YaesuCloneModeRadio): for index in range(0, 60): # There is probably a more pythonesque way to do this - if int(aprs_meta[index].sender_callsign[0]) != 255: + scl = int(aprs_meta[index].sender_callsign[0]) + dcl = int(aprs_beacon[index].dst_callsign[0]) + if scl != 255 and scl != 0: # ignore if empty send call callsign = str(aprs_meta[index].sender_callsign).rstrip("\xFF") - # LOG.debug("Callsign %s %s" % (callsign, list(callsign))) val = RadioSettingValueString(0, 9, callsign) val.set_mutable(False) rs = RadioSetting( @@ -1087,17 +1493,15 @@ class FT1Radio(yaesu_clone.YaesuCloneModeRadio): "SRC Callsign %d" % index, val) menu.append(rs) - if int(aprs_beacon[index].dst_callsign[0]) != 255: - val = RadioSettingValueString( - 0, 9, - str(aprs_beacon[index].dst_callsign).rstrip("\xFF")) - val.set_mutable(False) - rs = RadioSetting( + if dcl != 255 and dcl != 0: # ignore if empty dest call + val = str(aprs_beacon[index].dst_callsign) + val = RadioSettingValueString(0, 9, val.rstrip("\xFF")) + val.set_mutable(False) + rs = RadioSetting( "aprs_beacon.dst_callsign%d" % index, "DST Callsign %d" % index, val) - menu.append(rs) + menu.append(rs) - if int(aprs_meta[index].sender_callsign[0]) != 255: date = "%02d/%02d/%02d" % ( aprs_meta[index].date[0], aprs_meta[index].date[1], @@ -1115,23 +1519,23 @@ class FT1Radio(yaesu_clone.YaesuCloneModeRadio): rs = RadioSetting("aprs_beacon.time%d" % index, "Time", val) menu.append(rs) - if int(aprs_beacon[index].dst_callsign[0]) != 255: - path = str(aprs_beacon[index].path).replace("\x00", " ") - path = ''.join(c for c in path - if c in string.printable).strip() - path = str(path).replace("\xE0", "*") - # LOG.debug("path %s %s" % (path, list(path))) - val = RadioSettingValueString(0, 32, path) - val.set_mutable(False) - rs = RadioSetting( - "aprs_beacon.path%d" % index, "Digipath", val) - menu.append(rs) + if dcl != 255 and dcl != 0: # ignore if empty dest call + path = str(aprs_beacon[index].path).replace("\x00", " ") + path = ''.join(c for c in path + if c in string.printable).strip() + path = str(path).replace("\xE0", "*") + val = RadioSettingValueString(0, 32, path) + val.set_mutable(False) + rs = RadioSetting( + "aprs_beacon.path%d" % index, "Digipath", val) + menu.append(rs) body = str(aprs_beacon[index].body).rstrip("\xFF") checksum = body[-2:] body = ''.join(s for s in body[:-2] if s in string.printable).translate( - None, "\x09\x0a\x0b\x0c\x0d") + str.maketrans( + "", "", "\x09\x0a\x0b\x0c\x0d")) try: val = RadioSettingValueString(0, 134, body.strip()) except Exception as e: @@ -1407,6 +1811,169 @@ class FT1Radio(yaesu_clone.YaesuCloneModeRadio): return menu + def _get_digital_settings(self): + topmenu = RadioSettingGroup("digital_settings", "Digital") + menu = RadioSettingGroup("settings", "Digital Modes") + topmenu.append(menu) + GMmenu = RadioSettingGroup("first_settings", "Group Monitor(GM)") + topmenu.append(GMmenu) + WXmenu = RadioSettingGroup("WiresX_settings", "Wires-X") + topmenu.append(WXmenu) + + # MYCALL + mycall = self._memobj.my_call + mycallstr = str(mycall.callsign).rstrip("\xff").rstrip() + mycalle = RadioSettingValueString(0, 10, mycallstr, False, + charset=self._MYCALL_CHR_SET) + rs = RadioSetting('mycall.callsign', + 'MYCALL (10 uppercase chars)', mycalle) + rs.set_apply_callback(self.apply_mycall, mycall) + menu.append(rs) + + # Short Press AMS button AMS TX Mode + digital_settings = self._memobj.digital_settings + val = RadioSettingValueList( + self._AMS_TX_MODE, + self._AMS_TX_MODE[digital_settings.ams_tx_mode]) + rs = RadioSetting("digital_settings.ams_tx_mode", + "AMS TX Mode", val) + menu.append(rs) + + # 16 DIG VW Turn the VW mode selection ON or OFF. + val = RadioSettingValueList( + self._VW_MODE, + self._VW_MODE[digital_settings.vw_mode]) + rs = RadioSetting("digital_settings.vw_mode", "VW Mode", val) + menu.append(rs) + + # TX DG-ID Long Press Mode Key, Dial + val = RadioSettingValueList( + self._DG_ID, + self._DG_ID[digital_settings.tx_dg_id]) + rs = RadioSetting("digital_settings.tx_dg_id", + "TX DG-ID", val) + menu.append(rs) + + # RX DG-ID Long Press Mode Key, Mode Key to select, Dial + val = RadioSettingValueList( + self._DG_ID, + self._DG_ID[digital_settings.rx_dg_id]) + rs = RadioSetting("digital_settings.rx_dg_id", + "RX DG-ID", val) + menu.append(rs) + + # 15 DIG.POP Call sign display pop up time + digital_settings_more = self._memobj.digital_settings_more + + val = RadioSettingValueList( + self._DIG_POP_UP, + self._DIG_POP_UP[ + 0 if digital_settings_more.digital_popup == 0 + else digital_settings_more.digital_popup - 9]) + + rs = RadioSetting("digital_settings_more.digital_popup", + "Digital Popup", val) + rs.set_apply_callback(self.apply_digital_popup, + digital_settings_more) + menu.append(rs) + + # 07 BEP.STB Standby Beep in the digital C4FM mode. On/Off + val = RadioSettingValueList( + self._STANDBY_BEEP, + self._STANDBY_BEEP[digital_settings.standby_beep]) + rs = RadioSetting("digital_settings.standby_beep", + "Standby Beep", val) + menu.append(rs) + + # GM settings + # 24 GM RNG Select the beep option + first_settings = self._memobj.first_settings + val = RadioSettingValueList( + self._GM_RING, + self._GM_RING[first_settings.gm_ring]) + rs = RadioSetting("first_settings.gm_ring", "GM Ring", val) + GMmenu.append(rs) + + # 25 GM INT transmission interval of digital GM info + scan_settings = self._memobj.scan_settings + val = RadioSettingValueList( + self._GM_INTERVAL, + self._GM_INTERVAL[scan_settings.gm_interval]) + rs = RadioSetting("scan_settings.gm_interval", + "GM Interval", val) + GMmenu.append(rs) + + m = self._memobj.GM + for i in range(0, 10): + cname = "GM[%d].message" % i + msg = str(m[i].message).rstrip("\xff)") + val = RadioSettingValueString(0, 32, msg) + rs = RadioSetting(cname, "GM Message%2d" % (i + 1), + val) + GMmenu.append(rs) + + # WiresX settings + wxc = self._memobj.WiresX_settings + for i in range(0, 5): + cname = "WiresX_settings.Category[%d].name" % (i + 1) + c = '' + for j in range(0, 16): + s = wxc.Category[i].name[j] + if int(s) != 0xff: + c = c + str(s) + val = RadioSettingValueString(0, 16, c) + rs = RadioSetting(cname, "Category %d" % (i+1), val) + rs.set_apply_callback(self.apply_WiresX_category, + wxc.Category[i].name) + WXmenu.append(rs) + + r = wxc.RoomsPerCategory[i] + rn = False + for j in range(0, 20): + idn = "0" + if int(r.Rooms[j].ID[1]) != 0xff: + idn = r.Rooms[j].ID + rn = False + elif rn: + break + elif j > 0: + rn = True + val = RadioSettingValueInteger(0, 99999, int(str(idn))) + vname = "WiresX_settings.RoomsperCategory%s" \ + "Rooms[%d].ID" % (i, j) + rs = RadioSetting(vname, " Room ID%2s (5 numerals)" % + (j+1), val) + rs.set_apply_callback(self.apply_WiresX_roomid, + r.Rooms[j]) + WXmenu.append(rs) + cn = '' + for l in range(0, 16): + s = r.Rooms[j].name[l] + if int(s) != 0xff: + cn = cn + str(s) + val = RadioSettingValueString(0, 16, str(cn)) + cname = "WiresX_settings.RoomsperCategory%s" \ + "Rooms[%d].name" % (i, j) + rs = RadioSetting(cname, " Room Name%2s (16 chars)" % + (j+1), val) + rs.set_apply_callback(self.apply_WiresX_roomname, + r.Rooms[j]) + WXmenu.append(rs) + pass + return topmenu + + def apply_WiresX_category(cls, setting, obj): + val = setting.value.get_value() + setattr(obj, "name", val) + + def apply_WiresX_roomid(self, setting, obj): + val = setting.value.get_value() + obj.ID = self.zero_pad(val, 5) + + def apply_WiresX_roomname(cls, setting, obj): + val = setting.value.get_value() + obj.name = str(val) + def _get_dtmf_settings(self): menu = RadioSettingGroup("dtmf_settings", "DTMF") dtmf = self._memobj.scan_settings @@ -1515,12 +2082,12 @@ class FT1Radio(yaesu_clone.YaesuCloneModeRadio): return False - def backtrack_zero_pad(self, number, l): - number = str(number).strip() - while len(number) < l: - number = '0' + number - - return str(number) + @staticmethod + def zero_pad(number, length): + """ + Applies a leading zero pad of length `length` to `number` + """ + return str(number).rjust(length, "0") def _get_backtrack_settings(self): @@ -1606,7 +2173,7 @@ class FT1Radio(yaesu_clone.YaesuCloneModeRadio): if bt.status == 1 and self.backtrack_ll_validate(bt.lat, 0, 90): val = RadioSettingValueString( - 0, 3, self.backtrack_zero_pad(bt.lat, 3)) + 0, 3, self.zero_pad(bt.lat, 3)) else: val = RadioSettingValueString(0, 3, ' ') rs = RadioSetting("%s.lat" % bt_idx, prefix + "Latitude", val) @@ -1616,7 +2183,7 @@ class FT1Radio(yaesu_clone.YaesuCloneModeRadio): if bt.status == 1 and \ self.backtrack_ll_validate(bt.lat_min, 0, 59): val = RadioSettingValueString( - 0, 2, self.backtrack_zero_pad(bt.lat_min, 2)) + 0, 2, self.zero_pad(bt.lat_min, 2)) else: val = RadioSettingValueString(0, 2, ' ') rs = RadioSetting( @@ -1628,7 +2195,7 @@ class FT1Radio(yaesu_clone.YaesuCloneModeRadio): if bt.status == 1 and \ self.backtrack_ll_validate(bt.lat_dec_sec, 0, 9999): val = RadioSettingValueString( - 0, 4, self.backtrack_zero_pad(bt.lat_dec_sec, 4)) + 0, 4, self.zero_pad(bt.lat_dec_sec, 4)) else: val = RadioSettingValueString(0, 4, ' ') rs = RadioSetting( @@ -1651,7 +2218,7 @@ class FT1Radio(yaesu_clone.YaesuCloneModeRadio): if bt.status == 1 and self.backtrack_ll_validate(bt.lon, 0, 180): val = RadioSettingValueString( - 0, 3, self.backtrack_zero_pad(bt.lon, 3)) + 0, 3, self.zero_pad(bt.lon, 3)) else: val = RadioSettingValueString(0, 3, ' ') rs = RadioSetting("%s.lon" % bt_idx, prefix + "Longitude", val) @@ -1661,7 +2228,7 @@ class FT1Radio(yaesu_clone.YaesuCloneModeRadio): if bt.status == 1 and \ self.backtrack_ll_validate(bt.lon_min, 0, 59): val = RadioSettingValueString( - 0, 2, self.backtrack_zero_pad(bt.lon_min, 2)) + 0, 2, self.zero_pad(bt.lon_min, 2)) else: val = RadioSettingValueString(0, 2, ' ') rs = RadioSetting( @@ -1673,7 +2240,7 @@ class FT1Radio(yaesu_clone.YaesuCloneModeRadio): if bt.status == 1 and \ self.backtrack_ll_validate(bt.lon_dec_sec, 0, 9999): val = RadioSettingValueString( - 0, 4, self.backtrack_zero_pad(bt.lon_dec_sec, 4)) + 0, 4, self.zero_pad(bt.lon_dec_sec, 4)) else: val = RadioSettingValueString(0, 4, ' ') rs = RadioSetting( @@ -1756,12 +2323,8 @@ class FT1Radio(yaesu_clone.YaesuCloneModeRadio): return menu def _get_settings(self): - top = RadioSettings(self._get_aprs_general_settings(), - self._get_aprs_rx_settings(), - self._get_aprs_tx_settings(), - self._get_aprs_smartbeacon(), - self._get_aprs_msgs(), - self._get_aprs_beacons(), + top = RadioSettings(self._get_aprs_settings(), + self._get_digital_settings(), self._get_dtmf_settings(), self._get_misc_settings(), self._get_scan_settings(), @@ -1814,6 +2377,22 @@ class FT1Radio(yaesu_clone.YaesuCloneModeRadio): setattr(obj, "tx_interval_beacon", 0) setattr(obj, "tx_smartbeacon", 0) + # digital settings callback routines + def apply_digital_popup(cls, setting, obj): + rawval = setting.value.get_value() + val = 0 if cls._DIG_POP_UP.index(rawval) == 0 \ + else cls._DIG_POP_UP.index(rawval) + 9 + obj.digital_popup = val + + def apply_mycall(cls, setting, obj): + cs = setting.value.get_value() + if cs[0] in ('-', '/'): + raise InvalidValueError("First character of" + " call sign can't be - or /: {0:s}" + .format(cs)) + else: + obj.callsign = cls._add_ff_pad(cs.rstrip(), 10) + @classmethod def apply_callsign(cls, setting, obj, default_ssid=None): # Uppercase, strip SSID then FF pad to max string length. @@ -1890,7 +2469,7 @@ class FT1Radio(yaesu_clone.YaesuCloneModeRadio): except AttributeError as e: LOG.error("Setting %s is not in the memory map: %s" % (element.get_name(), e)) - except Exception, e: + except Exception: LOG.debug(element.get_name()) raise @@ -1944,13 +2523,6 @@ class FT1Radio(yaesu_clone.YaesuCloneModeRadio): hemi = ' ' setattr(obj, "WEhemi", hemi) - def apply_WEhemi(cls, setting, obj): - hemi = setting.value.get_value().upper() - - if hemi != 'W' and hemi != 'E': - hemi = ' ' - setattr(obj, "WEhemi", hemi) - def apply_bt_lat(cls, setting, obj): val = setting.value.get_value() val = cls.backtrack_zero_pad(val, 3) @@ -1986,3 +2558,26 @@ class FT1Radio(yaesu_clone.YaesuCloneModeRadio): val = cls.backtrack_zero_pad(val, 4) setattr(obj, "lon_dec_sec", val) + + def load_mmap(self, filename): + if filename.lower().endswith(self._adms_ext): + with open(filename, 'rb') as f: + self._adms_header = f.read(0x16) + LOG.debug('ADMS Header:\n%s', + util.hexprint(self._adms_header)) + self._mmap = memmap.MemoryMapBytes(self._model + f.read()) + LOG.info('Loaded ADMS file') + self.process_mmap() + else: + chirp_common.CloneModeRadio.load_mmap(self, filename) + + def save_mmap(self, filename): + if filename.lower().endswith(self._adms_ext): + if not hasattr(self, '_adms_header'): + raise Exception('Unable to save .img to %s' % self._adms_ext) + with open(filename, 'wb') as f: + f.write(self._adms_header) + f.write(self._mmap.get_packed()[5:]) + LOG.info('Wrote file') + else: + chirp_common.CloneModeRadio.save_mmap(self, filename) diff --git a/chirp/drivers/ft2800.py b/chirp/drivers/ft2800.py index 28cabf7..16dd752 100644 --- a/chirp/drivers/ft2800.py +++ b/chirp/drivers/ft2800.py @@ -14,7 +14,6 @@ # along with this program. If not, see . import time -import os import logging from chirp import util, memmap, chirp_common, bitwise, directory, errors @@ -33,17 +32,34 @@ def _send(s, data): if chunk != echo: raise Exception("Failed to read echo chunk") -IDBLOCK = "\x0c\x01\x41\x33\x35\x02\x00\xb8" -TRAILER = "\x0c\x02\x41\x33\x35\x00\x00\xb7" -ACK = "\x0C\x06\x00" + +# The IDBLOCK is the first thing sent during an upload or download +# and indicates the radio subtype: +# USA Unmodified: b"\x0c\x01\x41\x33\x35\x02\x00\xb8" +# USA With extended TX mod: b"\x0c\x01\x41\x33\x35\x03\x00\xb9" +SUPPORTED_IDBLOCKS = [b"\x0c\x01\x41\x33\x35\x02\x00\xb8", + b"\x0c\x01\x41\x33\x35\x03\x00\xb9"] +TRAILER = b"\x0c\x02\x41\x33\x35\x00\x00\xb7" +ACK = b"\x0C\x06\x00" def _download(radio): - data = "" - for _i in range(0, 10): + data = b"" + attempts = 30 + for _i in range(0, attempts): data = radio.pipe.read(8) - if data == IDBLOCK: + if data in SUPPORTED_IDBLOCKS: + radio.subtype = data break + LOG.debug('Download attempt %i received %i: %s', + _i, len(data), util.hexprint(data)) + if radio.status_fn: + status = chirp_common.Status() + status.max = 1 + status.cur = 0 + status.msg = "Waiting for radio (%i)" % ( + attempts - (_i + 1)) + radio.status_fn(status) LOG.debug("Header:\n%s" % util.hexprint(data)) @@ -52,7 +68,7 @@ def _download(radio): _send(radio.pipe, ACK) - data = "" + data = b"" while len(data) < radio._block_sizes[1]: time.sleep(0.1) @@ -67,8 +83,8 @@ def _download(radio): else: cs = 0 for byte in chunk[:-1]: - cs += ord(byte) - if ord(chunk[-1]) != (cs & 0xFF): + cs += byte + if chunk[-1] != (cs & 0xFF): raise Exception("Block failed checksum!") data += chunk[5:-1] @@ -83,7 +99,7 @@ def _download(radio): LOG.debug("Total: %i" % len(data)) - return memmap.MemoryMap(data) + return memmap.MemoryMapBytes(data) def _upload(radio): @@ -93,7 +109,7 @@ def _upload(radio): break LOG.debug("What is this garbage?\n%s" % util.hexprint(data)) - _send(radio.pipe, IDBLOCK) + _send(radio.pipe, radio.subtype) time.sleep(1) ack = radio.pipe.read(300) LOG.debug("Ack was (%i):\n%s" % (len(ack), util.hexprint(ack))) @@ -102,12 +118,12 @@ def _upload(radio): block = 0 while block < (radio.get_memsize() // 32): - data = "\x0C\x03\x00\x00" + chr(block) + data = b"\x0C\x03\x00\x00" + bytes([block]) data += radio.get_mmap()[block*32:(block+1)*32] cs = 0 for byte in data: - cs += ord(byte) - data += chr(cs & 0xFF) + cs += byte + data += bytes([cs & 0xFF]) LOG.debug("Writing block %i:\n%s" % (block, util.hexprint(data))) @@ -127,6 +143,7 @@ def _upload(radio): _send(radio.pipe, TRAILER) + MEM_FORMAT = """ struct { bbcd freq[4]; @@ -171,6 +188,41 @@ class FT2800Radio(YaesuCloneModeRadio): _block_sizes = [8, 7680] _memsize = 7680 + @property + def subtype(self): + # If our image is from before the subtype was stashed, assume + # the default unmodified US ID block + return bytes(self.metadata.get('subtype_idblock', + SUPPORTED_IDBLOCKS[0])) + + @subtype.setter + def subtype(self, value): + self.metadata = {'subtype_idblock': [x for x in value]} + + @classmethod + def get_prompts(cls): + rp = chirp_common.RadioPrompts() + rp.pre_download = _( + "1. Turn radio off.\n" + "2. Connect cable\n" + "3. Press and hold in the MHz, Low, and D/MR keys on the radio " + "while turning it on\n" + "4. Radio is in clone mode when TX/RX is flashing\n" + "5. After clicking OK, " + "press the MHz key on the radio to send" + " image.\n" + " (\"TX\" will appear on the LCD). \n") + rp.pre_upload = _( + "1. Turn radio off.\n" + "2. Connect cable\n" + "3. Press and hold in the MHz, Low, and D/MR keys on the radio " + "while turning it on\n" + "4. Radio is in clone mode when TX/RX is flashing\n" + "5. Press the Low key on the radio " + "(\"RX\" will appear on the LCD).\n" + "6. Click OK.") + return rp + def get_features(self): rf = chirp_common.RadioFeatures() @@ -196,12 +248,14 @@ class FT2800Radio(YaesuCloneModeRadio): def sync_in(self): self.pipe.parity = "E" + self.pipe.timeout = 1 start = time.time() try: self._mmap = _download(self) except errors.RadioError: raise except Exception as e: + LOG.exception('Failed download') raise errors.RadioError("Failed to communicate with radio: %s" % e) LOG.info("Downloaded in %.2f sec" % (time.time() - start)) self.process_mmap() @@ -215,6 +269,7 @@ class FT2800Radio(YaesuCloneModeRadio): except errors.RadioError: raise except Exception as e: + LOG.exception('Failed upload') raise errors.RadioError("Failed to communicate with radio: %s" % e) LOG.info("Uploaded in %.2f sec" % (time.time() - start)) diff --git a/chirp/drivers/ft2900.py b/chirp/drivers/ft2900.py index 3b34c46..5ef6a67 100644 --- a/chirp/drivers/ft2900.py +++ b/chirp/drivers/ft2900.py @@ -17,7 +17,6 @@ # along with this program. If not, see . import time -import os import logging from chirp import util, memmap, chirp_common, bitwise, directory, errors @@ -25,7 +24,6 @@ from chirp.drivers.yaesu_clone import YaesuCloneModeRadio from chirp.settings import RadioSetting, RadioSettingGroup, \ RadioSettingValueList, RadioSettingValueString, RadioSettings -from textwrap import dedent LOG = logging.getLogger(__name__) @@ -37,19 +35,20 @@ def _send(s, data): raise Exception("Failed to read echo") LOG.debug("got echo\n%s\n" % util.hexprint(echo)) -ACK = "\x06" + +ACK = b"\x06" INITIAL_CHECKSUM = 0 def _download(radio): - blankChunk = "" + blankChunk = b"" for _i in range(0, 32): - blankChunk += "\xff" + blankChunk += b"\xff" LOG.debug("in _download\n") - data = "" + data = b"" for _i in range(0, 20): data = radio.pipe.read(20) LOG.debug("Header:\n%s" % util.hexprint(data)) @@ -64,7 +63,7 @@ def _download(radio): _send(radio.pipe, ACK) # initialize data, the big var that holds all memory - data = "" + data = b"" _blockNum = 0 @@ -80,7 +79,6 @@ def _download(radio): if len(chunk) != 32: LOG.debug("len chunk is %i\n" % (len(chunk))) raise Exception("Failed to get full data block") - break else: data += chunk @@ -104,13 +102,13 @@ def _download(radio): # compute checksum cs = INITIAL_CHECKSUM for byte in radio.IDBLOCK: - cs += ord(byte) + cs += byte for byte in data: - cs += ord(byte) + cs += byte LOG.debug("calculated checksum is %x\n" % (cs & 0xff)) - LOG.debug("Radio sent checksum is %x\n" % ord(chunk[0])) + LOG.debug("Radio sent checksum is %x\n" % chunk[0]) - if (cs & 0xff) != ord(chunk[0]): + if (cs & 0xff) != chunk[0]: raise Exception("Failed checksum on read.") # for debugging purposes, dump the channels, in hex. @@ -119,7 +117,7 @@ def _download(radio): chunk = data[_startData:_startData + 20] LOG.debug("channel %i:\n%s" % (_i, util.hexprint(chunk))) - return memmap.MemoryMap(data) + return memmap.MemoryMapBytes(data) def _upload(radio): @@ -143,9 +141,9 @@ def _upload(radio): block = 0 cs = INITIAL_CHECKSUM for byte in radio.IDBLOCK: - cs += ord(byte) + cs += byte - while block < (radio.get_memsize() / 32): + while block < (radio.get_memsize() // 32): data = radio.get_mmap()[block * 32:(block + 1) * 32] LOG.debug("Writing block %i:\n%s" % (block, util.hexprint(data))) @@ -154,7 +152,7 @@ def _upload(radio): time.sleep(0.03) for byte in data: - cs += ord(byte) + cs += byte if radio.status_fn: status = chirp_common.Status() @@ -164,7 +162,8 @@ def _upload(radio): radio.status_fn(status) block += 1 - _send(radio.pipe, chr(cs & 0xFF)) + _send(radio.pipe, bytes([cs & 0xFF])) + MEM_FORMAT = """ #seekto 0x0080; @@ -380,7 +379,7 @@ def _decode_name(mem): def _encode_name(mem): - if(mem.strip() == ""): + if (mem.strip() == ""): return [0xff] * 6 name = [None] * 6 @@ -395,7 +394,7 @@ def _encode_name(mem): def _wipe_memory(mem): - mem.set_raw("\xff" * (mem.size() // 8)) + mem.set_raw(b"\xff" * (mem.size() // 8)) class FT2900Bank(chirp_common.NamedBank): @@ -498,7 +497,7 @@ class FT2900Radio(YaesuCloneModeRadio): """Yaesu FT-2900""" VENDOR = "Yaesu" MODEL = "FT-2900R/1900R" - IDBLOCK = "\x56\x43\x32\x33\x00\x02\x46\x01\x01\x01" + IDBLOCK = b"\x56\x43\x32\x33\x00\x02\x46\x01\x01\x01" BAUD_RATE = 19200 _memsize = 8000 @@ -581,7 +580,7 @@ class FT2900Radio(YaesuCloneModeRadio): mem.freq = int(_mem.freq) * 1000 # compensate for 12.5 kHz tuning steps, add 500 Hz if needed - if(mem.tuning_step == 12.5): + if (mem.tuning_step == 12.5): lastdigit = int(_mem.freq) % 10 if (lastdigit == 2 or lastdigit == 7): mem.freq += 500 @@ -1167,7 +1166,7 @@ class FT2900Radio(YaesuCloneModeRadio): .ts_speed]))) # 56 VFO.SCN - opts = ["+/- 1MHz", "+/- 2MHz", "+/-5MHz", "All"] + opts = ["+/- 1 MHz", "+/- 2 MHz", "+/-5 MHz", "All"] scan.append(RadioSetting("vfo_scan", "VFO Scanner Width", RadioSettingValueList(opts, opts[_settings @@ -1210,7 +1209,7 @@ class FT2900Radio(YaesuCloneModeRadio): setattr(_settings, name, value) LOG.debug("Setting %s: %s" % (name, value)) - except Exception as e: + except Exception: LOG.debug(element.get_name()) raise @@ -1224,22 +1223,22 @@ class FT2900Radio(YaesuCloneModeRadio): @classmethod def get_prompts(cls): rp = chirp_common.RadioPrompts() - rp.pre_download = _(dedent("""\ - 1. Turn Radio off. - 2. Connect data cable. - 3. While holding "A/N LOW" button, turn radio on. - 4. After clicking OK, press "SET MHz" to send image.""")) - rp.pre_upload = _(dedent("""\ - 1. Turn Radio off. - 2. Connect data cable. - 3. While holding "A/N LOW" button, turn radio on. - 4. Press "MW D/MR" to receive image. - 5. Make sure display says "-WAIT-" (see note below if not) - 6. Click OK to dismiss this dialog and start transfer. - - Note: if you don't see "-WAIT-" at step 5, try cycling - power and pressing and holding red "*L" button to unlock - radio, then start back at step 1.""")) + rp.pre_download = _( + "1. Turn Radio off.\n" + "2. Connect data cable.\n" + "3. While holding \"A/N LOW\" button, turn radio on.\n" + "4. After clicking OK, press \"SET MHz\" to send image.\n") + rp.pre_upload = _( + "1. Turn Radio off.\n" + "2. Connect data cable.\n" + "3. While holding \"A/N LOW\" button, turn radio on.\n" + "4. Press \"MW D/MR\" to receive image.\n" + "5. Make sure display says \"-WAIT-\" (see note below if not)\n" + "6. Click OK to dismiss this dialog and start transfer.\n" + "Note: if you don't see \"-WAIT-\" at step 5, try cycling\n" + " power and pressing and holding red \"*L\" button to" + " unlock\n" + " radio, then start back at step 1.\n") return rp @@ -1253,7 +1252,7 @@ class FT2900ERadio(FT2900Radio): """Yaesu FT-2900E""" MODEL = "FT-2900E/1900E" VARIANT = "E" - IDBLOCK = "\x56\x43\x32\x33\x00\x02\x41\x02\x01\x01" + IDBLOCK = b"\x56\x43\x32\x33\x00\x02\x41\x02\x01\x01" # This class is for the TX Modified FT-1900/FT-2900 (MARS/CAP Mod). @@ -1264,7 +1263,7 @@ class FT2900ModRadio(FT2900Radio): """Yaesu FT-2900Mod""" MODEL = "FT-2900R/1900R(TXMod)" VARIANT = "Opened Xmit" - IDBLOCK = "\x56\x43\x32\x33\x00\x02\xc7\x01\x01\x01" + IDBLOCK = b"\x56\x43\x32\x33\x00\x02\xc7\x01\x01\x01" @classmethod def match_model(cls, filedata, filename): diff --git a/chirp/drivers/ft2d.py b/chirp/drivers/ft2d.py index 1bbc000..6e0b8c9 100644 --- a/chirp/drivers/ft2d.py +++ b/chirp/drivers/ft2d.py @@ -16,15 +16,16 @@ # along with this program. If not, see . import logging -from textwrap import dedent -from chirp.drivers import yaesu_clone, ft1d -from chirp import chirp_common, directory, bitwise -from chirp.settings import RadioSetting, RadioSettings +from chirp.drivers import ft1d +from chirp import chirp_common, directory +from chirp import errors +from chirp import memmap +from chirp.settings import RadioSetting from chirp.settings import RadioSettingValueString +from chirp import util # Differences from Yaesu FT1D -# 999 memories, but 901-999 are only for skipping VFO frequencies # Text in memory and memory bank structures is ASCII encoded # Expanded modes # Slightly different clone-mode instructions @@ -33,7 +34,8 @@ LOG = logging.getLogger(__name__) TMODES = ["", "Tone", "TSQL", "DTCS", "RTone", "JRfrq", "PRSQL", "Pager"] -class FT2Bank(chirp_common.NamedBank): # Like FT1D except for name in ASCII + +class FT2Bank(chirp_common.NamedBank): # Like FT1D except for name in ASCII def get_name(self): _bank = self._model._radio._memobj.bank_info[self.index] name = "" @@ -47,7 +49,8 @@ class FT2Bank(chirp_common.NamedBank): # Like FT1D except for name in ASCII _bank = self._model._radio._memobj.bank_info[self.index] _bank.name = [ord(x) for x in name.ljust(16, chr(0xFF))[:16]] -class FT2BankModel(ft1d.FT1BankModel): #just need this one to launch FT2Bank + +class FT2BankModel(ft1d.FT1BankModel): # Just need this one to launch FT2Bank """A FT1D bank model""" def __init__(self, radio, name='Banks'): super(FT2BankModel, self).__init__(radio, name) @@ -59,77 +62,63 @@ class FT2BankModel(ft1d.FT1BankModel): #just need this one to launch FT2Bank bank.index = index self._bank_mappings.append(bank) + @directory.register class FT2D(ft1d.FT1Radio): """Yaesu FT-2D""" BAUD_RATE = 38400 VENDOR = "Yaesu" - MODEL = "FT2D" # Yaesu doesn't use a hyphen in its documents + MODEL = "FT2D" # Yaesu doesn't use a hyphen in its documents VARIANT = "R" - _model = "AH60M" # Get this from chirp .img file after saving once + _model = b"AH60M" # Get this from chirp .img file after saving once _has_vibrate = True - _mem_params = (0x94a, # Location of DTMF storage - 999, # size of memories array - 999, # size of flags array - 0xFECA, # APRS beacon metadata address. - 60, # Number of beacons stored. - 0x1064A, # APRS beacon content address. - 134, # Length of beacon data stored. - 60) # Number of beacons stored. + MAX_MEM_SLOTS = 900 + _mem_params = { + "memnum": 900, # size of memories array + "flgnum": 900, # size of flags array + "dtmadd": 0x94A, # address of DTMF strings + } + _adms_ext = '.ft2d' _APRS_HIGH_SPEED_MAX = 90 + FORMATS = [directory.register_format('FT2D ADMS-8', '*.ft2d')] @classmethod def get_prompts(cls): rp = chirp_common.RadioPrompts() - rp.pre_download = _(dedent("""\ - 1. Turn radio off. - 2. Connect cable to DATA terminal. - 3. Press and hold [DISP] key while turning on radio - ("CLONE" will appear on the display). - 4. After clicking OK here in chirp, - press the [Send] screen button.""")) - rp.pre_upload = _(dedent("""\ - 1. Turn radio off. - 2. Connect cable to DATA terminal. - 3. Press and hold in [DISP] key while turning on radio - ("CLONE" will appear on radio LCD). - 4. Press [RECEIVE] screen button - ("-WAIT-" will appear on radio LCD). - 5. Finally, press OK button below.""")) + rp.pre_download = _( + "1. Turn radio off.\n" + "2. Connect cable to DATA terminal.\n" + "3. Press and hold [DISP] key while turning on radio\n" + " (\"CLONE\" will appear on the display).\n" + "4. After clicking OK here in chirp,\n" + " press the [Send] screen button.\n") + rp.pre_upload = _( + " 1. Turn radio off.\n" + " 2. Connect cable to DATA terminal.\n" + " 3. Press and hold in [DISP] key while turning on radio\n" + " (\"CLONE\" will appear on radio LCD).\n" + " 4. Press [RECEIVE] screen button\n" + " (\"-WAIT-\" will appear on radio LCD).\n" + "5. Finally, press OK button below.\n") return rp - def get_features(self): # AFAICT only TMODES & memory bounds are different + def get_features(self): # AFAICT only TMODES & memory bounds are different rf = super(FT2D, self).get_features() rf.valid_tmodes = list(TMODES) - rf.memory_bounds = (1, 999) + rf.memory_bounds = (1, self.MAX_MEM_SLOTS) return rf def get_bank_model(self): # here only to launch the bank model return FT2BankModel(self) - def get_memory(self, number): - mem = super(FT2D, self).get_memory(number) - flag = self._memobj.flag[number - 1] - if number >= 901 and number <= 999: # for FT2D; enforces skip - mem.skip = "S" - flag.skip = True - return mem - def _decode_label(self, mem): - return str(mem.label).rstrip("\xFF").decode('ascii', 'replace') + return str(mem.label).rstrip("\xFF") def _encode_label(self, mem): label = mem.name.rstrip().encode('ascii', 'ignore') return self._add_ff_pad(label, 16) - def set_memory(self, mem): - flag = self._memobj.flag[mem.number - 1] - if mem.number >= 901 and mem.number <= 999: # for FT2D; enforces skip - flag.skip = True - mem.skip = "S" - super(FT2D, self).set_memory(mem) - def _decode_opening_message(self, opening_message): msg = "" for i in opening_message.message.padded_yaesu: @@ -150,12 +139,14 @@ class FT2D(ft1d.FT1Radio): val.append(ord(i)) self._memobj.opening_message.message.padded_yaesu = val + @directory.register class FT2Dv2(FT2D): """Yaesu FT-2D v2 firmware""" VARIANT = "Rv2" - _model = "AH60G" + _model = b"AH60G" + @directory.register class FT3D(FT2D): @@ -163,4 +154,38 @@ class FT3D(FT2D): MODEL = "FT3D" VARIANT = "R" - _model = "AH72M" + _model = b"AH72M" + FORMATS = [directory.register_format('FT3D ADMS-11', '*.ft3d')] + + def load_mmap(self, filename): + if filename.lower().endswith('.ft3d'): + with open(filename, 'rb') as f: + self._adms_header = f.read(0x18C) + if b'ADMS11, Version=1.0.0.0' not in self._adms_header: + raise errors.ImageDetectFailed( + 'Unsupported version found in ADMS file') + LOG.debug('ADMS Header:\n%s', + util.hexprint(self._adms_header)) + self._mmap = memmap.MemoryMapBytes(f.read()) + LOG.info('Loaded ADMS-11 file at offset 0x18C') + self.process_mmap() + else: + chirp_common.CloneModeRadio.load_mmap(self, filename) + + def save_mmap(self, filename): + if filename.lower().endswith('.ft3d'): + if not hasattr(self, '_adms_header'): + raise Exception('Unable to save .img to .ft3d') + with open(filename, 'wb') as f: + f.write(self._adms_header) + f.write(self._mmap.get_packed()) + LOG.info('Wrote ADMS-11 file') + else: + chirp_common.CloneModeRadio.save_mmap(self, filename) + + @classmethod + def match_model(cls, filedata, filename): + if filename.endswith('.ft3d'): + return True + else: + return super().match_model(filedata, filename) diff --git a/chirp/drivers/ft4.py b/chirp/drivers/ft4.py index b625347..cb3f8d4 100644 --- a/chirp/drivers/ft4.py +++ b/chirp/drivers/ft4.py @@ -2,7 +2,7 @@ # Derives loosely from two sources released under GPLv2: # ./template.py, Copyright 2012 Dan Smith # ./ft60.py, Copyright 2011 Dan Smith -# Edited 2020 Bernhard Hailer AE6YN +# Edited 2020, 2023 Bernhard Hailer AE6YN # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -54,10 +54,12 @@ struct slot { u8 rx_ctcss; //see ctcss table, but radio code = CHIRP code+1. 0==off u8 tx_dcs; //see dcs table, but radio code = CHIRP code+1. 0==off u8 rx_dcs; //see dcs table, but radio code = CHIRP code+1. 0==off - u8 duplex; //(auto,offset). (0,2,4,5)= (+,-,0, auto) + u8 unknown1:5, + duplex:3; //(auto,offset). (0,2,4,5)= (+,-,0, auto) ul16 offset; //little-endian binary * scaler, +- per duplex //scaler is 25 kHz for FT-4, 50 kHz for FT-65. - u8 tx_width; //0=wide, 1=narrow + u8 unknown2:7, + tx_width:1; //0=wide, 1=narrow u8 step; //STEPS (0-9)=(auto,5,6.25,10,12.5,15,20,25,50,100) kHz u8 sql_type; //(0-6)==(off,r-tone,t-tone,tsql,rev tn,dcs,pager) u8 unused; @@ -241,7 +243,7 @@ def variable_len_resp(pipe): if i > toolong: LOG.debug("Response too long. got" + util.hexprint(response)) raise errors.RadioError("Response from radio too long.") - return(response) + return response def sendcmd(pipe, cmd, response_len): @@ -288,7 +290,7 @@ def enter_clonemode(radio): try: if b"QX" == sendcmd(radio.pipe, b"PROGRAM", 2): return - except: + except Exception: continue sendcmd(radio.pipe, b"END", 0) raise errors.RadioError("expected QX from radio.") @@ -308,16 +310,26 @@ def startcomms(radio, way): progressbar.max = radio.numblocks enter_clonemode(radio) id_response = sendcmd(radio.pipe, b'\x02', None) + + # The last byte of the ID contains info about regional differences + radio.subtype = id_response[-1] + # Set last byte of the ID zero so that no ID warning is thrown + # Unfortunately, the returned object is an immutable bytes object, + # so we need to convert into a bytearray, modify, and convert back. + ba_id_response = bytearray(id_response) + ba_id_response[len(ba_id_response) - 1] = 0 + id_response_mod = bytes(ba_id_response) + if id_response != radio.id_str: - substr0 = radio.id_str[:radio.id_str.find('\x00')] - if id_response[:id_response.find('\x00')] != substr0: + substr0 = radio.id_str[:radio.id_str.find(b'\x00')] + if id_response[:id_response.find(b'\x00')] != substr0: msg = "ID mismatch. Expected" + util.hexprint(radio.id_str) - msg += ", Received:" + util.hexprint(id_response) + msg += ", Received:" + util.hexprint(id_response_mod) LOG.warning(msg) raise errors.RadioError("Incorrect ID read from radio.") else: msg = "ID suspect. Expected" + util.hexprint(radio.id_str) - msg += ", Received:" + util.hexprint(id_response) + msg += ", Received:" + util.hexprint(id_response_mod) LOG.warning(msg) return progressbar @@ -332,12 +344,14 @@ def getblock(pipe, addr, image): cmd = struct.pack(">cHb", b"R", addr, 16) response = sendcmd(pipe, cmd, 21) if (response[0] != b"W"[0]) or (response[1:4] != cmd[1:4]): - msg = "Bad response. Sent:" + util.hexprint(cmd) + ", " - msg += b"Received:" + util.hexprint(response) + msg = "Bad response. Sent:\n%s" % util.hexprint(cmd) + msg += "\nReceived:\n%s" % util.hexprint(response) LOG.debug(msg) return False if checkSum8(response[1:20]) != bytearray(response)[20]: - LOG.debug(b"Bad checksum: " + util.hexprint(response)) + LOG.debug("Bad checksum:\n%s" % util.hexprint(response)) + LOG.debug('%r != %r' % (checkSum8(response[1:20]), + bytearray(response)[20])) return False image[addr:addr+16] = response[4:20] return True @@ -364,7 +378,7 @@ def do_download(radio): progressbar.cur = blocknum radio.status_fn(progressbar) sendcmd(pipe, b"END", 0) - return memmap.MemoryMap(bytes(image)) + return memmap.MemoryMapBytes(bytes(image)) def putblock(pipe, addr, data): @@ -466,6 +480,7 @@ class YaesuSC35GenericBankModel(chirp_common.BankModel): banks.append(bank) return banks + # the values in these lists must also be in the canonical UI list # we can re-arrange the order, and we don't need to have all # the values, but we cannot add our own values here. @@ -507,7 +522,7 @@ US_LEGAL_STEPS.remove(6.25) # euro radios just use STEP_CODE # is 6 (PAGER). Each row is a tuple. Its first member is a list of # [tmode,cross] or [tmode, cross, suppress]. "Suppress" is used only when # encoding UI-->radio. When decoding radio-->UI, two of the sql_types each -# result in 5 possibible UI decodings depending on the tx and rx codes, and the +# result in 5 possible UI decodings depending on the tx and rx codes, and the # list in each of these rows has five members. These two row tuples each have # two additional members to specify which of the radio fields to examine. # The map from CHIRP UI to radio image types is also built from this table. @@ -664,12 +679,24 @@ class YaesuSC35GenericRadio(chirp_common.CloneModeRadio, _memsize = 16 * numblocks # used by CHIRP file loader to guess radio type MAX_MEM_SLOT = 200 + # ID string last byte can contain extra info. It is usually 0; + # however, on FT25R/65R sold in Asia we have seen that it can be 3, + # which affects the scaler: instead of the default 50000 it's then 25000. + @property + def subtype(self): + return self.metadata.get('ft4_subtype', 0) + + @subtype.setter + def subtype(self, value): + self.metadata = {'ft4_subtype': int(value)} + @classmethod def get_prompts(cls): rp = chirp_common.RadioPrompts() rp.experimental = ( - 'Tested only by the developer and only on a single radio.\n' - 'Proceed at your own risk!' + 'Tested and mostly works, but may give you issues\n' + 'when using lesser common radio variants.\n' + 'Proceed at your own risk, and let us know about issues!' ) rp.pre_download = "".join([ @@ -812,7 +839,7 @@ class YaesuSC35GenericRadio(chirp_common.CloneModeRadio, # A param is a tuple: # for a simple param: (paramname, paramtitle,[valuename list]) # for a handler param: (paramname, paramtitle,( handler,[handler params])) - # This is a class variable. subclasses msut create a variable named + # This is a class variable. subclasses must create a variable named # class_group_descs. The FT-4 classes simply equate this, but the # FT-65 classes must copy and modify this. group_descriptions = [ @@ -843,8 +870,8 @@ class YaesuSC35GenericRadio(chirp_common.CloneModeRadio, ("bell", "Bell Repetitions", ["OFF", "1T", "3T", "5T", "8T", "CONT"]), ("dtmf_mode", "DTMF Mode", ["Manual", "Auto"]), ("dtmf_delay", "DTMF Autodialer Delay Time", - ["50 MS", "100 MS", "250 MS", "450 MS", "750 MS", "1000 MS"]), - ("dtmf_speed", "DTMF Autodialer Sending Speed", ["50 MS", "100 MS"]), + ["50 ms", "100 ms", "250 ms", "450 ms", "750 ms", "1000 ms"]), + ("dtmf_speed", "DTMF Autodialer Sending Speed", ["50 ms", "100 ms"]), ("dtmf", "DTMF Autodialer Memory ", (get_dtmfs, [])) # handler ]), ("switch", "Switch/Knob Settings", [ # switch @@ -862,7 +889,7 @@ class YaesuSC35GenericRadio(chirp_common.CloneModeRadio, ]), ("power", "Power Saver Settings", [ # power ("battsave", "Receive Mode Battery Save Interval", - ["OFF", "200 MS", "300 MS", "500 MS", "1 S", "2 S"]), + ["OFF", "200 ms", "300 ms", "500 ms", "1 s", "2 s"]), ("tx_save", "Transmitter Battery Saver", ["OFF", "ON"]) ]), ("eai", "EAI/EPCS Settings", [ # eai @@ -927,7 +954,7 @@ class YaesuSC35GenericRadio(chirp_common.CloneModeRadio, setattr(_settings, name, value) LOG.debug("Setting %s: %s" % (name, value)) - except: + except Exception: LOG.debug(element.get_name()) raise @@ -1014,7 +1041,7 @@ class YaesuSC35GenericRadio(chirp_common.CloneModeRadio, ndx = x[1].index(memref) array = x[0] break - except: + except Exception: num += len(x[1]) if array is None: LOG.debug("unknown Special %s", memref) @@ -1074,6 +1101,10 @@ class YaesuSC35GenericRadio(chirp_common.CloneModeRadio, mem = chirp_common.Memory() _mem, ndx, num, regtype, sname = self.slotloc(memref) mem.number = num + freq_offset_factor = self.freq_offset_factor + # FT-25R/65R Asia version (US is 0)? + if self.subtype == 3 and freq_offset_factor == 2: + freq_offset_factor = 1 # 25000 scaler # First, we need to know whether a channel is enabled, # then we can process any channel parameters. @@ -1112,7 +1143,7 @@ class YaesuSC35GenericRadio(chirp_common.CloneModeRadio, if _mem.duplex == 6: # split: offset is tx frequency mem.offset = txfreq else: - mem.offset = int(_mem.offset) * self.freq_offset_scale + mem.offset = int(_mem.offset) * 25000 * freq_offset_factor self.decode_sql(mem, _mem) mem.power = POWER_LEVELS[2 - _mem.tx_pwr] mem.mode = ["FM", "NFM"][_mem.tx_width] @@ -1126,7 +1157,7 @@ class YaesuSC35GenericRadio(chirp_common.CloneModeRadio, Raise an exception to cause UI to pop up an error message """ first_vfo_num = self.MAX_MEM_SLOT + len(PMSNAMES) + 1 - band = BAND_ASSIGNMENTS[mem_num - first_vfo_num] + band = self.BAND_ASSIGNMENTS[mem_num - first_vfo_num] frange = self.valid_bands[band] if freq >= frange[0] and freq <= frange[1]: memloc.freq = freq / 10 @@ -1137,7 +1168,7 @@ class YaesuSC35GenericRadio(chirp_common.CloneModeRadio, # modify a radio channel in memobj based on info in CHIRP canonical form def set_memory(self, mem): _mem, ndx, num, regtype, sname = self.slotloc(mem.number) - assert(_mem) + assert _mem if mem.empty: if regtype in ["memory", "pms"]: store_bit(self._memobj.enable, ndx, False) @@ -1153,7 +1184,11 @@ class YaesuSC35GenericRadio(chirp_common.CloneModeRadio, _mem.tx_width = mem.mode == "NFM" _mem.step = STEP_CODE.index(mem.tuning_step) - _mem.offset = mem.offset / self.freq_offset_scale + freq_offset_factor = self.freq_offset_factor + # FT-25R/65R Asia version (US version is 0)? + if self.subtype == 3 and freq_offset_factor == 2: + freq_offset_factor = 1 # 25000 scaler + _mem.offset = mem.offset / (25000 * freq_offset_factor) duplex = mem.duplex if regtype in ["memory", "pms"]: ndx = num - 1 @@ -1179,7 +1214,7 @@ class YaesuFT4GenericRadio(YaesuSC35GenericRadio): class_specials = SPECIALS_FT4 Pkeys = 2 # number of programmable keys namelen = 6 # length of the mem name display on the front-panel - freq_offset_scale = 25000 + freq_offset_factor = 1 # 25000 * 1 class_group_descs = YaesuSC35GenericRadio.group_descriptions # names for the setmode function for the programmable keys. Mode zero means # that the key is programmed for a memory not a setmode. @@ -1205,7 +1240,7 @@ class YaesuFT65GenericRadio(YaesuSC35GenericRadio): class_specials = SPECIALS_FT65 Pkeys = 4 # number of programmable keys namelen = 8 # length of the mem name display on the front-panel - freq_offset_scale = 50000 + freq_offset_factor = 2 # 25000 * 2 # we need a deep copy here because we are adding deeper than the top level. class_group_descs = copy.deepcopy(YaesuSC35GenericRadio.group_descriptions) add_paramdesc( @@ -1283,7 +1318,7 @@ class YaesuFT4VRRadio(YaesuFT4GenericRadio): @directory.register class YaesuFT65RRadio(YaesuFT65GenericRadio): """ - FT-65 dual band, US version + FT-65 dual band, US/Asia version """ MODEL = "FT-65R" id_str = b'IH-420\x00\x00\x00V100\x00\x00' @@ -1309,7 +1344,7 @@ class YaesuFT65ERadio(YaesuFT65GenericRadio): @directory.register class YaesuFT25RRadio(YaesuFT65GenericRadio): """ - FT-25 VHF, US version + FT-25 VHF, US/Asia version """ MODEL = "FT-25R" id_str = b'IFT-25R\x00\x00V100\x00\x00' diff --git a/chirp/drivers/ft450d.py b/chirp/drivers/ft450d.py index e5a1ee9..9f3fa05 100644 --- a/chirp/drivers/ft450d.py +++ b/chirp/drivers/ft450d.py @@ -1,1495 +1,1491 @@ -# Copyright 2018 by Rick DeWitt (aa0rd@yahoo.com> -# Bug fix for issue #8183, invalid APO Off value -# Thanks to Filippi Marco for Yaesu processes -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -"""FT450D Yaesu Radio Driver""" - -from chirp.drivers import yaesu_clone -from chirp import chirp_common, util, memmap, errors, directory, bitwise -from chirp.settings import RadioSetting, RadioSettingGroup, \ - RadioSettingValueInteger, RadioSettingValueList, \ - RadioSettingValueBoolean, RadioSettingValueString, \ - RadioSettingValueFloat, RadioSettings -import time -import logging -from textwrap import dedent - -LOG = logging.getLogger(__name__) - -CMD_ACK = 0x06 -# TBD: Enable some form of generated UI field, for the memory tags -# That field wiould not be stored in img file, but generated in get_memory -MEM_GRP_LBL = False # To ignore Comment channel-tags for now -EX_MODES = ["USER-L", "USER-U", "LSB+CW", "USB+CW", "RTTY-L", "RTTY-U", "N/A"] -for i in EX_MODES: - chirp_common.MODES.append(i) -T_STEPS = sorted(list(chirp_common.TUNING_STEPS)) -T_STEPS.remove(30.0) -T_STEPS.remove(100.0) -T_STEPS.remove(125.0) -T_STEPS.remove(200.0) - -@directory.register -class FT450DRadio(yaesu_clone.YaesuCloneModeRadio): - """Yaesu FT-450D""" - BAUD_RATE = 38400 - COM_BITS = 8 # number of data bits - COM_PRTY = 'N' # parity checking - COM_STOP = 1 # stop bits - MODEL = "FT-450D" - - DUPLEX = ["", "-", "+"] - MODES = ["LSB", "USB", "CW", "AM", "FM", "RTTY-L", - "USER-L", "USER-U", "NFM", "CWR"] - TMODES = ["", "Tone", "TSQL"] - STEPSFM = [5.0, 6.25, 10.0, 12.5, 15.0, 20.0, 25.0, 50.0] - STEPSAM = [2.5, 5.0, 9.0, 10.0, 12.5, 25.0] - STEPSSSB = [1.0, 2.5, 5.0] - VALID_BANDS = [(100000, 33000000), (33000000, 56000000)] - FUNC_LIST = ['MONI', 'N/A', 'PBAK', 'PLAY1', 'PLAY2', 'PLAY3', 'QSPLIT', - 'SPOT', 'SQLOFF', 'SWR', 'TXW', 'VCC', 'VOICE2', 'VM1MONI', - 'VM1REC', 'VM1TX', 'VM2MONI', 'VM2REC', 'VM2TX', 'DOWN', 'FAST', - 'UP', 'DSP', 'IPO/ATT', 'NB', 'AGC' , 'MODEDN', 'MODEUP', - 'DSP/SEL', 'KEYER', 'CLAR' , 'BANDDN', 'BANDUP', 'A=B', 'A/B', - 'LOCK', 'TUNE', 'VOICE', 'MW', 'V/M', 'HOME', 'RCL', 'VOX', 'STO', - 'STEP', 'SPLIT', 'PMS', 'SCAN', 'MENU', 'DIMMER', 'MTR'] - CHARSET = list(chirp_common.CHARSET_ASCII) - CHARSET.remove("\\") - - MEM_SIZE = 15017 - # block 9 (135 Bytes long) is to be repeated 101 times - _block_lengths = [4, 84, 135, 162, 135, 162, 151, 130, 135, 127, 189, 103] - - MEM_FORMAT = """ - struct mem_struct { // 27 bytes per channel - u8 tag_on_off:2, // @ Byte 0 1=Off, 2=On - unk0:2, - mode:4; - u8 duplex:2, // @ byte 1 - att:1, - ipo:1, - unka1:1, - tunerbad:1, // ?? Possible tuner failed - unk1b:1, // @@@??? - uprband:1; - u8 cnturpk:1, // @ Byte 2 Peak (clr), Null (set) - cnturmd:3, // Contour filter mode - cnturgn:1, // Contour filter gain Low/high - mode2:3; // When mode is data(5) - u8 ssb_step:2, // @ Byte 3 - am_step:3, - fm_step:3; - u8 tunerok:1, // @ Byte 4 ?? Poss tuned ok - cnturon:1, - unk4b:1, - dnr_on:1 - notch:1, - unk4c:1, - tmode:2; // Tone/Cross/etc as Off/Enc/Enc+Dec - u8 unk5a:4, // @ byte 5 - dnr_val:4; - u8 cw_width:2, // # byte 6, Notch width indexes - fm_width:2, - am_width:2, - sb_width:2; - i8 notch_pos; // @ Byte 7 Signed: - 0 + - u8 tone; // @ Byte 8 - u8 unk9; // @ Byte 9 Always set to 0 - u8 unkA; // @ Byte A - u8 unkB; // @ Byte B - u32 freq; // @ C-F - u32 offset; // @ 10-13 - u8 name[7]; // @ 14-1A - }; - - #seekto 0x04; - struct { - u8 set04; // ?Checksum / Clone counter? - u8 set05; // Current VFO? - u8 set06; - u8 fast:1, - lock:1, // Inverted: 1 = Off - nb:1, - agc:5; - u8 set08a:3, - keyer:1, - set08b:2, - mtr_mode:2; - u8 set09; - u8 set0A; - u8 set0B:2, - clk_sft:1, - cont:5; // 1:1 - u8 beepvol_sgn:1, // @x0C: set : Link @0x41, clear: fix @ 0x40 - set0Ca:3, - clar_btn:1, // 0 = Dial, 1= SEL - cwstone_sgn:1, // Set: Lnk @ x42, clear: Fixed at 0x43 - beepton:2; // Index 0-3 - u8 set0Da:1, - cw_key:1, - set0Db:3, - dialstp_mode:1, - dialstp:2; - u8 set0E:1, - keyhold:1, - lockmod:1, - set0ea:1, - amfmdial:1, // 0= Enabled. 1 = Disabled - cwpitch:3; // 0-based index - u8 sql_rfg:1 - set0F:2, - cwweigt:5; // Index 1:2.5=0 -> 1:4.5=20 - u8 cw_dly; // @x10 ms = val * 10 - u8 set11; - u8 cwspeed; // val 4-60 is wpm, *5 is cpm - u8 vox_gain; // val 1:1 - u8 set14:2, - emergen:1, - vox_dly:5; // ms = val * 100 - u8 set15a:1, - stby_beep:1 - set15b:1 - mem_grp:1, - apo:4; - u8 tot; // Byte x16, 1:1 - u8 micscan:1, - set17:5, - micgain:2; - u8 cwpaddl:1, // @x18 0=Key, 1=Mic - set18:7; - u8 set19; - u8 set1A; - u8 set1B; - u8 set1C; - u8 dig_vox; // 1:1 - u8 set1E; - i16 d_disp; // @ x1F,x20 signed 16bit - u8 pnl_cs; // 0-based index - u8 pm_up; - u8 pm_fst; - u8 pm_dwn; - u8 set25; - u8 set26; - u8 set27; - u8 set28; - u8 beacon_time; // 1:1 - u8 set2A; - u8 cat_rts:1, // @x2b: Enable=0, Disable=1 - peakhold:1, - set2B:4, - cat_tot:2; // Index 0-3 - u8 set2CA:2, - rtyrpol:1, - rtytpol:1 - rty_sft:2, - rty_ton:1, - set2CC:1; - u8 dig_vox; // 1:1 - u8 ext_mnu:1, - m_tune:1, - set2E:2, - scn_res:4; - u8 cw_auto:1, // Off=0, On=1 - cwtrain:2, // Index - set2F:1, - cw_qsk:2, // Index - cw_bfo:2; // Index - u8 mic_eq; // @x30 1:1 - u8 set31:5, - catrate:3; // Index 0-4 - u8 set32; - u8 dimmer:4, - set33:4; - u8 set34; - u8 set35; - u8 set36; - u8 set37; - u8 set38a:1, - rfpower:7; // 1:1 - u8 set39a:2, - tuner:3, // Index 0-4 - seldial:3; // Index 0-5 - u8 set3A; - u8 set3B; - u8 set3C; - i8 qspl_f; // Signed - u8 set3E; - u8 set3F; - u8 beepvol_fix; // 1:1 - i8 beepvol_lnk; // SIGNED 2's compl byte - u8 cwstone_fix; - i8 cwstone_lnk; // signed byte - u8 set44:2, - mym_data:1, // My Mode: Data, set = OFF - mym_fm:1, - mym_am:1, - mym_cw:1, - mym_usb:1, - mym_lsb:1; - u8 myb_24:1, // My Band: 24Mhz set = OFF - myb_21:1, - myb_18:1, - myb_14:1, - myb_10:1, - myb_7:1, - myb_3_5:1, - myb_1_8:1; - u8 set46:6, - myb_28:1, - myb_50:1; - u8 set47; - u8 set48; - u8 set49; - u8 set4A; - u8 set4B; - u8 set4C; - u8 set4D; - u8 set4E; - u8 set4F; - u8 set50; - u8 set51; - u8 set52; - u8 set53; - u8 set54; - u8 set55; - u8 set56a:3, - split:1, - set56b:4; - u8 set57; - } settings; - - #seekto 0x58; - struct mem_struct vfoa[11]; // The current cfgs for each vfo 'band' - struct mem_struct vfob[11]; - struct mem_struct home[2]; // The 2 Home cfgs (HF and 6m) - struct mem_struct qmb; // The Quick Memory Bank STO/RCL - struct mem_struct mtqmb; // Last QMB-MemTune cfg (not displayed) - struct mem_struct mtune; // Last MemTune cfg (not displayed) - - #seekto 0x343; // chan status - u8 visible[63]; // 1 bit per channel - u8 pmsvisible; // @ 0x382 - - #seekto 0x383; - u8 filled[63]; - u8 pmsfilled; // @ 0x3c2 - - #seekto 0x3C3; - struct mem_struct memory[500]; - struct mem_struct pms[4]; // Programmed Scan limits @ x387F - - #seekto 0x3906; - struct { - char t1[40]; // CW Beacon Text - char t2[40]; - char t3[40]; - } beacontext; // to 0x397E - - #seekto 0x3985; - struct mem_struct m60[5]; // to 0x3A0B - - #seekto 0x03a45; - struct mem_struct current; - - """ - _CALLSIGN_CHARSET = [chr(x) for x in range(ord("0"), ord("9") + 1) + - range(ord("A"), ord("Z") + 1) + [ord(" ")]] - _CALLSIGN_CHARSET_REV = dict(zip(_CALLSIGN_CHARSET, - range(0, len(_CALLSIGN_CHARSET)))) - - # WARNING Indecis are hard wired in get/set_memory code !!! - # Channels print in + increasing index order (PMS first) - SPECIAL_MEMORIES = { - "VFOa-1.8M": -27, - "VFOa-3.5M": -26, - "VFOa-7M": -25, - "VFOa-10M": -24, - "VFOa-14M": -23, - "VFOa-18M": -22, - "VFOa-21M": -21, - "VFOa-24M": -20, - "VFOa-28M": -19, - "VFOa-50M": -18, - "VFOa-HF": -17, - "VFOb-1.8M": -16, - "VFOb-3.5M": -15, - "VFOb-7M": -14, - "VFOb-10M": -13, - "VFOb-14M": -12, - "VFOb-18M": -11, - "VFOb-21M": - 10, - "VFOb-24M": -9, - "VFOb-28M": -8, - "VFOb-50M": -7, - "VFOb-HF": -6, - "HOME-HF": -5, - "HOME-50M": -4, - "QMB": -3, - "QMB-MTune": -2, - "Mem-Tune": -1, - } - FIRST_VFOB_INDEX = -6 - LAST_VFOB_INDEX = -16 - FIRST_VFOA_INDEX = -17 - LAST_VFOA_INDEX = -27 - - SPECIAL_PMS = { - "PMS1-L": -36, - "PMS1-U": -35, - "PMS2-L": -34, - "PMS2-U": -33, - } - LAST_PMS_INDEX = -36 - SPECIAL_MEMORIES.update(SPECIAL_PMS) - - SPECIAL_60M = { - "60m-Ch1": -32, - "60m-Ch2": -31, - "60m-Ch3": -30, - "60m-Ch4": -29, - "60m-Ch5": -28, - } - LAST_60M_INDEX = -32 - SPECIAL_MEMORIES.update(SPECIAL_60M) - - SPECIAL_MEMORIES_REV = dict(zip(SPECIAL_MEMORIES.values(), - SPECIAL_MEMORIES.keys())) - - @classmethod - def get_prompts(cls): - rp = chirp_common.RadioPrompts() - rp.info = _(dedent(""" - The FT-450 radio driver loads the 'Special Channels' tab - with the PMS scanning range memories (group 11), 60meter - channels (group 12), the QMB (STO/RCL) memory, the HF and - 50m HOME memories and all the A and B VFO memories. - There are VFO memories for the last frequency dialed in - each band. The last mem-tune config is also stored. - These Special Channels allow limited field editing. - This driver also populates the 'Other' tab in the channel - memory Properties window. This tab contains values for - those channel memory settings that don't fall under the - standard Chirp display columns. - """)) - rp.pre_download = _(dedent("""\ - 1. Turn radio off. - 2. Connect cable to ACC jack. - 3. Press and hold in the [MODE <] and [MODE >] keys while - turning the radio on ("CLONE MODE" will appear on the - display). - 4. After clicking OK here, press the [C.S.] key to - send image.""")) - rp.pre_upload = _(dedent("""\ - 1. Turn radio off. - 2. Connect cable to ACC jack. - 3. Press and hold in the [MODE <] and [MODE >] keys while - turning the radio on ("CLONE MODE" will appear on the - display). - 4. Click OK here. - ("Receiving" will appear on the LCD).""")) - return rp - - def _read(self, block, blocknum): - # be very patient at first block - if blocknum == 0: - attempts = 60 - else: - attempts = 5 - for _i in range(0, attempts): - data = self.pipe.read(block + 2) # Blocknum, data,checksum - if data: - break - time.sleep(0.5) - if len(data) == block + 2 and data[0] == chr(blocknum): - checksum = yaesu_clone.YaesuChecksum(1, block) - if checksum.get_existing(data) != \ - checksum.get_calculated(data): - raise Exception("Checksum Failed [%02X<>%02X] block %02X" % - (checksum.get_existing(data), - checksum.get_calculated(data), blocknum)) - # Remove the block number and checksum - data = data[1:block + 1] - else: # Use this info to decode a new Yaesu model - raise Exception("Unable to read block %i expected %i got %i" - % (blocknum, block + 2, len(data))) - return data - - def _clone_in(self): - # Be very patient with the radio - self.pipe.timeout = 2 - self.pipe.baudrate = self.BAUD_RATE - self.pipe.bytesize = self.COM_BITS - self.pipe.parity = self.COM_PRTY - self.pipe.stopbits = self.COM_STOP - self.pipe.rtscts = False - - start = time.time() - - data = "" - blocks = 0 - status = chirp_common.Status() - status.msg = _("Cloning from radio") - nblocks = len(self._block_lengths) + 100 # Block 8 repeats - status.max = nblocks - for block in self._block_lengths: - if blocks == 8: - # repeated read of block 8 same size (chan memory area) - repeat = 101 - else: - repeat = 1 - for _i in range(0, repeat): - data += self._read(block, blocks) - self.pipe.write(chr(CMD_ACK)) - blocks += 1 - status.cur = blocks - self.status_fn(status) - data += self.MODEL # Append ID - return memmap.MemoryMap(data) - - def _clone_out(self): - self.pipe.baudrate = self.BAUD_RATE - self.pipe.bytesize = self.COM_BITS - self.pipe.parity = self.COM_PRTY - self.pipe.stopbits = self.COM_STOP - self.pipe.rtscts = False - delay = 0.5 - start = time.time() - blocks = 0 - pos = 0 - status = chirp_common.Status() - status.msg = _("Cloning to radio") - status.max = len(self._block_lengths) + 100 - for block in self._block_lengths: - if blocks == 8: - repeat = 101 - else: - repeat = 1 - for _i in range(0, repeat): - time.sleep(0.01) - checksum = yaesu_clone.YaesuChecksum(pos, pos + block - 1) - self.pipe.write(chr(blocks)) - self.pipe.write(self.get_mmap()[pos:pos + block]) - self.pipe.write(chr(checksum.get_calculated(self.get_mmap()))) - buf = self.pipe.read(1) - if not buf or buf[0] != chr(CMD_ACK): - time.sleep(delay) - buf = self.pipe.read(1) - if not buf or buf[0] != chr(CMD_ACK): - raise Exception(_("Radio did not ack block %i") % blocks) - pos += block - blocks += 1 - status.cur = blocks - self.status_fn(status) - - - def sync_in(self): - try: - self._mmap = self._clone_in() - except errors.RadioError: - raise - except Exception, e: - raise errors.RadioError("Failed to communicate with radio: %s" - % e) - self.process_mmap() - - def sync_out(self): - try: - self._clone_out() - except errors.RadioError: - raise - except Exception, e: - raise errors.RadioError("Failed to communicate with radio: %s" - % e) - - def process_mmap(self): - self._memobj = bitwise.parse(self.MEM_FORMAT, self._mmap) - - def get_features(self): - rf = chirp_common.RadioFeatures() - rf.has_bank = False - rf.has_dtcs= False - if MEM_GRP_LBL: - rf.has_comment = True # Used for Mem-Grp number - rf.valid_modes = list(set(self.MODES)) - rf.valid_tmodes = list(self.TMODES) - rf.valid_duplexes = list(self.DUPLEX) - rf.valid_tuning_steps = list(T_STEPS) - rf.valid_bands = self.VALID_BANDS - rf.valid_power_levels = [] - rf.valid_characters = "".join(self.CHARSET) - rf.valid_name_length = 7 - rf.valid_skips = [] - rf.valid_special_chans = sorted(self.SPECIAL_MEMORIES.keys()) - rf.memory_bounds = (1, 500) - rf.has_ctone = True - rf.has_settings = True - rf.has_cross = True - return rf - - def get_raw_memory(self, number): - return repr(self._memobj.memory[number - 1]) - - def _get_tmode(self, mem, _mem): - mem.tmode = self.TMODES[_mem.tmode] - mem.rtone = chirp_common.TONES[_mem.tone] - mem.ctone = mem.rtone - - def _set_duplex(self, mem, _mem): - _mem.duplex = self.DUPLEX.index(mem.duplex) - - def get_memory(self, number): - if isinstance(number, str): - return self._get_special(number) - elif number < 0: - # I can't stop delete operation from losing extd_number but - # I know how to get it back - return self._get_special(self.SPECIAL_MEMORIES_REV[number]) - else: - return self._get_normal(number) - - def set_memory(self, memory): - if memory.number < 0: - return self._set_special(memory) - else: - return self._set_normal(memory) - - def _get_special(self, number): - mem = chirp_common.Memory() - mem.number = self.SPECIAL_MEMORIES[number] - mem.extd_number = number - - if mem.number in range(self.FIRST_VFOA_INDEX, - self.LAST_VFOA_INDEX - 1, -1): - _mem = self._memobj.vfoa[-self.LAST_VFOA_INDEX + mem.number] - immutable = ["number", "extd_number", "name", "power"] - elif mem.number in range(self.FIRST_VFOB_INDEX, - self.LAST_VFOB_INDEX - 1, -1): - _mem = self._memobj.vfob[-self.LAST_VFOB_INDEX + mem.number] - immutable = ["number", "extd_number", "name", "power"] - elif mem.number in range(-4, -6, -1): # 2 Home Chans - _mem = self._memobj.home[5 + mem.number] - immutable = ["number", "extd_number", "name", "power"] - elif mem.number == -3: - _mem = self._memobj.qmb - immutable = ["number", "extd_number", "name", "power"] - elif mem.number == -2: - _mem = self._memobj.mtqmb - immutable = ["number", "extd_number", "name", "power"] - elif mem.number == -1: - _mem = self._memobj.mtune - immutable = ["number", "extd_number", "name", "power"] - elif mem.number in self.SPECIAL_PMS.values(): - bitindex = (-self.LAST_PMS_INDEX) + mem.number - used = (self._memobj.pmsvisible >> bitindex) & 0x01 - valid = (self._memobj.pmsfilled >> bitindex) & 0x01 - if not used: - mem.empty = True - if not valid: - mem.empty = True - return mem - mx = (-self.LAST_PMS_INDEX) + mem.number - _mem = self._memobj.pms[mx] - mx = mx + 1 - if MEM_GRP_LBL: - mem.comment = "M-11-%02i" % mx - immutable = ["number", "rtone", "ctone", "extd_number", - "tmode", "cross_mode", - "power", "duplex", "offset"] - elif mem.number in self.SPECIAL_60M.values(): - mx = (-self.LAST_60M_INDEX) + mem.number - _mem = self._memobj.m60[mx] - mx = mx + 1 - if MEM_GRP_LBL: - mem.comment = "M-12-%02i" % mx - immutable = ["number", "rtone", "ctone", "extd_number", - "tmode", "cross_mode", - "frequency", "power", "duplex", "offset"] - else: - raise Exception("Sorry, you can't edit that special" - " memory channel %i." % mem.number) - - mem = self._get_memory(mem, _mem) - mem.immutable = immutable - - return mem - - def _set_special(self, mem): - if mem.empty and mem.number not in self.SPECIAL_PMS.values(): - # can't delete special memories! - raise Exception("Sorry, special memory can't be deleted") - - cur_mem = self._get_special(self.SPECIAL_MEMORIES_REV[mem.number]) - - if mem.number in range(self.FIRST_VFOA_INDEX, - self.LAST_VFOA_INDEX - 1, -1): - _mem = self._memobj.vfoa[-self.LAST_VFOA_INDEX + mem.number] - elif mem.number in range(self.FIRST_VFOB_INDEX, - self.LAST_VFOB_INDEX - 1, -1): - _mem = self._memobj.vfob[-self.LAST_VFOB_INDEX + mem.number] - elif mem.number in range(-4, -6, -1): - _mem = self._memobj.home[5 + mem.number] - elif mem.number == -3: - _mem = self._memobj.qmb - elif mem.number == -2: - _mem = self._memobj.mtqmb - elif mem.number == -1: - _mem = self._memobj.mtune - elif mem.number in self.SPECIAL_PMS.values(): - bitindex = (-self.LAST_PMS_INDEX) + mem.number - wasused = (self._memobj.pmsvisible >> bitindex) & 0x01 - wasvalid = (self._memobj.pmsfilled >> bitindex) & 0x01 - if mem.empty: - if wasvalid and not wasused: - # pylint get confused by &= operator - self._memobj.pmsfilled = self._memobj.pmsfilled & \ - ~ (1 << bitindex) - # pylint get confused by &= operator - self._memobj.pmsvisible = self._memobj.pmsvisible & \ - ~ (1 << bitindex) - return - # pylint get confused by |= operator - self._memobj.pmsvisible = self._memobj.pmsvisible | 1 << bitindex - self._memobj.pmsfilled = self._memobj.pmsfilled | 1 << bitindex - _mem = self._memobj.pms[-self.LAST_PMS_INDEX + mem.number] - else: - raise Exception("Sorry, you can't edit" - " that special memory.") - - for key in cur_mem.immutable: - if key != "extd_number": - if cur_mem.__dict__[key] != mem.__dict__[key]: - raise errors.RadioError("Editing field `%s' " % key + - "is not supported on this channel") - - self._set_memory(mem, _mem) - - def _get_normal(self, number): - _mem = self._memobj.memory[number - 1] - used = (self._memobj.visible[(number - 1) / 8] >> (number - 1) % 8) \ - & 0x01 - valid = (self._memobj.filled[(number - 1) / 8] >> (number - 1) % 8) \ - & 0x01 - - mem = chirp_common.Memory() - mem.number = number - if not used: - mem.empty = True - if not valid or _mem.freq == 0xffffffff: - return mem - if MEM_GRP_LBL: - mgrp = int((number - 1) / 50) - mem.comment = "M-%02i-%02i" % (mgrp + 1, number - (mgrp * 50)) - return self._get_memory(mem, _mem) - - def _set_normal(self, mem): - _mem = self._memobj.memory[mem.number - 1] - wasused = (self._memobj.visible[(mem.number - 1) / 8] >> - (mem.number - 1) % 8) & 0x01 - wasvalid = (self._memobj.filled[(mem.number - 1) / 8] >> - (mem.number - 1) % 8) & 0x01 - - if mem.empty: - if mem.number == 1: - raise Exception("Sorry, can't delete first memory") - if wasvalid and not wasused: - self._memobj.filled[(mem.number - 1) / 8] &= \ - ~(1 << (mem.number - 1) % 8) - _mem.set_raw("\xFF" * (_mem.size() / 8)) # clean up - self._memobj.visible[(mem.number - 1) / 8] &= \ - ~(1 << (mem.number - 1) % 8) - return - if not wasvalid: - _mem.set_raw("\x00" * (_mem.size() / 8)) # clean up - - self._memobj.visible[(mem.number - 1) / 8] |= 1 << (mem.number - 1) \ - % 8 - self._memobj.filled[(mem.number - 1) / 8] |= 1 << (mem.number - 1) \ - % 8 - self._set_memory(mem, _mem) - - def _get_memory(self, mem, _mem): - mem.freq = int(_mem.freq) - mem.offset = int(_mem.offset) - mem.duplex = self.DUPLEX[_mem.duplex] - # Mode gets tricky with dual (USB+DATA) options - vx = _mem.mode - if vx == 4: # FM or NFM - if _mem.mode2 == 2: - vx = 4 # FM - else: - vx = 8 # NFM - if vx == 10: # CWR - vx = 9 - if vx == 5: # Data/Dual mode - if _mem.mode2 == 0: # RTTY-L - vx = 5 - if _mem.mode2 == 1: # USER-L - vx = 6 - if _mem.mode2 == 2: # USER-U - vx = 7 - mem.mode = self.MODES[vx] - if mem.mode == "FM" or mem.mode == "NFM": - mem.tuning_step = self.STEPSFM[_mem.fm_step] - elif mem.mode == "AM": - mem.tuning_step = self.STEPSAM[_mem.am_step] - elif mem.mode[:2] == "CW": - mem.tuning_step = self.STEPSSSB[_mem.ssb_step] - else: - try: - mem.tuning_step = self.STEPSSSB[_mem.ssb_step] - except IndexError: - pass - self._get_tmode(mem, _mem) - - if _mem.tag_on_off == 2: - for i in _mem.name: - if i == 0xFF: - break - if chr(i) in self.CHARSET: - mem.name += chr(i) - else: - # radio has some graphical chars that are not supported - # we replace those with a * - LOG.info("Replacing char %x with *" % i) - mem.name += "*" - mem.name = mem.name.rstrip() - else: - mem.name = "" - - mem.extra = RadioSettingGroup("extra", "Extra") - - rs = RadioSetting("ipo", "IPO", - RadioSettingValueBoolean(bool(_mem.ipo))) - rs.set_doc("Bypass preamp") - mem.extra.append(rs) - - rs = RadioSetting("att", "ATT", - RadioSettingValueBoolean(bool(_mem.att))) - rs.set_doc("10dB front end attenuator") - mem.extra.append(rs) - - rs = RadioSetting("cnturon", "Contour Filter", - RadioSettingValueBoolean(_mem.cnturon )) - rs.set_doc("Contour filter on/off") - mem.extra.append(rs) - - options = ["Peak", "Null"] - rs = RadioSetting("cnturpk", "Contour Filter Mode", - RadioSettingValueList(options, - options[_mem.cnturpk])) - mem.extra.append(rs) - - options = ["Low", "High"] - rs = RadioSetting("cnturgn", "Contour Filter Gain", - RadioSettingValueList(options, - options[_mem.cnturgn])) - rs.set_doc("Filter gain/attenuation") - mem.extra.append(rs) - - options = ["-2", "-1", "Center", "+1", "+2"] - rs = RadioSetting("cnturmd", "Contour Filter Notch", - RadioSettingValueList(options, - options[_mem.cnturmd])) - rs.set_doc("Filter notch offset") - mem.extra.append(rs) - - rs = RadioSetting("notch", "Notch Filter", - RadioSettingValueBoolean(_mem.notch )) - rs.set_doc("IF bandpass filter") - mem.extra.append(rs) - - vx = 1 - options = ["<-", "Center", "+>"] - if _mem.notch_pos < 0: - vx = 0 - if _mem.notch_pos > 0: - vx = 2 - rs = RadioSetting("notch_pos", "Notch Position", - RadioSettingValueList(options, options[vx])) - rs.set_doc("IF bandpass filter shift") - mem.extra.append(rs) - - vx = 0 - if mem.mode[1:] == "SB": - options = ["1.8kHz", "2.4kHz", "3.0kHz"] - vx = _mem.sb_width - stx = "sb_width" - elif mem.mode[:1] == "CW": - options = ["300Hz", "500 kHz", "2.4kHz"] - vx = _mem.cw_width - stx = "cw_width" - elif mem.mode[:4] == "USER" or mem.mode[:4] == "RTTY": - options = ["300Hz", "2.4kHz", "3.0kHz"] - vx = _mem.sb_width - stx = "sb_width" - elif mem.mode == "AM": - options = ["3.0kHz", "6.0kHz", "9.0 kHz"] - vx = _mem.am_width - stx = "am_width" - else: - options = ["2.5kHz", "5.0kHz"] - vx = _mem.fm_width - stx = "fm_width" - rs = RadioSetting(stx, "IF Bandpass Filter Width", - RadioSettingValueList(options, options[vx])) - rs.set_doc("DSP IF bandpass Notch width (Hz)") - mem.extra.append(rs) - - rs = RadioSetting("dnr_on", "DSP Noise Reduction", - RadioSettingValueBoolean(bool(_mem.dnr_on))) - rs.set_doc("Digital noise processing") - mem.extra.append(rs) - - options = ["Off", "1", "2", "3", "4", "5", "6", "7", - "8", "9", "10", "11"] - rs = RadioSetting("dnr_val", "DSP Noise Reduction Alg", - RadioSettingValueList(options, - options[ _mem.dnr_val])) - rs.set_doc("Digital noise reduction algorithm number (1-11)") - mem.extra.append(rs) - - return mem # end get_memory - - def _set_memory(self, mem, _mem): - if len(mem.name) > 0: - _mem.tag_on_off = 2 - else: - _mem.tag_on_off = 1 - self._set_duplex(mem, _mem) - _mem.mode2 = 0 - if mem.mode == "USER-L": - _mem.mode = 5 - _mem.mode2 = 1 - elif mem.mode == "USER-U": - _mem.mode = 5 - _mem.mode2 = 2 - elif mem.mode == "RTTY-L": - _mem.mode = 5 - _mem.mode2 = 0 - elif mem.mode == "CWR": - _mem.mode = 10 - _mem.mode2 = 0 - elif mem.mode == "CW": - _mem.mode = 2 - _mem.mode2 = 0 - elif mem.mode == "NFM": - _mem.mode = 4 - _mem.mode2 = 1 - elif mem.mode == "FM": - _mem.mode = 4 - _mem.mode2 = 2 - else: # LSB, USB, AM - _mem.mode = self.MODES.index(mem.mode) - _mem.mode2 = 0 - try: - _mem.ssb_step = self.STEPSSSB.index(mem.tuning_step) - except ValueError: - pass - try: - _mem.am_step = self.STEPSAM.index(mem.tuning_step) - except ValueError: - pass - try: - _mem.fm_step = self.STEPSFM.index(mem.tuning_step) - except ValueError: - pass - _mem.freq = mem.freq - _mem.uprband = 0 - if mem.freq >= 33000000: - _mem.uprband = 1 - _mem.offset = mem.offset - _mem.tmode = self.TMODES.index(mem.tmode) - _mem.tone = chirp_common.TONES.index(mem.rtone) - _mem.tunerok = 0 # Dont know what these two do... - _mem.tunerbad = 0 - - for i in range(0, 7): - _mem.name[i] = ord(mem.name.ljust(7)[i]) - - for setting in mem.extra: - if setting.get_name() == "notch_pos": - vx = 0 # Override list string with signed value - stx = str(setting.value) - if stx == "<-": - vx = -13 - if stx == "+>": - vx = 12 - setattr(_mem, "notch_pos", vx) - elif setting.get_name() == "dnr_val": - stx = str(setting.value) # Convert string to int - vx = 0 - if stx != "Off": - vx = int(stx) - else: - setattr(_mem, "dnr_on", 0) - setattr(_mem, setting.get_name(), vx) - else: - setattr(_mem, setting.get_name(), setting.value) - - - @classmethod - def match_model(cls, filedata, filename): - """Match the opened/downloaded image to the correct version""" - if len(filedata) == cls.MEM_SIZE + 7: # +7 bytes of model name - rid = filedata[cls.MEM_SIZE:cls.MEM_SIZE + 7] - if rid.startswith(cls.MODEL): - return True - else: - return False - - def _invert_me(self, setting, obj, atrb): - """Callback: from inverted logic 1-bit booleans""" - invb = not setting.value - setattr(obj, atrb, invb) - return - - def _chars2str(self, cary, knt): - """Convert raw memory char array to a string: NOT a callback.""" - stx = "" - for char in cary[:knt]: - stx += chr(char) - return stx - - def _my_str2ary(self, setting, obj, atrba, knt): - """Callback: convert string to fixed-length char array..""" - ary = "" - for j in range(0, knt, 1): - chx = ord(str(setting.value)[j]) - if chx < 32 or chx > 125: # strip non-printing - ary += " " - else: - ary += str(setting.value)[j] - setattr(obj, atrba, ary) - return - - def get_settings(self): - _settings = self._memobj.settings - _beacon = self._memobj.beacontext - gen = RadioSettingGroup("gen", "General") - cw = RadioSettingGroup("cw", "CW") - pnlcfg = RadioSettingGroup("pnlcfg", "Panel buttons") - pnlset = RadioSettingGroup("pnlset", "Panel settings") - voxdat = RadioSettingGroup("voxdat", "VOX and Data") - mic = RadioSettingGroup("mic", "Microphone") - mybands = RadioSettingGroup("mybands", "My Bands") - mymodes = RadioSettingGroup("mymodes", "My Modes") - - top = RadioSettings(gen, cw, pnlcfg, pnlset, voxdat, mic, - mymodes, mybands) - - self._do_general_settings(gen) - self._do_cw_settings(cw) - self._do_panel_buttons(pnlcfg) - self._do_panel_settings(pnlset) - self._do_vox_settings(voxdat) - self._do_mic_settings(mic) - self._do_mymodes_settings(mymodes) - self._do_mybands_settings(mybands) - - return top - - def _do_general_settings(self, tab): - _settings = self._memobj.settings - - rs = RadioSetting("ext_mnu", "Extended menu", - RadioSettingValueBoolean(_settings.ext_mnu)) - rs.set_doc("Enables access to extended settings in the radio") - tab.append(rs) - # Issue #8183 bugfix - rs = RadioSetting("apo", "APO time (Hrs)", - RadioSettingValueInteger(0, 12, _settings.apo)) - tab.append(rs) - - options = ["%i" % i for i in range(0, 21)] - options[0] = "Off" - rs = RadioSetting("tot", "TX 'TOT' time-out (mins)", - RadioSettingValueList(options, - options[_settings.tot])) - tab.append(rs) - - bx = not _settings.cat_rts # Convert from Enable=0 - rs = RadioSetting("cat_rts", "CAT RTS flow control", - RadioSettingValueBoolean(bx)) - rs.set_apply_callback(self._invert_me, _settings, "cat_rts") - tab.append(rs) - - options = ["0", "100ms", "1000ms", "3000ms"] - rs = RadioSetting("cat_tot", "CAT Timeout", - RadioSettingValueList(options, - options[_settings.cat_tot])) - tab.append(rs) - - options = ["4800", "9600", "19200", "38400", "Data"] - rs = RadioSetting("catrate", "CAT rate", - RadioSettingValueList(options, - options[_settings.catrate])) - tab.append(rs) - - rs = RadioSetting("mem_grp", "Mem groups", - RadioSettingValueBoolean(_settings.mem_grp)) - tab.append(rs) - - rs = RadioSetting("scn_res", "Resume scan (secs)", - RadioSettingValueInteger(0, 10, _settings.scn_res)) - tab.append(rs) - - rs = RadioSetting("clk_sft", "CPU clock shift", - RadioSettingValueBoolean(_settings.clk_sft)) - tab.append(rs) - - rs = RadioSetting("split", "TX/RX Frequency Split", - RadioSettingValueBoolean(_settings.split)) - tab.append(rs) - - rs = RadioSetting("qspl_f", "Quick-Split freq offset (KHz)", - RadioSettingValueInteger(-20, 20, _settings.qspl_f)) - tab.append(rs) - - rs = RadioSetting("emergen", "Alaska Emergency Mem 5167.5KHz", - RadioSettingValueBoolean(_settings.emergen)) - tab.append(rs) - - rs = RadioSetting("stby_beep", "PTT release 'Standby' beep", - RadioSettingValueBoolean(_settings.stby_beep)) - tab.append(rs) - - options = ["ATAS", "EXT ATU", "INT ATU", "INTRATU", "F-TRANS"] - rs = RadioSetting("tuner", "Antenna Tuner", - RadioSettingValueList(options, - options[_settings.tuner])) - tab.append(rs) - - rs = RadioSetting("rfpower", "RF power (watts)", - RadioSettingValueInteger(5, 100, _settings.rfpower)) - tab.append(rs) # End of _do_general_settings - - - def _do_cw_settings(self, cw): # - - - CW - - - - _settings = self._memobj.settings - _beacon = self._memobj.beacontext - - rs = RadioSetting("cw_dly", "CW break-in delay (ms * 10)", - RadioSettingValueInteger(0, 300, _settings.cw_dly)) - cw.append(rs) - - options = ["%i Hz" % i for i in range(400, 801, 100)] - rs = RadioSetting("cwpitch", "CW pitch", - RadioSettingValueList(options, - options[_settings.cwpitch])) - cw.append(rs) - - rs = RadioSetting("cwspeed", "CW speed (wpm)", - RadioSettingValueInteger(4, 60, _settings.cwspeed)) - rs.set_doc("Cpm is Wpm * 5") - cw.append(rs) - - options = ["1:%1.1f" % (i / 10) for i in range(25, 46, 1)] - rs = RadioSetting("cwweigt", "CW weight", - RadioSettingValueList(options, - options[_settings.cwweigt])) - cw.append(rs) - - options = ["15ms", "20ms", "25ms", "30ms"] - rs = RadioSetting("cw_qsk", "CW delay before TX in QSK mode", - RadioSettingValueList(options, - options[_settings.cw_qsk])) - cw.append(rs) - - rs = RadioSetting("cwstone_sgn", "CW sidetone volume Linked", - RadioSettingValueBoolean(_settings.cwstone_sgn)) - rs.set_doc("If set; volume is relative to AF Gain knob.") - cw.append(rs) - - rs = RadioSetting("cwstone_lnk", "CW sidetone linked volume", - RadioSettingValueInteger(-50, 50, - _settings.cwstone_lnk)) - cw.append(rs) - - rs = RadioSetting("cwstone_fix", "CW sidetone fixed volume", - RadioSettingValueInteger(0, 100, - _settings.cwstone_fix)) - cw.append(rs) - - options = [ "Numeric", "Alpha", "Mixed"] - rs = RadioSetting("cwtrain", "CW Training mode", - RadioSettingValueList(options, - options[_settings.cwtrain])) - cw.append(rs) - - rs = RadioSetting("cw_auto", "CW key jack- auto CW mode", - RadioSettingValueBoolean(_settings.cw_auto)) - rs.set_doc("Enable for CW mode auto-set when keyer pluuged in.") - cw.append(rs) - - options = ["Normal", "Reverse"] - rs = RadioSetting("cw_key", "CW paddle wiring", - RadioSettingValueList(options, - options[_settings.cw_key])) - cw.append(rs) - - rs = RadioSetting("beacon_time", "CW beacon Tx interval (secs)", - RadioSettingValueInteger(0, 255, - _settings.beacon_time)) - cw.append(rs) - - tmp = self._chars2str(_beacon.t1, 40) - rs=RadioSetting("t1", "CW Beacon Line 1", - RadioSettingValueString(0, 40, tmp)) - rs.set_apply_callback(self._my_str2ary, _beacon, "t1", 40) - cw.append(rs) - - tmp = self._chars2str(_beacon.t2, 40) - rs=RadioSetting("t2", "CW Beacon Line 2", - RadioSettingValueString(0, 40, tmp)) - rs.set_apply_callback(self._my_str2ary, _beacon, "t2", 40) - cw.append(rs) - - tmp = self._chars2str(_beacon.t3, 40) - rs=RadioSetting("t3", "CW Beacon Line 3", - RadioSettingValueString(0, 40, tmp)) - rs.set_apply_callback(self._my_str2ary, _beacon, "t3", 40) - cw.append(rs) # END _do_cw_settings - - - def _do_panel_settings(self, pnlset): # - - - Panel settings - _settings = self._memobj.settings - - bx = not _settings.amfmdial # Convert from Enable=0 - rs = RadioSetting("amfmdial", "AM&FM Dial", - RadioSettingValueBoolean(bx)) - rs.set_apply_callback(self._invert_me, _settings, "amfmdial") - pnlset.append(rs) - - options = ["440Hz", "880Hz", "1760Hz"] - rs = RadioSetting("beepton", "Beep frequency", - RadioSettingValueList(options, - options[_settings.beepton])) - pnlset.append(rs) - - rs = RadioSetting("beepvol_sgn", "Beep volume Linked", - RadioSettingValueBoolean(_settings.beepvol_sgn)) - rs.set_doc("If set; volume is relative to AF Gain knob.") - pnlset.append(rs) - - rs = RadioSetting("beepvol_lnk", "Linked beep volume", - RadioSettingValueInteger(-50, 50, - _settings.beepvol_lnk)) - rs.set_doc("Relative to AF-Gain setting.") - pnlset.append(rs) - - rs = RadioSetting("beepvol_fix", "Fixed beep volume", - RadioSettingValueInteger(0, 100, - _settings.beepvol_fix)) - rs.set_doc("When Linked setting is unchecked.") - pnlset.append(rs) - - rs = RadioSetting("cont", "LCD Contrast", - RadioSettingValueInteger(1, 24, _settings.cont )) - rs.set_doc("This setting does not appear to do anything...") - pnlset.append(rs) - - rs = RadioSetting("dimmer", "LCD Dimmer", - RadioSettingValueInteger(1, 8, _settings.dimmer )) - pnlset.append(rs) - - options = ["RF-Gain", "Squelch"] - rs = RadioSetting("sql_rfg", "Squelch/RF-Gain", - RadioSettingValueList(options, - options[_settings.sql_rfg])) - pnlset.append(rs) - - options = ["Frequencies", "Panel", "All"] - rs = RadioSetting("lockmod", "Lock Mode", - RadioSettingValueList(options, - options[_settings.lockmod])) - pnlset.append(rs) - - options = ["Dial", "SEL"] - rs = RadioSetting("clar_btn", "CLAR button control", - RadioSettingValueList(options, - options[_settings.clar_btn])) - pnlset.append(rs) - - if _settings.dialstp_mode == 0: # AM/FM - options = ["SSB/CW:1Hz", "SSB/CW:10Hz", "SSB/CW:20Hz"] - else: - options = ["AM/FM:100Hz", "AM/FM:200Hz"] - rs = RadioSetting("dialstp", "Dial tuning step", - RadioSettingValueList(options, - options[_settings.dialstp])) - pnlset.append(rs) - - options = ["0.5secs", "1.0secs", "1.5secs", "2.0secs"] - rs = RadioSetting("keyhold", "Buttons hold-to-activate time", - RadioSettingValueList(options, - options[_settings.keyhold])) - pnlset.append(rs) - - rs = RadioSetting("m_tune", "Memory tune", - RadioSettingValueBoolean(_settings.m_tune)) - pnlset.append(rs) - - rs = RadioSetting("peakhold", "S-Meter display hold (1sec)", - RadioSettingValueBoolean(_settings.peakhold)) - pnlset.append(rs) - - options = ["CW Sidetone", "CW Speed", "100KHz step", "1MHz Step", - "Mic Gain", "RF Power"] - rs = RadioSetting("seldial", "SEL dial 2nd function (push)", - RadioSettingValueList(options, - options[_settings.seldial])) - pnlset.append(rs) - # End _do_panel_settings - - def _do_panel_buttons(self, pnlcfg): #- - - Current Panel Config - _settings = self._memobj.settings - - rs = RadioSetting("pnl_cs", "C.S. Function", - RadioSettingValueList(self.FUNC_LIST, - self.FUNC_LIST[_settings.pnl_cs])) - pnlcfg.append(rs) - - rs = RadioSetting("nb", "Noise blanker", - RadioSettingValueBoolean(_settings.nb)) - pnlcfg.append(rs) - - options = ["Auto", "Fast", "Slow", "Auto/Fast", "Auto/Slow", "?5?"] - rs = RadioSetting("agc", "AGC", - RadioSettingValueList(options, - options[_settings.agc])) - pnlcfg.append(rs) - - rs = RadioSetting("keyer", "Keyer", - RadioSettingValueBoolean(_settings.keyer)) - pnlcfg.append(rs) - - rs = RadioSetting("fast", "Fast step", - RadioSettingValueBoolean(_settings.fast)) - pnlcfg.append(rs) - - rs = RadioSetting("lock", "Lock (per Lock Mode)", - RadioSettingValueBoolean(_settings.lock)) - pnlcfg.append(rs) - - options = ["PO", "ALC", "SWR"] - rs = RadioSetting("mtr_mode", "S-Meter mode", - RadioSettingValueList(options, - options[_settings.mtr_mode])) - pnlcfg.append(rs) - # End _do_panel_Buttons - - def _do_vox_settings(self, voxdat): # - - VOX and DATA Settings - _settings = self._memobj.settings - - rs = RadioSetting("vox_dly", "VOX delay (x 100 ms)", - RadioSettingValueInteger(1, 30, _settings.vox_dly)) - voxdat.append(rs) - - rs = RadioSetting("vox_gain", "VOX Gain", - RadioSettingValueInteger(0, 100, - _settings.vox_gain)) - voxdat.append(rs) - - rs = RadioSetting("dig_vox", "Digital VOX Gain", - RadioSettingValueInteger(0, 100, - _settings.dig_vox)) - voxdat.append(rs) - - rs = RadioSetting("d_disp", "User-L/U freq offset (Hz)", - RadioSettingValueInteger(-3000, 30000, - _settings.d_disp, 10)) - voxdat.append(rs) - - options = ["170Hz", "200Hz", "425Hz", "850Hz"] - rs = RadioSetting("rty_sft", "RTTY FSK Freq Shift", - RadioSettingValueList(options, - options[_settings.rty_sft])) - voxdat.append(rs) - - options = ["1275Hz", "2125Hz"] - rs = RadioSetting("rty_ton", "RTTY FSK Mark tone", - RadioSettingValueList(options, - options[_settings.rty_ton])) - voxdat.append(rs) - - options = ["Normal", "Reverse"] - rs = RadioSetting("rtyrpol", "RTTY Mark/Space RX polarity", - RadioSettingValueList(options, - options[_settings.rtyrpol])) - voxdat.append(rs) - - rs = RadioSetting("rtytpol", "RTTY Mark/Space TX polarity", - RadioSettingValueList(options, - options[_settings.rtytpol])) - voxdat.append(rs) - # End _do_vox_settings - - def _do_mic_settings(self, mic): # - - MIC Settings - _settings = self._memobj.settings - - rs = RadioSetting("mic_eq", "Mic Equalizer", - RadioSettingValueInteger(0, 9, _settings.mic_eq)) - mic.append(rs) - - options = ["Low", "Normal", "High"] - rs = RadioSetting("micgain", "Mic Gain", - RadioSettingValueList(options, - options[_settings.micgain])) - mic.append(rs) - - rs = RadioSetting("micscan", "Mic scan enabled", - RadioSettingValueBoolean(_settings.micscan)) - rs.set_doc("Enables channel scanning via mic up/down buttons.") - mic.append(rs) - - rs = RadioSetting("pm_dwn", "Mic Down button function", - RadioSettingValueList(self.FUNC_LIST, - self.FUNC_LIST[_settings.pm_dwn])) - mic.append(rs) - - rs = RadioSetting("pm_fst", "Mic Fast button function", - RadioSettingValueList(self.FUNC_LIST, - self.FUNC_LIST[_settings.pm_fst])) - mic.append(rs) - - rs = RadioSetting("pm_up", "Mic Up button function", - RadioSettingValueList(self.FUNC_LIST, - self.FUNC_LIST[_settings.pm_up])) - mic.append(rs) - # End _do_mic_settings - - def _do_mymodes_settings(self, mymodes): # - - MYMODES - _settings = self._memobj.settings # Inverted Logic requires callback - - bx = not _settings.mym_lsb - rs = RadioSetting("mym_lsb", "LSB", RadioSettingValueBoolean(bx)) - rs.set_apply_callback(self._invert_me, _settings, "mym_lsb") - mymodes.append(rs) - - bx = not _settings.mym_usb - rs = RadioSetting("mym_usb", "USB", RadioSettingValueBoolean(bx)) - rs.set_apply_callback(self._invert_me, _settings, "mym_usb") - mymodes.append(rs) - - bx = not _settings.mym_cw - rs = RadioSetting("mym_cw", "CW", RadioSettingValueBoolean(bx)) - rs.set_apply_callback(self._invert_me, _settings, "mym_cw") - mymodes.append(rs) - - bx = not _settings.mym_am - rs = RadioSetting("mym_am", "AM", RadioSettingValueBoolean(bx)) - rs.set_apply_callback(self._invert_me, _settings, "mym_am") - mymodes.append(rs) - - bx = not _settings.mym_fm - rs = RadioSetting("mym_fm", "FM", RadioSettingValueBoolean(bx)) - rs.set_apply_callback(self._invert_me, _settings, "mym_fm") - mymodes.append(rs) - - bx = not _settings.mym_data - rs = RadioSetting("mym_data", "DATA", RadioSettingValueBoolean(bx)) - rs.set_apply_callback(self._invert_me, _settings, "mym_data") - mymodes.append(rs) - # End _do_mymodes_settings - - def _do_mybands_settings(self, mybands): # - - MYBANDS Settings - _settings = self._memobj.settings # Inverted Logic requires callback - - bx = not _settings.myb_1_8 - rs = RadioSetting("myb_1_8", "1.8 MHz", RadioSettingValueBoolean(bx)) - rs.set_apply_callback(self._invert_me, _settings, "myb_1_8") - mybands.append(rs) - - bx = not _settings.myb_3_5 - rs = RadioSetting("myb_3_5", "3.5 MHz", RadioSettingValueBoolean(bx)) - rs.set_apply_callback(self._invert_me, _settings, "myb_3_5") - mybands.append(rs) - - bx = not _settings.myb_7 - rs = RadioSetting("myb_7", "7 MHz", RadioSettingValueBoolean(bx)) - rs.set_apply_callback(self._invert_me, _settings, "myb_7") - mybands.append(rs) - - bx = not _settings.myb_10 - rs = RadioSetting("myb_10", "10 MHz", RadioSettingValueBoolean(bx)) - rs.set_apply_callback(self._invert_me, _settings, "myb_10") - mybands.append(rs) - - bx = not _settings.myb_14 - rs = RadioSetting("myb_14", "14 MHz", RadioSettingValueBoolean(bx)) - rs.set_apply_callback(self._invert_me, _settings, "myb_14") - mybands.append(rs) - - bx = not _settings.myb_18 - rs = RadioSetting("myb_18", "18 MHz", RadioSettingValueBoolean(bx)) - rs.set_apply_callback(self._invert_me, _settings, "myb_18") - mybands.append(rs) - - bx = not _settings.myb_21 - rs = RadioSetting("myb_21", "21 MHz", RadioSettingValueBoolean(bx)) - rs.set_apply_callback(self._invert_me, _settings, "myb_21") - mybands.append(rs) - - bx = not _settings.myb_24 - rs = RadioSetting("myb_24", "24 MHz", RadioSettingValueBoolean(bx)) - rs.set_apply_callback(self._invert_me, _settings, "myb_24") - mybands.append(rs) - - bx = not _settings.myb_28 - rs = RadioSetting("myb_28", "28 MHz", RadioSettingValueBoolean(bx)) - rs.set_apply_callback(self._invert_me, _settings, "myb_28") - mybands.append(rs) - - bx = not _settings.myb_50 - rs = RadioSetting("myb_50", "50 MHz", RadioSettingValueBoolean(bx)) - rs.set_apply_callback(self._invert_me, _settings, "myb_50") - mybands.append(rs) - # End _do_mybands_settings - - def set_settings(self, settings): - _settings = self._memobj.settings - _mem = self._memobj - for element in settings: - if not isinstance(element, RadioSetting): - self.set_settings(element) - continue - else: - try: - name = element.get_name() - if "." in name: - bits = name.split(".") - obj = self._memobj - for bit in bits[: -1]: - if "/" in bit: - bit, index = bit.split("/", 1) - index = int(index) - obj = getattr(obj, bit)[index] - else: - obj = getattr(obj, bit) - setting = bits[-1] - else: - obj = _settings - setting = element.get_name() - - if element.has_apply_callback(): - LOG.debug("Using apply callback") - element.run_apply_callback() - elif element.value.get_mutable(): - LOG.debug("Setting %s = %s" % (setting, element.value)) - setattr(obj, setting, element.value) - except Exception, e: - LOG.debug(element.get_name()) - raise +# Copyright 2018 by Rick DeWitt (aa0rd@yahoo.com) V2.0 +# PY3 Compliant release. +# Thanks to Filippi Marco for Yaesu processes +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +"""FT450D Yaesu Radio Driver""" + +from chirp.drivers import yaesu_clone +from chirp import chirp_common, util, memmap, errors, directory, bitwise +from chirp.settings import RadioSetting, RadioSettingGroup, \ + RadioSettingValueInteger, RadioSettingValueList, \ + RadioSettingValueBoolean, RadioSettingValueString, \ + RadioSettings +import time +import struct +import logging + +LOG = logging.getLogger(__name__) + +CMD_ACK = b'\x06' +EX_MODES = ["USER-L", "USER-U", "LSB+CW", "USB+CW", "RTTY-L", "RTTY-U", "N/A"] +T_STEPS = sorted(list(chirp_common.TUNING_STEPS)) +T_STEPS.remove(30.0) +T_STEPS.remove(100.0) +T_STEPS.remove(125.0) +T_STEPS.remove(200.0) + + +@directory.register +class FT450DRadio(yaesu_clone.YaesuCloneModeRadio): + """Yaesu FT-450D""" + BAUD_RATE = 38400 + COM_BITS = 8 # number of data bits + COM_PRTY = 'N' # parity checking + COM_STOP = 1 # stop bits + MODEL = "FT-450D" + NEEDS_COMPAT_SERIAL = False + + DUPLEX = ["", "-", "+"] + MODES = ["LSB", "USB", "CW", "AM", "FM", "RTTY-L", + "USER-L", "USER-U", "NFM", "CWR"] + TMODES = ["", "Tone", "TSQL"] + STEPSFM = [5.0, 6.25, 10.0, 12.5, 15.0, 20.0, 25.0, 50.0] + STEPSAM = [2.5, 5.0, 9.0, 10.0, 12.5, 25.0] + STEPSSSB = [1.0, 2.5, 5.0] + VALID_BANDS = [(100000, 33000000), (33000000, 56000000)] + FUNC_LIST = ['MONI', 'N/A', 'PBAK', 'PLAY1', 'PLAY2', 'PLAY3', 'QSPLIT', + 'SPOT', 'SQLOFF', 'SWR', 'TXW', 'VCC', 'VOICE2', 'VM1MONI', + 'VM1REC', 'VM1TX', 'VM2MONI', 'VM2REC', 'VM2TX', 'DOWN', 'FAST', + 'UP', 'DSP', 'IPO/ATT', 'NB', 'AGC', 'MODEDN', 'MODEUP', + 'DSP/SEL', 'KEYER', 'CLAR', 'BANDDN', 'BANDUP', 'A=B', 'A/B', + 'LOCK', 'TUNE', 'VOICE', 'MW', 'V/M', 'HOME', 'RCL', 'VOX', 'STO', + 'STEP', 'SPLIT', 'PMS', 'SCAN', 'MENU', 'DIMMER', 'MTR'] + CHARSET = list(chirp_common.CHARSET_ASCII) + CHARSET.remove("\\") + + MEM_SIZE = 15017 + # block 9 (135 Bytes long) is to be repeated 101 times + _block_lengths = [4, 84, 135, 162, 135, 162, 151, 130, 135, 127, 189, 103] + + MEM_FORMAT = """ + struct mem_struct { // 27 bytes per channel + u8 tag_on_off:2, // @ Byte 0 1=Off, 2=On + unk0:2, + mode:4; + u8 duplex:2, // @ byte 1 + att:1, + ipo:1, + unka1:1, + tunerbad:1, // ?? Possible tuner failed + unk1b:1, // @@@??? + uprband:1; + u8 cnturpk:1, // @ Byte 2 Peak (clr), Null (set) + cnturmd:3, // Contour filter mode + cnturgn:1, // Contour filter gain Low/high + mode2:3; // When mode is data(5) + u8 ssb_step:2, // @ Byte 3 + am_step:3, + fm_step:3; + u8 tunerok:1, // @ Byte 4 ?? Poss tuned ok + cnturon:1, + unk4b:1, + dnr_on:1 + notch:1, + unk4c:1, + tmode:2; // Tone/Cross/etc as Off/Enc/Enc+Dec + u8 unk5a:4, // @ byte 5 + dnr_val:4; + u8 cw_width:2, // # byte 6, Notch width indexes + fm_width:2, + am_width:2, + sb_width:2; + i8 notch_pos; // @ Byte 7 Signed: - 0 + + u8 tone; // @ Byte 8 + u8 unk9; // @ Byte 9 Always set to 0 + u8 unkA; // @ Byte A + u8 unkB; // @ Byte B + u32 freq; // @ C-F + u32 offset; // @ 10-13 + u8 name[7]; // @ 14-1A + }; + + #seekto 0x04; + struct { + u8 set04; // ?Checksum / Clone counter? + u8 set05; // Current VFO? + u8 set06; + u8 fast:1, + lock:1, // Inverted: 1 = Off + nb:1, + agc:5; + u8 set08a:3, + keyer:1, + set08b:2, + mtr_mode:2; + u8 set09; + u8 set0A; + u8 set0B:2, + clk_sft:1, + cont:5; // 1:1 + u8 beepvol_sgn:1, // @x0C: set : Link @0x41, clear: fix @ 0x40 + set0Ca:3, + clar_btn:1, // 0 = Dial, 1= SEL + cwstone_sgn:1, // Set: Lnk @ x42, clear: Fixed at 0x43 + beepton:2; // Index 0-3 + u8 set0Da:1, + cw_key:1, + set0Db:3, + dialstp_mode:1, + dialstp:2; + u8 set0E:1, + keyhold:1, + lockmod:1, + set0ea:1, + amfmdial:1, // 0= Enabled. 1 = Disabled + cwpitch:3; // 0-based index + u8 sql_rfg:1 + set0F:2, + cwweigt:5; // Index 1:2.5=0 -> 1:4.5=20 + u8 cw_dly; // @x10 ms = val * 10 + u8 set11; + u8 cwspeed; // val 4-60 is wpm, *5 is cpm + u8 vox_gain; // val 1:1 + u8 set14:2, + emergen:1, + vox_dly:5; // ms = val * 100 + u8 set15a:1, + stby_beep:1 + set15b:1 + mem_grp:1, + apo:4; + u8 tot; // Byte x16, 1:1 + u8 micscan:1, + set17:5, + micgain:2; + u8 cwpaddl:1, // @x18 0=Key, 1=Mic + set18:7; + u8 set19; + u8 set1A; + u8 set1B; + u8 set1C; + u8 dig_vox; // 1:1 + u8 set1E; + i16 d_disp; // @ x1F,x20 signed 16bit + u8 pnl_cs; // 0-based index + u8 pm_up; + u8 pm_fst; + u8 pm_dwn; + u8 set25; + u8 set26; + u8 set27; + u8 set28; + u8 beacon_time; // 1:1 + u8 set2A; + u8 cat_rts:1, // @x2b: Enable=0, Disable=1 + peakhold:1, + set2B:4, + cat_tot:2; // Index 0-3 + u8 set2CA:2, + rtyrpol:1, + rtytpol:1 + rty_sft:2, + rty_ton:1, + set2CC:1; + u8 dig_vox; // 1:1 + u8 ext_mnu:1, + m_tune:1, + set2E:2, + scn_res:4; + u8 cw_auto:1, // Off=0, On=1 + cwtrain:2, // Index + set2F:1, + cw_qsk:2, // Index + cw_bfo:2; // Index + u8 mic_eq; // @x30 1:1 + u8 set31:5, + catrate:3; // Index 0-4 + u8 set32; + u8 dimmer:4, + set33:4; + u8 set34; + u8 set35; + u8 set36; + u8 set37; + u8 set38a:1, + rfpower:7; // 1:1 + u8 set39a:2, + tuner:3, // Index 0-4 + seldial:3; // Index 0-5 + u8 set3A; + u8 set3B; + u8 set3C; + i8 qspl_f; // Signed + u8 set3E; + u8 set3F; + u8 beepvol_fix; // 1:1 + i8 beepvol_lnk; // SIGNED 2's compl byte + u8 cwstone_fix; + i8 cwstone_lnk; // signed byte + u8 set44:2, + mym_data:1, // My Mode: Data, set = OFF + mym_fm:1, + mym_am:1, + mym_cw:1, + mym_usb:1, + mym_lsb:1; + u8 myb_24:1, // My Band: 24 MHz set = OFF + myb_21:1, + myb_18:1, + myb_14:1, + myb_10:1, + myb_7:1, + myb_3_5:1, + myb_1_8:1; + u8 set46:6, + myb_28:1, + myb_50:1; + u8 set47; + u8 set48; + u8 set49; + u8 set4A; + u8 set4B; + u8 set4C; + u8 set4D; + u8 set4E; + u8 set4F; + u8 set50; + u8 set51; + u8 set52; + u8 set53; + u8 set54; + u8 set55; + u8 set56a:3, + split:1, + set56b:4; + u8 set57; + } settings; + + #seekto 0x58; + struct mem_struct vfoa[11]; // The current cfgs for each vfo 'band' + struct mem_struct vfob[11]; + struct mem_struct home[2]; // The 2 Home cfgs (HF and 6m) + struct mem_struct qmb; // The Quick Memory Bank STO/RCL + struct mem_struct mtqmb; // Last QMB-MemTune cfg (not displayed) + struct mem_struct mtune; // Last MemTune cfg (not displayed) + + #seekto 0x343; // chan status + u8 visible[63]; // 1 bit per channel + u8 pmsvisible; // @ 0x382 + + #seekto 0x383; + u8 filled[63]; + u8 pmsfilled; // @ 0x3c2 + + #seekto 0x3C3; + struct mem_struct memory[500]; + struct mem_struct pms[4]; // Programmed Scan limits @ x387F + + #seekto 0x3906; + struct { + char t1[40]; // CW Beacon Text + char t2[40]; + char t3[40]; + } beacontext; // to 0x397E + + #seekto 0x3985; + struct mem_struct m60[5]; // to 0x3A0B + + #seekto 0x03a45; + struct mem_struct current; + + """ + _CALLSIGN_CHARSET = [chr(x) for x in list(range(ord("0"), ord("9") + 1)) + + list(range(ord("A"), ord("Z") + 1)) + [ord(" ")]] + _CALLSIGN_CHARSET_REV = dict(zip(_CALLSIGN_CHARSET, + range(0, len(_CALLSIGN_CHARSET)))) + + # WARNING Indecis are hard wired in get/set_memory code !!! + # Channels print in + increasing index order (PMS first) + SPECIAL_MEMORIES = { + "VFOa-1.8M": -27, + "VFOa-3.5M": -26, + "VFOa-7M": -25, + "VFOa-10M": -24, + "VFOa-14M": -23, + "VFOa-18M": -22, + "VFOa-21M": -21, + "VFOa-24M": -20, + "VFOa-28M": -19, + "VFOa-50M": -18, + "VFOa-HF": -17, + "VFOb-1.8M": -16, + "VFOb-3.5M": -15, + "VFOb-7M": -14, + "VFOb-10M": -13, + "VFOb-14M": -12, + "VFOb-18M": -11, + "VFOb-21M": - 10, + "VFOb-24M": -9, + "VFOb-28M": -8, + "VFOb-50M": -7, + "VFOb-HF": -6, + "HOME-HF": -5, + "HOME-50M": -4, + "QMB": -3, + "QMB-MTune": -2, + "Mem-Tune": -1, + } + FIRST_VFOB_INDEX = -6 + LAST_VFOB_INDEX = -16 + FIRST_VFOA_INDEX = -17 + LAST_VFOA_INDEX = -27 + + SPECIAL_PMS = { + "PMS1-L": -36, + "PMS1-U": -35, + "PMS2-L": -34, + "PMS2-U": -33, + } + LAST_PMS_INDEX = -36 + SPECIAL_MEMORIES.update(SPECIAL_PMS) + + SPECIAL_60M = { + "60m-Ch1": -32, + "60m-Ch2": -31, + "60m-Ch3": -30, + "60m-Ch4": -29, + "60m-Ch5": -28, + } + LAST_60M_INDEX = -32 + SPECIAL_MEMORIES.update(SPECIAL_60M) + + SPECIAL_MEMORIES_REV = dict(zip(SPECIAL_MEMORIES.values(), + SPECIAL_MEMORIES.keys())) + + @classmethod + def get_prompts(cls): + rp = chirp_common.RadioPrompts() + rp.info = _( + "The FT-450 radio driver loads the 'Special Channels' tab\n" + "with the PMS scanning range memories (group 11), 60meter\n" + "channels (group 12), the QMB (STO/RCL) memory, the HF and\n" + "50m HOME memories and all the A and B VFO memories.\n" + "There are VFO memories for the last frequency dialed in\n" + "each band. The last mem-tune config is also stored.\n" + "These Special Channels allow limited field editing.\n" + "This driver also populates the 'Other' tab in the channel\n" + "memory Properties window. This tab contains values for\n" + "those channel memory settings that don't fall under the\n" + "standard Chirp display columns.\n") + rp.pre_download = _( + "1. Turn radio off.\n" + "2. Connect cable to ACC jack.\n" + "3. Press and hold in the [MODE <] and [MODE >] keys" + " while\n" + " turning the radio on (\"CLONE MODE\" will appear on the\n" + " display).\n" + "4. After clicking OK here, press the [C.S.] key to\n" + " send image.\n") + rp.pre_upload = _( + "1. Turn radio off.\n" + "2. Connect cable to ACC jack.\n" + "3. Press and hold in the [MODE <] and [MODE >] keys" + " while\n" + " turning the radio on (\"CLONE MODE\" will appear on the\n" + " display).\n" + "4. Click OK here.\n" + " (\"Receiving\" will appear on the LCD).\n") + return rp + + def _read(self, block, blocknum): + # be very patient at first block + if blocknum == 0: + attempts = 60 + else: + attempts = 5 + for _i in range(0, attempts): + data = self.pipe.read(block + 2) # Blocknum, data,checksum + if data: + break + time.sleep(0.5) + if len(data) == block + 2 and data[0] == blocknum: + checksum = yaesu_clone.YaesuChecksum(1, block) + if checksum.get_existing(data) != \ + checksum.get_calculated(data): + raise Exception("Checksum Failed [%02X<>%02X] block %02X" % + (checksum.get_existing(data), + checksum.get_calculated(data), blocknum)) + # Remove the block number and checksum + data = data[1:block + 1] + else: # Use this info to decode a new Yaesu model + raise Exception("Unable to read block %i expected %i got %i" + % (blocknum, block + 2, len(data))) + return data + + def _clone_in(self): + # Be very patient with the radio + self.pipe.timeout = 2 + self.pipe.baudrate = self.BAUD_RATE + self.pipe.bytesize = self.COM_BITS + self.pipe.parity = self.COM_PRTY + self.pipe.stopbits = self.COM_STOP + self.pipe.rtscts = False + + start = time.time() + + data = b"" + blocks = 0 + status = chirp_common.Status() + status.msg = _("Cloning from radio") + nblocks = len(self._block_lengths) + 100 # Block 8 repeats + status.max = nblocks + for block in self._block_lengths: + if blocks == 8: + # repeated read of block 8 same size (chan memory area) + repeat = 101 + else: + repeat = 1 + for _i in range(0, repeat): + data += self._read(block, blocks) + self.pipe.write(CMD_ACK) + blocks += 1 + status.cur = blocks + self.status_fn(status) + data += self.MODEL.encode() + return memmap.MemoryMapBytes(data) + + def _clone_out(self): + self.pipe.baudrate = self.BAUD_RATE + self.pipe.bytesize = self.COM_BITS + self.pipe.parity = self.COM_PRTY + self.pipe.stopbits = self.COM_STOP + self.pipe.rtscts = False + delay = 0.5 + start = time.time() + blocks = 0 + pos = 0 + status = chirp_common.Status() + status.msg = _("Cloning to radio") + status.max = len(self._block_lengths) + 100 + for block in self._block_lengths: + if blocks == 8: + repeat = 101 + else: + repeat = 1 + for _i in range(0, repeat): + time.sleep(0.01) + checksum = yaesu_clone.YaesuChecksum(pos, pos + block - 1) + LOG.debug("Sending block %s" % hex(blocks)) + self.pipe.write(struct.pack('B', blocks)) + blkdat = self.get_mmap()[pos:pos + block] + LOG.debug("Sending %d bytes:\n%s" + % (len(blkdat), util.hexprint(blkdat))) + self.pipe.write(blkdat) + xs = checksum.get_calculated(self.get_mmap()) + LOG.debug("Sending checksum %s" % hex(xs)) + self.pipe.write(struct.pack('B', xs)) + buf = self.pipe.read(1) + if not buf or buf[:1] != CMD_ACK: + time.sleep(delay) + buf = self.pipe.read(1) + if not buf or buf[:1] != CMD_ACK: + raise Exception(_("Radio did not ack block %i") % blocks) + pos += block + blocks += 1 + status.cur = blocks + self.status_fn(status) + + def sync_in(self): + try: + self._mmap = self._clone_in() + except errors.RadioError: + raise + except Exception as e: + raise errors.RadioError("Failed to communicate with radio: %s" + % e) + self.process_mmap() + + def sync_out(self): + try: + self._clone_out() + except errors.RadioError: + raise + except Exception as e: + raise errors.RadioError("Failed to communicate with radio: %s" + % e) + + def process_mmap(self): + self._memobj = bitwise.parse(self.MEM_FORMAT, self._mmap) + + def get_features(self): + rf = chirp_common.RadioFeatures() + rf.has_bank = False + rf.has_dtcs = False + rf.valid_modes = [x for x in self.MODES if x in chirp_common.MODES] + rf.valid_tmodes = list(self.TMODES) + rf.valid_duplexes = list(self.DUPLEX) + rf.valid_tuning_steps = list(T_STEPS) + rf.valid_bands = self.VALID_BANDS + rf.valid_power_levels = [] + rf.valid_characters = "".join(self.CHARSET) + rf.valid_name_length = 7 + rf.valid_skips = [] + rf.valid_special_chans = sorted(self.SPECIAL_MEMORIES.keys()) + rf.memory_bounds = (1, 500) + rf.has_ctone = True + rf.has_settings = True + rf.has_cross = True + return rf + + def get_raw_memory(self, number): + return repr(self._memobj.memory[number - 1]) + + def _get_tmode(self, mem, _mem): + mem.tmode = self.TMODES[_mem.tmode] + mem.rtone = chirp_common.TONES[_mem.tone] + mem.ctone = mem.rtone + + def _set_duplex(self, mem, _mem): + _mem.duplex = self.DUPLEX.index(mem.duplex) + + def get_memory(self, number): + if isinstance(number, str): + return self._get_special(number) + elif number < 0: + # I can't stop delete operation from losing extd_number but + # I know how to get it back + return self._get_special(self.SPECIAL_MEMORIES_REV[number]) + else: + return self._get_normal(number) + + def set_memory(self, memory): + if memory.number < 0: + return self._set_special(memory) + else: + return self._set_normal(memory) + + def _get_special(self, number): + mem = chirp_common.Memory() + mem.number = self.SPECIAL_MEMORIES[number] + mem.extd_number = number + + if mem.number in range(self.FIRST_VFOA_INDEX, + self.LAST_VFOA_INDEX - 1, -1): + _mem = self._memobj.vfoa[-self.LAST_VFOA_INDEX + mem.number] + immutable = ["number", "extd_number", "name", "power"] + elif mem.number in range(self.FIRST_VFOB_INDEX, + self.LAST_VFOB_INDEX - 1, -1): + _mem = self._memobj.vfob[-self.LAST_VFOB_INDEX + mem.number] + immutable = ["number", "extd_number", "name", "power"] + elif mem.number in range(-4, -6, -1): # 2 Home Chans + _mem = self._memobj.home[5 + mem.number] + immutable = ["number", "extd_number", "name", "power"] + elif mem.number == -3: + _mem = self._memobj.qmb + immutable = ["number", "extd_number", "name", "power"] + elif mem.number == -2: + _mem = self._memobj.mtqmb + immutable = ["number", "extd_number", "name", "power"] + elif mem.number == -1: + _mem = self._memobj.mtune + immutable = ["number", "extd_number", "name", "power"] + elif mem.number in self.SPECIAL_PMS.values(): + bitindex = (-self.LAST_PMS_INDEX) + mem.number + used = (self._memobj.pmsvisible >> bitindex) & 0x01 + valid = (self._memobj.pmsfilled >> bitindex) & 0x01 + if not used: + mem.empty = True + if not valid: + mem.empty = True + return mem + mx = (-self.LAST_PMS_INDEX) + mem.number + _mem = self._memobj.pms[mx] + mx = mx + 1 + immutable = ["number", "rtone", "ctone", "extd_number", + "tmode", "cross_mode", + "power", "duplex", "offset"] + elif mem.number in self.SPECIAL_60M.values(): + mx = (-self.LAST_60M_INDEX) + mem.number + _mem = self._memobj.m60[mx] + mx = mx + 1 + immutable = ["number", "rtone", "ctone", "extd_number", + "tmode", "cross_mode", + "frequency", "power", "duplex", "offset"] + else: + raise Exception("Sorry, you can't edit that special" + " memory channel %i." % mem.number) + + mem = self._get_memory(mem, _mem) + mem.immutable = immutable + + return mem + + def _set_special(self, mem): + if mem.empty and mem.number not in self.SPECIAL_PMS.values(): + # can't delete special memories! + raise errors.RadioError("Sorry, special memory can't be deleted") + + cur_mem = self._get_special(self.SPECIAL_MEMORIES_REV[mem.number]) + + if mem.number in range(self.FIRST_VFOA_INDEX, + self.LAST_VFOA_INDEX - 1, -1): + _mem = self._memobj.vfoa[-self.LAST_VFOA_INDEX + mem.number] + elif mem.number in range(self.FIRST_VFOB_INDEX, + self.LAST_VFOB_INDEX - 1, -1): + _mem = self._memobj.vfob[-self.LAST_VFOB_INDEX + mem.number] + elif mem.number in range(-4, -6, -1): + _mem = self._memobj.home[5 + mem.number] + elif mem.number == -3: + _mem = self._memobj.qmb + elif mem.number == -2: + _mem = self._memobj.mtqmb + elif mem.number == -1: + _mem = self._memobj.mtune + elif mem.number in self.SPECIAL_PMS.values(): + bitindex = (-self.LAST_PMS_INDEX) + mem.number + wasused = (self._memobj.pmsvisible >> bitindex) & 0x01 + wasvalid = (self._memobj.pmsfilled >> bitindex) & 0x01 + if mem.empty: + if wasvalid and not wasused: + # pylint get confused by &= operator + self._memobj.pmsfilled = self._memobj.pmsfilled & \ + ~ (1 << bitindex) + # pylint get confused by &= operator + self._memobj.pmsvisible = self._memobj.pmsvisible & \ + ~ (1 << bitindex) + return + # pylint get confused by |= operator + self._memobj.pmsvisible = self._memobj.pmsvisible | 1 << bitindex + self._memobj.pmsfilled = self._memobj.pmsfilled | 1 << bitindex + _mem = self._memobj.pms[-self.LAST_PMS_INDEX + mem.number] + else: + raise errors.RadioError("Sorry, you can't edit" + " that special memory.") + + for key in cur_mem.immutable: + if key != "extd_number": + if cur_mem.__dict__[key] != mem.__dict__[key]: + raise errors.RadioError("Editing field `%s' " % key + + "is not supported on this channel") + + self._set_memory(mem, _mem) + + def _get_normal(self, number): + _mem = self._memobj.memory[number - 1] + used = (self._memobj.visible[(number - 1) / 8] >> (number - 1) % 8) \ + & 0x01 + valid = (self._memobj.filled[(number - 1) / 8] >> (number - 1) % 8) \ + & 0x01 + + mem = chirp_common.Memory() + mem.number = number + if not used: + mem.empty = True + if not valid or _mem.freq == 0xffffffff: + return mem + if mem.number == 1: + mem.immutable = ['empty'] + return self._get_memory(mem, _mem) + + def _set_normal(self, mem): + _mem = self._memobj.memory[mem.number - 1] + wasused = (self._memobj.visible[(mem.number - 1) / 8] >> + (mem.number - 1) % 8) & 0x01 + wasvalid = (self._memobj.filled[(mem.number - 1) / 8] >> + (mem.number - 1) % 8) & 0x01 + + if mem.empty: + if mem.number == 1: + raise Exception("Sorry, can't delete first memory") + if wasvalid and not wasused: + self._memobj.filled[(mem.number - 1) // 8] &= \ + ~(1 << (mem.number - 1) % 8) + _mem.set_raw("\xFF" * (_mem.size() // 8)) # clean up + self._memobj.visible[(mem.number - 1) // 8] &= \ + ~(1 << (mem.number - 1) % 8) + return + if not wasvalid: + _mem.set_raw("\x00" * (_mem.size() // 8)) # clean up + + self._memobj.visible[(mem.number - 1) // 8] |= 1 << (mem.number - 1) \ + % 8 + self._memobj.filled[(mem.number - 1) // 8] |= 1 << (mem.number - 1) \ + % 8 + self._set_memory(mem, _mem) + + def _get_memory(self, mem, _mem): + mem.freq = int(_mem.freq) + mem.offset = int(_mem.offset) + mem.duplex = self.DUPLEX[_mem.duplex] + # Mode gets tricky with dual (USB+DATA) options + vx = _mem.mode + if vx == 4: # FM or NFM + if _mem.mode2 == 2: + vx = 4 # FM + else: + vx = 8 # NFM + if vx == 10: # CWR + vx = 9 + if vx == 5: # Data/Dual mode + if _mem.mode2 == 0: # RTTY-L + vx = 5 + if _mem.mode2 == 1: # USER-L + vx = 6 + if _mem.mode2 == 2: # USER-U + vx = 7 + try: + mem.mode = self.MODES[vx] + except ValueError: + LOG.error('The FT-450 driver is broken for unsupported modes') + if mem.mode == "FM" or mem.mode == "NFM": + mem.tuning_step = self.STEPSFM[_mem.fm_step] + elif mem.mode == "AM": + mem.tuning_step = self.STEPSAM[_mem.am_step] + elif mem.mode[:2] == "CW": + mem.tuning_step = self.STEPSSSB[_mem.ssb_step] + else: + try: + mem.tuning_step = self.STEPSSSB[_mem.ssb_step] + except IndexError: + pass + self._get_tmode(mem, _mem) + + if _mem.tag_on_off == 2: + for i in _mem.name: + if i == 0xFF: + break + if chr(i) in self.CHARSET: + mem.name += chr(i) + else: + # radio has some graphical chars that are not supported + # we replace those with a * + LOG.info("Replacing char %x with *" % i) + mem.name += "*" + mem.name = mem.name.rstrip() + else: + mem.name = "" + + mem.extra = RadioSettingGroup("extra", "Extra") + + rs = RadioSetting("ipo", "IPO", + RadioSettingValueBoolean(bool(_mem.ipo))) + rs.set_doc("Bypass preamp") + mem.extra.append(rs) + + rs = RadioSetting("att", "ATT", + RadioSettingValueBoolean(bool(_mem.att))) + rs.set_doc("10dB front end attenuator") + mem.extra.append(rs) + + rs = RadioSetting("cnturon", "Contour Filter", + RadioSettingValueBoolean(_mem.cnturon)) + rs.set_doc("Contour filter on/off") + mem.extra.append(rs) + + options = ["Peak", "Null"] + rs = RadioSetting("cnturpk", "Contour Filter Mode", + RadioSettingValueList(options, + options[_mem.cnturpk])) + mem.extra.append(rs) + + options = ["Low", "High"] + rs = RadioSetting("cnturgn", "Contour Filter Gain", + RadioSettingValueList(options, + options[_mem.cnturgn])) + rs.set_doc("Filter gain/attenuation") + mem.extra.append(rs) + + options = ["-2", "-1", "Center", "+1", "+2"] + rs = RadioSetting("cnturmd", "Contour Filter Notch", + RadioSettingValueList(options, + options[_mem.cnturmd])) + rs.set_doc("Filter notch offset") + mem.extra.append(rs) + + rs = RadioSetting("notch", "Notch Filter", + RadioSettingValueBoolean(_mem.notch)) + rs.set_doc("IF bandpass filter") + mem.extra.append(rs) + + vx = 1 + options = ["<-", "Center", "+>"] + if _mem.notch_pos < 0: + vx = 0 + if _mem.notch_pos > 0: + vx = 2 + rs = RadioSetting("notch_pos", "Notch Position", + RadioSettingValueList(options, options[vx])) + rs.set_doc("IF bandpass filter shift") + mem.extra.append(rs) + + vx = 0 + if mem.mode[1:] == "SB": + options = ["1.8 kHz", "2.4 kHz", "3.0 kHz"] + vx = _mem.sb_width + stx = "sb_width" + elif mem.mode[:1] == "CW": + options = ["300 Hz", "500 kHz", "2.4 kHz"] + vx = _mem.cw_width + stx = "cw_width" + elif mem.mode[:4] == "USER" or mem.mode[:4] == "RTTY": + options = ["300 Hz", "2.4 kHz", "3.0 kHz"] + vx = _mem.sb_width + stx = "sb_width" + elif mem.mode == "AM": + options = ["3.0 kHz", "6.0 kHz", "9.0 kHz"] + vx = _mem.am_width + stx = "am_width" + else: + options = ["2.5 kHz", "5.0 kHz"] + vx = _mem.fm_width + stx = "fm_width" + rs = RadioSetting(stx, "IF Bandpass Filter Width", + RadioSettingValueList(options, options[vx])) + rs.set_doc("DSP IF bandpass Notch width (Hz)") + mem.extra.append(rs) + + rs = RadioSetting("dnr_on", "DSP Noise Reduction", + RadioSettingValueBoolean(bool(_mem.dnr_on))) + rs.set_doc("Digital noise processing") + mem.extra.append(rs) + + options = ["Off", "1", "2", "3", "4", "5", "6", "7", + "8", "9", "10", "11"] + rs = RadioSetting("dnr_val", "DSP Noise Reduction Alg", + RadioSettingValueList(options, + options[_mem.dnr_val])) + rs.set_doc("Digital noise reduction algorithm number (1-11)") + mem.extra.append(rs) + + return mem # end get_memory + + def _set_memory(self, mem, _mem): + if len(mem.name) > 0: + _mem.tag_on_off = 2 + else: + _mem.tag_on_off = 1 + self._set_duplex(mem, _mem) + _mem.mode2 = 0 + if mem.mode == "USER-L": + _mem.mode = 5 + _mem.mode2 = 1 + elif mem.mode == "USER-U": + _mem.mode = 5 + _mem.mode2 = 2 + elif mem.mode == "RTTY-L": + _mem.mode = 5 + _mem.mode2 = 0 + elif mem.mode == "CWR": + _mem.mode = 10 + _mem.mode2 = 0 + elif mem.mode == "CW": + _mem.mode = 2 + _mem.mode2 = 0 + elif mem.mode == "NFM": + _mem.mode = 4 + _mem.mode2 = 1 + elif mem.mode == "FM": + _mem.mode = 4 + _mem.mode2 = 2 + else: # LSB, USB, AM + _mem.mode = self.MODES.index(mem.mode) + _mem.mode2 = 0 + try: + _mem.ssb_step = self.STEPSSSB.index(mem.tuning_step) + except ValueError: + pass + try: + _mem.am_step = self.STEPSAM.index(mem.tuning_step) + except ValueError: + pass + try: + _mem.fm_step = self.STEPSFM.index(mem.tuning_step) + except ValueError: + pass + _mem.freq = mem.freq + _mem.uprband = 0 + if mem.freq >= 33000000: + _mem.uprband = 1 + _mem.offset = mem.offset + _mem.tmode = self.TMODES.index(mem.tmode) + _mem.tone = chirp_common.TONES.index(mem.rtone) + _mem.tunerok = 0 # Dont know what these two do... + _mem.tunerbad = 0 + + for i in range(0, 7): + _mem.name[i] = ord(mem.name.ljust(7)[i]) + + for setting in mem.extra: + if setting.get_name() == "notch_pos": + vx = 0 # Override list string with signed value + stx = str(setting.value) + if stx == "<-": + vx = -13 + if stx == "+>": + vx = 12 + setattr(_mem, "notch_pos", vx) + elif setting.get_name() == "dnr_val": + stx = str(setting.value) # Convert string to int + vx = 0 + if stx != "Off": + vx = int(stx) + else: + setattr(_mem, "dnr_on", 0) + setattr(_mem, setting.get_name(), vx) + else: + setattr(_mem, setting.get_name(), setting.value) + + @classmethod + def match_model(cls, filedata, filename): + """Match the opened/downloaded image to the correct version""" + if len(filedata) == cls.MEM_SIZE + 7: # +7 bytes of model name + rid = filedata[cls.MEM_SIZE:cls.MEM_SIZE + 7] + if rid.startswith(cls.MODEL.encode()): + return True + else: + return False + + def _invert_me(self, setting, obj, atrb): + """Callback: from inverted logic 1-bit booleans""" + invb = not setting.value + setattr(obj, atrb, invb) + return + + def _chars2str(self, cary, knt): + """Convert raw memory char array to a string: NOT a callback.""" + stx = "" + for char in cary[0:knt]: + stx += chr(int(char)) + return stx + + def _my_str2ary(self, setting, obj, atrba, knt): + """Callback: convert string to fixed-length char array..""" + ary = "" + for j in range(0, knt, 1): + chx = ord(str(setting.value)[j]) + if chx < 32 or chx > 125: # strip non-printing + ary += " " + else: + ary += str(setting.value)[j] + setattr(obj, atrba, ary) + return + + def get_settings(self): + _settings = self._memobj.settings + _beacon = self._memobj.beacontext + gen = RadioSettingGroup("gen", "General") + cw = RadioSettingGroup("cw", "CW") + pnlcfg = RadioSettingGroup("pnlcfg", "Panel buttons") + pnlset = RadioSettingGroup("pnlset", "Panel settings") + voxdat = RadioSettingGroup("voxdat", "VOX and Data") + mic = RadioSettingGroup("mic", "Microphone") + mybands = RadioSettingGroup("mybands", "My Bands") + mymodes = RadioSettingGroup("mymodes", "My Modes") + + top = RadioSettings(gen, cw, pnlcfg, pnlset, voxdat, mic, + mymodes, mybands) + + self._do_general_settings(gen) + self._do_cw_settings(cw) + self._do_panel_buttons(pnlcfg) + self._do_panel_settings(pnlset) + self._do_vox_settings(voxdat) + self._do_mic_settings(mic) + self._do_mymodes_settings(mymodes) + self._do_mybands_settings(mybands) + + return top + + def _do_general_settings(self, tab): + _settings = self._memobj.settings + + rs = RadioSetting("ext_mnu", "Extended menu", + RadioSettingValueBoolean(_settings.ext_mnu)) + rs.set_doc("Enables access to extended settings in the radio") + tab.append(rs) + # Issue #8183 bugfix + rs = RadioSetting("apo", "APO time (Hrs)", + RadioSettingValueInteger(0, 12, _settings.apo)) + tab.append(rs) + + options = ["%i" % i for i in range(0, 21)] + options[0] = "Off" + rs = RadioSetting("tot", "TX 'TOT' time-out (mins)", + RadioSettingValueList(options, + options[_settings.tot])) + tab.append(rs) + + bx = not _settings.cat_rts # Convert from Enable=0 + rs = RadioSetting("cat_rts", "CAT RTS flow control", + RadioSettingValueBoolean(bx)) + rs.set_apply_callback(self._invert_me, _settings, "cat_rts") + tab.append(rs) + + options = ["0", "100ms", "1000ms", "3000ms"] + rs = RadioSetting("cat_tot", "CAT Timeout", + RadioSettingValueList(options, + options[_settings.cat_tot])) + tab.append(rs) + + options = ["4800", "9600", "19200", "38400", "Data"] + rs = RadioSetting("catrate", "CAT rate", + RadioSettingValueList(options, + options[_settings.catrate])) + tab.append(rs) + + rs = RadioSetting("mem_grp", "Mem groups", + RadioSettingValueBoolean(_settings.mem_grp)) + tab.append(rs) + + rs = RadioSetting("scn_res", "Resume scan (secs)", + RadioSettingValueInteger(0, 10, _settings.scn_res)) + tab.append(rs) + + rs = RadioSetting("clk_sft", "CPU clock shift", + RadioSettingValueBoolean(_settings.clk_sft)) + tab.append(rs) + + rs = RadioSetting("split", "TX/RX Frequency Split", + RadioSettingValueBoolean(_settings.split)) + tab.append(rs) + + rs = RadioSetting("qspl_f", "Quick-Split freq offset (kHz)", + RadioSettingValueInteger(-20, 20, _settings.qspl_f)) + tab.append(rs) + + rs = RadioSetting("emergen", "Alaska Emergency Mem 5167.5 kHz", + RadioSettingValueBoolean(_settings.emergen)) + tab.append(rs) + + rs = RadioSetting("stby_beep", "PTT release 'Standby' beep", + RadioSettingValueBoolean(_settings.stby_beep)) + tab.append(rs) + + options = ["ATAS", "EXT ATU", "INT ATU", "INTRATU", "F-TRANS"] + rs = RadioSetting("tuner", "Antenna Tuner", + RadioSettingValueList(options, + options[_settings.tuner])) + tab.append(rs) + + rs = RadioSetting("rfpower", "RF power (watts)", + RadioSettingValueInteger(5, 100, _settings.rfpower)) + tab.append(rs) # End of _do_general_settings + + def _do_cw_settings(self, cw): # - - - CW - - - + _settings = self._memobj.settings + _beacon = self._memobj.beacontext + + rs = RadioSetting("cw_dly", "CW break-in delay (ms * 10)", + RadioSettingValueInteger(0, 300, _settings.cw_dly)) + cw.append(rs) + + options = ["%i Hz" % i for i in range(400, 801, 100)] + rs = RadioSetting("cwpitch", "CW pitch", + RadioSettingValueList(options, + options[_settings.cwpitch])) + cw.append(rs) + + rs = RadioSetting("cwspeed", "CW speed (wpm)", + RadioSettingValueInteger(4, 60, _settings.cwspeed)) + rs.set_doc("Cpm is Wpm * 5") + cw.append(rs) + + options = ["1:%1.1f" % (i / 10) for i in range(25, 46, 1)] + rs = RadioSetting("cwweigt", "CW weight", + RadioSettingValueList(options, + options[_settings.cwweigt])) + cw.append(rs) + + options = ["15ms", "20ms", "25ms", "30ms"] + rs = RadioSetting("cw_qsk", "CW delay before TX in QSK mode", + RadioSettingValueList(options, + options[_settings.cw_qsk])) + cw.append(rs) + + rs = RadioSetting("cwstone_sgn", "CW sidetone volume Linked", + RadioSettingValueBoolean(_settings.cwstone_sgn)) + rs.set_doc("If set; volume is relative to AF Gain knob.") + cw.append(rs) + + rs = RadioSetting("cwstone_lnk", "CW sidetone linked volume", + RadioSettingValueInteger(-50, 50, + _settings.cwstone_lnk)) + cw.append(rs) + + rs = RadioSetting("cwstone_fix", "CW sidetone fixed volume", + RadioSettingValueInteger(0, 100, + _settings.cwstone_fix)) + cw.append(rs) + + options = ["Numeric", "Alpha", "Mixed"] + rs = RadioSetting("cwtrain", "CW Training mode", + RadioSettingValueList(options, + options[_settings.cwtrain])) + cw.append(rs) + + rs = RadioSetting("cw_auto", "CW key jack- auto CW mode", + RadioSettingValueBoolean(_settings.cw_auto)) + rs.set_doc("Enable for CW mode auto-set when keyer pluuged in.") + cw.append(rs) + + options = ["Normal", "Reverse"] + rs = RadioSetting("cw_key", "CW paddle wiring", + RadioSettingValueList(options, + options[_settings.cw_key])) + cw.append(rs) + + rs = RadioSetting("beacon_time", "CW beacon Tx interval (secs)", + RadioSettingValueInteger(0, 255, + _settings.beacon_time)) + cw.append(rs) + + tmp = self._chars2str(_beacon.t1, 40) + rs = RadioSetting("t1", "CW Beacon Line 1", + RadioSettingValueString(0, 40, tmp)) + rs.set_apply_callback(self._my_str2ary, _beacon, "t1", 40) + cw.append(rs) + + tmp = self._chars2str(_beacon.t2, 40) + rs = RadioSetting("t2", "CW Beacon Line 2", + RadioSettingValueString(0, 40, tmp)) + rs.set_apply_callback(self._my_str2ary, _beacon, "t2", 40) + cw.append(rs) + + tmp = self._chars2str(_beacon.t3, 40) + rs = RadioSetting("t3", "CW Beacon Line 3", + RadioSettingValueString(0, 40, tmp)) + rs.set_apply_callback(self._my_str2ary, _beacon, "t3", 40) + cw.append(rs) # END _do_cw_settings + + def _do_panel_settings(self, pnlset): # - - - Panel settings + _settings = self._memobj.settings + + bx = not _settings.amfmdial # Convert from Enable=0 + rs = RadioSetting("amfmdial", "AM&FM Dial", + RadioSettingValueBoolean(bx)) + rs.set_apply_callback(self._invert_me, _settings, "amfmdial") + pnlset.append(rs) + + options = ["440 Hz", "880 Hz", "1760 Hz"] + rs = RadioSetting("beepton", "Beep frequency", + RadioSettingValueList(options, + options[_settings.beepton])) + pnlset.append(rs) + + rs = RadioSetting("beepvol_sgn", "Beep volume Linked", + RadioSettingValueBoolean(_settings.beepvol_sgn)) + rs.set_doc("If set; volume is relative to AF Gain knob.") + pnlset.append(rs) + + rs = RadioSetting("beepvol_lnk", "Linked beep volume", + RadioSettingValueInteger(-50, 50, + _settings.beepvol_lnk)) + rs.set_doc("Relative to AF-Gain setting.") + pnlset.append(rs) + + rs = RadioSetting("beepvol_fix", "Fixed beep volume", + RadioSettingValueInteger(0, 100, + _settings.beepvol_fix)) + rs.set_doc("When Linked setting is unchecked.") + pnlset.append(rs) + + rs = RadioSetting("cont", "LCD Contrast", + RadioSettingValueInteger(1, 24, _settings.cont)) + rs.set_doc("This setting does not appear to do anything...") + pnlset.append(rs) + + rs = RadioSetting("dimmer", "LCD Dimmer", + RadioSettingValueInteger(1, 8, _settings.dimmer)) + pnlset.append(rs) + + options = ["RF-Gain", "Squelch"] + rs = RadioSetting("sql_rfg", "Squelch/RF-Gain", + RadioSettingValueList(options, + options[_settings.sql_rfg])) + pnlset.append(rs) + + options = ["Frequencies", "Panel", "All"] + rs = RadioSetting("lockmod", "Lock Mode", + RadioSettingValueList(options, + options[_settings.lockmod])) + pnlset.append(rs) + + options = ["Dial", "SEL"] + rs = RadioSetting("clar_btn", "CLAR button control", + RadioSettingValueList(options, + options[_settings.clar_btn])) + pnlset.append(rs) + + if _settings.dialstp_mode == 0: # AM/FM + options = ["SSB/CW:1Hz", "SSB/CW:10Hz", "SSB/CW:20Hz"] + else: + options = ["AM/FM:100Hz", "AM/FM:200Hz"] + rs = RadioSetting("dialstp", "Dial tuning step", + RadioSettingValueList(options, + options[_settings.dialstp])) + pnlset.append(rs) + + options = ["0.5secs", "1.0secs", "1.5secs", "2.0secs"] + rs = RadioSetting("keyhold", "Buttons hold-to-activate time", + RadioSettingValueList(options, + options[_settings.keyhold])) + pnlset.append(rs) + + rs = RadioSetting("m_tune", "Memory tune", + RadioSettingValueBoolean(_settings.m_tune)) + pnlset.append(rs) + + rs = RadioSetting("peakhold", "S-Meter display hold (1sec)", + RadioSettingValueBoolean(_settings.peakhold)) + pnlset.append(rs) + + options = ["CW Sidetone", "CW Speed", "100 kHz step", "1 MHz Step", + "Mic Gain", "RF Power"] + rs = RadioSetting("seldial", "SEL dial 2nd function (push)", + RadioSettingValueList(options, + options[_settings.seldial])) + pnlset.append(rs) + # End _do_panel_settings + + def _do_panel_buttons(self, pnlcfg): # - - - Current Panel Config + _settings = self._memobj.settings + + rs = RadioSetting("pnl_cs", "C.S. Function", + RadioSettingValueList(self.FUNC_LIST, + self.FUNC_LIST[_settings.pnl_cs])) + pnlcfg.append(rs) + + rs = RadioSetting("nb", "Noise blanker", + RadioSettingValueBoolean(_settings.nb)) + pnlcfg.append(rs) + + options = ["Auto", "Fast", "Slow", "Auto/Fast", "Auto/Slow", "?5?"] + rs = RadioSetting("agc", "AGC", + RadioSettingValueList(options, + options[_settings.agc])) + pnlcfg.append(rs) + + rs = RadioSetting("keyer", "Keyer", + RadioSettingValueBoolean(_settings.keyer)) + pnlcfg.append(rs) + + rs = RadioSetting("fast", "Fast step", + RadioSettingValueBoolean(_settings.fast)) + pnlcfg.append(rs) + + rs = RadioSetting("lock", "Lock (per Lock Mode)", + RadioSettingValueBoolean(_settings.lock)) + pnlcfg.append(rs) + + options = ["PO", "ALC", "SWR"] + rs = RadioSetting("mtr_mode", "S-Meter mode", + RadioSettingValueList(options, + options[_settings.mtr_mode])) + pnlcfg.append(rs) + # End _do_panel_Buttons + + def _do_vox_settings(self, voxdat): # - - VOX and DATA Settings + _settings = self._memobj.settings + + rs = RadioSetting("vox_dly", "VOX delay (x 100 ms)", + RadioSettingValueInteger(1, 30, _settings.vox_dly)) + voxdat.append(rs) + + rs = RadioSetting("vox_gain", "VOX Gain", + RadioSettingValueInteger(0, 100, + _settings.vox_gain)) + voxdat.append(rs) + + rs = RadioSetting("dig_vox", "Digital VOX Gain", + RadioSettingValueInteger(0, 100, + _settings.dig_vox)) + voxdat.append(rs) + + rs = RadioSetting("d_disp", "User-L/U freq offset (Hz)", + RadioSettingValueInteger(-3000, 30000, + _settings.d_disp, 10)) + voxdat.append(rs) + + options = ["170 Hz", "200 Hz", "425 Hz", "850 Hz"] + rs = RadioSetting("rty_sft", "RTTY FSK Freq Shift", + RadioSettingValueList(options, + options[_settings.rty_sft])) + voxdat.append(rs) + + options = ["1275 Hz", "2125 Hz"] + rs = RadioSetting("rty_ton", "RTTY FSK Mark tone", + RadioSettingValueList(options, + options[_settings.rty_ton])) + voxdat.append(rs) + + options = ["Normal", "Reverse"] + rs = RadioSetting("rtyrpol", "RTTY Mark/Space RX polarity", + RadioSettingValueList(options, + options[_settings.rtyrpol])) + voxdat.append(rs) + + rs = RadioSetting("rtytpol", "RTTY Mark/Space TX polarity", + RadioSettingValueList(options, + options[_settings.rtytpol])) + voxdat.append(rs) + # End _do_vox_settings + + def _do_mic_settings(self, mic): # - - MIC Settings + _settings = self._memobj.settings + + rs = RadioSetting("mic_eq", "Mic Equalizer", + RadioSettingValueInteger(0, 9, _settings.mic_eq)) + mic.append(rs) + + options = ["Low", "Normal", "High"] + rs = RadioSetting("micgain", "Mic Gain", + RadioSettingValueList(options, + options[_settings.micgain])) + mic.append(rs) + + rs = RadioSetting("micscan", "Mic scan enabled", + RadioSettingValueBoolean(_settings.micscan)) + rs.set_doc("Enables channel scanning via mic up/down buttons.") + mic.append(rs) + + rs = RadioSetting("pm_dwn", "Mic Down button function", + RadioSettingValueList(self.FUNC_LIST, + self.FUNC_LIST[_settings.pm_dwn])) + mic.append(rs) + + rs = RadioSetting("pm_fst", "Mic Fast button function", + RadioSettingValueList(self.FUNC_LIST, + self.FUNC_LIST[_settings.pm_fst])) + mic.append(rs) + + rs = RadioSetting("pm_up", "Mic Up button function", + RadioSettingValueList(self.FUNC_LIST, + self.FUNC_LIST[_settings.pm_up])) + mic.append(rs) + # End _do_mic_settings + + def _do_mymodes_settings(self, mymodes): # - - MYMODES + _settings = self._memobj.settings # Inverted Logic requires callback + + bx = not _settings.mym_lsb + rs = RadioSetting("mym_lsb", "LSB", RadioSettingValueBoolean(bx)) + rs.set_apply_callback(self._invert_me, _settings, "mym_lsb") + mymodes.append(rs) + + bx = not _settings.mym_usb + rs = RadioSetting("mym_usb", "USB", RadioSettingValueBoolean(bx)) + rs.set_apply_callback(self._invert_me, _settings, "mym_usb") + mymodes.append(rs) + + bx = not _settings.mym_cw + rs = RadioSetting("mym_cw", "CW", RadioSettingValueBoolean(bx)) + rs.set_apply_callback(self._invert_me, _settings, "mym_cw") + mymodes.append(rs) + + bx = not _settings.mym_am + rs = RadioSetting("mym_am", "AM", RadioSettingValueBoolean(bx)) + rs.set_apply_callback(self._invert_me, _settings, "mym_am") + mymodes.append(rs) + + bx = not _settings.mym_fm + rs = RadioSetting("mym_fm", "FM", RadioSettingValueBoolean(bx)) + rs.set_apply_callback(self._invert_me, _settings, "mym_fm") + mymodes.append(rs) + + bx = not _settings.mym_data + rs = RadioSetting("mym_data", "DATA", RadioSettingValueBoolean(bx)) + rs.set_apply_callback(self._invert_me, _settings, "mym_data") + mymodes.append(rs) + # End _do_mymodes_settings + + def _do_mybands_settings(self, mybands): # - - MYBANDS Settings + _settings = self._memobj.settings # Inverted Logic requires callback + + bx = not _settings.myb_1_8 + rs = RadioSetting("myb_1_8", "1.8 MHz", RadioSettingValueBoolean(bx)) + rs.set_apply_callback(self._invert_me, _settings, "myb_1_8") + mybands.append(rs) + + bx = not _settings.myb_3_5 + rs = RadioSetting("myb_3_5", "3.5 MHz", RadioSettingValueBoolean(bx)) + rs.set_apply_callback(self._invert_me, _settings, "myb_3_5") + mybands.append(rs) + + bx = not _settings.myb_7 + rs = RadioSetting("myb_7", "7 MHz", RadioSettingValueBoolean(bx)) + rs.set_apply_callback(self._invert_me, _settings, "myb_7") + mybands.append(rs) + + bx = not _settings.myb_10 + rs = RadioSetting("myb_10", "10 MHz", RadioSettingValueBoolean(bx)) + rs.set_apply_callback(self._invert_me, _settings, "myb_10") + mybands.append(rs) + + bx = not _settings.myb_14 + rs = RadioSetting("myb_14", "14 MHz", RadioSettingValueBoolean(bx)) + rs.set_apply_callback(self._invert_me, _settings, "myb_14") + mybands.append(rs) + + bx = not _settings.myb_18 + rs = RadioSetting("myb_18", "18 MHz", RadioSettingValueBoolean(bx)) + rs.set_apply_callback(self._invert_me, _settings, "myb_18") + mybands.append(rs) + + bx = not _settings.myb_21 + rs = RadioSetting("myb_21", "21 MHz", RadioSettingValueBoolean(bx)) + rs.set_apply_callback(self._invert_me, _settings, "myb_21") + mybands.append(rs) + + bx = not _settings.myb_24 + rs = RadioSetting("myb_24", "24 MHz", RadioSettingValueBoolean(bx)) + rs.set_apply_callback(self._invert_me, _settings, "myb_24") + mybands.append(rs) + + bx = not _settings.myb_28 + rs = RadioSetting("myb_28", "28 MHz", RadioSettingValueBoolean(bx)) + rs.set_apply_callback(self._invert_me, _settings, "myb_28") + mybands.append(rs) + + bx = not _settings.myb_50 + rs = RadioSetting("myb_50", "50 MHz", RadioSettingValueBoolean(bx)) + rs.set_apply_callback(self._invert_me, _settings, "myb_50") + mybands.append(rs) + # End _do_mybands_settings + + def set_settings(self, settings): + _settings = self._memobj.settings + _mem = self._memobj + for element in settings: + if not isinstance(element, RadioSetting): + self.set_settings(element) + continue + else: + try: + name = element.get_name() + if "." in name: + bits = name.split(".") + obj = self._memobj + for bit in bits[: -1]: + if "/" in bit: + bit, index = bit.split("/", 1) + index = int(index) + obj = getattr(obj, bit)[index] + else: + obj = getattr(obj, bit) + setting = bits[-1] + else: + obj = _settings + setting = element.get_name() + + if element.has_apply_callback(): + LOG.debug("Using apply callback") + element.run_apply_callback() + elif element.value.get_mutable(): + LOG.debug("Setting %s = %s" % (setting, element.value)) + setattr(obj, setting, element.value) + except Exception: + LOG.debug(element.get_name()) + raise diff --git a/chirp/drivers/ft50.py b/chirp/drivers/ft50.py index ef86ca2..3acb571 100644 --- a/chirp/drivers/ft50.py +++ b/chirp/drivers/ft50.py @@ -22,7 +22,6 @@ from chirp.settings import RadioSetting, RadioSettingGroup, \ RadioSettingValueInteger, RadioSettingValueList, \ RadioSettingValueBoolean, RadioSettingValueString, \ RadioSettings -from textwrap import dedent LOG = logging.getLogger(__name__) @@ -192,19 +191,20 @@ class FT50Radio(yaesu_clone.YaesuCloneModeRadio): @classmethod def get_prompts(cls): rp = chirp_common.RadioPrompts() - rp.pre_download = _(dedent("""\ -1. Turn radio off. -2. Connect cable to MIC/SP jack. -3. Press and hold [PTT] & Knob while turning the - radio on. -4. After clicking OK, press the [PTT] switch to send image.""")) - rp.pre_upload = _(dedent("""\ -1. Turn radio off. -2. Connect cable to MIC/SP jack. -3. Press and hold [PTT] & Knob while turning the - radio on. -4. Press the [MONI] switch ("WAIT" will appear on the LCD). -5. Press OK.""")) + rp.pre_download = _( + "1. Turn radio off.\n" + "2. Connect cable to MIC/SP jack.\n" + "3. Press and hold [PTT] & Knob while turning the\n" + " radio on.\n" + "4. After clicking OK, press the [PTT] switch to send" + " image.\n") + rp.pre_upload = _( + "1. Turn radio off.\n" + "2. Connect cable to MIC/SP jack.\n" + "3. Press and hold [PTT] & Knob while turning the\n" + " radio on.\n" + "4. Press the [MONI] switch (\"WAIT\" will appear on the LCD).\n" + "5. Press OK.\n") return rp def get_features(self): @@ -541,7 +541,7 @@ class FT50Radio(yaesu_clone.YaesuCloneModeRadio): try: setting = element.get_name() _settings = self._memobj.settings - if re.match('autodial\d', setting): + if re.match(r'autodial\d', setting): # set autodial fields dtmfstr = str(element.value).strip() newval = [] @@ -559,7 +559,7 @@ class FT50Radio(yaesu_clone.YaesuCloneModeRadio): bitwise.int_to_bcd(_settings.pagingcodep, int(element.value)) continue - if re.match('pagingcode\d', setting): + if re.match(r'pagingcode\d', setting): idx = int(setting[-1:]) - 1 bitwise.int_to_bcd(_settings.pagingcode[idx].digits, int(element.value)) @@ -592,6 +592,7 @@ def _clone_out(radio): def __clone_out(radio): pipe = radio.pipe + pipe.timeout = 1 block_lengths = radio._block_lengths total_written = 0 @@ -609,27 +610,27 @@ def __clone_out(radio): for block in radio._block_lengths: blocks += 1 data = radio.get_mmap()[pos:pos + block] - # LOG.debug(util.hexprint(data)) + # LOG.debug("Sending block: %s" % util.hexprint(data)) - recvd = "" + recvd = b"" # Radio echos every block received for byte in data: time.sleep(0.01) - pipe.write(byte) + pipe.write(bytes([byte])) # flush & sleep so don't loose ack pipe.flush() time.sleep(0.015) recvd += pipe.read(1) # chew the echo - # LOG.debug(util.hexprint(recvd)) + # LOG.debug("Echo was %s" % util.hexprint(recvd)) LOG.debug("Bytes sent: %i" % len(data)) # Radio does not ack last block if (blocks < 8): buf = pipe.read(block) LOG.debug("ACK attempt: " + util.hexprint(buf)) - if buf and buf[0] != chr(yaesu_clone.CMD_ACK): + if buf and buf[0] != yaesu_clone.CMD_ACK: buf = pipe.read(block) - if not buf or buf[-1] != chr(yaesu_clone.CMD_ACK): + if not buf or buf[-1] != yaesu_clone.CMD_ACK: raise errors.RadioError("Radio did not ack block %i" % blocks) total_written += len(data) diff --git a/chirp/drivers/ft60.py b/chirp/drivers/ft60.py index 7c2cfd7..a1bc2ee 100644 --- a/chirp/drivers/ft60.py +++ b/chirp/drivers/ft60.py @@ -14,20 +14,17 @@ # along with this program. If not, see . import time -import os import logging from chirp.drivers import yaesu_clone from chirp import chirp_common, memmap, bitwise, directory, errors from chirp.settings import RadioSetting, RadioSettingGroup, \ - RadioSettingValueInteger, RadioSettingValueList, \ - RadioSettingValueBoolean, RadioSettingValueString, \ - RadioSettingValueFloat, RadioSettings -from textwrap import dedent + RadioSettingValueList, RadioSettingValueString, \ + RadioSettings LOG = logging.getLogger(__name__) -ACK = "\x06" +ACK = b"\x06" def _send(pipe, data): @@ -38,7 +35,7 @@ def _send(pipe, data): def _download(radio): - data = "" + data = b"" for i in range(0, 10): chunk = radio.pipe.read(8) if len(chunk) == 8: @@ -70,7 +67,7 @@ def _download(radio): status.msg = "Cloning from radio" radio.status_fn(status) - return memmap.MemoryMap(data) + return memmap.MemoryMapBytes(data) def _upload(radio): @@ -279,7 +276,8 @@ u8 checksum; """ DUPLEX = ["", "", "-", "+", "split", "off"] -TMODES = ["", "Tone", "TSQL", "TSQL-R", "DTCS"] +TMODES = ["", "Tone", "TSQL", "TSQL-R", "DTCS", + "DTCS->", "Tone->DTCS", "DTCS->Tone"] POWER_LEVELS = [chirp_common.PowerLevel("High", watts=5.0), chirp_common.PowerLevel("Mid", watts=2.0), chirp_common.PowerLevel("Low", watts=0.5)] @@ -352,30 +350,32 @@ class FT60Radio(yaesu_clone.YaesuCloneModeRadio): @classmethod def get_prompts(cls): rp = chirp_common.RadioPrompts() - rp.pre_download = _(dedent("""\ -1. Turn radio off. -2. Connect cable to MIC/SP jack. -3. Press and hold in the [MONI] switch while turning the - radio on. -4. Rotate the DIAL job to select "F8 CLONE". -5. Press the [F/W] key momentarily. -6. After clicking OK, hold the [PTT] switch - for one second to send image.""")) - rp.pre_upload = _(dedent("""\ -1. Turn radio off. -2. Connect cable to MIC/SP jack. -3. Press and hold in the [MONI] switch while turning the - radio on. -4. Rotate the DIAL job to select "F8 CLONE". -5. Press the [F/W] key momentarily. -6. Press the [MONI] switch ("--RX--" will appear on the LCD).""")) + rp.pre_download = _( + "1. Turn radio off.\n" + "2. Connect cable to MIC/SP jack.\n" + "3. Press and hold in the [MONI] switch while turning the\n" + " radio on.\n" + "4. Rotate the DIAL job to select \"F8 CLONE\".\n" + "5. Press the [F/W] key momentarily.\n" + "6. After clicking OK, hold the [PTT] switch\n" + " for one second to send image.\n") + rp.pre_upload = _( + "1. Turn radio off.\n" + "2. Connect cable to MIC/SP jack.\n" + "3. Press and hold in the [MONI] switch while turning the\n" + " radio on.\n" + "4. Rotate the DIAL job to select \"F8 CLONE\".\n" + "5. Press the [F/W] key momentarily.\n" + "6. Press the [MONI] switch (\"--RX--\" will appear on the" + " LCD).\n") return rp def get_features(self): rf = chirp_common.RadioFeatures() rf.memory_bounds = (1, 1000) rf.valid_duplexes = DUPLEX[1:] - rf.valid_tmodes = TMODES + rf.valid_tmodes = [x for x in TMODES if '->' not in x] + ['Cross'] + rf.valid_cross_modes = ['Tone->DTCS', 'DTCS->Tone', 'DTCS->'] rf.valid_power_levels = POWER_LEVELS rf.valid_tuning_steps = STEPS rf.valid_skips = SKIPS @@ -504,13 +504,13 @@ class FT60Radio(yaesu_clone.YaesuCloneModeRadio): _settings.dcs_nr]))) # DT.DLY - opts = ["50 MS", "100 MS", "250 MS", "450 MS", "750 MS", "1000 MS"] + 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"] + opts = ["50 ms", "100 ms"] ctcss.append(RadioSetting("dt_spd", "DTMF Autodialer Sending Speed", RadioSettingValueList(opts, opts[ _settings.dt_spd]))) @@ -577,7 +577,7 @@ class FT60Radio(yaesu_clone.YaesuCloneModeRadio): # LOCK opts = ["LK KEY", "LKDIAL", "LK K+D", "LK PTT", - "LP P+K", "LK P+D", "LK ALL"] + "LK P+K", "LK P+D", "LK ALL"] rs = RadioSetting("lock", "Control Locking", RadioSettingValueList( opts, opts[_settings.lock - 1])) @@ -625,7 +625,7 @@ class FT60Radio(yaesu_clone.YaesuCloneModeRadio): _settings.pri_rvt]))) # RXSAVE - opts = ["OFF", "200 MS", "300 MS", "500 MS", "1 S", "2 S"] + opts = ["OFF", "200 ms", "300 ms", "500 ms", "1 s", "2 s"] power.append(RadioSetting( "rxsave", "Receive Mode Battery Savery Interval", RadioSettingValueList(opts, opts[_settings.rxsave]))) @@ -716,7 +716,7 @@ class FT60Radio(yaesu_clone.YaesuCloneModeRadio): setattr(_settings, name, value) LOG.debug("Setting %s: %s" % (name, value)) - except Exception as e: + except Exception: LOG.debug(element.get_name()) raise @@ -761,7 +761,12 @@ class FT60Radio(yaesu_clone.YaesuCloneModeRadio): mem.duplex = "off" else: mem.offset = _decode_freq(_mem.tx_freq) - mem.tmode = TMODES[_mem.tmode] + tmode = TMODES[_mem.tmode] + if '->' in tmode: + mem.tmode = 'Cross' + mem.cross_mode = tmode + else: + mem.tmode = tmode mem.rtone = chirp_common.TONES[_mem.tone] mem.dtcs = chirp_common.DTCS_CODES[_mem.dtcs] mem.power = POWER_LEVELS[_mem.power] @@ -789,7 +794,7 @@ class FT60Radio(yaesu_clone.YaesuCloneModeRadio): _nam = self._memobj.names[mem.number - 1] _skp = self._memobj.flags[(mem.number - 1) / 4] - assert(_mem) + assert (_mem) if mem.empty: _mem.used = False return @@ -811,7 +816,10 @@ class FT60Radio(yaesu_clone.YaesuCloneModeRadio): _mem.tx_freq = 0 _mem.offset = mem.offset / 50000 _mem.duplex = DUPLEX.index(mem.duplex) - _mem.tmode = TMODES.index(mem.tmode) + if mem.tmode == 'Cross': + _mem.tmode = TMODES.index(mem.cross_mode) + else: + _mem.tmode = TMODES.index(mem.tmode) _mem.tone = chirp_common.TONES.index(mem.rtone) _mem.dtcs = chirp_common.DTCS_CODES.index(mem.dtcs) _mem.power = mem.power and POWER_LEVELS.index(mem.power) or 0 diff --git a/chirp/drivers/ft70.py b/chirp/drivers/ft70.py index 3db601f..bd49f1e 100644 --- a/chirp/drivers/ft70.py +++ b/chirp/drivers/ft70.py @@ -18,11 +18,13 @@ import logging from chirp.drivers import yaesu_clone from chirp import chirp_common, directory, bitwise +from chirp import errors +from chirp import memmap from chirp.settings import RadioSettingGroup, RadioSetting, RadioSettings, \ - RadioSettingValueInteger, RadioSettingValueString, \ - RadioSettingValueList, RadioSettingValueBoolean, \ + RadioSettingValueString, RadioSettingValueList, \ InvalidValueError -from textwrap import dedent +from chirp import util + import string LOG = logging.getLogger(__name__) @@ -37,16 +39,16 @@ MEM_SETTINGS_FORMAT = """ // FT-70DE New Model #5329 // -// Communications Mode ? AMS,FM DN,DW TX vs RX? -// Mode not currently correctly stored in memories ? - ALL show as FM in memories +// Communications Mode ? AMS,FM DN,DW TX vs RX? +// Mode not currently correctly stored in memories ? - ALL show as FM in memories // SKIP test/where stored // Check storage of steps // Pager settings ? // Triple check/ understand _memsize and _block_lengths -// Bank name label name size display 6 store 16? padded with 0xFF same for MYCALL and message +// Bank name label name size display 6 store 16? padded with 0xFF same for MYCALL and message // CHIRP mode DIG not supported - is there a CHIRP Fusion mode? Auto? // Check character set -// Supported Modes ? +// Supported Modes ? // Supported Bands ? // rf.has_dtcs_polarity = False - think radio supports DTCS polarity // rf.memory_bounds = (1, 900) - should this be 0? as zero displays as blank @@ -56,13 +58,13 @@ MEM_SETTINGS_FORMAT = """ // Banks and VFO? // Features Required -// Default AMS and Memory name (in mem extras) to enabled. +// Default AMS and Memory name (in mem extras) to enabled. // Bugs // MYCALL and Opening Message errors if not 10 characters // Values greater than one sometimes stored as whole bytes, these need to be refactored into bit fields -// to prevent accidental overwriting of adjacent values -// Bank Name length not checked on gui input - but first 6 characters are saved correctly. +// to prevent accidental overwriting of adjacent values +// Bank Name length not checked on gui input - but first 6 characters are saved correctly. // Extended characters entered as bank names on radio are corrupted in Chirp // Missing @@ -71,106 +73,106 @@ MEM_SETTINGS_FORMAT = """ // Radio Questions // Temp unit C/F not saved by radio, always goes back to C ? -// 44 RF SQL Adjusts the RF Squelch threshold level. OFF / S1 - S9? Default is OFF - Based on RF strength - for AM? How +// 44 RF SQL Adjusts the RF Squelch threshold level. OFF / S1 - S9? Default is OFF - Based on RF strength - for AM? How // is this different from F, Monitor, Dial Squelch? -// Password setting on radio allows letters (DTMF), but letters cannot be entered at the radio's password prompt? -// 49 SCM.WTH Set the memory scan frequency range. ALL / BAND Defaults to ALL Not Band as stated in the manual. - +// Password setting on radio allows letters (DTMF), but letters cannot be entered at the radio's password prompt? +// 49 SCM.WTH Set the memory scan frequency range. ALL / BAND Defaults to ALL Not Band as stated in the manual. + #seekto 0x049a; - struct { + struct { u8 unknown0:4, squelch:4; // Squelch F, Monitor, Dial Adjust the Squelch level - } squelch_settings; - + } squelch_settings; + #seekto 0x04ba; - struct { + struct { u8 unknown:3, scan_resume:5; // 52 SCN.RSM Configure the scan stop mode settings. 2.0 S - 5.0 S - 10.0 S / BUSY / HOLD - u8 unknown1:3, + u8 unknown1:3, dw_resume_interval:5; // 22 DW RSM Configure the scan stop mode settings for Dual Receive. 2.0S-10.0S/BUSY/HOLD - u8 unknown2; + u8 unknown2; u8 unknown3:3, apo:5; // 02 APO Set the length of time until the transceiver turns off automatically. - u8 unknown4:6, - gm_ring:2; // 24 GM RNG Select the beep option while receiving digital GM info. OFF/IN RNG/ALWAYS - u8 temp_cf; // Placeholder as not found + u8 unknown4:6, + gm_ring:2; // 24 GM RNG Select the beep option while receiving digital GM info. OFF/IN RNG/ALWAYS + u8 temp_cf; // Placeholder as not found u8 unknown5; - } first_settings; - + } first_settings; + #seekto 0x04ed; - struct { + struct { u8 unknown1:1, - unknown2:1, + unknown2:1, unknown3:1, - unknown4:1, - unknown5:1, - unknown6:1, - unknown7:1, - unknown8:1; - } test_bit_field; - + unknown4:1, + unknown5:1, + unknown6:1, + unknown7:1, + unknown8:1; + } test_bit_field; + #seekto 0x04c0; struct { u8 unknown1:5, beep_level:3; // 05 BEP.LVL Beep volume setting LEVEL1 - LEVEL4 - LEVEL7 u8 unknown2:6, beep_select:2; // 04 BEEP Sets the beep sound function OFF / KEY+SC / KEY - } beep_settings; - - #seekto 0x04ce; + } beep_settings; + + #seekto 0x04ce; struct { u8 lcd_dimmer; // 14 DIMMER LCD Dimmer - u8 dtmf_delay; // 18 DT DLY DTMF delay - u8 unknown0[3]; + u8 dtmf_delay; // 18 DT DLY DTMF delay + u8 unknown0[3]; u8 unknown1:4, - unknown1:4; + unknown1:4; u8 lamp; // 28 LAMP Set the duration time of the backlight and keys to be lit u8 lock; // 30 LOCK Configure the lock mode setting. KEY/DIAL/K+D/PTT/K+P/D+P/ALL u8 unknown2_1; u8 mic_gain; // 31 MCGAIN Adjust the microphone gain level u8 unknown2_3; u8 dw_interval; // 21 DW INT Set the priority memory ch mon int during Dual RX 0.1S-5.0S-10.0S - u8 ptt_delay; // 42 PTT.DLY Set the PTT delay time. OFF / 20 MS / 50 MS / 100 MS / 200 MS - u8 rx_save; // 48 RX.SAVE Set the battery save time. OFF / 0.2 S - 60.0 S - u8 scan_restart; // 53 SCN.STR Set the scanning restart time. 0.1 S - 2.0 S - 10.0 S - u8 unknown2_5; - u8 unknown2_6; + u8 ptt_delay; // 42 PTT.DLY Set the PTT delay time. OFF / 20 ms / 50 ms / 100 ms / 200 ms + u8 rx_save; // 48 RX.SAVE Set the battery save time. OFF / 0.2 s - 60.0 s + u8 scan_restart; // 53 SCN.STR Set the scanning restart time. 0.1 s - 2.0 s - 10.0 s + u8 unknown2_5; + u8 unknown2_6; u8 unknown4[5]; - u8 tot; // 56 TOT Set the transmission timeout timer - u8 unknown5[3]; // 26 + u8 tot; // 56 TOT Set the transmission timeout timer + u8 unknown5[3]; // 26 u8 vfo_mode:1, // 60 VFO.MOD Set freq setting range in the VFO mode by DIAL knob. ALL / BAND unknown7:1, scan_lamp:1, // 51 SCN.LMP Set the scan lamp ON or OFF when scanning stops On/Off unknown8:1, ars:1, // 45 RPT.ARS Turn the ARS function on/off. dtmf_speed:1, // 20 DT SPD Set DTMF speed - unknown8:1, + unknown8:1, dtmf_mode:1; // DTMF Mode set from front panel - u8 busy_led:1, // Not Supported ? + u8 busy_led:1, // Not Supported ? unknown8_2:1, unknown8_3:1, bclo:1, // 03 BCLO Turns the busy channel lockout function on/off. - beep_edge:1, // 06 BEP.Edg Sets the beep sound ON or OFF when a band edge is encountered. - unknown8_6:1, + beep_edge:1, // 06 BEP.Edg Sets the beep sound ON or OFF when a band edge is encountered. + unknown8_6:1, unknown8_7:1, unknown8_8:1; // 28 - u8 unknown9_1:1, + u8 unknown9_1:1, unknown9_2:1, unknown9_3:1, - unknown9_4:1, - unknown9_5:1, + unknown9_4:1, + unknown9_5:1, password:1, // Placeholder location home_rev:1, // 26 HOME/REV Select the function of the [HOME/REV] key. moni:1; // 32 Mon/T-Call Select the function of the [MONI/T-CALL] switch. - u8 gm_interval:4, // 30 // 25 GM INT Set tx interval of digital GM information. OFF / NORMAL / LONG + u8 gm_interval:4, // 30 // 25 GM INT Set tx interval of digital GM information. OFF / NORMAL / LONG unknown10:4; - u8 unknown11; + u8 unknown11; u8 unknown12:1, unknown12_2:1, unknown12_3:1, - unknown12_4:1, + unknown12_4:1, home_vfo:1, // 27 HOME->VFO Turn transfer VFO to the Home channel ON or OFF. - unknown12_6:1, + unknown12_6:1, unknown12_7:1, dw_rt:1; // 32 // 23 DW RVT Turn "Priority Channel Revert" feature ON or OFF during Dual Rx. u8 unknown33; @@ -178,7 +180,7 @@ MEM_SETTINGS_FORMAT = """ u8 unknown35; u8 unknown36; u8 unknown37; - u8 unknown38; + u8 unknown38; u8 unknown39; u8 unknown40; u8 unknown41; @@ -190,39 +192,39 @@ MEM_SETTINGS_FORMAT = """ u8 prog_key2; // P2 Set Mode Items to the Programmable Key u8 unknown48; u8 unknown49; - u8 unknown50; - } scan_settings; - - #seekto 0x064b; + u8 unknown50; + } scan_settings; + + #seekto 0x064b; struct { u8 unknown1:1, unknown2:1, unknown3:1, unknown4:1, - vfo_scan_width:1, // Placeholder as not found - 50 SCV.WTH Set the VFO scan frequency range. BAND / ALL - memory_scan_width:1, // Placeholder as not found - 49 SCM.WTH Set the memory scan frequency range. ALL / BAND + vfo_scan_width:1, // Placeholder as not found - 50 SCV.WTH Set the VFO scan frequency range. BAND / ALL + memory_scan_width:1, // Placeholder as not found - 49 SCM.WTH Set the memory scan frequency range. ALL / BAND unknown7:1, unknown8:1; } scan_settings_1; - - #seekto 0x06B6; + + #seekto 0x06B6; struct { u8 unknown1:3, volume:5; // # VOL and Dial Adjust the volume level - } scan_settings_2; - + } scan_settings_2; + #seekto 0x0690; // Memory or VFO Settings Map? struct { u8 unknown[48]; // Array cannot be 64 elements! - u8 unknown1[16]; // Exception: Not implemented for chirp.bitwise.structDataElement + u8 unknown1[16]; // Exception: Not implemented for chirp.bitwise.structDataElement } vfo_info_1; - + #seekto 0x0710; // Backup Memory or VFO Settings Map? struct { u8 unknown[48]; u8 unknown1[16]; - } vfo_backup_info_1; - + } vfo_backup_info_1; + #seekto 0x047e; struct { u8 unknown1; @@ -231,30 +233,30 @@ MEM_SETTINGS_FORMAT = """ struct { char padded_string[6]; // 36 OPN.MSG Select MSG then key vm to edit it } message; - } opening_message; // 36 OPN.MSG Select the Opening Message when transceiver is ON. OFF/MSG/DC - + } opening_message; // 36 OPN.MSG Select the Opening Message when transceiver is ON. OFF/MSG/DC + #seekto 0x094a; // DTMF Memories struct { u8 memory[16]; - } dtmf[10]; - - #seekto 0x154a; + } dtmf[10]; + + #seekto 0x154a; struct { u16 channel[100]; } bank_members[24]; - + #seekto 0x54a; struct { u16 in_use; } bank_used[24]; - + #seekto 0x0EFE; struct { u8 unknown[2]; u8 name[6]; u8 unknown1[10]; } bank_info[24]; - + #seekto 0xCF30; struct { u8 unknown0; @@ -264,9 +266,9 @@ MEM_SETTINGS_FORMAT = """ u8 unknown4; u8 unknown5; u8 unknown6; - u8 digital_popup; // 15 DIG.POP Call sign display pop up time + u8 digital_popup; // 15 DIG.POP Call sign display pop up time } digital_settings_more; - + #seekto 0xCF7C; struct { u8 unknown0:6, @@ -274,26 +276,26 @@ MEM_SETTINGS_FORMAT = """ u8 unknown1; u8 unknown2:7, standby_beep:1; // 07 BEP.STB Standby Beep in the digital C4FM mode. On/Off - u8 unknown3; + u8 unknown3; u8 unknown4:6, gm_ring:2; // 24 GM RNG Select beep option while rx digital GM info. OFF/IN RNG/ALWAYS u8 unknown5; u8 rx_dg_id; // RX DG-ID Long Press Mode Key, Mode Key to select, Dial - u8 tx_dg_id; // TX DG-ID Long Press Mode Key, Dial + u8 tx_dg_id; // TX DG-ID Long Press Mode Key, Dial u8 unknown6:7, vw_mode:1; // 16 DIG VW Turn the VW mode selection ON or OFF u8 unknown7; } digital_settings; - + // ^^^ All above referenced U8's have been refactored to minimum number of bits. - + """ MEM_FORMAT = """ #seekto 0x2D4A; struct { // 32 Bytes per memory entry u8 display_tag:1, // 0 Display Freq, 1 Display Name - unknown0:1, // Mode if AMS not selected???????? + unknown0:1, // Mode if AMS not selected???????? deviation:1, // 0 Full deviation (Wide), 1 Half deviation (Narrow) clock_shift:1, // 0 None, 1 CPU clock shifted unknown1:4; // 1 @@ -302,36 +304,38 @@ MEM_FORMAT = """ tune_step:4; // Works - check all steps? 7 = Auto // 1 bbcd freq[3]; // Works // 3 u8 power:2, // Works - unknown2:1, // 0 FM, 1 Digital - If AMS off - ams:1, // 0 AMS off, 1 AMS on ? + unknown2:1, // 0 FM, 1 Digital - If AMS off + ams:1, // 0 AMS off, 1 AMS on ? tone_mode:4; // Works // 1 - u8 charsetbits[2]; // 2 + u8 charsetbits[2]; // 2 char label[6]; // Works - Can only input 6 on screen // 6 - char unknown7[10]; // Rest of label ??? // 10 + char unknown7[10]; // Rest of label ??? // 10 bbcd offset[3]; // Works // 3 u8 unknown5:2, tone:6; // Works // 1 u8 unknown6:1, dcs:7; // Works // 1 u8 unknown9; - u8 ams_on_dn_vw_fm:2, // AMS DN, AMS VW, AMS FM + u8 ams_on_dn_vw_fm:2, // AMS DN, AMS VW, AMS FM unknown8_3:1, unknown8_4:1, - unknown8_5:1, - unknown8_6:1, - unknown8_7:1, - unknown8_8:1; - u8 unknown10; - } memory[%d]; // DN, VW, FM, AM - // AMS DN, AMS VW, AMS FM - + smeter:4; + u8 unknown10:2, + att:1, + auto_step:1, + auto_mode:1, + unknown11:2, + bell:1; + } memory[%d]; // DN, VW, FM, AM + // AMS DN, AMS VW, AMS FM + #seekto 0x280A; struct { u8 nosubvfo:1, unknown:3, pskip:1, // PSkip (Select?) skip:1, // Skip memory during scan - used:1, // Memory used + used:1, // Memory used valid:1; // Always 1? } flag[%d]; """ @@ -352,7 +356,7 @@ MEM_CHECKSUM_FORMAT = """ TMODES = ["", "Tone", "TSQL", "DTCS"] DUPLEX = ["", "-", "+", "split"] -MODES = ["FM", "AM"] +MODES = ["FM", "AM", "NFM"] STEPS = [0, 5, 6.25, 10, 12.5, 15, 20, 25, 50, 100] # 0 = auto RFSQUELCH = ["OFF", "S1", "S2", "S3", "S4", "S5", "S6", "S7", "S8"] @@ -470,8 +474,10 @@ class FT70Radio(yaesu_clone.YaesuCloneModeRadio): BAUD_RATE = 38400 VENDOR = "Yaesu" MODEL = "FT-70D" + FORMATS = [directory.register_format('FT-70D ADMS-10', '*.ft70d')] - _model = "AH51G" + _model = b"AH51G" + _adms_ext = '.ft70d' _memsize = 65227 # 65227 read from dump _block_lengths = [10, 65217] @@ -510,7 +516,7 @@ class FT70Radio(yaesu_clone.YaesuCloneModeRadio): _MONI_TCALL = ("Monitor", "Tone-CALL") _HOME_REV = ("Home", "Reverse") _LOCK = ("KEY", "DIAL", "Key+Dial", "PTT", "Key+PTT", "Dial+PTT", "ALL") - _PTT_DELAY = ("Off", "20 MS", "50 MS", "100 MS", "200 MS") + _PTT_DELAY = ("Off", "20 ms", "50 ms", "100 ms", "200 ms") _BEEP_LEVEL = ("Level 1", "Level 2", "Level 3", "Level 4", "Level 5", "Level 6", "Level 7") _SET_MODE = ("Level 1", "Level 2", "Level 3", "Level 4", "Level 5", "Level 6", "Level 7") _RX_SAVE = ("OFF", "0.2s", ".3s", ".4s", ".5s", ".6s", ".7s", ".8s", ".9s", "1.0s", "1.5s", @@ -528,27 +534,36 @@ class FT70Radio(yaesu_clone.YaesuCloneModeRadio): _GM_RING = ("OFF", "IN RING", "AlWAYS") _GM_INTERVAL = ("LONG", "NORMAL", "OFF") - _MYCALL_CHR_SET = list(string.ascii_uppercase) + list(string.digits) + ['-','/' ] + _MYCALL_CHR_SET = list(string.ascii_uppercase) + list(string.digits) + ['-', '/'] + + @classmethod + def match_model(cls, filedata, filename): + if filename.endswith(cls._adms_ext): + return True + else: + return super().match_model(filedata, filename) @classmethod def get_prompts(cls): rp = chirp_common.RadioPrompts() - rp.pre_download = _(dedent("""\ - 1. Turn radio on. - 2. Connect cable to DATA terminal. - 3. Unclip battery. - 4. Press and hold in the [AMS] key and power key while clipping the battery back in - ("ADMS" will appear on the display). - 5. After clicking OK, press the [BAND] key.""" - )) - rp.pre_upload = _(dedent("""\ - 1. Turn radio on. - 2. Connect cable to DATA terminal. - 3. Unclip battery. - 4. Press and hold in the [AMS] key and power key while clipping the battery back in - ("ADMS" will appear on the display). - 5. Press the [MODE] key ("-WAIT-" will appear on the LCD). Then click OK""")) + rp.pre_download = _( + "1. Turn radio on.\n" + "2. Connect cable to DATA terminal.\n" + "3. Unclip battery.\n" + "4. Press and hold in the [AMS] key and power key while clipping" + " \n in back battery the" + "(\"ADMS\" will appear on the display).\n" + "5. After clicking OK, press the [BAND] key.\n") + rp.pre_upload = _( + "1. Turn radio on.\n" + "2. Connect cable to DATA terminal.\n" + "3. Unclip battery.\n" + "4. Press and hold in the [AMS] key and power key while clipping" + " \n in back battery the" + "(\"ADMS\" will appear on the display).\n" + "5. Press the [MODE] key (\"-WAIT-\" will appear on the LCD)." + " OK\n click Then") return rp def process_mmap(self): @@ -628,7 +643,7 @@ class FT70Radio(yaesu_clone.YaesuCloneModeRadio): return self._add_ff_pad(mem.name.rstrip(), 6) def _encode_charsetbits(self, mem): - # We only speak english here in chirpville + # We only speak English here in chirpville return [0x00, 0x00] def _decode_power_level(self, mem): # 3 High 2 Mid 1 Low @@ -638,10 +653,18 @@ class FT70Radio(yaesu_clone.YaesuCloneModeRadio): return 3 - POWER_LEVELS.index(mem.power) def _decode_mode(self, mem): - return MODES[mem.mode] + mode = MODES[mem.mode] + if mode == 'FM' and int(mem.deviation): + return 'NFM' + else: + return mode def _encode_mode(self, mem): - return MODES.index(mem.mode) + mode = mem.mode + if mode == 'NFM': + # Narrow is handled by a separate flag + mode = 'FM' + return MODES.index(mode) def _get_tmode(self, mem, _mem): mem.tmode = TMODES[_mem.tone_mode] @@ -650,6 +673,7 @@ class FT70Radio(yaesu_clone.YaesuCloneModeRadio): _mem.tone_mode = TMODES.index(mem.tmode) def _set_mode(self, _mem, mem): + _mem.deviation = mem.mode == 'NFM' _mem.mode = self._encode_mode(mem) def _debank(self, mem): @@ -870,7 +894,7 @@ class FT70Radio(yaesu_clone.YaesuCloneModeRadio): rs = RadioSetting("scan_settings.moni", "MONI/T-CALL", val) menu.append(rs) - # 42 PTT.DLY Set the PTT delay time. OFF / 20 MS / 50 MS / 100 MS / 200 MS + # 42 PTT.DLY Set the PTT delay time. OFF / 20 ms / 50 ms / 100 ms / 200 ms val = RadioSettingValueList( self._PTT_DELAY, @@ -886,7 +910,7 @@ class FT70Radio(yaesu_clone.YaesuCloneModeRadio): rs = RadioSetting("scan_settings.ars", "ARS", val) menu.append(rs) - # 48 RX.SAVE Set the battery save time. OFF / 0.2 S - 60.0 S + # 48 RX.SAVE Set the battery save time. OFF / 0.2 s - 60.0 s val = RadioSettingValueList( self._RX_SAVE, @@ -944,12 +968,12 @@ class FT70Radio(yaesu_clone.YaesuCloneModeRadio): # MYCALL mycall = self._memobj.my_call mycallstr = str(mycall.callsign).rstrip("\xFF") - + mycallentry = RadioSettingValueString(0, 10, mycallstr, False, charset=self._MYCALL_CHR_SET) rs = RadioSetting('mycall.callsign', 'MYCALL', mycallentry) rs.set_apply_callback(self.apply_mycall, mycall) menu.append(rs) - + # Short Press AMS button AMS TX Mode digital_settings = self._memobj.digital_settings @@ -1162,7 +1186,7 @@ class FT70Radio(yaesu_clone.YaesuCloneModeRadio): except AttributeError as e: LOG.error("Setting %s is not in the memory map: %s" % (element.get_name(), e)) - except Exception as e: + except Exception: LOG.debug(element.get_name()) raise @@ -1189,3 +1213,29 @@ class FT70Radio(yaesu_clone.YaesuCloneModeRadio): raise InvalidValueError("First character of call sign can't be - or /: {0:s}".format(cs)) else: obj.callsign = cls._add_ff_pad(cs.rstrip(), 10) + + def load_mmap(self, filename): + if filename.lower().endswith(self._adms_ext): + with open(filename, 'rb') as f: + self._adms_header = f.read(0xED) + if b'=ADMS10, Version=1.0.1.0' not in self._adms_header: + raise errors.ImageDetectFailed( + 'Unsupported version found in ADMS file') + LOG.debug('ADMS Header:\n%s', + util.hexprint(self._adms_header)) + self._mmap = memmap.MemoryMapBytes(self._model + f.read()) + LOG.info('Loaded ADMS file') + self.process_mmap() + else: + chirp_common.CloneModeRadio.load_mmap(self, filename) + + def save_mmap(self, filename): + if filename.lower().endswith(self._adms_ext): + if not hasattr(self, '_adms_header'): + raise Exception('Unable to save .img to %s' % self._adms_ext) + with open(filename, 'wb') as f: + f.write(self._adms_header) + f.write(self._mmap.get_packed()[5:]) + LOG.info('Wrote file') + else: + chirp_common.CloneModeRadio.save_mmap(self, filename) diff --git a/chirp/drivers/ft7100.py b/chirp/drivers/ft7100.py index 5b4bb73..9336138 100644 --- a/chirp/drivers/ft7100.py +++ b/chirp/drivers/ft7100.py @@ -26,11 +26,10 @@ from chirp.settings import RadioSetting, RadioSettingGroup, \ RadioSettingValueList, RadioSettingValueString, RadioSettings, \ RadioSettingValueInteger, RadioSettingValueBoolean -from textwrap import dedent LOG = logging.getLogger(__name__) -ACK = "\x06" +ACK = b"\x06" NB_OF_BLOCKS = 248 BLOCK_LEN = 32 @@ -40,18 +39,18 @@ def _send(pipe, data): # pipe.write(data) --> It seems, that the single bytes are sent too fast # so send character per character with a delay for ch in data: - pipe.write(ch) + pipe.write(bytes([ch])) time.sleep(0.0012) # 0.0011 is to short. No ACK after a few packets echo = pipe.read(len(data)) - if data == "": + if data == b"": raise Exception("Failed to read echo." " Maybe serial hardware not connected." " Maybe radio not powered or not in receiving mode.") if data != echo: LOG.debug("expecting echo\n%s\n", util.hexprint(data)) LOG.debug("got echo\n%s\n", util.hexprint(echo)) - raise Exception("Got false echo. Expected: '{}', got: '{}'." - .format(data, echo)) + raise Exception("Got false echo. Expected: %r, got: %r.", + data, echo) def _send_ack(pipe): @@ -63,27 +62,29 @@ def _send_ack(pipe): def _wait_for_ack(pipe): echo = pipe.read(1) - if echo == "": + if echo == b"": raise Exception("Failed to read ACK. No response from radio.") if echo != ACK: - raise Exception("Failed to read ACK. Expected: '{}', got: '{}'." - .format(util.hexprint(ACK), util.hexprint(echo))) + raise Exception("Failed to read ACK. Expected: %r, got: %r.", + ACK, echo) def _download(radio): LOG.debug("in _download\n") - data = "" + data = b"" for _i in range(0, 60): - data = radio.pipe.read(BLOCK_LEN) + chunk = radio.pipe.read(BLOCK_LEN) + data += chunk LOG.debug("Header:\n%s", util.hexprint(data)) - LOG.debug("len(header) = %s\n", len(data)) if data == radio.IDBLOCK: break - if data == "": + if len(data) > len(radio.IDBLOCK): + break + if data == b"": raise Exception("Got no data from radio.") if data != radio.IDBLOCK: - raise Exception("Got false header. Expected: '{}', got: '{}'." - .format(radio.IDBLOCK, data)) + raise Exception("Got false header. Expected: %r, got: %r." % ( + radio.IDBLOCK, data)) _send_ack(radio.pipe) # read 16 Byte block @@ -93,9 +94,10 @@ def _download(radio): # Now the data is hardcoded in _upload(radio) data = radio.pipe.read(16) _send_ack(radio.pipe) + LOG.debug('Magic 16-byte chunk:\n%s' % util.hexprint(data)) # initialize data, the big var that holds all memory - data = "" + data = b"" for block_nr in range(NB_OF_BLOCKS): chunk = radio.pipe.read(BLOCK_LEN) if len(chunk) != BLOCK_LEN: @@ -118,12 +120,12 @@ def _download(radio): _send_ack(radio.pipe) # for debugging purposes, dump the channels, in hex. - for _i in range(0, (NB_OF_BLOCKS * BLOCK_LEN) / 26): + for _i in range(0, (NB_OF_BLOCKS * BLOCK_LEN) // 26): _start_data = 4 + 26 * _i chunk = data[_start_data:_start_data + 26] LOG.debug("channel %i:\n%s", _i-21, util.hexprint(chunk)) - return memmap.MemoryMap(data) + return memmap.MemoryMapBytes(data) def _upload(radio): @@ -133,8 +135,8 @@ def _upload(radio): # write 16 Byte block # If there should be a problem, see remarks in _download(radio) - _send(radio.pipe, "\xCC\x77\x01\x00\x0C\x07\x0C\x07" - "\x00\x00\x00\x00\x00\x00\x00\x00") + _send(radio.pipe, b"\xEE\x77\x01\x00\x0E\x07\x0E\x07" + b"\x00\x00\x00\x00\x00\x02\x00\x00") _wait_for_ack(radio.pipe) for block_nr in range(NB_OF_BLOCKS): @@ -152,6 +154,7 @@ def _upload(radio): radio.status_fn(status) block_nr += 1 + MEM_FORMAT = """ struct mem { u8 is_used:1, @@ -525,8 +528,9 @@ class FT7100Radio(YaesuCloneModeRadio): """Yaesu FT-7100M""" MODEL = "FT-7100M" VARIANT = "" - IDBLOCK = "Vartex Standard AH003M M-Map V04" + IDBLOCK = b"Vartex Standard AH003M M-Map V04" BAUD_RATE = 9600 + NEEDS_COMPAT_SERIAL = False # Return information about this radio's features, including # how many memories it has, what bands it supports, etc @@ -535,7 +539,7 @@ class FT7100Radio(YaesuCloneModeRadio): rf = chirp_common.RadioFeatures() rf.has_bank = False - rf.memory_bounds = (0, 259) + rf.memory_bounds = (0, 240) # This radio supports 120 + 10 + 120 + 10 = 260 memories # These are zero based for chirpc rf.valid_bands = [ @@ -591,13 +595,13 @@ class FT7100Radio(YaesuCloneModeRadio): return repr(self._memobj.memory[number]) def get_memory(self, number): - LOG.debug("get_memory Number: {}".format(number)) + LOG.debug("get_memory Number: %r", number) # Create a high-level memory object to return to the UI mem = chirp_common.Memory() # Get a low-level memory object mapped to the image - if number < 0: + if isinstance(number, int) and number < 0: number = SPECIAL_CHANS[number + 10] if isinstance(number, str): mem.number = -10 + SPECIAL_CHANS.index(number) @@ -659,7 +663,7 @@ class FT7100Radio(YaesuCloneModeRadio): if _mem.is_split: mem.offset = int(_mem.freq_tx_Hz) else: - mem.offset = int(_mem.offset_10khz)*10000 # 10kHz to Hz + mem.offset = int(_mem.offset_10khz)*10000 # 10 kHz to Hz if _mem.is_mode_am: mem.mode = "AM" @@ -697,7 +701,7 @@ class FT7100Radio(YaesuCloneModeRadio): return mem def set_memory(self, mem): - LOG.debug("set_memory Number: {}".format(mem.number)) + LOG.debug("set_memory Number: %r", mem.number) if mem.number < 0: number = SPECIAL_CHANS[mem.number+10] if number == 'VFO-VHF': @@ -709,8 +713,8 @@ class FT7100Radio(YaesuCloneModeRadio): elif number == 'Home-UHF': _mem = self._memobj.home_vhf_uhf[1].mem_struct else: - raise errors.RadioError("Unexpected Memory Number: {}" - .format(mem.number)) + raise errors.RadioError("Unexpected Memory Number: %r", + mem.number) else: _mem = self._memobj.memory[mem.number] @@ -921,7 +925,7 @@ class FT7100Radio(YaesuCloneModeRadio): radio_setting_value_string = RadioSettingValueString(0, 16, dtmf_string) radio_setting_value_string.set_charset(DTMF_CHARSET) - rs = RadioSetting("dtmf_{0:02d}".format(i), + rs = RadioSetting("dtmf_%02i" % i, "DTMF Mem " + str(i+1), radio_setting_value_string) @@ -1091,24 +1095,24 @@ class FT7100Radio(YaesuCloneModeRadio): setattr(_overlay, name, value) LOG.debug("Setting %s: %s", name, value) - except Exception as e: + except Exception: LOG.debug(element.get_name()) raise def _get_upper_vhf_limit(self): if self._memobj is None: # test with tox has no _memobj - upper_vhf_limit = 130 + upper_vhf_limit = 120 else: - upper_vhf_limit = int(self._memobj.nb_mem_used_vhf_and_limits) + upper_vhf_limit = int(self._memobj.nb_mem_used_vhf) return upper_vhf_limit def _get_upper_uhf_limit(self): if self._memobj is None: # test with tox has no _memobj - upper_uhf_limit = 130 + upper_uhf_limit = 120 else: - upper_uhf_limit = int(self._memobj.nb_mem_used_uhf_and_limits) + upper_uhf_limit = int(self._memobj.nb_mem_used_uhf) return upper_uhf_limit @classmethod @@ -1118,18 +1122,19 @@ class FT7100Radio(YaesuCloneModeRadio): @classmethod def get_prompts(cls): rp = chirp_common.RadioPrompts() - rp.pre_download = _(dedent("""\ - 1. Turn Radio off. - 2. Connect data cable. - 3. While holding "TONE" and "REV" buttons, turn radio on. - 4. After clicking OK, press "TONE" to send image.""")) - rp.pre_upload = _(dedent("""\ - 1. Turn Radio off. - 2. Connect data cable. - 3. While holding "TONE" and "REV" buttons, turn radio on. - 4. Press "REV" to receive image. - 5. Make sure display says "CLONE RX" and green led is blinking - 6. Click OK to start transfer.""")) + rp.pre_download = _( + "1. Turn Radio off.\n" + "2. Connect data cable.\n" + "3. While holding \"TONE\" and \"REV\" buttons, turn radio on.\n" + "4. After clicking OK, press \"TONE\" to send image.\n") + rp.pre_upload = _( + "1. Turn Radio off.\n" + "2. Connect data cable.\n" + "3. While holding \"TONE\" and \"REV\" buttons, turn radio on.\n" + "4. Press \"REV\" to receive image.\n" + "5. Make sure display says \"CLONE RX\" and green led is" + " blinking\n" + "6. Click OK to start transfer.\n") return rp def get_sub_devices(self): @@ -1156,7 +1161,7 @@ class FT7100RadioVHF(FT7100Radio): return rf def get_memory(self, number): - LOG.debug("get_memory VHF Number: {}".format(number)) + LOG.debug("get_memory VHF Number: %s", number) if isinstance(number, int): if number >= 0: mem = FT7100Radio.get_memory(self, number + 0 - 1) @@ -1170,17 +1175,16 @@ class FT7100RadioVHF(FT7100Radio): return mem def set_memory(self, mem): - LOG.debug("set_memory VHF Number: {}".format(mem.number)) - # mem is used further in test by tox. So save the modified members. - _number = mem.number + LOG.debug("set_memory VHF Number: %s", mem.number) + # We modify memory, so dupe() it to avoid changing our caller's + # version + mem = mem.dupe() if isinstance(mem.number, int): if mem.number >= 0: mem.number += -1 else: mem.number += '-VHF' super(FT7100RadioVHF, self).set_memory(mem) - # Restore modified members - mem.number = _number return @@ -1200,11 +1204,11 @@ class FT7100RadioUHF(FT7100Radio): return rf def get_memory(self, number): - LOG.debug("get_memory UHF Number: {}".format(number)) + LOG.debug("get_memory UHF Number: %s", number) upper_vhf_limit = self._get_upper_vhf_limit() if isinstance(number, int): if number >= 0: - mem = FT7100Radio.get_memory(self, number + + mem = FT7100Radio.get_memory(self, number + 10 + upper_vhf_limit - 1) else: mem = FT7100Radio.get_memory(self, number) @@ -1216,16 +1220,15 @@ class FT7100RadioUHF(FT7100Radio): return mem def set_memory(self, mem): - LOG.debug("set_memory UHF Number: {}".format(mem.number)) - # mem is used further in test by tox. So save the modified members. - _number = mem.number + LOG.debug("set_memory UHF Number: %s", mem.number) + # We modify memory, so dupe() it to avoid changing our caller's + # version + mem = mem.dupe() upper_vhf_limit = self._get_upper_vhf_limit() if isinstance(mem.number, int): if mem.number >= 0: - mem.number += upper_vhf_limit - 1 + mem.number += upper_vhf_limit - 1 + 10 else: mem.number += '-UHF' super(FT7100RadioUHF, self).set_memory(mem) - # Restore modified members - mem.number = _number return diff --git a/chirp/drivers/ft7800.py b/chirp/drivers/ft7800.py index fd26b29..87db278 100644 --- a/chirp/drivers/ft7800.py +++ b/chirp/drivers/ft7800.py @@ -15,16 +15,13 @@ import time import logging -import os import re from chirp.drivers import yaesu_clone from chirp import chirp_common, memmap, directory, bitwise, errors -from textwrap import dedent from chirp.settings import RadioSetting, RadioSettingGroup, \ - RadioSettingValueInteger, RadioSettingValueList, \ - RadioSettingValueBoolean, RadioSettingValueString, \ - RadioSettings + RadioSettingValueList, RadioSettingValueBoolean, \ + RadioSettingValueString, RadioSettings from collections import defaultdict @@ -274,26 +271,28 @@ class FTx800Radio(yaesu_clone.YaesuCloneModeRadio): @classmethod def get_prompts(cls): rp = chirp_common.RadioPrompts() - rp.pre_download = _(dedent("""\ -1. Turn radio off. -2. Connect cable to DATA jack. -3. Press and hold in the [MHz(PRI)] key while turning the - radio on. -4. Rotate the DIAL job to select "F-7 CLONE". -5. Press and hold in the [BAND(SET)] key. The display - will disappear for a moment, then the "CLONE" notation - will appear. -6. After clicking OK, press the [V/M(MW)] key to send image.""")) - rp.pre_upload = _(dedent("""\ -1. Turn radio off. -2. Connect cable to DATA jack. -3. Press and hold in the [MHz(PRI)] key while turning the - radio on. -4. Rotate the DIAL job to select "F-7 CLONE". -5. Press and hold in the [BAND(SET)] key. The display - will disappear for a moment, then the "CLONE" notation - will appear. -6. Press the [LOW(ACC)] key ("--RX--" will appear on the display).""")) + rp.pre_download = _( + "1. Turn radio off.\n" + "2. Connect cable to DATA jack.\n" + "3. Press and hold in the [MHz(PRI)] key while turning the\n" + " radio on.\n" + "4. Rotate the DIAL job to select \"F-7 CLONE\".\n" + "5. Press and hold in the [BAND(SET)] key. The display\n" + " will disappear for a moment, then the \"CLONE\" notation\n" + " will appear.\n" + "6. After clicking OK, press the [V/M(MW)] key to send" + " image.\n") + rp.pre_upload = _( + "1. Turn radio off.\n" + "2. Connect cable to DATA jack.\n" + "3. Press and hold in the [MHz(PRI)] key while turning the\n" + " radio on.\n" + "4. Rotate the DIAL job to select \"F-7 CLONE\".\n" + "5. Press and hold in the [BAND(SET)] key. The display\n" + " will disappear for a moment, then the \"CLONE\" notation\n" + " will appear.\n" + "6. Press the [LOW(ACC)] key (\"--RX--\" will appear on the" + " display).\n") return rp def get_features(self): @@ -493,9 +492,8 @@ class FT7800BankModel(chirp_common.BankModel): _bitmap = self._radio._memobj.bank_channels[bank.index] ishft = 31 - (index % 32) if not (_bitmap.bitmap[index // 32] & (1 << ishft)): - raise Exception("Memory {num} is " + - "not in bank {bank}".format(num=memory.number, - bank=bank)) + raise Exception("Memory {num} is not in bank {bank}".format( + num=memory.number, bank=bank)) _bitmap.bitmap[index // 32] &= ~(1 << ishft) self.__b2m_cache[bank.index].remove(memory.number) self.__m2b_cache[memory.number].remove(bank.index) @@ -529,7 +527,7 @@ class FT7800Radio(FTx800Radio): """Yaesu FT-7800""" MODEL = "FT-7800/7900" - _model = "AH016" + _model = b"AH016" _memsize = 31561 _block_lengths = [8, 31552, 1] TMODES = ["", "Tone", "TSQL", "TSQL-R", "DTCS"] @@ -744,7 +742,7 @@ class FT7800Radio(FTx800Radio): try: _settings = self._memobj.settings setting = element.get_name() - if re.match('dtmf\d', setting): + if re.match(r'dtmf\d', setting): # set dtmf fields dtmfstr = str(element.value).strip() newval = [] @@ -768,10 +766,11 @@ class FT7800Radio(FTx800Radio): oldval = getattr(_settings, setting) LOG.debug("Setting %s(%s) <= %s" % (setting, oldval, newval)) setattr(_settings, setting, newval) - except Exception as e: + except Exception: LOG.debug(element.get_name()) raise + MEM_FORMAT_8800 = """ #seekto 0x%X; struct { @@ -823,7 +822,7 @@ class FT8800Radio(FTx800Radio): """Base class for Yaesu FT-8800""" MODEL = "FT-8800" - _model = "AH018" + _model = b"AH018" _memsize = 22217 _block_lengths = [8, 22208, 1] @@ -835,26 +834,27 @@ class FT8800Radio(FTx800Radio): @classmethod def get_prompts(cls): rp = chirp_common.RadioPrompts() - rp.pre_download = _(dedent("""\ - 1. Turn radio off. - 2. Connect cable to DATA jack. - 3. Press and hold in the "left" [V/M] key while turning the - radio on. - 4. Rotate the "right" DIAL knob to select "CLONE START". - 5. Press the [SET] key. The display will disappear - for a moment, then the "CLONE" notation will appear. - 6. After clicking OK, press the "left" [V/M] key to - send image.""")) - rp.pre_upload = _(dedent("""\ - 1. Turn radio off. - 2. Connect cable to DATA jack. - 3. Press and hold in the "left" [V/M] key while turning the - radio on. - 4. Rotate the "right" DIAL knob to select "CLONE START". - 5. Press the [SET] key. The display will disappear - for a moment, then the "CLONE" notation will appear. - 6. Press the "left" [LOW] key ("CLONE -RX-" will appear on - the display).""")) + rp.pre_download = _( + "1. Turn radio off.\n" + "2. Connect cable to DATA jack.\n" + "3. Press and hold in the \"left\" [V/M] key while turning the\n" + " radio on.\n" + "4. Rotate the \"right\" DIAL knob to select \"CLONE START\".\n" + "5. Press the [SET] key. The display will disappear\n" + " for a moment, then the \"CLONE\" notation will appear.\n" + "6. After clicking OK, press the \"left\" [V/M] key to\n" + " send image.\n") + rp.pre_upload = _( + "1. Turn radio off.\n" + "2. Connect cable to DATA jack.\n" + "3. Press and hold in the \"left\" [V/M] key while turning the\n" + " radio on.\n" + "4. Rotate the \"right\" DIAL knob to select \"CLONE START\".\n" + "5. Press the [SET] key. The display will disappear\n" + " for a moment, then the \"CLONE\" notation will appear.\n" + "6. Press the \"left\" [LOW] key (\"CLONE -RX-\" will appear" + " on\n" + " the display).\n") return rp def get_features(self): @@ -933,6 +933,7 @@ class FT8800RadioRight(FT8800Radio): _memstart = 0x2948 _bankstart = 0x4BC8 + MEM_FORMAT_8900 = """ #seekto 0x0708; struct { @@ -973,7 +974,7 @@ class FT8900Radio(FT8800Radio): """Yaesu FT-8900""" MODEL = "FT-8900" - _model = "AH008" + _model = b"AH008" _memsize = 14793 _block_lengths = [8, 14784, 1] diff --git a/chirp/drivers/ft8100.py b/chirp/drivers/ft8100.py index 9276224..757c3d4 100644 --- a/chirp/drivers/ft8100.py +++ b/chirp/drivers/ft8100.py @@ -126,10 +126,10 @@ class FT8100Radio(yaesu_clone.YaesuCloneModeRadio): rf.can_odd_split = True # TODO - #rf.valid_special_chans = SPECIALS.keys() + # rf.valid_special_chans = SPECIALS.keys() # TODO - #rf.has_tuning_step = False + # rf.has_tuning_step = False return rf def sync_in(self): diff --git a/chirp/drivers/ft817.py b/chirp/drivers/ft817.py index d3bc077..36ca858 100644 --- a/chirp/drivers/ft817.py +++ b/chirp/drivers/ft817.py @@ -25,7 +25,6 @@ from chirp.settings import RadioSetting, RadioSettingGroup, \ RadioSettings import time import logging -from textwrap import dedent LOG = logging.getLogger(__name__) @@ -60,7 +59,7 @@ class FT817Radio(yaesu_clone.YaesuCloneModeRadio): CHARSET.remove("\\") _memsize = 6509 - # block 9 (130 Bytes long) is to be repeted 40 times + # block 9 (130 Bytes long) is to be repeated 40 times _block_lengths = [2, 40, 208, 182, 208, 182, 198, 53, 130, 118, 118] MEM_FORMAT = """ @@ -280,20 +279,22 @@ class FT817Radio(yaesu_clone.YaesuCloneModeRadio): @classmethod def get_prompts(cls): rp = chirp_common.RadioPrompts() - rp.pre_download = _(dedent("""\ - 1. Turn radio off. - 2. Connect cable to ACC jack. - 3. Press and hold in the [MODE <] and [MODE >] keys while - turning the radio on ("CLONE MODE" will appear on the - display). - 4. After clicking OK, press the [A] key to send image.""")) - rp.pre_upload = _(dedent("""\ - 1. Turn radio off. - 2. Connect cable to ACC jack. - 3. Press and hold in the [MODE <] and [MODE >] keys while - turning the radio on ("CLONE MODE" will appear on the - display). - 4. Press the [C] key ("RX" will appear on the LCD).""")) + rp.pre_download = _( + "1. Turn radio off.\n" + "2. Connect cable to ACC jack.\n" + "3. Press and hold in the [MODE <] and [MODE >] keys" + " while\n" + " turning the radio on (\"CLONE MODE\" will appear on the\n" + " display).\n" + "4. After clicking OK, press the [A] key to send image.\n") + rp.pre_upload = _( + "1. Turn radio off.\n" + "2. Connect cable to ACC jack.\n" + "3. Press and hold in the [MODE <] and [MODE >] keys" + " while\n" + " turning the radio on (\"CLONE MODE\" will appear on the\n" + " display).\n" + "4. Press the [C] key (\"RX\" will appear on the LCD).\n") return rp def _read(self, block, blocknum, lastblock): @@ -505,21 +506,21 @@ class FT817Radio(yaesu_clone.YaesuCloneModeRadio): -1): _mem = self._memobj.vfoa[-self.LAST_VFOA_INDEX + mem.number] immutable = ["number", "skip", "extd_number", - "name", "dtcs_polarity", "power", "comment"] + "name", "dtcs_polarity", "power"] elif mem.number in range(self.FIRST_VFOB_INDEX, self.LAST_VFOB_INDEX - 1, -1): _mem = self._memobj.vfob[-self.LAST_VFOB_INDEX + mem.number] immutable = ["number", "skip", "extd_number", - "name", "dtcs_polarity", "power", "comment"] + "name", "dtcs_polarity", "power"] elif mem.number in range(-2, -6, -1): _mem = self._memobj.home[5 + mem.number] immutable = ["number", "skip", "extd_number", - "name", "dtcs_polarity", "power", "comment"] + "name", "dtcs_polarity", "power"] elif mem.number == -1: _mem = self._memobj.qmb immutable = ["number", "skip", "extd_number", - "name", "dtcs_polarity", "power", "comment"] + "name", "dtcs_polarity", "power"] elif mem.number in list(self.SPECIAL_PMS.values()): bitindex = -self.LAST_PMS_INDEX + mem.number used = (self._memobj.pmsvisible >> bitindex) & 0x01 @@ -532,7 +533,7 @@ class FT817Radio(yaesu_clone.YaesuCloneModeRadio): _mem = self._memobj.pms[-self.LAST_PMS_INDEX + mem.number] immutable = ["number", "skip", "rtone", "ctone", "extd_number", "dtcs", "tmode", "cross_mode", "dtcs_polarity", - "power", "duplex", "offset", "comment"] + "power", "duplex", "offset"] else: raise Exception("Sorry, special memory index %i " % mem.number + "unknown you hit a bug!!") @@ -607,6 +608,9 @@ class FT817Radio(yaesu_clone.YaesuCloneModeRadio): if not valid or _mem.freq == 0xffffffff: return mem + if mem.number == 1: + mem.immutable = ['empty'] + return self._get_memory(mem, _mem) def _set_normal(self, mem): @@ -619,7 +623,7 @@ class FT817Radio(yaesu_clone.YaesuCloneModeRadio): if mem.empty: if mem.number == 1: # as Dan says "yaesus are not good about that :(" - # if you ulpoad an empty image you can brick your radio + # if you upload an empty image you can brick your radio raise Exception("Sorry, can't delete first memory") if wasvalid and not wasused: self._memobj.filled[(mem.number - 1) // 8] &= \ @@ -689,8 +693,8 @@ class FT817Radio(yaesu_clone.YaesuCloneModeRadio): return mem def _set_memory(self, mem, _mem): - if len(mem.name) > 0: # not supported in chirp - # so I make label visible if have one + # not supported in chirp so I make label visible if have one + if len(mem.name) > 0: _mem.tag_on_off = 1 else: _mem.tag_on_off = 0 @@ -814,7 +818,7 @@ class FT817Radio(yaesu_clone.YaesuCloneModeRadio): RadioSettingValueList(options, options[_settings.batt_chg])) basic.append(rs) - options = ["440Hz", "880Hz"] + options = ["440 Hz", "880 Hz"] rs = RadioSetting("beep_freq", "Beep frequency", RadioSettingValueList(options, options[_settings.beep_freq])) @@ -1023,7 +1027,7 @@ class FT817Radio(yaesu_clone.YaesuCloneModeRadio): rs = RadioSetting("spl", "Split", RadioSettingValueBoolean(_settings.spl)) panelcontr.append(rs) - options = ["None", "Up", "Down"] + options = ["None", "Up", "Down", "PMS"] rs = RadioSetting("scn_mode", "Scan mode", RadioSettingValueList(options, options[_settings.scn_mode])) @@ -1104,7 +1108,7 @@ class FT817Radio(yaesu_clone.YaesuCloneModeRadio): str(element.value)] else: setattr(obj, setting, element.value) - except: + except Exception: LOG.debug(element.get_name()) raise @@ -1117,7 +1121,7 @@ class FT817NDRadio(FT817Radio): _model = "" _memsize = 6521 - # block 9 (130 Bytes long) is to be repeted 40 times + # block 9 (130 Bytes long) is to be repeated 40 times _block_lengths = [2, 40, 208, 182, 208, 182, 198, 53, 130, 118, 130] @@ -1125,14 +1129,14 @@ class FT817NDRadio(FT817Radio): class FT817NDUSRadio(FT817Radio): """Yaesu FT-817ND (US version)""" - # seems that radios configured for 5MHz operations send one packet + # seems that radios configured for 5 MHz operations send one packet # more than others so we have to distinguish sub models MODEL = "FT-817ND (US)" _model = "" _US_model = True _memsize = 6651 - # block 9 (130 Bytes long) is to be repeted 40 times + # block 9 (130 Bytes long) is to be repeated 40 times _block_lengths = [2, 40, 208, 182, 208, 182, 198, 53, 130, 118, 130, 130] SPECIAL_60M = { @@ -1163,7 +1167,7 @@ class FT817NDUSRadio(FT817Radio): mem.immutable = ["number", "rtone", "ctone", "extd_number", "name", "dtcs", "tmode", "cross_mode", "dtcs_polarity", "power", "duplex", "offset", - "comment", "empty"] + "empty"] return mem @@ -1187,9 +1191,9 @@ class FT817NDUSRadio(FT817Radio): self._set_memory(mem, _mem) def get_memory(self, number): - if number in list(self.SPECIAL_60M.keys()): + if number in self.SPECIAL_60M.keys(): return self._get_special_60m(number) - elif (number < 0 and + elif (isinstance(number, int) and number < 0 and self.SPECIAL_MEMORIES_REV[number] in list(self.SPECIAL_60M.keys())): # I can't stop delete operation from losing extd_number but diff --git a/chirp/drivers/ft818.py b/chirp/drivers/ft818.py index 6b77394..9447e19 100755 --- a/chirp/drivers/ft818.py +++ b/chirp/drivers/ft818.py @@ -19,14 +19,8 @@ from chirp.drivers import ft817 from chirp import chirp_common, errors, directory -from chirp.settings import RadioSetting, RadioSettingGroup, \ - RadioSettingValueInteger, RadioSettingValueList, \ - RadioSettingValueBoolean, RadioSettingValueString, \ - RadioSettings -import os +from chirp.settings import RadioSetting, RadioSettingValueBoolean import logging -from textwrap import dedent -from chirp.util import safe_charset_string LOG = logging.getLogger(__name__) diff --git a/chirp/drivers/ft857.py b/chirp/drivers/ft857.py index 045a9a8..7b6a96c 100644 --- a/chirp/drivers/ft857.py +++ b/chirp/drivers/ft857.py @@ -22,9 +22,7 @@ from chirp.settings import RadioSetting, RadioSettingGroup, \ RadioSettingValueInteger, RadioSettingValueList, \ RadioSettingValueBoolean, RadioSettingValueString, \ RadioSettings -import os import logging -from textwrap import dedent from chirp.util import safe_charset_string LOG = logging.getLogger(__name__) @@ -60,7 +58,7 @@ class FT857Radio(ft817.FT817Radio): list(CROSS_MODES.keys())))) _memsize = 7341 - # block 9 (140 Bytes long) is to be repeted 40 times + # block 9 (140 Bytes long) is to be repeated 40 times # should be 42 times but this way I can use original 817 functions _block_lengths = [2, 82, 252, 196, 252, 196, 212, 55, 140, 140, 140, 38, 176] @@ -439,22 +437,24 @@ class FT857Radio(ft817.FT817Radio): @classmethod def get_prompts(cls): rp = chirp_common.RadioPrompts() - rp.pre_download = _(dedent("""\ - 1. Turn radio off. - 2. Connect cable to CAT/LINEAR jack. - 3. Press and hold in the [MODE <] and [MODE >] keys while - turning the radio on ("CLONE MODE" will appear on the - display). - 4. After clicking OK, - press the [C](SEND) key to send image.""")) - rp.pre_upload = _(dedent("""\ - 1. Turn radio off. - 2. Connect cable to ACC jack. - 3. Press and hold in the [MODE <] and [MODE >] keys while - turning the radio on ("CLONE MODE" will appear on the - display). - 4. Press the [A](RCV) key ("receiving" will appear on the LCD).""" - )) + rp.pre_download = _( + "1. Turn radio off.\n" + "2. Connect cable to CAT/LINEAR jack.\n" + "3. Press and hold in the [MODE <] and [MODE >] keys" + " while\n" + " turning the radio on (\"CLONE MODE\" will appear on the\n" + " display).\n" + "4. After clicking OK,\n" + " press the [C](SEND) key to send image.\n") + rp.pre_upload = _( + "1. Turn radio off.\n" + "2. Connect cable to ACC jack.\n" + "3. Press and hold in the [MODE <] and [MODE >] keys" + " while\n" + " turning the radio on (\"CLONE MODE\" will appear on the\n" + " display).\n" + "4. Press the [A](RCV) key (\"receiving\" will appear on the" + " LCD).\n") return rp def get_features(self): @@ -484,7 +484,7 @@ class FT857Radio(ft817.FT817Radio): elif mem.tmode == "TSQL": mem.rtone = mem.ctone = chirp_common.TONES[_mem.tone] elif mem.tmode == "DTCS Enc": # UI does not support it yet but - # this code has already been tested + # this code has already been tested mem.dtcs = mem.rx_dtcs = chirp_common.DTCS_CODES[_mem.dcs] elif mem.tmode == "DTCS": mem.dtcs = mem.rx_dtcs = chirp_common.DTCS_CODES[_mem.dcs] @@ -511,7 +511,7 @@ class FT857Radio(ft817.FT817Radio): elif mem.tmode == "TSQL": _mem.tone = _mem.rxtone = chirp_common.TONES.index(mem.ctone) elif mem.tmode == "DTCS Enc": # UI does not support it yet but - # this code has already been tested + # this code has already been tested _mem.dcs = _mem.rxdcs = chirp_common.DTCS_CODES.index(mem.dtcs) elif mem.tmode == "DTCS": _mem.dcs = _mem.rxdcs = chirp_common.DTCS_CODES.index(mem.rx_dtcs) @@ -541,10 +541,10 @@ class FT857Radio(ft817.FT817Radio): rs = RadioSetting("extended_menu", "Extended menu", RadioSettingValueBoolean(_settings.extended_menu)) extended.append(rs) - rs = RadioSetting("ars_144", "144MHz ARS", + rs = RadioSetting("ars_144", "144 MHz ARS", RadioSettingValueBoolean(_settings.ars_144)) basic.append(rs) - rs = RadioSetting("ars_430", "430MHz ARS", + rs = RadioSetting("ars_430", "430 MHz ARS", RadioSettingValueBoolean(_settings.ars_430)) basic.append(rs) options = ["enable", "disable"] @@ -608,7 +608,7 @@ class FT857Radio(ft817.FT817Radio): options[_settings.beacon_time]) ) extended.append(rs) - options = ["440Hz", "880Hz", "1760Hz"] + options = ["440 Hz", "880 Hz", "1760 Hz"] rs = RadioSetting("beep_tone", "Beep tone", RadioSettingValueList(options, options[_settings.beep_tone])) @@ -692,7 +692,7 @@ class FT857Radio(ft817.FT817Radio): options[_settings.cw_speed])) cw.append(rs) options = ["Numeric", "Alphabet", "AlphaNumeric"] - rs = RadioSetting("cw_training", "CW trainig", + rs = RadioSetting("cw_training", "CW training", RadioSettingValueList(options, options[_settings.cw_training]) ) @@ -782,24 +782,25 @@ class FT857Radio(ft817.FT817Radio): RadioSettingValueList(options, options[_settings.disp_mode])) panel.append(rs) - options = ["60Hz", "120Hz", "240Hz"] + options = ["60 Hz", "120 Hz", "240 Hz"] 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"] + options = ["100 Hz", "160 Hz", "220 Hz", "280 Hz", "340 Hz", "400 Hz", + "460 Hz", "520 Hz", "580 Hz", "640 Hz", "720 Hz", "760 Hz", + "820 Hz", "880 Hz", "940 Hz", "1000 Hz"] 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"] + options = ["1000 Hz", "1160 Hz", "1320 Hz", "1480 Hz", "1650 Hz", + "1800 Hz", "1970 Hz", "2130 Hz", "2290 Hz", "2450 Hz", + "2610 Hz", "2770 Hz", "2940 Hz", "3100 Hz", "3260 Hz", + "3420 Hz", "3580 Hz", "3740 Hz", "3900 Hz", "4060 Hz", + "4230 Hz", "4390 Hz", "4550 Hz", "4710 Hz", "4870 Hz", + "5030 Hz", "5190 Hz", "5390 Hz", "5520 Hz", "5680 Hz", + "5840 Hz", "6000 Hz"] rs = RadioSetting("dsp_lpf", "Dsp low pass filter cut off", RadioSettingValueList(options, options[_settings.dsp_lpf])) @@ -1101,7 +1102,7 @@ class FT857Radio(ft817.FT817Radio): setattr(self._memobj, setting + "_offset", abs(val)) else: setattr(obj, setting, element.value) - except: + except Exception: LOG.debug(element.get_name()) raise @@ -1109,14 +1110,14 @@ class FT857Radio(ft817.FT817Radio): @directory.register class FT857USRadio(FT857Radio): """Yaesu FT857/897 (US version)""" - # seems that radios configured for 5MHz operations send one packet more + # seems that radios configured for 5 MHz operations send one packet more # than others so we have to distinguish sub models MODEL = "FT-857/897 (US)" _model = "" _US_model = True _memsize = 7481 - # block 9 (140 Bytes long) is to be repeted 40 times + # block 9 (140 Bytes long) is to be repeated 40 times # should be 42 times but this way I can use original 817 functions _block_lengths = [2, 82, 252, 196, 252, 196, 212, 55, 140, 140, 140, 38, 176, 140] @@ -1150,7 +1151,7 @@ class FT857USRadio(FT857Radio): mem.immutable = ["number", "rtone", "ctone", "extd_number", "name", "dtcs", "tmode", "cross_mode", "dtcs_polarity", "power", "duplex", "offset", - "comment", "empty"] + "empty"] return mem @@ -1175,9 +1176,9 @@ class FT857USRadio(FT857Radio): self._set_memory(mem, _mem) def get_memory(self, number): - if number in list(self.SPECIAL_60M.keys()): + if number in self.SPECIAL_60M: return self._get_special_60m(number) - elif number < 0 and ( + elif isinstance(number, int) and number < 0 and ( self.SPECIAL_MEMORIES_REV[number] in list(self.SPECIAL_60M.keys())): # I can't stop delete operation from losing extd_number but diff --git a/chirp/drivers/ft90.py b/chirp/drivers/ft90.py index f452983..00f7392 100644 --- a/chirp/drivers/ft90.py +++ b/chirp/drivers/ft90.py @@ -17,22 +17,19 @@ from chirp.drivers import yaesu_clone from chirp import chirp_common, bitwise, memmap, directory, errors, util from chirp.settings import RadioSetting, RadioSettingGroup, \ - RadioSettingValueInteger, RadioSettingValueList, \ - RadioSettingValueBoolean, RadioSettingValueString, \ - RadioSettings + RadioSettingValueList, RadioSettingValueBoolean, \ + RadioSettingValueString, RadioSettings import time -import os import traceback import string import re import logging -from textwrap import dedent LOG = logging.getLogger(__name__) -CMD_ACK = chr(0x06) +CMD_ACK = b'\x06' FT90_STEPS = [5.0, 10.0, 12.5, 15.0, 20.0, 25.0, 50.0] FT90_MODES = ["AM", "FM", "Auto"] @@ -63,7 +60,8 @@ FT90_SPECIAL = ["vfo_vhf", "home_vhf", "vfo_uhf", "home_uhf", class FT90Radio(yaesu_clone.YaesuCloneModeRadio): VENDOR = "Yaesu" MODEL = "FT-90" - ID = "\x8E\xF6" + ID = b"\x8E\xF6" + NEEDS_COMPAT_SERIAL = False _memsize = 4063 # block 03 (200 Bytes long) repeats 18 times; channel memories @@ -152,8 +150,7 @@ struct mem_struct { ars:1, tone:6; u8 packetmode:1, - unknown5:1, - dcstone:6; + dcstone:7; char name[7]; }; @@ -194,19 +191,20 @@ struct { @classmethod def get_prompts(cls): rp = chirp_common.RadioPrompts() - rp.pre_download = _(dedent("""\ -1. Turn radio off. -2. Connect mic and hold [ACC] on mic while powering on. - ("CLONE" will appear on the display) -3. Replace mic with PC programming cable. -4. After clicking OK, press the [SET] key to send image.""")) - rp.pre_upload = _(dedent("""\ -1. Turn radio off. -2. Connect mic and hold [ACC] on mic while powering on. - ("CLONE" will appear on the display) -3. Replace mic with PC programming cable. -4. Press the [DISP/SS] key - ("R" will appear on the lower left of LCD).""")) + rp.pre_download = _( + "1. Turn radio off.\n" + "2. Connect mic and hold [ACC] on mic while powering on.\n" + " (\"CLONE\" will appear on the display)\n" + "3. Replace mic with PC programming cable.\n" + "4. After clicking OK, press the [SET] key to send" + " image.\n") + rp.pre_upload = _( + "1. Turn radio off.\n" + "2. Connect mic and hold [ACC] on mic while powering on.\n" + " (\"CLONE\" will appear on the display)\n" + "3. Replace mic with PC programming cable.\n" + "4. Press the [DISP/SS] key\n" + " (\"R\" will appear on the lower left of LCD).\n") rp.display_pre_upload_prompt_before_opening_port = False return rp @@ -221,15 +219,17 @@ struct { rf.has_bank = False rf.has_dtcs_polarity = False rf.has_dtcs = True + rf.can_odd_split = True rf.valid_modes = FT90_MODES rf.valid_tmodes = FT90_TMODES rf.valid_duplexes = FT90_DUPLEX - rf.valid_tuning_steps = FT90_STEPS + rf.valid_tuning_steps = FT90_STEPS[1:] rf.valid_power_levels = FT90_POWER_LEVELS_VHF rf.valid_name_length = 7 rf.valid_characters = chirp_common.CHARSET_ASCII rf.valid_skips = ["", "S"] rf.valid_special_chans = FT90_SPECIAL + rf.valid_tones = FT90_TONES rf.memory_bounds = (1, 180) rf.valid_bands = [(100000000, 230000000), (300000000, 530000000), @@ -245,7 +245,7 @@ struct { time.sleep(0.02) self.pipe.read(1) # chew echoed ACK from 1-wire serial - if len(data) == blocksize + 2 and data[0] == chr(blocknum): + if len(data) == blocksize + 2 and data[0] == blocknum: checksum = yaesu_clone.YaesuChecksum(1, blocksize) if checksum.get_existing(data) != checksum.get_calculated(data): raise Exception("Checksum Failed [%02X<>%02X] block %02X, " @@ -267,7 +267,7 @@ struct { self.pipe.timeout = 4 start = time.time() - data = "" + data = b"" blocknum = 0 status = chirp_common.Status() status.msg = "Cloning..." @@ -282,11 +282,12 @@ struct { LOG.info("Clone completed in %i seconds, blocks read: %i" % (time.time() - start, blocknum)) - return memmap.MemoryMap(data) + return memmap.MemoryMapBytes(data) def _clone_out(self): looppredelay = 0.4 looppostdelay = 1.9 + self.pipe.timeout = 4 start = time.time() blocknum = 0 @@ -298,9 +299,9 @@ struct { for blocksize in self._block_lengths: checksum = yaesu_clone.YaesuChecksum(pos, pos+blocksize-1) - blocknumbyte = chr(blocknum) + blocknumbyte = bytes([blocknum]) payloadbytes = self.get_mmap()[pos:pos+blocksize] - checksumbyte = chr(checksum.get_calculated(self.get_mmap())) + checksumbyte = bytes([checksum.get_calculated(self.get_mmap())]) LOG.debug("Block %i - will send from %i to %i byte " % (blocknum, pos, pos + blocksize)) LOG.debug(util.hexprint(blocknumbyte)) @@ -333,7 +334,7 @@ struct { self._mmap = self._clone_in() except errors.RadioError: raise - except Exception as e: + except Exception: trace = traceback.format_exc() raise errors.RadioError( "Failed to communicate with radio: %s" % trace) @@ -344,7 +345,7 @@ struct { self._clone_out() except errors.RadioError: raise - except Exception as e: + except Exception: trace = traceback.format_exc() raise errors.RadioError( "Failed to communicate with radio: %s" % trace) @@ -383,8 +384,10 @@ struct { if re.match('^pms', mem.extd_number): # enable pms_XY channel flag _special_enables = self._memobj.special_enables - mem.empty = not getattr(_special_enables, - mem.extd_number + "_enable") + # Disabled in 2023 because this doesn't pass tests and I'm + # not sure what it is really trying to accomplish. + # mem.empty = not getattr(_special_enables, + # mem.extd_number + "_enable") else: # regular memory _mem = self._memobj.memory[number-1] @@ -406,17 +409,17 @@ struct { else: mem.power = FT90_POWER_LEVELS_VHF[_mem.power] - # radio has a known bug with 5khz step and squelch + # radio has a known bug with 5 kHz step and squelch if _mem.step == 0 or _mem.step > len(FT90_STEPS)-1: _mem.step = 2 mem.tuning_step = FT90_STEPS[_mem.step] mem.skip = _mem.skip and "S" or "" if not all(char in chirp_common.CHARSET_ASCII for char in str(_mem.name)): - # dont display blank/junk name + # don't display blank/junk name mem.name = "" else: - mem.name = str(_mem.name) + mem.name = str(_mem.name).rstrip() return mem def get_raw_memory(self, number): @@ -433,7 +436,7 @@ struct { _mem = self._memobj.memory[mem.number - 1] self._set_chan_enable(mem.number, not mem.empty) _mem.skip = mem.skip == "S" - # radio has a known bug with 5khz step and dead squelch + # radio has a known bug with 5 kHz step and dead squelch if not mem.tuning_step or mem.tuning_step == FT90_STEPS[0]: _mem.step = 2 else: @@ -463,7 +466,10 @@ struct { _mem.step = FT90_STEPS.index(mem.tuning_step) _mem.shift = FT90_DUPLEX.index(mem.duplex) if mem.power: - _mem.power = FT90_POWER_LEVELS_VHF.index(mem.power) + try: + _mem.power = FT90_POWER_LEVELS_VHF.index(mem.power) + except ValueError: + _mem.power = FT90_POWER_LEVELS_UHF.index(mem.power) else: _mem.power = 3 # default to low power if (len(mem.name) == 0): @@ -664,13 +670,13 @@ struct { newval = element.value if setting == "cwid": newval = self._encode_cwid(newval) - if re.match('dtmf\d', setting): + if re.match(r'dtmf\d', setting): # set dtmf length field and then get bcd dtmf dtmfstrlen = len(str(newval).strip()) setattr(_settings, setting + "_len", dtmfstrlen) newval = self._dtmf2bbcd(newval) LOG.debug("Setting %s(%s) <= %s" % (setting, oldval, newval)) setattr(_settings, setting, newval) - except Exception as e: + except Exception: LOG.debug(element.get_name()) raise diff --git a/chirp/drivers/ftlx011.py b/chirp/drivers/ftlx011.py index 2cf43ba..30c48ac 100644 --- a/chirp/drivers/ftlx011.py +++ b/chirp/drivers/ftlx011.py @@ -13,30 +13,25 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import struct -import os import logging import time -from time import sleep -from chirp import chirp_common, directory, memmap, errors, util, bitwise +from chirp import chirp_common, directory, memmap, errors, bitwise from chirp.settings import RadioSettingGroup, RadioSetting, \ RadioSettingValueBoolean, RadioSettingValueList, \ - RadioSettingValueString, RadioSettingValueInteger, \ - RadioSettingValueFloat, RadioSettings, InvalidValueError -from textwrap import dedent + RadioSettings LOG = logging.getLogger(__name__) -### SAMPLE MEM DUMP as sent from the radios +# SAMPLE MEM DUMP as sent from the radios # FTL-1011 -#0x000000 52 f0 16 90 04 08 38 c0 00 00 00 01 00 00 00 ff |R.....8.........| -#0x000010 20 f1 00 20 00 00 00 20 04 47 25 04 47 25 00 00 | .. ... .G%.G%..| +# 0x000000 52 f0 16 90 04 08 38 c0 00 00 00 01 00 00 00 ff |R.....8.........| +# 0x000010 20 f1 00 20 00 00 00 20 04 47 25 04 47 25 00 00 | .. ... .G%.G%..| # FTL-2011 -#0x000000: 50 90 21 40 04 80 fc 40 00 00 00 01 00 00 00 ff |P.!@...@........| -#0x000010: 20 f1 00 0b 00 00 00 0b 14 51 70 14 45 70 00 00 |.........Qp.Ep..| +# 0x000000: 50 90 21 40 04 80 fc 40 00 00 00 01 00 00 00 ff |P.!@...@........| +# 0x000010: 20 f1 00 0b 00 00 00 0b 14 51 70 14 45 70 00 00 |.........Qp.Ep..| MEM_FORMAT = """ @@ -57,7 +52,7 @@ u8 scan_resume:1, // Scan sesume: 0 = 0.5 seconds, 1 = Carrier talk_back:1, // Talk Back: 0 = enabled, 1 = disabled tx_carrier_delay:1; // TX carrier delay: 1 = enabled, 0 = disabled u8 tot:4, // Time out timer: 16 values (0.0-7.5 in 0.5s step) - tot_resume:2, // Time out timer resume: 3, 2, 1, 0 => 0s, 6s, 20s, 60s + tot_resume:2, // Time out timer resume: 3, 2, 1, 0 => 0s, 6s, 20s, 60s unknownB:2; u8 a_key:2, // A key function: resume: 0-3: Talkaround, High/Low, Call, Accessory unknownB:6; @@ -99,14 +94,14 @@ DTCS_CODES = chirp_common.DTCS_CODES SKIP_VALUES = ["", "S"] LIST_BCL = ["OFF", "Carrier", "Tone"] LIST_SCAN_RESUME = ["0.5 seconds", "Carrier drop"] -LIST_SCAN_TIME = ["%smsecs" % x for x in range(5, 85, 5)] +LIST_SCAN_TIME = ["%s ms" % x for x in range(5, 85, 5)] LIST_SCAN_P_SPEED = ["Slow", "Fast"] LIST_HOME_CHANNEL = ["Scan Start ch", "Priority 1ch"] LIST_TOT = ["Off"] + ["%.1f s" % (x/10.0) for x in range(5, 80, 5)] -# 3, 2, 1, 0 => 0s, 6s, 20s, 60s -LIST_TOT_RESUME = ["60s","20s","6s","0s"] +# 3, 2, 1, 0 => 0 s, 6 s, 20 s, 60 s +LIST_TOT_RESUME = ["60 s", "20 s", "6 s", "0 s"] LIST_A_KEY = ["Talkaround", "High/Low", "Call", "Accessory"] -LIST_PCH = [] # dynamic, as depends on channel list. +LIST_PCH = [] # dynamic, as depends on channel list. # make a copy of the tones, is not funny to work with this directly TONES = list(chirp_common.TONES) # this old radios has not the full tone ranges in CST @@ -143,7 +138,7 @@ def _checksum(data): """the radio block checksum algorithm""" cs = 0 for byte in data: - cs += ord(byte) + cs += ord(byte) return cs % 256 @@ -216,12 +211,11 @@ def _do_upload(radio): status.msg = " Quick, press MON on the radio to start. " radio.status_fn(status) - for byte in range(0,100): + for byte in range(0, 100): status.cur = byte radio.status_fn(status) time.sleep(0.1) - # real upload if user don't cancel the timeout status.cur = 0 status.max = MEM_SIZE @@ -254,16 +248,8 @@ def _model_match(cls, data): # It's hard to tell when this radio is really this radio. # I use the first byte, that appears to be the ID and the IF settings - LOG.debug("Drivers's ID string:") - LOG.debug(cls.finger) - LOG.debug("Radio's ID string:") - LOG.debug(util.hexprint(data[0:4])) - radiod = [data[0], data[2:4]] - if cls.finger == radiod: - return True - else: - return False + return cls.finger == radiod def bcd_to_int(data): @@ -290,7 +276,7 @@ class ftlx011(chirp_common.CloneModeRadio, chirp_common.ExperimentalRadio): _memsize = MEM_SIZE _upper = 0 _range = [] - finger = [] # two elements rid & IF + finger = [] # two elements rid & IF @classmethod def get_prompts(cls): @@ -303,31 +289,27 @@ class ftlx011(chirp_common.CloneModeRadio, chirp_common.ExperimentalRadio): '\n' 'The 99 channel versions appears to use another mem layout.\n' ) - rp.pre_download = _(dedent("""\ - Please follow this steps carefully: - - 1 - Turn on your radio - 2 - Connect the interface cable to your radio. - 3 - Click the button on this window to start download - (Radio will beep and led will flash) - 4 - Then press the "A" button in your radio to start cloning. - (At the end radio will beep) - """)) - rp.pre_upload = _(dedent("""\ - Please follow this steps carefully: - - 1 - Turn on your radio - 2 - Connect the interface cable to your radio - 3 - Click the button on this window to start download - (you may see another dialog, click ok) - 4 - Radio will beep and led will flash - 5 - You will get a 10 seconds timeout to press "MON" before - data upload start - 6 - If all goes right radio will beep at end. - - After cloning remove the cable and power cycle your radio to - get into normal mode. - """)) + rp.pre_download = _( + "Please follow this steps carefully:\n" + "1 - Turn on your radio\n" + "2 - Connect the interface cable to your radio.\n" + "3 - Click the button on this window to start download\n" + " (Radio will beep and led will flash)\n" + "4 - Then press the \"A\" button in your radio to start" + " cloning.\n" + " (At the end radio will beep)\n") + rp.pre_upload = _( + "Please follow this steps carefully:\n" + "1 - Turn on your radio\n" + "2 - Connect the interface cable to your radio\n" + "3 - Click the button on this window to start download\n" + " (you may see another dialog, click ok)\n" + "4 - Radio will beep and led will flash\n" + "5 - You will get a 10 seconds timeout to press \"MON\" before\n" + " data upload start\n" + "6 - If all goes right radio will beep at end.\n" + "After cloning remove the cable and power cycle your radio to\n" + "get into normal mode.\n") return rp def get_features(self): @@ -355,7 +337,7 @@ class ftlx011(chirp_common.CloneModeRadio, chirp_common.ExperimentalRadio): rf.valid_skips = SKIP_VALUES rf.valid_modes = ["FM"] rf.valid_power_levels = POWER_LEVELS - #rf.valid_tuning_steps = [5.0] + # rf.valid_tuning_steps = [5.0] rf.valid_bands = [self._range] rf.memory_bounds = (1, self._upper) return rf @@ -405,7 +387,7 @@ class ftlx011(chirp_common.CloneModeRadio, chirp_common.ExperimentalRadio): return repr(self._memobj.memory[number]) def _decode_tone(self, mem, rx=True): - """Parse the tone data to decode from mem tones are encodded like this + """Parse the tone data to decode from mem tones are encoded like this CTCS: mapped [0x80...0xa5] = [67.0...250.3] DTCS: mixed [0x88, 0x23] last is BCD and first is the 100 power - 88 @@ -418,7 +400,7 @@ class ftlx011(chirp_common.CloneModeRadio, chirp_common.ExperimentalRadio): t = mem.rx_tone else: t = mem.tx_tone - + tMSB = t[0] tLSB = t[1] @@ -459,9 +441,9 @@ class ftlx011(chirp_common.CloneModeRadio, chirp_common.ExperimentalRadio): if mode == "DTCS": tone[0] = int(value / 100) + 0x88 tone[1] = int_to_bcd(value % 100) - + if mode == "Tone": - #CTCS + # CTCS tone[1] = TONES.index(value) + 128 # set it @@ -547,8 +529,8 @@ class ftlx011(chirp_common.CloneModeRadio, chirp_common.ExperimentalRadio): _mem = self._memobj.memory[mem.number - 1] # Empty memory + _mem.empty = mem.empty if mem.empty: - _mem.empty = True _mem.rx_freq = _mem.tx_freq = 0 return @@ -578,11 +560,11 @@ class ftlx011(chirp_common.CloneModeRadio, chirp_common.ExperimentalRadio): # validate tone data from here if rxmode == "Tone" and rxtone in invalid_tones: - msg = "The tone %shz is not valid for this radio" % rxtone + msg = "The tone %s Hz is not valid for this radio" % rxtone raise errors.UnsupportedToneError(msg) if txmode == "Tone" and txtone in invalid_tones: - msg = "The tone %shz is not valid for this radio" % txtone + msg = "The tone %s Hz is not valid for this radio" % txtone raise errors.UnsupportedToneError(msg) if rxmode == "DTCS" and rxtone not in DTCS_CODES: @@ -630,7 +612,7 @@ class ftlx011(chirp_common.CloneModeRadio, chirp_common.ExperimentalRadio): # activate the tone _mem.rx_tone = [0x00, 0x80] else: - # reset extra settings + # reset extra settings _zero_settings() _mem.chname = chname @@ -642,20 +624,20 @@ class ftlx011(chirp_common.CloneModeRadio, chirp_common.ExperimentalRadio): basic = RadioSettingGroup("basic", "Basic Settings") group = RadioSettings(basic) - # ## Basic Settings + # ## Basic Settings scanr = RadioSetting("scan_resume", "Scan resume by", - RadioSettingValueList( + RadioSettingValueList( LIST_SCAN_RESUME, LIST_SCAN_RESUME[_settings.scan_resume])) basic.append(scanr) scant = RadioSetting("scan_time", "Scan time per channel", - RadioSettingValueList( + RadioSettingValueList( LIST_SCAN_TIME, LIST_SCAN_TIME[_settings.scan_time])) basic.append(scant) LIST_PCH = ["%s" % x for x in range(1, _settings.chcount + 1)] pch1 = RadioSetting("pch1", "Priority channel 1", - RadioSettingValueList( + RadioSettingValueList( LIST_PCH, LIST_PCH[_settings.pch1])) basic.append(pch1) @@ -673,8 +655,8 @@ class ftlx011(chirp_common.CloneModeRadio, chirp_common.ExperimentalRadio): LIST_SCAN_P_SPEED, LIST_SCAN_P_SPEED[_settings.priority_speed])) basic.append(scanps) - oh = RadioSetting("off_hook", "Off Hook", #inverted - RadioSettingValueBoolean(not _settings.off_hook)) + oh = RadioSetting("off_hook", "Off Hook", # inverted + RadioSettingValueBoolean(not _settings.off_hook)) basic.append(oh) tb = RadioSetting("talk_back", "Talk Back", # inverted @@ -682,17 +664,17 @@ class ftlx011(chirp_common.CloneModeRadio, chirp_common.ExperimentalRadio): basic.append(tb) tot = RadioSetting("tot", "Time out timer", - RadioSettingValueList( + RadioSettingValueList( LIST_TOT, LIST_TOT[_settings.tot])) basic.append(tot) totr = RadioSetting("tot_resume", "Time out timer resume guard", - RadioSettingValueList( + RadioSettingValueList( LIST_TOT_RESUME, LIST_TOT_RESUME[_settings.tot_resume])) basic.append(totr) ak = RadioSetting("a_key", "A Key function", - RadioSettingValueList( + RadioSettingValueList( LIST_A_KEY, LIST_A_KEY[_settings.a_key])) basic.append(ak) @@ -709,7 +691,6 @@ class ftlx011(chirp_common.CloneModeRadio, chirp_common.ExperimentalRadio): RadioSettingValueBoolean(_settings.tx_carrier_delay)) basic.append(txd) - return group def set_settings(self, uisettings): @@ -726,8 +707,6 @@ class ftlx011(chirp_common.CloneModeRadio, chirp_common.ExperimentalRadio): name = element.get_name() value = element.value - print(("== Setting %s: %s" % (name, value))) - obj = getattr(_settings, name) if name in ["off_hook", "talk_back", "monitor"]: setattr(_settings, name, not value) @@ -735,7 +714,7 @@ class ftlx011(chirp_common.CloneModeRadio, chirp_common.ExperimentalRadio): setattr(_settings, name, value) LOG.debug("Setting %s: %s" % (name, value)) - except Exception as e: + except Exception: LOG.debug(element.get_name()) raise @@ -747,15 +726,14 @@ class ftlx011(chirp_common.CloneModeRadio, chirp_common.ExperimentalRadio): # testing the file data size if len(filedata) == cls._memsize: match_size = True - print(("Comp: %i file / %i memzise" % (len(filedata), cls._memsize) )) # testing the firmware fingerprint, this experimental - match_model = _model_match(cls, filedata) + try: + match_model = _model_match(cls, filedata) + except Exception: + match_model = False - if match_size and match_model: - return True - else: - return False + return match_size and match_model @directory.register diff --git a/chirp/drivers/ftm3200d.py b/chirp/drivers/ftm3200d.py index 1b27012..92f9d13 100644 --- a/chirp/drivers/ftm3200d.py +++ b/chirp/drivers/ftm3200d.py @@ -15,7 +15,6 @@ # along with this program. If not, see . import logging -from textwrap import dedent from chirp.drivers import yaesu_clone, ft1d from chirp import chirp_common, directory, bitwise @@ -68,32 +67,35 @@ class FTM3200Radio(ft1d.FT1Radio): MODEL = "FTM-3200D" VARIANT = "R" - _model = "AH52N" + _model = b"AH52N" _memsize = 65227 _block_lengths = [10, 65217] _has_vibrate = False _has_af_dual = False - _mem_params = (199, # size of memories array - 199) # size of flags array + _mem_params = { + "memnum": 199, # size of memories array + "flgnum": 199} # size of flags array @classmethod def get_prompts(cls): rp = chirp_common.RadioPrompts() - rp.pre_download = _(dedent("""\ - 1. Turn radio off. - 2. Connect cable to DATA terminal. - 3. Press and hold in the [MHz(SETUP)] key while turning the radio - on ("CLONE" will appear on the display). - 4. After clicking OK, press the [REV(DW)] key - to send image.""")) - rp.pre_upload = _(dedent("""\ - 1. Turn radio off. - 2. Connect cable to DATA terminal. - 3. Press and hold in the [MHz(SETUP)] key while turning the radio - on ("CLONE" will appear on the display). - 4. Press the [MHz(SETUP)] key - ("-WAIT-" will appear on the LCD).""")) + rp.pre_download = _( + "1. Turn radio off.\n" + "2. Connect cable to DATA terminal.\n" + "3. Press and hold in the [MHz(SETUP)] key while turning the" + " radio\n" + " on (\"CLONE\" will appear on the display).\n" + "4. After clicking OK, press the [REV(DW)] key\n" + " to send image.\n") + rp.pre_upload = _( + "1. Turn radio off.\n" + "2. Connect cable to DATA terminal.\n" + "3. Press and hold in the [MHz(SETUP)] key while turning the" + " radio\n" + " on (\"CLONE\" will appear on the display).\n" + "4. Press the [MHz(SETUP)] key\n" + " (\"-WAIT-\" will appear on the LCD).\n") return rp def process_mmap(self): @@ -124,7 +126,7 @@ class FTM3200Radio(ft1d.FT1Radio): def _decode_label(self, mem): # TODO preserve the unknown \x80-x86 chars? - return str(mem.label).rstrip("\xFF").decode('ascii', 'replace') + return str(mem.label).rstrip("\xFF").rstrip() def _encode_label(self, mem): label = mem.name.rstrip().encode('ascii', 'ignore') @@ -135,14 +137,17 @@ class FTM3200Radio(ft1d.FT1Radio): # as a name or frequency. Should we expose this setting to the user # instead of autoselecting it (and losing their preference)? if mem.name.rstrip() == '': - return [0x00, 0x00] - return [0x00, 0x80] + return 0x0000 + return 0x0080 def _decode_power_level(self, mem): return POWER_LEVELS[mem.power - 1] def _encode_power_level(self, mem): - return POWER_LEVELS.index(mem.power) + 1 + if mem.power is None: + return 1 + else: + return POWER_LEVELS.index(mem.power) + 1 def _decode_mode(self, mem): return MODES[mem.mode_alt] @@ -193,7 +198,7 @@ class FTM3200Radio(ft1d.FT1Radio): @classmethod def _wipe_memory(cls, mem): - mem.set_raw("\x00" * (mem.size() / 8)) + mem.set_raw("\x00" * (mem.size() // 8)) def sync_out(self): # Need to give enough time for the radio to ACK after writes diff --git a/chirp/drivers/ftm350.py b/chirp/drivers/ftm350.py index 95ef755..5151351 100644 --- a/chirp/drivers/ftm350.py +++ b/chirp/drivers/ftm350.py @@ -15,11 +15,10 @@ import time import struct -import os import logging from chirp.drivers import yaesu_clone -from chirp import chirp_common, directory, errors, util, bitwise, memmap +from chirp import chirp_common, directory, errors, bitwise, memmap from chirp.settings import RadioSettingGroup, RadioSetting, RadioSettings from chirp.settings import RadioSettingValueInteger, RadioSettingValueString @@ -29,7 +28,8 @@ mem_format = """ struct mem { u8 used:1, skip:2, - unknown1:5; + unknown1:4, + visible:1; u8 unknown2:1, mode:3, unknown8:1, @@ -85,7 +85,7 @@ _TMODES = ["", "Tone", "TSQL", "-RVT", "DTCS", "-PR", "-PAG"] TMODES = ["", "Tone", "TSQL", "", "DTCS", "", ""] MODES = ["FM", "AM", "NFM", "", "WFM"] DUPLEXES = ["", "", "-", "+", "split"] -# TODO: add japanese characters (viewable in special menu, scroll backwards) +# TODO: add Japanese characters (viewable in special menu, scroll backwards) CHARSET = \ ('0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz!"' + '#$%&`()*+,-./:;<=>?@[\\]^_`{|}~?????? ' + '?' * 91) @@ -119,7 +119,7 @@ def _clone_in(radio): radio.pipe.timeout = 1 attempts = 30 - data = memmap.MemoryMap("\x00" * (radio._memsize + 128)) + data = memmap.MemoryMapBytes(b"\x00" * (radio._memsize + 128)) length = 0 last_addr = 0 while length < radio._memsize: @@ -134,18 +134,18 @@ def _clone_in(radio): if frame: addr, = struct.unpack(">H", frame[0:2]) - checksum = ord(frame[130]) + checksum = frame[130] block = frame[2:130] cs = 0 for i in frame[:-1]: - cs = (cs + ord(i)) % 256 + cs = (cs + i) % 256 if cs != checksum: LOG.debug("Calc: %02x Real: %02x Len: %i" % (cs, checksum, len(block))) raise errors.RadioError("Block failed checksum") - radio.pipe.write("\x06") + radio.pipe.write(b"\x06") time.sleep(0.05) if (last_addr + 128) != addr: @@ -182,11 +182,11 @@ def _clone_out(radio): frame = struct.pack(">H", i) + block cs = 0 for byte in frame: - cs += ord(byte) - frame += chr(cs % 256) + cs += byte + frame += bytes([cs % 256]) radio.pipe.write(frame) ack = radio.pipe.read(1) - if ack != "\x06": + if ack != b"\x06": raise errors.RadioError("Radio refused block %i" % (i / 128)) time.sleep(0.05) @@ -239,6 +239,7 @@ class FTM350Radio(yaesu_clone.YaesuCloneModeRadio): BAUD_RATE = 48000 VENDOR = "Yaesu" MODEL = "FTM-350" + NEEDS_COMPAT_SERIAL = False _model = "" _memsize = 65536 @@ -279,6 +280,7 @@ class FTM350Radio(yaesu_clone.YaesuCloneModeRadio): except errors.RadioError: raise except Exception as e: + LOG.exception('Failed to read: %s', e) raise errors.RadioError("Failed to download from radio (%s)" % e) self.process_mmap() @@ -288,6 +290,7 @@ class FTM350Radio(yaesu_clone.YaesuCloneModeRadio): except errors.RadioError: raise except Exception as e: + LOG.exception('Failed to write: %s', e) raise errors.RadioError("Failed to upload to radio (%s)" % e) def process_mmap(self): @@ -365,6 +368,7 @@ class FTM350Radio(yaesu_clone.YaesuCloneModeRadio): _mem = self._memory_obj()[mem.number - 1] _lab = self._label_obj()[mem.number - 1] _mem.used = not mem.empty + _mem.visible = not mem.empty if mem.empty: return diff --git a/chirp/drivers/ftm7250d.py b/chirp/drivers/ftm7250d.py index dd5b164..1ede2cd 100644 --- a/chirp/drivers/ftm7250d.py +++ b/chirp/drivers/ftm7250d.py @@ -16,7 +16,6 @@ # along with this program. If not, see . import logging -from textwrap import dedent from chirp.drivers import yaesu_clone, ft1d from chirp import chirp_common, directory, bitwise @@ -75,26 +74,28 @@ class FTM7250Radio(ft1d.FT1Radio): _has_vibrate = False _has_af_dual = False - _mem_params = (199, # size of memories array - 199) # size of flags array + _mem_params = {'memnum': 199, # size of memories array + 'flgnum': 199} # size of flags array @classmethod def get_prompts(cls): rp = chirp_common.RadioPrompts() - rp.pre_download = _(dedent("""\ - 1. Turn radio off. - 2. Connect cable to MIC Jack. - 3. Press and hold in the [MHz(SETUP)] key while turning the radio - on ("CLONE" will appear on the display). - 4. After clicking OK, press the [GM(AMS)] key - to send image.""")) - rp.pre_upload = _(dedent("""\ - 1. Turn radio off. - 2. Connect cable to MIC Jack. - 3. Press and hold in the [MHz(SETUP)] key while turning the radio - on ("CLONE" will appear on the display). - 4. Press the [MHz(SETUP)] key - ("-WAIT-" will appear on the LCD).""")) + rp.pre_download = _( + "1. Turn radio off.\n" + "2. Connect cable to MIC Jack.\n" + "3. Press and hold in the [MHz(SETUP)] key while turning the" + " radio\n" + " on (\"CLONE\" will appear on the display).\n" + "4. After clicking OK, press the [GM(AMS)] key\n" + " to send image.\n") + rp.pre_upload = _( + "1. Turn radio off.\n" + "2. Connect cable to MIC Jack.\n" + "3. Press and hold in the [MHz(SETUP)] key while turning the" + " radio\n" + " on (\"CLONE\" will appear on the display).\n" + "4. Press the [MHz(SETUP)] key\n" + " (\"-WAIT-\" will appear on the LCD).\n") return rp def process_mmap(self): @@ -125,7 +126,7 @@ class FTM7250Radio(ft1d.FT1Radio): def _decode_label(self, mem): # TODO preserve the unknown \x80-x86 chars? - return str(mem.label).rstrip("\xFF").decode('ascii', 'replace') + return str(mem.label).rstrip("\xFF") def _encode_label(self, mem): label = mem.name.rstrip().encode('ascii', 'ignore') @@ -136,14 +137,17 @@ class FTM7250Radio(ft1d.FT1Radio): # as a name or frequency. Should we expose this setting to the user # instead of autoselecting it (and losing their preference)? if mem.name.rstrip() == '': - return [0x00, 0x00] - return [0x00, 0x80] + return 0x00 + return 0x00 def _decode_power_level(self, mem): return POWER_LEVELS[mem.power - 1] def _encode_power_level(self, mem): - return POWER_LEVELS.index(mem.power) + 1 + if mem.power is None: + return 3 + else: + return 3 - POWER_LEVELS.index(mem.power) def _decode_mode(self, mem): return MODES[mem.mode_alt] @@ -194,7 +198,7 @@ class FTM7250Radio(ft1d.FT1Radio): @classmethod def _wipe_memory(cls, mem): - mem.set_raw("\x00" * (mem.size() / 8)) + mem.set_raw("\x00" * (mem.size() // 8)) def sync_out(self): # Need to give enough time for the radio to ACK after writes diff --git a/chirp/drivers/ga510.py b/chirp/drivers/ga510.py index 18957f4..27fffa1 100644 --- a/chirp/drivers/ga510.py +++ b/chirp/drivers/ga510.py @@ -1,6 +1,24 @@ +# Copyright 2011 Dan Smith +# Portions copyright 2023 Dave Liske +# Portions copyright 2020 by Jiauxn Yang +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + import logging import struct +from chirp import bandplan_na from chirp import bitwise from chirp import chirp_common from chirp import directory @@ -20,14 +38,17 @@ except ImportError: LOG.debug('python-future package is not available; ' '%s requires it' % __name__) -# GA510 also has DTCS code 645 -DTCS_CODES = list(sorted(chirp_common.DTCS_CODES + [645])) +# GA510 and SHX8800 also have DTCS code 645 +DTCS_CODES = tuple(sorted(chirp_common.DTCS_CODES + (645,))) DTMFCHARS = '0123456789ABCD*#' def reset(radio): - radio.pipe.write(b'E') + try: + radio.pipe.write(b'E') + except Exception as e: + LOG.error('Failed to reset radio: %s' % e) def start_program(radio): @@ -76,8 +97,6 @@ def do_download(radio): s.cur = addr radio.status_fn(s) - reset(radio) - return data @@ -106,7 +125,7 @@ def do_upload(radio): radio.status_fn(s) -MEM_FORMAT = """ +BASE_FORMAT = """ struct { lbcd rxfreq[4]; lbcd txfreq[4]; @@ -122,7 +141,7 @@ struct { unknown3_1:2, bcl:1, scan:1, - unknown3_2:1, + allow_tx:1, // SHX8800 FAMILY ONLY (unknown3_2 for GA-510) fhss:1; } memories[128]; @@ -132,6 +151,9 @@ struct { u8 pad[6]; } names[128]; +""" + +MODEL_GA510_FORMAT = """ #seekto 0x1A00; struct { // 0x1A00 @@ -204,17 +226,127 @@ struct { """ +MODEL_SHX8800_FORMAT = """ +#seekto 0x1A00; +struct { + // 0x1A00 + u8 squelch; + u8 savemode; // [off, mode1, mode2, mode3] + u8 vox; // off=0 + u8 backlight; + u8 tdr; // bool + u8 timeout; // n*15 = seconds + u8 beep; // bool + u8 voice; + + // 0x1A08 + u8 language; // [inop in 8800] + u8 dtmfst; + u8 scanmode; // [TO, CO, SE] + u8 pttid; // [off, BOT, EOT, Both] + u8 pttdelay; // 0-30 + u8 cha_disp; // [ch-name, ch-freq] + // [ch, ch-name]; retevis + u8 chb_disp; + u8 bcl; // bool + + // 0x1A10 + u8 autolock; // bool + u8 alarm_mode; // [site, tone, code] + u8 alarmsound; // bool + u8 txundertdr; // [off, bandA, bandB] + u8 tailnoiseclear; // [off, on] + u8 rptnoiseclr; // 10*ms, 0-1000 + u8 rptnoisedet; + u8 roger; // bool + + // 0x1A18 + u8 unknown1a10; + u8 fmradio; // boolean, inverted + u8 workmodeb:4, + workmodea:4; + u8 kblock; + u8 unknown2[4]; + u8 voxdelay; + u8 menu_timeout; + u8 micgain; +} settings; + +#seekto 0x1a40; +struct { + u8 freq[8]; + ul16 rxtone; + ul16 txtone; + u8 unknown[2]; + u8 unused2:2, + sftd:2, + scode:4; + u8 unknown1; + u8 txpower; + u8 widenarr:1, + unknown2:4, + fhss:1, + unknown3:2; + u8 band; + u8 unknown4:5, + step:3; + u8 unknown5; + u8 offset[6]; +} vfoa; // displays in Browser tab + +#seekto 0x1a60; +struct { + u8 freq[8]; + ul16 rxtone; + ul16 txtone; + u8 unknown[2]; + u8 unused2:2, + sftd:2, + scode:4; + u8 unknown1; + u8 txpower; + u8 widenarr:1, + unknown2:4, + fhss:1, + unknown3:2; + u8 band; + u8 unknown4:5, + step:3; + u8 unknown5; + u8 offset[6]; +} vfob; // displays in Browser tab + +#seekto 0x1a80; +struct { + u8 sidekey; + u8 sidekeyl; +} keymaps; + +#seekto 0x1b00; +struct { + u8 code[5]; + u8 unused[11]; +} dtmfgroup[15]; + +struct { + u8 code[5]; + u8 groupcode; + u8 aniid; + u8 dtmfspeedon; + u8 dtmfspeedoff; +} anicode; + +""" PTTID = ['Off', 'BOT', 'EOT', 'Both'] SIGNAL = [str(i) for i in range(1, 16)] - -GMRS_FREQS1 = [462.5625, 462.5875, 462.6125, 462.6375, 462.6625, - 462.6875, 462.7125] -GMRS_FREQS2 = [467.5625, 467.5875, 467.6125, 467.6375, 467.6625, - 467.6875, 467.7125] -GMRS_FREQS3 = [462.5500, 462.5750, 462.6000, 462.6250, 462.6500, - 462.6750, 462.7000, 462.7250] -GMRS_FREQS = GMRS_FREQS1 + GMRS_FREQS2 + GMRS_FREQS3 +WORKMODE_LIST = ["VFO", "CH"] +SHIFTD_LIST = ["Off", "+", "-"] +PTTIDCODE_LIST = ["%s" % x for x in range(1, 128)] +STEPS = [6.25, 10.0, 12.5, 20.0, 25.0, 50.0] +STEP_LIST = [str(x) for x in STEPS] +TXPOWER_LIST = ["High (5W)", "Low (1W)"] +BANDWIDTH_LIST = ["Wide", "Narrow"] @directory.register @@ -228,6 +360,7 @@ class RadioddityGA510Radio(chirp_common.CloneModeRadio): chirp_common.PowerLevel('L', watts=1), chirp_common.PowerLevel('M', watts=5)] + _mem_format = MODEL_GA510_FORMAT _magic = (b'PROGROMBFHU') _gmrs = False @@ -241,6 +374,8 @@ class RadioddityGA510Radio(chirp_common.CloneModeRadio): except Exception as e: LOG.exception('General failure') raise errors.RadioError('Failed to download from radio: %s' % e) + finally: + reset(self) self.process_mmap() def sync_out(self): @@ -251,9 +386,12 @@ class RadioddityGA510Radio(chirp_common.CloneModeRadio): except Exception as e: LOG.exception('General failure') raise errors.RadioError('Failed to upload to radio: %s' % e) + finally: + reset(self) def process_mmap(self): - self._memobj = bitwise.parse(MEM_FORMAT, self._mmap) + self._memobj = bitwise.parse(BASE_FORMAT + self._mem_format, + self._mmap) def get_features(self): rf = chirp_common.RadioFeatures() @@ -402,6 +540,7 @@ class RadioddityGA510Radio(chirp_common.CloneModeRadio): mem.extra = self._get_extra(_mem) except: LOG.exception('Failed to get extra for %i' % num) + return mem def _set_mem(self, number): @@ -423,30 +562,15 @@ class RadioddityGA510Radio(chirp_common.CloneModeRadio): LOG.debug('Initializing new memory %i' % mem.number) _mem.set_raw(b'\x00' * 16) - if self._gmrs: - if float(mem.freq) / 1000000 in GMRS_FREQS: - if float(mem.freq) / 1000000 in GMRS_FREQS1: - mem.duplex = '' - mem.offset = 0 - if float(mem.freq) / 1000000 in GMRS_FREQS2: - mem.duplex = '' - mem.offset = 0 - mem.mode = "NFM" - mem.power = self.POWER_LEVELS[1] - if float(mem.freq) / 1000000 in GMRS_FREQS3: - if mem.duplex == '+': - mem.offset = 5000000 - else: - mem.duplex = '' - mem.offset = 0 - else: - mem.duplex = 'off' - mem.offset = 0 - _nam.name = mem.name.ljust(10) + if isinstance(self, Senhaix8800Radio): + _mem.allow_tx = True + _mem.rxfreq = mem.freq // 10 if mem.duplex == '': + if isinstance(self, Senhaix8800Radio): + _mem.allow_tx = False _mem.txfreq = mem.freq // 10 elif mem.duplex == 'split': _mem.txfreq = mem.offset // 10 @@ -497,26 +621,48 @@ class RadioddityGA510Radio(chirp_common.CloneModeRadio): 'chb_disp': ['CH', 'CH+Name'], } + language_setting = { + 'language': ['English', 'Chinese'], + } + + ga_workmode = { + 'workmode': ['VFO', 'Chan'], + } + + shx_workmode = { + 'workmodea': ['VFO', 'Chan'], + 'workmodeb': ['VFO', 'Chan'], + } + choice_settings = { 'vox': ['Off'] + ['%i' % i for i in range(1, 11)], 'backlight': ['Off'] + ['%i' % i for i in range(1, 11)], 'timeout': ['Off'] + ['%i' % i for i in range(15, 615, 15)], - 'language': ['English', 'Chinese'], 'dtmfst': ['OFF', 'KB Side Tone', 'ANI Side Tone', 'KB ST+ANI ST', 'Both'], 'scanmode': ['TO', 'CO', 'SE'], 'pttid': ['Off', 'BOT', 'EOT', 'Both'], 'alarm_mode': ['Site', 'Tone', 'Code'], - 'workmode': ['VFO', 'Chan'], } + if isinstance(self, Senhaix8800Radio): + choice_settings.update(shx_workmode) + else: + choice_settings.update(language_setting) + choice_settings.update(ga_workmode) + if self.VENDOR == "Retevis": choice_settings.update(retevis_settings) else: choice_settings.update(radioddity_settings) - basic_settings = ['timeout', 'vox', 'backlight', 'language', - 'cha_disp', 'chb_disp', 'workmode'] + if isinstance(self, Senhaix8800Radio): + basic_settings = ['timeout', 'vox', 'backlight', + 'cha_disp', 'chb_disp', 'workmodea', + 'workmodeb'] + else: + basic_settings = ['timeout', 'vox', 'backlight', 'language', + 'cha_disp', 'chb_disp', 'workmode'] titles = { 'savemode': 'Save Mode', 'vox': 'VOX', @@ -533,6 +679,8 @@ class RadioddityGA510Radio(chirp_common.CloneModeRadio): 'rptnoiseclr': 'RPT Noise Clear (ms)', 'rptnoisedet': 'RPT Noise Detect (ms)', 'workmode': 'Work Mode', + 'workmodea': 'Work Mode A', + 'workmodeb': 'Work Mode B', } basic.append( @@ -674,32 +822,59 @@ class RadioddityGA510Radio(chirp_common.CloneModeRadio): cur = ''.join( '%X' % i for i in self._memobj.anicode.code if int(i) < 0xE) - dtmf.append( - RadioSetting( - 'anicode.code', 'ANI Code', - RadioSettingValueString(0, 5, cur, - autopad=False, - charset=DTMFCHARS))) anicode = self._memobj.anicode - dtmf.append( - RadioSetting( - 'anicode.groupcode', 'Group Code', - RadioSettingValueList( - list(DTMFCHARS), - DTMFCHARS[int(anicode.groupcode)]))) + if isinstance(self, Senhaix8800Radio): + _codeobj = self._memobj.anicode.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("anicode.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, anicode) + + dtmf.append(rs) + + dtmf.append( + RadioSetting( + "anicode.groupcode", "Group Code", + RadioSettingValueList(list(DTMFCHARS), + DTMFCHARS[int(anicode.groupcode)]))) + + else: + dtmf.append( + RadioSetting( + 'anicode.code', 'ANI Code', + RadioSettingValueString(0, 5, cur, + autopad=False, + charset=DTMFCHARS))) + dtmf.append( + RadioSetting( + 'anicode.groupcode', 'Group Code', + RadioSettingValueList( + list(DTMFCHARS), + DTMFCHARS[int(anicode.groupcode)]))) + dtmf.append( + RadioSetting( + 'anicode.releasetosend', 'Release To Send', + RadioSettingValueBoolean( + int(anicode.releasetosend)))) + dtmf.append( + RadioSetting( + 'anicode.presstosend', 'Press To Send', + RadioSettingValueBoolean( + int(anicode.presstosend)))) - dtmf.append( - RadioSetting( - 'anicode.releasetosend', 'Release To Send', - RadioSettingValueBoolean( - int(anicode.releasetosend)))) - dtmf.append( - RadioSetting( - 'anicode.presstosend', 'Press To Send', - RadioSettingValueBoolean( - int(anicode.presstosend)))) cur = int(anicode.dtmfspeedon) * 10 + 80 dtmf.append( RadioSetting( @@ -799,18 +974,6 @@ class RetevisRA685Radio(RadioddityGA510Radio): vhftx = [144000000, 146000000] uhftx = [430000000, 440000000] - def set_memory(self, mem): - # If memory is outside the TX limits, the radio will refuse - # transmit. Retevis asked for us to enforce this behavior - # in CHIRP for consistency. - if not (mem.freq >= self.vhftx[0] and mem.freq < self.vhftx[1]) and \ - not (mem.freq >= self.uhftx[0] and mem.freq < self.uhftx[1]): - LOG.info('Memory frequency outside TX limits of radio; ' - 'forcing duplex=off') - mem.duplex = 'off' - mem.offset = 0 - RadioddityGA510Radio.set_memory(self, mem) - @directory.register class RetevisRA85Radio(RadioddityGA510Radio): @@ -822,7 +985,6 @@ class RetevisRA85Radio(RadioddityGA510Radio): chirp_common.PowerLevel('M', watts=0.6)] _magic = b'PROGROMWLTU' - _gmrs = True def get_features(self): rf = RadioddityGA510Radio.get_features(self) @@ -848,3 +1010,77 @@ class RetevisRA85Radio(RadioddityGA510Radio): class TDH6Radio(RadioddityGA510Radio): VENDOR = "TIDRADIO" MODEL = "TD-H6" + + def get_features(self): + rf = super().get_features() + rf.valid_bands = [(136000000, 174000000), + (400000000, 520000000)] + return rf + + +@directory.register +class Senhaix8800Radio(RadioddityGA510Radio): + """Senhaix 8800""" + VENDOR = "SenhaiX" + MODEL = "8800" + + POWER_LEVELS = [ + chirp_common.PowerLevel('H', watts=5), + chirp_common.PowerLevel('L', watts=1)] + _mem_format = MODEL_SHX8800_FORMAT + _magic = b'PROGROMSHXU' + + +@directory.register +class RadioddityGS5BRadio(Senhaix8800Radio): + """Radioddity GS-5B""" + VENDOR = "Radioddity" + MODEL = "GS-5B" + + +# NOTE: This was added as Signus originally in 18295675 +@directory.register +class CignusXTR5Radio(Senhaix8800Radio): + """Cignus XTR-5""" + VENDOR = "Cignus" + MODEL = "XTR-5" + + +@directory.register +class AnysecuAC580Radio(Senhaix8800Radio): + """Anysecu AC-580""" + VENDOR = "Anysecu" + MODEL = "AC-580" + + +@directory.register +class AbbreeARF5Radio(RadioddityGA510Radio): + VENDOR = 'Abbree' + MODEL = 'AR-F5' + POWER_LEVELS = [ + chirp_common.PowerLevel('H', watts=5), + chirp_common.PowerLevel('L', watts=1), + chirp_common.PowerLevel('M', watts=2)] + + _magic = b'PROGROMWLTU' + + def get_features(self): + rf = RadioddityGA510Radio.get_features(self) + rf.memory_bounds = (1, 128) + rf.valid_bands = [(136000000, 174000000), + (200000000, 300000000), + (300000000, 400000000), + (400000000, 520000000)] + return rf + + def _get_mem(self, num): + return self._memobj.memories[num - 1] + + def _get_nam(self, number): + return self._memobj.names[number - 1] + + def _set_mem(self, num): + return self._memobj.memories[num - 1] + + def _set_nam(self, number): + return self._memobj.names[number - 1] diff --git a/chirp/drivers/generic_csv.py b/chirp/drivers/generic_csv.py index 0a3eab2..92eb071 100644 --- a/chirp/drivers/generic_csv.py +++ b/chirp/drivers/generic_csv.py @@ -20,6 +20,7 @@ import logging from chirp import chirp_common, errors, directory LOG = logging.getLogger(__name__) +DEFAULT_POWER_LEVEL = chirp_common.AutoNamedPowerLevel(50) class OmittedHeaderError(Exception): @@ -46,12 +47,19 @@ def write_memory(writer, mem): writer.writerow(mem.to_csv()) +def parse_cross_mode(value): + if value not in chirp_common.CROSS_MODES: + raise ValueError('Invalid cross mode %r' % value) + return value + + @directory.register class CSVRadio(chirp_common.FileBackedRadio): """A driver for Generic CSV files""" VENDOR = "Generic" MODEL = "CSV" FILE_EXTENSION = "csv" + FORMATS = [directory.register_format('CSV', '*.csv')] ATTR_MAP = { "Location": (int, "number"), @@ -64,9 +72,12 @@ class CSVRadio(chirp_common.FileBackedRadio): "cToneFreq": (float, "ctone"), "DtcsCode": (int, "dtcs"), "DtcsPolarity": (str, "dtcs_polarity"), + "RxDtcsCode": (int, "rx_dtcs"), + "CrossMode": (parse_cross_mode, "cross_mode"), "Mode": (str, "mode"), "TStep": (float, "tuning_step"), "Skip": (str, "skip"), + "Power": (chirp_common.parse_power, "power"), "Comment": (str, "comment"), } @@ -76,6 +87,8 @@ class CSVRadio(chirp_common.FileBackedRadio): if (setDefault): self.memories[0].empty = False self.memories[0].freq = 146010000 + # Default to 50W + self.memories[0].power = DEFAULT_POWER_LEVEL def __init__(self, pipe): chirp_common.FileBackedRadio.__init__(self, None) @@ -98,16 +111,22 @@ class CSVRadio(chirp_common.FileBackedRadio): rf.has_infinite_number = True rf.has_nostep_tuning = True rf.has_comment = True + rf.has_rx_dtcs = True + rf.has_variable_power = True rf.can_odd_split = True rf.valid_modes = list(chirp_common.MODES) rf.valid_tmodes = list(chirp_common.TONE_MODES) + rf.valid_cross_modes = list(chirp_common.CROSS_MODES) rf.valid_duplexes = ["", "-", "+", "split", "off"] rf.valid_tuning_steps = list(chirp_common.TUNING_STEPS) rf.valid_bands = [(1, 10000000000)] rf.valid_skips = ["", "S"] - rf.valid_characters = chirp_common.CHARSET_ASCII + rf.valid_characters = chirp_common.CHARSET_1252 rf.valid_name_length = 999 + rf.valid_power_levels = [chirp_common.AutoNamedPowerLevel(0.1), + DEFAULT_POWER_LEVEL, + chirp_common.AutoNamedPowerLevel(1500)] return rf @@ -156,11 +175,15 @@ class CSVRadio(chirp_common.FileBackedRadio): val = typ(val) if hasattr(mem, attr): setattr(mem, attr, val) - except OmittedHeaderError as e: + except OmittedHeaderError: pass except Exception as e: raise Exception("[%s] %s" % (attr, e)) + if not mem.power: + # Default power level to something if not set + mem.power = DEFAULT_POWER_LEVEL + return self._clean(headers, line, mem) def load(self, filename=None): @@ -172,9 +195,7 @@ class CSVRadio(chirp_common.FileBackedRadio): self._blank() - with open(self._filename, "rU") as f: - header = f.readline().strip() - f.seek(0, 0) + with open(self._filename, newline='', encoding='utf-8-sig') as f: return self._load(f) def _load(self, f): @@ -221,7 +242,7 @@ class CSVRadio(chirp_common.FileBackedRadio): if filename: self._filename = filename - with open(self._filename, "w") as f: + with open(self._filename, "w", newline='', encoding='utf-8') as f: writer = csv.writer(f, delimiter=chirp_common.SEPCHAR) writer.writerow(chirp_common.Memory.CSV_FORMAT) @@ -240,7 +261,7 @@ class CSVRadio(chirp_common.FileBackedRadio): def get_memory(self, number): try: - return self.memories[number] + return self.memories[number].dupe() except: raise errors.InvalidMemoryLocation("No such memory %s" % number) @@ -258,8 +279,17 @@ class CSVRadio(chirp_common.FileBackedRadio): self.memories.append(mem) def set_memory(self, newmem): + newmem = newmem.dupe() + if newmem.power is None: + newmem.power = DEFAULT_POWER_LEVEL + else: + # Accept any power level because we are CSV, but convert it to + # the class that will str() into our desired format. + newmem.power = chirp_common.AutoNamedPowerLevel( + chirp_common.dBm_to_watts(float(newmem.power))) self._grow(newmem.number) self.memories[newmem.number] = newmem + self.memories[newmem.number].name = newmem.name.rstrip() def erase_memory(self, number): mem = chirp_common.Memory() diff --git a/chirp/drivers/generic_tpe.py b/chirp/drivers/generic_tpe.py index dced1c5..16642e1 100644 --- a/chirp/drivers/generic_tpe.py +++ b/chirp/drivers/generic_tpe.py @@ -13,10 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -try: - import UserDict -except ImportError: - from collections import UserDict from chirp import chirp_common, directory from chirp.drivers import generic_csv @@ -27,6 +23,7 @@ class TpeRadio(generic_csv.CSVRadio): VENDOR = "ARRL" MODEL = "Travel Plus" FILE_EXTENSION = "tpe" + FORMATS = [directory.register_format('ARRL TPE', '*.tpe')] ATTR_MAP = { "Sequence Number": (int, "number"), diff --git a/chirp/drivers/gmrsuv1.py b/chirp/drivers/gmrsuv1.py index dfb1232..32f72fe 100644 --- a/chirp/drivers/gmrsuv1.py +++ b/chirp/drivers/gmrsuv1.py @@ -14,35 +14,31 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import time -import struct import logging -import re from chirp.drivers import baofeng_common -from chirp import chirp_common, directory, memmap -from chirp import bitwise, errors, util +from chirp import chirp_common, directory +from chirp import bitwise from chirp.settings import RadioSettingGroup, RadioSetting, \ RadioSettingValueBoolean, RadioSettingValueList, \ RadioSettingValueString, RadioSettingValueInteger, \ RadioSettingValueFloat, RadioSettings, \ InvalidValueError -from textwrap import dedent LOG = logging.getLogger(__name__) # #### MAGICS ######################################################### # BTECH GMRS-V1 magic string -MSTRING_GMRSV1 = "\x50\x5F\x20\x15\x12\x15\x4D" +MSTRING_GMRSV1 = b"\x50\x5F\x20\x15\x12\x15\x4D" # #### ID strings ##################################################### # BTECH GMRS-V1 -GMRSV1_fp1 = "US32411" # original -GMRSV1_fp2 = "US32416" # original -GMRSV1_fp3 = "US32418" # new rules -GMRSV1_fp4 = "US32412" # original +GMRSV1_fp1 = b"US32411" # original +GMRSV1_fp2 = b"US32416" # original +GMRSV1_fp3 = b"US32418" # new rules +GMRSV1_fp4 = b"US32412" # original DTMF_CHARS = "0123456789 *#ABCD" STEPS = [2.5, 5.0, 6.25, 10.0, 12.5, 20.0, 25.0, 50.0] @@ -72,12 +68,12 @@ LIST_TXPOWER = ["High", "Low"] LIST_VOICE = ["Off", "English", "Chinese"] LIST_WORKMODE = ["Frequency", "Channel"] -GMRS_FREQS1 = [462.5625, 462.5875, 462.6125, 462.6375, 462.6625, - 462.6875, 462.7125] -GMRS_FREQS2 = [467.5625, 467.5875, 467.6125, 467.6375, 467.6625, - 467.6875, 467.7125] -GMRS_FREQS3 = [462.5500, 462.5750, 462.6000, 462.6250, 462.6500, - 462.6750, 462.7000, 462.7250] +GMRS_FREQS1 = [462562500, 462587500, 462612500, 462637500, 462662500, + 462687500, 462712500] +GMRS_FREQS2 = [467562500, 467587500, 467612500, 467637500, 467662500, + 467687500, 467712500] +GMRS_FREQS3 = [462550000, 462575000, 462600000, 462625000, 462650000, + 462675000, 462700000, 462725000] GMRS_FREQS_ORIG = GMRS_FREQS1 + GMRS_FREQS3 * 2 GMRS_FREQS_2017 = GMRS_FREQS1 + GMRS_FREQS2 + GMRS_FREQS3 * 2 @@ -97,6 +93,7 @@ class GMRSV1(baofeng_common.BaofengCommonHT): """BTech GMRS-V1""" VENDOR = "BTECH" MODEL = "GMRS-V1" + NEEDS_COMPAT_SERIAL = False _fileid = [GMRSV1_fp4, GMRSV1_fp3, GMRSV1_fp2, GMRSV1_fp1, ] _is_orig = [GMRSV1_fp2, GMRSV1_fp1, GMRSV1_fp4, ] @@ -121,7 +118,7 @@ class GMRSV1(baofeng_common.BaofengCommonHT): "!@#$%^&*()+-=[]:\";'<>?,./" LENGTH_NAME = 7 SKIP_VALUES = ["", "S"] - DTCS_CODES = sorted(chirp_common.DTCS_CODES + [645]) + DTCS_CODES = tuple(sorted(chirp_common.DTCS_CODES + (645,))) POWER_LEVELS = [chirp_common.PowerLevel("High", watts=5.00), chirp_common.PowerLevel("Low", watts=2.00)] VALID_BANDS = [(130000000, 180000000), @@ -138,7 +135,7 @@ class GMRSV1(baofeng_common.BaofengCommonHT): rf.has_tuning_step = False rf.can_odd_split = False rf.has_name = True - rf.has_offset = False + rf.has_offset = True rf.has_mode = True rf.has_dtcs = True rf.has_rx_dtcs = True @@ -148,7 +145,7 @@ class GMRSV1(baofeng_common.BaofengCommonHT): rf.valid_modes = self.MODES rf.valid_characters = self.VALID_CHARS rf.valid_name_length = self.LENGTH_NAME - rf.valid_duplexes = ["", "-", "+"] + rf.valid_duplexes = ["", "-", "+", "off"] rf.valid_tmodes = ['', 'Tone', 'TSQL', 'DTCS', 'Cross'] rf.valid_cross_modes = [ "Tone->Tone", @@ -391,68 +388,24 @@ class GMRSV1(baofeng_common.BaofengCommonHT): 'Please save an unedited copy of your first successful\n' 'download to a CHIRP Radio Images(*.img) file.' ) - rp.pre_download = _(dedent("""\ - Follow these instructions to download your info: - - 1 - Turn off your radio - 2 - Connect your interface cable - 3 - Turn on your radio - 4 - Do the download of your radio data - """)) - rp.pre_upload = _(dedent("""\ - Follow this instructions to upload your info: - - 1 - Turn off your radio - 2 - Connect your interface cable - 3 - Turn on your radio - 4 - Do the upload of your radio data - """)) + rp.pre_download = _( + "Follow these instructions to download your info:\n" + "1 - Turn off your radio\n" + "2 - Connect your interface cable\n" + "3 - Turn on your radio\n" + "4 - Do the download of your radio data\n") + rp.pre_upload = _( + "Follow this instructions to upload your info:\n" + "1 - Turn off your radio\n" + "2 - Connect your interface cable\n" + "3 - Turn on your radio\n" + "4 - Do the upload of your radio data\n") return rp def process_mmap(self): """Process the mem map into the mem object""" self._memobj = bitwise.parse(self.MEM_FORMAT, self._mmap) - def validate_memory(self, mem): - msgs = baofeng_common.BaofengCommonHT.validate_memory(self, mem) - - _mem = self._memobj.memory[mem.number] - _msg_freq = 'Memory location cannot change frequency' - _msg_nfm = 'Memory location only supports NFM' - _msg_txp = 'Memory location only supports Low' - - # Original GMRS-V1 models - if str(self._memobj.firmware_msg.line1) in self._is_orig: - # range of memories with values permanently set by FCC rules - if mem.number <= 22: - if mem.freq != int(GMRS_FREQS_ORIG[mem.number] * 1000000): - # warn user can't change frequency - msgs.append(chirp_common.ValidationError(_msg_freq)) - - if mem.number <= 6: - if mem.mode == "FM": - # warn user can't change mode - msgs.append(chirp_common.ValidationError(_msg_nfm)) - - # GMRS-V1 models supporting 2017 GMRS rules - else: - # range of memories with values permanently set by FCC rules - if mem.number >= 1 and mem.number <= 30: - if mem.freq != int(GMRS_FREQS_2017[mem.number - 1] * 1000000): - # warn user can't change frequency - msgs.append(chirp_common.ValidationError(_msg_freq)) - - if mem.number >= 8 and mem.number <= 14: - if mem.mode == "FM": - # warn user can't change mode - msgs.append(chirp_common.ValidationError(_msg_nfm)) - - if str(mem.power) == "High": - # warn user can't change power level - msgs.append(chirp_common.ValidationError(_msg_txp)) - - return msgs - def get_memory(self, number): _mem = self._memobj.memory[number] _nam = self._memobj.names[number] @@ -466,14 +419,15 @@ class GMRSV1(baofeng_common.BaofengCommonHT): mem.freq = int(_mem.rxfreq) * 10 - # TX freq set - offset = (int(_mem.txfreq) * 10) - mem.freq - if offset != 0: - if offset > 0: - mem.offset = offset - mem.duplex = "+" - else: + if _mem.txfreq.get_raw() == "\xFF\xFF\xFF\xFF": + mem.duplex = "off" mem.offset = 0 + elif int(_mem.rxfreq) == int(_mem.txfreq): + mem.duplex = "" + mem.offset = 0 + else: + mem.duplex = int(_mem.rxfreq) > int(_mem.txfreq) and "-" or "+" + mem.offset = abs(int(_mem.rxfreq) - int(_mem.txfreq)) * 10 for char in _nam.name: if str(char) == "\xFF": @@ -556,6 +510,65 @@ class GMRSV1(baofeng_common.BaofengCommonHT): self.SCODE_LIST[_mem.scode])) mem.extra.append(rs) + immutable = [] + + # Original GMRS-V1 models (pre-2017 GMRS rules) + # line1 is a valid string, so safe to encode here + if str(self._memobj.firmware_msg.line1).encode() in self._is_orig: + if mem.freq in GMRS_FREQS_ORIG: + if mem.number >= 0 and mem.number <= 22: + GMRS_FREQ = GMRS_FREQS_ORIG[mem.number] + mem.freq = GMRS_FREQ + immutable = ["empty", "freq"] + if mem.number >= 0 and mem.number <= 6: + mem.duplex = '' + mem.offset = 0 + immutable += ["duplex", "offset"] + elif mem.number >= 7 and mem.number <= 14: + mem.duplex = '' + mem.offset = 0 + immutable += ["duplex", "offset"] + elif mem.number >= 15 and mem.number <= 22: + mem.duplex = '+' + mem.offset = 5000000 + immutable += ["duplex", "offset"] + else: + if mem.number > 22: + mem.duplex = 'off' + immutable = ["duplex", "offset"] + + # GMRS-V1 models supporting 2017 GMRS rules + else: + if mem.freq in GMRS_FREQS_2017: + if mem.number >= 1 and mem.number <= 30: + GMRS_FREQ = GMRS_FREQS_2017[mem.number - 1] + mem.freq = GMRS_FREQ + immutable = ["empty", "freq"] + if mem.number >= 1 and mem.number <= 7: + mem.duplex = '' + mem.offset = 0 + immutable += ["duplex", "offset"] + elif mem.number >= 8 and mem.number <= 14: + mem.duplex = '' + mem.offset = 0 + mem.mode = "NFM" + mem.power = self.POWER_LEVELS[1] + immutable += ["duplex", "offset", "mode", "power"] + elif mem.number >= 15 and mem.number <= 22: + mem.duplex = '' + mem.offset = 0 + immutable += ["duplex", "offset"] + elif mem.number >= 23 and mem.number <= 30: + mem.duplex = '+' + mem.offset = 5000000 + immutable += ["duplex", "offset"] + else: + if mem.number < 1 or mem.number > 30: + mem.duplex = 'off' + immutable = ["duplex", "offset"] + + mem.immutable = immutable + return mem def set_memory(self, mem): @@ -571,12 +584,17 @@ class GMRSV1(baofeng_common.BaofengCommonHT): _mem.rxfreq = mem.freq / 10 - if str(self._memobj.firmware_msg.line1) in self._is_orig: - if mem.number > 22: - _mem.txfreq = mem.freq / 10 + if mem.duplex == "off": + for i in range(0, 4): + _mem.txfreq[i].set_raw("\xFF") + elif mem.duplex == "split": + _mem.txfreq = mem.offset / 10 + elif mem.duplex == "+": + _mem.txfreq = (mem.freq + mem.offset) / 10 + elif mem.duplex == "-": + _mem.txfreq = (mem.freq - mem.offset) / 10 else: - if mem.number < 1 or mem.number > 22: - _mem.txfreq = mem.freq / 10 + _mem.txfreq = mem.freq / 10 _namelength = self.get_features().valid_name_length for i in range(_namelength): diff --git a/chirp/drivers/gmrsv2.py b/chirp/drivers/gmrsv2.py index 691583c..71a4e43 100644 --- a/chirp/drivers/gmrsv2.py +++ b/chirp/drivers/gmrsv2.py @@ -14,32 +14,35 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import time -import struct import logging -import re from chirp.drivers import baofeng_common -from chirp import chirp_common, directory, memmap -from chirp import bitwise, errors, util +from chirp import chirp_common, directory +from chirp import bitwise +from chirp import bandplan_na from chirp.settings import RadioSettingGroup, RadioSetting, \ RadioSettingValueBoolean, RadioSettingValueList, \ RadioSettingValueString, RadioSettingValueInteger, \ RadioSettingValueFloat, RadioSettings, \ InvalidValueError -from textwrap import dedent LOG = logging.getLogger(__name__) # #### MAGICS ######################################################### # BTECH GMRS-V2 magic string -MSTRING_GMRSV2 = "\x50\x5F\x20\x21\x12\x15\x4D" +MSTRING_GMRSV2 = b"\x50\x5F\x20\x21\x12\x15\x4D" + +# BTECH MURS-V2 magic string +MSTRING_MURSV2 = b"\x50\x5F\x20\x21\x12\x15\x4D" # #### ID strings ##################################################### # BTECH GMRS-V2 -GMRSV2_fp1 = "US32419" # original +GMRSV2_fp1 = b"US32419" # original + +# BTECH MURS-V2 +MURSV2_fp1 = b"USM2403" # original DTMF_CHARS = "0123456789 *#ABCD" STEPS = [2.5, 5.0, 6.25, 10.0, 12.5, 20.0, 25.0, 50.0] @@ -69,32 +72,19 @@ LIST_TXPOWER = ["High", "Low"] LIST_VOICE = ["Off", "English", "Chinese"] LIST_WORKMODE = ["Frequency", "Channel"] -GMRS_FREQS1 = [462.5625, 462.5875, 462.6125, 462.6375, 462.6625, - 462.6875, 462.7125] -GMRS_FREQS2 = [467.5625, 467.5875, 467.6125, 467.6375, 467.6625, - 467.6875, 467.7125] -GMRS_FREQS3 = [462.5500, 462.5750, 462.6000, 462.6250, 462.6500, - 462.6750, 462.7000, 462.7250] -GMRS_FREQS = GMRS_FREQS1 + GMRS_FREQS2 + GMRS_FREQS3 * 2 - - -@directory.register -class GMRSV2(baofeng_common.BaofengCommonHT): - """BTech GMRS-V2""" - VENDOR = "BTECH" - MODEL = "GMRS-V2" - _fileid = [GMRSV2_fp1, ] +class GMRSV2base(baofeng_common.BaofengCommonHT): + """BTech GMRS-V2base""" + VENDOR = "" + MODEL = "" + NEEDS_COMPAT_SERIAL = False - _magic = [MSTRING_GMRSV2, ] - _magic_response_length = 8 _fw_ver_start = 0x1EF0 _recv_block_size = 0x40 _mem_size = 0x2000 _ack_block = True - _ranges = [(0x0000, 0x0DF0), - (0x0E00, 0x1EF0), + _ranges = [(0x0000, 0x1EF0), (0x1F60, 0x1F70), (0x1F80, 0x1F90), (0x1FC0, 0x1FD0)] @@ -106,7 +96,7 @@ class GMRSV2(baofeng_common.BaofengCommonHT): "!@#$%^&*()+-=[]:\";'<>?,./" LENGTH_NAME = 7 SKIP_VALUES = ["", "S"] - DTCS_CODES = sorted(chirp_common.DTCS_CODES + [645]) + DTCS_CODES = tuple(sorted(chirp_common.DTCS_CODES + (645,))) POWER_LEVELS = [chirp_common.PowerLevel("High", watts=5.00), chirp_common.PowerLevel("Low", watts=0.50)] VALID_BANDS = [(130000000, 180000000), @@ -365,27 +355,23 @@ class GMRSV2(baofeng_common.BaofengCommonHT): def get_prompts(cls): rp = chirp_common.RadioPrompts() rp.experimental = \ - ('The BTech GMRS-V2 driver is a beta version.\n' + ('The BTech ' + cls.MODEL + ' driver is a beta version.\n' '\n' 'Please save an unedited copy of your first successful\n' 'download to a CHIRP Radio Images(*.img) file.' ) - rp.pre_download = _(dedent("""\ - Follow these instructions to download your info: - - 1 - Turn off your radio - 2 - Connect your interface cable - 3 - Turn on your radio - 4 - Do the download of your radio data - """)) - rp.pre_upload = _(dedent("""\ - Follow this instructions to upload your info: - - 1 - Turn off your radio - 2 - Connect your interface cable - 3 - Turn on your radio - 4 - Do the upload of your radio data - """)) + rp.pre_download = _( + "Follow these instructions to download your info:\n" + "1 - Turn off your radio\n" + "2 - Connect your interface cable\n" + "3 - Turn on your radio\n" + "4 - Do the download of your radio data\n") + rp.pre_upload = _( + "Follow this instructions to upload your info:\n" + "1 - Turn off your radio\n" + "2 - Connect your interface cable\n" + "3 - Turn on your radio\n" + "4 - Do the upload of your radio data\n") return rp def process_mmap(self): @@ -501,8 +487,66 @@ class GMRSV2(baofeng_common.BaofengCommonHT): self.SCODE_LIST[_mem.scode])) mem.extra.append(rs) + immutable = [] + + if self.MODEL == "GMRS-V2": + if mem.freq in bandplan_na.ALL_GMRS_FREQS: + if mem.freq in bandplan_na.GMRS_LOW: + # Non-repeater GMRS channels (limit duplex) + mem.duplex = '' + mem.offset = 0 + immutable = ["duplex", "offset"] + elif mem.freq in bandplan_na.GMRS_HHONLY: + # Non-repeater GMRS hand-held only channels + # (limit duplex, power) + mem.duplex = '' + mem.offset = 0 + mem.mode = "NFM" + mem.power = self.POWER_LEVELS[1] + immutable = ["duplex", "offset", "mode", "power"] + elif mem.freq in bandplan_na.GMRS_HIRPT: + # GMRS repeater channels, always either simplex or +5 MHz + if mem.duplex == '': + mem.offset = 0 + if mem.duplex == '+': + mem.offset = 5000000 + else: + # Not a GMRS channel, so restrict duplex since it will be + # forced to off. + if mem.freq not in bandplan_na.ALL_GMRS_FREQS: + mem.duplex = 'off' + mem.offset = 0 + immutable = ["duplex", "offset"] + + if self.MODEL == "MURS-V2": + if mem.freq in bandplan_na.ALL_MURS_FREQS: + if mem.freq in bandplan_na.MURS_NFM: + # Narrow only MURS channels (limit mode) + mem.duplex == '' + mem.offset = 0 + mem.mode = "NFM" + immutable = ["duplex", "offset", "mode"] + if mem.freq in bandplan_na.MURS_FM: + # Narrow or wide MURS channels + mem.duplex == '' + mem.offset = 0 + immutable = ["duplex", "offset"] + else: + # Not a MURS channel, so restrict duplex since it will be + # forced to off. + if mem.freq not in bandplan_na.ALL_MURS_FREQS: + mem.duplex = 'off' + mem.offset = 0 + immutable = ["duplex", "offset"] + + mem.immutable = immutable + return mem + def check_set_memory_immutable_policy(self, existing, new): + existing.immutable = [] + super().check_set_memory_immutable_policy(existing, new) + def set_memory(self, mem): _mem = self._memobj.memory[mem.number] _nam = self._memobj.names[mem.number] @@ -514,32 +558,14 @@ class GMRSV2(baofeng_common.BaofengCommonHT): _mem.set_raw("\x00" * 16) - if float(mem.freq) / 1000000 in GMRS_FREQS1: - mem.duplex == '' - mem.offset = 0 - elif float(mem.freq) / 1000000 in GMRS_FREQS2: - mem.duplex == '' - mem.offset = 0 - mem.mode = "NFM" - mem.power = self.POWER_LEVELS[1] - elif float(mem.freq) / 1000000 in GMRS_FREQS3: - if mem.duplex == '+': - mem.offset = 5000000 - else: - mem.duplex == '' - mem.offset = 0 - else: - mem.duplex = 'off' - mem.offset = 0 - _mem.rxfreq = mem.freq / 10 if mem.duplex == "off": for i in range(0, 4): _mem.txfreq[i].set_raw("\xFF") elif mem.duplex == "+": - mem.offset = 5000000 - _mem.txfreq = (mem.freq + mem.offset) / 10 + offset = 5000000 + _mem.txfreq = (mem.freq + offset) / 10 else: _mem.txfreq = mem.freq / 10 @@ -1028,3 +1054,64 @@ class GMRSV2(baofeng_common.BaofengCommonHT): # This radio has always been post-metadata, so never do # old-school detection return False + + +@directory.register +class GMRSV2(GMRSV2base): + """BTech GMRS-V2""" + VENDOR = "BTECH" + MODEL = "GMRS-V2" + NEEDS_COMPAT_SERIAL = False + + _fileid = [GMRSV2_fp1, ] + + _magic = [MSTRING_GMRSV2, ] + _magic_response_length = 8 + + POWER_LEVELS = [chirp_common.PowerLevel("High", watts=5.00), + chirp_common.PowerLevel("Low", watts=0.50)] + + def validate_memory(self, mem): + msgs = super().validate_memory(mem) + + _msg_duplex = 'Duplex must be "off" for this frequency' + _msg_offset = 'Only simplex or +5 MHz offset allowed on GMRS' + + if mem.freq not in bandplan_na.ALL_GMRS_FREQS: + if mem.duplex != "off": + msgs.append(chirp_common.ValidationWarning(_msg_duplex)) + if mem.freq in bandplan_na.GMRS_HIRPT: + if mem.duplex and mem.offset != 5000000: + msgs.append(chirp_common.ValidationWarning(_msg_offset)) + + return msgs + + +@directory.register +class MURSV2(GMRSV2base): + """BTech MURS-V2""" + VENDOR = "BTECH" + MODEL = "MURS-V2" + + _fileid = [MURSV2_fp1, ] + + _magic = [MSTRING_MURSV2, ] + _magic_response_length = 8 + + POWER_LEVELS = [chirp_common.PowerLevel("High", watts=2.00), + chirp_common.PowerLevel("Low", watts=0.50)] + + def validate_memory(self, mem): + msgs = super().validate_memory(mem) + + _msg_duplex = 'Duplex must be "off" for this frequency' + _msg_offset = 'Only simplex or +5 MHz offset allowed on GMRS' + + print('frequency') + print(mem.freq) + print(mem.freq in bandplan_na.ALL_MURS_FREQS) + if mem.freq not in bandplan_na.ALL_MURS_FREQS: + if mem.duplex != "off": + msgs.append(chirp_common.ValidationWarning(_msg_duplex)) + + return msgs diff --git a/chirp/drivers/h777.py b/chirp/drivers/h777.py index a2dd0be..f928447 100644 --- a/chirp/drivers/h777.py +++ b/chirp/drivers/h777.py @@ -15,7 +15,6 @@ # along with this program. If not, see . import time -import os import struct import unittest import logging @@ -58,6 +57,9 @@ struct { u8 alarm; u8 fmradio; } settings; +""" + +H777_SETTINGS2 = """ #seekto 0x03C0; struct { u8 unused:6, @@ -72,25 +74,30 @@ struct { } settings2; """ +BF1900_SETTINGS2 = """ +#seekto 0x03C0; +struct { + u8 unused:6, + batterysaver:1, + beep:1; + u8 squelchlevel; + u8 scanmode; + u8 timeouttimer; + u8 unused2[4]; +} settings2; +""" + CMD_ACK = b"\x06" BLOCK_SIZE = 0x08 UPLOAD_BLOCKS = [list(range(0x0000, 0x0110, 8)), list(range(0x02b0, 0x02c0, 8)), list(range(0x0380, 0x03e0, 8))] -# TODO: Is it 1 watt? -H777_POWER_LEVELS = [chirp_common.PowerLevel("Low", watts=1.00), - chirp_common.PowerLevel("High", watts=5.00)] VOICE_LIST = ["English", "Chinese"] TIMEOUTTIMER_LIST = ["Off", "30 seconds", "60 seconds", "90 seconds", "120 seconds", "150 seconds", "180 seconds", "210 seconds", "240 seconds", "270 seconds", "300 seconds"] -SCANMODE_LIST = ["Carrier", "Time"] - -SETTING_LISTS = { - "voice": VOICE_LIST, -} def _h777_enter_programming_mode(radio): @@ -101,7 +108,7 @@ def _h777_enter_programming_mode(radio): try: serial.write(b"\x02") time.sleep(0.1) - serial.write(b"PROGRAM") + serial.write(radio.PROGRAM_CMD) ack = serial.read(1) except: raise errors.RadioError("Error communicating with radio") @@ -277,12 +284,19 @@ class H777Radio(chirp_common.CloneModeRadio): # MODEL = "H-777" VENDOR = "Baofeng" MODEL = "BF-888" + PROGRAM_CMD = b'PROGRAM' BAUD_RATE = 9600 NEEDS_COMPAT_SERIAL = False + # TODO: Is it 1 watt? + POWER_LEVELS = [chirp_common.PowerLevel("Low", watts=1.00), + chirp_common.PowerLevel("High", watts=5.00)] + VALID_BANDS = (400000000, 470000000) + MAX_VOXLEVEL = 5 ALIASES = [ArcshellAR5, ArcshellAR6, GV8SAlias, GV9SAlias, A8SAlias, TenwayTW325Alias, RetevisH777Alias] SIDEKEYFUNCTION_LIST = ["Off", "Monitor", "Transmit Power", "Alarm"] + SCANMODE_LIST = ["Carrier", "Time"] # This code currently requires that ranges start at 0x0000 # and are continuous. In the original program 0x0388 and 0x03C8 @@ -303,11 +317,12 @@ class H777Radio(chirp_common.CloneModeRadio): _has_fm = True _has_sidekey = True _has_scanmodes = True + _has_scramble = True def get_features(self): rf = chirp_common.RadioFeatures() rf.has_settings = True - rf.valid_modes = ["NFM", "FM"] # 12.5 KHz, 25 kHz. + rf.valid_modes = ["NFM", "FM"] # 12.5 kHz, 25 kHz. rf.valid_skips = ["", "S"] rf.valid_tmodes = ["", "Tone", "TSQL", "DTCS", "Cross"] rf.valid_duplexes = ["", "-", "+", "split", "off"] @@ -327,15 +342,15 @@ class H777Radio(chirp_common.CloneModeRadio): rf.has_bank = False rf.has_name = False rf.memory_bounds = (1, 16) - rf.valid_bands = [(400000000, 470000000)] - rf.valid_power_levels = H777_POWER_LEVELS + rf.valid_bands = [self.VALID_BANDS] + rf.valid_power_levels = self.POWER_LEVELS rf.valid_tuning_steps = [2.5, 5.0, 6.25, 10.0, 12.5, 15.0, 20.0, 25.0, 50.0, 100.0] return rf def process_mmap(self): - self._memobj = bitwise.parse(MEM_FORMAT, self._mmap) + self._memobj = bitwise.parse(MEM_FORMAT + H777_SETTINGS2, self._mmap) def sync_in(self): self._mmap = do_download(self) @@ -379,7 +394,7 @@ class H777Radio(chirp_common.CloneModeRadio): mem.number = number mem.freq = int(_mem.rxfreq) * 10 - # We'll consider any blank (i.e. 0MHz frequency) to be empty + # We'll consider any blank (i.e. 0 MHz frequency) to be empty if mem.freq == 0: mem.empty = True return mem @@ -400,7 +415,7 @@ class H777Radio(chirp_common.CloneModeRadio): mem.offset = abs(int(_mem.rxfreq) - int(_mem.txfreq)) * 10 mem.mode = not _mem.narrow and "FM" or "NFM" - mem.power = H777_POWER_LEVELS[_mem.highpower] + mem.power = self.POWER_LEVELS[_mem.highpower] mem.skip = _mem.skip and "S" or "" @@ -412,9 +427,10 @@ class H777Radio(chirp_common.CloneModeRadio): rs = RadioSetting("bcl", "Busy Channel Lockout", RadioSettingValueBoolean(not _mem.bcl)) mem.extra.append(rs) - rs = RadioSetting("beatshift", "Beat Shift(scramble)", - RadioSettingValueBoolean(not _mem.beatshift)) - mem.extra.append(rs) + if self._has_scramble: + rs = RadioSetting("beatshift", "Beat Shift(scramble)", + RadioSettingValueBoolean(not _mem.beatshift)) + mem.extra.append(rs) return mem @@ -445,7 +461,7 @@ class H777Radio(chirp_common.CloneModeRadio): self._encode_tone(_mem.rxtone, *rxtone) _mem.narrow = 'N' in mem.mode - _mem.highpower = mem.power == H777_POWER_LEVELS[1] + _mem.highpower = mem.power == self.POWER_LEVELS[1] _mem.skip = mem.skip == "S" for setting in mem.extra: @@ -484,8 +500,8 @@ class H777Radio(chirp_common.CloneModeRadio): if self._has_scanmodes: rs = RadioSetting("settings2.scanmode", "Scan mode", RadioSettingValueList( - SCANMODE_LIST, - SCANMODE_LIST[ + self.SCANMODE_LIST, + self.SCANMODE_LIST[ self._memobj.settings2.scanmode])) basic.append(rs) @@ -495,7 +511,7 @@ class H777Radio(chirp_common.CloneModeRadio): rs = RadioSetting("voxlevel", "VOX level", RadioSettingValueInteger( - 1, 5, _settings.voxlevel + 1)) + 1, self.MAX_VOXLEVEL, _settings.voxlevel + 1)) basic.append(rs) rs = RadioSetting("voxinhibitonrx", "Inhibit VOX on receive", @@ -510,8 +526,14 @@ class H777Radio(chirp_common.CloneModeRadio): RadioSettingValueBoolean(_settings.highvolinhibittx)) basic.append(rs) - rs = RadioSetting("alarm", "Alarm", - RadioSettingValueBoolean(_settings.alarm)) + if self.PROGRAM_CMD == b'PWPG970': # Baofeng 1900 series + rs = RadioSetting("alarm", "Alarm", + RadioSettingValueList( + self.ALARM_LIST, + self.ALARM_LIST[_settings.alarm])) + else: + rs = RadioSetting("alarm", "Alarm", + RadioSettingValueBoolean(_settings.alarm)) basic.append(rs) # TODO: This should probably be called “FM Broadcast Band Radio” @@ -578,7 +600,7 @@ class H777Radio(chirp_common.CloneModeRadio): else: LOG.debug("Setting %s = %s" % (setting, element.value)) setattr(obj, setting, element.value) - except Exception as e: + except Exception: LOG.debug(element.get_name()) raise @@ -635,6 +657,7 @@ class H777TestCase(unittest.TestCase): class ROGA2SRadio(H777Radio): VENDOR = "Radioddity" MODEL = "GA-2S" + ALIASES = [] _has_fm = False SIDEKEYFUNCTION_LIST = ["Off", "Monitor", "Unused", "Alarm"] @@ -648,6 +671,7 @@ class ROGA2SRadio(H777Radio): class H777PlusRadio(H777Radio): VENDOR = "Retevis" MODEL = "H777 Plus" + ALIASES = [] _has_fm = False _has_scanmodes = False @@ -655,3 +679,83 @@ class H777PlusRadio(H777Radio): def match_model(cls, filedata, filename): # This model is only ever matched via metadata return False + + +@directory.register +class BFM4Radio(H777Radio): + VENDOR = "Baofeng" + MODEL = "BF-M4" + ALIASES = [] + _has_fm = False + + @classmethod + def match_model(cls, filedata, filename): + # This model is only ever matched via metadata + return False + + +@directory.register +class BF1901Radio(H777Radio): + VENDOR = "Baofeng" + MODEL = "BF-1901" + PROGRAM_CMD = b'PWPG970' + ALIASES = [] + + VALID_BANDS = (400000000, 520000000) + MAX_VOXLEVEL = 9 + SCANMODE_LIST = ["Time", "Carrier", "Search"] + ALARM_LIST = ["Local", "Remote"] + + _has_fm = True + _has_sidekey = False + _has_scanmodes = True + _has_scramble = False + + def process_mmap(self): + self._memobj = bitwise.parse(MEM_FORMAT + BF1900_SETTINGS2, self._mmap) + + @classmethod + def match_model(cls, filedata, filename): + # This model is only ever matched via metadata + return False + + +@directory.register +class BF1904Radio(BF1901Radio): + VENDOR = "Baofeng" + MODEL = "BF-1904" + ALIASES = [] + + # TODO: Is it 1 watt? + POWER_LEVELS = [chirp_common.PowerLevel("Low", watts=1.00), + chirp_common.PowerLevel("High", watts=10.00)] + + @classmethod + def match_model(cls, filedata, filename): + # This model is only ever matched via metadata + return False + + +@directory.register +class MAVERICKRA100Radio(BFM4Radio): + VENDOR = "Maverick" + MODEL = "RA-100" + ALIASES = [] + + @classmethod + def match_model(cls, filedata, filename): + # This model is only ever matched via metadata + return False + + +@directory.register +class MAVERICKRA425Radio(BF1904Radio): + VENDOR = "Maverick" + MODEL = "RA-425" + ALIASES = [] + _has_fm = False + + @classmethod + def match_model(cls, filedata, filename): + # This model is only ever matched via metadata + return False diff --git a/chirp/drivers/hf90.py b/chirp/drivers/hf90.py new file mode 100644 index 0000000..2c0b6fc --- /dev/null +++ b/chirp/drivers/hf90.py @@ -0,0 +1,571 @@ +# Copyright 2023 Finn Thain +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +from chirp import chirp_common, bitwise, memmap, errors, directory, util +from chirp.settings import RadioSettingGroup, RadioSetting +from chirp.settings import RadioSettingValueList, RadioSettingValueBoolean +from chirp.settings import RadioSettingValueInteger, RadioSettings + +import logging + +LOG = logging.getLogger(__name__) + +HF90_MEM_FORMAT = """ +#seekto 0x1800; +struct { + u8 type:1, f_p_program:1, unknown1:1, auto_tune:1, + tx_power:2, unknown2:1, mode_toggle:1; + u8 unknown3; + u24 pin; + u16 selcall_id; + u8 unknown4; +} settings; + +struct { + u8 unknown5:3, tx_equals_rx:1, usb:1, scan:1, selcall:1, alarm:1; + ul16 rx0_15; + u8 tx0_3:4, rx16_19:4; + ul16 tx4_19; + ul16 vnum; +} memory[255]; +""" + +HF90_CONFIG_ADDR = 0x1800 +HF90_CONFIG_LEN = 0x800 + + +def to_ihex(addr, kind, data): + rec = [len(data) & 0xff, (addr >> 8) & 0xff, addr & 0xff, kind & 0xff] + for d in data: + rec.append(d) + csum = 0 + for n in rec: + csum += n + rec.append((-csum) & 0xff) + return rec + + +def reset_buffer(pipe): + pipe.reset_input_buffer() + timeout = pipe.timeout + pipe.timeout = 0.05 + junk = pipe.read(32) + count = len(junk) + if count > 0: + LOG.debug("reset_buffer: discarded %d bytes" % count) + LOG.debug(util.hexprint(junk)) + junk = pipe.read(1) + count = len(junk) + pipe.timeout = timeout + if count > 0: + raise errors.RadioError("Unable to clean serial buffer. " + "Please check your serial port selection.") + + +class HF90StyleRadio(chirp_common.CloneModeRadio, + chirp_common.ExperimentalRadio): + """Base class for HF-90 radio variants""" + VENDOR = "Q-MAC" + MODEL = "HF-90" + MODES = ["LSB", "USB"] + DUPLEX = ["", "+", "-", "split", "off"] + BAUD_RATE = 4800 + NEEDS_COMPAT_SERIAL = False + + HF90_POWER_LEVELS = ["Low", "High"] + + _memsize = HF90_CONFIG_ADDR + HF90_CONFIG_LEN + _lower = 1 + _upper = 255 + + def _send(self, data): + LOG.debug("PC->R: (%2i)\n%s" % (len(data), util.hexprint(data))) + self.pipe.write(data) + echo = self.pipe.read(len(data)) + if echo != data: + LOG.error("Bad echo: (%2i)\n%s" % (len(data), util.hexprint(data))) + + def _read(self, length): + data = self.pipe.read(length) + LOG.debug("R->PC: (%2i)\n%s" % (len(data), util.hexprint(data))) + return data + + def _serial_prompt(self): + reset_buffer(self.pipe) + self._send(b'\r') + return self._read(3) == b'\r\n#' + + def _download_chunk(self, addr): + if addr % 16: + raise Exception("Addr 0x%04x not on 16-byte boundary" % addr) + + # Response format: + # 1. Four-digit address, followed by a space + # 2. 16 pairs of hex digits, each pair followed by a space + # 3. One additional space + # 4. 16 char ASCII representation + # 5. \r\n + resp_len = 5 + 48 + 1 + 16 + 2 + + resp = self._read(resp_len).strip() + if b' ' not in resp: + raise errors.RadioError("Incorrect data received from radio") + words = resp.split(b' ') + if addr != int(words[0], 16): + raise errors.RadioError("Incorrect address received from radio") + data = [] + for hh in words[1:17]: + data.append(int(hh, 16)) + + if len(data) != 16: + LOG.debug(data) + raise errors.RadioError("Radio sent %d bytes" % len(data)) + + return bytes(data) + + def _download(self, limit): + self.pipe.baudrate = self.BAUD_RATE + if not self._serial_prompt(): + raise errors.RadioError("Did not get initial prompt from radio") + + data = b'\x00' * HF90_CONFIG_ADDR + + cmd = b'D%04X%04X' % (HF90_CONFIG_ADDR, limit - HF90_CONFIG_ADDR) + self._send(cmd) + + resp = self._read(2) + if resp != b'\r\n': + raise errors.RadioError("Incorrect separator received from radio") + + for addr in range(HF90_CONFIG_ADDR, limit, 16): + data += self._download_chunk(addr) + + if self.status_fn: + status = chirp_common.Status() + status.cur = addr + 16 - HF90_CONFIG_ADDR + status.max = limit - HF90_CONFIG_ADDR + status.msg = "Downloading from radio" + self.status_fn(status) + + resp = self._read(3) + if resp != b'\r\n#': + raise errors.RadioError("Incorrect response from radio") + + return memmap.MemoryMapBytes(data) + + def _upload_chunk(self, addr): + if addr % 16: + raise Exception("Addr 0x%04x not on 16-byte boundary" % addr) + + data = self._mmap.get_byte_compatible()[addr:addr + 16] + ihex_rec = to_ihex(addr, 0, list(data[0:16])) + cmd = b':' + b''.join(b'%02X' % b for b in ihex_rec) + LOG.debug(cmd) + self._send(cmd) + + resp = self._read(4) + if resp != b'\x13\x11\r\n': + LOG.debug(util.hexprint(resp)) + raise errors.RadioError("Did not receive ack from radio") + + def _upload(self, limit): + self.pipe.baudrate = self.BAUD_RATE + if not self._serial_prompt(): + raise errors.RadioError("Did not get initial prompt from radio") + + timeout = self.pipe.timeout + self.pipe.timeout = 1 + + self._send(b'L0000') + + resp = self._read(4) + if resp != b'\r\n\r\n': + raise errors.RadioError("Did not get initial response from radio") + + for addr in range(HF90_CONFIG_ADDR, limit, 16): + self._upload_chunk(addr) + + if self.status_fn: + status = chirp_common.Status() + status.cur = addr + 16 - HF90_CONFIG_ADDR + status.max = limit - HF90_CONFIG_ADDR + status.msg = "Uploading to radio" + self.status_fn(status) + + self._send(b':00000001FF\r') + + resp = self._read(5) + if resp != b'\r\n\r\n#': + raise errors.RadioError("Did not get final response from radio") + + # Reset radio + # self._send(b'E') + + self.pipe.timeout = timeout + + def process_mmap(self): + self._memobj = bitwise.parse(HF90_MEM_FORMAT, self._mmap) + + def sync_in(self): + try: + self._mmap = self._download(self._memsize) + except errors.RadioError: + raise + except Exception as e: + raise errors.RadioError("Failed to communicate with radio: %s" % e) + self.process_mmap() + + def sync_out(self): + if self._memobj is None: + self.process_mmap() + + highest_nonempty = None + lowest_empty = None + for i in range(self._lower, self._upper + 1): + m = self.get_memory(i) + if m.empty: + if lowest_empty is None: + lowest_empty = i + else: + highest_nonempty = i + msgs = self.validate_memory(m) + if msgs: + raise Exception("Memory %d failed validation: %s" % + (i, ", ".join(msgs))) + + if highest_nonempty is None: + raise Exception("Cannot upload with no channels defined") + if isinstance(self, EarlyHF90Radio): + if lowest_empty is not None and lowest_empty < highest_nonempty: + raise Exception( + "Cannot upload with gaps between defined channels") + + try: + self._upload(self._memsize) + except errors.RadioError: + raise + except Exception as e: + raise errors.RadioError("Failed to communicate with radio: %s" % e) + + def get_raw_memory(self, number): + return repr(self._memobj.memory[number - 1]) + + @classmethod + def match_model(cls, filedata, filename): + return False + + @classmethod + def get_prompts(cls): + rp = chirp_common.RadioPrompts() + rp.experimental = ("This radio driver is currently under development." + "\nThere are no known issues with it, but you " + "should proceed with caution.\n") + rp.pre_download = ("Follow these instructions to down/upload:\n" + "1. Turn off your radio.\n" + "2. Connect the serial interface cable.\n" + "3. Turn on your radio.\n" + "4. Hold down 'CHAN UP' and 'CHAN DOWN' buttons " + "until 'RS-232' is displayed.\n" + "5. Click OK to proceed.\n" + "6. After the process completes, cycle power on " + "the radio to exit RS-232 mode.\n" + "Please refer to the CHIRP wiki for information " + "about HF-90 serial port compatibility issues.\n") + rp.pre_upload = rp.pre_download + return rp + + def get_features(self): + rf = chirp_common.RadioFeatures() + rf.can_odd_split = True + rf.has_bank = False + rf.has_ctone = False + rf.has_dtcs = False + rf.has_dtcs_polarity = False + rf.has_name = False + rf.has_nostep_tuning = True + rf.has_settings = True + rf.has_tuning_step = False + rf.memory_bounds = (self._lower, self._upper) + rf.valid_bands = self.BANDS + rf.valid_cross_modes = [] + rf.valid_duplexes = list(self.DUPLEX) + rf.valid_modes = list(self.MODES) + rf.valid_skips = [] + rf.valid_tmodes = [] + rf.valid_tones = [] + # TODO how does one make the Tone column go away? + return rf + + def apply_txpower(self, setting, obj): + v = setting.value + LOG.debug("apply_power: %s" % v) + obj.tx_power = 3 * self.HF90_POWER_LEVELS.index(str(v)) + + def apply_type(self, setting, obj): + v = setting.value + LOG.debug("apply_type: %s %d" % (v, obj.type)) + obj.type = self.HF90_TYPES.index(str(v)) + + def apply_selcall_id(self, setting, obj): + v = setting.value + LOG.debug("apply_selcall_id: %s %x" % (v, obj.selcall_id)) + if isinstance(self, EarlyHF90Radio): + # BCD, big endian, left aligned, "f" padded + s = "%-4d" % int(v) + s = s.replace(" ", "f") + else: + # BCD, big endian, right aligned, "0" padded + s = "%04d" % int(v) + obj.selcall_id = int(s[0:4], 16) + + def _get_selcall_id(self, _settings): + s = "%04x" % _settings.selcall_id + try: + i = int(s.rstrip("f")) + except ValueError: + i = 9999 + return i + + def get_settings(self): + _settings = self._memobj.settings + + LOG.debug("get_settings: %s %s" % (type(self), self.MODEL)) + + grp = RadioSettingGroup("settings", "Settings") + + rs = RadioSetting("type", "Type", + RadioSettingValueList( + self.HF90_TYPES, + self.HF90_TYPES[_settings.type])) + rs.set_apply_callback(self.apply_type, _settings) + grp.append(rs) + + if isinstance(self, EarlyHF90Radio): + rs = RadioSetting("selcall_id", "Selcall ID (0 for standard type)", + RadioSettingValueInteger( + 0, 9999, + self._get_selcall_id(_settings))) + rs.set_apply_callback(self.apply_selcall_id, _settings) + grp.append(rs) + else: + rs = RadioSetting("selcall_id", "Selcall ID", + RadioSettingValueInteger( + 1, 9999, + self._get_selcall_id(_settings))) + rs.set_apply_callback(self.apply_selcall_id, _settings) + grp.append(rs) + + rs = RadioSetting("f_p_program", "Front panel programming", + RadioSettingValueBoolean(_settings.f_p_program)) + grp.append(rs) + + rs = RadioSetting("auto_tune", "Auto tuning", + RadioSettingValueBoolean(_settings.auto_tune)) + grp.append(rs) + + rs = RadioSetting("mode_toggle", "Mode toggling", + RadioSettingValueBoolean(_settings.mode_toggle)) + grp.append(rs) + + hp = int(_settings.tx_power == 3) + rs = RadioSetting("tx_power", "Tx Power", + RadioSettingValueList(self.HF90_POWER_LEVELS, + self.HF90_POWER_LEVELS[hp])) + rs.set_apply_callback(self.apply_txpower, _settings) + grp.append(rs) + + return RadioSettings(grp) + + def set_settings(self, uisettings): + _settings = self._memobj.settings + + for element in uisettings: + if not isinstance(element, RadioSetting): + self.set_settings(element) + continue + if not element.changed(): + continue + + try: + name = element.get_name() + value = element.value + + if element.has_apply_callback(): + LOG.debug("Using apply callback") + element.run_apply_callback() + else: + setattr(_settings, name, value) + + LOG.debug("Setting %s: %s" % (name, value)) + except Exception: + LOG.debug(element.get_name()) + raise + + def get_memory(self, number): + _mem = self._memobj.memory[number - 1] + + mem = chirp_common.Memory() + mem.number = number + + _rx = _mem.rx0_15 | (_mem.rx16_19 << 16) + _tx = _mem.tx0_3 | (_mem.tx4_19 << 4) + + mem.empty = _rx == 0 or _mem.vnum == 0 + + if not mem.empty: + if (_tx == _rx) ^ _mem.tx_equals_rx: + LOG.warn("get_memory(%d): tx_equals_rx incorrect" % number) + if 0 < _rx * 100 < self._min_rx_freq: + LOG.warn("get_memory(%d): rx frequency too low" % number) + if _rx * 100 >= self._max_freq: + LOG.warn("get_memory(%d): rx frequency too high" % number) + if 0 < _tx * 100 < self._min_tx_freq: + LOG.warn("get_memory(%d): tx frequency too low" % number) + if _tx * 100 >= self._max_freq: + LOG.warn("get_memory(%d): tx frequency too high" % number) + + mem.freq = int(_rx) * 100 + + if _tx == 0: + mem.duplex = "off" + mem.offset = 0 + elif _tx > _rx: + mem.duplex = "+" + mem.offset = (int(_tx) - int(_rx)) * 100 + elif _tx < _rx: + mem.duplex = "-" + mem.offset = (int(_rx) - int(_tx)) * 100 + else: + mem.duplex = "" + mem.offset = 0 + + if _mem.usb: + mem.mode = "USB" + else: + mem.mode = "LSB" + + n = _mem.vnum & 0xff + if n == 0: + n = number + + rsg = RadioSettingGroup("Extra", "extra") + rs = RadioSetting("vnum", "Number", + RadioSettingValueInteger(self._lower, + self._upper, n)) + rsg.append(rs) + rs = RadioSetting("selcall", "Selcall", + RadioSettingValueBoolean(_mem.selcall)) + rsg.append(rs) + rs = RadioSetting("scan", "Scan", + RadioSettingValueBoolean(_mem.scan)) + rsg.append(rs) + mem.extra = rsg + + return mem + + def _get_tx_freq(self, mem): + if mem.duplex == "": + return mem.freq + elif mem.duplex == "split": + return mem.offset + elif mem.duplex == "+": + return mem.freq + mem.offset + elif mem.duplex == "-": + return mem.freq - mem.offset + return 0 + + def set_memory(self, mem): + _mem = self._memobj.memory[mem.number - 1] + + _mem.set_raw("\x00" * 8) + + if mem.empty: + return + + rx = int(mem.freq / 100) + tx = int(self._get_tx_freq(mem) / 100) + + _mem.tx_equals_rx = tx == rx + + _mem.rx0_15 = (rx >> 0) & 0xffff + _mem.rx16_19 = (rx >> 16) & 0xf + + _mem.tx0_3 = (tx >> 0) & 0xf + _mem.tx4_19 = (tx >> 4) & 0xffff + + _mem.usb = mem.mode == "USB" + + _mem.vnum = mem.number + + for setting in mem.extra: + setattr(_mem, setting.get_name(), int(setting.value)) + + def validate_memory(self, mem): + msgs = chirp_common.CloneModeRadio.validate_memory(self, mem) + + if 0 < self._get_tx_freq(mem) < self._min_tx_freq: + msgs.append(chirp_common.ValidationWarning( + "tx frequency too low")) + + if mem.extra and isinstance(self, EarlyHF90Radio): + if self._memobj.settings.selcall_id == 0x0fff: + if mem.extra["scan"].value or mem.extra["selcall"].value: + msgs.append(chirp_common.ValidationWarning( + "standard type but scan or selcall enabled")) + else: + if mem.extra["scan"].value and not mem.extra["selcall"].value: + msgs.append(chirp_common.ValidationWarning( + "scan enabled but selcall disabled")) + + return msgs + + +# EarlyHF90Radio imitates version 2 of the dealer software whereas +# LateHF90Radio imitates version 3. It seems both are needed because +# version 3 warns that it is incompatible with firmware revisions below V301. +# Unfortunately, the author does not have access to the technical information +# required to better accommodate the quirks of the various firmware revisions. + +@directory.register +class EarlyHF90Radio(HF90StyleRadio): + """Base class for early HF-90 radios""" + VARIANT = "v300 or earlier" + _min_rx_freq = 2000000 + _min_tx_freq = 2000000 + _max_freq = 30000000 + BANDS = [(_min_rx_freq, _max_freq)] + HF90_TYPES = ["HF-90A (Australia)", "HF-90E (Export)"] + + +@directory.register +class LateHF90Radio(HF90StyleRadio): + """Base class for late HF-90 radios""" + VARIANT = "v301 or later" + _min_rx_freq = 500000 + _min_tx_freq = 1800000 + _max_freq = 30000000 + # band is split into two pieces to avoid unit test failures + BANDS = [(_min_rx_freq, _min_tx_freq), (_min_tx_freq, _max_freq)] + HF90_TYPES = ["Standard", "Advanced"] + + +if __name__ == "__main__": + import sys + import serial + s = serial.Serial(port=sys.argv[1], baudrate=4800, timeout=0.1) + reset_buffer(s) + s.write(b"\r") + print(s.read(32)) + print(s.out_waiting) diff --git a/chirp/drivers/hg_uv98.py b/chirp/drivers/hg_uv98.py index d95608c..7b14ce1 100644 --- a/chirp/drivers/hg_uv98.py +++ b/chirp/drivers/hg_uv98.py @@ -20,8 +20,6 @@ # KG7KMV and Bartłomiej Zieliński # Based on the implementation of Kenwood TK-8102 -from builtins import bytes -import os import logging import struct @@ -29,10 +27,22 @@ from chirp import chirp_common, directory, memmap, errors, util from chirp import bitwise from chirp.settings import RadioSettingGroup, RadioSetting from chirp.settings import RadioSettingValueBoolean, RadioSettingValueList -from chirp.settings import RadioSettingValueString, RadioSettings +from chirp.settings import RadioSettings LOG = logging.getLogger(__name__) +# Gross hack to handle missing future module on un-updatable +# platforms like MacOS. Just avoid registering these radio +# classes for now. +try: + from builtins import bytes + has_future = True +except ImportError: + has_future = False + LOG.debug('python-future package is not ' + 'available; %s requires it' % __name__) + + MEM_FORMAT = """ #seekto 0x0000; struct { @@ -308,7 +318,6 @@ class RadioSettingValueChannel(RadioSettingValueList): return int(self.get_value().partition(" ")[0]) -@directory.register class LanchonlhHG_UV98(chirp_common.CloneModeRadio, chirp_common.ExperimentalRadio): """ Lanchonlh HG-UV98 @@ -895,3 +904,7 @@ class LanchonlhHG_UV98(chirp_common.CloneModeRadio, chirp_common.ExperimentalRad if hasattr(_settings, name): setattr(_settings, name, value) + + +if has_future: + LanchonlhHG_UV98 = directory.register(LanchonlhHG_UV98) diff --git a/chirp/drivers/hobbypcb.py b/chirp/drivers/hobbypcb.py index 7d7779b..128f19e 100644 --- a/chirp/drivers/hobbypcb.py +++ b/chirp/drivers/hobbypcb.py @@ -16,8 +16,7 @@ import logging import time -from chirp import chirp_common, directory, memmap, errors -from chirp import bitwise +from chirp import chirp_common, directory, errors from chirp.settings import RadioSetting, RadioSettingGroup, \ RadioSettingValueInteger, RadioSettingValueList, \ RadioSettingValueBoolean, RadioSettingValueString, \ @@ -33,16 +32,16 @@ TONE_MODES = ['', 'Tone', 'TSQL', ''] def detect_baudrate(radio): bauds = list(BAUDS) - bauds.remove(radio.pipe.getBaudrate()) - bauds.insert(0, radio.pipe.getBaudrate()) + bauds.remove(radio.pipe.baudrate) + bauds.insert(0, radio.pipe.baudrate) for baud in bauds: - radio.pipe.setBaudrate(baud) - radio.pipe.setTimeout(0.5) - radio.pipe.write('\rFW?\r') + radio.pipe.baudrate = baud + radio.pipe.timeout = 0.5 + radio.pipe.write(b'\rFW?\r') resp = radio.pipe.read(2) - if resp.strip().startswith('FW'): + if resp.strip().startswith(b'FW'): resp += radio.pipe.read(16) - LOG.info('HobbyPCB %s at baud rate %i' % (resp.strip(), baud)) + LOG.info('HobbyPCB %r at baud rate %i' % (resp.strip(), baud)) return baud @@ -52,24 +51,26 @@ class HobbyPCBRSUV3Radio(chirp_common.LiveRadio): VENDOR = "HobbyPCB" MODEL = "RS-UV3" BAUD_RATE = 19200 + NEEDS_COMPAT_SERIAL = False def __init__(self, *args, **kwargs): super(HobbyPCBRSUV3Radio, self).__init__(*args, **kwargs) if self.pipe: baud = detect_baudrate(self) if not baud: - errors.RadioError('Radio did not respond') + raise errors.RadioError('Radio did not respond') def _cmd(self, command, rsize=None): + command = command.encode() LOG.debug('> %s' % command) - self.pipe.write('%s\r' % command) - resp = '' + self.pipe.write(b'%s\r' % command) + resp = b'' if rsize is None: - complete = lambda: False + complete = lambda: time.sleep(0.1) is None elif rsize == 0: rsize = 1 - complete = lambda: resp.endswith('\r') + complete = lambda: resp.endswith(b'\r') else: complete = lambda: len(resp) >= rsize @@ -79,7 +80,7 @@ class HobbyPCBRSUV3Radio(chirp_common.LiveRadio): break resp += chunk LOG.debug('< %r [%i]' % (resp, len(resp))) - return resp.strip() + return resp.decode().strip() def get_features(self): rf = chirp_common.RadioFeatures() @@ -103,7 +104,7 @@ class HobbyPCBRSUV3Radio(chirp_common.LiveRadio): def get_memory(self, number): _mem = self._cmd('CP%i' % number, 33).split('\r') - LOG.debug('Memory elements: %s' % _mem) + LOG.debug('Memory elements: %r' % _mem) mem = chirp_common.Memory() mem.number = number mem.freq = int(_mem[0]) * 1000 @@ -137,7 +138,6 @@ class HobbyPCBRSUV3Radio(chirp_common.LiveRadio): self._cmd('TM%i' % TONE_MODES.index(mem.tmode)) self._cmd('TF%05i' % tone) self._cmd('PW%i' % POWER_LEVELS.index(mem.power)) - time.sleep(1) self._cmd('ST%i' % mem.number) def get_settings(self): @@ -182,7 +182,7 @@ class HobbyPCBRSUV3Radio(chirp_common.LiveRadio): tg = RadioSetting('TG%7s', 'CW Timeout Message', RadioSettingValueString(0, 7, - _get('TG'))) + _get('TG'))) cw.append(tg) io = RadioSettingGroup('io', 'IO') diff --git a/chirp/drivers/ic208.py b/chirp/drivers/ic208.py index e972503..c7b088a 100644 --- a/chirp/drivers/ic208.py +++ b/chirp/drivers/ic208.py @@ -14,7 +14,7 @@ # along with this program. If not, see . from chirp.drivers import icf -from chirp import chirp_common, errors, directory, bitwise +from chirp import chirp_common, directory, bitwise MEM_FORMAT = """ struct memory { diff --git a/chirp/drivers/ic2100.py b/chirp/drivers/ic2100.py index 7525ebf..0fc2181 100644 --- a/chirp/drivers/ic2100.py +++ b/chirp/drivers/ic2100.py @@ -16,9 +16,7 @@ from chirp.drivers import icf from chirp import chirp_common, util, directory, bitwise, memmap from chirp.settings import RadioSetting, RadioSettingGroup, \ - RadioSettingValueInteger, RadioSettingValueList, \ - RadioSettingValueBoolean, RadioSettingValueString, \ - RadioSettingValueFloat, InvalidValueError, RadioSettings + RadioSettingValueBoolean MEM_FORMAT = """ struct { @@ -120,7 +118,7 @@ def _get_freq(mem): elif mem.freq_1khz == 7: freq += 500 else: - raise Exception("Unable to resolve 12.5kHz: %i" % freq) + raise Exception("Unable to resolve 12.5 kHz: %i" % freq) return freq @@ -244,12 +242,13 @@ class IC2100Radio(icf.IcomCloneModeRadio): return mem def set_memory(self, mem): - if mem.number == "C": + number = mem.extd_number or mem.number + if number == "C": _mem = self._memobj.call[0] - elif isinstance(mem.number, str): - _mem = self._memobj.special[_get_special[mem.number] - 500] + elif isinstance(number, str): + _mem = self._memobj.special[_get_special()[number] - 500] else: - number = mem.number - 1 + number = number - 1 _mem = self._memobj.memory[number] _emt = self._memobj.usedflags[number / 8].flagbits mask = 1 << (number % 8) diff --git a/chirp/drivers/ic2300.py b/chirp/drivers/ic2300.py index 5969da5..8b0a0ab 100644 --- a/chirp/drivers/ic2300.py +++ b/chirp/drivers/ic2300.py @@ -18,7 +18,7 @@ from chirp.drivers import icf from chirp.settings import RadioSetting, RadioSettingGroup, \ RadioSettingValueList, RadioSettingValueBoolean, RadioSettings -# The Icom IC-2300H is a 65W, 144MHz mobile transceiver based on the IC-2200H. +# The Icom IC-2300H is a 65W, 144 MHz mobile transceiver based on the IC-2200H. # Unlike the IC-2200H, this model does not accept Icom's UT-118 D-STAR board. # # A simple USB interface based on a typical FT232RL breakout board was used @@ -40,7 +40,7 @@ from chirp.settings import RadioSetting, RadioSettingGroup, \ # +------------| GND | # `------------------' # -# D1: 1N4148 shottky diode +# D1: 1N4148 Schottky diode # R1: 10K ohm resistor MEM_FORMAT = """ @@ -135,7 +135,7 @@ class IC2300Radio(icf.IcomCloneModeRadio): rf.valid_tmodes = list(TONE_MODES) rf.valid_duplexes = list(DUPLEX) rf.valid_tuning_steps = list(TUNING_STEPS) - rf.valid_bands = [(136000000, 174000000)] # USA tx range: 144-148MHz + rf.valid_bands = [(136000000, 174000000)] # USA tx range: 144-148 MHz rf.valid_skips = ["", "S"] rf.valid_power_levels = POWER_LEVELS rf.has_settings = True @@ -190,7 +190,8 @@ class IC2300Radio(icf.IcomCloneModeRadio): # Tx inhibit tx_inhibit = RadioSetting("tx_inhibit", "TX inhibit", - RadioSettingValueBoolean(bool(_mem.tx_inhibit))) + RadioSettingValueBoolean( + bool(_mem.tx_inhibit))) tx_inhibit.set_doc("TX inhibit") mem.extra.append(tx_inhibit) diff --git a/chirp/drivers/ic2720.py b/chirp/drivers/ic2720.py index 30f4a8e..5d0e459 100644 --- a/chirp/drivers/ic2720.py +++ b/chirp/drivers/ic2720.py @@ -14,7 +14,7 @@ # along with this program. If not, see . from chirp.drivers import icf -from chirp import chirp_common, util, directory, bitwise +from chirp import chirp_common, directory, bitwise MEM_FORMAT = """ struct { diff --git a/chirp/drivers/ic2730.py b/chirp/drivers/ic2730.py index 3d80a18..16036c3 100644 --- a/chirp/drivers/ic2730.py +++ b/chirp/drivers/ic2730.py @@ -17,16 +17,13 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import struct import logging from chirp.drivers import icf -from chirp import chirp_common, util, directory, bitwise, memmap -from chirp import errors +from chirp import chirp_common, directory, bitwise from chirp.settings import RadioSettingGroup, RadioSetting, \ RadioSettingValueBoolean, RadioSettingValueList, \ RadioSettingValueString, RadioSettingValueInteger, \ - RadioSettingValueFloat, RadioSettings, InvalidValueError -from textwrap import dedent + RadioSettingValueFloat, RadioSettings LOG = logging.getLogger(__name__) @@ -277,7 +274,7 @@ def _wipe_memory(mem, char): @directory.register -class IC2730Radio(icf.IcomRawCloneModeRadio): +class IC2730Radio(icf.IcomCloneModeRadio): """Icom IC-2730A""" VENDOR = "Icom" MODEL = "IC-2730A" @@ -293,6 +290,15 @@ class IC2730Radio(icf.IcomRawCloneModeRadio): _num_banks = 10 _bank_class = IC2730Bank _can_hispeed = True + _raw_frames = True + _highbit_flip = True + + _icf_data = { + 'MapRev': 1, + 'EtcData': 0, # This might be wrong + 'Comment': '', + 'recordsize': 32, + } @classmethod def get_prompts(cls): @@ -302,27 +308,23 @@ class IC2730Radio(icf.IcomRawCloneModeRadio): 'The Pocket Beep tone/dtcs modes are not supported by ' 'CHIRP. Set those manually.\n') - rp.pre_download = _(dedent("""\ - Follow these instructions to download your config: - - 1 - Turn off your radio - 2 - Connect your interface cable to the Speaker-2 jack - 3 - Turn on your radio - 4 - Radio > Download from radio - 5 - Disconnect the interface cable! Otherwise there will be - no right-side audio! - """)) - rp.pre_upload = _(dedent("""\ - Follow these instructions to upload your config: - - 1 - Turn off your radio - 2 - Connect your interface cable to the Speaker-2 jack - 3 - Turn on your radio - 4 - Radio > Upload to radio - 5 - Disconnect the interface cable, otherwise there will be - no right-side audio! - 6 - Cycle power on the radio to exit clone mode - """)) + rp.pre_download = _( + "Follow these instructions to download your config:\n" + "1 - Turn off your radio\n" + "2 - Connect your interface cable to the Speaker-2 jack\n" + "3 - Turn on your radio\n" + "4 - Radio > Download from radio\n" + "5 - Disconnect the interface cable! Otherwise there will be\n" + " no right-side audio!\n") + rp.pre_upload = _( + "Follow these instructions to upload your config:\n" + "1 - Turn off your radio\n" + "2 - Connect your interface cable to the Speaker-2 jack\n" + "3 - Turn on your radio\n" + "4 - Radio > Upload to radio\n" + "5 - Disconnect the interface cable, otherwise there will be\n" + " no right-side audio!\n" + "6 - Cycle power on the radio to exit clone mode\n") return rp def _get_bank(self, loc): @@ -863,7 +865,7 @@ class IC2730Radio(icf.IcomRawCloneModeRadio): other.append(rset) rx = RadioSettingValueBoolean(bool(_sets.toneburst)) - rset = RadioSetting("settings.toneburst", "1750 Htz Tone Burst", rx) + rset = RadioSetting("settings.toneburst", "1750 Hz Tone Burst", rx) other.append(rset) rx = RadioSettingValueBoolean(bool(_sets.ifxchg)) @@ -1303,7 +1305,7 @@ class IC2730Radio(icf.IcomRawCloneModeRadio): stx += "%0d, " % nx elif (nx >= 8) and (nx < 16): if (_pslg[kx].msk[1] & (1 << (nx - 8))): - sstx += "%0d, " % nx + stx += "%0d, " % nx elif (nx >= 16) and (nx < 24): if (_pslg[kx].msk[2] & (1 << (nx - 16))): stx += "%0d, " % nx @@ -1354,6 +1356,6 @@ class IC2730Radio(icf.IcomRawCloneModeRadio): elif element.value.get_mutable(): LOG.debug("Setting %s = %s" % (setting, element.value)) setattr(obj, setting, element.value) - except Exception as e: + except Exception: LOG.debug(element.get_name()) raise diff --git a/chirp/drivers/ic2820.py b/chirp/drivers/ic2820.py index 315436b..c3cd23d 100644 --- a/chirp/drivers/ic2820.py +++ b/chirp/drivers/ic2820.py @@ -176,7 +176,7 @@ class IC2820Radio(icf.IcomCloneModeRadio, chirp_common.IcomDstarSupport): rf.has_bank_names = True rf.requires_call_lists = False rf.memory_bounds = (0, 499) - rf.valid_modes = list(MODES) + rf.valid_modes = [x for x in MODES if '?' not in x] rf.valid_tmodes = list(TMODES) rf.valid_duplexes = list(set(DUPLEX)) rf.valid_tuning_steps = list(chirp_common.TUNING_STEPS) @@ -220,8 +220,7 @@ class IC2820Radio(icf.IcomCloneModeRadio, chirp_common.IcomDstarSupport): mem.skip = "P" else: mem.extd_number = util.get_dict_rev(_get_special(), number) - mem.immutable = ["number", "skip", "bank", "bank_index", - "extd_number"] + mem.immutable = ["number", "skip", "extd_number"] if not is_used: mem.empty = True @@ -268,7 +267,8 @@ class IC2820Radio(icf.IcomCloneModeRadio, chirp_common.IcomDstarSupport): if mem.empty: _used |= bitpos _wipe_memory(_mem, "\xFF") - self._set_bank(mem.number, None) + if mem.number < 500: + self._set_bank(mem.number, None) return _used &= ~bitpos diff --git a/chirp/drivers/ic9x.py b/chirp/drivers/ic9x.py index fc52560..362df75 100644 --- a/chirp/drivers/ic9x.py +++ b/chirp/drivers/ic9x.py @@ -16,6 +16,7 @@ import time import threading import logging +import uuid from chirp.drivers import ic9x_ll, icf from chirp import chirp_common, errors, util, directory @@ -48,9 +49,55 @@ IC9X_SPECIAL = { } CHARSET = chirp_common.CHARSET_ALPHANUMERIC + \ - "!\"#$%&'()*+,-./:;<=>?@[\]^_`{|}~" + "!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~" -LOCK = threading.Lock() + +class Lock: + """Maintains the state of an ic9x + + This makes sure that only one RadioThread accesses the radio at one + time. It also keeps track of the last successful unlock of the radio + so that we know when to re-send the magic wakeup sequence. + """ + def __init__(self): + self.lock = threading.Lock() + self.id = str(uuid.uuid4()) + self._last = 0 + + def __enter__(self): + LOG.debug('%s locking', self.id) + self.lock.acquire() + LOG.debug('%s locked', self.id) + + def __exit__(self, exc_type, exc_value, exc_tb): + self.lock.release() + if exc_type is None: + self._last = time.time() + LOG.debug('%s unlocked success=%s', self.id, exc_type is None) + + def __repr__(self): + return '' % self.id + + @property + def stale(self): + return time.time() - self._last > 4 + + +def locked(fn): + """Decorator for operations that talk to the radio. + + Runs them with the lock and sends the magic wakeup if the timer is + expired. + """ + def _lock(self, *a, **k): + with self._lock: + LOG.debug('Locked for %s', fn.__name__) + if self._lock.stale: + LOG.debug('Doing wakeup') + self._init() + r = fn(self, *a, **k) + return r + return _lock class IC9xBank(icf.IcomNamedBank): @@ -69,10 +116,10 @@ class IC9xBank(icf.IcomNamedBank): class IC9xRadio(icf.IcomLiveRadio): """Base class for Icom IC-9x radios""" MODEL = "IC-91/92AD" + NEEDS_COMPAT_SERIAL = False _model = "ic9x" # Fake model info for detect.py vfo = 0 - __last = 0 _upper = 300 _num_banks = 26 @@ -96,24 +143,40 @@ class IC9xRadio(icf.IcomLiveRadio): mem._bank_index = index self.set_memory(mem) - def __init__(self, *args, **kwargs): - icf.IcomLiveRadio.__init__(self, *args, **kwargs) + def _init(self): + """Does the magic wakeup dance""" + self.pipe.baudrate = 4800 + self.pipe.timeout = 1 + for i in range(5): + buf = (b'\xfe' * 8) * 20 + ( + b'\xfe\xfe\x01\x80\x19\xfd') + self.pipe.write(buf) + time.sleep(0.1) + resp = self.pipe.read(5) + if b'\x80\x01\x19' in resp: + LOG.debug('Radio responded to wakeup attempt %i' % (i + 1)) + self.pipe.baudrate = 38400 + while True: + r = ic9x_ll.ic9x_recv(self.pipe) + if not r: + break + LOG.debug('Got post-wakeup response: %r' % r) + return + time.sleep(1) + LOG.warning('Made %i attempts to wake radio', i + 1) + raise errors.RadioError('Radio not responding') - if self.pipe: - self.pipe.timeout = 0.1 + def __init__(self, *args, **kwargs): + if 'lock' in kwargs: + self._lock = kwargs.pop('lock') + else: + self._lock = Lock() + super().__init__(*args, **kwargs) self.__memcache = {} self.__bankcache = {} - global LOCK - self._lock = LOCK - - def _maybe_send_magic(self): - if (time.time() - self.__last) > 1: - LOG.debug("Sending magic") - ic9x_ll.send_magic(self.pipe) - self.__last = time.time() - + @locked def get_memory(self, number): if isinstance(number, str): try: @@ -128,20 +191,13 @@ class IC9xRadio(icf.IcomLiveRadio): if number in self.__memcache: return self.__memcache[number] - self._lock.acquire() try: - self._maybe_send_magic() mem = ic9x_ll.get_memory(self.pipe, self.vfo, number) except errors.InvalidMemoryLocation: mem = chirp_common.Memory() mem.number = number if number < self._upper: mem.empty = True - except: - self._lock.release() - raise - - self._lock.release() if number > self._upper or number < 0: mem.extd_number = util.get_dict_rev(IC9X_SPECIAL, @@ -153,17 +209,9 @@ class IC9xRadio(icf.IcomLiveRadio): return mem + @locked def get_raw_memory(self, number): - self._lock.acquire() - try: - ic9x_ll.send_magic(self.pipe) - mframe = ic9x_ll.get_memory_frame(self.pipe, self.vfo, number) - except: - self._lock.release() - raise - - self._lock.release() - + mframe = ic9x_ll.get_memory_frame(self.pipe, self.vfo, number) return repr(bitwise.parse(ic9x_ll.MEMORY_FRAME_FORMAT, mframe)) def get_memories(self, lo=0, hi=None): @@ -187,6 +235,7 @@ class IC9xRadio(icf.IcomLiveRadio): return memories + @locked def set_memory(self, _memory): # Make sure we mirror the DV-ness of the new memory we're # setting, and that we capture the Bank value of any currently @@ -199,43 +248,30 @@ class IC9xRadio(icf.IcomLiveRadio): else: if isinstance(_memory, chirp_common.DVMemory): memory = ic9x_ll.IC9xDVMemory() - memory.clone(self.get_memory(_memory.number)) else: memory = ic9x_ll.IC9xMemory() - memory.clone(self.get_memory(_memory.number)) - + try: + memory.clone(ic9x_ll.get_memory(self.pipe, self.vfo, + _memory.number)) + except errors.InvalidMemoryLocation: + pass memory.clone(_memory) - self._lock.acquire() - self._maybe_send_magic() - try: - if memory.empty: - ic9x_ll.erase_memory(self.pipe, self.vfo, memory.number) - else: - ic9x_ll.set_memory(self.pipe, self.vfo, memory) + if memory.empty: + ic9x_ll.erase_memory(self.pipe, self.vfo, memory.number) + else: + ic9x_ll.set_memory(self.pipe, self.vfo, memory) memory = ic9x_ll.get_memory(self.pipe, self.vfo, memory.number) - except: - self._lock.release() - raise - - self._lock.release() self.__memcache[memory.number] = memory + @locked def _ic9x_get_banks(self): if len(list(self.__bankcache.keys())) == 26: return [self.__bankcache[k] for k in sorted(self.__bankcache.keys())] - self._lock.acquire() - try: - self._maybe_send_magic() - banks = ic9x_ll.get_banks(self.pipe, self.vfo) - except: - self._lock.release() - raise - - self._lock.release() + banks = ic9x_ll.get_banks(self.pipe, self.vfo) i = 0 for bank in banks: @@ -244,6 +280,7 @@ class IC9xRadio(icf.IcomLiveRadio): return banks + @locked def _ic9x_set_banks(self, banks): if len(banks) != len(list(self.__bankcache.keys())): @@ -263,18 +300,11 @@ class IC9xRadio(icf.IcomLiveRadio): (chr(i + ord("A")), cached_names[i], banks[i])) if need_update: - self._lock.acquire() - try: - self._maybe_send_magic() - ic9x_ll.set_banks(self.pipe, self.vfo, banks) - except: - self._lock.release() - raise - - self._lock.release() + ic9x_ll.set_banks(self.pipe, self.vfo, banks) def get_sub_devices(self): - return [IC9xRadioA(self.pipe), IC9xRadioB(self.pipe)] + return [IC9xRadioA(self.pipe, lock=self._lock), + IC9xRadioB(self.pipe, lock=self._lock)] def get_features(self): rf = chirp_common.RadioFeatures() @@ -335,25 +365,26 @@ class IC9xRadioB(IC9xRadio, chirp_common.IcomDstarSupport): return rf def __init__(self, *args, **kwargs): - IC9xRadio.__init__(self, *args, **kwargs) + super().__init__(*args, **kwargs) self.__rcalls = [] self.__mcalls = [] self.__ucalls = [] + @locked def __get_call_list(self, cache, cstype, ulimit): if cache: return cache calls = [] - self._maybe_send_magic() for i in range(ulimit - 1): call = ic9x_ll.get_call(self.pipe, cstype, i+1) calls.append(call) return calls + @locked def __set_call_list(self, cache, cstype, ulimit, calls): for i in range(ulimit - 1): blank = " " * 8 @@ -371,7 +402,6 @@ class IC9xRadioB(IC9xRadio, chirp_common.IcomDstarSupport): if acall == bcall: continue # No change to this one - self._maybe_send_magic() ic9x_ll.set_call(self.pipe, cstype, i + 1, calls[i]) return calls diff --git a/chirp/drivers/ic9x_icf.py b/chirp/drivers/ic9x_icf.py index 3e3e3d5..03172ad 100644 --- a/chirp/drivers/ic9x_icf.py +++ b/chirp/drivers/ic9x_icf.py @@ -14,7 +14,7 @@ # along with this program. If not, see . from chirp.drivers import icf, ic9x_icf_ll -from chirp import chirp_common, util, directory, errors +from chirp import chirp_common, util, errors # Don't register as this module is used to load icf file from File-Open menu @@ -48,7 +48,7 @@ class IC9xICFRadio(chirp_common.CloneModeRadio): return ic9x_icf_ll.get_memory(self._mmap, number) def load_mmap(self, filename): - _mdata, self._mmap = icf.read_file(filename) + _icf_data, self._mmap = icf.read_file(filename) def get_sub_devices(self): return [IC9xICFRadioA(self._mmap), diff --git a/chirp/drivers/ic9x_ll.py b/chirp/drivers/ic9x_ll.py index d645ecf..609099c 100644 --- a/chirp/drivers/ic9x_ll.py +++ b/chirp/drivers/ic9x_ll.py @@ -17,7 +17,7 @@ import struct import logging from chirp import chirp_common, util, errors, bitwise -from chirp.memmap import MemoryMap +from chirp.memmap import MemoryMapBytes LOG = logging.getLogger(__name__) @@ -56,11 +56,11 @@ class IC9xDVMemory(chirp_common.DVMemory): def _ic9x_parse_frames(buf): frames = [] - while "\xfe\xfe" in buf: + while b"\xfe\xfe" in buf: try: - start = buf.index("\xfe\xfe") - end = buf[start:].index("\xfd") + start + 1 - except Exception as e: + start = buf.index(b"\xfe\xfe") + end = buf[start:].index(b"\xfd") + start + 1 + except Exception: LOG.error("No trailing bit") break @@ -79,27 +79,30 @@ def _ic9x_parse_frames(buf): return frames +def ic9x_recv(pipe): + data = b"" + while b'\xfd' not in data: + buf = pipe.read(1) + if not buf: + break + + data += buf + + return _ic9x_parse_frames(data) + + def ic9x_send(pipe, buf): """Send @buf to @pipe, wrapped in a header and trailer. Attempt to read any response frames, which are returned as a list""" # Add header and trailer - realbuf = "\xfe\xfe" + buf + "\xfd" + realbuf = b"\xfe\xfe" + buf + b"\xfd" # LOG.debug("Sending:\n%s" % util.hexprint(realbuf)) pipe.write(realbuf) pipe.flush() - - data = "" - while True: - buf = pipe.read(4096) - if not buf: - break - - data += buf - - return _ic9x_parse_frames(data) + return ic9x_recv(pipe) class IC92Frame: @@ -110,27 +113,27 @@ class IC92Frame: def set_vfo(self, vfo): """Set the vfo number""" - self._map[0] = chr(vfo) + self._map[0] = vfo def from_raw(self, data): """Construct the frame from raw data""" - self._map = MemoryMap(data) + self._map = MemoryMapBytes(data) def from_frame(self, frame): """Construct the frame by copying another frame""" - self._map = MemoryMap(frame.get_raw()) + self._map = MemoryMapBytes(frame.get_raw()) def __init__(self, subcmd=0, flen=0, cmd=0x1A): - self._map = MemoryMap("\x00" * (4 + flen)) - self._map[0] = "\x01\x80" + chr(cmd) + chr(subcmd) + self._map = MemoryMapBytes(b"\x00" * (4 + flen)) + self._map[0] = b"\x01\x80" + bytes([cmd, subcmd]) def get_payload(self): """Return the entire payload (sans header)""" - return self._map[4:] + return MemoryMapBytes(self._map[4:]) def get_raw(self): """Return the raw version of the frame""" - return self._map.get_packed() + return self._map.get_byte_compatible().get_packed() def __str__(self): string = "Frame VFO=%i (len = %i)\n" % (self.get_vfo(), @@ -142,12 +145,17 @@ class IC92Frame: def send(self, pipe, verbose=False): """Send the frame to the radio via @pipe""" - if verbose: + if verbose or True: LOG.debug("Sending:\n%s" % util.hexprint(self.get_raw())) response = ic9x_send(pipe, self.get_raw()) + while (response and len(response[0].get_raw()) > 4 and + response[0].get_raw()[4] != self.get_raw()[4]): + LOG.warning('Skipping unexpected frame:\n%s', + util.hexprint(response[0].get_raw())) + response = ic9x_recv(pipe) - if len(response) == 0: + if not response: raise errors.InvalidDataError("No response from radio") return response[0] @@ -156,7 +164,7 @@ class IC92Frame: self._map[start+4] = value def __getitem__(self, index): - return self._map[index+4] + return self.get_payload()[index] def __getslice__(self, start, end): return self._map[start+4:end+4] @@ -264,6 +272,7 @@ class IC92MyCallsignFrame(IC92CallsignFrame): command = 8 # My width = 12 # 4 bytes for /STID + MEMORY_FRAME_FORMAT = """ struct { u8 vfo; @@ -307,14 +316,14 @@ class IC92MemoryFrame(IC92Frame): # are invalid, it's easiest to start with a known-good one # since we don't set everything. self[0] = \ - "\x01\x00\x03\x00\x00\x01\x46\x01" + \ - "\x00\x00\x60\x00\x00\x08\x85\x08" + \ - "\x85\x00\x23\x22\x80\x06\x00\x00" + \ - "\x00\x00\x20\x20\x20\x20\x20\x20" + \ - "\x20\x20\x00\x00\x20\x20\x20\x20" + \ - "\x20\x20\x20\x20\x4b\x44\x37\x52" + \ - "\x45\x58\x20\x43\x43\x51\x43\x51" + \ - "\x43\x51\x20\x20" + b"\x01\x00\x03\x00\x00\x01\x46\x01" + \ + b"\x00\x00\x60\x00\x00\x08\x85\x08" + \ + b"\x85\x00\x23\x22\x80\x06\x00\x00" + \ + b"\x00\x00\x20\x20\x20\x20\x20\x20" + \ + b"\x20\x20\x00\x00\x20\x20\x20\x20" + \ + b"\x20\x20\x20\x20\x4b\x44\x37\x52" + \ + b"\x45\x58\x20\x43\x43\x51\x43\x51" + \ + b"\x43\x51\x20\x20" def set_vfo(self, vfo): IC92Frame.set_vfo(self, vfo) @@ -372,7 +381,7 @@ class IC92MemoryFrame(IC92Frame): def get_memory(self): """Return a Memory object based on the contents of the frame""" - _mem = bitwise.parse(MEMORY_FRAME_FORMAT, self).mem + _mem = bitwise.parse(MEMORY_FRAME_FORMAT, self.get_payload()).mem if MODES[_mem.mode] == "DV": mem = IC9xDVMemory() @@ -416,56 +425,6 @@ class IC92MemoryFrame(IC92Frame): return mem -def _send_magic_4800(pipe): - cmd = "\x01\x80\x19" - magic = ("\xFE" * 25) + cmd - for _i in [0, 1]: - resp = ic9x_send(pipe, magic) - if resp: - return resp[0].get_raw()[0] == "\x80" - return True - - -def _send_magic_38400(pipe): - cmd = "\x01\x80\x19" - # rsp = "\x80\x01\x19" - magic = ("\xFE" * 400) + cmd - for _i in [0, 1]: - resp = ic9x_send(pipe, magic) - if resp: - return resp[0].get_raw()[0] == "\x80" - return False - - -def send_magic(pipe): - """Send the magic incantation to wake up an ic9x radio""" - if pipe.baudrate == 38400: - resp = _send_magic_38400(pipe) - if resp: - return - LOG.info("Switching from 38400 to 4800") - pipe.baudrate = 4800 - resp = _send_magic_4800(pipe) - pipe.baudrate = 38400 - if resp: - return - raise errors.RadioError("Radio not responding") - elif pipe.baudrate == 4800: - resp = _send_magic_4800(pipe) - if resp: - return - LOG.info("Switching from 4800 to 38400") - pipe.baudrate = 38400 - resp = _send_magic_38400(pipe) - if resp: - return - pipe.baudrate = 4800 - raise errors.RadioError("Radio not responding") - else: - raise errors.InvalidDataError("Radio in unknown state (%i)" % - pipe.baudrate) - - def get_memory_frame(pipe, vfo, number): """Get the memory frame for @vfo and @number via @pipe""" if number < 0: @@ -487,11 +446,14 @@ def get_memory(pipe, vfo, number): if len(rframe.get_payload()) < 1: raise errors.InvalidMemoryLocation("No response from radio") - if rframe.get_payload()[3] == '\xff': + if rframe.get_payload()[3] == b'\xff': raise errors.InvalidMemoryLocation("Radio says location is empty") mf = IC92MemoryFrame() mf.from_frame(rframe) + if mf.get_memory().number != number: + raise errors.RadioError('get_memory() wanted %i got %i' % ( + number, mf.get_memory().number)) return mf.get_memory() @@ -507,7 +469,7 @@ def set_memory(pipe, vfo, memory): rframe = frame.send(pipe) - if rframe.get_raw()[2] != "\xfb": + if rframe.get_raw()[2] != 0xfb: raise errors.InvalidDataError("Radio reported error:\n%s" % util.hexprint(rframe.get_payload())) @@ -518,7 +480,7 @@ def erase_memory(pipe, vfo, number): frame.set_vfo(vfo) rframe = frame.send(pipe) - if rframe.get_raw()[2] != "\xfb": + if rframe.get_raw()[2] != 0xfb: raise errors.InvalidDataError("Radio reported error") diff --git a/chirp/drivers/icf.py b/chirp/drivers/icf.py index c04e80a..5f43d1e 100644 --- a/chirp/drivers/icf.py +++ b/chirp/drivers/icf.py @@ -15,72 +15,91 @@ from builtins import bytes +import binascii +import hashlib +import os +import struct import re import time import logging -import struct -from chirp import bitwise from chirp import chirp_common, errors, util, memmap +from chirp import directory from chirp.settings import RadioSetting, RadioSettingGroup, \ - RadioSettingValueBoolean, RadioSettings + RadioSettingValueString, RadioSettings LOG = logging.getLogger(__name__) +CMD_CLONE_ID = 0xE0 +CMD_CLONE_MODEL = 0xE1 CMD_CLONE_OUT = 0xE2 CMD_CLONE_IN = 0xE3 CMD_CLONE_DAT = 0xE4 CMD_CLONE_END = 0xE5 +CMD_CLONE_OK = 0xE6 +CMD_CLONE_HISPEED = 0xE8 + +ADDR_PC = 0xEE +ADDR_RADIO = 0xEF SAVE_PIPE = None +TRACE_ICF = 'CHIRP_DEBUG_ICF' in os.environ class IcfFrame: """A single ICF communication frame""" - src = 0 - dst = 0 - cmd = 0 - - payload = "" def __str__(self): - addrs = {0xEE: "PC", - 0xEF: "Radio"} - cmds = {0xE0: "ID", - 0xE1: "Model", - 0xE2: "Clone out", - 0xE3: "Clone in", - 0xE4: "Clone data", - 0xE5: "Clone end", - 0xE6: "Clone result"} - - return "%s -> %s [%s]:\n%s" % (addrs[self.src], addrs[self.dst], - cmds[self.cmd], + addrs = {ADDR_PC: "PC", + ADDR_RADIO: "Radio"} + cmds = {CMD_CLONE_ID: "ID", + CMD_CLONE_MODEL: "Model", + CMD_CLONE_OUT: "Clone out", + CMD_CLONE_IN: "Clone in", + CMD_CLONE_DAT: "Clone data", + CMD_CLONE_END: "Clone end", + CMD_CLONE_OK: "Clone OK", + CMD_CLONE_HISPEED: "Clone hispeed"} + + return "%s -> %s [%s]:\n%s" % (addrs.get(self.src, '??'), + addrs.get(self.dst, '??'), + cmds.get(self.cmd, '??'), util.hexprint(self.payload)) - def __init__(self): - pass + def __init__(self, src=0, dst=0, cmd=0): + self.src = src + self.dst = dst + self.cmd = cmd + self.payload = b'' + @classmethod + def parse(cls, data): + """Parse an ICF frame of unknown type from the beginning of @data""" + frame = cls(util.byte_to_int(data[2]), + util.byte_to_int(data[3]), + util.byte_to_int(data[4])) -def parse_frame_generic(data): - """Parse an ICF frame of unknown type from the beginning of @data""" - frame = IcfFrame() + try: + end = data.index(b"\xFD") + except ValueError: + LOG.warning('Frame parsed with no end') + return None - assert isinstance(data, bytes), ('parse_frame_generic() expected bytes, ' - 'but got %s' % data.__class__) + assert isinstance(data, bytes), ( + 'parse_frame_generic() expected bytes, ' + 'but got %s' % data.__class__) - frame.src = data[2] - frame.dst = data[3] - frame.cmd = data[4] + if data[end + 1:]: + LOG.warning('Frame parsed with trailing data') - try: - end = data.index(0xFD) - except ValueError as e: - return None, data + frame.payload = data[5:end] - frame.payload = data[5:end] + return frame - return frame, data[end+1:] + def pack(self): + return (b'\xfe\xfe' + + struct.pack('BBB', self.src, self.dst, self.cmd) + + self.payload + b'\xfd') class RadioStream: @@ -88,6 +107,7 @@ class RadioStream: def __init__(self, pipe): self.pipe = pipe self.data = bytes() + self.iecho = None def _process_frames(self): if not self.data.startswith(b"\xFE\xFE"): @@ -99,26 +119,39 @@ class RadioStream: frames = [] while self.data: + # Hispeed clone frames start with a pad of \xFE, so strip those + # away until we have the two we expect + while self.data.startswith(b'\xfe\xfe\xfe'): + self.data = self.data[1:] + try: cmd = self.data[4] except IndexError: break # Out of data try: - frame, rest = parse_frame_generic(self.data) - if not frame: - break - elif frame.src == 0xEE and frame.dst == 0xEF: + end = self.data.index(b'\xFD') + frame = IcfFrame.parse(self.data[:end + 1]) + self.data = self.data[end + 1:] + if frame.src == 0xEE and frame.dst == 0xEF: # PC echo, ignore - pass + if self.iecho is None: + LOG.info('Detected an echoing cable') + self.iecho = True else: + if TRACE_ICF: + LOG.debug('Received frame:\n%s' % frame) frames.append(frame) - - self.data = bytes(rest) + except ValueError: + # no data + break except errors.InvalidDataError as e: LOG.error("Failed to parse frame (cmd=%i): %s" % (cmd, e)) return [] + if frames and self.iecho is None: + LOG.info('Non-echoing cable detected') + self.iecho = False return frames def get_frames(self, nolimit=False, limit=None): @@ -144,17 +177,44 @@ class RadioStream: return self._process_frames() - -def get_model_data(radio, mdata=bytes(b"\x00\x00\x00\x00")): + def munch_echo(self): + if self.iecho is not False: + f = self.get_frames(limit=1) + if len(f) != 0: + LOG.warning('Expected to read one echo frame, found %i', + len(f)) + if f and f[0].src == 0xEF: + LOG.warning('Expected PC echo but found radio frame!') + + +def decode_model(data): + if len(data) != 49: + LOG.info('Unable to decode %i-byte model data' % len(data)) + return None + rev = util.byte_to_int(data[5]) + LOG.info('Radio revision is %i' % rev) + comment = data[6:6 + 16] + LOG.info('Radio comment is %r' % comment) + serial = binascii.unhexlify(data[35:35 + 14]) + model, b1, b2, u1, s3 = struct.unpack('>HBBBH', serial) + serial_num = '%04i%02i%02i%04i' % (model, b1, b2, s3) + LOG.info('Radio serial is %r' % serial_num) + return rev + + +def get_model_data(radio, mdata=b"\x00\x00\x00\x00", stream=None): """Query the @radio for its model data""" send_clone_frame(radio, 0xe0, mdata, raw=True) - stream = RadioStream(radio.pipe) + if stream is None: + stream = RadioStream(radio.pipe) frames = stream.get_frames() if len(frames) != 1: raise errors.RadioError("Unexpected response from radio") + LOG.debug('Model query result:\n%s' % frames[0]) + return frames[0].payload @@ -181,28 +241,23 @@ def get_clone_resp(pipe, length=None, max_count=None): def send_clone_frame(radio, cmd, data, raw=False, checksum=False): """Send a clone frame with @cmd and @data to the @radio""" - payload = radio.get_payload(bytes(data), raw, checksum) - frame = (bytes(b"\xfe\xfe\xee\xef") + - bytes([cmd]) + - payload + - bytes(b"\xfd")) + frame = IcfFrame(ADDR_PC, ADDR_RADIO, cmd) + frame.payload = radio.get_payload(data, raw, checksum) if SAVE_PIPE: LOG.debug("Saving data...") - SAVE_PIPE.write(frame) + SAVE_PIPE.write(frame.pack()) + + if TRACE_ICF: + LOG.debug('Sending:\n%s' % frame) - # LOG.debug("Sending:\n%s" % util.hexprint(frame)) - # LOG.debug("Sending:\n%s" % util.hexprint(hed[6:])) if cmd == 0xe4: # Uncomment to avoid cloning to the radio # return frame pass - radio.pipe.write(frame) - if radio.MUNCH_CLONE_RESP: - # Do max 2*len(frame) read(1) calls - get_clone_resp(radio.pipe, max_count=2*len(frame)) + radio.pipe.write(frame.pack()) return frame @@ -244,8 +299,7 @@ def process_data_frame(radio, frame, _mmap): LOG.error("Bad checksum in address %04X frame: %02x " "calculated, %02x sent!" % (saddr, vx, sumc)) raise errors.InvalidDataError( - "Checksum error in download! " - "Try disabling High Speed Clone option in Settings.") + "Checksum error in download!") try: _mmap[saddr] = data except IndexError: @@ -256,12 +310,11 @@ def process_data_frame(radio, frame, _mmap): def start_hispeed_clone(radio, cmd): """Send the magic incantation to the radio to go fast""" - buf = ((bytes(b"\xFE") * 20) + - bytes(b"\xEE\xEF\xE8") + - radio.get_model() + - bytes(b"\x00\x00\x02\x01\xFD")) - LOG.debug("Starting HiSpeed:\n%s" % util.hexprint(buf)) - radio.pipe.write(buf) + frame = IcfFrame(ADDR_PC, ADDR_RADIO, CMD_CLONE_HISPEED) + frame.payload = radio.get_model() + b'\x00\x00\x02\x01\xFD' + + LOG.debug("Starting HiSpeed:\n%s" % frame) + radio.pipe.write(b'\xFE' * 20 + frame.pack()) radio.pipe.flush() resp = radio.pipe.read(128) LOG.debug("Response:\n%s" % util.hexprint(resp)) @@ -269,19 +322,23 @@ def start_hispeed_clone(radio, cmd): LOG.info("Switching to 38400 baud") radio.pipe.baudrate = 38400 - buf = ((bytes(b"\xFE") * 14) + - bytes(b"\xEE\xEF") + - bytes([cmd]) + - radio.get_model()[:3] + - bytes(b"\x00\xFD")) - LOG.debug("Starting HiSpeed Clone:\n%s" % util.hexprint(buf)) - radio.pipe.write(buf) + frame = IcfFrame(ADDR_PC, ADDR_RADIO, cmd) + frame.payload = radio.get_model()[:3] + b'\x00' + + LOG.debug("Starting HiSpeed Clone:\n%s" % frame) + radio.pipe.write(b'\xFE' * 14 + frame.pack()) radio.pipe.flush() def _clone_from_radio(radio): md = get_model_data(radio) + try: + radio_rev = decode_model(md) + except Exception: + LOG.error('Failed to decode model data') + radio_rev = None + if md[0:4] != radio.get_model(): LOG.info("This model: %s" % util.hexprint(md[0:4])) LOG.info("Supp model: %s" % util.hexprint(radio.get_model())) @@ -301,12 +358,16 @@ def _clone_from_radio(radio): addr = 0 _mmap = memmap.MemoryMapBytes(bytes(b'\x00') * radio.get_memsize()) last_size = 0 - while True: + got_end = False + last_frame = time.time() + timeout = 10 + while not got_end: frames = stream.get_frames() - if not frames: + if not frames and (time.time() - last_frame) > timeout: break for frame in frames: + last_frame = time.time() if frame.cmd == CMD_CLONE_DAT: src, dst = process_data_frame(radio, frame, _mmap) if last_size != (dst - src): @@ -320,6 +381,10 @@ def _clone_from_radio(radio): LOG.debug("End frame (%i):\n%s" % (len(frame.payload), util.hexprint(frame.payload))) LOG.debug("Last addr: %04x" % addr) + # For variable-length radios, make sure we don't + # return a longer map than we got from the radio. + _mmap.truncate(addr) + got_end = True if radio.status_fn: status = chirp_common.Status() @@ -328,6 +393,13 @@ def _clone_from_radio(radio): status.cur = addr radio.status_fn(status) + if not got_end: + LOG.error('clone_from_radio ending at address %06X before ' + 'CLONE_END; stream buffer is:\n%s', + addr, util.hexprint(stream.data)) + raise errors.RadioError('Data stream stopped before end-of-clone ' + 'received') + return _mmap @@ -347,6 +419,8 @@ def send_mem_chunk(radio, stream, start, stop, bs=32): status.msg = "Cloning to radio" status.max = radio.get_memsize() + LOG.debug('Sending memory range %06x - %06x @ %i bytes' % ( + start, stop, bs)) for i in range(start, stop, bs): if i + bs < stop: size = bs @@ -365,7 +439,7 @@ def send_mem_chunk(radio, stream, start, stop, bs=32): raw=False, checksum=True) - stream.get_frames(1) + stream.munch_echo() if radio.status_fn: status.cur = i+bs @@ -380,18 +454,30 @@ def _clone_to_radio(radio): # Uncomment to save out a capture of what we actually write to the radio # SAVE_PIPE = file("pipe_capture.log", "w", 0) - md = get_model_data(radio) + stream = RadioStream(radio.pipe) + md = get_model_data(radio, stream=stream) + if radio._double_ident: + md = get_model_data(radio, stream=stream) if md[0:4] != radio.get_model(): raise errors.RadioError("I can't talk to this model") + try: + radio_rev = decode_model(md) + except Exception: + LOG.error('Failed to decode model data') + radio_rev = None + + image_rev = radio._icf_data.get('MapRev', 1) + if radio_rev is not None and radio_rev != image_rev: + raise errors.RadioError('Radio revision %i does not match image %i' % ( + radio_rev, image_rev)) + # This mimics what the Icom software does, but isn't required and just # takes longer # md = get_model_data(radio, mdata=md[0:2]+"\x00\x00") # md = get_model_data(radio, mdata=md[0:2]+"\x00\x00") - stream = RadioStream(radio.pipe) - if radio.is_hispeed(): start_hispeed_clone(radio, CMD_CLONE_IN) else: @@ -423,6 +509,11 @@ def _clone_to_radio(radio): if len(frames) == 0: raise errors.RadioError("Did not get clone result from radio") + elif result.cmd != CMD_CLONE_OK: + LOG.error('Clone failed result frame:\n%s' % result) + raise errors.RadioError('Radio rejected clone') + else: + LOG.debug('Clone result frame:\n%s' % result) return result.payload[0] == bytes(b'\x00') @@ -438,11 +529,11 @@ def clone_to_radio(radio): def convert_model(mod_str): """Convert an ICF-style model string into what we get from the radio""" - data = "" + data = b"" for i in range(0, len(mod_str), 2): hexval = mod_str[i:i+2] intval = int(hexval, 16) - data += chr(intval) + data += bytes([intval]) return data @@ -469,7 +560,7 @@ def convert_data_line(line): size = int(line[8:10], 16) data = line[10:] - _mmap = "" + _mmap = b"" i = 0 while i < (size * 2): try: @@ -485,19 +576,107 @@ def convert_data_line(line): def read_file(filename): """Read an ICF file and return the model string and memory data""" - f = file(filename) + f = open(filename) mod_str = f.readline() dat = f.readlines() - model = convert_model(mod_str.strip()) + icfdata = { + 'model': convert_model(mod_str.strip()) + } - _mmap = "" + _mmap = b"" for line in dat: - if not line.startswith("#"): - _mmap += convert_data_line(line) + if line.startswith("#"): + try: + key, value = line.strip().split('=', 1) + if key == '#EtcData': + value = int(value, 16) + elif value.isdigit(): + value = int(value) + icfdata[key[1:]] = value + except ValueError: + # Some old files have lines with just # + pass + else: + line_data = convert_data_line(line) + _mmap += line_data + if 'recordsize' not in icfdata: + icfdata['recordsize'] = len(line_data) + + return icfdata, memmap.MemoryMapBytes(_mmap) + + +def _encode_model_for_icf(model): + """ Encode the model magically for the ICF file hash. + + If model is: AB CD 00 00 + Then the magic is AA BB CC DD AB CD + """ + a = (util.byte_to_int(model[0]) & 0xF0) >> 4 + b = util.byte_to_int(model[0]) & 0x0F + c = (util.byte_to_int(model[1]) & 0xF0) >> 4 + d = util.byte_to_int(model[1]) & 0x0F + + sequence = [(a << 4) | a, + (b << 4) | b, + (c << 4) | c, + (d << 4) | d, + (a << 4) | b, + (c << 4) | d] + return b''.join(util.int_to_byte(x) for x in sequence) + + +def write_file(radio, filename): + """Write an ICF file""" + f = open(filename, 'w', newline='\r\n') + + model = radio._model + mdata = '%02x%02x%02x%02x' % (ord(model[0]), + ord(model[1]), + ord(model[2]), + ord(model[3])) + data = radio._mmap.get_packed() + + f.write('%s\n' % mdata) + f.write('#Comment=%s\n' % radio._icf_data.get('Comment', '')) + f.write('#MapRev=%i\n' % radio._icf_data.get('MapRev', 1)) + f.write('#EtcData=%06x\n' % radio._icf_data.get('EtcData', 0)) + + binicf = _encode_model_for_icf(model) + + # ICF files for newer models (probably everything with an SD card + # slot) store a hash on the last line of the ICF file, as + # #CD=$hexdigest. This is an MD5 sum of a sequence that starts + # with the specially-encoded model from _encode_model_for_icf(), + # followed by the unencoded lines of the ICF file (including + # address and length values). So for an ID31 the value we hash + # looks like this (in hex, line breaks for the humans and pep8): + # + # 333322223322 + # 0000000020 + # dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd + # 0000002020 + # dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd + # ... and so on + + LOG.debug('ICF hash header: %r' % binascii.hexlify(binicf)) + blksize = radio._icf_data.get('recordsize', 32) + for addr in range(0, len(data), blksize): + block = binascii.hexlify(data[addr:addr + blksize]).decode().upper() + if blksize == 32: + line = '%08X%02X%s' % (addr, blksize, block) + binicf += binascii.unhexlify(line) + else: + line = '%04X%02X%s' % (addr, blksize, block) + f.write(line + '\n') - return model, memmap.MemoryMap(_mmap) + if blksize == 32: + hash = hashlib.md5(binicf) + digest = hash.hexdigest().upper() + LOG.debug('ICF hash digest: %s' % digest) + f.write('#CD=%s\n' % digest) + f.close() def is_9x_icf(filename): @@ -627,15 +806,7 @@ class IcomCloneModeRadio(chirp_common.CloneModeRadio): VENDOR = "Icom" BAUDRATE = 9600 NEEDS_COMPAT_SERIAL = False - # Ideally, the driver should read clone response after each clone frame - # is sent, but for some reason it hasn't behaved this way for years. - # So not to break the existing tested drivers the MUNCH_CLONE_RESP flag - # was added. It's False by default which brings the old behavior, - # i.e. clone response is not read. The expectation is that new Icom - # drivers will use MUNCH_CLONE_RESP = True and old drivers will be - # gradually migrated to this. Once all Icom drivers will use - # MUNCH_CLONE_RESP = True, this flag will be removed. - MUNCH_CLONE_RESP = False + FORMATS = [directory.register_format('Icom ICF', '*.icf')] _model = "\x00\x00\x00\x00" # 4-byte model string _endframe = "" # Model-unique ending frame @@ -644,6 +815,19 @@ class IcomCloneModeRadio(chirp_common.CloneModeRadio): _bank_index_bounds = (0, 99) _bank_class = IcomBank _can_hispeed = False + _double_ident = False # A couple radios require double ident before upload + + # Newer radios (ID51Plus2, ID5100, IC2730) use a slightly + # different CLONE_DAT format + _raw_frames = False + _highbit_flip = False + + # Attributes that get put into ICF files when we export. The meaning + # of these are unknown at this time, but differ per model (at least). + # Saving ICF files will not be offered unless _icf_data has attributes. + _icf_data = { + 'recordsize': 16, + } @classmethod def is_hispeed(cls): @@ -653,26 +837,28 @@ class IcomCloneModeRadio(chirp_common.CloneModeRadio): @classmethod def get_model(cls): """Returns the Icom model data for this radio""" - return bytes([ord(x) for x in cls._model]) + return bytes([util.byte_to_int(x) for x in cls._model]) - @classmethod - def get_endframe(cls): + def get_endframe(self): """Returns the magic clone end frame for this radio""" - return bytes([ord(x) for x in cls._endframe]) + return bytes([util.byte_to_int(x) for x in self._endframe]) - @classmethod - def get_ranges(cls): + def get_ranges(self): """Returns the ranges this radio likes to have in a clone""" - return cls._ranges + return self._ranges def process_frame_payload(self, payload): - """Convert BCD-encoded data to raw""" + if self._raw_frames: + return unescape_raw_bytes(payload) + + # Legacy frame format: convert BCD-encoded data to raw""" bcddata = payload - data = bytes() + data = b"" i = 0 while i+1 < len(bcddata): try: - val = int("%s%s" % (chr(bcddata[i]), chr(bcddata[i+1])), 16) + val = int(b"%s%s" % (util.int_to_byte(bcddata[i]), + util.int_to_byte(bcddata[i+1])), 16) i += 2 data += struct.pack("B", val) except (ValueError, TypeError) as e: @@ -685,20 +871,42 @@ class IcomCloneModeRadio(chirp_common.CloneModeRadio): def get_payload(self, data, raw, checksum): """Returns the data with optional checksum BCD-encoded for the radio""" + if checksum: + data += util.int_to_byte(compute_checksum(data)) + if self._raw_frames: + # Always raw format, no need to check raw + return b''.join(escape_raw_byte(b) for b in data) if raw: return data - payload = bytes() + payload = b'' for byte in data: - payload += bytes(b"%02X" % byte) - if checksum: - payload += bytes(b"%02X" % compute_checksum(data)) + payload += b"%02X" % util.byte_to_int(byte) return payload def sync_in(self): - self._mmap = clone_from_radio(self) + _mmap = clone_from_radio(self) + if self._highbit_flip: + LOG.debug('Flipping high bits of received image') + map_cls = _mmap.__class__ + _mmap = flip_high_order_bit(_mmap.get_packed()) + self._mmap = map_cls(_mmap) + else: + self._mmap = _mmap self.process_mmap() + def get_mmap(self): + if self._highbit_flip: + map_cls = self._mmap.__class__ + LOG.debug('Flipping high bits of image') + return map_cls(flip_high_order_bit(self._mmap.get_packed())) + else: + return self._mmap + def sync_out(self): + # We always start at 9600 baud. The UI may have handed us the same + # rate we ended with last time (for radios which have variable but + # unchanging speeds) but we always have to start in low-speed mode. + self.pipe.baudrate = 9600 clone_to_radio(self) def get_bank_model(self): @@ -721,15 +929,65 @@ class IcomCloneModeRadio(chirp_common.CloneModeRadio): no bank if None""" raise Exception("Not implemented") + def _make_call_list_setting_group(self, listname): + current = getattr(self, 'get_%s_list' % listname)() + nice_name = listname.split('_', 1)[0].upper() + group = RadioSettingGroup('%s_list' % listname, + '%s List' % nice_name) + for i, cs in enumerate(current): + group.append(RadioSetting('%03i' % i, '%i' % i, + RadioSettingValueString(0, 8, cs))) + return group + def get_settings(self): - return make_speed_switch_setting(self) + if isinstance(self, chirp_common.IcomDstarSupport): + dstar = RadioSettingGroup('dstar', 'D-STAR') + dstar.append(self._make_call_list_setting_group('urcall')) + dstar.append(self._make_call_list_setting_group('repeater_call')) + dstar.append(self._make_call_list_setting_group('mycall')) + return RadioSettings(dstar) + return [] + + def _apply_call_list_setting(self, dstar, listname): + listgroup = dstar['%s_list' % listname] + calls = [str(listgroup[i].value) + for i in sorted(listgroup.keys())] + getattr(self, 'set_%s_list' % listname)(calls) def set_settings(self, settings): - return honor_speed_switch_setting(self, settings) + for group in settings: + if group.get_name() == 'dstar': + self._apply_call_list_setting(group, 'mycall') + self._apply_call_list_setting(group, 'urcall') + self._apply_call_list_setting(group, 'repeater_call') + + def load_mmap(self, filename): + if filename.lower().endswith('.icf'): + self._icf_data, self._mmap = read_file(filename) + LOG.debug('Loaded ICF file %s with data: %s' % (filename, + self._icf_data)) + self.process_mmap() + else: + chirp_common.CloneModeRadio.load_mmap(self, filename) + + def save_mmap(self, filename): + if filename.lower().endswith('.icf'): + write_file(self, filename) + else: + chirp_common.CloneModeRadio.save_mmap(self, filename) + + @classmethod + def match_model(cls, filedata, filename): + if (filedata[:4] == binascii.hexlify(cls.get_model())[:4] and + filename.lower().endswith('.icf')): + return True + else: + return super(IcomCloneModeRadio, cls).match_model(filedata, + filename) def flip_high_order_bit(data): - return [chr(ord(d) ^ 0x80) for d in list(data)] + return bytes([d ^ 0x80 for d in list(data)]) def escape_raw_byte(byte): @@ -759,33 +1017,6 @@ def unescape_raw_bytes(escaped_data): return data -class IcomRawCloneModeRadio(IcomCloneModeRadio): - """Subclass for Icom clone-mode radios using the raw data protocol.""" - def process_frame_payload(self, payload): - """Payloads from a raw-clone-mode radio are already in raw format.""" - return unescape_raw_bytes(payload) - - def get_payload(self, data, raw, checksum): - """Returns the data with optional checksum in raw format.""" - payload = data - if checksum: - payload += bytes([compute_checksum(data)]) - # Escape control characters. - escaped_payload = b''.join([escape_raw_byte(b) for b in payload]) - return escaped_payload - - def sync_in(self): - # The radio returns all the bytes with the high-order bit flipped. - _mmap = clone_from_radio(self) - _mmap = flip_high_order_bit(_mmap.get_packed()) - self._mmap = memmap.MemoryMap(_mmap) - self.process_mmap() - - def get_mmap(self): - _data = flip_high_order_bit(self._mmap.get_packed()) - return memmap.MemoryMap(_data) - - class IcomLiveRadio(chirp_common.LiveRadio): """Base class for an Icom Live-mode radio""" VENDOR = "Icom" @@ -806,21 +1037,35 @@ class IcomLiveRadio(chirp_common.LiveRadio): return None -def make_speed_switch_setting(radio): - if not radio.__class__._can_hispeed: - return {} - drvopts = RadioSettingGroup("drvopts", "Driver Options") - top = RadioSettings(drvopts) - rs = RadioSetting("drv_clone_speed", "Use Hi-Speed Clone", - RadioSettingValueBoolean(radio._can_hispeed)) - drvopts.append(rs) - return top - - -def honor_speed_switch_setting(radio, settings): - for element in settings: - if element.get_name() == "drvopts": - return honor_speed_switch_setting(radio, element) - if element.get_name() == "drv_clone_speed": - radio.__class__._can_hispeed = element.value.get_value() - return +def warp_byte_size(inbytes, obw=8, ibw=8): + """Convert between "byte sizes". + + This will pack N-bit characters into a sequence of 8-bit bytes, + and perform the opposite. + + ibw (input bit width) is the width of the storage + obw (output bit width) is the width of the characters to extract + + ibw=8,obw=7 will pull seven-bit characters from a sequence of bytes + ibw=7,obw=8 will pack seven-bit characters into a sequence of bytes + """ + if isinstance(inbytes, str): + inbytes = [ord(x) for x in inbytes] + outbit = 0 + tmp = 0 + stripmask = 1 << (ibw - 1) + for byte in inbytes: + inbit = 0 + for i in range(0, max(obw, ibw - inbit)): + if inbit == ibw: + # Move to next char + inbit = 0 + break + tmp = (tmp << 1) | ((byte & stripmask) and 1 or 0) + byte = (byte << 1) & 0xFF + inbit += 1 + outbit += 1 + if outbit == obw: + yield tmp + tmp = 0 + outbit = 0 diff --git a/chirp/drivers/icomciv.py b/chirp/drivers/icomciv.py index e9baf8f..3135963 100644 --- a/chirp/drivers/icomciv.py +++ b/chirp/drivers/icomciv.py @@ -127,6 +127,34 @@ char pad1; bbcd rtone[2]; // 12-14 tx tone freq char pad2; bbcd ctone[2]; // 15-17 tone rx squelch setting +// This is duplicated from 4-17 above, even duplicated by number in the +// manual! +lbcd freq_tx[5]; // 4-8 receive freq +u8 mode_tx; // 9 operating mode +u8 filter_tx; // 10 filter 1-3 (undocumented) +u8 dataMode_tx:4, // 11 data mode setting (on or off) + tmode_tx:4; // 11 tone type +char pad1_tx; +bbcd rtone_tx[2]; // 12-14 tx tone freq +char pad2_tx; +bbcd ctone_tx[2]; // 15-17 tone rx squelch setting +// End TX duplicate block +char name[10]; // 18-27 Callsign +""" + +MEM_IC7610_FORMAT = """ +bbcd number[2]; // 1,2 +u8 spl:4, // 3 split and select memory settings + select:4; +lbcd freq[5]; // 4-8 receive freq +u8 mode; // 9 operating mode +u8 filter; // 10 filter 1-3 (undocumented) +u8 dataMode:4, // 11 data mode setting (on or off) + tmode:4; // 11 tone type +char pad1; +bbcd rtone[2]; // 12-14 tx tone freq +char pad2; +bbcd ctone[2]; // 15-17 tone rx squelch setting char name[10]; // 18-27 Callsign """ @@ -207,6 +235,7 @@ class MemFrame(Frame): _cmd = 0x1A _sub = 0x00 _loc = 0 + FORMAT = MEM_FORMAT def set_location(self, loc): """Set the memory location number""" @@ -225,7 +254,7 @@ class MemFrame(Frame): """Return a bitwise parsed object""" # Make sure we're assignable self._data = MemoryMapBytes(bytes(self._data)) - return bitwise.parse(MEM_FORMAT, self._data) + return bitwise.parse(self.FORMAT, self._data) def initialize(self): """Initialize to sane values""" @@ -273,9 +302,9 @@ class DupToneMemFrame(MemFrame): class IC7300MemFrame(MemFrame): FORMAT = MEM_IC7300_FORMAT - def get_obj(self): - self._data = MemoryMapBytes(bytes(self._data)) - return bitwise.parse(self.FORMAT, self._data) + +class IC7610MemFrame(MemFrame): + FORMAT = MEM_IC7610_FORMAT class SpecialChannel(object): @@ -308,6 +337,8 @@ class IcomCIVRadio(icf.IcomLiveRadio): BAUD_RATE = 19200 NEEDS_COMPAT_SERIAL = False MODEL = "CIV Radio" + # RTS is interpreted as "transmit now" on some interface boxes for these + WANTS_RTS = False _model = "\x00" _template = 0 @@ -362,6 +393,37 @@ class IcomCIVRadio(icf.IcomLiveRadio): LOG.debug("Echo:\n%s" % util.hexprint(bytes(resp))) return resp == echo_test + def _detect_baudrate(self): + if self._baud_detected: + return + + # Don't ever try to run this twice, even if we fail + self._baud_detected = True + + bauds = [9600, 19200, 38400, 57600, 115200, 4800] + bauds.remove(self.BAUD_RATE) + bauds.insert(0, self.BAUD_RATE) + self.pipe.timeout = 0.25 + for baud in bauds: + LOG.debug('Trying %i baud' % baud) + self.pipe.baudrate = baud + self._willecho = self._detect_echo() + LOG.debug("Interface echo: %s" % self._willecho) + try: + f = self._get_template_memory() + print('Chew: %i' % len(self.pipe.read(128))) + LOG.info('Detected %i baud' % baud) + break + except errors.RadioError: + pass + else: + LOG.warning('Unable to detect baudrate, using default of %i' % ( + self.BAUD_RATE)) + self.pipe.baudrate = self.BAUD_RATE + + # Restore the historical default of 1s timeout for this driver + self.pipe.timeout = 1 + def __init__(self, *args, **kwargs): icf.IcomLiveRadio.__init__(self, *args, **kwargs) @@ -376,6 +438,8 @@ class IcomCIVRadio(icf.IcomLiveRadio): else: self._willecho = False + self._baud_detected = False + # f = Frame() # f.set_command(0x19, 0x00) # self._send_frame(f) @@ -418,6 +482,7 @@ class IcomCIVRadio(icf.IcomLiveRadio): return f def get_raw_memory(self, number): + self._detect_baudrate() LOG.debug("Getting %s (raw)" % number) f = self._classes["mem"]() if self._is_special(number): @@ -457,6 +522,7 @@ class IcomCIVRadio(icf.IcomLiveRadio): pass def get_memory(self, number): + self._detect_baudrate() LOG.debug("Getting %s" % number) f = self._classes["mem"]() mem = chirp_common.Memory() @@ -600,6 +666,7 @@ class IcomCIVRadio(icf.IcomLiveRadio): return mem def set_memory(self, mem): + self._detect_baudrate() LOG.debug("Setting %s(%s)" % (mem.number, mem.extd_number)) f = self._get_template_memory() if self._is_special(mem.number): @@ -806,7 +873,7 @@ class Icom7100Radio(IcomCIVRadio): @directory.register class Icom746Radio(IcomCIVRadio): """Icom IC-746""" - MODEL = "746" + MODEL = "IC-746" BAUD_RATE = 9600 _model = "\x56" _template = 102 @@ -895,6 +962,7 @@ class Icom910Radio(IcomCIVRadio): def _detect_23cm_unit(self): if not self.pipe: return True + self._detect_baudrate() f = IC910MemFrame() f.set_location(1, 3) # First memory in 23cm bank self._send_frame(f) @@ -941,6 +1009,7 @@ class Icom910Radio(IcomCIVRadio): class Icom7300Radio(IcomCIVRadio): # Added March, 2021 by Rick DeWitt """Icom IC-7300""" MODEL = "IC-7300" + BAUD_RATE = 115200 _model = "\x94" _template = 100 # Use P1 as blank template @@ -983,7 +1052,7 @@ class Icom7300Radio(IcomCIVRadio): # Added March, 2021 by Rick DeWitt self._rf.valid_tmodes = ["", "Tone", "TSQL"] # self._rf.valid_duplexes = ["", "-", "+", "split"] self._rf.valid_duplexes = [] # To prevent using memobj.duplex - self._rf.valid_bands = [(1800000, 70500000)] + self._rf.valid_bands = [(30000, 74800000)] self._rf.valid_skips = [] self._rf.valid_name_length = 10 self._rf.valid_characters = chirp_common.CHARSET_ASCII @@ -995,6 +1064,10 @@ class Icom7610Radio(Icom7300Radio): MODEL = "IC-7610" _model = '\x98' + def _initialize(self): + super()._initialize() + self._classes['mem'] = IC7610MemFrame + def probe_model(ser): """Probe the radio attached to @ser for its model""" diff --git a/chirp/drivers/icp7.py b/chirp/drivers/icp7.py index 5d8dbf8..6511333 100644 --- a/chirp/drivers/icp7.py +++ b/chirp/drivers/icp7.py @@ -17,11 +17,11 @@ from chirp.drivers import icf from chirp import chirp_common, directory, bitwise # memory number: -# 000 - 999 regular memory channels (supported, others not) -# 1000 - 1049 scan edges -# 1050 - 1249 auto write channels -# 1250 call channel (C0) -# 1251 call channel (C1) +# 000 - 999 regular memory channels (supported, others not) +# 1000 - 1049 scan edges +# 1050 - 1249 auto write channels +# 1250 call channel (C0) +# 1251 call channel (C1) MEM_FORMAT = """ @@ -70,7 +70,7 @@ TMODES = ["", "Tone", "TSQL", "", "DTCS"] DUPLEX = ["", "-", "+"] DTCS_POLARITY = ["NN", "NR", "RN", "RR"] TUNING_STEPS = [5.0, 6.25, 8.33, 9.0, 10.0, 12.5, 15.0, 20.0, - 25.0, 30.0, 50.0, 100.0, 200.0, 0.0] # 0.0 as "Auto" + 25.0, 30.0, 50.0, 100.0, 200.0, 0.0] # 0.0 as "Auto" class ICP7Bank(icf.IcomBank): @@ -218,17 +218,17 @@ class ICP7Radio(icf.IcomCloneModeRadio): _mem.freq = mem.freq * 3 _mem.offset = mem.offset * 3 - _mem.train_sql = 0 # Train SQL mode (0:off 1:Tone 2:MSK) + _mem.train_sql = 0 # Train SQL mode (0:off 1:Tone 2:MSK) _mem.tmode = TMODES.index(mem.tmode) _mem.duplex = DUPLEX.index(mem.duplex) - _mem.train_tone = 228 # Train SQL Tone (x10Hz) + _mem.train_tone = 228 # Train SQL Tone (x10 Hz) _mem.tuning_step = TUNING_STEPS.index(mem.tuning_step) _mem.rtone = chirp_common.TONES.index(mem.rtone) _mem.ctone = chirp_common.TONES.index(mem.ctone) - _mem.unknown0 = 0 # unknown (always zero) + _mem.unknown0 = 0 # unknown (always zero) _mem.mode = MODES.index(mem.mode) _mem.dtcs = chirp_common.DTCS_CODES.index(mem.dtcs) - _mem.unknown1 = ~0 # unknown (always one) + _mem.unknown1 = ~0 # unknown (always one) _mem.dtcs_polarity = DTCS_POLARITY.index(mem.dtcs_polarity) _mem.name = mem.name.ljust(6)[:6] diff --git a/chirp/drivers/icq7.py b/chirp/drivers/icq7.py index 7a081b9..1917655 100644 --- a/chirp/drivers/icq7.py +++ b/chirp/drivers/icq7.py @@ -13,7 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import struct import logging from chirp.drivers import icf @@ -21,8 +20,7 @@ from chirp import chirp_common, directory, bitwise from chirp.chirp_common import to_GHz, from_GHz from chirp.settings import RadioSetting, RadioSettingGroup, \ RadioSettingValueBoolean, RadioSettingValueList, \ - RadioSettingValueInteger, RadioSettingValueString, \ - RadioSettingValueFloat, RadioSettings + RadioSettingValueInteger, RadioSettings LOG = logging.getLogger(__name__) @@ -94,7 +92,7 @@ EDGE_LIST = ["%sP" % x for x in range(0, 20)] + ["Band", "All"] PAUSE_LIST = ["%s sec" % x for x in range(2, 22, 2)] + ["Hold"] RESUME_LIST = ["%s sec" % x for x in range(0, 6)] APOFF_LIST = ["Off"] + ["%s min" % x for x in range(30, 150, 30)] -D_SEL_LIST = ["100 KHz", "1 MHz", "10 MHz"] +D_SEL_LIST = ["100 kHz", "1 MHz", "10 MHz"] @directory.register @@ -137,7 +135,7 @@ class ICQ7Radio(icf.IcomCloneModeRadio): def validate_memory(self, mem): if mem.freq < 30000000 and mem.mode != 'AM': return [chirp_common.ValidationError( - 'Only AM is allowed below 30MHz')] + 'Only AM is allowed below 30 MHz')] return icf.IcomCloneModeRadio.validate_memory(self, mem) def get_memory(self, number): @@ -233,7 +231,7 @@ class ICQ7Radio(icf.IcomCloneModeRadio): RadioSettingValueBoolean(_settings.ritfunct)) basic.append(rs) - rs = RadioSetting("rit", "RIT Shift (KHz)", + rs = RadioSetting("rit", "RIT Shift (kHz)", RadioSettingValueInteger(-7, 7, _settings.rit)) basic.append(rs) @@ -344,6 +342,6 @@ class ICQ7Radio(icf.IcomCloneModeRadio): else: LOG.debug("Setting %s = %s" % (setting, element.value)) setattr(obj, setting, element.value) - except Exception as e: + except Exception: LOG.debug(element.get_name()) raise diff --git a/chirp/drivers/ict8.py b/chirp/drivers/ict8.py index 1bc6714..6d63ba8 100644 --- a/chirp/drivers/ict8.py +++ b/chirp/drivers/ict8.py @@ -14,7 +14,7 @@ # along with this program. If not, see . from chirp.drivers import icf -from chirp import chirp_common, util, directory +from chirp import chirp_common, directory from chirp import bitwise mem_format = """ diff --git a/chirp/drivers/icv80.py b/chirp/drivers/icv80.py new file mode 100644 index 0000000..d120247 --- /dev/null +++ b/chirp/drivers/icv80.py @@ -0,0 +1,520 @@ +# Copyright 2008 Dan Smith +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +import logging + +from chirp.drivers import icf +from chirp import chirp_common, bitwise, errors, directory +from chirp.settings import RadioSetting, RadioSettingGroup, \ + RadioSettingValueList, RadioSettingValueBoolean, \ + RadioSettings + +LOG = logging.getLogger(__name__) + + +ICV80_MEM_FORMAT = """ + +#seekto 0x0000; +struct { + ul16 freq; + ul16 offset; + char name[5]; + u8 unknown0:2, + rtone:6; + u8 unknown1:2, + ctone:6; + u8 unknown2:1, + dtcs:7; + u8 unknown3:5, + tuning_step:3; + u8 unknown4:2, + mode:1, + reverse_duplex:1, + duplex:2, + mult:2; + u8 unknown6:2, + dtcs_polarity:2, + unknown8:2, + tmode:2; + u8 unknown8:5, + tx_inhibit:1, + power:2; +} memory[208]; + +#seekto 0x0cf0; +u8 skip[32]; + +#seekto 0x0d10; +u8 unused[32]; + +#seekto 0x0e50; +struct { + u8 unknown1:6, + beep:2; + u8 unknown2:3, + tot:5; + u8 unknown3; + u8 unknown4:6, + auto_pwr_off:2; + u8 unknown5:6, + lockout:2; + u8 unknown6:7, + squelch_delay:1; + u8 unknown7_0; + u8 unknown7_1:6, + mem_display1:2; + u8 unknown8:6, + mem_display2:2; // CS stores the display value here as well + u8 unknown9:7, + dial_func:1; + u8 unknown10:7, + lcd:1; + u8 unknown11:5, + pwr_save:3; + u8 unknown12:7, + sel_speed:1; + u8 unknown13:6, + mic_mode:2; + u8 unknown14:6, + battery_save:2; + u8 unknown15; + u8 unknown16:6, + resume:2; + u8 unknown17:5, + func_mode:3; + u8 unknown18:6, + backlight:2; + u8 unknown19; + u8 unknown:4, + vox_gain:4; + u8 unknown20:6, + mic_gain:2; + u8 unknown21:5 + vox_delay:3; + u8 unknown22:4, + vox_tot:4; + u8 unknown23[2]; + u8 unknown24:6, + edge:2; + u8 unknown25; + u8 unknown26:7, + auto_low_pwr:1; + u8 unknown27[3]; + +} settings; + + +""" + +SPECIAL_CHANNELS = { + "1A": 200, "1B": 201, + "2A": 202, "2B": 203, + "3A": 204, "3B": 205, + "C": 206, +} + +TMODES = ["", "Tone", "TSQL", "DTCS"] +MODES = ["FM", "NFM"] +SKIPS = ["", "S"] +DUPLEXES = ["", "-", "+"] +DTCS_POLARITY = ["NN", "NR", "RN", "RR"] +TUNING_STEPS = [5.0, 10.0, 12.5, 15.0, 20.0, 25.0, 30.0, 50.0] +POWER_LEVELS = [ + chirp_common.PowerLevel("High", watts=5.5), + chirp_common.PowerLevel("Low", watts=0.5), + chirp_common.PowerLevel("Mid", watts=2.5) +] + + +@directory.register +class ICV80Radio(icf.IcomCloneModeRadio, chirp_common.ExperimentalRadio): + """Icom IC-V80""" + VENDOR = "Icom" + MODEL = "IC-V80" + + _model = "\x32\x54\x00\x01" + _memsize = 0x0E80 + _endframe = "Icom Inc\x2e7C" + _can_hispeed = True + _ranges = [(0x0000, 0x0CE0, 32), + (0x0CE0, 0x0D40, 16), + (0x0D40, 0x0E00, 32), + (0x0E00, 0x0E20, 16), + (0x0E20, 0x0E60, 32), + (0x0E60, 0x0E70, 16), + (0x0E70, 0x0E72, 2), + (0x0E72, 0x0E77, 5), + (0x0E77, 0x0E78, 1), + (0x0E78, 0x0E80, 8), + ] + + @classmethod + def get_prompts(cls): + rp = chirp_common.RadioPrompts() + rp.experimental = ("This radio driver is currently under development, " + "and not all the features or functions may work as" + "expected. You should proceed with caution.") + return rp + + def get_features(self): + rf = chirp_common.RadioFeatures() + + rf.memory_bounds = (0, 199) + rf.valid_modes = MODES + rf.valid_tmodes = TMODES + rf.valid_duplexes = DUPLEXES + rf.valid_tuning_steps = TUNING_STEPS + rf.valid_power_levels = POWER_LEVELS + rf.valid_skips = SKIPS + rf.valid_name_length = 5 + rf.valid_special_chans = sorted(SPECIAL_CHANNELS.keys()) + rf.valid_bands = [(136000000, 174000000)] + rf.has_ctone = True + rf.has_offset = True + rf.has_bank = False + rf.has_settings = True + + return rf + + def process_mmap(self): + self._memobj = bitwise.parse(ICV80_MEM_FORMAT, self._mmap) + + def get_settings(self): + _settings = self._memobj.settings + + setmode = RadioSettingGroup("setmode", "Set Mode") + display = RadioSettingGroup("display", "Display") + sounds = RadioSettingGroup("sounds", "Sounds") + scan = RadioSettingGroup("scan", "Scan") + settings = RadioSettings(setmode, display, sounds, scan) + + # TOT + opts = ["Off"] + ["%d min" % t for t in range(1, 31)] + setmode.append( + RadioSetting( + "tot", "Time out Timer", + RadioSettingValueList(opts, opts[_settings.tot]))) + + # Lockout + opts = ["Off", "Rpt", "Busy"] + setmode.append( + RadioSetting( + "lockout", "Lockout", + RadioSettingValueList(opts, opts[_settings.lockout]))) + + # Auto Power Off + opts = ["Off", "30 min", "1 hr", "2 hrs"] + setmode.append( + RadioSetting( + "auto_pwr_off", "Auto Power Off", + RadioSettingValueList(opts, opts[_settings.auto_pwr_off]))) + + # Power Save + opts = ["Off", "1:2", "1:8", "1:16", "Auto"] + setmode.append( + RadioSetting( + "pwr_save", "Power Save", + RadioSettingValueList(opts, opts[_settings.pwr_save]))) + + # Battery Save + opts = ["Off", "Ni-MH", "Li-Ion"] + setmode.append( + RadioSetting( + "battery_save", "Battery Save", + RadioSettingValueList(opts, opts[_settings.battery_save]))) + + # Auto Low Power + opts = ["Off", "On"] + setmode.append( + RadioSetting( + "auto_low_pwr", "Auto Low Power", + RadioSettingValueList(opts, opts[_settings.auto_low_pwr]))) + + # Squelch Delay + opts = ["Short", "Long"] + setmode.append( + RadioSetting( + "squelch_delay", "Squelch Delay", + RadioSettingValueList(opts, opts[_settings.squelch_delay]))) + + # MIC Simple Mode + opts = ["Simple", "Normal 1", "Normal 2"] + setmode.append( + RadioSetting( + "mic_mode", "Mic Simple Mode", + RadioSettingValueList(opts, opts[_settings.mic_mode]))) + + # MIC Gain + opts = ["1", "2", "3", "4"] + setmode.append( + RadioSetting( + "mic_gain", "Mic Gain", + RadioSettingValueList(opts, opts[_settings.mic_gain]))) + + # VOX Gain + opts = ["Off"] + ["%d" % t for t in range(1, 11)] + setmode.append( + RadioSetting( + "vox_gain", "VOX Gain", + RadioSettingValueList(opts, opts[_settings.vox_gain]))) + + # VOX Delay + opts = ["0.5 sec", "1.0 sec", "1.5 sec", "2.0 sec", "2.5 sec", + "3.0 sec"] + setmode.append( + RadioSetting( + "vox_delay", "VOX Delay", + RadioSettingValueList(opts, opts[_settings.vox_delay]))) + + # VOX Time out Timer + opts = ["Off", "1 min", "2 min", "3 min", "4 min", "5 min", "10 min", + "15 min"] + setmode.append( + RadioSetting( + "vox_tot", "VOX Time-Out Timer", + RadioSettingValueList(opts, opts[_settings.vox_tot]))) + + # Select Speed + opts = ["Manual", "Auto"] + setmode.append( + RadioSetting( + "sel_speed", "Select Speed", + RadioSettingValueList(opts, opts[_settings.sel_speed]))) + + # Dial Function + opts = ["Audio Volume", "Tuning Dial"] + setmode.append( + RadioSetting( + "dial_func", "Dial Function", + RadioSettingValueList(opts, opts[_settings.dial_func]))) + + # Function Mode + opts = ["0 sec", "1 sec", "2 sec", "3 sec", "Manual"] + setmode.append( + RadioSetting( + "func_mode", "Function Mode", + RadioSettingValueList(opts, opts[_settings.func_mode]))) + + # Backlight + opts = ["Off", "On", "Auto"] + display.append( + RadioSetting( + "backlight", "Backlight", + RadioSettingValueList(opts, opts[_settings.backlight]))) + + # LCD Contrast + opts = ["Low", "Auto"] + display.append( + RadioSetting( + "lcd", "LCD Contrast", + RadioSettingValueList(opts, opts[_settings.lcd]))) + + # Memory Display + opts = ["Frequency", "Channel", "Name"] + display.append( + RadioSetting( + "mem_display1", "Memory Display", + RadioSettingValueList(opts, opts[_settings.mem_display1]))) + + # Beep + opts = ["Off", "1", "2", "3"] + sounds.append( + RadioSetting( + "beep", "Beep", + RadioSettingValueList(opts, opts[_settings.beep]))) + + # Edge + opts = ["All", "P1", "P2", "P3"] + scan.append( + RadioSetting( + "edge", "Edge", + RadioSettingValueList(opts, opts[_settings.edge]))) + + # Resume + opts = ["T-5", "T-10", "T-15", "P-2"] + scan.append( + RadioSetting( + "resume", "Resume", + RadioSettingValueList(opts, opts[_settings.resume]))) + + return settings + + def set_settings(self, settings): + _settings = self._memobj.settings + for element in settings: + if not isinstance(element, RadioSetting): + self.set_settings(element) + continue + if not element.changed(): + continue + + try: + if element.has_apply_callback(): + LOG.debug("Using apply callback") + element.run_apply_callback() + else: + setting = element.get_name() + LOG.debug("Setting %s = %s" % (setting, element.value)) + setattr(_settings, setting, element.value) + # This appears to need to be mirrored? + if element.get_name() == 'mem_display1': + _settings.mem_display2 = _settings.mem_display1 + except Exception: + LOG.debug(element.get_name()) + raise + + def _get_memory(self, number, extd_number=None): + bit = 1 << (number % 8) + byte = number // 8 + + _mem = self._memobj.memory[number] + _unused = self._memobj.unused[byte] + _skip = self._memobj.skip[byte] + + mem = chirp_common.Memory(number) + + if extd_number is not None: + mem.extd_number = extd_number + mem.immutable = ["name", "number", "extd_number", "skip"] + if extd_number == "C": + _unused = False + + if (_unused & bit): + mem.empty = True + return mem + + if int(_mem.mult): + mult = 6250 + else: + mult = 5000 + mem.freq = int(_mem.freq) * mult + mem.offset = int(_mem.offset) * mult + if mem.extd_number == "": + mem.name = str(_mem.name).rstrip() + mem.skip = (_skip & bit) and "S" or "" + mem.duplex = DUPLEXES[_mem.duplex] + mem.power = POWER_LEVELS[_mem.power] + mem.tuning_step = TUNING_STEPS[_mem.tuning_step] + mem.mode = MODES[_mem.mode] + mem.tmode = TMODES[_mem.tmode] + mem.rtone = chirp_common.TONES[_mem.rtone] + mem.ctone = chirp_common.TONES[_mem.ctone] + mem.dtcs = chirp_common.DTCS_CODES[_mem.dtcs] + mem.dtcs_polarity = DTCS_POLARITY[_mem.dtcs_polarity] + + # Reverse duplex + mem.extra = RadioSettingGroup("extra", "Extra") + rev = RadioSetting("reverse_duplex", "Reverse duplex", + RadioSettingValueBoolean(bool(_mem.reverse_duplex))) + rev.set_doc("Reverse duplex") + mem.extra.append(rev) + + # Tx inhibit + tx_inhibit = RadioSetting("tx_inhibit", "TX inhibit", + RadioSettingValueBoolean( + bool(not _mem.tx_inhibit))) + tx_inhibit.set_doc("TX inhibit") + mem.extra.append(tx_inhibit) + + return mem + + def get_memory(self, number): + extd_number = None + if isinstance(number, str): + try: + extd_number = number + number = SPECIAL_CHANNELS[number] + except KeyError: + raise errors.InvalidMemoryLocation( + "Unknown channel %s" % number) + + return self._get_memory(number, extd_number) + + def _fill_memory(self, mem): + number = mem.number + _mem = self._memobj.memory[number] + + # zero-fill + _mem.freq = 146010000 // 5000 + _mem.offset = 600000 // 5000 + _mem.name = str("").ljust(5) + _mem.duplex = 0x0 + _mem.reverse_duplex = 0x0 + _mem.tx_inhibit = 0x1 + _mem.power = 0x0 + _mem.tuning_step = 0x0 + _mem.mode = 0x0 + _mem.tmode = 0x0 + _mem.rtone = 0x8 + _mem.ctone = 0x8 + _mem.dtcs = 0x0 + _mem.dtcs_polarity = 0x0 + + for setting in mem.extra: + setattr(_mem, setting.get_name(), setting.value) + + def set_memory(self, mem): + bit = 1 << (mem.number % 8) + byte = mem.number // 8 + + _mem = self._memobj.memory[mem.number] + _unused = self._memobj.unused[byte] + _skip = (mem.extd_number == "") and self._memobj.skip[byte] or None + assert (_mem) + + if mem.empty: + self._fill_memory(mem) + _unused |= bit + if _skip is not None: + _skip |= bit + return + + _mem.set_raw(b'\x00' * 15) + + if chirp_common.required_step(mem.freq) == 12.5: + mult = 6250 + else: + mult = 5000 + _mem.mult = 0 if mult == 5000 else 3 + _mem.freq = mem.freq // mult + _mem.offset = int(mem.offset) // mult + _mem.name = str(mem.name).ljust(5) + _mem.duplex = DUPLEXES.index(mem.duplex) + power = mem.power or POWER_LEVELS[0] + _mem.power = POWER_LEVELS.index(power) + _mem.tuning_step = TUNING_STEPS.index(mem.tuning_step) + _mem.mode = MODES.index(mem.mode) + _mem.tmode = TMODES.index(mem.tmode) + _mem.rtone = chirp_common.TONES.index(mem.rtone) + _mem.ctone = chirp_common.TONES.index(mem.ctone) + _mem.dtcs = chirp_common.DTCS_CODES.index(mem.dtcs) + _mem.dtcs_polarity = DTCS_POLARITY.index(mem.dtcs_polarity) + + # Set used + _unused &= ~bit + + # Set skip + if _skip is not None: + if mem.skip == "S": + _skip |= bit + else: + _skip &= ~bit + + if mem.extra: + _mem.tx_inhibit = not mem.extra['tx_inhibit'].value + _mem.reverse_duplex = mem.extra['reverse_duplex'].value + + def get_raw_memory(self, number): + return repr(self._memobj.memory[number]) diff --git a/chirp/drivers/icv86.py b/chirp/drivers/icv86.py index 52e84e0..387546c 100644 --- a/chirp/drivers/icv86.py +++ b/chirp/drivers/icv86.py @@ -16,11 +16,10 @@ import logging from chirp.drivers import icf -from chirp import chirp_common, memmap, bitwise, errors, directory +from chirp import chirp_common, bitwise, errors, directory from chirp.settings import RadioSetting, RadioSettingGroup, \ RadioSettingValueInteger, RadioSettingValueList, \ - RadioSettingValueBoolean, RadioSettingValueString, \ - RadioSettingValueFloat, RadioSettings + RadioSettingValueBoolean, RadioSettings LOG = logging.getLogger(__name__) @@ -103,7 +102,8 @@ TUNING_STEPS = [5., 10., 12.5, 15., 20., 25., 30., 50.] POWER_LEVELS = [ chirp_common.PowerLevel("High", watts=5.5), chirp_common.PowerLevel("Low", watts=0.5), - chirp_common.PowerLevel("Mid", watts=2.5) + chirp_common.PowerLevel("Mid", watts=2.5), + chirp_common.PowerLevel("Extra High", watts=7.0), ] @@ -112,8 +112,6 @@ class ICV86Radio(icf.IcomCloneModeRadio): """Icom IC-V86""" VENDOR = "Icom" MODEL = "IC-V86" - # read clone response after each clone frame is sent - MUNCH_CLONE_RESP = True _model = "\x40\x66\x00\x01" _memsize = 5504 @@ -153,7 +151,6 @@ class ICV86Radio(icf.IcomCloneModeRadio): def process_mmap(self): self._memobj = bitwise.parse(ICV86_MEM_FORMAT, self._mmap) - def get_settings(self): _settings = self._memobj.settings @@ -170,7 +167,8 @@ class ICV86Radio(icf.IcomCloneModeRadio): # Mic Gain rs = RadioSetting("mic", "Mic Gain", - RadioSettingValueInteger(1, 4, _settings.mic + 1)) + RadioSettingValueInteger(1, 4, _settings.mic + 1)) + def apply_mic(s, obj): setattr(obj, s.get_name(), int(s.value) - 1) rs.set_apply_callback(apply_mic, self._memobj.settings) @@ -209,7 +207,7 @@ class ICV86Radio(icf.IcomCloneModeRadio): setting = element.get_name() LOG.debug("Setting %s = %s" % (setting, element.value)) setattr(_settings, setting, element.value) - except Exception as e: + except Exception: LOG.debug(element.get_name()) raise @@ -252,12 +250,12 @@ class ICV86Radio(icf.IcomCloneModeRadio): # Extras mem.extra = RadioSettingGroup("extra", "Extra") rev = RadioSetting("rev", "Reverse duplex", - RadioSettingValueBoolean(bool(_mem.rev))) + RadioSettingValueBoolean(bool(_mem.rev))) rev.set_doc("Reverse duplex") mem.extra.append(rev) - + tx = RadioSetting("tx", "Tx permission", - RadioSettingValueBoolean(bool(_mem.tx))) + RadioSettingValueBoolean(bool(_mem.tx))) tx.set_doc("Tx permission") mem.extra.append(tx) @@ -270,7 +268,7 @@ class ICV86Radio(icf.IcomCloneModeRadio): if not self._mmap: self.sync_in() - assert(self._mmap) + assert (self._mmap) if isinstance(number, str): try: @@ -283,12 +281,12 @@ class ICV86Radio(icf.IcomCloneModeRadio): def _fill_memory(self, number): _mem = self._memobj.memory[number] - assert(_mem) + assert (_mem) # zero-fill _mem.freq = 146010000 _mem.offset = 146010000 - _mem.name = str("").ljust(5) + _mem.name = str("").ljust(5) _mem.reserved1 = 0x0 _mem.rtone = 0x8 _mem.reserved2 = 0x0 @@ -308,7 +306,7 @@ class ICV86Radio(icf.IcomCloneModeRadio): _mem.tx = 0x1 _mem.reserved8 = 0x0 _mem.power = 0x0 - _mem.reserved9 = 0x0 + _mem.reserved9 = 0x0 _mem.reserved10 = 0x0 _mem.reserved11 = 0x0 _mem.reserved12 = 0x0 @@ -321,7 +319,7 @@ class ICV86Radio(icf.IcomCloneModeRadio): _usd = self._memobj.used[byte] if mem.number <= 206 else None _skp = self._memobj.skips[byte] if mem.number < 200 else None - assert(_mem) + assert (_mem) if mem.empty: self._fill_memory(mem.number) @@ -343,7 +341,7 @@ class ICV86Radio(icf.IcomCloneModeRadio): _mem.duplex = DUPLEXES.index(mem.duplex) _mem.dtcs_polarity = DTCS_POLARITY.index(mem.dtcs_polarity) _mem.tmode = TMODES.index(mem.tmode) - _mem.power = POWER_LEVELS.index(mem.power) + _mem.power = 0 if mem.power is None else POWER_LEVELS.index(mem.power) for setting in mem.extra: setattr(_mem, setting.get_name(), setting.value) @@ -361,11 +359,10 @@ class ICV86Radio(icf.IcomCloneModeRadio): if not self._mmap: self.sync_in() - assert(self._mmap) + assert (self._mmap) return self._set_memory(mem) def get_raw_memory(self, number): return repr(self._memobj.memory[number]) + \ - repr(self._memobj.flags[(number)]) - + repr(self._memobj.used[(number)]) diff --git a/chirp/drivers/icx8x.py b/chirp/drivers/icx8x.py index b8f1533..04f07fd 100644 --- a/chirp/drivers/icx8x.py +++ b/chirp/drivers/icx8x.py @@ -15,35 +15,85 @@ import logging -from chirp.drivers import icf, icx8x_ll -from chirp import chirp_common, errors, directory +from chirp import bitwise +from chirp.drivers import icf +from chirp import chirp_common, directory LOG = logging.getLogger(__name__) +MEM_FORMAT = """ +struct { + ul16 freq; + ul16 offset; + char name[5]; + u8 unknown1:2, + rtone:6; + u8 unknown2:2, + ctone:6; + u8 dtcs; + u8 unknown3[5]; + u8 tuning_step:4, + unknown4:4; + u8 unknown5[3]; + u8 mult:1, + unknown6_0:1, + narrow:1, + unknown6:1, + unknown7:2, + tmode:2; + u8 dtcs_pol:2, + duplex:2, + unknown9:4; + u8 unknown10:1, + txinhibit:1, + unknown11:2, + dvmode:1, + unknown12:3; +} memories[207]; + +#seekto 0x1370; +struct { + u8 unknown:2, + empty:1, + skip:1, + bank:4; +} flags[206]; + +struct dvcall { + char call[8]; + char pad[8]; +}; + +#seekto 0x15E0; +struct dvcall mycall[6]; +#seekto 0x1640; +struct dvcall urcall[6]; +#seekto 0x16A0; +struct dvcall rptcall[6]; +#seekto 0x1700; + +#seekto 0x1930; +u8 isuhf; +""" + + +TMODES = ["", "Tone", "TSQL", "DTCS"] +DUPLEXES = ["", '-', '+'] +TUNING_STEPS = [5.0, 10.0, 12.5, 15.0, 20.0, 25.0, 30.0, 50.0] +DTCS_POLARITY = ['NN', 'NR', 'RN', 'RR'] +SPECIALS = ['L0', 'U0', 'L1', 'U1', 'L2', 'U2', 'C'] -def _isuhf(radio): - try: - md = icf.get_model_data(radio) - val = md[20] - uhf = val & 0x10 - except: - raise errors.RadioError("Unable to probe radio band") - LOG.debug("Radio is a %s82" % (uhf and "U" or "V")) - - return uhf - - -@directory.register class ICx8xRadio(icf.IcomCloneModeRadio, chirp_common.IcomDstarSupport): """Icom IC-V/U82""" VENDOR = "Icom" MODEL = "IC-V82/U82" - NEEDS_COMPAT_SERIAL = True _model = "\x28\x26\x00\x01" _memsize = 6464 _endframe = "Icom Inc\x2eCD" + _can_hispeed = False + _double_ident = True _memories = [] @@ -65,101 +115,118 @@ class ICx8xRadio(icf.IcomCloneModeRadio, chirp_common.IcomDstarSupport): RPTCALL_LIMIT = (0, 6) def _get_bank(self, loc): - return icx8x_ll.get_bank(self._mmap, loc) + bank = int(self._memobj.flags[loc].bank) + if bank > 9: + return None + else: + return bank def _set_bank(self, loc, bank): - return icx8x_ll.set_bank(self._mmap, loc, bank) + if bank is None: + self._memobj.flags[loc].bank = 0x0A + else: + self._memobj.flags[loc].bank = bank def get_features(self): rf = chirp_common.RadioFeatures() rf.memory_bounds = (0, 199) rf.valid_modes = ["FM", "NFM", "DV"] - rf.valid_tmodes = ["", "Tone", "TSQL", "DTCS"] - rf.valid_duplexes = ["", "-", "+"] - rf.valid_tuning_steps = [5., 10., 12.5, 15., 20., 25., 30., 50.] - if self._isuhf: - rf.valid_bands = [(420000000, 470000000)] - else: - rf.valid_bands = [(118000000, 176000000)] + rf.valid_tmodes = list(TMODES) + rf.valid_duplexes = list(DUPLEXES) + rf.valid_tuning_steps = list(TUNING_STEPS) rf.valid_skips = ["", "S"] rf.valid_name_length = 5 - rf.valid_special_chans = sorted(icx8x_ll.ICx8x_SPECIAL.keys()) + rf.valid_special_chans = list(SPECIALS) return rf - def _get_type(self): - flag = (_isuhf(self) != 0) - - if self._isuhf is not None and (self._isuhf != flag): - raise errors.RadioError("VHF/UHF model mismatch") + def process_mmap(self): + self._memobj = bitwise.parse(MEM_FORMAT, self._mmap) - self._isuhf = flag - - return flag + def get_memory(self, number): + mem = chirp_common.Memory() + if isinstance(number, str): + mem.extd_number = number + number = 200 + SPECIALS.index(number) - def __init__(self, pipe): - icf.IcomCloneModeRadio.__init__(self, pipe) + _mem = self._memobj.memories[number] - # Until I find a better way, I'll stash a boolean to indicate - # UHF-ness in an unused region of memory. If we're opening a - # file, look for the flag. If we're syncing from serial, set - # that flag. - if isinstance(pipe, str): - self._isuhf = (ord(self._mmap[0x1930]) != 0) - # LOG.debug("Found %s image" % (self.isUHF and "UHF" or "VHF")) + if number < 206: + _flg = self._memobj.flags[number] + mem.skip = _flg.skip and 'S' or '' + empty = _flg.empty else: - self._isuhf = None - - def sync_in(self): - self._get_type() - icf.IcomCloneModeRadio.sync_in(self) - self._mmap[0x1930] = self._isuhf and 1 or 0 - - def sync_out(self): - self._get_type() - icf.IcomCloneModeRadio.sync_out(self) - - def get_memory(self, number): - if not self._mmap: - self.sync_in() + empty = False - if self._isuhf: - base = 400 + if _mem.mult: + mult = 6250 else: - base = 0 + mult = 5000 + + mem.number = number + if empty: + mem.empty = True + return mem + + mem.name = str(_mem.name).rstrip() + if _mem.dvmode: + mem.mode = 'DV' + elif _mem.narrow: + mem.mode = 'NFM' + else: + mem.mode = 'FM' + mem.duplex = DUPLEXES[_mem.duplex] + mem.tmode = TMODES[_mem.tmode] + mem.tuning_step = TUNING_STEPS[_mem.tuning_step] + mem.rtone = chirp_common.TONES[_mem.rtone] + mem.ctone = chirp_common.TONES[_mem.ctone] + mem.dtcs = chirp_common.DTCS_CODES[_mem.dtcs] + mem.dtcs_polarity = DTCS_POLARITY[_mem.dtcs_pol] - if isinstance(number, str): - try: - number = icx8x_ll.ICx8x_SPECIAL[number] - except KeyError: - raise errors.InvalidMemoryLocation("Unknown channel %s" % - number) + mem.freq = (_mem.freq * mult) + chirp_common.to_MHz(self._base) + mem.offset = _mem.offset * 5000 - return icx8x_ll.get_memory(self._mmap, number, base) + return mem def set_memory(self, memory): - if not self._mmap: - self.sync_in() - - if self._isuhf: - base = 400 - else: - base = 0 + _mem = self._memobj.memories[memory.number] + if memory.number < 206: + _flg = self._memobj.flags[memory.number] + _flg.skip = memory.skip == 'S' + _flg.empty = memory.empty if memory.empty: - self._mmap = icx8x_ll.erase_memory(self._mmap, memory.number) + return + + _mem.mult = chirp_common.is_fractional_step(memory.freq) + if _mem.mult: + mult = 6250 else: - self._mmap = icx8x_ll.set_memory(self._mmap, memory, base) + mult = 5000 + _mem.freq = (memory.freq - chirp_common.to_MHz(self._base)) // mult + _mem.offset = memory.offset // 5000 + _mem.name = memory.name[:5].ljust(5) + _mem.dvmode = memory.mode == 'DV' + _mem.narrow = memory.mode == 'NFM' + _mem.duplex = DUPLEXES.index(memory.duplex) + _mem.tmode = TMODES.index(memory.tmode) + _mem.tuning_step = TUNING_STEPS.index(memory.tuning_step) + _mem.rtone = chirp_common.TONES.index(memory.rtone) + _mem.ctone = chirp_common.TONES.index(memory.ctone) + _mem.dtcs = chirp_common.DTCS_CODES.index(memory.dtcs) + _mem.dtcs_pol = DTCS_POLARITY.index(memory.dtcs_polarity) def get_raw_memory(self, number): - return icx8x_ll.get_raw_memory(self._mmap, number) + if isinstance(number, str): + number = 200 + SPECIALS.index(number) + + return repr(self._memobj.memories[number]) def get_urcall_list(self): calls = [] for i in range(*self.URCALL_LIMIT): - call = icx8x_ll.get_urcall(self._mmap, i) - calls.append(call) + calls.append(str(self._memobj.urcall[i].call).rstrip()) return calls @@ -167,8 +234,7 @@ class ICx8xRadio(icf.IcomCloneModeRadio, chirp_common.IcomDstarSupport): calls = [] for i in range(*self.RPTCALL_LIMIT): - call = icx8x_ll.get_rptcall(self._mmap, i) - calls.append(call) + calls.append(str(self._memobj.rptcall[i].call).rstrip()) return calls @@ -176,34 +242,62 @@ class ICx8xRadio(icf.IcomCloneModeRadio, chirp_common.IcomDstarSupport): calls = [] for i in range(*self.MYCALL_LIMIT): - call = icx8x_ll.get_mycall(self._mmap, i) - calls.append(call) + calls.append(str(self._memobj.mycall[i].call).rstrip()) return calls def set_urcall_list(self, calls): for i in range(*self.URCALL_LIMIT): try: - call = calls[i] + call = calls[i].ljust(8) except IndexError: call = " " * 8 - - icx8x_ll.set_urcall(self._mmap, i, call) + self._memobj.urcall[i].call = call def set_repeater_call_list(self, calls): for i in range(*self.RPTCALL_LIMIT): try: - call = calls[i] + call = calls[i].ljust(8) except IndexError: call = " " * 8 - - icx8x_ll.set_rptcall(self._mmap, i, call) + self._memobj.rptcall[i].call = call def set_mycall_list(self, calls): for i in range(*self.MYCALL_LIMIT): try: - call = calls[i] + call = calls[i].ljust(8) except IndexError: call = " " * 8 + self._memobj.mycall[i].call = call + + +@directory.register +class ICV82Radio(ICx8xRadio): + MODEL = 'IC-V82' + _base = 0 + + def get_features(self): + rf = super().get_features() + rf.valid_bands = [(118000000, 176000000)] + return rf + + @classmethod + def match_model(cls, filedata, filename): + if super().match_model(filedata, filename): + return filedata[0x1930] == 0 + + +@directory.register +class ICU82Radio(ICx8xRadio): + MODEL = 'IC-U82' + _base = 400 + + def get_features(self): + rf = super().get_features() + rf.valid_bands = [(420000000, 470000000)] + return rf - icx8x_ll.set_mycall(self._mmap, i, call) + @classmethod + def match_model(cls, filedata, filename): + if super().match_model(filedata, filename): + return filedata[0x1930] == 1 diff --git a/chirp/drivers/icx8x_ll.py b/chirp/drivers/icx8x_ll.py deleted file mode 100644 index ea380a2..0000000 --- a/chirp/drivers/icx8x_ll.py +++ /dev/null @@ -1,539 +0,0 @@ -# Copyright 2008 Dan Smith -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -import struct - -from chirp import chirp_common, errors -from chirp.memmap import MemoryMap -from chirp.chirp_common import to_MHz -from chirp.util import StringStruct as struct - -POS_FREQ_START = 0 -POS_FREQ_END = 2 -POS_OFFSET = 2 -POS_NAME_START = 4 -POS_NAME_END = 9 -POS_RTONE = 9 -POS_CTONE = 10 -POS_DTCS = 11 -POS_TUNE_STEP = 17 -POS_TMODE = 21 -POS_MODE = 21 -POS_MULT_FLAG = 21 -POS_DTCS_POL = 22 -POS_DUPLEX = 22 -POS_DIG = 23 -POS_TXI = 23 - -POS_FLAGS_START = 0x1370 -POS_MYCALL = 0x15E0 -POS_URCALL = 0x1640 -POS_RPCALL = 0x16A0 -POS_RP2CALL = 0x1700 - -MEM_LOC_SIZE = 24 - -ICx8x_SPECIAL = {"C": 206} -ICx8x_SPECIAL_REV = {206: "C"} - -for i in range(0, 3): - idA = "%iA" % i - idB = "%iB" % i - num = 200 + i * 2 - ICx8x_SPECIAL[idA] = num - ICx8x_SPECIAL[idB] = num + 1 - ICx8x_SPECIAL_REV[num] = idA - ICx8x_SPECIAL_REV[num+1] = idB - - -def bank_name(index): - char = chr(ord("A") + index) - return "BANK-%s" % char - - -def get_freq(mmap, base): - if (ord(mmap[POS_MULT_FLAG]) & 0x80) == 0x80: - mult = 6250 - else: - mult = 5000 - - val = struct.unpack(">= 4 - icx8x_ts = list(chirp_common.TUNING_STEPS) - del icx8x_ts[1] - - try: - return icx8x_ts[tsidx] - except IndexError: - raise errors.InvalidDataError("TS index %i out of range (%i)" % - (tsidx, len(icx8x_ts))) - - -def set_tune_step(mmap, tstep): - val = struct.unpack("B", mmap[POS_TUNE_STEP])[0] & 0x0F - icx8x_ts = list(chirp_common.TUNING_STEPS) - del icx8x_ts[1] - - tsidx = icx8x_ts.index(tstep) - val |= (tsidx << 4) - - mmap[POS_TUNE_STEP] = val - - -def get_mode(mmap): - val = struct.unpack("B", mmap[POS_DIG])[0] & 0x08 - - if val == 0x08: - return "DV" - - val = struct.unpack("B", mmap[POS_MODE])[0] & 0x20 - - if val == 0x20: - return "NFM" - else: - return "FM" - - -def set_mode(mmap, mode): - dig = struct.unpack("B", mmap[POS_DIG])[0] & 0xF7 - - val = struct.unpack("B", mmap[POS_MODE])[0] & 0xDF - - if mode == "FM": - pass - elif mode == "NFM": - val |= 0x20 - elif mode == "DV": - dig |= 0x08 - else: - raise errors.InvalidDataError("%s mode not supported" % mode) - - mmap[POS_DIG] = dig - mmap[POS_MODE] = val - - -def is_used(mmap, number): - if number == ICx8x_SPECIAL["C"]: - return True - - return (ord(mmap[POS_FLAGS_START + number]) & 0x20) == 0 - - -def set_used(mmap, number, used=True): - if number == ICx8x_SPECIAL["C"]: - return - - val = struct.unpack("B", mmap[POS_FLAGS_START + number])[0] & 0xDF - - if not used: - val |= 0x20 - - mmap[POS_FLAGS_START + number] = val - - -def get_skip(mmap, number): - val = struct.unpack("B", mmap[POS_FLAGS_START + number])[0] & 0x10 - - if val != 0: - return "S" - else: - return "" - - -def set_skip(mmap, number, skip): - if skip == "P": - raise errors.InvalidDataError("PSKIP not supported by this model") - - val = struct.unpack("B", mmap[POS_FLAGS_START + number])[0] & 0xEF - - if skip == "S": - val |= 0x10 - - mmap[POS_FLAGS_START + number] = val - - -def get_call_indices(mmap): - return ord(mmap[18]) & 0x0F, \ - (ord(mmap[19]) & 0xF0) >> 4, \ - ord(mmap[19]) & 0x0F - - -def set_call_indices(_map, mmap, urcall, r1call, r2call): - ulist = [] - for i in range(0, 6): - ulist.append(get_urcall(_map, i)) - - rlist = [] - for i in range(0, 6): - rlist.append(get_rptcall(_map, i)) - - try: - if not urcall: - uindex = 0 - else: - uindex = ulist.index(urcall) - except ValueError: - raise errors.InvalidDataError("Call `%s' not in URCALL list" % urcall) - - try: - if not r1call: - r1index = 0 - else: - r1index = rlist.index(r1call) - except ValueError: - raise errors.InvalidDataError("Call `%s' not in RCALL list" % r1call) - - try: - if not r2call: - r2index = 0 - else: - r2index = rlist.index(r2call) - except ValueError: - raise errors.InvalidDataError("Call `%s' not in RCALL list" % r2call) - - mmap[18] = (ord(mmap[18]) & 0xF0) | uindex - mmap[19] = (r1index << 4) | r2index - -# -- - - -def get_mem_offset(number): - return number * MEM_LOC_SIZE - - -def get_raw_memory(mmap, number): - offset = get_mem_offset(number) - return MemoryMap(mmap[offset:offset + MEM_LOC_SIZE]) - - -def get_bank(mmap, number): - val = ord(mmap[POS_FLAGS_START + number]) & 0x0F - - if val >= 10: - return None - else: - return val - - -def set_bank(mmap, number, bank): - if bank is not None and bank > 9: - raise errors.InvalidDataError("Invalid bank number %i" % bank) - - if bank is None: - index = 0x0A - else: - index = bank - - val = ord(mmap[POS_FLAGS_START + number]) & 0xF0 - val |= index - mmap[POS_FLAGS_START + number] = val - - -def _get_memory(_map, mmap, base): - if get_mode(mmap) == "DV": - mem = chirp_common.DVMemory() - i_ucall, i_r1call, i_r2call = get_call_indices(mmap) - mem.dv_urcall = get_urcall(_map, i_ucall) - mem.dv_rpt1call = get_rptcall(_map, i_r1call) - mem.dv_rpt2call = get_rptcall(_map, i_r2call) - else: - mem = chirp_common.Memory() - - mem.freq = get_freq(mmap, base) - mem.name = get_name(mmap) - mem.rtone = get_rtone(mmap) - mem.ctone = get_ctone(mmap) - mem.dtcs = get_dtcs(mmap) - mem.dtcs_polarity = get_dtcs_polarity(mmap) - mem.offset = get_dup_offset(mmap) - mem.duplex = get_duplex(mmap) - mem.tmode = get_tone_enabled(mmap) - mem.tuning_step = get_tune_step(mmap) - mem.mode = get_mode(mmap) - - return mem - - -def get_memory(_map, number, base): - if not is_used(_map, number): - mem = chirp_common.Memory() - if number < 200: - mem.number = number - mem.empty = True - return mem - else: - mmap = get_raw_memory(_map, number) - mem = _get_memory(_map, mmap, base) - - mem.number = number - - if number < 200: - mem.skip = get_skip(_map, number) - else: - mem.extd_number = ICx8x_SPECIAL_REV[number] - mem.immutable = ["number", "skip", "bank", "bank_index", "extd_number"] - - return mem - - -def clear_tx_inhibit(mmap): - txi = struct.unpack("B", mmap[POS_TXI])[0] - txi |= 0x40 - mmap[POS_TXI] = txi - - -def set_memory(_map, memory, base): - mmap = get_raw_memory(_map, memory.number) - - set_freq(mmap, memory.freq, base) - set_name(mmap, memory.name) - set_rtone(mmap, memory.rtone) - set_ctone(mmap, memory.ctone) - set_dtcs(mmap, memory.dtcs) - set_dtcs_polarity(mmap, memory.dtcs_polarity) - set_dup_offset(mmap, memory.offset) - set_duplex(mmap, memory.duplex) - set_tone_enabled(mmap, memory.tmode) - set_tune_step(mmap, memory.tuning_step) - set_mode(mmap, memory.mode) - if memory.number < 200: - set_skip(_map, memory.number, memory.skip) - - if isinstance(memory, chirp_common.DVMemory): - set_call_indices(_map, - mmap, - memory.dv_urcall, - memory.dv_rpt1call, - memory.dv_rpt2call) - - if not is_used(_map, memory.number): - clear_tx_inhibit(mmap) - - _map[get_mem_offset(memory.number)] = mmap.get_packed() - set_used(_map, memory.number) - - return _map - - -def erase_memory(_map, number): - set_used(_map, number, False) - - return _map - - -def call_location(base, index): - return base + (16 * index) - - -def get_urcall(mmap, index): - if index > 5: - raise errors.InvalidDataError("URCALL index %i must be <= 5" % index) - - start = call_location(POS_URCALL, index) - - return mmap[start:start+8].rstrip() - - -def get_rptcall(mmap, index): - if index > 5: - raise errors.InvalidDataError("RPTCALL index %i must be <= 5" % index) - - start = call_location(POS_RPCALL, index) - - return mmap[start:start+8].rstrip() - - -def get_mycall(mmap, index): - if index > 5: - raise errors.InvalidDataError("MYCALL index %i must be <= 5" % index) - - start = call_location(POS_MYCALL, index) - - return mmap[start:start+8].rstrip() - - -def set_urcall(mmap, index, call): - if index > 5: - raise errors.InvalidDataError("URCALL index %i must be <= 5" % index) - - start = call_location(POS_URCALL, index) - - mmap[start] = call.ljust(12) - - return mmap - - -def set_rptcall(mmap, index, call): - if index > 5: - raise errors.InvalidDataError("RPTCALL index %i must be <= 5" % index) - - start = call_location(POS_RPCALL, index) - mmap[start] = call.ljust(12) - - start = call_location(POS_RP2CALL, index) - mmap[start] = call.ljust(12) - - return mmap - - -def set_mycall(mmap, index, call): - if index > 5: - raise errors.InvalidDataError("MYCALL index %i must be <= 5" % index) - - start = call_location(POS_MYCALL, index) - - mmap[start] = call.ljust(12) - - return mmap diff --git a/chirp/drivers/icx90.py b/chirp/drivers/icx90.py index 33294d7..d5e6584 100644 --- a/chirp/drivers/icx90.py +++ b/chirp/drivers/icx90.py @@ -18,13 +18,11 @@ import logging from chirp.drivers import icf -import struct from chirp import chirp_common, bitwise, errors, directory -from chirp.memmap import MemoryMap from chirp.settings import RadioSetting, RadioSettingGroup, \ RadioSettingValueInteger, RadioSettingValueList, \ RadioSettingValueBoolean, RadioSettingValueString, \ - RadioSettingValueFloat, InvalidValueError, RadioSettings + RadioSettings import argparse ICX90_MEM_FORMAT = """ @@ -164,8 +162,8 @@ DTMF_AUTODIAL_NUM = 10 DTMF_DIGITS_NUM = 16 OPENING_MESSAGE_LEN = 6 COMMENT_LEN = 16 -BANDS=10 -TV_CHANNELS=68 +BANDS = 10 +TV_CHANNELS = 68 CHARSET = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789()*+-,/|= " NAME_LENGTH = 6 @@ -218,6 +216,7 @@ VFO_SCAN = ["All", "Band", "P0", "P1", "P2", "P3", "P4", "P5", "P6", "P7", "P8", MEMORY_SCAN = ["All", "Bank", "Sel BC", "Sel 5 MHz", "Sel 50 MHz", "Sel WFM", "Sel Air", "Sel 144 MHz", "Sel 220 MHz", "Sel 300 MHz", "Sel 440 MHz", "Sel 800 MHz"] + class ICx90BankModel(icf.IcomIndexedBankModel): bank_index = BANK_INDEX @@ -226,7 +225,7 @@ class ICx90BankModel(icf.IcomIndexedBankModel): if (self._radio._num_banks != len(type(self).bank_index)): raise Exception("Invalid number of banks %d, supported only %d banks" % - (self._radio._num_banks, len(type(self).bank_index))) + (self._radio._num_banks, len(type(self).bank_index))) for i in range(0, self._radio._num_banks): index = type(self).bank_index[i] @@ -236,17 +235,17 @@ class ICx90BankModel(icf.IcomIndexedBankModel): return banks + class ICT90_Alias(chirp_common.Alias): VENDOR = "Icom" MODEL = "IC-T90" + @directory.register class ICx90Radio(icf.IcomCloneModeRadio): """Icom IC-E/T90""" VENDOR = "Icom" MODEL = "IC-E90" - # read clone response after each clone frame is sent - MUNCH_CLONE_RESP = True ALIASES = [ICT90_Alias] @@ -263,32 +262,32 @@ class ICx90Radio(icf.IcomCloneModeRadio): icf.IcomCloneModeRadio.__init__(self, pipe) def special_add(self, key, item_type, num, unique_idx): - item = {} - item["item_type"] = item_type - item["num"] = num - item["uidx"] = unique_idx - self.special[key] = item + item = {} + item["item_type"] = item_type + item["num"] = num + item["uidx"] = unique_idx + self.special[key] = item def init_special(self): - self.special = {} - i = 0 - # program scan edges - for x in range(25): - self.special_add("Scan edge: %02dA" % x, "scan_edge", x * 2, i) - self.special_add("Scan edge: %02dB" % x, "scan_edge", x * 2 + 1, i + 1) - i += 2 - # call channels - for x in range(5): - self.special_add("Call ch: %d" % x, "call_chan", x, i) - i += 1 - # VFO A - for x in range(10): - self.special_add("VFO A: %d" % x, "vfo_a", x, i) - i += 1 - # VFO B - for x in range(10): - self.special_add("VFO B: %d" % x, "vfo_b", x, i) - i += 1 + self.special = {} + i = 0 + # program scan edges + for x in range(25): + self.special_add("Scan edge: %02dA" % x, "scan_edge", x * 2, i) + self.special_add("Scan edge: %02dB" % x, "scan_edge", x * 2 + 1, i + 1) + i += 2 + # call channels + for x in range(5): + self.special_add("Call ch: %d" % x, "call_chan", x, i) + i += 1 + # VFO A + for x in range(10): + self.special_add("VFO A: %d" % x, "vfo_a", x, i) + i += 1 + # VFO B + for x in range(10): + self.special_add("VFO B: %d" % x, "vfo_b", x, i) + i += 1 def get_sub_devices(self): return [ICx90Radio_ham(self._mmap), ICx90Radio_tv(self._mmap)] @@ -405,68 +404,68 @@ class ICx90Radio(icf.IcomCloneModeRadio): 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]))) + SQUELCH_LEVEL[self.memobj.squelch_level]))) basic.append(RadioSetting("scan_resume", "Scan resume", RadioSettingValueList(SCAN_RESUME, - SCAN_RESUME[self.memobj.scan_resume]))) + SCAN_RESUME[self.memobj.scan_resume]))) basic.append(RadioSetting("scan_pause", "Scan pause", RadioSettingValueList(SCAN_PAUSE, - SCAN_PAUSE[self.memobj.scan_pause]))) + SCAN_PAUSE[self.memobj.scan_pause]))) basic.append(RadioSetting("beep_volume", "Beep audio", RadioSettingValueList(BEEP_VOLUME, - BEEP_VOLUME[self.memobj.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]))) + 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]))) + AUTO_POWER_OFF[self.memobj.auto_power_off]))) basic.append(RadioSetting("power_save", "Power save", RadioSettingValueList(POWER_SAVE, - POWER_SAVE[self.memobj.power_save]))) + POWER_SAVE[self.memobj.power_save]))) basic.append(RadioSetting("monitor", "Monitor", RadioSettingValueList(MONITOR, - MONITOR[self.memobj.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]))) + 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]))) + 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]))) + WX_CHANNEL[self.memobj.wx_channel]))) basic.append(RadioSetting("comment", "Comment", RadioSettingValueString(0, COMMENT_LEN, - str(self.memobj.comment), - autopad = True))) + 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]))) + 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]))) + 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]))) + DIAL_SELECT[self.memobj.dial_select]))) basic.append(RadioSetting("power", "RF power", RadioSettingValueList(POWER, - POWER[self.memobj.power]))) + POWER[self.memobj.power]))) basic.append(RadioSetting("vfo", "Current VFO", RadioSettingValueList(VFO, - VFO[self.memobj.vfo]))) + VFO[self.memobj.vfo]))) basic.append(RadioSetting("attenuator", "RF attenuator", RadioSettingValueBoolean(self.memobj.attenuator))) basic.append(RadioSetting("skip_scan", "Skip scan", @@ -478,25 +477,25 @@ class ICx90Radio(icf.IcomCloneModeRadio): # OPERATION_MODE[self.memobj.mode]))) basic.append(RadioSetting("vfo_scan", "VFO scan", RadioSettingValueList(VFO_SCAN, - VFO_SCAN[self.memobj.vfo_scan]))) + VFO_SCAN[self.memobj.vfo_scan]))) basic.append(RadioSetting("memory_scan", "Memory scan", RadioSettingValueList(MEMORY_SCAN, - MEMORY_SCAN[self.memobj.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]))) + AUTODIAL[self.memobj.autodial]))) dtmf_autodial.append(RadioSetting("dtmf_speed", "Speed", RadioSettingValueList(DTMF_SPEED, - DTMF_SPEED[self.memobj.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 ")) + 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) @@ -509,29 +508,29 @@ class ICx90Radio(icf.IcomCloneModeRadio): RadioSettingValueBoolean(self.memobj.scan_stop_light))) expand_1.append(RadioSetting("light_postion", "Light position", RadioSettingValueList(LIGHT_POSITION, - LIGHT_POSITION[self.memobj.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]))) + 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]))) + 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]))) + 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]))) + 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))) + str(self.memobj.opening_message_text), + autopad=True, charset=CHARSET))) # expand 2 expand_2.append(RadioSetting("expand_2", "Expand 2", @@ -540,10 +539,10 @@ class ICx90Radio(icf.IcomCloneModeRadio): RadioSettingValueBoolean(self.memobj.busy_lockout))) expand_2.append(RadioSetting("timeout_timer", "Timeout timer", RadioSettingValueList(TIMEOUT_TIMER, - TIMEOUT_TIMER[self.memobj.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]))) + 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", @@ -552,7 +551,7 @@ class ICx90Radio(icf.IcomCloneModeRadio): 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]))) + MORSE_CODE_SPEED[self.memobj.morse_code_speed]))) return group except: @@ -596,17 +595,13 @@ class ICx90Radio(icf.IcomCloneModeRadio): except AttributeError as e: LOG.error("Setting %s is not in the memory map: %s" % (element.get_name(), e)) - except Exception as e: + except Exception: LOG.debug(element.get_name()) raise def process_mmap(self): self.memobj = bitwise.parse(ICX90_MEM_FORMAT, self._mmap) - def get_raw_memory(self, number): - (mem_item, special, unique_idx) = self.get_mem_item(number) - return repr(mem_item) - def sync_in(self): icf.IcomCloneModeRadio.sync_in(self) self.process_mmap() @@ -699,15 +694,16 @@ class ICx90Radio(icf.IcomCloneModeRadio): if not special: mem.skip = self.get_skip(number) if special: - mem.extd_number = number - mem.number = -len(self.special) + unique_idx + mem.extd_number = number + mem.number = -len(self.special) + unique_idx else: - mem.number = number + mem.number = number return mem def set_memory(self, memory): - (mem_item, special, unique_idx) = self.get_mem_item(memory.number) + (mem_item, special, unique_idx) = self.get_mem_item( + memory.extd_number or memory.number) if memory.empty: mem_item.set_raw("\x00" * MEM_ITEM_SIZE) self.clear_bank(memory.number) @@ -740,7 +736,9 @@ class ICx90Radio(icf.IcomCloneModeRadio): def get_bank_model(self): return ICx90BankModel(self) + class ICx90Radio_ham(ICx90Radio): + VARIANT = 'Radio' def get_features(self): rf = ICx90Radio.get_features(self) @@ -748,6 +746,7 @@ class ICx90Radio_ham(ICx90Radio): return rf + class ICx90Radio_tv(ICx90Radio): VARIANT = "TV" @@ -837,6 +836,7 @@ class ICx90Radio_tv(ICx90Radio): mem_item.mode = TV_MODE.index(memory.mode) self.set_skip(memory.number, memory.skip) + def dump_banks(icx90, template_file): mb = icx90.get_features().memory_bounds with open(template_file, "w") as f: @@ -849,6 +849,7 @@ def dump_banks(icx90, template_file): if not mem.empty and bank is not None and bank_pos is not None: f.write("%s;%s;%d\n" % (mem.name, bank, bank_pos)) + def read_template_file(template_file): banks_templ = {} with open(template_file, "r") as f: @@ -858,6 +859,7 @@ def read_template_file(template_file): banks_templ[l[0]] = l[1:] return banks_templ + def reorder_banks(icx90, preserve_position, preserve_unknown, banks_templ): banks_cnt = [] mb = icx90.get_features().memory_bounds @@ -888,6 +890,7 @@ def reorder_banks(icx90, preserve_position, preserve_unknown, banks_templ): icx90._set_bank(mi, bank) icx90._set_bank_index(mi, bank_pos) + if __name__ == "__main__": parser = argparse.ArgumentParser(description="Icom IC-E90 banks handling helper.") parser.add_argument("icx90_img_file", help="IC-X90 IMG file.") diff --git a/chirp/drivers/id31.py b/chirp/drivers/id31.py index 97d1c4b..a10e0a7 100644 --- a/chirp/drivers/id31.py +++ b/chirp/drivers/id31.py @@ -13,9 +13,12 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +import logging + from chirp.drivers import icf -from chirp import directory, bitwise, chirp_common +from chirp import directory, bitwise, chirp_common, settings +LOG = logging.getLogger(__name__) MEM_FORMAT = """ struct { u24 freq; @@ -26,13 +29,14 @@ struct { mode:3; u8 dtcs; u8 tune_step:4, - unknown5:4; + dsql_mode:2, + unknown5:2; u8 unknown4; u8 tmode:4, duplex:2, dtcs_polarity:2; char name[16]; - u8 unknow13; + u8 digcode; u8 urcall[7]; u8 rpt1call[7]; u8 rpt2call[7]; @@ -93,32 +97,16 @@ DUPLEX = ["", "-", "+"] DTCS_POLARITY = ["NN", "NR", "RN", "RR"] TUNING_STEPS = [5.0, 6.25, 0, 0, 10.0, 12.5, 15.0, 20.0, 25.0, 30.0, 50.0, 100.0, 125.0, 200.0] +DSQL_MODES = ['', 'DSQL', 'CSQL'] def _decode_call(_call): # Why Icom, why? - call = "" - shift = 1 - acc = 0 - for val in _call: - mask = (1 << (shift)) - 1 - call += chr((val >> shift) | acc) - acc = (val & mask) << (7 - shift) - shift += 1 - call += chr(acc) - return call + return ''.join(chr(x) for x in icf.warp_byte_size(_call, 7, 8)) def _encode_call(call): - _call = [0x00] * 7 - for i in range(0, 7): - val = ord(call[i]) << (i + 1) - if i > 0: - _call[i-1] |= (val & 0xFF00) >> 8 - _call[i] = val - _call[6] |= (ord(call[7]) & 0x7F) - - return _call + return list(icf.warp_byte_size(call.ljust(8), 8, 7)) def _get_freq(_mem): @@ -170,6 +158,11 @@ class ID31Radio(icf.IcomCloneModeRadio, chirp_common.IcomDstarSupport): _bank_class = ID31Bank _can_hispeed = True + _icf_data = { + 'MapRev': 1, + 'EtcData': 0x000005, + } + _ranges = [(0x00000, 0x15500, 32)] MODES = {0: "FM", 1: "NFM", 5: "DV"} @@ -210,6 +203,7 @@ class ID31Radio(icf.IcomCloneModeRadio, chirp_common.IcomDstarSupport): rf.valid_skips = ["", "S", "P"] rf.valid_characters = chirp_common.CHARSET_ASCII rf.valid_name_length = 16 + rf.requires_call_lists = False return rf def process_mmap(self): @@ -218,6 +212,25 @@ class ID31Radio(icf.IcomCloneModeRadio, chirp_common.IcomDstarSupport): def get_raw_memory(self, number): return repr(self._memobj.memory[number]) + def _get_mem_extra(self, _mem, mem): + extra = settings.RadioSettingGroup('extra', 'Extra') + rs = settings.RadioSetting( + 'dsql', 'DSQL Mode', + settings.RadioSettingValueList( + DSQL_MODES, current_index=int(_mem.dsql_mode))) + extra.append(rs) + return extra + + def _set_mem_extra(self, _mem, mem): + try: + _mem.dsql_mode = DSQL_MODES.index(str(mem.extra['dsql'].value)) + except (KeyError, TypeError): + # No settings or dsql is not provided + pass + except ValueError: + LOG.error('Invalid extra.dsql_mode: %r' % str( + mem.extra['dsql'].value)) + def get_memory(self, number): _mem = self._memobj.memory[number] _usd = self._memobj.used_flags[number / 8] @@ -251,12 +264,15 @@ class ID31Radio(icf.IcomCloneModeRadio, chirp_common.IcomDstarSupport): mem.dv_urcall = _decode_call(_mem.urcall).rstrip() mem.dv_rpt1call = _decode_call(_mem.rpt1call).rstrip() mem.dv_rpt2call = _decode_call(_mem.rpt2call).rstrip() + mem.dv_code = int(_mem.digcode) if _psk & bit: mem.skip = "P" elif _skp & bit: mem.skip = "S" + mem.extra = self._get_mem_extra(_mem, mem) + return mem def set_memory(self, memory): @@ -290,8 +306,13 @@ class ID31Radio(icf.IcomCloneModeRadio, chirp_common.IcomDstarSupport): _mem.urcall = _encode_call(memory.dv_urcall.ljust(8)) _mem.rpt1call = _encode_call(memory.dv_rpt1call.ljust(8)) _mem.rpt2call = _encode_call(memory.dv_rpt2call.ljust(8)) + _mem.digcode = memory.dv_code elif memory.mode == "DV": - raise Exception("BUG") + LOG.debug('Converting Memory to DVMemory with default values') + _mem.urcall = _encode_call('CQCQCQ'.ljust(8)) + _mem.rpt1call = _encode_call(' ' * 8) + _mem.rpt2call = _encode_call(' ' * 8) + _mem.digcode = 0 if memory.skip == "S": _skp |= bit @@ -303,6 +324,8 @@ class ID31Radio(icf.IcomCloneModeRadio, chirp_common.IcomDstarSupport): _skp &= ~bit _psk &= ~bit + self._set_mem_extra(_mem, memory) + def get_urcall_list(self): calls = [] for i in range(0, 200): @@ -331,6 +354,7 @@ class ID31Radio(icf.IcomCloneModeRadio, chirp_common.IcomDstarSupport): calls.append(call.rstrip()) return calls + if __name__ == "__main__": print(repr(_decode_call(_encode_call("KD7REX B")))) print(repr(_decode_call(_encode_call(" B")))) diff --git a/chirp/drivers/id51.py b/chirp/drivers/id51.py index c914230..402b1dc 100644 --- a/chirp/drivers/id51.py +++ b/chirp/drivers/id51.py @@ -29,13 +29,14 @@ struct { mode:3; u8 dtcs; u8 tune_step:4, - unknown5:4; + dsql_mode:2, + unknown5:2; u8 unknown4; u8 tmode:4, duplex:2, dtcs_polarity:2; char name[16]; - u8 unknown13; + u8 digcode; u8 urcall[7]; u8 rpt1call[7]; u8 rpt2call[7]; @@ -114,17 +115,12 @@ class ID51Radio(id31.ID31Radio): # Since the ID-51 and ID-51 Plus/Anniversary have exactly # the same memory size, we need to do a more detailed check. if len(filedata) == cls._memsize: - LOG.debug('File has correct memory size, ' - 'checking 20 bytes at offset 0x1AF40') snip = bytes(filedata[0x1AF40:0x1AF60]) if snip == bytes(b'\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF' b'\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF' b'\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF' b'\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF'): - LOG.debug('bytes matched ID-51 Signature') return True - else: - LOG.debug('bytes did not match ID-51 Signature') return False def get_features(self): diff --git a/chirp/drivers/id5100.py b/chirp/drivers/id5100.py new file mode 100644 index 0000000..c518f44 --- /dev/null +++ b/chirp/drivers/id5100.py @@ -0,0 +1,340 @@ +# Copyright 2022 Dan Smith +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +import logging + +from chirp import chirp_common +from chirp import directory +from chirp.drivers import icf, id31 +from chirp import errors +from chirp import bitwise + +LOG = logging.getLogger(__name__) + + +MEM_FORMAT = """ +struct { + u24 mult1:3, + mult2:3, + freq:18; + u16 offset; + u16 rtone:6, + ctone:6, + unknown1:1, + mode:3; + u8 dtcs; + u8 tuning_step:4, + unknown2:4; + u8 unknown3; + u8 tmode:4, + duplex:2, + dtcs_polarity:2; + char name[16]; + u8 dv_code; + u8 urcall[7]; + u8 rpt1call[7]; + u8 rpt2call[7]; +} memory[1004]; + +#seekto 0xC040; +u8 usedflags[125]; +#seekto 0xC0BE; +u8 skipflags[125]; +#seekto 0xC13B; +u8 pskipflags[125]; + +#seekto 0xC1C0; +struct { + u8 bank; + u8 index; +} bank_info[1000]; + +#seekto 0xC9C0; +char ICFComment[16]; +struct { + char name[16]; +} bank_names[26]; +""" + +TUNE_STEPS = [5.0, 6.25, 8.33, 5.0, 10.0, 12.5, 15.0, 20.0, 25.0, 30.0, 50.0, + 5.0, 5.0, 5.0, 5.0] +MODES = ['FM', 'NFM', '2??', 'AM', 'NAM', 'DV', '6??', '7??'] +TMODES = ['', 'Tone', '2??', 'TSQL', '4??', 'DTCS', 'TSQL-R', 'DTCS-R', + 'DTCS-T', 'Tone->DTCS', 'DTCS->Tone', 'Tone->Tone'] +DUPLEX = ['', '-', '+'] +DTCS_POL = ['NN', 'NR', 'RN', 'RR'] +SPECIALS = ['144-C0', '144-C1', '430-C0', '430-C1'] +MULTS = [5000, 6250, 25000 / 3.0] + + +@directory.register +class ID4100Radio(icf.IcomCloneModeRadio, chirp_common.IcomDstarSupport): + VENDOR = 'Icom' + MODEL = 'ID-4100' + NEEDS_COMPAT_SERIAL = False + + _model = b'\x38\x66\x00\x01' + _endframe = 'Icom Inc.8F' + _memsize = 0x2A3C0 + _ranges = [(0, _memsize, 64)] + _raw_frames = True + _highbit_flip = True + + _num_banks = 26 + _bank_class = id31.ID31Bank + + _can_hispeed = True + _icf_data = { + 'MapRev': 1, + 'EtcData': 0x400001, + } + + def process_mmap(self): + self._memobj = bitwise.parse(MEM_FORMAT, self._mmap) + + def get_features(self): + rf = chirp_common.RadioFeatures() + rf.has_ctone = True + rf.has_dtcs = True + rf.has_dtcs_polarity = True + rf.has_bank = True + rf.has_bank_index = True + rf.has_bank_names = True + rf.requires_call_lists = False + rf.valid_modes = [x for x in MODES + if '?' not in x] + rf.valid_tmodes = [x for x in TMODES + if '-' not in x and '?' not in x] + ['Cross'] + rf.valid_cross_modes = [x for x in TMODES + if '->' in x] + rf.memory_bounds = (0, 999) + rf.valid_bands = [(118000000, 174000000), + (375000000, 550000000)] + rf.valid_skips = ['', 'S', 'P'] + rf.valid_characters = chirp_common.CHARSET_ASCII + rf.valid_name_length = 16 + rf.valid_tuning_steps = list(sorted(set(TUNE_STEPS))) + rf.valid_special_chans = list(SPECIALS) + return rf + + def _get_bank(self, loc): + _bank = self._memobj.bank_info[loc] + _bank.bank &= 0x1F + if _bank.bank == 0x1F: + return None + else: + return _bank.bank + + def _set_bank(self, loc, bank): + _bank = self._memobj.bank_info[loc] + if bank is None: + _bank.bank = 0x1F + else: + _bank.bank = bank + + def _get_bank_index(self, loc): + _bank = self._memobj.bank_info[loc] + return _bank.index + + def _set_bank_index(self, loc, index): + _bank = self._memobj.bank_info[loc] + _bank.index = index + + def _get_raw_memory(self, number): + if isinstance(number, str): + number = 1000 + SPECIALS.index(number) + return number, self._memobj.memory[number] + + def get_raw_memory(self, number): + num, mem = self._get_raw_memory(number) + return repr(mem) + + def get_memory(self, number): + num, _mem = self._get_raw_memory(number) + m = chirp_common.DVMemory() + m.number = num + if isinstance(number, str): + m.extd_number = number + else: + _flg = self._memobj.usedflags[num // 8] + _skp = self._memobj.skipflags[num // 8] + _pskp = self._memobj.pskipflags[num // 8] + m.empty = bool(_flg & (1 << num % 8)) + if _pskp & 1 << (num % 8): + m.skip = 'P' + elif _skp & 1 << (num % 8): + m.skip = 'S' + else: + m.skip = '' + + mult = MULTS[_mem.mult1] + m.freq = int(_mem.freq * mult) + m.offset = int(_mem.offset * mult) + m.tuning_step = TUNE_STEPS[_mem.tuning_step] + m.name = str(_mem.name).rstrip() + m.mode = MODES[_mem.mode] + m.rtone = chirp_common.TONES[_mem.rtone] + m.ctone = chirp_common.TONES[_mem.ctone] + m.dtcs = chirp_common.DTCS_CODES[_mem.dtcs] + m.dtcs_polarity = DTCS_POL[_mem.dtcs_polarity] + tmode = TMODES[_mem.tmode] + if '->' in tmode: + m.tmode = 'Cross' + m.cross_mode = tmode + elif '-' in tmode and 0: + # FIXME + m.tmode, extra = tmode.split('-') + else: + m.tmode = tmode + m.duplex = DUPLEX[_mem.duplex] + + m.dv_code = _mem.dv_code + m.dv_urcall = ''.join( + chr(x) for x in icf.warp_byte_size(_mem.urcall, 7, 8)) + m.dv_rpt1call = ''.join( + chr(x) for x in icf.warp_byte_size(_mem.rpt1call, 7, 8)) + m.dv_rpt2call = ''.join( + chr(x) for x in icf.warp_byte_size(_mem.rpt2call, 7, 8)) + + return m + + def set_memory(self, mem): + num, _mem = self._get_raw_memory(mem.number) + if num < 1000: + _flg = self._memobj.usedflags[num // 8] + _skp = self._memobj.skipflags[num // 8] + _pskp = self._memobj.pskipflags[num // 8] + mybit = 1 << (num % 8) + _flg |= mybit + _skp &= ~mybit + _pskp &= ~mybit + + if mem.empty: + return + + _flg &= ~mybit + if mem.skip == 'S': + _skp |= mybit + elif mem.skip == 'P': + _pskp |= mybit + + if chirp_common.is_6_25(mem.freq): + mult = MULTS[1] + elif chirp_common.is_8_33(mem.freq): + mult = MULTS[2] + else: + mult = MULTS[0] + _mem.mult1 = _mem.mult2 = MULTS.index(mult) + _mem.freq = mem.freq / mult + _mem.offset = mem.offset / mult + _mem.tuning_step = TUNE_STEPS.index(mem.tuning_step) + _mem.name = mem.name.ljust(16) + _mem.mode = MODES.index(mem.mode) + _mem.rtone = chirp_common.TONES.index(mem.rtone) + _mem.ctone = chirp_common.TONES.index(mem.ctone) + _mem.dtcs = chirp_common.DTCS_CODES.index(mem.dtcs) + _mem.dtcs_polarity = DTCS_POL.index(mem.dtcs_polarity) + if mem.tmode == 'Cross': + _mem.tmode = TMODES.index(mem.cross_mode) + else: + _mem.tmode = TMODES.index(mem.tmode) + _mem.duplex = DUPLEX.index(mem.duplex) + + _mem.unknown1 = 0 + _mem.unknown2 = 0 + _mem.unknown3 = 0 + + if isinstance(mem, chirp_common.DVMemory): + _mem.dv_code = mem.dv_code + _mem.urcall = list( + icf.warp_byte_size(mem.dv_urcall.ljust(8), 8, 7)) + _mem.rpt1call = list( + icf.warp_byte_size(mem.dv_rpt1call.ljust(8), 8, 7)) + _mem.rpt2call = list( + icf.warp_byte_size(mem.dv_rpt2call.ljust(8), 8, 7)) + + +@directory.register +class ID5100Radio(ID4100Radio): + MODEL = "ID-5100" + + _model = b'\x34\x84\x00\x01' + + # This is only for MapRev=1 + _endframe = "Icom Inc.EE" + + # MapRev=1 Size is 260928 0x3FB40 + # MapRev=2 Size is 148160 0x242C0 + # MapRev=3 Size is 172928 0x2A380 + _memsize = 0x3FB40 + + _ranges = [(0, _memsize, 64)] + _raw_frames = True + _highbit_flip = True + + def process_mmap(self): + was_memsize = self._memsize + + # Apparently the 5100 has different reported memory sizes + # depending on firmware version. When we're loading an image, + # we should adjust our MapRev and _ranges to be correct for + # saving ICF files and uploading. This also means we should + # try to detect which version we are talking to and refuse to + # upload an image to a radio with a mismatch. + + self._memsize = len(self._mmap) + self._ranges = [(0, self._memsize, 64)] + + # Major (memory-format-changing) firmware versions, which + # correspond to MapRev in an ICF file. + maprevs = { + 0x3FB40: 1, + 0x242C0: 2, + 0x2A380: 3, + } + + # The 5100 seems to almost behave like three different radios, + # depending on firmware version. These are the endframes that + # are expected for a given MapRev. + endframes = { + 1: 'Icom Inc.EE', + 2: 'Icom Inc.0C', + 3: 'Icom Inc.8E', + } + + if self._memsize != was_memsize: + self._icf_data['MapRev'] = maprevs.get(self._memsize, 0) + if self._icf_data['MapRev'] == 0: + LOG.error('Unknown memsize %06X!', self._memsize) + raise errors.InvalidDataError('Unsupported memory format!') + self._endframe = endframes[self._icf_data['MapRev']] + LOG.info('Memory length changed from %06X to %06X; new MapRev=%i', + was_memsize, self._memsize, self._icf_data['MapRev']) + else: + LOG.debug('Unchanged memsize at %06X' % self._memsize) + + self._memobj = bitwise.parse(MEM_FORMAT, self._mmap) + + @classmethod + def get_prompts(cls): + rp = chirp_common.RadioPrompts() + rp.info = _('This driver has been tested with v3 of the ID-5100. ' + 'If your radio is not fully updated please help by ' + 'opening a bug report with a debug log so we can add ' + 'support for the other revisions.') + + rp.pre_upload = rp.info + rp.experimental = rp.info + return rp diff --git a/chirp/drivers/id51plus.py b/chirp/drivers/id51plus.py index b88aaa6..4aa751c 100644 --- a/chirp/drivers/id51plus.py +++ b/chirp/drivers/id51plus.py @@ -31,13 +31,14 @@ struct { mode:3; u8 dtcs; u8 tune_step:4, - unknown5:4; + dsql_mode:2, + unknown5:2; u8 unknown4; u8 tmode:4, duplex:2, dtcs_polarity:2; char name[16]; - u8 unknown13; + u8 digcode; u8 urcall[7]; u8 rpt1call[7]; u8 rpt2call[7]; @@ -68,7 +69,7 @@ struct { #seekto 0xA8C0; struct { u24 freq; - u16 offset; + u16 offset; u8 unknown1[4]; u8 call[7]; char name[16]; @@ -103,6 +104,7 @@ struct { } urcallname[200]; """ + @directory.register class ID51PLUSRadio(id31.ID31Radio): """Icom ID-51 Plus/50th Anniversary""" @@ -125,24 +127,19 @@ class ID51PLUSRadio(id31.ID31Radio): # Since the ID-51 and ID-51 Plus/Anniversary have exactly # the same memory size, we need to do a more detailed check. if len(filedata) == cls._memsize: - LOG.debug('File has correct memory size, ' - 'checking 20 bytes at offset 0x1AF40') snip = bytes(filedata[0x1AF40:0x1AF60]) if snip != bytes(b'\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF' b'\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF' b'\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF' b'\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF'): - LOG.debug('bytes matched ID-51 Plus Signature') return True - else: - LOG.debug('bytes did not match ID-51 Plus Signature') return False def _get_bank(self, loc): _bank = self._memobj.banks[loc] LOG.debug("Bank Value for location %s is %s" % (loc, _bank.bank)) if _bank.bank == 0x1F: - return None + return None else: return _bank.bank @@ -171,3 +168,23 @@ class ID51PLUSRadio(id31.ID31Radio): def process_mmap(self): self._memobj = bitwise.parse(MEM_FORMAT, self._mmap) + + +@directory.register +class ID51PLUS2Radio(ID51PLUSRadio): + MODEL = 'ID-51 Plus2' + _model = b'\x33\x90\x00\x03' + _endframe = b'Icom Inc.DA' + + _raw_frames = True + _highbit_flip = True + + _icf_data = { + 'MapRev': 1, + 'EtcData': 0x400001, + } + + @classmethod + def match_model(cls, filedata, filename): + # This model is always matched with metadata + return False diff --git a/chirp/drivers/id800.py b/chirp/drivers/id800.py index f71ec3b..8e8e87c 100644 --- a/chirp/drivers/id800.py +++ b/chirp/drivers/id800.py @@ -21,7 +21,7 @@ MEM_FORMAT = """ struct { u24 freq; u16 offset; - u8 unknown0:2, + u8 power:2, rtone:6; u8 duplex:2, ctone:6; @@ -50,7 +50,7 @@ struct { u8 unknown7:1, mode:3, unknown8:4; -} memory[500]; +} memory[512]; #seekto 0x2BF4; struct { @@ -59,7 +59,7 @@ struct { pskip:1, skip:1, bank:4; -} flags[500]; +} flags[512]; #seekto 0x3220; struct { @@ -77,11 +77,14 @@ struct { } rptcalls[59]; """ -MODES = ["FM", "NFM", "AM", "NAM", "DV"] +MODES = ["FM", "NFM", "AM", "NAM", "DV", "FM", "FM", "FM"] TMODES = ["", "Tone", "TSQL", "DTCS"] DUPLEX = ["", "", "-", "+"] DTCS_POL = ["NN", "NR", "RN", "RR"] STEPS = [5.0, 10.0, 12.5, 15, 20.0, 25.0, 30.0, 50.0, 100.0, 200.0, 6.25] +POWER_LEVELS = [chirp_common.PowerLevel('High', watts=50), + chirp_common.PowerLevel('Low', watts=5), + chirp_common.PowerLevel('Mid', watts=15)] ID800_SPECIAL = { "C2": 510, @@ -220,7 +223,7 @@ class ID800v2Radio(icf.IcomCloneModeRadio, chirp_common.IcomDstarSupport): rf.has_implicit_calls = True rf.has_settings = True rf.has_bank = True - rf.valid_modes = list(MODES) + rf.valid_modes = [x for x in MODES if x] rf.valid_tmodes = ["", "Tone", "TSQL", "DTCS"] rf.valid_duplexes = ["", "-", "+"] rf.valid_tuning_steps = list(STEPS) @@ -229,6 +232,7 @@ class ID800v2Radio(icf.IcomCloneModeRadio, chirp_common.IcomDstarSupport): rf.valid_skips = ["", "S", "P"] rf.valid_name_length = 6 rf.valid_special_chans = sorted(ID800_SPECIAL.keys()) + rf.valid_power_levels = list(POWER_LEVELS) rf.memory_bounds = (1, 499) return rf @@ -274,6 +278,7 @@ class ID800v2Radio(icf.IcomCloneModeRadio, chirp_common.IcomDstarSupport): mem.dtcs_polarity = DTCS_POL[_mem.dtcs_polarity] mem.tuning_step = STEPS[_mem.tuning_step] mem.name = get_name(_mem) + mem.power = POWER_LEVELS[_mem.power] mem.skip = _flg.pskip and "P" or _flg.skip and "S" or "" @@ -300,6 +305,8 @@ class ID800v2Radio(icf.IcomCloneModeRadio, chirp_common.IcomDstarSupport): _mem.dtcs = chirp_common.DTCS_CODES.index(mem.dtcs) _mem.dtcs_polarity = DTCS_POL.index(mem.dtcs_polarity) _mem.tuning_step = STEPS.index(mem.tuning_step) + if mem.power in POWER_LEVELS: + _mem.power = POWER_LEVELS.index(mem.power) set_name(_mem, mem.name) _flg.pskip = mem.skip == "P" diff --git a/chirp/drivers/id880.py b/chirp/drivers/id880.py index 5fd6079..ffd1291 100644 --- a/chirp/drivers/id880.py +++ b/chirp/drivers/id880.py @@ -80,10 +80,10 @@ u8 name_flags[132]; """ -TMODES = ["", "Tone", "?2", "TSQL", "DTCS", "TSQL-R", "DTCS-R", ""] +TMODES = ["", "Tone", "TSQL", "TSQL", "DTCS", "DTCS", "TSQL-R", "DTCS-R"] DUPLEX = ["", "-", "+", "?3"] DTCSP = ["NN", "NR", "RN", "RR"] -MODES = ["FM", "NFM", "?2", "AM", "NAM", "DV"] +MODES = ["FM", "NFM", "WFM", "AM", "NAM", "DV"] STEPS = [5.0, 6.25, 8.33, 9.0, 10.0, 12.5, 15.0, 20.0, 25.0, 30.0, 50.0, 100.0, 125.0, 200.0] FREQ_MULTIPLIER = [5000, 6250, 6250, 8333, 9000] @@ -219,8 +219,8 @@ class ID880Radio(icf.IcomCloneModeRadio, chirp_common.IcomDstarSupport): rf.has_bank = True rf.has_bank_index = True rf.has_bank_names = True - rf.valid_modes = [x for x in MODES if x is not None] - rf.valid_tmodes = list(TMODES) + rf.valid_modes = ["FM", "NFM", "AM", "NAM", "DV"] + rf.valid_tmodes = ['', 'Tone', 'TSQL', 'DTCS', 'TSQL-R', 'DTCS-R'] rf.valid_duplexes = list(DUPLEX) rf.valid_tuning_steps = STEPS rf.valid_bands = [(118000000, 173995000), (230000000, 549995000), @@ -229,7 +229,7 @@ class ID880Radio(icf.IcomCloneModeRadio, chirp_common.IcomDstarSupport): rf.valid_skips = ["", "S", "P"] rf.valid_name_length = 8 rf.valid_characters = chirp_common.CHARSET_UPPER_NUMERIC + \ - "!\"#$%&'()*+,-./:;<=>?@[\]^" + r"!\"#$%&'()*+,-./:;<=>?@[\]^" rf.memory_bounds = (0, 999) return rf @@ -312,6 +312,9 @@ class ID880Radio(icf.IcomCloneModeRadio, chirp_common.IcomDstarSupport): _mem.rtone = chirp_common.TONES.index(mem.rtone) _mem.ctone = chirp_common.TONES.index(mem.ctone) _mem.tmode = TMODES.index(mem.tmode) + if mem.tmode == 'DTCS': + # The first index of DTCS is "bell" mode + _mem.tmode += 1 _mem.duplex = DUPLEX.index(mem.duplex) _mem.mode = MODES.index(mem.mode) _mem.dtcs = chirp_common.DTCS_CODES.index(mem.dtcs) @@ -359,7 +362,6 @@ class ID880Radio(icf.IcomCloneModeRadio, chirp_common.IcomDstarSupport): return calls def get_repeater_call_list(self): - _calls = self._memobj.rptcall calls = ["*NOTUSE*"] for _i in range(*self.RPTCALL_LIMIT): @@ -371,6 +373,9 @@ class ID880Radio(icf.IcomCloneModeRadio, chirp_common.IcomDstarSupport): @classmethod def match_model(cls, filedata, filename): + if (super().match_model(filedata, filename) and + filename.lower().endswith('.icf')): + return True # This is a horrid hack, given that people can change the GPS-A # destination, but it should suffice in most cases until we get # a rich container file format @@ -388,7 +393,16 @@ class ID80Radio(ID880Radio): @classmethod def match_model(cls, filedata, filename): + if (super().match_model(filedata, filename) and + filename.lower().endswith('.icf')): + return True # This is a horrid hack, given that people can change the GPS-A # destination, but it should suffice in most cases until we get # a rich container file format return len(filedata) == cls._memsize and b"API80," in filedata + + def get_features(self): + rf = super().get_features() + rf.valid_modes = ["FM", "NFM", "WFM", "AM", "NAM", "DV"] + rf.valid_bands = [(495000, 1000000000)] + return rf diff --git a/chirp/drivers/idrp.py b/chirp/drivers/idrp.py index f7c115d..60680eb 100644 --- a/chirp/drivers/idrp.py +++ b/chirp/drivers/idrp.py @@ -107,6 +107,7 @@ def get_freq(pipe): raise errors.InvalidDataError("No frequency frame received") + RP_IMMUTABLE = ["number", "skip", "bank", "extd_number", "name", "rtone", "ctone", "dtcs", "tmode", "dtcs_polarity", "skip", "duplex", "offset", "mode", "tuning_step", "bank_index"] diff --git a/chirp/drivers/iradio_uv-5118.py b/chirp/drivers/iradio_uv-5118.py deleted file mode 100644 index 68b90f3..0000000 --- a/chirp/drivers/iradio_uv-5118.py +++ /dev/null @@ -1,1119 +0,0 @@ -# Copyright 2022 Jim Unroe -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -import time -import os -import struct -import re -import logging - -from chirp import chirp_common, directory, memmap -from chirp import bitwise, errors, util -from chirp.settings import RadioSetting, RadioSettingGroup, \ - RadioSettingValueInteger, RadioSettingValueList, \ - RadioSettingValueBoolean, RadioSettingValueString, \ - RadioSettingValueFloat, RadioSettings - -LOG = logging.getLogger(__name__) - -MEM_FORMAT = """ -struct memory { - ul32 rxfreq; // 00-03 - ul16 rx_tone; // PL/DPL Decode // 04-05 - ul32 txfreq; // 06-09 - ul16 tx_tone; // PL/DPL Encode // 0a-0b - u8 lowpower:1, // Power Level // 0c - isnarrow:1, // Bandwidth - unknown1:1, - unknown2:3, - bcl:1, // Busy Channel Lockout - scan:1; // Scan Add - u8 unknown3[3]; // 0d-0f -}; - -#seekto 0x0050; -struct memory channels[128]; - -#seekto 0x0010; -struct { - u8 range174_180; // 174-180 MHz - u8 range180_190; // 180-190 MHz - u8 range190_200; // 190-200 MHz - u8 range200_210; // 200-210 MHz - u8 range210_220; // 210-220 MHz - u8 range220_230; // 220-230 MHz - u8 range230_240; // 230-240 MHz - u8 range240_250; // 240-250 MHz - u8 range250_260; // 240-250 MHz - u8 range260_270; // 260-270 MHz - u8 range270_280; // 270-280 MHz - u8 range280_290; // 280-290 MHz - u8 range290_300; // 290-300 MHz - u8 range300_310; // 300-310 MHz - u8 range310_320; // 310-320 MHz - u8 range320_330; // 320-330 MHz - u8 range330_340; // 330-340 MHz - u8 range340_350; // 340-350 MHz - u8 range350_360; // 350-360 MHz - u8 range360_370; // 360-370 MHz - u8 range370_380; // 370-380 MHz - u8 range380_390; // 380-390 MHz - u8 range390_400; // 290-400 MHz - u8 range520_530; // 520-530 MHz - u8 range530_540; // 530-540 MHz - u8 range540_550; // 540-550 MHz - u8 range550_560; // 550-560 MHz - u8 range560_570; // 560-570 MHz - u8 range570_580; // 570-580 MHz - u8 range580_590; // 580-590 MHz - u8 range590_600; // 590-600 MHz - u8 range600_610; // 600-610 MHz - u8 range610_620; // 610-620 MHz - u8 range620_630; // 620-630 MHz - u8 range630_640; // 630-640 MHz - u8 range640_650; // 640-650 MHz - u8 range650_660; // 650-660 MHz -} txallow; - -#seekto 0x0039; -struct { - u8 display_timer; // 0x0039 Display Timer - u8 led_timer; // 0x003A LED Timer - u8 auto_lock; // 0x003B Auto Lock - u8 pfkey1short; // 0x003C FS1 Short - u8 pfkey1long; // 0x003D FS1 Long - u8 pfkey2short; // 0x003E FS2 Short - u8 pfkey2long; // 0x003F FS2 Long - u8 unknown_0; // 0x0040 - u8 voice:2, // 0x0041 Voice Prompt - beep:1, // Beep Switch - roger:2, // Roger Tone - save:3; // Power Save - u8 dispmode:1, // 0x0042 Display Mode - dstandby:1, // Dual Standby - unknown_1:1 - standby:1, // Radio Standby - squelch:4; // Squelch Level - u8 vox_level:4, // 0x0043 VOX Level - vox_delay:4; // VOX Delay - u8 brightness:2, // 0x0044 Screen Light - unknown_2:1, - alarm:1, // Alarm - scramble:4; // Scramble - u8 screen:1, // 0x0045 Screen On-off - led:1, // LED On-off - key_lock:1, // Key Lock - radio:1, // Radio On-off - compander:1, // Compander - rp:1, // Offset - freq_lock:1, // Freq Lock - vox:1; // VOX On-off - u8 unknown_4:4, // 0x0046 - txpri:1, // TX PRI - unknown_5:1, - tail_tone:2; // Tail Tone - ul16 fmcur; // 0x0047 Radio Freq - u8 unknown_49; // 0x0049 - u8 unknown_4A; // 0x004A - u8 unknown_4B; // 0x004B - u8 unknown_4C; // 0x004C - u8 dsrangea; // 0x004D Dual Standby Range A - u8 dsrangeb; // 0x004E Dual Standby Range B - u8 tot; // 0x004F -} settings; - -""" - -CMD_ACK = "\x06" - -RB15_DTCS = sorted(chirp_common.DTCS_CODES + [645]) - -_STEP_LIST = [0.25, 1.25, 2.5, 5., 6.25, 10., 12.5, 25., 50., 100.] - -LIST_ALARM = ["Local", "Remote"] -LIST_BRIGHT = ["Low", "Middle", "High"] -LIST_DISPM = ["Frequency", "Channel Number"] -LIST_ROGER = ["Off", "Start", "End", "Start and End"] -LIST_SAVE = ["Off", "1:1", "1:2", "1:3", "1:4", "1:5"] -LIST_SCRAMBLE = ["Off"] + ["%s" % x for x in range(1, 9)] -LIST_SKEY = ["None", "Monitor", "Local Alarm", "Remote Alarm", - "Screen On/Off", "Frequency Lock"] -LIST_TIMER = ["Off"] + ["%s seconds" % x for x in range(15, 615, 15)] -LIST_TXPRI = ["Edit", "Busy"] -LIST_VOICE = ["Off", "Chinese", "English"] - -TXALLOW_CHOICES = ["RX Only", "TX/RX"] -TXALLOW_VALUES = [0xFF, 0x00] - - -def _checksum(data): - cs = 0 - for byte in data: - cs += ord(byte) - return cs % 256 - - -def _enter_programming_mode(radio): - serial = radio.pipe - - # lengthen the timeout here as these radios are reseting due to timeout - radio.pipe.timeout = 0.75 - - exito = False - for i in range(0, 5): - serial.write(radio.magic) - ack = serial.read(1) - - try: - if ack == CMD_ACK: - exito = True - break - except: - LOG.debug("Attempt #%s, failed, trying again" % i) - pass - - # return timeout to default value - radio.pipe.timeout = 0.25 - - # check if we had EXITO - if exito is False: - msg = "The radio did not accept program mode after five tries.\n" - msg += "Check you interface cable and power cycle your radio." - raise errors.RadioError(msg) - - -def _exit_programming_mode(radio): - serial = radio.pipe - try: - serial.write("93" + "\x05\xEE\x5F") - except: - raise errors.RadioError("Radio refused to exit programming mode") - - -def _read_block(radio, block_addr, block_size): - serial = radio.pipe - - cmd = struct.pack(">BH", ord('R'), block_addr + 0x0340) - - ccs = _checksum(cmd) - - expectedresponse = "R" + cmd[1:] - - cmd = cmd + chr(ccs) - - LOG.debug("Reading block %04x..." % (block_addr + 0x0340)) - - try: - serial.write(cmd) - response = serial.read(3 + block_size + 1) - - cs = _checksum(response[:-1]) - - if response[:3] != expectedresponse: - raise Exception("Error reading block %04x." % (block_addr + - 0x0340)) - - chunk = response[3:] - - if ord(chunk[-1]) != cs: - raise Exception("Block failed checksum!") - - block_data = chunk[:-1] - except: - raise errors.RadioError("Failed to read block at %04x" % block_addr + - 0x0340) - - return block_data - - -def _write_block(radio, block_addr, block_size): - serial = radio.pipe - - data = radio.get_mmap()[block_addr:block_addr + block_size] - - cmd = struct.pack(">BH", ord('W'), block_addr + 0x0340) - - cs = _checksum(cmd + data) - data += chr(cs) - - LOG.debug("Writing Data:") - LOG.debug(util.hexprint(cmd + data)) - - try: - serial.write(cmd + data) - if serial.read(1) != CMD_ACK: - raise Exception("No ACK") - except: - raise errors.RadioError("Failed to send block " - "to radio at %04x" % (block_addr + 0x0340)) - - -def do_download(radio): - LOG.debug("download") - _enter_programming_mode(radio) - - data = "" - - status = chirp_common.Status() - status.msg = "Cloning from radio" - - status.cur = 0 - status.max = radio._memsize - - for addr in range(0, radio._memsize, radio.BLOCK_SIZE): - status.cur = addr + radio.BLOCK_SIZE - radio.status_fn(status) - - block = _read_block(radio, addr, radio.BLOCK_SIZE) - data += block - - LOG.debug("Address: %04x" % addr) - LOG.debug(util.hexprint(block)) - - _exit_programming_mode(radio) - - return memmap.MemoryMap(data) - - -def do_upload(radio): - status = chirp_common.Status() - status.msg = "Uploading to radio" - - _enter_programming_mode(radio) - - status.cur = 0 - status.max = radio._memsize - - for start_addr, end_addr in radio._ranges: - for addr in range(start_addr, end_addr, radio.BLOCK_SIZE): - status.cur = addr + radio.BLOCK_SIZE - radio.status_fn(status) - _write_block(radio, addr, radio.BLOCK_SIZE) - - _exit_programming_mode(radio) - - -def _split(rf, f1, f2): - """Returns False if the two freqs are in the same band (no split) - or True otherwise""" - - # determine if the two freqs are in the same band - for low, high in rf.valid_bands: - if f1 >= low and f1 <= high and \ - f2 >= low and f2 <= high: - # if the two freqs are on the same Band this is not a split - return False - - # if you get here is because the freq pairs are split - return True - - -class IradioUV5118(chirp_common.CloneModeRadio): - """IRADIO UV5118""" - VENDOR = "Iradio" - MODEL = "UV-5118" - BAUD_RATE = 9600 - - BLOCK_SIZE = 0x10 - magic = "93" + "\x05\x10\x81" - - VALID_BANDS = [(20000000, 64000000), # RX only - (108000000, 136000000), # RX only (Air Band) - (136000000, 174000000), # TX/RX (VHF) - (174000000, 400000000), # TX/RX - (400000000, 520000000), # TX/RX (UHF) - (520000000, 660000000)] # TX/RX - - POWER_LEVELS = [chirp_common.PowerLevel("High", watts=2.00), - chirp_common.PowerLevel("Low", watts=0.50)] - - # Radio's memory starts at 0x0340 - # Radio's memory ends at 0x0B90 - - _ranges = [ - (0x0000, 0x0850), - ] - _memsize = 0x0850 - - _upper = 128 - - def get_features(self): - rf = chirp_common.RadioFeatures() - rf.has_settings = True - rf.has_bank = False - rf.has_ctone = True - rf.has_cross = True - rf.has_rx_dtcs = True - rf.has_tuning_step = False - rf.can_odd_split = True - rf.has_name = False - rf.valid_skips = ["", "S"] - rf.valid_tmodes = ["", "Tone", "TSQL", "DTCS", "Cross"] - rf.valid_cross_modes = ["Tone->Tone", "Tone->DTCS", "DTCS->Tone", - "->Tone", "->DTCS", "DTCS->", "DTCS->DTCS"] - rf.valid_power_levels = self.POWER_LEVELS - rf.valid_duplexes = ["", "-", "+", "split"] - rf.valid_modes = ["FM", "NFM"] # 25 KHz, 12.5 KHz. - rf.valid_dtcs_codes = RB15_DTCS - rf.memory_bounds = (1, self._upper) - rf.valid_tuning_steps = _STEP_LIST - rf.valid_bands = self.VALID_BANDS - - return rf - - def process_mmap(self): - self._memobj = bitwise.parse(MEM_FORMAT, self._mmap) - - def sync_in(self): - """Download from radio""" - try: - data = do_download(self) - except errors.RadioError: - # Pass through any real errors we raise - raise - except: - # If anything unexpected happens, make sure we raise - # a RadioError and log the problem - LOG.exception('Unexpected error during download') - raise errors.RadioError('Unexpected error communicating ' - 'with the radio') - self._mmap = data - self.process_mmap() - - def sync_out(self): - """Upload to radio""" - try: - do_upload(self) - except: - # If anything unexpected happens, make sure we raise - # a RadioError and log the problem - LOG.exception('Unexpected error during upload') - raise errors.RadioError('Unexpected error communicating ' - 'with the radio') - - def get_raw_memory(self, number): - return repr(self._memobj.memory[number - 1]) - - @staticmethod - def _decode_tone(toneval): - # DCS examples: - # D023N - 1013 - 0001 0000 0001 0011 - # ^-DCS - # D023I - 2013 - 0010 0000 0001 0100 - # ^--DCS inverted - # D754I - 21EC - 0010 0001 1110 1100 - # code in octal-------^^^^^^^^^^^ - - if toneval == 0x3000: - return '', None, None - elif toneval & 0x1000: - # DTCS N - code = int('%o' % (toneval & 0x1FF)) - return 'DTCS', code, 'N' - elif toneval & 0x2000: - # DTCS R - code = int('%o' % (toneval & 0x1FF)) - return 'DTCS', code, 'R' - else: - return 'Tone', toneval / 10.0, None - - @staticmethod - def _encode_tone(mode, val, pol): - if not mode: - return 0x3000 - elif mode == 'Tone': - return int(val * 10) - elif mode == 'DTCS': - code = int('%i' % val, 8) - if pol == 'N': - code |= 0x1800 - if pol == 'R': - code |= 0x2800 - return code - else: - raise errors.RadioError('Unsupported tone mode %r' % mode) - - def get_memory(self, number): - mem = chirp_common.Memory() - _mem = self._memobj.channels[number - 1] - mem.number = number - - mem.freq = int(_mem.rxfreq) * 10 - - # We'll consider any blank (i.e. 0MHz frequency) to be empty - if mem.freq == 0: - mem.empty = True - return mem - - if _mem.rxfreq.get_raw() == "\xFF\xFF\xFF\xFF": - mem.freq = 0 - mem.empty = True - return mem - - if _mem.get_raw() == ("\xFF" * 16): - LOG.debug("Initializing empty memory") - _mem.set_raw("\xFF" * 4 + "\x00\x30" + "\xFF" * 4 + "\x00\x30" + - "\x00" * 4) - - # Freq and offset - mem.freq = int(_mem.rxfreq) * 10 - # TX freq set - offset = (int(_mem.txfreq) * 10) - mem.freq - if offset != 0: - if _split(self.get_features(), mem.freq, int( - _mem.txfreq) * 10): - mem.duplex = "split" - mem.offset = int(_mem.txfreq) * 10 - elif offset < 0: - mem.offset = abs(offset) - mem.duplex = "-" - elif offset > 0: - mem.offset = offset - mem.duplex = "+" - else: - mem.offset = 0 - - mem.mode = _mem.isnarrow and "NFM" or "FM" - - chirp_common.split_tone_decode(mem, - self._decode_tone(_mem.tx_tone), - self._decode_tone(_mem.rx_tone)) - - mem.power = self.POWER_LEVELS[_mem.lowpower] - - if not _mem.scan: - mem.skip = "S" - - mem.extra = RadioSettingGroup("Extra", "extra") - - rs = RadioSetting("bcl", "BCL", - RadioSettingValueBoolean(_mem.bcl)) - mem.extra.append(rs) - - return mem - - def set_memory(self, mem): - LOG.debug("Setting %i(%s)" % (mem.number, mem.extd_number)) - _mem = self._memobj.channels[mem.number - 1] - - # if empty memmory - if mem.empty: - _mem.set_raw("\xFF" * 16) - return - - _mem.set_raw("\xFF" * 4 + "\x00\x30" + "\xFF" * 4 + "\x00\x30" + - "\x00" * 4) - - _mem.rxfreq = mem.freq / 10 - - if mem.duplex == "split": - _mem.txfreq = mem.offset / 10 - elif mem.duplex == "+": - _mem.txfreq = (mem.freq + mem.offset) / 10 - elif mem.duplex == "-": - _mem.txfreq = (mem.freq - mem.offset) / 10 - else: - _mem.txfreq = mem.freq / 10 - - _mem.scan = mem.skip != "S" - _mem.isnarrow = mem.mode == "NFM" - - txtone, rxtone = chirp_common.split_tone_encode(mem) - _mem.tx_tone = self._encode_tone(*txtone) - _mem.rx_tone = self._encode_tone(*rxtone) - - _mem.lowpower = mem.power == self.POWER_LEVELS[1] - - for setting in mem.extra: - setattr(_mem, setting.get_name(), setting.value) - - def get_settings(self): - _settings = self._memobj.settings - _txallow = self._memobj.txallow - basic = RadioSettingGroup("basic", "Basic Settings") - sidekey = RadioSettingGroup("sidekey", "Side Key Settings") - dwatch = RadioSettingGroup("dwatch", "Dual Watch Settings") - txallow = RadioSettingGroup("txallow", "TX Allow") - top = RadioSettings(basic, sidekey, dwatch, txallow) - - voice = RadioSetting("voice", "Language", RadioSettingValueList( - LIST_VOICE, LIST_VOICE[_settings.voice])) - basic.append(voice) - - beep = RadioSetting("beep", "Key Beep", - RadioSettingValueBoolean(_settings.beep)) - basic.append(beep) - - roger = RadioSetting("roger", "Roger Tone", - RadioSettingValueList( - LIST_ROGER, LIST_ROGER[_settings.roger])) - basic.append(roger) - - save = RadioSetting("save", "Battery Save", - RadioSettingValueList( - LIST_SAVE, LIST_SAVE[_settings.save])) - basic.append(save) - - dispmode = RadioSetting("dispmode", "Display Mode", - RadioSettingValueList( - LIST_DISPM, - LIST_DISPM[_settings.dispmode])) - basic.append(dispmode) - - brightness = RadioSetting("brightness", "Screen Light", - RadioSettingValueList( - LIST_BRIGHT, - LIST_BRIGHT[_settings.brightness])) - basic.append(brightness) - - screen = RadioSetting("screen", "Screen", - RadioSettingValueBoolean(_settings.screen)) - basic.append(screen) - - display_timer = RadioSetting("display_timer", "Display Timer", - RadioSettingValueList( - LIST_TIMER, - LIST_TIMER[_settings.display_timer])) - basic.append(display_timer) - - led = RadioSetting("led", "LED", - RadioSettingValueBoolean(_settings.led)) - basic.append(led) - - led_timer = RadioSetting("led_timer", "LED Timer", - RadioSettingValueList( - LIST_TIMER, - LIST_TIMER[_settings.led_timer])) - basic.append(led_timer) - - squelch = RadioSetting("squelch", "Squelch Level", - RadioSettingValueInteger( - 0, 9, _settings.squelch)) - basic.append(squelch) - - vox = RadioSetting("vox", "VOX", - RadioSettingValueBoolean(_settings.vox)) - basic.append(vox) - - vox_level = RadioSetting("vox_level", "VOX Level", - RadioSettingValueInteger( - 0, 9, _settings.vox_level)) - basic.append(vox_level) - - vox_delay = RadioSetting("vox_delay", "VOX Delay", - RadioSettingValueInteger( - 0, 9, _settings.vox_delay)) - basic.append(vox_delay) - - compander = RadioSetting("compander", "Compander", - RadioSettingValueBoolean(_settings.compander)) - basic.append(compander) - - scramble = RadioSetting("scramble", "Scramble", - RadioSettingValueList( - LIST_SCRAMBLE, - LIST_SCRAMBLE[_settings.scramble])) - basic.append(scramble) - - rp = RadioSetting("rp", "Offset", - RadioSettingValueBoolean(_settings.rp)) - basic.append(rp) - - txpri = RadioSetting("txpri", "TX Priority", - RadioSettingValueList( - LIST_TXPRI, - LIST_TXPRI[_settings.txpri])) - basic.append(txpri) - - tot = RadioSetting("tot", "Time-out Timer", - RadioSettingValueList( - LIST_TIMER, - LIST_TIMER[_settings.tot])) - basic.append(tot) - - tail_tone = RadioSetting("tail_tone", "Tail Tone", - RadioSettingValueInteger( - 0, 3, _settings.tail_tone)) - basic.append(tail_tone) - - alarm = RadioSetting("alarm", "Alarm", - RadioSettingValueList( - LIST_ALARM, - LIST_ALARM[_settings.alarm])) - basic.append(alarm) - - freq_lock = RadioSetting("freq_lock", "Frequency Lock", - RadioSettingValueBoolean(_settings.freq_lock)) - basic.append(freq_lock) - - key_lock = RadioSetting("key_lock", "Key Lock", - RadioSettingValueBoolean(_settings.key_lock)) - basic.append(key_lock) - - auto_lock = RadioSetting("auto_lock", "Auto Lock Timer", - RadioSettingValueList( - LIST_TIMER, - LIST_TIMER[_settings.auto_lock])) - basic.append(auto_lock) - - radio = RadioSetting("radio", "Broadcast FM Radio", - RadioSettingValueBoolean(_settings.radio)) - basic.append(radio) - - standby = RadioSetting("standby", "Radio Standby", - RadioSettingValueBoolean(_settings.standby)) - basic.append(standby) - - def myset_freq(setting, obj, atrb, mult): - """ Callback to set frequency by applying multiplier""" - value = int(float(str(setting.value)) * mult) - setattr(obj, atrb, value) - return - - # FM Broadcast Settings - val = _settings.fmcur - val = val / 10.0 - if val < 87.5 or val > 108.0: - val = 90.4 - rx = RadioSettingValueFloat(87.5, 108.0, val, 0.1, 1) - rset = RadioSetting("fmcur", "Broadcast FM Freq (MHz)", rx) - rset.set_apply_callback(myset_freq, _settings, "fmcur", 10) - basic.append(rset) - - # Side Key Settings - pfkey1short = RadioSetting("pfkey1short", "Side Key 1 - Short Press", - RadioSettingValueList( - LIST_SKEY, - LIST_SKEY[_settings.pfkey1short])) - sidekey.append(pfkey1short) - - pfkey1long = RadioSetting("pfkey1long", "Side Key 1 - Long Press", - RadioSettingValueList( - LIST_SKEY, - LIST_SKEY[_settings.pfkey1long])) - sidekey.append(pfkey1long) - - pfkey2short = RadioSetting("pfkey2short", "Side Key 2 - Short Press", - RadioSettingValueList( - LIST_SKEY, - LIST_SKEY[_settings.pfkey2short])) - sidekey.append(pfkey2short) - - pfkey2long = RadioSetting("pfkey2long", "Side Key 2 - Long Press", - RadioSettingValueList( - LIST_SKEY, - LIST_SKEY[_settings.pfkey2long])) - sidekey.append(pfkey2long) - - dstandby = RadioSetting("dstandby", "Dual Standby", - RadioSettingValueBoolean(_settings.dstandby)) - dwatch.append(dstandby) - - dsrangea = RadioSetting("dsrangea", "Dual Standby Range A", - RadioSettingValueInteger( - 1, 128, _settings.dsrangea + 1)) - dwatch.append(dsrangea) - - dsrangeb = RadioSetting("dsrangeb", "Dual Standby Range B", - RadioSettingValueInteger( - 1, 128, _settings.dsrangeb + 1)) - dwatch.append(dsrangeb) - - def apply_txallow_listvalue(setting, obj): - LOG.debug("Setting value: " + str( - setting.value) + " from list") - val = str(setting.value) - index = TXALLOW_CHOICES.index(val) - val = TXALLOW_VALUES[index] - obj.set_value(val) - - if _txallow.range174_180 in TXALLOW_VALUES: - idx = TXALLOW_VALUES.index(_txallow.range174_180) - else: - idx = TXALLOW_VALUES.index(0xFF) - rs = RadioSettingValueList(TXALLOW_CHOICES, TXALLOW_CHOICES[idx]) - rset = RadioSetting("txallow.range174_180", "174-180 MHz", rs) - rset.set_apply_callback(apply_txallow_listvalue, _txallow.range174_180) - txallow.append(rset) - - if _txallow.range180_190 in TXALLOW_VALUES: - idx = TXALLOW_VALUES.index(_txallow.range180_190) - else: - idx = TXALLOW_VALUES.index(0xFF) - rs = RadioSettingValueList(TXALLOW_CHOICES, TXALLOW_CHOICES[idx]) - rset = RadioSetting("txallow.range180_190", "180-190 MHz", rs) - rset.set_apply_callback(apply_txallow_listvalue, _txallow.range180_190) - txallow.append(rset) - - if _txallow.range190_200 in TXALLOW_VALUES: - idx = TXALLOW_VALUES.index(_txallow.range190_200) - else: - idx = TXALLOW_VALUES.index(0xFF) - rs = RadioSettingValueList(TXALLOW_CHOICES, TXALLOW_CHOICES[idx]) - rset = RadioSetting("txallow.range190_200", "190-200 MHz", rs) - rset.set_apply_callback(apply_txallow_listvalue, _txallow.range190_200) - txallow.append(rset) - - if _txallow.range200_210 in TXALLOW_VALUES: - idx = TXALLOW_VALUES.index(_txallow.range200_210) - else: - idx = TXALLOW_VALUES.index(0xFF) - rs = RadioSettingValueList(TXALLOW_CHOICES, TXALLOW_CHOICES[idx]) - rset = RadioSetting("txallow.range200_210", "200-210 MHz", rs) - rset.set_apply_callback(apply_txallow_listvalue, _txallow.range200_210) - txallow.append(rset) - - if _txallow.range210_220 in TXALLOW_VALUES: - idx = TXALLOW_VALUES.index(_txallow.range210_220) - else: - idx = TXALLOW_VALUES.index(0xFF) - rs = RadioSettingValueList(TXALLOW_CHOICES, TXALLOW_CHOICES[idx]) - rset = RadioSetting("txallow.range210_220", "210-220 MHz", rs) - rset.set_apply_callback(apply_txallow_listvalue, _txallow.range210_220) - txallow.append(rset) - - if _txallow.range220_230 in TXALLOW_VALUES: - idx = TXALLOW_VALUES.index(_txallow.range220_230) - else: - idx = TXALLOW_VALUES.index(0xFF) - rs = RadioSettingValueList(TXALLOW_CHOICES, TXALLOW_CHOICES[idx]) - rset = RadioSetting("txallow.range220_230", "220-230 MHz", rs) - rset.set_apply_callback(apply_txallow_listvalue, _txallow.range220_230) - txallow.append(rset) - - if _txallow.range230_240 in TXALLOW_VALUES: - idx = TXALLOW_VALUES.index(_txallow.range230_240) - else: - idx = TXALLOW_VALUES.index(0xFF) - rs = RadioSettingValueList(TXALLOW_CHOICES, TXALLOW_CHOICES[idx]) - rset = RadioSetting("txallow.range230_240", "230-240 MHz", rs) - rset.set_apply_callback(apply_txallow_listvalue, _txallow.range230_240) - txallow.append(rset) - - if _txallow.range240_250 in TXALLOW_VALUES: - idx = TXALLOW_VALUES.index(_txallow.range240_250) - else: - idx = TXALLOW_VALUES.index(0xFF) - rs = RadioSettingValueList(TXALLOW_CHOICES, TXALLOW_CHOICES[idx]) - rset = RadioSetting("txallow.range240_250", "240-250 MHz", rs) - rset.set_apply_callback(apply_txallow_listvalue, _txallow.range240_250) - txallow.append(rset) - - if _txallow.range250_260 in TXALLOW_VALUES: - idx = TXALLOW_VALUES.index(_txallow.range250_260) - else: - idx = TXALLOW_VALUES.index(0xFF) - rs = RadioSettingValueList(TXALLOW_CHOICES, TXALLOW_CHOICES[idx]) - rset = RadioSetting("txallow.range250_260", "250-260 MHz", rs) - rset.set_apply_callback(apply_txallow_listvalue, _txallow.range250_260) - txallow.append(rset) - - if _txallow.range260_270 in TXALLOW_VALUES: - idx = TXALLOW_VALUES.index(_txallow.range260_270) - else: - idx = TXALLOW_VALUES.index(0xFF) - rs = RadioSettingValueList(TXALLOW_CHOICES, TXALLOW_CHOICES[idx]) - rset = RadioSetting("txallow.range260_270", "260-270 MHz", rs) - rset.set_apply_callback(apply_txallow_listvalue, _txallow.range260_270) - txallow.append(rset) - - if _txallow.range270_280 in TXALLOW_VALUES: - idx = TXALLOW_VALUES.index(_txallow.range270_280) - else: - idx = TXALLOW_VALUES.index(0xFF) - rs = RadioSettingValueList(TXALLOW_CHOICES, TXALLOW_CHOICES[idx]) - rset = RadioSetting("txallow.range270_280", "270-280 MHz", rs) - rset.set_apply_callback(apply_txallow_listvalue, _txallow.range270_280) - txallow.append(rset) - - if _txallow.range280_290 in TXALLOW_VALUES: - idx = TXALLOW_VALUES.index(_txallow.range280_290) - else: - idx = TXALLOW_VALUES.index(0xFF) - rs = RadioSettingValueList(TXALLOW_CHOICES, TXALLOW_CHOICES[idx]) - rset = RadioSetting("txallow.range280_290", "280-290 MHz", rs) - rset.set_apply_callback(apply_txallow_listvalue, _txallow.range280_290) - txallow.append(rset) - - if _txallow.range290_300 in TXALLOW_VALUES: - idx = TXALLOW_VALUES.index(_txallow.range290_300) - else: - idx = TXALLOW_VALUES.index(0xFF) - rs = RadioSettingValueList(TXALLOW_CHOICES, TXALLOW_CHOICES[idx]) - rset = RadioSetting("txallow.range290_300", "290-300 MHz", rs) - rset.set_apply_callback(apply_txallow_listvalue, _txallow.range290_300) - txallow.append(rset) - - if _txallow.range300_310 in TXALLOW_VALUES: - idx = TXALLOW_VALUES.index(_txallow.range300_310) - else: - idx = TXALLOW_VALUES.index(0xFF) - rs = RadioSettingValueList(TXALLOW_CHOICES, TXALLOW_CHOICES[idx]) - rset = RadioSetting("txallow.range300_310", "300-310 MHz", rs) - rset.set_apply_callback(apply_txallow_listvalue, _txallow.range300_310) - txallow.append(rset) - - if _txallow.range310_320 in TXALLOW_VALUES: - idx = TXALLOW_VALUES.index(_txallow.range310_320) - else: - idx = TXALLOW_VALUES.index(0xFF) - rs = RadioSettingValueList(TXALLOW_CHOICES, TXALLOW_CHOICES[idx]) - rset = RadioSetting("txallow.range310_320", "310-320 MHz", rs) - rset.set_apply_callback(apply_txallow_listvalue, _txallow.range310_320) - txallow.append(rset) - - if _txallow.range320_330 in TXALLOW_VALUES: - idx = TXALLOW_VALUES.index(_txallow.range320_330) - else: - idx = TXALLOW_VALUES.index(0xFF) - rs = RadioSettingValueList(TXALLOW_CHOICES, TXALLOW_CHOICES[idx]) - rset = RadioSetting("txallow.range320_330", "320-330 MHz", rs) - rset.set_apply_callback(apply_txallow_listvalue, _txallow.range320_330) - txallow.append(rset) - - if _txallow.range330_340 in TXALLOW_VALUES: - idx = TXALLOW_VALUES.index(_txallow.range330_340) - else: - idx = TXALLOW_VALUES.index(0xFF) - rs = RadioSettingValueList(TXALLOW_CHOICES, TXALLOW_CHOICES[idx]) - rset = RadioSetting("txallow.range330_340", "330-340 MHz", rs) - rset.set_apply_callback(apply_txallow_listvalue, _txallow.range330_340) - txallow.append(rset) - - if _txallow.range340_350 in TXALLOW_VALUES: - idx = TXALLOW_VALUES.index(_txallow.range340_350) - else: - idx = TXALLOW_VALUES.index(0xFF) - rs = RadioSettingValueList(TXALLOW_CHOICES, TXALLOW_CHOICES[idx]) - rset = RadioSetting("txallow.range340_350", "340-350 MHz", rs) - rset.set_apply_callback(apply_txallow_listvalue, _txallow.range340_350) - txallow.append(rset) - - if _txallow.range350_360 in TXALLOW_VALUES: - idx = TXALLOW_VALUES.index(_txallow.range350_360) - else: - idx = TXALLOW_VALUES.index(0xFF) - rs = RadioSettingValueList(TXALLOW_CHOICES, TXALLOW_CHOICES[idx]) - rset = RadioSetting("txallow.range350_360", "350-360 MHz", rs) - rset.set_apply_callback(apply_txallow_listvalue, _txallow.range350_360) - txallow.append(rset) - - if _txallow.range360_370 in TXALLOW_VALUES: - idx = TXALLOW_VALUES.index(_txallow.range360_370) - else: - idx = TXALLOW_VALUES.index(0xFF) - rs = RadioSettingValueList(TXALLOW_CHOICES, TXALLOW_CHOICES[idx]) - rset = RadioSetting("txallow.range360_370", "360-370 MHz", rs) - rset.set_apply_callback(apply_txallow_listvalue, _txallow.range360_370) - txallow.append(rset) - - if _txallow.range370_380 in TXALLOW_VALUES: - idx = TXALLOW_VALUES.index(_txallow.range370_380) - else: - idx = TXALLOW_VALUES.index(0xFF) - rs = RadioSettingValueList(TXALLOW_CHOICES, TXALLOW_CHOICES[idx]) - rset = RadioSetting("txallow.range370_380", "370-380 MHz", rs) - rset.set_apply_callback(apply_txallow_listvalue, _txallow.range370_380) - txallow.append(rset) - - if _txallow.range380_390 in TXALLOW_VALUES: - idx = TXALLOW_VALUES.index(_txallow.range380_390) - else: - idx = TXALLOW_VALUES.index(0xFF) - rs = RadioSettingValueList(TXALLOW_CHOICES, TXALLOW_CHOICES[idx]) - rset = RadioSetting("txallow.range380_390", "380-390 MHz", rs) - rset.set_apply_callback(apply_txallow_listvalue, _txallow.range380_390) - txallow.append(rset) - - if _txallow.range390_400 in TXALLOW_VALUES: - idx = TXALLOW_VALUES.index(_txallow.range390_400) - else: - idx = TXALLOW_VALUES.index(0xFF) - rs = RadioSettingValueList(TXALLOW_CHOICES, TXALLOW_CHOICES[idx]) - rset = RadioSetting("txallow.range390_400", "390-400 MHz", rs) - rset.set_apply_callback(apply_txallow_listvalue, _txallow.range390_400) - txallow.append(rset) - - if _txallow.range520_530 in TXALLOW_VALUES: - idx = TXALLOW_VALUES.index(_txallow.range520_530) - else: - idx = TXALLOW_VALUES.index(0xFF) - rs = RadioSettingValueList(TXALLOW_CHOICES, TXALLOW_CHOICES[idx]) - rset = RadioSetting("txallow.range520_530", "520-530 MHz", rs) - rset.set_apply_callback(apply_txallow_listvalue, _txallow.range520_530) - txallow.append(rset) - - if _txallow.range530_540 in TXALLOW_VALUES: - idx = TXALLOW_VALUES.index(_txallow.range530_540) - else: - idx = TXALLOW_VALUES.index(0xFF) - rs = RadioSettingValueList(TXALLOW_CHOICES, TXALLOW_CHOICES[idx]) - rset = RadioSetting("txallow.range530_540", "530-540 MHz", rs) - rset.set_apply_callback(apply_txallow_listvalue, _txallow.range530_540) - txallow.append(rset) - - if _txallow.range540_550 in TXALLOW_VALUES: - idx = TXALLOW_VALUES.index(_txallow.range540_550) - else: - idx = TXALLOW_VALUES.index(0xFF) - rs = RadioSettingValueList(TXALLOW_CHOICES, TXALLOW_CHOICES[idx]) - rset = RadioSetting("txallow.range540_550", "540-550 MHz", rs) - rset.set_apply_callback(apply_txallow_listvalue, _txallow.range540_550) - txallow.append(rset) - - if _txallow.range550_560 in TXALLOW_VALUES: - idx = TXALLOW_VALUES.index(_txallow.range550_560) - else: - idx = TXALLOW_VALUES.index(0xFF) - rs = RadioSettingValueList(TXALLOW_CHOICES, TXALLOW_CHOICES[idx]) - rset = RadioSetting("txallow.range550_560", "550-560 MHz", rs) - rset.set_apply_callback(apply_txallow_listvalue, _txallow.range550_560) - txallow.append(rset) - - if _txallow.range560_570 in TXALLOW_VALUES: - idx = TXALLOW_VALUES.index(_txallow.range560_570) - else: - idx = TXALLOW_VALUES.index(0xFF) - rs = RadioSettingValueList(TXALLOW_CHOICES, TXALLOW_CHOICES[idx]) - rset = RadioSetting("txallow.range560_570", "560-570 MHz", rs) - rset.set_apply_callback(apply_txallow_listvalue, _txallow.range560_570) - txallow.append(rset) - - if _txallow.range570_580 in TXALLOW_VALUES: - idx = TXALLOW_VALUES.index(_txallow.range570_580) - else: - idx = TXALLOW_VALUES.index(0xFF) - rs = RadioSettingValueList(TXALLOW_CHOICES, TXALLOW_CHOICES[idx]) - rset = RadioSetting("txallow.range570_580", "570-580 MHz", rs) - rset.set_apply_callback(apply_txallow_listvalue, _txallow.range570_580) - txallow.append(rset) - - if _txallow.range580_590 in TXALLOW_VALUES: - idx = TXALLOW_VALUES.index(_txallow.range580_590) - else: - idx = TXALLOW_VALUES.index(0xFF) - rs = RadioSettingValueList(TXALLOW_CHOICES, TXALLOW_CHOICES[idx]) - rset = RadioSetting("txallow.range580_590", "580-590 MHz", rs) - rset.set_apply_callback(apply_txallow_listvalue, _txallow.range580_590) - txallow.append(rset) - - if _txallow.range590_600 in TXALLOW_VALUES: - idx = TXALLOW_VALUES.index(_txallow.range590_600) - else: - idx = TXALLOW_VALUES.index(0xFF) - rs = RadioSettingValueList(TXALLOW_CHOICES, TXALLOW_CHOICES[idx]) - rset = RadioSetting("txallow.range590_600", "590-600 MHz", rs) - rset.set_apply_callback(apply_txallow_listvalue, _txallow.range590_600) - txallow.append(rset) - - if _txallow.range600_610 in TXALLOW_VALUES: - idx = TXALLOW_VALUES.index(_txallow.range600_610) - else: - idx = TXALLOW_VALUES.index(0xFF) - rs = RadioSettingValueList(TXALLOW_CHOICES, TXALLOW_CHOICES[idx]) - rset = RadioSetting("txallow.range600_610", "600-610 MHz", rs) - rset.set_apply_callback(apply_txallow_listvalue, _txallow.range600_610) - txallow.append(rset) - - if _txallow.range610_620 in TXALLOW_VALUES: - idx = TXALLOW_VALUES.index(_txallow.range610_620) - else: - idx = TXALLOW_VALUES.index(0xFF) - rs = RadioSettingValueList(TXALLOW_CHOICES, TXALLOW_CHOICES[idx]) - rset = RadioSetting("txallow.range610_620", "610-620 MHz", rs) - rset.set_apply_callback(apply_txallow_listvalue, _txallow.range610_620) - txallow.append(rset) - - if _txallow.range620_630 in TXALLOW_VALUES: - idx = TXALLOW_VALUES.index(_txallow.range620_630) - else: - idx = TXALLOW_VALUES.index(0xFF) - rs = RadioSettingValueList(TXALLOW_CHOICES, TXALLOW_CHOICES[idx]) - rset = RadioSetting("txallow.range620_630", "620-630 MHz", rs) - rset.set_apply_callback(apply_txallow_listvalue, _txallow.range620_630) - txallow.append(rset) - - if _txallow.range630_640 in TXALLOW_VALUES: - idx = TXALLOW_VALUES.index(_txallow.range630_640) - else: - idx = TXALLOW_VALUES.index(0xFF) - rs = RadioSettingValueList(TXALLOW_CHOICES, TXALLOW_CHOICES[idx]) - rset = RadioSetting("txallow.range630_640", "630-640 MHz", rs) - rset.set_apply_callback(apply_txallow_listvalue, _txallow.range630_640) - txallow.append(rset) - - if _txallow.range640_650 in TXALLOW_VALUES: - idx = TXALLOW_VALUES.index(_txallow.range640_650) - else: - idx = TXALLOW_VALUES.index(0xFF) - rs = RadioSettingValueList(TXALLOW_CHOICES, TXALLOW_CHOICES[idx]) - rset = RadioSetting("txallow.range640_650", "640-650 MHz", rs) - rset.set_apply_callback(apply_txallow_listvalue, _txallow.range640_650) - txallow.append(rset) - - if _txallow.range650_660 in TXALLOW_VALUES: - idx = TXALLOW_VALUES.index(_txallow.range650_660) - else: - idx = TXALLOW_VALUES.index(0xFF) - rs = RadioSettingValueList(TXALLOW_CHOICES, TXALLOW_CHOICES[idx]) - rset = RadioSetting("txallow.range650_660", "650-660 MHz", rs) - rset.set_apply_callback(apply_txallow_listvalue, _txallow.range650_660) - txallow.append(rset) - - return top - - def set_settings(self, settings): - for element in settings: - if not isinstance(element, RadioSetting): - self.set_settings(element) - continue - else: - try: - if "." in element.get_name(): - bits = element.get_name().split(".") - obj = self._memobj - for bit in bits[:-1]: - obj = getattr(obj, bit) - setting = bits[-1] - else: - obj = self._memobj.settings - setting = element.get_name() - - if element.has_apply_callback(): - LOG.debug("Using apply callback") - element.run_apply_callback() - elif setting == "dsrangea": - setattr(obj, setting, int(element.value) - 1) - elif setting == "dsrangeb": - setattr(obj, setting, int(element.value) - 1) - elif element.value.get_mutable(): - LOG.debug("Setting %s = %s" % (setting, element.value)) - setattr(obj, setting, element.value) - except Exception as e: - LOG.debug(element.get_name()) - raise - - @classmethod - def match_model(cls, filedata, filename): - # This radio has always been post-metadata, so never do - # old-school detection - return False - - -@directory.register -class AbbreeAR518Radio(IradioUV5118): - """ABBREE AR518""" - VENDOR = "Abbree" - MODEL = "AR-518" diff --git a/chirp/drivers/iradio_uv_5118.py b/chirp/drivers/iradio_uv_5118.py new file mode 100644 index 0000000..85b961f --- /dev/null +++ b/chirp/drivers/iradio_uv_5118.py @@ -0,0 +1,1117 @@ +# Copyright 2022 Jim Unroe +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +import struct +import logging + +from chirp import chirp_common, directory, memmap +from chirp import bitwise, errors, util +from chirp.settings import RadioSetting, RadioSettingGroup, \ + RadioSettingValueInteger, RadioSettingValueList, \ + RadioSettingValueBoolean, RadioSettingValueFloat, \ + RadioSettings + +LOG = logging.getLogger(__name__) + +MEM_FORMAT = """ +struct memory { + ul32 rxfreq; // 00-03 + ul16 rx_tone; // PL/DPL Decode // 04-05 + ul32 txfreq; // 06-09 + ul16 tx_tone; // PL/DPL Encode // 0a-0b + u8 lowpower:1, // Power Level // 0c + isnarrow:1, // Bandwidth + unknown1:1, + unknown2:3, + bcl:1, // Busy Channel Lockout + scan:1; // Scan Add + u8 unknown3[3]; // 0d-0f +}; + +#seekto 0x0050; +struct memory channels[128]; + +#seekto 0x0010; +struct { + u8 range174_180; // 174-180 MHz + u8 range180_190; // 180-190 MHz + u8 range190_200; // 190-200 MHz + u8 range200_210; // 200-210 MHz + u8 range210_220; // 210-220 MHz + u8 range220_230; // 220-230 MHz + u8 range230_240; // 230-240 MHz + u8 range240_250; // 240-250 MHz + u8 range250_260; // 240-250 MHz + u8 range260_270; // 260-270 MHz + u8 range270_280; // 270-280 MHz + u8 range280_290; // 280-290 MHz + u8 range290_300; // 290-300 MHz + u8 range300_310; // 300-310 MHz + u8 range310_320; // 310-320 MHz + u8 range320_330; // 320-330 MHz + u8 range330_340; // 330-340 MHz + u8 range340_350; // 340-350 MHz + u8 range350_360; // 350-360 MHz + u8 range360_370; // 360-370 MHz + u8 range370_380; // 370-380 MHz + u8 range380_390; // 380-390 MHz + u8 range390_400; // 290-400 MHz + u8 range520_530; // 520-530 MHz + u8 range530_540; // 530-540 MHz + u8 range540_550; // 540-550 MHz + u8 range550_560; // 550-560 MHz + u8 range560_570; // 560-570 MHz + u8 range570_580; // 570-580 MHz + u8 range580_590; // 580-590 MHz + u8 range590_600; // 590-600 MHz + u8 range600_610; // 600-610 MHz + u8 range610_620; // 610-620 MHz + u8 range620_630; // 620-630 MHz + u8 range630_640; // 630-640 MHz + u8 range640_650; // 640-650 MHz + u8 range650_660; // 650-660 MHz +} txallow; + +#seekto 0x0039; +struct { + u8 display_timer; // 0x0039 Display Timer + u8 led_timer; // 0x003A LED Timer + u8 auto_lock; // 0x003B Auto Lock + u8 pfkey1short; // 0x003C FS1 Short + u8 pfkey1long; // 0x003D FS1 Long + u8 pfkey2short; // 0x003E FS2 Short + u8 pfkey2long; // 0x003F FS2 Long + u8 unknown_0; // 0x0040 + u8 voice:2, // 0x0041 Voice Prompt + beep:1, // Beep Switch + roger:2, // Roger Tone + save:3; // Power Save + u8 dispmode:1, // 0x0042 Display Mode + dstandby:1, // Dual Standby + unknown_1:1 + standby:1, // Radio Standby + squelch:4; // Squelch Level + u8 vox_level:4, // 0x0043 VOX Level + vox_delay:4; // VOX Delay + u8 brightness:2, // 0x0044 Screen Light + unknown_2:1, + alarm:1, // Alarm + scramble:4; // Scramble + u8 screen:1, // 0x0045 Screen On-off + led:1, // LED On-off + key_lock:1, // Key Lock + radio:1, // Radio On-off + compander:1, // Compander + rp:1, // Offset + freq_lock:1, // Freq Lock + vox:1; // VOX On-off + u8 unknown_4:4, // 0x0046 + txpri:1, // TX PRI + unknown_5:1, + tail_tone:2; // Tail Tone + ul16 fmcur; // 0x0047 Radio Freq + u8 unknown_49; // 0x0049 + u8 unknown_4A; // 0x004A + u8 unknown_4B; // 0x004B + u8 unknown_4C; // 0x004C + u8 dsrangea; // 0x004D Dual Standby Range A + u8 dsrangeb; // 0x004E Dual Standby Range B + u8 tot; // 0x004F +} settings; + +""" + +CMD_ACK = b"\x06" + +RB15_DTCS = tuple(sorted(chirp_common.DTCS_CODES + (645,))) + +_STEP_LIST = [0.25, 1.25, 2.5, 5., 6.25, 10., 12.5, 25., 50., 100.] + +LIST_ALARM = ["Local", "Remote"] +LIST_BRIGHT = ["Low", "Middle", "High"] +LIST_DISPM = ["Frequency", "Channel Number"] +LIST_ROGER = ["Off", "Start", "End", "Start and End"] +LIST_SAVE = ["Off", "1:1", "1:2", "1:3", "1:4", "1:5"] +LIST_SCRAMBLE = ["Off"] + ["%s" % x for x in range(1, 9)] +LIST_SKEY = ["None", "Monitor", "Local Alarm", "Remote Alarm", + "Screen On/Off", "Frequency Lock"] +LIST_TIMER = ["Off"] + ["%s seconds" % x for x in range(15, 615, 15)] +LIST_TXPRI = ["Edit", "Busy"] +LIST_VOICE = ["Off", "Chinese", "English"] + +TXALLOW_CHOICES = ["RX Only", "TX/RX"] +TXALLOW_VALUES = [0xFF, 0x00] + + +def _checksum(data): + cs = 0 + for byte in data: + cs += byte + return cs % 256 + + +def _enter_programming_mode(radio): + serial = radio.pipe + + # lengthen the timeout here as these radios are resetting due to timeout + radio.pipe.timeout = 0.75 + + exito = False + for i in range(0, 5): + serial.write(radio.magic) + ack = serial.read(1) + + try: + if ack == CMD_ACK: + exito = True + break + except: + LOG.debug("Attempt #%s, failed, trying again" % i) + pass + + # return timeout to default value + radio.pipe.timeout = 0.25 + + # check if we had EXITO + if exito is False: + msg = "The radio did not accept program mode after five tries.\n" + msg += "Check you interface cable and power cycle your radio." + raise errors.RadioError(msg) + + +def _exit_programming_mode(radio): + serial = radio.pipe + try: + serial.write(b"93" + b"\x05\xEE\x5F") + except: + raise errors.RadioError("Radio refused to exit programming mode") + + +def _read_block(radio, block_addr, block_size): + serial = radio.pipe + + cmd = struct.pack(">BH", ord(b'R'), block_addr + 0x0340) + + ccs = bytes([_checksum(cmd)]) + + expectedresponse = b"R" + cmd[1:] + + cmd = cmd + ccs + + LOG.debug("Reading block %04x..." % (block_addr + 0x0340)) + + try: + serial.write(cmd) + response = serial.read(3 + block_size + 1) + + cs = _checksum(response[:-1]) + + if response[:3] != expectedresponse: + raise Exception("Error reading block %04x." % (block_addr + + 0x0340)) + + chunk = response[3:] + + if chunk[-1] != cs: + raise Exception("Block failed checksum!") + + block_data = chunk[:-1] + except: + raise errors.RadioError("Failed to read block at %04x" % block_addr + + 0x0340) + + return block_data + + +def _write_block(radio, block_addr, block_size): + serial = radio.pipe + + data = radio.get_mmap()[block_addr:block_addr + block_size] + + cmd = struct.pack(">BH", ord(b'W'), block_addr + 0x0340) + + cs = bytes([_checksum(cmd + data)]) + data += cs + + LOG.debug("Writing Data:") + LOG.debug(util.hexprint(cmd + data)) + + try: + serial.write(cmd + data) + if serial.read(1) != CMD_ACK: + raise Exception("No ACK") + except: + raise errors.RadioError("Failed to send block " + "to radio at %04x" % (block_addr + 0x0340)) + + +def do_download(radio): + LOG.debug("download") + _enter_programming_mode(radio) + + data = b"" + + status = chirp_common.Status() + status.msg = "Cloning from radio" + + status.cur = 0 + status.max = radio._memsize + + for addr in range(0, radio._memsize, radio.BLOCK_SIZE): + status.cur = addr + radio.BLOCK_SIZE + radio.status_fn(status) + + block = _read_block(radio, addr, radio.BLOCK_SIZE) + data += block + + LOG.debug("Address: %04x" % addr) + LOG.debug(util.hexprint(block)) + + _exit_programming_mode(radio) + + return memmap.MemoryMapBytes(data) + + +def do_upload(radio): + status = chirp_common.Status() + status.msg = "Uploading to radio" + + _enter_programming_mode(radio) + + status.cur = 0 + status.max = radio._memsize + + for start_addr, end_addr in radio._ranges: + for addr in range(start_addr, end_addr, radio.BLOCK_SIZE): + status.cur = addr + radio.BLOCK_SIZE + radio.status_fn(status) + _write_block(radio, addr, radio.BLOCK_SIZE) + + _exit_programming_mode(radio) + + +def _split(rf, f1, f2): + """Returns False if the two freqs are in the same band (no split) + or True otherwise""" + + # determine if the two freqs are in the same band + for low, high in rf.valid_bands: + if f1 >= low and f1 <= high and \ + f2 >= low and f2 <= high: + # if the two freqs are on the same Band this is not a split + return False + + # if you get here is because the freq pairs are split + return True + + +class IradioUV5118(chirp_common.CloneModeRadio): + """IRADIO UV5118""" + VENDOR = "Iradio" + MODEL = "UV-5118" + BAUD_RATE = 9600 + NEEDS_COMPAT_SERIAL = False + + BLOCK_SIZE = 0x10 + magic = b"93" + b"\x05\x10\x81" + + VALID_BANDS = [(20000000, 64000000), # RX only + (108000000, 136000000), # RX only (Air Band) + (136000000, 174000000), # TX/RX (VHF) + (174000000, 400000000), # TX/RX + (400000000, 520000000), # TX/RX (UHF) + (520000000, 660000000)] # TX/RX + + POWER_LEVELS = [chirp_common.PowerLevel("High", watts=2.00), + chirp_common.PowerLevel("Low", watts=0.50)] + + # Radio's memory starts at 0x0340 + # Radio's memory ends at 0x0B90 + + _ranges = [ + (0x0000, 0x0850), + ] + _memsize = 0x0850 + + _upper = 128 + + def get_features(self): + rf = chirp_common.RadioFeatures() + rf.has_settings = True + rf.has_bank = False + rf.has_ctone = True + rf.has_cross = True + rf.has_rx_dtcs = True + rf.has_tuning_step = False + rf.can_odd_split = True + rf.has_name = False + rf.valid_skips = ["", "S"] + rf.valid_tmodes = ["", "Tone", "TSQL", "DTCS", "Cross"] + rf.valid_cross_modes = ["Tone->Tone", "Tone->DTCS", "DTCS->Tone", + "->Tone", "->DTCS", "DTCS->", "DTCS->DTCS"] + rf.valid_power_levels = self.POWER_LEVELS + rf.valid_duplexes = ["", "-", "+", "split"] + rf.valid_modes = ["FM", "NFM"] # 25 kHz, 12.5 kHz. + rf.valid_dtcs_codes = RB15_DTCS + rf.memory_bounds = (1, self._upper) + rf.valid_tuning_steps = _STEP_LIST + rf.valid_bands = self.VALID_BANDS + + return rf + + def process_mmap(self): + self._memobj = bitwise.parse(MEM_FORMAT, self._mmap) + + def sync_in(self): + """Download from radio""" + try: + data = do_download(self) + except errors.RadioError: + # Pass through any real errors we raise + raise + except: + # If anything unexpected happens, make sure we raise + # a RadioError and log the problem + LOG.exception('Unexpected error during download') + raise errors.RadioError('Unexpected error communicating ' + 'with the radio') + self._mmap = data + self.process_mmap() + + def sync_out(self): + """Upload to radio""" + try: + do_upload(self) + except: + # If anything unexpected happens, make sure we raise + # a RadioError and log the problem + LOG.exception('Unexpected error during upload') + raise errors.RadioError('Unexpected error communicating ' + 'with the radio') + + def get_raw_memory(self, number): + return repr(self._memobj.memory[number - 1]) + + @staticmethod + def _decode_tone(toneval): + # DCS examples: + # D023N - 1013 - 0001 0000 0001 0011 + # ^-DCS + # D023I - 2013 - 0010 0000 0001 0100 + # ^--DCS inverted + # D754I - 21EC - 0010 0001 1110 1100 + # code in octal-------^^^^^^^^^^^ + + if toneval == 0x3000: + return '', None, None + elif toneval & 0x1000: + # DTCS N + code = int('%o' % (toneval & 0x1FF)) + return 'DTCS', code, 'N' + elif toneval & 0x2000: + # DTCS R + code = int('%o' % (toneval & 0x1FF)) + return 'DTCS', code, 'R' + else: + return 'Tone', toneval / 10.0, None + + @staticmethod + def _encode_tone(mode, val, pol): + if not mode: + return 0x3000 + elif mode == 'Tone': + return int(val * 10) + elif mode == 'DTCS': + code = int('%i' % val, 8) + if pol == 'N': + code |= 0x1800 + if pol == 'R': + code |= 0x2800 + return code + else: + raise errors.RadioError('Unsupported tone mode %r' % mode) + + def get_memory(self, number): + mem = chirp_common.Memory() + _mem = self._memobj.channels[number - 1] + mem.number = number + + mem.freq = int(_mem.rxfreq) * 10 + + # We'll consider any blank (i.e. 0 MHz frequency) to be empty + if mem.freq == 0: + mem.empty = True + return mem + + if _mem.rxfreq.get_raw() == "\xFF\xFF\xFF\xFF": + mem.freq = 0 + mem.empty = True + return mem + + if _mem.get_raw() == ("\xFF" * 16): + LOG.debug("Initializing empty memory") + _mem.set_raw("\xFF" * 4 + "\x00\x30" + "\xFF" * 4 + "\x00\x30" + + "\x00" * 4) + + # Freq and offset + mem.freq = int(_mem.rxfreq) * 10 + # TX freq set + offset = (int(_mem.txfreq) * 10) - mem.freq + if offset != 0: + if _split(self.get_features(), mem.freq, int( + _mem.txfreq) * 10): + mem.duplex = "split" + mem.offset = int(_mem.txfreq) * 10 + elif offset < 0: + mem.offset = abs(offset) + mem.duplex = "-" + elif offset > 0: + mem.offset = offset + mem.duplex = "+" + else: + mem.offset = 0 + + mem.mode = _mem.isnarrow and "NFM" or "FM" + + chirp_common.split_tone_decode(mem, + self._decode_tone(_mem.tx_tone), + self._decode_tone(_mem.rx_tone)) + + mem.power = self.POWER_LEVELS[_mem.lowpower] + + if not _mem.scan: + mem.skip = "S" + + mem.extra = RadioSettingGroup("Extra", "extra") + + rs = RadioSetting("bcl", "BCL", + RadioSettingValueBoolean(_mem.bcl)) + mem.extra.append(rs) + + return mem + + def set_memory(self, mem): + LOG.debug("Setting %i(%s)" % (mem.number, mem.extd_number)) + _mem = self._memobj.channels[mem.number - 1] + + # if empty memory + if mem.empty: + _mem.set_raw("\xFF" * 16) + return + + _mem.set_raw("\xFF" * 4 + "\x00\x30" + "\xFF" * 4 + "\x00\x30" + + "\x00" * 4) + + _mem.rxfreq = mem.freq / 10 + + if mem.duplex == "split": + _mem.txfreq = mem.offset / 10 + elif mem.duplex == "+": + _mem.txfreq = (mem.freq + mem.offset) / 10 + elif mem.duplex == "-": + _mem.txfreq = (mem.freq - mem.offset) / 10 + else: + _mem.txfreq = mem.freq / 10 + + _mem.scan = mem.skip != "S" + _mem.isnarrow = mem.mode == "NFM" + + txtone, rxtone = chirp_common.split_tone_encode(mem) + _mem.tx_tone = self._encode_tone(*txtone) + _mem.rx_tone = self._encode_tone(*rxtone) + + _mem.lowpower = mem.power == self.POWER_LEVELS[1] + + for setting in mem.extra: + setattr(_mem, setting.get_name(), setting.value) + + def get_settings(self): + _settings = self._memobj.settings + _txallow = self._memobj.txallow + basic = RadioSettingGroup("basic", "Basic Settings") + sidekey = RadioSettingGroup("sidekey", "Side Key Settings") + dwatch = RadioSettingGroup("dwatch", "Dual Watch Settings") + txallow = RadioSettingGroup("txallow", "TX Allow") + top = RadioSettings(basic, sidekey, dwatch, txallow) + + voice = RadioSetting("voice", "Language", RadioSettingValueList( + LIST_VOICE, LIST_VOICE[_settings.voice])) + basic.append(voice) + + beep = RadioSetting("beep", "Key Beep", + RadioSettingValueBoolean(_settings.beep)) + basic.append(beep) + + roger = RadioSetting("roger", "Roger Tone", + RadioSettingValueList( + LIST_ROGER, LIST_ROGER[_settings.roger])) + basic.append(roger) + + save = RadioSetting("save", "Battery Save", + RadioSettingValueList( + LIST_SAVE, LIST_SAVE[_settings.save])) + basic.append(save) + + dispmode = RadioSetting("dispmode", "Display Mode", + RadioSettingValueList( + LIST_DISPM, + LIST_DISPM[_settings.dispmode])) + basic.append(dispmode) + + brightness = RadioSetting("brightness", "Screen Light", + RadioSettingValueList( + LIST_BRIGHT, + LIST_BRIGHT[_settings.brightness])) + basic.append(brightness) + + screen = RadioSetting("screen", "Screen", + RadioSettingValueBoolean(_settings.screen)) + basic.append(screen) + + display_timer = RadioSetting("display_timer", "Display Timer", + RadioSettingValueList( + LIST_TIMER, + LIST_TIMER[_settings.display_timer])) + basic.append(display_timer) + + led = RadioSetting("led", "LED", + RadioSettingValueBoolean(_settings.led)) + basic.append(led) + + led_timer = RadioSetting("led_timer", "LED Timer", + RadioSettingValueList( + LIST_TIMER, + LIST_TIMER[_settings.led_timer])) + basic.append(led_timer) + + squelch = RadioSetting("squelch", "Squelch Level", + RadioSettingValueInteger( + 0, 9, _settings.squelch)) + basic.append(squelch) + + vox = RadioSetting("vox", "VOX", + RadioSettingValueBoolean(_settings.vox)) + basic.append(vox) + + vox_level = RadioSetting("vox_level", "VOX Level", + RadioSettingValueInteger( + 0, 9, _settings.vox_level)) + basic.append(vox_level) + + vox_delay = RadioSetting("vox_delay", "VOX Delay", + RadioSettingValueInteger( + 0, 9, _settings.vox_delay)) + basic.append(vox_delay) + + compander = RadioSetting("compander", "Compander", + RadioSettingValueBoolean(_settings.compander)) + basic.append(compander) + + scramble = RadioSetting("scramble", "Scramble", + RadioSettingValueList( + LIST_SCRAMBLE, + LIST_SCRAMBLE[_settings.scramble])) + basic.append(scramble) + + rp = RadioSetting("rp", "Offset", + RadioSettingValueBoolean(_settings.rp)) + basic.append(rp) + + txpri = RadioSetting("txpri", "TX Priority", + RadioSettingValueList( + LIST_TXPRI, + LIST_TXPRI[_settings.txpri])) + basic.append(txpri) + + tot = RadioSetting("tot", "Time-out Timer", + RadioSettingValueList( + LIST_TIMER, + LIST_TIMER[_settings.tot])) + basic.append(tot) + + tail_tone = RadioSetting("tail_tone", "Tail Tone", + RadioSettingValueInteger( + 0, 3, _settings.tail_tone)) + basic.append(tail_tone) + + alarm = RadioSetting("alarm", "Alarm", + RadioSettingValueList( + LIST_ALARM, + LIST_ALARM[_settings.alarm])) + basic.append(alarm) + + freq_lock = RadioSetting("freq_lock", "Frequency Lock", + RadioSettingValueBoolean(_settings.freq_lock)) + basic.append(freq_lock) + + key_lock = RadioSetting("key_lock", "Key Lock", + RadioSettingValueBoolean(_settings.key_lock)) + basic.append(key_lock) + + auto_lock = RadioSetting("auto_lock", "Auto Lock Timer", + RadioSettingValueList( + LIST_TIMER, + LIST_TIMER[_settings.auto_lock])) + basic.append(auto_lock) + + radio = RadioSetting("radio", "Broadcast FM Radio", + RadioSettingValueBoolean(_settings.radio)) + basic.append(radio) + + standby = RadioSetting("standby", "Radio Standby", + RadioSettingValueBoolean(_settings.standby)) + basic.append(standby) + + def myset_freq(setting, obj, atrb, mult): + """ Callback to set frequency by applying multiplier""" + value = int(float(str(setting.value)) * mult) + setattr(obj, atrb, value) + return + + # FM Broadcast Settings + val = _settings.fmcur + val = val / 10.0 + if val < 87.5 or val > 108.0: + val = 90.4 + rx = RadioSettingValueFloat(87.5, 108.0, val, 0.1, 1) + rset = RadioSetting("fmcur", "Broadcast FM Freq (MHz)", rx) + rset.set_apply_callback(myset_freq, _settings, "fmcur", 10) + basic.append(rset) + + # Side Key Settings + pfkey1short = RadioSetting("pfkey1short", "Side Key 1 - Short Press", + RadioSettingValueList( + LIST_SKEY, + LIST_SKEY[_settings.pfkey1short])) + sidekey.append(pfkey1short) + + pfkey1long = RadioSetting("pfkey1long", "Side Key 1 - Long Press", + RadioSettingValueList( + LIST_SKEY, + LIST_SKEY[_settings.pfkey1long])) + sidekey.append(pfkey1long) + + pfkey2short = RadioSetting("pfkey2short", "Side Key 2 - Short Press", + RadioSettingValueList( + LIST_SKEY, + LIST_SKEY[_settings.pfkey2short])) + sidekey.append(pfkey2short) + + pfkey2long = RadioSetting("pfkey2long", "Side Key 2 - Long Press", + RadioSettingValueList( + LIST_SKEY, + LIST_SKEY[_settings.pfkey2long])) + sidekey.append(pfkey2long) + + dstandby = RadioSetting("dstandby", "Dual Standby", + RadioSettingValueBoolean(_settings.dstandby)) + dwatch.append(dstandby) + + dsrangea = RadioSetting("dsrangea", "Dual Standby Range A", + RadioSettingValueInteger( + 1, 128, _settings.dsrangea + 1)) + dwatch.append(dsrangea) + + dsrangeb = RadioSetting("dsrangeb", "Dual Standby Range B", + RadioSettingValueInteger( + 1, 128, _settings.dsrangeb + 1)) + dwatch.append(dsrangeb) + + def apply_txallow_listvalue(setting, obj): + LOG.debug("Setting value: " + str( + setting.value) + " from list") + val = str(setting.value) + index = TXALLOW_CHOICES.index(val) + val = TXALLOW_VALUES[index] + obj.set_value(val) + + if _txallow.range174_180 in TXALLOW_VALUES: + idx = TXALLOW_VALUES.index(_txallow.range174_180) + else: + idx = TXALLOW_VALUES.index(0xFF) + rs = RadioSettingValueList(TXALLOW_CHOICES, TXALLOW_CHOICES[idx]) + rset = RadioSetting("txallow.range174_180", "174-180 MHz", rs) + rset.set_apply_callback(apply_txallow_listvalue, _txallow.range174_180) + txallow.append(rset) + + if _txallow.range180_190 in TXALLOW_VALUES: + idx = TXALLOW_VALUES.index(_txallow.range180_190) + else: + idx = TXALLOW_VALUES.index(0xFF) + rs = RadioSettingValueList(TXALLOW_CHOICES, TXALLOW_CHOICES[idx]) + rset = RadioSetting("txallow.range180_190", "180-190 MHz", rs) + rset.set_apply_callback(apply_txallow_listvalue, _txallow.range180_190) + txallow.append(rset) + + if _txallow.range190_200 in TXALLOW_VALUES: + idx = TXALLOW_VALUES.index(_txallow.range190_200) + else: + idx = TXALLOW_VALUES.index(0xFF) + rs = RadioSettingValueList(TXALLOW_CHOICES, TXALLOW_CHOICES[idx]) + rset = RadioSetting("txallow.range190_200", "190-200 MHz", rs) + rset.set_apply_callback(apply_txallow_listvalue, _txallow.range190_200) + txallow.append(rset) + + if _txallow.range200_210 in TXALLOW_VALUES: + idx = TXALLOW_VALUES.index(_txallow.range200_210) + else: + idx = TXALLOW_VALUES.index(0xFF) + rs = RadioSettingValueList(TXALLOW_CHOICES, TXALLOW_CHOICES[idx]) + rset = RadioSetting("txallow.range200_210", "200-210 MHz", rs) + rset.set_apply_callback(apply_txallow_listvalue, _txallow.range200_210) + txallow.append(rset) + + if _txallow.range210_220 in TXALLOW_VALUES: + idx = TXALLOW_VALUES.index(_txallow.range210_220) + else: + idx = TXALLOW_VALUES.index(0xFF) + rs = RadioSettingValueList(TXALLOW_CHOICES, TXALLOW_CHOICES[idx]) + rset = RadioSetting("txallow.range210_220", "210-220 MHz", rs) + rset.set_apply_callback(apply_txallow_listvalue, _txallow.range210_220) + txallow.append(rset) + + if _txallow.range220_230 in TXALLOW_VALUES: + idx = TXALLOW_VALUES.index(_txallow.range220_230) + else: + idx = TXALLOW_VALUES.index(0xFF) + rs = RadioSettingValueList(TXALLOW_CHOICES, TXALLOW_CHOICES[idx]) + rset = RadioSetting("txallow.range220_230", "220-230 MHz", rs) + rset.set_apply_callback(apply_txallow_listvalue, _txallow.range220_230) + txallow.append(rset) + + if _txallow.range230_240 in TXALLOW_VALUES: + idx = TXALLOW_VALUES.index(_txallow.range230_240) + else: + idx = TXALLOW_VALUES.index(0xFF) + rs = RadioSettingValueList(TXALLOW_CHOICES, TXALLOW_CHOICES[idx]) + rset = RadioSetting("txallow.range230_240", "230-240 MHz", rs) + rset.set_apply_callback(apply_txallow_listvalue, _txallow.range230_240) + txallow.append(rset) + + if _txallow.range240_250 in TXALLOW_VALUES: + idx = TXALLOW_VALUES.index(_txallow.range240_250) + else: + idx = TXALLOW_VALUES.index(0xFF) + rs = RadioSettingValueList(TXALLOW_CHOICES, TXALLOW_CHOICES[idx]) + rset = RadioSetting("txallow.range240_250", "240-250 MHz", rs) + rset.set_apply_callback(apply_txallow_listvalue, _txallow.range240_250) + txallow.append(rset) + + if _txallow.range250_260 in TXALLOW_VALUES: + idx = TXALLOW_VALUES.index(_txallow.range250_260) + else: + idx = TXALLOW_VALUES.index(0xFF) + rs = RadioSettingValueList(TXALLOW_CHOICES, TXALLOW_CHOICES[idx]) + rset = RadioSetting("txallow.range250_260", "250-260 MHz", rs) + rset.set_apply_callback(apply_txallow_listvalue, _txallow.range250_260) + txallow.append(rset) + + if _txallow.range260_270 in TXALLOW_VALUES: + idx = TXALLOW_VALUES.index(_txallow.range260_270) + else: + idx = TXALLOW_VALUES.index(0xFF) + rs = RadioSettingValueList(TXALLOW_CHOICES, TXALLOW_CHOICES[idx]) + rset = RadioSetting("txallow.range260_270", "260-270 MHz", rs) + rset.set_apply_callback(apply_txallow_listvalue, _txallow.range260_270) + txallow.append(rset) + + if _txallow.range270_280 in TXALLOW_VALUES: + idx = TXALLOW_VALUES.index(_txallow.range270_280) + else: + idx = TXALLOW_VALUES.index(0xFF) + rs = RadioSettingValueList(TXALLOW_CHOICES, TXALLOW_CHOICES[idx]) + rset = RadioSetting("txallow.range270_280", "270-280 MHz", rs) + rset.set_apply_callback(apply_txallow_listvalue, _txallow.range270_280) + txallow.append(rset) + + if _txallow.range280_290 in TXALLOW_VALUES: + idx = TXALLOW_VALUES.index(_txallow.range280_290) + else: + idx = TXALLOW_VALUES.index(0xFF) + rs = RadioSettingValueList(TXALLOW_CHOICES, TXALLOW_CHOICES[idx]) + rset = RadioSetting("txallow.range280_290", "280-290 MHz", rs) + rset.set_apply_callback(apply_txallow_listvalue, _txallow.range280_290) + txallow.append(rset) + + if _txallow.range290_300 in TXALLOW_VALUES: + idx = TXALLOW_VALUES.index(_txallow.range290_300) + else: + idx = TXALLOW_VALUES.index(0xFF) + rs = RadioSettingValueList(TXALLOW_CHOICES, TXALLOW_CHOICES[idx]) + rset = RadioSetting("txallow.range290_300", "290-300 MHz", rs) + rset.set_apply_callback(apply_txallow_listvalue, _txallow.range290_300) + txallow.append(rset) + + if _txallow.range300_310 in TXALLOW_VALUES: + idx = TXALLOW_VALUES.index(_txallow.range300_310) + else: + idx = TXALLOW_VALUES.index(0xFF) + rs = RadioSettingValueList(TXALLOW_CHOICES, TXALLOW_CHOICES[idx]) + rset = RadioSetting("txallow.range300_310", "300-310 MHz", rs) + rset.set_apply_callback(apply_txallow_listvalue, _txallow.range300_310) + txallow.append(rset) + + if _txallow.range310_320 in TXALLOW_VALUES: + idx = TXALLOW_VALUES.index(_txallow.range310_320) + else: + idx = TXALLOW_VALUES.index(0xFF) + rs = RadioSettingValueList(TXALLOW_CHOICES, TXALLOW_CHOICES[idx]) + rset = RadioSetting("txallow.range310_320", "310-320 MHz", rs) + rset.set_apply_callback(apply_txallow_listvalue, _txallow.range310_320) + txallow.append(rset) + + if _txallow.range320_330 in TXALLOW_VALUES: + idx = TXALLOW_VALUES.index(_txallow.range320_330) + else: + idx = TXALLOW_VALUES.index(0xFF) + rs = RadioSettingValueList(TXALLOW_CHOICES, TXALLOW_CHOICES[idx]) + rset = RadioSetting("txallow.range320_330", "320-330 MHz", rs) + rset.set_apply_callback(apply_txallow_listvalue, _txallow.range320_330) + txallow.append(rset) + + if _txallow.range330_340 in TXALLOW_VALUES: + idx = TXALLOW_VALUES.index(_txallow.range330_340) + else: + idx = TXALLOW_VALUES.index(0xFF) + rs = RadioSettingValueList(TXALLOW_CHOICES, TXALLOW_CHOICES[idx]) + rset = RadioSetting("txallow.range330_340", "330-340 MHz", rs) + rset.set_apply_callback(apply_txallow_listvalue, _txallow.range330_340) + txallow.append(rset) + + if _txallow.range340_350 in TXALLOW_VALUES: + idx = TXALLOW_VALUES.index(_txallow.range340_350) + else: + idx = TXALLOW_VALUES.index(0xFF) + rs = RadioSettingValueList(TXALLOW_CHOICES, TXALLOW_CHOICES[idx]) + rset = RadioSetting("txallow.range340_350", "340-350 MHz", rs) + rset.set_apply_callback(apply_txallow_listvalue, _txallow.range340_350) + txallow.append(rset) + + if _txallow.range350_360 in TXALLOW_VALUES: + idx = TXALLOW_VALUES.index(_txallow.range350_360) + else: + idx = TXALLOW_VALUES.index(0xFF) + rs = RadioSettingValueList(TXALLOW_CHOICES, TXALLOW_CHOICES[idx]) + rset = RadioSetting("txallow.range350_360", "350-360 MHz", rs) + rset.set_apply_callback(apply_txallow_listvalue, _txallow.range350_360) + txallow.append(rset) + + if _txallow.range360_370 in TXALLOW_VALUES: + idx = TXALLOW_VALUES.index(_txallow.range360_370) + else: + idx = TXALLOW_VALUES.index(0xFF) + rs = RadioSettingValueList(TXALLOW_CHOICES, TXALLOW_CHOICES[idx]) + rset = RadioSetting("txallow.range360_370", "360-370 MHz", rs) + rset.set_apply_callback(apply_txallow_listvalue, _txallow.range360_370) + txallow.append(rset) + + if _txallow.range370_380 in TXALLOW_VALUES: + idx = TXALLOW_VALUES.index(_txallow.range370_380) + else: + idx = TXALLOW_VALUES.index(0xFF) + rs = RadioSettingValueList(TXALLOW_CHOICES, TXALLOW_CHOICES[idx]) + rset = RadioSetting("txallow.range370_380", "370-380 MHz", rs) + rset.set_apply_callback(apply_txallow_listvalue, _txallow.range370_380) + txallow.append(rset) + + if _txallow.range380_390 in TXALLOW_VALUES: + idx = TXALLOW_VALUES.index(_txallow.range380_390) + else: + idx = TXALLOW_VALUES.index(0xFF) + rs = RadioSettingValueList(TXALLOW_CHOICES, TXALLOW_CHOICES[idx]) + rset = RadioSetting("txallow.range380_390", "380-390 MHz", rs) + rset.set_apply_callback(apply_txallow_listvalue, _txallow.range380_390) + txallow.append(rset) + + if _txallow.range390_400 in TXALLOW_VALUES: + idx = TXALLOW_VALUES.index(_txallow.range390_400) + else: + idx = TXALLOW_VALUES.index(0xFF) + rs = RadioSettingValueList(TXALLOW_CHOICES, TXALLOW_CHOICES[idx]) + rset = RadioSetting("txallow.range390_400", "390-400 MHz", rs) + rset.set_apply_callback(apply_txallow_listvalue, _txallow.range390_400) + txallow.append(rset) + + if _txallow.range520_530 in TXALLOW_VALUES: + idx = TXALLOW_VALUES.index(_txallow.range520_530) + else: + idx = TXALLOW_VALUES.index(0xFF) + rs = RadioSettingValueList(TXALLOW_CHOICES, TXALLOW_CHOICES[idx]) + rset = RadioSetting("txallow.range520_530", "520-530 MHz", rs) + rset.set_apply_callback(apply_txallow_listvalue, _txallow.range520_530) + txallow.append(rset) + + if _txallow.range530_540 in TXALLOW_VALUES: + idx = TXALLOW_VALUES.index(_txallow.range530_540) + else: + idx = TXALLOW_VALUES.index(0xFF) + rs = RadioSettingValueList(TXALLOW_CHOICES, TXALLOW_CHOICES[idx]) + rset = RadioSetting("txallow.range530_540", "530-540 MHz", rs) + rset.set_apply_callback(apply_txallow_listvalue, _txallow.range530_540) + txallow.append(rset) + + if _txallow.range540_550 in TXALLOW_VALUES: + idx = TXALLOW_VALUES.index(_txallow.range540_550) + else: + idx = TXALLOW_VALUES.index(0xFF) + rs = RadioSettingValueList(TXALLOW_CHOICES, TXALLOW_CHOICES[idx]) + rset = RadioSetting("txallow.range540_550", "540-550 MHz", rs) + rset.set_apply_callback(apply_txallow_listvalue, _txallow.range540_550) + txallow.append(rset) + + if _txallow.range550_560 in TXALLOW_VALUES: + idx = TXALLOW_VALUES.index(_txallow.range550_560) + else: + idx = TXALLOW_VALUES.index(0xFF) + rs = RadioSettingValueList(TXALLOW_CHOICES, TXALLOW_CHOICES[idx]) + rset = RadioSetting("txallow.range550_560", "550-560 MHz", rs) + rset.set_apply_callback(apply_txallow_listvalue, _txallow.range550_560) + txallow.append(rset) + + if _txallow.range560_570 in TXALLOW_VALUES: + idx = TXALLOW_VALUES.index(_txallow.range560_570) + else: + idx = TXALLOW_VALUES.index(0xFF) + rs = RadioSettingValueList(TXALLOW_CHOICES, TXALLOW_CHOICES[idx]) + rset = RadioSetting("txallow.range560_570", "560-570 MHz", rs) + rset.set_apply_callback(apply_txallow_listvalue, _txallow.range560_570) + txallow.append(rset) + + if _txallow.range570_580 in TXALLOW_VALUES: + idx = TXALLOW_VALUES.index(_txallow.range570_580) + else: + idx = TXALLOW_VALUES.index(0xFF) + rs = RadioSettingValueList(TXALLOW_CHOICES, TXALLOW_CHOICES[idx]) + rset = RadioSetting("txallow.range570_580", "570-580 MHz", rs) + rset.set_apply_callback(apply_txallow_listvalue, _txallow.range570_580) + txallow.append(rset) + + if _txallow.range580_590 in TXALLOW_VALUES: + idx = TXALLOW_VALUES.index(_txallow.range580_590) + else: + idx = TXALLOW_VALUES.index(0xFF) + rs = RadioSettingValueList(TXALLOW_CHOICES, TXALLOW_CHOICES[idx]) + rset = RadioSetting("txallow.range580_590", "580-590 MHz", rs) + rset.set_apply_callback(apply_txallow_listvalue, _txallow.range580_590) + txallow.append(rset) + + if _txallow.range590_600 in TXALLOW_VALUES: + idx = TXALLOW_VALUES.index(_txallow.range590_600) + else: + idx = TXALLOW_VALUES.index(0xFF) + rs = RadioSettingValueList(TXALLOW_CHOICES, TXALLOW_CHOICES[idx]) + rset = RadioSetting("txallow.range590_600", "590-600 MHz", rs) + rset.set_apply_callback(apply_txallow_listvalue, _txallow.range590_600) + txallow.append(rset) + + if _txallow.range600_610 in TXALLOW_VALUES: + idx = TXALLOW_VALUES.index(_txallow.range600_610) + else: + idx = TXALLOW_VALUES.index(0xFF) + rs = RadioSettingValueList(TXALLOW_CHOICES, TXALLOW_CHOICES[idx]) + rset = RadioSetting("txallow.range600_610", "600-610 MHz", rs) + rset.set_apply_callback(apply_txallow_listvalue, _txallow.range600_610) + txallow.append(rset) + + if _txallow.range610_620 in TXALLOW_VALUES: + idx = TXALLOW_VALUES.index(_txallow.range610_620) + else: + idx = TXALLOW_VALUES.index(0xFF) + rs = RadioSettingValueList(TXALLOW_CHOICES, TXALLOW_CHOICES[idx]) + rset = RadioSetting("txallow.range610_620", "610-620 MHz", rs) + rset.set_apply_callback(apply_txallow_listvalue, _txallow.range610_620) + txallow.append(rset) + + if _txallow.range620_630 in TXALLOW_VALUES: + idx = TXALLOW_VALUES.index(_txallow.range620_630) + else: + idx = TXALLOW_VALUES.index(0xFF) + rs = RadioSettingValueList(TXALLOW_CHOICES, TXALLOW_CHOICES[idx]) + rset = RadioSetting("txallow.range620_630", "620-630 MHz", rs) + rset.set_apply_callback(apply_txallow_listvalue, _txallow.range620_630) + txallow.append(rset) + + if _txallow.range630_640 in TXALLOW_VALUES: + idx = TXALLOW_VALUES.index(_txallow.range630_640) + else: + idx = TXALLOW_VALUES.index(0xFF) + rs = RadioSettingValueList(TXALLOW_CHOICES, TXALLOW_CHOICES[idx]) + rset = RadioSetting("txallow.range630_640", "630-640 MHz", rs) + rset.set_apply_callback(apply_txallow_listvalue, _txallow.range630_640) + txallow.append(rset) + + if _txallow.range640_650 in TXALLOW_VALUES: + idx = TXALLOW_VALUES.index(_txallow.range640_650) + else: + idx = TXALLOW_VALUES.index(0xFF) + rs = RadioSettingValueList(TXALLOW_CHOICES, TXALLOW_CHOICES[idx]) + rset = RadioSetting("txallow.range640_650", "640-650 MHz", rs) + rset.set_apply_callback(apply_txallow_listvalue, _txallow.range640_650) + txallow.append(rset) + + if _txallow.range650_660 in TXALLOW_VALUES: + idx = TXALLOW_VALUES.index(_txallow.range650_660) + else: + idx = TXALLOW_VALUES.index(0xFF) + rs = RadioSettingValueList(TXALLOW_CHOICES, TXALLOW_CHOICES[idx]) + rset = RadioSetting("txallow.range650_660", "650-660 MHz", rs) + rset.set_apply_callback(apply_txallow_listvalue, _txallow.range650_660) + txallow.append(rset) + + return top + + def set_settings(self, settings): + for element in settings: + if not isinstance(element, RadioSetting): + self.set_settings(element) + continue + else: + try: + if "." in element.get_name(): + bits = element.get_name().split(".") + obj = self._memobj + for bit in bits[:-1]: + obj = getattr(obj, bit) + setting = bits[-1] + else: + obj = self._memobj.settings + setting = element.get_name() + + if element.has_apply_callback(): + LOG.debug("Using apply callback") + element.run_apply_callback() + elif setting == "dsrangea": + setattr(obj, setting, int(element.value) - 1) + elif setting == "dsrangeb": + setattr(obj, setting, int(element.value) - 1) + elif element.value.get_mutable(): + LOG.debug("Setting %s = %s" % (setting, element.value)) + setattr(obj, setting, element.value) + except Exception: + LOG.debug(element.get_name()) + raise + + @classmethod + def match_model(cls, filedata, filename): + # This radio has always been post-metadata, so never do + # old-school detection + return False + + +@directory.register +class AbbreeAR518Radio(IradioUV5118): + """ABBREE AR518""" + VENDOR = "Abbree" + MODEL = "AR-518" diff --git a/chirp/drivers/iradio_uv_5118plus.py b/chirp/drivers/iradio_uv_5118plus.py new file mode 100644 index 0000000..fcd61e2 --- /dev/null +++ b/chirp/drivers/iradio_uv_5118plus.py @@ -0,0 +1,1071 @@ +# Copyright 2023 Jim Unroe +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +import struct +import logging + +from chirp import chirp_common, directory, memmap +from chirp import bitwise, errors, util +from chirp.settings import RadioSetting, RadioSettingGroup, \ + RadioSettingValueInteger, RadioSettingValueList, \ + RadioSettingValueBoolean, RadioSettingValueString, \ + RadioSettingValueFloat, RadioSettings + +LOG = logging.getLogger(__name__) + +MEM_FORMAT = """ +struct memory { + ul32 rxfreq; // RX Frequency 00-03 + ul16 rx_tone; // PL/DPL Decode 04-05 + ul32 txfreq; // TX Frequency 06-09 + ul16 tx_tone; // PL/DPL Encode 0a-0b + ul24 mutecode; // Mute Code 0c-0e + u8 unknown_0:2, // 0f + mutetype:2, // Mute Type + unknown_1:4; // + u8 isnarrow:1, // Bandwidth 00 + lowpower:1, // Power + scan:1, // Scan Add + bcl:2, // Busy Lock + is_airband:1, // Air Band (AM) + unknown_3:1, // + unknown_4:1; // + u8 unknown_5; // 01 + u8 unused_0:4, // 02 + scno:4; // SC No. + u8 unknown_6[3]; // 03-05 + char name[10]; // 06-0f +}; + +#seekto 0x1000; +struct memory channels[999]; + +#seekto 0x0000; +struct { + char startuplabel[32]; // Startup Label 0000-001f + char personalid[16]; // Personal ID 0020-002f + u8 displaylogo:1, // Display Startup Logo 0030 + displayvoltage:1, // Display Voltage + displaylabel:1, // Display Startup Label + tailtone:1, // Tail Tone + startupringtone:1, // Startup Ringtone + voiceprompt:1, // Voice Prompt + keybeep:1, // Key Beep + unknown_0:1; + u8 txpriority:1, // TX Priority 0031 + rogerbeep:2, // Roger Beep + savemode:1, // Save Mode + frequencystep:4; // Frequency Step + u8 squelch:4, // Squelch 0032 + talkaround:2, // Talkaround + noaaalarm:1, // NOAA Alarm + dualdisplay:1; // Dual Display + u8 displaytimer; // Display Timer 0033 + u8 locktimer; // Lock Timer 0034 + u8 timeouttimer; // Timeout Timer 0035 + u8 voxlevel:4, // VOX Level 0036 + voxdelay:4; // Delay + ul16 tonefrequency; // Tone Frequency 0037-0038 + ul16 fmfrequency; // FM Frequency 0039-003a + u8 fmstandby:1, // FM Standby 003b + dualstandby:1, // Dual Standby + standbyarea:1, // Standby Area + scandirection:1, // Scan Direction + unknown_2:2, + workmode:1, // Work Mode + unknown_3:1; + ul16 areaach; // Area A CH 003c-003d + ul16 areabch; // Area B CH 003e-003f + u8 unused_0:4, // 0040 + key1long:4; // Key 1 Long + u8 unused_1:4, // 0041 + key1short:4; // Key 1 Short + u8 unused_2:4, // 0042 + key2long:4; // Key 2 Long + u8 unused_3:4, // 0043 + key2short:4; // Key 2 Short + u8 unknown_4:4, // 0044 + vox:1, // VOX + unknown_5:3; + u8 xposition; // X position (0-159) 0045 + u8 yposition; // Y position (0-110) 0046 + ul16 bordercolor; // Border Color 0047-0048 + u8 unknown_6[9]; // 0x00 0049-0051 + u8 unknown_7[2]; // 0xFF 0052-0053 + u8 range174_240; // 174-240 MHz 0054 + u8 range240_320; // 240-320 MHz 0055 + u8 range320_400; // 320-400 MHz 0056 + u8 range480_560; // 480-560 MHz 0057 + u8 unused_4[7]; // 0xFF 0058-005e + u8 unknown_8; // 0x00 005f + u8 unused_5[12]; // 0xFF 0060-006b + u8 unknown_9[4]; // 0x00 006c-006f + ul16 quickch2; // Quick CH 2 0070-0071 + ul16 quickch1; // Quick CH 1 0072-0073 + ul16 quickch4; // Quick CH 4 0074-0075 + ul16 quickch3; // Quick CH 3 0076-0077 +} settings; + +#seekto 0x8D20; +struct { + u8 senddelay; // Send Delay 8d20 + u8 sendinterval; // Send Interval 8d21 + u8 unused_0:6, // 8d22 + sendmode:2; // Send Mode + u8 unused_2:4, // 8d23 + sendselect:4; // Send Select + u8 unused_3:7, // 8d24 + recvdisplay:1; // Recv Display + u8 encodegain; // Encode Gain 8d25 + u8 decodeth; // Decode TH 8d26 +} dtmf; + +#seekto 0x8D30; +struct { + char code[14]; // DTMF code + u8 unused_ff; + u8 code_len; // DTMF code length +} dtmfcode[16]; + +#seekto 0x8E30; +struct { + char kill[14]; // Remotely Kill 8e30-8e3d + u8 unknown_0; // 8e3e + u8 kill_len; // Remotely Kill Length 83ef + char stun[14]; // Remotely Stun 8e40-834d + u8 unknown_1; // 8e4e + u8 stun_len; // Remotely Stun Length 8e4f + char wakeup[14]; // Wake Up 8e50-8e5d + u8 unknown_2; // 8e5e + u8 wakeup_len; // Wake Up Length 8e5f +} dtmf2; + +""" + +CMD_ACK = b"\x06" + +DTCS_CODES = tuple(sorted(chirp_common.DTCS_CODES + (645,))) + +_STEP_LIST = [0.25, 1.25, 2.5, 5., 6.25, 10., 12.5, 25., 50., 100., 500., + 1000., 5000.] + +LIST_AB = ["A", "B"] +LIST_BCL = ["Off", "Carrier", "CTC/DCS"] +LIST_DELAY = ["%s ms" % x for x in range(0, 2100, 100)] +LIST_DIRECTION = ["Up", "Down"] +LIST_FREQSTEP = ["0.25K", "1.25K", "2.5K", "5K", "6.25K", "10K", "12.5K", + "20K", "25K", "50K", "100K", "500K", "1M", "5M"] +LIST_INTERVAL = ["%s ms" % x for x in range(30, 210, 10)] +LIST_MUTETYPE = ["Off", "-", "23b", "24b"] +LIST_ROGER = ["Off", "Roger 1", "Roger 2", "Send ID"] +LIST_SENDM = ["Off", "TX Start", "TX End", "Start and End"] +LIST_SENDS = ["DTMF %s" % x for x in range(1, 17)] +LIST_SKEY = ["None", "Monitor", "Frequency Detect", "Talkaround", + "Quick CH", "Local Alarm", "Remote Alarm", "Weather CH", + "Send Tone", "Roger Beep"] +LIST_REPEATER = ["Off", "Talkaround", "Frequency Reversal"] +LIST_TIMER = ["Off", "5 seconds", "10 seconds"] + [ + "%s seconds" % x for x in range(15, 615, 15)] +LIST_TXPRI = ["Edit", "Busy"] +LIST_WORKMODE = ["Frequency", "Channel"] + +TXALLOW_CHOICES = ["RX Only", "TX/RX"] +TXALLOW_VALUES = [0xFF, 0x00] + +VALID_CHARS = chirp_common.CHARSET_ALPHANUMERIC + \ + "`{|}!\"#$%&'()*+,-./:;<=>?@[]^_" +DTMF_CHARS = list("0123456789ABCD*#") + + +def _checksum(data): + cs = 0 + for byte in data: + cs += byte + return cs % 256 + + +def _enter_programming_mode(radio): + serial = radio.pipe + + exito = False + for i in range(0, 5): + serial.write(radio.magic) + ack = serial.read(1) + + try: + if ack == CMD_ACK: + exito = True + break + except Exception: + LOG.debug("Attempt #%s, failed, trying again" % i) + pass + + # check if we had EXITO + if exito is False: + msg = "The radio did not accept program mode after five tries.\n" + msg += "Check you interface cable and power cycle your radio." + raise errors.RadioError(msg) + + +def _exit_programming_mode(radio): + serial = radio.pipe + try: + serial.write(b"58" + b"\x05\xEE\x60") + except Exception: + raise errors.RadioError("Radio refused to exit programming mode") + + +def _read_block(radio, block_addr, block_size): + serial = radio.pipe + + cmd = struct.pack(">BH", ord(b'R'), block_addr + radio.READ_OFFSET) + + ccs = bytes([_checksum(cmd)]) + + expectedresponse = b"R" + cmd[1:] + + cmd = cmd + ccs + + LOG.debug("Reading block %04x..." % block_addr) + + try: + serial.write(cmd) + response = serial.read(3 + block_size + 1) + + cs = _checksum(response[:-1]) + + if response[:3] != expectedresponse: + raise Exception("Error reading block %04x." % block_addr) + + chunk = response[3:] + + if chunk[-1] != cs: + raise Exception("Block failed checksum!") + + block_data = chunk[:-1] + except Exception: + raise errors.RadioError("Failed to read block at %04x" % block_addr) + + return block_data + + +def _write_block(radio, block_addr, block_size): + serial = radio.pipe + + # map the upload address to the mmap start and end addresses + start_addr = block_addr * block_size + end_addr = start_addr + block_size + + data = radio.get_mmap()[start_addr:end_addr] + + cmd = struct.pack(">BH", ord(b'I'), block_addr) + + cs = bytes([_checksum(cmd + data)]) + data += cs + + LOG.debug("Writing Data:") + LOG.debug(util.hexprint(cmd + data)) + + try: + serial.write(cmd + data) + if serial.read(1) != CMD_ACK: + raise Exception("No ACK") + except Exception: + raise errors.RadioError("Failed to send block " + "to radio at %04x" % block_addr) + + +def do_download(radio): + LOG.debug("download") + _enter_programming_mode(radio) + + data = b"" + + status = chirp_common.Status() + status.msg = "Cloning from radio" + + status.cur = 0 + status.max = radio.END_ADDR + + for addr in range(radio.START_ADDR, radio.END_ADDR, 1): + status.cur = addr + radio.status_fn(status) + + block = _read_block(radio, addr, radio.BLOCK_SIZE) + data += block + + LOG.debug("Address: %04x" % addr) + LOG.debug(util.hexprint(block)) + + _exit_programming_mode(radio) + + return memmap.MemoryMapBytes(data) + + +def do_upload(radio): + status = chirp_common.Status() + status.msg = "Uploading to radio" + + _enter_programming_mode(radio) + + status.cur = 0 + status.max = radio._memsize + + # The OEM software reads the 1st block from the radio before commencing + # with the upload. That behavior will be mirrored here. + _read_block(radio, radio.START_ADDR, radio.BLOCK_SIZE) + + for start_addr, end_addr in radio._ranges: + for addr in range(start_addr, end_addr, 1): + status.cur = addr * radio.BLOCK_SIZE + radio.status_fn(status) + _write_block(radio, addr, radio.BLOCK_SIZE) + + _exit_programming_mode(radio) + + +def _split(rf, f1, f2): + """Returns False if the two freqs are in the same band (no split) + or True otherwise""" + + # determine if the two freqs are in the same band + for low, high in rf.valid_bands: + if f1 >= low and f1 <= high and \ + f2 >= low and f2 <= high: + # if the two freqs are on the same Band this is not a split + return False + + # if you get here is because the freq pairs are split + return True + + +class IradioUV5118plus(chirp_common.CloneModeRadio): + """IRADIO UV5118plus""" + VENDOR = "Iradio" + MODEL = "UV-5118plus" + NAME_LENGTH = 10 + BAUD_RATE = 115200 + NEEDS_COMPAT_SERIAL = False + + BLOCK_SIZE = 0x80 + magic = b"58" + b"\x05\x10\x82" + + VALID_BANDS = [(108000000, 136000000), # RX only (Air Band) + (136000000, 174000000), # TX/RX (VHF) + (174000000, 240000000), # TX/RX + (240000000, 320000000), # TX/RX + (320000000, 400000000), # TX/RX + (400000000, 480000000), # TX/RX (UHF) + (480000000, 560000000)] # TX/RX + + POWER_LEVELS = [chirp_common.PowerLevel("High", watts=2.00), + chirp_common.PowerLevel("Low", watts=0.50)] + + # Radio's write address starts at 0x0000 + # Radio's write address ends at 0x0140 + START_ADDR = 0 + END_ADDR = 0x0140 + # Radio's read address starts at 0x7820 + # Radio's read address ends at 0x795F + READ_OFFSET = 0x7820 + + _ranges = [ + (0x0000, 0x0140), + ] + _memsize = 0xA000 # 0x0140 * 0x80 + + _upper = 999 + + def get_features(self): + rf = chirp_common.RadioFeatures() + rf.has_settings = True + rf.has_bank = False + rf.has_ctone = True + rf.has_cross = True + rf.has_rx_dtcs = True + rf.has_tuning_step = False + rf.can_odd_split = True + rf.has_name = True + rf.valid_name_length = self.NAME_LENGTH + rf.valid_characters = chirp_common.CHARSET_ASCII + rf.valid_skips = ["", "S"] + rf.valid_tmodes = ["", "Tone", "TSQL", "DTCS", "Cross"] + rf.valid_cross_modes = ["Tone->Tone", "Tone->DTCS", "DTCS->Tone", + "->Tone", "->DTCS", "DTCS->", "DTCS->DTCS"] + rf.valid_power_levels = self.POWER_LEVELS + rf.valid_duplexes = ["", "-", "+", "split"] + rf.valid_modes = ["FM", "NFM"] # 25 kHz, 12.5 kHz. + rf.valid_dtcs_codes = DTCS_CODES + rf.memory_bounds = (1, self._upper) + rf.valid_tuning_steps = _STEP_LIST + rf.valid_bands = self.VALID_BANDS + + return rf + + def process_mmap(self): + self._memobj = bitwise.parse(MEM_FORMAT, self._mmap) + + def sync_in(self): + """Download from radio""" + try: + data = do_download(self) + except errors.RadioError: + # Pass through any real errors we raise + raise + except Exception: + # If anything unexpected happens, make sure we raise + # a RadioError and log the problem + LOG.exception('Unexpected error during download') + raise errors.RadioError('Unexpected error communicating ' + 'with the radio') + self._mmap = data + self.process_mmap() + + def sync_out(self): + """Upload to radio""" + try: + do_upload(self) + except Exception: + # If anything unexpected happens, make sure we raise + # a RadioError and log the problem + LOG.exception('Unexpected error during upload') + raise errors.RadioError('Unexpected error communicating ' + 'with the radio') + + def get_raw_memory(self, number): + return repr(self._memobj.memory[number - 1]) + + @staticmethod + def _decode_tone(toneval): + # DCS examples: + # D023N - 1013 - 0001 0000 0001 0011 + # ^-DCS + # D023I - 2013 - 0010 0000 0001 0100 + # ^--DCS inverted + # D754I - 21EC - 0010 0001 1110 1100 + # code in octal-------^^^^^^^^^^^ + + if toneval == 0x3000: + return '', None, None + elif toneval & 0x1000: + # DTCS N + code = int('%o' % (toneval & 0x1FF)) + return 'DTCS', code, 'N' + elif toneval & 0x2000: + # DTCS R + code = int('%o' % (toneval & 0x1FF)) + return 'DTCS', code, 'R' + else: + return 'Tone', toneval / 10.0, None + + @staticmethod + def _encode_tone(mode, val, pol): + if not mode: + return 0x3000 + elif mode == 'Tone': + return int(val * 10) + elif mode == 'DTCS': + code = int('%i' % val, 8) + if pol == 'N': + code |= 0x1800 + if pol == 'R': + code |= 0x2800 + return code + else: + raise errors.RadioError('Unsupported tone mode %r' % mode) + + def get_memory(self, number): + mem = chirp_common.Memory() + _mem = self._memobj.channels[number - 1] + mem.number = number + + mem.freq = int(_mem.rxfreq) * 10 + + # We'll consider any blank (i.e. 0 MHz frequency) to be empty + if mem.freq == 0: + mem.empty = True + return mem + + if _mem.rxfreq.get_raw() == "\xFF\xFF\xFF\xFF": + mem.freq = 0 + mem.empty = True + return mem + + # Freq and offset + mem.freq = int(_mem.rxfreq) * 10 + # TX freq set + offset = (int(_mem.txfreq) * 10) - mem.freq + if offset != 0: + if _split(self.get_features(), mem.freq, int( + _mem.txfreq) * 10): + mem.duplex = "split" + mem.offset = int(_mem.txfreq) * 10 + elif offset < 0: + mem.offset = abs(offset) + mem.duplex = "-" + elif offset > 0: + mem.offset = offset + mem.duplex = "+" + else: + mem.offset = 0 + + mem.name = str(_mem.name).rstrip(" ").replace("\xFF", " ") + + mem.mode = _mem.isnarrow and "NFM" or "FM" + + if mem.freq < 136000000: + _mem.is_airband = True + else: + _mem.is_airband = False + + chirp_common.split_tone_decode(mem, + self._decode_tone(_mem.tx_tone), + self._decode_tone(_mem.rx_tone)) + + mem.power = self.POWER_LEVELS[_mem.lowpower] + + if not _mem.scan: + mem.skip = "S" + + mem.extra = RadioSettingGroup("Extra", "extra") + + rs = RadioSettingValueList(LIST_BCL, LIST_BCL[_mem.bcl]) + rset = RadioSetting("bcl", "Busy Channel Lockout", rs) + mem.extra.append(rset) + + rs = RadioSettingValueList(LIST_MUTETYPE, LIST_MUTETYPE[_mem.mutetype]) + rset = RadioSetting("mutetype", "Mute Type", rs) + mem.extra.append(rset) + + rs = RadioSettingValueInteger(0, 16777215, _mem.mutecode) + rset = RadioSetting("mutecode", "Mute Code (0-16777215)", rs) + mem.extra.append(rset) + + rs = RadioSettingValueInteger(0, 8, _mem.scno) + rset = RadioSetting("scno", "SC No. (0-8)", rs) + mem.extra.append(rset) + + return mem + + def set_memory(self, mem): + LOG.debug("Setting %i(%s)" % (mem.number, mem.extd_number)) + _mem = self._memobj.channels[mem.number - 1] + + # if empty memory + if mem.empty: + _mem.set_raw("\xFF" * 22 + "\x20" * 10) + return + + _mem.set_raw("\xFF" * 4 + "\x00\x30" + "\xFF" * 4 + "\x00\x30" + + "\x00" * 10 + "\x20" * 10) + + _mem.rxfreq = mem.freq / 10 + + if mem.duplex == "split": + _mem.txfreq = mem.offset / 10 + elif mem.duplex == "+": + _mem.txfreq = (mem.freq + mem.offset) / 10 + elif mem.duplex == "-": + _mem.txfreq = (mem.freq - mem.offset) / 10 + else: + _mem.txfreq = mem.freq / 10 + + _mem.name = mem.name.rstrip('\xFF').ljust(10, '\x20') + + _mem.scan = mem.skip != "S" + _mem.isnarrow = mem.mode == "NFM" + + # dtcs_pol = ["N", "N"] + + txtone, rxtone = chirp_common.split_tone_encode(mem) + _mem.tx_tone = self._encode_tone(*txtone) + _mem.rx_tone = self._encode_tone(*rxtone) + + _mem.lowpower = mem.power == self.POWER_LEVELS[1] + + for setting in mem.extra: + setattr(_mem, setting.get_name(), setting.value) + + def get_settings(self): + _dtmf = self._memobj.dtmf + _dtmf2 = self._memobj.dtmf2 + _settings = self._memobj.settings + basic = RadioSettingGroup("basic", "Basic Settings") + dtmf = RadioSettingGroup("dtmf", "DTMF Settings") + startup = RadioSettingGroup("startup", "Startup Settings") + txallow = RadioSettingGroup("txallow", "TX Allow Settings") + top = RadioSettings(basic, dtmf, startup, txallow) + + # Basic Settings + + # Menu 21 - Personal ID + _codeobj = _settings.personalid + _code = str(_codeobj).rstrip('\x20') + rs = RadioSettingValueString(0, 16, _code, True) + rset = RadioSetting("personalid", "Personal ID", rs) + basic.append(rset) + + rs = RadioSettingValueList(LIST_WORKMODE, + LIST_WORKMODE[_settings.workmode]) + rset = RadioSetting("workmode", "Work Mode", rs) + basic.append(rset) + + # Menu 05 - Voice Prompt + rs = RadioSettingValueBoolean(_settings.voiceprompt) + rset = RadioSetting("voiceprompt", "Voice Prompt", rs) + basic.append(rset) + + # Menu 06 - Key Beep + rs = RadioSettingValueBoolean(_settings.keybeep) + rset = RadioSetting("keybeep", "Key Beep", rs) + basic.append(rset) + + # Menu 07 - Roger Beep + rs = RadioSettingValueList(LIST_ROGER, + LIST_ROGER[_settings.rogerbeep]) + rset = RadioSetting("rogerbeep", "Roger Beep", rs) + basic.append(rset) + + # Menu 09 - TX Priority + rs = RadioSettingValueList(LIST_TXPRI, + LIST_TXPRI[_settings.txpriority]) + rset = RadioSetting("txpriority", "TX Priority", rs) + basic.append(rset) + + # Menu 10 - Save Mode + rs = RadioSettingValueBoolean(_settings.savemode) + rset = RadioSetting("savemode", "Save Mode", rs) + basic.append(rset) + + # Menu 11 - Freq Step + val = min(_settings.frequencystep, 0x0D) + rs = RadioSettingValueList(LIST_FREQSTEP, LIST_FREQSTEP[val]) + rset = RadioSetting("frequencystep", "Frequency Step", rs) + basic.append(rset) + + # Menu 12 - SQ Level + val = min(_settings.squelch, 0x09) + rs = RadioSettingValueInteger(0, 9, val) + rset = RadioSetting("squelch", "Squelch Level (0-9)", rs) + basic.append(rset) + + # Menu 13 - LED Timer + val = min(_settings.displaytimer, 0x2A) + rs = RadioSettingValueList(LIST_TIMER, LIST_TIMER[val]) + rset = RadioSetting("displaytimer", "Display Timer", rs) + basic.append(rset) + + # Menu 14 - Lcok Timer + val = min(_settings.locktimer, 0x2A) + rs = RadioSettingValueList(LIST_TIMER, LIST_TIMER[val]) + rset = RadioSetting("locktimer", "Lock Timer", rs) + basic.append(rset) + + # Menu 15 - TOT + val = min(_settings.timeouttimer, 0x2A) + rs = RadioSettingValueList(LIST_TIMER, LIST_TIMER[val]) + rset = RadioSetting("timeouttimer", "Timeout Timer", rs) + basic.append(rset) + + rs = RadioSettingValueBoolean(_settings.vox) + rset = RadioSetting("vox", "VOX", rs) + basic.append(rset) + + # Menu 16 - VOX Level + val = min(_settings.voxlevel, 0x09) + rs = RadioSettingValueInteger(0, 9, val) + rset = RadioSetting("voxlevel", "VOX Level (0-9)", rs) + basic.append(rset) + + # Menu 17 - VOX Delay + val = min(_settings.voxdelay, 0x09) + rs = RadioSettingValueInteger(0, 9, val) + rset = RadioSetting("voxdelay", "VOX Delay (0-9)", rs) + basic.append(rset) + + # Menu 18 - NOAA Monitor + rs = RadioSettingValueBoolean(_settings.noaaalarm) + rset = RadioSetting("noaaalarm", "NOAA Alarm", rs) + basic.append(rset) + + # Menu 19 - FM Standby + rs = RadioSettingValueBoolean(_settings.fmstandby) + rset = RadioSetting("fmstandby", "FM Standby", rs) + basic.append(rset) + + def myset_freq(setting, obj, atrb, mult): + """ Callback to set frequency by applying multiplier""" + value = int(float(str(setting.value)) * mult) + setattr(obj, atrb, value) + return + + # FM Broadcast Settings + val = _settings.fmfrequency + val = val / 10.0 + if val < 64.0 or val > 108.0: + val = 90.4 + rx = RadioSettingValueFloat(64.0, 108.0, val, 0.1, 1) + rset = RadioSetting("fmfrequency", "Broadcast FM Freq (MHz)", rx) + rset.set_apply_callback(myset_freq, _settings, "fmfrequency", 10) + basic.append(rset) + + # Menu 20 - Tail Tone + rs = RadioSettingValueBoolean(_settings.tailtone) + rset = RadioSetting("tailtone", "Tail Tone", rs) + basic.append(rset) + + # Menu 21 - Scan DIR + rs = RadioSettingValueList(LIST_DIRECTION, + LIST_DIRECTION[_settings.scandirection]) + rset = RadioSetting("scandirection", "Scan Direction", rs) + basic.append(rset) + + # Menu 08 - Dual Display + rs = RadioSettingValueBoolean(_settings.dualdisplay) + rset = RadioSetting("dualdisplay", "Dual Display", rs) + basic.append(rset) + + # Menu 23 - Repeater Mode + val = min(_settings.talkaround, 0x02) + rs = RadioSettingValueList(LIST_REPEATER, LIST_REPEATER[val]) + rset = RadioSetting("talkaround", "Talkaround", rs) + basic.append(rset) + + # Menu 37 - K1 Short + val = min(_settings.key1short, 0x09) + rs = RadioSettingValueList(LIST_SKEY, LIST_SKEY[val]) + rset = RadioSetting("key1short", "Key 1 Short", rs) + basic.append(rset) + + # Menu 36 - K1 Long + val = min(_settings.key1long, 0x09) + rs = RadioSettingValueList(LIST_SKEY, LIST_SKEY[val]) + rset = RadioSetting("key1long", "Key 1 Long", rs) + basic.append(rset) + + # Menu 39 - K2 Short + val = min(_settings.key2short, 0x09) + rs = RadioSettingValueList(LIST_SKEY, LIST_SKEY[val]) + rset = RadioSetting("key2short", "Key 2 Short", rs) + basic.append(rset) + + # Menu 38 - K2 Long + val = min(_settings.key2long, 0x09) + rs = RadioSettingValueList(LIST_SKEY, LIST_SKEY[val]) + rset = RadioSetting("key2long", "Key 2 Long", rs) + basic.append(rset) + + rs = RadioSettingValueInteger(0, 20000, _settings.tonefrequency) + rset = RadioSetting("tonefrequency", "Tone Frequency (0-2000)", rs) + basic.append(rset) + + rs = RadioSettingValueBoolean(_settings.dualstandby) + rset = RadioSetting("dualstandby", "Dual Standby", rs) + basic.append(rset) + + rs = RadioSettingValueList(LIST_AB, + LIST_AB[_settings.standbyarea]) + rset = RadioSetting("standbyarea", "Standby Area", rs) + basic.append(rset) + + rs = RadioSettingValueInteger(1, 999, _settings.areaach + 1) + rset = RadioSetting("areaach", "Area A CH (1-999)", rs) + basic.append(rset) + + rs = RadioSettingValueInteger(1, 999, _settings.areabch + 1) + rset = RadioSetting("areabch", "Area B CH (1-999)", rs) + basic.append(rset) + + rs = RadioSettingValueInteger(1, 999, _settings.quickch1 + 1) + rset = RadioSetting("quickch1", "Quick CH 1 (1-999)", rs) + basic.append(rset) + + rs = RadioSettingValueInteger(1, 999, _settings.quickch2 + 1) + rset = RadioSetting("quickch2", "Quick CH 2 (1-999)", rs) + basic.append(rset) + + rs = RadioSettingValueInteger(1, 999, _settings.quickch3 + 1) + rset = RadioSetting("quickch3", "Quick CH 3 (1-999)", rs) + basic.append(rset) + + rs = RadioSettingValueInteger(1, 999, _settings.quickch4 + 1) + rset = RadioSetting("quickch4", "Quick CH 4 (1-999)", rs) + basic.append(rset) + + rs = RadioSettingValueInteger(0, 65535, _settings.bordercolor) + rset = RadioSetting("bordercolor", "Border Color (0-65535)", rs) + basic.append(rset) + + # DTMF Settings + + # Menu 40 - DTMF Delay + val = min(_dtmf.senddelay, 0x14) + rs = RadioSettingValueList(LIST_DELAY, LIST_DELAY[val]) + rset = RadioSetting("dtmf.senddelay", "Send Delay", rs) + dtmf.append(rset) + + # Menu 41 - DTMF Interval + val = min(_dtmf.sendinterval, 0x11) + rs = RadioSettingValueList(LIST_INTERVAL, LIST_INTERVAL[val]) + rset = RadioSetting("dtmf.sendinterval", "Send Interval", rs) + dtmf.append(rset) + + # Menu 42 - DTMF Mode + rs = RadioSettingValueList(LIST_SENDM, + LIST_SENDM[_dtmf.sendmode]) + rset = RadioSetting("dtmf.sendmode", "Send Mode", rs) + dtmf.append(rset) + + # Menu 43 - DTMF Select + rs = RadioSettingValueList(LIST_SENDS, + LIST_SENDS[_dtmf.sendselect]) + rset = RadioSetting("dtmf.sendselect", "Send Select", rs) + dtmf.append(rset) + + # Menu 44 - DTMF Display + rs = RadioSettingValueBoolean(_dtmf.recvdisplay) + rset = RadioSetting("dtmf.recvdisplay", "Receive Display", rs) + dtmf.append(rset) + + val = min(_dtmf.encodegain, 0x7F) + rs = RadioSettingValueInteger(0, 127, val) + rset = RadioSetting("dtmf.encodegain", "Encode Gain (0-127)", rs) + dtmf.append(rset) + + val = min(_dtmf.decodeth, 0x3F) + rs = RadioSettingValueInteger(0, 63, val) + rset = RadioSetting("dtmf.decodeth", "Decode TH (0-63)", rs) + dtmf.append(rset) + + for i in range(0, 16): + _codeobj = self._memobj.dtmfcode[i].code + _code = str(_codeobj).rstrip('\xFF') + rs = RadioSettingValueString(0, 14, _code, False) + rs.set_charset(DTMF_CHARS) + rset = RadioSetting("dtmfcode/%i.code" % i, + "Code %i" % (i + 1), rs) + + def apply_code(setting, obj, length): + code = "" + for char in str(setting.value): + if char in DTMF_CHARS: + code += char + else: + code += "" + obj.code_len = len(str(code)) + obj.code = code.ljust(length, chr(255)) + rset.set_apply_callback(apply_code, self._memobj.dtmfcode[i], 14) + dtmf.append(rset) + + _codeobj = _dtmf2.kill + _code = str(_codeobj).rstrip('\xFF') + rs = RadioSettingValueString(0, 14, _code, False) + rs.set_charset(DTMF_CHARS) + rset = RadioSetting("dtmf2.kill", + "Remotely Kill", rs) + + def apply_code(setting, obj, length): + code = "" + for char in str(setting.value): + if char in DTMF_CHARS: + code += char + else: + code += "" + obj.kill_len = len(str(code)) + obj.kill = code.ljust(length, chr(255)) + rset.set_apply_callback(apply_code, _dtmf2, 14) + dtmf.append(rset) + + _codeobj = _dtmf2.stun + _code = str(_codeobj).rstrip('\xFF') + rs = RadioSettingValueString(0, 14, _code, False) + rs.set_charset(DTMF_CHARS) + rset = RadioSetting("dtmf2.stun", + "Remotely Stun", rs) + + def apply_code(setting, obj, length): + code = "" + for char in str(setting.value): + if char in DTMF_CHARS: + code += char + else: + code += "" + obj.stun_len = len(str(code)) + obj.stun = code.ljust(length, chr(255)) + rset.set_apply_callback(apply_code, _dtmf2, 14) + dtmf.append(rset) + + _codeobj = _dtmf2.wakeup + _code = str(_codeobj).rstrip('\xFF') + rs = RadioSettingValueString(0, 14, _code, False) + rs.set_charset(DTMF_CHARS) + rset = RadioSetting("dtmf2.wakeup", + "Wake Up", rs) + + def apply_code(setting, obj, length): + code = "" + for char in str(setting.value): + if char in DTMF_CHARS: + code += char + else: + code += "" + obj.wakeup_len = len(str(code)) + obj.wakeup = code.ljust(length, chr(255)) + rset.set_apply_callback(apply_code, _dtmf2, 14) + dtmf.append(rset) + + # Startup Settings + + _codeobj = _settings.startuplabel + _code = str(_codeobj).rstrip('\x20') + rs = RadioSettingValueString(0, 32, _code, True) + rset = RadioSetting("startuplabel", "Startup Label", rs) + startup.append(rset) + + # Menu 04 - Prompt Text + rs = RadioSettingValueBoolean(_settings.displaylabel) + rset = RadioSetting("displaylabel", "Display Startup Label", rs) + startup.append(rset) + + # Menu 02 - Voltage + rs = RadioSettingValueBoolean(_settings.displayvoltage) + rset = RadioSetting("displayvoltage", "Display Voltage", rs) + startup.append(rset) + + # Menu 01 - Startup Logo + rs = RadioSettingValueBoolean(_settings.displaylogo) + rset = RadioSetting("displaylogo", "Display Startup Logo", rs) + startup.append(rset) + + # Menu 03 - Ringtone + rs = RadioSettingValueBoolean(_settings.startupringtone) + rset = RadioSetting("startupringtone", "Startup Ringtone", rs) + startup.append(rset) + + val = min(_settings.xposition, 0x9F) + rs = RadioSettingValueInteger(0, 159, val) + rset = RadioSetting("xposition", "X Position (0-159)", rs) + startup.append(rset) + + val = min(_settings.yposition, 0x6E) + rs = RadioSettingValueInteger(16, 110, val) + rset = RadioSetting("yposition", "Y Position (16-110)", rs) + startup.append(rset) + + # TX Allow Settings + + def apply_txallow_listvalue(setting, obj): + LOG.debug("Setting value: " + str( + setting.value) + " from list") + val = str(setting.value) + index = TXALLOW_CHOICES.index(val) + val = TXALLOW_VALUES[index] + obj.set_value(val) + + if _settings.range174_240 in TXALLOW_VALUES: + idx = TXALLOW_VALUES.index(_settings.range174_240) + else: + idx = TXALLOW_VALUES.index(0xFF) + rs = RadioSettingValueList(TXALLOW_CHOICES, TXALLOW_CHOICES[idx]) + rset = RadioSetting("range174_240", "174-240 MHz", rs) + rset.set_apply_callback(apply_txallow_listvalue, + _settings.range174_240) + txallow.append(rset) + + if _settings.range240_320 in TXALLOW_VALUES: + idx = TXALLOW_VALUES.index(_settings.range240_320) + else: + idx = TXALLOW_VALUES.index(0xFF) + rs = RadioSettingValueList(TXALLOW_CHOICES, TXALLOW_CHOICES[idx]) + rset = RadioSetting("range240_320", "240-320 MHz", rs) + rset.set_apply_callback(apply_txallow_listvalue, + _settings.range240_320) + txallow.append(rset) + + if _settings.range320_400 in TXALLOW_VALUES: + idx = TXALLOW_VALUES.index(_settings.range320_400) + else: + idx = TXALLOW_VALUES.index(0xFF) + rs = RadioSettingValueList(TXALLOW_CHOICES, TXALLOW_CHOICES[idx]) + rset = RadioSetting("range320_400", "320-400 MHz", rs) + rset.set_apply_callback(apply_txallow_listvalue, + _settings.range320_400) + txallow.append(rset) + + if _settings.range480_560 in TXALLOW_VALUES: + idx = TXALLOW_VALUES.index(_settings.range480_560) + else: + idx = TXALLOW_VALUES.index(0xFF) + rs = RadioSettingValueList(TXALLOW_CHOICES, TXALLOW_CHOICES[idx]) + rset = RadioSetting("range480_560", "480-560 MHz", rs) + rset.set_apply_callback(apply_txallow_listvalue, + _settings.range480_560) + txallow.append(rset) + + return top + + def set_settings(self, settings): + for element in settings: + if not isinstance(element, RadioSetting): + self.set_settings(element) + continue + else: + try: + name = element.get_name() + if "." in name: + bits = name.split(".") + obj = self._memobj + for bit in bits[:-1]: + if "/" in bit: + bit, index = bit.split("/", 1) + index = int(index) + obj = getattr(obj, bit)[index] + else: + obj = getattr(obj, bit) + setting = bits[-1] + else: + obj = self._memobj.settings + setting = element.get_name() + + if element.has_apply_callback(): + LOG.debug("Using apply callback") + element.run_apply_callback() + elif setting in ["areaach", + "areabch", + "quickch1", + "quickch2", + "quickch3", + "quickch4" + ]: + setattr(obj, setting, int(element.value) - 1) + elif element.value.get_mutable(): + LOG.debug("Setting %s = %s" % (setting, element.value)) + setattr(obj, setting, element.value) + except Exception as e: + LOG.debug(element.get_name(), e) + raise + + @classmethod + def match_model(cls, filedata, filename): + # This radio has always been post-metadata, so never do + # old-school detection + return False + + +@directory.register +class RuyageUV58PlusRadio(IradioUV5118plus): + """Ruyage UV58Plus""" + VENDOR = "Ruyage" + MODEL = "UV58Plus" diff --git a/chirp/drivers/kenwood_d7.py b/chirp/drivers/kenwood_d7.py new file mode 100644 index 0000000..7ab8079 --- /dev/null +++ b/chirp/drivers/kenwood_d7.py @@ -0,0 +1,2331 @@ +# Copyright 2010 Dan Smith +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +import logging +import math +import os +import threading + +from chirp import chirp_common, directory, errors, util +from chirp.settings import RadioSetting, RadioSettingGroup, \ + RadioSettingValueInteger, RadioSettingValueBoolean, \ + RadioSettingValueString, RadioSettingValueList, RadioSettingValueMap, \ + RadioSettings, RadioSettingValueFloat + +LOG = logging.getLogger(__name__) + + +class KenwoodD7Position(RadioSettingGroup): + def __init__(self, name, shortname, radio, *args, **kwargs): + super().__init__(name, shortname, *args, **kwargs) + self._radio = radio + if ' ' in name: + index = name.split(" ", 1)[1] + else: + index = '' + rs = RadioSetting("latd%s" % index, "Latitude degrees", + RadioSettingValueInteger(0, 90, 0)) + self.append(rs) + rs = RadioSetting("latm%s" % index, "Latitude minutes", + RadioSettingValueFloat(0, 59.99, 0, + resolution=0.01, + precision=2)) + self.append(rs) + rs = RadioSetting("south%s" % index, "South", + RadioSettingValueBoolean(False)) + self.append(rs) + rs = RadioSetting("longd%s" % index, "Longitude degrees", + RadioSettingValueInteger(0, 180, 0)) + self.append(rs) + rs = RadioSetting("longm%s" % index, "Longitude minutes", + RadioSettingValueFloat(0, 59.99, 0, + resolution=0.01, precision=2)) + self.append(rs) + rs = RadioSetting("west%s" % index, "West", + RadioSettingValueBoolean(False)) + self.append(rs) + + def kenwood_d7_read_value(self): + index = self._get_index() + name = self.get_name() + rawval = self._radio._kenwood_get(name)[1] + curr_value = int(rawval[0:2]) + self["latd%s" % index].value.set_value(curr_value) + curr_value = int(rawval[2:6]) / 100 + self["latm%s" % index].value.set_value(curr_value) + curr_value = int(rawval[6:8]) + self["south%s" % index].value.set_value(curr_value) + curr_value = int(rawval[8:11]) + self["longd%s" % index].value.set_value(curr_value) + curr_value = int(rawval[11:15]) / 100 + self["longm%s" % index].value.set_value(curr_value) + curr_value = int(rawval[15:17]) + self["west%s" % index].value.set_value(curr_value) + self['latd%s' % index].value._has_changed = False + self['latm%s' % index].value._has_changed = False + self['south%s' % index].value._has_changed = False + self['longd%s' % index].value._has_changed = False + self['longm%s' % index].value._has_changed = False + self['west%s' % index].value._has_changed = False + + def _get_index(self): + name = self.get_name() + if ' ' in name: + return name.split(" ", 1)[1] + return '' + + def changed(self): + index = self._get_index() + if self['latd%s' % index].changed(): + return True + if self['latm%s' % index].changed(): + return True + if self['south%s' % index].changed(): + return True + if self['longd%s' % index].changed(): + return True + if self['longm%s' % index].changed(): + return True + if self['west%s' % index].changed(): + return True + return False + + def kenwood_d7_set_value(self): + index = self._get_index() + latd = self['latd%s' % index].value.get_value() + latm = self['latm%s' % index].value.get_value() + latmd = int(round(math.modf(latm)[0] * 100)) + latm = int(round(latm)) + south = int(self['south%s' % index].value.get_value()) + longd = self['longd%s' % index].value.get_value() + longm = self['longm%s' % index].value.get_value() + longmd = int(round(math.modf(longm)[0] * 100)) + longm = int(round(longm)) + west = int(self['west%s' % index].value.get_value()) + args = '%s%02d%02d%02d%02d%03d%02d%02d%02d' % (index, + latd, latm, latmd, + south, + longd, longm, longmd, + west) + if index != '': + index = ' ' + index + self._radio._kenwood_set('MP%s' % index, args) + # TODO: Hacking up _has_changed is bad... but we don't want + # to re-send all the set commands each time either. + self['latd%s' % index].value._has_changed = False + self['latm%s' % index].value._has_changed = False + self['south%s' % index].value._has_changed = False + self['longd%s' % index].value._has_changed = False + self['longm%s' % index].value._has_changed = False + self['west%s' % index].value._has_changed = False + + +class KenwoodD7DTMFMemory(RadioSettingGroup): + DTMF_CHARSET = "ABCD#*0123456789 " + + def __init__(self, name, shortname, radio, *args, **kwargs): + super().__init__(name, shortname, *args, **kwargs) + self._radio = radio + self._name = name + index = self._get_index() + rs = RadioSetting("DMN %s" % index, "Memory Name", + RadioSettingValueString(0, 8, '', False)) + self.append(rs) + rs = RadioSetting("DM %s" % index, "Memory Value", + RadioSettingValueString(0, 16, '', False, + self.DTMF_CHARSET)) + self.append(rs) + + def _get_index(self): + return "%02d" % int(self._name.split(" ", 1)[1]) + + def kenwood_d7_read_value(self): + index = self._get_index() + value = self._radio._kenwood_get("DM %s" % index)[1] + value = value.replace("E", "*").replace("F", "#") + vname = self._radio._kenwood_get("DMN %s" % index)[1] + self["DMN %s" % index].value.set_value(vname) + self["DMN %s" % index].value._has_changed = False + self["DM %s" % index].value.set_value(value) + self["DM %s" % index].value._has_changed = False + + def changed(self): + for element in self: + if element.changed(): + return True + return False + + def kenwood_d7_set_value(self): + for element in self: + if not element.changed(): + continue + newval = element.value.get_value() + newval = newval.replace("*", "E").replace("#", "F") + self._radio._kenwood_set(element.get_name(), + newval) + element.value._has_changed = False + + +class KenwoodD7ProgrammableVFOs(RadioSettingGroup): + def __init__(self, name, shortname, radio, *args, **kwargs): + self._radio = radio + super().__init__(name, shortname, *args, **kwargs) + for optname, index, minimum, maximum in self._radio._PROGRAMMABLE_VFOS: + group = RadioSettingGroup("PV %d" % index, optname) + self.append(group) + rs = RadioSetting("PV %dL" % index, "Lower Limit", + RadioSettingValueInteger(minimum, maximum, + minimum)) + group.append(rs) + rs = RadioSetting("PV %dU" % index, "Upper Limit", + RadioSettingValueInteger(minimum, maximum, + maximum)) + group.append(rs) + + def _get_index(self, element): + name = element.get_name() + return int(name.split(" ", 1)[1]) + + def kenwood_d7_read_value(self): + for element in self: + index = self._get_index(element) + rv = self._radio._kenwood_get("PV %d" % index)[1] + lower, upper = rv.split(',', 1) + lower = int(lower) + upper = int(upper) + pvdl = "PV %dL" % index + pvdu = "PV %dU" % index + element[pvdl].value.set_value(lower) + element[pvdl].value._has_changed = False + element[pvdu].value.set_value(upper) + element[pvdu].value._has_changed = False + + def changed(self): + for element in self: + for bound in element: + if bound.changed(): + return True + return False + + # TODO: Custom validator things... + + def kenwood_d7_set_value(self): + for element in self: + index = self._get_index(element) + pvdl = "PV %dL" % index + pvdu = "PV %dU" % index + if element[pvdl].changed() or element[pvdu].changed(): + lower = element[pvdl].value.get_value() + upper = element[pvdu].value.get_value() + args = "%05d,%05d" % (lower, upper) + self._radio._kenwood_set(element.get_name(), args) + element[pvdl].value._has_changed = False + element[pvdu].value._has_changed = False + + +class KenwoodD7Family(chirp_common.LiveRadio): + VENDOR = "Kenwood" + MODEL = "" + NEEDS_COMPAT_SERIAL = False + HARDWARE_FLOW = False + + _ARG_DELIMITER = " " + _BAUDS = [9600] + _CMD_DELIMITER = "\r" + _DISABLE_AI_CMD = ('AI', '0') + _DUPLEX = {0: "", 1: "+", 2: "-"} + _HAS_NAME = True + _LOCK = threading.Lock() + _MODES = {0: "FM", 1: "AM"} + _NOCACHE = "CHIRP_NOCACHE" in os.environ + _SPLIT = True + _STEPS = (5.0, 6.25, 10.0, 12.5, 15.0, 20.0, 25.0, 30.0, 50.0, 100.0) + _TONES = chirp_common.OLD_TONES + _LOWER = 0 + _UPPER = 199 + + _CALL_CHANS = ("VHF Call", "UHF Call") + _SPECIAL_CHANS = ("L0", "U0", + "L1", "U1", + "L2", "U2", + "L3", "U3", + "L4", "U4", + "L5", "U5", + "L6", "U6", + "L7", "U7", + "L8", "U8", + "L9", "U9", + *_CALL_CHANS) + + # These are used more than once in _COMMON_SETTINGS + _BOOL = {'type': 'bool'} + _DATA_BAND = {'type': 'list', + 'values': ("A", "B", "A:TX/B:RX", "A:RX/B:TX")} + _DTMF_MEMORY = {'type': KenwoodD7DTMFMemory} + _ON_OFF_DUAL_MAP = {'type': 'map', + 'map': (("Off", "0"), ("On", "1,0")), + 'set_requires': (('DL', True),), + 'get_requires': (('DL', True),)} + _POSITION = {'type': KenwoodD7Position} + _SSTV_CHARSET = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 !?-/" + _SSTV_COLOURS = {'type': 'list', + 'values': ("Black", "Blue", "Red", "Magenta", "Green", + "Cyan", "Yellow", "White")} + _STATUS_TEXT = {'type': 'string', 'max_len': 32} + _SQUELCH = {'type': 'list', 'digits': 2, + 'values': ("Open", "1", "2", "3", "4", "5")} + # Settings that are shared by at least two radios. + # If a third radio does not have the setting at all, the presence + # here won't matter. If it has it but with different parameters, + # it can be overridden in the subclass _SETTINGS dict. + _COMMON_SETTINGS = { + "AIP": _BOOL, + "ARL": {'type': 'map', + 'map': (('Off', '0000'),) + tuple( + [('%i' % x, '%04i' % x) + for x in range(10, 2510, 10)])}, + "ARLM": {'type': 'string', 'max_len': 45}, + "AMGG": {'type': 'string', 'max_len': 45, + 'charset': "ABCDEFGHIJKLMNOPQRSTUVWXYZ*,-0123456789"}, + "AMR": _BOOL, + "APO": {'type': 'list', + 'values': ("Off", "30min", "60min")}, + "ARO": _BOOL, + # ASC x requires that the specified VFO is enabled on TH-D7G + # (ie: dual is on or VFO is current) for both fetch and set + # Easiest to just enable DL before set/read + "ASC 0": _ON_OFF_DUAL_MAP, + "ASC 1": _ON_OFF_DUAL_MAP, + "BAL": {'type': 'list', + 'values': ("4:0", "3:1", "2:2", "1:3", "0:4")}, + "BC": {'type': 'list', + 'values': ("A", "B")}, + "BCN": _BOOL, + # BEL x requires that the specified VFO is enabled on TH-D7G + # (ie: dual is on or VFO is current) for both fetch and set + # Easiest to just enable DL before set/read + "BEL 0": _ON_OFF_DUAL_MAP, + "BEL 1": _ON_OFF_DUAL_MAP, + "BEP": {'type': 'list', + 'values': ("Off", "Key", "Key+Data", "All")}, + "BEPT": {'type': 'list', + 'values': ("Off", "Mine", "All New", "All")}, + "CH": _BOOL, + "CKEY": {'type': 'list', + 'values': ("Call", "1750 Hz")}, + "CNT": {'type': 'integer', 'min': 1, 'max': 16}, + "DL": _BOOL, + "DS": {'type': 'list', + 'values': ("Data Band", "Both Bands")}, + "DTB": _DATA_BAND, + "DTBA": _DATA_BAND, + "dtmfmem 00": _DTMF_MEMORY, + "dtmfmem 01": _DTMF_MEMORY, + "dtmfmem 02": _DTMF_MEMORY, + "dtmfmem 03": _DTMF_MEMORY, + "dtmfmem 04": _DTMF_MEMORY, + "dtmfmem 05": _DTMF_MEMORY, + "dtmfmem 06": _DTMF_MEMORY, + "dtmfmem 07": _DTMF_MEMORY, + "dtmfmem 08": _DTMF_MEMORY, + "dtmfmem 09": _DTMF_MEMORY, + "DTX": {'type': 'list', + 'values': ("Manual", "PTT", "Auto")}, + "ELK": {'type': 'bool'}, + "GU": {'type': 'list', + 'values': ("Not Used", "NMEA", "NMEA96")}, + # This isn't exactly shared, but each radio adds to this list + "ICO": {'type': 'map', + 'map': (('Kenwood', '0,0'), + ('Runner', '0,1'), + ('House ', '0,2'), + ('Tent', '0,3'), + ('Boat', '0,4'), + ('SSTV', '0,5'), + ('Plane', '0,6'), + ('Speedboat', '0,7'), + ('Car', '0,8'), + ('Bicycle', '0,9'), + ('TRIANGLE(DF station)', '0,A'), + ('Jeep', '0,B'), + ('Recreational Vehicle', '0,C'), + ('Truck ', '0,D'), + ('Van', '0,E'))}, + "KILO": {'type': 'list', + 'values': ("Miles", "Kilometers")}, + "LK": _BOOL, + "LMP": _BOOL, + "MAC": _SSTV_COLOURS, + "MES": {'type': 'string', 'max_len': 8}, + # NOTE: Requires memory mode to be active + "MNF": {'type': 'list', + 'values': ("Name", "Frequency")}, + "MP 1": _POSITION, + "MP 2": _POSITION, + "MP 3": _POSITION, + "MYC": {'type': 'string', 'max_len': 9}, + "PAMB": {'type': 'list', + 'values': ("Off", "1 Digit", "2 Digits", "3 Digits", + "4 Digits")}, + "PKSA": {'type': 'list', + 'values': ("1200", "9600")}, + "POSC": {'type': 'list', + 'values': ("Off Duty", "Enroute", "In Service", "Returning", + "Committed", "Special", "Priority", "CUSTOM 0", + "CUSTOM 1", "CUSTOM 2", "CUSTOM 4", "CUSTOM 5", + "CUSTOM 6", "Emergency")}, + "PP": {'type': 'string', 'max_len': 32}, + "PT": {'type': 'list', + 'values': ("100ms", "200ms", "500ms", "750ms", + "1000ms", "1500ms", "2000ms")}, + "PV": {'type': KenwoodD7ProgrammableVFOs}, + "RSC": _SSTV_COLOURS, + "RSV": {'type': 'string', 'max_len': 10, 'charset': _SSTV_CHARSET}, + "SCC": {'type': 'string', 'max_len': 8}, + "SCR": {'type': 'list', + 'values': ("Time", "Carrier", "Seek")}, + "SCT": {'type': 'string', 'max_len': 8}, + "SKTN": {'type': 'map', + 'map': tuple([(str(x), "%02d" % (ind + 1)) + for ind, x in enumerate(_TONES) if x != 69.3])}, + "SMC": _SSTV_COLOURS, + "SMSG": {'type': 'string', 'max_len': 9, 'charset': _SSTV_CHARSET}, + "SMY": {'type': 'string', 'max_len': 8, 'charset': _SSTV_CHARSET}, + "SQ 0": _SQUELCH, + "SQ 1": _SQUELCH, + "STAT 1": _STATUS_TEXT, + "STAT 2": _STATUS_TEXT, + "STAT 3": _STATUS_TEXT, + "STXR": {'type': 'list', + 'values': ("Off", "1/1", "1/2", "1/3", "1/4", "1/5", "1/6", + "1/7", "1/8")}, + "SV": {'type': 'list', + 'values': ("Off", "0.2s", "0.4s", "0.6s", "0.8s", "1.0s", + "2s", "3s", "4s", "5s")}, + "TEMP": {'type': 'list', + 'values': ("°F", "°C")}, + "TH": _BOOL, + "TNC": _BOOL, + "TSP": _BOOL, + "TXD": {'type': 'map', + 'map': (("100ms", "1"), ("200ms", "2"), ("300ms", "3"), + ("400ms", "4"), ("500ms", "5"), ("750ms", "6"), + ("1000ms", "7"))}, + "TXH": _BOOL, + "TXI": {'type': 'list', + 'values': ("30sec", "1min", "2min", "3min", "4min", "5min", + "10min", "20min", "30min")}, + "TXS": _BOOL, + "TZ": {'type': 'list', + 'values': ("UTC - 12:00", "UTC - 11:30", "UTC - 11:00", + "UTC - 10:30", "UTC - 10:00", "UTC - 9:30", + "UTC - 9:00", "UTC - 8:30", "UTC - 8:00", + "UTC - 7:30", "UTC - 7:00", "UTC - 6:30", + "UTC - 6:00", "UTC - 5:30", "UTC - 5:00", + "UTC - 4:30", "UTC - 4:00", "UTC - 3:30", + "UTC - 3:00", "UTC - 2:30", "UTC - 2:00", + "UTC - 1:30", "UTC - 1:00", "UTC - 0:30", + "UTC", "UTC + 0:30", "UTC + 1:00", "UTC + 1:30", + "UTC + 2:00", "UTC + 2:30", "UTC + 3:00", + "UTC + 3:30", "UTC + 4:00", "UTC + 4:30", + "UTC + 5:00", "UTC + 5:30", "UTC + 6:00", + "UTC + 6:30", "UTC + 7:00", "UTC + 7:30", + "UTC + 8:00", "UTC + 8:30", "UTC + 9:00", + "UTC + 9:30", "UTC + 10:00", "UTC + 10:30", + "UTC + 11:00", "UTC + 11:30", "UTC + 12:00")}, + "UPR": {'type': 'string', 'max_len': 9, + 'charset': "ABCDEFGHIJKLMNOPQRSTUVWXYZ-0123456789"}, + "VCS": _BOOL, + "WAY": {'type': 'list', + 'values': ("Off", "6 digit NMEA", "7 digit NMEA", + "8 digit NMEA", "9 digit NMEA", "6 digit Magellan", + "DGPS")}} + + _PROGRAMMABLE_VFOS = ( + ("Band A, 118 MHz Sub-Band", 1, 118, 135), + ("Band A, VHF Sub-Band", 2, 136, 173), + ("Band B, VHF Sub-Band", 3, 144, 147), + ("Band B, UHF Sub-Band", 6, 400, 479)) + + def __init__(self, *args, **kwargs): + chirp_common.LiveRadio.__init__(self, *args, **kwargs) + + # Clear the caches + self._memcache = {} + self._setcache = {} + self._baud = 9600 + self._cur_setting = 0 + self._setting_count = 0 + self._vfo = 0 + if self.pipe: + self.pipe.timeout = 0.5 + radio_id = self._get_id() + if hasattr(self, '_ID_STRING'): + id_str = self._ID_STRING + else: + id_str = self.MODEL.split(" ")[0] + if radio_id != id_str: + raise Exception("Radio reports %s (not %s)" % (radio_id, + id_str)) + + self._command(*self._DISABLE_AI_CMD) + + # This returns the index value for CR/CW commands, not the index + # in the memory list grid + def _call_index(self, memid_or_index): + if isinstance(memid_or_index, int): + memid = self._index_to_memid(memid_or_index) + else: + memid = memid_or_index + return self._CALL_CHANS.index(memid) + + # This returns the memid from the index value in CR/CW commands, not + # the index in the memory list grid + def _call_index_to_memid(self, index): + return self._CALL_CHANS[index] + + def _cmd_get_memory_name(self, memid): + return "MNA", "%i,%s" % (self._vfo, memid) + + def _cmd_get_memory_or_split(self, memid, split): + sd = split and 1 or 0 + if self._is_call(memid): + return "CR", "%d,%d" % (self._call_index(memid), split) + return "MR", "%i,%d,%s" % (self._vfo, sd, memid) + + def _cmd_set_memory_name(self, memid, name): + if self._is_call(memid): + return None + return "MNA", "%i,%s,%s" % (self._vfo, memid, name) + + def _cmd_set_memory_or_split(self, memid, memory, split): + if not memory.empty: + spec = "," + ",".join(self._make_mem_spec(memid, memory)) + else: + spec = '' + sd = split and 1 or 0 + if (self._is_call(memid)): + return "CW", "%d,%d%s" % (self._call_index(memid), sd, spec) + return "MW", "%i,%d,%s%s" % (self._vfo, sd, memid, spec) + + def _count_settings(self, entries): + for entry in entries: + if (type(entry[1]) is tuple): + self._count_settings(entry[1]) + else: + self._setting_count += 1 + + def _create_group(self, entries, grp=None): + if grp is None: + grp = RadioSettings() + for entry in entries: + if (type(entry[1]) is tuple): + subgrp = RadioSettingGroup(entry[0].lower(), entry[0]) + grp.append(self._create_group(entry[1], subgrp)) + else: + setting = self._get_setting_data(entry[0]) + if setting['type'] == 'undefined': + continue + if setting['type'] == 'list': + rsvl = RadioSettingValueList(setting['values']) + rs = RadioSetting(entry[0], entry[1], rsvl) + elif setting['type'] == 'bool': + rs = RadioSetting(entry[0], entry[1], + RadioSettingValueBoolean(False)) + elif setting['type'] == 'string': + params = {} + if 'charset' in setting: + params['charset'] = setting['charset'] + else: + params['charset'] = chirp_common.CHARSET_ASCII + minlen = 'min_len' in setting and setting['min_len'] or 0 + dummy = params['charset'][0] * minlen + rsvs = RadioSettingValueString(minlen, + setting['max_len'], + dummy, + False, **params) + rs = RadioSetting(entry[0], entry[1], rsvs) + elif setting['type'] == 'integer': + rs = RadioSetting(entry[0], entry[1], + RadioSettingValueInteger(setting['min'], + setting['max'], + setting['min'])) + elif setting['type'] == 'map': + rsvs = RadioSettingValueMap(setting['map'], + setting['map'][0][1]) + rs = RadioSetting(entry[0], entry[1], rsvs) + else: + rs = setting['type'](entry[0], entry[1], self) + rs.kenwood_d7_loaded = False + grp.append(rs) + self._setcache[entry[0]] = rs + return grp + + def _do_prerequisite(self, cmd, get, do): + if get: + arg = 'get_requires' + else: + arg = 'set_requires' + setting = self._get_setting_data(cmd) + if arg not in setting: + return + # Undo prerequisites in the reverse order they were applied + if not do: + it = reversed(setting[arg]) + else: + it = iter(setting[arg]) + for prereq, value in it: + entry = self._setcache[prereq] + if not entry.kenwood_d7_loaded: + self._refresh_setting(entry) + if do: + entry.kenwood_d7_old_value = entry.value.get_value() + entry.value.set_value(value) + else: + entry.value.set_value(entry.kenwood_d7_old_value) + sdata = self._get_setting_data(prereq) + self._set_setting(prereq, sdata, entry) + + def _drain_input(self): + oldto = self.pipe.timeout + self.pipe.timeout = 0 + # Read until a timeout + while len(self.pipe.read(1)): + pass + self.pipe.timeout = oldto + + def _empty_memory(self, memid): + mem = chirp_common.Memory() + if self._is_special(memid): + mem.extd_number = memid + mem.number = self._memid_to_index(memid) + mem.empty = True + mem.immutable = self._get_immutable(memid) + return mem + + def _get_id(self): + """Get the ID of the radio attached to @ser""" + + for i in self._BAUDS: + LOG.info("Trying ID at baud %i" % i) + self.pipe.baudrate = i + # Try to force an error + self.pipe.write(self._CMD_DELIMITER.encode('cp1252')) + # Wait for it to be sent + self.pipe.flush() + self._drain_input() + try: + resp = self._command("ID") + except UnicodeDecodeError: + # If we got binary here, we are using the wrong rate + # or not talking to a kenwood live radio. + continue + + ret = self._parse_id_response(resp) + if ret is not None: + self._baud = i + return ret + + # Radio responded in the right baud rate, + # but threw an error because of all the crap + # we have been hurling at it. Retry the ID at this + # baud rate, which will almost definitely work. + if "?" in resp: + resp = self._command("ID") + ret = self._parse_id_response(resp) + if ret is not None: + self._baud = i + return ret + raise errors.RadioError("No response from radio") + + def _get_immutable(self, memid_or_index): + if self._is_call(memid_or_index): + return ['name', 'skip'] + if self._is_pscan(memid_or_index): + return ['skip'] + return [] + + def _get_setting_data(self, setting): + if setting in self._SETTINGS: + return self._SETTINGS[setting] + if setting in self._COMMON_SETTINGS: + return self._COMMON_SETTINGS[setting] + if (setting.upper() == setting): + LOG.debug("Undefined setting: %s" % setting) + return {'type': 'undefined'} + + def _get_setting_digits(self, setting_data): + if 'digits' in setting_data: + return setting_data['digits'] + if setting_data['type'] == 'integer': + return len(str(setting_data['max'])) + if setting_data['type'] == 'list': + return len(str(len(setting_data['values']))) + raise TypeError('Setting data should not have digits') + + def _get_tmode(self, tone, ctcss, dcs): + """Get the tone mode based on the values of the tone, ctcss, dcs""" + if dcs and int(dcs) == 1: + return "DTCS" + elif int(ctcss): + return "TSQL" + elif int(tone): + return "Tone" + else: + return "" + + def _index_to_memid(self, index): + if not isinstance(index, int): + raise errors.RadioError("%s passed as memory index" + % str(type(index))) + if index <= self._UPPER: + return "%03d" % index + index -= self._UPPER + index -= 1 + return self._SPECIAL_CHANS[index] + + def _is_call(self, memid_or_index): + if isinstance(memid_or_index, int): + memid = self._index_to_memid(memid_or_index) + else: + memid = memid_or_index + return memid in self._CALL_CHANS + + def _is_pscan(self, memid_or_index): + if isinstance(memid_or_index, int): + memid = self._index_to_memid(memid_or_index) + else: + memid = memid_or_index + if memid[0] == 'L' or memid[0] == 'U': + if memid[1:].isdigit(): + return True + return False + + def _is_special(self, memid_or_index): + if isinstance(memid_or_index, str): + index = self._memid_to_index(memid_or_index) + else: + index = memid_or_index + return index > self._UPPER + + def _iserr(self, result): + """Returns True if the @result from a radio is an error""" + return result in ["N", "?"] + + def _keep_reading(self, result): + return False + + def _kenwood_get(self, cmd): + self._do_prerequisite(cmd, True, True) + ret = None + if " " in cmd: + suffix = cmd.split(" ", 1)[1] + resp = self._kenwood_simple_get(cmd) + if resp[1][0:len(suffix)+1] == suffix + ',': + resp = (cmd, resp[1][len(suffix)+1:]) + ret = resp + else: + raise errors.RadioError("Command %s response value '%s' " + "unusable" % (cmd, resp[1])) + else: + ret = self._kenwood_simple_get(cmd) + self._do_prerequisite(cmd, True, False) + return ret + + def _kenwood_get_bool(self, cmd): + _cmd, result = self._kenwood_get(cmd) + return result == "1" + + def _kenwood_get_int(self, cmd): + _cmd, result = self._kenwood_get(cmd) + return int(result) + + def _kenwood_set_success(self, cmd, modcmd, value, response): + if response[:len(modcmd)] == modcmd: + return True + return False + + def _kenwood_set(self, cmd, value): + self._do_prerequisite(cmd, False, True) + if " " in cmd: + resp = self._command(cmd + "," + value) + modcmd = cmd.split(" ", 1)[0] + else: + resp = self._command(cmd, value) + modcmd = cmd + self._do_prerequisite(cmd, False, False) + if self._kenwood_set_success(cmd, modcmd, value, resp): + return + raise errors.RadioError("Radio refused to set %s" % cmd) + + def _kenwood_set_bool(self, cmd, value): + return self._kenwood_set(cmd, str(int(value))) + + def _kenwood_set_int(self, cmd, value, digits=1): + return self._kenwood_set(cmd, ("%%0%ii" % digits) % value) + + def _kenwood_simple_get(self, cmd): + resp = self._command(cmd) + if " " in resp: + return resp.split(" ", 1) + else: + if resp == cmd: + return [resp, ""] + else: + raise errors.RadioError("Radio refused to return %s" % cmd) + + def _mem_spec_fixup(self, spec, memid, mem): + pass + + def _make_mem_spec(self, memid, mem): + if mem.duplex in " -+": + duplex = util.get_dict_rev(self._DUPLEX, mem.duplex) + offset = mem.offset + else: + duplex = 0 + offset = 0 + + spec = [ + "%011i" % mem.freq, + "%X" % self._STEPS.index(mem.tuning_step), + "%i" % duplex, + "0", + "%i" % (mem.tmode == "Tone"), + "%i" % (mem.tmode == "TSQL"), + "", # DCS Flag + "%02i" % (self._TONES.index(mem.rtone) + 1), + "", # DCS Code + "%02i" % (self._TONES.index(mem.ctone) + 1), + "%09i" % offset, + "%i" % util.get_dict_rev(self._MODES, mem.mode)] + if not self._is_call(memid): + spec.append("%i" % ((mem.skip == "S") and 1 or 0)) + self._mem_spec_fixup(spec, memid, mem) + + return tuple(spec) + + def _make_split_spec(self, mem): + return ("%011i" % mem.offset, "0") + + def _memid_to_index(self, memid): + if not isinstance(memid, str): + raise errors.RadioError("%s passed as memory id" + % str(type(memid))) + if memid in self._SPECIAL_CHANS: + return self._SPECIAL_CHANS.index(memid) + self._UPPER + 1 + return int(memid) + + def _parse_id_response(self, resp): + # most kenwood VHF+ radios + if " " in resp: + return resp.split(" ")[1] + return None + + def _parse_mem_fixup(self, mem, spec): + pass + + def _parse_mem(self, result): + mem = chirp_common.Memory() + + value = result.split(" ")[1] + spec = value.split(",") + if len(spec) == 14: # This is a Call memory + spec.insert(1, 0) # Add "bank" + spec.insert(15, 0) # Add "skip" + memid = self._call_index_to_memid(int(spec[0])) + mem.extd_number = memid + mem.number = self._memid_to_index(mem.extd_number) + elif spec[2].isdigit(): # Normal memory + mem.number = int(spec[2]) + memid = self._index_to_memid(mem.number) + else: # Program Scan memory + memid = spec[2] + mem.extd_number = memid + mem.number = self._memid_to_index(mem.extd_number) + mem.immutable = self._get_immutable(memid) + mem.freq = int(spec[3], 10) + mem.tuning_step = self._STEPS[int(spec[4], 16)] + mem.duplex = self._DUPLEX[int(spec[5])] + mem.tmode = self._get_tmode(spec[7], spec[8], spec[9]) + mem.rtone = self._TONES[int(spec[10]) - 1] + mem.ctone = self._TONES[int(spec[12]) - 1] + if spec[13]: + mem.offset = int(spec[13]) + else: + mem.offset = 0 + mem.mode = self._MODES[int(spec[14])] + if 'skip' not in mem.immutable: + mem.skip = int(spec[15]) and "S" or "" + self._parse_mem_fixup(mem, spec) + return mem + + def _parse_split(self, mem, result): + value = result.split(" ")[1] + spec = value.split(",") + mem.duplex = "split" + # TODO: There's another parameter here... not sure what it is + if len(spec) == 14: # Call memory + mem.offset = int(spec[2]) + else: + mem.offset = int(spec[3]) + + def _refresh_setting(self, entry): + name = entry.get_name() + setting = self._get_setting_data(name) + # TODO: It would be nice to bump_wait_dialog here... + # Also, this is really only useful for the cli. :( + if self.status_fn: + status = chirp_common.Status() + status.cur = self._cur_setting + status.max = self._setting_count + status.msg = "Fetching %-30s" % entry.get_shortname() + # self.bump_wait_dialog(int(status.cur * 100 / status.max), + # "Fetching %s" % entry[1]) + self.status_fn(status) + self._cur_setting += 1 + if setting['type'] == 'list': + value = self._kenwood_get_int(name) + entry.value.set_index(value) + elif setting['type'] == 'bool': + value = self._kenwood_get_bool(name) + entry.value.set_value(value) + elif setting['type'] == 'string': + value = self._kenwood_get(name)[1] + entry.value.set_value(value) + elif setting['type'] == 'integer': + value = self._kenwood_get_int(name) + entry.value.set_value(value) + elif setting['type'] == 'map': + value = self._kenwood_get(name)[1] + entry.value.set_mem_val(value) + else: + entry.kenwood_d7_read_value() + if hasattr(entry, 'value'): + if hasattr(entry.value, '_has_changed'): + entry.value._has_changed = False + entry.kenwood_d7_loaded = True + + def _refresh_settings(self): + for entry in self._setcache.values(): + if not entry.kenwood_d7_loaded: + self._refresh_setting(entry) + + def _validate_memid(self, memid_or_index): + if isinstance(memid_or_index, int): + index = memid_or_index + memid = self._index_to_memid(memid_or_index) + else: + memid = memid_or_index + index = self._memid_to_index(memid_or_index) + if memid in self._SPECIAL_CHANS: + pass + elif index < self._LOWER or index > self._UPPER: + raise errors.InvalidMemoryLocation( + "Number must be between %i and %i" % (self._LOWER, + self._UPPER)) + return index, memid + + def _validate_memory(self, memory): + if memory.number is None: + return self._validate_memid(memory.extd_number) + return self._validate_memid(memory.number) + + def _set_setting(self, name, sdata, element): + if sdata['type'] == 'bool': + value = element.value.get_value() + self._kenwood_set_bool(name, value) + element.value._has_changed = False + elif sdata['type'] == 'integer': + value = element.value.get_value() + digits = self._get_setting_digits(sdata) + self._kenwood_set_int(name, value, digits) + element.value._has_changed = False + elif sdata['type'] == 'string': + value = element.value.get_value() + self._kenwood_set(name, value) + element.value._has_changed = False + elif sdata['type'] == 'list': + value = element.value.get_value() + digits = self._get_setting_digits(sdata) + self._kenwood_set_int(name, sdata['values'].index(value), + digits) + element.value._has_changed = False + elif sdata['type'] == 'map': + self._kenwood_set(name, element.value.get_mem_val()) + element.value._has_changed = False + # TODO: I would like to have tried this first then fetched + # value, but we can't use hasattr() on settings due to the + # Magic foo.value attribute in chirp/settings.py. Instead, + # I need to get_value() each time. :( + elif hasattr(element, 'kenwood_d7_set_value'): + element.kenwood_d7_set_value() + else: + raise TypeError('No way to set %s value' % name) + + def _command(self, cmd, *args): + """Send @cmd to radio via @ser""" + + # This lock is needed to allow clicking the settings tab while + # the memories are still loading. Most important with the TH-D7A + # and TH-D7A(G) with the 9600bps maximum. + with self._LOCK: + if args: + cmd += self._ARG_DELIMITER + self._ARG_DELIMITER.join(args) + cmd += self._CMD_DELIMITER + self._drain_input() + + LOG.debug("PC->RADIO: %s" % cmd.strip()) + self.pipe.write(cmd.encode('cp1252')) + cd = self._CMD_DELIMITER.encode('cp1252') + keep_reading = True + while keep_reading: + result = self.pipe.read_until(cd).decode('cp1252') + if result.endswith(self._CMD_DELIMITER): + keep_reading = self._keep_reading(result) + LOG.debug("RADIO->PC: %r" % result.strip()) + result = result[:-1] + else: + keep_reading = False + LOG.error("Timeout waiting for data") + + return result.strip() + + def erase_memory(self, memid_or_index): + index, memid = self._validate_memid(memid_or_index) + if memid not in self._memcache: + return + # TODO: Can't disable the menu item? + if self._is_call(memid): + # Raising an error just makes the memory errored + return + cmd = self._cmd_set_memory_or_split(memid, self._empty_memory(memid), + False) + resp = self._command(*cmd) + if self._iserr(resp): + raise errors.RadioError("Radio refused delete of %s" % memid) + del self._memcache[memid] + + def get_features(self, *args, **kwargs): + rf = chirp_common.RadioFeatures(*args, **kwargs) + rf.valid_tones = tuple([x for x in self._TONES if x != 69.3]) + rf.has_settings = True + rf.has_dtcs = False + rf.has_dtcs_polarity = False + rf.has_bank = False + rf.has_mode = True + rf.has_tuning_step = True + rf.can_odd_split = True + rf.valid_name_length = 8 + rf.valid_duplexes = ["", "-", "+", "split"] + rf.valid_modes = list(self._MODES.values()) + rf.valid_tmodes = ["", "Tone", "TSQL"] + rf.valid_characters = \ + chirp_common.CHARSET_ALPHANUMERIC + "/.-+*)('&%$#! ~}|{" + rf.valid_tuning_steps = self._STEPS + rf.memory_bounds = (self._LOWER, self._UPPER) + rf.valid_special_chans = self._SPECIAL_CHANS + return rf + + def get_memory(self, memid_or_index): + index, memid = self._validate_memid(memid_or_index) + if memid in self._memcache and not self._NOCACHE: + return self._memcache[memid] + + result = self._command(*self._cmd_get_memory_or_split(memid, + False)) + if result == "N": + mem = self._empty_memory(memid) + self._memcache[memid] = mem + return mem + elif self._ARG_DELIMITER not in result: + LOG.error("Not sure what to do with this: `%s'" % result) + raise errors.RadioError("Unexpected result returned from radio") + + mem = self._parse_mem(result) + self._memcache[memid] = mem + + if self._HAS_NAME: + cmd = self._cmd_get_memory_name(memid) + if cmd is not None: + result = self._command(*cmd) + if " " in result: + value = result.split(" ", 1)[1] + mem.name = value.split(",", 2)[2] + if mem.duplex == "" and self._SPLIT: + cmd = self._cmd_get_memory_or_split(memid, True) + if cmd is not None: + result = self._command(*cmd) + if " " in result: + self._parse_split(mem, result) + + return mem + + def get_settings(self): + if self._setting_count == 0: + self._count_settings(self._SETTINGS_MENUS) + ret = self._create_group(self._SETTINGS_MENUS) + self._cur_setting = 0 + self._refresh_settings() + status = chirp_common.Status() + status.cur = self._setting_count + status.max = self._setting_count + status.msg = "%-40s" % "Done" + self.status_fn(status) + return ret + + def set_memory(self, memory): + index, memid = self._validate_memory(memory) + if memory.empty: + self.erase_memory(memid) + LOG.debug("set_memory passed an empty memory, perhaps " + "you wanted erase_memory()?") + return + r1 = self._command(*self._cmd_set_memory_or_split(memid, memory, + False)) + if self._iserr(r1): + raise errors.InvalidDataError("Radio refused %s" % memid) + self._memcache[memid] = memory.dupe() + if self._HAS_NAME: + r2cmd = self._cmd_set_memory_name(memid, memory.name) + if r2cmd is not None: + r2 = self._command(*r2cmd) + if self._iserr(r2): + raise errors.InvalidDataError("Radio refused name %s: %s" % + (memid, repr(memory.name))) + if memory.duplex == "split" and self._SPLIT: + result = self._command(*self._cmd_set_memory_or_split(memid, + memory, + True)) + if self._iserr(result): + raise errors.InvalidDataError("Radio refused %s" % + memid) + + def set_settings(self, settings): + for element in settings: + name = element.get_name() + sdata = self._get_setting_data(name) + if sdata['type'] == 'undefined': + if isinstance(element, RadioSettingGroup): + self.set_settings(element) + continue + if not element.changed(): + continue + self._set_setting(name, sdata, element) + + +@directory.register +class THD7Radio(KenwoodD7Family): + """Kenwood TH-D7""" + MODEL = "TH-D7" + + _SETTINGS = { + "BEPT": {'type': 'list', + 'values': ("Off", "Mine", "All New")}, + "DTB": {'type': 'list', + 'values': ("A", "B")}, + "DTBA": {'type': 'list', + 'values': ("A", "B", "A:TX/B:RX", "A:RX/B:TX")}, + "GU": {'type': 'list', + 'values': ("Not Used", "NMEA")}, + "MP": {'type': 'position'}, + "STAT": {'type': 'string', 'max_len': 20}, + "TEMP": {'type': 'list', + 'values': ("Miles / °F", "Kilometers / °C")}} + + _SETTINGS_MENUS = ( + ('Main', + (("ASC 0", "Automatic Simplex Check Band A"), + ("ASC 1", "Automatic Simplex Check Band B"), + ("BAL", "Balance"), + ("BC", "Band"), + ("BEL 0", "Tone Alert Band A"), + ("BEL 1", "Tone Alert Band B"), + ("CH", "Channel Mode Display"), + ("DL", "Dual"), + ("LMP", "Lamp"), + ("LK", "Lock"), + # MNF requires that the *current* VFO be in MR mode + # Also, it has a direct key + # ("MNF", "Memory Display Mode"), + ("SQ 0", "Band A Squelch"), + ("SQ 1", "Band B Squelch"), + # We likely don't want to enable this from Chirp... + # ("TNC", "Packet Mode"))), + )), + ('Radio', + (('Display', + (("MES", "Power-ON Message"), + ("CNT", "Contrast"))), + ('Save', + (("SV", "Battery Saver Interval"), + ("APO", "Automatic Power Off (APO)"))), + ('DTMF', + (("dtmfmem 00", "Number Store #0"), + ("dtmfmem 01", "Number Store #1"), + ("dtmfmem 02", "Number Store #2"), + ("dtmfmem 03", "Number Store #3"), + ("dtmfmem 04", "Number Store #4"), + ("dtmfmem 05", "Number Store #5"), + ("dtmfmem 06", "Number Store #6"), + ("dtmfmem 07", "Number Store #7"), + ("dtmfmem 08", "Number Store #8"), + ("dtmfmem 09", "Number Store #9"), + ("TSP", "TX Speed"), + ("TXH", "TX Hold"), + ("PT", "Pause"))), + ('TNC', + (("DTB", "Data band select"), + ("DS", "DCD sense"))), + ('AUX', + (("ARO", "Automatic Repeater Offset"), + ("SCR", "Scan Resume"), + ("BEP", "Key Beep"), + ("ELK", "Tuning Enable"), + ("TXS", "TX Inhibit"), + ("AIP", "Advanced Intercept Point"), + ("TH", "TX Hold, 1750 Hz"), + ("XXX", "VHF band narrow TX deviation"))))), + ('APRS', + (("MYC", "My call sign"), + ("GU", "GPS receiver"), + # Untested... D7G and D700 take an index, but since D7A only has + # one position and is older, it may not. + # ("MP", "Latitude / longitude data"), + ("POSC", "Position comment"), + ("ICO", "Station icon"), + ("STAT", "Status text"), + ("TXI", "Beacon transmit interval"), + ("PP", "Packet path"), + ("DTX", "Beacon transmit method"), + ("UPR", "Group code"), + ("ARL", "Reception restriction distance"), + ("TEMP", "Unit for temperature"))), + ('SSTV', + (("SMY", "My call sign"), + ("MAC", "Color for call sign"), + ("SMSG", "Message"), + ("SMC", "Color for message"), + ("RSV", "RSV report"), + ("RSC", "Color for RSV report"), + ("VCS", "VC-H1 Control"))), + ('SkyCommand', + (("SCC", "Commander call sign"), + ("SCT", "Transporter call sign"), + ("SKTN", "Tone frequency select")))) + + +@directory.register +class THD7GRadio(KenwoodD7Family): + """Kenwood TH-D7G""" + MODEL = "TH-D7G" + + _APRS_EXTRA = (('WEATHER Station (blue)', '1,/#'), + ('House QTH (VHF)', '1,/-'), + ('Boy Scouts', '1,/,'), + ('Campground (Portable ops)', '1,/;'), + ('FIRE', '1,/:'), + ('Police, Sheriff', '1,/!'), + ('SERVER for Files', '1,/?'), + ('X', '1,/.'), + ('Small AIRCRAFT (SSID-11)', "1,/'"), + ('reserved (was rain)', '1,/"'), + ('Mobile Satellite Station', '1,/('), + ('Wheelchair (handicapped)', '1,/)'), + ('Human/Person (SSID-7)', '1,/['), + ('MAIL/PostOffice(was PBBS)', '1,/]'), + ('/{ (J1)', '1,/{'), + ('/} (J3)', '1,/}'), + ('HC FUTURE predict (dot)', '1,/@'), + ('SnowMobile', '1,/*'), + ('Red Dot', '1,//'), + ('TRIANGLE(DF station)', '1,/\\'), + ('HF GATEway', '1,/&'), + ('DIGI (white center)', '1,/#'), + ('DX CLUSTER', '1,/%'), + ('Dish Antenna', '1,/`'), + ('LARGE AIRCRAFT', '1,/^'), + ('Red Cross', '1,/+'), + ('Motorcycle (SSID-10)', '1,/<'), + ('RAILROAD ENGINE', '1,/='), + ('CAR (SSID-9)', '1,/>'), + ('TNC Stream Switch', '1,/|'), + ('TNC Stream Switch', '1,/~'), + ('PHONE', '1,/$'), + ('# circle (obsolete)', '1,/0'), + ('TBD (these were numbered)', '1,/1'), + ('TBD (circles like pool)', '1,/2'), + ('TBD (balls. But with)', '1,/3'), + ('TBD (overlays, we can)', '1,/4'), + ("TBD (put all #'s on one)", '1,/5'), + ('TBD (So 1-9 are available)', '1,/6'), + ('TBD (for new uses?)', '1,/7'), + ('TBD (They are often used)', '1,/8'), + ('TBD (as mobiles at events)', '1,/9'), + ('Aid Station', '1,/A'), + ('AMBULANCE (SSID-1)', '1,/a'), + ('BBS or PBBS', '1,/B'), + ('BIKE (SSID-4)', '1,/b'), + ('Canoe', '1,/C'), + ('Incident Command Post', '1,/c'), + ('/D (PD)', '1,/D'), + ('Fire dept', '1,/d'), + ('EYEBALL (Events, etc!)', '1,/E'), + ('HORSE (equestrian)', '1,/e'), + ('Farm Vehicle (tractor)', '1,/F'), + ('FIRE TRUCK (SSID-3)', '1,/f'), + ('Grid Square (6 digit)', '1,/G'), + ('Glider', '1,/g'), + ('HOTEL (blue bed symbol)', '1,/H'), + ('HOSPITAL', '1,/h'), + ('TcpIp on air network stn', '1,/I'), + ('IOTA (islands on the air)', '1,/i'), + ('/J (PJ)', '1,/J'), + ('JEEP (SSID-12)', '1,/j'), + ('School', '1,/K'), + ('TRUCK (SSID-14)', '1,/k'), + ('PC user (Jan 03)', '1,/L'), + ('Laptop (Jan 03) (Feb 07)', '1,/l'), + ('MacAPRS', '1,/M'), + ('Mic-E Repeater', '1,/m'), + ('NTS Station', '1,/N'), + ('Node (black bulls-eye)', '1,/n'), + ('BALLOON (SSID-11)', '1,/O'), + ('EOC', '1,/o'), + ('Police', '1,/P'), + ('ROVER (puppy, or dog)', '1,/p'), + ('TBD', '1,/Q'), + ('GRID SQ shown above 128 m', '1,/q'), + ('REC. VEHICLE (SSID-13)', '1,/R'), + ('Repeater (Feb 07)', '1,/r'), + ('SHUTTLE', '1,/S'), + ('SHIP (pwr boat) (SSID-8)', '1,/s'), + ('SSTV', '1,/T'), + ('TRUCK STOP', '1,/t'), + ('BUS (SSID-2)', '1,/U'), + ('TRUCK (18 wheeler)', '1,/u'), + ('ATV', '1,/V'), + ('VAN (SSID-15)', '1,/v'), + ('National WX Service Site', '1,/W'), + ('WATER station', '1,/w'), + ('HELO (SSID-6)', '1,/X'), + ('xAPRS (Unix)', '1,/x'), + ('YACHT (sail) (SSID-5)', '1,/Y'), + ('YAGI @ QTH', '1,/y'), + ('WinAPRS', '1,/Z'), + ('TBD', '1,/z'), + ('# WX site (green digi)', '1,\\_'), + ('# WX site (green digi) with Zero overlaid', '1,0_'), + ('# WX site (green digi) with One overlaid', '1,1_'), + ('# WX site (green digi) with Two overlaid', '1,2_'), + ('# WX site (green digi) with Three overlaid', '1,3_'), + ('# WX site (green digi) with Four overlaid', '1,4_'), + ('# WX site (green digi) with Five overlaid', '1,5_'), + ('# WX site (green digi) with Six overlaid', '1,6_'), + ('# WX site (green digi) with Seven overlaid', '1,7_'), + ('# WX site (green digi) with Eight overlaid', '1,8_'), + ('# WX site (green digi) with Nine overlaid', '1,9_'), + ('# WX site (green digi) with Letter A overlaid', '1,A_'), + ('# WX site (green digi) with Letter B overlaid', '1,B_'), + ('# WX site (green digi) with Letter C overlaid', '1,C_'), + ('# WX site (green digi) with Letter D overlaid', '1,D_'), + ('# WX site (green digi) with Letter E overlaid', '1,E_'), + ('# WX site (green digi) with Letter F overlaid', '1,F_'), + ('# WX site (green digi) with Letter G overlaid', '1,G_'), + ('# WX site (green digi) with Letter H overlaid', '1,H_'), + ('# WX site (green digi) with Letter I overlaid', '1,I_'), + ('# WX site (green digi) with Letter J overlaid', '1,J_'), + ('# WX site (green digi) with Letter K overlaid', '1,K_'), + ('# WX site (green digi) with Letter L overlaid', '1,L_'), + ('# WX site (green digi) with Letter M overlaid', '1,M_'), + ('# WX site (green digi) with Letter N overlaid', '1,N_'), + ('# WX site (green digi) with Letter O overlaid', '1,O_'), + ('# WX site (green digi) with Letter P overlaid', '1,P_'), + ('# WX site (green digi) with Letter Q overlaid', '1,Q_'), + ('# WX site (green digi) with Letter R overlaid', '1,R_'), + ('# WX site (green digi) with Letter S overlaid', '1,S_'), + ('# WX site (green digi) with Letter T overlaid', '1,T_'), + ('# WX site (green digi) with Letter U overlaid', '1,U_'), + ('# WX site (green digi) with Letter V overlaid', '1,V_'), + ('# WX site (green digi) with Letter W overlaid', '1,W_'), + ('# WX site (green digi) with Letter X overlaid', '1,X_'), + ('# WX site (green digi) with Letter Y overlaid', '1,Y_'), + ('# WX site (green digi) with Letter Z overlaid', '1,Z_'), + ('House (H=HF) (O = Op Present)', '1,\\-'), + ('Girl Scouts', '1,\\,'), + ('Park/Picnic + overlay events', '1,\\;'), + ('AVAIL (Hail ==> ` ovly H)', '1,\\:'), + ('EMERGENCY (and overlays)', '1,\\!'), + ('INFO Kiosk (Blue box with ?)', '1,\\?'), + ('Ambiguous (Big Question mark)', '1,\\.'), + ('Crash (& now Incident sites)', "1,\\'"), + ('reserved', '1,\\"'), + ('CLOUDY (other clouds w ovrly)', '1,\\('), + ('Firenet MEO, MODIS Earth Obs.', '1,\\)'), + ('W.Cloud (& humans w Ovrly)', '1,\\['), + ('AVAIL', '1,\\]'), + ('AVAIL? (Fog ==> E ovly F)', '1,\\{'), + ('AVAIL? (maybe)', '1,\\}'), + ('HURICANE/Trop-Storm', '1,\\@'), + ('AVAIL (SNOW moved to ` ovly S)', '1,\\*'), + ('Waypoint Destination See APRSdos MOBILE.txt', '1,\\/'), + ('New overlayable GPS symbol', '1,\\\\'), + ('I=Igte R=RX T=1hopTX 2=2hopTX', '1,\\&'), + ('I=Igte R=RX T=1hopTX 2=2hopTX with Zero overlaid', + '1,0&'), + ('I=Igte R=RX T=1hopTX 2=2hopTX with One overlaid', '1,1&'), + ('TX igate with path set to 2 hops', '1,2&'), + ('I=Igte R=RX T=1hopTX 2=2hopTX with Three overlaid', + '1,3&'), + ('I=Igte R=RX T=1hopTX 2=2hopTX with Four overlaid', + '1,4&'), + ('I=Igte R=RX T=1hopTX 2=2hopTX with Five overlaid', + '1,5&'), + ('I=Igte R=RX T=1hopTX 2=2hopTX with Six overlaid', '1,6&'), + ('I=Igte R=RX T=1hopTX 2=2hopTX with Seven overlaid', + '1,7&'), + ('I=Igte R=RX T=1hopTX 2=2hopTX with Eight overlaid', + '1,8&'), + ('I=Igte R=RX T=1hopTX 2=2hopTX with Nine overlaid', + '1,9&'), + ('I=Igte R=RX T=1hopTX 2=2hopTX with Letter A overlaid', + '1,A&'), + ('I=Igte R=RX T=1hopTX 2=2hopTX with Letter B overlaid', + '1,B&'), + ('I=Igte R=RX T=1hopTX 2=2hopTX with Letter C overlaid', + '1,C&'), + ('I=Igte R=RX T=1hopTX 2=2hopTX with Letter D overlaid', + '1,D&'), + ('I=Igte R=RX T=1hopTX 2=2hopTX with Letter E overlaid', + '1,E&'), + ('I=Igte R=RX T=1hopTX 2=2hopTX with Letter F overlaid', + '1,F&'), + ('I=Igte R=RX T=1hopTX 2=2hopTX with Letter G overlaid', + '1,G&'), + ('I=Igte R=RX T=1hopTX 2=2hopTX with Letter H overlaid', + '1,H&'), + ('Igate Generic', '1,I&'), + ('I=Igte R=RX T=1hopTX 2=2hopTX with Letter J overlaid', + '1,J&'), + ('I=Igte R=RX T=1hopTX 2=2hopTX with Letter K overlaid', + '1,K&'), + ('Lora Igate', '1,L&'), + ('I=Igte R=RX T=1hopTX 2=2hopTX with Letter M overlaid', + '1,M&'), + ('I=Igte R=RX T=1hopTX 2=2hopTX with Letter N overlaid', + '1,N&'), + ('I=Igte R=RX T=1hopTX 2=2hopTX with Letter O overlaid', + '1,O&'), + ('PSKmail node', '1,P&'), + ('I=Igte R=RX T=1hopTX 2=2hopTX with Letter Q overlaid', + '1,Q&'), + ('Receive only Igate', '1,R&'), + ('I=Igte R=RX T=1hopTX 2=2hopTX with Letter S overlaid', + '1,S&'), + ('TX igate with path set to 1 hop only', '1,T&'), + ('I=Igte R=RX T=1hopTX 2=2hopTX with Letter U overlaid', + '1,U&'), + ('I=Igte R=RX T=1hopTX 2=2hopTX with Letter V overlaid', + '1,V&'), + ('WIRES-X', '1,W&'), + ('I=Igte R=RX T=1hopTX 2=2hopTX with Letter X overlaid', + '1,X&'), + ('I=Igte R=RX T=1hopTX 2=2hopTX with Letter Y overlaid', + '1,Y&'), + ('I=Igte R=RX T=1hopTX 2=2hopTX with Letter Z overlaid', + '1,Z&'), + ('OVERLAY DIGI (green star)', '1,\\#'), + ('OVERLAY DIGI (green star) with Zero overlaid', '1,0#'), + ('OVERLAY DIGI (green star) with One overlaid', '1,1#'), + ('OVERLAY DIGI (green star) with Two overlaid', '1,2#'), + ('OVERLAY DIGI (green star) with Three overlaid', '1,3#'), + ('OVERLAY DIGI (green star) with Four overlaid', '1,4#'), + ('OVERLAY DIGI (green star) with Five overlaid', '1,5#'), + ('OVERLAY DIGI (green star) with Six overlaid', '1,6#'), + ('OVERLAY DIGI (green star) with Seven overlaid', '1,7#'), + ('OVERLAY DIGI (green star) with Eight overlaid', '1,8#'), + ('OVERLAY DIGI (green star) with Nine overlaid', '1,9#'), + ('OVERLAY DIGI (green star) with Letter A overlaid', + '1,A#'), + ('OVERLAY DIGI (green star) with Letter B overlaid', + '1,B#'), + ('OVERLAY DIGI (green star) with Letter C overlaid', + '1,C#'), + ('OVERLAY DIGI (green star) with Letter D overlaid', + '1,D#'), + ('OVERLAY DIGI (green star) with Letter E overlaid', + '1,E#'), + ('OVERLAY DIGI (green star) with Letter F overlaid', + '1,F#'), + ('OVERLAY DIGI (green star) with Letter G overlaid', + '1,G#'), + ('OVERLAY DIGI (green star) with Letter H overlaid', + '1,H#'), + ('OVERLAY DIGI (green star) with Letter I overlaid', + '1,I#'), + ('OVERLAY DIGI (green star) with Letter J overlaid', + '1,J#'), + ('OVERLAY DIGI (green star) with Letter K overlaid', + '1,K#'), + ('OVERLAY DIGI (green star) with Letter L overlaid', + '1,L#'), + ('OVERLAY DIGI (green star) with Letter M overlaid', + '1,M#'), + ('OVERLAY DIGI (green star) with Letter N overlaid', + '1,N#'), + ('OVERLAY DIGI (green star) with Letter O overlaid', + '1,O#'), + ('OVERLAY DIGI (green star) with Letter P overlaid', + '1,P#'), + ('OVERLAY DIGI (green star) with Letter Q overlaid', + '1,Q#'), + ('OVERLAY DIGI (green star) with Letter R overlaid', + '1,R#'), + ('OVERLAY DIGI (green star) with Letter S overlaid', + '1,S#'), + ('OVERLAY DIGI (green star) with Letter T overlaid', + '1,T#'), + ('OVERLAY DIGI (green star) with Letter U overlaid', + '1,U#'), + ('OVERLAY DIGI (green star) with Letter V overlaid', + '1,V#'), + ('OVERLAY DIGI (green star) with Letter W overlaid', + '1,W#'), + ('OVERLAY DIGI (green star) with Letter X overlaid', + '1,X#'), + ('OVERLAY DIGI (green star) with Letter Y overlaid', + '1,Y#'), + ('OVERLAY DIGI (green star) with Letter Z overlaid', + '1,Z#'), + ('Power Plant with overlay', '1,\\%'), + ('Rain (all types w ovrly)', '1,\\`'), + ('other Aircraft ovrlys (2014)', '1,\\^'), + ('other Aircraft ovrlys (2014) with Zero overlaid', '1,0^'), + ('other Aircraft ovrlys (2014) with One overlaid', '1,1^'), + ('other Aircraft ovrlys (2014) with Two overlaid', '1,2^'), + ('other Aircraft ovrlys (2014) with Three overlaid', + '1,3^'), + ('other Aircraft ovrlys (2014) with Four overlaid', '1,4^'), + ('other Aircraft ovrlys (2014) with Five overlaid', '1,5^'), + ('other Aircraft ovrlys (2014) with Six overlaid', '1,6^'), + ('other Aircraft ovrlys (2014) with Seven overlaid', + '1,7^'), + ('other Aircraft ovrlys (2014) with Eight overlaid', + '1,8^'), + ('other Aircraft ovrlys (2014) with Nine overlaid', '1,9^'), + ('Autonomous', '1,A^'), + ('other Aircraft ovrlys (2014) with Letter B overlaid', + '1,B^'), + ('other Aircraft ovrlys (2014) with Letter C overlaid', + '1,C^'), + ('Drone', '1,D^'), + ('Electric aircraft', '1,E^'), + ('other Aircraft ovrlys (2014) with Letter F overlaid', + '1,F^'), + ('other Aircraft ovrlys (2014) with Letter G overlaid', + '1,G^'), + ('Hovercraft', '1,H^'), + ('other Aircraft ovrlys (2014) with Letter I overlaid', + '1,I^'), + ('JET', '1,J^'), + ('other Aircraft ovrlys (2014) with Letter K overlaid', + '1,K^'), + ('other Aircraft ovrlys (2014) with Letter L overlaid', + '1,L^'), + ('Missle', '1,M^'), + ('other Aircraft ovrlys (2014) with Letter N overlaid', + '1,N^'), + ('other Aircraft ovrlys (2014) with Letter O overlaid', + '1,O^'), + ('Prop', '1,P^'), + ('other Aircraft ovrlys (2014) with Letter Q overlaid', + '1,Q^'), + ('Remotely Piloted', '1,R^'), + ('Solar Powered', '1,S^'), + ('other Aircraft ovrlys (2014) with Letter T overlaid', + '1,T^'), + ('other Aircraft ovrlys (2014) with Letter U overlaid', + '1,U^'), + ('Vertical takeoff', '1,V^'), + ('other Aircraft ovrlys (2014) with Letter W overlaid', + '1,W^'), + ('Experimental', '1,X^'), + ('other Aircraft ovrlys (2014) with Letter Y overlaid', + '1,Y^'), + ('other Aircraft ovrlys (2014) with Letter Z overlaid', + '1,Z^'), + ('Church', '1,\\+'), + ('ADVISORY (one WX flag)', '1,\\<'), + ('avail. symbol overlay group', '1,\\='), + ('OVERLAYED CARs & Vehicles', '1,\\>'), + ('OVERLAYED CARs & Vehicles with Zero overlaid', '1,0>'), + ('OVERLAYED CARs & Vehicles with One overlaid', '1,1>'), + ('OVERLAYED CARs & Vehicles with Two overlaid', '1,2>'), + ('Model 3 (Tesla)', '1,3>'), + ('OVERLAYED CARs & Vehicles with Four overlaid', '1,4>'), + ('OVERLAYED CARs & Vehicles with Five overlaid', '1,5>'), + ('OVERLAYED CARs & Vehicles with Six overlaid', '1,6>'), + ('OVERLAYED CARs & Vehicles with Seven overlaid', '1,7>'), + ('OVERLAYED CARs & Vehicles with Eight overlaid', '1,8>'), + ('OVERLAYED CARs & Vehicles with Nine overlaid', '1,9>'), + ('OVERLAYED CARs & Vehicles with Letter A overlaid', + '1,A>'), + ('BEV - Battery EV', '1,B>'), + ('OVERLAYED CARs & Vehicles with Letter C overlaid', + '1,C>'), + ('DIY - Do it yourself ', '1,D>'), + ('Ethanol (was electric)', '1,E>'), + ('Fuelcell or hydrogen', '1,F>'), + ('OVERLAYED CARs & Vehicles with Letter G overlaid', + '1,G>'), + ('Hybrid', '1,H>'), + ('OVERLAYED CARs & Vehicles with Letter I overlaid', + '1,I>'), + ('OVERLAYED CARs & Vehicles with Letter J overlaid', + '1,J>'), + ('OVERLAYED CARs & Vehicles with Letter K overlaid', + '1,K>'), + ('Leaf', '1,L>'), + ('OVERLAYED CARs & Vehicles with Letter M overlaid', + '1,M>'), + ('OVERLAYED CARs & Vehicles with Letter N overlaid', + '1,N>'), + ('OVERLAYED CARs & Vehicles with Letter O overlaid', + '1,O>'), + ('PHEV - Plugin-hybrid', '1,P>'), + ('OVERLAYED CARs & Vehicles with Letter Q overlaid', + '1,Q>'), + ('OVERLAYED CARs & Vehicles with Letter R overlaid', + '1,R>'), + ('Solar powered', '1,S>'), + ('Tesla (temporary)', '1,T>'), + ('OVERLAYED CARs & Vehicles with Letter U overlaid', + '1,U>'), + ('Volt (temporary)', '1,V>'), + ('OVERLAYED CARs & Vehicles with Letter W overlaid', + '1,W>'), + ('Model X', '1,X>'), + ('OVERLAYED CARs & Vehicles with Letter Y overlaid', + '1,Y>'), + ('OVERLAYED CARs & Vehicles with Letter Z overlaid', + '1,Z>'), + ('TNC Stream Switch', '1,\\|'), + ('TNC Stream Switch', '1,\\~'), + ('Bank or ATM (green box)', '1,\\$'), + ('CIRCLE (IRLP/Echolink/WIRES)', '1,\\0'), + ('CIRCLE (IRLP/Echolink/WIRES) with Zero overlaid', '1,00'), + ('CIRCLE (IRLP/Echolink/WIRES) with One overlaid', '1,10'), + ('CIRCLE (IRLP/Echolink/WIRES) with Two overlaid', '1,20'), + ('CIRCLE (IRLP/Echolink/WIRES) with Three overlaid', + '1,30'), + ('CIRCLE (IRLP/Echolink/WIRES) with Four overlaid', '1,40'), + ('CIRCLE (IRLP/Echolink/WIRES) with Five overlaid', '1,50'), + ('CIRCLE (IRLP/Echolink/WIRES) with Six overlaid', '1,60'), + ('CIRCLE (IRLP/Echolink/WIRES) with Seven overlaid', + '1,70'), + ('CIRCLE (IRLP/Echolink/WIRES) with Eight overlaid', + '1,80'), + ('CIRCLE (IRLP/Echolink/WIRES) with Nine overlaid', '1,90'), + ('Allstar Node', '1,A0'), + ('CIRCLE (IRLP/Echolink/WIRES) with Letter B overlaid', + '1,B0'), + ('CIRCLE (IRLP/Echolink/WIRES) with Letter C overlaid', + '1,C0'), + ('CIRCLE (IRLP/Echolink/WIRES) with Letter D overlaid', + '1,D0'), + ('Echolink Node', '1,E0'), + ('CIRCLE (IRLP/Echolink/WIRES) with Letter F overlaid', + '1,F0'), + ('CIRCLE (IRLP/Echolink/WIRES) with Letter G overlaid', + '1,G0'), + ('CIRCLE (IRLP/Echolink/WIRES) with Letter H overlaid', + '1,H0'), + ('IRLP repeater', '1,I0'), + ('CIRCLE (IRLP/Echolink/WIRES) with Letter J overlaid', + '1,J0'), + ('CIRCLE (IRLP/Echolink/WIRES) with Letter K overlaid', + '1,K0'), + ('CIRCLE (IRLP/Echolink/WIRES) with Letter L overlaid', + '1,L0'), + ('CIRCLE (IRLP/Echolink/WIRES) with Letter M overlaid', + '1,M0'), + ('CIRCLE (IRLP/Echolink/WIRES) with Letter N overlaid', + '1,N0'), + ('CIRCLE (IRLP/Echolink/WIRES) with Letter O overlaid', + '1,O0'), + ('CIRCLE (IRLP/Echolink/WIRES) with Letter P overlaid', + '1,P0'), + ('CIRCLE (IRLP/Echolink/WIRES) with Letter Q overlaid', + '1,Q0'), + ('CIRCLE (IRLP/Echolink/WIRES) with Letter R overlaid', + '1,R0'), + ('Staging Area', '1,S0'), + ('CIRCLE (IRLP/Echolink/WIRES) with Letter T overlaid', + '1,T0'), + ('CIRCLE (IRLP/Echolink/WIRES) with Letter U overlaid', + '1,U0'), + ('Echolink and IRLP', '1,V0'), + ('WIRES (Yaesu VOIP)', '1,W0'), + ('CIRCLE (IRLP/Echolink/WIRES) with Letter X overlaid', + '1,X0'), + ('CIRCLE (IRLP/Echolink/WIRES) with Letter Y overlaid', + '1,Y0'), + ('CIRCLE (IRLP/Echolink/WIRES) with Letter Z overlaid', + '1,Z0'), + ('AVAIL', '1,\\1'), + ('AVAIL', '1,\\2'), + ('AVAIL', '1,\\3'), + ('AVAIL', '1,\\4'), + ('AVAIL', '1,\\5'), + ('AVAIL', '1,\\6'), + ('AVAIL', '1,\\7'), + ('802.11 or other network node', '1,\\8'), + ('Gas Station (blue pump)', '1,\\9'), + ('overlayBOX DTMF & RFID & XO', '1,\\A'), + ('overlayBOX DTMF & RFID & XO with Zero overlaid', '1,0A'), + ('overlayBOX DTMF & RFID & XO with One overlaid', '1,1A'), + ('overlayBOX DTMF & RFID & XO with Two overlaid', '1,2A'), + ('overlayBOX DTMF & RFID & XO with Three overlaid', '1,3A'), + ('overlayBOX DTMF & RFID & XO with Four overlaid', '1,4A'), + ('overlayBOX DTMF & RFID & XO with Five overlaid', '1,5A'), + ('overlayBOX DTMF & RFID & XO with Six overlaid', '1,6A'), + ('HT DTMF user', '1,7A'), + ('overlayBOX DTMF & RFID & XO with Eight overlaid', '1,8A'), + ('Mobile DTMF user', '1,9A'), + ('AllStar DTMF report', '1,AA'), + ('overlayBOX DTMF & RFID & XO with Letter B overlaid', + '1,BA'), + ('overlayBOX DTMF & RFID & XO with Letter C overlaid', + '1,CA'), + ('D-Star report', '1,DA'), + ('Echolink DTMF report', '1,EA'), + ('overlayBOX DTMF & RFID & XO with Letter F overlaid', + '1,FA'), + ('overlayBOX DTMF & RFID & XO with Letter G overlaid', + '1,GA'), + ('House DTMF user', '1,HA'), + ('IRLP DTMF report', '1,IA'), + ('overlayBOX DTMF & RFID & XO with Letter J overlaid', + '1,JA'), + ('overlayBOX DTMF & RFID & XO with Letter K overlaid', + '1,KA'), + ('overlayBOX DTMF & RFID & XO with Letter L overlaid', + '1,LA'), + ('overlayBOX DTMF & RFID & XO with Letter M overlaid', + '1,MA'), + ('overlayBOX DTMF & RFID & XO with Letter N overlaid', + '1,NA'), + ('overlayBOX DTMF & RFID & XO with Letter O overlaid', + '1,OA'), + ('overlayBOX DTMF & RFID & XO with Letter P overlaid', + '1,PA'), + ('overlayBOX DTMF & RFID & XO with Letter Q overlaid', + '1,QA'), + ('RFID report', '1,RA'), + ('overlayBOX DTMF & RFID & XO with Letter S overlaid', + '1,SA'), + ('overlayBOX DTMF & RFID & XO with Letter T overlaid', + '1,TA'), + ('overlayBOX DTMF & RFID & XO with Letter U overlaid', + '1,UA'), + ('overlayBOX DTMF & RFID & XO with Letter V overlaid', + '1,VA'), + ('overlayBOX DTMF & RFID & XO with Letter W overlaid', + '1,WA'), + ('OLPC Laptop XO', '1,XA'), + ('overlayBOX DTMF & RFID & XO with Letter Y overlaid', + '1,YA'), + ('overlayBOX DTMF & RFID & XO with Letter Z overlaid', + '1,ZA'), + ('ARRL,ARES,WinLINK,Dstar, etc', '1,\\a'), + ('AVAIL (BlwngSnow ==> E ovly B', '1,\\B'), + ('AVAIL (Blwng Dst/Snd => E ovly)', '1,\\b'), + ('Coast Guard', '1,\\C'), + ('CD triangle RACES/SATERN/etc', '1,\\c'), + ('DX spot by callsign', '1,\\d'), + ("DEPOTS (Drizzle ==> ' ovly D)", '1,\\D A'), + ('Smoke (& other vis codes)', '1,\\E'), + ('Sleet (& future ovrly codes)', '1,\\e'), + ('AVAIL (FrzngRain ==> `F)', '1,\\F'), + ('Funnel Cloud', '1,\\f'), + ('AVAIL (Snow Shwr ==> I ovly S)', '1,\\G'), + ('Gale Flags', '1,\\g'), + ('\\Haze (& Overlay Hazards)', '1,\\H'), + ('Store. or HAMFST Hh=HAM store', '1,\\h'), + ('Rain Shower', '1,\\I'), + ('BOX or points of Interest', '1,\\i'), + ('AVAIL (Lightning ==> I ovly L)', '1,\\J'), + ('WorkZone (Steam Shovel)', '1,\\j'), + ('Kenwood HT (W)', '1,\\K'), + ('Special Vehicle SUV,ATV,4x4', '1,\\k'), + ('Lighthouse', '1,\\L'), + ('Areas (box,circles,etc)', '1,\\l'), + ('MARS (A=Army,N=Navy,F=AF)', '1,\\M'), + ('Value Sign (3 digit display)', '1,\\m'), + ('Navigation Buoy', '1,\\N'), + ('OVERLAY TRIANGLE', '1,\\n'), + ('OVERLAY TRIANGLE with Zero overlaid', '1,0n'), + ('OVERLAY TRIANGLE with One overlaid', '1,1n'), + ('OVERLAY TRIANGLE with Two overlaid', '1,2n'), + ('OVERLAY TRIANGLE with Three overlaid', '1,3n'), + ('OVERLAY TRIANGLE with Four overlaid', '1,4n'), + ('OVERLAY TRIANGLE with Five overlaid', '1,5n'), + ('OVERLAY TRIANGLE with Six overlaid', '1,6n'), + ('OVERLAY TRIANGLE with Seven overlaid', '1,7n'), + ('OVERLAY TRIANGLE with Eight overlaid', '1,8n'), + ('OVERLAY TRIANGLE with Nine overlaid', '1,9n'), + ('OVERLAY TRIANGLE with Letter A overlaid', '1,An'), + ('OVERLAY TRIANGLE with Letter B overlaid', '1,Bn'), + ('OVERLAY TRIANGLE with Letter C overlaid', '1,Cn'), + ('OVERLAY TRIANGLE with Letter D overlaid', '1,Dn'), + ('OVERLAY TRIANGLE with Letter E overlaid', '1,En'), + ('OVERLAY TRIANGLE with Letter F overlaid', '1,Fn'), + ('OVERLAY TRIANGLE with Letter G overlaid', '1,Gn'), + ('OVERLAY TRIANGLE with Letter H overlaid', '1,Hn'), + ('OVERLAY TRIANGLE with Letter I overlaid', '1,In'), + ('OVERLAY TRIANGLE with Letter J overlaid', '1,Jn'), + ('OVERLAY TRIANGLE with Letter K overlaid', '1,Kn'), + ('OVERLAY TRIANGLE with Letter L overlaid', '1,Ln'), + ('OVERLAY TRIANGLE with Letter M overlaid', '1,Mn'), + ('OVERLAY TRIANGLE with Letter N overlaid', '1,Nn'), + ('OVERLAY TRIANGLE with Letter O overlaid', '1,On'), + ('OVERLAY TRIANGLE with Letter P overlaid', '1,Pn'), + ('OVERLAY TRIANGLE with Letter Q overlaid', '1,Qn'), + ('OVERLAY TRIANGLE with Letter R overlaid', '1,Rn'), + ('OVERLAY TRIANGLE with Letter S overlaid', '1,Sn'), + ('OVERLAY TRIANGLE with Letter T overlaid', '1,Tn'), + ('OVERLAY TRIANGLE with Letter U overlaid', '1,Un'), + ('OVERLAY TRIANGLE with Letter V overlaid', '1,Vn'), + ('OVERLAY TRIANGLE with Letter W overlaid', '1,Wn'), + ('OVERLAY TRIANGLE with Letter X overlaid', '1,Xn'), + ('OVERLAY TRIANGLE with Letter Y overlaid', '1,Yn'), + ('OVERLAY TRIANGLE with Letter Z overlaid', '1,Zn'), + ('Overlay Balloon (Rocket = \\O)', '1,\\O'), + ('small circle', '1,\\o'), + ('Parking', '1,\\P'), + ('AVAIL (PrtlyCldy => ( ovly P', '1,\\p'), + ('QUAKE', '1,\\Q'), + ('AVAIL', '1,\\q'), + ('Restaurant', '1,\\R'), + ('Restrooms', '1,\\r'), + ('Satellite/Pacsat', '1,\\S'), + ('OVERLAY SHIP/boats', '1,\\s'), + ('OVERLAY SHIP/boats with Zero overlaid', '1,0s'), + ('OVERLAY SHIP/boats with One overlaid', '1,1s'), + ('OVERLAY SHIP/boats with Two overlaid', '1,2s'), + ('OVERLAY SHIP/boats with Three overlaid', '1,3s'), + ('OVERLAY SHIP/boats with Four overlaid', '1,4s'), + ('OVERLAY SHIP/boats with Five overlaid', '1,5s'), + ('Shipwreck ("deep6")', '1,6s'), + ('OVERLAY SHIP/boats with Seven overlaid', '1,7s'), + ('OVERLAY SHIP/boats with Eight overlaid', '1,8s'), + ('OVERLAY SHIP/boats with Nine overlaid', '1,9s'), + ('OVERLAY SHIP/boats with Letter A overlaid', '1,As'), + ('Pleasure Boat', '1,Bs'), + ('Cargo', '1,Cs'), + ('Diving', '1,Ds'), + ('Emergency or Medical transport', '1,Es'), + ('Fishing', '1,Fs'), + ('OVERLAY SHIP/boats with Letter G overlaid', '1,Gs'), + ('High-speed Craft', '1,Hs'), + ('OVERLAY SHIP/boats with Letter I overlaid', '1,Is'), + ('Jet Ski', '1,Js'), + ('OVERLAY SHIP/boats with Letter K overlaid', '1,Ks'), + ('Law enforcement', '1,Ls'), + ('Miltary', '1,Ms'), + ('OVERLAY SHIP/boats with Letter N overlaid', '1,Ns'), + ('Oil Rig', '1,Os'), + ('Pilot Boat', '1,Ps'), + ('Torpedo', '1,Qs'), + ('OVERLAY SHIP/boats with Letter R overlaid', '1,Rs'), + ('Search and Rescue', '1,Ss'), + ('Tug', '1,Ts'), + ('Underwater ops or submarine', '1,Us'), + ('OVERLAY SHIP/boats with Letter V overlaid', '1,Vs'), + ('Wing-in-Ground effect (or Hovercraft)', '1,Ws'), + ('Passenger (paX)(ferry)', '1,Xs'), + ('Sailing (large ship)', '1,Ys'), + ('OVERLAY SHIP/boats with Letter Z overlaid', '1,Zs'), + ('Thunderstorm', '1,\\T'), + ('Tornado', '1,\\t'), + ('SUNNY', '1,\\U'), + ('OVERLAYED TRUCK', '1,\\u'), + ('OVERLAYED TRUCK with Zero overlaid', '1,0u'), + ('OVERLAYED TRUCK with One overlaid', '1,1u'), + ('OVERLAYED TRUCK with Two overlaid', '1,2u'), + ('OVERLAYED TRUCK with Three overlaid', '1,3u'), + ('OVERLAYED TRUCK with Four overlaid', '1,4u'), + ('OVERLAYED TRUCK with Five overlaid', '1,5u'), + ('OVERLAYED TRUCK with Six overlaid', '1,6u'), + ('OVERLAYED TRUCK with Seven overlaid', '1,7u'), + ('OVERLAYED TRUCK with Eight overlaid', '1,8u'), + ('OVERLAYED TRUCK with Nine overlaid', '1,9u'), + ('OVERLAYED TRUCK with Letter A overlaid', '1,Au'), + ('Buldozer/construction/Backhoe', '1,Bu'), + ('Chlorine Tanker', '1,Cu'), + ('OVERLAYED TRUCK with Letter D overlaid', '1,Du'), + ('OVERLAYED TRUCK with Letter E overlaid', '1,Eu'), + ('OVERLAYED TRUCK with Letter F overlaid', '1,Fu'), + ('Gas', '1,Gu'), + ('Hazardous', '1,Hu'), + ('OVERLAYED TRUCK with Letter I overlaid', '1,Iu'), + ('OVERLAYED TRUCK with Letter J overlaid', '1,Ju'), + ('OVERLAYED TRUCK with Letter K overlaid', '1,Ku'), + ('OVERLAYED TRUCK with Letter L overlaid', '1,Lu'), + ('OVERLAYED TRUCK with Letter M overlaid', '1,Mu'), + ('OVERLAYED TRUCK with Letter N overlaid', '1,Nu'), + ('OVERLAYED TRUCK with Letter O overlaid', '1,Ou'), + ('Plow or SnowPlow', '1,Pu'), + ('OVERLAYED TRUCK with Letter Q overlaid', '1,Qu'), + ('OVERLAYED TRUCK with Letter R overlaid', '1,Ru'), + ('OVERLAYED TRUCK with Letter S overlaid', '1,Su'), + ('Tanker', '1,Tu'), + ('OVERLAYED TRUCK with Letter U overlaid', '1,Uu'), + ('OVERLAYED TRUCK with Letter V overlaid', '1,Vu'), + ('OVERLAYED TRUCK with Letter W overlaid', '1,Wu'), + ('OVERLAYED TRUCK with Letter X overlaid', '1,Xu'), + ('OVERLAYED TRUCK with Letter Y overlaid', '1,Yu'), + ('OVERLAYED TRUCK with Letter Z overlaid', '1,Zu'), + ('VORTAC Nav Aid', '1,\\V'), + ('OVERLAYED Van', '1,\\v'), + ('OVERLAYED Van with Zero overlaid', '1,0v'), + ('OVERLAYED Van with One overlaid', '1,1v'), + ('OVERLAYED Van with Two overlaid', '1,2v'), + ('OVERLAYED Van with Three overlaid', '1,3v'), + ('OVERLAYED Van with Four overlaid', '1,4v'), + ('OVERLAYED Van with Five overlaid', '1,5v'), + ('OVERLAYED Van with Six overlaid', '1,6v'), + ('OVERLAYED Van with Seven overlaid', '1,7v'), + ('OVERLAYED Van with Eight overlaid', '1,8v'), + ('OVERLAYED Van with Nine overlaid', '1,9v'), + ('OVERLAYED Van with Letter A overlaid', '1,Av'), + ('OVERLAYED Van with Letter B overlaid', '1,Bv'), + ('OVERLAYED Van with Letter C overlaid', '1,Cv'), + ('OVERLAYED Van with Letter D overlaid', '1,Dv'), + ('OVERLAYED Van with Letter E overlaid', '1,Ev'), + ('OVERLAYED Van with Letter F overlaid', '1,Fv'), + ('OVERLAYED Van with Letter G overlaid', '1,Gv'), + ('OVERLAYED Van with Letter H overlaid', '1,Hv'), + ('OVERLAYED Van with Letter I overlaid', '1,Iv'), + ('OVERLAYED Van with Letter J overlaid', '1,Jv'), + ('OVERLAYED Van with Letter K overlaid', '1,Kv'), + ('OVERLAYED Van with Letter L overlaid', '1,Lv'), + ('OVERLAYED Van with Letter M overlaid', '1,Mv'), + ('OVERLAYED Van with Letter N overlaid', '1,Nv'), + ('OVERLAYED Van with Letter O overlaid', '1,Ov'), + ('OVERLAYED Van with Letter P overlaid', '1,Pv'), + ('OVERLAYED Van with Letter Q overlaid', '1,Qv'), + ('OVERLAYED Van with Letter R overlaid', '1,Rv'), + ('OVERLAYED Van with Letter S overlaid', '1,Sv'), + ('OVERLAYED Van with Letter T overlaid', '1,Tv'), + ('OVERLAYED Van with Letter U overlaid', '1,Uv'), + ('OVERLAYED Van with Letter V overlaid', '1,Vv'), + ('OVERLAYED Van with Letter W overlaid', '1,Wv'), + ('OVERLAYED Van with Letter X overlaid', '1,Xv'), + ('OVERLAYED Van with Letter Y overlaid', '1,Yv'), + ('OVERLAYED Van with Letter Z overlaid', '1,Zv'), + ('# NWS site (NWS options)', '1,\\W'), + ('# NWS site (NWS options) with Zero overlaid', '1,0W'), + ('# NWS site (NWS options) with One overlaid', '1,1W'), + ('# NWS site (NWS options) with Two overlaid', '1,2W'), + ('# NWS site (NWS options) with Three overlaid', '1,3W'), + ('# NWS site (NWS options) with Four overlaid', '1,4W'), + ('# NWS site (NWS options) with Five overlaid', '1,5W'), + ('# NWS site (NWS options) with Six overlaid', '1,6W'), + ('# NWS site (NWS options) with Seven overlaid', '1,7W'), + ('# NWS site (NWS options) with Eight overlaid', '1,8W'), + ('# NWS site (NWS options) with Nine overlaid', '1,9W'), + ('# NWS site (NWS options) with Letter A overlaid', '1,AW'), + ('# NWS site (NWS options) with Letter B overlaid', '1,BW'), + ('# NWS site (NWS options) with Letter C overlaid', '1,CW'), + ('# NWS site (NWS options) with Letter D overlaid', '1,DW'), + ('# NWS site (NWS options) with Letter E overlaid', '1,EW'), + ('# NWS site (NWS options) with Letter F overlaid', '1,FW'), + ('# NWS site (NWS options) with Letter G overlaid', '1,GW'), + ('# NWS site (NWS options) with Letter H overlaid', '1,HW'), + ('# NWS site (NWS options) with Letter I overlaid', '1,IW'), + ('# NWS site (NWS options) with Letter J overlaid', '1,JW'), + ('# NWS site (NWS options) with Letter K overlaid', '1,KW'), + ('# NWS site (NWS options) with Letter L overlaid', '1,LW'), + ('# NWS site (NWS options) with Letter M overlaid', '1,MW'), + ('# NWS site (NWS options) with Letter N overlaid', '1,NW'), + ('# NWS site (NWS options) with Letter O overlaid', '1,OW'), + ('# NWS site (NWS options) with Letter P overlaid', '1,PW'), + ('# NWS site (NWS options) with Letter Q overlaid', '1,QW'), + ('# NWS site (NWS options) with Letter R overlaid', '1,RW'), + ('# NWS site (NWS options) with Letter S overlaid', '1,SW'), + ('# NWS site (NWS options) with Letter T overlaid', '1,TW'), + ('# NWS site (NWS options) with Letter U overlaid', '1,UW'), + ('# NWS site (NWS options) with Letter V overlaid', '1,VW'), + ('# NWS site (NWS options) with Letter W overlaid', '1,WW'), + ('# NWS site (NWS options) with Letter X overlaid', '1,XW'), + ('# NWS site (NWS options) with Letter Y overlaid', '1,YW'), + ('# NWS site (NWS options) with Letter Z overlaid', '1,ZW'), + ('Flooding (Avalanches/Slides)', '1,\\w'), + ('Pharmacy Rx (Apothecary)', '1,\\X'), + ('Wreck or Obstruction ->X<-', '1,\\x'), + ('Radios and devices', '1,\\Y'), + ('Skywarn', '1,\\y'), + ('AVAIL', '1,\\Z'), + ('OVERLAYED Shelter', '1,\\z')) + _SETTINGS = { + "DS": {'type': 'list', + 'values': ("Data Band", "Both Bands", "Ignore DCD")}, + "DSPA": {'type': 'list', + 'values': ("Entire Display", "One Line")}, + "ICO": {'type': 'map', + 'map': (KenwoodD7Family._COMMON_SETTINGS["ICO"]["map"] + + _APRS_EXTRA)}} + + _SETTINGS_MENUS = ( + ('Main', + (("ASC 0", "Automatic Simplex Check Band A"), + ("ASC 1", "Automatic Simplex Check Band B"), + ("BAL", "Balance"), + ("BC", "Band"), + ("BEL 0", "Tone Alert Band A"), + ("BEL 1", "Tone Alert Band B"), + ("CH", "Channel Mode Display"), + ("DL", "Dual"), + ("LK", "Lock"), + ("LMP", "Lamp"), + # MNF requires that the *current* VFO be in MR mode + # Also, it has a direct key + # ("MNF", "Memory Display Mode"), + ("PV", "Programmable VFOs"), + ("SQ 0", "Band A Squelch"), + ("SQ 1", "Band B Squelch"), + # We likely don't want to enable this from Chirp... + # ("TNC", "Packet Mode"))), + )), + ('Radio', + (('Display', + (("MES", "Power-ON Message"), + ("CNT", "Contrast"))), + ('Save', + (("SV", "Battery Saver Interval"), + ("APO", "Automatic Power Off (APO)"))), + ('DTMF', + (("dtmfmem 00", "Number Store #0"), + ("dtmfmem 01", "Number Store #1"), + ("dtmfmem 02", "Number Store #2"), + ("dtmfmem 03", "Number Store #3"), + ("dtmfmem 04", "Number Store #4"), + ("dtmfmem 05", "Number Store #5"), + ("dtmfmem 06", "Number Store #6"), + ("dtmfmem 07", "Number Store #7"), + ("dtmfmem 08", "Number Store #8"), + ("dtmfmem 09", "Number Store #9"), + ("TSP", "TX Speed"), + ("TXH", "TX Hold"), + ("PT", "Pause"))), + ('TNC', + (("DTB", "Data band select"), + ("DS", "DCD sense"))), + ('AUX', + (("ARO", "Automatic Repeater Offset"), + ("SCR", "Scan Resume"), + ("BEP", "Key Beep"), + ("ELK", "Tuning Enable"), + ("TXS", "TX Inhibit"), + ("AIP", "Advanced Intercept Point"), + ("CKEY", "Call Key function"), + ("TH", "TX Hold, 1750 Hz"))))), + ('APRS', + (("MYC", "My call sign"), + ("GU", "GPS receiver"), + ("WAY", "Waypoint"), + ("MP 1", "My position #1"), + ("MP 2", "My position #2"), + ("MP 3", "My position #3"), + ("PAMB", "Position Ambiguity"), + ("POSC", "Position comment"), + ("ARL", "Reception restriction distance"), + ("ICO", "Station icon"), + ("STAT 1", "Status text #1"), + ("STAT 2", "Status text #2"), + ("STAT 3", "Status text #3"), + ("STXR", "Status text transmit rate"), + ("PP", "Packet path"), + ("DTX", "Packet transmit method"), + ("TXI", "Packet transmit interval"), + ("UPR", "Group code"), + ("BEPT", "Beep"), + ("DSPA", "Display area"), + ("KILO", "Unit for distance"), + ("TEMP", "Unit for temperature"), + ("AMR", "Auto Answer Reply"), + ("ARLM", "Reply message"), + ("AMGG", "Message group"), + ("DTBA", "Data band"), + ("PKSA", "Packet transfer rate"), + ("TZ", "Time Zone"), + ("TXD", "Packet transmit delay"))), + ('SSTV', + (("SMY", "My call sign"), + ("MAC", "Color for call sign"), + ("SMSG", "Message"), + ("SMC", "Color for message"), + ("RSV", "RSV report"), + ("RSC", "Color for RSV report"), + ("VCS", "VC-H1 Control"))), + ('SkyCommand', + (("SCC", "Commander call sign"), + ("SCT", "Transporter call sign"), + ("SKTN", "Tone frequency select")))) + + +@directory.register +class TMD700Radio(KenwoodD7Family): + """Kenwood TH-D700""" + MODEL = "TM-D700" + HARDWARE_FLOW = True + + # Details taken from https://www.qsl.net/k7jar/pages/D700Cmds.html + # And https://www.qsl.net/k/kb9rku/aprs/ (continued on next line) + # PC%20Command%20Specifications%20for%20TM-D700_Rev1.pdf + _BAUDS = [57600, 38400, 19200, 9600] + _LOWER = 1 + _UPPER = 200 + + _BOOL = {'type': 'bool'} + _PKEY_FUNCTION = {'type': 'list', + 'values': ('Power', 'A/B', 'Monitor', 'Enter', 'Voice', + '1750', 'PM', 'Menu', 'VFO', 'MR', 'CALL', + 'MHz', 'Tone', 'Rev', 'Low', 'Mute', 'Ctrl', + 'PM.In', 'A.B.C', 'M>V', 'M.In', 'C.In', + 'Lock', 'T.Sel', 'Shift', 'Step', 'Visual', + 'Dim', 'Sub-Band Select', 'DX', 'TNC', 'List', + 'P.Mon', 'BCon', 'Msg', 'Pos')} + _VOLUME = {'type': 'list', + 'values': ('Off', '1', '2', '3', '4', '5', '6', 'Maximum')} + _SETTINGS = { + "ABLG": {'type': 'string', 'max_len': 29}, + "AD": _BOOL, + "BEP": {'type': 'list', + 'values': ("Off", "Key")}, + "BVOL": _VOLUME, + "CP": {'type': 'list', + 'values': ('9600bps', '19200bps', '38400bps', '57600bps')}, + "DATP": {'type': 'list', + 'values': ('1200bps', '9600bps')}, + "DIG": _BOOL, + "DTM": _BOOL, + "FUNC": {'type': 'map', + 'map': (("Mode 1", "1"), ("Mode 2", "2"), ("Mode 3", "3"))}, + "ICO": {'type': 'map', + 'map': (KenwoodD7Family._COMMON_SETTINGS["ICO"]["map"] + + (('Digipeater', '0,F'),) + + THD7GRadio._APRS_EXTRA)}, + "MCL 0": _BOOL, + "MCL 1": _BOOL, + "MCNT": _BOOL, + "MD": {'type': 'list', 'values': ('FM', 'AM')}, + "NP": _BOOL, + "OS": {'type': 'integer', 'min': -99999999, 'max': 999999999, + 'digits': 9}, + "PF 1": _PKEY_FUNCTION, + "PF 2": _PKEY_FUNCTION, + "PF 3": _PKEY_FUNCTION, + "PF 4": _PKEY_FUNCTION, + "PMM": _BOOL, + "RCA": _BOOL, + "RC": _BOOL, + "RCC": {'type': 'integer', 'min': 0, 'max': 999}, + "REP": {'type': 'list', + 'values': ('Off', 'Locked-Band', 'Cross-Band')}, + "REPL": _BOOL, + "SHT": {'type': 'list', + 'values': ('Off', '125ms', '250ms', '500ms')}, + "SSEL": {'type': 'map', + 'map': (("MODE1", "1"), ("MODE2", "2"))}, + "SSQ 0": _BOOL, + "SSQ 1": _BOOL, + "TOT": {'type': 'list', + 'values': ('3 minutes', '5 minutes', '10 minutes')}, + "UDIG": {'type': 'string', 'max_len': 39, 'charset': '0123456789' + 'ABCDEFGHIJKLMNOPQRSTUVWXYZ,-'}, + "VOM": {'type': 'list', + 'values': ('Off', 'English', 'APRS only', 'Japanese')}, + "VS3": _VOLUME, + "VSM": {'type': 'map', + 'map': (('31 Channels', '1'), ('61 Channels', '2'), + ('91 Channels', '3'), ('181 Channels', '4'))}} + + _PROGRAMMABLE_VFOS = ( + ("Band A 118 MHz Sub-Band", 1, 118, 135), + ("Band A VHF Sub-Band", 2, 136, 199), + ("Band B VHF Sub-Band", 3, 136, 174), + ("Band A 220 MHz Sub-Band", 4, 200, 299), + ("Band B 300 MHz Sub-Band", 5, 300, 399), + ("Band A 300 MHz Sub-Band", 6, 300, 399), + ("Band B UHF Sub-Band", 7, 400, 523), + ("Band A UHF Sub-Band", 8, 400, 469), + ("Band B 1.2 GHz Sub-Band", 9, 800, 1299)) + + _SETTINGS_MENUS = ( + ('Main', + (("ASC 0", "Automatic Simplex Check Band A"), + ("ASC 1", "Automatic Simplex Check Band B"), + ("DL", "Dual"), + ("LK", "Lock"), + # MNF requires that the *current* VFO be in MR mode + # ("MNF", "Memory Display Mode"), + # We likely don't want to enable this from Chirp... + # ("TNC", "Packet Mode"))), + )), + ('Radio', + (('Display', + (("MES", "Power-ON Message"), + ("CNT", "Contrast"), + ("NP", "Reverse mode"), + ("AD", "Auto Dimmer Change"), + ("FUNC", "Multi-function button"))), + ('Audio', + (("BVOL", "Beep volume"), + ("BEP", "Key Beep"), + ("SSEL", "Speaker configuration"), + ("VOM", "Voice Synthesizer"), + ("VS3", "Voice volume"))), + ('TX/RX', + (("PV", "Programmable VFO"), + ("SSQ 0", "Band A S-meter Squelch"), + ("SSQ 1", "Band B S-meter Squelch"), + ("SHT", "Squelch hang time"), + ("MD", "FM / AM mode"), + ("AIP", "Advanced Intercept Point"), + ("XXX", "TX/ RX deviation"))), + ('Memory', + (("PMM", "Auto PM Channel Store"), + ("CH", "Channel Display"), + ("MCL 0", "Band A Memory Channel Lockout"), + ("MCL 1", "Band B Memory Channel Lockout"), + ("XXX", "Memory channel name"))), + ('DTMF', + (("dtmfmem 00", "Number Store #0"), + ("dtmfmem 01", "Number Store #1"), + ("dtmfmem 02", "Number Store #2"), + ("dtmfmem 03", "Number Store #3"), + ("dtmfmem 04", "Number Store #4"), + ("dtmfmem 05", "Number Store #5"), + ("dtmfmem 06", "Number Store #6"), + ("dtmfmem 07", "Number Store #7"), + ("dtmfmem 08", "Number Store #8"), + ("dtmfmem 09", "Number Store #9"), + ("TSP", "TX Speed"), + ("PT", "Pause"))), + ('TNC', + (("DTB", "Data band"), + ("DS", "DCD sense"), + ("XXX", "Time"), + ("XXX", "Date"), + ("TZ", "Time zone"))), + ('Repeater', + (("OS", "Offset frequency"), + ("ARO", "Automatic Repeater Offset"), + ("CKEY", "Call Button Function"), + ("TH", "TX Hold"), + ("REPH", "Repeater Hold"), + ("REP", "Repeater function"))), + ('Mic', + (("PF 1", "Mic PF Key"), + ("PF 2", "Mic MR Key"), + ("PF 3", "Mic VFO Key"), + ("PF 4", "Mic CALL Key"), + ("MCNT", "Microphone Control"), + ("DTM", "DTMF Monitor"))), + ('Aux', + (("SCR", "Scan Resume"), + ("VSM", "Number of Channels for Visual Scan"), + ("APO", "Automatic Power Off (APO)"), + ("TOT", "Time-Out Timer (TOT)"), + ("CP", "COM port"), + ("DATP", "Data port"))), + ('Remote Control', + (("RCC", "Secret code"), + ("RCA", "Acknowledgement"), + ("RC", "Remote Control"))))), + ('SSTV', + (("SMY", "My call sign"), + ("MAC", "Color for call sign"), + ("SMSG", "Message"), + ("SMC", "Color for message"), + ("RSV", "RSV report"), + ("RSC", "Color for RSV report"), + ("VCS", "VC-H1 Control"))), + ('APRS', + (("MYC", "My call sign"), + ("GU", "GPS receiver"), + ("WAY", "Waypoint"), + ("MP 1", "My position #1"), + ("MP 2", "My position #2"), + ("MP 3", "My position #3"), + ("PAMB", "Position Ambiguity"), + ("POSC", "Position comment"), + ("ARL", "Reception restriction distance"), + ("ICO", "Station icon"), + ("STAT 1", "Status text #1"), + ("STAT 2", "Status text #2"), + ("STAT 3", "Status text #3"), + ("STXR", "Status text transmit rate"), + ("PP", "Packet path"), + ("DTX", "Packet transmit method"), + ("TXI", "Packet transmit interval"), + ("UPR", "Group code"), + ("BEPT", "Beep"), + ("KILO", "Unit for distance"), + ("TEMP", "Unit for temperature"), + ("DTBA", "Data band"), + ("PKSA", "Packet transfer rate"), + ("DIG", "Digipeater"), + ("UDIG", "Digipeating path"), + ("AMR", "Auto Answer Reply"), + ("ARLM", "Reply message"), + ("ABLG", "Bulletin group"))), + ('SkyCommand', + (("SCC", "Commander call sign"), + ("SCT", "Transporter call sign"), + ("SKTN", "Tone frequency select")))) + + # Apparently, when sent "CH 1", the radio will return "SM 0,00" + # which is the current value of the Band A S-Meter. We'll ignore that + # and read the next line (which is hopefully "CH 1") + def _keep_reading(self, result): + if result[0:3] == 'SM ': + return True + return False + + # It also seems that "CH 1" can return "N" when the current memory + # is invalid (but still enters CH mode) + def _kenwood_set_success(self, cmd, modcmd, value, response): + if cmd == 'CH' and value == "1": + if response == 'N': + return True + return super()._kenwood_set_success(cmd, modcmd, value, response) + + def _mem_spec_fixup(self, spec, memid, mem): + spec[6] = "%i" % (mem.tmode == "DTCS") + spec[8] = "%03i0" % (chirp_common.DTCS_CODES.index(mem.dtcs) + 1) + + def _parse_mem_fixup(self, mem, spec): + if spec[11] and spec[11].isdigit(): + mem.dtcs = chirp_common.DTCS_CODES[int(spec[11][:-1]) - 1] + else: + LOG.warn("Unknown or invalid DCS: %s" % spec[11]) + + def get_features(self, *args, **kwargs): + rf = super().get_features(*args, **kwargs) + rf.has_dtcs = True + rf.valid_tmodes = ["", "Tone", "TSQL", "DTCS"] + return rf diff --git a/chirp/drivers/kenwood_itm.py b/chirp/drivers/kenwood_itm.py index dd7fc24..cf98f07 100644 --- a/chirp/drivers/kenwood_itm.py +++ b/chirp/drivers/kenwood_itm.py @@ -85,7 +85,7 @@ class ITMRadio(generic_csv.CSVRadio): self._blank() - f = file(self._filename, "r") + f = open(self._filename, "r") for line in f: if line.strip() == "// Conventional Data": break diff --git a/chirp/drivers/kenwood_live.py b/chirp/drivers/kenwood_live.py index 07c035f..9e3db3f 100644 --- a/chirp/drivers/kenwood_live.py +++ b/chirp/drivers/kenwood_live.py @@ -78,12 +78,12 @@ def _command(ser, cmd, *args): cmd += LAST_DELIMITER[0] LOG.debug("PC->RADIO: %s" % cmd.strip()) - ser.write(cmd.encode()) + ser.write(cmd.encode('cp1252')) result = "" while not result.endswith(LAST_DELIMITER[0]): - result += ser.read(COMMAND_RESP_BUFSIZE).decode() - if (time.time() - start) > 0.5: + result += ser.read(COMMAND_RESP_BUFSIZE).decode('cp1252') + if (time.time() - start) > 1: # TXH sometimes takes longer on TH-D7G LOG.error("Timeout waiting for data") break @@ -126,10 +126,10 @@ def get_id(ser): resp = command(ser, "ID") except UnicodeDecodeError: # If we got binary here, we are using the wrong rate - # or not talking to a kenwood live radio. + # or not talking to a Kenwood live radio. continue - # most kenwood radios + # most Kenwood radios if " " in resp: LAST_BAUD = i return resp.split(" ")[1] @@ -169,11 +169,14 @@ def iserr(result): class KenwoodLiveRadio(chirp_common.LiveRadio): - """Base class for all live-mode kenwood radios""" + """Base class for all live-mode Kenwood radios""" BAUD_RATE = 9600 VENDOR = "Kenwood" MODEL = "" NEEDS_COMPAT_SERIAL = False + # Lots of Kenwood radios actually require RTS, even some of the ones with + # USB integrated + HARDWARE_FLOW = True _vfo = 0 _upper = 200 @@ -286,7 +289,7 @@ class KenwoodLiveRadio(chirp_common.LiveRadio): memory.name)) if not iserr(r2): memory.name = memory.name.rstrip() - self._memcache[memory.number] = memory + self._memcache[memory.number] = memory.dupe() else: raise errors.InvalidDataError("Radio refused name %i: %s" % (memory.number, @@ -388,312 +391,6 @@ class KenwoodOldLiveRadio(KenwoodLiveRadio): return KenwoodLiveRadio.set_memory(self, memory) -@directory.register -class THD7Radio(KenwoodOldLiveRadio): - """Kenwood TH-D7""" - MODEL = "TH-D7" - - _kenwood_split = True - - _BEP_OPTIONS = ["Off", "Key", "Key+Data", "All"] - _POSC_OPTIONS = ["Off Duty", "Enroute", "In Service", "Returning", - "Committed", "Special", "Priority", "Emergency"] - - _SETTINGS_OPTIONS = { - "BAL": ["4:0", "3:1", "2:2", "1:3", "0:4"], - "BEP": None, - "BEPT": ["Off", "Mine", "All New"], # D700 has fourth "All" - "DS": ["Data Band", "Both Bands"], - "DTB": ["A", "B"], - "DTBA": ["A", "B", "A:TX/B:RX"], # D700 has fourth A:RX/B:TX - "DTX": ["Manual", "PTT", "Auto"], - "ICO": ["Kenwood", "Runner", "House", "Tent", "Boat", "SSTV", - "Plane", "Speedboat", "Car", "Bicycle"], - "MNF": ["Name", "Frequency"], - "PKSA": ["1200", "9600"], - "POSC": None, - "PT": ["100ms", "200ms", "500ms", "750ms", - "1000ms", "1500ms", "2000ms"], - "SCR": ["Time", "Carrier", "Seek"], - "SV": ["Off", "0.2s", "0.4s", "0.6s", "0.8s", "1.0s", - "2s", "3s", "4s", "5s"], - "TEMP": ["F", "C"], - "TXI": ["30sec", "1min", "2min", "3min", "4min", "5min", - "10min", "20min", "30min"], - "UNIT": ["English", "Metric"], - "WAY": ["Off", "6 digit NMEA", "7 digit NMEA", "8 digit NMEA", - "9 digit NMEA", "6 digit Magellan", "DGPS"], - } - - def get_features(self): - rf = chirp_common.RadioFeatures() - rf.has_settings = True - rf.has_dtcs = False - rf.has_dtcs_polarity = False - rf.has_bank = False - rf.has_mode = True - rf.has_tuning_step = False - rf.can_odd_split = True - rf.valid_duplexes = ["", "-", "+", "split"] - rf.valid_modes = list(MODES.values()) - rf.valid_tmodes = ["", "Tone", "TSQL"] - rf.valid_characters = \ - chirp_common.CHARSET_ALPHANUMERIC + "/.-+*)('&%$#! ~}|{" - rf.valid_name_length = 7 - rf.valid_tuning_steps = STEPS - rf.memory_bounds = (1, self._upper) - return rf - - def _make_mem_spec(self, mem): - if mem.duplex in " -+": - duplex = util.get_dict_rev(DUPLEX, mem.duplex) - offset = mem.offset - else: - duplex = 0 - offset = 0 - - spec = ( - "%011i" % mem.freq, - "%X" % STEPS.index(mem.tuning_step), - "%i" % duplex, - "0", - "%i" % (mem.tmode == "Tone"), - "%i" % (mem.tmode == "TSQL"), - "", # DCS Flag - "%02i" % (self._kenwood_valid_tones.index(mem.rtone) + 1), - "", # DCS Code - "%02i" % (self._kenwood_valid_tones.index(mem.ctone) + 1), - "%09i" % offset, - "%i" % util.get_dict_rev(MODES, mem.mode), - "%i" % ((mem.skip == "S") and 1 or 0)) - - return spec - - def _parse_mem_spec(self, spec): - mem = chirp_common.Memory() - - mem.number = int(spec[2]) - mem.freq = int(spec[3], 10) - mem.tuning_step = STEPS[int(spec[4], 16)] - mem.duplex = DUPLEX[int(spec[5])] - mem.tmode = get_tmode(spec[7], spec[8], spec[9]) - mem.rtone = self._kenwood_valid_tones[int(spec[10]) - 1] - mem.ctone = self._kenwood_valid_tones[int(spec[12]) - 1] - if spec[11] and spec[11].isdigit(): - mem.dtcs = chirp_common.DTCS_CODES[int(spec[11][:-1]) - 1] - else: - LOG.warn("Unknown or invalid DCS: %s" % spec[11]) - if spec[13]: - mem.offset = int(spec[13]) - else: - mem.offset = 0 - mem.mode = MODES[int(spec[14])] - mem.skip = int(spec[15]) and "S" or "" - - return mem - - EXTRA_BOOL_SETTINGS = { - 'main': [("LMP", "Lamp")], - 'dtmf': [("TXH", "TX Hold")], - } - EXTRA_LIST_SETTINGS = { - 'main': [("BAL", "Balance"), - ("MNF", "Memory Display Mode")], - 'save': [("SV", "Battery Save")], - } - - def _get_setting_options(self, setting): - opts = self._SETTINGS_OPTIONS[setting] - if opts is None: - opts = getattr(self, '_%s_OPTIONS' % setting) - return opts - - def get_settings(self): - main = RadioSettingGroup("main", "Main") - aux = RadioSettingGroup("aux", "Aux") - tnc = RadioSettingGroup("tnc", "TNC") - save = RadioSettingGroup("save", "Save") - display = RadioSettingGroup("display", "Display") - dtmf = RadioSettingGroup("dtmf", "DTMF") - radio = RadioSettingGroup("radio", "Radio", - aux, tnc, save, display, dtmf) - sky = RadioSettingGroup("sky", "SkyCommand") - aprs = RadioSettingGroup("aprs", "APRS") - - top = RadioSettings(main, radio, aprs, sky) - - bools = [("AMR", aprs, "APRS Message Auto-Reply"), - ("AIP", aux, "Advanced Intercept Point"), - ("ARO", aux, "Automatic Repeater Offset"), - ("BCN", aprs, "Beacon"), - ("CH", radio, "Channel Mode Display"), - # ("DIG", aprs, "APRS Digipeater"), - ("DL", main, "Dual"), - ("LK", main, "Lock"), - ("TSP", dtmf, "DTMF Fast Transmission"), - ] - - for setting, group, name in bools: - value = self._kenwood_get_bool(setting) - rs = RadioSetting(setting, name, - RadioSettingValueBoolean(value)) - group.append(rs) - - lists = [("BEP", aux, "Beep"), - ("BEPT", aprs, "APRS Beep"), - ("DS", tnc, "Data Sense"), - ("DTB", tnc, "Data Band"), - ("DTBA", aprs, "APRS Data Band"), - ("DTX", aprs, "APRS Data TX"), - # ("ICO", aprs, "APRS Icon"), - ("PKSA", aprs, "APRS Packet Speed"), - ("POSC", aprs, "APRS Position Comment"), - ("PT", dtmf, "DTMF Speed"), - ("TEMP", aprs, "APRS Temperature Units"), - ("TXI", aprs, "APRS Transmit Interval"), - # ("UNIT", aprs, "APRS Display Units"), - ("WAY", aprs, "Waypoint Mode"), - ] - - for setting, group, name in lists: - value = self._kenwood_get_int(setting) - options = self._get_setting_options(setting) - rs = RadioSetting(setting, name, - RadioSettingValueList(options, - options[value])) - group.append(rs) - - for group_name, settings in self.EXTRA_BOOL_SETTINGS.items(): - group = locals()[group_name] - for setting, name in settings: - value = self._kenwood_get_bool(setting) - rs = RadioSetting(setting, name, - RadioSettingValueBoolean(value)) - group.append(rs) - - for group_name, settings in self.EXTRA_LIST_SETTINGS.items(): - group = locals()[group_name] - for setting, name in settings: - value = self._kenwood_get_int(setting) - options = self._get_setting_options(setting) - rs = RadioSetting(setting, name, - RadioSettingValueBoolean(value)) - group.append(rs) - - ints = [("CNT", display, "Contrast", 1, 16), - ] - for setting, group, name, minv, maxv in ints: - value = self._kenwood_get_int(setting) - rs = RadioSetting(setting, name, - RadioSettingValueInteger(minv, maxv, value)) - group.append(rs) - - strings = [("MES", display, "Power-on Message", 8), - ("MYC", aprs, "APRS Callsign", 8), - ("PP", aprs, "APRS Path", 32), - ("SCC", sky, "SkyCommand Callsign", 8), - ("SCT", sky, "SkyCommand To Callsign", 8), - # ("STAT", aprs, "APRS Status Text", 32), - ] - for setting, group, name, length in strings: - _cmd, value = self._kenwood_get(setting) - rs = RadioSetting(setting, name, - RadioSettingValueString(0, length, value)) - group.append(rs) - - return top - - -@directory.register -class THD7GRadio(THD7Radio): - """Kenwood TH-D7G""" - MODEL = "TH-D7G" - - def get_features(self): - rf = super(THD7GRadio, self).get_features() - rf.valid_name_length = 8 - return rf - - -@directory.register -class TMD700Radio(THD7Radio): - """Kenwood TH-D700""" - MODEL = "TM-D700" - - _kenwood_split = True - - _BEP_OPTIONS = ["Off", "Key"] - _POSC_OPTIONS = ["Off Duty", "Enroute", "In Service", "Returning", - "Committed", "Special", "Priority", "CUSTOM 0", - "CUSTOM 1", "CUSTOM 2", "CUSTOM 4", "CUSTOM 5", - "CUSTOM 6", "Emergency"] - EXTRA_BOOL_SETTINGS = {} - EXTRA_LIST_SETTINGS = {} - - def get_features(self): - rf = chirp_common.RadioFeatures() - rf.has_settings = True - rf.has_dtcs = True - rf.has_dtcs_polarity = False - rf.has_bank = False - rf.has_mode = True - rf.has_tuning_step = False - rf.can_odd_split = True - rf.valid_duplexes = ["", "-", "+", "split"] - rf.valid_modes = ["FM", "AM"] - rf.valid_tmodes = ["", "Tone", "TSQL", "DTCS"] - rf.valid_characters = chirp_common.CHARSET_ALPHANUMERIC - rf.valid_name_length = 8 - rf.valid_tuning_steps = STEPS - rf.memory_bounds = (1, self._upper) - return rf - - def _make_mem_spec(self, mem): - if mem.duplex in " -+": - duplex = util.get_dict_rev(DUPLEX, mem.duplex) - else: - duplex = 0 - spec = ( - "%011i" % mem.freq, - "%X" % STEPS.index(mem.tuning_step), - "%i" % duplex, - "0", - "%i" % (mem.tmode == "Tone"), - "%i" % (mem.tmode == "TSQL"), - "%i" % (mem.tmode == "DTCS"), - "%02i" % (self._kenwood_valid_tones.index(mem.rtone) + 1), - "%03i0" % (chirp_common.DTCS_CODES.index(mem.dtcs) + 1), - "%02i" % (self._kenwood_valid_tones.index(mem.ctone) + 1), - "%09i" % mem.offset, - "%i" % util.get_dict_rev(MODES, mem.mode), - "%i" % ((mem.skip == "S") and 1 or 0)) - - return spec - - def _parse_mem_spec(self, spec): - mem = chirp_common.Memory() - - mem.number = int(spec[2]) - mem.freq = int(spec[3]) - mem.tuning_step = STEPS[int(spec[4], 16)] - mem.duplex = DUPLEX[int(spec[5])] - mem.tmode = get_tmode(spec[7], spec[8], spec[9]) - mem.rtone = self._kenwood_valid_tones[int(spec[10]) - 1] - mem.ctone = self._kenwood_valid_tones[int(spec[12]) - 1] - if spec[11] and spec[11].isdigit(): - mem.dtcs = chirp_common.DTCS_CODES[int(spec[11][:-1]) - 1] - else: - LOG.warn("Unknown or invalid DCS: %s" % spec[11]) - if spec[13]: - mem.offset = int(spec[13]) - else: - mem.offset = 0 - mem.mode = MODES[int(spec[14])] - mem.skip = int(spec[15]) and "S" or "" - - return mem - - @directory.register class TMV7Radio(KenwoodOldLiveRadio): """Kenwood TM-V7""" @@ -881,7 +578,9 @@ THF6A_DUPLEX[3] = "split" class THF6ARadio(KenwoodLiveRadio): """Kenwood TH-F6""" MODEL = "TH-F6" + HARDWARE_FLOW = False + _charset = chirp_common.CHARSET_ASCII _upper = 399 _kenwood_split = True _kenwood_valid_tones = list(KENWOOD_TONES) @@ -897,7 +596,7 @@ class THF6ARadio(KenwoodLiveRadio): rf.valid_bands = [(1000, 1300000000)] rf.valid_skips = ["", "S"] rf.valid_duplexes = list(THF6A_DUPLEX.values()) - rf.valid_characters = chirp_common.CHARSET_ASCII + rf.valid_characters = self._charset rf.valid_name_length = 8 rf.memory_bounds = (0, self._upper) rf.has_settings = True @@ -977,7 +676,7 @@ class THF6ARadio(KenwoodLiveRadio): "APO": ["Off", "30min", "60min"], "BAL": ["100%:0%", "75%:25%", "50%:50%", "25%:75%", "%0:100%"], "BAT": ["Lithium", "Alkaline"], - "CKEY": ["Call", "1750Hz"], + "CKEY": ["Call", "1750 Hz"], "DATP": ["1200bps", "9600bps"], "LAN": ["English", "Japanese"], "MNF": ["Name", "Frequency"], @@ -1070,6 +769,7 @@ class THF6ARadio(KenwoodLiveRadio): class THF7ERadio(THF6ARadio): """Kenwood TH-F7""" MODEL = "TH-F7" + _charset = chirp_common.CHARSET_1252 D710_DUPLEX = ["", "+", "-", "split"] diff --git a/chirp/drivers/kg935g.py b/chirp/drivers/kg935g.py index 0538685..9a9e927 100644 --- a/chirp/drivers/kg935g.py +++ b/chirp/drivers/kg935g.py @@ -1,5 +1,6 @@ # Wouxun KG-935G Driver -# Updated by: +# Updated to support the KG-935G Plus +# Updated to support the KG-UV8H # melvin.terechenok@gmail.com # Copyright 2019 Pavel Milanes CO7WT @@ -23,15 +24,16 @@ """Wouxun KG-935G radio management module""" +import struct import time -import os import logging from chirp import util, chirp_common, bitwise, memmap, errors, directory from chirp.settings import RadioSetting, RadioSettingGroup, \ RadioSettingValueBoolean, RadioSettingValueList, \ RadioSettingValueInteger, RadioSettingValueString, \ - RadioSettingValueFloat, RadioSettingValueMap, RadioSettings + RadioSettingValueFloat, RadioSettingValueMap, RadioSettings, \ + InvalidValueError LOG = logging.getLogger(__name__) @@ -43,6 +45,36 @@ CMD_WR = 131 # \83 MEM_VALID = 158 +# set up map of addresses to upload to known memory locations only +# Add new regions as new settings are discovered +# 1st entry is start address in hex +# 2nd entry is write size (number of bytes to transfer in decimal (64-MAX)) +# 3rd entry is write count +# so 0x00, 64, 512 = start at 0x00 and write 64*512 bytes = 0 - 32768 + +# NOTE : It looks like the radio MUST have write +# sizes in values of 1,2,4,8,16,32 or 64 bytes if using +# a write count value of > 1. +# OTHERWISE - it appears the radio gets out of sync +# and the memory write is messed up +# for that section + +config_map_935G = ( # map address, write size, write count + # (0x00, 64, 512), #- Use for full upload testing + (0x44, 32, 1), # Freq Limits + (0x440, 8, 1), # Area Message + (0x480, 8, 5), # Scan Groups + (0x500, 8, 15), # Call Codes + (0x580, 8, 15), # Call Names + (0x600, 8, 5), # FM Presets + (0x800, 64, 2), # settings + (0x880, 16, 1), # VFO A + (0x8C0, 16, 1), # VFO B + (0x900, 64, 250), # Channel Memory 0-999 + (0x4780, 32, 375), # Memory Names 0-999 + (0x7670, 8, 125), # Ch Valid bytes 0-999 + ) + AB_LIST = ["A", "B"] STEPS = [2.5, 5.0, 6.25, 10.0, 12.5, 25.0, 50.0, 100.0] STEP_LIST = [str(x) for x in STEPS] @@ -51,24 +83,33 @@ TIMEOUT_LIST = ["Off"] + [str(x) + "s" for x in range(15, 901, 15)] VOX_LIST = ["Off"] + ["%s" % x for x in range(1, 10)] BANDWIDTH_LIST = ["Narrow", "Wide"] VOICE_LIST = ["Off", "On"] -LANGUAGE_LIST = ["Chinese", "English"] +LANGUAGE_LIST = ["Chinese", "English", "Traditional Chinese"] SCANMODE_LIST = ["TO", "CO", "SE"] -# MRT - EDIT FOR 935G PFKEYLONG_LIST = ["undef", "FRQ2-PTT", "Selec Call", "Scan", "Flashlight", "Alarm", "SOS", "FM Radio", "Moni", "Strobe", "Weather", "Tlk A", "Reverse", "CTC Scan", "DCS Scan", "BRT"] PFKEYSHORT_LIST = ["undef", "Scan", "Flashlight", "Alarm", "SOS", "FM Radio", "Moni", "Strobe", "Weather", "Tlk A", "Reverse", "CTC Scan", "DCS Scan", "BRT"] -# +PFKEYLONG_LIST_UV8H = ["Selec Call", "Sub Freq Tx"] +PFKEYSHORT_LIST_UV8H = ["undef", "Scan", "Lamp", "Alarm", "SOS", "Radio"] + +PFKEYLONG_LIST_935GPLUS = ["undef", "FRQ2-PTT", "Selec Call", "Favorite", + "Bright+", "Scan", "Flashlight", "Alarm", "SOS", + "FM Radio", "Moni", "Strobe", "Weather", "Tlk A", + "Reverse", "CTC Scan", "DCS Scan", "Backlight"] +PFKEYSHORT_LIST_935GPLUS = ["undef", "Favorite", "Bright+", "Scan", + "Flashlight", "Alarm", "SOS", "FM Radio", + "Moni", "Strobe", "Weather", "Tlk A", "Reverse", + "CTC Scan", "DCS Scan", "Backlight"] WORKMODE_LIST = ["VFO", "Ch.Number.", "Ch.Freq.", "Ch.Name"] +WORKMODE_LIST_935GPLUS = ["FREQ", "Ch.Number.", "Ch.Freq.", "Ch.Name"] BACKLIGHT_LIST = ["Always On"] + [str(x) + "s" for x in range(1, 21)] + \ ["Always Off"] -OFFSET_LIST = ["+", "-"] +OFFSET_LIST = ["Off", "Plus Shift", "Minus Shift"] PONMSG_LIST = ["MSG - Bitmap", "Battery Volts"] SPMUTE_LIST = ["QT", "QT+DTMF", "QT*DTMF"] DTMFST_LIST = ["OFF", "DTMF", "ANI", "DTMF+ANI"] -# DTMF_TIMES = [str(x) + "ms" for x in range(0, 501, 10)] DTMF_TIMES = [('%dms' % dtmf, (dtmf // 10)) for dtmf in range(50, 501, 10)] ALERTS = [1750, 2100, 1000, 1450] ALERTS_LIST = [str(x) for x in ALERTS] @@ -80,14 +121,15 @@ SMUTESET_LIST = ["Off", "Tx", "Rx", "Tx+Rx"] POWER_LIST = ["Lo", "Mid", "Hi"] HOLD_TIMES = ["Off"] + ["%s" % x for x in range(100, 5001, 100)] RPTMODE_LIST = ["Radio", "Repeater"] -# MRT ADDED NEW LISTS +RPTTYPE_MAP = [("X-DIRPT", 1), ("X-TWRPT", 2)] CALLGROUP_LIST = [str(x) for x in range(1, 21)] THEME_LIST = ["White-1", "White-2", "Black-1", "Black-2"] +THEME_LIST_935GPLUS = ["White-1", "White-2", "Black-1", "Black-2", + "Cool", "Rain", "NotARubi", "Sky", "BTWR", "Candy"] DSPBRTSBY_LIST = ["OFF", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10"] DSPBRTACT_MAP = [("1", 1), ("2", 2), ("3", 3), ("4", 4), ("5", 5), ("6", 6), ("7", 7), ("8", 8), ("9", 9), ("10", 10)] TONESCANSAVELIST = ["Rx", "Tx", "Tx/Rx"] -# PTTDELAY_LIST = [str(x) + "ms" for x in range(0, 3001, 100)] PTTDELAY_TIMES = [('%dms' % pttdelay, (pttdelay // 100)) for pttdelay in range(100, 3001, 100)] SCRAMBLE_LIST = ["OFF"] + [str(x) for x in range(1, 9)] @@ -106,18 +148,556 @@ TONE_MAP = [('Off', 0x0000)] + \ for tone in chirp_common.DTCS_CODES] + \ [('D%03di' % tone, int(0x6000 + int(str(tone), 8))) for tone in chirp_common.DTCS_CODES] +BATT_DISP_LIST = ["Icon", "Voltage", "Percent"] +WX_TYPE = ["Weather", "Icon-Only", "Tone", "Flash", "Tone-Flash"] +# memory slot 0 is not used, start at 1 (so need 1000 slots, not 999) +# structure elements whose name starts with x are currently unidentified + +_MEM_FORMAT_935G = """ + #seekto 0x0044; + struct { + u32 rx_start; + u32 rx_stop; + u32 tx_start; + u32 tx_stop; + } uhf_limits; + + #seekto 0x0054; + struct { + u32 rx_start; + u32 rx_stop; + u32 tx_start; + u32 tx_stop; + } vhf_limits; + + #seekto 0x0400; + struct { + char oem1[8]; + char unknown[2]; + u8 unknown2[10]; + u8 unknown3[10]; + u8 unknown4[8]; + char oem2[10]; + u8 version[6]; + char date[8]; + u8 unknown5[2]; + char model[8]; + } oem_info; + + #seekto 0x0480; + struct { + u16 Group_lower1; + u16 Group_upper1; + u16 Group_lower2; + u16 Group_upper2; + u16 Group_lower3; + u16 Group_upper3; + u16 Group_lower4; + u16 Group_upper4; + u16 Group_lower5; + u16 Group_upper5; + u16 Group_lower6; + u16 Group_upper6; + u16 Group_lower7; + u16 Group_upper7; + u16 Group_lower8; + u16 Group_upper8; + u16 Group_lower9; + u16 Group_upper9; + u16 Group_lower10; + u16 Group_upper10; + } scan_groups; + + #seekto 0x0500; + struct { + u8 cid[6]; + } call_ids[20]; + + #seekto 0x0580; + struct { + char call_name1[6]; + char call_name2[6]; + char call_name3[6]; + char call_name4[6]; + char call_name5[6]; + char call_name6[6]; + char call_name7[6]; + char call_name8[6]; + char call_name9[6]; + char call_name10[6]; + char call_name11[6]; + char call_name12[6]; + char call_name13[6]; + char call_name14[6]; + char call_name15[6]; + char call_name16[6]; + char call_name17[6]; + char call_name18[6]; + char call_name19[6]; + char call_name20[6]; + } call_names; + + + #seekto 0x0600; + struct { + u16 FM_radio1; + u16 FM_radio2; + u16 FM_radio3; + u16 FM_radio4; + u16 FM_radio5; + u16 FM_radio6; + u16 FM_radio7; + u16 FM_radio8; + u16 FM_radio9; + u16 FM_radio10; + u16 FM_radio11; + u16 FM_radio12; + u16 FM_radio13; + u16 FM_radio14; + u16 FM_radio15; + u16 FM_radio16; + u16 FM_radio17; + u16 FM_radio18; + u16 FM_radio19; + u16 FM_radio20; + u16 unknown_pad_x0640[235]; + u8 unknown07fe; + u8 unknown07ff; + u8 ponmsg; + char dispstr[15]; + u8 unknown0810; + u8 unknown0811; + u8 unknown0812; + u8 unknown0813; + u8 unknown0814; + u8 voice; + u8 timeout; + u8 toalarm; + u8 channel_menu; + u8 power_save; + u8 autolock; + u8 keylock; + u8 beep; + u8 stopwatch; + u8 vox; + u8 scan_rev; + u8 backlight; + u8 roger_beep; + char mode_sw_pwd[6]; + char reset_pwd[6]; + u16 pri_ch; + u8 ani_sw; + u8 ptt_delay; + u8 ani_code[6]; + u8 dtmf_st; + u8 BCL_A; + u8 BCL_B; + u8 ptt_id; + u8 prich_sw; + u8 unknown083d; + u8 unknown083e; + u8 unknown083f; + u8 alert; + u8 pf1_shrt; + u8 pf1_long; + u8 pf2_shrt; + u8 pf2_long; + u8 unknown0845; + u8 work_mode_a; + u8 work_mode_b; + u8 dtmf_tx_time; + u8 dtmf_interval; + u8 main_band; + u16 work_ch_a; + u16 work_ch_b; + u8 unknown084f; + u8 unknown0850; + u8 unknown0851; + u8 unknown0852; + u8 unknown0853; + u8 unknown0854; + u8 unknown0855; + u8 unknown0856; + u8 unknown0857; + u8 unknown0858; + u8 unknown0859; + u8 unknown085a; + u8 unknown085b; + u8 unknown085c; + u8 unknown085d; + u8 unknown085e; + u8 unknown085f; + u8 unknown0860; + u8 TDR_single_mode; + u8 ring_time; + u8 ScnGrpA_Act; + u8 ScnGrpB_Act; + u8 unknown0865; + u8 rpt_tone; + u8 unknown0867; + u8 scan_det; + u8 ToneScnSave; + u8 unknown086a; + u8 smuteset; + u8 cur_call_grp; + u8 DspBrtAct; + u8 DspBrtSby; + u8 unknown086f; + u8 theme; + u8 wxalert; + u8 VFO_repeater_a; + u8 VFO_repeater_b; + u8 unknown0874; + u8 unknown0875; + u8 unknown0876; + u8 unknown0877; + u8 unknown0878; + u8 unknown0879; + u8 unknown087a; + u8 unknown087b; + u8 unknown087c; + u8 unknown087d; + u8 unknown087e; + u8 unknown087f; + } settings; + + #seekto 0x0880; + struct { + u32 rxfreq; + u32 unknown0; + u16 rxtone; + u16 txtone; + u8 scrambler:4, + power:4; + u8 unknown3:1, + unknown5:2, + unknown4:1, + cmpndr:1, + mute_mode:2, + iswide:1; + u8 step; + u8 squelch; + } vfoa; + + #seekto 0x08c0; + struct { + u32 rxfreq; + u32 unknown0; + u16 rxtone; + u16 txtone; + u8 scrambler:4, + power:4; + u8 unknown3:1, + unknown5:2, + unknown4:1, + cmpndr:1, + mute_mode:2, + iswide:1; + u8 step; + u8 squelch; + } vfob; + + #seekto 0x0900; + struct { + u32 rxfreq; + u32 txfreq; + u16 rxtone; + u16 txtone; + u8 scrambler:4, + power:4; + u8 unknown3:2, + scan_add:1, + unknown4:1, + compander:1, + mute_mode:2, + iswide:1; + u8 unknown5; + u8 unknown6; + } memory[1000]; + + #seekto 0x4780; + struct { + u8 name[8]; + u8 unknown[4]; + } names[1000]; + + #seekto 0x7670; + u8 valid[1000]; + """ + +_MEM_FORMAT_935GPLUS = """ + #seekto 0x0044; + struct { + u32 rx_start; + u32 rx_stop; + u32 tx_start; + u32 tx_stop; + } uhf_limits; + + #seekto 0x0054; + struct { + u32 rx_start; + u32 rx_stop; + u32 tx_start; + u32 tx_stop; + } vhf_limits; + + #seekto 0x0400; + struct { + char oem1[8]; + char unknown[2]; + u8 unknown2[10]; + u8 unknown3[10]; + u8 unknown4[8]; + char oem2[10]; + u8 version[6]; + char date[8]; + u8 unknown5[2]; + char model[8]; + } oem_info; + + #seekto 0x0480; + struct { + u16 Group_lower1; + u16 Group_upper1; + u16 Group_lower2; + u16 Group_upper2; + u16 Group_lower3; + u16 Group_upper3; + u16 Group_lower4; + u16 Group_upper4; + u16 Group_lower5; + u16 Group_upper5; + u16 Group_lower6; + u16 Group_upper6; + u16 Group_lower7; + u16 Group_upper7; + u16 Group_lower8; + u16 Group_upper8; + u16 Group_lower9; + u16 Group_upper9; + u16 Group_lower10; + u16 Group_upper10; + } scan_groups; + + #seekto 0x0500; + struct { + u8 cid[6]; + } call_ids[20]; + + #seekto 0x0580; + struct { + char call_name1[6]; + char call_name2[6]; + char call_name3[6]; + char call_name4[6]; + char call_name5[6]; + char call_name6[6]; + char call_name7[6]; + char call_name8[6]; + char call_name9[6]; + char call_name10[6]; + char call_name11[6]; + char call_name12[6]; + char call_name13[6]; + char call_name14[6]; + char call_name15[6]; + char call_name16[6]; + char call_name17[6]; + char call_name18[6]; + char call_name19[6]; + char call_name20[6]; + } call_names; + + + #seekto 0x0600; + struct { + u16 FM_radio1; + u16 FM_radio2; + u16 FM_radio3; + u16 FM_radio4; + u16 FM_radio5; + u16 FM_radio6; + u16 FM_radio7; + u16 FM_radio8; + u16 FM_radio9; + u16 FM_radio10; + u16 FM_radio11; + u16 FM_radio12; + u16 FM_radio13; + u16 FM_radio14; + u16 FM_radio15; + u16 FM_radio16; + u16 FM_radio17; + u16 FM_radio18; + u16 FM_radio19; + u16 FM_radio20; + u16 unknown_pad_x0640[235]; + u8 unknown07fe; + u8 unknown07ff; + u8 ponmsg; + char dispstr[15]; + u8 unknown0810; + u8 unknown0811; + u8 unknown0812; + u8 unknown0813; + u8 unknown0814; + u8 voice; + u8 timeout; + u8 toalarm; + u8 channel_menu; + u8 power_save; + u8 autolock; + u8 keylock; + u8 beep; + u8 stopwatch; + u8 vox; + u8 scan_rev; + u8 backlight; + u8 roger_beep; + char mode_sw_pwd[6]; + char reset_pwd[6]; + u16 pri_ch; + u8 ani_sw; + u8 ptt_delay; + u8 ani_code[6]; + u8 dtmf_st; + u8 BCL_A; + u8 BCL_B; + u8 ptt_id; + u8 prich_sw; + u8 unknown083d; + u8 unknown083e; + u8 unknown083f; + u8 alert; + u8 pf1_shrt; + u8 pf1_long; + u8 pf2_shrt; + u8 pf2_long; + u8 unknown0845; + u8 work_mode_a; + u8 work_mode_b; + u8 dtmf_tx_time; + u8 dtmf_interval; + u8 main_band; + u16 work_ch_a; + u16 work_ch_b; + u8 unknown084f; + u8 unknown0850; + u8 unknown0851; + u8 unknown0852; + u8 unknown0853; + u8 unknown0854; + u8 unknown0855; + u8 unknown0856; + u8 unknown0857; + u8 unknown0858; + u8 unknown0859; + u8 unknown085a; + u8 unknown085b; + u8 unknown085c; + u8 unknown085d; + u8 unknown085e; + u8 unknown085f; + u8 unknown0860; + u8 TDR_single_mode; + u8 ring_time; + u8 ScnGrpA_Act; + u8 ScnGrpB_Act; + u8 unknown0865; + u8 rpt_tone; + u8 unknown0867; + u8 scan_det; + u8 ToneScnSave; + u8 unknown086a; + u8 smuteset; + u8 cur_call_grp; + u8 DspBrtAct; + u8 DspBrtSby; + u8 unknown086f; + u8 theme; + u8 batt_ind; + u8 wxalert; + u8 wxalert_type; + u8 VFO_repeater_a; + u8 VFO_repeater_b; + u8 sim_rec; + u8 unknown0877; + u8 unknown0878; + u8 unknown0879; + u8 unknown087a; + u8 unknown087b; + u8 unknown087c; + u8 unknown087d; + u8 unknown087e; + u8 unknown087f; + } settings; + #seekto 0x0880; + struct { + u32 rxfreq; + u32 unknown0; + u16 rxtone; + u16 txtone; + u8 scrambler:4, + power:4; + u8 unknown3:1, + unknown5:2, + unknown4:1, + cmpndr:1, + mute_mode:2, + iswide:1; + u8 step; + u8 squelch; + } vfoa; -# memory slot 0 is not used, start at 1 (so need 1000 slots, not 999) -# structure elements whose name starts with x are currently unidentified + #seekto 0x08c0; + struct { + u32 rxfreq; + u32 unknown0; + u16 rxtone; + u16 txtone; + u8 scrambler:4, + power:4; + u8 unknown3:1, + unknown5:2, + unknown4:1, + cmpndr:1, + mute_mode:2, + iswide:1; + u8 step; + u8 squelch; + } vfob; + + #seekto 0x0900; + struct { + u32 rxfreq; + u32 txfreq; + u16 rxtone; + u16 txtone; + u8 scrambler:4, + power:4; + u8 unknown3:2, + scan_add:1, + unknown4:1, + compander:1, + mute_mode:2, + iswide:1; + u8 unknown5; + u8 unknown6; + } memory[1000]; + + #seekto 0x4780; + struct { + u8 name[8]; + u8 unknown[4]; + } names[1000]; -# MRT made Power = 4 bits to handle 935G's 3 power levels and -# to prevent display errors -# MRT beta 1.3 - updates to structure to match KG935G Custom -# programming SW configuration settings, FM Radio presets, Key Settings -# MRT beta 1.4 - modified some value names and merged FM Radio -# memories with other settings to resolve errors in UI implementation -_MEM_FORMAT = """ + #seekto 0x7670; + u8 valid[1000]; + """ + +_MEM_FORMAT_UV8H = """ #seekto 0x0044; struct { u32 rx_start; @@ -174,27 +754,8 @@ _MEM_FORMAT = """ #seekto 0x0500; struct { - u8 call_code_1[6]; - u8 call_code_2[6]; - u8 call_code_3[6]; - u8 call_code_4[6]; - u8 call_code_5[6]; - u8 call_code_6[6]; - u8 call_code_7[6]; - u8 call_code_8[6]; - u8 call_code_9[6]; - u8 call_code_10[6]; - u8 call_code_11[6]; - u8 call_code_12[6]; - u8 call_code_13[6]; - u8 call_code_14[6]; - u8 call_code_15[6]; - u8 call_code_16[6]; - u8 call_code_17[6]; - u8 call_code_18[6]; - u8 call_code_19[6]; - u8 call_code_20[6]; - } call_groups; + u8 cid[6]; + } call_ids[20]; #seekto 0x0580; struct { @@ -277,30 +838,30 @@ _MEM_FORMAT = """ u8 BCL_B; u8 ptt_id; u8 prich_sw; - u8 unknown083d; - u8 unknown083e; - u8 unknown083f; + u8 rpttype; + u8 rptspk; + u8 rptptt; u8 alert; - u8 pf1_shrt; u8 pf1_long; - u8 pf2_shrt; - u8 pf2_long; - u8 unknown0845; + u8 pf1_shrt; + u8 unk845; u8 work_mode_a; u8 work_mode_b; u8 dtmf_tx_time; u8 dtmf_interval; - u8 main_band; + u8 unk4a; u16 work_ch_a; u16 work_ch_b; + u8 unk4d; + u8 main_band; u8 unknown084f; u8 unknown0850; u8 unknown0851; u8 unknown0852; u8 unknown0853; u8 unknown0854; - u8 unknown0855; - u8 unknown0856; + u8 rptmode; + u8 language; u8 unknown0857; u8 unknown0858; u8 unknown0859; @@ -309,27 +870,27 @@ _MEM_FORMAT = """ u8 unknown085c; u8 unknown085d; u8 unknown085e; - u8 unknown085f; - u8 unknown0860; u8 TDR_single_mode; u8 ring_time; u8 ScnGrpA_Act; u8 ScnGrpB_Act; - u8 unknown0865; + u8 unk863; u8 rpt_tone; - u8 unknown0867; + u8 rpt_hold; u8 scan_det; u8 ToneScnSave; - u8 unknown086a; + u8 unk868; u8 smuteset; u8 cur_call_grp; u8 DspBrtAct; - u8 DspBrtSby; - u8 unknown086f; + u8 unknown086c; u8 theme; u8 wxalert; - u8 VFO_repeater_a; - u8 VFO_repeater_b; + u8 unknown086f; + u8 unknown0870; + u8 unk871; + u8 unk872; + u8 unk873; u8 unknown0874; u8 unknown0875; u8 unknown0876; @@ -347,13 +908,13 @@ _MEM_FORMAT = """ #seekto 0x0880; struct { u32 rxfreq; - u32 unknown0; + u32 offset; u16 rxtone; u16 txtone; u8 scrambler:4, power:4; u8 unknown3:1, - unknown5:2, + ofst_dir:2, unknown4:1, cmpndr:1, mute_mode:2, @@ -365,13 +926,13 @@ _MEM_FORMAT = """ #seekto 0x08c0; struct { u32 rxfreq; - u32 unknown0; + u32 offset; u16 rxtone; u16 txtone; u8 scrambler:4, power:4; u8 unknown3:1, - unknown5:2, + ofst_dir:2, unknown4:1, cmpndr:1, mute_mode:2, @@ -408,6 +969,7 @@ _MEM_FORMAT = """ u8 valid[1000]; """ + # Support for the Wouxun KG-935G radio # Serial coms are at 19200 baud # The data is passed in variable length records @@ -430,9 +992,33 @@ _MEM_FORMAT = """ # MRT 1.2 correct spelling of Wouxon -class KGUV8TRadio(chirp_common.Alias): - VENDOR = "Wouxun" - MODEL = "KG-935G" +def str2callid(val): + """ Convert caller id strings from callid2str. + """ + ascii2bin = "0123456789" + s = str(val).strip() + LOG.debug("val = %s" % val) + LOG.debug("s = %s" % s) + if len(s) < 3 or len(s) > 6: + raise InvalidValueError( + "Caller ID must be at least 3 and no more than 6 digits") + if s[0] == '0': + raise InvalidValueError( + "First digit of a Caller ID cannot be a zero '0'") + blk = bytearray() + for c in s: + if c not in ascii2bin: + raise InvalidValueError( + "Caller ID must be all digits 0x%x" % c) + b = ascii2bin.index(c) + blk.append(b) + if len(blk) < 6: + blk.append(0x0F) # EOL a short ID + if len(blk) < 6: + for i in range(0, (6 - len(blk))): + blk.append(0xf0) + LOG.debug("blk = %s" % blk) + return blk @directory.register @@ -442,78 +1028,61 @@ class KG935GRadio(chirp_common.CloneModeRadio, """Wouxun KG-935G""" VENDOR = "Wouxun" MODEL = "KG-935G" - _model = "KG-UV8D-B" - _file_ident = b"935G" + _model = b"KG-UV8D-B" BAUD_RATE = 19200 -# MRT - Added Medium Power level for 935G support + # MRT - Added Medium Power level for 935G support POWER_LEVELS = [chirp_common.PowerLevel("L", watts=0.5), chirp_common.PowerLevel("M", watts=4.5), chirp_common.PowerLevel("H", watts=5.5)] - _mmap = "" - ALIASES = [KGUV8TRadio, ] + NEEDS_COMPAT_SERIAL = False + _record_start = 0x7C def _checksum(self, data): cs = 0 for byte in data: - cs += ord(byte) - return chr(cs % 256) - - def _write_record(self, cmd, payload=None): - # build the packet - _header = '\x7c' + chr(cmd) + '\xff' - - _length = 0 - if payload: - _length = len(payload) - - # update the length field - _header += chr(_length) - - if payload: - # calculate checksum then add it with the payload - # to the packet and encrypt - crc = self._checksum(_header[1:] + payload) - payload += crc - _header += self.encrypt(payload) - else: - # calculate and add encrypted checksum to the packet - crc = self._checksum(_header[1:]) - _header += self.strxor(crc, '\x57') + cs += byte + return cs % 256 - try: - self.pipe.write(_header) - except Exception as e: - raise errors.RadioError("Failed to communicate with radio: %s" % e) + def _write_record(self, cmd, payload=b''): + _packet = struct.pack('BBBB', self._record_start, cmd, 0xFF, + len(payload)) + checksum = bytes([self._checksum(_packet[1:] + payload)]) + _packet += self.encrypt(payload + checksum) + LOG.debug("Sent:\n%s" % util.hexprint(_packet)) + self.pipe.write(_packet) def _read_record(self): # read 4 chars for the header _header = self.pipe.read(4) if len(_header) != 4: raise errors.RadioError('Radio did not respond') - _length = ord(_header[3]) + _length = struct.unpack('xxxB', _header)[0] _packet = self.pipe.read(_length) _rcs_xor = _packet[-1] _packet = self.decrypt(_packet) - _cs = ord(self._checksum(_header[1:] + _packet)) - # read the checksum and decrypt it - _rcs = ord(self.strxor(self.pipe.read(1), _rcs_xor)) + _cs = self._checksum(_header[1:]) + _cs += self._checksum(_packet) + _cs %= 256 + _rcs = self.strxor(self.pipe.read(1)[0], _rcs_xor)[0] + LOG.debug("_cs =%x", _cs) + LOG.debug("_rcs=%x", _rcs) return (_rcs != _cs, _packet) def decrypt(self, data): - result = '' + result = b'' for i in range(len(data)-1, 0, -1): result += self.strxor(data[i], data[i - 1]) - result += self.strxor(data[0], '\x57') + result += self.strxor(data[0], 0x57) return result[::-1] def encrypt(self, data): - result = self.strxor('\x57', data[0]) + result = self.strxor(0x57, data[0]) for i in range(1, len(data), 1): result += self.strxor(result[i - 1], data[i]) return result def strxor(self, xora, xorb): - return chr(ord(xora) ^ ord(xorb)) + return bytes([xora ^ xorb]) # Identify the radio # @@ -522,16 +1091,11 @@ class KG935GRadio(chirp_common.CloneModeRadio, # # The ID record returned by the radio also includes the # current frequency range - # as 4 bytes big-endian in 10Hz increments + # as 4 bytes big-endian in 10 Hz increments # # Offset # 0:10 Model, zero padded (Looks for 'KG-UV8D-B') - @classmethod - def match_model(cls, filedata, filename): - id = cls._file_ident - return cls._file_ident in filedata[0x426:0x430] - def _identify(self): """Do the identification dance""" for _i in range(0, 10): @@ -554,7 +1118,7 @@ class KG935GRadio(chirp_common.CloneModeRadio, self._write_record(CMD_END) def process_mmap(self): - self._memobj = bitwise.parse(_MEM_FORMAT, self._mmap) + self._memobj = bitwise.parse(_MEM_FORMAT_935G, self._mmap) def sync_in(self): try: @@ -572,7 +1136,7 @@ class KG935GRadio(chirp_common.CloneModeRadio, # It would be smarter to only load the active areas and none of # the padding/unused areas. Padding still need to be investigated. def _download(self): - """Talk to a wouxun KG-935G and do a download""" + """Talk to a Wouxun KG-935G and do a download""" try: self._identify() return self._do_download(0, 32768, 64) @@ -584,9 +1148,9 @@ class KG935GRadio(chirp_common.CloneModeRadio, def _do_download(self, start, end, blocksize): # allocate & fill memory - image = "" + image = b"" for i in range(start, end, blocksize): - req = chr(i // 256) + chr(i % 256) + chr(blocksize) + req = struct.pack('>HB', i, blocksize) self._write_record(CMD_RD, req) cs_error, resp = self._read_record() if cs_error: @@ -601,38 +1165,48 @@ class KG935GRadio(chirp_common.CloneModeRadio, status.msg = "Cloning from radio" self.status_fn(status) self._finish() - return memmap.MemoryMap(''.join(image)) + return memmap.MemoryMapBytes(image) def _upload(self): - """Talk to a wouxun KG-935G and do a upload""" + """Talk to a Wouxun KG-935G and do a upload""" try: self._identify() - self._do_upload(0, 32768, 64) + self._do_upload() except errors.RadioError: raise except Exception as e: raise errors.RadioError("Failed to communicate with radio: %s" % e) return - def _do_upload(self, start, end, blocksize): - ptr = start - for i in range(start, end, blocksize): - req = chr(i // 256) + chr(i % 256) - chunk = self.get_mmap()[ptr:ptr + blocksize] - self._write_record(CMD_WR, req + chunk) - LOG.debug(util.hexprint(req + chunk)) - cserr, ack = self._read_record() - LOG.debug(util.hexprint(ack)) - j = ord(ack[0]) * 256 + ord(ack[1]) - if cserr or j != ptr: - raise Exception("Radio did not ack block %i" % ptr) - ptr += blocksize - if self.status_fn: - status = chirp_common.Status() - status.cur = i - status.max = end - status.msg = "Cloning to radio" - self.status_fn(status) + def _do_upload(self): + cfgmap = config_map_935G + + for start, blocksize, count in cfgmap: + end = start + (blocksize * count) + LOG.debug("start = " + str(start)) + LOG.debug("end = " + str(end)) + LOG.debug("blksize = " + str(blocksize)) + + for addr in range(start, end, blocksize): + ptr = addr + LOG.debug("ptr = " + str(ptr)) + req = struct.pack('>H', addr) + chunk = self.get_mmap()[ptr:ptr + blocksize] + self._write_record(CMD_WR, req + chunk) + LOG.debug(util.hexprint(req + chunk)) + cserr, ack = self._read_record() + LOG.debug(util.hexprint(ack)) + j = struct.unpack('>H', ack)[0] + if cserr or j != ptr: + raise Exception("Radio did not ack block %i" % ptr) + ptr += blocksize + if self.status_fn: + status = chirp_common.Status() + status.cur = ptr + status.max = 0x8000 + status.msg = "Cloning to radio" + self.status_fn(status) + self._finish() def get_features(self): @@ -659,13 +1233,10 @@ class KG935GRadio(chirp_common.CloneModeRadio, rf.valid_power_levels = self.POWER_LEVELS rf.valid_name_length = 8 rf.valid_duplexes = ["", "-", "+", "split", "off"] -# MRT - Open up channel memory freq range to support RxFreq limit expansion + # MRT - Open up channel memory freq range to support + # RxFreq limit expansion rf.valid_bands = [(30000000, 299999990), # supports 2m (300000000, 999999990)] # supports 70cm - # rf.valid_bands = [(self._memobj.vhf_limits.rx_start - # , self._memobj.vhf_limits.rx_stop), # supports 2m - # (self._memobj.uhf_limits.rx_start - # , self._memobj.uhf_limits.rx_stop)] # supports 70cm rf.valid_characters = chirp_common.CHARSET_ASCII rf.memory_bounds = (1, 999) # 999 memories @@ -684,38 +1255,28 @@ class KG935GRadio(chirp_common.CloneModeRadio, 'Please keep a copy of your memories with the original Wouxon' 'CPS software if you treasure them, this driver is new and' 'may contain bugs.\n' - '\n' - ' All of the settings from the Wouxon Custom Programming' - ' Software (CSP) have been mapped\n in addition to some bonus' - ' settings that were found.\n' - ' Changing the VHF/UHF Rx limits does expand receive range -' - ' but radio performance\n' - ' is not guaranteed- and may void warranty or cause radio' - ' to malfunction.\n' - ' You can also customize the bottom banner from the OEMINFO ' - ' Model setting\n' ) return rp def get_raw_memory(self, number): return repr(self._memobj.memory[number]) -# MRT - corrected the Polarity decoding to match 935G implementation -# use 0x2000 bit mask for R -# MRT - 0x2000 appears to be the bit mask for Inverted DCS tones -# MRT - n DCS Tone will be 0x4xxx values - i DCS Tones will -# be 0x6xxx values. -# MRT - Chirp Uses N for n DCS Tones and R for i DCS Tones def _get_tone(self, _mem, mem): + # MRT - corrected the Polarity decoding to match 935G implementation + # use 0x2000 bit mask for R + # MRT - 0x2000 appears to be the bit mask for Inverted DCS tones + # MRT - n DCS Tone will be 0x4xxx values - i DCS Tones will + # be 0x6xxx values. + # MRT - Chirp Uses N for n DCS Tones and R for i DCS Tones def _get_dcs(val): code = int("%03o" % (val & 0x07FF)) pol = (val & 0x2000) and "R" or "N" return code, pol -# MRT - Modified the function below to bitwise AND with 0x4000 -# to check for 935G DCS Tone decoding -# MRT 0x4000 appears to be the bit mask for DCS tones + # MRT - Modified the function below to bitwise AND with 0x4000 + # to check for 935G DCS Tone decoding + # MRT 0x4000 appears to be the bit mask for DCS tones tpol = False -# MRT Beta 1.1 - Fix the txtone compare to 0x4000 - was rxtone. + # MRT Beta 1.1 - Fix the txtone compare to 0x4000 - was rxtone. if _mem.txtone != 0xFFFF and (_mem.txtone & 0x4000) == 0x4000: tcode, tpol = _get_dcs(_mem.txtone) mem.dtcs = tcode @@ -725,8 +1286,8 @@ class KG935GRadio(chirp_common.CloneModeRadio, txmode = "Tone" else: txmode = "" -# MRT - Modified the function below to bitwise AND with 0x4000 -# to check for 935G DCS Tone decoding + # MRT - Modified the function below to bitwise AND with 0x4000 + # to check for 935G DCS Tone decoding rpol = False if _mem.rxtone != 0xFFFF and (_mem.rxtone & 0x4000) == 0x4000: rcode, rpol = _get_dcs(_mem.rxtone) @@ -913,46 +1474,81 @@ class KG935GRadio(chirp_common.CloneModeRadio, _vfoa = self._memobj.vfoa _vfob = self._memobj.vfob _scan = self._memobj.scan_groups - _call = self._memobj.call_groups _callname = self._memobj.call_names + if self.MODEL == "KG-935G": + themelist = THEME_LIST + vfoa_grp_label = "VFO A Settings" + vfob_grp_label = "VFO B Settings" + workmodelist = WORKMODE_LIST + pfkeyshort = PFKEYSHORT_LIST + pfkeylong = PFKEYLONG_LIST + dispmesg = "Display Message - Interface Display Edit" + areamsglabel = "Model / Bottom Banner" + vfo_area = "VFO " + ani_msg = "ANI-ID Switch (ANI-SW)" + pttdly_msg = "PTT-DLY" + idtx_msg = "PTT-ID" + elif self.MODEL == "KG-UV8H": + themelist = THEME_LIST + vfoa_grp_label = "VFO A Settings" + vfob_grp_label = "VFO B Settings" + workmodelist = WORKMODE_LIST + pfkeyshort = PFKEYSHORT_LIST_UV8H + pfkeylong = PFKEYLONG_LIST_UV8H + dispmesg = "Display Message - Interface Display Edit" + areamsglabel = "Model / Bottom Banner" + vfo_area = "VFO " + ani_msg = "ANI-ID Switch (ANI-SW)" + pttdly_msg = "PTT-DLY" + idtx_msg = "PTT-ID" + elif self.MODEL == "KG-935G Plus": + themelist = THEME_LIST_935GPLUS + vfoa_grp_label = "Freq Mode A Settings" + vfob_grp_label = "Freq Mode B Settings" + workmodelist = WORKMODE_LIST_935GPLUS + pfkeyshort = PFKEYSHORT_LIST_935GPLUS + pfkeylong = PFKEYLONG_LIST_935GPLUS + dispmesg = "Top Message" + areamsglabel = "Area Message" + vfo_area = "Area " + ani_msg = "Send ANI-ID on Tx(ANI-SW)" + pttdly_msg = "ID Delay" + idtx_msg = "ID Transmit Setting" + cfg_grp = RadioSettingGroup("cfg_grp", "Config Settings") - vfoa_grp = RadioSettingGroup("vfoa_grp", "VFO A Settings") - vfob_grp = RadioSettingGroup("vfob_grp", "VFO B Settings") + vfoa_grp = RadioSettingGroup("vfoa_grp", vfoa_grp_label) + vfob_grp = RadioSettingGroup("vfob_grp", vfob_grp_label) key_grp = RadioSettingGroup("key_grp", "Key Settings") fmradio_grp = RadioSettingGroup("fmradio_grp", "FM Broadcast Memory") - lmt_grp = RadioSettingGroup("lmt_grp", "Rx/Tx Frequency Limits") - uhf_lmt_grp = RadioSettingGroup("uhf_lmt_grp", "UHF") - vhf_lmt_grp = RadioSettingGroup("vhf_lmt_grp", "VHF") + lmt_grp = RadioSettingGroup("lmt_grp", "Frequency Limits") oem_grp = RadioSettingGroup("oem_grp", "OEM Info") scan_grp = RadioSettingGroup("scan_grp", "Scan Group") call_grp = RadioSettingGroup("call_grp", "Call Settings") - extra_grp = RadioSettingGroup("extra_grp", - "Extra Settings" - "\nNOT Changed by RESET or CPS") - extra_grp.append(lmt_grp) - extra_grp.append(oem_grp) group = RadioSettings(cfg_grp, vfoa_grp, vfob_grp, fmradio_grp, key_grp, scan_grp, - call_grp, extra_grp) + call_grp, lmt_grp, oem_grp) - # Call Settings + # Call Settings rs = RadioSetting("cur_call_grp", "Current Call Group", RadioSettingValueList(CALLGROUP_LIST, CALLGROUP_LIST[_settings. cur_call_grp])) call_grp.append(rs) + def apply_callid(setting, obj): + c = str2callid(setting.value) + obj.cid = c + callchars = "0123456789" for i in range(1, 21): callnum = str(i) _msg = "" _msg1 = str(eval("_callname.call_name"+callnum)).split("\0")[0] -# MRT - Handle default factory values of 0xFF or -# non-ascii values in Call Name memory + # MRT - Handle default factory values of 0xFF or + # non-ascii values in Call Name memory for char in _msg1: if char < chr(0x20) or char > chr(0x7E): - # _msg += chr(0x20) _msg += "" else: _msg += str(char) @@ -962,23 +1558,14 @@ class KG935GRadio(chirp_common.CloneModeRadio, "Call Name "+callnum, val) call_grp.append(rs) - _codeobj = eval("_call.call_code_"+callnum) - _code = "".join([callchars[x] for x in _codeobj if int(x) < 0x0A]) - val = RadioSettingValueString(3, 6, _code, False) - val.set_charset(callchars) - rs = RadioSetting("call_code_"+callnum, - "Call Code " + callnum, val) - - def apply_call_code(setting, obj): - value = [] - for j in range(0, 6): - try: - value.append(callchars.index(str(setting.value)[j])) - except IndexError: - value.append(0xFF) - obj.call_code = value - rs.set_apply_callback(apply_call_code, - eval("_call.call_code_"+callnum)) + x = i - 1 + callid = self._memobj.call_ids[x] + c_id = RadioSettingValueString(0, 6, + self.callid2str(callid.cid), + False) + rs = RadioSetting("call_ids[%i].cid" % x, + "Call Code %s" % str(i), c_id) + rs.set_apply_callback(apply_callid, callid) call_grp.append(rs) # Configuration Settings @@ -987,20 +1574,29 @@ class KG935GRadio(chirp_common.CloneModeRadio, RadioSettingValueMap(DSPBRTACT_MAP, _settings.DspBrtAct)) cfg_grp.append(rs) - rs = RadioSetting("DspBrtSby", "Display Brightness STANDBY", - RadioSettingValueList(DSPBRTSBY_LIST, - DSPBRTSBY_LIST[_settings. - DspBrtSby])) - cfg_grp.append(rs) + if self.MODEL != "KG-UV8H": + rs = RadioSetting("DspBrtSby", "Display Brightness STANDBY", + RadioSettingValueList( + DSPBRTSBY_LIST, DSPBRTSBY_LIST[ + _settings.DspBrtSby])) + cfg_grp.append(rs) rs = RadioSetting("wxalert", "Weather Alert", RadioSettingValueBoolean(_settings.wxalert)) cfg_grp.append(rs) + + if self.MODEL == "KG-935G Plus": + rs = RadioSetting("wxalert_type", "Weather Alert Notification", + RadioSettingValueList(WX_TYPE, + WX_TYPE[_settings. + wxalert_type])) + cfg_grp.append(rs) + rs = RadioSetting("power_save", "Battery Saver", RadioSettingValueBoolean(_settings.power_save)) cfg_grp.append(rs) rs = RadioSetting("theme", "Theme", RadioSettingValueList( - THEME_LIST, THEME_LIST[_settings.theme])) + themelist, themelist[_settings.theme])) cfg_grp.append(rs) rs = RadioSetting("backlight", "Backlight Active Time", RadioSettingValueList(BACKLIGHT_LIST, @@ -1049,10 +1645,10 @@ class KG935GRadio(chirp_common.CloneModeRadio, rs = RadioSetting("beep", "Keypad Beep", RadioSettingValueBoolean(_settings.beep)) cfg_grp.append(rs) - rs = RadioSetting("BCL_B", "Busy Channel Lock-out A", + rs = RadioSetting("BCL_A", "Busy Channel Lock-out A", RadioSettingValueBoolean(_settings.BCL_A)) cfg_grp.append(rs) - rs = RadioSetting("BCL_A", "Busy Channel Lock-out B", + rs = RadioSetting("BCL_B", "Busy Channel Lock-out B", RadioSettingValueBoolean(_settings.BCL_B)) cfg_grp.append(rs) rs = RadioSetting("smuteset", "Secondary Area Mute (SMUTESET)", @@ -1060,7 +1656,7 @@ class KG935GRadio(chirp_common.CloneModeRadio, SMUTESET_LIST[_settings. smuteset])) cfg_grp.append(rs) - rs = RadioSetting("ani_sw", "ANI-ID Switch (ANI-SW)", + rs = RadioSetting("ani_sw", ani_msg, RadioSettingValueBoolean(_settings.ani_sw)) cfg_grp.append(rs) rs = RadioSetting("dtmf_st", "DTMF Sidetone (SIDETONE)", @@ -1072,18 +1668,46 @@ class KG935GRadio(chirp_common.CloneModeRadio, RadioSettingValueList(ALERTS_LIST, ALERTS_LIST[_settings.alert])) cfg_grp.append(rs) - rs = RadioSetting("ptt_delay", "PTT-DLY", + rs = RadioSetting("ptt_delay", pttdly_msg, RadioSettingValueMap(PTTDELAY_TIMES, _settings.ptt_delay)) cfg_grp.append(rs) - rs = RadioSetting("ptt_id", "PTT-ID", + rs = RadioSetting("ptt_id", idtx_msg, 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) + + if self.MODEL == "KG-UV8H": + rs = RadioSetting("language", "Language", + RadioSettingValueList( + LANGUAGE_LIST, + LANGUAGE_LIST[_settings.language])) + cfg_grp.append(rs) + rs = RadioSetting("rptmode", "Radio Work Mode", + RadioSettingValueList( + RPTMODE_LIST, + RPTMODE_LIST[_settings.rptmode])) + cfg_grp.append(rs) + rs = RadioSetting("rpttype", "Repeater Type", + RadioSettingValueMap(RPTTYPE_MAP, + _settings.rpttype)) + cfg_grp.append(rs) + rs = RadioSetting("rptspk", "Repeater Speaker", + RadioSettingValueBoolean(_settings.rptspk)) + cfg_grp.append(rs) + rs = RadioSetting("rptptt", "Repeater PTT", + RadioSettingValueBoolean(_settings.rptptt)) + cfg_grp.append(rs) + rs = RadioSetting("rpt_hold", "RPT Hold Time", + RadioSettingValueList( + HOLD_TIMES, HOLD_TIMES[_settings.rpt_hold])) + cfg_grp.append(rs) + rs = RadioSetting("rpt_tone", "Repeater Tone", RadioSettingValueBoolean(_settings.rpt_tone)) cfg_grp.append(rs) @@ -1108,6 +1732,18 @@ class KG935GRadio(chirp_common.CloneModeRadio, RadioSettingValueMap(DTMF_TIMES, _settings.dtmf_interval)) cfg_grp.append(rs) + + if self.MODEL == "KG-935G Plus": + rs = RadioSetting("batt_ind", "Battery Indicator", + RadioSettingValueList( + BATT_DISP_LIST, + BATT_DISP_LIST[_settings.batt_ind])) + cfg_grp.append(rs) + + rs = RadioSetting("sim_rec", "Simultaneous Receive", + RadioSettingValueBoolean(_settings.sim_rec)) + cfg_grp.append(rs) + rs = RadioSetting("channel_menu", "Menu available in channel mode", RadioSettingValueBoolean(_settings.channel_menu)) cfg_grp.append(rs) @@ -1133,47 +1769,42 @@ class KG935GRadio(chirp_common.CloneModeRadio, val = RadioSettingValueString(0, 15, _msg) val.set_mutable(True) rs = RadioSetting("dispstr", - "Display Message - Interface Display Edit", val) + dispmesg, 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) + c = str2callid(setting.value) + obj.ani_code = c + + cid = self._memobj.settings + my_callid = RadioSettingValueString(3, 6, + self.callid2str(cid.ani_code), + False) + rs = RadioSetting("ani_code", "ANI Edit", my_callid) + rs.set_apply_callback(apply_ani_id, cid) key_grp.append(rs) rs = RadioSetting("pf1_shrt", "PF1 SHORT Key function", RadioSettingValueList( - PFKEYSHORT_LIST, - PFKEYSHORT_LIST[_settings.pf1_shrt])) + pfkeyshort, + pfkeyshort[_settings.pf1_shrt])) key_grp.append(rs) rs = RadioSetting("pf1_long", "PF1 LONG Key function", RadioSettingValueList( - PFKEYLONG_LIST, - PFKEYLONG_LIST[_settings.pf1_long])) - key_grp.append(rs) - rs = RadioSetting("pf2_shrt", "PF2 SHORT Key function", - RadioSettingValueList( - PFKEYSHORT_LIST, - PFKEYSHORT_LIST[_settings.pf2_shrt])) - key_grp.append(rs) - rs = RadioSetting("pf2_long", "PF2 LONG Key function", - RadioSettingValueList( - PFKEYLONG_LIST, - PFKEYLONG_LIST[_settings.pf2_long])) + pfkeylong, + pfkeylong[_settings.pf1_long])) key_grp.append(rs) + if self.MODEL != "KG-UV8H": + rs = RadioSetting("pf2_shrt", "PF2 SHORT Key function", + RadioSettingValueList( + pfkeyshort, + pfkeyshort[_settings.pf2_shrt])) + key_grp.append(rs) + rs = RadioSetting("pf2_long", "PF2 LONG Key function", + RadioSettingValueList( + pfkeylong, + pfkeylong[_settings.pf2_long])) + key_grp.append(rs) # SCAN GROUP settings rs = RadioSetting("ScnGrpA_Act", "Scan Group A Active", @@ -1210,145 +1841,172 @@ class KG935GRadio(chirp_common.CloneModeRadio, # VFO A Settings # - rs = RadioSetting("work_mode_a", "VFO A Workmode", - RadioSettingValueList(WORKMODE_LIST, - WORKMODE_LIST[_settings. - work_mode_a])) + rs = RadioSetting("work_mode_a", vfo_area + "A Workmode", + RadioSettingValueList(workmodelist, + workmodelist[_settings. + work_mode_a])) vfoa_grp.append(rs) - rs = RadioSetting("work_ch_a", "VFO A Work Channel", + rs = RadioSetting("work_ch_a", vfo_area + "A Work Channel", RadioSettingValueInteger(1, 999, _settings.work_ch_a)) vfoa_grp.append(rs) - rs = RadioSetting("vfoa.rxfreq", "VFO A Rx Frequency (MHz)", + rs = RadioSetting("vfoa.rxfreq", vfo_area + "A Rx Frequency (MHz)", RadioSettingValueFloat( 30.00000, 999.999999, (_vfoa.rxfreq / 100000.0), 0.000001, 6)) vfoa_grp.append(rs) - - rs = RadioSetting("vfoa.rxtone", "VFOA Rx tone", + if self.MODEL == "KG-UV8H": + rs = RadioSetting("vfoa.offset", vfo_area + "A Offset (MHz)", + RadioSettingValueFloat( + 0.00000, 599.999999, + (_vfoa.offset / 100000.0), 0.000001, 6)) + vfoa_grp.append(rs) + + rs = RadioSetting("vfoa.rxtone", vfo_area + "A Rx tone", RadioSettingValueMap( TONE_MAP, _vfoa.rxtone)) vfoa_grp.append(rs) - rs = RadioSetting("vfoa.txtone", "VFOA Tx tone", + rs = RadioSetting("vfoa.txtone", vfo_area + "A Tx tone", RadioSettingValueMap( TONE_MAP, _vfoa.txtone)) vfoa_grp.append(rs) - -# MRT - AND power with 0x03 to display only the lower 2 bits for -# power level and to clear the upper bits -# MRT - any bits set in the upper 2 bits will cause radio to show -# invalid values for power level and a display glitch -# MRT - when PTT is pushed + # MRT - AND power with 0x03 to display only the lower 2 bits for + # power level and to clear the upper bits + # MRT - any bits set in the upper 2 bits will cause radio to show + # invalid values for power level and a display glitch + # MRT - when PTT is pushed _vfoa.power = _vfoa.power & 0x3 if _vfoa.power > 2: _vfoa.power = 2 - rs = RadioSetting("vfoa.power", "VFO A Power", + rs = RadioSetting("vfoa.power", vfo_area + "A Power", RadioSettingValueList( POWER_LIST, POWER_LIST[_vfoa.power])) vfoa_grp.append(rs) - rs = RadioSetting("vfoa.iswide", "VFO A Wide/Narrow", + rs = RadioSetting("vfoa.iswide", vfo_area + "A Wide/Narrow", RadioSettingValueList( BANDWIDTH_LIST, BANDWIDTH_LIST[_vfoa.iswide])) vfoa_grp.append(rs) - rs = RadioSetting("vfoa.mute_mode", "VFO A Mute (SP Mute)", + rs = RadioSetting("vfoa.mute_mode", vfo_area + "A Mute (SP Mute)", RadioSettingValueList( SPMUTE_LIST, SPMUTE_LIST[_vfoa.mute_mode])) vfoa_grp.append(rs) - rs = RadioSetting("VFO_repeater_a", "VFO A Repeater", - RadioSettingValueBoolean(_settings.VFO_repeater_a)) - vfoa_grp.append(rs) + if self.MODEL == "KG-UV8H": + rs = RadioSetting("vfoa.ofst_dir", vfo_area + "A Shift Dir", + RadioSettingValueList( + OFFSET_LIST, OFFSET_LIST[_vfoa.ofst_dir])) + vfoa_grp.append(rs) + else: + rs = RadioSetting("VFO_repeater_a", vfo_area + "A Repeater", + RadioSettingValueBoolean( + _settings.VFO_repeater_a)) + vfoa_grp.append(rs) - rs = RadioSetting("vfoa.scrambler", "VFO A Descramble", + rs = RadioSetting("vfoa.scrambler", vfo_area + "A Descramble", RadioSettingValueList( SCRAMBLE_LIST, SCRAMBLE_LIST[_vfoa.scrambler])) vfoa_grp.append(rs) - rs = RadioSetting("vfoa.cmpndr", "VFO A Compander", + rs = RadioSetting("vfoa.cmpndr", vfo_area + "A Compander", RadioSettingValueList( ONOFF_LIST, ONOFF_LIST[_vfoa.cmpndr])) vfoa_grp.append(rs) - rs = RadioSetting("vfoa.step", "VFO A Step (kHz)", + rs = RadioSetting("vfoa.step", vfo_area + "A Step (kHz)", RadioSettingValueList( STEP_LIST, STEP_LIST[_vfoa.step])) vfoa_grp.append(rs) - rs = RadioSetting("vfoa.squelch", "VFO A Squelch", + rs = RadioSetting("vfoa.squelch", vfo_area + "A Squelch", RadioSettingValueList( LIST_10, LIST_10[_vfoa.squelch])) vfoa_grp.append(rs) # VFO B Settings - rs = RadioSetting("work_mode_b", "VFO B Workmode", - RadioSettingValueList(WORKMODE_LIST, - WORKMODE_LIST[_settings. - work_mode_b])) + rs = RadioSetting("work_mode_b", vfo_area + "B Workmode", + RadioSettingValueList(workmodelist, + workmodelist[_settings. + work_mode_b])) vfob_grp.append(rs) - rs = RadioSetting("work_ch_b", "VFO B Work Channel", + rs = RadioSetting("work_ch_b", vfo_area + "B Work Channel", RadioSettingValueInteger(1, 999, _settings.work_ch_b)) vfob_grp.append(rs) - rs = RadioSetting("vfob.rxfreq", "VFO B Rx Frequency (MHz)", + rs = RadioSetting("vfob.rxfreq", vfo_area + "B Rx Frequency (MHz)", RadioSettingValueFloat( 30.000000, 999.999999, (_vfob.rxfreq / 100000.0), 0.000001, 6)) vfob_grp.append(rs) - rs = RadioSetting("vfob.rxtone", "VFOB Rx tone", + + if self.MODEL == "KG-UV8H": + rs = RadioSetting("vfob.offset", vfo_area + "B Offset (MHz)", + RadioSettingValueFloat( + 0.00000, 599.999999, + (_vfob.offset / 100000.0), 0.000001, 6)) + vfob_grp.append(rs) + + rs = RadioSetting("vfob.rxtone", vfo_area + "B Rx tone", RadioSettingValueMap( TONE_MAP, _vfob.rxtone)) vfob_grp.append(rs) - rs = RadioSetting("vfob.txtone", "VFOB Tx tone", + rs = RadioSetting("vfob.txtone", vfo_area + "B Tx tone", RadioSettingValueMap( TONE_MAP, _vfob.txtone)) vfob_grp.append(rs) -# MRT - AND power with 0x03 to display only the lower 2 bits for -# power level and to clear the upper bits -# MRT - any bits set in the upper 2 bits will cause radio to show -# invalid values for power level and a display glitch -# MRT - when PTT is pushed + # MRT - AND power with 0x03 to display only the lower 2 bits for + # power level and to clear the upper bits + # MRT - any bits set in the upper 2 bits will cause radio to show + # invalid values for power level and a display glitch + # MRT - when PTT is pushed _vfob.power = _vfob.power & 0x3 if _vfob.power > 2: _vfob.power = 2 - rs = RadioSetting("vfob.power", "VFO B Power", + rs = RadioSetting("vfob.power", vfo_area + "B Power", RadioSettingValueList( POWER_LIST, POWER_LIST[_vfob.power])) vfob_grp.append(rs) - rs = RadioSetting("vfob.iswide", "VFO B Wide/Narrow", + rs = RadioSetting("vfob.iswide", vfo_area + "B Wide/Narrow", RadioSettingValueList( BANDWIDTH_LIST, BANDWIDTH_LIST[_vfob.iswide])) vfob_grp.append(rs) - rs = RadioSetting("vfob.mute_mode", "VFO B Mute (SP Mute)", + rs = RadioSetting("vfob.mute_mode", vfo_area + "B Mute (SP Mute)", RadioSettingValueList( SPMUTE_LIST, SPMUTE_LIST[_vfob.mute_mode])) vfob_grp.append(rs) - rs = RadioSetting("VFO_repeater_b", "VFO B Repeater", - RadioSettingValueBoolean(_settings.VFO_repeater_b)) - vfob_grp.append(rs) + if self.MODEL == "KG-UV8H": + rs = RadioSetting("vfob.ofst_dir", vfo_area + "B Shift Dir", + RadioSettingValueList( + OFFSET_LIST, OFFSET_LIST[_vfob.ofst_dir])) + vfob_grp.append(rs) + else: + rs = RadioSetting("VFO_repeater_b", vfo_area + "B Repeater", + RadioSettingValueBoolean( + _settings.VFO_repeater_b)) + vfob_grp.append(rs) - rs = RadioSetting("vfob.scrambler", "VFO B Descramble", + rs = RadioSetting("vfob.scrambler", vfo_area + "B Descramble", RadioSettingValueList( SCRAMBLE_LIST, SCRAMBLE_LIST[_vfob.scrambler])) vfob_grp.append(rs) - rs = RadioSetting("vfob.cmpndr", "VFO B Compander", + rs = RadioSetting("vfob.cmpndr", vfo_area + "B Compander", RadioSettingValueList( ONOFF_LIST, ONOFF_LIST[_vfob.cmpndr])) vfob_grp.append(rs) - rs = RadioSetting("vfob.step", "VFO B Step (kHz)", + rs = RadioSetting("vfob.step", vfo_area + "B Step (kHz)", RadioSettingValueList( STEP_LIST, STEP_LIST[_vfob.step])) vfob_grp.append(rs) - rs = RadioSetting("vfob.squelch", "VFO B Squelch", + rs = RadioSetting("vfob.squelch", vfo_area + "B Squelch", RadioSettingValueList( LIST_10, LIST_10[_vfob.squelch])) vfob_grp.append(rs) -# FM RADIO PRESETS + # FM RADIO PRESETS -# memory stores raw integer value like 760 -# radio will divide 760 by 10 and interpret correctly at 76.0Mhz + # memory stores raw integer value like 760 + # radio will divide 760 by 10 and interpret correctly at 76.0 MHz for i in range(1, 21): chan = str(i) rs = RadioSetting("FM_radio" + chan, "FM Preset" + chan, @@ -1359,8 +2017,7 @@ class KG935GRadio(chirp_common.CloneModeRadio, 0.1, 1)) fmradio_grp.append(rs) -# Freq Limits settings - # + # Freq Limits settings rs = RadioSetting("vhf_limits.rx_start", "VHF RX Lower Limit (MHz)", RadioSettingValueFloat( 30.000000, 299.999999, @@ -1389,23 +2046,10 @@ class KG935GRadio(chirp_common.CloneModeRadio, 0.000001, 6)) lmt_grp.append(rs) -# MRT - TX Limits do not appear to change radio's ability -# to transmit on other freqs. -# MRT - Appears that the radio firmware prevent Tx -# on anything other than a valid GMRS Freq - - # rs = RadioSetting("vhf_limits.tx_start", "VHF TX Lower Limit", - # RadioSettingValueInteger( - # 10000000, 299999999, - # self._memobj.vhf_limits.tx_start * 10, 5000)) - # val.set_mutable(False) - # vhf_lmt_grp.append(rs) - # rs = RadioSetting("vhf_limits.tx_stop", "VHF TX Upper Limit", - # RadioSettingValueInteger( - # 10000000, 299999999, - # self._memobj.vhf_limits.tx_stop * 10, 5000)) - # val.set_mutable(False) - # vhf_lmt_grp.append(rs) + # MRT - TX Limits do not appear to change radio's ability + # to transmit on other freqs. + # MRT - Appears that the radio firmware prevent Tx + # on anything other than a valid GMRS Freq rs = RadioSetting("uhf_limits.rx_start", "UHF RX Lower Limit (MHz)", RadioSettingValueFloat( @@ -1433,20 +2077,7 @@ class KG935GRadio(chirp_common.CloneModeRadio, 0.000001, 6)) lmt_grp.append(rs) - # rs = RadioSetting("uhf_limits.tx_start", "UHF TX Lower Limit", - # RadioSettingValueInteger( - # 300000000, 999999999, - # self._memobj.uhf_limits.tx_start * 10, 5000)) - # uhf_lmt_grp.append(rs) - # rs = RadioSetting("uhf_limits.tx_stop", "UHF TX Upper Limit", - # RadioSettingValueInteger( - # 300000000, 999999999, - # self._memobj.uhf_limits.tx_stop * 10, 5000)) - # uhf_lmt_grp.append(rs) - - -# OEM info - # + # OEM info def _decode(lst): _str = ''.join([chr(int(c)) for c in lst if chr(int(c)) in chirp_common.CHARSET_ASCII]) @@ -1458,8 +2089,12 @@ class KG935GRadio(chirp_common.CloneModeRadio, _str = _decode(self._memobj.oem_info.model) val = RadioSettingValueString(0, 8, _str) val.set_mutable(True) - rs = RadioSetting("oem_info.model", "Model / Bottom Banner", val) - oem_grp.append(rs) + rs = RadioSetting("oem_info.model", areamsglabel, val) + if self.MODEL == "KG-935G": + oem_grp.append(rs) + else: + key_grp.append(rs) + _str = _decode(self._memobj.oem_info.oem1) val = RadioSettingValueString(0, 15, _str) val.set_mutable(False) @@ -1472,12 +2107,7 @@ class KG935GRadio(chirp_common.CloneModeRadio, rs = RadioSetting("oem_info.oem2", "Firmware Version ??", 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) @@ -1506,7 +2136,13 @@ class KG935GRadio(chirp_common.CloneModeRadio, bits = element.get_name().split(".") obj = self._memobj for bit in bits[:-1]: - obj = getattr(obj, bit) + if "[" in bit and "]" in bit: + bit, index = bit.split("[", 1) + index, junk = index.split("]", 1) + index = int(index) + obj = getattr(obj, bit)[index] + else: + obj = getattr(obj, bit) setting = bits[-1] else: obj = self._memobj.settings @@ -1531,17 +2167,61 @@ class KG935GRadio(chirp_common.CloneModeRadio, int(element.values()[0]._current * 10.0)) else: setattr(obj, setting, element.value) - except Exception as e: + except Exception: LOG.debug(element.get_name()) raise def _is_freq(self, element): - return "rxfreq" in element.get_name() or \ - "txoffset" in element.get_name() or \ - "rx_start" in element.get_name() or \ - "rx_stop" in element.get_name() or \ - "tx_start" in element.get_name() or \ - "tx_stop" in element.get_name() + return ("rxfreq" in element.get_name() or + "txoffset" in element.get_name() or + "rx_start" in element.get_name() or + "rx_stop" in element.get_name() or + "tx_start" in element.get_name() or + "tx_stop" in element.get_name()) def _is_fmradio(self, element): return "FM_radio" in element.get_name() + + def callid2str(self, cid): + """Caller ID per MDC-1200 spec? Must be 3-6 digits (100 - 999999). + One digit (binary) per byte, terminated with '0xc' + """ + + bin2ascii = "0123456789" + cidstr = "" + for i in range(0, 6): + b = cid[i].get_value() + # Handle fluky firmware 0x0a is sometimes used instead of 0x00 + if b == 0x0a: + b = 0x00 + if b == 0xc or b == 0xf: # the cid EOL + break + if b > 0xa: + raise InvalidValueError( + "Caller ID code has illegal byte 0x%x" % b) + cidstr += bin2ascii[b] + return cidstr + + +@directory.register +class KG935GPlusRadio(KG935GRadio): + + """Wouxun KG-935G Plus""" + VENDOR = "Wouxun" + MODEL = "KG-935G Plus" + NEEDS_COMPAT_SERIAL = False + + def process_mmap(self): + self._memobj = bitwise.parse(_MEM_FORMAT_935GPLUS, self._mmap) + + +@directory.register +class KGUV8HRadio(KG935GRadio): + + """Wouxun KG-UV8H""" + VENDOR = "Wouxun" + MODEL = "KG-UV8H" + NEEDS_COMPAT_SERIAL = False + + def process_mmap(self): + self._memobj = bitwise.parse(_MEM_FORMAT_UV8H, self._mmap) diff --git a/chirp/drivers/kguv8d.py b/chirp/drivers/kguv8d.py index 3b921f9..490b814 100644 --- a/chirp/drivers/kguv8d.py +++ b/chirp/drivers/kguv8d.py @@ -16,13 +16,13 @@ """Wouxun KG-UV8D radio management module""" import time -import os import logging from chirp import util, chirp_common, bitwise, memmap, errors, directory from chirp.settings import RadioSetting, RadioSettingGroup, \ RadioSettingValueBoolean, RadioSettingValueList, \ RadioSettingValueInteger, RadioSettingValueString, \ RadioSettings +import struct LOG = logging.getLogger(__name__) @@ -280,32 +280,31 @@ class KGUV8DRadio(chirp_common.CloneModeRadio, """Wouxun KG-UV8D""" VENDOR = "Wouxun" MODEL = "KG-UV8D" - _model = "KG-UV8D" + _model = b"KG-UV8D" _file_ident = b"KGUV8D" BAUD_RATE = 19200 POWER_LEVELS = [chirp_common.PowerLevel("L", watts=1), chirp_common.PowerLevel("H", watts=5)] - _mmap = "" + NEEDS_COMPAT_SERIAL = False + _record_start = 0x7D def _checksum(self, data): cs = 0 for byte in data: - cs += ord(byte) + cs += byte return cs % 256 def _write_record(self, cmd, payload=None): # build the packet - _packet = '\x7d' + chr(cmd) + '\xff' _length = 0 if payload: _length = len(payload) - # update the length field - _packet += chr(_length) + _packet = struct.pack('BBBB', self._record_start, cmd, 0xFF, _length) if payload: # add the chars to the packet _packet += payload # calculate and add the checksum to the packet - _packet += chr(self._checksum(_packet[1:])) + _packet += bytes([self._checksum(_packet[1:])]) LOG.debug("Sent:\n%s" % util.hexprint(_packet)) self.pipe.write(_packet) @@ -314,12 +313,12 @@ class KGUV8DRadio(chirp_common.CloneModeRadio, _header = self.pipe.read(4) if len(_header) != 4: raise errors.RadioError('Radio did not respond') - _length = ord(_header[3]) + _length = struct.unpack('xxxB', _header)[0] _packet = self.pipe.read(_length) _cs = self._checksum(_header[1:]) _cs += self._checksum(_packet) _cs %= 256 - _rcs = ord(self.pipe.read(1)) + _rcs = self.pipe.read(1)[0] LOG.debug("_cs =%x", _cs) LOG.debug("_rcs=%x", _rcs) return (_rcs != _cs, _packet) @@ -330,11 +329,11 @@ class KGUV8DRadio(chirp_common.CloneModeRadio, # attempts return the correct checksum... (well it does on my radio!) # # The ID record returned by the radio also includes the current frequency range -# as 4 bytes big-endian in 10Hz increments +# as 4 bytes big-endian in 10 Hz increments # # Offset # 0:10 Model, zero padded (Use first 7 chars for 'KG-UV8D') -# 11:14 UHF rx lower limit (in units of 10Hz) +# 11:14 UHF rx lower limit (in units of 10 Hz) # 15:18 UHF rx upper limit # 19:22 UHF tx lower limit # 23:26 UHF tx upper limit @@ -383,11 +382,11 @@ class KGUV8DRadio(chirp_common.CloneModeRadio, def sync_out(self): self._upload() - # TODO: This is a dumb, brute force method of downlolading the memory. + # TODO: This is a dumb, brute force method of downloading the memory. # it would be smarter to only load the active areas and none of # the padding/unused areas. def _download(self): - """Talk to a wouxun KG-UV8D and do a download""" + """Talk to a Wouxun KG-UV8D and do a download""" try: self._identify() return self._do_download(0, 32768, 64) @@ -399,9 +398,9 @@ class KGUV8DRadio(chirp_common.CloneModeRadio, def _do_download(self, start, end, blocksize): # allocate & fill memory - image = "" + image = b"" for i in range(start, end, blocksize): - req = chr(i / 256) + chr(i % 256) + chr(blocksize) + req = struct.pack('>HB', i, blocksize) self._write_record(CMD_RD, req) cs_error, resp = self._read_record() if cs_error: @@ -417,10 +416,10 @@ class KGUV8DRadio(chirp_common.CloneModeRadio, status.msg = "Cloning from radio" self.status_fn(status) self._finish() - return memmap.MemoryMap(''.join(image)) + return memmap.MemoryMapBytes(image) def _upload(self): - """Talk to a wouxun KG-UV8D and do a upload""" + """Talk to a Wouxun KG-UV8D and do a upload""" try: self._identify() self._do_upload(0, 32768, 64) @@ -433,13 +432,13 @@ class KGUV8DRadio(chirp_common.CloneModeRadio, def _do_upload(self, start, end, blocksize): ptr = start for i in range(start, end, blocksize): - req = chr(i / 256) + chr(i % 256) + req = struct.pack('>H', i) chunk = self.get_mmap()[ptr:ptr + blocksize] self._write_record(CMD_WR, req + chunk) LOG.debug(util.hexprint(req + chunk)) cserr, ack = self._read_record() LOG.debug(util.hexprint(ack)) - j = ord(ack[0]) * 256 + ord(ack[1]) + j = struct.unpack('>H', ack)[0] if cserr or j != ptr: raise Exception("Radio did not ack block %i" % ptr) ptr += blocksize @@ -1038,7 +1037,7 @@ class KGUV8DRadio(chirp_common.CloneModeRadio, def get_settings(self): try: return self._get_settings() - except: + except Exception: import traceback LOG.error("Failed to parse settings: %s", traceback.format_exc()) return None diff --git a/chirp/drivers/kguv8dplus.py b/chirp/drivers/kguv8dplus.py index 33739d7..b80b358 100644 --- a/chirp/drivers/kguv8dplus.py +++ b/chirp/drivers/kguv8dplus.py @@ -25,8 +25,8 @@ """Wouxun KG-UV8D Plus radio management module""" +import struct import time -import os import logging from chirp import util, chirp_common, bitwise, memmap, errors, directory from chirp.settings import RadioSetting, RadioSettingGroup, \ @@ -266,7 +266,7 @@ _MEM_FORMAT = """ #seekto 0x4780; struct { u8 name[8]; - u8 unknown[4]; + u8 unknown[4]; } names[1000]; #seekto 0x7670; @@ -292,79 +292,69 @@ _MEM_FORMAT = """ # the maximum payload size (from the Wouxun software) seems to be 66 bytes # (2 bytes location + 64 bytes data). + @directory.register class KGUV8DPlusRadio(chirp_common.CloneModeRadio, - chirp_common.ExperimentalRadio): + chirp_common.ExperimentalRadio): """Wouxun KG-UV8D Plus""" VENDOR = "Wouxun" MODEL = "KG-UV8D Plus" - _model = "KG-UV8D" + _model = b"KG-UV8D" _file_ident = b"kguv8dplus" BAUD_RATE = 19200 POWER_LEVELS = [chirp_common.PowerLevel("L", watts=1), chirp_common.PowerLevel("H", watts=5)] + NEEDS_COMPAT_SERIAL = False _mmap = "" + _record_start = 0x7A def _checksum(self, data): cs = 0 for byte in data: - cs += ord(byte) - return chr(cs % 256) - - def _write_record(self, cmd, payload = None): - # build the packet - _header = '\x7a' + chr(cmd) + '\xff' - - _length = 0 - if payload: - _length = len(payload) - - # update the length field - _header += chr(_length) - if payload: - # calculate checksum then add it with the payload to the packet and encrypt - crc = self._checksum(_header[1:] + payload) - payload += crc - _header += self.encrypt(payload) - else: - # calculate and add encrypted checksum to the packet - crc = self._checksum(_header[1:]) - _header += self.strxor(crc, '\x57') - LOG.debug("Sent:\n%s" % util.hexprint(_header)) - self.pipe.write(_header) + cs += byte + return cs % 256 + + def _write_record(self, cmd, payload=b''): + _packet = struct.pack('BBBB', self._record_start, cmd, 0xFF, + len(payload)) + checksum = bytes([self._checksum(_packet[1:] + payload)]) + _packet += self.encrypt(payload + checksum) + LOG.debug("Sent:\n%s" % util.hexprint(_packet)) + self.pipe.write(_packet) def _read_record(self): # read 4 chars for the header _header = self.pipe.read(4) if len(_header) != 4: raise errors.RadioError('Radio did not respond') - _length = ord(_header[3]) + _length = struct.unpack('xxxB', _header)[0] _packet = self.pipe.read(_length) _rcs_xor = _packet[-1] _packet = self.decrypt(_packet) - _cs = ord(self._checksum(_header[1:] + _packet)) - # read the checksum and decrypt it - _rcs = ord(self.strxor(self.pipe.read(1), _rcs_xor)) + _cs = self._checksum(_header[1:]) + _cs += self._checksum(_packet) + _cs %= 256 + _rcs = self.strxor(self.pipe.read(1)[0], _rcs_xor)[0] LOG.debug("_cs =%x", _cs) LOG.debug("_rcs=%x", _rcs) return (_rcs != _cs, _packet) - + def decrypt(self, data): - result = '' + result = b'' for i in range(len(data)-1, 0, -1): result += self.strxor(data[i], data[i - 1]) - result += self.strxor(data[0], '\x57') + result += self.strxor(data[0], 0x57) return result[::-1] def encrypt(self, data): - result = self.strxor('\x57', data[0]) + result = self.strxor(0x57, data[0]) for i in range(1, len(data), 1): result += self.strxor(result[i - 1], data[i]) return result - def strxor (self, xora, xorb): - return chr(ord(xora) ^ ord(xorb)) + def strxor(self, xora, xorb): + return bytes([xora ^ xorb]) # Identify the radio # @@ -372,11 +362,11 @@ class KGUV8DPlusRadio(chirp_common.CloneModeRadio, # attempts return the correct checksum... (well it does on my radio!) # # The ID record returned by the radio also includes the current frequency range -# as 4 bytes big-endian in 10Hz increments +# as 4 bytes big-endian in 10 Hz increments # # Offset # 0:10 Model, zero padded (Use first 7 chars for 'KG-UV8D') -# 11:14 UHF rx lower limit (in units of 10Hz) +# 11:14 UHF rx lower limit (in units of 10 Hz) # 15:18 UHF rx upper limit # 19:22 UHF tx lower limit # 23:26 UHF tx upper limit @@ -387,7 +377,9 @@ class KGUV8DPlusRadio(chirp_common.CloneModeRadio, # @classmethod def match_model(cls, filedata, filename): - return cls._file_ident in b'kg' + filedata[0x426:0x430].replace(b'(', b'').replace(b')', b'').lower() + return (cls._file_ident in b'kg' + + filedata[0x426:0x430].replace(b'(', b'').replace(b')', + b'').lower()) def _identify(self): """Do the identification dance""" @@ -429,7 +421,7 @@ class KGUV8DPlusRadio(chirp_common.CloneModeRadio, # It would be smarter to only load the active areas and none of # the padding/unused areas. Padding still need to be investigated. def _download(self): - """Talk to a wouxun KG-UV8D Plus and do a download""" + """Talk to a Wouxun KG-UV8D Plus and do a download""" try: self._identify() return self._do_download(0, 32768, 64) @@ -441,9 +433,9 @@ class KGUV8DPlusRadio(chirp_common.CloneModeRadio, def _do_download(self, start, end, blocksize): # allocate & fill memory - image = "" + image = b"" for i in range(start, end, blocksize): - req = chr(i / 256) + chr(i % 256) + chr(blocksize) + req = struct.pack('>HB', i, blocksize) self._write_record(CMD_RD, req) cs_error, resp = self._read_record() if cs_error: @@ -458,10 +450,10 @@ class KGUV8DPlusRadio(chirp_common.CloneModeRadio, status.msg = "Cloning from radio" self.status_fn(status) self._finish() - return memmap.MemoryMap(''.join(image)) + return memmap.MemoryMapBytes(image) def _upload(self): - """Talk to a wouxun KG-UV8D Plus and do a upload""" + """Talk to a Wouxun KG-UV8D Plus and do a upload""" try: self._identify() self._do_upload(0, 32768, 64) @@ -474,13 +466,13 @@ class KGUV8DPlusRadio(chirp_common.CloneModeRadio, def _do_upload(self, start, end, blocksize): ptr = start for i in range(start, end, blocksize): - req = chr(i / 256) + chr(i % 256) + req = struct.pack('>H', i) chunk = self.get_mmap()[ptr:ptr + blocksize] self._write_record(CMD_WR, req + chunk) LOG.debug(util.hexprint(req + chunk)) cserr, ack = self._read_record() LOG.debug(util.hexprint(ack)) - j = ord(ack[0]) * 256 + ord(ack[1]) + j = struct.unpack('>H', ack)[0] if cserr or j != ptr: raise Exception("Radio did not ack block %i" % ptr) ptr += blocksize @@ -517,7 +509,7 @@ class KGUV8DPlusRadio(chirp_common.CloneModeRadio, rf.valid_name_length = 8 rf.valid_duplexes = ["", "-", "+", "split", "off"] rf.valid_bands = [(134000000, 175000000), # supports 2m - (400000000, 520000000)] # supports 70cm + (300000000, 520000000)] # supports 70cm rf.valid_characters = chirp_common.CHARSET_ASCII rf.valid_tuning_steps = STEPS rf.memory_bounds = (1, 999) # 999 memories @@ -537,11 +529,11 @@ class KGUV8DPlusRadio(chirp_common.CloneModeRadio, def _get_tone(self, _mem, mem): def _get_dcs(val): code = int("%03o" % (val & 0x07FF)) - pol = (val & 0x8000) and "R" or "N" + pol = (val & 0x2000) and "R" or "N" return code, pol tpol = False - if _mem.txtone != 0xFFFF and (_mem.txtone & 0x2800) == 0x2800: + if _mem.txtone != 0xFFFF and (_mem.txtone & 0x4000) == 0x4000: tcode, tpol = _get_dcs(_mem.txtone) mem.dtcs = tcode txmode = "DTCS" @@ -552,7 +544,7 @@ class KGUV8DPlusRadio(chirp_common.CloneModeRadio, txmode = "" rpol = False - if _mem.rxtone != 0xFFFF and (_mem.rxtone & 0x2800) == 0x2800: + if _mem.rxtone != 0xFFFF and (_mem.rxtone & 0x4000) == 0x4000: rcode, rpol = _get_dcs(_mem.rxtone) mem.rx_dtcs = rcode rxmode = "DTCS" @@ -623,9 +615,9 @@ class KGUV8DPlusRadio(chirp_common.CloneModeRadio, def _set_tone(self, mem, _mem): def _set_dcs(code, pol): - val = int("%i" % code, 8) + 0x2800 + val = int("%i" % code, 8) + 0x4000 if pol == "R": - val += 0x8000 + val += 0x2000 return val rx_mode = tx_mode = None @@ -720,8 +712,8 @@ class KGUV8DPlusRadio(chirp_common.CloneModeRadio, 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); + 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) @@ -751,8 +743,9 @@ class KGUV8DPlusRadio(chirp_common.CloneModeRadio, RadioSettingValueInteger(0, 10, _settings.toalarm)) cfg_grp.append(rs) rs = RadioSetting("roger_beep", "Roger Beep", - RadioSettingValueList(ROGER_LIST, - ROGER_LIST[_settings.roger_beep])) + RadioSettingValueList(ROGER_LIST, + ROGER_LIST[ + _settings.roger_beep])) cfg_grp.append(rs) rs = RadioSetting("power_save", "Power save", RadioSettingValueBoolean(_settings.power_save)) @@ -855,12 +848,13 @@ class KGUV8DPlusRadio(chirp_common.CloneModeRadio, 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])) + 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)) @@ -899,12 +893,13 @@ class KGUV8DPlusRadio(chirp_common.CloneModeRadio, 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])) + 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)) @@ -943,8 +938,7 @@ class KGUV8DPlusRadio(chirp_common.CloneModeRadio, 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] @@ -959,6 +953,7 @@ class KGUV8DPlusRadio(chirp_common.CloneModeRadio, 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): @@ -986,12 +981,12 @@ class KGUV8DPlusRadio(chirp_common.CloneModeRadio, # rs = RadioSetting("uhf_limits.rx_start", "UHF RX Lower Limit", RadioSettingValueInteger( - 400000000, 520000000, + 300000000, 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, + 300000000, 520000000, self._memobj.uhf_limits.rx_stop * 10, 5000)) uhf_lmt_grp.append(rs) rs = RadioSetting("uhf_limits.tx_start", "UHF TX Lower Limit", @@ -1072,7 +1067,7 @@ class KGUV8DPlusRadio(chirp_common.CloneModeRadio, def get_settings(self): try: return self._get_settings() - except: + except Exception: import traceback LOG.error("Failed to parse settings: %s", traceback.format_exc()) return None @@ -1103,7 +1098,7 @@ class KGUV8DPlusRadio(chirp_common.CloneModeRadio, setattr(obj, setting, int(element.value)/10) else: setattr(obj, setting, element.value) - except Exception as e: + except Exception: LOG.debug(element.get_name()) raise @@ -1114,4 +1109,3 @@ class KGUV8DPlusRadio(chirp_common.CloneModeRadio, or "rx_stop" in element.get_name() \ or "tx_start" in element.get_name() \ or "tx_stop" in element.get_name() - diff --git a/chirp/drivers/kguv8e.py b/chirp/drivers/kguv8e.py index 7e0d035..b290af7 100644 --- a/chirp/drivers/kguv8e.py +++ b/chirp/drivers/kguv8e.py @@ -19,8 +19,8 @@ """Wouxun KG-UV8E radio management module""" +import struct import time -import os import logging from chirp import util, chirp_common, bitwise, memmap, errors, directory from chirp.settings import RadioSetting, RadioSettingGroup, \ @@ -57,7 +57,7 @@ PONMSG_LIST = ["Bitmap", "Battery Volts"] SPMUTE_LIST = ["QT", "QT+DTMF", "QT*DTMF"] DTMFST_LIST = ["DT-ST", "ANI-ST", "DT-ANI", "Off"] DTMF_TIMES = ["%s" % x for x in range(50, 501, 10)] -RPTSET_LIST = ["", "X-DIRRPT", "X-TWRPT"] # TODO < what is index 0? +RPTSET_LIST = ["", "X-DIRRPT", "X-TWRPT"] # TODO < what is index 0? ALERTS = [1750, 2100, 1000, 1450] ALERTS_LIST = [str(x) for x in ALERTS] PTTID_LIST = ["Begin", "End", "Both"] @@ -275,24 +275,25 @@ _MEM_FORMAT = """ u8 valid[1000]; """ - # Support for the Wouxun KG-UV8E radio - # Serial coms are at 19200 baud - # The data is passed in variable length records - # Record structure: - # Offset Usage - # 0 start of record (\x7a) - # 1 Command (\x80 Identify \x81 End/Reboot \x82 Read \x83 Write) - # 2 direction (\xff PC-> Radio, \x00 Radio -> PC) - # 3 length of payload (excluding header/checksum) (n) - # 4 payload (n bytes) - # 4+n+1 checksum - byte sum (% 256) of bytes 1 -> 4+n - # - # Memory Read Records: - # the payload is 3 bytes, first 2 are offset (big endian), - # 3rd is number of bytes to read - # Memory Write Records: - # the maximum payload size (from the Wouxun software) seems to be 66 bytes - # (2 bytes location + 64 bytes data). +# Support for the Wouxun KG-UV8E radio +# Serial coms are at 19200 baud +# The data is passed in variable length records +# Record structure: +# Offset Usage +# 0 start of record (\x7a) +# 1 Command (\x80 Identify \x81 End/Reboot \x82 Read \x83 Write) +# 2 direction (\xff PC-> Radio, \x00 Radio -> PC) +# 3 length of payload (excluding header/checksum) (n) +# 4 payload (n bytes) +# 4+n+1 checksum - byte sum (% 256) of bytes 1 -> 4+n +# +# Memory Read Records: +# the payload is 3 bytes, first 2 are offset (big endian), +# 3rd is number of bytes to read +# Memory Write Records: +# the maximum payload size (from the Wouxun software) seems to be 66 bytes +# (2 bytes location + 64 bytes data). + @directory.register class KGUV8ERadio(chirp_common.CloneModeRadio, @@ -301,74 +302,60 @@ class KGUV8ERadio(chirp_common.CloneModeRadio, """Wouxun KG-UV8E""" VENDOR = "Wouxun" MODEL = "KG-UV8E" - _model = "KG-UV8D-A" - _file_ident = b"kguv8e" # lowercase + _model = b"KG-UV8D-A" + _file_ident = b"kguv8e" # lowercase BAUD_RATE = 19200 POWER_LEVELS = [chirp_common.PowerLevel("L", watts=1), chirp_common.PowerLevel("H", watts=5)] - _mmap = "" + _record_start = 0x7B + NEEDS_COMPAT_SERIAL = False def _checksum(self, data): cs = 0 for byte in data: - cs += ord(byte) - return chr(cs % 256) - - def _write_record(self, cmd, payload = None): - # build the packet - _header = '\x7b' + chr(cmd) + '\xff' + cs += byte + return cs % 256 - _length = 0 - if payload: - _length = len(payload) - - # update the length field - _header += chr(_length) - - if payload: - # calculate checksum then add it with the payload to the packet and encrypt - crc = self._checksum(_header[1:] + payload) - payload += crc - _header += self.encrypt(payload) - else: - # calculate and add encrypted checksum to the packet - crc = self._checksum(_header[1:]) - _header += self.strxor(crc, '\x57') - - try: - self.pipe.write(_header) - except Exception as e: - raise errors.RadioError("Failed to communicate with radio: %s" % e) + def _write_record(self, cmd, payload=b''): + _packet = struct.pack('BBBB', self._record_start, cmd, 0xFF, + len(payload)) + checksum = bytes([self._checksum(_packet[1:] + payload)]) + _packet += self.encrypt(payload + checksum) + LOG.debug("Sent:\n%s" % util.hexprint(_packet)) + self.pipe.write(_packet) def _read_record(self): # read 4 chars for the header _header = self.pipe.read(4) if len(_header) != 4: raise errors.RadioError('Radio did not respond') - _length = ord(_header[3]) + _length = struct.unpack('xxxB', _header)[0] _packet = self.pipe.read(_length) _rcs_xor = _packet[-1] _packet = self.decrypt(_packet) - _cs = ord(self._checksum(_header[1:] + _packet)) - # read the checksum and decrypt it - _rcs = ord(self.strxor(self.pipe.read(1), _rcs_xor)) + _cs = self._checksum(_header[1:]) + _cs += self._checksum(_packet) + _cs %= 256 + _rcs = self.strxor(self.pipe.read(1)[0], _rcs_xor)[0] + LOG.debug("_cs =%x", _cs) + LOG.debug("_rcs=%x", _rcs) return (_rcs != _cs, _packet) def decrypt(self, data): - result = '' + result = b'' for i in range(len(data)-1, 0, -1): result += self.strxor(data[i], data[i - 1]) - result += self.strxor(data[0], '\x57') + result += self.strxor(data[0], 0x57) return result[::-1] def encrypt(self, data): - result = self.strxor('\x57', data[0]) + result = self.strxor(0x57, data[0]) for i in range(1, len(data), 1): result += self.strxor(result[i - 1], data[i]) return result - def strxor (self, xora, xorb): - return chr(ord(xora) ^ ord(xorb)) + def strxor(self, xora, xorb): + return bytes([xora ^ xorb]) # Identify the radio # @@ -376,11 +363,11 @@ class KGUV8ERadio(chirp_common.CloneModeRadio, # attempts return the correct checksum... (well it does on my radio!) # # The ID record returned by the radio also includes the current frequency range - # as 4 bytes big-endian in 10Hz increments + # as 4 bytes big-endian in 10 Hz increments # # Offset # 0:10 Model, zero padded (Use first 7 chars for 'KG-UV8D') - # 11:14 UHF rx lower limit (in units of 10Hz) + # 11:14 UHF rx lower limit (in units of 10 Hz) # 15:18 UHF rx upper limit # 19:22 UHF tx lower limit # 23:26 UHF tx upper limit @@ -391,7 +378,7 @@ class KGUV8ERadio(chirp_common.CloneModeRadio, @classmethod def match_model(cls, filedata, filename): - id = cls._file_ident + id = cls._file_ident return cls._file_ident in b'kg' + filedata[0x426:0x430].replace(b'(', b'').replace(b')', b'').lower() def _identify(self): @@ -434,7 +421,7 @@ class KGUV8ERadio(chirp_common.CloneModeRadio, # It would be smarter to only load the active areas and none of # the padding/unused areas. Padding still need to be investigated. def _download(self): - """Talk to a wouxun KG-UV8E and do a download""" + """Talk to a Wouxun KG-UV8E and do a download""" try: self._identify() return self._do_download(0, 32768, 64) @@ -446,9 +433,9 @@ class KGUV8ERadio(chirp_common.CloneModeRadio, def _do_download(self, start, end, blocksize): # allocate & fill memory - image = "" + image = b"" for i in range(start, end, blocksize): - req = chr(i // 256) + chr(i % 256) + chr(blocksize) + req = struct.pack('>HB', i, blocksize) self._write_record(CMD_RD, req) cs_error, resp = self._read_record() if cs_error: @@ -463,10 +450,10 @@ class KGUV8ERadio(chirp_common.CloneModeRadio, status.msg = "Cloning from radio" self.status_fn(status) self._finish() - return memmap.MemoryMap(''.join(image)) + return memmap.MemoryMapBytes(image) def _upload(self): - """Talk to a wouxun KG-UV8E and do a upload""" + """Talk to a Wouxun KG-UV8E and do a upload""" try: self._identify() self._do_upload(0, 32768, 64) @@ -479,13 +466,13 @@ class KGUV8ERadio(chirp_common.CloneModeRadio, def _do_upload(self, start, end, blocksize): ptr = start for i in range(start, end, blocksize): - req = chr(i // 256) + chr(i % 256) + req = struct.pack('>H', i) chunk = self.get_mmap()[ptr:ptr + blocksize] self._write_record(CMD_WR, req + chunk) # ~ LOG.debug(util.hexprint(req + chunk)) cserr, ack = self._read_record() # ~ LOG.debug(util.hexprint(ack)) - j = ord(ack[0]) * 256 + ord(ack[1]) + j = struct.unpack('>H', ack)[0] if cserr or j != ptr: raise Exception("Radio did not ack block %i" % ptr) ptr += blocksize @@ -732,9 +719,9 @@ class KGUV8ERadio(chirp_common.CloneModeRadio, 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); + 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) @@ -869,7 +856,7 @@ class KGUV8ERadio(chirp_common.CloneModeRadio, smuteset])) cfg_grp.append(rs) - # + # # VFO A Settings # rs = RadioSetting("workmode_a", "VFO A Workmode", @@ -913,7 +900,7 @@ class KGUV8ERadio(chirp_common.CloneModeRadio, RadioSettingValueBoolean(_settings.bcl_a)) vfoa_grp.append(rs) - # + # # VFO B Settings # rs = RadioSetting("workmode_b", "VFO B Workmode", @@ -957,7 +944,7 @@ class KGUV8ERadio(chirp_common.CloneModeRadio, RadioSettingValueBoolean(_settings.bcl_b)) vfob_grp.append(rs) - # + # # Key Settings # _msg = str(_settings.dispstr).split("\0")[0] @@ -972,6 +959,7 @@ class KGUV8ERadio(chirp_common.CloneModeRadio, 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): @@ -1138,7 +1126,7 @@ class KGUV8ERadio(chirp_common.CloneModeRadio, setattr(obj, setting, int(element.value)/10) else: setattr(obj, setting, element.value) - except Exception as e: + except Exception: LOG.debug(element.get_name()) raise diff --git a/chirp/drivers/kguv920pa.py b/chirp/drivers/kguv920pa.py index d106763..903ec17 100644 --- a/chirp/drivers/kguv920pa.py +++ b/chirp/drivers/kguv920pa.py @@ -16,14 +16,13 @@ """Wouxun KG-UV920P-A radio management module based""" import time -import os import logging from chirp import util, chirp_common, bitwise, memmap, errors, directory from chirp.settings import RadioSetting, RadioSettingGroup, \ RadioSettingValueBoolean, RadioSettingValueList, \ RadioSettingValueInteger, RadioSettingValueString, \ - RadioSettingValueMap, RadioSettingValueFloat, RadioSettings, \ - InvalidValueError + RadioSettingValueMap, RadioSettingValueFloat, RadioSettings +import struct LOG = logging.getLogger(__name__) @@ -36,7 +35,7 @@ CHARSET_NUMERIC = "0123456789" CHARSET = "0123456789" + \ ":;<=>?@" + \ "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + \ - "[\]^_`" + \ + "[\\]^_`" + \ "abcdefghijklmnopqrstuvwxyz" + \ "{|}~\x4E" + \ " !\"#$%&'()*+,-./" @@ -333,30 +332,28 @@ _MEM_FORMAT = """ def _checksum(data): cs = 0 for byte in data: - cs += ord(byte) + cs += byte return cs % 16 def _str_decode(in_str): out_str = '' for c in in_str: - if isinstance(c, str): - c = ord(c) if c < len(CHARSET): out_str += CHARSET[c] return out_str.rstrip() def _str_encode(in_str): - out_str = '' + out_str = [] for c in in_str: try: - out_str += chr(CHARSET.index(c)) + out_str.append(CHARSET.index(c)) except ValueError: pass while len(out_str) < 8: - out_str += chr(CHARSET.index(' ')) - return out_str + out_str.append(CHARSET.index(' ')) + return bytes(out_str) def _freq_decode(in_freq, bytes=4): @@ -528,21 +525,18 @@ class KGUV920PARadio(chirp_common.CloneModeRadio, POWER_LEVELS = [chirp_common.PowerLevel("L", watts=5), chirp_common.PowerLevel("M", watts=20), chirp_common.PowerLevel("H", watts=50)] - _mmap = "" + NEEDS_COMPAT_SERIAL = False def _write_record(self, cmd, payload=None): - # build the packet - _packet = '\x7e' + chr(cmd) + '\xff' _length = 0 if payload: _length = len(payload) - # update the length field - _packet += chr(_length) + _packet = struct.pack('BBBB', 0x7E, cmd, 0xFF, _length) if payload: # add the chars to the packet _packet += payload # calculate and add the checksum to the packet - _packet += chr(_checksum(_packet[1:])) + _packet += bytes([_checksum(_packet[1:])]) LOG.debug("Sent:\n%s" % util.hexprint(_packet)) self.pipe.write(_packet) @@ -551,17 +545,18 @@ class KGUV920PARadio(chirp_common.CloneModeRadio, _header = self.pipe.read(4) if len(_header) != 4: raise errors.RadioError('Radio did not respond') - _length = ord(_header[3]) + _length = _header[3] _packet = self.pipe.read(_length) _cs = _checksum(_header[1:]) _cs += _checksum(_packet) _cs %= 16 try: - _rcs = ord(self.pipe.read(1)) - except TypeError: + _rcs = self.pipe.read(1)[0] + except (TypeError, IndexError): raise errors.RadioError('Radio did not respond') - LOG.debug("_cs =%x", _cs) - LOG.debug("_rcs=%x", _rcs) + if _rcs != _cs: + LOG.error("_cs =%x", _cs) + LOG.error("_rcs=%x", _rcs) return (_rcs != _cs, _packet) @classmethod @@ -582,7 +577,7 @@ class KGUV920PARadio(chirp_common.CloneModeRadio, raise Exception("Checksum error") if len(_resp) == 0: raise Exception("Radio not responding") - reported_model = _str_decode(''.join(_resp[0:10])) + reported_model = _str_decode(_resp[0:10]) if reported_model != self._model: raise Exception("Unable to identify radio (Got %s, Expected)" % reported_model, self._model) @@ -605,11 +600,11 @@ class KGUV920PARadio(chirp_common.CloneModeRadio, def sync_out(self): self._upload() - # TODO: This is a dumb, brute force method of downlolading the memory. + # TODO: This is a dumb, brute force method of downloading the memory. # it would be smarter to only load the active areas and none of # the padding/unused areas. def _download(self): - """Talk to a wouxun KG-UV920P-A and do a download""" + """Talk to a Wouxun KG-UV920P-A and do a download""" try: self._identify() return self._do_download(0, 0x6640, 0x40) @@ -621,9 +616,9 @@ class KGUV920PARadio(chirp_common.CloneModeRadio, def _do_download(self, start, end, blocksize): # allocate & fill memory - image = "" + image = b"" for i in range(start, end, blocksize): - req = chr(i / 256) + chr(i % 256) + chr(blocksize) + req = struct.pack('>HB', i, blocksize) self._write_record(CMD_RD, req) cs_error, resp = self._read_record() if cs_error: @@ -638,10 +633,10 @@ class KGUV920PARadio(chirp_common.CloneModeRadio, status.msg = "Cloning from radio" self.status_fn(status) self._finish() - return memmap.MemoryMap(''.join(image)) + return memmap.MemoryMapBytes(image) def _upload(self): - """Talk to a wouxun KG-UV920P-A and do a upload""" + """Talk to a Wouxun KG-UV920P-A and do a upload""" try: self._identify() self._do_upload(0x0000, 0x6640, 0x40) @@ -654,14 +649,17 @@ class KGUV920PARadio(chirp_common.CloneModeRadio, def _do_upload(self, start, end, blocksize): ptr = start for i in range(start, end, blocksize): - req = chr(i / 256) + chr(i % 256) + req = struct.pack('>H', i) chunk = self.get_mmap()[ptr:ptr + blocksize] self._write_record(CMD_WR, req + chunk) LOG.debug(util.hexprint(req + chunk)) cserr, ack = self._read_record() LOG.debug(util.hexprint(ack)) - j = ord(ack[0]) * 256 + ord(ack[1]) + j = struct.unpack('>H', ack[0:2])[0] if cserr or j != ptr: + print(cserr) + print(j) + print(ptr) raise Exception("Radio did not ack block %i" % ptr) ptr += blocksize if self.status_fn: @@ -824,7 +822,7 @@ class KGUV920PARadio(chirp_common.CloneModeRadio, _mem.named = True name_encoded = _str_encode(mem.name) for i in range(0, 8): - _nam.name[i] = ord(name_encoded[i]) + _nam.name[i] = name_encoded[i] else: _mem.named = False @@ -1312,12 +1310,12 @@ class KGUV920PARadio(chirp_common.CloneModeRadio, if name == 'ponmsg.left': value = _str_encode(element[0].get_value()) for i in range(0, 8): - self._memobj.ponmsg.left[i] = ord(value[i]) + self._memobj.ponmsg.left[i] = value[i] continue elif name == 'ponmsg.right': value = _str_encode(element[0].get_value()) for i in range(0, 8): - self._memobj.ponmsg.right[i] = ord(value[i]) + self._memobj.ponmsg.right[i] = value[i] continue # diff --git a/chirp/drivers/kguv980p.py b/chirp/drivers/kguv980p.py new file mode 100644 index 0000000..5b23947 --- /dev/null +++ b/chirp/drivers/kguv980p.py @@ -0,0 +1,2607 @@ +# Copyright 2022 Mel Terechenok +# KG-UV980P , KG-1000G, KG-1000G Plus unified driver using +# KG-935G, KG-UV8H, KG-UV920P, and KG-UV9D Plus drivers as resources +# +# Based on the previous work of Pavel Milanes CO7WT +# and Krystian Struzik +# who figured out the crypt used and made possible the +# Wuoxun KG-UV8D Plus driver. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +"""Wouxun KG-UV980P radio management module""" + +import time +import logging +import struct + +from chirp import util, chirp_common, bitwise, memmap, errors, directory +from chirp.settings import RadioSetting, RadioSettingGroup, \ + RadioSettingValueBoolean, RadioSettingValueList, \ + RadioSettingValueInteger, RadioSettingValueString, \ + RadioSettingValueFloat, RadioSettingValueMap, RadioSettings + + +LOG = logging.getLogger(__name__) + + +CMD_ID = 0x80 +CMD_END = 0x81 +CMD_RD = 0x82 +CMD_WR = 0x83 +DIR_TO = 0xFF +DIR_FROM = 0x00 + + +# This is used to write the configuration of the radio base on info +# gleaned from the downloaded app. There are empty spaces and we honor +# them because we don't know what they are (yet) although we read the +# whole of memory. +# Max Write Size = 64 for comm protocol + +config_map = ( # map address, write size, write count + # (0x0, 64, 512), # 0 to 8000 - full write use only + (0x4c, 12, 1), # Mode PSW -- Display name + (0x60, 44, 1), # Freq Limits + (0x740, 40, 1), # FM chan 1-20 + (0x830, 16, 13), # General settings + (0x900, 8, 1), # General settings + (0x940, 64, 2), # Scan groups and names + (0xa00, 64, 249), # Memory Channels 1-996 + (0x4840, 48, 1), # Memory Channels 997-999 + (0x4900, 64, 124), # Memory Names 1-992 + (0x6800, 8, 7), # Memory Names 997-999 + (0x7000, 64, 15), # mem valid 1 -960 + (0x73c0, 39, 1), # mem valid 961 - 999 +) + + +MEM_VALID = 0x00 +TX_BLANK = 0x40 +RX_BLANK = 0x80 + +CHARSET_NUMERIC = "0123456789" +CHARSET = "0123456789" + \ + ":;<=>?@" + \ + "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + \ + "[\\]^_`" + \ + "abcdefghijklmnopqrstuvwxyz" + \ + "{|}~\x4E" + \ + " !\"#$%&'()*+,-./" + +SCANNAME_CHARSET = "0123456789" + \ + ":;<=>?@" + \ + "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + \ + "[\\]^_`" + \ + "abcdefghijklmnopqrstuvwxyz" + \ + "{|}~\x4E" + \ + " !\"#$%&'()*+,-./" + +MUTE_MODE_MAP = [('QT', 0b01), + ('QT*DTMF', 0b10), + ('QT+DTMF', 0b11)] +STEPS = [2.5, 5.0, 6.25, 10.0, 12.5, 20.0, 25.0, 30.0, 50.0, 100.0] +STEP_LIST = [str(x) for x in STEPS] +SQL_LIST = [int(i) for i in range(0, 10)] +M_POWER_MAP = [('1 = 20W', 1), + ('2 = 10W', 2)] +ROGER_LIST = ["Off", "BOT", "EOT", "Both"] +VOICE_MAP = [('Off', 0), + ('Chinese', 1), + ('On / English', 2)] +VOICE_MAP_1000GPLUS = [('Off', 0), + ('On', 2)] +SC_REV_MAP = [('Timeout (TO)', 1), + ('Carrier (CO)', 2), + ('Stop (SE)', 3)] +TOT_MAP = [('%d min' % i, int('%02d' % i, 10)) for i in range(1, 61)] +TOT_MAP_1000GPLUS = [('%d min' % i, int('%02d' % i, 16)) for i in range(1, 61)] +TOA_LIST = ["Off", "1s", "2s", "3s", "4s", "5s", "6s", "7s", "8s", "9s", "10s"] +TOA_MAP = [('Off', 0)] + \ + [('%ds' % i, int('%02d' % i, 16)) for i in range(1, 11)] +RING_LIST = ["Off", "1s", "2s", "3s", "4s", "5s", "6s", "7s", + "8s", "9s", "10s"] +RING_MAP = [('Off', 0)] + \ + [('%ds' % i, int('%02d' % i, 10)) for i in range(1, 11)] +DTMF_ST_LIST = ["Off", "DT-ST", "ANI-ST", "DT+ANI"] +DTMF_ST_LIST_1000GPLUS = ["Off", "DTMF", "ID", "DTMF+ID"] + +PTT_ID_MAP = [('BOT', 1), + ('EOT', 2), + ('Both', 3)] +PTT_ID_MAP_1000GPLUS = [('Off', 0), + ('BOT', 1), + ('EOT', 2), + ('Both', 3)] +BACKLIGHT_LIST = ["Off", "Red", "Orange", "Green"] +SPEAKER_MAP = [('SPK_1', 1), + ('SPK_2', 2), + ('SPK_1+2', 3)] +SPEAKER_MAP_1000GPLUS = [('RADIO', 1), + ('MIC', 2), + ('BOTH', 3)] +RPT_MODE_LIST = ["Radio", "X-DIRPT", "X-TWRPT", "RPT-RX", "T-W RPT"] +RPT_MODE_MAP = [("OFF", 0), + ("RPT-RX", 3), + ("RPT-TX", 4)] +APO_TIME_LIST = ["Off", "30", "60", "90", "120", "150"] +ALERT_MAP = [('1750', 1), + ('2100', 2), + ('1000', 3), + ('1450', 4)] +FAN_MODE_LIST = ["TX", "Hi-Temp/TX", "Always"] +SCAN_GROUP_LIST = ["All"] + ["%s" % x for x in range(1, 11)] +WORKMODE_MAP = [('VFO', 1), + ('Ch. No.', 2), + ('Ch. No.+Freq.', 3), + ('Ch. No.+Name', 4)] +WORKMODE_MAP_1000GPLUS = [('Freq', 1), + ('Ch-Num', 2), + ('Ch-Freq', 3), + ('Ch-Name', 4)] + +VFOBAND_MAP = [("150M", 0), + ("450M", 1), + ("20M", 2), + ("50M", 3), + ("350M", 4), + ("850M", 5)] +AB_LIST = ["A", "B"] +POWER_MAP = [('Low', 0), + ('Med', 1), + ('Med2', 2), + ('High', 3)] +BANDWIDTH_MAP = [('Narrow', 1), + ('Wide', 0)] +SCRAMBLER_LIST = ["Off", "1", "2", "3", "4", "5", "6", "7", "8"] +ANS_LIST = ["Off", "Normal", "Strong"] +DTMF_TIMES = [str(x) for x in range(80, 501, 20)] +DTMF_INTERVALS = [str(x) for x in range(60, 501, 20)] +ROGER_TIMES = [str(x) for x in range(20, 1001, 20)] +# For py3 compliance x/100 must be changed to x//100 +PTT_ID_DELAY_MAP = [(str(x), x//100) for x in range(100, 1001, 100)] +ROGER_INTERVALS = ROGER_TIMES +TONE_MAP = [('Off', 0x0000)] + \ + [('%.1f' % tone, int(tone * 10)) for tone in chirp_common.TONES] + \ + [('DN%d' % tone, int(0x8000 + tone)) + for tone in chirp_common.DTCS_CODES] + \ + [('DI%d' % tone, int(0xC000 + tone)) + for tone in chirp_common.DTCS_CODES] +DUPLEX_LIST = ["Off", "Plus", "Minus"] +SC_QT_MAP = [("Decoder - Rx QT/DT MEM", 1), ("Encoder- Tx QT/DT MEM", 2), + ("All- RxTx QT/DT MEM", 3)] +SC_QT_MAP_1000GPLUS = [("Rx", 1), ("Tx", 2), + ("Tx/Rx", 3)] + +HOLD_TIMES = ["Off"] + ["%s" % x for x in range(100, 5001, 100)] +PF1_SETTINGS = ["Off", "Stun", "Kill", "Monitor", "Inspection"] +PF1_SETTINGS_1000GPLUS = ["OFF", "Reverse", "Pri-Sel", "Pri-Scan", "Squelch", + "TX PWR", "Scan", "Scan CTCSS", + "Scan DCS", "FM Radio", "Weather", "Ch-Add", "W-N", + "TDR", "WORKMODE", "Band", "Repeater", "Lock", + "Monitor"] + +ABR_LIST = ["Always", "1s", "2s", "3s", "4s", "5s", "6s", "7s", "8s", + "9s", "10s", "11s", "12s", "13s", "14s", "15s", "16s", "17s", + "18s", "19s", "20s", "Off"] +KEY_LIST = ["Off", "B/SW", "MENCH", "H-M-L", "VFO/MR", "SET-D", "TDR", + "SQL", "SCAN", "FM-Radio", "Scan CTCSS", "Scan DCS"] +KEY_LIST_1000GPLUS = ["OFF", "Reverse", "Pri-Sel", "Pri-Scan", "Squelch", + "TX PWR", "Scan", "Scan CTCSS", "Scan DCS", + "FM Radio", "Weather", "Ch-Add", "W-N", "TDR", + "WORKMODE", "Band", "Repeater", "Lock", "Monitor"] + +RC_POWER_LIST = ["RC Stop", "RC Open"] +ACTIVE_AREA_LIST = ["Area A - Left", "Area B - Right"] +TDR_LIST = ["TDR ON", "TDR OFF"] +PRI_CH_SCAN_LIST = ["Off", "ON-Stby", "On-Always"] + +# memory slot 0 is not used, start at 1 (so need 1000 slots, not 999) +# structure elements whose name starts with x are currently unidentified + +_MEM_FORMAT = """ + #seekto 0x004c; + struct { + u24 mode_psw; + u8 xunk04F; + u8 display_name[8]; + } oem; + + #seekto 0x0060; + struct { + bbcd limit_144M_ChA_rx_start[2]; + bbcd limit_144M_ChA_rx_stop[2]; + bbcd limit_70cm_rx_start[2]; + bbcd limit_70cm_rx_stop[2]; + bbcd limit_10m_rx_start[2]; + bbcd limit_10m_rx_stop[2]; + bbcd limit_6m_rx_start[2]; + bbcd limit_6m_rx_stop[2]; + bbcd limit_350M_rx_start[2]; + bbcd limit_350M_rx_stop[2]; + bbcd limit_850M_rx_start[2]; + bbcd limit_850M_rx_stop[2]; + bbcd limit_144M_tx_start[2]; + bbcd limit_144M_tx_stop[2]; + bbcd limit_70cm_tx_start[2]; + bbcd limit_70cm_tx_stop[2]; + bbcd limit_10m_tx_start[2]; + bbcd limit_10m_tx_stop[2]; + bbcd limit_6m_tx_start[2]; + bbcd limit_6m_tx_stop[2]; + bbcd limit_144M_ChB_rx_start[2]; + bbcd limit_144M_ChB_rx_stop[2]; + } bandlimits; + + + #seekto 0x0740; + struct { + u16 FM_radio1; + u16 FM_radio2; + u16 FM_radio3; + u16 FM_radio4; + u16 FM_radio5; + u16 FM_radio6; + u16 FM_radio7; + u16 FM_radio8; + u16 FM_radio9; + u16 FM_radio10; + u16 FM_radio11; + u16 FM_radio12; + u16 FM_radio13; + u16 FM_radio14; + u16 FM_radio15; + u16 FM_radio16; + u16 FM_radio17; + u16 FM_radio18; + u16 FM_radio19; + u16 FM_radio20; + u16 FM_radio21; + u16 FM_radio22; + u8 x76c_pad[196]; + u32 vfofreq1; // 0x0830 + u32 vfoofst1; + u16 txtone1; + u16 rxtone1; + u8 xunk83C_1:3, + mute1:2, + xunk83C_2:3; + u8 xunk83d_1:1, + xunk83d_2:1, + xunk83d_3:1, + power1:2, + am_mode1:1, + xunk83d_7:1, + narrow1:1; + u8 xunk83e:6, + shft_dir1:2; + u8 xunk83F:3, + compander1:1, + scrambler1:4; + u32 vfofreq2; + u32 vfoofst2; + u16 txtone2; + u16 rxtone2; + u8 xunk84C_1:3, + mute2:2, + xunk84C_2:3; + u8 xunk84d_1:1, + xunk84d_2:1, + xunk84d_3:1, + power2:2, + am_mode2:1, + xunk84d_7:1, + narrow2:1; + u8 xunk84e:6, + shft_dir2:2; + u8 xunk84F:3, + compander2:1, + scrambler2:4; + u32 vfofreq3; + u32 vfoofst3; + u16 txtone3; + u16 rxtone3; + u8 xunk85C_1:3, + mute3:2, + xunk85C_2:3; + u8 xunk85d_1:1, + xunk85d_2:1, + xunk85d_3:1, + power3:2, + am_mode3:1, + xunk85d_7:1, + narrow3:1; + u8 xunk85e:6, + shft_dir3:2; + u8 xunk85F:3, + compander3:1, + scrambler3:4; + u32 vfofreq4; + u32 vfoofst4; + u16 txtone4; + u16 rxtone4; + u8 xunk86C_1:3, + mute4:2, + xunk86C_2:3; + u8 xunk86d_1:1, + xunk86d_2:1, + xunk86d_3:1, + power4:2, + am_mode4:1, + xunk86d_7:1, + narrow4:1; + u8 xunk86e:6, + shft_dir4:2; + u8 xunk86F:3, + compander4:1, + scrambler4:4; + u32 vfofreq5; + u32 vfoofst5; + u16 txtone5; + u16 rxtone5; + u8 xunk87C_1:3, + mute5:2, + xunk87C_2:3; + u8 xunk87d_1:1, + xunk87d_2:1, + xunk87d_3:1, + power5:2, + am_mode5:1, + xunk87d_7:1, + narrow5:1; + u8 xunk87e:6, + shft_dir5:2; + u8 xunk87F:3, + compander5:1, + scrambler5:4; + u32 vfofreq6; + u32 vfoofst6; + u16 txtone6; + u16 rxtone6; + u8 xunk88C_1:3, + mute6:2, + xunk88C_2:3; + u8 xunk88d_1:1, + xunk88d_2:1, + xunk88d_3:1, + power6:2, + am_mode6:1, + xunk88d_7:1, + narrow6:1; + u8 xunk88e:6, + shft_dir6:2; + u8 xunk8F:3, + compander6:1, + scrambler6:4; + u32 vfofreq7; + u32 vfoofst7; + u16 txtone7; + u16 rxtone7; + u8 xunk89C_1:3, + mute7:2, + xunk89C_2:3; + u8 xunk89d_1:1, + xunk89d_2:1, + xunk89d_3:1, + power7:2, + am_mode7:1, + xunk89d_7:1, + narrow7:1; + u8 xunk89e:6, + shft_dir7:2; + u8 xunk89F:3, + compander7:1, + scrambler7:4; + u8 x8a0; + u16 vfochan_a; + u8 x8a3; + u16 vfochan_b; + u16 pri_ch; + u8 x8a8; + u8 x8a9; + u8 scan_a_act; + u8 scan_b_act; + u8 m_pwr; + u8 hold_time_rpt; + u8 spk_cont; + u8 x8af; + u8 rc_power; + u8 voice; + u8 tot; + u8 toa; + u8 roger; + u8 sc_rev; + u8 dtmfsf; + u8 ptt_id; + u8 ring; + u8 ani_sw; + u8 rc_sw; + u8 alert; + u8 bcl_a; + u8 prich_sw; + u8 x8bE; + u8 ptt_id_dly; + u8 menu; + u8 x8c1; + u8 beep; + u8 key_lock; + u8 x8c4; + u8 tx_led; + u8 wt_led; + u8 rx_led; + u8 act_area; + u8 vfomode_a; + u8 vfomode_b; + u8 vfosquelch_a; + u8 vfosquelch_b; + u8 vfostep_a; + u8 vfostep_b; + u8 tdr_off; + u8 rpt_spk; //x8d0 + u8 rpt_ptt; + u8 autolock; + u8 apo_time; + u8 low_v; + u8 fan; + u8 rpt_set_model; + u8 pf1_set; + u8 auto_am; + u8 dtmf_time; + u8 dtmf_int; + u8 bcl_b; + u8 rpt_tone; + u8 sc_qt; + u8 vfoband_a; + u8 x8dF; + u24 ani_edit; + u8 x8e3; + u24 mcc_edit; + u8 x8e7; + u24 scc_edit; + u8 x8eB; + u24 ctrl_edit; + u8 x8eF; + u8 KeyA; + u8 KeyB; + u8 KeyC; + u8 ABR; + u8 x8f4; + u8 x8f5; + u8 KeyD; // KG-1000G Plus ONLY + u8 x8f7; + u8 x8f8; + u8 x8f9; + u8 x8fA; + u8 x8fB; + u8 x8fC; + u8 x8fD; + u8 x8fE; + u8 x8fF; + u16 FM_radio_cur_freq; + u8 x902; + u8 scan_det; + u8 x904; + u8 thr_vol_tx; + u16 thr_vol_lvl; + u8 x908; + u8 x909; + u8 x90A; + u8 x90B; + u8 x90C; + u8 x90D; + u8 x90E; + u8 x90F; + u8 x910pad[48]; + u16 scanlower1; // x940 + u16 scanupper1; + u16 scanlower2; + u16 scanupper2; + u16 scanlower3; + u16 scanupper3; + u16 scanlower4; + u16 scanupper4; + u16 scanlower5; + u16 scanupper5; + u16 scanlower6; + u16 scanupper6; + u16 scanlower7; + u16 scanupper7; + u16 scanlower8; + u16 scanupper8; + u16 scanlower9; + u16 scanupper9; + u16 scanlower10; + u16 scanupper10; + u8 scanname0[8]; // x968 + u8 scanname1[8]; + u8 scanname2[8]; + u8 scanname3[8]; + u8 scanname4[8]; + u8 scanname5[8]; + u8 scanname6[8]; + u8 scanname7[8]; + u8 scanname8[8]; + u8 scanname9[8]; + u8 scanname10[8]; + } settings; + + + #seekto 0x09f0; + struct { + u32 rxfreq; + u32 txfreq; + u16 txtone; + u16 rxtone; + u8 unknown1:3, + mute_mode:2, + unknown2:3; + u8 named:1, + scan_add:1, + extra_power_bit:1, + power:2, + am_mode:1, + unknownbit2:1, + isnarrow:1; + u8 unknown3:6, + Unknown4_shft_dir:2; + u8 unknown5:3, + compander:1 + scrambler:4; + } memory[1000]; + + #seekto 0x48f8; + struct { + u8 name[8]; + } names[1000]; + + #seekto 0x6fff; + u8 valid[1000]; + """ + + +def _freq_decode(in_freq, bytes=4): + out_freq = 0 + for i in range(bytes*2): + out_freq += (in_freq & 0xF) * (10 ** i) + in_freq = in_freq >> 4 + if bytes == 4: + return out_freq * 10 + elif bytes == 2: + return out_freq * 100000 + + +def _freq_encode(in_freq, bytes=4): + if bytes == 4: + return int('%08d' % (in_freq / 10), 16) + elif bytes == 2: + return int('%04d' % (in_freq / 100000), 16) + + +def _oem_str_decode(in_str): + out_str = '' + stopchar = False + for c in in_str: + if c != 0x50 and stopchar is False: + if chr(c+48) in chirp_common.CHARSET_ASCII: + out_str += chr(c+48) + else: + out_str += '' + stopchar = True + return out_str + + +def _oem_str_encode(in_str): + out_str = '' + LOG.debug("OEM Input String = %s", in_str) + for c in in_str: + try: + out_str += chr(int(ord(c))-48) + except ValueError: + pass + while len(out_str) < 8: + out_str += chr(0x50) + LOG.debug("OEM Output String = %s", out_str) + return out_str + + +# OEM String Encode for KG-1000G Plus +def _oem_str_decode_1000GPLUS(in_str): + LOG.debug("decode OEM Input String = %s", in_str) + out_str = '' + for c in in_str: + # 1000G+ character mapping starts with P = 32 and O = 127 + if 127 >= c >= 80: + out_str += chr(c - 48) + elif 32 <= c < 80: + out_str += chr(c+48) + else: + out_str += '' + LOG.debug("decode OEM Output String = %s", out_str) + return out_str + + +# OEM String Encode for KG-1000G Plus +def _oem_str_encode_1000GPLUS(in_str): + out_str = '' + LOG.debug("encode OEM Input String = %s", in_str) + for c in in_str: + if 32 <= ord(c) < 80: + out_str += chr(int(ord(c)) + 48) + elif 127 >= ord(c) >= 80: + out_str += chr(int(ord(c)) - 48) + while len(out_str) < 8: + out_str += chr(0x50) + LOG.debug("encode OEM Output String = %s", out_str) + return out_str + + +def _str_decode(in_str): + out_str = '' + stopchar = False + for c in in_str: + if c != 0x00 and stopchar is False: + if chr(c) in chirp_common.CHARSET_ASCII: + out_str += chr(c) + else: + out_str += '' + stopchar = True + return out_str + + +def _str_encode(in_str): + out_str = '' + for c in in_str: + try: + out_str += chr(ord(c)) + except ValueError: + pass + while len(out_str) < 8: + out_str += chr(0x00) + if out_str == " " or out_str == "": + out_str = "\x00\x00\x00\x00\x00\x00\x00\x00" + return out_str + + +def _chnum_decode(in_ch): + return int(('%04x' % in_ch)[0:3]) + + +def _chnum_encode(in_ch): + return int('%03d0' % in_ch, 16) + +# Support for the Wouxun KG-UV980P radio +# Serial coms are at 19200 baud +# The data is passed in variable length records +# Record structure: +# Offset Usage +# 0 start of record (\x7c) +# 1 Command (\x80 Identify \x81 End/Reboot \x82 Read \x83 Write) +# 2 direction (\xff PC-> Radio, \x00 Radio -> PC) +# 3 length of payload (excluding header/checksum) (n) +# 4 payload (n bytes) +# 4+n+1 checksum - only lower 4 bits of byte sum (% 256) of bytes 1 -> 4+n +# +# Memory Read Records: +# the payload is 3 bytes, first 2 are offset (big endian), +# 3rd is number of bytes to read +# Memory Write Records: +# the maximum payload size (from the Wouxun software) seems to be 66 bytes +# (2 bytes location + 64 bytes data). + + +@directory.register +class KG980PRadio(chirp_common.CloneModeRadio, + chirp_common.ExperimentalRadio): + + """Wouxun KG-UV980P""" + VENDOR = "Wouxun" + MODEL = "KG-UV980P" + _model = b"KG-UV950R2" + _file_ident = b"980P" + BAUD_RATE = 19200 + NEEDS_COMPAT_SERIAL = False + # Start Byte for Communication messages + _record_start = 0xDA + # _cs_size = 0x0F for 4-bit checksum, 0xFF for 8-Bit checksum + _cs_size = 0x0F + # _valxor = value needed to encrypt/decrypt the bytes to/from the radio + _valxor = 0x57 + POWER_LEVELS = [chirp_common.PowerLevel("L", watts=1.0), + chirp_common.PowerLevel("M", watts=20.0), + chirp_common.PowerLevel("H", watts=50.0)] + + def _checksum(self, data): + cs = 0 + for byte in data: + cs += byte + return ((cs % 256) & self._cs_size) + + def _write_record(self, cmd, payload=b''): + _packet = struct.pack('BBBB', self._record_start, cmd, 0xFF, + len(payload)) + checksum = bytes([self._checksum(_packet[1:] + payload)]) + _packet += self.encrypt(payload + checksum) + LOG.debug("Sent:\n%s" % util.hexprint(_packet)) + self.pipe.write(_packet) + + def _read_record(self): + # read 4 chars for the header + _header = self.pipe.read(4) + if len(_header) != 4: + raise errors.RadioError('Radio did not respond') + _length = struct.unpack('xxxB', _header)[0] + _packet = self.pipe.read(_length) + _rcs_xor = _packet[-1] + _packet = self.decrypt(_packet) + _cs = self._checksum(_header[1:]) + _cs += self._checksum(_packet) + _cs %= 256 + _cs = _cs & self._cs_size + _rcs = self.strxor(self.pipe.read(1)[0], _rcs_xor)[0] + return (_rcs != _cs, _packet) + + def decrypt(self, data): + result = b'' + for i in range(len(data)-1, 0, -1): + result += self.strxor(data[i], data[i - 1]) + result += self.strxor(data[0], self._valxor) + return result[::-1] + + def encrypt(self, data): + result = self.strxor(self._valxor, data[0]) + for i in range(1, len(data), 1): + result += self.strxor(result[i - 1], data[i]) + return result + + def strxor(self, xora, xorb): + return bytes([xora ^ xorb]) + + # Identify the radio + # + # A Gotcha: the first identify packet returns a bad checksum, subsequent + # attempts return the correct checksum... (well it does on my radio!) + # + # The ID record returned by the radio also includes the + # current frequency range + # as 4 bytes big-endian in 10 Hz increments + # + # Offset + # 0:10 Model, zero padded + + def _identify(self): + """Do the identification dance""" + for _i in range(0, 3): + LOG.debug("ID try #"+str(_i)) + self._write_record(CMD_ID) + _chksum_err, _resp = self._read_record() + if len(_resp) == 0: + raise errors.RadioError("Radio not responding") + else: + LOG.debug("Got:\n%s" % util.hexprint(_resp)) + LOG.debug("Model received is %s" % _resp[0:10]) + LOG.debug("Model expected is %s" % self._model) + if _chksum_err: + LOG.error("Checksum error: retrying ident...") + time.sleep(0.100) + continue + else: + LOG.debug("checksum passed") + if _resp[0:8] == self._model[0:8]: + LOG.debug("Passed identify") + break + else: + LOG.debug("FAILED to identify") + raise errors.RadioError("Failed Identification") + + def _finish(self): + self._write_record(CMD_END) + + def process_mmap(self): + self._memobj = bitwise.parse(_MEM_FORMAT, self._mmap) + + def sync_in(self): + try: + self._mmap = self._download() + except errors.RadioError: + raise + except Exception: + raise errors.RadioError("Failed to communicate with radio: %s") + self.process_mmap() + + def sync_out(self): + self._upload() + + # TODO: Load all memory. + # It would be smarter to only load the active areas and none of + # the padding/unused areas. Padding still need to be investigated. + def _download(self): + """Talk to a Wouxun KG-UV980P and do a download""" + try: + self._identify() + return self._do_download(0, 32768, 64) + except errors.RadioError: + raise + except Exception: + LOG.exception('Unknown error during download process') + raise errors.RadioError("Failed to communicate with radio: %s") + + def _do_download(self, start, end, size): + # allocate & fill memory + LOG.debug("Start Download") + image = b"" + for i in range(start, end, size): + req = struct.pack("BBB", int(i / 256), int(i % 256), int(size)) + self._write_record(CMD_RD, req) + cs_error, resp = self._read_record() + if cs_error: + LOG.debug(util.hexprint(resp)) + raise errors.RadioError("Checksum error on read") + image += resp[2:] + if self.status_fn: + status = chirp_common.Status() + status.cur = i + status.max = end + status.msg = "Cloning from radio" + self.status_fn(status) + self._finish() + LOG.debug("Download Completed") + return memmap.MemoryMapBytes(image) + + def _upload(self): + """Talk to a Wouxun KG-UV980P and do a upload""" + try: + self._identify() + LOG.debug("Done with Upload Identify") + self._do_upload() + LOG.debug("Done with Mem and Settings Upload") + self._finish() + except errors.RadioError: + raise + except Exception: + raise errors.RadioError("Failed to communicate with radio: %s") + return + + def _do_upload(self): + LOG.debug("Start of _do_upload") + cfg_map = config_map + endwrite = 0x73E7 + for start, blocksize, count in cfg_map: + end = start + (blocksize * count) + LOG.debug("start = " + str(start)) + LOG.debug("end = " + str(end)) + LOG.debug("blksize = " + str(blocksize)) + + for addr in range(start, end, blocksize): + ptr = addr + req = struct.pack('>H', addr) + chunk = self.get_mmap()[ptr:ptr + blocksize] + self._write_record(CMD_WR, req + chunk) + LOG.debug(util.hexprint(req + chunk)) + cserr, ack = self._read_record() + LOG.debug(util.hexprint(ack)) + j = struct.unpack('>H', ack)[0] + if cserr or j != ptr: + raise errors.RadioError("Radio did not ack block %i" % ptr) + ptr += blocksize + if self.status_fn: + status = chirp_common.Status() + status.cur = ptr + status.max = endwrite + status.msg = "Cloning to radio" + self.status_fn(status) + + def get_features(self): + rf = chirp_common.RadioFeatures() + rf.has_settings = True + rf.has_ctone = True + rf.has_rx_dtcs = True + rf.has_cross = True + rf.has_tuning_step = False + rf.has_bank = False + rf.can_odd_split = True + rf.valid_skips = ["", "S"] + rf.valid_tmodes = ["", "Tone", "TSQL", "DTCS", "Cross"] + rf.valid_cross_modes = [ + "Tone->Tone", + "Tone->DTCS", + "DTCS->Tone", + "DTCS->", + "->Tone", + "->DTCS", + "DTCS->DTCS", + ] + rf.valid_modes = ["FM", "NFM", "AM", "NAM"] + rf.valid_power_levels = self.POWER_LEVELS + rf.valid_name_length = 8 + rf.valid_duplexes = ["", "-", "+", "split", "off"] + rf.valid_bands = [(26000000, 299999990), # supports VHF + (300000000, 999999990)] # supports UHF + + rf.valid_characters = chirp_common.CHARSET_ASCII + rf.memory_bounds = (1, 999) # 999 memories + rf.valid_tuning_steps = STEPS + return rf + + @classmethod + def get_prompts(cls): + rp = chirp_common.RadioPrompts() + rp.experimental = \ + ('This driver is experimental and may contain bugs. \n' + 'USE AT YOUR OWN RISK - ' + 'SAVE A COPY OF DOWNLOAD FROM YOUR RADIO BEFORE MAKING CHANGES\n' + 'Modification of Freq Limit Interfaces is done ' + 'AT YOUR OWN RISK and may affect performance or certification' + ) + return rp + + def get_raw_memory(self, number): + return repr(self._memobj.memory[number]) + + def _get_tone(self, _mem, mem): + # - corrected the Polarity decoding to match 980P implementation + # use 0x4000 bit mask for R + # - 0x4000 appears to be the bit mask for Inverted DCS tones + # - n DCS Tone will be 0x8xxx values - i DCS Tones will + # be 0xCxxx values. + # - Chirp Uses N for n DCS Tones and R for i DCS Tones + # - 980P encodes DCS tone # in decimal - NOT OCTAL + def _get_dcs(val): + code = int("%03d" % (val & 0x07FF)) + pol = (val & 0x4000) and "R" or "N" + return code, pol + # - Modified the function below to bitwise AND with 0x4000 + # to check for 980P DCS Tone decoding + # 0x8000 appears to be the bit mask for DCS tones + tpol = False + # Beta 1.1 - Fix the txtone compare to 0x8000 - was rxtone. + if _mem.txtone != 0xFFFF and (_mem.txtone & 0x8000) == 0x8000: + tcode, tpol = _get_dcs(_mem.txtone) + mem.dtcs = tcode + txmode = "DTCS" + elif _mem.txtone != 0xFFFF and _mem.txtone != 0x0: + mem.rtone = (_mem.txtone & 0x7fff) / 10.0 + txmode = "Tone" + else: + txmode = "" + # - Modified the function below to bitwise AND with 0x4000 + # to check for 980P DCS Tone decoding + rpol = False + if _mem.rxtone != 0xFFFF and (_mem.rxtone & 0x8000) == 0x8000: + rcode, rpol = _get_dcs(_mem.rxtone) + mem.rx_dtcs = rcode + rxmode = "DTCS" + elif _mem.rxtone != 0xFFFF and _mem.rxtone != 0x0: + mem.ctone = (_mem.rxtone & 0x7fff) / 10.0 + rxmode = "Tone" + else: + rxmode = "" + + if txmode == "Tone" and not rxmode: + mem.tmode = "Tone" + elif txmode == rxmode and txmode == "Tone" and mem.rtone == mem.ctone: + mem.tmode = "TSQL" + elif txmode == rxmode and txmode == "DTCS" and mem.dtcs == mem.rx_dtcs: + mem.tmode = "DTCS" + elif rxmode or txmode: + mem.tmode = "Cross" + mem.cross_mode = "%s->%s" % (txmode, rxmode) + + # always set it even if no dtcs is used + mem.dtcs_polarity = "%s%s" % (tpol or "N", rpol or "N") + + def get_memory(self, number): + _mem = self._memobj.memory[number] + + mem = chirp_common.Memory() + mem.number = number + _valid = self._memobj.valid[mem.number] + + if (_valid != MEM_VALID) & ((_mem.rxfreq == 0xFFFFFFFF) or + _mem.rxfreq == 0x00000000): + mem.empty = True + return mem + elif (_valid != MEM_VALID) & ((_mem.rxfreq != 0xFFFFFFFF) and + (_mem.rxfreq != 0x00000000)): + mem.empty = False + else: + mem.empty = False + mem.freq = int(_mem.rxfreq) * 10 + _rxfreq = _freq_decode(_mem.rxfreq) + _txfreq = _freq_decode(_mem.txfreq) + mem.freq = _rxfreq + + if _mem.txfreq == 0xFFFFFFFF: + # TX freq not set + mem.duplex = "off" + mem.offset = 0 + elif int(_rxfreq) == int(_txfreq): + mem.duplex = "" + mem.offset = 0 + elif abs(_rxfreq - _txfreq) > 70000000: + mem.duplex = "split" + mem.offset = _txfreq + else: + mem.duplex = _rxfreq > _txfreq and "-" or "+" + mem.offset = abs(_rxfreq - _txfreq) + + if _mem.named: + mem.name = _str_decode(self._memobj.names[number].name) + # Remove trailing whitespaces from the name + mem.name = mem.name.rstrip() + else: + mem.name = '' + + self._get_tone(_mem, mem) + + mem.skip = "" if bool(_mem.scan_add) else "S" + + pwr_index = _mem.power + if _mem.power == 3: + pwr_index = 2 + if _mem.power: + mem.power = self.POWER_LEVELS[pwr_index] + else: + mem.power = self.POWER_LEVELS[0] + + if _mem.am_mode: + if _mem.isnarrow: + mem.mode = "NAM" + else: + mem.mode = "AM" + else: + mem.mode = _mem.isnarrow and "NFM" or "FM" + + mem.extra = RadioSettingGroup("Extra", "extra") + + # Scrambler >8 is invalid default to off + if _mem.scrambler > 8: + _mem.scrambler = 0 + + return mem + + def _set_tone(self, mem, _mem): + def _set_dcs(code, pol): + # Change to 0x8000 to + # set the bit for DCS- code is a decimal version + # of the code # - NOT OCTAL + val = code | 0x8000 + if pol == "R": + # Change to 0x4000 to set the bit for + # i/R polarity + val += 0x4000 + return val + + rx_mode = tx_mode = None + rxtone = txtone = 0x0000 + + if mem.tmode == "Tone": + tx_mode = "Tone" + rx_mode = None + txtone = int(mem.rtone * 10) + elif mem.tmode == "TSQL": + rx_mode = tx_mode = "Tone" + rxtone = txtone = int(mem.ctone * 10) + elif mem.tmode == "DTCS": + tx_mode = rx_mode = "DTCS" + txtone = _set_dcs(mem.dtcs, mem.dtcs_polarity[0]) + rxtone = _set_dcs(mem.dtcs, mem.dtcs_polarity[1]) + elif mem.tmode == "Cross": + tx_mode, rx_mode = mem.cross_mode.split("->") + if tx_mode == "DTCS": + txtone = _set_dcs(mem.dtcs, mem.dtcs_polarity[0]) + elif tx_mode == "Tone": + txtone = int(mem.rtone * 10) + if rx_mode == "DTCS": + rxtone = _set_dcs(mem.rx_dtcs, mem.dtcs_polarity[1]) + elif rx_mode == "Tone": + rxtone = int(mem.ctone * 10) + + _mem.rxtone = rxtone + _mem.txtone = txtone + + LOG.debug("Set TX %s (%i) RX %s (%i)" % + (tx_mode, _mem.txtone, rx_mode, _mem.rxtone)) + + def set_memory(self, mem): + # _mem = Stored Memory value + # mem = New value from user entry + number = mem.number + _mem = self._memobj.memory[number] + _nam = self._memobj.names[number] + + if mem.empty: + self._memobj.valid[number] = 0xFF + _mem.rxfreq = 0xFFFFFFFF + _mem.txfreq = 0xFFFFFFFF + self._memobj.names[number].set_raw("\xFF" * (_nam.size() // 8)) + else: + if len(mem.name) > 0: + _mem.named = True + name_encoded = _str_encode(mem.name) + for i in range(0, 8): + _nam.name[i] = ord(name_encoded[i]) + else: + _mem.named = False + + _mem.rxfreq = _freq_encode(mem.freq) + if mem.duplex == "off": + _mem.txfreq = 0xFFFFFFFF + elif mem.duplex == "split": + _mem.txfreq = _freq_encode(mem.offset) + elif mem.duplex == "+": + _mem.txfreq = _freq_encode(mem.freq + mem.offset) + elif mem.duplex == "-": + _mem.txfreq = _freq_encode(mem.freq - mem.offset) + else: + _mem.txfreq = _freq_encode(mem.freq) + + _mem.scan_add = int(mem.skip != "S") + + if mem.mode == "AM": + _mem.am_mode = True + _mem.isnarrow = False + elif mem.mode == "NAM": + _mem.am_mode = True + _mem.isnarrow = True + else: + _mem.am_mode = False + if mem.mode == "NFM": + _mem.isnarrow = True + else: + _mem.isnarrow = False + + # set the tone + self._set_tone(mem, _mem) + # set the scrambler and compander to off by default + # This changes them in the channel memory + _mem.scrambler = 0 + _mem.compander = 0 + # set the power + if mem.power: + _mem.power = self.POWER_LEVELS.index(mem.power) + else: + _mem.power = True + # pwr_index= mem.power + if str(mem.power) == "None": + mem.power = self.POWER_LEVELS[1] + index = self.POWER_LEVELS.index(mem.power) + if index == 2: + _mem.power = 0b11 + else: + _mem.power = self.POWER_LEVELS.index(mem.power) + # Not sure what this bit does yet but it causes + # the radio to display + # MED power when the CPS shows Low Power. + # Forcing it to 0 to keep them + # consistent + _mem.extra_power_bit = 0 + # Set other unknowns to 0 to match default CPS values + _mem.unknown1 = 0 + _mem.unknown2 = 0 + _mem.unknownbit2 = 0 + _mem.unknown3 = 0 + _mem.Unknown4_shft_dir = 0 + _mem.unknown5 = 0 + + # set to mute mode to QT (not QT+DTMF or QT*DTMF) by default + # This changes them in the channel memory + _mem.mute_mode = 1 + + def _get_settings(self): + _settings = self._memobj.settings + _oem = self._memobj.oem + + cfg_grp = RadioSettingGroup("cfg_grp", "Config Settings") + cfg1_grp = RadioSettingGroup("cfg1_grp", "Config Settings 1") + cfg2_grp = RadioSettingGroup("cfg2_grp", "Config Settings 2") + if self.MODEL == "KG-1000G Plus": + vfoaname = "Area A Settings" + else: + vfoaname = "VFO A Settings" + vfoa_grp = RadioSettingGroup("vfoa_grp", vfoaname) + vfo150_grp = RadioSettingGroup("vfo150_grp", "150M Settings") + vfo450_grp = RadioSettingGroup("vfo450_grp", "450M Settings") + vfo20_grp = RadioSettingGroup("vfo20_grp", "20M Settings") + vfo50_grp = RadioSettingGroup("vfo50_grp", "50M Settings") + vfo350_grp = RadioSettingGroup("vfo350_grp", "350M Settings") + vfo850_grp = RadioSettingGroup("vfo850_grp", "850M Settings") + if self.MODEL == "KG-1000G Plus": + vfobname = "Area B Settings" + else: + vfobname = "VFO B Settings" + vfob_grp = RadioSettingGroup("vfob_grp", vfobname) + + fmradio_grp = RadioSettingGroup("fmradio_grp", "FM Broadcast Memory") + lmt_grp = RadioSettingGroup("lmt_grp", "Frequency Limits") + lmwrn_grp = RadioSettingGroup("lmwrn_grp", "USE AT YOUR OWN RISK") + rxlim_grp = RadioSettingGroup("rxlim_grp", "Rx Limits") + txlim_grp = RadioSettingGroup("txlim_grp", "Tx Limits") + oem_grp = RadioSettingGroup("oem_grp", "OEM Info") + scan_grp = RadioSettingGroup("scan_grp", "Scan Group") + scanname_grp = RadioSettingGroup("scanname_grp", "Scan Names") + remote_grp = RadioSettingGroup("remote_grp", "Remote Settings") + extra_grp = RadioSettingGroup("extra_grp", + "Extra Settings") + if self.MODEL == "KG-1000G Plus": + vfoname = "Freq Mode Settings" + else: + vfoname = "VFO Settings" + vfo_grp = RadioSettingGroup("vfo_grp", + vfoname) + extra_grp.append(oem_grp) + cfg_grp.append(cfg1_grp) + cfg_grp.append(cfg2_grp) + lmt_grp.append(lmwrn_grp) + lmt_grp.append(rxlim_grp) + extra_grp.append(lmt_grp) + vfo_grp.append(vfoa_grp) + vfo_grp.append(vfob_grp) + vfoa_grp.append(vfo150_grp) + vfoa_grp.append(vfo450_grp) + if self.MODEL == "KG-UV980P": + vfoa_grp.append(vfo20_grp) + lmt_grp.append(txlim_grp) + vfoa_grp.append(vfo50_grp) + vfoa_grp.append(vfo350_grp) + vfoa_grp.append(vfo850_grp) + scan_grp.append(scanname_grp) + + group = RadioSettings(cfg_grp, vfo_grp, fmradio_grp, + remote_grp, scan_grp, extra_grp) + + # Configuration Settings + if self.MODEL == "KG-1000G Plus": + voicemap = VOICE_MAP_1000GPLUS + pttidmap = PTT_ID_MAP_1000GPLUS + pttidlabel = "DTMF ID" + dtmflist = DTMF_ST_LIST_1000GPLUS + dtmflabel = "Sidetone" + spkmap = SPEAKER_MAP_1000GPLUS + key_l = KEY_LIST_1000GPLUS + scqt = SC_QT_MAP_1000GPLUS + pf1set = PF1_SETTINGS_1000GPLUS + wmmap = WORKMODE_MAP_1000GPLUS + totmap = TOT_MAP_1000GPLUS + lowvlabel = "Voltage Alert" + fanlabel = "Fan Setting" + alerttonelabel = "Alert Tone(Hz)" + tonescanlabel = "Tone Save" + pttdelaylabel = "DTMF ID Delay (ms)" + scandetlabel = "Tone Scan" + txvoltlabel = "Tx Voltage Limit" + holdtimrptlabel = "Repeater Hold Time (ms)" + thrvollvllabel = "Tx Voltage Min" + modepswlabel = "Freq Mode Password" + narrow1label = "150M W/N" + mute1label = "150M SP Mute" + scram1label = "150M Descrambler" + narrow2label = "450M W/N" + mute2label = "450M SP Mute" + scram2label = "450M Descrambler" + narrow3label = "20M W/N" + mute3label = "20M SP Mute" + scram3label = "20M Descrambler" + narrow4label = "50M W/N" + mute4label = "50M SP Mute" + scram4label = "50M Descrambler" + narrow5label = "350M W/N" + mute5label = "350M SP Mute" + scram5label = "350M Descrambler" + narrow6label = "850M W/N" + mute6label = "850M SP Mute" + scram6label = "850M Descrambler" + narrow7label = "W/N" + mute7label = "SP Mute" + scram7label = "Descrambler" + else: # 980P or 1000G radios + voicemap = VOICE_MAP + pttidmap = PTT_ID_MAP + pttidlabel = "Caller ID Tx Mode (PTT_ID)" + dtmflist = DTMF_ST_LIST + dtmflabel = "DTMF Sidetone" + spkmap = SPEAKER_MAP + key_l = KEY_LIST + scqt = SC_QT_MAP + pf1set = PF1_SETTINGS + wmmap = WORKMODE_MAP + totmap = TOT_MAP + lowvlabel = "Low Voltage Shutoff" + fanlabel = "Fan Mode" + alerttonelabel = "Alert Pulse (Hz)" + tonescanlabel = "CTCSS/DCS Scan" + pttdelaylabel = "Caller ID Tx Delay PTT-ID-DLY (ms)" + scandetlabel = "Scan DET" + txvoltlabel = "Threshold Voltage Tx" + holdtimrptlabel = "Hold Time of Repeat (ms)" + thrvollvllabel = "Threshold Voltage Level" + modepswlabel = "MODE PSW" + narrow1label = "150M Bandwidth" + mute1label = "150M Mute Mode" + scram1label = "150M Scrambler" + narrow2label = "450M Bandwidth" + mute2label = "450M Mute Mode" + scram2label = "450M Scrambler" + narrow3label = "20M Bandwidth" + mute3label = "20M Mute Mode" + scram3label = "20M Scrambler" + narrow4label = "50M Bandwidth" + mute4label = "50M Mute Mode" + scram4label = "50M Scrambler" + narrow5label = "350M Bandwidth" + mute5label = "350M Mute Mode" + scram5label = "350M Scrambler" + narrow6label = "850M Bandwidth" + mute6label = "850M Mute Mode" + scram6label = "850M Scrambler" + narrow7label = "Bandwidth" + mute7label = "Mute Mode" + scram7label = "Scrambler" + + rs = RadioSetting("roger", "Roger Beep", + RadioSettingValueList(ROGER_LIST, + ROGER_LIST[_settings. + roger])) + cfg1_grp.append(rs) + + rs = RadioSetting("beep", "Keypad Beep", + RadioSettingValueBoolean(_settings.beep)) + cfg1_grp.append(rs) + + rs = RadioSetting("voice", "Voice Guide", + RadioSettingValueMap(voicemap, + _settings.voice)) + cfg1_grp.append(rs) + + rs = RadioSetting("bcl_a", "Busy Channel Lock-out A", + RadioSettingValueBoolean(_settings.bcl_a)) + cfg1_grp.append(rs) + + rs = RadioSetting("bcl_b", "Busy Channel Lock-out B", + RadioSettingValueBoolean(_settings.bcl_b)) + cfg1_grp.append(rs) + + rs = RadioSetting("sc_rev", "Scan Mode", + RadioSettingValueMap(SC_REV_MAP, _settings.sc_rev)) + cfg1_grp.append(rs) + rs = RadioSetting("tot", "Timeout Timer (TOT)", + RadioSettingValueMap( + totmap, _settings.tot)) + cfg1_grp.append(rs) + + if self.MODEL != "KG-1000G Plus": + rs = RadioSetting("toa", "Timeout Alarm (TOA)", + RadioSettingValueList( + TOA_LIST, TOA_LIST[_settings.toa])) + else: + rs = RadioSetting("toa", "Overtime Alarm (TOA)", + RadioSettingValueMap( + TOA_MAP, _settings.toa)) + cfg1_grp.append(rs) + + if self.MODEL != "KG-1000G Plus": + rs = RadioSetting("ani_sw", "Caller ID Tx - ANI-SW", + RadioSettingValueBoolean(_settings.ani_sw)) + cfg1_grp.append(rs) + + if self.MODEL != "KG-1000G Plus": + rs = RadioSetting("ring", "Ring Time (Sec)", + RadioSettingValueList( + RING_LIST, + RING_LIST[_settings.ring])) + else: + rs = RadioSetting("ring", "Ring Time (Sec)", + RadioSettingValueMap( + RING_MAP, _settings.ring)) + cfg1_grp.append(rs) + + rs = RadioSetting("dtmfsf", dtmflabel, + RadioSettingValueList( + dtmflist, + dtmflist[_settings.dtmfsf])) + cfg1_grp.append(rs) + + rs = RadioSetting("ptt_id", pttidlabel, + RadioSettingValueMap(pttidmap, _settings.ptt_id)) + cfg1_grp.append(rs) + + rs = RadioSetting("wt_led", "Standby / WT LED", + RadioSettingValueList( + BACKLIGHT_LIST, + BACKLIGHT_LIST[_settings.wt_led])) + cfg1_grp.append(rs) + + rs = RadioSetting("tx_led", "TX LED", + RadioSettingValueList( + BACKLIGHT_LIST, + BACKLIGHT_LIST[_settings.tx_led])) + cfg1_grp.append(rs) + + rs = RadioSetting("rx_led", "Rx LED", + RadioSettingValueList( + BACKLIGHT_LIST, + BACKLIGHT_LIST[_settings.rx_led])) + cfg1_grp.append(rs) + + if self.MODEL == "KG-1000G Plus": + rs = RadioSetting("prich_sw", "Priority Scan", + RadioSettingValueList( + PRI_CH_SCAN_LIST, + PRI_CH_SCAN_LIST[_settings.prich_sw])) + cfg1_grp.append(rs) + else: + rs = RadioSetting("prich_sw", "Priority Channel Scan", + RadioSettingValueBoolean(_settings.prich_sw)) + cfg1_grp.append(rs) + + rs = RadioSetting("spk_cont", "Speaker Control", + RadioSettingValueMap( + spkmap, + _settings.spk_cont)) + cfg1_grp.append(rs) + + rs = RadioSetting("autolock", "Autolock", + RadioSettingValueBoolean(_settings.autolock)) + cfg1_grp.append(rs) + + rs = RadioSetting("low_v", lowvlabel, + RadioSettingValueBoolean(_settings.low_v)) + cfg1_grp.append(rs) + + rs = RadioSetting("fan", fanlabel, + RadioSettingValueList( + FAN_MODE_LIST, + FAN_MODE_LIST[_settings.fan])) + cfg1_grp.append(rs) + + rs = RadioSetting("apo_time", "Auto Power-Off (Min)", + RadioSettingValueList( + APO_TIME_LIST, + APO_TIME_LIST[_settings.apo_time])) + cfg1_grp.append(rs) + + rs = RadioSetting("alert", alerttonelabel, + RadioSettingValueMap(ALERT_MAP, _settings.alert)) + cfg1_grp.append(rs) + rs = RadioSetting("m_pwr", "Medium Power Level (W)", + RadioSettingValueMap(M_POWER_MAP, + _settings.m_pwr)) + cfg1_grp.append(rs) + + if self.MODEL != "KG-1000G Plus": + rs = RadioSetting("rpt_set_model", "Model (RPT-SET)", + RadioSettingValueList( + RPT_MODE_LIST, + RPT_MODE_LIST[_settings.rpt_set_model])) + else: + rs = RadioSetting("rpt_set_model", "Repeater Mode", + RadioSettingValueMap( + RPT_MODE_MAP, + _settings.rpt_set_model)) + cfg2_grp.append(rs) + + rs = RadioSetting("rpt_spk", "Repeater Speaker Switch (RPT-SPK)", + RadioSettingValueBoolean(_settings.rpt_spk)) + cfg2_grp.append(rs) + + rs = RadioSetting("rpt_ptt", "Repeater PTT (RPT-PTT)", + RadioSettingValueBoolean(_settings.rpt_ptt)) + cfg2_grp.append(rs) + + rs = RadioSetting("dtmf_time", "DTMF Tx Duration (ms)", + RadioSettingValueList( + DTMF_TIMES, + DTMF_TIMES[_settings.dtmf_time])) + cfg2_grp.append(rs) + rs = RadioSetting("dtmf_int", "DTMF Interval (ms)", + RadioSettingValueList( + DTMF_INTERVALS, + DTMF_INTERVALS[_settings.dtmf_int])) + cfg2_grp.append(rs) + + rs = RadioSetting("sc_qt", tonescanlabel, + RadioSettingValueMap( + scqt, _settings.sc_qt)) + cfg2_grp.append(rs) + + rs = RadioSetting("pri_ch", "Priority Channel", + RadioSettingValueInteger( + 1, 999, _chnum_decode(_settings.pri_ch))) + cfg2_grp.append(rs) + + rs = RadioSetting("ptt_id_dly", pttdelaylabel, + RadioSettingValueMap(PTT_ID_DELAY_MAP, + _settings.ptt_id_dly)) + cfg2_grp.append(rs) + + rs = RadioSetting("rc_sw", "Remote Control RC-SW", + RadioSettingValueBoolean(_settings.rc_sw)) + cfg2_grp.append(rs) + + rs = RadioSetting("scan_det", scandetlabel, + RadioSettingValueBoolean(_settings.scan_det)) + cfg2_grp.append(rs) + + rs = RadioSetting("menu", "Menu Available", + RadioSettingValueBoolean(_settings.menu)) + cfg2_grp.append(rs) + + rs = RadioSetting("thr_vol_tx", txvoltlabel, + RadioSettingValueBoolean(_settings.thr_vol_tx)) + cfg2_grp.append(rs) + + rs = RadioSetting("hold_time_rpt", holdtimrptlabel, + RadioSettingValueList( + HOLD_TIMES, + HOLD_TIMES[_settings.hold_time_rpt])) + cfg2_grp.append(rs) + + rs = RadioSetting("auto_am", "Auto AM", + RadioSettingValueBoolean(_settings.auto_am)) + cfg2_grp.append(rs) + + rs = RadioSetting("rpt_tone", "Repeat Tone", + RadioSettingValueBoolean(_settings.rpt_tone)) + cfg2_grp.append(rs) + + rs = RadioSetting("pf1_set", "PF1 setting", + RadioSettingValueList( + pf1set, + pf1set[_settings.pf1_set])) + cfg2_grp.append(rs) + + rs = RadioSetting("settings.thr_vol_lvl", thrvollvllabel, + RadioSettingValueFloat( + 9.5, 10.5, _settings.thr_vol_lvl / 100.0, 0.1, 1)) + cfg2_grp.append(rs) + + dtmfchars = "0123456789" + _code = '' + test = int(_oem.mode_psw) + _codeobj = '0x{0:0{1}X}'.format(test, 6) + LOG.debug("codeobj = %s" % _codeobj) + _psw = str(_codeobj) + for i in range(2, 8): + LOG.debug("psw[i] = %s" % _psw[i]) + if _psw[i] in dtmfchars: + _code += _psw[i] + val_psw = RadioSettingValueString(6, 6, _code, False) + val_psw.set_charset(dtmfchars) + rs = RadioSetting("oem.mode_psw", modepswlabel, val_psw) + + def apply_psw_id(setting, obj): + val2 = hex(int(str(val_psw), 16)) + if (int(val2, 16) != 0): + while len(val2) < 8: + val2 += '0' + psw = int(str(val2), 16) + obj.mode_psw = psw + rs.set_apply_callback(apply_psw_id, _oem) + cfg2_grp.append(rs) + + rs = RadioSetting("ABR", "Backlight On Time (ABR)", + RadioSettingValueList( + ABR_LIST, + ABR_LIST[_settings.ABR])) + cfg2_grp.append(rs) + + rs = RadioSetting("KeyA", "Key A", + RadioSettingValueList( + key_l, + key_l[_settings.KeyA])) + cfg2_grp.append(rs) + rs = RadioSetting("KeyB", "Key B", + RadioSettingValueList( + key_l, + key_l[_settings.KeyB])) + cfg2_grp.append(rs) + rs = RadioSetting("KeyC", "Key C", + RadioSettingValueList( + key_l, + key_l[_settings.KeyC])) + cfg2_grp.append(rs) + + if self.MODEL == "KG-1000G Plus": + rs = RadioSetting("KeyD", "Key D", + RadioSettingValueList( + KEY_LIST_1000GPLUS, + KEY_LIST_1000GPLUS[_settings.KeyD])) + cfg2_grp.append(rs) + + rs = RadioSetting("key_lock", "Key Lock Active", + RadioSettingValueBoolean(_settings.key_lock)) + cfg2_grp.append(rs) + + rs = RadioSetting("act_area", "Active Area (BAND)", + RadioSettingValueList( + ACTIVE_AREA_LIST, + ACTIVE_AREA_LIST[_settings.act_area])) + cfg2_grp.append(rs) + rs = RadioSetting("tdr_off", "TDR", + RadioSettingValueList( + TDR_LIST, + TDR_LIST[_settings.tdr_off])) + cfg2_grp.append(rs) + + # Freq Limits settings + + # Convert Integer back to correct limit HEX value: + s = self._memobj + + _temp = int(s.bandlimits.limit_144M_ChA_rx_start) // 10 + val = RadioSettingValueInteger(0, 999, _temp) + rs = RadioSetting("bandlimits.limit_144M_ChA_rx_start", + "144M Area A Rx Lower Limit (MHz)", + RadioSettingValueInteger(0, 999, + val)) + rxlim_grp.append(rs) + + _temp = int(s.bandlimits.limit_144M_ChA_rx_stop) // 10 + val = RadioSettingValueInteger(0, 999, _temp) + rs = RadioSetting("bandlimits.limit_144M_ChA_rx_stop", + "144M Area A Rx Upper Limit (+ .9975 MHz)", + RadioSettingValueInteger(0, 999, + val)) + rxlim_grp.append(rs) + + _temp = int(s.bandlimits.limit_144M_ChB_rx_start) // 10 + val = RadioSettingValueInteger(0, 999, _temp) + rs = RadioSetting("bandlimits.limit_144M_ChB_rx_start", + "144M Area B Rx Lower Limit (MHz)", + RadioSettingValueInteger(0, 999, + val)) + rxlim_grp.append(rs) + + _temp = int(s.bandlimits.limit_144M_ChB_rx_stop) // 10 + val = RadioSettingValueInteger(0, 999, _temp) + rs = RadioSetting("bandlimits.limit_144M_ChB_rx_stop", + "144M Area B Rx Upper Limit (+ .9975 MHz)", + RadioSettingValueInteger(0, 999, + val)) + rxlim_grp.append(rs) + + _temp = int(s.bandlimits.limit_70cm_rx_start) // 10 + val = RadioSettingValueInteger(0, 999, _temp) + rs = RadioSetting("bandlimits.limit_70cm_rx_start", + "450M Rx Lower Limit (MHz)", + RadioSettingValueInteger(0, 999, + val)) + rxlim_grp.append(rs) + + _temp = int(s.bandlimits.limit_70cm_rx_stop) // 10 + val = RadioSettingValueInteger(0, 999, _temp) + rs = RadioSetting("bandlimits.limit_70cm_rx_stop", + "450M Rx Upper Limit (+ .9975 MHz)", + RadioSettingValueInteger(0, 999, + val)) + rxlim_grp.append(rs) + + if self.MODEL == "KG-UV980P": + _temp = int(s.bandlimits.limit_10m_rx_start) // 10 + val = RadioSettingValueInteger(0, 999, _temp) + rs = RadioSetting("bandlimits.limit_10m_rx_start", + "20M Rx Lower Limit (MHz)", + RadioSettingValueInteger(0, 999, + val)) + rxlim_grp.append(rs) + + _temp = int(s.bandlimits.limit_10m_rx_stop) // 10 + val = RadioSettingValueInteger(0, 999, _temp) + rs = RadioSetting("bandlimits.limit_10m_rx_stop", + "20M Rx Upper Limit (+ .9975 MHz)", + RadioSettingValueInteger(0, 999, + val)) + rxlim_grp.append(rs) + + _temp = int(s.bandlimits.limit_6m_rx_start) // 10 + val = RadioSettingValueInteger(0, 999, _temp) + rs = RadioSetting("bandlimits.limit_6m_rx_start", + "50M Rx Lower Limit (MHz)", + RadioSettingValueInteger(0, 999, + val)) + rxlim_grp.append(rs) + + _temp = int(s.bandlimits.limit_6m_rx_stop) // 10 + val = RadioSettingValueInteger(0, 999, _temp) + rs = RadioSetting("bandlimits.limit_6m_rx_stop", + "50M Rx Upper Limit (+ .9975 MHz)", + RadioSettingValueInteger(0, 999, + val)) + rxlim_grp.append(rs) + + _temp = int(s.bandlimits.limit_350M_rx_start) // 10 + val = RadioSettingValueInteger(0, 999, _temp) + rs = RadioSetting("bandlimits.limit_350M_rx_start", + "350M Rx Lower Limit (MHz)", + RadioSettingValueInteger(0, 999, + val)) + rxlim_grp.append(rs) + + _temp = int(s.bandlimits.limit_350M_rx_stop) // 10 + val = RadioSettingValueInteger(0, 999, _temp) + rs = RadioSetting("bandlimits.limit_350M_rx_stop", + "350M Rx Upper Limit (+ .9975 MHz)", + RadioSettingValueInteger(0, 999, + val)) + rxlim_grp.append(rs) + + _temp = int(s.bandlimits.limit_850M_rx_start) // 10 + val = RadioSettingValueInteger(0, 999, _temp) + rs = RadioSetting("bandlimits.limit_850M_rx_start", + "850M Rx Lower Limit (MHz)", + RadioSettingValueInteger(0, 999, + val)) + rxlim_grp.append(rs) + + _temp = int(s.bandlimits.limit_850M_rx_stop) // 10 + val = RadioSettingValueInteger(0, 999, _temp) + rs = RadioSetting("bandlimits.limit_850M_rx_stop", + "850M Rx Upper Limit (+ .9975 MHz)", + RadioSettingValueInteger(0, 999, + val)) + rxlim_grp.append(rs) + if self.MODEL == "KG-UV980P": + _temp = int(s.bandlimits.limit_144M_tx_start) // 10 + val = RadioSettingValueInteger(0, 999, _temp) + rs = RadioSetting("bandlimits.limit_144M_tx_start", + "144M Tx Lower Limit (MHz)", + RadioSettingValueInteger(0, 999, + val)) + txlim_grp.append(rs) + + _temp = int(s.bandlimits.limit_144M_tx_stop) // 10 + val = RadioSettingValueInteger(0, 999, _temp) + rs = RadioSetting("bandlimits.limit_144M_tx_stop", + "144M Tx Upper Limit (+ .9975 MHz)", + RadioSettingValueInteger(0, 999, + val)) + txlim_grp.append(rs) + + _temp = int(s.bandlimits.limit_70cm_tx_start) // 10 + val = RadioSettingValueInteger(0, 999, _temp) + rs = RadioSetting("bandlimits.limit_70cm_tx_start", + "450M Tx Lower Limit (MHz)", + RadioSettingValueInteger(0, 999, + val)) + txlim_grp.append(rs) + + _temp = int(s.bandlimits.limit_70cm_tx_stop) // 10 + val = RadioSettingValueInteger(0, 999, _temp) + rs = RadioSetting("bandlimits.limit_70cm_tx_stop", + "450M tx Upper Limit (+ .9975 MHz)", + RadioSettingValueInteger(0, 999, + val)) + txlim_grp.append(rs) + + if self.MODEL == "KG-UV980P": + _temp = int(s.bandlimits.limit_10m_tx_start) // 10 + val = RadioSettingValueInteger(0, 999, _temp) + rs = RadioSetting("bandlimits.limit_10m_tx_start", + "20M tx Lower Limit (MHz)", + RadioSettingValueInteger(0, 999, + val)) + txlim_grp.append(rs) + + _temp = int(s.bandlimits.limit_10m_tx_stop) // 10 + val = RadioSettingValueInteger(0, 999, _temp) + rs = RadioSetting("bandlimits.limit_10m_tx_stop", + "20M tx Upper Limit (+ .9975 MHz)", + RadioSettingValueInteger(0, 999, + val)) + txlim_grp.append(rs) + + _temp = int(s.bandlimits.limit_6m_tx_start) // 10 + val = RadioSettingValueInteger(0, 999, _temp) + rs = RadioSetting("bandlimits.limit_6m_tx_start", + "50M tx Lower Limit (MHz)", + RadioSettingValueInteger(0, 999, + val)) + txlim_grp.append(rs) + + _temp = int(s.bandlimits.limit_6m_tx_stop) // 10 + val = RadioSettingValueInteger(0, 999, _temp) + rs = RadioSetting("bandlimits.limit_6m_tx_stop", + "50M tx Upper Limit (+ .9975 MHz)", + RadioSettingValueInteger(0, 999, + val)) + txlim_grp.append(rs) + + # VFO Settings + rs = RadioSetting("vfomode_a", "Working Mode", + RadioSettingValueMap(wmmap, + _settings.vfomode_a)) + vfoa_grp.append(rs) + + rs = RadioSetting("vfoband_a", "Current Band", + RadioSettingValueMap(VFOBAND_MAP, + _settings.vfoband_a)) + vfoa_grp.append(rs) + + rs = RadioSetting("vfochan_a", "Active/Work Channel", + RadioSettingValueInteger(1, 999, + _chnum_decode( + _settings.vfochan_a))) + vfoa_grp.append(rs) + + rs = RadioSetting("vfosquelch_a", "Squelch", + RadioSettingValueInteger(0, 9, + _settings.vfosquelch_a)) + vfoa_grp.append(rs) + rs = RadioSetting("vfostep_a", "Step", + RadioSettingValueList( + STEP_LIST, + STEP_LIST[_settings.vfostep_a])) + vfoa_grp.append(rs) + + # ##################### + + rs = RadioSetting("vfofreq1", "150M Freq", + RadioSettingValueFloat( + 0, 999.999999, (_freq_decode + (_settings.vfofreq1) / + 1000000.0), 0.000001, 6)) + vfo150_grp.append(rs) + + if self.MODEL != "KG-1000G Plus": + rs = RadioSetting("vfoofst1", "150M Offset", + RadioSettingValueFloat( + 0, 999.999999, (_freq_decode + (_settings.vfoofst1) / + 1000000.0), 0.000001, 6)) + vfo150_grp.append(rs) + + rs = RadioSetting("rxtone1", "150M Rx tone", + RadioSettingValueMap( + TONE_MAP, _settings.rxtone1)) + vfo150_grp.append(rs) + + rs = RadioSetting("txtone1", "150M Tx tone", + RadioSettingValueMap( + TONE_MAP, _settings.txtone1)) + vfo150_grp.append(rs) + + rs = RadioSetting("power1", "150M Power", + RadioSettingValueMap( + POWER_MAP, _settings.power1)) + vfo150_grp.append(rs) + + rs = RadioSetting("narrow1", narrow1label, + RadioSettingValueMap( + BANDWIDTH_MAP, _settings.narrow1)) + vfo150_grp.append(rs) + + rs = RadioSetting("mute1", mute1label, + RadioSettingValueMap( + MUTE_MODE_MAP, _settings.mute1)) + vfo150_grp.append(rs) + + if self.MODEL == "KG-1000G Plus": + rs = RadioSetting("shft_dir1", "150M Repeater", + RadioSettingValueBoolean( + _settings.shft_dir1)) + else: + rs = RadioSetting("shft_dir1", "150M Shift Direction", + RadioSettingValueList( + DUPLEX_LIST, + DUPLEX_LIST[_settings.shft_dir1])) + vfo150_grp.append(rs) + + rs = RadioSetting("compander1", "150M Compander", + RadioSettingValueBoolean( + _settings.compander1)) + vfo150_grp.append(rs) + + rs = RadioSetting("scrambler1", scram1label, + RadioSettingValueList( + SCRAMBLER_LIST, + SCRAMBLER_LIST[_settings.scrambler1])) + vfo150_grp.append(rs) + rs = RadioSetting("am_mode1", "150M AM Mode", + RadioSettingValueBoolean( + _settings.am_mode1)) + vfo150_grp.append(rs) + + # ########################### + + rs = RadioSetting("vfofreq2", "450M Freq", + RadioSettingValueFloat( + 0, 999.999999, (_freq_decode( + _settings.vfofreq2) / + 1000000.0), 0.000001, 6)) + vfo450_grp.append(rs) + + if self.MODEL != "KG-1000G Plus": + rs = RadioSetting("vfoofst2", "450M Offset", + RadioSettingValueFloat( + 0, 999.999999, (_freq_decode( + _settings.vfoofst2) / + 1000000.0), 0.000001, 6)) + vfo450_grp.append(rs) + + rs = RadioSetting("rxtone2", "450M Rx tone", + RadioSettingValueMap( + TONE_MAP, _settings.rxtone2)) + vfo450_grp.append(rs) + + rs = RadioSetting("txtone2", "450M Tx tone", + RadioSettingValueMap( + TONE_MAP, _settings.txtone2)) + vfo450_grp.append(rs) + + rs = RadioSetting("power2", "450M Power", + RadioSettingValueMap( + POWER_MAP, _settings.power2)) + vfo450_grp.append(rs) + + rs = RadioSetting("narrow2", narrow2label, + RadioSettingValueMap( + BANDWIDTH_MAP, _settings.narrow2)) + vfo450_grp.append(rs) + + rs = RadioSetting("mute2", mute2label, + RadioSettingValueMap( + MUTE_MODE_MAP, _settings.mute2)) + vfo450_grp.append(rs) + + if self.MODEL == "KG-1000G Plus": + rs = RadioSetting("shft_dir2", "450M Repeater", + RadioSettingValueBoolean( + _settings.shft_dir2)) + else: + rs = RadioSetting("shft_dir2", "450M Shift Direction", + RadioSettingValueList( + DUPLEX_LIST, + DUPLEX_LIST[_settings.shft_dir2])) + vfo450_grp.append(rs) + + rs = RadioSetting("compander2", "450M Compander", + RadioSettingValueBoolean( + _settings.compander2)) + vfo450_grp.append(rs) + + rs = RadioSetting("scrambler2", scram2label, + RadioSettingValueList( + SCRAMBLER_LIST, + SCRAMBLER_LIST[_settings.scrambler2])) + vfo450_grp.append(rs) + + rs = RadioSetting("am_mode2", "450M AM Mode", + RadioSettingValueBoolean( + _settings.am_mode2)) + vfo450_grp.append(rs) + + # ########################### + if self.MODEL == "KG-UV980P": + rs = RadioSetting("vfofreq3", "20M Freq", + RadioSettingValueFloat( + 0, 999.999999, (_freq_decode( + _settings.vfofreq3) / + 1000000.0), 0.000001, 6)) + vfo20_grp.append(rs) + + if self.MODEL == "KG-UV980P": + rs = RadioSetting("vfoofst3", "20M Offset", + RadioSettingValueFloat( + 0, 999.999999, (_freq_decode( + _settings.vfoofst3) / + 1000000.0), 0.000001, 6)) + vfo20_grp.append(rs) + + rs = RadioSetting("rxtone3", "20M Rx tone", + RadioSettingValueMap( + TONE_MAP, _settings.rxtone3)) + vfo20_grp.append(rs) + + rs = RadioSetting("txtone3", "20M Tx tone", + RadioSettingValueMap( + TONE_MAP, _settings.txtone3)) + vfo20_grp.append(rs) + + rs = RadioSetting("power3", "20M Power", + RadioSettingValueMap( + POWER_MAP, _settings.power3)) + vfo20_grp.append(rs) + + rs = RadioSetting("narrow3", narrow3label, + RadioSettingValueMap( + BANDWIDTH_MAP, _settings.narrow3)) + vfo20_grp.append(rs) + + rs = RadioSetting("mute3", mute3label, + RadioSettingValueMap( + MUTE_MODE_MAP, _settings.mute3)) + vfo20_grp.append(rs) + + if self.MODEL == "KG-1000G Plus": + rs = RadioSetting("shft_dir3", "20M Repeater", + RadioSettingValueBoolean( + _settings.shft_dir3)) + else: + rs = RadioSetting("shft_dir3", "20M Shift Direction", + RadioSettingValueList( + DUPLEX_LIST, + DUPLEX_LIST[_settings.shft_dir3])) + vfo20_grp.append(rs) + + rs = RadioSetting("compander3", "20M Compander", + RadioSettingValueBoolean( + _settings.compander3)) + vfo20_grp.append(rs) + + rs = RadioSetting("scrambler3", scram3label, + RadioSettingValueList( + SCRAMBLER_LIST, + SCRAMBLER_LIST[_settings.scrambler3])) + vfo20_grp.append(rs) + + rs = RadioSetting("am_mode3", "20M AM Mode", + RadioSettingValueBoolean( + _settings.am_mode3)) + vfo20_grp.append(rs) + + # ########################### + + rs = RadioSetting("vfofreq4", "50M Freq", + RadioSettingValueFloat( + 0, 999.999999, (_freq_decode( + _settings.vfofreq4) / + 1000000.0), 0.000001, 6)) + vfo50_grp.append(rs) + + if self.MODEL != "KG-1000G Plus": + rs = RadioSetting("vfoofst4", "50M Offset", + RadioSettingValueFloat( + 0, 999.999999, (_freq_decode( + _settings.vfoofst4) / + 1000000.0), 0.000001, 6)) + vfo50_grp.append(rs) + + rs = RadioSetting("rxtone4", "50M Rx tone", + RadioSettingValueMap( + TONE_MAP, _settings.rxtone4)) + vfo50_grp.append(rs) + + rs = RadioSetting("txtone4", "50M Tx tone", + RadioSettingValueMap( + TONE_MAP, _settings.txtone4)) + vfo50_grp.append(rs) + + rs = RadioSetting("power4", "50M Power", + RadioSettingValueMap( + POWER_MAP, _settings.power4)) + vfo50_grp.append(rs) + + rs = RadioSetting("narrow4", narrow4label, + RadioSettingValueMap( + BANDWIDTH_MAP, _settings.narrow4)) + vfo50_grp.append(rs) + + rs = RadioSetting("mute4", mute4label, + RadioSettingValueMap( + MUTE_MODE_MAP, _settings.mute4)) + vfo50_grp.append(rs) + + if self.MODEL == "KG-1000G Plus": + rs = RadioSetting("shft_dir4", "50M Repeater", + RadioSettingValueBoolean( + _settings.shft_dir4)) + else: + rs = RadioSetting("shft_dir4", "50M Shift Direction", + RadioSettingValueList( + DUPLEX_LIST, + DUPLEX_LIST[_settings.shft_dir4])) + vfo50_grp.append(rs) + + rs = RadioSetting("compander4", "50M Compander", + RadioSettingValueBoolean( + _settings.compander4)) + vfo50_grp.append(rs) + + rs = RadioSetting("scrambler4", scram4label, + RadioSettingValueList( + SCRAMBLER_LIST, + SCRAMBLER_LIST[_settings.scrambler4])) + vfo50_grp.append(rs) + + rs = RadioSetting("am_mode4", "50M AM Mode", + RadioSettingValueBoolean( + _settings.am_mode4)) + vfo50_grp.append(rs) + # ########################### + rs = RadioSetting("vfofreq5", "350M Freq", + RadioSettingValueFloat( + 0, 999.999999, (_freq_decode( + _settings.vfofreq5) / + 1000000.0), 0.000001, 6)) + vfo350_grp.append(rs) + + if self.MODEL != "KG-1000G Plus": + rs = RadioSetting("vfoofst5", "350M Offset", + RadioSettingValueFloat( + 0, 999.999999, (_freq_decode( + _settings.vfoofst5) / + 1000000.0), 0.000001, 6)) + vfo350_grp.append(rs) + + rs = RadioSetting("rxtone5", "350M Rx tone", + RadioSettingValueMap( + TONE_MAP, _settings.rxtone5)) + vfo350_grp.append(rs) + + rs = RadioSetting("txtone5", "350M Tx tone", + RadioSettingValueMap( + TONE_MAP, _settings.txtone5)) + vfo350_grp.append(rs) + + rs = RadioSetting("power5", "350M Power", + RadioSettingValueMap( + POWER_MAP, _settings.power5)) + vfo350_grp.append(rs) + + rs = RadioSetting("narrow5", narrow5label, + RadioSettingValueMap( + BANDWIDTH_MAP, _settings.narrow5)) + vfo350_grp.append(rs) + + rs = RadioSetting("mute5", mute5label, + RadioSettingValueMap( + MUTE_MODE_MAP, _settings.mute5)) + vfo350_grp.append(rs) + + if self.MODEL == "KG-1000G Plus": + rs = RadioSetting("shft_dir5", "350M Repeater", + RadioSettingValueBoolean( + _settings.shft_dir5)) + else: + rs = RadioSetting("shft_dir5", "350M Shift Direction", + RadioSettingValueList( + DUPLEX_LIST, + DUPLEX_LIST[_settings.shft_dir5])) + vfo350_grp.append(rs) + + rs = RadioSetting("compander5", "350M Compander", + RadioSettingValueBoolean( + _settings.compander5)) + vfo350_grp.append(rs) + + rs = RadioSetting("scrambler5", scram5label, + RadioSettingValueList( + SCRAMBLER_LIST, + SCRAMBLER_LIST[_settings.scrambler5])) + vfo350_grp.append(rs) + + rs = RadioSetting("am_mode5", "350M AM Mode", + RadioSettingValueBoolean( + _settings.am_mode5)) + vfo350_grp.append(rs) + + # ############################ + rs = RadioSetting("vfofreq6", "850M Freq", + RadioSettingValueFloat( + 0, 999.999999, (_freq_decode( + _settings.vfofreq6) / + 1000000.0), 0.000001, 6)) + vfo850_grp.append(rs) + if self.MODEL != "KG-1000G Plus": + rs = RadioSetting("vfoofst6", "850M Offset", + RadioSettingValueFloat( + 0, 999.999999, (_freq_decode( + _settings.vfoofst6) / + 1000000.0), 0.000001, 6)) + vfo850_grp.append(rs) + + rs = RadioSetting("rxtone6", "850M Rx tone", + RadioSettingValueMap( + TONE_MAP, _settings.rxtone6)) + vfo850_grp.append(rs) + + rs = RadioSetting("txtone6", "850M Tx tone", + RadioSettingValueMap( + TONE_MAP, _settings.txtone6)) + vfo850_grp.append(rs) + + rs = RadioSetting("power6", "850M Power", + RadioSettingValueMap( + POWER_MAP, _settings.power6)) + vfo850_grp.append(rs) + + rs = RadioSetting("narrow6", narrow6label, + RadioSettingValueMap( + BANDWIDTH_MAP, _settings.narrow6)) + vfo850_grp.append(rs) + + rs = RadioSetting("mute6", mute6label, + RadioSettingValueMap( + MUTE_MODE_MAP, _settings.mute6)) + vfo850_grp.append(rs) + + if self.MODEL == "KG-1000G Plus": + rs = RadioSetting("shft_dir6", "850M Repeater", + RadioSettingValueBoolean( + _settings.shft_dir6)) + else: + rs = RadioSetting("shft_dir6", "850M Shift Direction", + RadioSettingValueList( + DUPLEX_LIST, + DUPLEX_LIST[_settings.shft_dir6])) + vfo850_grp.append(rs) + + rs = RadioSetting("compander6", "850M Compander", + RadioSettingValueBoolean( + _settings.compander6)) + vfo850_grp.append(rs) + + rs = RadioSetting("scrambler6", scram6label, + RadioSettingValueList( + SCRAMBLER_LIST, + SCRAMBLER_LIST[_settings.scrambler6])) + vfo850_grp.append(rs) + + rs = RadioSetting("am_mode6", "850M AM Mode", + RadioSettingValueBoolean( + _settings.am_mode6)) + vfo850_grp.append(rs) + + # ########################### + + rs = RadioSetting("vfomode_b", "Working Mode", + RadioSettingValueMap(wmmap, + _settings.vfomode_b)) + vfob_grp.append(rs) + + rs = RadioSetting("vfochan_b", "Active/Work Channel", + RadioSettingValueInteger(1, 999, + _chnum_decode( + _settings.vfochan_b))) + vfob_grp.append(rs) + + rs = RadioSetting("vfofreq7", "Freq", + RadioSettingValueFloat( + 0, 999.999999, (_freq_decode( + _settings.vfofreq7) / + 1000000.0), 0.000001, 6)) + vfob_grp.append(rs) + + if self.MODEL != "KG-1000G Plus": + rs = RadioSetting("vfoofst7", "Offset", + RadioSettingValueFloat( + 0, 999.999999, (_freq_decode( + _settings.vfoofst7) / + 1000000.0), 0.000001, 6)) + vfob_grp.append(rs) + + rs = RadioSetting("rxtone7", "Rx tone", + RadioSettingValueMap( + TONE_MAP, _settings.rxtone7)) + vfob_grp.append(rs) + + rs = RadioSetting("txtone7", "Tx tone", + RadioSettingValueMap( + TONE_MAP, _settings.txtone7)) + vfob_grp.append(rs) + rs = RadioSetting("power7", "Power", + RadioSettingValueMap( + POWER_MAP, _settings.power7)) + vfob_grp.append(rs) + rs = RadioSetting("narrow7", narrow7label, + RadioSettingValueMap( + BANDWIDTH_MAP, _settings.narrow7)) + vfob_grp.append(rs) + rs = RadioSetting("mute7", mute7label, + RadioSettingValueMap( + MUTE_MODE_MAP, _settings.mute7)) + vfob_grp.append(rs) + if self.MODEL == "KG-1000G Plus": + rs = RadioSetting("shft_dir7", "Repeater", + RadioSettingValueBoolean( + _settings.shft_dir7)) + else: + rs = RadioSetting("shft_dir7", "Shift Direction", + RadioSettingValueList( + DUPLEX_LIST, + DUPLEX_LIST[_settings.shft_dir7])) + vfob_grp.append(rs) + rs = RadioSetting("compander7", "Compander", + RadioSettingValueBoolean( + _settings.compander7)) + vfob_grp.append(rs) + + rs = RadioSetting("scrambler7", scram7label, + RadioSettingValueList( + SCRAMBLER_LIST, + SCRAMBLER_LIST[_settings.scrambler7])) + vfob_grp.append(rs) + + rs = RadioSetting("vfosquelch_b", "Squelch", + RadioSettingValueInteger(0, 9, + _settings.vfosquelch_b)) + vfob_grp.append(rs) + rs = RadioSetting("vfostep_b", "Step", + RadioSettingValueList( + STEP_LIST, + STEP_LIST[_settings.vfostep_b])) + vfob_grp.append(rs) + + # Scan Group Settings + def _decode(lst): + LOG.debug("lst %s", lst) + _str = ''.join([chr(c) for c in lst + if chr(c) in SCANNAME_CHARSET]) + return _str + + rs = RadioSetting("scan_a_act", "Scan A Active Group", + RadioSettingValueList( + SCAN_GROUP_LIST, + SCAN_GROUP_LIST[_settings.scan_a_act])) + scan_grp.append(rs) + rs = RadioSetting("scan_b_act", "Scan B Active Group", + RadioSettingValueList( + SCAN_GROUP_LIST, + SCAN_GROUP_LIST[_settings.scan_b_act])) + scan_grp.append(rs) + + for i in range(1, 11): + x = str(i) + _str = _decode(eval("_settings.scanname"+x)) + LOG.debug("ScanName %s", i) + LOG.debug("is %s", _str) + # CPS treats PPPPPP as a blank name as it is the factory reset + # value" + # The Radio treats PPPPPPP as a blank name and can display 8 + # chars" + # Force Chirp to blank out the scan name if value is PPPPPPP + # to match the radio" + # Blank out the name if first 6 are spaces or null and the + # 7th is a P to handle + # firmware peculiarities in handling all 8 characters. + if _str[0:7] == "PPPPPPP": + _str = "" + if self.MODEL != "KG-1000G Plus": + if _str[0:7] == "\x00\x00\x00\x00\x00\x00P": + _str = "" + elif _str[0:7] == "\x20\x20\x20\x20\x20\x20P": + _str = "" + else: + if _str[0:6] == "\x00\x00\x00\x00\x00\x00": + _str = "" + elif _str[0:6] == "\x20\x20\x20\x20\x20\x20": + _str = "" + elif (len(_str) == 2) & (_str[0:2] == "PP"): + _str = "" + rs = RadioSetting("scanname" + x, "Scan Name " + x, + RadioSettingValueString(0, 8, _str)) + scanname_grp.append(rs) + + scngrp = str(i) + rs = RadioSetting("scanlower"+scngrp, "Scan Lower "+scngrp, + RadioSettingValueInteger(1, 999, + eval( + "_settings.\ + scanlower" + + scngrp))) + scan_grp.append(rs) + rs = RadioSetting("scanupper"+scngrp, "Scan Upper "+scngrp, + RadioSettingValueInteger(1, 999, + eval( + "_settings.scanupper" + + scngrp))) + scan_grp.append(rs) +# remote settings + rs = RadioSetting("rc_power", "RC Power", + RadioSettingValueList( + RC_POWER_LIST, + RC_POWER_LIST[_settings.rc_power])) + remote_grp.append(rs) + + def decode_remote_vals(self, setting): + # parse the id value and replace all C with empty + # C indicates the end of the id value + code = ('%06X' % int(setting)).replace('C', '') + return int(code), code + + def apply_remote_id(setting, obj, val): + val = str(val) + value = int(val.ljust(3, '0').ljust(6, 'C'), 16) + setattr(obj, setting.get_name(), value) + + val_ani, code_val = decode_remote_vals(self, _settings.ani_edit) + LOG.debug("ani = %s" % val_ani) + val_ani = RadioSettingValueString(3, 6, code_val, False) + val_ani.set_charset(dtmfchars) + rs = RadioSetting("settings.ani_edit", "ANI Edit", val_ani) + + def apply_ani_id(setting, obj): + LOG.debug("val= %s" % val_ani) + if str(val_ani)[0] == "0": + raise errors.RadioError("ANI EDIT must start with \ + Non-Zero Digit") + val = str(val_ani) + value = int(val.ljust(3, '0').ljust(6, 'C'), 16) + obj.ani_edit = value + rs.set_apply_callback(apply_ani_id, _settings) + remote_grp.append(rs) + + val_mcc, code_val = decode_remote_vals(self, _settings.mcc_edit) + LOG.debug("mcc = %s" % val_mcc) + val_mcc = RadioSettingValueString(3, 6, code_val, False) + val_mcc.set_charset(dtmfchars) + rs = RadioSetting("mcc_edit", "MCC Edit", val_mcc) + + rs.set_apply_callback(apply_remote_id, _settings, val_mcc) + remote_grp.append(rs) + + val_scc, code_val = decode_remote_vals(self, _settings.scc_edit) + LOG.debug("scc = %s" % val_scc) + val_scc = RadioSettingValueString(3, 6, code_val, False) + val_scc.set_charset(dtmfchars) + rs = RadioSetting("scc_edit", "SCC Edit", val_scc) + + rs.set_apply_callback(apply_remote_id, _settings, val_scc) + remote_grp.append(rs) + + val_ctrl, code_val = decode_remote_vals(self, _settings.ctrl_edit) + LOG.debug("ctrl = %s" % val_ctrl) + val_ctrl = RadioSettingValueString(3, 6, code_val, False) + val_ctrl.set_charset(dtmfchars) + rs = RadioSetting("ctrl_edit", "CTRL Edit", val_ctrl) + + rs.set_apply_callback(apply_remote_id, _settings, val_ctrl) + remote_grp.append(rs) + + # OEM Settings + if self.MODEL != "KG-1000G Plus": + _oem_name = _oem_str_decode(self._memobj.oem.display_name) + else: + displayname = self._memobj.oem.display_name + _oem_name = _oem_str_decode_1000GPLUS(displayname) + + rs = RadioSetting("oem.display_name", "Area Message", + RadioSettingValueString(1, 8, _oem_name)) + oem_grp.append(rs) + + # FM RADIO PRESETS + + # memory stores raw integer value like 7600 + # radio will divide 7600 by 100 and interpret correctly at 76.0 MHz + + for i in range(1, 21): + # chan = str(i) + fmname = "FM_radio%i" % i + fmlabel = "FM Preset %i" % i + fmvalue = getattr(_settings, fmname) + # some CPS versions store values with .01 MHz in error + # eg 99.5 MHz is stored as 0x26df = 9951 dec = 99.51 MHz + # even though the radio properly displays 99.5 + # this will drop the 0.01 MHz for Chirp Displayed values + fmvalue = fmvalue // 10 / 10 + rs = RadioSetting(fmname, fmlabel, + RadioSettingValueFloat(76.0, 108.0, + fmvalue, + 0.1, 1)) + fmradio_grp.append(rs) + + return group + + def get_settings(self): + try: + return self._get_settings() + except Exception: + LOG.exception("Failed to parse settings: %s") + return None + + def set_settings(self, settings): + for element in settings: + if not isinstance(element, RadioSetting): + self.set_settings(element) + continue + else: + try: + if "." in element.get_name(): + bits = element.get_name().split(".") + obj = self._memobj + for bit in bits[:-1]: + obj = getattr(obj, bit) + setting = bits[-1] + else: + obj = self._memobj.settings + setting = element.get_name() + + if element.has_apply_callback(): + LOG.debug("Using apply callback") + element.run_apply_callback() + else: + LOG.debug("Setting %s = %s" % (setting, element.value)) + if self._is_freq(element): + # rescale freq values to match radio + # expected values + value = _freq_encode( + element[0].get_value()*1000000.0) + setattr(obj, setting, value) + + elif self._is_fmradio_or_voltage(element): + # rescale FM Radio values to match radio + # expected values + setattr(obj, setting, + int(element.values()[0]._current * 100.0)) + + elif self._is_limit(element): + setattr(obj, setting, + int(element[0].get_value()) * 10) + + # Special VFO A Settings + # + elif self._is_chan(element): + value = _chnum_encode(element[0].get_value()) + setattr(obj, setting, value) + continue + elif self._is_display_name(element): + string = element[0].get_value() + if self.MODEL != "KG-1000G Plus": + nameenc = _oem_str_encode(string) + else: + nameenc = _oem_str_encode_1000GPLUS(string) + for i in range(0, 8): + LOG.debug("nameenc %s" % (nameenc[i])) + self._memobj.oem.display_name[i] = \ + ord(nameenc[i]) + + elif self._is_scan_name(element): + string = element[0].get_value() + LOG.debug("string %s" % (string)) + value = _str_encode(string) + LOG.debug("scaname %s" % (value)) + setattr(obj, setting, value.encode()) + else: + setattr(obj, setting, element.value) + except Exception: + LOG.debug(element.get_name()) + raise + + def _is_freq(self, element): + return ("rxfreq" in element.get_name() or + "txoffset" in element.get_name() or + "vfofreq" in element.get_name() or + "vfoofst" in element.get_name()) + + def _is_limit(self, element): + return "limit" in element.get_name() + + def _is_fmradio_or_voltage(self, element): + return ("FM_radio" in element.get_name() or + "thr_vol_lvl" in element.get_name()) + + def _is_chan(self, element): + return ("vfochan" in element.get_name() or + "pri_ch" in element.get_name()) + + def _is_display_name(self, element): + return "display_name" in element.get_name() + + def _is_scan_name(self, element): + return "scanname" in element.get_name() + + +@directory.register +class KG1000GRadio(KG980PRadio): + + # """Wouxun KG-1000G""" + VENDOR = "Wouxun" + MODEL = "KG-1000G" + + +@directory.register +class KG1000GPlusRadio(KG980PRadio): + + # """Wouxun KG-1000G Plus""" + VENDOR = "Wouxun" + MODEL = "KG-1000G Plus" diff --git a/chirp/drivers/kguv9dplus.py b/chirp/drivers/kguv9dplus.py index 9856d26..53c8443 100644 --- a/chirp/drivers/kguv9dplus.py +++ b/chirp/drivers/kguv9dplus.py @@ -1,6 +1,7 @@ -# Copyright 2018 Jim Lieb -# -# Driver for Wouxon KG-UV9D Plus +# Copyright 2022 Mel Terechenok +# Updated Driver to support Wouxun KG-UV9PX +# based on prior driver for KG-UV9D Plus by +# Jim Lieb # # Borrowed from other chirp drivers, especially the KG-UV8D Plus # by Krystian Struzik @@ -21,16 +22,14 @@ """Wouxun KG-UV9D Plus radio management module""" import time -import os import logging import struct -import string -from chirp import util, chirp_common, bitwise, memmap, errors, directory -from chirp.settings import RadioSetting, RadioSettingValue, \ - RadioSettingGroup, \ - RadioSettingValueBoolean, RadioSettingValueList, \ - RadioSettingValueInteger, RadioSettingValueString, \ - RadioSettings, InvalidValueError +from chirp import chirp_common, bitwise, memmap, errors, directory +from chirp.settings import RadioSetting, RadioSettingGroup, \ + RadioSettingValueBoolean, \ + RadioSettingValueList, RadioSettingValueInteger, \ + RadioSettingValueString, RadioSettings, \ + InvalidValueError LOG = logging.getLogger(__name__) @@ -62,6 +61,8 @@ cmd_name = { config_map = ( # map address, write size, write count (0x40, 16, 1), # Passwords + (0x60, 20, 1), # RX frequency limits + (0x74, 8, 1), # TX frequency limits (0x740, 40, 1), # FM chan 1-20 (0x780, 16, 1), # vfo-b-150 (0x790, 16, 1), # vfo-b-450 @@ -85,13 +86,55 @@ config_map = ( # map address, write size, write count (0x4840, 48, 1), # Memory Channels 997-999 (0x4900, 32, 249), # Memory Names 1-996 (0x6820, 24, 1), # Memory Names 997-999 + (0x7000, 8, 124), # Valid Channel bytes 1-992 + (0x73E0, 1, 7), # Valid Channel Bytes 993-999 (0x7400, 64, 5), # CALL-ID 1-20, names 1-20 ) +config_map2 = ( # map address, write size, write count + (0x40, 16, 1), # Passwords + (0x50, 10, 1), # OEM Display Name + (0x60, 20, 1), # Rx Freq Limits Area A + (0x74, 8, 1), # TX Frequency Limits 150M and 450M + (0x7c, 4, 1), # Rx 150M Freq Limits Area B + # (0x80, 8, 1), # unknown Freq limits + (0x740, 40, 1), # FM chan 1-20 + (0x780, 16, 1), # vfo-b-150 + (0x790, 16, 1), # vfo-b-450 + (0x800, 16, 1), # vfo-a-150 + (0x810, 16, 1), # vfo-a-450 + (0x820, 16, 1), # vfo-a-300 + (0x830, 16, 1), # vfo-a-700 + (0x840, 16, 1), # vfo-a-200 + (0x860, 16, 1), # area-a-conf + (0x870, 16, 1), # area-b-conf + (0x880, 16, 1), # radio conf 0 + (0x890, 16, 1), # radio conf 1 + (0x8a0, 16, 1), # radio conf 2 + (0x8b0, 16, 1), # radio conf 3 + (0x8c0, 16, 1), # PTT-ANI + (0x8d0, 16, 1), # SCC + (0x8e0, 16, 1), # power save + (0x8f0, 16, 1), # Display banner + (0x940, 64, 2), # Scan groups and names + (0xa00, 64, 249), # Memory Channels 1-996 + (0x4840, 48, 1), # Memory Channels 997-999 + (0x4900, 32, 249), # Memory Names 1-996 + (0x6820, 24, 1), # Memory Names 997-999 + (0x7000, 8, 124), # Valid Channel bytes 1-992 + (0x73E0, 1, 7), # Valid Channel Bytes 993-999 + (0x7400, 64, 5), # CALL-ID 1-20, names 1-20 + (0x7600, 1, 1) # Screen Mode + ) MEM_VALID = 0xfc MEM_INVALID = 0xff - +VALID_MEM_VALUES = [MEM_VALID, 0x00, 0x02, 0x40, 0x3D] +INVALID_MEM_VALUES = [MEM_INVALID] +# new CHAN_VALID/INVALID mem values to address some radios not showing +# new channels +CHAN_VALID = 0x41 +CHAN_INVALID = 0xFC # Radio memory map. This matches the reads/writes above. # structure elements whose name starts with x are currently unidentified @@ -105,6 +148,26 @@ struct { char x4e; } passwords; +#seekto 0x60; + +struct freq_limit { + u16 start; + u16 stop; +}; + +struct { + struct freq_limit band_150; + struct freq_limit band_450; + struct freq_limit band_300; + struct freq_limit band_700; + struct freq_limit band_200; +} rx_freq_limits; + +struct { + struct freq_limit band_150; + struct freq_limit band_450; +} tx_freq_limits; + #seekto 0x740; struct { @@ -154,8 +217,7 @@ struct { struct area_conf { u8 w_mode; - u8 x861; - u8 w_chan; + u16 w_chan; u8 scan_grp; u8 bcl; u8 sql; @@ -312,6 +374,11 @@ struct { char name[8]; } chan_name[999]; +#seekto 0x7000; +struct { + u8 ch_valid; +} chan_valid[999]; + #seekto 0x7400; struct { u8 cid[6]; @@ -325,193 +392,444 @@ struct { } cid_names[20]; """ +_MEM_FORMAT_9PX = """ +#seekto 0x40; -# Support for the Wouxun KG-UV9D Plus radio -# Serial coms are at 19200 baud -# The data is passed in variable length records -# Record structure: -# Offset Usage -# 0 start of record (\x7d) -# 1 Command (6 commands, see above) -# 2 direction (\xff PC-> Radio, \x00 Radio -> PC) -# 3 length of payload (excluding header/checksum) (n) -# 4 payload (n bytes) -# 4+n+1 checksum - byte sum (% 256) of bytes 1 -> 4+n -# -# Memory Read Records: -# the payload is 3 bytes, first 2 are offset (big endian), -# 3rd is number of bytes to read -# Memory Write Records: -# the maximum payload size (from the Wouxun software) -# seems to be 66 bytes (2 bytes location + 64 bytes data). - -def _pkt_encode(op, payload): - """Assemble a packet for the radio and encode it for transmission. - Yes indeed, the checksum we store is only 4 bits. Why? - I suspect it's a bug in the radio firmware guys didn't want to fix, - i.e. a typo 0xff -> 0xf...""" - - data = bytearray() - data.append(0x7d) # tag that marks the beginning of the packet - data.append(op) - data.append(0xff) # 0xff is from app to radio - # calc checksum from op to end - cksum = op + 0xff - if (payload): - data.append(len(payload)) - cksum += len(payload) - for byte in payload: - cksum += byte - data.append(byte) - else: - data.append(0x00) - # Yea, this is a 4 bit cksum (also known as a bug) - data.append(cksum & 0xf) - - # now obfuscate by an xor starting with first payload byte ^ 0x52 - # including the trailing cksum. - xorbits = 0x52 - for i, byte in enumerate(data[4:]): - xord = xorbits ^ byte - data[i + 4] = xord - xorbits = xord - return(data) - - -def _pkt_decode(data): - """Take a packet hot off the wire and decode it into clear text - and return the fields. We say <> here because all it - turns out to be is annoying obfuscation. - This is the inverse of pkt_decode""" - - # we don't care about data[0]. - # It is always 0x7d and not included in checksum - op = data[1] - direction = data[2] - bytecount = data[3] +struct { + char reset[6]; + char x46[2]; + char mode_sw[6]; + char x4e; +} passwords; - # First un-obfuscate the payload and cksum - payload = bytearray() - xorbits = 0x52 - for i, byte in enumerate(data[4:]): - payload.append(xorbits ^ byte) - xorbits = byte +#seekto 0x50; +struct { + char model[10]; +} oemmodel; - # Calculate the checksum starting with the 3 bytes of the header - cksum = op + direction + bytecount - for byte in payload[:-1]: - cksum += byte - # yes, a 4 bit cksum to match the encode - cksum_match = (cksum & 0xf) == payload[-1] - if (not cksum_match): - LOG.debug( - "Checksum mismatch: %x != %x; " % (cksum, payload[-1])) - return (cksum_match, op, payload[:-1]) +#seekto 0x60; +struct { + u16 lim_150M_area_a_rxlower_limit; // 0x60 + u16 lim_150M_area_a_rxupper_limit; + u16 lim_450M_rxlower_limit; + u16 lim_450M_rxupper_limit; + u16 lim_300M_rxlower_limit; + u16 lim_300M_rxupper_limit; + u16 lim_800M_rxlower_limit; + u16 lim_800M_rxupper_limit; + u16 lim_210M_rxlower_limit; + u16 lim_210M_rxupper_limit; + u16 lim_150M_Txlower_limit; + u16 lim_150M_Txupper_limit; + u16 lim_450M_Txlower_limit; + u16 lim_450M_Txupper_limit; + u16 lim_150M_area_b_rxlower_limit; + u16 lim_150M_area_b_rxupper_limit; + u16 unknown_lower_limit; + u16 unknown_upper_limit; + u16 unknown2_lower_limit; + u16 unknown2_upper_limit; +} limits; -# UI callbacks to process input for mapping UI fields to memory cells +#seekto 0x740; +struct { + u16 fm_freq; +} fm_chans[20]; -def freq2int(val, min, max): - """Convert a frequency as a string to a u32. Units is Hz - """ - _freq = chirp_common.parse_freq(str(val)) - if _freq > max or _freq < min: - raise InvalidValueError("Frequency %s is not with in %s-%s" % - (chirp_common.format_freq(_freq), - chirp_common.format_freq(min), - chirp_common.format_freq(max))) - return _freq +// each band has its own configuration, essentially its default params +struct vfo { + u32 freq; + u32 offset; + u16 encqt; + u16 decqt; + u8 bit7_4:3, + qt:3, + bit1_0:2; + u8 bit7:1, + scan:1, + bit5:1, + pwr:2, + mod:1, + fm_dev:2; + u8 pad2:6, + shift:2; + u8 zeros; +}; -def int2freq(freq): - """ - Convert a u32 frequency to a string for UI data entry/display - This is stored in the radio as units of 10Hz which we compensate to Hz. - A value of -1 indicates , i.e. unused channel. - """ - if (int(freq) > 0): - f = chirp_common.format_freq(freq) - return f - else: - return "" +#seekto 0x780; +struct { + struct vfo band_150; + struct vfo band_450; +} vfo_b; -def freq2short(val, min, max): - """Convert a frequency as a string to a u16 which is units of 10KHz - """ - _freq = chirp_common.parse_freq(str(val)) - if _freq > max or _freq < min: - raise InvalidValueError("Frequency %s is not with in %s-%s" % - (chirp_common.format_freq(_freq), - chirp_common.format_freq(min), - chirp_common.format_freq(max))) - return _freq // 100000 & 0xFFFF +#seekto 0x800; +struct { + struct vfo band_150; + struct vfo band_450; + struct vfo band_300; + struct vfo band_700; + struct vfo band_200; +} vfo_a; -def short2freq(freq): - """ - Convert a short frequency to a string for UI data entry/display - This is stored in the radio as units of 10KHz which we - compensate to Hz. - A value of -1 indicates , i.e. unused channel. - """ - if (int(freq) > 0): - f = chirp_common.format_freq(freq * 100000) - return f - else: - return "" +// There are two independent radios, aka areas (as described +// in the manual as the upper and lower portions of the display... +struct area_conf { + u8 w_mode; + u16 w_chan; // fix issue in 9D Plus - w_chan is 2bytes + u8 scan_grp; + u8 bcl; + u8 sql; + u8 cset; + u8 step; + u8 scan_mode; + u8 x869; + u8 scan_range; + u8 x86b; + u8 x86c; + u8 x86d; + u8 x86e; + u8 x86f; +}; -def tone2short(t): - """Convert a string tone or DCS to an encoded u16 - """ - tone = str(t) - if tone == "----": - u16tone = 0x0000 - elif tone[0] == 'D': # This is a DCS code - c = tone[1: -1] - code = int(c, 8) - if tone[-1] == 'I': - code |= 0x4000 - u16tone = code | 0x8000 - else: # This is an analog CTCSS - u16tone = int(tone[0:-2]+tone[-1]) & 0xffff # strip the '.' - return u16tone +#seekto 0x860; +struct area_conf a_conf; -def short2tone(tone): - """ Map a binary CTCSS/DCS to a string name for the tone - """ - if tone == 0 or tone == 0xffff: - ret = "----" - else: - code = tone & 0x3fff - if tone & 0x8000: # This is a DCS - if tone & 0x4000: # This is an inverse code - ret = "D%0.3oI" % code - else: - ret = "D%0.3oN" % code - else: # Just plain old analog CTCSS - ret = "%4.1f" % (code / 10.0) - return ret +#seekto 0x870; +struct area_conf b_conf; -def callid2str(cid): - """Caller ID per MDC-1200 spec? Must be 3-6 digits (100 - 999999). - One digit (binary) per byte, terminated with '0xc' - """ +#seekto 0x880; - bin2ascii = " 1234567890" - cidstr = "" - for i in range(0, 6): - b = cid[i].get_value() - if b == 0xc: # the cid EOL - break - if b == 0 or b > 0xa: - raise InvalidValueError( - "Caller ID code has illegal byte 0x%x" % b) - cidstr += bin2ascii[b] - return cidstr +struct { + u8 menu_avail; + u8 reset_avail; + u8 act_area; + u8 tdr; + u8 lang; + u8 x885; + u8 beep; + u8 auto_am; + u8 qt_sw; + u8 lock; + u8 x88a; + u8 pf1; + u8 pf2; + u8 pf3; + u8 s_mute; + u8 type_set; + u8 tot; + u8 toa; + u8 ptt_id; + u8 x893; + u8 id_dly; + u8 x895; + u8 voice_sw; + u8 s_tone; + u8 abr_lvl; + u8 ring_time; + u8 roger; + u8 x89b; + u8 abr; + u8 save_m; + u8 lock_m; + u8 auto_lk; + u8 rpt_ptt; + u8 rpt_spk; + u8 rpt_rct; + u8 prich_sw; + u16 pri_ch; + u8 x8a6; + u8 x8a7; + u8 dtmf_st; + u8 dtmf_tx; + u8 x8aa; + u8 sc_qt; + u8 apo_tmr; + u8 vox_grd; + u8 vox_dly; + u8 rpt_kpt; + struct { + u16 scan_st; + u16 scan_end; + } a; + struct { + u16 scan_st; + u16 scan_end; + } b; + u8 x8b8; + u8 x8b9; + u8 x8ba; + u8 ponmsg; + u8 blcdsw; + u8 bledsw; + u8 x8be; + u8 x8bf; + +} settings; + + +#seekto 0x8c0; +struct { + u8 code[6]; + char x8c6[10]; +} my_callid; + +#seekto 0x8d0; +struct { + u8 scc[6]; + char x8d6[10]; +} stun; + +#seekto 0x8e0; +struct { + u16 wake; + u16 sleep; +} save[4]; + +#seekto 0x8f0; +struct { + char banner[16]; +} display; + +#seekto 0x940; +struct { + struct { + i16 scan_st; + i16 scan_end; + } addrs[10]; + u8 x0968[8]; + struct { + char name[8]; + } names[10]; +} scn_grps; + +// this array of structs is marshalled via the R/WCHAN commands +#seekto 0xa00; +struct { + u32 rxfreq; + u32 txfreq; + u16 encQT; + u16 decQT; + u8 bit7_5:3, // all ones + qt:3, + bit1_0:2; + u8 bit7:1, + scan:1, + bit5:1, + pwr:2, + mod:1, + fm_dev:2; + u8 state; + u8 c3; +} chan_blk[999]; + +// nobody really sees this. It is marshalled with chan_blk +// in 4 entry chunks +#seekto 0x4900; + +// Tracks with the index of chan_blk[] +struct { + char name[8]; +} chan_name[999]; + +#seekto 0x7400; +struct { + u8 cid[6]; + u8 pad[2]; +}call_ids[20]; + +// This array tracks with the index of call_ids[] +struct { + char name[6]; + char pad[2]; +} cid_names[20]; + +#seekto 0x7000; +struct { + u8 ch_valid; +} chan_valid[999]; + +#seekto 0x7600; +struct { + u8 screen_mode; +} screen; +""" + + +# Support for the Wouxun KG-UV9D Plus and KG-UV9PX radio +# Serial coms are at 19200 baud +# The data is passed in variable length records +# Record structure: +# Offset Usage +# 0 start of record (\x7d) +# 1 Command (6 commands, see above) +# 2 direction (\xff PC-> Radio, \x00 Radio -> PC) +# 3 length of payload (excluding header/checksum) (n) +# 4 payload (n bytes) +# 4+n+1 checksum - byte sum (% 256) of bytes 1 -> 4+n +# +# Memory Read Records: +# the payload is 3 bytes, first 2 are offset (big endian), +# 3rd is number of bytes to read +# Memory Write Records: +# the maximum payload size (from the Wouxun software) +# seems to be 66 bytes (2 bytes location + 64 bytes data). + +def _pkt_encode(op, payload): + """Assemble a packet for the radio and encode it for transmission. + Yes indeed, the checksum we store is only 4 bits. Why? + I suspect it's a bug in the radio firmware guys didn't want to fix, + i.e. a typo 0xff -> 0xf...""" + + data = bytearray() + data.append(0x7d) # tag that marks the beginning of the packet + data.append(op) + data.append(0xff) # 0xff is from app to radio + # calc checksum from op to end + cksum = op + 0xff + if (payload): + data.append(len(payload)) + cksum += len(payload) + for byte in payload: + cksum += byte + data.append(byte) + else: + data.append(0x00) + # Yea, this is a 4 bit cksum (also known as a bug) + data.append(cksum & 0xf) + + # now obfuscate by an xor starting with first payload byte ^ 0x52 + # including the trailing cksum. + xorbits = 0x52 + for i, byte in enumerate(data[4:]): + xord = xorbits ^ byte + data[i + 4] = xord + xorbits = xord + return (data) + + +def _pkt_decode(data): + """Take a packet hot off the wire and decode it into clear text + and return the fields. We say <> here because all it + turns out to be is annoying obfuscation. + This is the inverse of pkt_decode""" + + # we don't care about data[0]. + # It is always 0x7d and not included in checksum + op = data[1] + direction = data[2] + bytecount = data[3] + + # First un-obfuscate the payload and cksum + payload = bytearray() + xorbits = 0x52 + for i, byte in enumerate(data[4:]): + payload.append(xorbits ^ byte) + xorbits = byte + + # Calculate the checksum starting with the 3 bytes of the header + cksum = op + direction + bytecount + for byte in payload[:-1]: + cksum += byte + # yes, a 4 bit cksum to match the encode + cksum_match = (cksum & 0xf) == payload[-1] + if (not cksum_match): + LOG.debug( + "Checksum mismatch: %x != %x; " % (cksum, payload[-1])) + return (cksum_match, op, payload[:-1]) + +# UI callbacks to process input for mapping UI fields to memory cells + + +def freq2int(val, min, max): + """Convert a frequency as a string to a u32. Units is Hz + """ + _freq = chirp_common.parse_freq(str(val)) + if _freq > max or _freq < min: + raise InvalidValueError("Frequency %s is not with in %s-%s" % + (chirp_common.format_freq(_freq), + chirp_common.format_freq(min), + chirp_common.format_freq(max))) + return _freq + + +def int2freq(freq): + """ + Convert a u32 frequency to a string for UI data entry/display + This is stored in the radio as units of 10 Hz which we compensate to Hz. + A value of -1 indicates , i.e. unused channel. + """ + if (int(freq) > 0): + f = chirp_common.format_freq(freq) + return f + else: + return "" + + +def freq2short(val, min, max): + """Convert a frequency as a string to a u16 which is units of 10 kHz + """ + _freq = chirp_common.parse_freq(str(val)) + if _freq > max or _freq < min: + raise InvalidValueError("Frequency %s is not with in %s-%s" % + (chirp_common.format_freq(_freq), + chirp_common.format_freq(min), + chirp_common.format_freq(max))) + return _freq // 100000 & 0xFFFF + + +def short2freq(freq): + """ + Convert a short frequency to a string for UI data entry/display + This is stored in the radio as units of 10 kHz which we + compensate to Hz. + A value of -1 indicates , i.e. unused channel. + """ + if (int(freq) > 0): + f = chirp_common.format_freq(freq * 100000) + return f + else: + return "" + + +def tone2short(t): + """Convert a string tone or DCS to an encoded u16 + """ + tone = str(t) + if tone == "----": + u16tone = 0x0000 + elif tone[0] == 'D': # This is a DCS code + c = tone[1: -1] + code = int(c, 8) + if tone[-1] == 'I': + code |= 0x4000 + u16tone = code | 0x8000 + else: # This is an analog CTCSS + u16tone = int(tone[0:-2]+tone[-1]) & 0xffff # strip the '.' + return u16tone + + +def short2tone(tone): + """ Map a binary CTCSS/DCS to a string name for the tone + """ + if tone == 0 or tone == 0xffff: + ret = "----" + else: + code = tone & 0x3fff + if tone & 0x8000: # This is a DCS + if tone & 0x4000: # This is an inverse code + ret = "D%0.3oI" % code + else: + ret = "D%0.3oN" % code + else: # Just plain old analog CTCSS + ret = "%4.1f" % (code / 10.0) + return ret def str2callid(val): @@ -594,7 +912,7 @@ def str2name(val, size=6, fillchar='\0', emptyfill='\0'): """ Convert a string to a name. A name is a 6 element bytearray with ascii chars. """ - val = str(val).rstrip(' \t\r\n\0\0xff') + val = str(val).rstrip(' \t\r\n\0\xff') if len(val) == 0: name = "".ljust(size, emptyfill) else: @@ -656,7 +974,7 @@ def _hex_print(data, addrfmt=None): block_size = 16 - lines = (len(data) / block_size) + lines = (len(data) // block_size) if (len(data) % block_size > 0): lines += 1 @@ -702,25 +1020,38 @@ def _hex_print(data, addrfmt=None): # Useful UI lists STEPS = [2.5, 5.0, 6.25, 10.0, 12.5, 25.0, 50.0, 100.0] +STEPS_9K = [2.5, 5.0, 6.25, 8.33, 10.0, 12.5, 25.0, 50.0, 100.0] S_TONES = [str(x) for x in [1000, 1450, 1750, 2100]] STEP_LIST = [str(x)+"kHz" for x in STEPS] +STEP_LIST_9K = [str(x)+"kHz" for x in STEPS_9K] ROGER_LIST = ["Off", "Begin", "End", "Both"] TIMEOUT_LIST = [str(x) + "s" for x in range(15, 601, 15)] -TOA_LIST = ["Off"] + ["%ds" % t for t in range(1, 10)] +TOA_LIST = ["Off"] + ["%ds" % t for t in range(1, 11)] BANDWIDTH_LIST = ["Wide", "Narrow"] LANGUAGE_LIST = ["English", "Chinese"] +LANGUAGE_LIST2 = ["English", "Chinese-DISABLED"] PF1KEY_LIST = ["OFF", "call id", "r-alarm", "SOS", "SF-TX"] -PF2KEY_LIST = ["OFF", "Scan", "Second", "lamp", "SDF-DIR", "K-lamp"] +PF1KEY_LIST9GX = ["OFF", "call id", "r-alarm", "SOS", "SF-TX", "Scan", + "Second", "Lamp"] +PF2KEY_LIST = ["OFF", "Scan", "Second", "Lamp", "SDF-DIR", "K-lamp"] +PF2KEY_LIST9GX = ["OFF", "Scan", "Second", "Lamp", "K-lamp"] +PF3KEY_LIST2 = ["OFF", "Call ID", "R-ALARM", "SOS", "SF-TX", "Scan", + "Second", "Lamp"] +PF3KEY_LIST9GX = ["OFF", "call id", "r-alarm", "SOS", "SF-TX", "Scan", + "Second", "Lamp"] PF3KEY_LIST = ["OFF", "Call ID", "R-ALARM", "SOS", "SF-TX"] WORKMODE_LIST = ["VFO freq", "Channel No.", "Ch. No.+Freq.", "Ch. No.+Name"] BACKLIGHT_LIST = ["Off"] + ["%sS" % t for t in range(1, 31)] + \ ["Always On"] +BACKLIGHT_BRIGHT_MIN = 1 +BACKLIGHT_BRIGHT_MAX = 5 SAVE_MODES = ["Off", "1", "2", "3", "4"] LOCK_MODES = ["key-lk", "key+pg", "key+ptt", "all"] APO_TIMES = ["Off"] + ["%dm" % t for t in range(15, 151, 15)] OFFSET_LIST = ["none", "+", "-"] PONMSG_LIST = ["Battery Volts", "Bitmap"] +PONMSG_LIST2 = ["Battery Volts", "Bitmap-DISABLED"] SPMUTE_LIST = ["QT", "QT*T", "QT&T"] DTMFST_LIST = ["Off", "DT-ST", "ANI-ST", "DT-ANI"] DTMF_TIMES = ["%d" % x for x in range(80, 501, 20)] @@ -729,6 +1060,7 @@ ID_DLY_LIST = ["%dms" % t for t in range(100, 3001, 100)] VOX_GRDS = ["Off"] + ["%dlevel" % l for l in range(1, 11)] VOX_DLYS = ["Off"] + ["%ds" % t for t in range(1, 5)] RPT_KPTS = ["Off"] + ["%dms" % t for t in range(100, 5001, 100)] +ABR_LVL_MAP = [("1", 1), ("2", 2), ("3", 3), ("4", 4), ("5", 5)] LIST_1_5 = ["%s" % x for x in range(1, 6)] LIST_0_9 = ["%s" % x for x in range(0, 10)] LIST_1_20 = ["%s" % x for x in range(1, 21)] @@ -739,11 +1071,14 @@ SCANRANGE_LIST = ["Current band", "freq range", "ALL"] SCQT_LIST = ["Decoder", "Encoder", "Both"] S_MUTE_LIST = ["off", "rx mute", "tx mute", "r/t mute"] POWER_LIST = ["Low", "Med", "High"] -RPTMODE_LIST = ["Radio", "One direction Repeater", +RPTMODE_LIST = ["Radio/Talkie", "One direction Repeater", "Two direction repeater"] TONE_LIST = ["----"] + ["%s" % str(t) for t in chirp_common.TONES] + \ ["D%0.3dN" % dts for dts in chirp_common.DTCS_CODES] + \ ["D%0.3dI" % dts for dts in chirp_common.DTCS_CODES] +SCREEN_MODE_LIST = ["Classic", "Covert", "Day_1", "Day_2"] +ACTIVE_AREA_LIST = ["Receiver A - Top", "Receiver B - Bottom"] +TDR_LIST = ["TDR ON", "TDR OFF"] @directory.register @@ -753,13 +1088,16 @@ class KGUV9DPlusRadio(chirp_common.CloneModeRadio, """Wouxun KG-UV9D Plus""" VENDOR = "Wouxun" MODEL = "KG-UV9D Plus" - _model = "KG-UV9D" - _rev = "00" # default rev for the radio I know about... + _model = b"KG-UV9D" + _rev = b"00" # default rev for the radio I know about... _file_ident = b"kg-uv9d" + NEEDS_COMPAT_SERIAL = False BAUD_RATE = 19200 POWER_LEVELS = [chirp_common.PowerLevel("L", watts=1), chirp_common.PowerLevel("M", watts=2), chirp_common.PowerLevel("H", watts=5)] + _step_list = STEP_LIST + _valid_steps = STEPS _mmap = "" def _read_record(self): @@ -824,7 +1162,7 @@ class KGUV9DPlusRadio(chirp_common.CloneModeRadio, seen differences between my radio and the dump named KG-UV9D-Plus-OutOfBox-Read.txt from bug #3509. The first five bands match the OEM windows - app except the 350-400 band. The OOB trace has the 700MHz + app except the 350-400 band. The OOB trace has the 700 MHz band different. This is speculation at this point. TODO: This could be smarter and reject a radio not actually @@ -859,12 +1197,11 @@ class KGUV9DPlusRadio(chirp_common.CloneModeRadio, raise Exception("All retries to identify failed") def process_mmap(self): - if self._rev == "02" or self._rev == "00": - self._memobj = bitwise.parse(_MEM_FORMAT02, self._mmap) - else: # this is where you elif the other variants and non-Plus radios - raise errors.RadioError( - "Unrecognized model variation (%s). No memory map for it" % - self._rev) + if self._rev != b"02" and self._rev != b"00": + # new revision found - log it and assume same map and proceed + LOG.debug("Unrecognized model variation (%s) Using default Map" % + self._rev) + self._memobj = bitwise.parse(_MEM_FORMAT02, self._mmap) def sync_in(self): """ Public sync_in @@ -939,7 +1276,9 @@ class KGUV9DPlusRadio(chirp_common.CloneModeRadio, (addr, op, pkt_addr)) LOG.debug("Config read (0x%x):\n%s" % (addr, _hex_print(resp, '0x%(addr)04x'))) - for i in range(0, len(payload) - 1): + # Orig Code from 9D Plus driver was len(Payload)-1: + # This Caused every 64th byte to = 00 + for i in range(0, len(payload)): mem[addr + i] = payload[i] if self.status_fn: status = chirp_common.Status() @@ -947,8 +1286,7 @@ class KGUV9DPlusRadio(chirp_common.CloneModeRadio, status.max = 0x8000 status.msg = "Cloning from radio" self.status_fn(status) - strmem = "".join([chr(x) for x in mem]) - return memmap.MemoryMap(strmem) + return memmap.MemoryMapBytes(bytes(mem)) def _do_upload(self): """Walk through the config map and write updated records to @@ -958,10 +1296,16 @@ class KGUV9DPlusRadio(chirp_common.CloneModeRadio, 3 channel memory and names slots. As we discover other useful goodies in the map, we can add more slots... """ - for ar, size, count in config_map: - for addr in range(ar, ar + (size*count), size): + if (self.MODEL == "KG-UV9PX" or self.MODEL == "KG-UV9GX"): + cfgmap = config_map2 + else: + cfgmap = config_map + + for start, blocksize, count in cfgmap: + end = start + (blocksize * count) + for addr in range(start, end, blocksize): req = bytearray(struct.pack(">H", addr)) - req.extend(self.get_mmap()[addr:addr + size]) + req.extend(self.get_mmap()[addr:addr + blocksize]) self._write_record(CMD_WCONF, req) LOG.debug("Config write (0x%x):\n%s" % (addr, _hex_print(req))) @@ -984,7 +1328,7 @@ class KGUV9DPlusRadio(chirp_common.CloneModeRadio, status = chirp_common.Status() status.cur = addr status.max = 0x8000 - status.msg = "Update radio" + status.msg = "Cloning to radio" self.status_fn(status) def get_features(self): @@ -1022,7 +1366,7 @@ class KGUV9DPlusRadio(chirp_common.CloneModeRadio, (400000000, 520000000), # supports 70cm (700000000, 985000000)] rf.valid_characters = chirp_common.CHARSET_ASCII - rf.valid_tuning_steps = STEPS + rf.valid_tuning_steps = self._valid_steps rf.memory_bounds = (1, 999) # 999 memories return rf @@ -1035,7 +1379,7 @@ class KGUV9DPlusRadio(chirp_common.CloneModeRadio, return rp def get_raw_memory(self, number): - return repr(self._memobj.chan_blk[number]) + return repr(self._memobj.chan_blk[number - 1]) def _get_tone(self, _mem, mem): """Decode both the encode and decode CTSS/DCS codes from @@ -1092,17 +1436,57 @@ class KGUV9DPlusRadio(chirp_common.CloneModeRadio, """ _mem = self._memobj.chan_blk[number - 1] _nam = self._memobj.chan_name[number - 1] + _val = self._memobj.chan_valid[number - 1] mem = chirp_common.Memory() mem.number = number _valid = _mem.state - if _valid != MEM_VALID and _valid != 0 and _valid != 2: - # In Issue #6995 we can find _valid values of 0 and 2 in the IMG - # so these values should be treated like MEM_VALID. + + # This code attempts to robustly decipher what Wouxun considers valid + # memory locations on the 9 series radios and the factory CPS. + # It appears they use a combination of State and Rx Freq to determine + # validity rather than just the State value. + # It is possible the State value is not even used at all. + # Rather than continuously adding new Mem Valid values as they are + # found, assume any value other than 0xFF is likely valid and use + # Rx Freq to further assess validity + + if _mem.rxfreq == 0xFFFFFFFF: + # Rx freq indicates empty channel memory + # assume empty regardless of _valid and proceed to next channel + if _valid not in INVALID_MEM_VALUES: + # only log if _valid indicates the channel is not invalid + LOG.debug("CH %s Rx Freq = 0xFFFFFFFF - " + "Treating chan as empty", mem.number) mem.empty = True + _val.ch_valid = CHAN_INVALID return mem - else: - mem.empty = False + elif _valid in INVALID_MEM_VALUES: + # Check for 9PX case where CPS creates a valid channel with + # 0xFF for State - accept it as valid as long as Rx Freq is + # <= max value + if _mem.rxfreq > 99999999: # Max poss Value = 999.99999 MHz + LOG.debug("CH %s State invalid - Rx Frq > 999.99999 MHz: " + "Treating chan as empty", mem.number) + mem.empty = True + _val.ch_valid = CHAN_INVALID + return mem + else: + LOG.debug("CH %s State invalid - Rx Freq valid: " + "Assume chan valid", mem.number) + mem.empty = False + _val.ch_valid = CHAN_VALID + else: # State not Invalid and Rx Freq not 0xFFFFFFFF + if _mem.rxfreq > 99999999: # Max poss Value = 999.99999 MHz + LOG.debug("CH %s Invalid Rx Frq: %s MHz - " + "Treating chan as empty", mem.number, + int(_mem.rxfreq) / 100000) + mem.empty = True + _val.ch_valid = CHAN_INVALID + return mem + else: + _val.ch_valid = CHAN_VALID + mem.empty = False mem.freq = int(_mem.rxfreq) * 10 @@ -1185,11 +1569,24 @@ class KGUV9DPlusRadio(chirp_common.CloneModeRadio, _mem = self._memobj.chan_blk[number - 1] _nam = self._memobj.chan_name[number - 1] + _val = self._memobj.chan_valid[number - 1] if mem.empty: + # consider putting in a check for chan # that is empty but + # listed as one of the 2 working channels and change them + # to channel 1 to be consistent with CPS and allow + # complete deletion from radio. Otherwise, + # a deleted channel will still show on radio with no name. + # MRT implement the above working channel check + if self._memobj.a_conf.w_chan == number: + self._memobj.a_conf.w_chan = 1 + if self._memobj.b_conf.w_chan == number: + self._memobj.b_conf.w_chan = 1 + _mem.set_raw("\xFF" * (_mem.size() // 8)) _nam.name = str2name("", 8, '\0', '\0') _mem.state = MEM_INVALID + _val.ch_valid = CHAN_INVALID return _mem.rxfreq = int(mem.freq / 10) @@ -1226,9 +1623,10 @@ class KGUV9DPlusRadio(chirp_common.CloneModeRadio, # Set fields we can't access via the UI table to safe defaults _mem.qt = 0 # mute mode to QT - + _mem.bit5 = 0 # clear this bit to ensure accurate CPS power level _nam.name = str2name(mem.name, 8, '\0', '\0') _mem.state = MEM_VALID + _val.ch_valid = CHAN_VALID # Build the UI configuration tabs # the channel memory tab is built by the core. @@ -1239,130 +1637,151 @@ class KGUV9DPlusRadio(chirp_common.CloneModeRadio, Radio settings common to all modes and areas go here. """ s = self._memobj.settings + if (self.MODEL == "KG-UV9PX" or self.MODEL == "KG-UV9GX"): + + sm = self._memobj.screen cf = RadioSettingGroup("cfg_grp", "Configuration") cf.append(RadioSetting("auto_am", - "Auto detect AM(53)", + "Auto detect AM (Menu 53)", RadioSettingValueBoolean(s.auto_am))) cf.append(RadioSetting("qt_sw", - "Scan tone detect(59)", + "Scan tone detect (Menu 59)", RadioSettingValueBoolean(s.qt_sw))) cf.append( RadioSetting("s_mute", - "SubFreq Mute(60)", + "SubFreq Mute (Menu 60)", RadioSettingValueList(S_MUTE_LIST, S_MUTE_LIST[s.s_mute]))) cf.append( RadioSetting("tot", - "Transmit timeout Timer(10)", + "Transmit timeout Timer (Menu 10)", RadioSettingValueList(TIMEOUT_LIST, TIMEOUT_LIST[s.tot]))) cf.append( RadioSetting("toa", - "Transmit Timeout Alarm(11)", + "Transmit Timeout Alarm (Menu 11)", RadioSettingValueList(TOA_LIST, TOA_LIST[s.toa]))) cf.append( RadioSetting("ptt_id", - "PTT Caller ID mode(23)", + "PTT Caller ID mode (Menu 23)", RadioSettingValueList(PTTID_LIST, PTTID_LIST[s.ptt_id]))) cf.append( RadioSetting("id_dly", - "Caller ID Delay time(25)", + "Caller ID Delay time (Menu 25)", RadioSettingValueList(ID_DLY_LIST, ID_DLY_LIST[s.id_dly]))) cf.append(RadioSetting("voice_sw", - "Voice Guide(12)", + "Voice Guide (Menu 12)", RadioSettingValueBoolean(s.voice_sw))) cf.append(RadioSetting("beep", - "Keypad Beep(13)", + "Keypad Beep (Menu 13)", RadioSettingValueBoolean(s.beep))) cf.append( RadioSetting("s_tone", - "Side Tone(36)", + "Side Tone (Menu 36)", RadioSettingValueList(S_TONES, S_TONES[s.s_tone]))) cf.append( RadioSetting("ring_time", - "Ring Time(26)", + "Ring Time (Menu 26)", RadioSettingValueList( LIST_OFF_10, LIST_OFF_10[s.ring_time]))) cf.append( RadioSetting("roger", - "Roger Beep(9)", + "Roger Beep (Menu 9)", RadioSettingValueList(ROGER_LIST, ROGER_LIST[s.roger]))) cf.append(RadioSetting("blcdsw", - "Backlight(41)", + "Backlight (Menu 41)", RadioSettingValueBoolean(s.blcdsw))) cf.append( RadioSetting("abr", - "Auto Backlight Time(1)", + "Auto Backlight Time (Menu 1)", RadioSettingValueList(BACKLIGHT_LIST, BACKLIGHT_LIST[s.abr]))) cf.append( RadioSetting("abr_lvl", - "Backlight Brightness(27)", - RadioSettingValueList(LIST_1_5, - LIST_1_5[s.abr_lvl]))) + "Backlight Brightness (Menu 27)", + RadioSettingValueInteger(BACKLIGHT_BRIGHT_MIN, + BACKLIGHT_BRIGHT_MAX, + s.abr_lvl))) cf.append(RadioSetting("lock", "Keypad Lock", RadioSettingValueBoolean(s.lock))) cf.append( RadioSetting("lock_m", - "Keypad Lock Mode(35)", + "Keypad Lock Mode (Menu 35)", RadioSettingValueList(LOCK_MODES, LOCK_MODES[s.lock_m]))) cf.append(RadioSetting("auto_lk", - "Keypad Autolock(34)", + "Keypad Autolock (Menu 34)", RadioSettingValueBoolean(s.auto_lk))) cf.append(RadioSetting("prich_sw", - "Priority Channel Scan(33)", + "Priority Channel Scan (Menu 33)", RadioSettingValueBoolean(s.prich_sw))) cf.append(RadioSetting("pri_ch", - "Priority Channel(32)", + "Priority Channel (Menu 32)", RadioSettingValueInteger(1, 999, s.pri_ch))) cf.append( RadioSetting("dtmf_st", - "DTMF Sidetone(22)", + "DTMF Sidetone (Menu 22)", RadioSettingValueList(DTMFST_LIST, DTMFST_LIST[s.dtmf_st]))) cf.append(RadioSetting("sc_qt", - "Scan QT Save Mode(38)", + "Scan QT Save Mode (Menu 38)", RadioSettingValueList( SCQT_LIST, SCQT_LIST[s.sc_qt]))) cf.append( RadioSetting("apo_tmr", - "Automatic Power-off(39)", + "Automatic Power-off (Menu 39)", RadioSettingValueList(APO_TIMES, APO_TIMES[s.apo_tmr]))) cf.append( # VOX "guard" is really VOX trigger audio level RadioSetting("vox_grd", - "VOX level(7)", + "VOX level (Menu 7)", RadioSettingValueList(VOX_GRDS, VOX_GRDS[s.vox_grd]))) cf.append( RadioSetting("vox_dly", - "VOX Delay(37)", + "VOX Delay (Menu 37)", RadioSettingValueList(VOX_DLYS, VOX_DLYS[s.vox_dly]))) + cf.append(RadioSetting("bledsw", + "Receive LED (Menu 42)", + RadioSettingValueBoolean(s.bledsw))) + + if (self.MODEL == "KG-UV9PX" or self.MODEL == "KG-UV9GX"): + cf.append(RadioSetting("screen.screen_mode", + "Screen Mode (Menu 62)", + RadioSettingValueList( + SCREEN_MODE_LIST, + SCREEN_MODE_LIST[ + sm.screen_mode]))) + if (self.MODEL == "KG-UV9PX" or self.MODEL == "KG-UV9GX"): + langlst = LANGUAGE_LIST2 + else: + langlst = LANGUAGE_LIST cf.append( RadioSetting("lang", - "Menu Language(14)", - RadioSettingValueList(LANGUAGE_LIST, - LANGUAGE_LIST[s.lang]))) + "Menu Language (Menu 14)", + RadioSettingValueList(langlst, + langlst[s.lang]))) + + if (self.MODEL == "KG-UV9PX" or self.MODEL == "KG-UV9GX"): + ponmsglst = PONMSG_LIST2 + else: + ponmsglst = PONMSG_LIST cf.append(RadioSetting("ponmsg", - "Poweron message(40)", + "Poweron message (Menu 40)", RadioSettingValueList( - PONMSG_LIST, PONMSG_LIST[s.ponmsg]))) - cf.append(RadioSetting("bledsw", - "Receive LED(42)", - RadioSettingValueBoolean(s.bledsw))) + ponmsglst, ponmsglst[s.ponmsg]))) return cf def _repeater_tab(self): @@ -1373,315 +1792,789 @@ class KGUV9DPlusRadio(chirp_common.CloneModeRadio, cf.append( RadioSetting("type_set", - "Radio Mode(43)", + "Radio Mode (Menu 43)", RadioSettingValueList( RPTMODE_LIST, RPTMODE_LIST[s.type_set]))) cf.append(RadioSetting("rpt_ptt", - "Repeater PTT(45)", + "Repeater PTT (Menu 45)", RadioSettingValueBoolean(s.rpt_ptt))) cf.append(RadioSetting("rpt_spk", - "Repeater Mode Speaker(44)", + "Repeater Mode Speaker (Menu 44)", RadioSettingValueBoolean(s.rpt_spk))) cf.append( RadioSetting("rpt_kpt", - "Repeater Hold Time(46)", + "Repeater Hold Time (Menu 46)", RadioSettingValueList(RPT_KPTS, RPT_KPTS[s.rpt_kpt]))) cf.append(RadioSetting("rpt_rct", - "Repeater Receipt Tone(47)", + "Repeater Receipt Tone (Menu 47)", RadioSettingValueBoolean(s.rpt_rct))) return cf - def _admin_tab(self): - """Admin functions not present in radio menu... - These are admin functions not radio operation configuration + def _admin_tab(self): + """Admin functions not present in radio menu... + These are admin functions not radio operation configuration + """ + + def apply_cid(setting, obj): + c = str2callid(setting.value) + obj.code = c + + def apply_scc(setting, obj): + c = str2digits(setting.value) + obj.scc = c + + def apply_mode_sw(setting, obj): + pw = str2pw(setting.value) + obj.mode_sw = pw + setting.value = pw2str(obj.mode_sw) + + def apply_reset(setting, obj): + pw = str2pw(setting.value) + obj.reset = pw + setting.value = pw2str(obj.reset) + + def apply_wake(setting, obj): + obj.wake = int(setting.value)/10 + + def apply_sleep(setting, obj): + obj.sleep = int(setting.value)/10 + + pw = self._memobj.passwords # admin passwords + s = self._memobj.settings + + cf = RadioSettingGroup("admin", "Admin Functions") + + cf.append(RadioSetting("menu_avail", + "Menu available in channel mode", + RadioSettingValueBoolean(s.menu_avail))) + mode_sw = RadioSettingValueString(0, 6, + pw2str(pw.mode_sw), False) + rs = RadioSetting("passwords.mode_sw", + "Mode Switch Password", mode_sw) + rs.set_apply_callback(apply_mode_sw, pw) + cf.append(rs) + + cf.append(RadioSetting("reset_avail", + "Radio Reset Available", + RadioSettingValueBoolean(s.reset_avail))) + reset = RadioSettingValueString(0, 6, pw2str(pw.reset), False) + rs = RadioSetting("passwords.reset", + "Radio Reset Password", reset) + rs.set_apply_callback(apply_reset, pw) + cf.append(rs) + + cf.append( + RadioSetting("dtmf_tx", + "DTMF Tx Duration", + RadioSettingValueList(DTMF_TIMES, + DTMF_TIMES[s.dtmf_tx]))) + cid = self._memobj.my_callid + my_callid = RadioSettingValueString(3, 6, + self.callid2str(cid.code), False) + rs = RadioSetting("my_callid.code", + "PTT Caller ID code (Menu 24)", my_callid) + rs.set_apply_callback(apply_cid, cid) + cf.append(rs) + + stun = self._memobj.stun + st = RadioSettingValueString(0, 6, digits2str(stun.scc), False) + rs = RadioSetting("stun.scc", "Security code", st) + rs.set_apply_callback(apply_scc, stun) + cf.append(rs) + + cf.append( + RadioSetting("settings.save_m", + "Save Mode (Menu 2)", + RadioSettingValueList(SAVE_MODES, + SAVE_MODES[s.save_m]))) + for i in range(0, 4): + sm = self._memobj.save[i] + wake = RadioSettingValueInteger(0, 18000, sm.wake * 10, 1) + wf = RadioSetting("save[%i].wake" % i, + "Save Mode %d Wake Time" % (i+1), wake) + wf.set_apply_callback(apply_wake, sm) + cf.append(wf) + + slp = RadioSettingValueInteger(0, 18000, sm.sleep * 10, 1) + wf = RadioSetting("save[%i].sleep" % i, + "Save Mode %d Sleep Time" % (i+1), slp) + wf.set_apply_callback(apply_sleep, sm) + cf.append(wf) + + _msg = str(self._memobj.display.banner).split("\0")[0] + val = RadioSettingValueString(0, 16, _msg) + val.set_mutable(True) + cf.append(RadioSetting("display.banner", + "Display Message", val)) + + if (self.MODEL == "KG-UV9PX" or self.MODEL == "KG-UV9GX"): + _str = str(self._memobj.oemmodel.model).split("\0")[0] + val = RadioSettingValueString(0, 10, _str) + val.set_mutable(True) + cf.append(RadioSetting("oemmodel.model", + "Custom Sub-Receiver Message", val)) + + val = RadioSettingValueList( + TDR_LIST, + TDR_LIST[s.tdr]) + val.set_mutable(True) + cf.append(RadioSetting("tdr", "TDR", val)) + + val = RadioSettingValueList( + ACTIVE_AREA_LIST, + ACTIVE_AREA_LIST[s.act_area]) + val.set_mutable(True) + cf.append(RadioSetting("act_area", "Active Receiver(BAND)", val)) + + return cf + + def _fm_tab(self): + """FM Broadcast channels + """ + def apply_fm(setting, obj): + f = freq2short(setting.value, 76000000, 108000000) + obj.fm_freq = f + + fm = RadioSettingGroup("fm_chans", "FM Broadcast") + for ch in range(0, 20): + chan = self._memobj.fm_chans[ch] + freq = RadioSettingValueString(0, 20, + short2freq(chan.fm_freq)) + rs = RadioSetting("fm_%d" % (ch + 1), + "FM Channel %d" % (ch + 1), freq) + rs.set_apply_callback(apply_fm, chan) + fm.append(rs) + return fm + + def _scan_grp(self): + """Scan groups + """ + def apply_name(setting, obj): + name = str2name(setting.value, 8, '\0', '\0') + obj.name = name + + def apply_start(setting, obj): + """Do a callback to deal with RadioSettingInteger limitation + on memory address resolution + """ + obj.scan_st = int(setting.value) + + def apply_end(setting, obj): + """Do a callback to deal with RadioSettingInteger limitation + on memory address resolution + """ + obj.scan_end = int(setting.value) + + sgrp = self._memobj.scn_grps + scan = RadioSettingGroup("scn_grps", "Channel Scanner Groups") + for i in range(0, 10): + s_grp = sgrp.addrs[i] + s_name = sgrp.names[i] + rs_name = RadioSettingValueString(0, 8, + name2str(s_name.name)) + rs = RadioSetting("scn_grps.names[%i].name" % i, + "Group %i Name" % (i + 1), rs_name) + rs.set_apply_callback(apply_name, s_name) + scan.append(rs) + rs_st = RadioSettingValueInteger(1, 999, s_grp.scan_st) + rs = RadioSetting("scn_grps.addrs[%i].scan_st" % i, + "Starting Channel", rs_st) + rs.set_apply_callback(apply_start, s_grp) + scan.append(rs) + rs_end = RadioSettingValueInteger(1, 999, s_grp.scan_end) + rs = RadioSetting("scn_grps.addrs[%i].scan_end" % i, + "Last Channel", rs_end) + rs.set_apply_callback(apply_end, s_grp) + scan.append(rs) + return scan + + def _callid_grp(self): + """Caller IDs to be recognized by radio + This really should be a table in the UI + """ + def apply_callid(setting, obj): + c = str2callid(setting.value) + obj.cid = c + + def apply_name(setting, obj): + name = str2name(setting.value, 6, '\0', '\xff') + obj.name = name + + cid = RadioSettingGroup("callids", "Caller IDs") + for i in range(0, 20): + callid = self._memobj.call_ids[i] + name = self._memobj.cid_names[i] + c_name = RadioSettingValueString(0, 6, name2str(name.name)) + rs = RadioSetting("cid_names[%i].name" % i, + "Caller ID %i Name" % (i + 1), c_name) + rs.set_apply_callback(apply_name, name) + cid.append(rs) + c_id = RadioSettingValueString(0, 6, + self.callid2str(callid.cid), + False) + rs = RadioSetting("call_ids[%i].cid" % i, + "Caller ID Code", c_id) + rs.set_apply_callback(apply_callid, callid) + cid.append(rs) + return cid + + def _band_tab(self, area, band): + """ Build a band tab inside a VFO/Area """ + def apply_freq(setting, lo, hi, obj): + f = freq2int(setting.value, lo, hi) + obj.freq = f/10 - def apply_cid(setting, obj): - c = str2callid(setting.value) - obj.code = c + def apply_offset(setting, obj): + f = freq2int(setting.value, 0, 5000000) + obj.offset = f/10 - def apply_scc(setting, obj): - c = str2digits(setting.value) - obj.scc = c + def apply_enc(setting, obj): + t = tone2short(setting.value) + obj.encqt = t - def apply_mode_sw(setting, obj): - pw = str2pw(setting.value) - obj.mode_sw = pw - setting.value = pw2str(obj.mode_sw) + def apply_dec(setting, obj): + t = tone2short(setting.value) + obj.decqt = t - def apply_reset(setting, obj): - pw = str2pw(setting.value) - obj.reset = pw - setting.value = pw2str(obj.reset) + if area == "a": + if band == 150: + c = self._memobj.vfo_a.band_150 + lo = 108000000 + hi = 180000000 + elif band == 200: + c = self._memobj.vfo_a.band_200 + lo = 230000000 + hi = 250000000 + elif band == 300: + c = self._memobj.vfo_a.band_300 + lo = 350000000 + hi = 400000000 + elif band == 450: + c = self._memobj.vfo_a.band_450 + lo = 400000000 + hi = 512000000 + else: # 700 + c = self._memobj.vfo_a.band_700 + lo = 700000000 + hi = 985000000 + else: # area 'b' + if band == 150: + c = self._memobj.vfo_b.band_150 + lo = 136000000 + hi = 180000000 + else: # 450 + c = self._memobj.vfo_b.band_450 + lo = 400000000 + hi = 512000000 - def apply_wake(setting, obj): - obj.wake = int(setting.value)/10 + prefix = "vfo_%s.band_%d" % (area, band) + bf = RadioSettingGroup(prefix, "%d MHz Band" % band) + freq = RadioSettingValueString(0, 15, int2freq(c.freq * 10)) + rs = RadioSetting(prefix + ".freq", "Rx Frequency", freq) + rs.set_apply_callback(apply_freq, lo, hi, c) + bf.append(rs) - def apply_sleep(setting, obj): - obj.sleep = int(setting.value)/10 + off = RadioSettingValueString(0, 15, int2freq(c.offset * 10)) + rs = RadioSetting(prefix + ".offset", "Tx Offset (Menu 28)", off) + rs.set_apply_callback(apply_offset, c) + bf.append(rs) - pw = self._memobj.passwords # admin passwords - s = self._memobj.settings + rs = RadioSetting(prefix + ".encqt", + "Encode QT (Menu 17,19)", + RadioSettingValueList(TONE_LIST, + short2tone(c.encqt))) + rs.set_apply_callback(apply_enc, c) + bf.append(rs) - cf = RadioSettingGroup("admin", "Admin Functions") + rs = RadioSetting(prefix + ".decqt", + "Decode QT (Menu 16,18)", + RadioSettingValueList(TONE_LIST, + short2tone(c.decqt))) + rs.set_apply_callback(apply_dec, c) + bf.append(rs) - cf.append(RadioSetting("menu_avail", - "Menu available in channel mode", - RadioSettingValueBoolean(s.menu_avail))) - mode_sw = RadioSettingValueString(0, 6, - pw2str(pw.mode_sw), False) - rs = RadioSetting("passwords.mode_sw", - "Mode Switch Password", mode_sw) - rs.set_apply_callback(apply_mode_sw, pw) - cf.append(rs) + bf.append(RadioSetting(prefix + ".qt", + "Mute Mode (Menu 21)", + RadioSettingValueList(SPMUTE_LIST, + SPMUTE_LIST[c.qt]))) + bf.append(RadioSetting(prefix + ".scan", + "Scan this (Menu 48)", + RadioSettingValueBoolean(c.scan))) + bf.append(RadioSetting(prefix + ".pwr", + "Power (Menu 5)", + RadioSettingValueList( + POWER_LIST, POWER_LIST[c.pwr]))) + bf.append(RadioSetting(prefix + ".mod", + "AM Modulation (Menu 54)", + RadioSettingValueBoolean(c.mod))) + bf.append(RadioSetting(prefix + ".fm_dev", + "FM Deviation (Menu 4)", + RadioSettingValueList( + BANDWIDTH_LIST, + BANDWIDTH_LIST[c.fm_dev]))) + bf.append( + RadioSetting(prefix + ".shift", + "Frequency Shift (Menu 6)", + RadioSettingValueList(OFFSET_LIST, + OFFSET_LIST[c.shift]))) + return bf - cf.append(RadioSetting("reset_avail", - "Radio Reset Available", - RadioSettingValueBoolean(s.reset_avail))) - reset = RadioSettingValueString(0, 6, pw2str(pw.reset), False) - rs = RadioSetting("passwords.reset", - "Radio Reset Password", reset) - rs.set_apply_callback(apply_reset, pw) - cf.append(rs) + def _area_tab(self, area): + """Build a VFO tab + """ + def apply_scan_st(setting, scan_lo, scan_hi, obj): + f = freq2short(setting.value, scan_lo, scan_hi) + obj.scan_st = f - cf.append( - RadioSetting("dtmf_tx", - "DTMF Tx Duration", - RadioSettingValueList(DTMF_TIMES, - DTMF_TIMES[s.dtmf_tx]))) - cid = self._memobj.my_callid - my_callid = RadioSettingValueString(3, 6, - callid2str(cid.code), False) - rs = RadioSetting("my_callid.code", - "PTT Caller ID code(24)", my_callid) - rs.set_apply_callback(apply_cid, cid) - cf.append(rs) + def apply_scan_end(setting, scan_lo, scan_hi, obj): + f = freq2short(setting.value, scan_lo, scan_hi) + obj.scan_end = f - stun = self._memobj.stun - st = RadioSettingValueString(0, 6, digits2str(stun.scc), False) - rs = RadioSetting("stun.scc", "Security code", st) - rs.set_apply_callback(apply_scc, stun) - cf.append(rs) + if area == "a": + desc = "Area A Settings" + c = self._memobj.a_conf + scan_lo = 108000000 + scan_hi = 985000000 + scan_rng = self._memobj.settings.a + band_list = (150, 200, 300, 450, 700) + else: + desc = "Area B Settings" + c = self._memobj.b_conf + scan_lo = 136000000 + scan_hi = 512000000 + scan_rng = self._memobj.settings.b + band_list = (150, 450) - cf.append( - RadioSetting("settings.save_m", - "Save Mode (2)", - RadioSettingValueList(SAVE_MODES, - SAVE_MODES[s.save_m]))) - for i in range(0, 4): - sm = self._memobj.save[i] - wake = RadioSettingValueInteger(0, 18000, sm.wake * 10, 1) - wf = RadioSetting("save[%i].wake" % i, - "Save Mode %d Wake Time" % (i+1), wake) - wf.set_apply_callback(apply_wake, sm) - cf.append(wf) + prefix = "%s_conf" % area + af = RadioSettingGroup(prefix, desc) + af.append( + RadioSetting(prefix + ".w_mode", + "Workmode", + RadioSettingValueList( + WORKMODE_LIST, + WORKMODE_LIST[c.w_mode]))) + af.append(RadioSetting(prefix + ".w_chan", + "Channel", + RadioSettingValueInteger(1, 999, + c.w_chan))) + af.append( + RadioSetting(prefix + ".scan_grp", + "Scan Group (Menu 49)", + RadioSettingValueList( + SCANGRP_LIST, + SCANGRP_LIST[c.scan_grp]))) + af.append(RadioSetting(prefix + ".bcl", + "Busy Channel Lock-out (Menu 15)", + RadioSettingValueBoolean(c.bcl))) + af.append( + RadioSetting(prefix + ".sql", + "Squelch Level (Menu 8)", + RadioSettingValueList(LIST_0_9, + LIST_0_9[c.sql]))) + af.append( + RadioSetting(prefix + ".cset", + "Call ID Group (Menu 52)", + RadioSettingValueList(LIST_1_20, + LIST_1_20[c.cset]))) + af.append( + RadioSetting(prefix + ".step", + "Frequency Step (Menu 3)", + RadioSettingValueList( + self._step_list, self._step_list[c.step]))) + af.append( + RadioSetting(prefix + ".scan_mode", + "Scan Mode (Menu 20)", + RadioSettingValueList( + SCANMODE_LIST, + SCANMODE_LIST[c.scan_mode]))) + af.append( + RadioSetting(prefix + ".scan_range", + "Scan Range (Menu 50)", + RadioSettingValueList( + SCANRANGE_LIST, + SCANRANGE_LIST[c.scan_range]))) + st = RadioSettingValueString(0, 15, + short2freq(scan_rng.scan_st)) + rs = RadioSetting("settings.%s.scan_st" % area, + "Frequency Scan Start", st) + rs.set_apply_callback(apply_scan_st, scan_lo, scan_hi, scan_rng) + af.append(rs) - slp = RadioSettingValueInteger(0, 18000, sm.sleep * 10, 1) - wf = RadioSetting("save[%i].sleep" % i, - "Save Mode %d Sleep Time" % (i+1), slp) - wf.set_apply_callback(apply_sleep, sm) - cf.append(wf) + end = RadioSettingValueString(0, 15, + short2freq(scan_rng.scan_end)) + rs = RadioSetting("settings.%s.scan_end" % area, + "Frequency Scan End", end) + rs.set_apply_callback(apply_scan_end, scan_lo, scan_hi, + scan_rng) + af.append(rs) + # Each area has its own set of bands + for band in (band_list): + af.append(self._band_tab(area, band)) + return af + + def _key_tab(self): + """Build radio key/button menu + """ + s = self._memobj.settings + if self.MODEL == "KG-UV9PX": + pfkey1 = PF1KEY_LIST + pfkey2 = PF2KEY_LIST + pfkey3 = PF3KEY_LIST2 + elif (self.MODEL == "KG-UV9GX" or + self.MODEL == "KG-UV9G Pro"): + pfkey1 = PF1KEY_LIST9GX + pfkey2 = PF2KEY_LIST9GX + pfkey3 = PF3KEY_LIST9GX + else: + pfkey1 = PF1KEY_LIST + pfkey2 = PF2KEY_LIST + pfkey3 = PF3KEY_LIST - _msg = str(self._memobj.display.banner).split("\0")[0] - val = RadioSettingValueString(0, 16, _msg) - val.set_mutable(True) - cf.append(RadioSetting("display.banner", - "Display Message", val)) - return cf + kf = RadioSettingGroup("key_grp", "Key Settings") - def _fm_tab(self): - """FM Broadcast channels + kf.append(RadioSetting("settings.pf1", + "PF1 Key function (Menu 55)", + RadioSettingValueList( + pfkey1, + pfkey1[s.pf1]))) + kf.append(RadioSetting("settings.pf2", + "PF2 Key function (Menu 56)", + RadioSettingValueList( + pfkey2, + pfkey2[s.pf2]))) + + kf.append(RadioSetting("settings.pf3", + "PF3 Key function (Menu 57)", + RadioSettingValueList( + pfkey3, + pfkey3[s.pf3]))) + return kf + + def _fl_tab(self): + """Build the frequency limits tab """ - def apply_fm(setting, obj): - f = freq2short(setting.value, 76000000, 108000000) - obj.fm_freq = f - fm = RadioSettingGroup("fm_chans", "FM Broadcast") - for ch in range(0, 20): - chan = self._memobj.fm_chans[ch] - freq = RadioSettingValueString(0, 20, - short2freq(chan.fm_freq)) - rs = RadioSetting("fm_%d" % (ch + 1), - "FM Channel %d" % (ch + 1), freq) - rs.set_apply_callback(apply_fm, chan) - fm.append(rs) - return fm + # The stop limits in the factory KG-UV9D Mate memory image are 1 MHz + # higher than the published specs. The settings panel will crash if + # it encounters a value outside of these ranges. + hard_limits = { + "band_150": (108000000, 181000000), + "band_450": (400000000, 513000000), + "band_300": (350000000, 401000000), + "band_700": (700000000, 987000000), + "band_200": (230000000, 251000000) + } + + def apply_freq_start(setting, low, high, obj): + f = freq2short(setting.value, low, high) + obj.start = f + + def apply_freq_stop(setting, low, high, obj): + """Sets the stop limit to 1 MHz below the input value""" + + # The firmware has an off-by-1MHz error with stop limits. + # If you set the stop limit to 1480 (148 MHz), you can still tune + # up to 148.99 MHz. To compensate for this, + # we subtract 10 increments of 100 MHz before storing the value. + f = freq2short(setting.value, low, high) - 10 + obj.stop = f + + fl = RadioSettingGroup("freq_limit_grp", "Frequency Limits") + + rx = self._memobj.rx_freq_limits + tx = self._memobj.tx_freq_limits + + for rx_band in rx.items(): + name, limits = rx_band + + start_freq = RadioSettingValueString(1, + 20, + short2freq(limits.start)) + start_rs = RadioSetting("rx_start_" + name, + name + " Receive Start", + start_freq) + start_rs.set_apply_callback(apply_freq_start, + hard_limits[name][0], + hard_limits[name][1], + limits) + fl.append(start_rs) + + # Add 10 increments of 100 MHz before displaying to compensate for + # the firmware off-by-1MHz problem. + stop_freq = RadioSettingValueString(1, + 20, + short2freq(limits.stop + 10)) + stop_rs = RadioSetting("rx_stop_" + name, + name + " Receive Stop", + stop_freq) + stop_rs.set_apply_callback(apply_freq_stop, + hard_limits[name][0], + hard_limits[name][1], + limits) + fl.append(stop_rs) + + for tx_band in tx.items(): + name, limits = tx_band + + start_freq = RadioSettingValueString(1, + 20, + short2freq(limits.start)) + start_rs = RadioSetting("tx_start_" + name, + name + " Transmit Start", + start_freq) + start_rs.set_apply_callback(apply_freq_start, + hard_limits[name][0], + hard_limits[name][1], limits) + fl.append(start_rs) + + # Add 10 increments of 100 MHz before displaying to compensate for + # the firmware off-by-1MHz problem. + stop_freq = RadioSettingValueString(1, + 20, + short2freq(limits.stop + 10)) + stop_rs = RadioSetting("tx_stop_" + name, + name + " Transmit Stop", + stop_freq) + stop_rs.set_apply_callback(apply_freq_stop, + hard_limits[name][0], + hard_limits[name][1], + limits) + fl.append(stop_rs) + + return fl - def _scan_grp(self): - """Scan groups + def _get_settings(self): + """Build the radio configuration settings menus """ - def apply_name(setting, obj): - name = str2name(setting.value, 8, '\0', '\0') - obj.name = name - def apply_start(setting, obj): - """Do a callback to deal with RadioSettingInteger limitation - on memory address resolution - """ - obj.scan_st = int(setting.value) + core_grp = self._core_tab() + fm_grp = self._fm_tab() + area_a_grp = self._area_tab("a") + area_b_grp = self._area_tab("b") + key_grp = self._key_tab() + scan_grp = self._scan_grp() + callid_grp = self._callid_grp() + admin_grp = self._admin_tab() + rpt_grp = self._repeater_tab() + freq_limit_grp = self._fl_tab() - def apply_end(setting, obj): - """Do a callback to deal with RadioSettingInteger limitation - on memory address resolution - """ - obj.scan_end = int(setting.value) + core_grp.append(key_grp) + core_grp.append(admin_grp) + core_grp.append(rpt_grp) + core_grp.append(freq_limit_grp) + group = RadioSettings(core_grp, + area_a_grp, + area_b_grp, + fm_grp, + scan_grp, + callid_grp + ) + return group - sgrp = self._memobj.scn_grps - scan = RadioSettingGroup("scn_grps", "Channel Scanner Groups") - for i in range(0, 10): - s_grp = sgrp.addrs[i] - s_name = sgrp.names[i] - rs_name = RadioSettingValueString(0, 8, - name2str(s_name.name)) - rs = RadioSetting("scn_grps.names[%i].name" % i, - "Group %i Name" % (i + 1), rs_name) - rs.set_apply_callback(apply_name, s_name) - scan.append(rs) - rs_st = RadioSettingValueInteger(1, 999, s_grp.scan_st) - rs = RadioSetting("scn_grps.addrs[%i].scan_st" % i, - "Starting Channel", rs_st) - rs.set_apply_callback(apply_start, s_grp) - scan.append(rs) - rs_end = RadioSettingValueInteger(1, 999, s_grp.scan_end) - rs = RadioSetting("scn_grps.addrs[%i].scan_end" % i, - "Last Channel", rs_end) - rs.set_apply_callback(apply_end, s_grp) - scan.append(rs) - return scan + def get_settings(self): + """ Public build out linkage between radio settings and UI + """ + try: + return self._get_settings() + except Exception: + import traceback + LOG.error("Failed to parse settings: %s", + traceback.format_exc()) + return None - def _callid_grp(self): - """Caller IDs to be recognized by radio - This really should be a table in the UI + def _is_freq(self, element): + """This is a hack to smoke out whether we need to do + frequency translations for otherwise innocent u16s and u32s """ - def apply_callid(setting, obj): - c = str2callid(setting.value) - obj.cid = c + return "rxfreq" in element.get_name() or \ + "txfreq" in element.get_name() or \ + "scan_st" in element.get_name() or \ + "scan_end" in element.get_name() or \ + "offset" in element.get_name() or \ + "fm_stop" in element.get_name() - def apply_name(setting, obj): - name = str2name(setting.value, 6, '\0', '\xff') - obj.name = name + def _is_limit(self, element): + return "lower_limit" in element.get_name() or\ + "upper_limit" in element.get_name() - cid = RadioSettingGroup("callids", "Caller IDs") - for i in range(0, 20): - callid = self._memobj.call_ids[i] - name = self._memobj.cid_names[i] - c_name = RadioSettingValueString(0, 6, name2str(name.name)) - rs = RadioSetting("cid_names[%i].name" % i, - "Caller ID %i Name" % (i + 1), c_name) - rs.set_apply_callback(apply_name, name) - cid.append(rs) - c_id = RadioSettingValueString(0, 6, - callid2str(callid.cid), - False) - rs = RadioSetting("call_ids[%i].cid" % i, - "Caller ID Code", c_id) - rs.set_apply_callback(apply_callid, callid) - cid.append(rs) - return cid + def set_settings(self, settings): + """ Public update radio settings via UI callback + A lot of this should be in common code.... + """ - def _band_tab(self, area, band): - """ Build a band tab inside a VFO/Area + for element in settings: + if not isinstance(element, RadioSetting): + LOG.debug("set_settings: not instance %s" % + element.get_name()) + self.set_settings(element) + continue + else: + try: + if "." in element.get_name(): + bits = element.get_name().split(".") + obj = self._memobj + for bit in bits[:-1]: + # decode an array index + if "[" in bit and "]" in bit: + bit, index = bit.split("[", 1) + index, junk = index.split("]", 1) + index = int(index) + obj = getattr(obj, bit)[index] + else: + obj = getattr(obj, bit) + setting = bits[-1] + else: + obj = self._memobj.settings + setting = element.get_name() + + if element.has_apply_callback(): + LOG.debug("Using apply callback") + element.run_apply_callback() + else: + LOG.debug("Setting %s = %s" % + (setting, element.value)) + if self._is_freq(element): + setattr(obj, setting, int(element.value)/10) + elif self._is_limit(element): + setattr(obj, setting, int(element.value)*10) + else: + setattr(obj, setting, element.value) + except Exception: + LOG.debug("set_settings: Exception with %s" % + element.get_name()) + raise + + def callid2str(self, cid): + """Caller ID per MDC-1200 spec? Must be 3-6 digits (100 - 999999). + One digit (binary) per byte, terminated with '0xc' """ - def apply_freq(setting, lo, hi, obj): - f = freq2int(setting.value, lo, hi) - obj.freq = f/10 - def apply_offset(setting, obj): - f = freq2int(setting.value, 0, 5000000) - obj.offset = f/10 + bin2ascii = " 1234567890" + cidstr = "" + for i in range(0, 6): + b = cid[i].get_value() + if b == 0xc: # the cid EOL + break + if b == 0 or b > 0xa: + raise InvalidValueError( + "Caller ID code has illegal byte 0x%x" % b) + cidstr += bin2ascii[b] + return cidstr - def apply_enc(setting, obj): - t = tone2short(setting.value) - obj.encqt = t - def apply_dec(setting, obj): - t = tone2short(setting.value) - obj.decqt = t +@directory.register +class KGUV9PXRadio(KGUV9DPlusRadio): - if area == "a": - if band == 150: - c = self._memobj.vfo_a.band_150 - lo = 108000000 - hi = 180000000 - elif band == 200: - c = self._memobj.vfo_a.band_200 - lo = 230000000 - hi = 250000000 - elif band == 300: - c = self._memobj.vfo_a.band_300 - lo = 350000000 - hi = 400000000 - elif band == 450: - c = self._memobj.vfo_a.band_450 - lo = 400000000 - hi = 512000000 - else: # 700 - c = self._memobj.vfo_a.band_700 - lo = 700000000 - hi = 985000000 - else: # area 'b' - if band == 150: - c = self._memobj.vfo_b.band_150 - lo = 136000000 - hi = 180000000 - else: # 450 - c = self._memobj.vfo_b.band_450 - lo = 400000000 - hi = 512000000 + """Wouxun KG-UV9PX""" + VENDOR = "Wouxun" + MODEL = "KG-UV9PX" + _model = b"KG-UV9D" + _rev = b"02" # default rev for the radio I know about... + _file_ident = b"kg-uv9px" + NEEDS_COMPAT_SERIAL = False + _valid_steps = STEPS + _step_list = STEP_LIST - prefix = "vfo_%s.band_%d" % (area, band) - bf = RadioSettingGroup(prefix, "%dMHz Band" % band) - freq = RadioSettingValueString(0, 15, int2freq(c.freq * 10)) - rs = RadioSetting(prefix + ".freq", "Rx Frequency", freq) - rs.set_apply_callback(apply_freq, lo, hi, c) - bf.append(rs) + @classmethod + def match_model(cls, filedata, filename): + # This model is only ever matched via metadata + return False + + def process_mmap(self): + if self._rev != b"02" and self._rev != b"00": + # new revision found - log it and assume same map and proceed + LOG.debug("Unrecognized model variation (%s) Using default Map" % + self._rev) + self._memobj = bitwise.parse(_MEM_FORMAT_9PX, self._mmap) + + def get_features(self): + """ Public get_features + Return the features of this radio once we have identified + it and gotten its bits + """ + rf = chirp_common.RadioFeatures() + rf.has_settings = True + rf.has_ctone = True + rf.has_rx_dtcs = True + rf.has_cross = True + rf.has_tuning_step = False + rf.has_bank = False + rf.can_odd_split = True + rf.valid_skips = ["", "S"] + rf.valid_tmodes = ["", "Tone", "TSQL", "DTCS", "Cross"] + rf.valid_cross_modes = [ + "Tone->Tone", + "Tone->DTCS", + "DTCS->Tone", + "DTCS->", + "->Tone", + "->DTCS", + "DTCS->DTCS", + ] + rf.valid_modes = ["FM", "NFM", "AM"] + rf.valid_power_levels = self.POWER_LEVELS + rf.valid_name_length = 8 + rf.valid_duplexes = ["", "-", "+", "split", "off"] + rf.valid_bands = [(108000000, 135997500), # Aircraft AM + (136000000, 180997500), # supports 2m + (219000000, 250997500), + (350000000, 399997500), + (400000000, 512997500), # supports 70cm + (700000000, 986997500)] + rf.valid_characters = chirp_common.CHARSET_ASCII + rf.valid_tuning_steps = STEPS + rf.memory_bounds = (1, 999) # 999 memories + return rf - off = RadioSettingValueString(0, 15, int2freq(c.offset * 10)) - rs = RadioSetting(prefix + ".offset", "Tx Offset(28)", off) - rs.set_apply_callback(apply_offset, c) - bf.append(rs) + def callid2str(self, cid): + """Caller ID per MDC-1200 spec? Must be 3-6 digits (100 - 999999). + One digit (binary) per byte, terminated with '0xc' + """ - rs = RadioSetting(prefix + ".encqt", - "Encode QT(17,19)", - RadioSettingValueList(TONE_LIST, - short2tone(c.encqt))) - rs.set_apply_callback(apply_enc, c) - bf.append(rs) + bin2ascii = " 1234567890" + cidstr = "" + for i in range(0, 6): + b = cid[i].get_value() + # 9PX factory reset CID use 0x00 for 0 digit - instead of 0x0a + # remap 0x00 to 0x0a + if b == 0x00: + b = 0x0a + if b == 0xc or b == 0xf0: # the cid EOL + break + if b > 0xa: + raise InvalidValueError( + "Caller ID code has illegal byte 0x%x" % b) + cidstr += bin2ascii[b] + return cidstr - rs = RadioSetting(prefix + ".decqt", - "Decode QT(16,18)", - RadioSettingValueList(TONE_LIST, - short2tone(c.decqt))) - rs.set_apply_callback(apply_dec, c) - bf.append(rs) + def _get_settings(self): + """Build the radio configuration settings menus + """ - bf.append(RadioSetting(prefix + ".qt", - "Mute Mode(21)", - RadioSettingValueList(SPMUTE_LIST, - SPMUTE_LIST[c.qt]))) - bf.append(RadioSetting(prefix + ".scan", - "Scan this(48)", - RadioSettingValueBoolean(c.scan))) - bf.append(RadioSetting(prefix + ".pwr", - "Power(5)", - RadioSettingValueList( - POWER_LIST, POWER_LIST[c.pwr]))) - bf.append(RadioSetting(prefix + ".mod", - "AM Modulation(54)", - RadioSettingValueBoolean(c.mod))) - bf.append(RadioSetting(prefix + ".fm_dev", - "FM Deviation(4)", - RadioSettingValueList( - BANDWIDTH_LIST, - BANDWIDTH_LIST[c.fm_dev]))) - bf.append( - RadioSetting(prefix + ".shift", - "Frequency Shift(6)", - RadioSettingValueList(OFFSET_LIST, - OFFSET_LIST[c.shift]))) - return bf + core_grp = self._core_tab() + fm_grp = self._fm_tab() + area_a_grp = self._area_tab("a") + area_b_grp = self._area_tab("b") + key_grp = self._key_tab() + scan_grp = self._scan_grp() + callid_grp = self._callid_grp() + admin_grp = self._admin_tab() + rpt_grp = self._repeater_tab() + freq_limit_grp = self._fl_tab() + core_grp.append(key_grp) + core_grp.append(admin_grp) + core_grp.append(rpt_grp) + group = RadioSettings(core_grp, + area_a_grp, + area_b_grp, + fm_grp, + scan_grp, + callid_grp, + freq_limit_grp,) + return group def _area_tab(self, area): """Build a VFO tab @@ -1695,17 +2588,17 @@ class KGUV9DPlusRadio(chirp_common.CloneModeRadio, obj.scan_end = f if area == "a": - desc = "Area A Settings" + desc = "Receiver A Settings" c = self._memobj.a_conf scan_lo = 108000000 - scan_hi = 985000000 + scan_hi = 985997500 scan_rng = self._memobj.settings.a band_list = (150, 200, 300, 450, 700) else: - desc = "Area B Settings" + desc = "Receiver B Settings" c = self._memobj.b_conf scan_lo = 136000000 - scan_hi = 512000000 + scan_hi = 512997500 scan_rng = self._memobj.settings.b band_list = (150, 450) @@ -1723,37 +2616,37 @@ class KGUV9DPlusRadio(chirp_common.CloneModeRadio, c.w_chan))) af.append( RadioSetting(prefix + ".scan_grp", - "Scan Group(49)", + "Scan Group (Menu 49)", RadioSettingValueList( SCANGRP_LIST, SCANGRP_LIST[c.scan_grp]))) af.append(RadioSetting(prefix + ".bcl", - "Busy Channel Lock-out(15)", + "Busy Channel Lock-out (Menu 15)", RadioSettingValueBoolean(c.bcl))) af.append( RadioSetting(prefix + ".sql", - "Squelch Level(8)", + "Squelch Level (Menu 8)", RadioSettingValueList(LIST_0_9, LIST_0_9[c.sql]))) af.append( RadioSetting(prefix + ".cset", - "Call ID Group(52)", + "Call ID Group (Menu 52)", RadioSettingValueList(LIST_1_20, LIST_1_20[c.cset]))) af.append( RadioSetting(prefix + ".step", - "Frequency Step(3)", + "Frequency Step (Menu 3)", RadioSettingValueList( - STEP_LIST, STEP_LIST[c.step]))) + self._step_list, self._step_list[c.step]))) af.append( RadioSetting(prefix + ".scan_mode", - "Scan Mode(20)", + "Scan Mode (Menu 20)", RadioSettingValueList( SCANMODE_LIST, SCANMODE_LIST[c.scan_mode]))) af.append( RadioSetting(prefix + ".scan_range", - "Scan Range(50)", + "Scan Range (Menu 50)", RadioSettingValueList( SCANRANGE_LIST, SCANRANGE_LIST[c.scan_range]))) @@ -1776,118 +2669,298 @@ class KGUV9DPlusRadio(chirp_common.CloneModeRadio, af.append(self._band_tab(area, band)) return af - def _key_tab(self): - """Build radio key/button menu + def _band_tab(self, area, band): + """ Build a band tab inside a VFO/Area """ - s = self._memobj.settings - kf = RadioSettingGroup("key_grp", "Key Settings") + def apply_freq(setting, lo, hi, obj): + f = freq2int(setting.value, lo, hi) + obj.freq = f/10 - kf.append(RadioSetting("settings.pf1", - "PF1 Key function(55)", - RadioSettingValueList( - PF1KEY_LIST, - PF1KEY_LIST[s.pf1]))) - kf.append(RadioSetting("settings.pf2", - "PF2 Key function(56)", + def apply_offset(setting, obj): + f = freq2int(setting.value, 0, 5000000) + obj.offset = f/10 + + def apply_enc(setting, obj): + t = tone2short(setting.value) + obj.encqt = t + + def apply_dec(setting, obj): + t = tone2short(setting.value) + obj.decqt = t + + if area == "a": + if band == 150: + c = self._memobj.vfo_a.band_150 + lo = 108000000 + hi = 180997500 + elif band == 200: + c = self._memobj.vfo_a.band_200 + lo = 219000000 + hi = 250997500 + elif band == 300: + c = self._memobj.vfo_a.band_300 + lo = 350000000 + hi = 399997500 + elif band == 450: + c = self._memobj.vfo_a.band_450 + lo = 400000000 + hi = 512997500 + else: # 700 + c = self._memobj.vfo_a.band_700 + lo = 700000000 + hi = 986997500 + else: # area 'b' + if band == 150: + c = self._memobj.vfo_b.band_150 + lo = 136000000 + hi = 180997500 + else: # 450 + c = self._memobj.vfo_b.band_450 + lo = 400000000 + hi = 512997500 + + prefix = "vfo_%s.band_%d" % (area, band) + bf = RadioSettingGroup(prefix, "%d MHz Band" % band) + freq = RadioSettingValueString(0, 15, int2freq(c.freq * 10)) + rs = RadioSetting(prefix + ".freq", "Rx Frequency", freq) + rs.set_apply_callback(apply_freq, lo, hi, c) + bf.append(rs) + + off = RadioSettingValueString(0, 15, int2freq(c.offset * 10)) + rs = RadioSetting(prefix + ".offset", "Tx Offset (Menu 28)", off) + rs.set_apply_callback(apply_offset, c) + bf.append(rs) + + rs = RadioSetting(prefix + ".encqt", + "Encode QT (Menu 17,19)", + RadioSettingValueList(TONE_LIST, + short2tone(c.encqt))) + rs.set_apply_callback(apply_enc, c) + bf.append(rs) + + rs = RadioSetting(prefix + ".decqt", + "Decode QT (Menu 16,18)", + RadioSettingValueList(TONE_LIST, + short2tone(c.decqt))) + rs.set_apply_callback(apply_dec, c) + bf.append(rs) + + bf.append(RadioSetting(prefix + ".qt", + "Mute Mode (Menu 21)", + RadioSettingValueList(SPMUTE_LIST, + SPMUTE_LIST[c.qt]))) + bf.append(RadioSetting(prefix + ".scan", + "Scan this (Menu 48)", + RadioSettingValueBoolean(c.scan))) + bf.append(RadioSetting(prefix + ".pwr", + "Power (Menu 5)", RadioSettingValueList( - PF2KEY_LIST, - PF2KEY_LIST[s.pf2]))) - kf.append(RadioSetting("settings.pf3", - "PF3 Key function(57)", + POWER_LIST, POWER_LIST[c.pwr]))) + bf.append(RadioSetting(prefix + ".mod", + "AM Modulation (Menu 54)", + RadioSettingValueBoolean(c.mod))) + bf.append(RadioSetting(prefix + ".fm_dev", + "FM Deviation (Menu 4)", RadioSettingValueList( - PF3KEY_LIST, - PF3KEY_LIST[s.pf3]))) - return kf + BANDWIDTH_LIST, + BANDWIDTH_LIST[c.fm_dev]))) + bf.append( + RadioSetting(prefix + ".shift", + "Frequency Shift (Menu 6)", + RadioSettingValueList(OFFSET_LIST, + OFFSET_LIST[c.shift]))) + return bf - def _get_settings(self): - """Build the radio configuration settings menus - """ + def _fl_tab(self): + + freq_limit_grp = RadioSettingGroup("limits", + "Freq Limits") + limgrp = freq_limit_grp + + l = self._memobj.limits + + if self.MODEL == "KG-UV9PX": + val = RadioSettingValueInteger(136, 180, + (l.lim_150M_Txlower_limit) / 10.0) + rs = RadioSetting("limits.lim_150M_Txlower_limit", + "150M Tx Lower Limit (MHz)", + RadioSettingValueInteger(136, 180, val)) + limgrp.append(rs) + + val = RadioSettingValueInteger(136, 180, + (l.lim_150M_Txupper_limit) / 10.0) + rs = RadioSetting("limits.lim_150M_Txupper_limit", + "150M Tx Upper Limit (MHz + 0.9975)", + RadioSettingValueInteger(136, 180, val)) + limgrp.append(rs) + + val = RadioSettingValueInteger(400, 512, + (l.lim_450M_Txlower_limit) / 10.0) + rs = RadioSetting("limits.lim_450M_Txlower_limit", + "450M Tx Lower Limit (MHz)", + RadioSettingValueInteger(400, 512, val)) + limgrp.append(rs) + + val = RadioSettingValueInteger(400, 512, + (l.lim_450M_Txupper_limit) / 10.0) + rs = RadioSetting("limits.lim_450M_Txupper_limit", + "450M Tx Upper Limit (MHz + 0.9975)", + RadioSettingValueInteger(400, 512, val)) + limgrp.append(rs) + + val = RadioSettingValueInteger(108, 180, + (l.lim_150M_area_a_rxlower_limit) / + 10.0) + rs = RadioSetting("limits.lim_150M_area_a_rxlower_limit", + "Rcvr A 150M Rx Lower Limit (MHz)", + RadioSettingValueInteger(108, 180, + val)) + limgrp.append(rs) + + val = RadioSettingValueInteger(108, 180, + (l.lim_150M_area_a_rxupper_limit) / + 10.0) + rs = RadioSetting("limits.lim_150M_area_a_rxupper_limit", + "Rcvr A 150M Rx Upper Limit (MHz + 0.9975)", + RadioSettingValueInteger(108, 180, + val)) + limgrp.append(rs) + + val = RadioSettingValueInteger(136, 180, + (l.lim_150M_area_b_rxlower_limit) / + 10.0) + rs = RadioSetting("limits.lim_150M_area_b_rxlower_limit", + "Rcvr B 150M Rx Lower Limit (MHz)", + RadioSettingValueInteger(136, 180, + val)) + limgrp.append(rs) + + val = RadioSettingValueInteger(136, 180, + (l.lim_150M_area_b_rxupper_limit) / + 10.0) + rs = RadioSetting("limits.lim_150M_area_b_rxupper_limit", + "Rcvr B 150M Rx Upper Limit (MHz + 0.9975)", + RadioSettingValueInteger(136, 180, + val)) + limgrp.append(rs) + + val = RadioSettingValueInteger(400, 512, + (l.lim_450M_rxlower_limit) / 10.0) + rs = RadioSetting("limits.lim_450M_rxlower_limit", + "450M Rx Lower Limit (MHz)", + RadioSettingValueInteger(400, 512, + val)) + limgrp.append(rs) + + val = RadioSettingValueInteger(400, 512, + (l.lim_450M_rxupper_limit) / 10.0) + rs = RadioSetting("limits.lim_450M_rxupper_limit", + "450M Rx Upper Limit (MHz + 0.9975)", + RadioSettingValueInteger(400, 512, + val)) + limgrp.append(rs) + + val = RadioSettingValueInteger(350, 399, + (l.lim_300M_rxlower_limit) / 10.0) + rs = RadioSetting("limits.lim_300M_rxlower_limit", + "300M Rx Lower Limit (MHz)", + RadioSettingValueInteger(350, 399, + val)) + limgrp.append(rs) + + val = RadioSettingValueInteger(350, 399, + (l.lim_300M_rxupper_limit) / 10.0) + rs = RadioSetting("limits.lim_300M_rxupper_limit", + "300M Rx Upper Limit (MHz + 0.9975)", + RadioSettingValueInteger(350, 399, + val)) + limgrp.append(rs) + val = RadioSettingValueInteger(700, 986, + (l.lim_800M_rxlower_limit) / 10.0) + rs = RadioSetting("limits.lim_800M_rxlower_limit", + "800M Rx Lower Limit (MHz)", + RadioSettingValueInteger(700, 986, + val)) + limgrp.append(rs) + + val = RadioSettingValueInteger(700, 986, + (l.lim_800M_rxupper_limit) / 10.0) + rs = RadioSetting("limits.lim_800M_rxupper_limit", + "800M Rx Upper Limit (MHz + 0.9975)", + RadioSettingValueInteger(700, 986, + val)) + limgrp.append(rs) + + val = RadioSettingValueInteger(219, 250, + (l.lim_210M_rxlower_limit) / 10.0) + rs = RadioSetting("limits.lim_210M_rxlower_limit", + "210M Rx Lower Limit (MHz)", + RadioSettingValueInteger(219, 250, + val)) + limgrp.append(rs) + + val = RadioSettingValueInteger(219, 250, + (l.lim_210M_rxupper_limit) / 10.0) + rs = RadioSetting("limits.lim_210M_rxupper_limit", + "210M Rx Upper Limit (MHz + 0.9975)", + RadioSettingValueInteger(219, 250, + val)) + limgrp.append(rs) + + return limgrp - core_grp = self._core_tab() - fm_grp = self._fm_tab() - area_a_grp = self._area_tab("a") - area_b_grp = self._area_tab("b") - key_grp = self._key_tab() - scan_grp = self._scan_grp() - callid_grp = self._callid_grp() - admin_grp = self._admin_tab() - rpt_grp = self._repeater_tab() - core_grp.append(key_grp) - core_grp.append(admin_grp) - core_grp.append(rpt_grp) - group = RadioSettings(core_grp, - area_a_grp, - area_b_grp, - fm_grp, - scan_grp, - callid_grp - ) - return group +@directory.register +class KGUV9GXRadio(KGUV9PXRadio): - def get_settings(self): - """ Public build out linkage between radio settings and UI - """ - try: - return self._get_settings() - except Exception: - import traceback - LOG.error("Failed to parse settings: %s", - traceback.format_exc()) - return None + """Wouxun KG-UV9GX""" + VENDOR = "Wouxun" + MODEL = "KG-UV9GX" + _model = b"KG-UV9D" + _rev = b"02" # default rev for the radio I know about... + NEEDS_COMPAT_SERIAL = False + _valid_steps = STEPS + _step_list = STEP_LIST - def _is_freq(self, element): - """This is a hack to smoke out whether we need to do - frequency translations for otherwise innocent u16s and u32s - """ - return "rxfreq" in element.get_name() or \ - "txfreq" in element.get_name() or \ - "scan_st" in element.get_name() or \ - "scan_end" in element.get_name() or \ - "offset" in element.get_name() or \ - "fm_stop" in element.get_name() + @classmethod + def match_model(cls, filedata, filename): + # This model is only ever matched via metadata + return False - def set_settings(self, settings): - """ Public update radio settings via UI callback - A lot of this should be in common code.... - """ - for element in settings: - if not isinstance(element, RadioSetting): - LOG.debug("set_settings: not instance %s" % - element.get_name()) - self.set_settings(element) - continue - else: - try: - if "." in element.get_name(): - bits = element.get_name().split(".") - obj = self._memobj - for bit in bits[:-1]: - # decode an array index - if "[" in bit and "]" in bit: - bit, index = bit.split("[", 1) - index, junk = index.split("]", 1) - index = int(index) - obj = getattr(obj, bit)[index] - else: - obj = getattr(obj, bit) - setting = bits[-1] - else: - obj = self._memobj.settings - setting = element.get_name() +@directory.register +class KGUV9KRadio(KGUV9DPlusRadio): - if element.has_apply_callback(): - LOG.debug("Using apply callback") - element.run_apply_callback() - else: - LOG.debug("Setting %s = %s" % - (setting, element.value)) - if self._is_freq(element): - setattr(obj, setting, int(element.value)/10) - else: - setattr(obj, setting, element.value) - except Exception as e: - LOG.debug("set_settings: Exception with %s" % - element.get_name()) - raise + """Wouxun KG-UV9K""" + VENDOR = "Wouxun" + MODEL = "KG-UV9K" + _model = b"KG-UV9D" + _file_ident = b"kg-uv9k" + _rev = b"02" # default rev for the radio I know about... + NEEDS_COMPAT_SERIAL = False + _step_list = STEP_LIST_9K + _valid_steps = STEPS_9K + + @classmethod + def match_model(cls, filedata, filename): + # This model is only ever matched via metadata + return False + + +@directory.register +class KGUV9GProRadio(KGUV9DPlusRadio): + + """Wouxun KG-UV9G Pro""" + VENDOR = "Wouxun" + MODEL = "KG-UV9G Pro" + _model = b"KG-UV9D" + _file_ident = b"kg-uv9gpro" + _rev = b"02" # default rev for the radio I know about... + NEEDS_COMPAT_SERIAL = False + _step_list = STEP_LIST + _valid_steps = STEPS + + @classmethod + def match_model(cls, filedata, filename): + # This model is only ever matched via metadata + return False diff --git a/chirp/drivers/kyd.py b/chirp/drivers/kyd.py index 5747808..3542771 100644 --- a/chirp/drivers/kyd.py +++ b/chirp/drivers/kyd.py @@ -14,8 +14,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import time -import os import struct import logging @@ -67,7 +65,7 @@ CMD_ACK = "\x06" NC630A_POWER_LEVELS = [chirp_common.PowerLevel("Low", watts=1.00), chirp_common.PowerLevel("High", watts=5.00)] -NC630A_DTCS = sorted(chirp_common.DTCS_CODES + [645]) +NC630A_DTCS = tuple(sorted(chirp_common.DTCS_CODES + (645,))) BCL_LIST = ["Off", "Carrier", "QT/DQT"] TIMEOUTTIMER_LIST = [""] + ["%s seconds" % x for x in range(15, 615, 15)] @@ -76,15 +74,6 @@ VOICE_LIST = ["Off", "Chinese", "English"] VOX_LIST = ["OFF"] + ["%s" % x for x in range(1, 17)] VOXDELAY_LIST = ["0.3", "0.5", "1.0", "1.5", "2.0", "3.0"] -SETTING_LISTS = { - "bcl": BCL_LIST, - "tot": TIMEOUTTIMER_LIST, - "totalert": TOTALERT_LIST, - "voice": VOICE_LIST, - "vox": VOX_LIST, - "voxdelay": VOXDELAY_LIST, - } - def _nc630a_enter_programming_mode(radio): serial = radio.pipe @@ -223,7 +212,7 @@ class NC630aRadio(chirp_common.CloneModeRadio): ] _memsize = 0x03C8 _block_size = 0x08 - _fileid = "P32073" + _fileid = b"P32073" def get_features(self): rf = chirp_common.RadioFeatures() @@ -241,7 +230,7 @@ class NC630aRadio(chirp_common.CloneModeRadio): "->Tone", "->DTCS", "DTCS->", "DTCS->DTCS"] rf.valid_power_levels = NC630A_POWER_LEVELS rf.valid_duplexes = ["", "-", "+", "split", "off"] - rf.valid_modes = ["NFM", "FM"] # 12.5 KHz, 25 kHz. + rf.valid_modes = ["NFM", "FM"] # 12.5 kHz, 25 kHz. rf.memory_bounds = (1, 16) rf.valid_tuning_steps = [2.5, 5., 6.25, 10., 12.5, 25.] rf.valid_bands = [(400000000, 520000000)] @@ -318,7 +307,7 @@ class NC630aRadio(chirp_common.CloneModeRadio): mem.number = number mem.freq = int(_mem.rxfreq) * 10 - # We'll consider any blank (i.e. 0MHz frequency) to be empty + # We'll consider any blank (i.e. 0 MHz frequency) to be empty if mem.freq == 0: mem.empty = True return mem @@ -501,7 +490,7 @@ class NC630aRadio(chirp_common.CloneModeRadio): LOG.debug("Setting %s = %s" % (setting, element.value)) setattr(obj, setting, element.value) - except Exception as e: + except Exception: LOG.debug(element.get_name()) raise diff --git a/chirp/drivers/kyd_IP620.py b/chirp/drivers/kyd_IP620.py index 6c8cd65..01aad36 100644 --- a/chirp/drivers/kyd_IP620.py +++ b/chirp/drivers/kyd_IP620.py @@ -22,13 +22,10 @@ import struct import time -import os import logging from chirp import util, chirp_common, bitwise, memmap, errors, directory from chirp.settings import RadioSetting, RadioSettingGroup, \ - RadioSettingValueBoolean, RadioSettingValueList, \ - RadioSettingValueInteger, RadioSettingValueString, \ - RadioSettings + RadioSettingValueList, RadioSettings LOG = logging.getLogger(__name__) @@ -80,7 +77,7 @@ struct { // Settings memory structure ( A-Frequency mode ) #seekto 0x0E20; struct { u8 chan_disp_way; // Channel display way - u8 step_freq; // Step frequency KHz + u8 step_freq; // Step frequency kHz u8 rf_sql; // Squelch level u8 bat_save; // Battery Saver u8 chan_pri; // Channel PRI @@ -128,7 +125,7 @@ OFF_ON_LIST = ["OFF", "ON"] ON_OFF_LIST = ["ON", "OFF"] NO_YES_LIST = ["NO", "YES"] STEP_LIST = ["5.0", "6.25", "10.0", "12.5", "25.0"] -BAT_SAVE_LIST = ["OFF", "0.2 Sec", "0.4 Sec", "0.6 Sec", "0.8 Sec","1.0 Sec"] +BAT_SAVE_LIST = ["OFF", "0.2 Sec", "0.4 Sec", "0.6 Sec", "0.8 Sec", "1.0 Sec"] SHIFT_LIST = ["", "-", "+"] SCANM_LIST = ["Time", "Carrier wave", "Search"] ENDBEEP_LIST = ["OFF", "Begin", "End", "Begin/End"] @@ -144,7 +141,7 @@ BACKLIGHT_LIST = ["Always Off", "Auto", "Always On"] BUSYLOCK_LIST = ["NO", "Carrier", "SM"] KEYBLOCK_LIST = ["Manual", "Auto"] CALLTONE_LIST = ["OFF", "1", "2", "3", "4", "5", "6", "7", "8", "1750"] -RFSQL_LIST = ["OFF", "S-1", "S-2", "S-3", "S-4", "S-5", "S-6","S-7", "S-8", "S-FULL"] +RFSQL_LIST = ["OFF", "S-1", "S-2", "S-3", "S-4", "S-5", "S-6", "S-7", "S-8", "S-FULL"] IP620_CHARSET = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ?+-* " @@ -158,9 +155,10 @@ IP620_BANDS = [ (450000000, 520000000), ] + @directory.register class IP620Radio(chirp_common.CloneModeRadio, - chirp_common.ExperimentalRadio): + chirp_common.ExperimentalRadio): """KYD IP-620""" VENDOR = "KYD" MODEL = "IP-620" @@ -174,7 +172,7 @@ class IP620Radio(chirp_common.CloneModeRadio, @classmethod def match_model(cls, filedata, filename): return len(filedata) == cls._memsize and \ - filedata[0xF7E:0xF80] == "\x01\xE2" + filedata[0xF7E:0xF80] == b"\x01\xE2" def _ip620_exit_programming_mode(self): try: @@ -366,7 +364,7 @@ class IP620Radio(chirp_common.CloneModeRadio, mem.dtcs_polarity = "%s%s" % (tpol, rpol) LOG.debug("Got TX %s (%i) RX %s (%i)" % (txmode, _mem.tx_tone, - rxmode, _mem.rx_tone)) + rxmode, _mem.rx_tone)) def get_memory(self, number): _mem = self._memobj.memory[number - 1] @@ -401,31 +399,31 @@ class IP620Radio(chirp_common.CloneModeRadio, mem.extra = RadioSettingGroup("Extra", "extra") rs = RadioSetting("lout", "Lock out", RadioSettingValueList(OFF_ON_LIST, - OFF_ON_LIST[_mem.lout])) + OFF_ON_LIST[_mem.lout])) mem.extra.append(rs) rs = RadioSetting("busy_loc", "Busy lock", RadioSettingValueList(BUSYLOCK_LIST, - BUSYLOCK_LIST[_mem.busy_loc])) + BUSYLOCK_LIST[_mem.busy_loc])) mem.extra.append(rs) rs = RadioSetting("scan_add", "Scan add", RadioSettingValueList(NO_YES_LIST, - NO_YES_LIST[_mem.scan_add])) + NO_YES_LIST[_mem.scan_add])) mem.extra.append(rs) - #TODO: Show name channel -## count = 0 -## for i in _nam.chan_name: -## if i == 0xFF: -## break -## try: -## mem.name += IP620_CHARSET[i] -## except Exception: -## LOG.error("Unknown name char %i: 0x%02x (mem %i)" % -## (count, i, number - 1)) -## mem.name += " " -## count += 1 -## mem.name = mem.name.rstrip() + # TODO: Show name channel +# count = 0 +# for i in _nam.chan_name: +# if i == 0xFF: +# break +# try: +# mem.name += IP620_CHARSET[i] +# except Exception: +# LOG.error("Unknown name char %i: 0x%02x (mem %i)" % +# (count, i, number - 1)) +# mem.name += " " +# count += 1 +# mem.name = mem.name.rstrip() return mem @@ -501,92 +499,92 @@ class IP620Radio(chirp_common.CloneModeRadio, rs = RadioSetting("rf_sql", "Squelch level (SQL)", RadioSettingValueList(RFSQL_LIST, - RFSQL_LIST[_settings.rf_sql])) + RFSQL_LIST[_settings.rf_sql])) basic.append(rs) - rs = RadioSetting("step_freq", "Step frequency KHz (STP)", + rs = RadioSetting("step_freq", "Step frequency kHz (STP)", RadioSettingValueList(STEP_LIST, - STEP_LIST[_settings.step_freq])) + STEP_LIST[_settings.step_freq])) basic.append(rs) rs = RadioSetting("fm_radio", "FM radio (DW)", RadioSettingValueList(OFF_ON_LIST, - OFF_ON_LIST[_settings_misc.fm_radio])) + OFF_ON_LIST[_settings_misc.fm_radio])) basic.append(rs) rs = RadioSetting("call_tone", "Call tone (CK)", RadioSettingValueList(CALLTONE_LIST, - CALLTONE_LIST[_settings.call_tone])) + CALLTONE_LIST[_settings.call_tone])) basic.append(rs) rs = RadioSetting("tot", "Time-out timer (TOT)", RadioSettingValueList(TIMEOUT_LIST, - TIMEOUT_LIST[_settings.tot])) + TIMEOUT_LIST[_settings.tot])) basic.append(rs) rs = RadioSetting("chan_disp_way", "Channel display way", RadioSettingValueList(CH_FLAG_LIST, - CH_FLAG_LIST[_settings.chan_disp_way])) + CH_FLAG_LIST[_settings.chan_disp_way])) basic.append(rs) rs = RadioSetting("vox", "VOX Gain (VOX)", RadioSettingValueList(VOX_LIST, - VOX_LIST[_settings.vox])) + VOX_LIST[_settings.vox])) basic.append(rs) rs = RadioSetting("vox_dly", "VOX Delay", RadioSettingValueList(VOXDELAY_LIST, - VOXDELAY_LIST[_settings.vox_dly])) + VOXDELAY_LIST[_settings.vox_dly])) basic.append(rs) rs = RadioSetting("beep", "Beep (BP)", RadioSettingValueList(OFF_ON_LIST, - OFF_ON_LIST[_settings.beep])) + OFF_ON_LIST[_settings.beep])) basic.append(rs) rs = RadioSetting("auto_lock", "Auto lock (KY)", RadioSettingValueList(NO_YES_LIST, - NO_YES_LIST[_settings_misc.auto_lock])) + NO_YES_LIST[_settings_misc.auto_lock])) basic.append(rs) rs = RadioSetting("bat_save", "Battery Saver (SAV)", RadioSettingValueList(BAT_SAVE_LIST, - BAT_SAVE_LIST[_settings.bat_save])) + BAT_SAVE_LIST[_settings.bat_save])) basic.append(rs) rs = RadioSetting("chan_pri", "Channel PRI (PRI)", RadioSettingValueList(OFF_ON_LIST, - OFF_ON_LIST[_settings.chan_pri])) + OFF_ON_LIST[_settings.chan_pri])) basic.append(rs) rs = RadioSetting("chan_pri_num", "Channel PRI time Sec (PRI)", RadioSettingValueList(PRI_NUM_LIST, - PRI_NUM_LIST[_settings.chan_pri_num])) + PRI_NUM_LIST[_settings.chan_pri_num])) basic.append(rs) rs = RadioSetting("end_beep", "End beep (ET)", RadioSettingValueList(ENDBEEP_LIST, - ENDBEEP_LIST[_settings.end_beep])) + ENDBEEP_LIST[_settings.end_beep])) basic.append(rs) rs = RadioSetting("ch_mode", "CH mode", RadioSettingValueList(ON_OFF_LIST, - ON_OFF_LIST[_settings.ch_mode])) + ON_OFF_LIST[_settings.ch_mode])) basic.append(rs) rs = RadioSetting("scan_rev", "Scan rev (SCAN)", RadioSettingValueList(SCANM_LIST, - SCANM_LIST[_settings.scan_rev])) + SCANM_LIST[_settings.scan_rev])) basic.append(rs) rs = RadioSetting("enc", "Frequency lock (ENC)", RadioSettingValueList(OFF_ON_LIST, - OFF_ON_LIST[_settings.enc])) + OFF_ON_LIST[_settings.enc])) basic.append(rs) rs = RadioSetting("wait_back_light", "Wait back light (LED)", RadioSettingValueList(BACKLIGHT_LIST, - BACKLIGHT_LIST[_settings.wait_back_light])) + BACKLIGHT_LIST[_settings.wait_back_light])) basic.append(rs) return top @@ -597,7 +595,7 @@ class IP620Radio(chirp_common.CloneModeRadio, setattr(self._memobj.settings_misc, element.get_name(), element.value) - except Exception as e: + except Exception: LOG.debug(element.get_name()) raise @@ -612,7 +610,7 @@ class IP620Radio(chirp_common.CloneModeRadio, continue try: setting = element.get_name() - if setting in ["auto_lock","fm_radio"]: + if setting in ["auto_lock", "fm_radio"]: oldval = getattr(_settings_misc, setting) else: oldval = getattr(_settings, setting) @@ -620,10 +618,10 @@ class IP620Radio(chirp_common.CloneModeRadio, newval = element.value LOG.debug("Setting %s(%s) <= %s" % (setting, oldval, newval)) - if setting in ["auto_lock","fm_radio"]: + if setting in ["auto_lock", "fm_radio"]: setattr(_settings_misc, setting, newval) else: setattr(_settings, setting, newval) - except Exception as e: + except Exception: LOG.debug(element.get_name()) raise diff --git a/chirp/drivers/leixen.py b/chirp/drivers/leixen.py index fb965c8..093e860 100644 --- a/chirp/drivers/leixen.py +++ b/chirp/drivers/leixen.py @@ -14,7 +14,6 @@ # along with this program. If not, see . import struct -import os import logging from chirp import chirp_common, directory, memmap, errors, util @@ -22,8 +21,7 @@ from chirp import bitwise from chirp.settings import RadioSetting, RadioSettingGroup, \ RadioSettingValueInteger, RadioSettingValueList, \ RadioSettingValueBoolean, RadioSettingValueString, \ - RadioSettingValueFloat, InvalidValueError, RadioSettings -from textwrap import dedent + RadioSettings LOG = logging.getLogger(__name__) @@ -172,7 +170,7 @@ SQL_LIST = ["%s" % x for x in range(0, 10)] SCANM_LIST = ["CO", "TO"] TOT_LIST = ["OFF"] + ["%s seconds" % x for x in range(10, 130, 10)] _STEP_LIST = [2.5, 5., 6.25, 10., 12.5, 25.] -STEP_LIST = ["{} KHz".format(x) for x in _STEP_LIST] +STEP_LIST = ["{} kHz".format(x) for x in _STEP_LIST] MONITOR_LIST = ["CTC/DCS", "DTMF", "CTC/DCS and DTMF", "CTC/DCS or DTMF"] VFOMR_LIST = ["MR", "VFO"] MRCHA_LIST = ["MR CHA", "Freq. MR"] @@ -201,7 +199,7 @@ PFKEYLONG_LIST = ["OFF", "VFO/MR", "DTMF", "CALL", - "Transmit 1750Hz", + "Transmit 1750 Hz", "A/B", "Talk Around", "Reverse" @@ -219,17 +217,16 @@ PFKEYSHORT_LIST = ["OFF", "VFO/MR", "DTMF", "CALL", - "Transmit 1750Hz", + "Transmit 1750 Hz", "A/B", "Talk Around", "Reverse" ] MODES = ["NFM", "FM"] -WTFTONES = [float(x) for x in range(56, 64)] -TONES = WTFTONES + chirp_common.TONES -DTCS_CODES = [17, 50, 645] + chirp_common.DTCS_CODES -DTCS_CODES.sort() +WTFTONES = tuple(float(x) for x in range(56, 64)) +TONES = tuple(sorted(WTFTONES + chirp_common.TONES)) +DTCS_CODES = tuple(sorted((17, 50, 645) + chirp_common.DTCS_CODES)) TMODES = ["", "Tone", "DTCS", "DTCS"] @@ -244,15 +241,15 @@ def _image_ident_from_image(radio): def checksum(frame): x = 0 for b in frame: - x ^= ord(b) - return chr(x) + x ^= b + return x & 0xFF -def make_frame(cmd, addr, data=""): +def make_frame(cmd, addr, data=b""): payload = struct.pack(">H", addr) + data - header = struct.pack(">BB", ord(cmd), len(payload)) + header = struct.pack(">cB", cmd, len(payload)) frame = header + payload - return frame + checksum(frame) + return frame + bytes([checksum(frame)]) def send(radio, frame): @@ -269,7 +266,7 @@ def recv(radio, readdata=True): hdr = radio.pipe.read(4) # LOG.debug("%04i PBBH", hdr) length -= 2 @@ -282,30 +279,30 @@ def recv(radio, readdata=True): len(data), length)) chk = radio.pipe.read(1) else: - data = "" + data = b"" return addr, data def do_ident(radio): - send(radio, "\x02\x06LEIXEN\x17") + send(radio, b"\x02\x06LEIXEN\x17") ident = radio.pipe.read(9) LOG.debug(" P # Modified for Baojie BJ-218: 2018 # Rick DeWitt (RJD), # Modified for Baojie BJ-318: April 2021 # Mark Hartong, AJ4YI +# Modified for Baojie BJ-318: January 2023 +# Mark Hartong, AJ4YI +# 1. Removed Experimental Warning +# 2. Added Brown & Yellow as Color Selections +# 3. Max VFO Volume Setting to 15 ( vice 10) +# Modified UHF band limits: February 2023 +# Jim Unroe, KC9HI # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -18,10 +25,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import time import struct import logging -import re from chirp import chirp_common, directory, memmap from chirp import bitwise, errors, util @@ -29,7 +34,6 @@ from chirp.settings import RadioSettingGroup, RadioSetting, \ RadioSettingValueBoolean, RadioSettingValueList, \ RadioSettingValueString, RadioSettingValueInteger, \ RadioSettingValueFloat, RadioSettings, InvalidValueError -from textwrap import dedent LOG = logging.getLogger(__name__) @@ -111,7 +115,8 @@ struct { u8 up_scr_color; // BJ-318 upper screen character color u8 dn_scr_color; // BJ-318 lower screen character color // purple=00, red=01, emerald=02, blue=03, - // sky_blue=04, black=05, required hex values for color + // sky_blue=04, black=05, brown=06, yellow=07 required + // hex values for color // Note sky_blue and black look the same on the // BJ-318 screen u16 fm_318; // FM stored Frequency in BJ-318 @@ -142,7 +147,7 @@ struct vfo { u8 sql; // squelch for entire vfo band // integer values 0 (low) to 9 (high) u8 bvol; // sets volume for vfo band - // integer values 0 (low) TO 10 (high) + // integer values 0 (low) TO 15 (high) }; #seekto 0x0300; @@ -168,12 +173,12 @@ struct mem { u8 botsignal; u8 eotsignal; u8 power:1, // binary value for - // indiviudal channel power + // individual channel power // set to "High" or "Low" // BJ-318 band power overrides any // individual channel power setting wide:1, - compandor:1 + compander:1 scrambler:1 unknown:4; u8 namelen; @@ -206,7 +211,8 @@ LIST_BPOWER = ["Low", "Mid", "High"] # Tri-power models # BJ-218 Colors LIST_COLOR = ["Off", "Orange", "Blue", "Purple"] # BJ-318 Colors -LIST_COLOR318 = ["Purple", "Red", "Emerald", "Blue", "Sky_Blue", "Black"] +LIST_COLOR318 = ["Purple", "Red", "Emerald", "Blue", "Sky_Blue", "Black", + "Brown", "Yellow"] LIST_LEDSW = ["Auto", "On"] LIST_RING = ["Off"] + ["%s" % x for x in range(1, 10)] LIST_TDR_DEF = ["A-Upper", "B-Lower"] @@ -229,43 +235,18 @@ LIST_STATE = ["Normal", "Stun", "Kill"] LIST_SSF = ["1000", "1450", "1750", "2100"] LIST_DTMFTX = ["50", "100", "150", "200", "300", "500"] -SETTING_LISTS = { - "init_bank": LIST_TDR_DEF, - "tot": LIST_TIMEOUT, - "wtled": LIST_COLOR, # not used in BJ-318, other radios use - "rxled": LIST_COLOR, # not used in BJ-318, other radios use - "txled": LIST_COLOR, # not used in BJ-318, other radios use - "sig_freq": LIST_SSF, - "dtmf_txms": LIST_DTMFTX, - "ledsw": LIST_LEDSW, - "frq_chn_mode": LIST_VFOMODE, - "rx_tone": LIST_CTCSS, - "tx_tone": LIST_CTCSS, - "rx_mode": LIST_RECVMODE, - "launch_sig": LIST_SIGNAL, - "tx_end_sig": LIST_SIGNAL, - "bpower": LIST_BPOWER, - "fm_bw": LIST_BW, - "shift": LIST_SHIFT, - "step": LIST_STEPS, - "ring": LIST_RING, - "state_now": LIST_STATE, - "up_scr_color": LIST_COLOR318, # unique to BJ-318 - "dn_scr_color": LIST_COLOR318, # unique to BJ-318 -} - def _clean_buffer(radio): radio.pipe.timeout = 0.005 junk = radio.pipe.read(256) radio.pipe.timeout = STIMEOUT if junk: - Log.debug("Got %i bytes of junk before starting" % len(junk)) + LOG.debug("Got %i bytes of junk before starting" % len(junk)) def _rawrecv(radio, amount): """Raw read from the radio device""" - data = "" + data = b"" try: data = radio.pipe.read(amount) except: @@ -290,7 +271,7 @@ def _rawsend(radio, data): def _make_frame(cmd, addr, length, data=""): - """Pack the info in the headder format""" + """Pack the info in the header format""" frame = struct.pack(">4sHH", cmd, addr, length) # Add the data if set if len(data) != 0: @@ -321,12 +302,12 @@ def _do_ident(radio): # Flush input buffer _clean_buffer(radio) - magic = "PROM_LIN" + magic = b"PROM_LIN" _rawsend(radio, magic) ack = _rawrecv(radio, 1) - if ack != "\x06": + if ack != b"\x06": _exit_program_mode(radio) if ack: LOG.debug(repr(ack)) @@ -336,7 +317,7 @@ def _do_ident(radio): def _exit_program_mode(radio): - endframe = "EXIT" + endframe = b"EXIT" _rawsend(radio, endframe) @@ -349,13 +330,13 @@ def _download(radio): # UI progress status = chirp_common.Status() status.cur = 0 - status.max = MEM_SIZE / BLOCK_SIZE + status.max = MEM_SIZE // BLOCK_SIZE status.msg = "Cloning from radio..." radio.status_fn(status) - data = "" + data = b"" for addr in range(0, MEM_SIZE, BLOCK_SIZE): - frame = _make_frame("READ", addr, BLOCK_SIZE) + frame = _make_frame(b"READ", addr, BLOCK_SIZE) # DEBUG LOG.info("Request sent:") LOG.debug(util.hexprint(frame)) @@ -370,14 +351,12 @@ def _download(radio): data += d # UI Update - status.cur = addr / BLOCK_SIZE + status.cur = addr // BLOCK_SIZE status.msg = "Cloning from radio..." radio.status_fn(status) _exit_program_mode(radio) - data += radio.MODEL.ljust(8) - return data @@ -390,7 +369,7 @@ def _upload(radio): # UI progress status = chirp_common.Status() status.cur = 0 - status.max = MEM_SIZE / BLOCK_SIZE + status.max = MEM_SIZE // BLOCK_SIZE status.msg = "Cloning to radio..." radio.status_fn(status) @@ -399,19 +378,19 @@ def _upload(radio): # Sending the data data = radio.get_mmap()[addr:addr + BLOCK_SIZE] - frame = _make_frame("WRIE", addr, BLOCK_SIZE, data) + frame = _make_frame(b"WRIE", addr, BLOCK_SIZE, data) _rawsend(radio, frame) # Receiving the response ack = _rawrecv(radio, 1) - if ack != "\x06": + if ack != b"\x06": _exit_program_mode(radio) msg = "Bad ack writing block 0x%04x" % addr raise errors.RadioError(msg) # UI Update - status.cur = addr / BLOCK_SIZE + status.cur = addr // BLOCK_SIZE status.msg = "Cloning to radio..." radio.status_fn(status) @@ -422,7 +401,7 @@ def model_match(cls, data): """Match the opened/downloaded image to the correct version""" if len(data) == 0x1C08: rid = data[0x1C00:0x1C08] - return rid.startswith(cls.MODEL) + return rid.startswith(cls.MODEL.encode()) else: return False @@ -447,9 +426,10 @@ class LT725UV(chirp_common.CloneModeRadio): """LUITON LT-725UV Radio""" VENDOR = "LUITON" MODEL = "LT-725UV" + NEEDS_COMPAT_SERIAL = False MODES = ["NFM", "FM"] TONES = chirp_common.TONES - DTCS_CODES = sorted(chirp_common.DTCS_CODES + [645]) + DTCS_CODES = tuple(sorted(chirp_common.DTCS_CODES + (645,))) NAME_LENGTH = 7 DTMF_CHARS = list("0123456789ABCD*#") @@ -465,7 +445,7 @@ class LT725UV(chirp_common.CloneModeRadio): chirp_common.PowerLevel("High", watts=30.00)] VALID_BANDS = [(136000000, 176000000), - (400000000, 480000000)] + (400000000, 490000000)] # Valid chars on the LCD VALID_CHARS = chirp_common.CHARSET_ALPHANUMERIC + \ @@ -476,18 +456,23 @@ class LT725UV(chirp_common.CloneModeRadio): rp = chirp_common.RadioPrompts() if cls.MODEL == "BJ-318": msg = \ - (' BJ-318 EXPERIMENTAL\n' - ' PLEASE REPORT ANY ISSUES \n' + ('\n' + 'The individual BJ-318 channel power settings set in CHIRP' + ' are ignored by \n' + 'the radio. They are allowed to be set in hopes of a future' + ' firmware \n' + 'change by the manufacturer. While the CHIRP driver will' + ' allow setting \n' + 'the individual VFO power to High (25W), Med (10W) or Low' + ' (5W) they \n' + 'are converted to just Low (5W) and High (25W) on upload. The' + ' Med setting \n' + 'reverts to Low. \n' '\n' - 'The individual channel power settings are ignored by \n' - 'the radio. They are allowed to be set in hopes of a \n' - 'future firmware change. Changing a stored channel power \n' - 'setting must be done manually using the front panel menu \n' - 'control (or the microphone control controls while in VFO \n' - 'mode) to change the VFO power. The CHIRP driver will \n' - 'allow setting the individual VFO power to High (25W), \n' - 'Med (10W) or Low (5W) and setting the unused individual \n' - 'channel power setting to High (25W) or Low (5W)' + 'Changing a channel power setting must be done manually using' + ' the front \n' + 'panel menu control (or the microphone controls while in VFO' + ' mode.)' ) else: @@ -508,22 +493,18 @@ class LT725UV(chirp_common.CloneModeRadio): rp.info = msg - rp.pre_download = _(dedent("""\ - Follow this instructions to download your info: - - 1 - Turn off your radio - 2 - Connect your interface cable - 3 - Turn on your radio - 4 - Do the download of your radio data - """)) - rp.pre_upload = _(dedent("""\ - Follow this instructions to upload your info: - - 1 - Turn off your radio - 2 - Connect your interface cable - 3 - Turn on your radio - 4 - Do the upload of your radio data - """)) + rp.pre_download = _( + "Follow this instructions to download your info:\n" + "1 - Turn off your radio\n" + "2 - Connect your interface cable\n" + "3 - Turn on your radio\n" + "4 - Do the download of your radio data\n") + rp.pre_upload = _( + "Follow this instructions to upload your info:\n" + "1 - Turn off your radio\n" + "2 - Connect your interface cable\n" + "3 - Turn on your radio\n" + "4 - Do the upload of your radio data\n") return rp def get_features(self): @@ -578,7 +559,7 @@ class LT725UV(chirp_common.CloneModeRadio): LOG.exception('Unexpected error during download') raise errors.RadioError('Unexpected error communicating ' 'with the radio') - self._mmap = memmap.MemoryMap(data) + self._mmap = memmap.MemoryMapBytes(data) self.process_mmap() def sync_out(self): @@ -634,7 +615,7 @@ class LT725UV(chirp_common.CloneModeRadio): mem.duplex = int(_mem.rxfreq) > int(_mem.txfreq) and "-" or "+" mem.offset = abs(int(_mem.rxfreq) - int(_mem.txfreq)) * 10 - for char in _mem.name[:_mem.namelen]: + for char in _mem.name[0:_mem.namelen]: mem.name += chr(char) dtcs_pol = ["N", "N"] @@ -711,9 +692,9 @@ class LT725UV(chirp_common.CloneModeRadio): eotsignal = RadioSetting("eotsignal", "Transmit end signaling", rx) mem.extra.append(eotsignal) - rx = RadioSettingValueBoolean(bool(_mem.compandor)) - compandor = RadioSetting("compandor", "Compandor", rx) - mem.extra.append(compandor) + rx = RadioSettingValueBoolean(bool(_mem.compander)) + compander = RadioSetting("compander", "Compander", rx) + mem.extra.append(compander) rx = RadioSettingValueBoolean(bool(_mem.scrambler)) scrambler = RadioSetting("scrambler", "Scrambler", rx) @@ -743,7 +724,7 @@ class LT725UV(chirp_common.CloneModeRadio): else: _mem.txfreq = mem.freq / 10 - _mem.namelen = len(mem.name) + _mem.namelen = len(mem.name.rstrip()) _namelength = self.get_features().valid_name_length for i in range(_namelength): try: @@ -1021,7 +1002,7 @@ class LT725UV(chirp_common.CloneModeRadio): basic.append(rs) tmp = str(int(_sets.sig_freq)) - rs = RadioSetting("settings.sig_freq", "Single Signaling Tone (Htz)", + rs = RadioSetting("settings.sig_freq", "Single Signaling Tone (Hz)", RadioSettingValueList(LIST_SSF, tmp)) rs.set_apply_callback(my_val_list, _sets, "sig_freq") basic.append(rs) @@ -1039,7 +1020,7 @@ class LT725UV(chirp_common.CloneModeRadio): # UPPER BAND SETTINGS # Freq Mode, convert bit 1 state to index pointer - val = _vfoa.frq_chn_mode / 2 + val = _vfoa.frq_chn_mode // 2 rx = RadioSettingValueList(LIST_VFOMODE, LIST_VFOMODE[val]) rs = RadioSetting("upper.vfoa.frq_chn_mode", "Default Mode", rx) @@ -1061,7 +1042,7 @@ class LT725UV(chirp_common.CloneModeRadio): a_band.append(rs) tmp = my_tone_strn(_vfoa, "is_rxdigtone", "rxdtcs_pol", "rx_tone") - rs = RadioSetting("rx_tone", "Default Recv CTCSS (Htz)", + rs = RadioSetting("rx_tone", "Default Recv CTCSS (Hz)", RadioSettingValueList(LIST_CTCSS, tmp)) rs.set_apply_callback(my_set_tone, _vfoa, "is_rxdigtone", "rxdtcs_pol", "rx_tone") @@ -1073,7 +1054,7 @@ class LT725UV(chirp_common.CloneModeRadio): a_band.append(rs) tmp = my_tone_strn(_vfoa, "is_txdigtone", "txdtcs_pol", "tx_tone") - rs = RadioSetting("tx_tone", "Default Xmit CTCSS (Htz)", + rs = RadioSetting("tx_tone", "Default Xmit CTCSS (Hz)", RadioSettingValueList(LIST_CTCSS, tmp)) rs.set_apply_callback(my_set_tone, _vfoa, "is_txdigtone", "txdtcs_pol", "tx_tone") @@ -1093,7 +1074,7 @@ class LT725UV(chirp_common.CloneModeRadio): a_band.append(rs) rx = RadioSettingValueBoolean(bool(_vfoa.cmp_nder)) - rs = RadioSetting("upper.vfoa.cmp_nder", "Compandor", rx) + rs = RadioSetting("upper.vfoa.cmp_nder", "Compander", rx) a_band.append(rs) rs = RadioSetting("upper.vfoa.scrm_blr", "Scrambler", @@ -1112,7 +1093,7 @@ class LT725UV(chirp_common.CloneModeRadio): a_band.append(rs) tmp = str(_vfoa.step / 100.0) - rs = RadioSetting("step", "Freq step (KHz)", + rs = RadioSetting("step", "Freq step (kHz)", RadioSettingValueList(LIST_STEPS, tmp)) rs.set_apply_callback(my_word2raw, _vfoa, "step", 100) a_band.append(rs) @@ -1131,7 +1112,7 @@ class LT725UV(chirp_common.CloneModeRadio): if self.MODEL == "BJ-318": bvolume_u = RadioSetting("upper.vfoa.bvol", "Volume", RadioSettingValueInteger( - 0, 10, _vfoa.bvol)) + 0, 15, _vfoa.bvol)) a_band.append(bvolume_u) # BJ-318 Upper Screen Color @@ -1151,7 +1132,7 @@ class LT725UV(chirp_common.CloneModeRadio): # LOWER BAND SETTINGS - val = _vfob.frq_chn_mode / 2 + val = _vfob.frq_chn_mode // 2 rx = RadioSettingValueList(LIST_VFOMODE, LIST_VFOMODE[val]) rs = RadioSetting("lower.vfob.frq_chn_mode", "Default Mode", rx) rs.set_apply_callback(my_spcl, _vfob, "frq_chn_mode") @@ -1164,15 +1145,15 @@ class LT725UV(chirp_common.CloneModeRadio): b_band.append(rs) val = _vfob.rxfreq / 100000.0 - if (val < 400.0 or val > 480.0): + if (val < 400.0 or val > 490.0): val = 446.0 # UHF calling rs = RadioSetting("lower.vfob.rxfreq ", "Default Recv Freq (MHz)", - RadioSettingValueFloat(400.0, 480.0, val, 0.001, 5)) + RadioSettingValueFloat(400.0, 490.0, val, 0.001, 5)) rs.set_apply_callback(my_dbl2raw, _vfob, "rxfreq") b_band.append(rs) tmp = my_tone_strn(_vfob, "is_rxdigtone", "rxdtcs_pol", "rx_tone") - rs = RadioSetting("rx_tone", "Default Recv CTCSS (Htz)", + rs = RadioSetting("rx_tone", "Default Recv CTCSS (Hz)", RadioSettingValueList(LIST_CTCSS, tmp)) rs.set_apply_callback(my_set_tone, _vfob, "is_rxdigtone", "rxdtcs_pol", "rx_tone") @@ -1183,7 +1164,7 @@ class LT725UV(chirp_common.CloneModeRadio): b_band.append(rs) tmp = my_tone_strn(_vfob, "is_txdigtone", "txdtcs_pol", "tx_tone") - rs = RadioSetting("tx_tone", "Default Xmit CTCSS (Htz)", + rs = RadioSetting("tx_tone", "Default Xmit CTCSS (Hz)", RadioSettingValueList(LIST_CTCSS, tmp)) rs.set_apply_callback(my_set_tone, _vfob, "is_txdigtone", "txdtcs_pol", "tx_tone") @@ -1201,7 +1182,7 @@ class LT725UV(chirp_common.CloneModeRadio): rs = RadioSetting("lower.vfob.fm_bw", "Wide/Narrow Band", rx) b_band.append(rs) - rs = RadioSetting("lower.vfob.cmp_nder", "Compandor", + rs = RadioSetting("lower.vfob.cmp_nder", "Compander", RadioSettingValueBoolean(bool(_vfob.cmp_nder))) b_band.append(rs) @@ -1220,7 +1201,7 @@ class LT725UV(chirp_common.CloneModeRadio): b_band.append(rs) tmp = str(_vfob.step / 100.0) - rs = RadioSetting("step", "Freq step (KHz)", + rs = RadioSetting("step", "Freq step (kHz)", RadioSettingValueList(LIST_STEPS, tmp)) rs.set_apply_callback(my_word2raw, _vfob, "step", 100) b_band.append(rs) @@ -1239,7 +1220,7 @@ class LT725UV(chirp_common.CloneModeRadio): if self.MODEL == "BJ-318": bvolume_l = RadioSetting("lower.vfob.bvol", "Volume", RadioSettingValueInteger( - 0, 10, _vfob.bvol)) + 0, 15, _vfob.bvol)) b_band.append(bvolume_l) # BJ-318 Lower Screen Color @@ -1261,8 +1242,8 @@ class LT725UV(chirp_common.CloneModeRadio): def chars2str(cary, knt): """Convert raw memory char array to a string: NOT a callback.""" stx = "" - for char in cary[:knt]: - stx += chr(char) + for char in cary[0:knt]: + stx += chr(int(char)) return stx def my_str2ary(setting, obj, atrba, atrbc): @@ -1299,7 +1280,7 @@ class LT725UV(chirp_common.CloneModeRadio): rs.set_apply_callback(my_str2ary, _lims, "hello2", "hello2_cnt") lims.append(rs) - # VALID_BANDS = [(136000000, 176000000),400000000, 480000000)] + # VALID_BANDS = [(136000000, 176000000),400000000, 490000000)] lval = _lims.vhf_low / 100000.0 uval = _lims.vhf_high / 100000.0 @@ -1324,12 +1305,12 @@ class LT725UV(chirp_common.CloneModeRadio): uval = 470.0 rs = RadioSetting("hello_lims.uhf_low", "Lower UHF Band Limit (MHz)", - RadioSettingValueFloat(400.0, 480.0, lval, 0.001, 3)) + RadioSettingValueFloat(400.0, 490.0, lval, 0.001, 3)) rs.set_apply_callback(my_dbl2raw, _lims, "uhf_low") lims.append(rs) rs = RadioSetting("hello_lims.uhf_high", "Upper UHF Band Limit (MHz)", - RadioSettingValueFloat(400.0, 480.0, uval, 0.001, 3)) + RadioSettingValueFloat(400.0, 490.0, uval, 0.001, 3)) rs.set_apply_callback(my_dbl2raw, _lims, "uhf_high") lims.append(rs) @@ -1339,7 +1320,7 @@ class LT725UV(chirp_common.CloneModeRadio): """Generate the DTMF code 1-8, NOT a callback.""" tmp = "" if knt > 0 and knt != 0xff: - for val in ary[:knt]: + for val in ary[0:knt]: if val > 0 and val <= 9: tmp += chr(val + 48) elif val == 0x0a: @@ -1547,7 +1528,7 @@ class LT725UV(chirp_common.CloneModeRadio): elif element.value.get_mutable(): LOG.debug("Setting %s = %s" % (setting, element.value)) setattr(obj, setting, element.value) - except Exception, e: + except Exception: LOG.debug(element.get_name()) raise diff --git a/chirp/drivers/mml_jc8810.py b/chirp/drivers/mml_jc8810.py new file mode 100644 index 0000000..c16c36d --- /dev/null +++ b/chirp/drivers/mml_jc8810.py @@ -0,0 +1,1417 @@ +# Copyright 2023 Jim Unroe +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +import logging +import struct + +from chirp import ( + bitwise, + chirp_common, + directory, + errors, + memmap, + util, +) +from chirp.settings import ( + RadioSetting, + RadioSettingGroup, + RadioSettings, + RadioSettingValueBoolean, + RadioSettingValueInteger, + RadioSettingValueList, + RadioSettingValueString, +) + +LOG = logging.getLogger(__name__) + +MEM_FORMAT = """ +#seekto 0x0000; +struct { + lbcd rxfreq[4]; // 0-3 + lbcd txfreq[4]; // 4-7 + ul16 rxtone; // 8-9 + ul16 txtone; // A-B + u8 unknown1:4, // C + scode:4; // Signaling + u8 unknown2:6, // D + pttid:2; // PTT-ID + u8 unknown3:6, // E + txpower:2; // Power Level 0 = H, 1 = L, 2 = M + u8 unknown4:1, // F + narrow:1, // Bandwidth 0 = Wide, 1 = Narrow + encrypt:2, // Encrypt + bcl:1, // BCL + scan:1, // Scan 0 = Skip, 1 = Scan + unknown5:1, // + learning:1; // Learning + lbcd code[3]; // 0-2 Code + u8 unknown6; // 3 + char name[12]; // 4-F 12-character Alpha Tag +} memory[%d]; + +#seekto 0x9000; +struct { + u8 unused:4, // 9000 + sql:4; // Squelch Level + u8 unused_9001:6, // 9001 + save:2; // Battery Save + u8 unused_9002:4, // 9002 + vox:4; // VOX Level + u8 unused_9003:4, // 9003 + abr:4; // Auto BackLight + u8 unused_9004:7, // 9004 + tdr:1; // TDR + u8 unused:5, // 9005 + tot:3; // Time-out Timer + u8 unused_9006:7, // 9006 + beep:1; // Beep + u8 unused_9007:7, // 9007 + voice:1; // Voice Prompt + u8 unused_9008:7, // 9008 + language:1; // Language + u8 unused_9009:6, // 9009 + dtmfst:2; // DTMF ST + u8 unused_900a:6, // 900A + screv:2; // Scan Mode + u8 unknown_900b; // 900B + u8 unused_900c:5, // 900C + pttlt:3; // PTT Delay + u8 unused_900d:6, // 900D + mdfa:2; // Channel_A Display + u8 unused_9003:6, // 900E + mdfb:2; // Channel_B Display + u8 unknown_900f; // 900F + u8 unused_9010:4, // 9010 + autolk:4; // Key Auto Lock + u8 unused_9011:6, // 9011 + almode:2; // Alarm Mode + u8 unused_9012:7, // 9012 + alarmsound:1; // Alarm Sound + u8 unused_9013:6, // 9013 + dualtx:2; // Dual TX + u8 unused_9014:7, // 9014 + ste:1; // Tail Noise Clear + u8 unused_9015:4, // 9015 + rpste:4; // RPT Noise Clear + u8 unused_9016:4, // 9016 + rptrl:4; // RPT Noise Delay + u8 unused_9017:6, // 9017 + roger:2; // Roger + u8 unknown_9018; // 9018 + u8 unused_9019:7, // 9019 + fmradio:1; // FM Radio + u8 unused_901a1:3, // 901A + vfomrb:1, // WorkMode B + unused_901a2:3, // + vfomra:1; // WorkMode A + u8 unused_901b:7, // 901B + kblock:1; // KB Lock + u8 unused_901c:7, // 901C + ponmsg:1; // Power On Msg + u8 unknown_901d; // 901D + u8 unused_901e:6, // 901E + tone:2; // Pilot + u8 unknown_901f; // 901F + u8 unused_9020:4, // 9020 + voxd:4; // VOX Delay + u8 unused_9021:4, // 9021 + menuquit:4; // Menu Auto Quit + u8 unused_9022:7, // 9022 + tailcode:1; // Tail Code (RT-470L) + u8 unknown_9023; // 9023 + u8 unknown_9024; // 9024 + u8 unknown_9025; // 9025 + u8 unknown_9026; // 9026 + u8 unknown_9027; // 9027 + u8 unknown_9028; // 9028 + u8 unused_9029:6, // 9029 + qtsave:2; // QT Save Type + u8 ani; // 902A ANI + u8 skey2_sp; // 902B Skey2 Short + u8 skey2_lp; // 902C Skey2 Long + u8 skey3_sp; // 902D Skey3 Short + u8 topkey_sp; // 902E Top Key (RT-470L) + u8 unused_902f:6, // 902F + rxendtail:2; // RX END TAIL (RT-470) + // TAIL PHASE (A36plus) + u8 skey3_lp; // 9030 Skey3 Long (RT-470L) + // RX END TAIL (A36plus) +} settings; + +#seekto 0xA020; +struct { + u8 code[5]; // 5-character DTMF Encoder Groups + u8 unused[11]; +} pttid[15]; + +#seekto 0xA006; +struct { + u8 unused_a006:4, // A006 + pttid:4; // PTT-ID + u8 unused_a007:5, // A007 + dtmfon:3; // DTMF Speed (on time) + u8 unused_a008:5, // A008 + dtmfoff:3; // DTMF Speed (off time) +} dtmf; + +#seekto 0xB000; +struct { + u8 code[3]; // 3-character ANI Code Groups +} anicodes[60]; + +#seekto 0xB0C0; +struct { + char name[10]; // 10-character ANI Code Group Names + u8 unused[6]; +} aninames[%d]; + +#seekto 0xB200; +struct { + char name[10]; // 10-character Custom CH Names (Talkpod A36plus) + u8 unused[6]; +} customnames[30]; + +""" + + +CMD_ACK = b"\x06" + +DTCS = tuple(sorted(chirp_common.DTCS_CODES + (645,))) + +DTMF_CHARS = "0123456789 *#ABCD" + +TXPOWER_HIGH = 0x00 +TXPOWER_LOW = 0x01 +TXPOWER_MID = 0x02 + +ABR_LIST = ["On", "5 seconds", "10 seconds", "15 seconds", "20 seconds", + "30 seconds", "1 minute", "2 minutes", "3 minutes"] +ALMODE_LIST = ["Site", "Tone", "Code"] +AUTOLK_LIST = ["Off"] + ABR_LIST[1:4] +DTMFSPEED_LIST = ["50 ms", "100 ms", "200 ms", "300 ms", "500 ms"] +DTMFST_LIST = ["Off", "KeyBoard Side Tone", "ANI Side Tone", "KB ST + ANI ST"] +DUALTX_LIST = ["Off", "A", "B"] +ENCRYPT_LIST = ["Off", "DCP1", "DCP2", "DCP3"] +LANGUAGE_LIST = ["English", "Chinese"] +MDF_LIST = ["Name", "Frequency", "Channel"] +MENUQUIT_LIST = ["%s seconds" % x for x in range(5, 55, 5)] + ["60 seconds"] +OFF1TO9_LIST = ["Off"] + ["%s" % x for x in range(1, 10)] +PONMSG_LIST = ["Logo", "Voltage"] +PTTID_LIST = ["Off", "BOT", "EOT", "Both"] +PTTIDCODE_LIST = ["%s" % x for x in range(1, 16)] +PTTLT_LIST = ["None", "100 ms"] + \ + ["%s ms" % x for x in range(200, 1200, 200)] +QTSAVE_LIST = ["All", "RX", "TX"] +ROGER_LIST = ["OFF", "BEEP", "TONE1200"] +RPSTE_LIST = ["Off"] + ["%s ms" % x for x in range(100, 1100, 100)] +SAVE_LIST = ["Off", "Normal", "Super", "Deep"] +SCREV_LIST = ["Time (TO)", "Carrier (CO)", "Search (SE)"] +TAILCODE_LIST = ["55 Hz", "62.5 Hz"] +TAILPHASE_LIST = ["None", "120 Shift", "180 Shift", "240 Shift"] +TONERXEND_LIST = ["Off", "MDC-1200"] +TONE_LIST = ["1000 Hz", "1450 Hz", "1750 Hz", "2100 Hz"] +TOT_LIST = ["Off", "30 seconds", "60 seconds", "120 seconds", "240 seconds", + "480 seconds"] +VOXD_LIST = ["%s seconds" % str(x / 10) for x in range(5, 21)] +WORKMODE_LIST = ["VFO Mode", "Channel Mode"] + +ALL_SKEY_CHOICES = ["OFF", + "FM Radio", + "TX Power Level", + "Scan", + "Search", + "Flashlight", + "NOAA Weather", + "Monitor", + "PTT B", + "SOS", + "DTMF", + "REVERSE", + "REMOTE Scan"] + +ALL_SKEY_VALUES = [0xFF, + 0x07, + 0x0A, + 0x1C, + 0x1D, + 0x08, + 0x0C, + 0x05, + 0x01, + 0x03, + 0x2A, + 0x2D, + 0x23] + + +def _enter_programming_mode(radio): + serial = radio.pipe + + exito = False + for i in range(0, 5): + serial.write(radio._magic) + ack = serial.read(1) + + try: + if ack == CMD_ACK: + exito = True + break + except Exception: + LOG.debug("Attempt #%s, failed, trying again" % i) + pass + + # check if we had EXITO + if exito is False: + msg = "The radio did not accept program mode after five tries.\n" + msg += "Check you interface cable and power cycle your radio." + raise errors.RadioError(msg) + + try: + serial.write(b"F") + ident = serial.read(8) + except Exception: + raise errors.RadioError("Error communicating with radio") + + if ident not in radio._fingerprint: + LOG.debug(util.hexprint(ident)) + raise errors.RadioError("Radio returned unknown identification string") + + +def _exit_programming_mode(radio): + serial = radio.pipe + try: + serial.write(b"E") + except Exception: + raise errors.RadioError("Radio refused to exit programming mode") + + +def _read_block(radio, block_addr, block_size): + serial = radio.pipe + + cmd = struct.pack(">cHb", b'R', block_addr, block_size) + expectedresponse = b"R" + cmd[1:] + LOG.debug("Reading block %04x..." % (block_addr)) + + try: + serial.write(cmd) + response = serial.read(4 + block_size) + if response[:4] != expectedresponse: + raise Exception("Error reading block %04x." % (block_addr)) + + block_data = response[4:] + except Exception: + raise errors.RadioError("Failed to read block at %04x" % block_addr) + + return block_data + + +def _write_block(radio, block_addr, block_size): + serial = radio.pipe + + cmd = struct.pack(">cHb", b'W', block_addr, block_size) + data = radio.get_mmap()[block_addr:block_addr + block_size] + + LOG.debug("Writing Data:") + LOG.debug(util.hexprint(cmd + data)) + + try: + serial.write(cmd + data) + if serial.read(1) != CMD_ACK: + raise Exception("No ACK") + except Exception: + raise errors.RadioError("Failed to send block " + "to radio at %04x" % block_addr) + + +def do_download(radio): + LOG.debug("download") + _enter_programming_mode(radio) + + data = b"" + + status = chirp_common.Status() + status.msg = "Cloning from radio" + + status.cur = 0 + status.max = radio._memsize + + for addr in range(0, radio._memsize, radio.BLOCK_SIZE): + status.cur = addr + radio.BLOCK_SIZE + radio.status_fn(status) + + block = _read_block(radio, addr, radio.BLOCK_SIZE) + data += block + + LOG.debug("Address: %04x" % addr) + LOG.debug(util.hexprint(block)) + + _exit_programming_mode(radio) + + return memmap.MemoryMapBytes(data) + + +def do_upload(radio): + status = chirp_common.Status() + status.msg = "Uploading to radio" + + _enter_programming_mode(radio) + + status.cur = 0 + status.max = radio._memsize + + for start_addr, end_addr in radio._ranges: + for addr in range(start_addr, end_addr, radio.BLOCK_SIZE_UP): + status.cur = addr + radio.BLOCK_SIZE_UP + radio.status_fn(status) + _write_block(radio, addr, radio.BLOCK_SIZE_UP) + + _exit_programming_mode(radio) + + +def _split(rf, f1, f2): + """Returns False if the two freqs are in the same band (no split) + or True otherwise""" + + # determine if the two freqs are in the same band + for low, high in rf.valid_bands: + if f1 >= low and f1 <= high and \ + f2 >= low and f2 <= high: + # if the two freqs are on the same Band this is not a split + return False + + # if you get here is because the freq pairs are split + return True + + +class JC8810base(chirp_common.CloneModeRadio): + """MML JC-8810""" + VENDOR = "MML" + MODEL = "JC-8810base" + BAUD_RATE = 57600 + NEEDS_COMPAT_SERIAL = False + BLOCK_SIZE = 0x40 + BLOCK_SIZE_UP = 0x40 + + POWER_LEVELS = [chirp_common.PowerLevel("H", watts=10.00), + chirp_common.PowerLevel("M", watts=8.00), + chirp_common.PowerLevel("L", watts=4.00)] + + VALID_BANDS = [(108000000, 136000000), + (136000000, 180000000), + (200000000, 260000000), + (330000000, 400000000), + (400000000, 520000000)] + + _magic = b"PROGRAMJC81U" + _fingerprint = [b"\x00\x00\x00\x26\x00\x20\xD8\x04", + b"\x00\x00\x00\x42\x00\x20\xF0\x04", + b"\x00\x00\x00\x4A\x00\x20\xF8\x04"] + + _ranges = [ + (0x0000, 0x2000), + (0x8000, 0x8040), + (0x9000, 0x9040), + (0xA000, 0xA140), + (0xB000, 0xB300) + ] + _memsize = 0xB300 + _upper = 256 + _aninames = 30 + _mem_params = (_upper, # number of channels + _aninames, # number of aninames + ) + _valid_chars = chirp_common.CHARSET_ALPHANUMERIC + \ + "`~!@#$%^&*()-=_+[]\\{}|;':\",./<>?" + + def get_features(self): + rf = chirp_common.RadioFeatures() + rf.has_settings = True + rf.has_bank = False + rf.has_ctone = True + rf.has_cross = True + rf.has_rx_dtcs = True + rf.has_tuning_step = False + rf.can_odd_split = True + rf.has_name = True + rf.valid_name_length = 12 + rf.valid_characters = self._valid_chars + rf.valid_skips = ["", "S"] + rf.valid_tmodes = ["", "Tone", "TSQL", "DTCS", "Cross"] + rf.valid_cross_modes = ["Tone->Tone", "Tone->DTCS", "DTCS->Tone", + "->Tone", "->DTCS", "DTCS->", "DTCS->DTCS"] + rf.valid_power_levels = self.POWER_LEVELS + rf.valid_duplexes = ["", "-", "+", "split", "off"] + rf.valid_modes = ["FM", "NFM"] # 25 kHz, 12.5 kHz. + rf.valid_dtcs_codes = DTCS + rf.memory_bounds = (1, self._upper) + rf.valid_tuning_steps = [2.5, 5., 6.25, 10., 12.5, 20., 25., 50.] + rf.valid_bands = self.VALID_BANDS + return rf + + def process_mmap(self): + self._memobj = bitwise.parse(MEM_FORMAT % self._mem_params, self._mmap) + + def sync_in(self): + """Download from radio""" + try: + data = do_download(self) + except errors.RadioError: + # Pass through any real errors we raise + raise + except Exception: + # If anything unexpected happens, make sure we raise + # a RadioError and log the problem + LOG.exception('Unexpected error during download') + raise errors.RadioError('Unexpected error communicating ' + 'with the radio') + self._mmap = data + self.process_mmap() + + def sync_out(self): + """Upload to radio""" + try: + do_upload(self) + except Exception: + # If anything unexpected happens, make sure we raise + # a RadioError and log the problem + LOG.exception('Unexpected error during upload') + raise errors.RadioError('Unexpected error communicating ' + 'with the radio') + + def _is_txinh(self, _mem): + raw_tx = "" + for i in range(0, 4): + raw_tx += _mem.txfreq[i].get_raw() + return raw_tx == "\xFF\xFF\xFF\xFF" + + def get_memory(self, number): + """Get the mem representation from the radio image""" + _mem = self._memobj.memory[number - 1] + + # Create a high-level memory object to return to the UI + mem = chirp_common.Memory() + + # Memory number + mem.number = number + + if _mem.get_raw()[0] == "\xff": + mem.empty = True + return mem + + # Freq and offset + mem.freq = int(_mem.rxfreq) * 10 + # tx freq can be blank + if _mem.get_raw()[4] == "\xFF": + # TX freq not set + mem.offset = 0 + mem.duplex = "off" + else: + # TX freq set + offset = (int(_mem.txfreq) * 10) - mem.freq + if offset != 0: + if _split(self.get_features(), mem.freq, int( + _mem.txfreq) * 10): + mem.duplex = "split" + mem.offset = int(_mem.txfreq) * 10 + elif offset < 0: + mem.offset = abs(offset) + mem.duplex = "-" + elif offset > 0: + mem.offset = offset + mem.duplex = "+" + else: + mem.offset = 0 + + for char in _mem.name: + if str(char) == "\xFF": + char = " " # may have 0xFF mid-name + mem.name += str(char) + mem.name = mem.name.rstrip() + + dtcs_pol = ["N", "N"] + + if _mem.txtone in [0, 0xFFFF]: + txmode = "" + elif _mem.txtone >= 0x0258: + txmode = "Tone" + mem.rtone = int(_mem.txtone) / 10.0 + elif _mem.txtone <= 0x0258: + txmode = "DTCS" + if _mem.txtone > 0x69: + index = _mem.txtone - 0x6A + dtcs_pol[0] = "R" + else: + index = _mem.txtone - 1 + mem.dtcs = DTCS[index] + else: + LOG.warn("Bug: txtone is %04x" % _mem.txtone) + + if _mem.rxtone in [0, 0xFFFF]: + rxmode = "" + elif _mem.rxtone >= 0x0258: + rxmode = "Tone" + mem.ctone = int(_mem.rxtone) / 10.0 + elif _mem.rxtone <= 0x0258: + rxmode = "DTCS" + if _mem.rxtone >= 0x6A: + index = _mem.rxtone - 0x6A + dtcs_pol[1] = "R" + else: + index = _mem.rxtone - 1 + mem.rx_dtcs = DTCS[index] + else: + LOG.warn("Bug: rxtone is %04x" % _mem.rxtone) + + if txmode == "Tone" and not rxmode: + mem.tmode = "Tone" + elif txmode == rxmode and txmode == "Tone" and mem.rtone == mem.ctone: + mem.tmode = "TSQL" + elif txmode == rxmode and txmode == "DTCS" and mem.dtcs == mem.rx_dtcs: + mem.tmode = "DTCS" + elif rxmode or txmode: + mem.tmode = "Cross" + mem.cross_mode = "%s->%s" % (txmode, rxmode) + + mem.dtcs_polarity = "".join(dtcs_pol) + + if not _mem.scan: + mem.skip = "S" + + _levels = self.POWER_LEVELS + if self.MODEL in ["A36plus", "UV-A37", "AR-730"]: + if _mem.txpower == TXPOWER_HIGH: + mem.power = _levels[0] + elif _mem.txpower == TXPOWER_LOW: + mem.power = _levels[1] + else: + LOG.error('%s: get_mem: unhandled power level: 0x%02x' % + (mem.name, _mem.txpower)) + else: + if _mem.txpower == TXPOWER_HIGH: + mem.power = _levels[0] + elif _mem.txpower == TXPOWER_MID: + mem.power = _levels[1] + elif _mem.txpower == TXPOWER_LOW: + mem.power = _levels[2] + else: + LOG.error('%s: get_mem: unhandled power level: 0x%02x' % + (mem.name, _mem.txpower)) + + mem.mode = _mem.narrow and "NFM" or "FM" + + mem.extra = RadioSettingGroup("Extra", "extra") + + # BCL (Busy Channel Lockout) + rs = RadioSettingValueBoolean(_mem.bcl) + rset = RadioSetting("bcl", "BCL", rs) + mem.extra.append(rset) + + # PTT-ID + rs = RadioSettingValueList(PTTID_LIST, PTTID_LIST[_mem.pttid]) + rset = RadioSetting("pttid", "PTT ID", rs) + mem.extra.append(rset) + + # Signal (DTMF Encoder Group #) + rs = RadioSettingValueList(PTTIDCODE_LIST, PTTIDCODE_LIST[_mem.scode]) + rset = RadioSetting("scode", "PTT ID Code", rs) + mem.extra.append(rset) + + return mem + + def set_memory(self, mem): + _mem = self._memobj.memory[mem.number - 1] + + if mem.empty: + _mem.set_raw("\xff" * 32) + return + + _mem.set_raw("\x00" * 16 + "\xFF" * 16) + + _mem.rxfreq = mem.freq / 10 + + if mem.duplex == "off": + for i in range(0, 4): + _mem.txfreq[i].set_raw("\xFF") + elif mem.duplex == "split": + _mem.txfreq = mem.offset / 10 + elif mem.duplex == "+": + _mem.txfreq = (mem.freq + mem.offset) / 10 + elif mem.duplex == "-": + _mem.txfreq = (mem.freq - mem.offset) / 10 + else: + _mem.txfreq = mem.freq / 10 + + _namelength = self.get_features().valid_name_length + for i in range(_namelength): + try: + _mem.name[i] = mem.name[i] + except IndexError: + _mem.name[i] = "\xFF" + + rxmode = txmode = "" + if mem.tmode == "Tone": + _mem.txtone = int(mem.rtone * 10) + _mem.rxtone = 0 + elif mem.tmode == "TSQL": + _mem.txtone = int(mem.ctone * 10) + _mem.rxtone = int(mem.ctone * 10) + elif mem.tmode == "DTCS": + rxmode = txmode = "DTCS" + _mem.txtone = DTCS.index(mem.dtcs) + 1 + _mem.rxtone = DTCS.index(mem.dtcs) + 1 + elif mem.tmode == "Cross": + txmode, rxmode = mem.cross_mode.split("->", 1) + if txmode == "Tone": + _mem.txtone = int(mem.rtone * 10) + elif txmode == "DTCS": + _mem.txtone = DTCS.index(mem.dtcs) + 1 + else: + _mem.txtone = 0 + if rxmode == "Tone": + _mem.rxtone = int(mem.ctone * 10) + elif rxmode == "DTCS": + _mem.rxtone = DTCS.index(mem.rx_dtcs) + 1 + else: + _mem.rxtone = 0 + else: + _mem.rxtone = 0 + _mem.txtone = 0 + + if txmode == "DTCS" and mem.dtcs_polarity[0] == "R": + _mem.txtone += 0x69 + if rxmode == "DTCS" and mem.dtcs_polarity[1] == "R": + _mem.rxtone += 0x69 + + _mem.scan = mem.skip != "S" + _mem.narrow = mem.mode == "NFM" + + _levels = self.POWER_LEVELS + if self.MODEL in ["A36plus", "UV-A37", "AR-730"]: + if mem.power is None: + _mem.txpower = TXPOWER_HIGH + elif mem.power == _levels[0]: + _mem.txpower = TXPOWER_HIGH + elif mem.power == _levels[1]: + _mem.txpower = TXPOWER_LOW + else: + LOG.error('%s: set_mem: unhandled power level: %s' % + (mem.name, mem.power)) + else: + if mem.power is None: + _mem.txpower = TXPOWER_HIGH + elif mem.power == _levels[0]: + _mem.txpower = TXPOWER_HIGH + elif mem.power == _levels[1]: + _mem.txpower = TXPOWER_MID + elif mem.power == _levels[2]: + _mem.txpower = TXPOWER_LOW + else: + LOG.error('%s: set_mem: unhandled power level: %s' % + (mem.name, mem.power)) + + for setting in mem.extra: + if setting.get_name() == "scramble_type": + setattr(_mem, setting.get_name(), int(setting.value) + 8) + setattr(_mem, "scramble_type2", int(setting.value) + 8) + else: + setattr(_mem, setting.get_name(), setting.value) + + def get_settings(self): + _dtmf = self._memobj.dtmf + _settings = self._memobj.settings + basic = RadioSettingGroup("basic", "Basic Settings") + group = RadioSettings(basic) + + # Menu 12: TOT + rs = RadioSettingValueList(TOT_LIST, TOT_LIST[_settings.tot]) + rset = RadioSetting("tot", "Time Out Timer", rs) + basic.append(rset) + + # Menu 00: SQL + rs = RadioSettingValueInteger(0, 9, _settings.sql) + rset = RadioSetting("sql", "Squelch Level", rs) + basic.append(rset) + + # Menu 13: VOX + rs = RadioSettingValueList(OFF1TO9_LIST, OFF1TO9_LIST[_settings.vox]) + rset = RadioSetting("vox", "VOX", rs) + basic.append(rset) + + # Menu 39: VOX DELAY + rs = RadioSettingValueList(VOXD_LIST, VOXD_LIST[_settings.voxd]) + rset = RadioSetting("voxd", "VOX Delay", rs) + basic.append(rset) + + # Menu 15: VOICE + rs = RadioSettingValueBoolean(_settings.voice) + rset = RadioSetting("voice", "Voice Prompts", rs) + basic.append(rset) + + if self.MODEL not in ["A36plus", "UV-A37", "AR-730"]: + # Menu 17: LANGUAGE + rs = RadioSettingValueList(LANGUAGE_LIST, + LANGUAGE_LIST[_settings.language]) + rset = RadioSetting("language", "Voice", rs) + basic.append(rset) + + # Menu 23: ABR + rs = RadioSettingValueList(ABR_LIST, ABR_LIST[_settings.abr]) + rset = RadioSetting("abr", "Auto BackLight", rs) + basic.append(rset) + + # Work Mode A + rs = RadioSettingValueList(WORKMODE_LIST, + WORKMODE_LIST[_settings.vfomra]) + rset = RadioSetting("vfomra", "Work Mode A", rs) + basic.append(rset) + + # Work Mode B + rs = RadioSettingValueList(WORKMODE_LIST, + WORKMODE_LIST[_settings.vfomrb]) + rset = RadioSetting("vfomrb", "Work Mode B", rs) + basic.append(rset) + + # Menu 19: SC-REV + rs = RadioSettingValueList(SCREV_LIST, SCREV_LIST[_settings.screv]) + rset = RadioSetting("screv", "Scan Resume Method", rs) + basic.append(rset) + + # Menu 10: SAVE + rs = RadioSettingValueList(SAVE_LIST, + SAVE_LIST[_settings.save]) + rset = RadioSetting("save", "Battery Save Mode", rs) + basic.append(rset) + + # Menu 42: MDF-A + rs = RadioSettingValueList(MDF_LIST, MDF_LIST[_settings.mdfa]) + rset = RadioSetting("mdfa", "Memory Display Format A", rs) + basic.append(rset) + + # Menu 43: MDF-B + rs = RadioSettingValueList(MDF_LIST, MDF_LIST[_settings.mdfb]) + rset = RadioSetting("mdfb", "Memory Display Format B", rs) + basic.append(rset) + + # Menu 33: DTMFST (DTMF ST) + rs = RadioSettingValueList(DTMFST_LIST, DTMFST_LIST[_settings.dtmfst]) + rset = RadioSetting("dtmfst", "DTMF Side Tone", rs) + basic.append(rset) + + # Menu 37: PTT-LT + rs = RadioSettingValueList(PTTLT_LIST, PTTLT_LIST[_settings.pttlt]) + rset = RadioSetting("pttlt", "PTT Delay", rs) + basic.append(rset) + + rs = RadioSettingValueInteger(1, 60, _settings.ani + 1) + rset = RadioSetting("ani", "ANI", rs) + basic.append(rset) + + # Menu 20: PF2 + def apply_skey2s_listvalue(setting, obj): + LOG.debug("Setting value: " + str(setting.value) + " from list") + val = str(setting.value) + index = SKEY2S_CHOICES.index(val) + val = SKEY2S_VALUES[index] + obj.set_value(val) + + if self.MODEL in ["RT-470"]: + unwanted = [0, 7, 9, 10, 11, 12] + elif self.MODEL in ["HI-8811", "RT-470L", "RT-470X"]: + unwanted = [9, 10, 11, 12] + elif self.MODEL in ["UV-A37", "AR-730"]: + unwanted = [0, 5, 7, 9, 10, 11, 12] + elif self.MODEL in ["A36plus"]: + unwanted = [0, 5, 7, 9, 10, 11] + else: + unwanted = [] + SKEY2S_CHOICES = ALL_SKEY_CHOICES.copy() + SKEY2S_VALUES = ALL_SKEY_VALUES.copy() + for ele in sorted(unwanted, reverse=True): + del SKEY2S_CHOICES[ele] + del SKEY2S_VALUES[ele] + + if _settings.skey2_sp in SKEY2S_VALUES: + idx = SKEY2S_VALUES.index(_settings.skey2_sp) + else: + idx = SKEY2S_VALUES.index(0x07) # default FM + rs = RadioSettingValueList(SKEY2S_CHOICES, SKEY2S_CHOICES[idx]) + rset = RadioSetting("skey2_sp", "PF2 Key (Short Press)", rs) + rset.set_apply_callback(apply_skey2s_listvalue, _settings.skey2_sp) + basic.append(rset) + + # Menu 21: PF2 LONG PRESS + def apply_skey2l_listvalue(setting, obj): + LOG.debug("Setting value: " + str(setting.value) + " from list") + val = str(setting.value) + index = SKEY2L_CHOICES.index(val) + val = SKEY2L_VALUES[index] + obj.set_value(val) + + if self.MODEL in ["RT-470"]: + unwanted = [0, 7, 8, 9, 10, 11, 12] + elif self.MODEL in ["HI-8811", "RT-470L", "RT-470X"]: + unwanted = [8, 9, 10, 11, 12] + elif self.MODEL in ["UV-A37", "AR-730"]: + unwanted = [0, 5, 7, 8, 10, 11, 12] + elif self.MODEL in ["A36plus"]: + unwanted = [0, 5, 7, 8, 11, 12] + else: + unwanted = [] + SKEY2L_CHOICES = ALL_SKEY_CHOICES.copy() + SKEY2L_VALUES = ALL_SKEY_VALUES.copy() + for ele in sorted(unwanted, reverse=True): + del SKEY2L_CHOICES[ele] + del SKEY2L_VALUES[ele] + + if _settings.skey2_lp in SKEY2L_VALUES: + idx = SKEY2L_VALUES.index(_settings.skey2_lp) + else: + idx = SKEY2L_VALUES.index(0x1D) # default Search + rs = RadioSettingValueList(SKEY2L_CHOICES, SKEY2L_CHOICES[idx]) + rset = RadioSetting("skey2_lp", "PF2 Key (Long Press)", rs) + rset.set_apply_callback(apply_skey2l_listvalue, _settings.skey2_lp) + basic.append(rset) + + # Menu 22: PF3 + def apply_skey3s_listvalue(setting, obj): + LOG.debug("Setting value: " + str(setting.value) + " from list") + val = str(setting.value) + index = SKEY3S_CHOICES.index(val) + val = SKEY3S_VALUES[index] + obj.set_value(val) + + if self.MODEL in ["RT-470"]: + unwanted = [0, 7, 8, 9, 10, 11, 12] + elif self.MODEL in ["HI-8811", "RT-470L", "RT-470X"]: + unwanted = [8, 9, 10, 11, 12] + elif self.MODEL in ["UV-A37", "AR-730"]: + unwanted = [0, 5, 7, 8, 9, 10, 11, 12] + elif self.MODEL in ["A36plus"]: + unwanted = [0, 5, 7, 8, 11] + else: + unwanted = [] + SKEY3S_CHOICES = ALL_SKEY_CHOICES.copy() + SKEY3S_VALUES = ALL_SKEY_VALUES.copy() + for ele in sorted(unwanted, reverse=True): + del SKEY3S_CHOICES[ele] + del SKEY3S_VALUES[ele] + + if _settings.skey3_sp in SKEY3S_VALUES: + idx = SKEY3S_VALUES.index(_settings.skey3_sp) + else: + idx = SKEY3S_VALUES.index(0x0C) # default NOAA + rs = RadioSettingValueList(SKEY3S_CHOICES, SKEY3S_CHOICES[idx]) + rset = RadioSetting("skey3_sp", "PF3 Key (Short Press)", rs) + rset.set_apply_callback(apply_skey3s_listvalue, _settings.skey3_sp) + basic.append(rset) + + if self.MODEL in ["HI-8811", "RT-470L", "RT-470X"]: + # Menu 24: PF3 LONG PRESS (RT-470L) + def apply_skey3l_listvalue(setting, obj): + LOG.debug("Setting value: " + str(setting.value) + + " from list") + val = str(setting.value) + index = SKEY3L_CHOICES.index(val) + val = SKEY2L_VALUES[index] + obj.set_value(val) + + if self.MODEL in ["HI-8811", "RT-470L", "RT-470X"]: + unwanted = [8, 9, 10, 11, 12] + else: + unwanted = [] + SKEY3L_CHOICES = ALL_SKEY_CHOICES.copy() + SKEY3L_VALUES = ALL_SKEY_VALUES.copy() + for ele in sorted(unwanted, reverse=True): + del SKEY3L_CHOICES[ele] + del SKEY3L_VALUES[ele] + + if _settings.skey3_lp in SKEY3L_VALUES: + idx = SKEY3L_VALUES.index(_settings.skey3_lp) + else: + idx = SKEY3L_VALUES.index(0x1D) # default SEARCH + rs = RadioSettingValueList(SKEY3L_CHOICES, SKEY3L_CHOICES[idx]) + rset = RadioSetting("skey3_lp", "PF3 Key (Long Press)", rs) + rset.set_apply_callback(apply_skey3l_listvalue, + _settings.skey3_lp) + basic.append(rset) + + # Menu 25: TOP KEY (RT-470L) + def apply_skeytop_listvalue(setting, obj): + LOG.debug("Setting value: " + str(setting.value) + + " from list") + val = str(setting.value) + index = SKEYTOP_CHOICES.index(val) + val = SKEYTOP_VALUES[index] + obj.set_value(val) + + if self.MODEL in ["RT-470"]: + # ========== + # Notice to developers: + # The RT-470 v1.22 firmware added 'hidden' support for the + # Top Key (Short Press) feature. RT-470 radios with a firmware + # version prior to v1.22 will not honor the Top Key (Short + # Press) setting in CHIRP. + # ========== + unwanted = [0, 7, 8, 9, 10, 11, 12] + elif self.MODEL in ["HI-8811", "RT-470L", "RT-470X"]: + unwanted = [8, 9, 10, 11, 12] + elif self.MODEL in ["UV-A37", "AR-730"]: + unwanted = [0, 5, 7, 8, 9, 10, 11, 12] + elif self.MODEL in ["A36plus"]: + unwanted = [0, 5, 7, 8, 11] + else: + unwanted = [] + SKEYTOP_CHOICES = ALL_SKEY_CHOICES.copy() + SKEYTOP_VALUES = ALL_SKEY_VALUES.copy() + for ele in sorted(unwanted, reverse=True): + del SKEYTOP_CHOICES[ele] + del SKEYTOP_VALUES[ele] + + if _settings.topkey_sp in SKEYTOP_VALUES: + idx = SKEYTOP_VALUES.index(_settings.topkey_sp) + else: + idx = SKEYTOP_VALUES.index(0x1D) # default SEARCH + rs = RadioSettingValueList(SKEYTOP_CHOICES, SKEYTOP_CHOICES[idx]) + rset = RadioSetting("topkey_sp", "Top Key (Short Press)", rs) + rset.set_apply_callback(apply_skeytop_listvalue, + _settings.topkey_sp) + basic.append(rset) + + # Mneu 36: TONE + rs = RadioSettingValueList(TONE_LIST, TONE_LIST[_settings.tone]) + rset = RadioSetting("tone", "Tone-burst Frequency", rs) + basic.append(rset) + + # Mneu 29: POWER ON MSG + rs = RadioSettingValueList(PONMSG_LIST, PONMSG_LIST[_settings.ponmsg]) + rset = RadioSetting("ponmsg", "Power On Message", rs) + basic.append(rset) + + if self.MODEL in ["HI-8811", "RT-470L"]: + rs = RadioSettingValueList(TAILCODE_LIST, + TAILCODE_LIST[_settings.tailcode]) + rset = RadioSetting("tailcode", "Tail Code", rs) + basic.append(rset) + + # Menu 46: STE + rs = RadioSettingValueBoolean(_settings.ste) + rset = RadioSetting("ste", "Squelch Tail Eliminate (HT to HT)", rs) + basic.append(rset) + + # Menu 40: RP-STE + rs = RadioSettingValueList(RPSTE_LIST, RPSTE_LIST[_settings.rpste]) + rset = RadioSetting("rpste", "Squelch Tail Eliminate (repeater)", rs) + basic.append(rset) + + # Menu 41: RPT-RL + rs = RadioSettingValueList(RPSTE_LIST, RPSTE_LIST[_settings.rptrl]) + rset = RadioSetting("rptrl", "STE Repeater Delay", rs) + basic.append(rset) + + # Menu 38: MENU EXIT TIME + rs = RadioSettingValueList(MENUQUIT_LIST, + MENUQUIT_LIST[_settings.menuquit]) + rset = RadioSetting("menuquit", "Menu Auto Quit", rs) + basic.append(rset) + + # Menu 34: AUTOLOCK + rs = RadioSettingValueList(AUTOLK_LIST, AUTOLK_LIST[_settings.autolk]) + rset = RadioSetting("autolk", "Key Auto Lock", rs) + basic.append(rset) + + # Menu 28: CDCSS SAVE MODE + rs = RadioSettingValueList(QTSAVE_LIST, QTSAVE_LIST[_settings.qtsave]) + rset = RadioSetting("qtsave", "QT Save Type", rs) + basic.append(rset) + + # Menu 45: TX-A/B + rs = RadioSettingValueList(DUALTX_LIST, DUALTX_LIST[_settings.dualtx]) + rset = RadioSetting("dualtx", "Dual TX", rs) + basic.append(rset) + + # Menu 47: AL-MODE + rs = RadioSettingValueList(ALMODE_LIST, ALMODE_LIST[_settings.almode]) + rset = RadioSetting("almode", "Alarm Mode", rs) + basic.append(rset) + + # Menu 11: ROGER + # ========== + # Notice to developers: + # The RT-470 v1.22 firmware expanded the ROGER menu with an additional + # choice, 'TONE1200'. RT-470 radios with a firmware version prior to + # v1.22 will not honor the ROGER menu's 'TONE1200' choice in CHIRP. + # ========== + rs = RadioSettingValueList(ROGER_LIST, ROGER_LIST[_settings.roger]) + rset = RadioSetting("roger", "Roger", rs) + basic.append(rset) + + rs = RadioSettingValueBoolean(_settings.alarmsound) + rset = RadioSetting("alarmsound", "Alarm Sound", rs) + basic.append(rset) + + # Menu 44: TDR + rs = RadioSettingValueBoolean(_settings.tdr) + rset = RadioSetting("tdr", "TDR", rs) + basic.append(rset) + + rs = RadioSettingValueBoolean(not _settings.fmradio) + rset = RadioSetting("fmradio", "FM Radio", rs) + basic.append(rset) + + rs = RadioSettingValueBoolean(_settings.kblock) + rset = RadioSetting("kblock", "KB Lock", rs) + basic.append(rset) + + # Menu 16: BEEP PROMPT + rs = RadioSettingValueBoolean(_settings.beep) + rset = RadioSetting("beep", "Beep", rs) + basic.append(rset) + + if self.MODEL not in ["A36plus", "UV-A37", "AR-730"]: + # Menu 48: RX END TAIL + rs = RadioSettingValueList(TONERXEND_LIST, + TONERXEND_LIST[_settings.rxendtail]) + rset = RadioSetting("rxendtail", "Tone RX End", rs) + basic.append(rset) + + dtmf = RadioSettingGroup("dtmf", "DTMF Settings") + group.append(dtmf) + + 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]) + rs = RadioSettingValueString(0, 5, _code, False) + rs.set_charset(DTMF_CHARS) + rset = RadioSetting("pttid/%i.code" % i, + "PTT-ID Code %i" % (i + 1), rs) + rset.set_apply_callback(apply_code, self._memobj.pttid[i], 5) + dtmf.append(rset) + + rs = RadioSettingValueList(DTMFSPEED_LIST, + DTMFSPEED_LIST[_dtmf.dtmfon]) + rset = RadioSetting("dtmf.dtmfon", "DTMF Speed (on)", rs) + dtmf.append(rset) + + rs = RadioSettingValueList(DTMFSPEED_LIST, + DTMFSPEED_LIST[_dtmf.dtmfoff]) + rset = RadioSetting("dtmf.dtmfoff", "DTMF Speed (off)", rs) + dtmf.append(rset) + + rs = RadioSettingValueList(PTTID_LIST, PTTID_LIST[_dtmf.pttid]) + rset = RadioSetting("dtmf.pttid", "PTT ID", rs) + dtmf.append(rset) + + ani = RadioSettingGroup("ani", "ANI Code List Settings") + group.append(ani) + + def _filter(name): + filtered = "" + for char in str(name): + if char in self._valid_chars: + filtered += char + else: + filtered += " " + return filtered + + end = 60 - self._aninames # end of immutable ANI names + for i in range(0, end): + _codeobj = self._memobj.anicodes[i].code + _code = "".join([DTMF_CHARS[x] for x in _codeobj if int(x) < 0x1F]) + rs = RadioSettingValueString(0, 3, _code, False) + rs.set_charset(DTMF_CHARS) + rset = RadioSetting("anicodes/%i.code" % i, + "ANI Code %i (NUM.%i)" % (i + 1, i + 1), rs) + rset.set_apply_callback(apply_code, self._memobj.anicodes[i], 3) + ani.append(rset) + + for i in range(end, 60): + _codeobj = self._memobj.anicodes[i].code + _code = "".join([DTMF_CHARS[x] for x in _codeobj if int(x) < 0x1F]) + rs = RadioSettingValueString(0, 3, _code, False) + rs.set_charset(DTMF_CHARS) + rset = RadioSetting("anicodes/%i.code" % (i), + "ANI Code %i" % (i + 1), rs) + rset.set_apply_callback(apply_code, + self._memobj.anicodes[i], 3) + ani.append(rset) + + _nameobj = self._memobj.aninames[i - end].name + rs = RadioSettingValueString(0, 10, _filter(_nameobj)) + rset = RadioSetting("aninames/%i.name" % (i - end), + "ANI Code %i Name" % (i + 1), rs) + ani.append(rset) + + if self.MODEL == "A36plus": + custom = RadioSettingGroup("custom", "Custom Channel Names") + group.append(custom) + + for i in range(0, 30): + _nameobj = self._memobj.customnames[i].name + rs = RadioSettingValueString(0, 10, _filter(_nameobj)) + rset = RadioSetting("customnames/%i.name" % i, + "Custom Name %i" % (i + 1), rs) + custom.append(rset) + + if self.MODEL == "A36plus": + # Menu 21: RX END TAIL + rs = RadioSettingValueList(TONERXEND_LIST, + TONERXEND_LIST[_settings.skey3_lp]) + rset = RadioSetting("skey3_lp", "RX End Tail", rs) + basic.append(rset) + + # Menu 23: TAIL PHASE + rs = RadioSettingValueList(TAILPHASE_LIST, + TAILPHASE_LIST[_settings.rxendtail]) + rset = RadioSetting("rxendtail", "Tail Phase", rs) + basic.append(rset) + + return group + + def set_settings(self, settings): + _settings = self._memobj.settings + for element in settings: + if not isinstance(element, RadioSetting): + self.set_settings(element) + continue + else: + try: + name = element.get_name() + if "." in name: + bits = name.split(".") + obj = self._memobj + for bit in bits[:-1]: + if "/" in bit: + bit, index = bit.split("/", 1) + index = int(index) + obj = getattr(obj, bit)[index] + else: + obj = getattr(obj, bit) + setting = bits[-1] + else: + obj = _settings + setting = element.get_name() + + if element.has_apply_callback(): + LOG.debug("Using apply callback") + element.run_apply_callback() + elif setting == "ani": + setattr(obj, setting, int(element.value) - 1) + elif setting == "fmradio": + setattr(obj, setting, not int(element.value)) + elif element.value.get_mutable(): + LOG.debug("Setting %s = %s" % (setting, element.value)) + setattr(obj, setting, element.value) + except Exception as e: + LOG.debug(element.get_name(), e) + raise + + @classmethod + def match_model(cls, filedata, filename): + # This radio has always been post-metadata, so never do + # old-school detection + return False + + +@directory.register +class RT470Radio(JC8810base): + """Radtel RT-470""" + VENDOR = "Radtel" + MODEL = "RT-470" + + # ========== + # Notice to developers: + # The RT-470 support in this driver is currently based upon v1.25 firmware. + # ========== + + _fingerprint = [b"\x00\x00\x00\x26\x00\x20\xD8\x04", + b"\x00\x00\x00\x42\x00\x20\xF0\x04", + b"\x00\x00\x00\x4A\x00\x20\xF8\x04", + b"\x00\x00\x00\x3A\x00\x20\xE8\x04", # fw 1.25A + ] + + VALID_BANDS = [(16000000, 100000000), + (100000000, 136000000), + (136000000, 200000000), + (200000000, 300000000), + (300000000, 400000000), + (400000000, 560000000), + (740000000, 1000000000), + ] + + +@directory.register +class RT470LRadio(JC8810base): + """Radtel RT-470L""" + VENDOR = "Radtel" + MODEL = "RT-470L" + + # ========== + # Notice to developers: + # The RT-470 support in this driver is currently based upon v1.17 firmware. + # ========== + + _fingerprint = [b"\x00\x00\x00\xfe\x00\x20\xAC\x04", + b"\x00\x00\x00\x20\x00\x20\xCC\x04", + b"\x00\x00\x00\x20\x00\x20\x07\x00"] + + POWER_LEVELS = [chirp_common.PowerLevel("H", watts=5.00), + chirp_common.PowerLevel("M", watts=4.00), + chirp_common.PowerLevel("L", watts=2.00)] + + VALID_BANDS = [(108000000, 136000000), + (136000000, 179000000), + (220000000, 260000000), + (330000000, 400000000), + (400000000, 520000000)] + + +@directory.register +class RT470XRadio(RT470LRadio): + """Radtel RT-470X""" + VENDOR = "Radtel" + MODEL = "RT-470X" + + # ========== + # Notice to developers: + # The RT-470 support in this driver is currently based upon v1.18 firmware. + # ========== + + VALID_BANDS = [(100000000, 136000000), + (136000000, 200000000), + (200000000, 300000000), + (300000000, 400000000), + (400000000, 560000000)] + + +@directory.register +class HI8811Radio(RT470LRadio): + """Hiroyasu HI-8811""" + VENDOR = "Hiroyasu" + MODEL = "HI-8811" + + # ========== + # Notice to developers: + # The HI-8811 support in this driver is currently based upon v1.17 + # firmware. + # ========== + + +@directory.register +class UVA37Radio(JC8810base): + """Anysecu UV-A37""" + VENDOR = "Anysecu" + MODEL = "UV-A37" + + # ========== + # Notice to developers: + # The UV-A37 support in this driver is currently based upon v1.24 + # firmware. + # ========== + + POWER_LEVELS = [chirp_common.PowerLevel("H", watts=5.00), + chirp_common.PowerLevel("L", watts=1.00)] + + VALID_BANDS = [(108000000, 136000000), + (136000000, 174000000), + (200000000, 260000000), + (350000000, 390000000), + (400000000, 520000000)] + + _magic = b"PROGRAMJC37U" + _fingerprint = [b"\x00\x00\x00\xE4\x00\x20\x94\x04", + b"\x00\x00\x00\xE8\x00\x20\x98\x04"] + + _ranges = [ + (0x0000, 0x2000), + (0x8000, 0x8040), + (0x9000, 0x9040), + (0xA000, 0xA140), + (0xB000, 0xB440) + ] + _memsize = 0xB440 + + +@directory.register +class A36plusRadio(JC8810base): + """Talkpod A36plus""" + VENDOR = "Talkpod" + MODEL = "A36plus" + + # ========== + # Notice to developers: + # The A36plus support in this driver is currently based upon v1.22 + # firmware. + # ========== + + POWER_LEVELS = [chirp_common.PowerLevel("H", watts=5.00), + chirp_common.PowerLevel("L", watts=1.00)] + + VALID_BANDS = [(108000000, 136000000), + (136000000, 180000000), + (200000000, 260000000), + (350000000, 400000000), + (400000000, 520000000), + ] + + _magic = b"PROGRAMJC37U" + _fingerprint = [b"\x00\x00\x00\x42\x00\x20\xF0\x04", + b"\x00\x00\x00\x5A\x00\x20\x08\x05", # fw 1.18 + b"\x00\x00\x00\x9E\x00\x20\x0C\x05", # fw 1.22 + ] + + _ranges = [ + (0x0000, 0x4000), + (0x8000, 0x8040), + (0x9000, 0x9040), + (0xA000, 0xA140), + (0xB000, 0xB440) + ] + _memsize = 0xB440 + _upper = 512 # fw 1.22 expands from 256 to 512 channels + _aninames = 10 + _mem_params = (_upper, # number of channels + _aninames, # number of aninames + ) + + +@directory.register +class AR730Radio(UVA37Radio): + """Abbree AR730""" + VENDOR = "Abbree" + MODEL = "AR-730" + + # ========== + # Notice to developers: + # The AR-730 support in this driver is currently based upon v1.24 + # firmware. + # ========== + + POWER_LEVELS = [chirp_common.PowerLevel("H", watts=5.00), + chirp_common.PowerLevel("L", watts=1.00)] + + VALID_BANDS = [(108000000, 136000000), + (136000000, 180000000), + (200000000, 260000000), + (350000000, 390000000), + (400000000, 520000000)] diff --git a/chirp/drivers/mursv1.py b/chirp/drivers/mursv1.py index 0e8d996..f53345a 100644 --- a/chirp/drivers/mursv1.py +++ b/chirp/drivers/mursv1.py @@ -14,32 +14,28 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import time -import struct import logging -import re from chirp.drivers import baofeng_common -from chirp import chirp_common, directory, memmap -from chirp import bitwise, errors, util +from chirp import chirp_common, directory +from chirp import bitwise +from chirp import bandplan_na from chirp.settings import RadioSettingGroup, RadioSetting, \ RadioSettingValueBoolean, RadioSettingValueList, \ RadioSettingValueString, RadioSettingValueInteger, \ - RadioSettingValueFloat, RadioSettings, \ - InvalidValueError -from textwrap import dedent + RadioSettingValueFloat, RadioSettings LOG = logging.getLogger(__name__) # #### MAGICS ######################################################### # BTECH MURS-V1 magic string -MSTRING_MURSV1 = "\x50\x5F\x20\x15\x12\x15\x4D" +MSTRING_MURSV1 = b"\x50\x5F\x20\x15\x12\x15\x4D" # #### ID strings ##################################################### # BTECH MURS-V1 -MURSV1_fp1 = "USM2402" +MURSV1_fp1 = b"USM2402" DTMF_CHARS = "0123456789 *#ABCD" @@ -67,8 +63,7 @@ LIST_TXPOWER = ["High", "Low"] LIST_VOICE = ["Off", "English", "Chinese"] LIST_WORKMODE = ["Frequency", "Channel"] -MURS_FREQS = [151.820, 151.880, 151.940, 154.570, 154.600] * 3 -FM_MODE = [3, 4, 8, 9, 13, 14] +MURS_FREQS = bandplan_na.ALL_MURS_FREQS * 3 def model_match(cls, data): @@ -86,6 +81,7 @@ class MURSV1(baofeng_common.BaofengCommonHT): """BTech MURS-V1""" VENDOR = "BTECH" MODEL = "MURS-V1" + NEEDS_COMPAT_SERIAL = False _fileid = [MURSV1_fp1, ] @@ -109,7 +105,7 @@ class MURSV1(baofeng_common.BaofengCommonHT): "!@#$%^&*()+-=[]:\";'<>?,./" LENGTH_NAME = 7 SKIP_VALUES = ["", "S"] - DTCS_CODES = sorted(chirp_common.DTCS_CODES + [645]) + DTCS_CODES = tuple(sorted(chirp_common.DTCS_CODES + (645,))) POWER_LEVELS = [chirp_common.PowerLevel("High", watts=2.00), chirp_common.PowerLevel("Low", watts=.50)] VALID_BANDS = [(151820000, 154600250)] @@ -342,22 +338,18 @@ class MURSV1(baofeng_common.BaofengCommonHT): 'Please save an unedited copy of your first successful\n' 'download to a CHIRP Radio Images(*.img) file.' ) - rp.pre_download = _(dedent("""\ - Follow these instructions to download your info: - - 1 - Turn off your radio - 2 - Connect your interface cable - 3 - Turn on your radio - 4 - Do the download of your radio data - """)) - rp.pre_upload = _(dedent("""\ - Follow this instructions to upload your info: - - 1 - Turn off your radio - 2 - Connect your interface cable - 3 - Turn on your radio - 4 - Do the upload of your radio data - """)) + rp.pre_download = _( + "Follow these instructions to download your info:\n" + "1 - Turn off your radio\n" + "2 - Connect your interface cable\n" + "3 - Turn on your radio\n" + "4 - Do the download of your radio data\n") + rp.pre_upload = _( + "Follow this instructions to upload your info:\n" + "1 - Turn off your radio\n" + "2 - Connect your interface cable\n" + "3 - Turn on your radio\n" + "4 - Do the upload of your radio data\n") return rp def process_mmap(self): @@ -377,8 +369,16 @@ class MURSV1(baofeng_common.BaofengCommonHT): mem = chirp_common.Memory() mem.number = number + if _mem.get_raw()[0] == "\xff": + mem.empty = True + return mem + mem.freq = int(_mem.rxfreq) * 10 + if int(_mem.rxfreq) == int(_mem.txfreq): + mem.duplex = "" + mem.offset = 0 + for char in _nam.name: if str(char) == "\xFF": char = " " # The OEM software may have 0xFF mid-name @@ -460,6 +460,21 @@ class MURSV1(baofeng_common.BaofengCommonHT): self.SCODE_LIST[_mem.scode])) mem.extra.append(rs) + immutable = [] + + if mem.freq in MURS_FREQS: + if mem.number >= 1 and mem.number <= 15: + MURS_FREQ = MURS_FREQS[mem.number - 1] + mem.freq = MURS_FREQ + mem.duplex == '' + mem.offset = 0 + immutable = ["empty", "freq", "duplex", "offset"] + if mem.freq in bandplan_na.MURS_NFM: + mem.mode = "NFM" + immutable += ["mode"] + + mem.immutable = immutable + return mem def _set_mem(self, number): @@ -468,22 +483,20 @@ class MURSV1(baofeng_common.BaofengCommonHT): def _set_nam(self, number): return self._memobj.names[number - 1] - def validate_memory(self, mem): - msgs = baofeng_common.BaofengCommonHT.validate_memory(self, mem) + def set_memory(self, mem): + _mem = self._set_mem(mem.number) + _nam = self._set_nam(mem.number) - if mem.freq != int(MURS_FREQS[mem.number - 1] * 1000000): - msgs.append(chirp_common.ValidationError( - 'Memory location cannot change frequency')) + if mem.empty: + _mem.set_raw("\xff" * 16) + _nam.set_raw("\xff" * 16) + return - if mem.mode == "FM" and (mem.number - 1) not in FM_MODE: - msgs.append(chirp_common.ValidationError( - 'Memory location only supports NFM')) + _mem.set_raw("\x00" * 16) - return msgs + _mem.rxfreq = mem.freq / 10 - def set_memory(self, mem): - _mem = self._set_mem(mem.number) - _nam = self._set_nam(mem.number) + _mem.txfreq = mem.freq / 10 _namelength = self.get_features().valid_name_length for i in range(_namelength): diff --git a/chirp/drivers/puxing.py b/chirp/drivers/puxing.py index f166c48..bc0ddc3 100644 --- a/chirp/drivers/puxing.py +++ b/chirp/drivers/puxing.py @@ -16,7 +16,6 @@ """Puxing radios management module""" import time -import os import logging from chirp import util, chirp_common, bitwise, errors, directory @@ -26,31 +25,33 @@ LOG = logging.getLogger(__name__) def _puxing_prep(radio): - radio.pipe.write("\x02PROGRA") + radio.pipe.write(b"\x02PROGRA") ack = radio.pipe.read(1) - if ack != "\x06": + if ack != b"\x06": raise Exception("Radio did not ACK first command") - radio.pipe.write("M\x02") + radio.pipe.write(b"M\x02") ident = radio.pipe.read(8) if len(ident) != 8: LOG.debug(util.hexprint(ident)) raise Exception("Radio did not send identification") - radio.pipe.write("\x06") - if radio.pipe.read(1) != "\x06": + radio.pipe.write(b"\x06") + if radio.pipe.read(1) != b"\x06": raise Exception("Radio did not ACK ident") def puxing_prep(radio): """Do the Puxing PX-777 identification dance""" + ex = None for _i in range(0, 10): try: return _puxing_prep(radio) - except Exception, e: + except Exception as e: time.sleep(1) + ex = e - raise e + raise ex def puxing_download(radio): @@ -60,7 +61,7 @@ def puxing_download(radio): return do_download(radio, 0x0000, 0x0C60, 0x0008) except errors.RadioError: raise - except Exception, e: + except Exception as e: raise errors.RadioError("Failed to communicate with radio: %s" % e) @@ -71,9 +72,10 @@ def puxing_upload(radio): return do_upload(radio, 0x0000, 0x0C40, 0x0008) except errors.RadioError: raise - except Exception, e: + except Exception as e: raise errors.RadioError("Failed to communicate with radio: %s" % e) + POWER_LEVELS = [chirp_common.PowerLevel("High", watts=5.00), chirp_common.PowerLevel("Low", watts=1.00)] @@ -150,6 +152,7 @@ class Puxing777Radio(chirp_common.CloneModeRadio): """Puxing PX-777""" VENDOR = "Puxing" MODEL = "PX-777" + NEEDS_COMPAT_SERIAL = False def sync_in(self): self._mmap = puxing_download(self) @@ -205,9 +208,9 @@ class Puxing777Radio(chirp_common.CloneModeRadio): def match_model(cls, filedata, filename): # There are PX-777 that says to be model 328 ... return (len(filedata) == 3168 and - (ord(filedata[0x080B]) == PUXING_MODELS[777] or - (ord(filedata[0x080B]) == PUXING_MODELS[328] and - ord(filedata[0x080A]) == 0xEE))) + (util.byte_to_int(filedata[0x080B]) == PUXING_MODELS[777] or + (util.byte_to_int(filedata[0x080B]) == PUXING_MODELS[328] and + util.byte_to_int(filedata[0x080A]) == 0xEE))) def get_memory(self, number): _mem = self._memobj.memory[number - 1] @@ -355,9 +358,9 @@ class Puxing777Radio(chirp_common.CloneModeRadio): def puxing_2r_prep(radio): """Do the Puxing 2R identification dance""" radio.pipe.timeout = 0.2 - radio.pipe.write("PROGRAM\x02") + radio.pipe.write(b"PROGRAM\x02") ack = radio.pipe.read(1) - if ack != "\x06": + if ack != b"\x06": raise Exception("Radio is not responding") radio.pipe.write(ack) @@ -372,7 +375,7 @@ def puxing_2r_download(radio): return do_download(radio, 0x0000, 0x0FE0, 0x0010) except errors.RadioError: raise - except Exception, e: + except Exception as e: raise errors.RadioError("Failed to communicate with radio: %s" % e) @@ -383,9 +386,10 @@ def puxing_2r_upload(radio): return do_upload(radio, 0x0000, 0x0FE0, 0x0010) except errors.RadioError: raise - except Exception, e: + except Exception as e: raise errors.RadioError("Failed to communicate with radio: %s" % e) + PUXING_2R_MEM_FORMAT = """ #seekto 0x0010; struct { @@ -437,7 +441,8 @@ class Puxing2RRadio(chirp_common.CloneModeRadio): @classmethod def match_model(cls, filedata, filename): return (len(filedata) == cls._memsize) and \ - filedata[-16:] != "IcomCloneFormat3" + filedata[-16:] not in ("IcomCloneFormat3", + b'IcomCloneFormat3') def sync_in(self): self._mmap = puxing_2r_download(self) diff --git a/chirp/drivers/puxing_px888k.py b/chirp/drivers/puxing_px888k.py index e091a07..e4b66d7 100644 --- a/chirp/drivers/puxing_px888k.py +++ b/chirp/drivers/puxing_px888k.py @@ -14,7 +14,7 @@ # along with this program. If not, see . from chirp import chirp_common, directory, memmap, \ - bitwise, settings, errors + bitwise, settings, errors, util from struct import pack import logging @@ -432,8 +432,8 @@ else: "u8 _unknown_0CFE[2];") FILE_MAGIC = [0xc40, 0xc50, - '\x50\x58\x38\x38\x38\x44\x00\xff' - '\x13\x40\x17\x60\x40\x00\x48\x00'] + b'\x50\x58\x38\x38\x38\x44\x00\xff' + b'\x13\x40\x17\x60\x40\x00\x48\x00'] HANDSHAKE_OUT = b'XONLINE' HANDSHAKE_IN = [b'PX888D\x00\xff'] @@ -495,7 +495,7 @@ SCRAMBLER_MODES = OFF_INT[0:9] PTT_ID_EDGES = ["Off", "BOT", "EOT", "Both"] OPTSIGN_MODES = ["None", "DTMF", "5-Tone", "MSK"] -VFO_STRIDE = ['5kHz', '6.25kHz', '10kHz', '12.5kHz', '25kHz'] +VFO_STRIDE = ['5 kHz', '6.25 kHz', '10 kHz', '12.5 kHz', '25 kHz'] AB = ['A', 'B'] WATCH_MODES = ['Single watch', 'Dual watch'] AB_MODES = ['VFO', 'Memory index', 'Memory name', 'Memory frequency'] @@ -505,11 +505,11 @@ WAIT_TIMES = [("0.3s", 6), ("0.5s", 10)] +\ BUTTON_MODES = ["Send call list data", "Emergency alarm", - "Send 1750Hz signal", + "Send 1750 Hz signal", "Open squelch"] BOOT_MESSAGE_TYPES = ["Off", "Battery voltage", "Custom message"] TALKBACK = ['Off', 'Chinese', 'English'] -BACKLIGHT_COLORS = zip(["Blue", "Orange", "Purple"], range(1, 4)) +BACKLIGHT_COLORS = list(zip(["Blue", "Orange", "Purple"], range(1, 4))) VOX_GAIN = OFF_INT[0:10] VOX_DELAYS = ['1s', '2s', '3s', '4s'] TRANSMIT_ALARMS = ['Off', '30s', '60s', '90s', '120s', @@ -527,7 +527,8 @@ BACKLIGHT_MODES = ["Off", "Auto", "On"] TONE_RESET_TIME = ['Off'] + ['%ds' % x for x in range(1, 256)] DTMF_TONE_RESET_TIME = TONE_RESET_TIME[0:16] -DTMF_GROUPS = zip(["Off", "A", "B", "C", "D", "*", "#"], [255]+range(10, 16)) +DTMF_GROUPS = list(zip(["Off", "A", "B", "C", "D", "*", "#"], [255] + + list(range(10, 16)))) FIVE_TONE_STANDARDS = ['ZVEI1', 'ZVEI2', 'CCIR1', 'CCITT'] # should mimic the defaults in the memedit MemoryEditor somewhat @@ -540,16 +541,16 @@ SANE_MEMORY_DEFAULT = b"\x14\x61\x00\x00\x14\x61\x00\x00" + \ # these two option sets are listed differently like this in the stock software, # so I'm keeping them separate for now if they are in fact identical # in behaviour, that should probably be amended -DTMF_ALERT_TRANSPOND = zip(['Off', 'Call alert', - 'Transpond-alert', - 'Transpond-ID code'], - [255]+range(1, 4)) -FIVE_TONE_ALERT_TRANSPOND = zip(['Off', 'Alert tone', - 'Transpond', 'Transpond-ID code'], - [255]+range(1, 4)) +DTMF_ALERT_TRANSPOND = list(zip(['Off', 'Call alert', + 'Transpond-alert', + 'Transpond-ID code'], + [255] + list(range(1, 4)))) +FIVE_TONE_ALERT_TRANSPOND = list(zip(['Off', 'Alert tone', + 'Transpond', 'Transpond-ID code'], + [255] + list(range(1, 4)))) -BFM_BANDS = ['87.5-108MHz', '76.0-91.0MHz', '76.0-108.0MHz', '65.0-76.0MHz'] -BFM_STRIDE = ['100kHz', '50kHz'] +BFM_BANDS = ['87.5-108 MHz', '76.0-91.0 MHz', '76.0-108.0 MHz', '65.0-76.0 MHz'] +BFM_STRIDE = ['100 kHz', '50 kHz'] def piperead(pipe, amount): @@ -669,7 +670,7 @@ def show_progress(radio, blockaddr, upper, msg): def do_download(radio): """download from the radio to the memory map""" initial_handshake(radio.pipe, 10) - memory = memmap.MemoryMap(b'\xff'*0x1000) + memory = memmap.MemoryMapBytes(b'\xff'*0x1000) for blockaddr in range(LOWER_READ_BOUND, UPPER_READ_BOUND, BLOCKSIZE): LOG.debug("Reading block "+str(blockaddr)) block = read_block(radio.pipe, blockaddr) @@ -769,7 +770,7 @@ def encode_halfbytes(data, datapad, mapping, fillvalue, fieldlen): for i in range(0, len(data), 2): v = (mapping.index(data[i]) << 4) | mapping.index(data[i+1]) o[i >> 1] = v - return bytearray(o) + return bytearray(util.byte_to_int(b) for b in o) def decode_ffstring(data): @@ -787,7 +788,7 @@ def encode_ffstring(data, fieldlen): extra = fieldlen-len(data) if extra > 0: data += '\xff'*extra - return bytearray(data) + return bytearray([util.byte_to_int(x) for x in data]) def decode_dtmf(data, length): @@ -815,7 +816,7 @@ def encode_5tone(data, fieldlen): def decode_freq(data): - """decode frequency data for the broadcast fm radio memories""" + """decode frequency data for the broadcast FM radio memories""" data_out = '' if data[0] != 0xff: data_out = chirp_common.format_freq( @@ -824,8 +825,8 @@ def decode_freq(data): def encode_freq(data, fieldlen): - """encode frequency data for the broadcast fm radio memories""" - data_out = bytearray('\xff')*fieldlen + """encode frequency data for the broadcast FM radio memories""" + data_out = bytearray(b'\xff')*fieldlen if data != '': data_out = encode_halfbytes((('%%0%di' % (fieldlen << 1)) % int(chirp_common.parse_freq(data)/10)), @@ -835,7 +836,7 @@ def encode_freq(data, fieldlen): def sbyn(s, n): """setting by name""" - return filter(lambda x: x.get_name() == n, s)[0] + return list(filter(lambda x: x.get_name() == n, s))[0] # These helper classes provide a direct link between the value @@ -902,8 +903,9 @@ class MappedListSettingValue(settings.RadioSettingValueMap): """ self._val_mem = val_mem self._autowrite = autowrite + options = list(options) if not isinstance(options[0], tuple): - options = zip(options, range(len(options))) + options = list(zip(options, range(len(options)))) settings.RadioSettingValueMap.__init__( self, options, mem_val=int(val_mem)) @@ -1097,16 +1099,13 @@ class Puxing_PX888K_Radio(chirp_common.CloneModeRadio): VENDOR = "Puxing" MODEL = "PX-888K" BAUD_RATE = 9600 + NEEDS_COMPAT_SERIAL = False @classmethod def match_model(cls, filedata, filename): if len(filedata) == UPPER_READ_BOUND: if filedata[FILE_MAGIC[0]:FILE_MAGIC[1]] == FILE_MAGIC[2]: return True - else: - LOG.debug("The data at 0x0c40 does not match the PX-888K") - else: - LOG.debug("The file size does not match.") return False def get_features(self): @@ -1142,7 +1141,7 @@ class Puxing_PX888K_Radio(chirp_common.CloneModeRadio): rf.valid_name_length = 6 rf.valid_cross_modes = CROSS_MODES rf.memory_bounds = (1, 128) - rf.valid_special_chans = SPECIAL_CHANNELS.keys() + rf.valid_special_chans = list(SPECIAL_CHANNELS.keys()) rf.valid_tuning_steps = [5.0, 6.25, 10.0, 12.5, 25.0] return rf @@ -1229,7 +1228,6 @@ class Puxing_PX888K_Radio(chirp_common.CloneModeRadio): isregular, isvfo, iscall) = self._get_memory_structs(number) mem.number = index - mem.extd_number = designator # handle empty channels if isregular: @@ -1244,6 +1242,7 @@ class Puxing_PX888K_Radio(chirp_common.CloneModeRadio): else: mem.empty = False mem.name = '' + mem.extd_number = designator # get frequency data mem.freq = int(_data.rx_freq)*10 @@ -1378,8 +1377,6 @@ class Puxing_PX888K_Radio(chirp_common.CloneModeRadio): (index, designator, _data, _name, _present, _priority, isregular, isvfo, iscall) = self._get_memory_structs(mem.number) - mem.number = index - mem.extd_number = designator # handle empty channels if mem.empty: @@ -1398,7 +1395,8 @@ class Puxing_PX888K_Radio(chirp_common.CloneModeRadio): if not bool(_present): self._set_sane_defaults(_data) _name.set_value( - encode_ffstring(self.filter_name(mem.name), len(_name))) + encode_ffstring(self.filter_name(mem.name.rstrip()), + len(_name))) _present.set_value(True) _priority.set_value(1-SKIP_MODES.index(mem.skip)) @@ -1828,7 +1826,7 @@ class Puxing_PX888K_Radio(chirp_common.CloneModeRadio): NO_YES), ] - # broadcast fm radio settings + # broadcast FM radio settings broadcast_settings = [ list_setting("band", "Frequency interval", _broadcast.receive_range, diff --git a/chirp/drivers/radioddity_r2.py b/chirp/drivers/radioddity_r2.py index e4b37f0..3359fe7 100644 --- a/chirp/drivers/radioddity_r2.py +++ b/chirp/drivers/radioddity_r2.py @@ -14,7 +14,6 @@ # along with this program. If not, see . import time -import os import struct import logging @@ -22,8 +21,7 @@ from chirp import chirp_common, directory, memmap from chirp import bitwise, errors, util from chirp.settings import RadioSetting, RadioSettingGroup, \ RadioSettingValueInteger, RadioSettingValueList, \ - RadioSettingValueBoolean, RadioSettings, \ - RadioSettingValueString + RadioSettingValueBoolean, RadioSettings LOG = logging.getLogger(__name__) @@ -66,8 +64,8 @@ struct { mode:1, unknown2:1, bclo:1; - u8 unknown3[3]; -} memory[16]; + u8 reserved[3]; +} memory[%(memnum)i]; #seekto 0x03C0; struct { @@ -89,10 +87,10 @@ struct { """ -CMD_ACK = "\x06" -CMD_ALT_ACK = "\x53" -CMD_STX = "\x02" -CMD_ENQ = "\x05" +CMD_ACK = b"\x06" +CMD_ALT_ACK = b"\x53" +CMD_STX = b"\x02" +CMD_ENQ = b"\x05" POWER_LEVELS = [chirp_common.PowerLevel("Low", watts=0.50), chirp_common.PowerLevel("High", watts=3.00)] @@ -101,19 +99,22 @@ SCANMODE_LIST = ["Carrier", "Timer"] VOICE_LIST = ["Off", "Chinese", "English"] VOX_LIST = ["Off"] + ["%s" % x for x in range(1, 9)] VOXDELAY_LIST = ["0.5", "1.0", "1.5", "2.0", "2.5", "3.0"] -MODE_LIST = ["WFM", "NFM"] +MODE_LIST = ["FM", "NFM"] TONES = chirp_common.TONES DTCS_CODES = chirp_common.DTCS_CODES -SETTING_LISTS = { - "tot": TIMEOUT_LIST, - "scanmode": SCANMODE_LIST, - "voice": VOICE_LIST, - "vox": VOX_LIST, - "voxdelay": VOXDELAY_LIST, - "mode": MODE_LIST, - } +FRS16_FREQS = [462562500, 462587500, 462612500, 462637500, + 462662500, 462625000, 462725000, 462687500, + 462712500, 462550000, 462575000, 462600000, + 462650000, 462675000, 462700000, 462725000] + +PMR_FREQS1 = [446006250, 446018750, 446031250, 446043750, 446056250, + 446068750, 446081250, 446093750] +PMR_FREQS2 = [446106250, 446118750, 446131250, 446143750, 446156250, + 446168750, 446181250, 446193750] + +PMR_FREQS = PMR_FREQS1 + PMR_FREQS2 VALID_CHARS = chirp_common.CHARSET_ALPHANUMERIC + \ "`{|}!\"#$%&'()*+,-./:;<=>?@[]^_" @@ -122,12 +123,12 @@ VALID_CHARS = chirp_common.CHARSET_ALPHANUMERIC + \ def _r2_enter_programming_mode(radio): serial = radio.pipe - magic = "TYOGRAM" + magic = b"TYOGRAM" exito = False serial.write(CMD_STX) for i in range(0, 5): for j in range(0, len(magic)): - serial.write(magic[j]) + serial.write(magic[j:j + 1]) ack = serial.read(1) if ack == CMD_ACK: exito = True @@ -174,7 +175,7 @@ def _r2_enter_programming_mode(radio): raise errors.RadioError("Error communicating with radio") # we will only read if no password is set - if ack != "\xFF\xFF\xFF\xFF\xFF\xFF": + if ack != b"\xFF\xFF\xFF\xFF\xFF\xFF": _r2_exit_programming_mode(radio) raise errors.RadioError("Radio is password protected") try: @@ -201,13 +202,14 @@ def _r2_exit_programming_mode(radio): def _r2_read_block(radio, block_addr, block_size): serial = radio.pipe - cmd = struct.pack(">cHb", 'R', block_addr, block_size) - expectedresponse = "W" + cmd[1:] + cmd = struct.pack(">cHb", b'R', block_addr, block_size) + expectedresponse = b"W" + cmd[1:] LOG.debug("Reading block %04x..." % (block_addr)) try: for j in range(0, len(cmd)): - serial.write(cmd[j]) + time.sleep(0.005) + serial.write(cmd[j:j + 1]) response = serial.read(4 + block_size) if response[:4] != expectedresponse: @@ -216,6 +218,7 @@ def _r2_read_block(radio, block_addr, block_size): block_data = response[4:] + time.sleep(0.005) serial.write(CMD_ACK) ack = serial.read(1) except: @@ -232,7 +235,7 @@ def _r2_read_block(radio, block_addr, block_size): def _r2_write_block(radio, block_addr, block_size): serial = radio.pipe - cmd = struct.pack(">cHb", 'W', block_addr, block_size) + cmd = struct.pack(">cHb", b'W', block_addr, block_size) data = radio.get_mmap()[block_addr:block_addr + block_size] LOG.debug("Writing block %04x..." % (block_addr)) @@ -240,9 +243,9 @@ def _r2_write_block(radio, block_addr, block_size): try: for j in range(0, len(cmd)): - serial.write(cmd[j]) + serial.write(cmd[j:j + 1]) for j in range(0, len(data)): - serial.write(data[j]) + serial.write(data[j:j + 1]) if serial.read(1) != CMD_ACK: raise Exception("No ACK") except: @@ -255,7 +258,7 @@ def do_download(radio): LOG.debug("download") _r2_enter_programming_mode(radio) - data = "" + data = b"" status = chirp_common.Status() status.msg = "Cloning from radio" @@ -273,11 +276,9 @@ def do_download(radio): LOG.debug("Address: %04x" % addr) LOG.debug(util.hexprint(block)) - data += radio.MODEL.ljust(8) - _r2_exit_programming_mode(radio) - return memmap.MemoryMap(data) + return memmap.MemoryMapBytes(data) def do_upload(radio): @@ -298,11 +299,13 @@ def do_upload(radio): _r2_exit_programming_mode(radio) +@directory.register class RadioddityR2(chirp_common.CloneModeRadio): """Radioddity R2""" VENDOR = "Radioddity" MODEL = "R2" BAUD_RATE = 9600 + NEEDS_COMPAT_SERIAL = False # definitions on how to read StartAddr EndAddr BlockZize _ranges = [ @@ -312,10 +315,15 @@ class RadioddityR2(chirp_common.CloneModeRadio): _memsize = 0x03F0 # never read more than 8 bytes at once _block_size = 0x08 - # frequency range is 400-470MHz + # frequency range is 400-470 MHz _range = [400000000, 470000000] # maximum 16 channels _upper = 16 + _mem_params = { + 'memnum': _upper, # number of channels + } + + _frs16 = _pmr = False def get_features(self): rf = chirp_common.RadioFeatures() @@ -347,7 +355,7 @@ class RadioddityR2(chirp_common.CloneModeRadio): "DTCS->", "DTCS->DTCS"] rf.valid_power_levels = POWER_LEVELS - rf.valid_skips = [] + rf.valid_skips = ["", "S"] rf.valid_bands = [self._range] rf.memory_bounds = (1, self._upper) rf.valid_tuning_steps = [2.5, 5.0, 6.25, 10.0, 12.5, 25.0] @@ -355,7 +363,7 @@ class RadioddityR2(chirp_common.CloneModeRadio): def process_mmap(self): """Process the mem map into the mem object""" - self._memobj = bitwise.parse(MEM_FORMAT, self._mmap) + self._memobj = bitwise.parse(MEM_FORMAT % self._mem_params, self._mmap) # to set the vars on the class to the correct ones def sync_in(self): @@ -436,6 +444,16 @@ class RadioddityR2(chirp_common.CloneModeRadio): mem.freq = int(_mem.rx_freq) * 10 + # We'll consider any blank (i.e. 0 MHz frequency) to be empty + if mem.freq == 0: + mem.empty = True + return mem + + if _mem.rx_freq.get_raw() == "\xFF\xFF\xFF\xFF": + mem.freq = 0 + mem.empty = True + return mem + txfreq = int(_mem.tx_freq) * 10 if txfreq == mem.freq: mem.duplex = "" @@ -462,18 +480,15 @@ class RadioddityR2(chirp_common.CloneModeRadio): rxtone = self.decode_tone(_mem.rx_tone) chirp_common.split_tone_decode(mem, txtone, rxtone) + if not _mem.scanadd: + mem.skip = "S" + mem.power = POWER_LEVELS[_mem.power] # add extra channel settings to the OTHER tab of the properties # extra settings are unfortunately inverted mem.extra = RadioSettingGroup("extra", "Extra") - scanadd = RadioSetting("scanadd", "Scan Add", - RadioSettingValueBoolean( - not bool(_mem.scanadd))) - scanadd.set_doc("Add channel for scanning") - mem.extra.append(scanadd) - bclo = RadioSetting("bclo", "Busy Lockout", RadioSettingValueBoolean(not bool(_mem.bclo))) bclo.set_doc("Busy Lockout") @@ -490,6 +505,31 @@ class RadioddityR2(chirp_common.CloneModeRadio): compand.set_doc("Compress Audio for TX") mem.extra.append(compand) + immutable = [] + + if self._frs16: + if mem.freq in FRS16_FREQS: + if mem.number >= 1 and mem.number <= 16: + FRS_FREQ = FRS16_FREQS[mem.number - 1] + mem.freq = FRS_FREQ + mem.duplex == '' + mem.offset = 0 + mem.mode = "NFM" + immutable = ["empty", "freq", "duplex", "offset", "mode"] + elif self._pmr: + if mem.freq in PMR_FREQS: + if mem.number >= 1 and mem.number <= 16: + PMR_FREQ = PMR_FREQS[mem.number - 1] + mem.freq = PMR_FREQ + mem.duplex = '' + mem.offset = 0 + mem.mode = "NFM" + mem.power = POWER_LEVELS[0] + immutable = ["empty", "freq", "duplex", "offset", "mode", + "power"] + + mem.immutable = immutable + return mem def set_memory(self, mem): @@ -501,8 +541,10 @@ class RadioddityR2(chirp_common.CloneModeRadio): # Get a low-level memory object mapped to the image _mem = self._memobj.memory[mem.number - 1] - LOG.warning('This driver may be broken for deleted memories') + _rsvd = _mem.reserved.get_raw() + if mem.empty: + _mem.set_raw("\xFF" * 13 + _rsvd) return _mem.rx_freq = mem.freq / 10 @@ -529,6 +571,7 @@ class RadioddityR2(chirp_common.CloneModeRadio): self.encode_tone(_mem.tx_tone, txmode, txtone, txpol) self.encode_tone(_mem.rx_tone, rxmode, rxtone, rxpol) + _mem.scanadd = mem.skip != "S" _mem.mode = MODE_LIST.index(mem.mode) # extra settings are unfortunately inverted @@ -611,7 +654,7 @@ class RadioddityR2(chirp_common.CloneModeRadio): LOG.debug("Setting %s = %s" % (setting, element.value)) setattr(obj, setting, element.value) - except Exception as e: + except Exception: LOG.debug(element.get_name()) raise @@ -622,11 +665,36 @@ class RadioddityR2(chirp_common.CloneModeRadio): return False -class RT24Alias(chirp_common.Alias): +@directory.register +class RetevisRT24(RadioddityR2): + """Retevis RT24""" VENDOR = "Retevis" MODEL = "RT24" + _pmr = False # sold as PMR radio but supports full band TX/RX + + +@directory.register +class RetevisRT24V(RadioddityR2): + """Retevis RT24V""" + VENDOR = "Retevis" + MODEL = "RT24V" + + # sold as FreeNet radio but supports full band TX/RX + + # frequency range is 136-174 MHz + _range = [136000000, 174000000] + # maximum 6 channels + _upper = 6 + _mem_params = { + 'memnum': _upper, # number of channels + } + @directory.register -class RadioddityR2Generic(RadioddityR2): - ALIASES = [RT24Alias] +class RetevisH777S(RadioddityR2): + """Retevis H777S""" + VENDOR = "Retevis" + MODEL = "H777S" + + _frs16 = False # sold as FRS radio but supports full band TX/RX diff --git a/chirp/drivers/radtel_t18.py b/chirp/drivers/radtel_t18.py index 0e47396..5401511 100644 --- a/chirp/drivers/radtel_t18.py +++ b/chirp/drivers/radtel_t18.py @@ -13,10 +13,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import time -import os import struct -import unittest import logging from chirp import chirp_common, directory, memmap @@ -34,7 +31,7 @@ struct { lbcd txfreq[4]; lbcd rxtone[2]; lbcd txtone[2]; - u8 speccode:1, + u8 speccode:1, // Retevis RB87 PTT ID compander:1, scramble:1, skip:1, @@ -46,18 +43,19 @@ struct { } memory[%d]; #seekto 0x03C0; struct { - u8 unknown1:1, + u8 codesw:1, // Retevis RB29 code switch scanmode:1, vox:1, // Retevis RB19 VOX speccode:1, voiceprompt:2, batterysaver:1, - beep:1; + beep:1; // Retevis RB87 vox u8 squelchlevel; u8 sidekey2; // Retevis RT22S setting // Retevis RB85 sidekey 1 short // Retevis RB19 sidekey 2 long // Retevis RT47 sidekey 1 long + // Retevis RB87 sidekey 1 long u8 timeouttimer; u8 voxlevel; u8 sidekey2S; @@ -134,10 +132,12 @@ struct { } settings; """ -CMD_ACK = "\x06" +CMD_ACK = b"\x06" VOICE_LIST = ["Off", "Chinese", "English"] VOICE_LIST2 = ["English", "Chinese"] +VOICE_LIST3 = ["Off", "English", "Chinese"] +VOICE_LIST4 = ["Chinese", "English"] TIMEOUTTIMER_LIST = ["Off", "30 seconds", "60 seconds", "90 seconds", "120 seconds", "150 seconds", "180 seconds", "210 seconds", "240 seconds", "270 seconds", @@ -148,6 +148,7 @@ VOXDELAY_LIST = ["0.5 seconds", "1.0 seconds", "1.5 seconds", "2.0 seconds", "2.5 seconds", "3.0 seconds"] SIDEKEY19_LIST = ["Off", "Scan", "Emergency Alarm"] SIDEKEY2_LIST = SIDEKEY19_LIST + ["Display Battery"] +SIDEKEY29_LIST = ["Off", "Scan", "VOX", "Busy Lock", "Emergency Alarm"] SIDEKEY85SHORT_LIST = ["Off", "Noise Cansellation On", @@ -183,52 +184,36 @@ SIDEKEYV8A_LIST = ["Off", "Monitor", "High/Low Power", "Alarm"] - -SETTING_LISTS = { - "voiceprompt": VOICE_LIST, - "language": VOICE_LIST2, - "timeouttimer": TIMEOUTTIMER_LIST, - "scanmode": SCANMODE_LIST, - "voxlevel": VOXLEVEL_LIST, - "voxdelay": VOXDELAY_LIST, - "sidekey2": SIDEKEY2_LIST, - "sidekey2": SIDEKEY19_LIST, - "sidekey2": SIDEKEY85SHORT_LIST, - "sidekey2": SIDEKEYV8A_LIST, - "sidekey1L": SIDEKEY85LONG_LIST, - "sidekey2S": SIDEKEY85SHORT_LIST, - "sidekey2L": SIDEKEY85LONG_LIST, - "speccode": SPECCODE_LIST -} - -FRS_FREQS1 = [462.5625, 462.5875, 462.6125, 462.6375, 462.6625, - 462.6875, 462.7125] -FRS_FREQS2 = [467.5625, 467.5875, 467.6125, 467.6375, 467.6625, - 467.6875, 467.7125] -FRS_FREQS3 = [462.5500, 462.5750, 462.6000, 462.6250, 462.6500, - 462.6750, 462.7000, 462.7250] +SIDEKEY87_LIST = ["Scan", "Emergency Alarm"] + +FRS_FREQS1 = [462562500, 462587500, 462612500, 462637500, 462662500, + 462687500, 462712500] +FRS_FREQS2 = [467562500, 467587500, 467612500, 467637500, 467662500, + 467687500, 467712500] +FRS_FREQS3 = [462550000, 462575000, 462600000, 462625000, 462650000, + 462675000, 462700000, 462725000] FRS_FREQS = FRS_FREQS1 + FRS_FREQS2 + FRS_FREQS3 -FRS16_FREQS = [462.5625, 462.5875, 462.6125, 462.6375, - 462.6625, 462.6250, 462.7250, 462.6875, - 462.7125, 462.5500, 462.5750, 462.6000, - 462.6500, 462.6750, 462.7000, 462.7250] +FRS16_FREQS = [462562500, 462587500, 462612500, 462637500, + 462662500, 462625000, 462725000, 462687500, + 462712500, 462550000, 462575000, 462600000, + 462650000, 462675000, 462700000, 462725000] GMRS_FREQS = FRS_FREQS1 + FRS_FREQS2 + FRS_FREQS3 * 2 -MURS_FREQS = [151.820, 151.880, 151.940, 154.570, 154.600] +MURS_FREQS = [151820000, 151880000, 151940000, 154570000, 154600000] -PMR_FREQS1 = [446.00625, 446.01875, 446.03125, 446.04375, 446.05625, - 446.06875, 446.08125, 446.09375] -PMR_FREQS2 = [446.10625, 446.11875, 446.13125, 446.14375, 446.15625, - 446.16875, 446.18125, 446.19375] +PMR_FREQS1 = [446006250, 446018750, 446031250, 446043750, 446056250, + 446068750, 446081250, 446093750] +PMR_FREQS2 = [446106250, 446118750, 446131250, 446143750, 446156250, + 446168750, 446181250, 446193750] PMR_FREQS = PMR_FREQS1 + PMR_FREQS2 def _t18_enter_programming_mode(radio): serial = radio.pipe - _magic = "\x02" + radio._magic + _magic = b"\x02" + radio._magic try: serial.write(_magic) @@ -244,16 +229,20 @@ def _t18_enter_programming_mode(radio): raise errors.RadioError("Radio refused to enter programming mode") try: - serial.write("\x02") + serial.write(b"\x02") if radio._echo: serial.read(1) # Chew the echo ident = serial.read(8) except: raise errors.RadioError("Error communicating with radio") - if not ident.startswith(radio._fingerprint): - LOG.debug(util.hexprint(ident)) - raise errors.RadioError("Radio returned unknown identification string") + # check if ident is OK + for fp in radio._fingerprint: + if ident.startswith(fp): + break + else: + LOG.debug("Incorrect model ID, got this:\n\n" + util.hexprint(ident)) + raise errors.RadioError("Radio identification failed.") try: serial.write(CMD_ACK) @@ -264,7 +253,7 @@ def _t18_enter_programming_mode(radio): raise errors.RadioError("Error communicating with radio") if radio.MODEL == "RT647": - if ack != "\xF0": + if ack != b"\xF0": raise errors.RadioError("Radio refused to enter programming mode") else: if ack != CMD_ACK: @@ -284,8 +273,8 @@ def _t18_exit_programming_mode(radio): def _t18_read_block(radio, block_addr, block_size): serial = radio.pipe - cmd = struct.pack(">cHb", 'R', block_addr, block_size) - expectedresponse = "W" + cmd[1:] + cmd = struct.pack(">cHb", b'R', block_addr, block_size) + expectedresponse = b"W" + cmd[1:] LOG.debug("Reading block %04x..." % (block_addr)) try: @@ -316,7 +305,7 @@ def _t18_read_block(radio, block_addr, block_size): def _t18_write_block(radio, block_addr, block_size): serial = radio.pipe - cmd = struct.pack(">cHb", 'W', block_addr, block_size) + cmd = struct.pack(">cHb", b'W', block_addr, block_size) data = radio.get_mmap()[block_addr:block_addr + block_size] LOG.debug("Writing Data:") @@ -337,7 +326,7 @@ def do_download(radio): LOG.debug("download") _t18_enter_programming_mode(radio) - data = "" + data = b"" status = chirp_common.Status() status.msg = "Cloning from radio" @@ -357,7 +346,7 @@ def do_download(radio): _t18_exit_programming_mode(radio) - return memmap.MemoryMap(data) + return memmap.MemoryMapBytes(data) def do_upload(radio): @@ -394,14 +383,15 @@ class T18Radio(chirp_common.CloneModeRadio): VENDOR = "Radtel" MODEL = "T18" BAUD_RATE = 9600 + NEEDS_COMPAT_SERIAL = False BLOCK_SIZE = 0x08 - CMD_EXIT = "b" + CMD_EXIT = b"b" ACK_BLOCK = True VALID_BANDS = [(400000000, 470000000)] - _magic = "1ROGRAM" - _fingerprint = "SMP558" + "\x00\x00" + _magic = b"1ROGRAM" + _fingerprint = [b"SMP558" + b"\x00\x00"] _upper = 16 _mem_params = (_upper # number of channels ) @@ -416,7 +406,7 @@ class T18Radio(chirp_common.CloneModeRadio): def get_features(self): rf = chirp_common.RadioFeatures() rf.has_settings = True - rf.valid_modes = ["NFM", "FM"] # 12.5 KHz, 25 kHz. + rf.valid_modes = ["NFM", "FM"] # 12.5 kHz, 25 kHz. rf.valid_skips = ["", "S"] rf.valid_tmodes = ["", "Tone", "TSQL", "DTCS", "Cross"] rf.valid_duplexes = ["", "-", "+", "split", "off"] @@ -490,7 +480,7 @@ class T18Radio(chirp_common.CloneModeRadio): mem.number = number mem.freq = int(_mem.rxfreq) * 10 - # We'll consider any blank (i.e. 0MHz frequency) to be empty + # We'll consider any blank (i.e. 0 MHz frequency) to be empty if mem.freq == 0: mem.empty = True return mem @@ -526,8 +516,10 @@ class T18Radio(chirp_common.CloneModeRadio): RadioSettingValueBoolean(not _mem.bcl)) mem.extra.append(rs) if self.MODEL != "RB18" and self.MODEL != "RB618" and \ - self.MODEL != "FRS-B1" and self.MODEL != "BF-V8A": - if self.MODEL != "RT47V": + self.MODEL != "FRS-B1" and self.MODEL != "BF-V8A" and \ + self.MODEL != "RB29" and self.MODEL != "RB629": + if self.MODEL not in ["RB87", + "RT47V"]: rs = RadioSetting("scramble", "Scramble", RadioSettingValueBoolean(not _mem.scramble)) mem.extra.append(rs) @@ -537,9 +529,89 @@ class T18Radio(chirp_common.CloneModeRadio): if self.MODEL != "RT47V" and self.MODEL != "T8" and \ self.MODEL != "RB17" and self.MODEL != "RB617" and \ self.MODEL != "RB75" and self.MODEL != "RB19P": - rs = RadioSetting("speccode", "Spec Code", - RadioSettingValueBoolean(not _mem.speccode)) - mem.extra.append(rs) + if self.MODEL == "RB87": + rs = RadioSettingValueBoolean(not _mem.speccode) + rset = RadioSetting("speccode", "PTT-ID", rs) + mem.extra.append(rset) + else: + rs = RadioSettingValueBoolean(not _mem.speccode) + rset = RadioSetting("speccode", "Spec Code", rs) + mem.extra.append(rset) + + immutable = [] + + if self._frs: + if mem.freq in FRS_FREQS: + if mem.number >= 1 and mem.number <= 22: + FRS_FREQ = FRS_FREQS[mem.number - 1] + mem.freq = FRS_FREQ + mem.duplex = '' + mem.offset = 0 + mem.mode = "NFM" + if mem.number >= 8 and mem.number <= 14: + mem.power = self.POWER_LEVELS[1] + immutable = ["empty", "freq", "duplex", "offset", "mode", + "power"] + else: + immutable = ["empty", "freq", "duplex", "offset", "mode"] + elif self._frs16: + if mem.freq in FRS16_FREQS: + if mem.number >= 1 and mem.number <= 16: + FRS_FREQ = FRS16_FREQS[mem.number - 1] + mem.freq = FRS_FREQ + mem.duplex = '' + mem.offset = 0 + mem.mode = "NFM" + immutable = ["empty", "freq", "duplex", "offset", "mode"] + elif self._murs: + if mem.freq in MURS_FREQS: + if mem.number >= 1 and mem.number <= 5: + MURS_FREQ = MURS_FREQS[mem.number - 1] + mem.freq = MURS_FREQ + mem.duplex = '' + mem.offset = 0 + if mem.number <= 3: + mem.mode = "NFM" + immutable = ["empty", "freq", "duplex", "offset", "mode"] + else: + immutable = ["empty", "freq", "duplex", "offset"] + elif self._pmr: + if mem.freq in PMR_FREQS: + if mem.number >= 1 and mem.number <= 16: + PMR_FREQ = PMR_FREQS[mem.number - 1] + mem.freq = PMR_FREQ + mem.duplex = '' + mem.offset = 0 + mem.mode = "NFM" + mem.power = self.POWER_LEVELS[1] + immutable = ["empty", "freq", "duplex", "offset", "mode", + "power"] + elif self._gmrs: + if mem.freq in GMRS_FREQS: + if mem.number >= 1 and mem.number <= 30: + GMRS_FREQ = GMRS_FREQS[mem.number - 1] + mem.freq = GMRS_FREQ + immutable = ["freq"] + if mem.number >= 1 and mem.number <= 7: + mem.duplex = '' + mem.offset = 0 + immutable += ["duplex", "offset"] + elif mem.number >= 8 and mem.number <= 14: + mem.duplex = '' + mem.offset = 0 + mem.mode = "NFM" + mem.power = self.POWER_LEVELS[1] + immutable += ["duplex", "offset", "mode", "power"] + elif mem.number >= 15 and mem.number <= 22: + mem.duplex = '' + mem.offset = 0 + immutable += ["duplex", "offset"] + elif mem.number >= 23 and mem.number <= 30: + mem.duplex = '+' + mem.offset = 5000000 + immutable += ["duplex", "offset"] + + mem.immutable = immutable return mem @@ -552,48 +624,10 @@ class T18Radio(chirp_common.CloneModeRadio): return - _mem.set_raw("\x00" * 12 + "\xF9\xFF\xFF\xFF") - - if self._gmrs: - GMRS_FREQ = int(GMRS_FREQS[mem.number - 1] * 1000000) - mem.freq = GMRS_FREQ - if mem.number <= 22: - mem.duplex = '' - mem.offset = 0 - if mem.number >= 8 and mem.number <= 14: - mem.mode = "NFM" - mem.power = self.POWER_LEVELS[1] - if mem.number > 22: - mem.duplex = '+' - mem.offset = 5000000 - if self._frs: - FRS_FREQ = int(FRS_FREQS[mem.number - 1] * 1000000) - mem.freq = FRS_FREQ - mem.mode = "NFM" - mem.duplex = '' - mem.offset = 0 - if mem.number >= 8 and mem.number <= 14: - mem.power = self.POWER_LEVELS[1] - if self._frs16: - FRS_FREQ = int(FRS16_FREQS[mem.number - 1] * 1000000) - mem.freq = FRS_FREQ - mem.mode = "NFM" - mem.duplex = '' - mem.offset = 0 - if self._murs: - MURS_FREQ = int(MURS_FREQS[mem.number - 1] * 1000000) - mem.freq = MURS_FREQ - if mem.number <= 3: - mem.mode = "NFM" - mem.duplex = '' - mem.offset = 0 - if self._pmr: - PMR_FREQ = int(PMR_FREQS[mem.number - 1] * 1000000) - mem.freq = PMR_FREQ - mem.duplex = '' - mem.offset = 0 - mem.mode = "NFM" - mem.power = self.POWER_LEVELS[1] + if self.MODEL == "BF-V8A": + _mem.set_raw("\x00" * 12 + "\x09\xFF\xFF\xFF") + else: + _mem.set_raw("\x00" * 12 + "\xF9\xFF\xFF\xFF") _mem.rxfreq = mem.freq / 10 @@ -657,7 +691,13 @@ class T18Radio(chirp_common.CloneModeRadio): SCANMODE_LIST[_settings.scanmode])) basic.append(rs) - if self.MODEL == "RT22S": + if self.MODEL == "RT20": + rs = RadioSetting("voiceprompt", "Voice prompts", + RadioSettingValueList( + VOICE_LIST4, + VOICE_LIST4[_settings.voiceprompt])) + basic.append(rs) + elif self.MODEL == "RT22S": rs = RadioSetting("voiceprompt", "Voice prompts", RadioSettingValueBoolean(_settings.voiceprompt)) basic.append(rs) @@ -669,18 +709,30 @@ class T18Radio(chirp_common.CloneModeRadio): rs = RadioSetting("settings2.voicesw", "Voice prompts", RadioSettingValueBoolean(_settings2.voicesw)) basic.append(rs) - else: + elif self.MODEL == "RT15": rs = RadioSetting("voiceprompt", "Voice prompts", RadioSettingValueList( - VOICE_LIST, - VOICE_LIST[_settings.voiceprompt])) + VOICE_LIST3, + VOICE_LIST3[_settings.voiceprompt])) basic.append(rs) + else: + if self.MODEL != "RB87": + rs = RadioSetting("voiceprompt", "Voice prompts", + RadioSettingValueList( + VOICE_LIST, + VOICE_LIST[_settings.voiceprompt])) + basic.append(rs) rs = RadioSetting("batterysaver", "Battery saver", RadioSettingValueBoolean(_settings.batterysaver)) basic.append(rs) - if self.MODEL != "RB75": + if self.MODEL not in ["RB29", + "RB75", + "RB87", + "RB629", + "RT15" + ]: rs = RadioSetting("beep", "Beep", RadioSettingValueBoolean(_settings.beep)) basic.append(rs) @@ -691,6 +743,11 @@ class T18Radio(chirp_common.CloneModeRadio): RadioSettingValueBoolean(_settings.vox)) basic.append(rs) + if self.MODEL == "RB87": + rs = RadioSetting("beep", "VOX", + RadioSettingValueBoolean(_settings.beep)) + basic.append(rs) + if self.MODEL != "RB18" and self.MODEL != "RB618" \ and self.MODEL != "FRS-B1" \ and self.MODEL != "BF-V8A": @@ -812,6 +869,13 @@ class T18Radio(chirp_common.CloneModeRadio): RadioSettingValueBoolean(_settings.power10w)) basic.append(rs) + if self.MODEL == "RB87": + rs = RadioSetting("sidekey2", "Side Key 1(Long)", + RadioSettingValueList( + SIDEKEY87_LIST, + SIDEKEY87_LIST[_settings.sidekey2])) + basic.append(rs) + if self.MODEL == "FRS-B1": rs = RadioSetting("settings2.hivoltnotx", "High Voltage Inhibit TX", @@ -896,6 +960,23 @@ class T18Radio(chirp_common.CloneModeRadio): 1, 5, _settings2.voxgain)) basic.append(rs) + if self.MODEL == "RB29" or self.MODEL == "RB629": + rs = RadioSetting("codesw", "Code Switch", + RadioSettingValueBoolean(_settings.codesw)) + basic.append(rs) + + rs = RadioSetting("sidekey2S", "Side Key(Short)", + RadioSettingValueList( + SIDEKEY29_LIST, + SIDEKEY29_LIST[_settings.sidekey2S])) + basic.append(rs) + + rs = RadioSetting("sidekey2L", "Side Key(Long)", + RadioSettingValueList( + SIDEKEY29_LIST, + SIDEKEY29_LIST[_settings.sidekey2L])) + basic.append(rs) + return top def set_settings(self, settings): @@ -923,7 +1004,7 @@ class T18Radio(chirp_common.CloneModeRadio): else: LOG.debug("Setting %s = %s" % (setting, element.value)) setattr(obj, setting, element.value) - except Exception as e: + except Exception: LOG.debug(element.get_name()) raise @@ -950,6 +1031,24 @@ class T18Radio(chirp_common.CloneModeRadio): return False +@directory.register +class RT20Radio(T18Radio): + """RETEVIS RT20""" + VENDOR = "Retevis" + MODEL = "RT20" + ACK_BLOCK = True + BLOCK_SIZE = 0x08 + + POWER_LEVELS = [chirp_common.PowerLevel("High", watts=2.00), + chirp_common.PowerLevel("Low", watts=0.50)] + + _magic = b"8AOGRAM" + _fingerprint = [b"SMP558" + b"\x02"] + _upper = 16 + _mem_params = (_upper # number of channels + ) + + @directory.register class RT22SRadio(T18Radio): """RETEVIS RT22S""" @@ -960,8 +1059,8 @@ class RT22SRadio(T18Radio): POWER_LEVELS = [chirp_common.PowerLevel("High", watts=2.00), chirp_common.PowerLevel("Low", watts=0.50)] - _magic = "9COGRAM" - _fingerprint = "SMP558" + "\x02" + _magic = b"9COGRAM" + _fingerprint = [b"SMP558" + b"\x02"] _upper = 22 _mem_params = (_upper # number of channels ) @@ -975,13 +1074,13 @@ class RB18Radio(T18Radio): VENDOR = "Retevis" MODEL = "RB18" BLOCK_SIZE = 0x10 - CMD_EXIT = "E" + CMD_EXIT = b"E" POWER_LEVELS = [chirp_common.PowerLevel("High", watts=2.00), chirp_common.PowerLevel("Low", watts=0.50)] - _magic = "PROGRAL" - _fingerprint = "P3107" + "\xF7" + _magic = b"PROGRAL" + _fingerprint = [b"P3107" + b"\xF7"] _upper = 22 _mem_params = (_upper # number of channels ) @@ -1023,13 +1122,13 @@ class RT68Radio(T18Radio): VENDOR = "Retevis" MODEL = "RT68" ACK_BLOCK = False - CMD_EXIT = "" + CMD_EXIT = b"" POWER_LEVELS = [chirp_common.PowerLevel("High", watts=2.00), chirp_common.PowerLevel("Low", watts=0.50)] - _magic = "83OGRAM" - _fingerprint = "\x06\x00\x00\x00\x00\x00\x00\x00" + _magic = b"83OGRAM" + _fingerprint = [b"\x06\x00\x00\x00\x00\x00\x00\x00"] _upper = 16 _mem_params = (_upper # number of channels ) @@ -1049,7 +1148,7 @@ class RT668Radio(RT68Radio): VENDOR = "Retevis" MODEL = "RT668" - _frs = False + _frs16 = False _pmr = True @@ -1059,8 +1158,8 @@ class RB17Radio(RT68Radio): VENDOR = "Retevis" MODEL = "RB17" - _magic = "A5OGRAM" - _fingerprint = "\x53\x00\x00\x00\x00\x00\x00\x00" + _magic = b"A5OGRAM" + _fingerprint = [b"\x53\x00\x00\x00\x00\x00\x00\x00"] _frs16 = True _pmr = False @@ -1073,7 +1172,7 @@ class RB617Radio(RB17Radio): VENDOR = "Retevis" MODEL = "RB617" - _frs = False + _frs16 = False _pmr = True _murs = False @@ -1088,7 +1187,7 @@ class RB17VRadio(RB17Radio): _upper = 5 - _frs = False + _frs16 = False _pmr = False _murs = True @@ -1103,8 +1202,8 @@ class RB85Radio(T18Radio): POWER_LEVELS = [chirp_common.PowerLevel("High", watts=10.00), chirp_common.PowerLevel("Low", watts=5.00)] - _magic = "H19GRAM" - _fingerprint = "SMP558" + "\x02" + _magic = b"H19GRAM" + _fingerprint = [b"SMP558" + b"\x02"] @directory.register @@ -1117,12 +1216,12 @@ class RB75Radio(T18Radio): POWER_LEVELS = [chirp_common.PowerLevel("High", watts=5.00), chirp_common.PowerLevel("Low", watts=0.50)] - _magic = "KVOGRAM" - _fingerprint = "SMP558" + "\x00" + _magic = b"KVOGRAM" + _fingerprint = [b"SMP558" + b"\x00"] _upper = 30 _mem_params = (_upper # number of channels ) - _gmrs = True + _gmrs = False # sold as GMRS radio but supports full band TX/RX @directory.register @@ -1135,8 +1234,8 @@ class FRSB1Radio(T18Radio): POWER_LEVELS = [chirp_common.PowerLevel("High", watts=2.00), chirp_common.PowerLevel("Low", watts=0.50)] - _magic = "PROGRAM" - _fingerprint = "P3107" + "\xF7\x00" + _magic = b"PROGRAM" + _fingerprint = [b"P3107" + b"\xF7\x00"] _upper = 22 _mem_params = (_upper # number of channels ) @@ -1153,8 +1252,8 @@ class RB19Radio(T18Radio): POWER_LEVELS = [chirp_common.PowerLevel("High", watts=2.00), chirp_common.PowerLevel("Low", watts=0.50)] - _magic = "9COGRAM" - _fingerprint = "SMP558" + "\x02" + _magic = b"9COGRAM" + _fingerprint = [b"SMP558" + b"\x02"] _upper = 22 _mem_params = (_upper # number of channels ) @@ -1171,8 +1270,8 @@ class RB19PRadio(T18Radio): POWER_LEVELS = [chirp_common.PowerLevel("High", watts=3.00), chirp_common.PowerLevel("Low", watts=0.50)] - _magic = "70OGRAM" - _fingerprint = "SMP558" + "\x02" + _magic = b"70OGRAM" + _fingerprint = [b"SMP558" + b"\x02"] _upper = 30 _mem_params = (_upper # number of channels ) @@ -1189,8 +1288,8 @@ class RB619Radio(T18Radio): POWER_LEVELS = [chirp_common.PowerLevel("High", watts=0.500), chirp_common.PowerLevel("Low", watts=0.499)] - _magic = "9COGRAM" - _fingerprint = "SMP558" + "\x02" + _magic = b"9COGRAM" + _fingerprint = [b"SMP558" + b"\x02"] _upper = 16 _mem_params = (_upper # number of channels ) @@ -1207,8 +1306,8 @@ class RT47Radio(T18Radio): POWER_LEVELS = [chirp_common.PowerLevel("High", watts=2.000), chirp_common.PowerLevel("Low", watts=0.500)] - _magic = "47OGRAM" - _fingerprint = "\x06\x00\x00\x00\x00\x00\x00\x00" + _magic = b"47OGRAM" + _fingerprint = [b"\x06\x00\x00\x00\x00\x00\x00\x00"] _upper = 16 _mem_params = (_upper # number of channels ) @@ -1251,9 +1350,86 @@ class BFV8ARadio(T18Radio): POWER_LEVELS = [chirp_common.PowerLevel("High", watts=2.000), chirp_common.PowerLevel("Low", watts=0.500)] - _magic = "PROGRAM" - _fingerprint = "P3107" + "\xF7\x00\x00" + _magic = b"PROGRAM" + _fingerprint = [b"P3107" + b"\xF7\x00\x00"] _upper = 16 _mem_params = (_upper # number of channels ) _echo = False + + +@directory.register +class RB29Radio(T18Radio): + """Retevis RB29""" + VENDOR = "Retevis" + MODEL = "RB29" + ACK_BLOCK = False + + POWER_LEVELS = [chirp_common.PowerLevel("High", watts=2.00), + chirp_common.PowerLevel("Low", watts=0.50)] + + _magic = b"S19GRAM" + _fingerprint = [b"SMP558" + b"\x02"] + _upper = 16 + _mem_params = (_upper # number of channels + ) + _frs16 = True + + +@directory.register +class RB629Radio(RB29Radio): + """Retevis RB29""" + VENDOR = "Retevis" + MODEL = "RB629" + + POWER_LEVELS = [chirp_common.PowerLevel("High", watts=0.500), + chirp_common.PowerLevel("Low", watts=0.499)] + + _frs16 = False + _pmr = True + + +@directory.register +class RT15Radio(T18Radio): + """RETEVIS RT15""" + VENDOR = "Retevis" + MODEL = "RT15" + ACK_BLOCK = False + CMD_EXIT = b"b" + + POWER_LEVELS = [chirp_common.PowerLevel("High", watts=2.00), + chirp_common.PowerLevel("Low", watts=0.50)] + + _magic = b"KAOGRAM" + _fingerprint = [b"\x06\x00\x00\x00\x00\x00\x00\x00", + b"\x06\x03\xE8\x08\xFF\xFF\xFF\xFF"] + _upper = 16 + _mem_params = (_upper # number of channels + ) + _frs16 = False # sold as FRS radio but supports full band TX/RX + + @classmethod + def match_model(cls, filedata, filename): + # This radio has always been post-metadata, so never do + # old-school detection + return False + + +@directory.register +class RB87Radio(T18Radio): + """RETEVIS RB87""" + VENDOR = "Retevis" + MODEL = "RB87" + ACK_BLOCK = False + CMD_EXIT = b"" + ACK_BLOCK = False + + POWER_LEVELS = [chirp_common.PowerLevel("High", watts=5.00), + chirp_common.PowerLevel("Low", watts=0.50)] + + _magic = b"C8OGRAN" + _fingerprint = [b"SMP558"] + _upper = 30 + _mem_params = (_upper # number of channels + ) + _gmrs = True diff --git a/chirp/drivers/repeaterbook.py b/chirp/drivers/repeaterbook.py deleted file mode 100644 index 3b68660..0000000 --- a/chirp/drivers/repeaterbook.py +++ /dev/null @@ -1,36 +0,0 @@ -# Copyright 2016 Tom Hayward -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -import six - -from chirp import chirp_common -from chirp.drivers import generic_csv - - -class RBRadio(generic_csv.CSVRadio, chirp_common.NetworkSourceRadio): - VENDOR = "RepeaterBook" - MODEL = "" - - def _clean_comment(self, headers, line, mem): - "Converts iso-8859-1 encoded comments to unicode for pyGTK." - if six.PY2: - mem.comment = six.text_type(mem.comment, 'iso-8859-1') - return mem - - def _clean_name(self, headers, line, mem): - "Converts iso-8859-1 encoded names to unicode for pyGTK." - if six.PY2: - mem.name = six.text_type(mem.name, 'iso-8859-1') - return mem diff --git a/chirp/drivers/retevis_rb15.py b/chirp/drivers/retevis_rb15.py index 649a55c..8318723 100644 --- a/chirp/drivers/retevis_rb15.py +++ b/chirp/drivers/retevis_rb15.py @@ -13,18 +13,15 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import time -import os import struct -import re import logging from chirp import chirp_common, directory, memmap from chirp import bitwise, errors, util +from chirp import bandplan_na from chirp.settings import RadioSetting, RadioSettingGroup, \ RadioSettingValueInteger, RadioSettingValueList, \ - RadioSettingValueBoolean, RadioSettingValueString, \ - RadioSettings + RadioSettingValueBoolean, RadioSettings LOG = logging.getLogger(__name__) @@ -40,12 +37,12 @@ struct memory { bcl:2, // Busy Channel Lockout scan:1, // Scan Add encode:1, // Encode - unknown2:1; + isunused:1; // Is Unused u8 unknown3[3]; // 0d-0f }; #seekto 0x0170; -struct memory channels[22]; +struct memory channels[99]; #seekto 0x0162; struct { @@ -76,9 +73,9 @@ struct { } settings; """ -CMD_ACK = "\x06" +CMD_ACK = b"\x06" -RB15_DTCS = sorted(chirp_common.DTCS_CODES + [645]) +RB15_DTCS = tuple(sorted(chirp_common.DTCS_CODES + (645,))) LIST_BACKLIGHT = ["Off", "On", "Auto"] LIST_BCL = ["None", "Carrier", "QT/DQT Match"] @@ -106,25 +103,11 @@ TOT_VALUES = [0x00, 0x0F, 0x1E, 0x2D, 0x3C, 0x4B, 0x5A, 0x69, 0x78, 0x1EF, 0x1FE, 0x20D, 0x21C, 0x22B, 0x23A, 0x249, 0x258 ] -FRS_FREQS1 = [462.5625, 462.5875, 462.6125, 462.6375, 462.6625, - 462.6875, 462.7125] -FRS_FREQS2 = [467.5625, 467.5875, 467.6125, 467.6375, 467.6625, - 467.6875, 467.7125] -FRS_FREQS3 = [462.5500, 462.5750, 462.6000, 462.6250, 462.6500, - 462.6750, 462.7000, 462.7250] -FRS_FREQS = FRS_FREQS1 + FRS_FREQS2 + FRS_FREQS3 - -PMR_FREQS1 = [446.00625, 446.01875, 446.03125, 446.04375, 446.05625, - 446.06875, 446.08125, 446.09375] -PMR_FREQS2 = [446.10625, 446.11875, 446.13125, 446.14375, 446.15625, - 446.16875, 446.18125, 446.19375] -PMR_FREQS = PMR_FREQS1 + PMR_FREQS2 - def _checksum(data): cs = 0 for byte in data: - cs += ord(byte) + cs += byte return cs % 256 @@ -148,7 +131,7 @@ def tone2short(t): def short2tone(tone): """ Map a binary CTCSS/DCS to a string name for the tone """ - if tone == 0 or tone == 0xffff: + if tone == 0xC000 or tone == 0xffff: ret = "----" else: code = tone & 0x3fff @@ -193,7 +176,7 @@ def _rb15_enter_programming_mode(radio): def _rb15_exit_programming_mode(radio): serial = radio.pipe try: - serial.write("21" + "\x05\xEE" + "V") + serial.write(b"21" + b"\x05\xEE" + b"V") except: raise errors.RadioError("Radio refused to exit programming mode") @@ -201,13 +184,13 @@ def _rb15_exit_programming_mode(radio): def _rb15_read_block(radio, block_addr, block_size): serial = radio.pipe - cmd = struct.pack(">BH", ord('R'), block_addr) + cmd = struct.pack(">BH", ord(b'R'), block_addr) - ccs = _checksum(cmd) + ccs = bytes([_checksum(cmd)]) - expectedresponse = "R" + cmd[1:] + expectedresponse = b"R" + cmd[1:] - cmd = cmd + chr(ccs) + cmd = cmd + ccs LOG.debug("Reading block %04x..." % (block_addr)) @@ -215,14 +198,14 @@ def _rb15_read_block(radio, block_addr, block_size): serial.write(cmd) response = serial.read(3 + block_size + 1) - cs = _checksum(response[:-1]) + cs = bytes([_checksum(response[:-1])]) if response[:3] != expectedresponse: raise Exception("Error reading block %04x." % (block_addr)) chunk = response[3:] - if ord(chunk[-1]) != cs: + if chunk[-1:] != cs: raise Exception("Block failed checksum!") block_data = chunk[:-1] @@ -235,11 +218,11 @@ def _rb15_read_block(radio, block_addr, block_size): def _rb15_write_block(radio, block_addr, block_size): serial = radio.pipe - cmd = struct.pack(">BH", ord('W'), block_addr) + cmd = struct.pack(">BH", ord(b'W'), block_addr) data = radio.get_mmap()[block_addr:block_addr + block_size] - cs = _checksum(cmd + data) - data += chr(cs) + cs = bytes([_checksum(cmd + data)]) + data += cs LOG.debug("Writing Data:") LOG.debug(util.hexprint(cmd + data)) @@ -257,7 +240,7 @@ def do_download(radio): LOG.debug("download") _rb15_enter_programming_mode(radio) - data = "" + data = b"" status = chirp_common.Status() status.msg = "Cloning from radio" @@ -277,7 +260,7 @@ def do_download(radio): _rb15_exit_programming_mode(radio) - return memmap.MemoryMap(data) + return memmap.MemoryMapBytes(data) def do_upload(radio): @@ -317,11 +300,12 @@ class RB15RadioBase(chirp_common.CloneModeRadio): """RETEVIS RB15 BASE""" VENDOR = "Retevis" BAUD_RATE = 9600 + NEEDS_COMPAT_SERIAL = False BLOCK_SIZE = 0x10 - magic = "21" + "\x05\x10" + "x" + magic = b"21" + b"\x05\x10" + b"x" - VALID_BANDS = [(400000000, 520000000)] + VALID_BANDS = [(400000000, 480000000)] _ranges = [ (0x0150, 0x07A0), @@ -346,7 +330,7 @@ class RB15RadioBase(chirp_common.CloneModeRadio): "->Tone", "->DTCS", "DTCS->", "DTCS->DTCS"] rf.valid_power_levels = self.POWER_LEVELS rf.valid_duplexes = ["", "-", "+", "split", "off"] - rf.valid_modes = ["FM", "NFM"] # 25 KHz, 12.5 KHz. + rf.valid_modes = ["FM", "NFM"] # 25 kHz, 12.5 kHz. rf.valid_dtcs_codes = RB15_DTCS rf.memory_bounds = (1, self._upper) rf.valid_tuning_steps = _STEP_LIST @@ -447,7 +431,7 @@ class RB15RadioBase(chirp_common.CloneModeRadio): return val rx_mode = tx_mode = None - rxtone = txtone = 0x0000 + rxtone = txtone = 0xC000 if mem.tmode == "Tone": tx_mode = "Tone" @@ -483,7 +467,7 @@ class RB15RadioBase(chirp_common.CloneModeRadio): mem.freq = int(_mem.rxfreq) * 10 - # We'll consider any blank (i.e. 0MHz frequency) to be empty + # We'll consider any blank (i.e. 0 MHz frequency) to be empty if mem.freq == 0: mem.empty = True return mem @@ -532,9 +516,13 @@ class RB15RadioBase(chirp_common.CloneModeRadio): mem.extra = RadioSettingGroup("Extra", "extra") + if _mem.bcl > 0x02: + val = 0 + else: + val = _mem.bcl rs = RadioSetting("bcl", "BCL", RadioSettingValueList( - LIST_BCL, LIST_BCL[_mem.bcl])) + LIST_BCL, LIST_BCL[val])) mem.extra.append(rs) rs = RadioSetting("encode", "Encode", @@ -549,26 +537,11 @@ class RB15RadioBase(chirp_common.CloneModeRadio): # if empty memory if mem.empty: - _mem.set_raw("\xFF" * 8 + "\x00" * 5 + "\xFF" * 3) + _mem.set_raw("\xFF" * 16) return - if self._frs: - if mem.number >= 1 and mem.number <= 22: - FRS_FREQ = int(FRS_FREQS[mem.number - 1] * 1000000) - mem.freq = FRS_FREQ - if mem.number <= 22: - mem.duplex = '' - mem.offset = 0 - mem.mode = "NFM" - if mem.number >= 8 and mem.number <= 14: - mem.power = self.POWER_LEVELS[1] - elif self._pmr: - if mem.number >= 1 and mem.number <= 16: - PMR_FREQ = int(PMR_FREQS[mem.number - 1] * 1000000) - mem.freq = PMR_FREQ - mem.duplex = '' - mem.offset = 0 - mem.mode = "NFM" + _mem.isunused = False + _mem.unknown1 = False _mem.rxfreq = mem.freq / 10 @@ -754,7 +727,7 @@ class RB15RadioBase(chirp_common.CloneModeRadio): elif element.value.get_mutable(): LOG.debug("Setting %s = %s" % (setting, element.value)) setattr(obj, setting, element.value) - except Exception as e: + except Exception: LOG.debug(element.get_name()) raise @@ -779,8 +752,8 @@ class RB15Radio(RB15RadioBase): ] _memsize = 0x07A0 - _upper = 22 - _frs = True + _upper = 99 + _frs = False # sold as FRS radio but supports full band TX/RX @directory.register @@ -789,13 +762,13 @@ class RB615RadioBase(RB15RadioBase): VENDOR = "Retevis" MODEL = "RB615" - POWER_LEVELS = [chirp_common.PowerLevel("High", watts=0.50), - chirp_common.PowerLevel("Low", watts=0.49)] + POWER_LEVELS = [chirp_common.PowerLevel("High", watts=2.00), + chirp_common.PowerLevel("Low", watts=0.50)] _ranges = [ (0x0150, 0x07A0), ] _memsize = 0x07A0 - _upper = 16 - _pmr = True + _upper = 99 + _pmr = False # sold as PMR radio but supports full band TX/RX diff --git a/chirp/drivers/retevis_rb17p.py b/chirp/drivers/retevis_rb17p.py index 321c628..a59bbf4 100644 --- a/chirp/drivers/retevis_rb17p.py +++ b/chirp/drivers/retevis_rb17p.py @@ -14,9 +14,7 @@ # along with this program. If not, see . import time -import os import struct -import unittest import logging from chirp import chirp_common, directory, memmap @@ -85,7 +83,7 @@ struct { """ -CMD_ACK = "\x06" +CMD_ACK = b"\x06" ALARMTYPE_LIST = ["Local & Remote", "Local"] BACKLIGHT_LIST = ["5 seconds", "10 seconds", "30 seconds", "Always"] @@ -97,26 +95,14 @@ VOXDELAY_LIST = ["0.3", "0.5", "1", "1.5", "2", "2.5"] VOXLEVEL_LIST = ["Off", "1", "2", "3", "4", "5", "6", "7", "8", "9"] WORKMODE_LIST = ["Frequencies", "Channel Numbers", "Names"] -SETTING_LISTS = { - "alarmtype": ALARMTYPE_LIST, - "backlight": BACKLIGHT_LIST, - "batterysave": BATTERYSAVE_LIST, - "scanmode": SCANMODE_LIST, - "sidekey": SIDEKEY_LIST, - "timeouttimer": TIMEOUTTIMER_LIST, - "voxdelay": VOXDELAY_LIST, - "voxlevel": VOXLEVEL_LIST, - "workmode": WORKMODE_LIST -} - BCL = ["Off", "Carrier", "QT/DCS"] -GMRS_FREQS1 = [462.5625, 462.5875, 462.6125, 462.6375, 462.6625, - 462.6875, 462.7125] -GMRS_FREQS2 = [467.5625, 467.5875, 467.6125, 467.6375, 467.6625, - 467.6875, 467.7125] -GMRS_FREQS3 = [462.5500, 462.5750, 462.6000, 462.6250, 462.6500, - 462.6750, 462.7000, 462.7250] +GMRS_FREQS1 = [462562500, 462587500, 462612500, 462637500, 462662500, + 462687500, 462712500] +GMRS_FREQS2 = [467562500, 467587500, 467612500, 467637500, 467662500, + 467687500, 467712500] +GMRS_FREQS3 = [462550000, 462575000, 462600000, 462625000, 462650000, + 462675000, 462700000, 462725000] GMRS_FREQS = GMRS_FREQS1 + GMRS_FREQS2 + GMRS_FREQS3 * 2 @@ -124,7 +110,7 @@ def _enter_programming_mode(radio): serial = radio.pipe try: - serial.write("\x02") + serial.write(b"\x02") time.sleep(0.01) serial.write(radio._magic) ack = serial.read(1) @@ -137,7 +123,7 @@ def _enter_programming_mode(radio): raise errors.RadioError("Radio refused to enter programming mode") try: - serial.write("M" + "\x02") + serial.write(b"M" + b"\x02") ident = serial.read(8) except: raise errors.RadioError("Error communicating with radio") @@ -159,8 +145,8 @@ def _enter_programming_mode(radio): def _read_block(radio, block_addr, block_size): serial = radio.pipe - cmd = struct.pack(">cHb", 'R', block_addr, block_size) - expectedresponse = "W" + cmd[1:] + cmd = struct.pack(">cHb", b'R', block_addr, block_size) + expectedresponse = b"W" + cmd[1:] LOG.debug("Reading block %04x..." % (block_addr)) try: @@ -179,7 +165,7 @@ def _read_block(radio, block_addr, block_size): def _write_block(radio, block_addr, block_size): serial = radio.pipe - cmd = struct.pack(">cHb", 'W', block_addr, block_size) + cmd = struct.pack(">cHb", b'W', block_addr, block_size) data = radio.get_mmap()[block_addr:block_addr + block_size] LOG.debug("Writing Data:") @@ -198,7 +184,7 @@ def do_download(radio): LOG.debug("download") _enter_programming_mode(radio) - data = "" + data = b"" status = chirp_common.Status() status.msg = "Cloning from radio" @@ -216,7 +202,7 @@ def do_download(radio): LOG.debug("Address: %04x" % addr) LOG.debug(util.hexprint(block)) - return memmap.MemoryMap(data) + return memmap.MemoryMapBytes(data) def do_upload(radio): @@ -240,14 +226,15 @@ class RB17P_Base(chirp_common.CloneModeRadio): VENDOR = "Retevis" MODEL = "RB17P Base" BAUD_RATE = 9600 + NEEDS_COMPAT_SERIAL = False BLOCK_SIZE = 0x40 VALID_BANDS = [(400000000, 470000000)] POWER_LEVELS = [chirp_common.PowerLevel("High", watts=5.00), chirp_common.PowerLevel("Low", watts=0.50)] - _magic = "PGA588" - _fingerprint = "\xFF" * 8 + _magic = b"PGA588" + _fingerprint = b"\xFF" * 8 _upper = 128 _gmrs = True _ranges = [(0x0000, 0x1800, 0x40), @@ -259,7 +246,7 @@ class RB17P_Base(chirp_common.CloneModeRadio): def get_features(self): rf = chirp_common.RadioFeatures() rf.has_settings = True - rf.valid_modes = ["NFM", "FM"] # 12.5 KHz, 25 kHz. + rf.valid_modes = ["NFM", "FM"] # 12.5 kHz, 25 kHz. rf.valid_skips = ["", "S"] rf.valid_tmodes = ["", "Tone", "TSQL", "DTCS", "Cross"] rf.valid_duplexes = ["", "-", "+", "split", "off"] @@ -333,7 +320,7 @@ class RB17P_Base(chirp_common.CloneModeRadio): mem.number = number mem.freq = int(_mem.rxfreq) * 10 - # We'll consider any blank (i.e. 0MHz frequency) to be empty + # We'll consider any blank (i.e. 0 MHz frequency) to be empty if mem.freq == 0: mem.empty = True return mem @@ -377,8 +364,44 @@ class RB17P_Base(chirp_common.CloneModeRadio): RadioSettingValueBoolean(_mem.compander)) mem.extra.append(rs) + immutable = [] + + if self._gmrs: + if mem.freq in GMRS_FREQS: + if mem.freq in GMRS_FREQS1: + # Non-repeater GMRS channels (limit duplex) + mem.duplex == '' + mem.offset = 0 + immutable = ["duplex", "offset"] + elif mem.freq in GMRS_FREQS2: + # Non-repeater FRS channels (limit duplex, power) + mem.duplex == '' + mem.offset = 0 + mem.mode = "NFM" + mem.power = self.POWER_LEVELS[1] + immutable = ["duplex", "offset", "mode", "power"] + elif mem.freq in GMRS_FREQS3: + # GMRS repeater channels, always either simplex or +5 MHz + if mem.duplex != '+': + mem.duplex = '' + mem.offset = 0 + else: + mem.offset = 5000000 + else: + # Not a GMRS channel, so restrict duplex since it will be + # forced to off. + mem.duplex = 'off' + mem.offset = 0 + immutable = ["duplex", "offset"] + + mem.immutable = immutable + return mem + def check_set_memory_immutable_policy(self, existing, new): + existing.immutable = [] + super().check_set_memory_immutable_policy(existing, new) + def set_memory(self, mem): # Get a low-level memory object mapped to the image _mem = self._memobj.memory[mem.number - 1] @@ -392,25 +415,6 @@ class RB17P_Base(chirp_common.CloneModeRadio): _mem.set_raw("\x00" * (_mem.size() // 8)) - if self._gmrs: - if float(mem.freq) / 1000000 in GMRS_FREQS1: - mem.duplex == '' - mem.offset = 0 - elif float(mem.freq) / 1000000 in GMRS_FREQS2: - mem.duplex == '' - mem.offset = 0 - mem.mode = "NFM" - mem.power = self.POWER_LEVELS[1] - elif float(mem.freq) / 1000000 in GMRS_FREQS3: - if mem.duplex == '+': - mem.offset = 5000000 - else: - mem.duplex == '' - mem.offset = 0 - else: - mem.duplex = 'off' - mem.offset = 0 - _mem.rxfreq = mem.freq / 10 if mem.duplex == "off": @@ -579,7 +583,7 @@ class RB17P_Base(chirp_common.CloneModeRadio): else: LOG.debug("Setting %s = %s" % (setting, element.value)) setattr(obj, setting, element.value) - except Exception as e: + except Exception: LOG.debug(element.get_name()) raise @@ -600,3 +604,17 @@ class RB17PRadio(RB17P_Base): (0x0810, 0x0830, 0x30), (0x1000, 0x1800, 0x40) ] + + def validate_memory(self, mem): + msgs = super().validate_memory(mem) + + _msg_duplex = 'Duplex must be "off" for this frequency' + _msg_offset = 'Only simplex or +5 MHz offset allowed on GMRS' + + if mem.freq not in GMRS_FREQS: + if mem.duplex != "off": + msgs.append(chirp_common.ValidationWarning(_msg_duplex)) + elif mem.duplex and mem.offset != 5000000: + msgs.append(chirp_common.ValidationWarning(_msg_offset)) + + return msgs diff --git a/chirp/drivers/retevis_rb28.py b/chirp/drivers/retevis_rb28.py new file mode 100644 index 0000000..a12b529 --- /dev/null +++ b/chirp/drivers/retevis_rb28.py @@ -0,0 +1,732 @@ +# Copyright 2023 Jim Unroe +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +import struct +import logging + +from chirp import ( + bandplan_iaru_r1, + bandplan_na, + bitwise, + chirp_common, + directory, + errors, + memmap, + util, +) +from chirp.settings import ( + RadioSetting, + RadioSettingGroup, + RadioSettings, + RadioSettingValueBoolean, + RadioSettingValueInteger, + RadioSettingValueList, +) + +LOG = logging.getLogger(__name__) + +MEM_FORMAT = """ +#seekto 0x0000; +struct { + lbcd rxfreq[4]; // RX Frequency 0-3 + lbcd txfreq[4]; // TX Frequency 4-7 + u8 rxtone; // PL/DPL Decode 8 + u8 unused_9; // 9 + u8 txtone; // PL/DPL Encode A + u8 unused_b; // B + u8 compander:1, // Compander C + unused_1:1, // + highpower:1, // Power Level + wide:1, // Bandwidth + unused_2:4; // + u8 reserved[3]; // Reserved D-F +} memory[%d]; + +#seekto 0x002D; +struct { + u8 unknown_2d_7:1, // 002D + unknown_2d_6:1, // + unknown_2d_5:1, // + savem:1, // Battery Save Set + save:1, // Battery Save + beep:1, // Beep + voice:1, // Voice Prompts + unused_2d_0:1; // + u8 squelch; // Squelch 002E + u8 tot; // Time-out Timer 002F + u8 channel_4[13]; // 0030-003C + u8 unused_3d; // 003D + u8 voxl; // Vox Level 003E + u8 voxd; // Vox Delay 003F + u8 channel_5[13]; // 0040-004C + u8 unknown_3[3]; // 004D-004F + u8 channel_6[13]; // 0050-005C + u8 unknown_4[3]; // 005D-005F + u8 channel_7[13]; // 0060-006C + u8 volume; // Volume 006D + u8 tone; // Tone 006E + u8 chnumber; // Channel 006F + u8 channel_8[13]; // 0070-007C + u8 unknown_7d; // 007D + u8 scan; // Scan 007E + u8 backlight; // Back Light 007F + u8 channel_9[13]; // 0080-008C + u8 wxchnumber; // Weather Channel 008D + u8 wxwarn; // Weather Warn 008E + u8 roger; // End Tone 008F + u8 channel_10[13]; // 0090-009C + u8 unknown_9d; // 009D + u8 keylock; // Key Lock 009E + u8 unknown_9f; // 009F + u8 channel_11[13]; // 00A0-00AC + u8 unknown_ad; // 00AD + u8 unknown_ae; // 00AE + u8 unknown_af; // 00AF + u8 channel_12[13]; // 00B0-00BC + u8 autokeylock; // Key Lock 00BD + u8 pfkey_lt; // Key Set < Long 00BE + u8 pfkey_gt; // Key Set > Long 00BB +} settings; + +#seekto 0x00AD; +struct { +u8 chnl_8:1, // Busy Channel Lockout 8 00AD + chnl_7:1, // Busy Channel Lockout 7 + chnl_6:1, // Busy Channel Lockout 6 + chnl_5:1, // Busy Channel Lockout 5 + chnl_4:1, // Busy Channel Lockout 4 + chnl_3:1, // Busy Channel Lockout 3 + chnl_2:1, // Busy Channel Lockout 2 + chnl_1:1; // Busy Channel Lockout 1 +u8 chnl_16:1, // Busy Channel Lockout 16 00AE + chnl_15:1, // Busy Channel Lockout 15 + chnl_14:1, // Busy Channel Lockout 14 + chnl_13:1, // Busy Channel Lockout 13 + chnl_12:1, // Busy Channel Lockout 12 + chnl_11:1, // Busy Channel Lockout 11 + chnl_10:1, // Busy Channel Lockout 10 + chnl_9:1; // Busy Channel Lockout 09 +u8 unused_af_7:1, // 00AF + unused_af_6:1, // + chnl_22:1, // Busy Channel Lockout 22 + chnl_21:1, // Busy Channel Lockout 21 + chnl_20:1, // Busy Channel Lockout 20 + chnl_19:1, // Busy Channel Lockout 19 + chnl_18:1, // Busy Channel Lockout 18 + chnl_17:1; // Busy Channel Lockout 17 +} bclo; +""" + +CMD_ACK = b"\x06" + +BACKLIGHT_LIST = ["Off", "ON", "5S", "10S", "15S", "30S"] +PFKEY_US_LIST = ["None", "Weather", "Warn", "Call", "Monitor"] +PFKEY_EU_LIST = ["None", "Warn", "Call", "Monitor"] +SAVE_LIST = ["Normal", "Super"] +TIMEOUTTIMER_LIST = ["%s seconds" % x for x in range(15, 195, 15)] +VOICE_LIST = ["Off", "English"] +VOXD_LIST = ["0.5", "1.0", "1.5", "2.0", "2.5", "3.0"] +VOXL_LIST = ["OFF"] + ["%s" % x for x in range(1, 10)] + +PMR_TONES = list(chirp_common.TONES) +[PMR_TONES.remove(x) for x in [69.3, 159.8, 165.5, 171.3, 177.3, 183.5, + 189.9, 196.6, 199.5, 206.5, 229.1, 254.1]] + +PMR_DTCS_CODES = list(chirp_common.DTCS_CODES) +[PMR_DTCS_CODES.remove(x) for x in [36, 53, 122, 145, 212, 225, 246, + 252, 255, 266, 274, 325, 332, 356, + 446, 452, 454, 455, 462, 523, 526]] + + +def _enter_programming_mode(radio): + serial = radio.pipe + + _magic = radio._magic + + try: + serial.write(_magic) + for i in range(1, 5): + ack = serial.read(1) + if ack == CMD_ACK: + break + except: + raise errors.RadioError("Error communicating with radio") + + if not ack: + raise errors.RadioError("No response from radio") + elif ack != CMD_ACK: + raise errors.RadioError("Radio refused to enter programming mode") + + try: + serial.write(b"\x02") + ident = serial.read(8) + except: + raise errors.RadioError("Error communicating with radio") + + # check if ident is OK + for fp in radio._fingerprint: + if fp in ident: + break + else: + LOG.debug("Incorrect model ID, got this:\n\n" + util.hexprint(ident)) + raise errors.RadioError("Radio identification failed.") + + try: + serial.write(CMD_ACK) + ack = serial.read(1) + except: + raise errors.RadioError("Error communicating with radio") + + if ack != CMD_ACK: + raise errors.RadioError("Radio refused to enter programming mode") + + +def _exit_programming_mode(radio): + serial = radio.pipe + try: + serial.write(b"E") + except: + raise errors.RadioError("Radio refused to exit programming mode") + + +def _read_block(radio, block_addr, block_size): + serial = radio.pipe + + cmd = struct.pack(">cHb", b'R', block_addr, block_size) + expectedresponse = b"W" + cmd[1:] + LOG.debug("Reading block %04x..." % (block_addr)) + + try: + serial.write(cmd) + response = serial.read(4 + block_size) + if response[:4] != expectedresponse: + raise Exception("Error reading block %04x." % (block_addr)) + + block_data = response[4:] + + if block_addr != 0 or radio._ack_1st_block: + serial.write(CMD_ACK) + ack = serial.read(1) + except: + raise errors.RadioError("Failed to read block at %04x" % block_addr) + + if block_addr != 0 or radio._ack_1st_block: + if ack != CMD_ACK: + raise Exception("No ACK reading block %04x." % (block_addr)) + + return block_data + + +def _write_block(radio, block_addr, block_size): + serial = radio.pipe + + cmd = struct.pack(">cHb", b'W', block_addr, block_size) + data = radio.get_mmap()[block_addr:block_addr + block_size] + + LOG.debug("Writing Data:") + LOG.debug(util.hexprint(cmd + data)) + + try: + serial.write(cmd + data) + if serial.read(1) != CMD_ACK: + raise Exception("No ACK") + except: + raise errors.RadioError("Failed to send block " + "to radio at %04x" % block_addr) + + +def do_download(radio): + LOG.debug("download") + _enter_programming_mode(radio) + + data = b"" + + status = chirp_common.Status() + status.msg = "Cloning from radio" + + status.cur = 0 + status.max = radio._memsize + + for addr in range(0, radio._memsize, radio.BLOCK_SIZE): + status.cur = addr + radio.BLOCK_SIZE + radio.status_fn(status) + + block = _read_block(radio, addr, radio.BLOCK_SIZE) + data += block + + LOG.debug("Address: %04x" % addr) + LOG.debug(util.hexprint(block)) + + _exit_programming_mode(radio) + + return memmap.MemoryMapBytes(data) + + +def do_upload(radio): + status = chirp_common.Status() + status.msg = "Uploading to radio" + + _enter_programming_mode(radio) + + status.cur = 0 + status.max = radio._memsize + + for start_addr, end_addr in radio._ranges: + for addr in range(start_addr, end_addr, radio.BLOCK_SIZE_UP): + status.cur = addr + radio.BLOCK_SIZE_UP + radio.status_fn(status) + _write_block(radio, addr, radio.BLOCK_SIZE_UP) + + _exit_programming_mode(radio) + + +@directory.register +class RB28Radio(chirp_common.CloneModeRadio): + """RETEVIS RB28""" + VENDOR = "Retevis" + MODEL = "RB28" + BAUD_RATE = 9600 + NEEDS_COMPAT_SERIAL = False + BLOCK_SIZE = 0x20 + BLOCK_SIZE_UP = 0x10 + + TONES = PMR_TONES + DTCS_CODES = PMR_DTCS_CODES + PFKEY_LIST = PFKEY_US_LIST + POWER_LEVELS = [chirp_common.PowerLevel("High", watts=2.50), + chirp_common.PowerLevel("Low", watts=0.50)] + VALID_BANDS = [(400000000, 480000000)] + + _magic = b"PHOGR\x0B\x28" + _fingerprint = [b"P32073" + b"\x02\xFF", + b"P32073" + b"\x00\xFF", + ] + _upper = 22 + _mem_params = (_upper, # number of channels + ) + _ack_1st_block = False + _reserved = True + _frs = True + + _ranges = [ + (0x0000, 0x0160), + ] + _memsize = 0x0160 + + def get_features(self): + rf = chirp_common.RadioFeatures() + rf.has_settings = True + rf.has_bank = False + rf.has_ctone = True + rf.has_cross = True + rf.has_rx_dtcs = True + rf.has_dtcs_polarity = False + rf.has_tuning_step = False + rf.can_odd_split = True + rf.has_name = False + rf.valid_skips = [] + rf.valid_tmodes = ["", "Tone", "TSQL", "DTCS", "Cross"] + rf.valid_cross_modes = ["Tone->Tone", "Tone->DTCS", "DTCS->Tone", + "->Tone", "->DTCS", "DTCS->", "DTCS->DTCS"] + rf.valid_power_levels = self.POWER_LEVELS + rf.valid_duplexes = ["", "off"] + rf.valid_modes = ["FM", "NFM"] # 25 kHz, 12.5 kHz. + rf.valid_tones = self.TONES + rf.valid_dtcs_codes = self.DTCS_CODES + rf.memory_bounds = (1, self._upper) + rf.valid_tuning_steps = [2.5, 5., 6.25, 10., 12.5, 25.] + rf.valid_bands = self.VALID_BANDS + + return rf + + def process_mmap(self): + self._memobj = bitwise.parse(MEM_FORMAT % self._mem_params, + self._mmap) + + def sync_in(self): + """Download from radio""" + try: + data = do_download(self) + except errors.RadioError: + # Pass through any real errors we raise + raise + except: + # If anything unexpected happens, make sure we raise + # a RadioError and log the problem + LOG.exception('Unexpected error during download') + raise errors.RadioError('Unexpected error communicating ' + 'with the radio') + self._mmap = data + self.process_mmap() + + def sync_out(self): + """Upload to radio""" + try: + do_upload(self) + except: + # If anything unexpected happens, make sure we raise + # a RadioError and log the problem + LOG.exception('Unexpected error during upload') + raise errors.RadioError('Unexpected error communicating ' + 'with the radio') + + def get_raw_memory(self, number): + return repr(self._memobj.memory[number - 1]) + + def get_memory(self, number): + + mem = chirp_common.Memory() + + mem.number = number + + _mem = self._memobj.memory[number - 1] + + if self._reserved: + _rsvd = _mem.reserved.get_raw() + + mem.freq = int(_mem.rxfreq) * 10 + + # We'll consider any blank (i.e. 0 MHz frequency) to be empty + if mem.freq == 0: + mem.empty = True + return mem + + if _mem.rxfreq.get_raw() == "\xFF\xFF\xFF\xFF": + mem.freq = 0 + mem.empty = True + return mem + + if int(_mem.rxfreq) == int(_mem.txfreq): + mem.duplex = "" + mem.offset = 0 + else: + mem.duplex = int(_mem.rxfreq) > int(_mem.txfreq) and "-" or "+" + mem.offset = abs(int(_mem.rxfreq) - int(_mem.txfreq)) * 10 + + mem.mode = _mem.wide and "FM" or "NFM" + + if _mem.txtone in [0, 0xFF]: + txmode = "" + elif _mem.txtone < 0x27: + mem.rtone = PMR_TONES[_mem.txtone - 1] + txmode = "Tone" + elif _mem.txtone >= 0x27: + tcode = PMR_DTCS_CODES[_mem.txtone - 0x27] + mem.dtcs = tcode + txmode = "DTCS" + else: + LOG.warn("Bug: tx_mode is %02x" % _mem.txtone) + + if _mem.rxtone in [0, 0xFF]: + rxmode = "" + elif _mem.rxtone < 0x27: + mem.ctone = PMR_TONES[_mem.rxtone - 1] + rxmode = "Tone" + elif _mem.rxtone >= 0x27: + rcode = PMR_DTCS_CODES[_mem.rxtone - 0x27] + mem.rx_dtcs = rcode + rxmode = "DTCS" + else: + LOG.warn("Bug: rx_mode is %02x" % _mem.rxtone) + + if txmode == "Tone" and not rxmode: + mem.tmode = "Tone" + elif txmode == rxmode and txmode == "Tone" and mem.rtone == mem.ctone: + mem.tmode = "TSQL" + elif txmode == rxmode and txmode == "DTCS" and mem.dtcs == mem.rx_dtcs: + mem.tmode = "DTCS" + elif rxmode or txmode: + mem.tmode = "Cross" + mem.cross_mode = "%s->%s" % (txmode, rxmode) + + mem.power = self.POWER_LEVELS[1 - _mem.highpower] + + mem.extra = RadioSettingGroup("Extra", "extra") + + rs = RadioSettingValueBoolean(_mem.compander) + rset = RadioSetting("compander", "Compander", rs) + mem.extra.append(rset) + + _obj = self._memobj.bclo + key = "chnl_%i" % (mem.number) + rs = RadioSettingValueBoolean(getattr(_obj, "chnl_%i" % (mem.number))) + rset = RadioSetting(key, "Busy Channel Lockout", rs) + mem.extra.append(rset) + + immutable = [] + + if self._frs: + if mem.number >= 1 and mem.number <= 22: + # 22 FRS fixed channels + FRS_FREQ = bandplan_na.ALL_GMRS_FREQS[mem.number - 1] + mem.freq = FRS_FREQ + mem.duplex == '' + mem.offset = 0 + mem.mode = "NFM" + immutable = ["empty", "freq", "duplex", "offset", "mode"] + if mem.number >= 8 and mem.number <= 14: + mem.power = self.POWER_LEVELS[1] + immutable += ["power"] + elif self._pmr: + if mem.number >= 1 and mem.number <= 16: + # 16 PMR fixed channels + PMR_FREQ = bandplan_iaru_r1.PMR446_FREQS[mem.number - 1] + mem.freq = PMR_FREQ + mem.duplex = '' + mem.offset = 0 + mem.mode = "NFM" + mem.power = self.POWER_LEVELS[1] + immutable = ["empty", "freq", "duplex", "offset", "mode", + "power"] + + mem.immutable = immutable + + return mem + + def _set_tone(self, _mem, which, value, mode): + if mode == "Tone": + val = PMR_TONES.index(value) + 1 + elif mode == "DTCS": + val = PMR_DTCS_CODES.index(value) + 0x27 + elif mode == "": + val = 0 + else: + raise errors.RadioError("Internal error: tmode %s" % mode) + + setattr(_mem, which, val) + + def set_memory(self, mem): + _mem = self._memobj.memory[mem.number - 1] + + if self._reserved: + _rsvd = _mem.reserved.get_raw() + + if mem.empty: + if self._reserved: + _mem.set_raw("\xFF" * 13 + _rsvd) + else: + _mem.set_raw("\xFF" * (_mem.size() // 8)) + + return + + if self._reserved: + _mem.set_raw("\x00" * 13 + _rsvd) + else: + _mem.set_raw("\x00" * 13 + "\xFF\xFF\xFF") + + _mem.rxfreq = mem.freq / 10 + + if mem.duplex == "off": + for i in range(0, 4): + _mem.txfreq[i].set_raw("\xFF") + elif mem.duplex == "split": + _mem.txfreq = mem.offset / 10 + elif mem.duplex == "+": + _mem.txfreq = (mem.freq + mem.offset) / 10 + elif mem.duplex == "-": + _mem.txfreq = (mem.freq - mem.offset) / 10 + else: + _mem.txfreq = mem.freq / 10 + + _mem.wide = mem.mode == "FM" + + rxtone = txtone = 0 + rxmode = txmode = "" + + if mem.tmode == "DTCS": + rxmode = txmode = "DTCS" + rxtone = txtone = mem.dtcs + elif mem.tmode and mem.tmode != "Cross": + rxtone = txtone = mem.tmode == "Tone" and mem.rtone or mem.ctone + txmode = "Tone" + rxmode = mem.tmode == "TSQL" and "Tone" or "" + elif mem.tmode == "Cross": + txmode, rxmode = mem.cross_mode.split("->", 1) + + if txmode == "DTCS": + txtone = mem.dtcs + elif txmode == "Tone": + txtone = mem.rtone + + if rxmode == "DTCS": + rxtone = mem.rx_dtcs + elif rxmode == "Tone": + rxtone = mem.ctone + + self._set_tone(_mem, "txtone", txtone, txmode) + self._set_tone(_mem, "rxtone", rxtone, rxmode) + + _mem.highpower = mem.power == self.POWER_LEVELS[0] + + for setting in mem.extra: + if setting.get_name().startswith("chnl_"): + setattr(self._memobj.bclo, setting.get_name(), setting.value) + else: + setattr(_mem, setting.get_name(), setting.value) + + def get_settings(self): + _settings = self._memobj.settings + basic = RadioSettingGroup("basic", "Basic Settings") + top = RadioSettings(basic) + + rs = RadioSettingValueInteger(0, 9, _settings.squelch) + rset = RadioSetting("squelch", "Squelch Level", rs) + basic.append(rset) + + rs = RadioSettingValueList(TIMEOUTTIMER_LIST, + TIMEOUTTIMER_LIST[_settings.tot - 1]) + rset = RadioSetting("tot", "Time-out timer", rs) + basic.append(rset) + + rs = RadioSettingValueList(VOICE_LIST, + VOICE_LIST[_settings.voice]) + rset = RadioSetting("voice", "Voice Prompts", rs) + basic.append(rset) + + rs = RadioSettingValueList(SAVE_LIST, + SAVE_LIST[_settings.savem]) + rset = RadioSetting("savem", "Battery Save Mode", rs) + basic.append(rset) + + rs = RadioSettingValueList(BACKLIGHT_LIST, + BACKLIGHT_LIST[_settings.backlight]) + rset = RadioSetting("backlight", "Back Light", rs) + basic.append(rset) + + rs = RadioSettingValueInteger(0, 9, _settings.volume) + rset = RadioSetting("volume", "Volume", rs) + basic.append(rset) + + rs = RadioSettingValueInteger(0, 10, _settings.tone) + rset = RadioSetting("tone", "Tone", rs) + basic.append(rset) + + rs = RadioSettingValueInteger(1, 22, _settings.chnumber + 1) + rset = RadioSetting("chnumber", "Channel Number", rs) + basic.append(rset) + + if self.MODEL == "RB28": + rs = RadioSettingValueInteger(1, 11, _settings.wxchnumber + 1) + rset = RadioSetting("wxchnumber", "Weather Channel Number", rs) + basic.append(rset) + + rs = RadioSettingValueBoolean(_settings.autokeylock) + rset = RadioSetting("autokeylock", "Auto Key Lock", rs) + basic.append(rset) + + rs = RadioSettingValueBoolean(_settings.save) + rset = RadioSetting("save", "Battery Save", rs) + basic.append(rset) + + rs = RadioSettingValueBoolean(_settings.roger) + rset = RadioSetting("roger", "End Tone", rs) + basic.append(rset) + + rs = RadioSettingValueBoolean(_settings.beep) + rset = RadioSetting("beep", "Beep", rs) + basic.append(rset) + + rs = RadioSettingValueBoolean(_settings.scan) + rset = RadioSetting("scan", "Scan", rs) + basic.append(rset) + + if self.MODEL == "RB28": + rs = RadioSettingValueBoolean(_settings.wxwarn) + rset = RadioSetting("wxwarn", "Weather Warn", rs) + basic.append(rset) + + rs = RadioSettingValueBoolean(_settings.keylock) + rset = RadioSetting("keylock", "Key Lock", rs) + basic.append(rset) + + rs = RadioSettingValueList(VOXL_LIST, + VOXL_LIST[_settings.voxl]) + rset = RadioSetting("voxl", "Vox Level", rs) + basic.append(rset) + + rs = RadioSettingValueList(VOXD_LIST, + VOXD_LIST[_settings.voxd]) + rset = RadioSetting("voxd", "Vox Delay", rs) + basic.append(rset) + + rs = RadioSettingValueList(self.PFKEY_LIST, + self.PFKEY_LIST[_settings.pfkey_lt]) + rset = RadioSetting("pfkey_lt", "Key Set < Long", rs) + basic.append(rset) + + rs = RadioSettingValueList(self.PFKEY_LIST, + self.PFKEY_LIST[_settings.pfkey_gt]) + rset = RadioSetting("pfkey_gt", "Key Set > Long", rs) + basic.append(rset) + + return top + + def set_settings(self, settings): + for element in settings: + if not isinstance(element, RadioSetting): + self.set_settings(element) + continue + else: + try: + if "." in element.get_name(): + bits = element.get_name().split(".") + obj = self._memobj + for bit in bits[:-1]: + obj = getattr(obj, bit) + setting = bits[-1] + else: + obj = self._memobj.settings + setting = element.get_name() + + if element.has_apply_callback(): + LOG.debug("Using apply callback") + element.run_apply_callback() + elif setting == "chnumber": + setattr(obj, setting, int(element.value) - 1) + elif setting == "tot": + setattr(obj, setting, int(element.value) + 1) + elif setting == "wxchnumber": + setattr(obj, setting, int(element.value) - 1) + elif element.value.get_mutable(): + LOG.debug("Setting %s = %s" % (setting, element.value)) + setattr(obj, setting, element.value) + except Exception: + LOG.debug(element.get_name()) + raise + + @classmethod + def match_model(cls, filedata, filename): + # Radios that have always been post-metadata, so never do + # old-school detection + return False + + +@directory.register +class RB628Radio(RB28Radio): + """RETEVIS RB628""" + VENDOR = "Retevis" + MODEL = "RB628" + + PFKEY_LIST = PFKEY_EU_LIST + POWER_LEVELS = [chirp_common.PowerLevel("High", watts=0.50), + chirp_common.PowerLevel("Low", watts=0.50)] + + _magic = b"PHOGR\x28\x0B" + _fingerprint = [b"P32073" + b"\x00\xFF", ] + _upper = 16 + _mem_params = (_upper, # number of channels + ) + _frs = False + _pmr = True diff --git a/chirp/drivers/retevis_rt1.py b/chirp/drivers/retevis_rt1.py index 59e6263..7dcbd74 100644 --- a/chirp/drivers/retevis_rt1.py +++ b/chirp/drivers/retevis_rt1.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import time -import os import struct import logging @@ -22,8 +20,7 @@ from chirp import chirp_common, directory, memmap from chirp import bitwise, errors, util from chirp.settings import RadioSetting, RadioSettingGroup, \ RadioSettingValueInteger, RadioSettingValueList, \ - RadioSettingValueBoolean, RadioSettingValueString, \ - InvalidValueError, RadioSettings + RadioSettingValueBoolean, RadioSettings LOG = logging.getLogger(__name__) @@ -85,12 +82,12 @@ struct { } fingerprint; """ -CMD_ACK = "\x06" +CMD_ACK = b"\x06" RT1_POWER_LEVELS = [chirp_common.PowerLevel("Low", watts=5.00), chirp_common.PowerLevel("High", watts=9.00)] -RT1_DTCS = sorted(chirp_common.DTCS_CODES + [645]) +RT1_DTCS = tuple(sorted(chirp_common.DTCS_CODES + (645,))) LIST_LPT = ["0.5", "1.0", "1.5", "2.0", "2.5"] LIST_SHORT_PRESS = ["Off", "Monitor On/Off", "Power High/Low", "Alarm", "Volt"] @@ -106,26 +103,9 @@ LIST_SCANSPEED = ["%s" % x for x in range(100, 550, 50)] LIST_SCANDELAY = ["%s" % x for x in range(3, 31)] LIST_TXTONE = ["Off", "BOT", "EOT", "Both"] -SETTING_LISTS = { - "lpt": LIST_LPT, - "k1shortp": LIST_SHORT_PRESS, - "k1longp": LIST_LONG_PRESS, - "k2shortp": LIST_SHORT_PRESS, - "k2longp": LIST_LONG_PRESS, - "voxd": LIST_VOXDELAY, - "voice": LIST_VOICE, - "tot": LIST_TIMEOUTTIMER, - "save": LIST_SAVE, - "ssave": LIST_SSAVE, - "prioritych": LIST_PRIORITYCH, - "scanspeed": LIST_SCANSPEED, - "scandelay": LIST_SCANDELAY, - "txtone": LIST_TXTONE, - } - # Retevis RT1 fingerprints -RT1_VHF_fp = "PXT8K" + "\xF0\x00\x00" # RT1 VHF model -RT1_UHF_fp = "PXT8K" + "\xF3\x00\x00" # RT1 UHF model +RT1_VHF_fp = b"PXT8K" + b"\xF0\x00\x00" # RT1 VHF model +RT1_UHF_fp = b"PXT8K" + b"\xF3\x00\x00" # RT1 UHF model MODELS = [RT1_VHF_fp, RT1_UHF_fp] @@ -147,11 +127,11 @@ def _get_radio_model(radio): def _rt1_enter_programming_mode(radio): serial = radio.pipe - magic = ["PROGRAMa", "PROGRAMb"] + magic = [b"PROGRAMa", b"PROGRAMb"] for i in range(0, 2): try: - LOG.debug("sending " + magic[i]) + LOG.debug("sending " + magic[i].decode()) serial.write(magic[i]) ack = serial.read(1) except: @@ -168,13 +148,13 @@ def _rt1_enter_programming_mode(radio): try: LOG.debug("sending " + util.hexprint("\x02")) - serial.write("\x02") + serial.write(b"\x02") ident = serial.read(16) except: _rt1_exit_programming_mode(radio) raise errors.RadioError("Error communicating with radio") - if not ident.startswith("PXT8K"): + if not ident.startswith(b"PXT8K"): LOG.debug("Incorrect response, got this:\n\n" + util.hexprint(ident)) _rt1_exit_programming_mode(radio) LOG.debug(util.hexprint(ident)) @@ -182,13 +162,13 @@ def _rt1_enter_programming_mode(radio): try: LOG.debug("sending " + util.hexprint("MXT8KCUMHS1X7BN/")) - serial.write("MXT8KCUMHS1X7BN/") + serial.write(b"MXT8KCUMHS1X7BN/") ack = serial.read(1) except: _rt1_exit_programming_mode(radio) raise errors.RadioError("Error communicating with radio") - if ack != "\xB2": + if ack != b"\xB2": LOG.debug("Incorrect response, got this:\n\n" + util.hexprint(ack)) _rt1_exit_programming_mode(radio) raise errors.RadioError("Radio refused to enter programming mode") @@ -213,7 +193,7 @@ def _rt1_enter_programming_mode(radio): def _rt1_exit_programming_mode(radio): serial = radio.pipe try: - serial.write("E") + serial.write(b"E") except: raise errors.RadioError("Radio refused to exit programming mode") @@ -221,8 +201,8 @@ def _rt1_exit_programming_mode(radio): def _rt1_read_block(radio, block_addr, block_size): serial = radio.pipe - cmd = struct.pack(">cHb", 'R', block_addr, block_size) - expectedresponse = "W" + cmd[1:] + cmd = struct.pack(">cHb", b'R', block_addr, block_size) + expectedresponse = b"W" + cmd[1:] LOG.debug("Reading block %04x..." % (block_addr)) try: @@ -251,7 +231,7 @@ def _rt1_read_block(radio, block_addr, block_size): def _rt1_write_block(radio, block_addr, block_size): serial = radio.pipe - cmd = struct.pack(">cHb", 'W', block_addr, block_size) + cmd = struct.pack(">cHb", b'W', block_addr, block_size) data = radio.get_mmap()[block_addr:block_addr + block_size] LOG.debug("Writing Data:") @@ -271,7 +251,7 @@ def do_download(radio): LOG.debug("download") _rt1_enter_programming_mode(radio) - data = "" + data = b"" status = chirp_common.Status() status.msg = "Cloning from radio" @@ -291,7 +271,7 @@ def do_download(radio): _rt1_exit_programming_mode(radio) - return memmap.MemoryMap(data) + return memmap.MemoryMapBytes(data) def do_upload(radio): @@ -346,6 +326,7 @@ class RT1Radio(chirp_common.CloneModeRadio): VENDOR = "Retevis" MODEL = "RT1" BAUD_RATE = 2400 + NEEDS_COMPAT_SERIAL = False _ranges = [ (0x0000, 0x0190, 0x10), @@ -371,7 +352,7 @@ class RT1Radio(chirp_common.CloneModeRadio): "->Tone", "->DTCS", "DTCS->", "DTCS->DTCS"] rf.valid_power_levels = RT1_POWER_LEVELS rf.valid_duplexes = ["", "-", "+", "split", "off"] - rf.valid_modes = ["NFM", "FM"] # 12.5 KHz, 25 kHz. + rf.valid_modes = ["NFM", "FM"] # 12.5 kHz, 25 kHz. rf.valid_dtcs_codes = RT1_DTCS rf.memory_bounds = (1, 16) rf.valid_tuning_steps = [2.5, 5., 6.25, 10., 12.5, 25.] @@ -440,7 +421,7 @@ class RT1Radio(chirp_common.CloneModeRadio): mem.number = number mem.freq = int(_mem.rxfreq) * 10 - # We'll consider any blank (i.e. 0MHz frequency) to be empty + # We'll consider any blank (i.e. 0 MHz frequency) to be empty if mem.freq == 0: mem.empty = True return mem @@ -737,7 +718,7 @@ class RT1Radio(chirp_common.CloneModeRadio): elif element.value.get_mutable(): LOG.debug("Setting %s = %s" % (setting, element.value)) setattr(obj, setting, element.value) - except Exception as e: + except Exception: LOG.debug(element.get_name()) raise diff --git a/chirp/drivers/retevis_rt21.py b/chirp/drivers/retevis_rt21.py index 3309f54..68205f7 100644 --- a/chirp/drivers/retevis_rt21.py +++ b/chirp/drivers/retevis_rt21.py @@ -1,4 +1,4 @@ -# Copyright 2021-2022 Jim Unroe +# Copyright 2021-2023 Jim Unroe # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import time -import os import struct import logging @@ -33,7 +31,6 @@ from chirp.settings import ( RadioSettingValueBoolean, RadioSettingValueInteger, RadioSettingValueList, - RadioSettingValueString, ) LOG = logging.getLogger(__name__) @@ -57,7 +54,7 @@ struct { unknown5:4; u8 unknown6:5, scramble_type2:3; // Scramble Type 2 F -} memory[16]; +} memory[%d]; #seekto 0x011D; struct { @@ -397,7 +394,124 @@ struct { u8 skipflags[3]; // SCAN_ADD """ -CMD_ACK = "\x06" +MEM_FORMAT_RB28B = """ +#seekto 0x0000; +struct { + lbcd rxfreq[4]; // RX Frequency 0-3 + lbcd txfreq[4]; // TX Frequency 4-7 + ul16 rx_tone; // PL/DPL Decode 8-9 + ul16 tx_tone; // PL/DPL Encode A-B + u8 compander:1, // Compander C + unused_1:1, // + highpower:1, // Power Level + wide:1, // Bandwidth + bcl:1, // Busy Lock + unused_2:3; // + u8 reserved[3]; // Reserved D-F +} memory[30]; + +#seekto 0x002D; +struct { + u8 unknown_1:1, // 002D + unknown_2:1, // + gain:1, // MIC Gain + savem:1, // Battery Save Mode + save:1, // Battery Save + voice:1, // Voice Prompts + beep:1, // Beep + unused_3:1; // Power on Type + u8 squelch; // Squelch 002E + u8 tot; // Time-out Timer 002F + u8 channel_4[13]; // 0030-003C + u8 unused_3d:7, // 003D + vox:1; // Vox + u8 voxl; // Vox Level 003E + u8 voxd; // Vox Delay 003F + u8 channel_5[13]; // 0040-004C + u8 unknown_3[3]; // 004D-004F + u8 channel_6[13]; // 0050-005C + u8 unknown_4[3]; // 005D-005F + u8 channel_7[13]; // 0060-006C + u8 volume; // Volume 006D + u8 pfkey_lt; // Key Set < 006E + u8 pfkey_gt; // Key Set > 006F + u8 channel_8[13]; // 0070-007C + u8 unknown_5; // 007D + u8 unused_7e6:7, // 007E + pwrontype:1; // Power on Type + u8 unused_7f:7, // 007F + keylock:1; // Key Lock + u8 channel_9[13]; // 0080-008C + u8 unknown_7; // 008D + u8 chnumber; // Channel 008E +} settings; +""" + +MEM_FORMAT_RT86 = """ +#seekto 0x0000; +struct { + lbcd rxfreq[4]; // RX Frequency 0-3 + lbcd txfreq[4]; // TX Frequency 4-7 + ul16 rx_tone; // PL/DPL Decode 8-9 + ul16 tx_tone; // PL/DPL Encode A-B + u8 audio:2, // Audio C + highpower:1, // Power Level + wide:1, // Bandwidth + bcl:1, // Busy Lock OFF=0 ON=1 + scramble_type:3; // Scramble + u8 reserved[3]; // Reserved D-F +} memory[16]; + +#seekto 0x002D; +struct { + u8 unknown_1:1, // 002D + chnumberd:1, // Channel Number Disable + gain:1, // MIC Gain + savem:1, // Battery Save Mode + save:1, // Battery Save + beep:1, // Beep + voice:1, // Voice Prompts + unknown_2:1; // + u8 squelch; // Squelch 002E + u8 tot; // Time-out Timer 002F + u8 channel_4[13]; // 0030-003C + u8 unused_3d:7, // 003D + vox:1; // Vox + u8 voxl; // Vox Level 003E + u8 voxd; // Vox Delay 003F + u8 channel_5[13]; // 0040-004C + u8 unknown_4; // 004D + u8 unknown_5[2]; // 004E-004F + u8 channel_6[13]; // 0050-005C + u8 unknown_6; // 005D + u8 unknown_7[2]; // 005E-005F + u8 channel_7[13]; // 0060-006C + u8 warn; // Warn Mode 006D + u8 pf1; // Key Set PF1 006E + u8 pf2; // Key Set PF2 006F + u8 channel_8[13]; // 0070-007C + u8 unknown_8; // 007D + u8 tail; // QT/DQT Tail(inverted) 007E + u8 tailmode; // QT/DQT Tail Mode 007F + u8 channel_9[13]; // 0080-008C + u8 unknown_9[3]; // 008D-008F + u8 channel_10[13]; // 0090-009C + u8 unknown_10[3]; // 009D-009F + u8 channel_11[13]; // 00A0-00AC + u8 unknown_11[2]; // 00AD-00AE + u8 chnumber; // Channel Number 00AF +} settings; + +#seekto 0x004E; +u8 skipflags[2]; // SCAN_ADD + +#seekto 0x0100; +struct { + u8 freqhop; // Frequency Hop +} freqhops[16]; +""" + +CMD_ACK = b"\x06" ALARM_LIST = ["Local Alarm", "Remote Alarm"] BCL_LIST = ["Off", "Carrier", "QT/DQT"] @@ -408,11 +522,17 @@ FREQHOP_LIST = ["Off", "Hopping 1", "Hopping 2", "Hopping 3"] FUNCTION_LIST = ["Off", "Scramble", "Compand"] GAIN_LIST = ["Standard", "Enhanced"] HOP_LIST = ["Mode A", "Mode B", "Mode C", "Mode D", "Mode E"] +HOP86_LIST = ["Off", "Mode 1", "Mode 2", "Mode 3", "Mode 4"] PFKEY_LIST = ["None", "Monitor", "Lamp", "Warn", "VOX", "VOX Delay", "Key Lock", "Scan"] +PFKEY28B_LIST = ["None", "Scan", "Warn", "TX Power", "Monitor"] +PFKEY86_LIST = ["None", "Monitor", "Lamp", "Warn", "VOX", "VOX Delay", + "Key Lock", "TX Power", "Scan"] +POT_LIST = ["Channel Type", "Volume Type"] SAVE_LIST = ["Standard", "Super"] SAVEM_LIST = ["1-5", "1-8", "1-10", "1-15"] SCRAMBLE_LIST = ["OFF"] + ["%s" % x for x in range(1, 9)] +SPECIAL_LIST = ["Standard", "Special"] TAIL_LIST = ["134.4 Hz", "55 Hz"] TIMEOUTTIMER_LIST = ["Off"] + ["%s seconds" % x for x in range(15, 615, 15)] TOTALERT_LIST = ["Off"] + ["%s seconds" % x for x in range(1, 11)] @@ -434,48 +554,24 @@ PFKEY_VALUES = [0x0F, 0x04, 0x06, 0x08, 0x09, 0x0A] TOPKEY_CHOICES = ["None", "Alarming"] TOPKEY_VALUES = [0xFF, 0x0C] -SETTING_LISTS = { - "alarm": ALARM_LIST, - "bcl": BCL_LIST, - "bootsel": BOOTSEL_LIST, - "cdcss": CDCSS_LIST, - "cdcss": CDCSS2_LIST, - "freqhop": FREQHOP_LIST, - "function": FUNCTION_LIST, - "gain": GAIN_LIST, - "hop": HOP_LIST, - "pfkey": PFKEY_LIST, - "save": SAVE_LIST, - "savem": SAVEM_LIST, - "scramble": SCRAMBLE_LIST, - "tail": TAIL_LIST, - "tot": TIMEOUTTIMER_LIST, - "totalert": TOTALERT_LIST, - "voice": VOICE_LIST, - "voice": VOICE_LIST2, - "voice": VOICE_LIST3, - "vox": VOX_LIST, - "voxd": VOXD_LIST, - "voxl": VOXL_LIST, - "warn": WARN_LIST, - } - -GMRS_FREQS1 = [462.5625, 462.5875, 462.6125, 462.6375, 462.6625, - 462.6875, 462.7125] -GMRS_FREQS2 = [467.5625, 467.5875, 467.6125, 467.6375, 467.6625, - 467.6875, 467.7125] -GMRS_FREQS3 = [462.5500, 462.5750, 462.6000, 462.6250, 462.6500, - 462.6750, 462.7000, 462.7250] +GMRS_FREQS1 = [462562500, 462587500, 462612500, 462637500, 462662500, + 462687500, 462712500] +GMRS_FREQS2 = [467562500, 467587500, 467612500, 467637500, 467662500, + 467687500, 467712500] +GMRS_FREQS3 = [462550000, 462575000, 462600000, 462625000, 462650000, + 462675000, 462700000, 462725000] GMRS_FREQS = GMRS_FREQS1 + GMRS_FREQS2 + GMRS_FREQS3 * 2 FRS_FREQS = GMRS_FREQS1 + GMRS_FREQS2 + GMRS_FREQS3 -PMR_FREQS1 = [446.00625, 446.01875, 446.03125, 446.04375, 446.05625, - 446.06875, 446.08125, 446.09375] -PMR_FREQS2 = [446.10625, 446.11875, 446.13125, 446.14375, 446.15625, - 446.16875, 446.18125, 446.19375] +PMR_FREQS1 = [446006250, 446018750, 446031250, 446043750, 446056250, + 446068750, 446081250, 446093750] +PMR_FREQS2 = [446106250, 446118750, 446131250, 446143750, 446156250, + 446168750, 446181250, 446193750] PMR_FREQS = PMR_FREQS1 + PMR_FREQS2 +DTCS_EXTRA = tuple(sorted(chirp_common.DTCS_CODES + (645,))) + def _enter_programming_mode(radio): serial = radio.pipe @@ -486,9 +582,10 @@ def _enter_programming_mode(radio): serial.write(_magic) if radio._echo: chew = serial.read(len(_magic)) # Chew the echo - ack = serial.read(1) - if ack == "\x00": + for i in range(1, 5): ack = serial.read(1) + if ack == CMD_ACK: + break except: raise errors.RadioError("Error communicating with radio") @@ -498,7 +595,7 @@ def _enter_programming_mode(radio): raise errors.RadioError("Radio refused to enter programming mode") try: - serial.write("\x02") + serial.write(b"\x02") if radio._echo: serial.read(1) # Chew the echo ident = serial.read(8) @@ -533,7 +630,7 @@ def _enter_programming_mode(radio): def _exit_programming_mode(radio): serial = radio.pipe try: - serial.write("E") + serial.write(b"E") if radio._echo: chew = serial.read(1) # Chew the echo except: @@ -543,8 +640,8 @@ def _exit_programming_mode(radio): def _read_block(radio, block_addr, block_size): serial = radio.pipe - cmd = struct.pack(">cHb", 'R', block_addr, block_size) - expectedresponse = "W" + cmd[1:] + cmd = struct.pack(">cHb", b'R', block_addr, block_size) + expectedresponse = b"W" + cmd[1:] LOG.debug("Reading block %04x..." % (block_addr)) try: @@ -575,7 +672,7 @@ def _read_block(radio, block_addr, block_size): def _write_block(radio, block_addr, block_size): serial = radio.pipe - cmd = struct.pack(">cHb", 'W', block_addr, block_size) + cmd = struct.pack(">cHb", b'W', block_addr, block_size) data = radio.get_mmap()[block_addr:block_addr + block_size] LOG.debug("Writing Data:") @@ -596,7 +693,7 @@ def do_download(radio): LOG.debug("download") _enter_programming_mode(radio) - data = "" + data = b"" status = chirp_common.Status() status.msg = "Cloning from radio" @@ -616,7 +713,7 @@ def do_download(radio): _exit_programming_mode(radio) - return memmap.MemoryMap(data) + return memmap.MemoryMapBytes(data) def do_upload(radio): @@ -650,18 +747,21 @@ class RT21Radio(chirp_common.CloneModeRadio): VENDOR = "Retevis" MODEL = "RT21" BAUD_RATE = 9600 + NEEDS_COMPAT_SERIAL = False BLOCK_SIZE = 0x10 BLOCK_SIZE_UP = 0x10 - DTCS_CODES = sorted(chirp_common.DTCS_CODES + [17, 50, 645]) + DTCS_CODES = sorted(chirp_common.DTCS_CODES + (17, 50, 645)) POWER_LEVELS = [chirp_common.PowerLevel("High", watts=2.50), chirp_common.PowerLevel("Low", watts=1.00)] VALID_BANDS = [(400000000, 480000000)] - _magic = "PRMZUNE" - _fingerprint = ["P3207s\xF8\xFF", ] + _magic = b"PRMZUNE" + _fingerprint = [b"P3207s\xF8\xFF", ] _upper = 16 + _mem_params = (_upper, # number of channels + ) _ack_1st_block = True _skipflags = True _reserved = False @@ -684,7 +784,8 @@ class RT21Radio(chirp_common.CloneModeRadio): rf.can_odd_split = True rf.has_name = False if self.MODEL == "RT76" or \ - self.MODEL == "RT19" or self.MODEL == "RT619": + self.MODEL == "RT19" or self.MODEL == "RT619" or \ + self.MODEL == "RB28B" or self.MODEL == "RB628B": rf.valid_skips = [] else: rf.valid_skips = ["", "S"] @@ -693,7 +794,7 @@ class RT21Radio(chirp_common.CloneModeRadio): "->Tone", "->DTCS", "DTCS->", "DTCS->DTCS"] rf.valid_power_levels = self.POWER_LEVELS rf.valid_duplexes = ["", "-", "+", "split", "off"] - rf.valid_modes = ["FM", "NFM"] # 25 KHz, 12.5 kHz. + rf.valid_modes = ["FM", "NFM"] # 25 kHz, 12.5 kHz. rf.valid_dtcs_codes = self.DTCS_CODES rf.memory_bounds = (1, self._upper) rf.valid_tuning_steps = [2.5, 5., 6.25, 10., 12.5, 25.] @@ -702,7 +803,8 @@ class RT21Radio(chirp_common.CloneModeRadio): return rf def process_mmap(self): - self._memobj = bitwise.parse(MEM_FORMAT, self._mmap) + self._memobj = bitwise.parse(MEM_FORMAT % self._mem_params, + self._mmap) def sync_in(self): """Download from radio""" @@ -803,7 +905,7 @@ class RT21Radio(chirp_common.CloneModeRadio): mem.freq = int(_mem.rxfreq) * 10 - # We'll consider any blank (i.e. 0MHz frequency) to be empty + # We'll consider any blank (i.e. 0 MHz frequency) to be empty if mem.freq == 0: mem.empty = True return mem @@ -845,7 +947,8 @@ class RT21Radio(chirp_common.CloneModeRadio): mem.extra = RadioSettingGroup("Extra", "extra") if self.MODEL == "RT21" or self.MODEL == "RB17A" or \ - self.MODEL == "RT29_UHF" or self.MODEL == "RT29_VHF": + self.MODEL == "RT29_UHF" or self.MODEL == "RT29_VHF" or \ + self.MODEL == "RT21V": rs = RadioSettingValueList(BCL_LIST, BCL_LIST[_mem.bcl]) rset = RadioSetting("bcl", "Busy Channel Lockout", rs) mem.extra.append(rset) @@ -914,6 +1017,105 @@ class RT21Radio(chirp_common.CloneModeRadio): rset = RadioSetting("compander", "Compander", rs) mem.extra.append(rset) + if self.MODEL == "RB28B" or self.MODEL == "RB628B": + rs = RadioSettingValueBoolean(_mem.compander) + rset = RadioSetting("compander", "Compander", rs) + mem.extra.append(rset) + + rs = RadioSettingValueBoolean(_mem.bcl) + rset = RadioSetting("bcl", "Busy Channel Lockout", rs) + mem.extra.append(rset) + + if self.MODEL == "RT86": + _freqhops = self._memobj.freqhops[number - 1] + + rs = RadioSettingValueList(FUNCTION_LIST, + FUNCTION_LIST[_mem.audio]) + rset = RadioSetting("audio", "Audio", rs) + mem.extra.append(rset) + + rs = RadioSettingValueInteger(1, 8, _mem.scramble_type + 1) + rset = RadioSetting("scramble_type", "Scramble", rs) + mem.extra.append(rset) + + rs = RadioSettingValueList(HOP86_LIST, + HOP86_LIST[_freqhops.freqhop]) + rset = RadioSetting("freqhop", "Frequency Hop", rs) + mem.extra.append(rset) + + rs = RadioSettingValueBoolean(_mem.bcl) + rset = RadioSetting("bcl", "Busy Lock", rs) + mem.extra.append(rset) + + immutable = [] + + if self._frs: + if mem.number >= 1 and mem.number <= 22: + FRS_FREQ = FRS_FREQS[mem.number - 1] + mem.freq = FRS_FREQ + mem.duplex == '' + mem.offset = 0 + mem.mode = "NFM" + if mem.number >= 8 and mem.number <= 14: + mem.power = self.POWER_LEVELS[1] + immutable = ["empty", "freq", "duplex", "offset", "mode", + "power"] + else: + immutable = ["empty", "freq", "duplex", "offset", "mode"] + elif self._pmr: + if mem.number >= 1 and mem.number <= 16: + PMR_FREQ = PMR_FREQS[mem.number - 1] + mem.freq = PMR_FREQ + mem.duplex = '' + mem.offset = 0 + mem.mode = "NFM" + mem.power = self.POWER_LEVELS[1] + immutable = ["empty", "freq", "duplex", "offset", "mode", + "power"] + elif self._gmrs: + if mem.number >= 1 and mem.number <= 30: + GMRS_FREQ = GMRS_FREQS[mem.number - 1] + mem.freq = GMRS_FREQ + immutable = ["empty", "freq"] + if mem.number >= 1 and mem.number <= 7: + mem.duplex == '' + mem.offset = 0 + immutable += ["duplex", "offset"] + elif mem.number >= 8 and mem.number <= 14: + mem.duplex == '' + mem.offset = 0 + mem.mode = "NFM" + mem.power = self.POWER_LEVELS[1] + immutable += ["duplex", "offset", "mode", "power"] + elif mem.number >= 15 and mem.number <= 22: + mem.duplex == '' + mem.offset = 0 + immutable += ["duplex", "offset"] + elif mem.number >= 23 and mem.number <= 30: + mem.duplex == '+' + mem.offset = 5000000 + immutable += ["duplex", "offset"] + elif mem.freq in FRS_FREQS1: + mem.duplex == '' + mem.offset = 0 + immutable += ["duplex", "offset"] + elif mem.freq in FRS_FREQS2: + mem.duplex == '' + mem.offset = 0 + mem.mode = "NFM" + mem.power = self.POWER_LEVELS[1] + immutable += ["duplex", "offset", "mode", "power"] + elif mem.freq in FRS_FREQS3: + if mem.duplex == '': + mem.offset = 0 + if mem.duplex == '+': + mem.offset = 5000000 + else: + if mem.freq not in GMRS_FREQS: + immutable = ["duplex", "offset"] + + mem.immutable = immutable + return mem def _set_tone(self, mem, _mem): @@ -976,12 +1178,21 @@ class RT21Radio(chirp_common.CloneModeRadio): if self._reserved: _rsvd = _mem.reserved.get_raw() + if self.MODEL == "RT86": + _freqhops = self._memobj.freqhops[mem.number - 1] + if mem.empty: - if self.MODEL == "RB26" or self.MODEL == "RT76" \ - or self.MODEL == "RB23" \ - or self.MODEL == "RT40B": + if self.MODEL in ["RB23", + "RB26", + "RT40B", + "RT76", + "RT86", + ]: _mem.set_raw("\xFF" * 13 + _rsvd) - elif self.MODEL == "RT19" or self.MODEL == "RT619": + elif self.MODEL in ["RT19", + "RT86", + "RT619", + ]: _mem.set_raw("\xFF" * 13 + _rsvd) _freqhops.freqhop.set_raw("\x00") elif self.MODEL == "AR-63": @@ -1000,36 +1211,6 @@ class RT21Radio(chirp_common.CloneModeRadio): else: _mem.set_raw("\x00" * 13 + "\x30\x8F\xF8") - if self._gmrs: - if mem.number >= 1 and mem.number <= 30: - GMRS_FREQ = int(GMRS_FREQS[mem.number - 1] * 1000000) - mem.freq = GMRS_FREQ - if mem.number <= 22: - mem.duplex = '' - mem.offset = 0 - if mem.number >= 8 and mem.number <= 14: - mem.mode = "NFM" - mem.power = self.POWER_LEVELS[1] - if mem.number > 22: - mem.duplex = '+' - mem.offset = 5000000 - if self._frs: - if mem.number >= 1 and mem.number <= 22: - FRS_FREQ = int(FRS_FREQS[mem.number - 1] * 1000000) - mem.freq = FRS_FREQ - mem.mode = "NFM" - mem.duplex = '' - mem.offset = 0 - if mem.number >= 8 and mem.number <= 14: - mem.power = self.POWER_LEVELS[1] - if self._pmr: - PMR_FREQ = int(PMR_FREQS[mem.number - 1] * 1000000) - mem.freq = PMR_FREQ - mem.duplex = '' - mem.offset = 0 - mem.mode = "NFM" - mem.power = self.POWER_LEVELS[1] - _mem.rxfreq = mem.freq / 10 if mem.duplex == "off": @@ -1072,7 +1253,7 @@ class RT21Radio(chirp_common.CloneModeRadio): for setting in mem.extra: if setting.get_name() == "scramble_type": setattr(_mem, setting.get_name(), int(setting.value) - 1) - if self.MODEL == "RT21": + if self.MODEL == "RT21" or self.MODEL == "RT21V": setattr(_mem, "scramble_type2", int(setting.value) - 1) elif setting.get_name() == "freqhop": setattr(_freqhops, setting.get_name(), setting.value) @@ -1087,7 +1268,8 @@ class RT21Radio(chirp_common.CloneModeRadio): top = RadioSettings(basic) if self.MODEL == "RT21" or self.MODEL == "RB17A" or \ - self.MODEL == "RT29_UHF" or self.MODEL == "RT29_VHF": + self.MODEL == "RT29_UHF" or self.MODEL == "RT29_VHF" or \ + self.MODEL == "RT21V": _keys = self._memobj.keys rs = RadioSettingValueList(TIMEOUTTIMER_LIST, @@ -1144,7 +1326,7 @@ class RT21Radio(chirp_common.CloneModeRadio): val = PF1_VALUES[index] obj.set_value(val) - if self.MODEL == "RT21": + if self.MODEL == "RT21" or self.MODEL == "RT21V": if _keys.pf1 in PF1_VALUES: idx = PF1_VALUES.index(_keys.pf1) else: @@ -1218,11 +1400,15 @@ class RT21Radio(chirp_common.CloneModeRadio): rset.set_apply_callback(apply_pfkey_listvalue, _keys.pf2) basic.append(rset) - if self.MODEL == "RB26" or self.MODEL == "RT76" \ - or self.MODEL == "RB23" \ - or self.MODEL == "RT19" or self.MODEL == "RT619" \ - or self.MODEL == "AR-63" \ - or self.MODEL == "RT40B": + if self.MODEL in ["AR-63", + "RB23", + "RB26", + "RT19", + "RT40B", + "RT76", + "RT86", + "RT619", + ]: if self.MODEL == "RB26" or self.MODEL == "RB23": _settings2 = self._memobj.settings2 _settings3 = self._memobj.settings3 @@ -1271,7 +1457,9 @@ class RT21Radio(chirp_common.CloneModeRadio): rset = RadioSetting("voice", "Voice Prompts", rs) basic.append(rset) - if self.MODEL == "RT76": + if self.MODEL in ["RT76", + "RT86", + ]: rs = RadioSettingValueList(VOICE_LIST3, VOICE_LIST3[_settings.voice]) rset = RadioSetting("voice", "Voice Annumciation", rs) @@ -1288,6 +1476,12 @@ class RT21Radio(chirp_common.CloneModeRadio): rset = RadioSetting("chnumberd", "Channel Number Enable", rs) basic.append(rset) + if self.MODEL == "RT86": + rs = RadioSettingValueList(SPECIAL_LIST, + SPECIAL_LIST[_settings.tailmode]) + rset = RadioSetting("tailmode", "QT/DQT Tail Mode", rs) + basic.append(rset) + rs = RadioSettingValueBoolean(_settings.save) rset = RadioSetting("save", "Battery Save", rs) basic.append(rset) @@ -1296,7 +1490,10 @@ class RT21Radio(chirp_common.CloneModeRadio): rset = RadioSetting("beep", "Beep", rs) basic.append(rset) - if self.MODEL == "RB26" or self.MODEL == "RB23": + if self.MODEL in ["RB23", + "RB26", + "RT86", + ]: rs = RadioSettingValueBoolean(not _settings.tail) rset = RadioSetting("tail", "QT/DQT Tail", rs) basic.append(rset) @@ -1320,6 +1517,25 @@ class RT21Radio(chirp_common.CloneModeRadio): rset = RadioSetting("warn", "Warn Mode", rs) basic.append(rset) + if self.MODEL == "RT86": + rs = RadioSettingValueInteger(1, 16, _settings.chnumber + 1) + rset = RadioSetting("settings.chnumber", "Channel Number", rs) + basic.append(rset) + + rs = RadioSettingValueBoolean(_settings.vox) + rset = RadioSetting("vox", "Vox Function", rs) + basic.append(rset) + + rs = RadioSettingValueList(VOXL_LIST, + VOXL_LIST[_settings.voxl]) + rset = RadioSetting("voxl", "Vox Level", rs) + basic.append(rset) + + rs = RadioSettingValueList(VOXD_LIST, + VOXD_LIST[_settings.voxd]) + rset = RadioSetting("voxd", "Vox Delay", rs) + basic.append(rset) + if self.MODEL == "RB26" or self.MODEL == "RB23": rs = RadioSettingValueBoolean(_settings3.vox) rset = RadioSetting("settings3.vox", "Vox Function", rs) @@ -1465,6 +1681,91 @@ class RT21Radio(chirp_common.CloneModeRadio): rset = RadioSetting("voxd", "Vox Delay", rs) basic.append(rset) + if self.MODEL == "RT86": + rs = RadioSettingValueList(PFKEY86_LIST, + PFKEY86_LIST[_settings.pf1]) + rset = RadioSetting("pf1", "PF1 Key Set", rs) + basic.append(rset) + + rs = RadioSettingValueList(PFKEY86_LIST, + PFKEY86_LIST[_settings.pf2]) + rset = RadioSetting("pf2", "PF2 Key Set", rs) + basic.append(rset) + + if self.MODEL == "RB28B" or self.MODEL == "RB628B": + rs = RadioSettingValueInteger(0, 9, _settings.squelch) + rset = RadioSetting("squelch", "Squelch Level", rs) + basic.append(rset) + + rs = RadioSettingValueList(TIMEOUTTIMER_LIST, + TIMEOUTTIMER_LIST[_settings.tot]) + rset = RadioSetting("tot", "Time-out timer", rs) + basic.append(rset) + + rs = RadioSettingValueList(VOICE_LIST2, + VOICE_LIST2[_settings.voice]) + rset = RadioSetting("voice", "Voice Annumciation", rs) + basic.append(rset) + + rs = RadioSettingValueList(POT_LIST, + POT_LIST[_settings.pwrontype]) + rset = RadioSetting("pwrontype", "Power on Type", rs) + basic.append(rset) + + rs = RadioSettingValueList(SAVE_LIST, + SAVE_LIST[_settings.savem]) + rset = RadioSetting("savem", "Battery Save Mode", rs) + basic.append(rset) + + rs = RadioSettingValueList(GAIN_LIST, + GAIN_LIST[_settings.gain]) + rset = RadioSetting("gain", "MIC Gain", rs) + basic.append(rset) + + rs = RadioSettingValueInteger(1, 10, _settings.volume + 1) + rset = RadioSetting("volume", "Volume", rs) + basic.append(rset) + + rs = RadioSettingValueInteger(1, 22, _settings.chnumber + 1) + rset = RadioSetting("chnumber", "Channel Number", rs) + basic.append(rset) + + rs = RadioSettingValueBoolean(_settings.save) + rset = RadioSetting("save", "Battery Save", rs) + basic.append(rset) + + rs = RadioSettingValueBoolean(_settings.beep) + rset = RadioSetting("beep", "Beep", rs) + basic.append(rset) + + rs = RadioSettingValueBoolean(_settings.keylock) + rset = RadioSetting("keylock", "Key Lock", rs) + basic.append(rset) + + rs = RadioSettingValueBoolean(_settings.vox) + rset = RadioSetting("vox", "Vox Function", rs) + basic.append(rset) + + rs = RadioSettingValueList(VOXL_LIST, + VOXL_LIST[_settings.voxl]) + rset = RadioSetting("voxl", "Vox Level", rs) + basic.append(rset) + + rs = RadioSettingValueList(VOXD_LIST, + VOXD_LIST[_settings.voxd]) + rset = RadioSetting("voxd", "Vox Delay", rs) + basic.append(rset) + + rs = RadioSettingValueList(PFKEY28B_LIST, + PFKEY28B_LIST[_settings.pfkey_lt]) + rset = RadioSetting("pfkey_lt", "Key Set <", rs) + basic.append(rset) + + rs = RadioSettingValueList(PFKEY28B_LIST, + PFKEY28B_LIST[_settings.pfkey_gt]) + rset = RadioSetting("pfkey_gt", "Key Set >", rs) + basic.append(rset) + return top def set_settings(self, settings): @@ -1497,10 +1798,12 @@ class RT21Radio(chirp_common.CloneModeRadio): setattr(obj, setting, not int(element.value)) elif setting == "voicel": setattr(obj, setting, int(element.value) - 1) + elif setting == "volume": + setattr(obj, setting, int(element.value) - 1) elif element.value.get_mutable(): LOG.debug("Setting %s = %s" % (setting, element.value)) setattr(obj, setting, element.value) - except Exception as e: + except Exception: LOG.debug(element.get_name()) raise @@ -1540,8 +1843,8 @@ class RB17ARadio(RT21Radio): POWER_LEVELS = [chirp_common.PowerLevel("High", watts=5.00), chirp_common.PowerLevel("Low", watts=0.50)] - _magic = "PROA8US" - _fingerprint = ["P3217s\xF8\xFF", ] + _magic = b"PROA8US" + _fingerprint = [b"P3217s\xF8\xFF", ] _upper = 30 _skipflags = True _reserved = False @@ -1556,6 +1859,22 @@ class RB17ARadio(RT21Radio): self._memobj = bitwise.parse(MEM_FORMAT_RB17A, self._mmap) +@directory.register +class RT21VRadio(RT21Radio): + """RETEVIS RT21V""" + VENDOR = "Retevis" + MODEL = "RT21V" + POWER_LEVELS = [chirp_common.PowerLevel("High", watts=2.00), + chirp_common.PowerLevel("Low", watts=0.50)] + VALID_BANDS = [(137000000, 174000000)] + + _fingerprint = [b"P2207\x01\xF8\xFF", ] + _murs = False # sold as MURS radio but supports full band TX/RX + _upper = 5 + _mem_params = (_upper, # number of channels + ) + + @directory.register class RB26Radio(RT21Radio): """RETEVIS RB26""" @@ -1565,12 +1884,12 @@ class RB26Radio(RT21Radio): BLOCK_SIZE = 0x20 BLOCK_SIZE_UP = 0x10 - DTCS_CODES = sorted(chirp_common.DTCS_CODES + [645]) + DTCS_CODES = DTCS_EXTRA POWER_LEVELS = [chirp_common.PowerLevel("High", watts=3.00), chirp_common.PowerLevel("Low", watts=0.50)] - _magic = "PHOGR" + "\x01" + "0" - _fingerprint = ["P32073" + "\x02\xFF", ] + _magic = b"PHOGR" + b"\x01" + b"0" + _fingerprint = [b"P32073" + b"\x02\xFF", ] _upper = 30 _ack_1st_block = False _skipflags = True @@ -1595,12 +1914,12 @@ class RT76Radio(RT21Radio): BLOCK_SIZE = 0x20 BLOCK_SIZE_UP = 0x10 - DTCS_CODES = sorted(chirp_common.DTCS_CODES + [645]) + DTCS_CODES = DTCS_EXTRA POWER_LEVELS = [chirp_common.PowerLevel("High", watts=5.00), chirp_common.PowerLevel("Low", watts=0.50)] - _magic = "PHOGR\x14\xD4" - _fingerprint = ["P32073" + "\x02\xFF", ] + _magic = b"PHOGR\x14\xD4" + _fingerprint = [b"P32073" + b"\x02\xFF", ] _upper = 30 _ack_1st_block = False _skipflags = False @@ -1628,12 +1947,14 @@ class RT29UHFRadio(RT21Radio): TXPOWER_HIGH = 0x01 TXPOWER_LOW = 0x02 + DTCS_CODES = tuple(sorted(chirp_common.DTCS_CODES + (17, 50, 55, 135, + 217, 254, 305, 345, 425, 466, 534, 645, 765))) POWER_LEVELS = [chirp_common.PowerLevel("High", watts=10.00), chirp_common.PowerLevel("Mid", watts=5.00), chirp_common.PowerLevel("Low", watts=1.00)] - _magic = "PROHRAM" - _fingerprint = ["P3207" + "\x13\xF8\xFF", ] # UHF model + _magic = b"PROHRAM" + _fingerprint = [b"P3207" + b"\x13\xF8\xFF", ] # UHF model _upper = 16 _skipflags = True _reserved = False @@ -1663,8 +1984,8 @@ class RT29VHFRadio(RT29UHFRadio): VALID_BANDS = [(136000000, 174000000)] - _magic = "PROHRAM" - _fingerprint = ["P2207" + "\x01\xF8\xFF", ] # VHF model + _magic = b"PROHRAM" + _fingerprint = [b"P2207" + b"\x01\xF8\xFF", ] # VHF model @directory.register @@ -1678,8 +1999,8 @@ class RB23Radio(RT21Radio): POWER_LEVELS = [chirp_common.PowerLevel("High", watts=5.00), chirp_common.PowerLevel("Low", watts=0.50)] - _magic = "PHOGR" + "\x01" + "0" - _fingerprint = ["P32073" + "\x02\xFF", ] + _magic = b"PHOGR" + b"\x01" + b"0" + _fingerprint = [b"P32073" + b"\x02\xFF", ] _upper = 30 _ack_1st_block = False _skipflags = True @@ -1706,8 +2027,8 @@ class RT19Radio(RT21Radio): POWER_LEVELS = [chirp_common.PowerLevel("High", watts=2.00), chirp_common.PowerLevel("Low", watts=0.50)] - _magic = "PHOGRQ^" - _fingerprint = ["P32073" + "\x02\xFF", ] + _magic = b"PHOGRQ^" + _fingerprint = [b"P32073" + b"\x02\xFF", ] _upper = 22 _mem_params = (_upper, # number of channels 0x160, # memory start @@ -1737,13 +2058,14 @@ class RT619Radio(RT19Radio): POWER_LEVELS = [chirp_common.PowerLevel("High", watts=0.50), chirp_common.PowerLevel("Low", watts=0.49)] - _magic = "PHOGRS]" - _fingerprint = ["P32073" + "\x02\xFF", ] + _magic = b"PHOGRS]" + _fingerprint = [b"P32073" + b"\x02\xFF", ] _upper = 16 _mem_params = (_upper, # number of channels 0x100, # memory start _upper # number of freqhops ) + _frs = False _pmr = True _ranges = [ @@ -1763,9 +2085,9 @@ class AR63Radio(RT21Radio): POWER_LEVELS = [chirp_common.PowerLevel("High", watts=3.00), chirp_common.PowerLevel("Low", watts=1.00)] - _magic = "PHOGR\xF5\x9A" - _fingerprint = ["P32073" + "\x02\xFF", - "P32073" + "\x03\xFF", ] + _magic = b"PHOGR\xF5\x9A" + _fingerprint = [b"P32073" + b"\x02\xFF", + b"P32073" + b"\x03\xFF", ] _upper = 16 _ack_1st_block = False _skipflags = True @@ -1789,14 +2111,14 @@ class RT40BRadio(RT21Radio): BLOCK_SIZE = 0x20 BLOCK_SIZE_UP = 0x10 - DTCS_CODES = sorted(chirp_common.DTCS_CODES + [645]) + DTCS_CODES = DTCS_EXTRA POWER_LEVELS = [chirp_common.PowerLevel("High", watts=2.00), chirp_common.PowerLevel("Low", watts=0.50)] VALID_BANDS = [(400000000, 480000000)] - _magic = "PHOGRH" + "\x5C" - _fingerprint = ["P32073" + "\x02\xFF", ] + _magic = b"PHOGRH" + b"\x5C" + _fingerprint = [b"P32073" + b"\x02\xFF", ] _upper = 22 _mem_params = (_upper, # number of channels ) @@ -1814,3 +2136,78 @@ class RT40BRadio(RT21Radio): def process_mmap(self): self._memobj = bitwise.parse(MEM_FORMAT_RT40B % self._mem_params, self._mmap) + + +@directory.register +class RB28BRadio(RT21Radio): + """RETEVIS RB28B""" + VENDOR = "Retevis" + MODEL = "RB28B" + BLOCK_SIZE = 0x20 + BLOCK_SIZE_UP = 0x10 + + DTCS_CODES = DTCS_EXTRA + POWER_LEVELS = [chirp_common.PowerLevel("High", watts=2.00), + chirp_common.PowerLevel("Low", watts=0.50)] + + _magic = b"PHOGR\x08\xB2" + _fingerprint = [b"P32073" + b"\x02\xFF", ] + _upper = 22 + _ack_1st_block = False + _skipflags = False + _reserved = True + _frs = True + + _ranges = [ + (0x0000, 0x01F0), + ] + _memsize = 0x01F0 + + def process_mmap(self): + self._memobj = bitwise.parse(MEM_FORMAT_RB28B, self._mmap) + + +@directory.register +class RB628BRadio(RB28BRadio): + """RETEVIS RB628B""" + VENDOR = "Retevis" + MODEL = "RB628B" + + POWER_LEVELS = [chirp_common.PowerLevel("High", watts=0.50), + chirp_common.PowerLevel("Low", watts=0.50)] + + _magic = b"PHOGR\x09\xB2" + _fingerprint = [b"P32073" + b"\x02\xFF", ] + _upper = 16 + _frs = False + _pmr = True + + +@directory.register +class RT86Radio(RT21Radio): + """RETEVIS RT86""" + VENDOR = "Retevis" + MODEL = "RT86" + BLOCK_SIZE = 0x20 + BLOCK_SIZE_UP = 0x10 + + DTCS_CODES = DTCS_EXTRA + POWER_LEVELS = [chirp_common.PowerLevel("High", watts=2.00), + chirp_common.PowerLevel("Low", watts=0.50)] + + VALID_BANDS = [(400000000, 480000000)] + + _magic = b"PHOGR" + b"\xCD\x91" + _fingerprint = [b"P32073" + b"\x02\xFF", ] + _upper = 16 + _ack_1st_block = False + _skipflags = True + _reserved = True + + _ranges = [ + (0x0000, 0x01A0), + ] + _memsize = 0x01A0 + + def process_mmap(self): + self._memobj = bitwise.parse(MEM_FORMAT_RT86, self._mmap) diff --git a/chirp/drivers/retevis_rt22.py b/chirp/drivers/retevis_rt22.py index ec3e6e5..4148114 100644 --- a/chirp/drivers/retevis_rt22.py +++ b/chirp/drivers/retevis_rt22.py @@ -14,7 +14,6 @@ # along with this program. If not, see . import time -import os import struct import logging @@ -75,12 +74,12 @@ struct { } embedded_msg; """ -CMD_ACK = "\x06" +CMD_ACK = b"\x06" RT22_POWER_LEVELS = [chirp_common.PowerLevel("Low", watts=2.00), chirp_common.PowerLevel("High", watts=5.00)] -RT22_DTCS = sorted(chirp_common.DTCS_CODES + [645]) +RT22_DTCS = tuple(sorted(chirp_common.DTCS_CODES + (645,))) PF2KEY_LIST = ["Scan", "Local Alarm", "Remote Alarm"] TIMEOUTTIMER_LIST = ["Off"] + ["%s seconds" % x for x in range(15, 615, 15)] @@ -94,14 +93,6 @@ VOXDELAY_LIST = ["0.5 | Off", "3.0 | 4", "--- | 5"] -SETTING_LISTS = { - "pf2key": PF2KEY_LIST, - "tot": TIMEOUTTIMER_LIST, - "voice": VOICE_LIST, - "vox": VOX_LIST, - "voxdelay": VOXDELAY_LIST, - } - VALID_CHARS = chirp_common.CHARSET_ALPHANUMERIC + \ "`{|}!\"#$%&'()*+,-./:;<=>?@[]^_" @@ -124,12 +115,12 @@ def _get_radio_model(radio): def _rt22_enter_programming_mode(radio): serial = radio.pipe - magic = "PROGRGS" + magic = b"PROGRGS" exito = False for i in range(0, 5): for j in range(0, len(magic)): time.sleep(0.005) - serial.write(magic[j]) + serial.write(magic[j:j + 1]) ack = serial.read(1) try: @@ -147,7 +138,7 @@ def _rt22_enter_programming_mode(radio): raise errors.RadioError(msg) try: - serial.write("\x02") + serial.write(b"\x02") ident = serial.read(8) except: _rt22_exit_programming_mode(radio) @@ -178,13 +169,13 @@ def _rt22_enter_programming_mode(radio): raise errors.RadioError("Radio refused to enter programming mode") try: - serial.write("\x07") + serial.write(b"\x07") ack = serial.read(1) except: _rt22_exit_programming_mode(radio) raise errors.RadioError("Error communicating with radio") - if ack != "\x4E": + if ack != b"\x4E": _rt22_exit_programming_mode(radio) raise errors.RadioError("Radio refused to enter programming mode") @@ -194,7 +185,7 @@ def _rt22_enter_programming_mode(radio): def _rt22_exit_programming_mode(radio): serial = radio.pipe try: - serial.write("E") + serial.write(b"E") except: raise errors.RadioError("Radio refused to exit programming mode") @@ -202,14 +193,14 @@ def _rt22_exit_programming_mode(radio): def _rt22_read_block(radio, block_addr, block_size): serial = radio.pipe - cmd = struct.pack(">cHb", 'R', block_addr, block_size) - expectedresponse = "W" + cmd[1:] + cmd = struct.pack(">cHb", b'R', block_addr, block_size) + expectedresponse = b"W" + cmd[1:] LOG.debug("Reading block %04x..." % (block_addr)) try: for j in range(0, len(cmd)): time.sleep(0.005) - serial.write(cmd[j]) + serial.write(cmd[j:j + 1]) response = serial.read(4 + block_size) if response[:4] != expectedresponse: @@ -236,11 +227,10 @@ def _rt22_write_block(radio, block_addr, block_size, _requires_patch=False, _radio_id=""): serial = radio.pipe - cmd = struct.pack(">cHb", 'W', block_addr, block_size) + cmd = struct.pack(">cHb", b'W', block_addr, block_size) if _requires_patch: mmap = radio.get_mmap() data = mmap[block_addr:block_addr + block_size] - # For some radios (RT-622 & RT22FRS) memory at 0x1b8 reads as 0, but # radio ID should be written instead if block_addr == 0x1b8: @@ -256,10 +246,10 @@ def _rt22_write_block(radio, block_addr, block_size, _requires_patch=False, try: for j in range(0, len(cmd)): time.sleep(0.005) - serial.write(cmd[j]) + serial.write(cmd[j:j + 1]) for j in range(0, len(data)): time.sleep(0.005) - serial.write(data[j]) + serial.write(data[j:j + 1]) if serial.read(1) != CMD_ACK: raise Exception("No ACK") except: @@ -273,7 +263,7 @@ def do_download(radio): radio_ident = _rt22_enter_programming_mode(radio) LOG.info("Radio Ident is %s" % repr(radio_ident)) - data = "" + data = b"" status = chirp_common.Status() status.msg = "Cloning from radio" @@ -291,11 +281,9 @@ def do_download(radio): LOG.debug("Address: %04x" % addr) LOG.debug(util.hexprint(block)) - data += radio.MODEL.ljust(8) - _rt22_exit_programming_mode(radio) - return memmap.MemoryMap(data) + return memmap.MemoryMapBytes(data) def do_upload(radio): @@ -309,7 +297,7 @@ def do_upload(radio): LOG.info("Image Ident is %s" % repr(image_ident)) # Determine if upload requires patching - if image_ident == "\x00\x00\x00\x00\x00\x00\xFF\xFF": + if image_ident == b"\x00\x00\x00\x00\x00\x00\xFF\xFF": patch_block = True else: patch_block = False @@ -343,6 +331,7 @@ class RT22Radio(chirp_common.CloneModeRadio): VENDOR = "Retevis" MODEL = "RT22" BAUD_RATE = 9600 + NEEDS_COMPAT_SERIAL = False _ranges = [ (0x0000, 0x0180, 0x10), @@ -352,8 +341,8 @@ class RT22Radio(chirp_common.CloneModeRadio): ] _memsize = 0x0400 _block_size = 0x40 - _fileid = ["P32073", "P3" + "\x00\x00\x00" + "3", "P3207!", - "\x00\x00\x00\x00\x00\x00\xF8\xFF"] + _fileid = [b"P32073", b"P3" + b"\x00\x00\x00" + b"3", b"P3207!", + b"\x00\x00\x00\x00\x00\x00\xF8\xFF"] def get_features(self): rf = chirp_common.RadioFeatures() @@ -371,7 +360,7 @@ class RT22Radio(chirp_common.CloneModeRadio): "->Tone", "->DTCS", "DTCS->", "DTCS->DTCS"] rf.valid_power_levels = RT22_POWER_LEVELS rf.valid_duplexes = ["", "-", "+", "split", "off"] - rf.valid_modes = ["NFM", "FM"] # 12.5 KHz, 25 kHz. + rf.valid_modes = ["NFM", "FM"] # 12.5 kHz, 25 kHz. rf.valid_dtcs_codes = RT22_DTCS rf.memory_bounds = (1, 16) rf.valid_tuning_steps = [2.5, 5., 6.25, 10., 12.5, 25.] @@ -468,7 +457,7 @@ class RT22Radio(chirp_common.CloneModeRadio): mem.number = number mem.freq = int(_mem.rxfreq) * 10 - # We'll consider any blank (i.e. 0MHz frequency) to be empty + # We'll consider any blank (i.e. 0 MHz frequency) to be empty if mem.freq == 0: mem.empty = True return mem @@ -636,26 +625,27 @@ class RT22Radio(chirp_common.CloneModeRadio): 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 - - val = str(self._memobj.radio.id_0x200) - if val == "\xFF" * 8: - 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) + if self.MODEL != "W31E": + def _filter(name): + filtered = "" + for char in str(name): + if char in VALID_CHARS: + filtered += char + else: + filtered += " " + return filtered + + val = str(self._memobj.radio.id_0x200) + if val == "\xFF" * 8: + 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 @@ -678,7 +668,7 @@ class RT22Radio(chirp_common.CloneModeRadio): LOG.debug("Setting %s = %s" % (setting, element.value)) setattr(obj, setting, element.value) - except Exception as e: + except Exception: LOG.debug(element.get_name()) raise @@ -737,3 +727,16 @@ class RT22FRS(RT22Radio): class RT622(RT22Radio): VENDOR = "Retevis" MODEL = "RT622" + + +@directory.register +class W31E(RT22Radio): + """Baofeng W31E""" + VENDOR = "Baofeng" + MODEL = "W31E" + + _ranges = [ + (0x0000, 0x0200, 0x10), + ] + _memsize = 0x0200 + _block_size = 0x40 diff --git a/chirp/drivers/retevis_rt23.py b/chirp/drivers/retevis_rt23.py index bfe17b5..fc7b928 100644 --- a/chirp/drivers/retevis_rt23.py +++ b/chirp/drivers/retevis_rt23.py @@ -14,9 +14,7 @@ # along with this program. If not, see . import time -import os import struct -import re import logging from chirp import chirp_common, directory, memmap @@ -136,15 +134,15 @@ struct { } settings2; """ -CMD_ACK = "\x06" +CMD_ACK = b"\x06" BLOCK_SIZE = 0x10 RT23_POWER_LEVELS = [chirp_common.PowerLevel("Low", watts=1.00), chirp_common.PowerLevel("High", watts=2.50)] -RT23_DTCS = sorted(chirp_common.DTCS_CODES + - [17, 50, 55, 135, 217, 254, 305, 645, 765]) +RT23_DTCS = tuple(sorted(chirp_common.DTCS_CODES + + (17, 50, 55, 135, 217, 254, 305, 645, 765))) RT23_CHARSET = chirp_common.CHARSET_UPPER_NUMERIC + \ ":;<=>?@ !\"#$%&'()*+,-./" @@ -185,12 +183,12 @@ LIST_VOX = ["OFF"] + ["%s" % x for x in range(1, 6)] def _rt23_enter_programming_mode(radio): serial = radio.pipe - magic = "PROIUAM" + magic = b"PROIUAM" exito = False for i in range(0, 5): for j in range(0, len(magic)): time.sleep(0.005) - serial.write(magic[j]) + serial.write(magic[j:j + 1]) ack = serial.read(1) try: @@ -208,12 +206,12 @@ def _rt23_enter_programming_mode(radio): raise errors.RadioError(msg) try: - serial.write("\x02") + serial.write(b"\x02") ident = serial.read(8) except: raise errors.RadioError("Error communicating with radio") - if not ident.startswith("P31183"): + if not ident.startswith(b"P31183"): LOG.debug(util.hexprint(ident)) raise errors.RadioError("Radio returned unknown identification string") @@ -230,7 +228,7 @@ def _rt23_enter_programming_mode(radio): def _rt23_exit_programming_mode(radio): serial = radio.pipe try: - serial.write("E") + serial.write(b"E") except: raise errors.RadioError("Radio refused to exit programming mode") @@ -238,8 +236,8 @@ def _rt23_exit_programming_mode(radio): def _rt23_read_block(radio, block_addr, block_size): serial = radio.pipe - cmd = struct.pack(">cHb", 'R', block_addr, BLOCK_SIZE) - expectedresponse = "W" + cmd[1:] + cmd = struct.pack(">cHb", b'R', block_addr, BLOCK_SIZE) + expectedresponse = b"W" + cmd[1:] LOG.debug("Reading block %04x..." % (block_addr)) try: @@ -252,8 +250,8 @@ def _rt23_read_block(radio, block_addr, block_size): cs = 0 for byte in chunk[:-1]: - cs += ord(byte) - if ord(chunk[-1]) != (cs & 0xFF): + cs += byte + if chunk[-1] != (cs & 0xFF): raise Exception("Block failed checksum!") block_data = chunk[:-1] @@ -266,12 +264,12 @@ def _rt23_read_block(radio, block_addr, block_size): def _rt23_write_block(radio, block_addr, block_size): serial = radio.pipe - cmd = struct.pack(">cHb", 'W', block_addr, BLOCK_SIZE) + cmd = struct.pack(">cHb", b'W', block_addr, BLOCK_SIZE) data = radio.get_mmap()[block_addr:block_addr + BLOCK_SIZE] cs = 0 for byte in data: - cs += ord(byte) - data += chr(cs & 0xFF) + cs += byte + data += bytes([cs & 0xFF]) LOG.debug("Writing Data:") LOG.debug(util.hexprint(cmd + data)) @@ -289,7 +287,7 @@ def do_download(radio): LOG.debug("download") _rt23_enter_programming_mode(radio) - data = "" + data = b"" status = chirp_common.Status() status.msg = "Cloning from radio" @@ -302,8 +300,8 @@ def do_download(radio): radio.status_fn(status) block = _rt23_read_block(radio, addr, BLOCK_SIZE) - if addr == 0 and block.startswith("\xFF" * 6): - block = "P31183" + "\xFF" * 10 + if addr == 0 and block.startswith(b"\xFF" * 6): + block = b"P31183" + b"\xFF" * 10 data += block LOG.debug("Address: %04x" % addr) @@ -311,7 +309,7 @@ def do_download(radio): _rt23_exit_programming_mode(radio) - return memmap.MemoryMap(data) + return memmap.MemoryMapBytes(data) def do_upload(radio): @@ -335,7 +333,7 @@ def model_match(cls, data): if len(data) == 0x1000: rid = data[0x0000:0x0006] - return rid == "P31183" + return rid == b"P31183" else: return False @@ -361,6 +359,7 @@ class RT23Radio(chirp_common.CloneModeRadio): VENDOR = "Retevis" MODEL = "RT23" BAUD_RATE = 9600 + NEEDS_COMPAT_SERIAL = False _ranges = [ (0x0000, 0x0EC0), @@ -385,7 +384,7 @@ class RT23Radio(chirp_common.CloneModeRadio): "->Tone", "->DTCS", "DTCS->", "DTCS->DTCS"] rf.valid_power_levels = RT23_POWER_LEVELS rf.valid_duplexes = ["", "-", "+", "split", "off"] - rf.valid_modes = ["FM", "NFM"] # 25 KHz, 12.5 KHz. + rf.valid_modes = ["FM", "NFM"] # 25 kHz, 12.5 kHz. rf.valid_dtcs_codes = RT23_DTCS rf.memory_bounds = (1, 128) rf.valid_tuning_steps = _STEP_LIST @@ -477,7 +476,7 @@ class RT23Radio(chirp_common.CloneModeRadio): mem.freq = int(_mem.rxfreq) * 10 - # We'll consider any blank (i.e. 0MHz frequency) to be empty + # We'll consider any blank (i.e. 0 MHz frequency) to be empty if mem.freq == 0: mem.empty = True return mem @@ -849,7 +848,7 @@ class RT23Radio(chirp_common.CloneModeRadio): elif element.value.get_mutable(): LOG.debug("Setting %s = %s" % (setting, element.value)) setattr(obj, setting, element.value) - except Exception as e: + except Exception: LOG.debug(element.get_name()) raise diff --git a/chirp/drivers/retevis_rt26.py b/chirp/drivers/retevis_rt26.py index b10e331..255d80f 100644 --- a/chirp/drivers/retevis_rt26.py +++ b/chirp/drivers/retevis_rt26.py @@ -13,7 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import time import struct import logging import re @@ -23,7 +22,7 @@ from chirp import bitwise, errors, util from chirp.settings import RadioSetting, RadioSettingGroup, \ RadioSettingValueInteger, RadioSettingValueList, \ RadioSettingValueBoolean, RadioSettingValueString, \ - InvalidValueError, RadioSettings + RadioSettings LOG = logging.getLogger(__name__) @@ -113,7 +112,7 @@ struct { } fingerprint; """ -CMD_ACK = "\x06" +CMD_ACK = b"\x06" NUMERIC_CHARSET = list("0123456789") DTMF_CHARSET = NUMERIC_CHARSET + list("ABCD*#") @@ -121,7 +120,7 @@ DTMF_CHARSET = NUMERIC_CHARSET + list("ABCD*#") RT26_POWER_LEVELS = [chirp_common.PowerLevel("Low", watts=5.00), chirp_common.PowerLevel("High", watts=10.00)] -RT26_DTCS = sorted(chirp_common.DTCS_CODES + [645]) +RT26_DTCS = tuple(sorted(chirp_common.DTCS_CODES + (645,))) LIST_PTTID = ["Off", "BOT", "EOT", "Both"] LIST_SHORT_PRESS = ["Off", "Monitor On/Off", "", "Scan", "Alarm", @@ -145,30 +144,8 @@ LIST_DECODETO = ["%s" % x for x in range(500, 1000, 50)] + \ ["%s" % x for x in range(1000, 1600, 100)] LIST_STUNTYPE = ["TX/RX Inhibit", "TX Inhibit"] -SETTING_LISTS = { - "k1shortp": LIST_SHORT_PRESS, - "k1longp": LIST_LONG_PRESS, - "k2shortp": LIST_SHORT_PRESS, - "k2longp": LIST_LONG_PRESS, - "voxd": LIST_VOXDELAY, - "voice": LIST_VOICE, - "tot": LIST_TIMEOUTTIMER, - "save": LIST_SAVE, - "ssave": LIST_SSAVE, - "scanspeed": LIST_SCANSPEED, - "scandelay": LIST_SCANDELAY, - "digtime": LIST_DIGTIME, - "digdelay": LIST_DIGDELAY, - "starhash": LIST_STARHASH, - "codespace": LIST_CODESPACE, - "groupcode": LIST_GROUPCODE, - "resettime": LIST_RESETTIME, - "decodeto": LIST_DECODETO, - "stuntype": LIST_STUNTYPE, - } - # Retevis RT26 fingerprints -RT26_UHF_fp = "PDK80" + "\xF3\x00\x00" # RT26 UHF model +RT26_UHF_fp = b"PDK80" + b"\xF3\x00\x00" # RT26 UHF model MODELS = [RT26_UHF_fp, ] @@ -190,11 +167,11 @@ def _get_radio_model(radio): def _rt26_enter_programming_mode(radio): serial = radio.pipe - magic = ["PROGRAMa", "PROGRAMb"] + magic = [b"PROGRAMa", b"PROGRAMb"] for i in range(0, 2): try: - LOG.debug("sending " + magic[i]) + LOG.debug("sending " + magic[i].decode()) serial.write(magic[i]) ack = serial.read(1) except: @@ -211,13 +188,13 @@ def _rt26_enter_programming_mode(radio): try: LOG.debug("sending " + util.hexprint("\x02")) - serial.write("\x02") + serial.write(b"\x02") ident = serial.read(16) except: _rt26_exit_programming_mode(radio) raise errors.RadioError("Error communicating with radio") - if not ident.startswith("PDK80"): + if not ident.startswith(b"PDK80"): LOG.debug("Incorrect response, got this:\n\n" + util.hexprint(ident)) _rt26_exit_programming_mode(radio) LOG.debug(util.hexprint(ident)) @@ -225,13 +202,13 @@ def _rt26_enter_programming_mode(radio): try: LOG.debug("sending " + util.hexprint("MDK8ECUMHS1X7BN/")) - serial.write("MXT8KCUMHS1X7BN/") + serial.write(b"MXT8KCUMHS1X7BN/") ack = serial.read(1) except: _rt26_exit_programming_mode(radio) raise errors.RadioError("Error communicating with radio") - if ack != "\xB2": + if ack != b"\xB2": LOG.debug("Incorrect response, got this:\n\n" + util.hexprint(ack)) _rt26_exit_programming_mode(radio) raise errors.RadioError("Radio refused to enter programming mode") @@ -256,7 +233,7 @@ def _rt26_enter_programming_mode(radio): def _rt26_exit_programming_mode(radio): serial = radio.pipe try: - serial.write("E") + serial.write(b"E") except: raise errors.RadioError("Radio refused to exit programming mode") @@ -264,8 +241,8 @@ def _rt26_exit_programming_mode(radio): def _rt26_read_block(radio, block_addr, block_size): serial = radio.pipe - cmd = struct.pack(">cHb", 'R', block_addr, block_size) - expectedresponse = "W" + cmd[1:] + cmd = struct.pack(">cHb", b'R', block_addr, block_size) + expectedresponse = b"W" + cmd[1:] LOG.debug("Reading block %04x..." % (block_addr)) try: @@ -294,7 +271,7 @@ def _rt26_read_block(radio, block_addr, block_size): def _rt26_write_block(radio, block_addr, block_size): serial = radio.pipe - cmd = struct.pack(">cHb", 'W', block_addr, block_size) + cmd = struct.pack(">cHb", b'W', block_addr, block_size) data = radio.get_mmap()[block_addr:block_addr + block_size] LOG.debug("Writing Data:") @@ -314,7 +291,7 @@ def do_download(radio): LOG.debug("download") _rt26_enter_programming_mode(radio) - data = "" + data = b"" status = chirp_common.Status() status.msg = "Cloning from radio" @@ -334,7 +311,7 @@ def do_download(radio): _rt26_exit_programming_mode(radio) - return memmap.MemoryMap(data) + return memmap.MemoryMapBytes(data) def do_upload(radio): @@ -368,6 +345,7 @@ class RT26Radio(chirp_common.CloneModeRadio): VENDOR = "Retevis" MODEL = "RT26" BAUD_RATE = 4800 + NEEDS_COMPAT_SERIAL = False _ranges = [ (0x0000, 0x0190, 0x10), @@ -391,7 +369,7 @@ class RT26Radio(chirp_common.CloneModeRadio): "->Tone", "->DTCS", "DTCS->", "DTCS->DTCS"] rf.valid_power_levels = RT26_POWER_LEVELS rf.valid_duplexes = ["", "-", "+", "split", "off"] - rf.valid_modes = ["NFM", "FM"] # 12.5 KHz, 25 kHz. + rf.valid_modes = ["NFM", "FM"] # 12.5 kHz, 25 kHz. rf.valid_dtcs_codes = RT26_DTCS rf.memory_bounds = (1, 16) rf.valid_tuning_steps = [2.5, 5., 6.25, 10., 12.5, 25.] @@ -455,7 +433,7 @@ class RT26Radio(chirp_common.CloneModeRadio): mem.number = number mem.freq = int(_mem.rxfreq) * 10 - # We'll consider any blank (i.e. 0MHz frequency) to be empty + # We'll consider any blank (i.e. 0 MHz frequency) to be empty if mem.freq == 0: mem.empty = True return mem @@ -882,7 +860,7 @@ class RT26Radio(chirp_common.CloneModeRadio): setattr(obj, setting, int(element.value) + 3) elif setting == "dtmfspd": setattr(obj, setting, int(element.value) - 4) - elif re.match('code\d', setting): + elif re.match(r'code\d', setting): # set dtmf length field and then get bcd dtmf if setting == "code3": strlen = 10 @@ -898,7 +876,7 @@ class RT26Radio(chirp_common.CloneModeRadio): elif element.value.get_mutable(): LOG.debug("Setting %s = %s" % (setting, element.value)) setattr(obj, setting, element.value) - except Exception as e: + except Exception: LOG.debug(element.get_name()) raise diff --git a/chirp/drivers/retevis_rt76p.py b/chirp/drivers/retevis_rt76p.py index 09a643c..18a3dac 100644 --- a/chirp/drivers/retevis_rt76p.py +++ b/chirp/drivers/retevis_rt76p.py @@ -14,9 +14,7 @@ # along with this program. If not, see . import logging -import os import struct -import time from chirp import ( bitwise, @@ -31,7 +29,6 @@ from chirp.settings import ( RadioSettingGroup, RadioSettings, RadioSettingValueBoolean, - RadioSettingValueFloat, RadioSettingValueInteger, RadioSettingValueList, RadioSettingValueString, @@ -169,9 +166,9 @@ struct { """ -CMD_ACK = "\x06" +CMD_ACK = b"\x06" -RT76P_DTCS = sorted(chirp_common.DTCS_CODES + [645]) +RT76P_DTCS = tuple(sorted(chirp_common.DTCS_CODES + (645,))) DTMF_CHARS = "0123456789 *#ABCD" @@ -189,43 +186,19 @@ RPSTE_LIST = ["Off"] + ["%s" % x for x in range(100, 1100, 100)] SCMODE_LIST = ["Time (TO)", "Carrier (CO)", "Search (SE)"] TDRAB_LIST = ["Off", "A Band", "B Band"] TIMEOUTTIMER_LIST = ["%s seconds" % x for x in range(15, 615, 15)] -TONE_LIST = ["1000Hz", "1450Hz", "1750Hz", "2100Hz"] +TONE_LIST = ["1000 Hz", "1450 Hz", "1750 Hz", "2100 Hz"] VOICE_LIST = ["Off", "On"] WORKMODE_LIST = ["VFO Mode", "Channel Mode"] SKEY_CHOICES = ["FM", "Tx Power", "Moni", "Scan", "Offline", "Weather"] SKEY_VALUES = [0x07, 0x0A, 0x05, 0x1C, 0x0B, 0x0C] - -SETTING_LISTS = { - "abr": OFF1TO10_LIST, - "almod": ALMOD_LIST, - "dtmfspeed": DTMFSPEED_LIST, - "language": LANGUAGE_LIST, - "mdfa": MDF_LIST, - "mdfb": MDF_LIST, - "pttid": PTTID_LIST, - "rpste": RPSTE_LIST, - "rptrl": RPSTE_LIST, - "rxled": BACKLIGHT_LIST, - "scode": PTTIDCODE_LIST, - "scmode": SCMODE_LIST, - "tdrab": TDRAB_LIST, - "tot": TIMEOUTTIMER_LIST, - "tone": TONE_LIST, - "txled": BACKLIGHT_LIST, - "voice": VOICE_LIST, - "vox": OFF1TO10_LIST, - "workmode": WORKMODE_LIST, - "wtled": BACKLIGHT_LIST, - } - -GMRS_FREQS1 = [462.5625, 462.5875, 462.6125, 462.6375, 462.6625, - 462.6875, 462.7125] -GMRS_FREQS2 = [467.5625, 467.5875, 467.6125, 467.6375, 467.6625, - 467.6875, 467.7125] -GMRS_FREQS3 = [462.5500, 462.5750, 462.6000, 462.6250, 462.6500, - 462.6750, 462.7000, 462.7250] +GMRS_FREQS1 = [462562500, 462587500, 462612500, 462637500, 462662500, + 462687500, 462712500] +GMRS_FREQS2 = [467562500, 467587500, 467612500, 467637500, 467662500, + 467687500, 467712500] +GMRS_FREQS3 = [462550000, 462575000, 462600000, 462625000, 462650000, + 462675000, 462700000, 462725000] GMRS_FREQS = GMRS_FREQS1 + GMRS_FREQS2 + GMRS_FREQS3 * 2 @@ -252,7 +225,7 @@ def _rt76p_enter_programming_mode(radio): raise errors.RadioError(msg) try: - serial.write("F") + serial.write(b"F") ident = serial.read(8) except: raise errors.RadioError("Error communicating with radio") @@ -265,7 +238,7 @@ def _rt76p_enter_programming_mode(radio): def _rt76p_exit_programming_mode(radio): serial = radio.pipe try: - serial.write("E") + serial.write(b"E") except: raise errors.RadioError("Radio refused to exit programming mode") @@ -273,8 +246,8 @@ def _rt76p_exit_programming_mode(radio): def _rt76p_read_block(radio, block_addr, block_size): serial = radio.pipe - cmd = struct.pack(">cHb", 'R', block_addr, block_size) - expectedresponse = "R" + cmd[1:] + cmd = struct.pack(">cHb", b'R', block_addr, block_size) + expectedresponse = b"R" + cmd[1:] LOG.debug("Reading block %04x..." % (block_addr)) try: @@ -293,7 +266,7 @@ def _rt76p_read_block(radio, block_addr, block_size): def _rt76p_write_block(radio, block_addr, block_size): serial = radio.pipe - cmd = struct.pack(">cHb", 'W', block_addr, block_size) + cmd = struct.pack(">cHb", b'W', block_addr, block_size) data = radio.get_mmap()[block_addr:block_addr + block_size] LOG.debug("Writing Data:") @@ -313,7 +286,7 @@ def do_download(radio): LOG.debug("download") _rt76p_enter_programming_mode(radio) - data = "" + data = b"" status = chirp_common.Status() status.msg = "Cloning from radio" @@ -333,7 +306,7 @@ def do_download(radio): _rt76p_exit_programming_mode(radio) - return memmap.MemoryMap(data) + return memmap.MemoryMapBytes(data) def do_upload(radio): @@ -360,14 +333,15 @@ class RT76PRadio(chirp_common.CloneModeRadio): VENDOR = "Retevis" MODEL = "RT76P" BAUD_RATE = 9600 + NEEDS_COMPAT_SERIAL = False BLOCK_SIZE = 0x40 BLOCK_SIZE_UP = 0x20 RT76P_POWER_LEVELS = [chirp_common.PowerLevel("High", watts=5.00), chirp_common.PowerLevel("Low", watts=0.50)] - _magic = "PROGROMCD2U" - _fingerprint = "\x01\x36\x01\x74\x04\x00\x05\x20" + _magic = b"PROGROMCD2U" + _fingerprint = b"\x01\x36\x01\x74\x04\x00\x05\x20" _ranges = [ (0x0000, 0x0820), @@ -396,7 +370,7 @@ class RT76PRadio(chirp_common.CloneModeRadio): "->Tone", "->DTCS", "DTCS->", "DTCS->DTCS"] rf.valid_power_levels = self.RT76P_POWER_LEVELS rf.valid_duplexes = ["", "-", "+", "split", "off"] - rf.valid_modes = ["FM", "NFM"] # 25 kHz, 12.5 KHz. + rf.valid_modes = ["FM", "NFM"] # 25 kHz, 12.5 kHz. rf.valid_dtcs_codes = RT76P_DTCS rf.memory_bounds = (1, 128) rf.valid_tuning_steps = [2.5, 5., 6.25, 10., 12.5, 20., 25., 50.] @@ -567,15 +541,15 @@ class RT76PRadio(chirp_common.CloneModeRadio): _mem.set_raw("\x00" * 16) - if float(mem.freq) / 1000000 in GMRS_FREQS1: + if mem.freq in GMRS_FREQS1: mem.duplex == '' mem.offset = 0 - elif float(mem.freq) / 1000000 in GMRS_FREQS2: + elif mem.freq in GMRS_FREQS2: mem.duplex == '' mem.offset = 0 mem.mode = "NFM" - mem.power = self.POWER_LEVELS[1] - elif float(mem.freq) / 1000000 in GMRS_FREQS3: + mem.power = self.RT76P_POWER_LEVELS[1] + elif mem.freq in GMRS_FREQS3: if mem.duplex == '+': mem.offset = 5000000 else: @@ -998,7 +972,7 @@ class RT76PRadio(chirp_common.CloneModeRadio): elif element.value.get_mutable(): LOG.debug("Setting %s = %s" % (setting, element.value)) setattr(obj, setting, element.value) - except Exception as e: + except Exception: LOG.debug(element.get_name()) raise diff --git a/chirp/drivers/retevis_rt87.py b/chirp/drivers/retevis_rt87.py index 0717424..10ff7f8 100644 --- a/chirp/drivers/retevis_rt87.py +++ b/chirp/drivers/retevis_rt87.py @@ -124,9 +124,9 @@ struct { // 110 6 (default) // 111 7 u8 unknown_083B:1, - pf1:3, // PF1 (Off, Reverse, Opt Call, 1750Hz, A/B) [21] + pf1:3, // PF1 (Off, Reverse, Opt Call, 1750 Hz, A/B) [21] unknown_083B1:1, - pf2:3; // PF2 (Off, Reverse, Opt Call, 1750Hz, A/B) [22] + pf2:3; // PF2 (Off, Reverse, Opt Call, 1750 Hz, A/B) [22] u8 unknown_083c; // factory = 05, reset = FF u8 unknown_083d; // factory = 12, reset = FF u8 unknown_083e; // factory = 50, reset = FF @@ -196,7 +196,7 @@ struct name names[128]; # Radio supports UPPER/lower case and symbols CHARSET_ASCII_PLUS = chirp_common.CHARSET_ALPHANUMERIC + \ - "!\"#$%&'()*+,-./:;<=>?@[\]^_`" + "!\"#$%&'()*+,-./:;<=>?@[\\]^_`" POWER_LEVELS = [chirp_common.PowerLevel('Low', watts=1), chirp_common.PowerLevel('High', watts=4)] @@ -204,7 +204,7 @@ POWER_LEVELS = [chirp_common.PowerLevel('Low', watts=1), VALID_BANDS = [(136000000, 174000000), (400000000, 480000000)] -RT87_DTCS = sorted(chirp_common.DTCS_CODES + [645]) +RT87_DTCS = tuple(sorted(chirp_common.DTCS_CODES + (645,))) NUMERIC_CHARSET = list("0123456789") DTMF_CHARSET = NUMERIC_CHARSET + list("ABCD*#") @@ -253,7 +253,7 @@ def _identify(radio): .format(magic, echo)) ack = radio.pipe.read(2) - if ack != "\x06\x30": + if ack != b"\x06\x30": raise errors.RadioError("Radio did not ACK first command: %r" % ack) except: @@ -263,9 +263,9 @@ def _identify(radio): def _download(radio): _identify(radio) - data = [] + data = bytes([]) for i in range(0, 0x2000, 0x40): - msg = struct.pack('>cHb', 'R', i, 0x40) + msg = struct.pack('>cHb', b'R', i, 0x40) radio.pipe.write(msg) echo = radio.pipe.read(len(msg)) # Chew the echoed response @@ -288,9 +288,9 @@ def _download(radio): status.msg = "Cloning from radio" radio.status_fn(status) - radio.pipe.write("E") + radio.pipe.write(b"E") - return memmap.MemoryMap(data) + return memmap.MemoryMapBytes(data) def _upload(radio): @@ -298,12 +298,12 @@ def _upload(radio): for start_addr, end_addr, block_size in radio._ranges: for addr in range(start_addr, end_addr, block_size): - msg = struct.pack('>cHb', 'W', addr, block_size) + msg = struct.pack('>cHb', b'W', addr, block_size) msg += radio._mmap[addr:(addr + block_size)] radio.pipe.write(msg) radio.pipe.read(block_size + 4) ack = radio.pipe.read(1) - if ack != '\x06': + if ack != b'\x06': raise errors.RadioError('Radio did not ACK block %i (0x%04x)' % (addr, addr)) @@ -314,7 +314,7 @@ def _upload(radio): status.msg = "Cloning to radio" radio.status_fn(status) - radio.pipe.write("E") + radio.pipe.write(b"E") def _split(rf, f1, f2): @@ -336,7 +336,8 @@ class Rt87BaseRadio(chirp_common.CloneModeRadio): VENDOR = "Retevis" MODEL = "RT87 Base" BAUD_RATE = 9600 - _MAGIC = "PGM2017" + NEEDS_COMPAT_SERIAL = False + _MAGIC = b"PGM2017" def get_features(self): rf = chirp_common.RadioFeatures() @@ -1024,7 +1025,7 @@ class Rt87BaseRadio(chirp_common.CloneModeRadio): elif element.value.get_mutable(): LOG.debug("Setting %s = %s" % (setting, element.value)) setattr(obj, setting, element.value) - except Exception as e: + except Exception: LOG.debug(element.get_name()) raise diff --git a/chirp/drivers/retevis_rt98.py b/chirp/drivers/retevis_rt98.py index 6520a99..697a675 100644 --- a/chirp/drivers/retevis_rt98.py +++ b/chirp/drivers/retevis_rt98.py @@ -13,9 +13,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import os import struct -import time import logging from chirp import bitwise @@ -26,14 +24,13 @@ from chirp import memmap from chirp import util from chirp.settings import RadioSettingGroup, RadioSetting, RadioSettings, \ RadioSettingValueList, RadioSettingValueString, RadioSettingValueBoolean, \ - RadioSettingValueInteger, RadioSettingValueString, \ - RadioSettingValueFloat, InvalidValueError + RadioSettingValueInteger LOG = logging.getLogger(__name__) # -# Chirp Driver for Retevis RT98 models: RT98V (136-174 Mhz) -# RT98U (400-490 Mhz) +# Chirp Driver for Retevis RT98 models: RT98V (136-174 MHz) +# RT98U (400-490 MHz) # # # @@ -65,13 +62,13 @@ PMR_POWER_LEVELS = [chirp_common.PowerLevel("Low", watts=0.5), ] FREENET_POWER_LEVELS = [chirp_common.PowerLevel("Low", watts=1), ] -PMR_FREQS = [446.00625, 446.01875, 446.03125, 446.04375, - 446.05625, 446.06875, 446.08125, 446.09375, - 446.10625, 446.11875, 446.13125, 446.14375, - 446.15625, 446.16875, 446.18125, 446.19375] +PMR_FREQS = [446006250, 446018750, 446031250, 446043750, + 446056250, 446068750, 446081250, 446093750, + 446106250, 446118750, 446131250, 446143750, + 446156250, 446168750, 446181250, 446193750] -FREENET_FREQS = [149.02500, 149.03750, 149.05000, - 149.08750, 149.10000, 149.11250] +FREENET_FREQS = [149025000, 149037500, 149050000, + 149087500, 149100000, 149112500] CROSS_MODES = ["Tone->Tone", "DTCS->", "->DTCS", "Tone->DTCS", "DTCS->Tone", "->Tone", "DTCS->DTCS"] @@ -118,25 +115,6 @@ LIST_RT98U_FREQS = ["Rx(446 - 446.2 MHz) Tx(446 - 446.2 MHz)", "Rx(400 - 470 MHz) Tx(400 - 470 MHz)", "Rx(450 - 470 MHz) Tx(450 - 470 MHz)"] -SETTING_LISTS = { - "tuning_step": LIST_STEP, - "timeout_timer": LIST_TIMEOUT, - "auto_power_off": LIST_APO, - "squelch": LIST_SQUELCH, - "display_mode": LIST_DISPLAY_MODE, - "auto_power_on": LIST_AOP, - "ste_type": LIST_STE_TYPE, - "ste_frequency": LIST_STE_FREQ, - "priority_ch": LIST_PRIORITY_CH, - "revert_ch": LIST_REVERT_CH, - "settings2.dropout_delay_time": LIST_TIME50, - "settings2.dwell_time": LIST_TIME50, - "settings2.look_back_time_a": LIST_TIME46, - "settings2.look_back_time_b": LIST_TIME46, - "settings3.vfomr": LIST_VFOMR, - "settings.scan": LIST_SCAN -} - # RT98 memory map # section: 1 Channel Bank # description of channel bank (199 channels , range 1-199) @@ -538,7 +516,7 @@ def _echo_write(radio, data): def _checksum(data): cs = 0 for byte in data: - cs += ord(byte) + cs += byte return cs % 256 @@ -598,13 +576,13 @@ def check_ver(ver_response, allowed_types): def _ident(radio): radio.pipe.timeout = 1 - _echo_write(radio, "PROGRAM") + _echo_write(radio, b"PROGRAM") response = radio.pipe.read(3) - if response != "QX\06": + if response != b"QX\06": _finish(radio) LOG.debug("Response was :\n%s" % util.hexprint(response)) raise errors.RadioError("Radio did not respond. Check connection.") - _echo_write(radio, "\x02") + _echo_write(radio, b"\x02") ver_response = radio.pipe.read(16) LOG.debug(util.hexprint(ver_response)) @@ -623,13 +601,13 @@ def _send(radio, cmd, addr, length, data=None): frame = struct.pack(">cHb", cmd, addr, length) if data: frame += data - frame += chr(_checksum(frame[1:])) - frame += "\x06" + frame += bytes([_checksum(frame[1:])]) + frame += b"\x06" _echo_write(radio, frame) LOG.debug("Sent:\n%s" % util.hexprint(frame)) if data: result = radio.pipe.read(1) - if result != "\x06": + if result != b"\x06": _finish(radio) LOG.debug("Ack was: %s" % repr(result)) raise errors.RadioError("Radio did not accept block at %04x" @@ -637,10 +615,10 @@ def _send(radio, cmd, addr, length, data=None): return result = _read(radio, length + 6) LOG.debug("Got:\n%s" % util.hexprint(result)) - header = result[0:4] + header = result[:4] data = result[4:-2] - ack = result[-1] - if ack != "\x06": + ack = result[-1:] + if ack != b"\x06": _finish(radio) LOG.debug("Ack was: %s" % repr(ack)) raise errors.RadioError("Radio NAK'd block at %04x" % addr) @@ -652,19 +630,19 @@ def _send(radio, cmd, addr, length, data=None): LOG.debug(" Addr: %04x/%04x" % (addr, _addr)) raise errors.RadioError("Radio send unexpected block") cs = _checksum(result[1:-2]) - if cs != ord(result[-2]): + if cs != result[-2]: _finish(radio) LOG.debug("Calculated: %02x" % cs) - LOG.debug("Actual: %02x" % ord(result[-2])) + LOG.debug("Actual: %02x" % result[-2]) raise errors.RadioError("Block at 0x%04x failed checksum" % addr) return data def _finish(radio): - endframe = "\x45\x4E\x44" + endframe = b"\x45\x4E\x44" _echo_write(radio, endframe) result = radio.pipe.read(1) - if result != "\x06": + if result != b"\x06": LOG.error("Got:\n%s" % util.hexprint(result)) raise errors.RadioError("Radio did not finish cleanly") @@ -674,10 +652,10 @@ def do_download(radio): _ident(radio) _memobj = None - data = "" + data = b"" for addr in range(0, radio._memsize, 0x10): - block = _send(radio, 'R', addr, 0x10) + block = _send(radio, b'R', addr, 0x10) data += block status = chirp_common.Status() status.cur = len(data) @@ -687,7 +665,7 @@ def do_download(radio): _finish(radio) - return memmap.MemoryMap(data) + return memmap.MemoryMapBytes(data) def do_upload(radio): @@ -711,9 +689,9 @@ def do_upload(radio): image_band_limits = LIST_RT98U_FREQS[int(_embedded.mode)] if str(_embedded.radio_type).rstrip("\00") in ["RT98V", "AT-779V"]: image_band_limits = LIST_RT98V_FREQS[int(_embedded.mode)] - if model in ["RT98U", "AT-779U"]: + if str(model).rstrip("\00") in ["RT98U", "AT-779U"]: radio_band_limits = LIST_RT98U_FREQS[int(bandlimit)] - if model in ["RT98V", "AT-779V"]: + if str(model).rstrip("\00") in ["RT98V", "AT-779V"]: radio_band_limits = LIST_RT98V_FREQS[int(bandlimit)] LOG.warning('radio and image band limits differ') @@ -731,7 +709,7 @@ def do_upload(radio): for start, end in radio._ranges: for addr in range(start, end, 0x10): block = radio._mmap[addr:addr+0x10] - _send(radio, 'W', addr, len(block), block) + _send(radio, b'W', addr, len(block), block) status = chirp_common.Status() status.cur = addr status.max = end @@ -754,6 +732,7 @@ class Rt98BaseRadio(chirp_common.CloneModeRadio, VENDOR = "Retevis" MODEL = "RT98 Base" BAUD_RATE = 9600 + NEEDS_COMPAT_SERIAL = False _memsize = 0x3E00 _ranges = [(0x0000, 0x3310), @@ -796,14 +775,11 @@ class Rt98BaseRadio(chirp_common.CloneModeRadio, rf.memory_bounds = (1, 199) rf.valid_name_length = 6 if _embedded.mode == 0: # PMR or FreeNet - rf.valid_duplexes = [''] + rf.valid_duplexes = ['', 'off'] else: rf.valid_duplexes = DUPLEXES + ['split', 'off'] rf.valid_characters = chirp_common.CHARSET_UPPER_NUMERIC + "- " - if _embedded.mode == 0: # PMR or FreeNet - rf.valid_modes = ['NFM'] - else: - rf.valid_modes = ['FM', 'NFM'] + rf.valid_modes = ['FM', 'NFM'] rf.valid_tmodes = ['', 'Tone', 'TSQL', 'DTCS', 'Cross'] rf.valid_cross_modes = CROSS_MODES if _embedded.mode == 0: # PMR or FreeNet @@ -813,13 +789,14 @@ class Rt98BaseRadio(chirp_common.CloneModeRadio, rf.valid_power_levels = FREENET_POWER_LEVELS else: rf.valid_power_levels = POWER_LEVELS + rf.valid_tones = TONES rf.valid_dtcs_codes = chirp_common.ALL_DTCS_CODES try: rf.valid_bands = get_band_limits_Hz( str(_embedded.radio_type), int(_embedded.mode)) - except TypeError as e: + except TypeError: # If we're asked without memory loaded, assume the most permissive rf.valid_bands = get_band_limits_Hz(str(_embedded.radio_type), 1) except Exception as e: @@ -829,31 +806,6 @@ class Rt98BaseRadio(chirp_common.CloneModeRadio, rf.valid_tuning_steps = TUNING_STEPS return rf - def validate_memory(self, mem): - _embedded = self._memobj.embedded_msg - msgs = "" - msgs = chirp_common.CloneModeRadio.validate_memory(self, mem) - - # FreeNet and PMR radio types - if _embedded.mode == 0: # PMR or FreeNet - freq = float(mem.freq) / 1000000 - - # FreeNet - if str(_embedded.radio_type).rstrip("\00") == "RT98V": - if freq not in FREENET_FREQS: - _msg_freq = 'Memory location not a valid FreeNet frequency' - # warn user invalid frequency - msgs.append(chirp_common.ValidationError(_msg_freq)) - - # PMR - if str(_embedded.radio_type).rstrip("\00") == "RT98U": - if freq not in PMR_FREQS: - _msg_freq = 'Memory location not a valid PMR frequency' - # warn user invalid frequency - msgs.append(chirp_common.ValidationError(_msg_freq)) - - return msgs - # Do a download of the radio from the serial port def sync_in(self): self._mmap = do_download(self) @@ -899,7 +851,7 @@ class Rt98BaseRadio(chirp_common.CloneModeRadio, mem.number = number # Set the memory number - # We'll consider any blank (i.e. 0MHz frequency) to be empty + # We'll consider any blank (i.e. 0 MHz frequency) to be empty if _mem.freq == 0: mem.empty = True return mem @@ -920,7 +872,9 @@ class Rt98BaseRadio(chirp_common.CloneModeRadio, mem.offset = int(_mem.offset) * 10 # Set the duplex flags - if _mem.duplex == DUPLEX_POSSPLIT: + if _mem.tx_off: # handle tx off + mem.duplex = 'off' + elif _mem.duplex == DUPLEX_POSSPLIT: mem.duplex = '+' elif _mem.duplex == DUPLEX_NEGSPLIT: mem.duplex = '-' @@ -932,21 +886,17 @@ class Rt98BaseRadio(chirp_common.CloneModeRadio, LOG.error('%s: get_mem: unhandled duplex: %02x' % (mem.name, _mem.duplex)) - # handle tx off - if _mem.tx_off: - mem.duplex = 'off' - # Set the channel width if _mem.channel_width == CHANNEL_WIDTH_12d5kHz: mem.mode = 'NFM' elif _embedded.mode == 0: # PMR or FreeNet - LOG.info('PMR and FreeNet channels must be Channel Width 12.5kHz') + LOG.info('PMR and FreeNet channels must be Channel Width 12.5 kHz') mem.mode = 'NFM' elif _mem.channel_width == CHANNEL_WIDTH_25kHz: mem.mode = 'FM' elif _mem.channel_width == CHANNEL_WIDTH_20kHz: LOG.info( - '%s: get_mem: promoting 20kHz channel width to 25kHz' % + '%s: get_mem: promoting 20 kHz channel width to 25 kHz' % mem.name) mem.mode = 'FM' else: @@ -1042,10 +992,34 @@ class Rt98BaseRadio(chirp_common.CloneModeRadio, if mem.empty: self._memobj.csetflag[cbyte].c[cbit] = 0 self._memobj.cskipflag[cbyte].c[cbit] = 0 - _mem.set_raw('\xff' * (_mem.size() / 8)) + _mem.set_raw("\xff" * 32) return - _mem.set_raw('\x00' * (_mem.size() / 8)) + _mem.set_raw("\x00" * 32) + + # FreeNet and PMR radio types + if _embedded.mode == 0: # PMR or FreeNet + + mem.mode = 'NFM' + mem.offset = 0 + + # FreeNet + if str(_embedded.radio_type).rstrip("\00") == "RT98V": + if mem.number >= 1 and mem.number <= 6: + FREENET_FREQ = FREENET_FREQS[mem.number - 1] + mem.freq = FREENET_FREQ + else: + _mem.tx_off = 1 + mem.duplex = 'off' + + # PMR + if str(_embedded.radio_type).rstrip("\00") == "RT98U": + if mem.number >= 1 and mem.number <= 16: + PMR_FREQ = PMR_FREQS[mem.number - 1] + mem.freq = PMR_FREQ + else: + _mem.tx_off = 1 + mem.duplex = 'off' # set the occupied bitfield self._memobj.csetflag[cbyte].c[cbit] = 1 @@ -1059,7 +1033,10 @@ class Rt98BaseRadio(chirp_common.CloneModeRadio, _mem.name = mem.name.ljust(6)[:6] # Store the alpha tag # Set duplex bitfields - if mem.duplex == '+': + _mem.tx_off = 0 + if mem.duplex == 'off': # handle tx off + _mem.tx_off = 1 + elif mem.duplex == '+': _mem.duplex = DUPLEX_POSSPLIT elif mem.duplex == '-': _mem.duplex = DUPLEX_NEGSPLIT @@ -1074,12 +1051,7 @@ class Rt98BaseRadio(chirp_common.CloneModeRadio, LOG.error('%s: set_mem: unhandled duplex: %s' % (mem.name, mem.duplex)) - # handle tx off - _mem.tx_off = 0 - if mem.duplex == 'off': - _mem.tx_off = 1 - - # Set the channel width - remember we promote 20kHz channels to FM + # Set the channel width - remember we promote 20 kHz channels to FM # on import, so don't handle them here if mem.mode == 'FM': _mem.channel_width = CHANNEL_WIDTH_25kHz @@ -1116,11 +1088,28 @@ class Rt98BaseRadio(chirp_common.CloneModeRadio, _mem.rxinv = rxpol == "R" # set the power level - if mem.power == POWER_LEVELS[0]: + if _embedded.mode == 0: # PMR or FreeNet + if str(_embedded.radio_type).rstrip("\00") == "RT98U": + LOG.info('using PMR power levels') + _levels = PMR_POWER_LEVELS + if str(_embedded.radio_type).rstrip("\00") == "RT98V": + LOG.info('using FreeNet power levels') + _levels = FREENET_POWER_LEVELS + else: # COM or COMII + LOG.info('using general power levels') + _levels = POWER_LEVELS + + if mem.power is None: + _mem.txpower = TXPOWER_HIGH + elif mem.power == _levels[0]: + _mem.txpower = TXPOWER_LOW + elif _embedded.mode == 0: # PMR or FreeNet + LOG.info('FreeNet or PMR channel is not set to TX Power Low') + LOG.info('Setting channel to TX Power Low') _mem.txpower = TXPOWER_LOW - elif mem.power == POWER_LEVELS[1]: + elif mem.power == _levels[1]: _mem.txpower = TXPOWER_MED - elif mem.power == POWER_LEVELS[2]: + elif mem.power == _levels[2]: _mem.txpower = TXPOWER_HIGH else: LOG.error('%s: set_mem: unhandled power level: %s' % @@ -1376,7 +1365,7 @@ class Rt98BaseRadio(chirp_common.CloneModeRadio, elif element.value.get_mutable(): LOG.debug("Setting %s = %s" % (setting, element.value)) setattr(obj, setting, element.value) - except Exception as e: + except Exception: LOG.debug(element.get_name()) raise diff --git a/chirp/drivers/rfinder.py b/chirp/drivers/rfinder.py deleted file mode 100644 index e379d31..0000000 --- a/chirp/drivers/rfinder.py +++ /dev/null @@ -1,331 +0,0 @@ -# Copyright 2011 Dan Smith -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -import urllib -import hashlib -import re -import logging - -from math import pi, cos, acos, sin, atan2 -from chirp import chirp_common, CHIRP_VERSION - -LOG = logging.getLogger(__name__) - -EARTH_RADIUS = 3963.1 - -SCHEMA = [ - "ID", - "TRUSTEE", - "OUTFREQUENCY", - "CITY", - "STATE", - "COUNTRY", - "LATITUDE", - "LONGITUDE", - "CLUB", - "DESCRIPTION", - "NOTES", - "RANGE", - "OFFSETSIGN", - "OFFSETFREQ", - "PL", - "DCS", - "REPEATERTYPE", - "BAND", - "IRLP", - "ECHOLINK", - "DOC_ID", - ] - - -def deg2rad(deg): - """Convert degrees to radians""" - return deg * (pi / 180) - - -def rad2deg(rad): - """Convert radians to degrees""" - return rad / (pi / 180) - - -def dm2deg(degrees, minutes): - """Convert degrees and minutes to decimal degrees""" - return degrees + (minutes / 60.0) - - -def deg2dm(decdeg): - """Convert decimal degrees to degrees and minutes""" - degrees = int(decdeg) - minutes = (decdeg - degrees) * 60.0 - - return degrees, minutes - - -def nmea2deg(nmea, direction="N"): - """Convert NMEA-encoded value to float""" - deg = int(nmea) / 100 - try: - minutes = nmea % (deg * 100) - except ZeroDivisionError: - minutes = int(nmea) - - if direction == "S" or direction == "W": - sign = -1 - else: - sign = 1 - - return dm2deg(deg, minutes) * sign - - -def deg2nmea(deg): - """Convert degrees to a NMEA-encoded value""" - degrees, minutes = deg2dm(deg) - - return (degrees * 100) + minutes - - -def meters2feet(meters): - """Convert meters to feet""" - return meters * 3.2808399 - - -def feet2meters(feet): - """Convert feet to meters""" - return feet * 0.3048 - - -def distance(lat_a, lon_a, lat_b, lon_b): - """Calculate the distance between two points""" - lat_a = deg2rad(lat_a) - lon_a = deg2rad(lon_a) - - lat_b = deg2rad(lat_b) - lon_b = deg2rad(lon_b) - - earth_radius = EARTH_RADIUS - - tmp = (cos(lat_a) * cos(lon_a) * cos(lat_b) * cos(lon_b)) + \ - (cos(lat_a) * sin(lon_a) * cos(lat_b) * sin(lon_b)) + \ - (sin(lat_a) * sin(lat_b)) - - # Correct round-off error (which is just *silly*) - if tmp > 1: - tmp = 1 - elif tmp < -1: - tmp = -1 - - dist = acos(tmp) - - return dist * earth_radius - - -def bearing(lat_a, lon_a, lat_b, lon_b): - """Calculate the bearing between two points""" - lat_me = deg2rad(lat_a) - lat_u = deg2rad(lat_b) - lon_d = deg2rad(lon_b - lon_a) - - posy = sin(lon_d) * cos(lat_u) - posx = cos(lat_me) * sin(lat_u) - \ - sin(lat_me) * cos(lat_u) * cos(lon_d) - - bear = rad2deg(atan2(posy, posx)) - - return (bear + 360) % 360 - - -def fuzzy_to(lat_a, lon_a, lat_b, lon_b): - """Calculate a fuzzy distance to a point""" - bear = bearing(lat_a, lon_a, lat_b, lon_b) - - dirs = ["N", "NNE", "NE", "ENE", "E", - "ESE", "SE", "SSE", "S", - "SSW", "SW", "WSW", "W", - "WNW", "NW", "NNW"] - - delta = 22.5 - angle = 0 - - direction = "?" - for i in dirs: - if bear > angle and bear < (angle + delta): - direction = i - angle += delta - - return direction - - -class RFinderParser: - """Parser for RFinder's data format""" - def __init__(self, lat, lon): - self.__memories = [] - self.__cheat = {} - self.__lat = lat - self.__lon = lon - - def fetch_data(self, user, pw, coords, radius): - """Fetches the data for a set of parameters""" - args = { - "email": urllib.quote_plus(user), - "pass": hashlib.new("md5", pw).hexdigest(), - "lat": "%7.5f" % coords[0], - "lon": "%7.5f" % coords[1], - "radius": "%i" % radius, - "vers": "CH%s" % CHIRP_VERSION, - } - - _url = "https://www.rfinder.net/query.php?%s" % \ - ("&".join(["%s=%s" % (k, v) for k, v in args.items()])) - - f = urllib.urlopen(_url) - data = f.read() - f.close() - - match = re.match("^/#SERVERMSG#/(.*)/#ENDMSG#/", data) - if match: - raise Exception(match.groups()[0]) - - return data - - def _parse_line(self, line): - mem = chirp_common.Memory() - - _vals = line.split("|") - - vals = {} - for i in range(0, len(SCHEMA)): - try: - vals[SCHEMA[i]] = _vals[i] - except IndexError: - LOG.error("No such vals %s" % SCHEMA[i]) - self.__cheat = vals - - mem.name = vals["TRUSTEE"] - mem.freq = chirp_common.parse_freq(vals["OUTFREQUENCY"]) - if vals["OFFSETSIGN"] != "X": - mem.duplex = vals["OFFSETSIGN"] - if vals["OFFSETFREQ"]: - mem.offset = chirp_common.parse_freq(vals["OFFSETFREQ"]) - - if vals["PL"] and float(vals["PL"]) != 0: - mem.rtone = float(vals["PL"]) - mem.tmode = "Tone" - elif vals["DCS"] and vals["DCS"] != "0": - mem.dtcs = int(vals["DCS"]) - mem.tmode = "DTCS" - - if vals["NOTES"]: - mem.comment = vals["NOTES"].strip() - - if vals["LATITUDE"] and vals["LONGITUDE"]: - try: - lat = float(vals["LATITUDE"]) - lon = float(vals["LONGITUDE"]) - dist = distance(self.__lat, self.__lon, lat, lon) - bear = fuzzy_to(self.__lat, self.__lon, lat, lon) - mem.comment = "(%imi %s) %s" % (dist, bear, mem.comment) - except Exception, e: - LOG.error("Failed to calculate distance: %s" % e) - - return mem - - def parse_data(self, data): - """Parse the fetched data""" - number = 1 - for line in data.split("\n"): - if line.startswith("<"): - continue - elif not line.strip(): - continue - try: - mem = self._parse_line(line) - mem.number = number - number += 1 - self.__memories.append(mem) - except Exception, e: - import traceback - LOG.error(traceback.format_exc()) - LOG.error("Error in received data, cannot continue") - LOG.error("rfinder.parse_data: %s", e) - LOG.error(self.__cheat) - LOG.error(line) - - def get_memories(self): - """Return the Memory objects associated with the fetched data""" - return self.__memories - - -class RFinderRadio(chirp_common.NetworkSourceRadio): - """A network source radio that supports the RFinder repeater directory""" - VENDOR = "ITWeRKS" - MODEL = "RFinder" - - def __init__(self, *args, **kwargs): - chirp_common.NetworkSourceRadio.__init__(self, *args, **kwargs) - - self._lat = 0 - self._lon = 0 - self._user = "" - self._pass = "" - self._miles = 25 - - self._rfp = None - - def set_params(self, (lat, lon), miles, email, password): - """Sets the parameters to use for the query""" - self._lat = lat - self._lon = lon - self._miles = miles - self._user = email - self._pass = password - - def do_fetch(self): - self._rfp = RFinderParser(self._lat, self._lon) - - self._rfp.parse_data(self._rfp.fetch_data(self._user, - self._pass, - (self._lat, self._lon), - self._miles)) - - def get_features(self): - if not self._rfp: - self.do_fetch() - - rf = chirp_common.RadioFeatures() - rf.memory_bounds = (1, len(self._rfp.get_memories())) - rf.has_bank = False - rf.has_ctone = False - rf.valid_tmodes = ["", "Tone", "TSQL", "DTCS"] - rf.valid_modes = ["", "FM", "NFM", "AM", "NAM", "DV"] - return rf - - def get_memory(self, number): - if not self._rfp: - self.do_fetch() - - return self._rfp.get_memories()[number-1] - - -def _test(): - rfp = RFinderParser() - data = rfp.fetch_data("KK7DS", "dsmith@danplanet.com", - (45.5, -122.91), 25) - rfp.parse_data(data) - - for mem in rfp.get_memories(): - LOG.debug(mem) - -if __name__ == "__main__": - _test() diff --git a/chirp/drivers/rh5r_v2.py b/chirp/drivers/rh5r_v2.py index 5aa712c..b297584 100644 --- a/chirp/drivers/rh5r_v2.py +++ b/chirp/drivers/rh5r_v2.py @@ -18,11 +18,7 @@ import struct import logging -from chirp import chirp_common, bitwise, errors, directory, memmap, util -from chirp.settings import RadioSetting, RadioSettingGroup, \ - RadioSettingValueInteger, RadioSettingValueList, \ - RadioSettingValueBoolean, RadioSettingValueString, \ - RadioSettings +from chirp import chirp_common, bitwise, errors, directory, memmap LOG = logging.getLogger(__name__) @@ -129,7 +125,7 @@ class TYTTHUVF8_V2(chirp_common.CloneModeRadio): VENDOR = "TYT" MODEL = "TH-UVF8F" BAUD_RATE = 9600 - _FILEID = b'OEMOEM \XFF' + _FILEID = b'OEMOEM \\XFF' def get_features(self): rf = chirp_common.RadioFeatures() @@ -272,7 +268,7 @@ class TYTTHUVF8_V2(chirp_common.CloneModeRadio): _mem.tx_freq = (mem.freq + (mem.offset * mult)) / 10 (txmode, txval, txpol), (rxmode, rxval, rxpol) = \ - chirp_common.split_tone_encode(mem) + chirp_common.split_tone_encode(mem) self._encode_tone(_mem.tx_tone, txmode, txval, txpol) self._encode_tone(_mem.rx_tone, rxmode, rxval, rxpol) diff --git a/chirp/drivers/tdh8.py b/chirp/drivers/tdh8.py new file mode 100644 index 0000000..c26fede --- /dev/null +++ b/chirp/drivers/tdh8.py @@ -0,0 +1,2059 @@ +# Copyright 2012 Dan Smith +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +import struct +import time +import logging + + +from chirp import chirp_common, errors, util, directory, memmap +from chirp import bitwise +from chirp.settings import InvalidValueError, RadioSetting, \ + RadioSettingGroup, RadioSettingValueFloat, \ + RadioSettingValueList, RadioSettingValueBoolean, \ + RadioSettingValueString, RadioSettings +from textwrap import dedent +from chirp import bandplan_na + +LOG = logging.getLogger(__name__) + + +MEM_FORMAT = """ +#seekto 0x0008; +struct { + lbcd rxfreq[4]; + lbcd txfreq[4]; + lbcd rxtone[2]; + lbcd txtone[2]; + u8 unused1; + u8 pttid:2, + freqhop:1, + unused3:1, + unused4:1, + bcl:1, + unused5:1, + unused2:1; + u8 unused6:1, + unused7:1, + lowpower:2, + wide:1, + unused8:1, + offset:2; + u8 unused10; +} memory[200]; + +#seekto 0x0D38; +struct { + char name[8]; + u8 unknown2[8]; +} names[200]; + +#seekto 0x0CA8; +struct { + u8 txled:1, + rxled:1, + unused11:1, + ham:1, + gmrs:1, + unused14:1, + unused15:1, + pritx:1; + u8 scanmode:2, + unused16:1, + keyautolock:1, + unused17:1, + btnvoice:1, + unknown18:1, + voiceprompt:1; + u8 fmworkmode:1, + sync:1, + tonevoice:2, + fmrec:1, + mdfa:1, + aworkmode:2; + u8 openmes:2, + unused19:1, + mdfb:1, + unused20:1, + dbrx:1, + bworkmode:2; + u8 ablock; + u8 bblock; + u8 fmroad; + u8 unused21:1, + tailclean:1, + rogerprompt:1, + unused23:1, + unused24:1, + voxgain:3; + u8 astep:4, + bstep:4; + u8 squelch; + u8 tot; + u8 lang; + u8 save; + u8 ligcon; + u8 voxdelay; + u8 onlychmode:1, + unused:6, + alarm:1; +} settings; + +#seekto 0x0CB8; +struct { + u8 ofseta[4]; + u8 ununsed26[12]; +} aoffset; + +#seekto 0x0CBC; +struct { + u8 ofsetb[4]; + u8 ununsed27[12]; +} boffset; + +#seekto 0x0CD8; +struct{ + u8 fmblock[4]; +}fmmode[25]; + +#seekto 0x1A08; +struct{ + u8 block8:1, + block7:1, + block6:1, + block5:1, + block4:1, + block3:1, + block2:1, + block1:1; +} usedflags[25]; + +#seekto 0x1a28; +struct{ + u8 scan8:1, + scan7:1, + scan6:1, + scan5:1, + scan4:1, + scan3:1, + scan2:1, + scan1:1; +} scanadd[25]; + +#seekto 0x1B38; +struct{ + u8 vfo[4]; +}fmvfo; + +#seekto 0x1B58; +struct { + lbcd rxfreqa[4]; + lbcd txfreq[4]; + u8 rxtone[2]; + u8 txtone[2]; + u8 unused1; + u8 pttid:2, + specialqta:1, + unused3:1, + unused4:1, + bcl:1, + unused5:1, + unused2:1; + u8 unused6:1, + unused7:1, + lowpower:2, + wide:1, + unused8:1, + offset:2; + u8 unused10; +} vfoa; + +#seekto 0x1B68; +struct { + lbcd rxfreqb[4]; + lbcd txfreq[4]; + u8 rxtoneb[2]; + u8 txtone[2]; + u8 unused1; + u8 pttid:2, + specialqtb:1, + unused3:1, + unused4:1, + bclb:1, + unused5:1, + unused2:1; + u8 unused6:1, + unused7:1, + lowpowerb:2, + wideb:1, + unused8:1, + offsetb:2; + u8 unused10; +} vfob; + +#seekto 0x1B78; +struct{ + u8 block8:1, + block7:1, + block6:1, + block5:1, + block4:1, + block3:1, + block2:1, + block1:1; +} fmusedflags[4]; + +#seekto 0x1CC8; +struct{ + u8 stopkey1; + u8 ssidekey1; + u8 ssidekey2; + u8 ltopkey2; + u8 lsidekey3; + u8 lsidekey4; + u8 unused25[10]; +} press; + +#seekto 0x1E28; +struct{ + u8 idcode[3]; +}icode; + +#seekto 0x1E31; +struct{ + u8 gcode; +}groupcode; + +#seekto 0x1E38; +struct{ + u8 group1[7]; +}group1; + +#seekto 0x1E48; +struct{ + u8 group2[7]; +}group2; + +#seekto 0x1E58; +struct{ + u8 group3[7]; +}group3; + +#seekto 0x1E68; +struct{ + u8 group4[7]; +}group4; + +#seekto 0x1E78; +struct{ + u8 group5[7]; +}group5; + +#seekto 0x1E88; +struct{ + u8 group6[7]; +}group6; + +#seekto 0x1E98; +struct{ + u8 group7[7]; +}group7; + +#seekto 0x1EA8; +struct{ + u8 group8[7]; +}group8; + +#seekto 0x1EC8; +struct{ + u8 scode[7]; +}startcode; + +#seekto 0x1ED8; +struct{ + u8 ecode[7]; +}endcode; + +""" + +# basic settings +SQUELCH = ['%s' % x for x in range(0, 10)] +LIGHT_LIST = ["CONT", "5s", "10s", "15s", "30s"] +VOICE_PRMPT_LIST = ["OFF", "ON"] +AUTOLOCK_LIST = ["OFF", "ON"] +TIME_OUT_LIST = ["OFF", "60s", "120s", "180s"] +MDFA_LIST = ["Frequency", "Name"] +MDFB_LIST = ["Frequency", "Name"] +SYNC_LIST = ["ON", "OFF"] +LANG_LIST = ["Chinese", "English"] +BTV_SAVER_LIST = ["OFF", "1:1", "1:2", "1:3", "1:4"] +DBRX_LIST = ["OFF", "ON"] +ASTEP_LIST = ["2.50K", "5.00K", "6.25K", + "10.00K", "12.00K", "25.00K", "50.00K"] +BSTEP_LIST = ["2.50K", "5.00K", "6.25K", + "10.00K", "12.00K", "25.00K", "50.00K"] +SCAN_MODE_LIST = ["TO", "CO", "SE"] +PRIO_LIST = ["Edit", "Busy"] +SHORT_KEY_LIST = ["None", "FM Radio", "Lamp", "Monitor", + "TONE", "Alarm", "Weather"] +LONG_KEY_LIST = ["None", "FM Radio", "Lamp", + "Monitor", "TONE", "Alarm", "Weather"] +BUSYLOCK_LIST = ["Off", "On"] +PRESS_NAME = ["stopkey1", "ssidekey1", "ssidekey2", + "ltopkey2", "lsidekey3", "lsidekey4"] + +VFOA_NAME = ["rxfreqa", + "txfreq", + "rxtone", + "txtone", + "pttid", + "specialqta", + "bcl", + "lowpower", + "wide", + "offset"] + +VFOB_NAME = ["rxfreqb", + "txfreq", + "rxtoneb", + "txtone", + "pttid", + "specialqtb", + "bclb", + "lowpowerb", + "wideb", + "offsetb"] + +# KEY +VOX_GAIN = ["OFF", "1", "2", "3", "4", "5"] +VOX_DELAY = ["1.05s", "2.0s", "3.0s"] +PTTID_VALUES = ["Off", "BOT", "EOT", "BOTH"] +BCLOCK_VALUES = ["Off", "On"] +FREQHOP_VALUES = ["Off", "On"] +SCAN_VALUES = ["Del", "Add"] + +# AB CHANNEL +A_OFFSET = ["Off", "-", "+"] +A_TX_POWER = ["Low", "Mid", "High"] +A_BAND = ["Wide", "Narrow"] +A_BUSYLOCK = ["Off", "On"] +A_SPEC_QTDQT = ["Off", "On"] +A_WORKMODE = ["VFO", "VFO+CH", "CH Mode"] + +B_OFFSET = ["Off", "-", "+"] +B_TX_POWER = ["Low", "Mid", "High"] +B_BAND = ["Wide", "Narrow"] +B_BUSYLOCK = ["Off", "On"] +B_SPEC_QTDQT = ["Off", "On"] +B_WORKMODE = ["VFO", "VFO+CH", "CH Mode"] + +# FM +FM_WORKMODE = ["CH", "VFO"] +FM_CHANNEL = ['%s' % x for x in range(0, 26)] + +# DTMF +GROUPCODE = ["", "Off", "*", "#", "A", "B", "C", "D"] + +AB_LIST = ["A", "B"] +ALMOD_LIST = ["Site", "Tone", "Code"] +BANDWIDTH_LIST = ["Wide", "Narrow"] +COLOR_LIST = ["Off", "Blue", "Orange", "Purple"] +DTMFSPEED_LIST = ["%s ms" % x for x in range(50, 2010, 10)] +DTMFST_LIST = ["OFF", "DT-ST", "ANI-ST", "DT+ANI"] +MODE_LIST = ["Channel", "Name", "Frequency"] +PONMSG_LIST = ["Full", "Message"] +PTTID_LIST = ["Off", "BOT", "EOT", "Both"] +PTTIDCODE_LIST = ["%s" % x for x in range(1, 16)] +RTONE_LIST = ["1000 Hz", "1450 Hz", "1750 Hz", "2100 Hz"] +RESUME_LIST = ["TO", "CO", "SE"] +ROGERRX_LIST = ["Off"] + AB_LIST +RPSTE_LIST = ["OFF"] + ["%s" % x for x in range(1, 11)] +SAVE_LIST = ["Off", "1:1", "1:2", "1:3", "1:4"] +SCODE_LIST = ["%s" % x for x in range(1, 16)] +SHIFTD_LIST = ["Off", "+", "-"] +STEDELAY_LIST = ["OFF"] + ["%s ms" % x for x in range(100, 1100, 100)] +STEPS = [2.5, 5.0, 6.25, 10.0, 12.5, 25.0] +STEP_LIST = [str(x) for x in STEPS] +STEPS = [2.5, 5.0, 6.25, 10.0, 12.5, 20.0, 25.0, 50.0] +STEP291_LIST = [str(x) for x in STEPS] +TDRAB_LIST = ["Off"] + AB_LIST +TDRCH_LIST = ["CH%s" % x for x in range(1, 129)] +TIMEOUT_LIST = ["%s sec" % x for x in range(15, 615, 15)] + \ + ["Off (if supported by radio)"] +TXPOWER_LIST = ["High", "Low"] +TXPOWER3_LIST = ["High", "Mid", "Low"] +VOICE_LIST = ["Off", "English", "Chinese"] +VOX_LIST = ["OFF"] + ["%s" % x for x in range(1, 11)] +WORKMODE_LIST = ["Frequency", "Channel"] + +GMRS_FREQS = bandplan_na.GMRS_HIRPT + +NOAA_FREQS = [162550000, 162400000, 162475000, 162425000, 162450000, + 162500000, 162525000, 161650000, 161775000, 161750000, + 162000000] + +HAM_GMRS_NAME = ["NOAA 1", "NOAA 2", "NOAA 3", "NOAA 4", "NOAA 5", "NOAA 6", + "NOAA 7", "NOAA 8", "NOAA 9", "NOAA 10", "NOAA 11"] + +ALL_MODEL = ["TD-H8", "TD-H8-HAM", "TD-H8-GMRS"] + +TD_H8 = b"\x50\x56\x4F\x4A\x48\x1C\x14" + + +def _do_status(radio, block): + status = chirp_common.Status() + status.msg = "Cloning" + status.cur = block + status.max = radio._memsize + radio.status_fn(status) + + +def _upper_band_from_data(data): + return data[0x03:0x04] + + +def _upper_band_from_image(radio): + return _upper_band_from_data(radio.get_mmap()) + + +def _firmware_version_from_data(data, version_start, version_stop): + version_tag = data[version_start:version_stop] + return version_tag + + +def _firmware_version_from_image(radio): + version = _firmware_version_from_data(radio.get_mmap(), + radio._fw_ver_file_start, + radio._fw_ver_file_stop) + # LOG.debug("_firmware_version_from_image: " + util.hexprint(version)) + return version + + +def _do_ident(radio, magic, secondack=True): + serial = radio.pipe + serial.timeout = 1 + + LOG.info("Sending Magic: %s" % util.hexprint(magic)) + serial.write(magic) + ack = serial.read(1) + + if ack != b"\x06": + if ack: + # LOG.debug(repr(ack)) + pass + raise errors.RadioError("Radio did not respond") + + serial.write(b"\x02") + + response = b"" + for i in range(1, 9): + byte = serial.read(1) + response += byte + if byte == b"\xDD": + break + + if len(response) in [8, 12]: + # DEBUG + LOG.info("Valid response, got this:") + LOG.info(util.hexprint(response)) + if len(response) == 12: + ident = response[0] + response[3] + response[5] + response[7:] + else: + ident = response + else: + # bad response + msg = "Unexpected response, got this:" + msg += util.hexprint(response) + LOG.debug(msg) + raise errors.RadioError("Unexpected response from radio.") + + if secondack: + serial.write(b"\x06") + ack = serial.read(1) + if ack != b"\x06": + raise errors.RadioError("Radio refused clone") + + return ident + + +def response_mode(mode): + data = mode + return data + + +def _read_block(radio, start, size): + serial = radio.pipe + + cmd = struct.pack(">cHb", b'R', start, size) + expectedresponse = b"W" + cmd[1:] + + try: + serial.write(cmd) + response = serial.read(5 + size) + if response[:4] != expectedresponse: + raise errors.RadioError("Error reading block %04x." % (start)) + block_data = response[4:-1] + + except Exception: + raise errors.RadioError("Failed to read block at %04x" % start) + + return block_data + + +def _get_radio_firmware_version(radio): + if radio.MODEL in ALL_MODEL: + block = _read_block(radio, 0x1B40, 0x20) + version = block[0:6] + return version + + +IDENT_BLACKLIST = { + b"\x50\x56\x4F\x4A\x48\x1C\x14": "Radio identifies as TIDRADIO TD-H8", +} + + +def _ident_radio(radio): + for magic in radio._idents: + error = None + try: + data = _do_ident(radio, magic) + return data + except errors.RadioError as e: + error = e + time.sleep(2) + + if error: + raise error + raise errors.RadioError("Radio did not respond") + + +def _do_download(radio): + data = _ident_radio(radio) + append_model = False + # HAM OR GMRS + # Determine the walkie-talkie mode + # TDH8 have three mode:ham, gmrs and normal + + LOG.info("Radio mode is " + str(data)[2:8]) + LOG.info("Chirp choose mode is " + str(data)[2:8]) + # The Ham and GMRS modes are subclasses of this model TDH8. + # We compare the radio identification to the value of that class to + # make sure the user chose the model that matches + # the radio we're talking to right now. If they do not match, + # we refuse to talk to the radio until the user selects the correct model. + + if radio.ident_mode == data: + LOG.info("Successful match.") + else: + msg = ("Model mismatch!") + raise errors.RadioError(msg) + + # Main block + LOG.info("Downloading...") + + for i in range(0, radio._memsize, 0x20): + block = _read_block(radio, i, 0x20) + data += block + _do_status(radio, i) + _do_status(radio, radio._memsize) + LOG.info("done.") + + if append_model: + data += radio.MODEL.ljust(8) + + return memmap.MemoryMapBytes(data) + + +def _exit_write_block(radio): + serial = radio.pipe + try: + serial.write(b"E") + + except Exception: + raise errors.RadioError("Radio refused to exit programming mode") + + +def _write_block(radio, addr, data): + serial = radio.pipe + cmd = struct.pack(">cHb", b'W', addr, 0x20) + data = radio.get_mmap()[addr + 8: addr + 40] + # The checksum needs to be in the last + check_sum = bytes([sum(data) & 0xFF]) + data += check_sum + used_data = cmd + data + serial.write(used_data) + + ack = radio.pipe.read(1) + if ack != b"\x06": + raise errors.RadioError("Radio refused to accept block 0x%04x" % addr) + + +def _do_upload(radio): + data = _ident_radio(radio) + radio_version = _get_radio_firmware_version(radio) + LOG.info("Radio Version is %s" % repr(radio_version)) + + if radio.ident_mode == data: + LOG.info("Successful match.") + else: + msg = ("Model mismatch!") + raise errors.RadioError(msg) + + # Main block + LOG.debug("Uploading...") + + for start_addr, end_addr in radio._ranges_main: + for addr in range(start_addr, end_addr, 0x20): + _write_block(radio, addr, 0x20) + _do_status(radio, addr) + _exit_write_block(radio) + LOG.debug("Upload all done.") + + +TX_POWER = [chirp_common.PowerLevel("Low", watts=1.00), + chirp_common.PowerLevel("Mid", watts=4.00), + chirp_common.PowerLevel("High", watts=8.00)] + +TDH8_CHARSET = chirp_common.CHARSET_UPPER_NUMERIC + \ + "!@#$%^&*()+-=[]:\";'<>?,./" + + +@directory.register +class TDH8(chirp_common.CloneModeRadio): + """TIDRADIO TD-H8""" + VENDOR = "TIDRADIO" + MODEL = "TD-H8" + ident_mode = b'P31183\xff\xff' + BAUD_RATE = 38400 + NEEDS_COMPAT_SERIAL = False + _memsize = 0x1eef + _ranges_main = [(0x0000, 0x1eef)] + _idents = [TD_H8] + _vhf_range = (136000000, 175000000) + _uhf_range = (400000000, 521000000) + _aux_block = True + _tri_power = True + _gmrs = False + _ham = False + _mem_params = (0x1F2F) + + # offset of fw version in image file + _fw_ver_file_start = 0x1838 + _fw_ver_file_stop = 0x1846 + _valid_chars = TDH8_CHARSET + + @classmethod + def get_prompts(cls): + rp = chirp_common.RadioPrompts() + rp.pre_download = (dedent("""\ + 1. Turn radio off. + 2. Connect cable to mic/spkr connector. + 3. Make sure connector is firmly connected. + 4. Turn radio on (volume may need to be set at 100%). + 5. Ensure that the radio is tuned to channel with no activity. + 6. Click OK to download image from device.""")) + rp.pre_upload = (dedent("""\ + 1. Turn radio off. + 2. Connect cable to mic/spkr connector. + 3. Make sure connector is firmly connected. + 4. Turn radio on (volume may need to be set at 100%). + 5. Ensure that the radio is tuned to channel with no activity. + 6. Click OK to upload image to device.""")) + return rp + + def get_features(self): + rf = chirp_common.RadioFeatures() + rf.has_settings = True + rf.has_bank = False + rf.has_cross = True + rf.has_ctone = True + rf.has_rx_dtcs = True + rf.has_tuning_step = False + rf.has_ctone = True + rf.can_odd_split = True + rf.valid_name_length = 8 + rf.valid_characters = self._valid_chars + rf.valid_skips = ["", "S"] + rf.valid_tmodes = ["", "Tone", "TSQL", "DTCS", "Cross"] + rf.valid_cross_modes = [ + "Tone->Tone", + "DTCS->", + "->DTCS", + "Tone->DTCS", + "DTCS->Tone", + "->Tone", + "DTCS->DTCS"] + rf.valid_power_levels = TX_POWER + rf.valid_duplexes = ["", "-", "+", "split"] + rf.valid_modes = ["FM", "NFM"] + rf.valid_tuning_steps = STEPS + + normal_bands = [self._vhf_range, self._uhf_range] + + if self._mmap is None: + rf.valid_bands = [normal_bands[0], normal_bands[1]] + else: + rf.valid_bands = normal_bands + rf.memory_bounds = (1, 199) + return rf + + def process_mmap(self): + self._memobj = bitwise.parse(MEM_FORMAT, self._mmap) + + def sync_in(self): + try: + self._mmap = _do_download(self) + self.process_mmap() + except Exception as e: + raise errors.RadioError("Failed to communicate with radio: %s" % e) + + def sync_out(self): + try: + _do_upload(self) + except errors.RadioError: + raise + except Exception as e: + raise errors.RadioError("Failed to communicate with radio: %s" % e) + + def get_raw_memory(self, number): + return repr(self._memobj.memory[number]) + + # Encoding processing + def _decode_tone(self, val): + if val == 16665 or val == 0: + return '', None, None + elif val >= 12000: + return 'DTCS', val - 12000, 'R' + elif val >= 8000: + return 'DTCS', val - 8000, 'N' + else: + return 'Tone', val / 10.0, None + + # Decoding processing + def _encode_tone(self, memval, mode, value, pol): + if mode == "": + memval[0].set_raw(0xFF) + memval[1].set_raw(0xFF) + elif mode == 'Tone': + memval.set_value(int(value * 10)) + + elif mode == 'DTCS': + flag = 0x80 if pol == 'N' else 0xC0 + memval.set_value(value) + memval[1].set_bits(flag) + else: + raise Exception("Internal error: invalid mode `%s'" % mode) + + def _get_mem(self, number): + return self._memobj.memory[number] + + def _get_nam(self, number): + return self._memobj.names[number] + + def _get_fm(self, number): + return self._memobj.fmmode[number] + + def _get_get_scanvfo(self, number): + return self._memobj.fmvfo[number] + + def _get_scan(self, number): + return self._memobj.scanadd[number] + + def _get_block_data(self, number): + return self._memobj.usedflags[number] + + def _get_fmblock_data(self, number): + return self._memobj.fmusedflags[number] + + def get_memory(self, number): + _mem = self._get_mem(number) + _nam = self._get_nam(number) + mem = chirp_common.Memory() + mem.number = number + + if _mem.get_raw()[0] == "\xff": + mem.empty = True + return mem + + # receiving frequency + mem.freq = int(_mem.rxfreq) * 10 + + # narrow and wide + mem.mode = _mem.wide and "NFM" or "FM" + + # power + try: + mem.power = TX_POWER[_mem.lowpower] + except IndexError: + LOG.error("Radio reported invalid power level %s (in %s)" % + (_mem.lowpower, TX_POWER)) + mem.power = TX_POWER[0] + + # Channel name + for char in _nam.name: + if "\x00" in str(char) or "\xFF" in str(char): + char = "" + mem.name += str(char) + + mem.name = mem.name.rstrip() + if self.ident_mode != b'P31183\xff\xff' and \ + (mem.number >= 189 and mem.number <= 199): + mem.name = HAM_GMRS_NAME[mem.number - 200] + + # tmode + lin2 = int(_mem.rxtone) + rxtone = self._decode_tone(lin2) + + lin = int(_mem.txtone) + txtone = self._decode_tone(lin) + + if txtone[0] == "Tone" and not rxtone[0]: + mem.tmode = "Tone" + elif txtone[0] == rxtone[0] and txtone[0] == "Tone" \ + and mem.rtone == mem.ctone: + mem.tmode = "TSQL" + elif txtone[0] == rxtone[0] and txtone[0] == "DTCS" \ + and mem.dtcs == mem.rx_dtcs: + mem.tmode = "DTCS" + elif rxtone[0] or txtone[0]: + mem.tmode = "Cross" + mem.cross_mode = "%s->%s" % (txtone[0], rxtone[0]) + + chirp_common.split_tone_decode(mem, txtone, rxtone) + + # skip/scanadd + scan_val_list = [] + for x in range(25): + a = self._get_scan(x) + for i in range(0, 8): + scan_val = (getattr(a, 'scan%i' % (i+1))) + # print(str(scan_val)[3]) + used_scan_val = str(scan_val)[3] + scan_val_list.append(used_scan_val) + + if int(scan_val_list[number - 1]) == 0: + mem.skip = 'S' + elif int(scan_val_list[number - 1]) == 1: + mem.skip = '' + + if int(_mem.rxfreq) == int(_mem.txfreq): + mem.duplex = "" + mem.offset = 0 + else: + mem.duplex = int(_mem.rxfreq) > int(_mem.txfreq) and "-" or "+" + mem.offset = abs(int(_mem.rxfreq) - int(_mem.txfreq)) * 10 + + if self._gmrs: + # mem.duplex = "" + # mem.offset = 0 + if mem.number >= 1 and mem.number <= 30: + mem.immutable.append('freq') + if mem.number >= 8 and mem.number <= 14: + mem.mode = 'NFM' + mem.power = TX_POWER[0] + mem.immutable = ['freq', 'mode', 'power', + 'duplex', 'offset'] + elif mem.number >= 31 and mem.number <= 54: + # mem.immutable = ['duplex', 'offset'] + mem.duplex = '+' + mem.offset = 5000000 + elif mem.number >= 189 and mem.number <= 199: + ham_freqs = NOAA_FREQS[mem.number - 189] + mem.freq = ham_freqs + mem.immutable = ['name', 'power', 'duplex', 'freq', + 'rx_dtcs', 'vfo', 'tmode', 'empty', + 'offset', 'rtone', 'ctone', 'dtcs', + 'dtcs_polarity', 'cross_mode'] + elif self._ham: + if mem.number >= 189 and mem.number <= 199: + ham_freqs = NOAA_FREQS[mem.number - 189] + mem.freq = ham_freqs + mem.immutable = ['name', 'power', 'freq', 'rx_dtcs', 'vfo', + 'tmode', 'empty', 'offset', 'rtone', 'ctone', + 'dtcs', 'dtcs_polarity', 'cross_mode'] + + # other function + # pttid + mem.extra = RadioSettingGroup("Extra", "extra") + + rs = RadioSetting("pttid", "PTT ID", + RadioSettingValueList(PTTID_VALUES, + PTTID_VALUES[_mem.pttid])) + mem.extra.append(rs) + + # Busylock + rs = RadioSetting("bcl", "Busy Lock", + RadioSettingValueList(BCLOCK_VALUES, + BCLOCK_VALUES[_mem.bcl])) + mem.extra.append(rs) + + rs = RadioSetting( + "freqhop", "Frequency Hop", RadioSettingValueList( + FREQHOP_VALUES, FREQHOP_VALUES[_mem.freqhop])) + mem.extra.append(rs) + + return mem + + def _set_mem(self, number): + return self._memobj.memory[number] + + def _set_nam(self, number): + return self._memobj.names[number] + + def _get_scan_list(self, scan_data): + # scan_val_list - Get all scans Add data 1-200 digits + scan_val_list = [] + for x in range(25): + a = self._get_scan(x) + for i in range(0, 8): + scan_val = (getattr(a, 'scan%i' % (i+1))) + used_scan_val = str(scan_val)[3] + scan_val_list.append(used_scan_val) + + # used_scan_list - 25 structures, split the scan added + # data into 25 groups of 8 bits each + used_scan_list = [] + count_num = 1 + for i in range(0, len(scan_val_list), 8): + used_scan_list.append(scan_val_list[i:i + 8]) + count_num += 1 + # Determine whether it is a standard number that can be divisible + # Which group is the scan addition located in the modified channel + if scan_data % 8 != 0: + x_list = scan_data / 8 + y_list = scan_data % 8 + + else: + x_list = (scan_data / 8) - 1 + y_list = 8 + + return ([x_list, y_list]) + + def get_block_xy(self, number): + if number % 8 != 0: + x_list = number / 8 + y_list = number % 8 + + else: + x_list = (number / 8) - 1 + y_list = 8 + + return ([x_list, y_list]) + + def set_memory(self, mem): + _mem = self._get_mem(mem.number) + _nam = self._get_nam(mem.number) + + if mem.empty: + _mem.set_raw("\xff" * 16) + _nam.set_raw("\xff" * 16) + return + + _mem.set_raw("\x00" * 16) + + # When the channel is empty, you need to set "usedflags" to 0, + # which means it is empty.When the channel has a value, + # you need to set "usedflags" to 0, + # indicating that it contains a value. + # The method "get_block_xy" is due to + # the particularity of the structure, + # x represents a certain structure group, + # and y represents a certain byte of the structure group. + if not mem.empty: + block_xy = self.get_block_xy(mem.number) + _usedflags = self._get_block_data(block_xy[0]) + if block_xy[1] == 1: + _usedflags.block1 = 1 + elif block_xy[1] == 2: + _usedflags.block2 = 1 + elif block_xy[1] == 3: + _usedflags.block3 = 1 + elif block_xy[1] == 4: + _usedflags.block4 = 1 + elif block_xy[1] == 5: + _usedflags.block5 = 1 + elif block_xy[1] == 6: + _usedflags.block6 = 1 + elif block_xy[1] == 7: + _usedflags.block7 = 1 + elif block_xy[1] == 8: + _usedflags.block8 = 1 + else: + block_xy = self.get_block_xy(mem.number) + _usedflags = self._get_block_data(block_xy[0]) + if block_xy[1] == 1: + _usedflags.block1 = 0 + elif block_xy[1] == 2: + _usedflags.block2 = 0 + elif block_xy[1] == 3: + _usedflags.block3 = 0 + elif block_xy[1] == 4: + _usedflags.block4 = 0 + elif block_xy[1] == 5: + _usedflags.block5 = 0 + elif block_xy[1] == 6: + _usedflags.block6 = 0 + elif block_xy[1] == 7: + _usedflags.block7 = 0 + elif block_xy[1] == 8: + _usedflags.block8 = 0 + + if mem.duplex == "": + _mem.rxfreq = _mem.txfreq = mem.freq / 10 + elif mem.duplex == "split": + _mem.txfreq = mem.offset / 10 + elif mem.duplex == "+": + _mem.txfreq = (mem.freq + mem.offset) / 10 + elif mem.duplex == "-": + _mem.txfreq = (mem.freq - mem.offset) / 10 + else: + _mem.txfreq = mem.freq / 10 + + _mem.rxfreq = mem.freq / 10 + _namelength = self.get_features().valid_name_length + + for i in range(_namelength): + try: + _nam.name[i] = mem.name[i] + except IndexError: + _nam.name[i] = "\xFF" + + txtone, rxtone = chirp_common.split_tone_encode(mem) + + self._encode_tone(_mem.txtone, *txtone) + self._encode_tone(_mem.rxtone, *rxtone) + + if mem.mode == "FM": + _mem.wide = 0 + else: + _mem.wide = 1 + + if str(mem.power) == "Low": + _mem.lowpower = 0 + elif str(mem.power) == "Mid": + _mem.lowpower = 1 + elif str(mem.power) == "High": + _mem.lowpower = 10 + else: + _mem.lowpower = 0 + + # Skip/Scanadd Setting + scanlist = self._get_scan_list(mem.number) + _scan = self._get_scan(scanlist[0]) + + if scanlist[1] == 1: + _scan.scan1 = mem.skip != "S" + elif scanlist[1] == 2: + _scan.scan2 = mem.skip != "S" + elif scanlist[1] == 3: + _scan.scan3 = mem.skip != "S" + elif scanlist[1] == 4: + _scan.scan4 = mem.skip != "S" + elif scanlist[1] == 5: + _scan.scan5 = mem.skip != "S" + elif scanlist[1] == 6: + _scan.scan6 = mem.skip != "S" + elif scanlist[1] == 7: + _scan.scan7 = mem.skip != "S" + elif scanlist[1] == 8: + _scan.scan8 = mem.skip != "S" + + for setting in mem.extra: + if (self.ident_mode == b'P31185\xff\xff' or + self.ident_mode == b'P31184\xff\xff') and \ + mem.number >= 189 and mem.number <= 199: + if setting.get_name() == 'pttid': + setting.value = 'Off' + setattr(_mem, setting.get_name(), setting.value) + elif setting.get_name() == 'bcl': + setting.value = 'Off' + setattr(_mem, setting.get_name(), setting.value) + elif setting.get_name() == 'freqhop': + setting.value = 'Off' + setattr(_mem, setting.get_name(), setting.value) + else: + setattr(_mem, setting.get_name(), setting.value) + + def _is_orig(self): + version_tag = _firmware_version_from_image(self) + try: + if b'BFB' in version_tag: + idx = version_tag.index(b"BFB") + 3 + version = int(version_tag[idx:idx + 3]) + return version < 291 + return False + except Exception: + pass + raise errors.RadioError("Unable to parse version string %s" % + version_tag) + + def _my_upper_band(self): + band_tag = _upper_band_from_image(self) + return band_tag + + def _get_settings(self): + _settings = self._memobj.settings + _press = self._memobj.press + _aoffset = self._memobj.aoffset + _boffset = self._memobj.boffset + _vfoa = self._memobj.vfoa + _vfob = self._memobj.vfob + _gcode = self._memobj.groupcode + + basic = RadioSettingGroup("basic", "Basic Settings") + abblock = RadioSettingGroup("abblock", "A/B Channel") + fmmode = RadioSettingGroup("fmmode", "FM") + dtmf = RadioSettingGroup("dtmf", "DTMF") + + # group = RadioSettings(fmmode, dtmf) + group = RadioSettings(basic, abblock, fmmode, dtmf) + + rs = RadioSetting("squelch", "Squelch Level", + RadioSettingValueList( + SQUELCH, SQUELCH[_settings.squelch])) + basic.append(rs) + + rs = RadioSetting("ligcon", "Light Control", + RadioSettingValueList( + LIGHT_LIST, LIGHT_LIST[_settings.ligcon])) + basic.append(rs) + + rs = RadioSetting("voiceprompt", "Voice Prompt", + RadioSettingValueList( + VOICE_PRMPT_LIST, VOICE_PRMPT_LIST[ + _settings.voiceprompt])) + basic.append(rs) + + rs = RadioSetting("keyautolock", "Auto Lock", + RadioSettingValueList( + AUTOLOCK_LIST, AUTOLOCK_LIST[ + _settings.keyautolock])) + basic.append(rs) + + rs = RadioSetting("mdfa", "MDF-A", + RadioSettingValueList( + MDFA_LIST, MDFA_LIST[_settings.mdfa])) + basic.append(rs) + + rs = RadioSetting("mdfb", "MDF-B", + RadioSettingValueList( + MDFB_LIST, MDFB_LIST[_settings.mdfb])) + basic.append(rs) + + rs = RadioSetting("sync", "SYNC", + RadioSettingValueList( + SYNC_LIST, SYNC_LIST[_settings.sync])) + basic.append(rs) + + if _settings.lang in (2, 3): + langs = 1 + else: + langs = 0 + rs = RadioSetting("lang", "Language", + RadioSettingValueList( + LANG_LIST, LANG_LIST[langs])) + basic.append(rs) + + rs = RadioSetting("save", "Battery Save", + RadioSettingValueList( + BTV_SAVER_LIST, BTV_SAVER_LIST[_settings.save])) + basic.append(rs) + + rs = RadioSetting("dbrx", "Double Rx", + RadioSettingValueList( + DBRX_LIST, DBRX_LIST[_settings.dbrx])) + basic.append(rs) + + rs = RadioSetting("astep", "A Step", + RadioSettingValueList( + ASTEP_LIST, ASTEP_LIST[_settings.astep])) + basic.append(rs) + + rs = RadioSetting("bstep", "B Step", + RadioSettingValueList( + BSTEP_LIST, BSTEP_LIST[_settings.bstep])) + basic.append(rs) + + rs = RadioSetting("scanmode", "Scan Mode", + RadioSettingValueList( + SCAN_MODE_LIST, SCAN_MODE_LIST[ + _settings.scanmode])) + basic.append(rs) + + rs = RadioSetting("pritx", "Priority TX", + RadioSettingValueList( + PRIO_LIST, PRIO_LIST[_settings.pritx])) + basic.append(rs) + + rs = RadioSetting("btnvoice", "Beep", + RadioSettingValueBoolean(_settings.btnvoice)) + basic.append(rs) + + rs = RadioSetting("rogerprompt", "Roger", + RadioSettingValueBoolean(_settings.rogerprompt)) + basic.append(rs) + + rs = RadioSetting("txled", "Disp Lcd(TX)", + + RadioSettingValueBoolean(_settings.txled)) + basic.append(rs) + + rs = RadioSetting("rxled", "Disp Lcd(RX)", + RadioSettingValueBoolean(_settings.rxled)) + basic.append(rs) + + rs = RadioSetting("onlychmode", "Only CH Mode", + RadioSettingValueBoolean(_settings.onlychmode)) + basic.append(rs) + + rs = RadioSetting("stopkey1", "SHORT_KEY_TOP", + RadioSettingValueList( + SHORT_KEY_LIST, SHORT_KEY_LIST[0])) + basic.append(rs) + + rs = RadioSetting("ssidekey1", "SHORT_KEY_PF1", + RadioSettingValueList( + SHORT_KEY_LIST, SHORT_KEY_LIST[ + _press.ssidekey1])) + basic.append(rs) + + rs = RadioSetting("ssidekey2", "SHORT_KEY_PF2", + RadioSettingValueList( + SHORT_KEY_LIST, SHORT_KEY_LIST[ + _press.ssidekey2])) + basic.append(rs) + + rs = RadioSetting("ltopkey2", "LONG_KEY_TOP", + RadioSettingValueList( + LONG_KEY_LIST, LONG_KEY_LIST[_press.ltopkey2])) + basic.append(rs) + + rs = RadioSetting("lsidekey3", "LONG_KEY_PF1", + RadioSettingValueList( + LONG_KEY_LIST, LONG_KEY_LIST[_press.lsidekey3])) + basic.append(rs) + + rs = RadioSetting("lsidekey4", "LONG_KEY_PF2", + RadioSettingValueList( + LONG_KEY_LIST, LONG_KEY_LIST[_press.lsidekey4])) + basic.append(rs) + + rs = RadioSetting("voxgain", "VOX Gain", + RadioSettingValueList( + VOX_GAIN, VOX_GAIN[_settings.voxgain])) + basic.append(rs) + + rs = RadioSetting("voxdelay", "VOX Delay", + RadioSettingValueList( + VOX_DELAY, VOX_DELAY[_settings.voxdelay])) + basic.append(rs) + + # A channel + a_freq = int(_vfoa.rxfreqa) + freqa = "%i.%05i" % (a_freq / 100000, a_freq % 100000) + if freqa == "0.00000": + val1a = RadioSettingValueString(0, 7, '0.00000') + else: + val1a = RadioSettingValueFloat( + 136, 520, float(freqa), 0.00001, 5) + rs = RadioSetting("rxfreqa", "A Channel - Frequency", val1a) + abblock.append(rs) + + # Offset + # If the offset is 12.345 + # Then the data obtained is [0x45, 0x23, 0x01, 0x00] + a_set_val = _aoffset.ofseta + a_set_list = len(_aoffset.ofseta) - 1 + real_val = '' + for i in range(a_set_list, -1, -1): + real_val += str(a_set_val[i])[2:] + if real_val == "FFFFFFFF": + rs = RadioSetting("ofseta", "A Offset Frequency", + RadioSettingValueString(0, 7, "")) + + else: + real_val = int(real_val) + real_val = "%i.%05i" % (real_val / 100000, real_val % 100000) + rs = RadioSetting("ofseta", "A Offset Frequency", + RadioSettingValueFloat( + 0.00000, 59.99750, real_val, 0.00001, 5)) + abblock.append(rs) + + rs = RadioSetting("offset", "A Offset", + RadioSettingValueList( + A_OFFSET, A_OFFSET[_vfoa.offset])) + abblock.append(rs) + + rs = RadioSetting("lowpower", "A TX Power", + RadioSettingValueList( + A_TX_POWER, A_TX_POWER[_vfoa.lowpower])) + abblock.append(rs) + + rs = RadioSetting("wide", "A Band", + RadioSettingValueList( + A_BAND, A_BAND[_vfoa.wide])) + abblock.append(rs) + + rs = RadioSetting("bcl", "A Busy Lock", + RadioSettingValueList( + A_BUSYLOCK, A_BUSYLOCK[_vfoa.bcl])) + abblock.append(rs) + + rs = RadioSetting("specialqta", "A Special QT/DQT", + RadioSettingValueList( + A_SPEC_QTDQT, A_SPEC_QTDQT[_vfoa.specialqta])) + abblock.append(rs) + + rs = RadioSetting("aworkmode", "A Work Mode", + RadioSettingValueList( + A_WORKMODE, A_WORKMODE[_settings.aworkmode])) + abblock.append(rs) + + # B channel + b_freq = int(str(int(_vfob.rxfreqb)).ljust(8, '0')) + freqb = "%i.%05i" % (b_freq / 100000, b_freq % 100000) + if freqb == "0.00000": + val1a = RadioSettingValueString(0, 7, '0.00000') + else: + val1a = RadioSettingValueFloat( + 136, 520, float(freqb), 0.00001, 5) + rs = RadioSetting("rxfreqb", "B Channel - Frequency", val1a) + abblock.append(rs) + + # Offset frequency + # If the offset is 12.345 + # Then the data obtained is [0x45, 0x23, 0x01, 0x00] + # Need to use the following anonymous function to process data + b_set_val = _boffset.ofsetb + b_set_list = len(_boffset.ofsetb) - 1 + real_val = '' + for i in range(b_set_list, -1, -1): + real_val += str(b_set_val[i])[2:] + if real_val == "FFFFFFFF": + rs = RadioSetting("ofsetb", "B Offset Frequency", + RadioSettingValueString(0, 7, " ")) + else: + real_val = int(real_val) + real_val = "%i.%05i" % (real_val / 100000, real_val % 100000) + rs = RadioSetting("ofsetb", "B Offset Frequency", + RadioSettingValueFloat( + 0.00000, 59.99750, real_val, 0.00001, 5)) + abblock.append(rs) + + rs = RadioSetting("offsetb", "B Offset", + RadioSettingValueList( + B_OFFSET, B_OFFSET[_vfob.offsetb])) + abblock.append(rs) + + rs = RadioSetting("lowpowerb", "B TX Power", + RadioSettingValueList( + B_TX_POWER, B_TX_POWER[_vfob.lowpowerb])) + abblock.append(rs) + + rs = RadioSetting("wideb", "B Band", + RadioSettingValueList( + B_BAND, B_BAND[_vfob.wideb])) + abblock.append(rs) + + rs = RadioSetting("bclb", "B Busy Lock", + RadioSettingValueList( + B_BUSYLOCK, B_BUSYLOCK[_vfob.bclb])) + abblock.append(rs) + + rs = RadioSetting("specialqtb", "B Special QT/DQT", + RadioSettingValueList( + B_SPEC_QTDQT, B_SPEC_QTDQT[_vfob.specialqtb])) + abblock.append(rs) + + rs = RadioSetting("bworkmode", "B Work Mode", + RadioSettingValueList( + B_WORKMODE, B_WORKMODE[_settings.bworkmode])) + abblock.append(rs) + + rs = RadioSetting("fmworkmode", "Work Mode", + RadioSettingValueList( + FM_WORKMODE, FM_WORKMODE[_settings.fmworkmode])) + fmmode.append(rs) + + rs = RadioSetting("fmroad", "Channel", + RadioSettingValueList( + FM_CHANNEL, FM_CHANNEL[_settings.fmroad])) + fmmode.append(rs) + + rs = RadioSetting("fmrec", "Forbid Receive", + RadioSettingValueBoolean(_settings.fmrec)) + fmmode.append(rs) + + # FM + for i in range(25): + _fm = self._get_fm(i).fmblock + _fm_len = len(_fm) - 1 + _fm_temp = '' + for x in range(_fm_len, -1, -1): + _fm_temp += str(_fm[x])[2:] + if _fm_temp == "00000000" or _fm_temp == 'FFFFFFFF': + rs = RadioSetting('block' + str(i), "Channel" + " " + str(i+1), + RadioSettingValueString(0, 5, "")) + else: + _fm_block = int(_fm_temp) + _fm_block = '%i.%i' % (_fm_block / 10, _fm_block % 10) + rs = RadioSetting('block' + str(i), "Channel" + " " + str(i+1), + RadioSettingValueString(0, 5, _fm_block)) + fmmode.append(rs) + + _fmv = self._memobj.fmvfo.vfo + _fmv_len = len(_fmv) - 1 + _fmv_temp = '' + for x in range(_fmv_len, -1, -1): + _fmv_temp += str(_fmv[x])[2:] + _fmv_block = int(_fmv_temp) + _fmv_block = '%i.%i' % (_fmv_block / 10, _fmv_block % 10) + rs = RadioSetting( + "fmvfo", "VFO", RadioSettingValueFloat( + 76.0, 108.0, _fmv_block, 0.1, 1)) + fmmode.append(rs) + + # DTMF + gcode_val = str(_gcode.gcode)[2:] + if gcode_val == "FF": + gcode_val = "Off" + elif gcode_val == "0F": + gcode_val = "#" + elif gcode_val == "0E": + gcode_val = "*" + elif gcode_val == '00': + gcode_val = "" + else: + gcode_val = gcode_val[1] + rs = RadioSetting("gcode", "Group Code", + RadioSettingValueList(GROUPCODE, + gcode_val)) + dtmf.append(rs) + + icode_list = self._memobj.icode.idcode + used_icode = '' + for i in icode_list: + if i == 0xFF: + continue + used_icode += str(i)[3] + dtmfcharsani = "0123456789ABCD " + i_val = RadioSettingValueString(0, 3, used_icode) + rs = RadioSetting("icode", "ID Code", i_val) + i_val.set_charset(dtmfcharsani) + dtmf.append(rs) + + gcode_list_1 = self._memobj.group1.group1 + used_group1 = '' + for i in gcode_list_1: + if i == 0xFF: + continue + used_group1 += str(i)[3] + group1_val = RadioSettingValueString(0, 7, used_group1) + rs = RadioSetting("group1", "1", group1_val) + group1_val.set_charset(dtmfcharsani) + dtmf.append(rs) + + gcode_list_2 = self._memobj.group2.group2 + used_group2 = '' + for i in gcode_list_2: + if i == 0xFF: + continue + used_group2 += str(i)[3] + group2_val = RadioSettingValueString(0, 7, used_group2) + rs = RadioSetting("group2", "2", group2_val) + group2_val.set_charset(dtmfcharsani) + dtmf.append(rs) + + gcode_list_3 = self._memobj.group3.group3 + used_group3 = '' + for i in gcode_list_3: + if i == 0xFF: + continue + used_group3 += str(i)[3] + group3_val = RadioSettingValueString(0, 7, used_group3) + rs = RadioSetting("group3", "3", group3_val) + group3_val.set_charset(dtmfcharsani) + dtmf.append(rs) + + gcode_list_4 = self._memobj.group4.group4 + used_group4 = '' + for i in gcode_list_4: + if i == 0xFF: + continue + used_group4 += str(i)[3] + group4_val = RadioSettingValueString(0, 7, used_group4) + rs = RadioSetting("group4", "4", group4_val) + group4_val.set_charset(dtmfcharsani) + dtmf.append(rs) + + gcode_list_5 = self._memobj.group5.group5 + used_group5 = '' + for i in gcode_list_5: + if i == 0xFF: + continue + used_group5 += str(i)[3] + group5_val = RadioSettingValueString(0, 7, used_group5) + rs = RadioSetting("group5", "5", group5_val) + group5_val.set_charset(dtmfcharsani) + dtmf.append(rs) + + gcode_list_6 = self._memobj.group6.group6 + used_group6 = '' + for i in gcode_list_6: + if i == 0xFF: + continue + used_group6 += str(i)[3] + group6_val = RadioSettingValueString(0, 7, used_group6) + rs = RadioSetting("group6", "6", group6_val) + group6_val.set_charset(dtmfcharsani) + dtmf.append(rs) + + gcode_list_7 = self._memobj.group7.group7 + used_group7 = '' + for i in gcode_list_7: + if i == 0xFF: + continue + used_group7 += str(i)[3] + group7_val = RadioSettingValueString(0, 7, used_group7) + rs = RadioSetting("group7", "7", group7_val) + group7_val.set_charset(dtmfcharsani) + dtmf.append(rs) + + gcode_list_8 = self._memobj.group8.group8 + used_group8 = '' + for i in gcode_list_8: + if i == 0xFF: + continue + used_group8 += str(i)[3] + group8_val = RadioSettingValueString(0, 7, used_group8) + rs = RadioSetting("group8", "8", group7_val) + group8_val.set_charset(dtmfcharsani) + dtmf.append(rs) + + scode_list = self._memobj.startcode.scode + used_scode = '' + for i in scode_list: + if i == 0xFF: + continue + used_scode += str(i)[3] + scode_val = RadioSettingValueString(0, 7, used_scode) + rs = RadioSetting("scode", "PTT ID Starting(BOT)", scode_val) + scode_val.set_charset(dtmfcharsani) + dtmf.append(rs) + + ecode_list = self._memobj.endcode.ecode + used_ecode = '' + for i in ecode_list: + if i == 0xFF: + continue + used_ecode += str(i)[3] + ecode_val = RadioSettingValueString(0, 7, used_ecode) + rs = RadioSetting("ecode", "PTT ID Ending(BOT)", ecode_val) + dtmf.append(rs) + + return group + + def get_settings(self): + try: + return self._get_settings() + except Exception: + raise InvalidValueError("Setting Failed!") + + def set_settings(self, settings): + + def fm_validate(value): + if 760 > value or value > 1080: + msg = ("FM Channel muse be between 76.0-108.0") + raise InvalidValueError(msg) + + _settings = self._memobj.settings + _press = self._memobj.press + _aoffset = self._memobj.aoffset + _boffset = self._memobj.boffset + _vfoa = self._memobj.vfoa + _vfob = self._memobj.vfob + _fmmode = self._memobj.fmmode + for element in settings: + if not isinstance(element, RadioSetting): + if element.get_name() == "fm_preset": + self._set_fm_preset(element) + else: + self.set_settings(element) + continue + else: + try: + name = element.get_name() + if "." in name: + bits = name.split(".") + obj = self._memobj + for bit in bits[:-1]: + if "/" in bit: + bit, index = bit.split("/", 1) + index = int(index) + obj = getattr(obj, bit)[index] + else: + obj = getattr(obj, bit) + setting = bits[-1] + elif name in PRESS_NAME: + obj = _press + setting = element.get_name() + + elif name in VFOA_NAME: + obj = _vfoa + setting = element.get_name() + elif name == "ofseta": + obj = _aoffset + setting = element.get_name() + elif name in VFOB_NAME: + obj = _vfob + setting = element.get_name() + elif name == "ofsetb": + obj = _boffset + setting = element.get_name() + elif "block" in name: + obj = _fmmode + setting = element.get_name() + elif "fmvfo" in name: + obj = self._memobj.fmvfo.vfo + setting = element.get_name() + elif "gcode" in name: + obj = self._memobj.groupcode.gcode + setting = element.get_name() + elif "idcode" in name: + obj = self._memobj.icode.idcode + setting = element.get_name() + elif "scode" in name: + obj = self._memobj.startcode.scode + setting = element.get_name() + elif "ecode" in name: + obj = self._memobj.endcode.ecode + setting = element.get_name() + elif "group1" in name: + obj = self._memobj.group1.group1 + setting = element.get_name() + elif "group2" in name: + obj = self._memobj.group2.group2 + setting = element.get_name() + elif "group3" in name: + obj = self._memobj.group3.group3 + setting = element.get_name() + elif "group4" in name: + obj = self._memobj.group4.group4 + setting = element.get_name() + elif "group5" in name: + obj = self._memobj.group5.group5 + setting = element.get_name() + elif "group6" in name: + obj = self._memobj.group6.group6 + setting = element.get_name() + elif "group7" in name: + obj = self._memobj.group7.group7 + setting = element.get_name() + elif "group8" in name: + obj = self._memobj.group8.group8 + setting = element.get_name() + + else: + obj = _settings + setting = element.get_name() + + if element.has_apply_callback(): + LOG.debug("Using apply callback") + element.run_apply_callback() + + # Channel A + elif setting == "rxfreqa" and element.value.get_mutable(): + val = int(str(element.value).replace( + '.', '').ljust(8, '0')) + if (val >= 13600000 and val <= 17400000) or \ + (val >= 40000000 and val <= 52000000): + setattr(obj, setting, val) + else: + msg = ( + "Frequency must be between " + "136.00000-174.00000 or 400.00000-520.00000") + raise InvalidValueError(msg) + + elif setting == "ofseta" and element.value.get_mutable(): + if '.' in str(element.value): + val = str(element.value).replace(' ', '') + if len( + val[val.index(".") + 1:] + ) >= 1 and int(val[val.index(".") + 1:] + ) != 0: + val = '00' + val.replace('.', '') + else: + val = '0' + val.replace('.', '') + val = val.ljust(8, '0') + lenth_val = 0 + list_val = [] + else: + val = '0' + str(element.value).replace(' ', '') + val = val.ljust(8, '0') + lenth_val = 0 + list_val = [] + if (int(val) >= 0 and int(val) <= 5999750): + if int(val) == 0: + _aoffset.ofseta = [0xFF, 0xFF, 0xFF, 0xFF] + else: + while lenth_val < (len(val)): + list_val.insert( + 0, val[lenth_val:lenth_val + 2]) + lenth_val += 2 + for i in range(len(list_val)): + list_val[i] = int(list_val[i], 16) + _aoffset.ofseta = list_val + else: + msg = ("Offset must be between 0.00000-59.99750") + raise InvalidValueError(msg) + + # B channel + elif setting == "rxfreqb" and element.value.get_mutable(): + val = 0 + val = int(str(element.value).replace( + '.', '').ljust(8, '0')) + if (val >= 13600000 and val <= 17400000) or \ + (val >= 40000000 and val <= 52000000): + setattr(obj, setting, val) + else: + msg = ( + "Frequency must be between " + "136.00000-174.00000 or 400.00000-520.00000") + raise InvalidValueError(msg) + # setattr(obj, setting, val) + + elif setting == "ofsetb" and element.value.get_mutable(): + if '.' in str(element.value): + val = str(element.value).replace(' ', '') + if len(val[val.index(".") + 1:] + ) >= 1 and int(val[val.index(".") + 1:] + ) != 0: + val = '00' + \ + str(element.value).replace('.', '') + else: + val = '0' + str(element.value).replace('.', '') + val = val.ljust(8, '0') + lenth_val = 0 + list_val = [] + else: + val = '0' + str(element.value).replace(' ', '') + val = val.ljust(8, '0') + lenth_val = 0 + list_val = [] + if (int(val) >= 0 and int(val) <= 5999750): + if int(val) == 0: + _boffset.ofsetb = [0xFF, 0xFF, 0xFF, 0xFF] + else: + while lenth_val < (len(val)): + list_val.insert( + 0, val[lenth_val:lenth_val + 2]) + lenth_val += 2 + for i in range(len(list_val)): + list_val[i] = int(list_val[i], 16) + _boffset.ofsetb = list_val + else: + msg = ("Offset must be between 0.00000-59.99750") + raise InvalidValueError(msg) + + # FM + elif "block" in name: + + val = str(element.value).replace('.', '').zfill(8) + num = int(element.get_name().replace('block', '')) + 1 + lenth_val = 0 + list_val = [] + if str(element.value)[0] == ' ': + list_val = [0, 0, 0, 0] + else: + val = val.replace(' ', '').zfill(8) + fm_validate(int(val)) + while lenth_val < (len(val)): + list_val.insert( + 0, int(val[lenth_val:lenth_val + 2], 16)) + lenth_val += 2 + self._memobj.fmmode[num - 1].fmblock = list_val + + if val != '00000 ': + fmblock_xy = self.get_block_xy(num) + _fmusedflags = self._get_fmblock_data( + fmblock_xy[0]) + if fmblock_xy[1] == 1: + _fmusedflags.block1 = 1 + elif fmblock_xy[1] == 2: + _fmusedflags.block2 = 1 + elif fmblock_xy[1] == 3: + _fmusedflags.block3 = 1 + elif fmblock_xy[1] == 4: + _fmusedflags.block4 = 1 + elif fmblock_xy[1] == 5: + _fmusedflags.block5 = 1 + elif fmblock_xy[1] == 6: + _fmusedflags.block6 = 1 + elif fmblock_xy[1] == 7: + _fmusedflags.block7 = 1 + elif fmblock_xy[1] == 8: + _fmusedflags.block8 = 1 + else: + fmblock_xy = self.get_block_xy(num) + _fmusedflags = self._get_fmblock_data( + fmblock_xy[0]) + if fmblock_xy[1] == 1: + _fmusedflags.block1 = 0 + elif fmblock_xy[1] == 2: + _fmusedflags.block2 = 0 + elif fmblock_xy[1] == 3: + _fmusedflags.block3 = 0 + elif fmblock_xy[1] == 4: + _fmusedflags.block4 = 0 + elif fmblock_xy[1] == 5: + _fmusedflags.block5 = 0 + elif fmblock_xy[1] == 6: + _fmusedflags.block6 = 0 + elif fmblock_xy[1] == 7: + _fmusedflags.block7 = 0 + elif fmblock_xy[1] == 8: + _fmusedflags.block8 = 0 + + elif setting == 'fmvfo' and element.value.get_mutable(): + val = str(element.value).replace('.', '').zfill(8) + lenth_val = 0 + list_val = [] + if " " in val: + list_val = [0, 0, 0, 0] + else: + while lenth_val < (len(val)): + list_val.insert( + 0, int(val[lenth_val:lenth_val + 2], 16)) + lenth_val += 2 + self._memobj.fmvfo.vfo = list_val + + elif setting == 'gcode' and element.value.get_mutable(): + val = str(element.value) + if val == 'Off': + gcode_used = 0xFF + elif val == 'A': + gcode_used = 0x0A + elif val == 'B': + gcode_used = 0x0B + elif val == 'C': + gcode_used = 0x0C + elif val == 'D': + gcode_used = 0x0D + elif val == '#': + gcode_used = 0x0F + elif val == '*': + gcode_used = 0x0E + elif val == '': + gcode_used = 0x00 + self._memobj.groupcode.gcode = gcode_used + + elif setting == 'icode' and element.value.get_mutable(): + val = str(element.value) + list_val = [] + lenth_val = 0 + while lenth_val < (len(val)): + if val[lenth_val] != ' ': + list_val.append(int(val[lenth_val], 16)) + lenth_val += 1 + else: + list_val.append(0xFF) + lenth_val += 1 + self._memobj.icode.idcode = list_val + + elif setting == 'scode' and element.value.get_mutable(): + val = str(element.value) + list_val = [] + lenth_val = 0 + while lenth_val < (len(val)): + if val[lenth_val] != ' ': + list_val.append(int(val[lenth_val], 16)) + lenth_val += 1 + else: + list_val.append(0xFF) + lenth_val += 1 + self._memobj.startcode.scode = list_val + + elif setting == 'ecode' and element.value.get_mutable(): + val = str(element.value) + list_val = [] + lenth_val = 0 + while lenth_val < (len(val)): + if val[lenth_val] != ' ': + list_val.append(int(val[lenth_val], 16)) + lenth_val += 1 + else: + list_val.append(0xFF) + lenth_val += 1 + self._memobj.endcode.ecode = list_val + + elif setting == 'group1' and element.value.get_mutable(): + val = str(element.value) + list_val = [] + lenth_val = 0 + while lenth_val < (len(val)): + if val[lenth_val] != ' ': + list_val.append(int(val[lenth_val], 16)) + lenth_val += 1 + else: + list_val.append(0xFF) + lenth_val += 1 + self._memobj.group1.group1 = list_val + + elif setting == 'group2' and element.value.get_mutable(): + val = str(element.value) + list_val = [] + lenth_val = 0 + while lenth_val < (len(val)): + if val[lenth_val] != ' ': + list_val.append(int(val[lenth_val], 16)) + lenth_val += 1 + else: + list_val.append(0xFF) + lenth_val += 1 + self._memobj.group2.group2 = list_val + + elif setting == 'group3' and element.value.get_mutable(): + val = str(element.value) + list_val = [] + lenth_val = 0 + while lenth_val < (len(val)): + if val[lenth_val] != ' ': + list_val.append(int(val[lenth_val], 16)) + lenth_val += 1 + else: + list_val.append(0xFF) + lenth_val += 1 + self._memobj.group3.group3 = list_val + + elif setting == 'group4' and element.value.get_mutable(): + val = str(element.value) + list_val = [] + lenth_val = 0 + while lenth_val < (len(val)): + if val[lenth_val] != ' ': + list_val.append(int(val[lenth_val], 16)) + lenth_val += 1 + else: + list_val.append(0xFF) + lenth_val += 1 + self._memobj.group4.group4 = list_val + + elif setting == 'group5' and element.value.get_mutable(): + val = str(element.value) + list_val = [] + lenth_val = 0 + while lenth_val < (len(val)): + if val[lenth_val] != ' ': + list_val.append(int(val[lenth_val], 16)) + lenth_val += 1 + else: + list_val.append(0xFF) + lenth_val += 1 + self._memobj.group5.group5 = list_val + + elif setting == 'group6' and element.value.get_mutable(): + val = str(element.value) + list_val = [] + lenth_val = 0 + while lenth_val < (len(val)): + if val[lenth_val] != ' ': + list_val.append(int(val[lenth_val], 16)) + lenth_val += 1 + else: + list_val.append(0xFF) + lenth_val += 1 + self._memobj.group6.group6 = list_val + + elif setting == 'group7' and element.value.get_mutable(): + val = str(element.value) + list_val = [] + lenth_val = 0 + while lenth_val < (len(val)): + if val[lenth_val] != ' ': + list_val.append(int(val[lenth_val], 16)) + lenth_val += 1 + else: + list_val.append(0xFF) + lenth_val += 1 + self._memobj.group7.group7 = list_val + + elif setting == 'group8' and element.value.get_mutable(): + val = str(element.value) + list_val = [] + lenth_val = 0 + while lenth_val < (len(val)): + if val[lenth_val] != ' ': + list_val.append(int(val[lenth_val], 16)) + lenth_val += 1 + else: + list_val.append(0xFF) + lenth_val += 1 + self._memobj.group8.group8 = list_val + elif setting == 'lang': + self._memobj.settings.lang = ( + str(element.value) == 'English' and 2 or 1) + elif element.value.get_mutable(): + setattr(obj, setting, element.value) + except Exception: + LOG.debug(element.get_name()) + raise + + def _set_fm_preset(self, settings): + for element in settings: + try: + val = element.value + if self._memobj.fm_presets <= 108.0 * 10 - 650: + value = int(val.get_value() * 10 - 650) + else: + value = int(val.get_value() * 10) + LOG.debug("Setting fm_presets = %s" % (value)) + self._memobj.fm_presets = value + except Exception: + LOG.debug(element.get_name()) + raise + + +@directory.register +class TDH8_HAM(TDH8): + VENDOR = "TIDRADIO" + MODEL = "TD-H8-HAM" + ident_mode = b'P31185\xff\xff' + _ham = True + _vhf_range = (144000000, 149000000) + _uhf_range = (420000000, 451000000) + + +@directory.register +class TDH8_GMRS(TDH8): + VENDOR = "TIDRADIO" + MODEL = "TD-H8-GMRS" + ident_mode = b'P31184\xff\xff' + _gmrs = True + _vhf_range = (136000000, 175000000) + _uhf_range = (400000000, 521000000) + + def validate_memory(self, mem): + msgs = super().validate_memory(mem) + if 31 <= mem.number <= 54 and mem.freq not in GMRS_FREQS: + msgs.append(chirp_common.ValidationError( + "The frequency in channels 31-54 must be between" + "462.55000-462.72500 in 0.025 increments.")) + return msgs + + +@directory.register +class UV68(TDH8): + VENDOR = "TID" + MODEL = "TD-UV68" diff --git a/chirp/drivers/tdxone_tdq8a.py b/chirp/drivers/tdxone_tdq8a.py index 3da0494..56a57ef 100644 --- a/chirp/drivers/tdxone_tdq8a.py +++ b/chirp/drivers/tdxone_tdq8a.py @@ -17,16 +17,13 @@ import time import struct import logging -import re from chirp import chirp_common, directory, memmap from chirp import bitwise, errors, util from chirp.settings import RadioSettingGroup, RadioSetting, \ RadioSettingValueBoolean, RadioSettingValueList, \ RadioSettingValueString, RadioSettingValueInteger, \ - RadioSettingValueFloat, RadioSettings, \ - InvalidValueError -from textwrap import dedent + RadioSettings LOG = logging.getLogger(__name__) @@ -209,7 +206,7 @@ def _rawsend(radio, data): def _make_frame(cmd, addr, length, data=""): - """Pack the info in the headder format""" + """Pack the info in the header format""" frame = struct.pack(">BHB", ord(cmd), addr, length) # add the data if set if len(data) != 0: @@ -454,22 +451,18 @@ class TDXoneTDQ8A(chirp_common.CloneModeRadio, 'Please save an unedited copy of your first successful\n' 'download to a CHIRP Radio Images(*.img) file.' ) - rp.pre_download = _(dedent("""\ - Follow these instructions to download your info: - - 1 - Turn off your radio - 2 - Connect your interface cable - 3 - Turn on your radio - 4 - Do the download of your radio data - """)) - rp.pre_upload = _(dedent("""\ - Follow this instructions to upload your info: - - 1 - Turn off your radio - 2 - Connect your interface cable - 3 - Turn on your radio - 4 - Do the upload of your radio data - """)) + rp.pre_download = _( + "Follow these instructions to download your info:\n" + "1 - Turn off your radio\n" + "2 - Connect your interface cable\n" + "3 - Turn on your radio\n" + "4 - Do the download of your radio data\n") + rp.pre_upload = _( + "Follow this instructions to upload your info:\n" + "1 - Turn off your radio\n" + "2 - Connect your interface cable\n" + "3 - Turn on your radio\n" + "4 - Do the upload of your radio data\n") return rp def get_features(self): @@ -951,7 +944,7 @@ class TDXoneTDQ8A(chirp_common.CloneModeRadio, elif element.value.get_mutable(): LOG.debug("Setting %s = %s" % (setting, element.value)) setattr(obj, setting, element.value) - except Exception as e: + except Exception: LOG.debug(element.get_name()) raise @@ -965,7 +958,7 @@ class TDXoneTDQ8A(chirp_common.CloneModeRadio, value = int(val.get_value() * 10) LOG.debug("Setting fm_presets = %s" % (value)) self._memobj.fm_presets = value - except Exception as e: + except Exception: LOG.debug(element.get_name()) raise diff --git a/chirp/drivers/template.py b/chirp/drivers/template.py index 9802dc2..c0acb0c 100644 --- a/chirp/drivers/template.py +++ b/chirp/drivers/template.py @@ -13,7 +13,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -from chirp import chirp_common, directory, memmap +from chirp import chirp_common, memmap from chirp import bitwise # Here is where we define the memory map for the radio. Since @@ -36,7 +36,7 @@ struct { def do_download(radio): """This is your download function""" # NOTE: Remove this in your real implementation! - return memmap.MemoryMap("\x00" * 1000) + return memmap.MemoryMapBytes(b"\x00" * 1000) # Get the serial port connection serial = radio.pipe @@ -44,11 +44,11 @@ def do_download(radio): # Our fake radio is just a simple download of 1000 bytes # from the serial port. Do that one byte at a time and # store them in the memory map - data = "" + data = b"" for _i in range(0, 1000): - data = serial.read(1) + data += serial.read(1) - return memmap.MemoryMap(data) + return memmap.MemoryMapBytes(data) def do_upload(radio): @@ -74,6 +74,9 @@ class TemplateRadio(chirp_common.CloneModeRadio): MODEL = "Template" # Replace this with your model BAUD_RATE = 9600 # Replace this with your baud rate + # All new drivers should be "Byte Clean" so leave this in place. + NEEDS_COMPAT_SERIAL = False + # Return information about this radio's features, including # how many memories it has, what bands it supports, etc def get_features(self): @@ -117,7 +120,7 @@ class TemplateRadio(chirp_common.CloneModeRadio): mem.freq = int(_mem.freq) mem.name = str(_mem.name).rstrip() # Set the alpha tag - # We'll consider any blank (i.e. 0MHz frequency) to be empty + # We'll consider any blank (i.e. 0 MHz frequency) to be empty if mem.freq == 0: mem.empty = True diff --git a/chirp/drivers/tg_uv2p.py b/chirp/drivers/tg_uv2p.py index 85fb906..6d96002 100644 --- a/chirp/drivers/tg_uv2p.py +++ b/chirp/drivers/tg_uv2p.py @@ -23,9 +23,8 @@ import serial from chirp import chirp_common, directory, bitwise, memmap, errors, util from chirp.settings import RadioSetting, RadioSettingGroup, \ RadioSettingValueBoolean, RadioSettingValueList, \ - RadioSettingValueInteger, RadioSettingValueString, \ - RadioSettingValueFloat, RadioSettingValueMap, RadioSettings -from textwrap import dedent + RadioSettingValueInteger, RadioSettingValueFloat, \ + RadioSettingValueMap, RadioSettings LOG = logging.getLogger(__name__) @@ -115,24 +114,34 @@ struct name names[200]; """ -def do_ident(radio): - radio.pipe.timeout = 3 - radio.pipe.stopbits = serial.STOPBITS_TWO - radio.pipe.write("\x02PnOGdAM") +def do_program_mode(radio): + radio.pipe.write(b"\x02PnOGdAM") for x in range(10): ack = radio.pipe.read(1) - if ack == '\x06': + if ack == b'\x06': break else: raise errors.RadioError("Radio did not ack programming mode") - radio.pipe.write("\x40\x02") + + +def do_ident(radio): + radio.pipe.timeout = 3 + radio.pipe.stopbits = serial.STOPBITS_TWO + do_program_mode(radio) + radio.pipe.write(b"\x4D\x02") ident = radio.pipe.read(8) LOG.debug(util.hexprint(ident)) - if not ident.startswith('P5555'): - raise errors.RadioError("Unsupported model") - radio.pipe.write("\x06") + if not ident.startswith(b'P5555'): + LOG.debug("First ident attempt (x4D, x02) failed trying 0x40,x02") + do_program_mode(radio) + radio.pipe.write(b"\x40\x02") + ident = radio.pipe.read(8) + LOG.debug(util.hexprint(ident)) + if not ident.startswith(b'P5555'): + raise errors.RadioError("Unsupported model") + radio.pipe.write(b"\x06") ack = radio.pipe.read(1) - if ack != "\x06": + if ack != b"\x06": raise errors.RadioError("Radio did not ack ident") @@ -146,18 +155,18 @@ def do_status(radio, direction, addr): def do_download(radio): do_ident(radio) - data = "TG-UV2+ Radio Program Data v1.0\x00" - data += ("\x00" * 16) + data = b"TG-UV2+ Radio Program Data v1.0\x00" + data += (b"\x00" * 16) firstack = None for i in range(0, 0x2000, 8): - frame = struct.pack(">cHB", "R", i, 8) + frame = struct.pack(">cHB", b"R", i, 8) radio.pipe.write(frame) result = radio.pipe.read(12) - if not (result[0] == "W" and frame[1:4] == result[1:4]): + if not (result[0:1] == b"W" and frame[1:4] == result[1:4]): LOG.debug(util.hexprint(result)) raise errors.RadioError("Invalid response for address 0x%04x" % i) - radio.pipe.write("\x06") + radio.pipe.write(b"\x06") ack = radio.pipe.read(1) if not firstack: firstack = ack @@ -169,7 +178,7 @@ def do_download(radio): data += result[4:] do_status(radio, "from", i) - return memmap.MemoryMap(data) + return memmap.MemoryMapBytes(data) def do_upload(radio): @@ -177,17 +186,18 @@ def do_upload(radio): data = radio._mmap[0x0030:] for i in range(0, 0x2000, 8): - frame = struct.pack(">cHB", "W", i, 8) + frame = struct.pack(">cHB", b"W", i, 8) frame += data[i:i + 8] radio.pipe.write(frame) ack = radio.pipe.read(1) - if ack != "\x06": + if ack != b"\x06": LOG.debug("Radio NAK'd block at address 0x%04x" % i) raise errors.RadioError( "Radio NAK'd block at address 0x%04x" % i) LOG.debug("Radio ACK'd block at address 0x%04x" % i) do_status(radio, "to", i) + DUPLEX = ["", "+", "-"] TGUV2P_STEPS = [5, 6.25, 10, 12.5, 15, 20, 25, 30, 50, 100] CHARSET = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_|* +-" @@ -209,6 +219,7 @@ class QuanshengTGUV2P(chirp_common.CloneModeRadio, VENDOR = "Quansheng" MODEL = "TG-UV2+" BAUD_RATE = 9600 + NEEDS_COMPAT_SERIAL = False _memsize = 0x2000 @@ -218,20 +229,22 @@ class QuanshengTGUV2P(chirp_common.CloneModeRadio, rp.experimental = \ ('Experimental version for TG-UV2/2+ radios ' 'Proceed at your own risk!') - rp.pre_download = _(dedent("""\ - 1. Turn radio off. - 2. Connect cable to mic/spkr connector. - 3. Make sure connector is firmly connected. - 4. Turn radio on. - 5. Ensure that the radio is tuned to channel with no activity. - 6. Click OK to download image from device.""")) - rp.pre_upload = _(dedent("""\ - 1. Turn radio off. - 2. Connect cable to mic/spkr connector. - 3. Make sure connector is firmly connected. - 4. Turn radio on. - 5. Ensure that the radio is tuned to channel with no activity. - 6. Click OK to upload image to device.""")) + rp.pre_download = _( + "1. Turn radio off.\n" + "2. Connect cable to mic/spkr connector.\n" + "3. Make sure connector is firmly connected.\n" + "4. Turn radio on.\n" + "5. Ensure that the radio is tuned to channel with no" + " activity.\n" + "6. Click OK to download image from device.\n") + rp.pre_upload = _( + "1. Turn radio off.\n" + "2. Connect cable to mic/spkr connector.\n" + "3. Make sure connector is firmly connected.\n" + "4. Turn radio on.\n" + "5. Ensure that the radio is tuned to channel with no" + " activity.\n" + "6. Click OK to upload image to device.\n") return rp def get_features(self): @@ -759,12 +772,12 @@ class QuanshengTGUV2P(chirp_common.CloneModeRadio, raise errors.InvalidValueError( "Please select a valid priority channel:\n" "A used memory channel which is not " - "in the Broadcast FM band (88-108MHz),\n" + "in the Broadcast FM band (88-108 MHz),\n" "Or select 'Not Used'") elif element.value.get_mutable(): LOG.debug("Setting %s = %s" % (setting, element.value)) setattr(obj, setting, element.value) - except Exception as e: + except Exception: LOG.debug(element.get_name()) raise diff --git a/chirp/drivers/th350.py b/chirp/drivers/th350.py index b27c86b..a728d2f 100644 --- a/chirp/drivers/th350.py +++ b/chirp/drivers/th350.py @@ -208,7 +208,6 @@ def do_download(radio): do_ident(radio) data = b"TRI350 Radio Program data v1.08\x00" data += (b"\x00" * 16) - firstack = None for i in range(0, 0x1000, 16): frame = struct.pack(">cHB", b"R", i, 16) radio.pipe.write(frame) diff --git a/chirp/drivers/th7800.py b/chirp/drivers/th7800.py index 59027fc..58dfd01 100644 --- a/chirp/drivers/th7800.py +++ b/chirp/drivers/th7800.py @@ -19,13 +19,10 @@ from chirp import bitwise, chirp_common, directory, errors, util, memmap import struct from chirp.settings import RadioSetting, RadioSettingGroup, \ - RadioSettingValueInteger, RadioSettingValueList, \ - RadioSettingValueBoolean, RadioSettingValueString, \ - RadioSettingValueFloat, InvalidValueError, RadioSettings, \ + RadioSettingValueInteger, RadioSettingValueBoolean, \ + RadioSettingValueString, RadioSettings, \ RadioSettingValueMap, zero_indexed_seq_map from chirp.chirp_common import format_freq -import os -import time import logging from datetime import date @@ -162,8 +159,8 @@ BUSY_LOCK = ["off", "Carrier", "2 tone"] MICKEYFUNC = ["None", "SCAN", "SQL.OFF", "TCALL", "PPTR", "PRI", "LOW", "TONE", "MHz", "REV", "HOME", "BAND", "VFO/MR"] SQLPRESET = ["Off", "2", "5", "9", "Full"] -BANDS = ["30MHz", "50MHz", "60MHz", "108MHz", "150MHz", "250MHz", "350MHz", - "450MHz", "850MHz"] +BANDS = ["30 MHz", "50 MHz", "60 MHz", "108 MHz", "150 MHz", "250 MHz", "350 MHz", + "450 MHz", "850 MHz"] STEPS = [2.5, 5.0, 6.25, 7.5, 8.33, 10.0, 12.5, 15.0, 20.0, 25.0, 30.0, 50.0, 100.0] @@ -536,7 +533,7 @@ class TYTTH7800Base(chirp_common.Radio): LOG.debug("Setting %s(%s) <= %s" % (setting, oldval, newval)) setattr(_settings, setting, newval) - except Exception as e: + except Exception: LOG.debug(element.get_name()) raise @@ -573,21 +570,20 @@ class TYTTH7800File(TYTTH7800Base, chirp_common.FileBackedRadio): def _identify(radio): """Do identify handshake with TYT""" try: - radio.pipe.write("\x02SPECPR") + radio.pipe.write(b"\x02SPECPR") ack = radio.pipe.read(1) - if ack != "A": + if ack != b"A": util.hexprint(ack) - raise errors.RadioError("Radio did not ACK first command: %x" - % ord(ack)) + raise errors.RadioError("Radio did not ACK first command: %r" + % ack) except: - LOG.debug(util.hexprint(ack)) raise errors.RadioError("Unable to communicate with the radio") - radio.pipe.write("G\x02") + radio.pipe.write(b"G\x02") ident = radio.pipe.read(16) - radio.pipe.write("A") + radio.pipe.write(b"A") r = radio.pipe.read(2) - if r != "A": + if r != b"A": raise errors.RadioError("Ack failed") return ident @@ -598,15 +594,15 @@ def _download(radio, memsize=0x10000, blocksize=0x80): LOG.info("ident:", util.hexprint(data)) offset = 0x100 for addr in range(offset, memsize, blocksize): - msg = struct.pack(">cHB", "R", addr, blocksize) + msg = struct.pack(">cHB", b"R", addr, blocksize) radio.pipe.write(msg) block = radio.pipe.read(blocksize + 4) if len(block) != (blocksize + 4): LOG.debug(util.hexprint(block)) raise errors.RadioError("Radio sent a short block") - radio.pipe.write("A") + radio.pipe.write(b"A") ack = radio.pipe.read(1) - if ack != "A": + if ack != b"A": LOG.debug(util.hexprint(ack)) raise errors.RadioError("Radio NAKed block") data += block[4:] @@ -618,9 +614,9 @@ def _download(radio, memsize=0x10000, blocksize=0x80): status.msg = "Cloning from radio" radio.status_fn(status) - radio.pipe.write("ENDR") + radio.pipe.write(b"ENDR") - return memmap.MemoryMap(data) + return memmap.MemoryMapBytes(data) def _upload(radio, memsize=0xF400, blocksize=0x80): @@ -629,7 +625,7 @@ def _upload(radio, memsize=0xF400, blocksize=0x80): radio.pipe.timeout = 1 - if data != radio._mmap[:radio._mmap_offset]: + if data != radio._mmap[0:radio._mmap_offset]: raise errors.RadioError( "Model mismatch: \n%s\n%s" % (util.hexprint(data), @@ -656,12 +652,12 @@ def _upload(radio, memsize=0xF400, blocksize=0x80): for addr in range(offset, memsize, blocksize): mapaddr = addr + radio._mmap_offset - offset LOG.debug("addr: 0x%04X, mmapaddr: 0x%04X" % (addr, mapaddr)) - msg = struct.pack(">cHB", "W", addr, blocksize) + msg = struct.pack(">cHB", b"W", addr, blocksize) msg += radio._mmap[mapaddr:(mapaddr + blocksize)] LOG.debug(util.hexprint(msg)) radio.pipe.write(msg) ack = radio.pipe.read(1) - if ack != "A": + if ack != b"A": LOG.debug(util.hexprint(ack)) raise errors.RadioError("Radio did not ack block 0x%04X" % addr) @@ -673,7 +669,7 @@ def _upload(radio, memsize=0xF400, blocksize=0x80): radio.status_fn(status) # End of clone - radio.pipe.write("ENDW") + radio.pipe.write(b"ENDW") # Checksum? final_data = radio.pipe.read(3) @@ -686,6 +682,7 @@ class TYTTH7800Radio(TYTTH7800Base, chirp_common.CloneModeRadio, VENDOR = "TYT" MODEL = "TH-7800" BAUD_RATE = 38400 + NEEDS_COMPAT_SERIAL = False _memsize = 65296 _mmap_offset = 0x0010 diff --git a/chirp/drivers/th9000.py b/chirp/drivers/th9000.py index 4cfb0d1..6556706 100644 --- a/chirp/drivers/th9000.py +++ b/chirp/drivers/th9000.py @@ -13,9 +13,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import os import struct -import time import logging from chirp import bitwise @@ -25,15 +23,13 @@ from chirp import errors from chirp import memmap from chirp import util from chirp.settings import RadioSettingGroup, RadioSetting, RadioSettings, \ - RadioSettingValueList, RadioSettingValueString, RadioSettingValueBoolean, \ - RadioSettingValueInteger, RadioSettingValueString, \ - RadioSettingValueFloat, InvalidValueError + RadioSettingValueList, RadioSettingValueString, RadioSettingValueInteger LOG = logging.getLogger(__name__) # -# Chirp Driver for TYT TH-9000D (models: 2M (144 Mhz), 1.25M (220 Mhz) -# and 70cm (440 Mhz) radios) +# Chirp Driver for TYT TH-9000D (models: 2M (144 MHz), 1.25M (220 MHz) +# and 70 cm (440 MHz) radios) # # Version 1.0 # @@ -60,20 +56,9 @@ BGBRIGHT_LIST = ["%s" % x for x in range(1, 32)] SQUELCH_LIST = ["Off"] + ["Level %s" % x for x in range(1, 20)] TIMEOUT_LIST = ["Off"] + ["%s min" % x for x in range(1, 30)] TXPWR_LIST = ["60W", "25W"] # maximum power for Hi setting -TBSTFREQ_LIST = ["1750Hz", "2100Hz", "1000Hz", "1450Hz"] +TBSTFREQ_LIST = ["1750 Hz", "2100 Hz", "1000 Hz", "1450 Hz"] BEEP_LIST = ["Off", "On"] -SETTING_LISTS = { - "auto_power_off": APO_LIST, - "bg_color": BGCOLOR_LIST, - "bg_brightness": BGBRIGHT_LIST, - "squelch": SQUELCH_LIST, - "timeout_timer": TIMEOUT_LIST, - "choose_tx_power": TXPWR_LIST, - "tbst_freq": TBSTFREQ_LIST, - "voice_prompt": BEEP_LIST -} - MEM_FORMAT = """ #seekto 0x0000; struct { @@ -146,7 +131,7 @@ struct { """ # TH9000 memory map # section: 5 TX/RX Range -# used to set the TX/RX range of the radio (e.g. 222-228Mhz for 220 meter) +# used to set the TX/RX range of the radio (e.g. 222-228 MHz for 220 meter) # possible to set range for tx/rx # MEM_FORMAT = MEM_FORMAT + """ @@ -198,8 +183,8 @@ struct { # 1 u8 unknown; # 1 u8 bg_color ; bg color, menu index, blue 0 , orange 1, # purple 2 -# 1 u8 tbst_freq ; tbst freq , menu 0 = 1750Hz, 1=2100 , -# 2=1000 , 3=1450hz +# 1 u8 tbst_freq ; tbst freq, menu 0=1750 Hz, 1=2100, +# 2=1000, 3=1450 Hz # 1 u8 timeout_timer; timeout timer, hex, value = minutes, # 0= no timeout # 1 u8 unknown; @@ -392,7 +377,7 @@ def _echo_write(radio, data): def _checksum(data): cs = 0 for byte in data: - cs += ord(byte) + cs += byte return cs % 256 @@ -413,15 +398,24 @@ def _read(radio, length): def _ident(radio): radio.pipe.timeout = 1 - _echo_write(radio, "PROGRAM") - response = radio.pipe.read(3) - if response != "QX\06": - LOG.debug("Response was :\n%s" % util.hexprint(response)) - raise errors.RadioError("Unsupported model") - _echo_write(radio, "\x02") + exito = False + for i in range(0, 5): + _echo_write(radio, b"PROGRAM") + response = radio.pipe.read(3) + + if response == b"QX\06": + exito = True + + # check if we had EXITO + if exito is False: + msg = "The radio did not accept program mode after five tries.\n" + msg += "Check you interface cable and power cycle your radio." + raise errors.RadioError(msg) + + _echo_write(radio, b"\x02") response = radio.pipe.read(16) LOG.debug(util.hexprint(response)) - if response[1:8] != "TH-9000": + if response[1:8] != b"TH-9000": LOG.error("Looking for:\n%s" % util.hexprint("TH-9000")) LOG.error("Response was:\n%s" % util.hexprint(response)) raise errors.RadioError("Unsupported model") @@ -431,23 +425,23 @@ def _send(radio, cmd, addr, length, data=None): frame = struct.pack(">cHb", cmd, addr, length) if data: frame += data - frame += chr(_checksum(frame[1:])) - frame += "\x06" + frame += bytes([_checksum(frame[1:])]) + frame += b"\x06" _echo_write(radio, frame) LOG.debug("Sent:\n%s" % util.hexprint(frame)) if data: result = radio.pipe.read(1) - if result != "\x06": + if result != b"\x06": LOG.debug("Ack was: %s" % repr(result)) raise errors.RadioError( "Radio did not accept block at %04x" % addr) return result = _read(radio, length + 6) LOG.debug("Got:\n%s" % util.hexprint(result)) - header = result[0:4] + header = result[:4] data = result[4:-2] - ack = result[-1] - if ack != "\x06": + ack = result[-1:] + if ack != b"\x06": LOG.debug("Ack was: %s" % repr(ack)) raise errors.RadioError("Radio NAK'd block at %04x" % addr) _cmd, _addr, _length = struct.unpack(">cHb", header) @@ -457,19 +451,19 @@ def _send(radio, cmd, addr, length, data=None): LOG.debug(" Addr: %04x/%04x" % (addr, _addr)) raise errors.RadioError("Radio send unexpected block") cs = _checksum(result[1:-2]) - if cs != ord(result[-2]): + if cs != result[-2]: LOG.debug("Calculated: %02x" % cs) - LOG.debug("Actual: %02x" % ord(result[-2])) + LOG.debug("Actual: %02x" % result[-2]) raise errors.RadioError("Block at 0x%04x failed checksum" % addr) return data def _finish(radio): - endframe = "\x45\x4E\x44" + endframe = b"\x45\x4E\x44" _echo_write(radio, endframe) result = radio.pipe.read(1) # TYT radios acknowledge the "endframe" command, Luiton radios do not. - if result != "" and result != "\x06": + if result != b"" and result != b"\x06": LOG.error("Got:\n%s" % util.hexprint(result)) raise errors.RadioError("Radio did not finish cleanly") @@ -479,11 +473,11 @@ def do_download(radio): _ident(radio) _memobj = None - data = "" + data = b"" for start, end in radio._ranges: for addr in range(start, end, 0x10): - block = _send(radio, 'R', addr, 0x10) + block = _send(radio, b'R', addr, 0x10) data += block status = chirp_common.Status() status.cur = len(data) @@ -493,7 +487,7 @@ def do_download(radio): _finish(radio) - return memmap.MemoryMap(data) + return memmap.MemoryMapBytes(data) def do_upload(radio): @@ -505,7 +499,7 @@ def do_upload(radio): if addr < 0x0100: continue block = radio._mmap[addr:addr + 0x10] - _send(radio, 'W', addr, len(block), block) + _send(radio, b'W', addr, len(block), block) status = chirp_common.Status() status.cur = addr status.max = end @@ -524,6 +518,7 @@ class Th9000Radio(chirp_common.CloneModeRadio, VENDOR = "TYT" MODEL = "TH9000 Base" BAUD_RATE = 9600 + NEEDS_COMPAT_SERIAL = False valid_freq = [(900000000, 999000000)] _memsize = MMAPSIZE @@ -552,6 +547,7 @@ class Th9000Radio(chirp_common.CloneModeRadio, rf.valid_cross_modes = ['Tone->DTCS', 'DTCS->Tone', '->Tone', '->DTCS', 'Tone->Tone'] rf.valid_power_levels = POWER_LEVELS + rf.valid_tones = TONES rf.valid_dtcs_codes = chirp_common.ALL_DTCS_CODES rf.valid_bands = self.valid_freq rf.valid_tuning_steps = TUNING_STEPS @@ -647,7 +643,7 @@ class Th9000Radio(chirp_common.CloneModeRadio, mem.skip = "S" if skipflag == 1 else "" - # We'll consider any blank (i.e. 0MHz frequency) to be empty + # We'll consider any blank (i.e. 0 MHz frequency) to be empty if mem.freq == 0: mem.empty = True @@ -779,25 +775,25 @@ class Th9000Radio(chirp_common.CloneModeRadio, fhigh /= 1000 fmidrange = (fhigh - flow) / 2 - rs = RadioSetting("txrangelow", "TX Freq, Lower Limit (khz)", + 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)", + 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)", + 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)", + rs = RadioSetting("rxrangehi", "RX Freq, Upper Limit (kHz)", RadioSettingValueInteger( fhigh-fmidrange, fhigh, int(_freqrange.rxrangehi) / 10)) @@ -847,7 +843,7 @@ class Th9000Radio(chirp_common.CloneModeRadio, LOG.debug("Setting %s = %s" % (setting, element.value)) setattr(obj, setting, element.value) - except Exception as e: + except Exception: LOG.debug(element.get_name()) raise diff --git a/chirp/drivers/th9800.py b/chirp/drivers/th9800.py index 027324f..0ea022a 100644 --- a/chirp/drivers/th9800.py +++ b/chirp/drivers/th9800.py @@ -20,10 +20,8 @@ import struct from chirp.settings import RadioSetting, RadioSettingGroup, \ RadioSettingValueInteger, RadioSettingValueList, \ RadioSettingValueBoolean, RadioSettingValueString, \ - RadioSettingValueFloat, InvalidValueError, RadioSettings + RadioSettings from chirp.chirp_common import format_freq -import os -import time import logging from datetime import date @@ -164,8 +162,8 @@ BUSY_LOCK = ["off", "Carrier", "2 tone"] MICKEYFUNC = ["None", "SCAN", "SQL.OFF", "TCALL", "PPTR", "PRI", "LOW", "TONE", "MHz", "REV", "HOME", "BAND", "VFO/MR"] SQLPRESET = ["Off", "2", "5", "9", "Full"] -BANDS = ["30MHz", "50MHz", "60MHz", "108MHz", "150MHz", "250MHz", "350MHz", - "450MHz", "850MHz"] +BANDS = ["30 MHz", "50 MHz", "60 MHz", "108 MHz", "150 MHz", "250 MHz", + "350 MHz", "450 MHz", "850 MHz"] STEPS = [2.5, 5.0, 6.25, 7.5, 8.33, 10.0, 12.5, 15.0, 20.0, 25.0, 30.0, 50.0, 100.0] @@ -186,13 +184,13 @@ def isValidDate(month, day, year): max1 = 29 else: max1 = 28 - if(month < 1 or month > 12): + if (month < 1 or month > 12): LOG.debug("Invalid 'Last Program Date: Month'") return False - elif(day < 1 or day > max1): + elif (day < 1 or day > max1): LOG.debug("Invalid 'Last Program Date: Day'") return False - elif(year < 2014 or year > today.year): + elif (year < 2014 or year > today.year): LOG.debug("Invalid 'Last Program Date: Year'") return False return True @@ -201,6 +199,7 @@ def isValidDate(month, day, year): class TYTTH9800Base(chirp_common.Radio): """Base class for TYT TH-9800""" VENDOR = "TYT" + NEEDS_COMPAT_SERIAL = False def get_features(self): rf = chirp_common.RadioFeatures() @@ -326,7 +325,7 @@ class TYTTH9800Base(chirp_common.Radio): emphasis = RadioSetting( "emphasis", "Emphasis", RadioSettingValueBoolean(bool(_mem.emphasis))) - emphasis.set_doc("Boosts 300Hz to 2500Hz mic response") + emphasis.set_doc("Boosts 300 Hz to 2500 Hz mic response") mem.extra.append(emphasis) compand = RadioSetting( @@ -431,7 +430,7 @@ class TYTTH9800Base(chirp_common.Radio): _mem.step = STEPS.index(mem.tuning_step) for setting in mem.extra: - LOG.debug("@set_mem:", setting.get_name(), setting.value) + LOG.debug("@set_mem: %s %s", setting.get_name(), setting.value) setattr(_mem, setting.get_name(), setting.value) def get_settings(self): @@ -492,7 +491,7 @@ class TYTTH9800Base(chirp_common.Radio): basic.append(RadioSetting( "right_func_key", "Right Function Key", RadioSettingValueList(opts, opts[_settings.right_func_key]))) - opts = ["1000Hz", "1450Hz", "1750Hz", "2100Hz"] + opts = ["1000 Hz", "1450 Hz", "1750 Hz", "2100 Hz"] basic.append(RadioSetting( "tbst_freq", "Tone Burst Frequency", RadioSettingValueList(opts, opts[_settings.tbst_freq]))) @@ -634,7 +633,7 @@ class TYTTH9800Base(chirp_common.Radio): LOG.debug("Setting %s(%s) <= %s" % (setting, oldval, newval)) setattr(_settings, setting, newval) - except Exception as e: + except Exception: LOG.debug(element.get_name()) raise @@ -671,9 +670,9 @@ class TYTTH9800File(TYTTH9800Base, chirp_common.FileBackedRadio): def _identify(radio): """Do identify handshake with TYT""" try: - radio.pipe.write("\x02PROGRA") + radio.pipe.write(b"\x02PROGRA") ack = radio.pipe.read(1) - if ack != "A": + if ack != b"A": util.hexprint(ack) raise errors.RadioError("Radio did not ACK first command: %x" % ord(ack)) @@ -681,11 +680,11 @@ def _identify(radio): LOG.debug(util.hexprint(ack)) raise errors.RadioError("Unable to communicate with the radio") - radio.pipe.write("M\x02") + radio.pipe.write(b"M\x02") ident = radio.pipe.read(16) - radio.pipe.write("A") + radio.pipe.write(b"A") r = radio.pipe.read(1) - if r != "A": + if r != b"A": raise errors.RadioError("Ack failed") return ident @@ -693,18 +692,18 @@ def _identify(radio): def _download(radio, memsize=0x10000, blocksize=0x80): """Download from TYT TH-9800""" data = _identify(radio) - LOG.info("ident:", util.hexprint(data)) + LOG.info("ident:\n%s", util.hexprint(data)) offset = 0x100 for addr in range(offset, memsize, blocksize): - msg = struct.pack(">cHB", "R", addr, blocksize) + msg = struct.pack(">cHB", b"R", addr, blocksize) radio.pipe.write(msg) block = radio.pipe.read(blocksize + 4) if len(block) != (blocksize + 4): LOG.debug(util.hexprint(block)) raise errors.RadioError("Radio sent a short block") - radio.pipe.write("A") + radio.pipe.write(b"A") ack = radio.pipe.read(1) - if ack != "A": + if ack != b"A": LOG.debug(util.hexprint(ack)) raise errors.RadioError("Radio NAKed block") data += block[4:] @@ -716,9 +715,9 @@ def _download(radio, memsize=0x10000, blocksize=0x80): status.msg = "Cloning from radio" radio.status_fn(status) - radio.pipe.write("ENDR") + radio.pipe.write(b"ENDR") - return memmap.MemoryMap(data) + return memmap.MemoryMapBytes(data) def _upload(radio, memsize=0xF400, blocksize=0x80): @@ -727,7 +726,7 @@ def _upload(radio, memsize=0xF400, blocksize=0x80): radio.pipe.timeout = 1 - if data != radio._mmap[:radio._mmap_offset]: + if data != radio._mmap[0:radio._mmap_offset]: raise errors.RadioError( "Model mismatch: \n%s\n%s" % (util.hexprint(data), @@ -760,12 +759,12 @@ def _upload(radio, memsize=0xF400, blocksize=0x80): for addr in range(offset, memsize, blocksize): mapaddr = addr + radio._mmap_offset - offset LOG.debug("addr: 0x%04X, mmapaddr: 0x%04X" % (addr, mapaddr)) - msg = struct.pack(">cHB", "W", addr, blocksize) + msg = struct.pack(">cHB", b"W", addr, blocksize) msg += radio._mmap[mapaddr:(mapaddr + blocksize)] LOG.debug(util.hexprint(msg)) radio.pipe.write(msg) ack = radio.pipe.read(1) - if ack != "A": + if ack != b"A": LOG.debug(util.hexprint(ack)) raise errors.RadioError("Radio did not ack block 0x%04X" % addr) @@ -777,11 +776,11 @@ def _upload(radio, memsize=0xF400, blocksize=0x80): radio.status_fn(status) # End of clone - radio.pipe.write("ENDW") + radio.pipe.write(b"ENDW") # Checksum? final_data = radio.pipe.read(3) - LOG.debug("final:", util.hexprint(final_data)) + LOG.debug("final:\n%s" % util.hexprint(final_data)) @directory.register diff --git a/chirp/drivers/th_uv3r.py b/chirp/drivers/th_uv3r.py index 8e40f3a..0544644 100644 --- a/chirp/drivers/th_uv3r.py +++ b/chirp/drivers/th_uv3r.py @@ -15,7 +15,6 @@ """TYT uv3r radio management module""" -import os import logging from chirp import chirp_common, bitwise, errors, directory from chirp.drivers.wouxun import do_download, do_upload @@ -25,9 +24,9 @@ LOG = logging.getLogger(__name__) def tyt_uv3r_prep(radio): try: - radio.pipe.write("PROGRAMa") + radio.pipe.write(b"PROGRAMa") ack = radio.pipe.read(1) - if ack != "\x06": + if ack != b"\x06": raise errors.RadioError("Radio did not ACK first command") except: raise errors.RadioError("Unable to communicate with the radio") @@ -42,6 +41,7 @@ def tyt_uv3r_upload(radio): tyt_uv3r_prep(radio) return do_upload(radio, 0x0000, 0x0910, 0x0010) + mem_format = """ struct memory { ul24 duplex:2, @@ -78,6 +78,7 @@ class TYTUV3RRadio(chirp_common.CloneModeRadio): MODEL = "TH-UV3R" BAUD_RATE = 2400 _memsize = 2320 + NEEDS_COMPAT_SERIAL = False def get_features(self): rf = chirp_common.RadioFeatures() @@ -229,7 +230,7 @@ class TYTUV3RRadio(chirp_common.CloneModeRadio): def set_memory(self, mem): _mem = self._memobj.memory[mem.number - 1] bit = 1 << ((mem.number - 1) % 8) - byte = (mem.number - 1) / 8 + byte = (mem.number - 1) // 8 if mem.empty: self._memobj.emptyflags[byte] |= bit diff --git a/chirp/drivers/th_uv3r25.py b/chirp/drivers/th_uv3r25.py index ece7959..e03b50b 100644 --- a/chirp/drivers/th_uv3r25.py +++ b/chirp/drivers/th_uv3r25.py @@ -13,16 +13,15 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -"""TYT uv3r (2.5kHz) radio management module""" +"""TYT uv3r (2.5 kHz) radio management module""" from chirp import chirp_common, bitwise, directory from chirp.drivers.wouxun import do_download, do_upload from chirp.settings import RadioSetting, RadioSettingGroup, \ - RadioSettingValueInteger, RadioSettingValueList, \ - RadioSettingValueBoolean, RadioSettingValueString + RadioSettingValueList, RadioSettingValueBoolean -from th_uv3r import TYTUV3RRadio, tyt_uv3r_prep, THUV3R_CHARSET +from chirp.drivers.th_uv3r import TYTUV3RRadio, tyt_uv3r_prep, THUV3R_CHARSET def tyt_uv3r_download(radio): @@ -34,6 +33,7 @@ def tyt_uv3r_upload(radio): tyt_uv3r_prep(radio) return do_upload(radio, 0x0000, 0x0B30, 0x0010) + mem_format = """ // 20 bytes per memory struct memory { @@ -69,6 +69,7 @@ VOICE_MODE_LIST = ["Compander", "Scrambler", "None"] class TYTUV3R25Radio(TYTUV3RRadio): MODEL = "TH-UV3R-25" _memsize = 2864 + NEEDS_COMPAT_SERIAL = False POWER_LEVELS = [chirp_common.PowerLevel("High", watts=2.00), chirp_common.PowerLevel("Low", watts=0.80)] @@ -155,7 +156,7 @@ class TYTUV3R25Radio(TYTUV3RRadio): def set_memory(self, mem): _mem = self._memobj.memory[mem.number - 1] bit = 1 << ((mem.number - 1) % 8) - byte = (mem.number - 1) / 8 + byte = (mem.number - 1) // 8 if mem.empty: self._memobj.emptyflags[byte] |= bit diff --git a/chirp/drivers/th_uv8000.py b/chirp/drivers/th_uv8000.py index 2e496ca..220e06e 100644 --- a/chirp/drivers/th_uv8000.py +++ b/chirp/drivers/th_uv8000.py @@ -18,18 +18,15 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import time import struct import logging -import re import math from chirp import chirp_common, directory, memmap from chirp import bitwise, errors, util from chirp.settings import RadioSettingGroup, RadioSetting, \ RadioSettingValueBoolean, RadioSettingValueList, \ RadioSettingValueString, RadioSettingValueInteger, \ - RadioSettingValueFloat, RadioSettings, InvalidValueError -from textwrap import dedent + RadioSettingValueFloat, RadioSettings LOG = logging.getLogger(__name__) @@ -252,20 +249,12 @@ for x in chirp_common.DTCS_CODES: for x in chirp_common.DTCS_CODES: LIST_CTCSS.append("D{:03d}R".format(x)) LIST_BW = ["Narrow", "Wide"] -LIST_SHIFT = ["off", "+", "-"] +LIST_SHIFT = ["off", "+", "-", ""] STEPS = [0.5, 2.5, 5.0, 6.25, 10.0, 12.5, 25.0, 37.5, 50.0, 100.0] LIST_STEPS = [str(x) for x in STEPS] LIST_VOXDLY = ["0.5", "1.0", "2.0", "3.0"] # LISTS must be strings LIST_PTT = ["Both", "EoT", "BoT", "Off"] -SETTING_LISTS = {"tot": LIST_TIMEOUT, "wtled": LIST_COLOR, - "rxled": LIST_COLOR, "txled": LIST_COLOR, - "ledsw": LIST_LEDSW, "frq_chn_mode": LIST_VFOMODE, - "rx_tone": LIST_CTCSS, "tx_tone": LIST_CTCSS, - "rx_mode": LIST_RECVMODE, "fm_bw": LIST_BW, - "shift": LIST_SHIFT, "step": LIST_STEPS, - "vox_dly": LIST_VOXDLY, "ptt": LIST_PTT} - def _clean_buffer(radio): radio.pipe.timeout = 0.005 @@ -302,7 +291,7 @@ def _rawsend(radio, data): def _make_frame(cmd, addr, length, data=""): - """Pack the info in the headder format""" + """Pack the info in the header format""" frame = struct.pack(">shB", cmd, addr, length) # Add the data if set if len(data) != 0: @@ -332,31 +321,31 @@ def _do_ident(radio): # Flush input buffer _clean_buffer(radio) - magic = "PROGRAMa" + magic = b"PROGRAMa" _rawsend(radio, magic) ack = _rawrecv(radio, 1) # LOG.warning("PROGa Ack:" + util.hexprint(ack)) - if ack != "\x06": + if ack != b"\x06": _exit_program_mode(radio) if ack: LOG.debug(repr(ack)) raise errors.RadioError("Radio did not respond") - magic = "PROGRAMb" + magic = b"PROGRAMb" _rawsend(radio, magic) ack = _rawrecv(radio, 1) - if ack != "\x06": + if ack != b"\x06": _exit_program_mode(radio) if ack: LOG.debug(repr(ack)) raise errors.RadioError("Radio did not respond to B") - magic = chr(0x02) + magic = b"\x02" _rawsend(radio, magic) ack = _rawrecv(radio, 1) # s/b: 0x50 magic = _rawrecv(radio, 7) # s/b TC88... - magic = "MTC88CUMHS3E7BN-" + magic = b"MTC88CUMHS3E7BN-" _rawsend(radio, magic) ack = _rawrecv(radio, 1) # s/b 0x80 - magic = chr(0x06) + magic = b"\x06" _rawsend(radio, magic) ack = _rawrecv(radio, 1) @@ -364,7 +353,7 @@ def _do_ident(radio): def _exit_program_mode(radio): - endframe = "E" + endframe = b"E" _rawsend(radio, endframe) @@ -377,13 +366,13 @@ def _download(radio): # UI progress status = chirp_common.Status() status.cur = 0 - status.max = MEM_SIZE / BLOCK_SIZE + status.max = MEM_SIZE // BLOCK_SIZE status.msg = "Cloning from radio..." radio.status_fn(status) - data = "" + data = b"" for addr in range(0, MEM_SIZE, BLOCK_SIZE): - frame = _make_frame("R", addr, BLOCK_SIZE) + frame = _make_frame(b"R", addr, BLOCK_SIZE) # DEBUG LOG.info("Request sent:") LOG.debug("Frame=" + util.hexprint(frame)) @@ -400,7 +389,7 @@ def _download(radio): data += d # UI Update - status.cur = addr / BLOCK_SIZE + status.cur = addr // BLOCK_SIZE status.msg = "Cloning from radio..." radio.status_fn(status) @@ -417,7 +406,7 @@ def _upload(radio): # UI progress status = chirp_common.Status() status.cur = 0 - status.max = MEM_SIZE / BLOCK_SIZE + status.max = MEM_SIZE // BLOCK_SIZE status.msg = "Cloning to radio..." radio.status_fn(status) @@ -426,19 +415,19 @@ def _upload(radio): # Sending the data data = radio.get_mmap()[addr:addr + BLOCK_SIZE] - frame = _make_frame("W", addr, BLOCK_SIZE, data) + frame = _make_frame(b"W", addr, BLOCK_SIZE, data) # LOG.warning("Frame:%s:" % util.hexprint(frame)) _rawsend(radio, frame) # Receiving the response ack = _rawrecv(radio, 1) - if ack != "\x06": + if ack != b"\x06": _exit_program_mode(radio) msg = "Bad ack writing block 0x%04x" % addr raise errors.RadioError(msg) # UI Update - status.cur = addr / BLOCK_SIZE + status.cur = addr // BLOCK_SIZE status.msg = "Cloning to radio..." radio.status_fn(status) @@ -496,9 +485,10 @@ class THUV8000Radio(chirp_common.CloneModeRadio): """TYT UV8000D Radio""" VENDOR = "TYT" MODEL = "TH-UV8000" + NEEDS_COMPAT_SERIAL = False MODES = ["NFM", "FM"] TONES = chirp_common.TONES - DTCS_CODES = sorted(chirp_common.DTCS_CODES + [645]) + DTCS_CODES = tuple(sorted(chirp_common.DTCS_CODES + (645,))) NAME_LENGTH = 7 DTMF_CHARS = list("0123456789ABCD*#") # NOTE: SE Model supports 220-260 MHz @@ -531,22 +521,18 @@ class THUV8000Radio(chirp_common.CloneModeRadio): ('Click on the "Special Channels" toggle-button of the memory ' 'editor to see/set the upper and lower frequency-mode values.\n') - rp.pre_download = _(dedent("""\ - Follow these instructions to download the radio memory: - - 1 - Turn off your radio - 2 - Connect your interface cable - 3 - Turn on your radio, volume @ 50% - 4 - Radio > Download from radio - """)) - rp.pre_upload = _(dedent("""\ - Follow these instructions to upload the radio memory: - - 1 - Turn off your radio - 2 - Connect your interface cable - 3 - Turn on your radio, volume @ 50% - 4 - Radio > Upload to radio - """)) + rp.pre_download = _( + "Follow these instructions to download the radio memory:\n" + "1 - Turn off your radio\n" + "2 - Connect your interface cable\n" + "3 - Turn on your radio, volume @ 50%\n" + "4 - Radio > Download from radio\n") + rp.pre_upload = _( + "Follow these instructions to upload the radio memory:\n" + "1 - Turn off your radio\n" + "2 - Connect your interface cable\n" + "3 - Turn on your radio, volume @ 50%\n" + "4 - Radio > Upload to radio\n") return rp def get_features(self): @@ -597,7 +583,7 @@ class THUV8000Radio(chirp_common.CloneModeRadio): LOG.exception('Unexpected error during download') raise errors.RadioError('Unexpected error communicating ' 'with the radio') - self._mmap = memmap.MemoryMap(data) + self._mmap = memmap.MemoryMapBytes(data) self.process_mmap() def sync_out(self): @@ -1087,7 +1073,7 @@ class THUV8000Radio(chirp_common.CloneModeRadio): def myset_fmfrq(setting, obj, atrb, nx): """ Callback to set xx.x FM freq in memory as xx.x * 40""" - # in-valid even KHz freqs are allowed; to satisfy run_tests + # in-valid even kHz freqs are allowed; to satisfy run_tests vx = float(str(setting.value)) vx = int(vx * 40) setattr(obj[nx], atrb, vx) @@ -1107,7 +1093,7 @@ class THUV8000Radio(chirp_common.CloneModeRadio): basic.append(rset) rx = RadioSettingValueList(LIST_STEPS, LIST_STEPS[_sets.freqstep]) - rset = RadioSetting("setstuf.freqstep", "VFO Tune Step (KHz))", rx) + rset = RadioSetting("setstuf.freqstep", "VFO Tune Step (kHz)", rx) basic.append(rset) rx = RadioSettingValueBoolean(bool(_sets.dbw)) # true logic @@ -1267,7 +1253,7 @@ class THUV8000Radio(chirp_common.CloneModeRadio): options = ["5", "50", "100", "200(USA)"] # 5 is not used rx = RadioSettingValueList(options, options[_sets.fmstep]) - rset = RadioSetting("setstuf.fmstep", "FM Freq Step (KHz)", rx) + rset = RadioSetting("setstuf.fmstep", "FM Freq Step (kHz)", rx) fmb.append(rset) # FM Scan Range fmsclo and fmschi are unknown memory locations, @@ -1396,8 +1382,8 @@ class THUV8000Radio(chirp_common.CloneModeRadio): mod_se = True # UV8000SE has 3rd freq bank if mod_se: rx = RadioSettingValueBoolean(bool(_sets.frqr3)) - rset = RadioSetting("setstuf.frqr3", "Freq Range 3 (220Mhz)", rx) - rset.set_doc("Enable the 220MHz frequency bank.") + rset = RadioSetting("setstuf.frqr3", "Freq Range 3 (220 MHz)", rx) + rset.set_doc("Enable the 220 MHz frequency bank.") frng.append(rset) frqm = 100000 @@ -1485,6 +1471,6 @@ class THUV8000Radio(chirp_common.CloneModeRadio): elif element.value.get_mutable(): LOG.debug("Setting %s = %s" % (setting, element.value)) setattr(obj, setting, element.value) - except Exception as e: + except Exception: LOG.debug(element.get_name()) raise diff --git a/chirp/drivers/th_uv88.py b/chirp/drivers/th_uv88.py index e941a45..3f83f2d 100644 --- a/chirp/drivers/th_uv88.py +++ b/chirp/drivers/th_uv88.py @@ -16,18 +16,15 @@ # You should have received a copy of the GNU General Public License # along with this program. -import time import struct import logging -import re import math from chirp import chirp_common, directory, memmap from chirp import bitwise, errors, util from chirp.settings import RadioSettingGroup, RadioSetting, \ RadioSettingValueBoolean, RadioSettingValueList, \ RadioSettingValueString, RadioSettingValueInteger, \ - RadioSettingValueFloat, RadioSettings, InvalidValueError -from textwrap import dedent + RadioSettingValueFloat, RadioSettings LOG = logging.getLogger(__name__) @@ -52,7 +49,8 @@ struct chns { unk5:2; u8 unk6:2 pttid:2 - step:4; // not required + unk7:1 + step:3; // not required u8 name[6]; }; @@ -258,17 +256,17 @@ def _rawsend(radio, data): def _make_read_frame(addr, length): - frame = "\xFE\xFE\xEE\xEF\xEB" + frame = b"\xFE\xFE\xEE\xEF\xEB" """Pack the info in the header format""" frame += struct.pack(">ih", addr, length) - frame += "\xFD" + frame += b"\xFD" # Return the data return frame def _make_write_frame(addr, length, data=""): - frame = "\xFE\xFE\xEE\xEF\xE4" + frame = b"\xFE\xFE\xEE\xEF\xE4" """Pack the info in the header format""" output = struct.pack(">ih", addr, length) @@ -279,7 +277,7 @@ def _make_write_frame(addr, length, data=""): frame += output frame += _calculate_checksum(output) - frame += "\xFD" + frame += b"\xFD" # Return the data return frame @@ -287,12 +285,12 @@ def _make_write_frame(addr, length, data=""): def _calculate_checksum(data): num = 0 for x in range(0, len(data)): - num = (num + ord(data[x])) % 256 + num = (num + data[x]) % 256 if num == 0: - return chr(0) + return bytes([0]) - return chr(256 - num) + return bytes([256 - num]) def _recv(radio, addr, length): @@ -321,7 +319,7 @@ def _do_ident(radio): _rawsend(radio, magic) ack = _rawrecv(radio, 36) - if not ack.startswith(radio._fingerprint) or not ack.endswith("\xFD"): + if not ack.startswith(radio._fingerprint) or not ack.endswith(b"\xFD"): _exit_program_mode(radio) if ack: LOG.debug(repr(ack)) @@ -347,7 +345,7 @@ def _download(radio): magic = radio._magic2 _rawsend(radio, magic) ack = _rawrecv(radio, 7) - if ack != "\xFE\xFE\xEF\xEE\xE6\x00\xFD": + if ack != b"\xFE\xFE\xEF\xEE\xE6\x00\xFD": _exit_program_mode(radio) if ack: LOG.debug(repr(ack)) @@ -356,11 +354,11 @@ def _download(radio): # UI progress status = chirp_common.Status() status.cur = 0 - status.max = MEM_SIZE / BLOCK_SIZE + status.max = MEM_SIZE // BLOCK_SIZE status.msg = "Cloning from radio..." radio.status_fn(status) - data = "" + data = b"" for addr in range(0, MEM_SIZE, BLOCK_SIZE): frame = _make_read_frame(addr, BLOCK_SIZE) # DEBUG @@ -374,9 +372,9 @@ def _download(radio): LOG.debug("Response Data= " + util.hexprint(d)) - if not d.startswith("\xFE\xFE\xEF\xEE\xE4"): + if not d.startswith(b"\xFE\xFE\xEF\xEE\xE4"): LOG.warning("Incorrect start") - if not d.endswith("\xFD"): + if not d.endswith(b"\xFD"): LOG.warning("Incorrect end") # could validate the block data @@ -384,7 +382,7 @@ def _download(radio): data += d[11:-2] # UI Update - status.cur = addr / BLOCK_SIZE + status.cur = addr // BLOCK_SIZE status.msg = "Cloning from radio..." radio.status_fn(status) @@ -401,7 +399,7 @@ def _upload(radio): magic = radio._magic3 _rawsend(radio, magic) ack = _rawrecv(radio, 7) - if ack != "\xFE\xFE\xEF\xEE\xE6\x00\xFD": + if ack != b"\xFE\xFE\xEF\xEE\xE6\x00\xFD": _exit_program_mode(radio) if ack: LOG.debug(repr(ack)) @@ -410,7 +408,7 @@ def _upload(radio): # UI progress status = chirp_common.Status() status.cur = 0 - status.max = MEM_SIZE / BLOCK_SIZE + status.max = MEM_SIZE // BLOCK_SIZE status.msg = "Cloning to radio..." radio.status_fn(status) @@ -430,14 +428,14 @@ def _upload(radio): ack = _rawrecv(radio, 7) LOG.debug("Response Data= " + util.hexprint(ack)) - if not ack.startswith("\xFE\xFE\xEF\xEE\xE6\x00\xFD"): + if not ack.startswith(b"\xFE\xFE\xEF\xEE\xE6\x00\xFD"): LOG.warning("Unexpected response") _exit_program_mode(radio) msg = "Bad ack writing block 0x%04x" % addr raise errors.RadioError(msg) # UI Update - status.cur = addr / BLOCK_SIZE + status.cur = addr // BLOCK_SIZE status.msg = "Cloning to radio..." radio.status_fn(status) @@ -468,6 +466,7 @@ class THUV88Radio(chirp_common.CloneModeRadio): """TYT UV88 Radio""" VENDOR = "TYT" MODEL = "TH-UV88" + NEEDS_COMPAT_SERIAL = False MODES = ['WFM', 'FM', 'NFM'] TONES = chirp_common.TONES DTCS_CODES = chirp_common.DTCS_CODES @@ -480,11 +479,11 @@ class THUV88Radio(chirp_common.CloneModeRadio): VALID_CHARS = chirp_common.CHARSET_ALPHANUMERIC + \ "`!\"#$%&'()*+,-./:;<=>?@[]^_" - _magic0 = "\xFE\xFE\xEE\xEF\xE0" + "UV88" + "\xFD" - _magic2 = "\xFE\xFE\xEE\xEF\xE2" + "UV88" + "\xFD" - _magic3 = "\xFE\xFE\xEE\xEF\xE3" + "UV88" + "\xFD" - _magic5 = "\xFE\xFE\xEE\xEF\xE5" + "UV88" + "\xFD" - _fingerprint = "\xFE\xFE\xEF\xEE\xE1" + "UV88" + _magic0 = b"\xFE\xFE\xEE\xEF\xE0" + b"UV88" + b"\xFD" + _magic2 = b"\xFE\xFE\xEE\xEF\xE2" + b"UV88" + b"\xFD" + _magic3 = b"\xFE\xFE\xEE\xEF\xE3" + b"UV88" + b"\xFD" + _magic5 = b"\xFE\xFE\xEE\xEF\xE5" + b"UV88" + b"\xFD" + _fingerprint = b"\xFE\xFE\xEF\xEE\xE1" + b"UV88" @classmethod def get_prompts(cls): @@ -492,12 +491,10 @@ class THUV88Radio(chirp_common.CloneModeRadio): rp.info = \ (cls.VENDOR + ' ' + cls.MODEL + '\n') - rp.pre_download = _(dedent("""\ - This is an early stage beta driver - """)) - rp.pre_upload = _(dedent("""\ - This is an early stage beta driver - upload at your own risk - """)) + rp.pre_download = _( + "This is an early stage beta driver\n") + rp.pre_upload = _( + "This is an early stage beta driver - upload at your own risk\n") return rp def get_features(self): @@ -547,7 +544,7 @@ class THUV88Radio(chirp_common.CloneModeRadio): LOG.exception('Unexpected error during download') raise errors.RadioError('Unexpected error communicating ' 'with the radio') - self._mmap = memmap.MemoryMap(data) + self._mmap = memmap.MemoryMapBytes(data) self.process_mmap() def sync_out(self): @@ -680,15 +677,15 @@ class THUV88Radio(chirp_common.CloneModeRadio): mem.mode = self.MODES[_mem.wide] mem.power = POWER_LEVELS[int(_mem.power)] - b_lock = RadioSetting("b_lock", "B_Lock", - RadioSettingValueList(B_LOCK_LIST, - B_LOCK_LIST[_mem.b_lock])) + rs = RadioSettingValueList(B_LOCK_LIST, + B_LOCK_LIST[min(_mem.b_lock, 0x02)]) + b_lock = RadioSetting("b_lock", "B_Lock", rs) mem.extra.append(b_lock) - b_lock = RadioSetting("step", "Step", - RadioSettingValueList(LIST_STEPS, - LIST_STEPS[_mem.step])) - mem.extra.append(b_lock) + step = RadioSetting("step", "Step", + RadioSettingValueList(LIST_STEPS, + LIST_STEPS[_mem.step])) + mem.extra.append(step) scramble_value = _mem.scramble if scramble_value >= 8: # Looks like OFF is 0x0f ** CONFIRM @@ -866,7 +863,7 @@ class THUV88Radio(chirp_common.CloneModeRadio): if self.MODEL == "QRZ-1": options = ["Time", "Carrier", "Stop"] else: - options = ["CO", "TO", "SE"] + options = ["TO", "CO", "SE"] rx = RadioSettingValueList(options, options[_settings.scanType]) rset = RadioSetting("basicsettings.scanType", "Scan Type", rx) basic.append(rset) @@ -917,7 +914,10 @@ class THUV88Radio(chirp_common.CloneModeRadio): # software only name = "" for i in range(15): # 0 - 15 - name += chr(int(self._memobj.openradioname.name1[i])) + char = chr(int(self._memobj.openradioname.name1[i])) + if char == "\x00": + char = " " # Other software may have 0x00 mid-name + name += char name = name.rstrip() # remove trailing spaces rx = RadioSettingValueString(0, 15, name) @@ -927,7 +927,10 @@ class THUV88Radio(chirp_common.CloneModeRadio): # software only name = "" for i in range(15): # 0 - 15 - name += chr(int(self._memobj.openradioname.name2[i])) + char = chr(int(self._memobj.openradioname.name2[i])) + if char == "\x00": + char = " " # Other software may have 0x00 mid-name + name += char name = name.rstrip() # remove trailing spaces rx = RadioSettingValueString(0, 15, name) @@ -998,7 +1001,7 @@ class THUV88Radio(chirp_common.CloneModeRadio): def myset_fmfrq(setting, obj, atrb, nx): """ Callback to set xx.x FM freq in memory as xx.x * 100000""" - # in-valid even KHz freqs are allowed; to satisfy run_tests + # in-valid even kHz freqs are allowed; to satisfy run_tests vx = float(str(setting.value)) vx = int(vx * 100000) setattr(obj[nx], atrb, vx) @@ -1089,7 +1092,7 @@ class THUV88Radio(chirp_common.CloneModeRadio): elif element.value.get_mutable(): LOG.debug("Setting %s = %s" % (setting, element.value)) setattr(obj, setting, element.value) - except Exception as e: + except Exception: LOG.debug(element.get_name()) raise @@ -1105,8 +1108,8 @@ class QRZ1(THUV88Radio): VENDOR = "Explorer" MODEL = "QRZ-1" - _magic0 = "\xFE\xFE\xEE\xEF\xE0" + "UV78" + "\xFD" - _magic2 = "\xFE\xFE\xEE\xEF\xE2" + "UV78" + "\xFD" - _magic3 = "\xFE\xFE\xEE\xEF\xE3" + "UV78" + "\xFD" - _magic5 = "\xFE\xFE\xEE\xEF\xE5" + "UV78" + "\xFD" - _fingerprint = "\xFE\xFE\xEF\xEE\xE1" + "UV78" + _magic0 = b"\xFE\xFE\xEE\xEF\xE0" + b"UV78" + b"\xFD" + _magic2 = b"\xFE\xFE\xEE\xEF\xE2" + b"UV78" + b"\xFD" + _magic3 = b"\xFE\xFE\xEE\xEF\xE3" + b"UV78" + b"\xFD" + _magic5 = b"\xFE\xFE\xEE\xEF\xE5" + b"UV78" + b"\xFD" + _fingerprint = b"\xFE\xFE\xEF\xEE\xE1" + b"UV78" diff --git a/chirp/drivers/th_uvf8d.py b/chirp/drivers/th_uvf8d.py index 3b93232..32bae59 100644 --- a/chirp/drivers/th_uvf8d.py +++ b/chirp/drivers/th_uvf8d.py @@ -37,19 +37,19 @@ LOG = logging.getLogger(__name__) def uvf8d_identify(radio): """Do identify handshake with TYT TH-UVF8D""" try: - radio.pipe.write("\x02PROGRAM") + radio.pipe.write(b"\x02PROGRAM") ack = radio.pipe.read(2) - if ack != "PG": + if ack != b"PG": raise errors.RadioError("Radio did not ACK first command: %x" % ord(ack)) - except: + except Exception: raise errors.RadioError("Unable to communicate with the radio") - radio.pipe.write("\x02") + radio.pipe.write(b"\x02") ident = radio.pipe.read(32) - radio.pipe.write("A") + radio.pipe.write(b"A") r = radio.pipe.read(1) - if r != "A": + if r != b"A": raise errors.RadioError("Ack failed") return ident @@ -57,14 +57,14 @@ def uvf8d_identify(radio): def tyt_uvf8d_download(radio): data = uvf8d_identify(radio) for i in range(0, 0x4000, 0x20): - msg = struct.pack(">cHb", "R", i, 0x20) + msg = struct.pack(">cHb", b"R", i, 0x20) radio.pipe.write(msg) block = radio.pipe.read(0x20 + 4) if len(block) != (0x20 + 4): raise errors.RadioError("Radio sent a short block") - radio.pipe.write("A") + radio.pipe.write(b"A") ack = radio.pipe.read(1) - if ack != "A": + if ack != b"A": raise errors.RadioError("Radio NAKed block") data += block[4:] @@ -75,9 +75,9 @@ def tyt_uvf8d_download(radio): status.msg = "Cloning from radio" radio.status_fn(status) - radio.pipe.write("ENDR") + radio.pipe.write(b"ENDR") - return memmap.MemoryMap(data) + return memmap.MemoryMapBytes(data) def tyt_uvf8d_upload(radio): @@ -86,19 +86,19 @@ def tyt_uvf8d_upload(radio): radio.pipe.timeout = 1 - if data != radio._mmap[:32]: + if data != radio._mmap[0:32]: raise errors.RadioError("Model mismatch: \n%s\n%s" % (util.hexprint(data), - util.hexprint(radio._mmap[:32]))) + util.hexprint(radio._mmap[0:32]))) for i in range(0, 0x4000, 0x20): addr = i + 0x20 - msg = struct.pack(">cHb", "W", i, 0x20) + msg = struct.pack(">cHb", b"W", i, 0x20) msg += radio._mmap[addr:(addr + 0x20)] radio.pipe.write(msg) ack = radio.pipe.read(1) - if ack != "A": + if ack != b"A": raise errors.RadioError("Radio did not ack block %i" % i) if radio.status_fn: @@ -109,10 +109,10 @@ def tyt_uvf8d_upload(radio): radio.status_fn(status) # End of clone? - radio.pipe.write("ENDW") + radio.pipe.write(b"ENDW") # Checksum? - final_data = radio.pipe.read(3) + radio.pipe.read(3) # these require working desktop software # TODO: DTMF features (ID, delay, speed, kill, etc.) @@ -133,7 +133,7 @@ struct memory { u8 bclo:2, wideband:1, ishighpower:1, - unknown21:1, + scanadd:1, vox:1, pttid:2; u8 unknown3:8; @@ -187,7 +187,7 @@ struct { roger:1; u8 light:2, led:2, - unknown206a:1, + taileliminate:1, autolk:1, unknown206ax:2; u8 unknown206b:1, @@ -268,6 +268,7 @@ class TYTUVF8DRadio(chirp_common.CloneModeRadio): VENDOR = "TYT" MODEL = "TH-UVF8D" BAUD_RATE = 9600 + NEEDS_COMPAT_SERIAL = False def get_features(self): rf = chirp_common.RadioFeatures() @@ -471,6 +472,7 @@ class TYTUVF8DRadio(chirp_common.CloneModeRadio): flag_index = 7 - ((mem.number - 1) % 8) s.flags[flag_index] = (mem.skip == "") + _mem.scanadd = (mem.skip == "") _mem.wideband = mem.mode == "FM" _mem.ishighpower = mem.power == POWER_LEVELS[0] @@ -495,11 +497,13 @@ class TYTUVF8DRadio(chirp_common.CloneModeRadio): group.append(RadioSetting( "a_channel", "A Selected Memory", - RadioSettingValueInteger(1, 128, _settings.a_channel + 1))) + RadioSettingValueInteger(1, 128, + min(_settings.a_channel + 1, 128)))) group.append(RadioSetting( "b_channel", "B Selected Memory", - RadioSettingValueInteger(1, 128, _settings.b_channel + 1))) + RadioSettingValueInteger(1, 128, + min(_settings.b_channel + 1, 128)))) group.append(RadioSetting( "a_display", "A Channel Display", @@ -571,6 +575,10 @@ class TYTUVF8DRadio(chirp_common.CloneModeRadio): RadioSettingValueList( SCAN_MODE_LIST, SCAN_MODE_LIST[_settings.scan_mode]))) + group.append(RadioSetting( + 'taileliminate', 'Tail Eliminate', + RadioSettingValueBoolean(_settings.taileliminate))) + group.append(RadioSetting( "autolk", "Auto Lock", RadioSettingValueBoolean(_settings.autolk))) diff --git a/chirp/drivers/thd72.py b/chirp/drivers/thd72.py index 2920873..ef39ec4 100644 --- a/chirp/drivers/thd72.py +++ b/chirp/drivers/thd72.py @@ -14,11 +14,12 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -from chirp import chirp_common, errors, util, directory +from chirp import chirp_common, errors, directory from chirp import bitwise, memmap +from chirp.drivers import kenwood_live from chirp.settings import RadioSettingGroup, RadioSetting, RadioSettings -from chirp.settings import RadioSettingValueInteger, RadioSettingValueString -from chirp.settings import RadioSettingValueList, RadioSettingValueBoolean +from chirp.settings import RadioSettingValueString +from chirp.settings import RadioSettingValueList import time import struct import sys @@ -103,7 +104,8 @@ struct { #seekto 0x1500; struct { ul32 freq; - u8 unknown1; + u8 unknown1:4, + tune_step:4; u8 mode; u8 tone_mode:4, duplex:4; @@ -112,7 +114,8 @@ struct { u8 dtcs; u8 cross_mode; ul32 offset; - u8 unknown2; + u8 unknown2:4, + split_tune_step:4; } memory[1032]; #seekto 0x5e00; @@ -185,6 +188,7 @@ DUPLEX_REV = { "split": 0x04, } +TUNE_STEPS = [5.0, 6.25, 8.33, 10.0, 12.5, 15.0, 20.0, 25.0, 30.0, 50.0, 100.0] EXCH_R = "R\x00\x00\x00\x00" EXCH_W = "W\x00\x00\x00\x00" @@ -197,9 +201,14 @@ DEFAULT_PROG_VFO = ( (320000000, 400000000), (400000000, 524000000), ) -# index of PROG_VFO used for setting memory.unknown1 and memory.unknown2 -# see http://chirp.danplanet.com/issues/1611#note-9 -UNKNOWN_LOOKUP = (0, 7, 4, 0, 4, 7) + +D72_FILE_HEADER = ( + b'MCP-4A\xFF\xFFV1.04\xFF\xFF\xFF' + + b'TH-D72' + (b'\xFF' * 10) + + b'\x31' + (b'\xFF' * 15) + + b'\xFF' * (5 * 16) + + b'AMB0' + (b'\xFF' * 12) + + b'\xFF' * (7 * 16)) def get_prog_vfo(frequency): @@ -216,6 +225,8 @@ class THD72Radio(chirp_common.CloneModeRadio): VENDOR = "Kenwood" MODEL = "TH-D72 (clone mode)" HARDWARE_FLOW = sys.platform == "darwin" # only OS X driver needs hw flow + NEEDS_COMPAT_SERIAL = False + FORMATS = [directory.register_format('Kenwood MCP4A', '*.mc4')] mem_upper_limit = 1022 _memsize = 65536 @@ -234,19 +245,21 @@ class THD72Radio(chirp_common.CloneModeRadio): def get_features(self): rf = chirp_common.RadioFeatures() - rf.memory_bounds = (0, 1031) + rf.memory_bounds = (0, 999) rf.valid_bands = [(118000000, 174000000), (320000000, 524000000)] rf.has_cross = True rf.can_odd_split = True rf.has_dtcs_polarity = False - rf.has_tuning_step = False + rf.has_tuning_step = True rf.has_bank = False rf.has_settings = True rf.valid_tuning_steps = [] rf.valid_modes = list(MODES_REV.keys()) rf.valid_tmodes = list(TMODES_REV.keys()) rf.valid_duplexes = list(DUPLEX_REV.keys()) + rf.valid_tuning_steps = list(TUNE_STEPS) + rf.valid_tones = list(kenwood_live.KENWOOD_TONES) rf.valid_skips = ["", "S"] rf.valid_characters = chirp_common.CHARSET_ALPHANUMERIC rf.valid_name_length = 8 @@ -260,7 +273,7 @@ class THD72Radio(chirp_common.CloneModeRadio): for baud in [9600, 19200, 38400, 57600]: self.pipe.baudrate = baud try: - self.pipe.write("\r\r") + self.pipe.write(b"\r\r") except: break self.pipe.read(32) @@ -277,7 +290,7 @@ class THD72Radio(chirp_common.CloneModeRadio): return sorted(THD72_SPECIAL.keys()) def add_dirty_block(self, memobj): - block = memobj._offset / 256 + block = memobj._offset // 256 if block not in self._dirty_blocks: self._dirty_blocks.append(block) self._dirty_blocks.sort() @@ -334,12 +347,13 @@ class THD72Radio(chirp_common.CloneModeRadio): mem.name = self.get_channel_name(number) mem.freq = int(_mem.freq) mem.tmode = TMODES[int(_mem.tone_mode)] - mem.rtone = chirp_common.TONES[_mem.rtone] - mem.ctone = chirp_common.TONES[_mem.ctone] + mem.rtone = kenwood_live.KENWOOD_TONES[_mem.rtone] + mem.ctone = kenwood_live.KENWOOD_TONES[_mem.ctone] mem.dtcs = chirp_common.DTCS_CODES[_mem.dtcs] mem.duplex = DUPLEX[int(_mem.duplex)] mem.offset = int(_mem.offset) mem.mode = MODES[int(_mem.mode)] + mem.tuning_step = TUNE_STEPS[int(_mem.tune_step)] if number < 999: mem.skip = chirp_common.SKIP_VALUES[int(flag.skip)] @@ -387,17 +401,23 @@ class THD72Radio(chirp_common.CloneModeRadio): self.set_channel_name(mem.number, mem.name) _mem.tone_mode = TMODES_REV[mem.tmode] - _mem.rtone = chirp_common.TONES.index(mem.rtone) - _mem.ctone = chirp_common.TONES.index(mem.ctone) + _mem.rtone = kenwood_live.KENWOOD_TONES.index(mem.rtone) + _mem.ctone = kenwood_live.KENWOOD_TONES.index(mem.ctone) _mem.dtcs = chirp_common.DTCS_CODES.index(mem.dtcs) _mem.cross_mode = chirp_common.CROSS_MODES.index(mem.cross_mode) _mem.duplex = DUPLEX_REV[mem.duplex] _mem.offset = mem.offset _mem.mode = MODES_REV[mem.mode] + _mem.tune_step = TUNE_STEPS.index(mem.tuning_step) + + if mem.duplex == 'split': + _mem.split_tune_step = TUNE_STEPS.index( + chirp_common.required_step(mem.offset)) + else: + _mem.split_tune_step = _mem.tune_step prog_vfo = get_prog_vfo(mem.freq) flag.prog_vfo = prog_vfo - _mem.unknown1 = _mem.unknown2 = UNKNOWN_LOOKUP[prog_vfo] if mem.number < 999: flag.skip = chirp_common.SKIP_VALUES.index(mem.skip) @@ -415,57 +435,57 @@ class THD72Radio(chirp_common.CloneModeRadio): self.upload() def read_block(self, block, count=256): - self.pipe.write(struct.pack("D72: %s" % cmd) - self.pipe.write(cmd + "\r") - while not data.endswith("\r") and (time.time() - start) < timeout: + self.pipe.write((cmd + "\r").encode()) + while not data.endswith(b"\r") and (time.time() - start) < timeout: data += self.pipe.read(1) LOG.debug("D72->PC: %s" % data.strip()) - return data.strip() + return data.decode().strip() def get_id(self): r = self.command("ID") @@ -581,7 +601,7 @@ class THD72Radio(chirp_common.CloneModeRadio): except AttributeError as e: LOG.error("Setting %s is not in the memory map: %s" % (element.get_name(), e)) - except Exception as e: + except Exception: LOG.debug(element.get_name()) raise @@ -724,10 +744,36 @@ class THD72Radio(chirp_common.CloneModeRadio): result.append(str(msg_text).rstrip("\xFF")) return result + def load_mmap(self, filename): + if filename.lower().endswith('.mc4'): + with open(filename, 'rb') as f: + f.seek(0x100) + self._mmap = memmap.MemoryMapBytes(f.read()) + LOG.info('Loaded MCP file at offset 0x100') + self.process_mmap() + else: + chirp_common.CloneModeRadio.load_mmap(self, filename) + + def save_mmap(self, filename): + if filename.lower().endswith('.mc4'): + with open(filename, 'wb') as f: + f.write(D72_FILE_HEADER) + f.write(self._mmap.get_packed()) + LOG.info('Wrote MCP file') + else: + chirp_common.CloneModeRadio.save_mmap(self, filename) + + @classmethod + def match_model(cls, filedata, filename): + if filename.endswith('.mc4'): + return True + else: + return super(THD72Radio, cls).match_model(filedata, filename) + + if __name__ == "__main__": import sys import serial - import detect import getopt def fixopts(opts): @@ -789,8 +835,8 @@ if __name__ == "__main__": if download: data = r.download(True, blocks) - file(fname, "wb").write(data) + open(fname, "wb").write(data) else: - r._mmap = file(fname, "rb").read(r._memsize) + r._mmap = open(fname, "rb").read(r._memsize) r.upload(blocks) print("\nDone") diff --git a/chirp/drivers/thd74.py b/chirp/drivers/thd74.py new file mode 100644 index 0000000..c2c44eb --- /dev/null +++ b/chirp/drivers/thd74.py @@ -0,0 +1,526 @@ +import itertools +import logging +import struct +import sys +import time + +from chirp import bitwise +from chirp import chirp_common +from chirp import directory +from chirp import errors +from chirp import memmap + +LOG = logging.getLogger(__name__) + +CALL_CHANS = ['VHF Call (A)', + 'VHF Call (D)', + '220M Call (A)', + '220M Call (D)', + 'UHF Call (A)', + 'UHF Call (D)'] + +# This is the order of special channels in memory directly after +# regular memory #999 +EXTD_NUMBERS = list(itertools.chain( + ['%s%02i' % (i % 2 and 'Upper' or 'Lower', i // 2) for i in range(100)], + ['Priority'], + ['WX%i' % (i + 1) for i in range(10)], + [None for i in range(20)], # 20-channel buffer? + [CALL_CHANS[i] for i in range(len(CALL_CHANS))])) + +D74_FILE_HEADER = ( + b'MCP-D74\xFFV1.03\xFF\xFF\xFF' + + b'TH-D74' + (b'\xFF' * 10) + + b'\x00' + (b'\xFF' * 15) + + b'\xFF' * (5 * 16) + + b'K2' + (b'\xFF' * 14) + + b'\xFF' * (7 * 16)) +GROUP_NAME_OFFSET = 1152 + +MEM_FORMAT = """ +#seekto 0x2000; +struct { + u8 used; + u8 unknown1:7, + lockout:1; + u8 group; + u8 unknownFF; +} flags[1200]; + +#seekto 0x4000; +struct { + struct { + ul32 freq; + ul32 offset; + u8 tuning_step:4, + split_tuning_step:3, + unknown2:1; + u8 unknown3_0:1, + mode:3, + narrow:1, + fine_mode:1, + fine_step:2; + u8 tone_mode:1, + ctcss_mode:1, + dtcs_mode:1, + cross_mode:1, + unknown4_0:1, + split:1, + duplex:2; + u8 rtone; + u8 unknownctone:2, + ctone:6; + u8 unknowndtcs:1, + dtcs_code:7; + u8 unknown5_1:2, + cross_mode_mode:2, + unknown5_2:2, + dig_squelch:2; + char dv_urcall[8]; + char dv_rpt1call[8]; + char dv_rpt2call[8]; + u8 unknown9:1, + dv_code:7; + } memories[6]; + u8 pad[16]; +} memgroups[210]; + +#seekto 0x10000; +struct { + char name[16]; +} names[1200]; +""" + + +def decode_call(call): + return ''.join(str(c) for c in call if ord(str(c)) > 0) + + +def encode_call(call): + return call[:8].ljust(8, '\x00') + + +DUPLEX = ['', '+', '-'] +TUNE_STEPS = [5.0, 6.25, 8.33, 9.0, 10.0, 12.5, 15.0, 20.0, 25.0, 30.0, 50.0, + 100.0] +CROSS_MODES = ['DTCS->', 'Tone->DTCS', 'DTCS->Tone', 'Tone->Tone'] +MODES = ['FM', 'DV', 'AM', 'LSB', 'USB', 'CW', 'NFM', + 'DV', # Actually DR in the radio + ] +DSQL_MODES = ['', 'Code', 'Callsign'] +FINE_STEPS = [20, 100, 500, 1000] + + +class KenwoodGroup(chirp_common.NamedBank): + def __init__(self, model, index): + # Default name until we are initialized, then we will report + # the value from memory + super().__init__(model, index, 'GRP-%i' % index) + + def get_name(self): + name = self._model._radio._memobj.names[ + GROUP_NAME_OFFSET + self._index].name + return str(name).rstrip() + + def set_name(self, name): + names = self._model._radio._memobj.names + names[GROUP_NAME_OFFSET + self._index].name = str(name)[:16].ljust(16) + super().set_name(name.strip()) + + +class KenwoodTHD74Bankmodel(chirp_common.BankModel): + channelAlwaysHasBank = True + + def get_num_mappings(self): + return 30 + + def get_mappings(self): + groups = [] + for i in range(self.get_num_mappings()): + groups.append(KenwoodGroup(self, i)) + return groups + + def add_memory_to_mapping(self, memory, bank): + self._radio._memobj.flags[memory.number].group = bank.get_index() + + def remove_memory_from_mapping(self, memory, bank): + self._radio._memobj.flags[memory.number].group = 0 + + def get_mapping_memories(self, bank): + features = self._radio.get_features() + memories = [] + for i in range(0, features.memory_bounds[1]): + if self._radio._memobj.flags[i].group == bank.get_index(): + memories.append(self._radio.get_memory(i)) + return memories + + def get_memory_mappings(self, memory): + index = self._radio._memobj.flags[memory.number].group + return [self.get_mappings()[index]] + + +def get_used_flag(mem): + if mem.empty: + return 0xFF + if mem.duplex == 'split': + freq = mem.offset + else: + freq = mem.freq + + if freq < chirp_common.to_MHz(150): + return 0x00 + elif freq < chirp_common.to_MHz(400): + return 0x01 + else: + return 0x02 + + +@directory.register +class THD74Radio(chirp_common.CloneModeRadio, + chirp_common.IcomDstarSupport): + VENDOR = "Kenwood" + MODEL = "TH-D74 (clone mode)" + NEEDS_COMPAT_SERIAL = False + BAUD_RATE = 9600 + HARDWARE_FLOW = sys.platform == "darwin" # only OS X driver needs hw flow + FORMATS = [directory.register_format('Kenwood MCP-D74', '*.d74')] + + _memsize = 0x7A300 + + def read_block(self, block, count=256): + hdr = struct.pack(">cHH", b"R", block, 0) + self.pipe.write(hdr) + r = self.pipe.read(5) + if len(r) != 5: + raise errors.RadioError("Did not receive block response") + + cmd, _block, zero = struct.unpack(">cHH", r) + if cmd != b"W" or _block != block: + raise errors.RadioError("Invalid response: %s %i" % (cmd, _block)) + + data = b"" + while len(data) < count: + data += self.pipe.read(count - len(data)) + + self.pipe.write(b'\x06') + if self.pipe.read(1) != b'\x06': + raise errors.RadioError("Did not receive post-block ACK!") + + return data + + def write_block(self, block, map, size=256): + hdr = struct.pack(">cHH", b"W", block, size < 256 and size or 0) + base = block * size + data = map[base:base + size] + self.pipe.write(hdr + data) + self.pipe.flush() + + for i in range(10): + ack = self.pipe.read(1) + if ack != b'\x06': + LOG.error('Ack for block %i was: %r' % (block, ack)) + else: + break + return ack == b'\x06' + + def download(self, raw=False, blocks=None): + if blocks is None: + blocks = range(self._memsize // 256) + else: + blocks = [b for b in blocks if b < self._memsize // 256] + + if self.command("0M PROGRAM") != "0M": + raise errors.RadioError("No response from self") + + allblocks = range(self._memsize // 256) + self.pipe.baudrate = 57600 + self.pipe.read(1) + data = b"" + LOG.debug("reading blocks %d..%d" % (blocks[0], blocks[-1])) + total = len(blocks) + count = 0 + for i in allblocks: + if i not in blocks: + data += 256 * b'\xff' + continue + data += self.read_block(i) + count += 1 + if self.status_fn: + s = chirp_common.Status() + s.msg = "Cloning from radio" + s.max = total + s.cur = count + self.status_fn(s) + + self.pipe.write(b"E") + + if raw: + return data + return memmap.MemoryMapBytes(data) + + def upload(self, blocks=None): + if blocks is None: + blocks = range((self._memsize // 256) - 2) + else: + blocks = [b for b in blocks if b < self._memsize // 256] + + if self.command("0M PROGRAM") != "0M": + raise errors.RadioError("No response from self") + + self.pipe.baudrate = 57600 + self.pipe.read(1) + + try: + LOG.debug("writing blocks %d..%d" % (blocks[0], blocks[-1])) + total = len(blocks) + count = 0 + for i in blocks: + r = self.write_block(i, self._mmap) + count += 1 + if not r: + raise errors.RadioError("self NAK'd block %i" % i) + if self.status_fn: + s = chirp_common.Status() + s.msg = "Cloning to radio" + s.max = total + s.cur = count + self.status_fn(s) + finally: + self.pipe.write(b"E") + + def command(self, cmd, timeout=1): + start = time.time() + + data = b"" + LOG.debug("PC->D74: %s" % cmd) + self.pipe.write((cmd + "\r").encode()) + while not data.endswith(b"\r") and (time.time() - start) < timeout: + data += self.pipe.read(1) + LOG.debug("D74->PC: %s" % data.strip()) + return data.decode().strip() + + def get_id(self): + r = self.command("ID") + if r.startswith("ID "): + return r.split(" ")[1] + else: + raise errors.RadioError("No response to ID command") + + def _detect_baud(self): + for baud in [9600, 19200, 38400, 57600]: + self.pipe.baudrate = baud + try: + self.pipe.write(b"\r\r") + except Exception: + break + self.pipe.read(32) + try: + id = self.get_id() + LOG.info("Radio %s at %i baud" % (id, baud)) + return True + except errors.RadioError: + pass + + raise errors.RadioError("No response from radio") + + def process_mmap(self): + self._memobj = bitwise.parse(MEM_FORMAT, self._mmap) + + def sync_in(self): + self._detect_baud() + self._mmap = self.download() + self.process_mmap() + + def sync_out(self): + self._detect_baud() + self.upload() + + def load_mmap(self, filename): + if filename.lower().endswith('.d74'): + with open(filename, 'rb') as f: + f.seek(0x100) + self._mmap = memmap.MemoryMapBytes(f.read()) + LOG.info('Loaded MCP d74 file at offset 0x100') + self.process_mmap() + else: + chirp_common.CloneModeRadio.load_mmap(self, filename) + + def save_mmap(self, filename): + if filename.lower().endswith('.d74'): + with open(filename, 'wb') as f: + f.write(D74_FILE_HEADER) + f.write(self._mmap.get_packed()) + LOG.info('Wrote MCP d74 file') + else: + chirp_common.CloneModeRadio.save_mmap(self, filename) + + def get_features(self): + rf = chirp_common.RadioFeatures() + rf.valid_tuning_steps = list(TUNE_STEPS) + rf.valid_tmodes = ['', 'Tone', 'TSQL', 'DTCS', 'Cross'] + rf.valid_cross_modes = list(CROSS_MODES) + rf.valid_duplexes = DUPLEX + ['split'] + rf.valid_skips = ['', 'S'] + rf.valid_modes = list(MODES) + rf.valid_characters = chirp_common.CHARSET_ASCII + rf.valid_name_length = 16 + rf.valid_bands = [(100000, 470000000)] + rf.valid_special_chans = [x for x in EXTD_NUMBERS if x] + rf.has_cross = True + rf.has_dtcs_polarity = False + rf.has_bank = True + rf.has_bank_names = True + rf.can_odd_split = True + rf.requires_call_lists = False + rf.memory_bounds = (0, 999) + return rf + + def _get_raw_memory(self, number): + # Why Kenwood ... WHY? + return self._memobj.memgroups[number // 6].memories[number % 6] + + def get_memory(self, number): + if isinstance(number, str): + extd_number = number + number = 1000 + EXTD_NUMBERS.index(number) + else: + extd_number = None + + _mem = self._get_raw_memory(number) + _flg = self._memobj.flags[number] + + if MODES[_mem.mode] == 'DV': + mem = chirp_common.DVMemory() + else: + mem = chirp_common.Memory() + + mem.number = number + if extd_number: + mem.extd_number = extd_number + + if _flg.used == 0xFF: + mem.empty = True + return mem + + mem.freq = int(_mem.freq) + if 'Call' in mem.extd_number: + name_index_adj = 5 + else: + name_index_adj = 0 + _nam = self._memobj.names[number + name_index_adj] + mem.name = str(_nam.name).rstrip().strip('\x00') + mem.offset = int(_mem.offset) + if _mem.split: + mem.duplex = 'split' + else: + mem.duplex = DUPLEX[_mem.duplex] + mem.tuning_step = TUNE_STEPS[_mem.tuning_step] + mem.mode = MODES[_mem.mode] + mem.rtone = chirp_common.TONES[_mem.rtone] + mem.ctone = chirp_common.TONES[_mem.ctone] + mem.dtcs = chirp_common.DTCS_CODES[_mem.dtcs_code] + + if _mem.tone_mode: + mem.tmode = 'Tone' + elif _mem.ctcss_mode: + mem.tmode = 'TSQL' + elif _mem.dtcs_mode: + mem.tmode = 'DTCS' + elif _mem.cross_mode: + mem.tmode = 'Cross' + mem.cross_mode = CROSS_MODES[_mem.cross_mode_mode] + else: + mem.tmode = '' + + mem.skip = _flg.lockout and 'S' or '' + + if mem.mode == 'DV': + mem.dv_urcall = decode_call(_mem.dv_urcall) + mem.dv_rpt1call = decode_call(_mem.dv_rpt1call) + mem.dv_rpt2call = decode_call(_mem.dv_rpt2call) + mem.dv_code = int(_mem.dv_code) + + if mem.extd_number: + mem.immutable.append('empty') + + if 'WX' in mem.extd_number: + mem.tmode = '' + mem.immutable.extend(['rtone', 'ctone', 'dtcs', 'rx_dtcs', + 'tmode', 'cross_mode', 'dtcs_polarity', + 'skip', 'power', 'offset', 'mode', + 'tuning_step']) + if 'Call' in mem.extd_number and mem.mode == 'DV': + mem.immutable.append('mode') + + return mem + + def set_memory(self, mem): + + if mem.number > 999 and 'Call' in EXTD_NUMBERS[mem.number - 1000]: + name_index_adj = 5 + else: + name_index_adj = 0 + + _mem = self._get_raw_memory(mem.number) + _flg = self._memobj.flags[mem.number] + _nam = self._memobj.names[mem.number + name_index_adj] + + _flg.used = get_used_flag(mem) + + if mem.empty: + _flg.lockout = 0 + _flg.group = 0 + _nam.name = ('\x00' * 16) + _mem.set_raw(b'\xFF' * 40) + return + + _mem.set_raw(b'\x00' * 40) + + _flg.group = 0 # FIXME + + _mem.freq = mem.freq + _nam.name = mem.name.ljust(16) + _mem.offset = int(mem.offset) + if mem.duplex == 'split': + _mem.split = True + _mem.duplex = 0 + _mem.split_tuning_step = TUNE_STEPS.index( + chirp_common.required_step(mem.offset)) + else: + _mem.split = False + _mem.duplex = DUPLEX.index(mem.duplex) + _mem.tuning_step = TUNE_STEPS.index(mem.tuning_step) + _mem.mode = MODES.index(mem.mode) + _mem.narrow = mem.mode == 'NFM' + _mem.rtone = chirp_common.TONES.index(mem.rtone) + _mem.ctone = chirp_common.TONES.index(mem.ctone) + _mem.dtcs_code = chirp_common.DTCS_CODES.index(mem.dtcs) + + _mem.tone_mode = mem.tmode == 'Tone' + _mem.ctcss_mode = mem.tmode == 'TSQL' + _mem.dtcs_mode = mem.tmode == 'DTCS' + _mem.cross_mode = mem.tmode == 'Cross' + + if mem.tmode == 'Cross': + _mem.cross_mode_mode = CROSS_MODES.index(mem.cross_mode) + + _flg.lockout = mem.skip == 'S' + if isinstance(mem, chirp_common.DVMemory): + _mem.dv_urcall = encode_call(mem.dv_urcall) + _mem.dv_rpt1call = encode_call(mem.dv_rpt1call) + _mem.dv_rpt2call = encode_call(mem.dv_rpt2call) + _mem.dv_code = mem.dv_code + + def get_raw_memory(self, number): + return (repr(self._get_raw_memory(number)) + + repr(self._memobj.flags[number])) + + def get_bank_model(self): + return KenwoodTHD74Bankmodel(self) + + @classmethod + def match_model(cls, filedata, filename): + if filename.endswith('.d74'): + return True + else: + return chirp_common.CloneModeRadio.match_model(filedata, filename) diff --git a/chirp/drivers/thuv1f.py b/chirp/drivers/thuv1f.py index 884e9cc..03990ad 100644 --- a/chirp/drivers/thuv1f.py +++ b/chirp/drivers/thuv1f.py @@ -28,16 +28,16 @@ LOG = logging.getLogger(__name__) def uvf1_identify(radio): """Do identify handshake with TYT TH-UVF1""" - radio.pipe.write("PROG333") + radio.pipe.write(b"PROG333") ack = radio.pipe.read(1) - if ack != "\x06": + if ack != b"\x06": raise errors.RadioError("Radio did not respond") - radio.pipe.write("\x02") + radio.pipe.write(b"\x02") ident = radio.pipe.read(16) LOG.info("Ident:\n%s" % util.hexprint(ident)) - radio.pipe.write("\x06") + radio.pipe.write(b"\x06") ack = radio.pipe.read(1) - if ack != "\x06": + if ack != b"\x06": raise errors.RadioError("Radio did not ack identification") return ident @@ -47,14 +47,14 @@ def uvf1_download(radio): data = uvf1_identify(radio) for i in range(0, 0x1000, 0x10): - msg = struct.pack(">BHB", ord("R"), i, 0x10) + msg = struct.pack(">cHB", b"R", i, 0x10) radio.pipe.write(msg) block = radio.pipe.read(0x10 + 4) if len(block) != (0x10 + 4): raise errors.RadioError("Radio sent a short block") - radio.pipe.write("\x06") + radio.pipe.write(b"\x06") ack = radio.pipe.read(1) - if ack != "\x06": + if ack != b"\x06": raise errors.RadioError("Radio NAKed block") data += block[4:] @@ -64,9 +64,9 @@ def uvf1_download(radio): status.msg = "Cloning from radio" radio.status_fn(status) - radio.pipe.write("\x45") + radio.pipe.write(b"\x45") - return memmap.MemoryMap(data) + return memmap.MemoryMapBytes(data) def uvf1_upload(radio): @@ -75,17 +75,17 @@ def uvf1_upload(radio): radio.pipe.timeout = 1 - if data != radio._mmap[:16]: + if data != radio._mmap[0:16]: raise errors.RadioError("Unable to talk to this model") for i in range(0, 0x1000, 0x10): addr = i + 0x10 - msg = struct.pack(">BHB", ord("W"), i, 0x10) + msg = struct.pack(">cHB", b"W", i, 0x10) msg += radio._mmap[addr:addr+0x10] radio.pipe.write(msg) ack = radio.pipe.read(1) - if ack != "\x06": + if ack != b"\x06": LOG.debug(repr(ack)) raise errors.RadioError("Radio did not ack block %i" % i) status = chirp_common.Status() @@ -95,7 +95,7 @@ def uvf1_upload(radio): radio.status_fn(status) # End of clone? - radio.pipe.write("\x45") + radio.pipe.write(b"\x45") THUV1F_MEM_FORMAT = """ @@ -184,6 +184,7 @@ class TYTTHUVF1Radio(chirp_common.CloneModeRadio): """TYT TH-UVF1""" VENDOR = "TYT" MODEL = "TH-UVF1" + NEEDS_COMPAT_SERIAL = False def get_features(self): rf = chirp_common.RadioFeatures() @@ -353,17 +354,17 @@ class TYTTHUVF1Radio(chirp_common.CloneModeRadio): def set_memory(self, mem): _mem = self._memobj.memory[mem.number - 1] if mem.empty: - _mem.set_raw("\xFF" * 16) + _mem.set_raw(b"\xFF" * 16) return if _mem.get_raw() == ("\xFF" * 16): LOG.debug("Initializing empty memory") - _mem.set_raw("\x00" * 16) + _mem.set_raw(b"\x00" * 16) _mem.rx_freq = mem.freq / 10 if mem.duplex == "off": for i in range(0, 4): - _mem.tx_freq[i].set_raw("\xFF") + _mem.tx_freq[i].set_raw(b"\xFF") elif mem.duplex == "split": _mem.tx_freq = mem.offset / 10 elif mem.duplex == "-": diff --git a/chirp/drivers/tk270.py b/chirp/drivers/tk270.py index 0d16958..d2cf981 100644 --- a/chirp/drivers/tk270.py +++ b/chirp/drivers/tk270.py @@ -23,9 +23,7 @@ from chirp import chirp_common, directory, memmap from chirp import bitwise, errors, util from chirp.settings import RadioSettingGroup, RadioSetting, \ RadioSettingValueBoolean, RadioSettingValueList, \ - RadioSettingValueString, RadioSettingValueInteger, \ - RadioSettings -from textwrap import dedent + RadioSettingValueString, RadioSettings MEM_FORMAT = """ #seekto 0x0010; @@ -104,7 +102,7 @@ POWER_LEVELS = [chirp_common.PowerLevel("Low", watts=1), chirp_common.PowerLevel("High", watts=5)] SKIP_VALUES = ["", "S"] TONES = chirp_common.TONES -#TONES.remove(254.1) +# TONES.remove(254.1) DTCS_CODES = chirp_common.DTCS_CODES # some vars for the UI @@ -121,12 +119,13 @@ SCAN = off + ["Carrier operated (COS)", "Time operated (TOS)"] YESNO = ["Enabled", "Disabled"] TA = off + ["Turn around", "Reverse"] + def rawrecv(radio, amount): """Raw read from the radio device""" data = "" try: data = radio.pipe.read(amount) - #print("<= %02i: %s" % (len(data), util.hexprint(data))) + # print("<= %02i: %s" % (len(data), util.hexprint(data))) except: raise errors.RadioError("Error reading data from radio") @@ -137,7 +136,7 @@ def rawsend(radio, data): """Raw send to the radio device""" try: radio.pipe.write(data) - #print("=> %02i: %s" % (len(data), util.hexprint(data))) + # print("=> %02i: %s" % (len(data), util.hexprint(data))) except: raise errors.RadioError("Error sending data from radio") @@ -168,7 +167,7 @@ def handshake(radio, msg="", full=False): ack = rawrecv(radio, 1) # check ACK if ack != ACK_CMD: - #close_radio(radio) + # close_radio(radio) mesg = "Handshake failed: " + msg raise Exception(mesg) @@ -180,7 +179,6 @@ def recv(radio): if len(rxdata) != 12: raise errors.RadioError( "Received a length of data that is not possible") - return cmd, addr, length = struct.unpack(">BHB", rxdata[0:4]) data = "" @@ -239,7 +237,7 @@ def do_download(radio): """This is your download function""" open_radio(radio) - # UI progress + # UI progress status = chirp_common.Status() status.cur = 0 status.max = MEM_SIZE / BLOCK_SIZE @@ -252,7 +250,7 @@ def do_download(radio): data += recv(radio) handshake(radio, "Rx error in block %03i" % addr, True) # DEBUG - #print("Block: %04x, Pos: %06x" % (addr, addr * BLOCK_SIZE)) + # print("Block: %04x, Pos: %06x" % (addr, addr * BLOCK_SIZE)) # UI Update status.cur = addr @@ -266,7 +264,7 @@ def do_upload(radio): """Upload info to radio""" open_radio(radio) - # UI progress + # UI progress status = chirp_common.Status() status.cur = 0 status.max = MEM_SIZE / BLOCK_SIZE @@ -304,7 +302,7 @@ def model_match(cls, data): rid = get_radio_id(data) # DEBUG - #print("Full ident string is %s" % util.hexprint(rid)) + # print("Full ident string is %s" % util.hexprint(rid)) if (rid in cls.VARIANTS): # correct model @@ -327,7 +325,7 @@ class Kenwood_P60_Radio(chirp_common.CloneModeRadio, chirp_common.ExperimentalRa rp = chirp_common.RadioPrompts() rp.experimental = \ ('This driver is experimental; not all features have been ' - 'implemented, but it has those features most used by hams.\n' + 'implemented, but it has those features most used by hams.\n' '\n' 'This radios are able to work slightly outside the OEM ' 'frequency limits. After testing, the limit in Chirp has ' @@ -337,20 +335,18 @@ class Kenwood_P60_Radio(chirp_common.CloneModeRadio, chirp_common.ExperimentalRa 'Nevertheless, each radio has its own hardware limits and ' 'your mileage may vary.\n' ) - rp.pre_download = _(dedent("""\ - Follow this instructions to read your radio: - 1 - Turn off your radio - 2 - Connect your interface cable - 3 - Turn on your radio - 4 - Do the download of your radio data - """)) - rp.pre_upload = _(dedent("""\ - Follow this instructions to write your radio: - 1 - Turn off your radio - 2 - Connect your interface cable - 3 - Turn on your radio - 4 - Do the upload of your radio data - """)) + rp.pre_download = _( + "Follow this instructions to read your radio:\n" + "1 - Turn off your radio\n" + "2 - Connect your interface cable\n" + "3 - Turn on your radio\n" + "4 - Do the download of your radio data\n") + rp.pre_upload = _( + "Follow this instructions to write your radio:\n" + "1 - Turn off your radio\n" + "2 - Connect your interface cable\n" + "3 - Turn on your radio\n" + "4 - Do the upload of your radio data\n") return rp def get_features(self): @@ -409,7 +405,7 @@ class Kenwood_P60_Radio(chirp_common.CloneModeRadio, chirp_common.ExperimentalRa to the correct variant of the radio""" rid = get_radio_id(self._mmap) - # identify the radio variant and set the environment to it's values + # identify the radio variant and set the environment to its values try: self._upper, low, high, self._kind = self.VARIANTS[rid] @@ -426,7 +422,7 @@ class Kenwood_P60_Radio(chirp_common.CloneModeRadio, chirp_common.ExperimentalRa self._VARIANT += self._kind + ", %d - %d MHz" % (low, high) # DEBUG - #print self._VARIANT + # print self._VARIANT except KeyError: LOG.debug("Wrong Kenwood radio, ID or unknown variant") @@ -446,8 +442,8 @@ class Kenwood_P60_Radio(chirp_common.CloneModeRadio, chirp_common.ExperimentalRa # The x0280 area has the settings for the DTMF/2-Tone per channel, # as we don't support this feature yet, # we disabled by cleaning the data - #fldata = "\x00\xf0\xff\xff\xff" * achs + \ - #"\xff" * (5 * (self._upper - achs)) + # fldata = "\x00\xf0\xff\xff\xff" * achs + \ + # "\xff" * (5 * (self._upper - achs)) fldata = "\xFF" * 5 * self._upper self._fill(0x0280, fldata) @@ -481,13 +477,13 @@ class Kenwood_P60_Radio(chirp_common.CloneModeRadio, chirp_common.ExperimentalRa bit = chan % 8 # DEBUG - #print("SET Chan %s, Byte %s, Bit % s" % (chan, byte, bit)) + # print("SET Chan %s, Byte %s, Bit % s" % (chan, byte, bit)) # get the actual value to see if I need to change anything actual = self.get_active(chan) if actual != bool(value): # DEBUG - #print "VALUE %s fliping" % int(not value) + # print "VALUE %s flipping" % int(not value) # I have to flip the value rbyte = self._memobj.active[byte] @@ -710,7 +706,7 @@ class Kenwood_P60_Radio(chirp_common.CloneModeRadio, chirp_common.ExperimentalRa basic.append(mod) beep = RadioSetting("settings.beep", "Beep tone", - RadioSettingValueBoolean( + RadioSettingValueBoolean( bool(sett.beep))) basic.append(beep) @@ -720,12 +716,12 @@ class Kenwood_P60_Radio(chirp_common.CloneModeRadio, chirp_common.ExperimentalRa basic.append(bsave) deal = RadioSetting("settings.dealer", "Dealer & Test", - RadioSettingValueBoolean( + RadioSettingValueBoolean( bool(sett.dealer))) basic.append(deal) add = RadioSetting("settings.add", "Del / Add feature", - RadioSettingValueBoolean( + RadioSettingValueBoolean( bool(sett.add))) basic.append(add) @@ -752,15 +748,15 @@ class Kenwood_P60_Radio(chirp_common.CloneModeRadio, chirp_common.ExperimentalRa basic.append(tot) tota = RadioSetting("settings.tot_alert", "TOT pre-plert", - RadioSettingValueList(TOT_A, TOT_A[int(sett.tot_alert)])) + 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)])) + 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)])) + RadioSettingValueList(TOT_RS, TOT_RS[int(sett.tot_reset)])) basic.append(totrs) sql = RadioSetting("settings.sql", "Squelch level", @@ -786,14 +782,14 @@ class Kenwood_P60_Radio(chirp_common.CloneModeRadio, chirp_common.ExperimentalRa if d > 1: d = 0 dial = RadioSetting("settings.kDial", "Dial", - RadioSettingValueList(YESNO, YESNO[d])) + 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])) + RadioSettingValueList(TA, TA[t])) fkeys.append(ta) l = int(sett.kLo) @@ -829,8 +825,8 @@ class Kenwood_P60_Radio(chirp_common.CloneModeRadio, chirp_common.ExperimentalRa value = element.value # integers case + special case - if setting in ["tot", "tot_alert", "tot_rekey", \ - "tot_reset", "sql", "kMoni", "kScan", \ + if setting in ["tot", "tot_alert", "tot_rekey", + "tot_reset", "sql", "kMoni", "kScan", "kDial", "kTa", "kLo"]: # catching the "off" values as zero try: @@ -844,7 +840,7 @@ class Kenwood_P60_Radio(chirp_common.CloneModeRadio, chirp_common.ExperimentalRa # Apply al configs done # DEBUG - #print("%s: %s" % (setting, value)) + # print("%s: %s" % (setting, value)) setattr(obj, setting, value) @@ -858,8 +854,8 @@ class TK260_Radio(Kenwood_P60_Radio): MODEL = "TK-260" TYPE = "P0260" VARIANTS = { - "P0260\x20\x00\x00": (4, 136, 150, "F2"), - "P0260\x21\x00\x00": (4, 150, 174, "F1"), + b"P0260\x20\x00\x00": (4, 136, 150, "F2"), + b"P0260\x21\x00\x00": (4, 150, 174, "F1"), } @@ -869,8 +865,8 @@ class TK270_Radio(Kenwood_P60_Radio): MODEL = "TK-270" TYPE = "P0270" VARIANTS = { - "P0270\x10\x00\x00": (32, 136, 150, "F2"), - "P0270\x11\x00\x00": (32, 150, 174, "F1"), + b"P0270\x10\x00\x00": (32, 136, 150, "F2"), + b"P0270\x11\x00\x00": (32, 150, 174, "F1"), } @@ -880,8 +876,8 @@ class TK272_Radio(Kenwood_P60_Radio): MODEL = "TK-272" TYPE = "P0272" VARIANTS = { - "P0272\x10\x00\x00": (10, 136, 150, "F2"), - "P0272\x11\x00\x00": (10, 150, 174, "F1"), + b"P0272\x10\x00\x00": (10, 136, 150, "F2"), + b"P0272\x11\x00\x00": (10, 150, 174, "F1"), } @@ -891,8 +887,8 @@ class TK278_Radio(Kenwood_P60_Radio): MODEL = "TK-278" TYPE = "P0278" VARIANTS = { - "P0278\x00\x00\x00": (32, 136, 150, "F2"), - "P0278\x01\x00\x00": (32, 150, 174, "F1"), + b"P0278\x00\x00\x00": (32, 136, 150, "F2"), + b"P0278\x01\x00\x00": (32, 150, 174, "F1"), } @@ -902,10 +898,10 @@ class TK360_Radio(Kenwood_P60_Radio): MODEL = "TK-360" TYPE = "P0360" VARIANTS = { - "P0360\x24\x00\x00": (4, 450, 470, "F1"), - "P0360\x25\x00\x00": (4, 470, 490, "F2"), - "P0360\x26\x00\x00": (4, 490, 512, "F3"), - "P0360\x23\x00\x00": (4, 406, 430, "F4"), + b"P0360\x24\x00\x00": (4, 450, 470, "F1"), + b"P0360\x25\x00\x00": (4, 470, 490, "F2"), + b"P0360\x26\x00\x00": (4, 490, 512, "F3"), + b"P0360\x23\x00\x00": (4, 406, 430, "F4"), } @@ -915,10 +911,10 @@ class TK370_Radio(Kenwood_P60_Radio): MODEL = "TK-370" TYPE = "P0370" VARIANTS = { - "P0370\x14\x00\x00": (32, 450, 470, "F1"), - "P0370\x15\x00\x00": (32, 470, 490, "F2"), - "P0370\x16\x00\x00": (32, 490, 512, "F3"), - "P0370\x13\x00\x00": (32, 406, 430, "F4"), + b"P0370\x14\x00\x00": (32, 450, 470, "F1"), + b"P0370\x15\x00\x00": (32, 470, 490, "F2"), + b"P0370\x16\x00\x00": (32, 490, 512, "F3"), + b"P0370\x13\x00\x00": (32, 406, 430, "F4"), } @@ -928,8 +924,8 @@ class TK372_Radio(Kenwood_P60_Radio): MODEL = "TK-372" TYPE = "P0372" VARIANTS = { - "P0372\x14\x00\x00": (10, 450, 470, "F1"), - "P0372\x15\x00\x00": (10, 470, 490, "F2"), + b"P0372\x14\x00\x00": (10, 450, 470, "F1"), + b"P0372\x15\x00\x00": (10, 470, 490, "F2"), } @@ -939,6 +935,6 @@ class TK378_Radio(Kenwood_P60_Radio): MODEL = "TK-378" TYPE = "P0378" VARIANTS = { - "P0378\x04\x00\x00": (32, 370, 470, "SP1"), - "P0378\x02\x00\x00": (32, 350, 427, "SP2"), + b"P0378\x04\x00\x00": (32, 370, 470, "SP1"), + b"P0378\x02\x00\x00": (32, 350, 427, "SP2"), } diff --git a/chirp/drivers/tk3140.py b/chirp/drivers/tk3140.py new file mode 100644 index 0000000..580fd16 --- /dev/null +++ b/chirp/drivers/tk3140.py @@ -0,0 +1,687 @@ +# Copyright 2023 Dan Smith +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +import collections +import logging +import struct + +from chirp import chirp_common +from chirp import bitwise +from chirp import directory +from chirp.drivers import tk8160 +from chirp.drivers import tk8180 +from chirp import errors +from chirp import memmap +from chirp import settings +from chirp import util + +LOG = logging.getLogger(__name__) + + +IndexEntry = collections.namedtuple('IndexEntry', 'zone memory zoneindex slot') +EMPTY_INDEX_ENTRY = IndexEntry(0xFF, 0xFF, 0xFF, 0xFF) + + +def send(radio, frame): + LOG.debug("%04i P>R:\n%s" % (len(frame), util.hexprint(frame))) + radio.pipe.write(frame) + + +def recv(radio, count): + buf = radio.pipe.read(count) + LOG.debug('%04i: R>P:\n%s' % (len(buf), util.hexprint(buf))) + return buf + + +def do_ident(radio): + radio.pipe.baudrate = 9600 + radio.pipe.databits = 8 + radio.pipe.stopbits = 2 + radio.pipe.parity = 'N' + radio.pipe.timeout = 1 + send(radio, b'PROGRAM') + ack = recv(radio, 1) + if ack != b'\x06': + LOG.error('Expected ACK, got %r' % ack) + raise errors.RadioError('Radio failed to ack program mode') + send(radio, b'\x02') + model = recv(radio, 8) + if model != radio._model: + raise errors.RadioError('Incorrect model') + send(radio, b'\x06') + ack = recv(radio, 1) + if ack != b'\x06': + raise errors.RadioError('No ack after model probe') + send(radio, b'P') + resp = recv(radio, 10) + LOG.debug('Radio ident:\n%s' % util.hexprint(resp)) + send(radio, b'\x06') + ack = recv(radio, 1) + if ack != b'\x06': + raise errors.RadioError('No ack after version probe') + + +def status(radio, block, msg): + s = chirp_common.Status() + s.cur = block + s.max = 0x7F + s.msg = msg + radio.status_fn(s) + + +def do_download(radio): + do_ident(radio) + + data = b'' + for block in range(0x80): + send(radio, struct.pack('>cBB', b'R', 0, block)) + cmd = recv(radio, 1) + if cmd == b'Z': + fillbyte = recv(radio, 1) + if len(fillbyte) != 1: + LOG.error('Expected fill byte after Z but got none') + raise errors.RadioError('Failed to communicate') + chunk = fillbyte * 256 + elif cmd == b'W': + chunk = recv(radio, 256) + cs = recv(radio, 1) + ccs = sum(chunk) % 256 + if cmd != b'Z' and cs[0] != ccs: + LOG.error('Checksum mismatch %02x!=%02x at block %02x', + cs[0], ccs, block) + raise errors.RadioError( + 'Checksum mismatch at block %02i' % block) + else: + LOG.error('Unsupported command %r' % cmd) + raise errors.RadioError('Invalid command') + + data += chunk + send(radio, b'\x06') + ack = recv(radio, 1) + if ack != b'\x06': + LOG.error('Expected ACK got %r' % ack) + raise errors.RadioError('Failed at block %02x' % block) + status(radio, block, 'Receiving from radio') + + # This is a separate region at the end, read and written in a different + # way. Only contains the scan bits (that we know of) + for addr in range(0x0320, 0x0340, 0x10): + hdr = struct.pack('>cHB', b'S', addr, 0x10) + send(radio, hdr) + cmd = recv(radio, 1) + if cmd != b'X': + LOG.error('Unsupported command %r' % cmd) + raise errors.RadioError('Invalid command') + chunk = recv(radio, 0x10) + if len(chunk) == 0x10: + send(radio, b'\x06') + recv(radio, 1) + else: + LOG.error('Got short read at %04x:\n%s', + addr, util.hexprint(chunk)) + raise errors.RadioError('Short read at %04x' % addr) + data += chunk + + return memmap.MemoryMapBytes(data) + + +def do_upload(radio): + do_ident(radio) + + data = radio._mmap.get_packed() + for block in range(0x80): + if 0x54 <= block < 0x60: + LOG.debug('Skipping block 0x%02x' % block) + continue + addr = block * 256 + chunk = data[addr:addr + 256] + if len(set(chunk)) == 1: + hdr = struct.pack('cBBB', b'Z', 0, block, chunk[0]) + send(radio, hdr) + else: + hdr = struct.pack('cBB', b'W', 0, block) + send(radio, hdr) + send(radio, chunk) + cs = sum(chunk) % 256 + send(radio, bytes([cs])) + ack = recv(radio, 1) + if ack != b'\x06': + LOG.error('Expected ACK but got %r' % ack) + raise errors.RadioError('Radio NAKd block %i' % block) + status(radio, block, 'Sending to radio') + + for i in range(2): + radio_addr = 0x0320 + i * 0x10 + memory_addr = 0x8000 + i * 0x10 + chunk = data[memory_addr:memory_addr + 0x10] + hdr = struct.pack('>cHB', b'X', radio_addr, 0x10) + send(radio, hdr) + send(radio, chunk) + send(radio, bytes([sum(chunk) % 255])) + ack = recv(radio, 1) + if ack != b'\x06': + LOG.error('Expected ACK at %04x, got %r', radio_addr, ack) + raise errors.RadioError('Radio NAKd block') + send(radio, ack) + + +def exit_program(radio): + try: + send(radio, b'E') + except Exception: + pass + + +KEYS = { + 0x31: 'DTMF ID (BOT)', + 0x32: 'DTMF ID (EOT)', + 0x33: 'Display Character', + 0x35: 'Home Channel', + 0x37: 'Channel Down', + 0x38: 'Channel Up', + 0x39: 'Key Lock', + 0x3A: 'Lamp', + 0x3C: 'Memory RCL/STO', + 0x3E: 'Memory RCL', + 0x3F: 'Memory STO', + 0x40: 'Squelch Off Momentary', + 0x41: 'Squelch Off Toggle', + 0x42: 'Monitor Momentary', + 0x43: 'Monitor Toggle', + 0x45: 'Redial', + 0x46: 'Low RF Power', + 0x47: 'Scan', + 0x48: 'Scan Add/Del', + 0x4A: 'Group Down', + 0x4B: 'Group Up', + 0x4E: 'OST', + 0x4F: 'None', + 0x52: 'Talk Around', + 0x60: 'Squelch Level', + } + +KEY_NAMES = { + 'A': 'akey', + 'B': 'bkey', + 'C': 'ckey', + 'S': 'skey', + 'Side 1': 'side1', + 'Side 2': 'side2', + 'Aux': 'aux', + 'Mic PF1': 'pf1', + 'Mic PF2': 'pf2', +} + +KNOB = { + 0x00: 'None', + 0x01: 'Channel Up/Down', + 0x02: 'Group Up/Down', +} + +BATTSAVE = { + 0xFF: 'Off', + 0x30: 'Short', + 0x31: 'Medium', + 0x32: 'Long', +} + +mem_format = """ +#seekto 0x00E; +u8 zone_count; +u8 memory_count; + +#seekto 0x01F; +// 0xFF=off, 0x30=short, 0x31=med, 0x32=long +u8 battsave; + +#seekto 0x110; +// 4F=none 31=dtmfidbot 32=dmtfideot 33=chup 35=home 37=chandn 38=dispchr +// 39=keylock 3A=lamp 3C=memrclsto 3E=memrcl 3F=memsto 40=sqlmon 41=sqltog +// 42=monmom 43=montog 45=redial 46=lowpower 47=scan 48=scanadd 60=sqllev 52=ta +// 4A=grpdn 4B=grpup 4E=OST +struct { + u8 akey; + u8 bkey; + u8 ckey; + u8 side2; + u8 skey; + u8 side1; + u8 aux; + u8 pf1; + u8 pf2; +} keys; +#seekto 0x124; +// A1=cha A2=group 4F=none +u8 unknown1:6, + knob:2; + +#seekto 0x300; +struct { + u8 zone; + u8 memory; + u8 zoneinfo_index; + u8 slot; +} index[250]; + +#seekto 0x1000; +struct { + u8 zone; + u8 count; + char name[10]; + u8 unknown[4]; +} zoneinfo[250]; + +#seekto 0x2000; +struct { + u8 memory; + u8 zone; + char name[10]; + lbcd rx_freq[4]; + lbcd tx_freq[4]; + u8 rxsomething; + u8 txsomething; + ul16 rxtone; + ul16 txtone; + u8 unknown2[5]; + u8 optsig; // ff=None 31=2tone 30=DTMF 32=MSK + u8 unknown2_1:1, + pttid:1, // 0=on 1=off + beatshift:1, // 0=on 1=off + bcl:1, // 1=none 0=QT/DQT + unknown1_2:1, + highpower:1, + compander:1, //0=on 1=off + wide:1; + u8 unknown3_1:4, + bcl_optsig:2, // 0 if bcl=carrier 1 if bcl=optsig 3 otherwise + mode2tone:2; // F=off C=2tone1 D=2tone2 E=2tone3 + u8 unknown4[14]; +} memories[250]; + +#seekto 0x8000; +u8 scanbits[32]; +""" + + +POWER_LEVELS = [chirp_common.PowerLevel('Low', watts=1), + chirp_common.PowerLevel('High', watts=5)] + + +class KenwoodTKx140Radio(chirp_common.CloneModeRadio): + VENDOR = 'Kenwood' + FORMATS = [directory.register_format('Kenwood KPG-74D', '*.dat')] + NEEDS_COMPAT_SERIAL = False + + def sync_in(self): + try: + self._mmap = do_download(self) + self.process_mmap() + except errors.RadioError: + raise + except Exception as e: + LOG.exception('Failed to download: %s' % e) + raise errors.RadioError('Failed to download from radio') + finally: + exit_program(self) + + def sync_out(self): + try: + do_upload(self) + except errors.RadioError: + raise + except Exception as e: + LOG.exception('Failed to upload: %s' % e) + raise errors.RadioError('Failed to upload to radio') + finally: + exit_program(self) + + def process_mmap(self): + self._memobj = bitwise.parse(mem_format, self._mmap) + + def get_features(self): + rf = chirp_common.RadioFeatures() + rf.memory_bounds = (1, 250) + rf.has_ctone = True + rf.has_cross = True + rf.has_bank = False + rf.has_tuning_step = False + rf.has_rx_dtcs = True + rf.has_settings = True + rf.can_odd_split = True + rf.valid_bands = self._valid_bands + rf.valid_characters = chirp_common.CHARSET_ASCII + rf.valid_name_length = 10 + rf.valid_tmodes = ['', 'Tone', 'TSQL', 'DTCS', 'Cross'] + rf.valid_cross_modes = ['Tone->Tone', 'DTCS->', '->DTCS', "Tone->DTCS", + 'DTCS->Tone', '->Tone', 'DTCS->DTCS'] + rf.valid_duplexes = ['', '-', '+', 'split', 'off'] + rf.valid_modes = ['FM', 'NFM'] + rf.valid_power_levels = list(POWER_LEVELS) + rf.valid_tuning_steps = [2.5, 5.0, 6.25, 12.5, 10.0, 15.0, 20.0, + 25.0, 50.0, 100.0] + + rf.has_sub_devices = not self.VARIANT + return rf + + def _get_zone(self, zone): + class TKx140Zone(self.__class__): + MODEL = self.MODEL + VARIANT = 'Group %i' % zone + _valid_bands = self._valid_bands + + def __init__(self, parent, zone): + self._memobj = parent._memobj + self._zone = zone + + return TKx140Zone(self, zone) + + def _get_zone_info(self): + zones = collections.defaultdict(int) + for i in range(250): + zone_obj = self._memobj.zoneinfo[i] + if int(zone_obj.zone) != 0xFF: + zones[int(zone_obj.zone)] = int(zone_obj.count) + return zones + + def _set_num_zones(self, count): + zones = self._get_zone_info() + available = [x + 1 for x in range(250) if x + 1 not in zones] + for i in range(250): + zoneinfo_obj = self._memobj.zoneinfo[i] + if i >= count: + if i > 0 and zoneinfo_obj.zone != 0xFF: + LOG.debug('Deleting zone %i index %i', + zoneinfo_obj.zone, i) + zoneinfo_obj.set_raw(b'\xFF' * 16) + elif zoneinfo_obj.zone == 0xFF: + next_zone = available.pop(0) + LOG.debug('Adding zone %i index %i', next_zone, i) + zoneinfo_obj.zone = next_zone + zoneinfo_obj.count = 0 + zoneinfo_obj.name = ('Group %i' % next_zone).ljust(10) + else: + LOG.debug('Keeping existing zone %i index %i', + zoneinfo_obj.zone, i) + self.sort_index() + + def get_sub_devices(self): + if not self._memobj: + return [self._get_zone(1)] + return [self._get_zone(zone) + for zone, count in self._get_zone_info().items()] + + def check_index(self, number): + for i in range(250): + index_obj = self._memobj.index[i] + if index_obj.zone == self._zone and index_obj.memory == number: + return i, index_obj.slot + elif index_obj.zone == 0xFF: + # KPG-74D keeps these compacted so that there are no empties + # until the end + break + return None, None + + def next_slot(self, number): + for i in range(250): + if self._memobj.memories[i].memory == 0xFF: + return i + + def sort_index(self): + zones = [] + for i in range(250): + zoneinfo_obj = self._memobj.zoneinfo[i] + if zoneinfo_obj.zone == 0xFF: + break + zones.append(int(zoneinfo_obj.zone)) + + LOG.debug('Enabled zones: %s' % zones) + + index_entries = [] + for i in range(250): + mem_obj = self._memobj.memories[i] + if mem_obj.zone == 0xFF: + # Empty + continue + if int(mem_obj.zone) not in zones: + LOG.debug('Erasing %i:%i from slot %i because zone disabled', + mem_obj.zone, mem_obj.memory, i) + mem_obj.set_raw(b'\xFF' * 48) + continue + index_entries.append(IndexEntry(int(mem_obj.zone), + int(mem_obj.memory), + zones.index(int(mem_obj.zone)), + i)) + + index_entries.sort() + zone_counts = collections.defaultdict(int) + for i in range(250): + try: + entry = index_entries[i] + zone_counts[entry.zone] += 1 + except IndexError: + entry = EMPTY_INDEX_ENTRY + index_obj = self._memobj.index[i] + index_obj.zone = entry.zone + index_obj.memory = entry.memory + index_obj.zoneinfo_index = entry.zoneindex + index_obj.slot = entry.slot + + for zone_index, zone in enumerate(zones): + LOG.debug('Zone %i count %i' % (zone, zone_counts[zone])) + self._memobj.zoneinfo[zone_index].count = zone_counts[zone] + self._memobj.memory_count = sum(zone_counts.values()) + self._memobj.zone_count = len(zones) + + LOG.debug('Sorted index, %i memories' % self._memobj.memory_count) + + def get_raw_memory(self, number): + _index_entry, slot = self.check_index(number) + if slot is not None: + return '\n'.join(repr(x) for x in [ + self._memobj.memories[slot], + self._memobj.index[_index_entry]]) + + def get_memory(self, number): + m = chirp_common.Memory(number) + _index_entry, slot = self.check_index(number) + if slot is None: + m.empty = True + return m + + _mem = self._memobj.memories[slot] + _scn = self._memobj.scanbits[slot // 8] + mask = 1 << (slot % 8) + m.freq = int(_mem.rx_freq) * 10 + offset = int(_mem.tx_freq) * 10 - m.freq + if _mem.tx_freq.get_raw(asbytes=True) == b'\xFF\xFF\xFF\xFF': + m.offset = 0 + m.duplex = 'off' + elif offset < 0: + m.offset = abs(offset) + m.duplex = '-' + elif offset > 0: + m.offset = offset + m.duplex = '+' + else: + m.offset = 0 + + rxtone = tk8180.KenwoodTKx180Radio._decode_tone( + _mem.rxtone) + txtone = tk8180.KenwoodTKx180Radio._decode_tone( + _mem.txtone) + chirp_common.split_tone_decode(m, txtone, rxtone) + + m.name = str(_mem.name).rstrip() + m.power = POWER_LEVELS[int(_mem.highpower)] + m.mode = 'FM' if _mem.wide else 'NFM' + m.skip = '' if _scn & mask else 'S' + + return m + + def set_memory(self, mem): + index_entry, slot = self.check_index(mem.number) + if mem.empty: + if slot is not None: + self._memobj.memories[slot].set_raw(b'\xFF' * 48) + self.sort_index() + return + if slot is None: + slot = self.next_slot(mem.number) + _mem = self._memobj.memories[slot] + _scn = self._memobj.scanbits[slot // 8] + mask = 1 << (slot % 8) + + # Everything seems to default to 0xFF for "off" + _mem.set_raw(b'\xFF' * 48) + _mem.memory = mem.number + _mem.zone = self._zone + self.sort_index() + _mem.rxsomething = 0x35 + _mem.txsomething = 0x35 + + _mem.rx_freq = mem.freq // 10 + if mem.duplex == '': + _mem.tx_freq = mem.freq // 10 + elif mem.duplex == 'split': + _mem.tx_freq = mem.offset // 10 + elif mem.duplex == 'off': + _mem.tx_freq.set_raw(b'\xFF' * 4) + elif mem.duplex == '-': + _mem.tx_freq = (mem.freq - mem.offset) // 10 + elif mem.duplex == '+': + _mem.tx_freq = (mem.freq + mem.offset) // 10 + else: + raise errors.RadioError('Unsupported duplex mode %r' % mem.duplex) + + txtone, rxtone = chirp_common.split_tone_encode(mem) + _mem.rxtone = tk8180.KenwoodTKx180Radio._encode_tone(*rxtone) + _mem.txtone = tk8180.KenwoodTKx180Radio._encode_tone(*txtone) + + _mem.wide = mem.mode == 'FM' + _mem.highpower = mem.power == POWER_LEVELS[1] + _mem.name = mem.name[:10].ljust(10) + if mem.skip == 'S': + _scn &= ~mask + else: + _scn |= mask + + def load_mmap(self, filename): + if filename.lower().endswith('.dat'): + with open(filename, 'rb') as f: + header = f.read(0x40) + LOG.debug('DAT header:\n%s' % util.hexprint(header)) + self._mmap = memmap.MemoryMapBytes(f.read()) + LOG.info('Loaded DAT file') + self.process_mmap() + else: + super().load_mmap(filename) + + def save_mmap(self, filename): + if filename.lower().endswith('.dat'): + with open(filename, 'wb') as f: + f.write(b'KPG74D\xff\xff\xff\xffV1.10P') + f.write(self._model[1:] + (b'\xff' * 9)) + f.write(b'\xff' * 32) + f.write(self._mmap.get_packed()) + LOG.info('Wrote DAT file') + else: + super().save_mmap(filename) + + @classmethod + def match_model(cls, filedata, filename): + if (filename.lower().endswith('.dat') and + filedata.startswith(b'KPG74D') and + filedata[0xE7:0xEF] == cls._model): + return True + return super().match_model(filedata, filename) + + def get_settings(self): + num_zones = len(self._get_zone_info()) + zones = settings.RadioSettingGroup('zones', 'Zones') + zone_count = settings.RadioSetting( + 'zonecount', 'Number of Zones', + settings.RadioSettingValueInteger(1, 250, num_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 the affected zones!') + zones.append(zone_count) + + keys = tk8160.TKx160Radio.make_key_group(self._memobj.keys, + KEY_NAMES, + KEYS) + + def apply_knob(setting): + rev = {v: k for k, v in KNOB.items()} + self._memobj.knob = rev[str(setting.value)] + + knob = settings.RadioSetting( + 'knob', 'Knob', + settings.RadioSettingValueList( + KNOB.values(), current_index=self._memobj.knob)) + knob.set_apply_callback(apply_knob) + keys.append(knob) + + def apply_battsave(setting): + rev = {v: k for k, v in BATTSAVE.items()} + self._memobj.battsave = rev[str(setting.value)] + + general = settings.RadioSettingGroup('general', 'General') + battsave = settings.RadioSetting( + 'battsave', 'Battery Save', + settings.RadioSettingValueList( + BATTSAVE.values(), + BATTSAVE[int(self._memobj.battsave)])) + battsave.set_apply_callback(apply_battsave) + general.append(battsave) + + return settings.RadioSettings(zones, keys, general) + + def set_settings(self, _settings): + for element in _settings: + if not isinstance(element, settings.RadioSetting): + self.set_settings(element) + elif element.get_name() == 'zonecount': + self._set_num_zones(int(element.value)) + elif element.has_apply_callback(): + element.run_apply_callback() + + +@directory.register +class KenwoodTK2140KRadio(KenwoodTKx140Radio): + MODEL = 'TK-2140K' + _valid_bands = [(136000000, 174000000)] + _model = b'P2140\x04\xFF\xF1' + + +@directory.register +class KenwoodTK3140KRadio(KenwoodTKx140Radio): + MODEL = 'TK-3140K' + _valid_bands = [(400000000, 520000000)] + _model = b'P3140\x06\xFF\xF1' + + +@directory.register +class KenwoodTK3140K2Radio(KenwoodTKx140Radio): + MODEL = 'TK-3140K2' + _valid_bands = [(400000000, 520000000)] + _model = b'P3140\x07\xFF\xF1' + + +@directory.register +class KenwoodTK3140K3Radio(KenwoodTKx140Radio): + MODEL = 'TK-3140K3' + _valid_bands = [(400000000, 520000000)] + _model = b'P3140\x08\xFF\xF1' diff --git a/chirp/drivers/tk760.py b/chirp/drivers/tk760.py index e99371f..f914ab2 100644 --- a/chirp/drivers/tk760.py +++ b/chirp/drivers/tk760.py @@ -17,9 +17,7 @@ from chirp import chirp_common, directory, memmap from chirp import bitwise, errors, util from chirp.settings import RadioSettingGroup, RadioSetting, \ RadioSettingValueBoolean, RadioSettingValueList, \ - RadioSettingValueString, RadioSettingValueInteger, \ - RadioSettings -from textwrap import dedent + RadioSettingValueString, RadioSettings import time import struct @@ -99,29 +97,30 @@ KEYS = { MEM_SIZE = 0x400 BLOCK_SIZE = 8 MEM_BLOCKS = list(range(0, (MEM_SIZE // BLOCK_SIZE))) -ACK_CMD = "\x06" -# from 0.03 up it' s safe -# I have to turn it up, some users reported problems with this, was 0.05 -TIMEOUT = 0.1 +ACK_CMD = b"\x06" +TIMEOUT = 1 POWER_LEVELS = [chirp_common.PowerLevel("Low", watts=1), chirp_common.PowerLevel("High", watts=5)] MODES = ["NFM", "FM"] SKIP_VALUES = ["", "S"] -TONES = chirp_common.TONES -# TONES.remove(254.1) +TONES = list(chirp_common.TONES) +TONES.remove(254.1) DTCS_CODES = chirp_common.DTCS_CODES TOT = ["off"] + ["%s" % x for x in range(30, 330, 30)] VOL = ["off"] + ["%s" % x for x in range(1, 32)] +debug = False + def rawrecv(radio, amount): """Raw read from the radio device""" - data = "" + data = b"" try: data = radio.pipe.read(amount) - # print("<= %02i: %s" % (len(data), util.hexprint(data))) + if debug: + print("<= %02i: %s" % (len(data), util.hexprint(data))) except: raise errors.RadioError("Error reading data from radio") @@ -132,7 +131,8 @@ def rawsend(radio, data): """Raw send to the radio device""" try: radio.pipe.write(data) - # print("=> %02i: %s" % (len(data), util.hexprint(data))) + if debug: + print("=> %02i: %s" % (len(data), util.hexprint(data))) except: raise errors.RadioError("Error sending data from radio") @@ -142,10 +142,10 @@ def send(radio, frame): rawsend(radio, frame) -def make_frame(cmd, addr, data=""): +def make_frame(cmd, addr, data=b""): """Pack the info in the format it likes""" ts = struct.pack(">BHB", ord(cmd), addr, 8) - if data == "": + if data == b"": return ts else: if len(data) == 8: @@ -175,7 +175,6 @@ def recv(radio): if len(rxdata) != 12: raise errors.RadioError( "Received a length of data that is not possible") - return cmd, addr, length = struct.unpack(">BHB", rxdata[0:4]) data = "" @@ -189,50 +188,43 @@ def open_radio(radio): """Open the radio into program mode and check if it's the correct model""" # Set serial discipline try: + radio.pipe.baudrate = 9600 radio.pipe.parity = "N" - radio.pipe.timeout = TIMEOUT - radio.pipe.flush() + radio.pipe.timeout = 0.5 LOG.debug("Serial port open successful") except: msg = "Serial error: Can't set serial line discipline" raise errors.RadioError(msg) - magic = "PROGRAM" + magic = b"PROGRAM" LOG.debug("Sending MAGIC") exito = False - # it appears that some buggy interfaces/serial devices keep sending - # data in the RX line, we will try to catch this garbage here + # The radio sends a continuous stream of 0xFF while idling in normal + # operating mode. Chew those up so we can pace it below. devnull = rawrecv(radio, 256) - for i in range(0, 5): - LOG.debug("Try %i" % i) - for i in range(0, len(magic)): - ack = rawrecv(radio, 1) - time.sleep(0.05) - send(radio, magic[i]) - - try: - handshake(radio, "Radio not entering Program mode") - LOG.debug("Radio opened for programming") - exito = True - break - except: - LOG.debug("No go, next try") - pass - - # validate the success - if exito is False: - msg = "Radio refuse to enter into program mode after a few tries" - raise errors.RadioError(msg) - - rawsend(radio, "\x02") + # "Pace" the radio's output by sending one byte of the magic string for + # every 0xFF we get from the radio + for b in magic: + rawrecv(radio, 1) + rawsend(radio, bytes([b])) + + # Read more than we need here because we may have received additional bytes + # in between the flush and the start of the magic. Consider it successful + # if we see ACK anywhere in the response + resp = rawrecv(radio, 256) + if ACK_CMD not in resp: + raise errors.RadioError('Radio did not respond to program mode') + + # 0x02 Means "show me your ident" + rawsend(radio, b"\x02") ident = rawrecv(radio, 8) # validate the input if len(ident) != 8: LOG.debug("Wrong ID, get only %s bytes, we expect 8" % len(ident)) - LOG.debug(hexprint(ident)) + LOG.debug(util.hexprint(ident)) msg = "Bad ID received, just %s bytes, we want 8" % len(ident) raise errors.RadioError(msg) @@ -257,14 +249,14 @@ def do_download(radio): # UI progress status = chirp_common.Status() status.cur = 0 - status.max = MEM_SIZE / BLOCK_SIZE + status.max = MEM_SIZE // BLOCK_SIZE status.msg = "Cloning from radio..." radio.status_fn(status) - data = "" - LOG.debug("Starting the downolad") + data = b"" + LOG.debug("Starting the download") for addr in MEM_BLOCKS: - send(radio, make_frame("R", addr * BLOCK_SIZE)) + send(radio, make_frame(b"R", addr * BLOCK_SIZE)) data += recv(radio) handshake(radio, "Rx error in block %03i" % addr, True) LOG.debug("Block: %04x, Pos: %06x" % (addr, addr * BLOCK_SIZE)) @@ -274,7 +266,7 @@ def do_download(radio): status.msg = "Cloning from radio..." radio.status_fn(status) - return memmap.MemoryMap(data) + return memmap.MemoryMapBytes(data) def do_upload(radio): @@ -284,7 +276,7 @@ def do_upload(radio): # UI progress status = chirp_common.Status() status.cur = 0 - status.max = MEM_SIZE / BLOCK_SIZE + status.max = MEM_SIZE // BLOCK_SIZE status.msg = "Cloning to radio..." radio.status_fn(status) count = 0 @@ -301,7 +293,7 @@ def do_upload(radio): continue data = radio.get_mmap()[pos:pos + BLOCK_SIZE] - send(radio, make_frame("W", pos, data)) + send(radio, make_frame(b"W", pos, data)) LOG.debug("Block: %04x, Pos: %06x" % (addr, pos)) time.sleep(0.1) @@ -321,8 +313,8 @@ def model_match(cls, data): """Match the opened/downloaded image to the correct version""" rid = get_rid(data) - # DEBUG - # print("Full ident string is %s" % util.hexprint(rid)) + if debug: + print("Full ident string is %s" % util.hexprint(rid)) if (rid in cls.VARIANTS): # correct model @@ -339,36 +331,25 @@ class Kenwood_M60_Radio(chirp_common.CloneModeRadio, _upper = 32 VARIANT = "" MODEL = "" + NEEDS_COMPAT_SERIAL = False @classmethod def get_prompts(cls): rp = chirp_common.RadioPrompts() rp.experimental = \ - ('This driver is experimental; not all features have been ' - 'implemented, but it has those features most used by hams.\n' - '\n' - 'This radios are able to work slightly outside the OEM ' - 'frequency limits. After testing, the limit in Chirp has ' - 'been set 4% outside the OEM limit. This allows you to use ' - 'some models on the ham bands.\n' - '\n' - 'Nevertheless, each radio has its own hardware limits and ' - 'your mileage may vary.\n' - ) - rp.pre_download = _(dedent("""\ - Follow this instructions to read your radio: - 1 - Turn off your radio - 2 - Connect your interface cable - 3 - Turn on your radio - 4 - Do the download of your radio data - """)) - rp.pre_upload = _(dedent("""\ - Follow this instructions to write your radio: - 1 - Turn off your radio - 2 - Connect your interface cable - 3 - Turn on your radio - 4 - Do the upload of your radio data - """)) + 'This driver is experimental: Use at your own risk!' + rp.pre_download = _( + "Follow these instructions to read your radio:\n" + "1 - Turn off your radio\n" + "2 - Connect your interface cable\n" + "3 - Turn on your radio\n" + "4 - Click OK to start\n") + rp.pre_upload = _( + "Follow these instructions to write your radio:\n" + "1 - Turn off your radio\n" + "2 - Connect your interface cable\n" + "3 - Turn on your radio\n" + "4 - Click OK to start\n") return rp def get_features(self): @@ -405,7 +386,12 @@ class Kenwood_M60_Radio(chirp_common.CloneModeRadio, def sync_in(self): """Download from radio""" - self._mmap = do_download(self) + try: + self._mmap = do_download(self) + except Exception as e: + LOG.exception('Failed to download: %s', e) + rawsend(self, b'E') + raise errors.RadioError('Error downloading from radio') self.process_mmap() def sync_out(self): @@ -413,13 +399,16 @@ class Kenwood_M60_Radio(chirp_common.CloneModeRadio, # Get the data ready for upload try: self._prep_data() - except: + except Exception as e: + LOG.exception('Failed to prep data: %s', e) raise errors.RadioError("Error processing the radio data") # do the upload try: do_upload(self) - except: + except Exception as e: + LOG.exception('Failed to upload: %s', e) + rawsend(self, b'E') raise errors.RadioError("Error uploading data to radio") def set_variant(self): @@ -427,7 +416,7 @@ class Kenwood_M60_Radio(chirp_common.CloneModeRadio, to the correct variant of the radio""" rid = get_rid(self._mmap) - # identify the radio variant and set the environment to it's values + # identify the radio variant and set the environment to its values try: self._upper, low, high, self._kind = self.VARIANTS[rid] @@ -461,14 +450,13 @@ class Kenwood_M60_Radio(chirp_common.CloneModeRadio, # The x0200 area has the settings for the DTMF/2-Tone per channel, # as by default any of this radios has the DTMF IC installed; # we clean this areas - fldata = "\x00\xf0\xff\xff\xff" * achs + \ - "\xff" * (5 * (self._upper - achs)) + fldata = b"\x00\xf0\xff\xff\xff" * achs + \ + b"\xff" * (5 * (self._upper - achs)) self._fill(0x0200, fldata) def _fill(self, offset, data): """Fill an specified area of the memmap with the passed data""" - for addr in range(0, len(data)): - self._mmap[offset + addr] = data[addr] + self._mmap[offset] = data def process_mmap(self): """Process the mem map into the mem object""" @@ -570,7 +558,7 @@ class Kenwood_M60_Radio(chirp_common.CloneModeRadio, if _mem.get_raw()[0] == "\xFF" or not self.get_active(number - 1): mem.empty = True - # but is not enough, you have to crear the memory in the mmap + # but is not enough, you have to clear the memory in the mmap # to get it ready for the sync_out process _mem.set_raw("\xFF" * 8) return mem @@ -810,10 +798,10 @@ class Kenwood_M60_Radio(chirp_common.CloneModeRadio, class TK760_Radio(Kenwood_M60_Radio): """Kenwood TK-760 Radios""" MODEL = "TK-760" - TYPE = "M0760" + TYPE = b"M0760" VARIANTS = { - "M0760\x01\x00\x00": (32, 136, 156, "K2"), - "M0760\x00\x00\x00": (32, 148, 174, "K") + b"M0760\x01\x00\x00": (32, 136, 156, "K2"), + b"M0760\x00\x00\x00": (32, 148, 174, "K") } @@ -821,10 +809,10 @@ class TK760_Radio(Kenwood_M60_Radio): class TK762_Radio(Kenwood_M60_Radio): """Kenwood TK-762 Radios""" MODEL = "TK-762" - TYPE = "M0762" + TYPE = b"M0762" VARIANTS = { - "M0762\x01\x00\x00": (2, 136, 156, "K2"), - "M0762\x00\x00\x00": (2, 148, 174, "K") + b"M0762\x01\x00\x00": (2, 136, 156, "K2"), + b"M0762\x00\x00\x00": (2, 148, 174, "K") } @@ -832,10 +820,10 @@ class TK762_Radio(Kenwood_M60_Radio): class TK768_Radio(Kenwood_M60_Radio): """Kenwood TK-768 Radios""" MODEL = "TK-768" - TYPE = "M0768" + TYPE = b"M0768" VARIANTS = { - "M0768\x21\x00\x00": (32, 136, 156, "K2"), - "M0768\x20\x00\x00": (32, 148, 174, "K") + b"M0768\x21\x00\x00": (32, 136, 156, "K2"), + b"M0768\x20\x00\x00": (32, 148, 174, "K") } @@ -843,12 +831,12 @@ class TK768_Radio(Kenwood_M60_Radio): class TK860_Radio(Kenwood_M60_Radio): """Kenwood TK-860 Radios""" MODEL = "TK-860" - TYPE = "M0860" + TYPE = b"M0860" VARIANTS = { - "M0860\x05\x00\x00": (32, 406, 430, "F4"), - "M0860\x04\x00\x00": (32, 488, 512, "F3"), - "M0860\x03\x00\x00": (32, 470, 496, "F2"), - "M0860\x02\x00\x00": (32, 450, 476, "F1") + b"M0860\x05\x00\x00": (32, 406, 430, "F4"), + b"M0860\x04\x00\x00": (32, 488, 512, "F3"), + b"M0860\x03\x00\x00": (32, 470, 496, "F2"), + b"M0860\x02\x00\x00": (32, 450, 476, "F1") } @@ -856,12 +844,12 @@ class TK860_Radio(Kenwood_M60_Radio): class TK862_Radio(Kenwood_M60_Radio): """Kenwood TK-862 Radios""" MODEL = "TK-862" - TYPE = "M0862" + TYPE = b"M0862" VARIANTS = { - "M0862\x05\x00\x00": (2, 406, 430, "F4"), - "M0862\x04\x00\x00": (2, 488, 512, "F3"), - "M0862\x03\x00\x00": (2, 470, 496, "F2"), - "M0862\x02\x00\x00": (2, 450, 476, "F1") + b"M0862\x05\x00\x00": (2, 406, 430, "F4"), + b"M0862\x04\x00\x00": (2, 488, 512, "F3"), + b"M0862\x03\x00\x00": (2, 470, 496, "F2"), + b"M0862\x02\x00\x00": (2, 450, 476, "F1") } @@ -869,10 +857,10 @@ class TK862_Radio(Kenwood_M60_Radio): class TK868_Radio(Kenwood_M60_Radio): """Kenwood TK-868 Radios""" MODEL = "TK-868" - TYPE = "M0868" + TYPE = b"M0868" VARIANTS = { - "M0868\x25\x00\x00": (32, 406, 430, "F4"), - "M0868\x24\x00\x00": (32, 488, 512, "F3"), - "M0868\x23\x00\x00": (32, 470, 496, "F2"), - "M0868\x22\x00\x00": (32, 450, 476, "F1") + b"M0868\x25\x00\x00": (32, 406, 430, "F4"), + b"M0868\x24\x00\x00": (32, 488, 512, "F3"), + b"M0868\x23\x00\x00": (32, 470, 496, "F2"), + b"M0868\x22\x00\x00": (32, 450, 476, "F1") } diff --git a/chirp/drivers/tk760g.py b/chirp/drivers/tk760g.py index e12b79b..858010b 100644 --- a/chirp/drivers/tk760g.py +++ b/chirp/drivers/tk760g.py @@ -16,10 +16,8 @@ import logging import struct import time -import sys from chirp import chirp_common, directory, memmap, errors, util, bitwise -from textwrap import dedent from chirp.settings import RadioSettingGroup, RadioSetting, \ RadioSettingValueBoolean, RadioSettingValueList, \ RadioSettingValueString, RadioSettingValueInteger, \ @@ -27,11 +25,11 @@ from chirp.settings import RadioSettingGroup, RadioSetting, \ LOG = logging.getLogger(__name__) -##### IMPORTANT DATA ########################################## +# #### IMPORTANT DATA ########################################## # This radios have a span of # 0x00000 - 0x08000 => Radio Memory / Settings data # 0x08000 - 0x10000 => FIRMWARE... hum... -############################################################### +# ############################################################## MEM_FORMAT = """ #seekto 0x0000; @@ -87,7 +85,7 @@ struct { u8 unknown20[4]; // x8c-x8f // -- u8 unknown21[4]; // x90-x93 - char poweronmesg[8]; // x94-x9b power on mesg 8 bytes, off is "\FF" * 8 + char poweronmesg[8]; // x94-x9b power on mesg 8 bytes, off is "\xFF" * 8 u8 unknown22[4]; // x9c-x9f // -- u8 unknown23[7]; // xa0-xa6 @@ -267,16 +265,16 @@ BLOCKS = MEM_SIZE // BLOCK_SIZE MEM_BLOCKS = list(range(0, BLOCKS)) # define and empty block of data, as it will be used a lot in this code -EMPTY_BLOCK = "\xFF" * 256 +EMPTY_BLOCK = b"\xFF" * 256 RO_BLOCKS = list(range(0x10, 0x1F)) + list(range(0x59, 0x5f)) -ACK_CMD = "\x06" +ACK_CMD = b"\x06" POWER_LEVELS = [chirp_common.PowerLevel("Low", watts=1), chirp_common.PowerLevel("High", watts=5)] -MODES = ["NFM", "FM"] # 12.5 / 25 Khz -VALID_CHARS = chirp_common.CHARSET_UPPER_NUMERIC + "_-*()/\-+=)" +MODES = ["NFM", "FM"] # 12.5 / 25 kHz +VALID_CHARS = chirp_common.CHARSET_UPPER_NUMERIC + r"_-*()/\-+=)" SKIP_VALUES = ["", "S"] TONES = chirp_common.TONES @@ -292,8 +290,8 @@ TVOL = ["%s" % x for x in range(0, 33)] TVOL[32] = "Continuous" SQL = ["off"] + ["%s" % x for x in range(1, 10)] -## BOT = 0, EOT = 1, Both = 2, NONE = 3 -#PTTID = ["BOT", "EOT", "Both", "none"] +# BOT = 0, EOT = 1, Both = 2, NONE = 3 +# PTTID = ["BOT", "EOT", "Both", "none"] # For debugging purposes debug = False @@ -321,7 +319,7 @@ KEYS = { 0x48: "Scan del/add", 0x4a: "GROUP down", 0x4b: "GROUP up", - #0x4e: "Tone off (Experimental)", # undocumented !!!! + # 0x4e: "Tone off (Experimental)", # undocumented !!!! 0x4f: "None", 0x50: "VOL down", 0x51: "VOL up", @@ -333,7 +331,6 @@ KEYS = { def _raw_recv(radio, amount): """Raw read from the radio device""" - data = "" try: data = radio.pipe.read(amount) except: @@ -360,22 +357,17 @@ def _raw_send(radio, data): def _close_radio(radio): """Get the radio out of program mode""" - _raw_send(radio, "\x45") + _raw_send(radio, b"E") def _checksum(data): """the radio block checksum algorithm""" cs = 0 for byte in data: - cs += ord(byte) + cs += byte return cs % 256 -def _send(radio, frame): - """Generic send data to the radio""" - _raw_send(radio, frame) - - def _make_frame(cmd, addr): """Pack the info in the format it likes""" return struct.pack(">BH", ord(cmd), addr) @@ -404,7 +396,7 @@ def _check_write_ack(r, ack, addr): return True # Explicit BAD checksum - if ack == "\x15": + if ack == b"\x15": _close_radio(r) raise errors.RadioError( "Bad checksum in block %02x write" % addr) @@ -417,26 +409,27 @@ def _check_write_ack(r, ack, addr): def _recv(radio): - """Receive data from the radio, 258 bytes split in (cmd, data, checksum) - checking the checksum to be correct, and returning just - 256 bytes of data or false if short empty block""" - rxdata = _raw_recv(radio, BLOCK_SIZE + 2) + """Receive a single block from the radio""" + + cmd = _raw_recv(radio, 1) # when the RX block has two bytes and the first is \x5A # then the block is all \xFF - if len(rxdata) == 2 and rxdata[0] == "\x5A": - # fast work in linux has to make the handshake, slow windows don't - if not sys.platform in ["win32", "cygwin"]: - _handshake(radio, "short block") - return False - elif len(rxdata) != 258: - # not the amount of data we want - msg = "The radio send %d bytes, we need 258" % len(rxdata) - # DEBUG - LOG.error(msg) - raise errors.RadioError(msg) + if not cmd: + raise errors.RadioError('No response from radio') + elif cmd == b'Z': + # Empty "zero" block + ff = _raw_recv(radio, 1) + _handshake(radio, "after zero block") + return b'\xff' * 256 + elif cmd != b'W': + LOG.error('Got non-W command:') + rxdata = _raw_recv(radio, BLOCK_SIZE + 1) + LOG.error(util.hexprint(rxdata)) + raise errors.RadioError('Received unexpected response from radio') else: - rcs = ord(rxdata[-1]) - data = rxdata[1:-1] + rxdata = _raw_recv(radio, BLOCK_SIZE + 1) + rcs = rxdata[-1] + data = rxdata[:-1] ccs = _checksum(data) if rcs != ccs: @@ -452,7 +445,7 @@ def _recv(radio): def _open_radio(radio, status): """Open the radio into program mode and check if it's the correct model""" # linux min is 0.13, win min is 0.25; set to bigger to be safe - radio.pipe.timeout = 0.4 + radio.pipe.timeout = 1 radio.pipe.parity = "E" # DEBUG @@ -465,33 +458,17 @@ def _open_radio(radio, status): status.max = tries status.msg = "Entering program mode..." - # try a few times to get the radio into program mode - exito = False - for i in range(0, tries): - _raw_send(radio, "PROGRAM") - ack = _raw_recv(radio, 1) - - if ack != ACK_CMD: - # DEBUG - LOG.debug("Try %s failed, traying again..." % i) - time.sleep(0.25) - else: - exito = True - break - - status.cur += 1 - radio.status_fn(status) - - - if exito is False: + _raw_send(radio, b"PROGRAM") + ack = _raw_recv(radio, 1) + if ack != ACK_CMD: _close_radio(radio) - LOG.debug("Radio did not accepted PROGRAM command in %s attempts" % tries) - raise errors.RadioError("The radio doesn't accept program mode") + LOG.debug("Radio did not accept PROGRAM command") + raise errors.RadioError("The radio did not start program mode") # DEBUG LOG.debug("Received ACK to the PROGRAM command, send ID query.") - _raw_send(radio, "\x02") + _raw_send(radio, b"\x02") rid = _raw_recv(radio, 8) if not (radio.TYPE in rid): @@ -504,7 +481,7 @@ def _open_radio(radio, status): raise errors.RadioError( "Incorrect model ID, got %s, it not contains %s" % - (rid.strip("\xff"), radio.TYPE)) + (rid.strip(b"\xff"), radio.TYPE)) # DEBUG LOG.debug("Full ident string is:") @@ -521,7 +498,7 @@ def do_download(radio): """ The download function """ # UI progress status = chirp_common.Status() - data = "" + data = b"" count = 0 # open the radio @@ -529,34 +506,22 @@ def do_download(radio): # reset UI data status.cur = 0 - status.max = MEM_SIZE / 256 + status.max = MEM_SIZE // 256 status.msg = "Cloning from radio..." radio.status_fn(status) - # set the timeout and if windows keep it bigger - if sys.platform in ["win32", "cygwin"]: - # bigger timeout - radio.pipe.timeout = 0.55 - else: - # Linux can keep up, MAC? - radio.pipe.timeout = 0.05 - # DEBUG LOG.debug("Starting the download from radio") for addr in MEM_BLOCKS: # send request, but before flush the rx buffer radio.pipe.flush() - _send(radio, _make_frame("R", addr)) + _raw_send(radio, _make_frame("R", addr)) - # now we get the data - d = _recv(radio) - # if empty block, it return false - # aka we assume a empty 256 xFF block - if d is False: - d = EMPTY_BLOCK + time.sleep(0.1) - data += d + # now we get the data + data += _recv(radio) # UI Update status.cur = count @@ -565,14 +530,14 @@ def do_download(radio): count += 1 _close_radio(radio) - return memmap.MemoryMap(data) + return memmap.MemoryMapBytes(data) def do_upload(radio): """ The upload function """ # UI progress status = chirp_common.Status() - data = "" + data = b"" count = 0 # open the radio @@ -580,13 +545,10 @@ def do_upload(radio): # update UI status.cur = 0 - status.max = MEM_SIZE / 256 + status.max = MEM_SIZE // 256 status.msg = "Cloning to radio..." radio.status_fn(status) - # the default for the original soft as measured - radio.pipe.timeout = 0.5 - # DEBUG LOG.debug("Starting the upload to the radio") @@ -597,7 +559,7 @@ def do_upload(radio): data = radio.get_mmap()[raddr:raddr+BLOCK_SIZE] # The blocks from x59-x5F are NOT programmable - # The blocks from x11-x1F are writed only if not empty + # The blocks from x11-x1F are written only if not empty if addr in RO_BLOCKS: # checking if in the range of optional blocks if addr >= 0x10 and addr <= 0x1F: @@ -614,12 +576,12 @@ def do_upload(radio): continue if data == EMPTY_BLOCK: - frame = _make_frame("Z", addr) + "\xFF" + frame = _make_frame(b"Z", addr) + b"\xFF" else: cs = _checksum(data) - frame = _make_frame("W", addr) + data + chr(cs) + frame = _make_frame(b"W", addr) + data + bytes([cs]) - _send(radio, frame) + _raw_send(radio, frame) # get the ACK ack = _raw_recv(radio, 1) @@ -641,7 +603,7 @@ def do_upload(radio): def model_match(cls, data): """Match the opened/downloaded image to the correct version""" rid = data[0xA7:0xAE] - if (rid in cls.VARIANTS): + if rid in cls.VARIANTS: # correct model return True else: @@ -649,7 +611,7 @@ def model_match(cls, data): class Kenwood60GBankModel(chirp_common.BankModel): - """Testing the bank model on kennwood""" + """Testing the bank model on Kenwood""" channelAlwaysHasBank = True def get_num_mappings(self): @@ -673,7 +635,7 @@ class Kenwood60GBankModel(chirp_common.BankModel): (memory.number, bank)) # We can't "Remove" it for good - # the kenwood paradigm don't allow it + # the Kenwood paradigm doesn't allow it # instead we move it to bank 0 self._radio._set_bank(memory.number, 0) @@ -690,13 +652,14 @@ class Kenwood60GBankModel(chirp_common.BankModel): class memBank(chirp_common.Bank): - """A bank model for kenwood""" + """A bank model for Kenwood""" # Integral index of the bank (not to be confused with per-memory # bank indexes index = 0 -class Kenwood_Serie_60G(chirp_common.CloneModeRadio, chirp_common.ExperimentalRadio): +class Kenwood_Serie_60G(chirp_common.CloneModeRadio, + chirp_common.ExperimentalRadio): """Kenwood Series 60G Radios base class""" VENDOR = "Kenwood" BAUD_RATE = 9600 @@ -710,36 +673,25 @@ class Kenwood_Serie_60G(chirp_common.CloneModeRadio, chirp_common.ExperimentalRa _kind = "" VARIANT = "" MODEL = "" + NEEDS_COMPAT_SERIAL = False @classmethod def get_prompts(cls): rp = chirp_common.RadioPrompts() rp.experimental = \ - ('This driver is experimental; not all features have been ' - 'implemented, but it has those features most used by hams.\n' - '\n' - 'This radios are able to work slightly outside the OEM ' - 'frequency limits. After testing, the limit in Chirp has ' - 'been set 4% outside the OEM limit. This allows you to use ' - 'some models on the ham bands.\n' - '\n' - 'Nevertheless, each radio has its own hardware limits and ' - 'your mileage may vary.\n' - ) - rp.pre_download = _(dedent("""\ - Follow this instructions to download your info: - 1 - Turn off your radio - 2 - Connect your interface cable - 3 - Turn on your radio (unblock it if password protected) - 4 - Do the download of your radio data - """)) - rp.pre_upload = _(dedent("""\ - Follow this instructions to upload your info: - 1 - Turn off your radio - 2 - Connect your interface cable - 3 - Turn on your radio (unblock it if password protected) - 4 - Do the upload of your radio data - """)) + 'This driver is experimental: Use at your own risk! ' + rp.pre_download = _( + "Follow these instructions to download your radio:\n" + "1 - Turn off your radio\n" + "2 - Connect your interface cable\n" + "3 - Turn on your radio (unlock it if password protected)\n" + "4 - Click OK to start\n") + rp.pre_upload = _( + "Follow these instructions to upload your radio:\n" + "1 - Turn off your radio\n" + "2 - Connect your interface cable\n" + "3 - Turn on your radio (unlock it if password protected)\n" + "4 - Click OK to start\n") return rp def get_features(self): @@ -774,13 +726,12 @@ class Kenwood_Serie_60G(chirp_common.CloneModeRadio, chirp_common.ExperimentalRa rf.valid_bands = [self._range] rf.valid_name_length = 8 rf.memory_bounds = (1, self._upper) - rf.valid_tuning_steps = [1., 2.5, 5., 6.25, 12.5] + rf.valid_tuning_steps = [1.0, 2.5, 5.0, 6.25, 12.5] return rf def _fill(self, offset, data): """Fill an specified area of the memmap with the passed data""" - for addr in range(0, len(data)): - self._mmap[offset + addr] = data[addr] + self._mmap[offset] = data def _prep_data(self): """Prepare the areas in the memmap to do a consistent write @@ -811,7 +762,7 @@ class Kenwood_Serie_60G(chirp_common.CloneModeRadio, chirp_common.ExperimentalRa self._memobj.settings.banks = len(data) # building the data for the memmap - fdata = "" + fdata = b"" for k, v in data.items(): # possible bad data @@ -822,11 +773,11 @@ class Kenwood_Serie_60G(chirp_common.CloneModeRadio, chirp_common.ExperimentalRa Trying to fix this, review your bank data!" % k) c = 1 for i in v: - fdata += chr(k) + chr(c) + chr(k - 1) + chr(i) + fdata += bytes([k, c, k - 1, i]) c = c + 1 # fill to match a full 256 bytes block - fdata += (len(fdata) % 256) * "\xFF" + fdata += (len(fdata) % 256) * b"\xFF" # updating the data in the memmap [x300] self._fill(0x300, fdata) @@ -834,14 +785,14 @@ class Kenwood_Serie_60G(chirp_common.CloneModeRadio, chirp_common.ExperimentalRa # update the info in x1000; it has 2 bytes with # x00 = bank , x01 = bank's channel count # the rest of the 14 bytes are \xff - bdata = "" + bdata = b"" for i in range(1, len(data) + 1): - line = chr(i) + chr(len(data[i])) - line += "\xff" * 14 + line = bytes([i, len(data[i])]) + line += b"\xff" * 14 bdata += line # fill to match a full 256 bytes block - bdata += (256 - (len(bdata)) % 256) * "\xFF" + bdata += (256 - (len(bdata)) % 256) * b"\xFF" # fill to match the whole area bdata += (16 - len(bdata) // 256) * EMPTY_BLOCK @@ -851,8 +802,8 @@ class Kenwood_Serie_60G(chirp_common.CloneModeRadio, chirp_common.ExperimentalRa # DTMF id for each channel, 5 bytes lbcd at x7000 # ############## TODO ################### - fldata = "\x00\xf0\xff\xff\xff" * self._chs_progs + \ - "\xff" * (5 * (self._upper - self._chs_progs)) + fldata = b"\x00\xf0\xff\xff\xff" * self._chs_progs + \ + b"\xff" * (5 * (self._upper - self._chs_progs)) # write it # updating the data in the memmap [x7000] @@ -863,7 +814,7 @@ class Kenwood_Serie_60G(chirp_common.CloneModeRadio, chirp_common.ExperimentalRa to the correct variant of the radio""" rid = self._mmap[0xA7:0xAE] - # identify the radio variant and set the environment to it's values + # identify the radio variant and set the environment to its values try: self._upper, low, high, self._kind = self.VARIANTS[rid] @@ -871,9 +822,10 @@ class Kenwood_Serie_60G(chirp_common.CloneModeRadio, chirp_common.ExperimentalRa # ham bands, even if they are outside the OEM ranges. # By experimentation we found that 4% at the edges is in most # cases safe and will cover the near ham bands in full - self._range = [low * 1000000 * 0.96, high * 1000000 * 1.04] + self._range = [int(low * 1000000 * 0.96), + int(high * 1000000 * 1.04)] - # setting the bank data in the features, 8 & 16 CH dont have banks + # setting the bank data in the features, 8 & 16 CH don't have banks if self._upper < 32: rf = chirp_common.RadioFeatures() rf.has_bank = False @@ -889,7 +841,6 @@ class Kenwood_Serie_60G(chirp_common.CloneModeRadio, chirp_common.ExperimentalRa LOG.debug(util.hexprint(rid)) raise errors.RadioError( "Wrong Kenwood radio, ID or unknown variant, see LOG output.") - return False def sync_in(self): """Do a download of the radio eeprom""" @@ -900,7 +851,7 @@ class Kenwood_Serie_60G(chirp_common.CloneModeRadio, chirp_common.ExperimentalRa """Do an upload to the radio eeprom""" # chirp signature on the eprom ;-) - sign = "Chirp" + sign = b"Chirp" self._fill(0xbb, sign) try: @@ -925,7 +876,7 @@ class Kenwood_Serie_60G(chirp_common.CloneModeRadio, chirp_common.ExperimentalRa def get_raw_memory(self, number): """Return a raw representation of the memory object, which is very helpful for development""" - return repr(self._memobj.memory[number]) + return repr(self._memobj.memory[number - 1]) def _decode_tone(self, val): """Parse the tone data to decode from mem, it returns: @@ -990,13 +941,9 @@ class Kenwood_Serie_60G(chirp_common.CloneModeRadio, chirp_common.ExperimentalRa # Memory number mem.number = number - # this radio has a setting about the amount of real chans of the 128 - # olso in the channel has xff on the Rx freq it's empty - if (number > (self._chs_progs + 1)) or (_mem.get_raw()[0] == "\xFF"): + # A "blank" rxfreq is the indication of an empty memory + if _mem.rxfreq[0].get_raw() == '\xFF': mem.empty = True - # but is not enough, you have to crear the memory in the mmap - # to get it ready for the sync_out process - _mem.set_raw("\xFF" * 48) return mem # Freq and offset @@ -1019,7 +966,7 @@ class Kenwood_Serie_60G(chirp_common.CloneModeRadio, chirp_common.ExperimentalRa mem.offset = 0 # name TAG of the channel - mem.name = str(_mem.name).rstrip() + mem.name = str(_mem.name).rstrip(' \xff') # power mem.power = POWER_LEVELS[_mem.power] @@ -1045,7 +992,7 @@ class Kenwood_Serie_60G(chirp_common.CloneModeRadio, chirp_common.ExperimentalRa if b > 127 or b == 0: _mem.bank = b = 1 - bank = RadioSetting("bank", "Bank it belongs", + bank = RadioSetting("bank", "Bank", RadioSettingValueInteger(1, 128, b)) mem.extra.append(bank) @@ -1053,7 +1000,7 @@ class Kenwood_Serie_60G(chirp_common.CloneModeRadio, chirp_common.ExperimentalRa if int(_mem.bnumb) > 127: _mem.bank = mem.number - bnumb = RadioSetting("bnumb", "Ch number in the bank", + bnumb = RadioSetting("bnumb", "Bank index", RadioSettingValueInteger(0, 127, _mem.bnumb)) mem.extra.append(bnumb) @@ -1182,7 +1129,7 @@ class Kenwood_Serie_60G(chirp_common.CloneModeRadio, chirp_common.ExperimentalRa # TODO / PLANNED # adjust feqs - #freqs = RadioSettingGroup("freqs", "Adjust Frequencies") + # freqs = RadioSettingGroup("freqs", "Adjust Frequencies") top = RadioSettings(basic, dealer, fkeys) @@ -1225,9 +1172,9 @@ class Kenwood_Serie_60G(chirp_common.CloneModeRadio, chirp_common.ExperimentalRa SQL, current_index=sett.sql_level)) basic.append(sql) - #c2t = RadioSetting("settings.c2t", "Clear to Transpond", - #RadioSettingValueBoolean(not sett.c2t)) - #basic.append(c2t) + # c2t = RadioSetting("settings.c2t", "Clear to Transpond", + # RadioSettingValueBoolean(not sett.c2t)) + # basic.append(c2t) ptone = RadioSetting("settings.poweron_tone", "Power On tone", RadioSettingValueBoolean(sett.poweron_tone)) @@ -1276,7 +1223,7 @@ class Kenwood_Serie_60G(chirp_common.CloneModeRadio, chirp_common.ExperimentalRa l1 = str(mess.line1).strip(" \xff") line1 = RadioSetting("message.line1", "Comment 1", - RadioSettingValueString(0, 32, l1)) + RadioSettingValueString(0, 32, l1)) dealer.append(line1) l2 = str(mess.line2).strip(" \xff") @@ -1324,16 +1271,16 @@ class Kenwood_Serie_60G(chirp_common.CloneModeRadio, chirp_common.ExperimentalRa fkeys.append(chd) foot = RadioSetting("keys.kFOOT", "Foot switch", - RadioSettingValueList(KEYS.values(), - KEYS[int(keys.kFOOT)])) + RadioSettingValueList(KEYS.values(), + KEYS[int(keys.kFOOT)])) fkeys.append(foot) # this is the common buttons for all # 260G model don't have the front keys - if not "P2600" in self.TYPE: + if b"P2600" not in self.TYPE: scn_name = "SCN" - if self.TYPE[0] == "P": + if self.TYPE[0] == b"P": scn_name = "Open Circle" scn = RadioSetting("keys.kSCN", scn_name, @@ -1342,7 +1289,7 @@ class Kenwood_Serie_60G(chirp_common.CloneModeRadio, chirp_common.ExperimentalRa fkeys.append(scn) a_name = "A" - if self.TYPE[0] == "P": + if self.TYPE[0] == b"P": a_name = "Closed circle" a = RadioSetting("keys.kA", a_name, @@ -1351,7 +1298,7 @@ class Kenwood_Serie_60G(chirp_common.CloneModeRadio, chirp_common.ExperimentalRa fkeys.append(a) da_name = "D/A" - if self.TYPE[0] == "P": + if self.TYPE[0] == b"P": da_name = "< key" da = RadioSetting("keys.kDA", da_name, @@ -1360,7 +1307,7 @@ class Kenwood_Serie_60G(chirp_common.CloneModeRadio, chirp_common.ExperimentalRa fkeys.append(da) gu_name = "Triangle up" - if self.TYPE[0] == "P": + if self.TYPE[0] == b"P": gu_name = "Side 1" gu = RadioSetting("keys.kGROUP_UP", gu_name, @@ -1370,7 +1317,7 @@ class Kenwood_Serie_60G(chirp_common.CloneModeRadio, chirp_common.ExperimentalRa # Side keys on portables gd_name = "Triangle Down" - if self.TYPE[0] == "P": + if self.TYPE[0] == b"P": gd_name = "> key" gd = RadioSetting("keys.kGROUP_DOWN", gd_name, @@ -1379,7 +1326,7 @@ class Kenwood_Serie_60G(chirp_common.CloneModeRadio, chirp_common.ExperimentalRa fkeys.append(gd) mon_name = "MON" - if self.TYPE[0] == "P": + if self.TYPE[0] == b"P": mon_name = "Side 2" mon = RadioSetting("keys.kMON", mon_name, @@ -1468,7 +1415,8 @@ class Kenwood_Serie_60G(chirp_common.CloneModeRadio, chirp_common.ExperimentalRa # case keys, with special config if inter == "keys": - value = list(KEYS.keys())[list(KEYS.values()).index(str(value))] + value = list(KEYS.keys())[list(KEYS.values()).index( + str(value))] # Apply al configs done setattr(obj, setting, value) @@ -1529,12 +1477,12 @@ class Kenwood_Serie_60G(chirp_common.CloneModeRadio, chirp_common.ExperimentalRa class TK868G_Radios(Kenwood_Serie_60G): """Kenwood TK-868G Radio M/C""" MODEL = "TK-868G" - TYPE = "M8680" + TYPE = b"M8680" VARIANTS = { - "M8680\x18\xff": (8, 400, 490, "M"), - "M8680;\xff": (128, 350, 390, "C1"), - "M86808\xff": (128, 400, 430, "C2"), - "M86806\xff": (128, 450, 490, "C3"), + b"M8680\x18\xff": (8, 400, 490, "M"), + b"M8680;\xff": (128, 350, 390, "C1"), + b"M86808\xff": (128, 400, 430, "C2"), + b"M86806\xff": (128, 450, 490, "C3"), } @@ -1542,12 +1490,12 @@ class TK868G_Radios(Kenwood_Serie_60G): class TK862G_Radios(Kenwood_Serie_60G): """Kenwood TK-862G Radio K/E/(N)E""" MODEL = "TK-862G" - TYPE = "M8620" + TYPE = b"M8620" VARIANTS = { - "M8620\x06\xff": (8, 450, 490, "K"), - "M8620\x07\xff": (8, 485, 512, "K2"), - "M8620&\xff": (8, 440, 470, "E"), - "M8620V\xff": (8, 440, 470, "(N)E"), + b"M8620\x06\xff": (8, 450, 490, "K"), + b"M8620\x07\xff": (8, 485, 512, "K2"), + b"M8620&\xff": (8, 440, 470, "E"), + b"M8620V\xff": (8, 440, 470, "(N)E"), } @@ -1555,14 +1503,14 @@ class TK862G_Radios(Kenwood_Serie_60G): class TK860G_Radios(Kenwood_Serie_60G): """Kenwood TK-860G Radio K""" MODEL = "TK-860G" - TYPE = "M8600" + TYPE = b"M8600" VARIANTS = { - "M8600\x08\xff": (128, 400, 430, "K"), - "M8600\x06\xff": (128, 450, 490, "K1"), - "M8600\x07\xff": (128, 485, 512, "K2"), - "M8600\x18\xff": (128, 400, 430, "M"), - "M8600\x16\xff": (128, 450, 490, "M1"), - "M8600\x17\xff": (128, 485, 520, "M2"), + b"M8600\x08\xff": (128, 400, 430, "K"), + b"M8600\x06\xff": (128, 450, 490, "K1"), + b"M8600\x07\xff": (128, 485, 512, "K2"), + b"M8600\x18\xff": (128, 400, 430, "M"), + b"M8600\x16\xff": (128, 450, 490, "M1"), + b"M8600\x17\xff": (128, 485, 520, "M2"), } @@ -1570,13 +1518,13 @@ class TK860G_Radios(Kenwood_Serie_60G): class TK768G_Radios(Kenwood_Serie_60G): """Kenwood TK-768G Radios [M/C]""" MODEL = "TK-768G" - TYPE = "M7680" + TYPE = b"M7680" # Note that 8 CH don't have banks VARIANTS = { - "M7680\x15\xff": (8, 136, 162, "M2"), - "M7680\x14\xff": (8, 148, 174, "M"), - "M76805\xff": (128, 136, 162, "C2"), - "M76804\xff": (128, 148, 174, "C"), + b"M7680\x15\xff": (8, 136, 162, "M2"), + b"M7680\x14\xff": (8, 148, 174, "M"), + b"M76805\xff": (128, 136, 162, "C2"), + b"M76804\xff": (128, 148, 174, "C"), } @@ -1584,13 +1532,13 @@ class TK768G_Radios(Kenwood_Serie_60G): class TK762G_Radios(Kenwood_Serie_60G): """Kenwood TK-762G Radios [K/E/NE]""" MODEL = "TK-762G" - TYPE = "M7620" + TYPE = b"M7620" # Note that 8 CH don't have banks VARIANTS = { - "M7620\x05\xff": (8, 136, 162, "K2"), - "M7620\x04\xff": (8, 148, 172, "K"), - "M7620$\xff": (8, 148, 172, "E"), - "M7620T\xff": (8, 148, 172, "NE"), + b"M7620\x05\xff": (8, 136, 162, "K2"), + b"M7620\x04\xff": (8, 148, 172, "K"), + b"M7620$\xff": (8, 148, 172, "E"), + b"M7620T\xff": (8, 148, 172, "NE"), } @@ -1598,12 +1546,12 @@ class TK762G_Radios(Kenwood_Serie_60G): class TK760G_Radios(Kenwood_Serie_60G): """Kenwood TK-760G Radios [K/M/(N)E]""" MODEL = "TK-760G" - TYPE = "M7600" + TYPE = b"M7600" VARIANTS = { - "M7600\x05\xff": (128, 136, 162, "K2"), - "M7600\x04\xff": (128, 148, 174, "K"), - "M7600\x14\xff": (128, 148, 174, "M"), - "M7600T\xff": (128, 148, 174, "NE") + b"M7600\x05\xff": (128, 136, 162, "K2"), + b"M7600\x04\xff": (128, 148, 174, "K"), + b"M7600\x14\xff": (128, 148, 174, "M"), + b"M7600T\xff": (128, 148, 174, "NE") } @@ -1611,9 +1559,9 @@ class TK760G_Radios(Kenwood_Serie_60G): class TK388G_Radios(Kenwood_Serie_60G): """Kenwood TK-388 Radio [K/E/M/NE]""" MODEL = "TK-388G" - TYPE = "P3880" + TYPE = b"P3880" VARIANTS = { - "P3880\x1b\xff": (128, 350, 370, "M") + b"P3880\x1b\xff": (128, 350, 370, "M") } @@ -1621,12 +1569,12 @@ class TK388G_Radios(Kenwood_Serie_60G): class TK378G_Radios(Kenwood_Serie_60G): """Kenwood TK-378 Radio [K/E/M/NE]""" MODEL = "TK-378G" - TYPE = "P3780" + TYPE = b"P3780" VARIANTS = { - "P3780\x16\xff": (16, 450, 470, "M"), - "P3780\x17\xff": (16, 400, 420, "M1"), - "P3780\x36\xff": (128, 490, 512, "C"), - "P3780\x39\xff": (128, 403, 430, "C1") + b"P3780\x16\xff": (16, 450, 470, "M"), + b"P3780\x17\xff": (16, 400, 420, "M1"), + b"P3780\x36\xff": (128, 490, 512, "C"), + b"P3780\x39\xff": (128, 403, 430, "C1") } @@ -1634,12 +1582,12 @@ class TK378G_Radios(Kenwood_Serie_60G): class TK372G_Radios(Kenwood_Serie_60G): """Kenwood TK-372 Radio [K/E/M/NE]""" MODEL = "TK-372G" - TYPE = "P3720" + TYPE = b"P3720" VARIANTS = { - "P3720\x06\xff": (32, 450, 470, "K"), - "P3720\x07\xff": (32, 470, 490, "K1"), - "P3720\x08\xff": (32, 490, 512, "K2"), - "P3720\x09\xff": (32, 403, 430, "K3") + b"P3720\x06\xff": (32, 450, 470, "K"), + b"P3720\x07\xff": (32, 470, 490, "K1"), + b"P3720\x08\xff": (32, 490, 512, "K2"), + b"P3720\x09\xff": (32, 403, 430, "K3") } @@ -1647,18 +1595,18 @@ class TK372G_Radios(Kenwood_Serie_60G): class TK370G_Radios(Kenwood_Serie_60G): """Kenwood TK-370 Radio [K/E/M/NE]""" MODEL = "TK-370G" - TYPE = "P3700" + TYPE = b"P3700" VARIANTS = { - "P3700\x06\xff": (128, 450, 470, "K"), - "P3700\x07\xff": (128, 470, 490, "K1"), - "P3700\x08\xff": (128, 490, 512, "K2"), - "P3700\x09\xff": (128, 403, 430, "K3"), - "P3700\x16\xff": (128, 450, 470, "M"), - "P3700\x17\xff": (128, 470, 490, "M1"), - "P3700\x18\xff": (128, 490, 520, "M2"), - "P3700\x19\xff": (128, 403, 430, "M3"), - "P3700&\xff": (128, 440, 470, "E"), - "P3700V\xff": (128, 440, 470, "NE") + b"P3700\x06\xff": (128, 450, 470, "K"), + b"P3700\x07\xff": (128, 470, 490, "K1"), + b"P3700\x08\xff": (128, 490, 512, "K2"), + b"P3700\x09\xff": (128, 403, 430, "K3"), + b"P3700\x16\xff": (128, 450, 470, "M"), + b"P3700\x17\xff": (128, 470, 490, "M1"), + b"P3700\x18\xff": (128, 490, 520, "M2"), + b"P3700\x19\xff": (128, 403, 430, "M3"), + b"P3700&\xff": (128, 440, 470, "E"), + b"P3700V\xff": (128, 440, 470, "NE") } @@ -1666,19 +1614,19 @@ class TK370G_Radios(Kenwood_Serie_60G): class TK360G_Radios(Kenwood_Serie_60G): """Kenwood TK-360 Radio [K/E/M/NE]""" MODEL = "TK-360G" - TYPE = "P3600" + TYPE = b"P3600" VARIANTS = { - "P3600\x06\xff": (8, 450, 470, "K"), - "P3600\x07\xff": (8, 470, 490, "K1"), - "P3600\x08\xff": (8, 490, 512, "K2"), - "P3600\x09\xff": (8, 403, 430, "K3"), - "P3600&\xff": (8, 440, 470, "E"), - "P3600)\xff": (8, 406, 430, "E1"), - "P3600\x16\xff": (8, 450, 470, "M"), - "P3600\x17\xff": (8, 470, 490, "M1"), - "P3600\x19\xff": (8, 403, 430, "M2"), - "P3600V\xff": (8, 440, 470, "NE"), - "P3600Y\xff": (8, 403, 430, "NE1") + b"P3600\x06\xff": (8, 450, 470, "K"), + b"P3600\x07\xff": (8, 470, 490, "K1"), + b"P3600\x08\xff": (8, 490, 512, "K2"), + b"P3600\x09\xff": (8, 403, 430, "K3"), + b"P3600&\xff": (8, 440, 470, "E"), + b"P3600)\xff": (8, 406, 430, "E1"), + b"P3600\x16\xff": (8, 450, 470, "M"), + b"P3600\x17\xff": (8, 470, 490, "M1"), + b"P3600\x19\xff": (8, 403, 430, "M2"), + b"P3600V\xff": (8, 440, 470, "NE"), + b"P3600Y\xff": (8, 403, 430, "NE1") } @@ -1686,13 +1634,13 @@ class TK360G_Radios(Kenwood_Serie_60G): class TK278G_Radios(Kenwood_Serie_60G): """Kenwood TK-278G Radio C/C1/M/M1""" MODEL = "TK-278G" - TYPE = "P2780" + TYPE = b"P2780" # Note that 16 CH don't have banks VARIANTS = { - "P27805\xff": (128, 136, 150, "C1"), - "P27804\xff": (128, 150, 174, "C"), - "P2780\x15\xff": (16, 136, 150, "M1"), - "P2780\x14\xff": (16, 150, 174, "M") + b"P27805\xff": (128, 136, 150, "C1"), + b"P27804\xff": (128, 150, 174, "C"), + b"P2780\x15\xff": (16, 136, 150, "M1"), + b"P2780\x14\xff": (16, 150, 174, "M") } @@ -1700,10 +1648,10 @@ class TK278G_Radios(Kenwood_Serie_60G): class TK272G_Radios(Kenwood_Serie_60G): """Kenwood TK-272G Radio K/K1""" MODEL = "TK-272G" - TYPE = "P2720" + TYPE = b"P2720" VARIANTS = { - "P2720\x05\xfb": (32, 136, 150, "K1"), - "P2720\x04\xfb": (32, 150, 174, "K") + b"P2720\x05\xfb": (32, 136, 150, "K1"), + b"P2720\x04\xfb": (32, 150, 174, "K") } @@ -1711,13 +1659,13 @@ class TK272G_Radios(Kenwood_Serie_60G): class TK270G_Radios(Kenwood_Serie_60G): """Kenwood TK-270G Radio K/K1/M/E/NE/NT""" MODEL = "TK-270G" - TYPE = "P2700" + TYPE = b"P2700" VARIANTS = { - "P2700T\xff": (128, 146, 174, "NE/NT"), - "P2700$\xff": (128, 146, 174, "E"), - "P2700\x14\xff": (128, 150, 174, "M"), - "P2700\x05\xff": (128, 136, 150, "K1"), - "P2700\x04\xff": (128, 150, 174, "K") + b"P2700T\xff": (128, 146, 174, "NE/NT"), + b"P2700$\xff": (128, 146, 174, "E"), + b"P2700\x14\xff": (128, 150, 174, "M"), + b"P2700\x05\xff": (128, 136, 150, "K1"), + b"P2700\x04\xff": (128, 150, 174, "K") } @@ -1726,12 +1674,12 @@ class TK260G_Radios(Kenwood_Serie_60G): """Kenwood TK-260G Radio K/K1/M/E/NE/NT""" MODEL = "TK-260G" _hasbanks = False - TYPE = "P2600" + TYPE = b"P2600" VARIANTS = { - "P2600U\xff": (8, 136, 150, "N1"), - "P2600T\xff": (8, 146, 174, "N"), - "P2600$\xff": (8, 150, 174, "E"), - "P2600\x14\xff": (8, 150, 174, "M"), - "P2600\x05\xff": (8, 136, 150, "K1"), - "P2600\x04\xff": (8, 150, 174, "K") + b"P2600U\xff": (8, 136, 150, "N1"), + b"P2600T\xff": (8, 146, 174, "N"), + b"P2600$\xff": (8, 150, 174, "E"), + b"P2600\x14\xff": (8, 150, 174, "M"), + b"P2600\x05\xff": (8, 136, 150, "K1"), + b"P2600\x04\xff": (8, 150, 174, "K") } diff --git a/chirp/drivers/tk8102.py b/chirp/drivers/tk8102.py index f28a219..d4434e3 100644 --- a/chirp/drivers/tk8102.py +++ b/chirp/drivers/tk8102.py @@ -14,7 +14,6 @@ # along with this program. If not, see . from builtins import bytes -import os import logging import struct @@ -45,6 +44,25 @@ struct { u8 unknown3[2]; } memory[8]; +#seekto 0x0250; +struct { + u8 unknown0; + u8 unknown1; + u8 unknown2; + u8 unknown3; + // 0x04 Emergency, 0x05 keylock, 0x06 Monitor 0x09 temp delete, 0x0A none + u8 speakerkey; + u8 circlekey; +} settings; + +#seekto 0x0270; +struct { + u8 scanresume; // 0=selected 1=selected+talkback + u8 dropoutdelay; // 0.5s*value, 0.5-5.0 + u8 txdwell; // same as above + u8 offhookscan; // 0=off 1=on +} settings2; + #seekto 0x0310; struct { char line1[32]; @@ -53,6 +71,18 @@ struct { """ +# These are 4+index +KEYS = [ + 'Emergency', + 'Key Lock', + 'Monitor', + 'Scan On/Off', + 'Talk Around', + 'Temporary Delete', + 'None', +] +SCAN_RESUME = ['Selected', 'Selected+Talkback'] +SCAN_TIME = ['%.1f' % (v * 0.5) for v in range(11)] POWER_LEVELS = [chirp_common.PowerLevel("Low", watts=5), chirp_common.PowerLevel("High", watts=50)] MODES = ["NFM", "FM"] @@ -88,6 +118,7 @@ def do_ident(radio): send(radio, b"PROGRAM") ack = radio.pipe.read(1) if ack != bytes(b"\x06"): + LOG.debug('Response was %r, expected 0x06' % ack) raise errors.RadioError("Radio refused program mode") radio.pipe.write(b"\x02") ident = radio.pipe.read(8) @@ -107,7 +138,10 @@ def do_ident(radio): def do_download(radio): radio.pipe.parity = "E" radio.pipe.timeout = 1 - do_ident(radio) + try: + do_ident(radio) + except errors.RadioError: + do_ident(radio) data = bytes(b"") for addr in range(0, 0x0400, 8): @@ -124,7 +158,7 @@ def do_download(radio): status = chirp_common.Status() status.cur = addr status.max = 0x0400 - status.msg = "Cloning to radio" + status.msg = "Cloning from radio" radio.status_fn(status) radio.pipe.write(b"\x45") @@ -137,7 +171,10 @@ def do_download(radio): def do_upload(radio): radio.pipe.parity = "E" radio.pipe.timeout = 1 - do_ident(radio) + try: + do_ident(radio) + except errors.RadioError: + do_ident(radio) mmap = radio._mmap.get_byte_compatible() for addr in range(0, 0x0400, 8): @@ -376,7 +413,8 @@ class KenwoodTKx102Radio(chirp_common.CloneModeRadio): def get_settings(self): _mem = self._memobj basic = RadioSettingGroup("basic", "Basic") - top = RadioSettings(basic) + scan = RadioSettingGroup("scan", "Scan") + top = RadioSettings(basic, scan) def _f(val): string = "" @@ -398,6 +436,42 @@ class KenwoodTKx102Radio(chirp_common.CloneModeRadio): autopad=False)) basic.append(line2) + skey = RadioSetting( + "settings.speakerkey", "Speaker Key", + RadioSettingValueList( + KEYS, current_index=int(_mem.settings.speakerkey) - 4)) + basic.append(skey) + + ckey = RadioSetting( + "settings.circlekey", "Circle Key", + RadioSettingValueList( + KEYS, current_index=int(_mem.settings.circlekey) - 4)) + basic.append(ckey) + + scanresume = RadioSetting( + "settings2.scanresume", "Scan Resume", + RadioSettingValueList(SCAN_RESUME, + current_index=_mem.settings2.scanresume)) + scan.append(scanresume) + + offhookscan = RadioSetting( + "settings2.offhookscan", "Off-Hook Scan", + RadioSettingValueBoolean(bool(_mem.settings2.offhookscan))) + scan.append(offhookscan) + + dropout = RadioSetting( + "settings2.dropoutdelay", "Drop-out Delay Time", + RadioSettingValueList( + SCAN_TIME, current_index=int(_mem.settings2.dropoutdelay))) + + scan.append(dropout) + + txdwell = RadioSetting( + "settings2.txdwell", "TX Dwell Time", + RadioSettingValueList( + SCAN_TIME, current_index=int(_mem.settings2.txdwell))) + scan.append(txdwell) + return top def set_settings(self, settings): @@ -412,11 +486,13 @@ class KenwoodTKx102Radio(chirp_common.CloneModeRadio): obj = getattr(obj, bit) setting = bits[-1] else: - obj = _settings + obj = self._memobj.settings setting = element.get_name() if "line" in setting: value = str(element.value).ljust(32, "\xFF") + elif 'key' in setting: + value = int(element.value) + 4 else: value = element.value setattr(obj, setting, value) @@ -424,8 +500,7 @@ class KenwoodTKx102Radio(chirp_common.CloneModeRadio): @classmethod def match_model(cls, filedata, filename): model = filedata[0x03D1:0x03D5] - LOG.debug(model) - return model == cls.MODEL.split("-")[1] + return model == cls.MODEL.encode().split(b"-")[1] @directory.register diff --git a/chirp/drivers/tk8160.py b/chirp/drivers/tk8160.py new file mode 100644 index 0000000..15d4eb4 --- /dev/null +++ b/chirp/drivers/tk8160.py @@ -0,0 +1,669 @@ +# Copyright 2023 Dan Smith +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +import functools +import logging +import struct + +from chirp import bitwise +from chirp import chirp_common +from chirp import directory +from chirp.drivers import tk8180 +from chirp import errors +from chirp import memmap +from chirp import settings +from chirp import util + +LOG = logging.getLogger(__name__) + +mem_format = """ +// Bitmask for zone in use +#seekto 0x0020; +u8 zoneflag[16]; + +// (identical?) bitmask for index spot in use +#seekto 0x0030; +u8 flag1[16]; +#seekto 0x0050; +u8 flag2[16]; + +// This is filled in order, regardless of the ordering of the memories or +// their positions +#seekto 0x00E0; +struct { + u8 zone; // Zone number + u8 memory; // Channel number + u8 zero; + u8 slot; // Index into the memory array +} index[128]; + +#seekto 0x02E0; +struct { + u8 used:1, + unknown1:4, // Always 0x71? + zoneaudiomode:2, // 00=QT/DQT 01=QT/DQT+OptSig 02 QT/DQTorOptSig + optsigdecode:1; // 0=Carrier 1=QT/DQT + u8 count; // Number of memories in the zone +} zoneinfo[128]; + +#seekto 0x03E0; +struct { + u8 number; + u8 zone; + lbcd rx_freq[4]; + lbcd tx_freq[4]; + u8 unknown1[2]; + ul16 rxtone; + ul16 txtone; + // BCL 0:no 1: carrier + u8 unknown2_0:4, + bcl:2, // 0:no 1:carrier 2:tone 3:optsig + unknown2_01:1, + wide:1; + u8 beatshift:1, + unknown2_1:1, + highpower:1, + scanadd:1, + unknown2_2:4; + u8 unknown2_3:6, + pttid:2; // 0:off 1:BOT 2:EOT 3:Both + char name[8]; + u8 unknown3_0:7, + compander:1; + u8 unknown3_1:7, + pttidmute:1; + u8 optsig:3, // 0:none 1:DTMF 2:2tone1 3:2tone2 4:2tone3 5:FleetSync + unknown4:5; + u8 unknown5[2]; +} memories[128]; + +#seekto 0x14F0; +struct { + char message1[32]; + char message2[32]; +} messages; + +#seekto 0x1730; +struct { + char model[5]; + u8 variant; +} model; + +// 28=volup 2A=None 15=2-tone 8=AUX 16=Call1 17=Call2 13=ChDn 12=ChUp +// 0B=DisplayCh 09=HornAlert 03=KeyLock 14=Brightness 02=Monitor 25=MonMom +// 0C=OST 19=PA 1A=SquelchLevel 05=Scan 06=ScanAdd 0A=Scrambler 18=Selcall +// 27=SendGPS 04=TA 28=VolUp 29=VolDn 00=ZoneUp 24=SqlOff 26=SqlOffMom +// 1C=Status 1D=SelCall+Status 01=ZoneDn +#seekto 0x1820; +struct { + u8 skey; + u8 akey; + u8 bkey; + u8 ckey; + u8 triangle; + u8 rightup; + u8 rightdn; + u8 leftup; + u8 leftdn; +} keys; +""" + +_KEYS = [ + 'Zone Up', + 'Zone Down', + 'Monitor', + 'Key Lock', + 'Talk Around', + 'Scan', + 'Scan Add', + '?', + 'AUX', + 'Horn Alert', + 'Scrambler', + 'Display Character', + 'OST', + '?', # 0D + '?', # 0E + '?', # 0F + '?', # 10 + '?', # 11 + 'Channel Up', + 'Channel Down', + 'Brightness', + '2-Tone', + 'Call 1', + 'Call 2', + 'Selcall', + 'Public Address', + 'Squelch Level', + '?', + 'Status', + 'Selcall+Status', + '?', # 1E + '?', # 1F + '?', # 20 + '?', # 21 + '?', # 22 + '?', # 23 + 'Squelch Off', + 'Monitor Momentary', + 'Squelch Off Momentary', + 'Send the GPS', + 'Volume Up', + 'Volume Down', + 'None', + ] + +KEYS = {i: key for i, key in enumerate(_KEYS) + if not key.startswith('?')} + +KEY_NAMES = { + 'A': 'akey', + 'B': 'bkey', + 'C': 'ckey', + 'S': 'skey', + 'Triangle': 'triangle', + 'Right Up': 'rightup', + 'Right Down': 'rightdn', + 'Left Up': 'leftup', + 'Left Down': 'leftdn', +} + +POWER_LEVELS = [chirp_common.PowerLevel('Low', watts=25), + chirp_common.PowerLevel('High', watts=50)] + + +def ends_program(fn): + @functools.wraps(fn) + def wrapper(radio): + try: + return fn(radio) + finally: + radio.pipe.write(b'E') + ack = radio.pipe.read(1) + if ack != b'\x06': + LOG.warning('Radio did not ACK exiting program mode') + + return wrapper + + +@ends_program +def do_download(radio): + tk8180.do_ident(radio) + + data = b'' + + def status(): + status = chirp_common.Status() + status.cur = len(data) + status.max = radio._memsize + status.msg = 'Cloning from radio' + radio.status_fn(status) + LOG.debug('Radio address 0x%04x' % len(data)) + + # This seems to be "give me the whole thing" + LOG.debug('Requesting clone image') + radio.pipe.write(b'hRDA') + ack = radio.pipe.read(1) + if ack != b'\x06': + LOG.error('No ack from radio; got %r' % ack) + raise errors.RadioError('Radio refused to send memory') + + while len(data) < radio._memsize: + cmd = radio.pipe.read(1) + if cmd == b'E': + LOG.debug('Got clone end') + break + elif cmd not in b'ZW': + LOG.error('Unsupported command %r' % cmd) + raise errors.RadioError('Radio sent unknown message') + + hdr = radio.pipe.read(3) + addr, length = struct.unpack('>HB', hdr) + LOG.debug('Radio: %r %04x %02x' % (cmd, addr, length)) + if cmd == b'Z': + data += b'\xFF' * length + elif cmd == b'W': + block = radio.pipe.read(length) + data += block + radio.pipe.write(b'\x06') + status() + + return memmap.MemoryMapBytes(data) + + +@ends_program +def do_upload(radio): + tk8180.do_ident(radio) + + data = radio._mmap.get_packed() + + def status(addr): + status = chirp_common.Status() + status.cur = addr + status.max = radio._memsize + status.msg = "Cloning to radio" + radio.status_fn(status) + LOG.debug('Radio address 0x%04x' % addr) + + for addr in range(0, 0x30E0, 0x40): + block = data[addr:addr + 0x40] + hdr = struct.pack('>cHB', b'W', addr, 0x40) + radio.pipe.write(hdr + block) + ack = radio.pipe.read(1) + if ack != b'\x06': + LOG.error('Expected ack, got %r' % ack) + raise errors.RadioError('Radio did not ACK block') + status(addr) + + +class TKx160Radio(chirp_common.CloneModeRadio): + VENDOR = 'Kenwood' + FORMATS = [directory.register_format('Kenwood KPG-99D', '*.dat')] + NEEDS_COMPAT_SERIAL = False + _memsize = 0x4000 + + def sync_in(self): + try: + self._mmap = do_download(self) + except errors.RadioError: + raise + except Exception as e: + LOG.exception('Failed download: %s' % e) + raise errors.RadioError('Failed to communicate with radio') + self.process_mmap() + + def sync_out(self): + try: + self._mmap = do_upload(self) + except errors.RadioError: + raise + except Exception as e: + LOG.exception('Failed upload: %s' % e) + raise errors.RadioError('Failed to communicate with radio') + + def process_mmap(self): + self._memobj = bitwise.parse(mem_format, self._mmap) + + @classmethod + def match_model(cls, filedata, filename): + return (filename.endswith('.dat') and + filedata[0x1740:0x1746] == cls._model) + + def get_features(self): + rf = chirp_common.RadioFeatures() + rf.memory_bounds = (1, 128) + rf.has_ctone = True + rf.has_cross = True + rf.has_bank = False + rf.has_sub_devices = not self.VARIANT + rf.has_tuning_step = False + rf.has_rx_dtcs = True + rf.has_settings = True + rf.can_odd_split = True + rf.valid_tmodes = ['', 'Tone', 'TSQL', 'DTCS', 'Cross'] + rf.valid_cross_modes = ['Tone->Tone', 'DTCS->', '->DTCS', "Tone->DTCS", + 'DTCS->Tone', '->Tone', 'DTCS->DTCS'] + rf.valid_duplexes = ['', '-', '+', 'split', 'off'] + rf.valid_modes = ['FM', 'NFM'] + rf.valid_tuning_steps = [2.5, 5.0, 6.25, 12.5, 10.0, 15.0, 20.0, + 25.0, 50.0, 100.0] + rf.valid_bands = self.VALID_BANDS + rf.valid_characters = chirp_common.CHARSET_UPPER_NUMERIC + rf.valid_name_length = 8 + rf.valid_power_levels = list(reversed(POWER_LEVELS)) + rf.valid_skips = ['', 'S'] + return rf + + def _get_zone_info(self): + zones = {} + for i in range(128): + info = self._memobj.zoneinfo[i] + if info.used: + zones[i + 1] = int(info.count) + if not zones: + LOG.warning('No zones defined, defaulting to 1') + # Default to at least one zone so we have *something* + zones[1] = 0 + return zones + + def _set_num_zones(self, count): + LOG.debug('Setting zones to %i' % count) + for i in range(128): + index_obj = self._memobj.index[i] + if index_obj.zone != 0xFF and index_obj.zone > count: + LOG.debug('Deleting memory %i:%i to delete zone', + index_obj.zone, index_obj.memory) + self._delete_entry_from_index(i) + + # This will disable zones with no memories, so do it after deletion + # but before we may expand (if we're increasing) + self.recalculate_index_entry_bitmask() + + unused_zones = [] + for i in range(128): + info = self._memobj.zoneinfo[i] + info.used = i < count + if not info.used: + unused_zones.append(i + 1) + + def _get_zone(self, zone): + class TKx160Zone(self.__class__): + MODEL = self.MODEL + VARIANT = 'Zone %i' % zone + VALID_BANDS = self.VALID_BANDS + + def __init__(self, parent, zone): + self._memobj = parent._memobj + self._zone = zone + + return TKx160Zone(self, zone) + + def get_sub_devices(self): + if not self._memobj: + return [self._get_zone(1)] + return [self._get_zone(zone) + for zone, count in self._get_zone_info().items()] + + def get_raw_memory(self, number): + index_entry, slot = self.check_index(number) + return (repr(self._memobj.index[index_entry]) + + repr(self._memobj.memories[slot])) + + def check_index(self, number): + """Return the index entry and slot for a channel in our zone""" + for i in range(128): + index_obj = self._memobj.index[i] + if index_obj.zone == self._zone and index_obj.memory == number: + LOG.debug('Found %i:%i in slot %i', + self._zone, number, + index_obj.slot) + return i, index_obj.slot + return None, None + + def next_slot(self, number): + """Claim the next available slot entry for channel.""" + for next_index in range(128): + index_obj = self._memobj.index[next_index] + if index_obj.zone == 0xFF: + break + else: + raise errors.RadioError('Radio is out if index memory') + + for next_slot in range(128): + if self._memobj.memories[next_slot].number == 0xFF: + break + else: + raise errors.RadioError('Radio is out of memory slots') + + LOG.debug('Putting channel %i in index spot %i', + number, next_index) + index_obj = self._memobj.index[next_index] + index_obj.zone = self._zone + index_obj.memory = number + index_obj.zero = 0 + index_obj.slot = next_slot + + self.recalculate_index_entry_bitmask() + + return next_slot + + def _delete_entry_from_index(self, index_entry): + last_entry = index_entry + + # Find the last index entry + for i in reversed(range(0, 128)): + mask = 1 << (i % 8) + if self._memobj.flag1[i // 8] & mask: + last_entry = i + break + + src_obj = self._memobj.index[last_entry] + dst_obj = self._memobj.index[index_entry] + if index_entry != last_entry: + LOG.debug('Moving index entry %i to %i for delete of %i:%i', + last_entry, index_entry, + dst_obj.zone, dst_obj.memory) + # Move last to current + dst_obj.zone = src_obj.zone + dst_obj.memory = src_obj.memory + dst_obj.zero = src_obj.zero + dst_obj.slot = src_obj.slot + + # Clear out the entry we moved, which may be the last and only one + src_obj.set_raw(b'\xFF' * 4) + + def delete_from_index(self, number): + """Delete the index entry for number""" + # Find the index entry to delete + index_entry, _slot = self.check_index(number) + self._delete_entry_from_index(index_entry) + self.recalculate_index_entry_bitmask() + + def recalculate_index_entry_bitmask(self): + # Recalculate the pins. This is more laborious than needed, but should + # also clean up residue. + zone_counts = [0] * 128 + mem_flags = [0] * 16 + for i in range(128): + index_obj = self._memobj.index[i] + byte = i // 8 + mask = 1 << (i % 8) + if index_obj.memory != 0xFF: + mem_flags[byte] |= mask + zone_counts[index_obj.zone - 1] += 1 + + for i, byte in enumerate(mem_flags): + self._memobj.flag1[i] = byte + self._memobj.flag2[i] = byte + + zone_flags = [0] * 16 + # Update zoneinfo + for i, count in enumerate(zone_counts): + self._memobj.zoneinfo[i].used = bool(count) + self._memobj.zoneinfo[i].count = count + if count: + zone_flags[i // 8] |= (1 << (i % 8)) + LOG.debug('Zone %i count is %i', i + 1, count) + + for i, byte in enumerate(zone_flags): + self._memobj.zoneflag[i] = byte + + def get_memory(self, number): + m = chirp_common.Memory(number) + _index_entry, slot = self.check_index(number) + if slot is None: + m.empty = True + return m + + _mem = self._memobj.memories[slot] + + m.freq = int(_mem.rx_freq) * 10 + offset = int(_mem.tx_freq) * 10 - m.freq + if _mem.tx_freq.get_raw(asbytes=True) == b'\xFF\xFF\xFF\xFF': + m.offset = 0 + m.duplex = 'off' + elif offset < 0: + m.offset = abs(offset) + m.duplex = '-' + elif offset > 0: + m.offset = offset + m.duplex = '+' + else: + m.offset = 0 + + rxtone = tk8180.KenwoodTKx180Radio._decode_tone( + _mem.rxtone) + txtone = tk8180.KenwoodTKx180Radio._decode_tone( + _mem.txtone) + chirp_common.split_tone_decode(m, txtone, rxtone) + + m.name = str(_mem.name).rstrip() + m.power = POWER_LEVELS[int(_mem.highpower)] + m.mode = 'FM' if _mem.wide else 'NFM' + m.skip = '' if _mem.scanadd else 'S' + + return m + + def set_memory(self, mem): + _index_entry, slot = self.check_index(mem.number) + if mem.empty: + if slot is not None: + self._memobj.memories[slot].set_raw(b'\xFF' * 32) + self.delete_from_index(mem.number) + return + elif slot is None: + slot = self.next_slot(mem.number) + + _mem = self._memobj.memories[slot] + _mem.number = mem.number + _mem.zone = self._zone + + LOG.debug('Setting memory %i in slot %i', mem.number, slot) + + _mem.rx_freq = mem.freq // 10 + if mem.duplex == '': + _mem.tx_freq = mem.freq // 10 + elif mem.duplex == 'split': + _mem.tx_freq = mem.offset // 10 + elif mem.duplex == 'off': + _mem.tx_freq.set_raw(b'\xFF' * 4) + elif mem.duplex == '-': + _mem.tx_freq = (mem.freq - mem.offset) // 10 + elif mem.duplex == '+': + _mem.tx_freq = (mem.freq + mem.offset) // 10 + else: + raise errors.RadioError('Unsupported duplex mode %r' % mem.duplex) + + txtone, rxtone = chirp_common.split_tone_encode(mem) + _mem.rxtone = tk8180.KenwoodTKx180Radio._encode_tone(*rxtone) + _mem.txtone = tk8180.KenwoodTKx180Radio._encode_tone(*txtone) + + _mem.wide = mem.mode == 'FM' + _mem.highpower = mem.power == POWER_LEVELS[1] + _mem.scanadd = mem.skip == '' + _mem.name = mem.name[:8].ljust(8) + + # Set the flags we don't support + _mem.bcl = 0 + _mem.beatshift = 0 + _mem.pttid = 0 + _mem.compander = 0 + _mem.pttidmute = 0 + _mem.optsig = 0 + + # Set the unknowns + _mem.unknown1[0] = 0x02 + _mem.unknown1[1] = 0x02 + _mem.unknown2_0 = 0x0F + _mem.unknown2_01 = 0x00 + _mem.unknown2_1 = 0x00 + _mem.unknown2_2 = 0x00 + _mem.unknown2_3 = 0x00 + _mem.unknown3_0 = 0x00 + _mem.unknown3_1 = 0x00 + _mem.unknown4 = 0x1F + _mem.unknown5[0] = 0xFF + _mem.unknown5[1] = 0xFF + + @staticmethod + def make_key_group(keysobj, keynames, keyvals): + keyvals_by_label = {v: k for k, v in keyvals.items()} + + def applycb(setting): + element = setting.get_name() + value = keyvals_by_label[str(setting.value)] + LOG.debug('Setting %s=%s (0x%02x)', element, setting.value, value) + setattr(keysobj, element, value) + + group = settings.RadioSettingGroup('keys', 'Keys') + for name, element in keynames.items(): + current = keyvals[int(getattr(keysobj, element))] + val = settings.RadioSettingValueList(keyvals.values(), current) + keysetting = settings.RadioSetting(element, name, val) + keysetting.set_apply_callback(applycb) + group.append(keysetting) + return group + + def get_settings(self): + num_zones = len(self._get_zone_info()) + zones = settings.RadioSettingGroup('zones', 'Zones') + zone_count = settings.RadioSetting( + 'zonecount', 'Number of Zones', + settings.RadioSettingValueInteger(1, 128, num_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 the affected zones!') + zones.append(zone_count) + keys = self.make_key_group(self._memobj.keys, + KEY_NAMES, + KEYS) + return settings.RadioSettings(zones, keys) + + def set_settings(self, _settings): + for element in _settings: + if not isinstance(element, settings.RadioSetting): + self.set_settings(element) + elif element.get_name() == 'zonecount': + self._set_num_zones(int(element.value)) + + def save_mmap(self, filename): + if filename.lower().endswith('.dat'): + with open(filename, 'wb') as f: + f.write(b'EX3774'.ljust(16, b'\xFF')) + f.write(self._mmap.get_packed()) + LOG.info('Wrote DAT file') + else: + super().save_mmap(filename) + + def load_mmap(self, filename): + if filename.lower().endswith('.dat'): + with open(filename, 'rb') as f: + header = f.read(16) + LOG.debug('DAT header:\n%s' % util.hexprint(header)) + self._mmap = memmap.MemoryMapBytes(f.read()) + LOG.info('Loaded DAT file') + self.process_mmap() + else: + super().load_mmap(filename) + + +@directory.register +class TK7160RadioM(TKx160Radio): + MODEL = 'TK-7160M' + VALID_BANDS = [(136000000, 174000000)] + _model = b'M66- \x04' + + +@directory.register +class TK7160RadioK(TKx160Radio): + MODEL = 'TK-7160K' + VALID_BANDS = [(136000000, 174000000)] + _model = b'M66- \x02' + + +@directory.register +class TK8160RadioK(TKx160Radio): + MODEL = 'TK-8160K' + VALID_BANDS = [(400000000, 520000000)] + _model = b'M67- "' + + +@directory.register +class TK8160RadioM(TKx160Radio): + MODEL = 'TK-8160M' + VALID_BANDS = [(400000000, 520000000)] + _model = b'M67- D' diff --git a/chirp/drivers/tk8180.py b/chirp/drivers/tk8180.py index 3cbb8e3..04e2c3e 100644 --- a/chirp/drivers/tk8180.py +++ b/chirp/drivers/tk8180.py @@ -14,7 +14,6 @@ # along with this program. If not, see . import struct -import os import time import logging from collections import OrderedDict @@ -245,8 +244,8 @@ def do_ident(radio): raise errors.RadioError('Radio refused program mode') if ident[:6] not in (radio._model,): model = ident[:5].decode() - variants = {b'\x06': 'K, K1, K3 (450-520MHz)', - b'\x07': 'K2, K4 (400-470MHz)'} + variants = {b'\x06': 'K, K1, K3 (450-520 MHz)', + b'\x07': 'K2, K4 (400-470 MHz)'} if model == 'P3180': model += ' ' + variants.get(ident[5], '(Unknown)') raise errors.RadioError('Unsupported radio model %s' % model) @@ -398,6 +397,7 @@ class KenwoodTKx180Radio(chirp_common.CloneModeRadio): MODEL = 'TK-x180' BAUD_RATE = 9600 NEEDS_COMPAT_SERIAL = False + FORMATS = [directory.register_format('Kenwood KPG-89D', '*.dat')] _system_start = 0x0B00 _memsize = 0xD100 @@ -405,6 +405,8 @@ class KenwoodTKx180Radio(chirp_common.CloneModeRadio): def __init__(self, *a, **k): self._zones = [] chirp_common.CloneModeRadio.__init__(self, *a, **k) + _dat_header = (b'KPG89D\xFF\xFF\xFF\xFFV1.61' + self._model + + (b'\xFF' * 11) + (b'\xFF' * 32)) def sync_in(self): try: @@ -427,6 +429,31 @@ class KenwoodTKx180Radio(chirp_common.CloneModeRadio): LOG.exception('General failure') raise errors.RadioError('Failed to upload to radio: %s' % e) + @classmethod + def match_model(cls, filedata, filename): + return (filename.endswith('.dat') and + filedata[15:21] == cls._model) + + def save_mmap(self, filename): + if filename.lower().endswith('.dat'): + with open(filename, 'wb') as f: + f.write(self._dat_header) + f.write(self._mmap.get_packed()) + LOG.info('Wrote DAT file') + else: + super().save_mmap(filename) + + def load_mmap(self, filename): + if filename.lower().endswith('.dat'): + with open(filename, 'rb') as f: + self._dat_header = f.read(0x40) + LOG.debug('DAT header:\n%s' % util.hexprint(self._dat_header)) + self._mmap = memmap.MemoryMapBytes(f.read()) + LOG.info('Loaded DAT file') + self.process_mmap() + else: + super().load_mmap(filename) + @property def is_portable(self): return self._model.startswith(b'P') @@ -685,8 +712,12 @@ class KenwoodTKx180Radio(chirp_common.CloneModeRadio): mem.power = POWER_LEVELS[_mem.highpower] offset = (int(_mem.tx_freq) - int(_mem.rx_freq)) * 10 - if offset == 0: + if _mem.tx_freq.get_raw(asbytes=True) == b'\xFF\xFF\xFF\xFF': + mem.offset = 0 + mem.duplex = 'off' + elif offset == 0: mem.duplex = '' + mem.offset = 0 elif abs(offset) < 10000000: mem.duplex = offset < 0 and '-' or '+' mem.offset = abs(offset) diff --git a/chirp/drivers/tmd710.py b/chirp/drivers/tmd710.py index 62e224e..a234189 100644 --- a/chirp/drivers/tmd710.py +++ b/chirp/drivers/tmd710.py @@ -18,15 +18,12 @@ import time import struct import logging -import re -import math from chirp import chirp_common, directory, memmap from chirp import bitwise, errors, util from chirp.settings import RadioSettingGroup, RadioSetting, \ RadioSettingValueBoolean, RadioSettingValueList, \ RadioSettingValueString, RadioSettingValueInteger, \ - RadioSettingValueFloat, RadioSettings, InvalidValueError -from textwrap import dedent + RadioSettingValueFloat, RadioSettings from chirp.drivers import kenwood_live LOG = logging.getLogger(__name__) @@ -179,27 +176,26 @@ class KenwoodTMx710Radio(chirp_common.CloneModeRadio): rf.valid_modes = TMD710_MODES rf.valid_duplexes = TMD710_DUPLEX rf.valid_tuning_steps = TMD710_STEPS + rf.valid_tones = TMD710_TONES rf.valid_dtcs_codes = TMD710_DTSC # Supports upper and lower case text rf.valid_characters = TMD710_CHARS rf.valid_name_length = 8 rf.valid_skips = TMD710_SKIP rf.valid_bands = TMD710_BANDS - rf.memory_bounds = (0, 1029) # including special chans 1000-1029 + rf.memory_bounds = (0, 999) # including special chans 1000-1029 rf.valid_special_chans = sorted(self.SPECIAL_MEMORIES.keys()) return rf @classmethod def get_prompts(cls): rp = chirp_common.RadioPrompts() - rp.pre_download = _(dedent("""\ - Connect your interface cable to the PC Port on the - back of the 'TX/RX' unit. NOT the Com Port on the head. - """)) - rp.pre_upload = _(dedent("""\ - Connect your interface cable to the PC Port on the - back of the 'TX/RX' unit. NOT the Com Port on the head. - """)) + rp.pre_download = _( + "Connect your interface cable to the PC Port on the\n" + "back of the 'TX/RX' unit. NOT the Com Port on the head.\n") + rp.pre_upload = _( + "Connect your interface cable to the PC Port on the\n" + "back of the 'TX/RX' unit. NOT the Com Port on the head.\n") return rp def sync_in(self): @@ -269,7 +265,7 @@ class KenwoodTMx710Radio(chirp_common.CloneModeRadio): for char in _nam.name: if int(char) < 127: mnx += chr(int(char)) - mem.name = mnx + mem.name = mnx.rstrip() if _mem.rxfreq == 0x0ffffffff or _mem.rxfreq == 0: mem.empty = True return mem @@ -314,7 +310,7 @@ class KenwoodTMx710Radio(chirp_common.CloneModeRadio): if self.SHORT == "G": # Only the 710G rx = RadioSettingValueList(STEPS_STR, STEPS_STR[_mem.splitstep]) - sx = "Split TX step (KHz)" + sx = "Split TX step (kHz)" rset = RadioSetting("splitstep", sx, rx) mem.extra.append(rset) @@ -328,6 +324,7 @@ class KenwoodTMx710Radio(chirp_common.CloneModeRadio): _map = self._memobj.chmap[mem.number] else: # Call chans _mem = self._memobj.call[mem.number - 1030] + _nam = None else: _mem = self._memobj.ch_mem[mem.number] _nam = self._memobj.ch_nam[mem.number] @@ -350,8 +347,9 @@ class KenwoodTMx710Radio(chirp_common.CloneModeRadio): _mem.dtcs = 0x0ff _map.skip = 0x0ff _map.band = 0x0ff - for ix in range(8): - _nam.name[ix] = chr(0x0ff) + if _nam: + for ix in range(8): + _nam.name[ix] = chr(0x0ff) return if _mem.rxfreq == 0x0ffffffff: # New Channel needs defaults _mem.rxfreq = 144000000 @@ -457,7 +455,7 @@ class KenwoodTMx710Radio(chirp_common.CloneModeRadio): group = RadioSettings(basic, disp, aud, aux, txrx, memz, pvfo, pfk, bmsk, rptr, dtmf, skyk, pmm) - mhz1 = 1000000. # Raw freq is stored with 0.1 Htz resolution + mhz1 = 1000000. # Raw freq is stored with 0.1 Hz resolution def _adjraw(setting, obj, atrb, fix=0, ndx=-1): """Callback for Integer add or subtract fix from value.""" @@ -472,7 +470,7 @@ class KenwoodTMx710Radio(chirp_common.CloneModeRadio): return def _mhz_val(setting, obj, atrb, ndx=-1, ndy=-1): - """ Callback to set freq back to Htz """ + """ Callback to set freq back to Hz """ vx = float(str(setting.value)) vx = int(vx * mhz1) if ndx < 0: @@ -767,7 +765,7 @@ class KenwoodTMx710Radio(chirp_common.CloneModeRadio): aux.append(rset) rx = RadioSettingValueBoolean(bool(_blk1.m10mz)) - sx = "10 Mhz mode" + sx = "10 MHz mode" rset = RadioSetting("block1.m10mz", sx, rx) aux.append(rset) @@ -963,7 +961,7 @@ class KenwoodTMx710Radio(chirp_common.CloneModeRadio): # ===== Prog VFO Group ============= for mx in range(0, 10): - # Raw freq is 0.1 Mhz resolution + # Raw freq is 0.1 MHz resolution vfx = int(_pmg[0].progvfo[mx].blow) / mhz1 if vfx == 0: vfx = 118 @@ -1030,52 +1028,52 @@ class KenwoodTMx710Radio(chirp_common.CloneModeRadio): # ===== BMSK GROUP ===== rx = RadioSettingValueBoolean(bool(_pmg[0].abnd118)) - sx = "A/Left: 118Mhz Band" + sx = "A/Left: 118 MHz Band" rset = RadioSetting("pmg/0.abnd118", sx, rx) bmsk.append(rset) rx = RadioSettingValueBoolean(bool(_pmg[0].abnd144)) - sx = "A/Left: 144Mhz Band" + sx = "A/Left: 144 MHz Band" rset = RadioSetting("pmg/0.abnd144", sx, rx) bmsk.append(rset) rx = RadioSettingValueBoolean(bool(_pmg[0].abnd220)) - sx = "A/Left: 220Mhz Band" + sx = "A/Left: 220 MHz Band" rset = RadioSetting("pmg/0.abnd220", sx, rx) bmsk.append(rset) rx = RadioSettingValueBoolean(bool(_pmg[0].abnd300)) - sx = "A/Left: 300Mhz Band" + sx = "A/Left: 300 MHz Band" rset = RadioSetting("pmg/0.abnd300", sx, rx) bmsk.append(rset) rx = RadioSettingValueBoolean(bool(_pmg[0].abnd430)) - sx = "A/Left: 430Mhz Band" + sx = "A/Left: 430 MHz Band" rset = RadioSetting("pmg/0.abnd430", sx, rx) bmsk.append(rset) rx = RadioSettingValueBoolean(bool(_pmg[0].bbnd144)) - sx = "B/Right: 144Mhz Band" + sx = "B/Right: 144 MHz Band" rset = RadioSetting("pmg/0.bbnd144", sx, rx) bmsk.append(rset) rx = RadioSettingValueBoolean(bool(_pmg[0].bbnd220)) - sx = "B/Right: 220Mhz Band" + sx = "B/Right: 220 MHz Band" rset = RadioSetting("pmg/0.bbnd220", sx, rx) bmsk.append(rset) rx = RadioSettingValueBoolean(bool(_pmg[0].bbnd300)) - sx = "B/Right: 300Mhz Band" + sx = "B/Right: 300 MHz Band" rset = RadioSetting("pmg/0.bbnd300", sx, rx) bmsk.append(rset) rx = RadioSettingValueBoolean(bool(_pmg[0].bbnd430)) - sx = "B/Right: 430Mhz Band" + sx = "B/Right: 430 MHz Band" rset = RadioSetting("pmg/0.bbnd430", sx, rx) bmsk.append(rset) rx = RadioSettingValueBoolean(bool(_pmg[0].bbnd800)) - sx = "B/Right: 800Mhz Band" + sx = "B/Right: 800 MHz Band" rset = RadioSetting("pmg/0.bbnd800", sx, rx) bmsk.append(rset) @@ -1242,7 +1240,7 @@ class KenwoodTMx710Radio(chirp_common.CloneModeRadio): LOG.debug("Setting %s = %s" % (setting, element.value)) setattr(obj, setting, element.value) - except Exception as e: + except Exception: LOG.debug(element.get_name()) raise return diff --git a/chirp/drivers/tmv71_ll.py b/chirp/drivers/tmv71_ll.py index 50a100b..5236361 100644 --- a/chirp/drivers/tmv71_ll.py +++ b/chirp/drivers/tmv71_ll.py @@ -68,6 +68,7 @@ def get_id(s): else: raise errors.RadioError("No response to ID command") + EXCH_R = "R\x00\x00\x00" EXCH_W = "W\x00\x00\x00" @@ -388,4 +389,4 @@ if __name__ == "__main__": # s.write("\r\r") # print get_id(s) data = download(s) - file(sys.argv[2], "wb").write(data) + open(sys.argv[2], "wb").write(data) diff --git a/chirp/drivers/ts2000.py b/chirp/drivers/ts2000.py index 50706ab..d52d41f 100644 --- a/chirp/drivers/ts2000.py +++ b/chirp/drivers/ts2000.py @@ -143,6 +143,15 @@ class TS2000Radio(KenwoodLiveRadio): _p16 = spec[42:49] mem.number = int(_p2 + _p3) # concat bank num and chan num + + if _p5 == '0': + # NOTE(danms): Apparently some TS2000s will return unset + # memory records with all zeroes for the fields instead of + # NAKing the command with an N response. If that happens here, + # return an empty memory. + mem.empty = True + return mem + mem.freq = int(_p4) mem.mode = TS2000_MODES[int(_p5)] mem.skip = ["", "S"][int(_p6)] diff --git a/chirp/drivers/ts480.py b/chirp/drivers/ts480.py index 141d199..3b58994 100644 --- a/chirp/drivers/ts480.py +++ b/chirp/drivers/ts480.py @@ -16,17 +16,13 @@ # along with this program. If not, see . import time -import struct import logging -import re -import math from chirp import chirp_common, directory, memmap -from chirp import bitwise, errors, util +from chirp import bitwise, errors from chirp.settings import RadioSettingGroup, RadioSetting, \ RadioSettingValueBoolean, RadioSettingValueList, \ RadioSettingValueString, RadioSettingValueInteger, \ - RadioSettingValueFloat, RadioSettings, InvalidValueError -from textwrap import dedent + RadioSettingValueFloat, RadioSettings LOG = logging.getLogger(__name__) @@ -106,9 +102,6 @@ TS480_SKIP = ["", "S"] # start at 0:LSB TS480_MODES = ["LSB", "USB", "CW", "FM", "AM", "FSK", "CW-R", "FSK-R"] EX_MODES = ["FSK-R", "CW-R"] -for ix in EX_MODES: - if ix not in chirp_common.MODES: - chirp_common.MODES.append(ix) TS480_TONES = list(chirp_common.TONES) TS480_TONES.append(1750.0) @@ -177,7 +170,6 @@ def _connect_radio(radio): (RADIO_IDS[resp], radio.MODEL) raise errors.RadioError(msg) raise errors.RadioError("No response from radio") - return def read_str(radio, trm=";"): @@ -505,7 +497,7 @@ class TS480_CRadio(chirp_common.CloneModeRadio): rf.valid_bands = TS480_BANDS rf.valid_characters = chirp_common.CHARSET_UPPER_NUMERIC + "*+-/" rf.valid_duplexes = TS480_DUPLEX - rf.valid_modes = TS480_MODES + rf.valid_modes = [x for x in TS480_MODES if x in chirp_common.MODES] rf.valid_skips = TS480_SKIP rf.valid_tuning_steps = TS480_TUNE_STEPS rf.valid_tmodes = ["", "Tone", "TSQL"] @@ -516,25 +508,22 @@ class TS480_CRadio(chirp_common.CloneModeRadio): @classmethod def get_prompts(cls): rp = chirp_common.RadioPrompts() - rp.info = _(dedent("""\ - P-VFO channels 100-109 are considered Settings.\n - Only a subset of the over 130 available radio settings - are supported in this release.\n - """)) - rp.pre_download = _(dedent("""\ - Follow these instructions to download the radio memory: - 1 - Connect your interface cable - 2 - Radio > Download from radio: Don't adjust any settings - on the radio head! - 3 - Disconnect your interface cable - """)) - rp.pre_upload = _(dedent("""\ - Follow these instructions to upload the radio memory: - 1 - Connect your interface cable - 2 - Radio > Upload to radio: Don't adjust any settings - on the radio head! - 3 - Disconnect your interface cable - """)) + rp.info = _( + "P-VFO channels 100-109 are considered Settings.\n" + "Only a subset of the over 130 available radio settings\n" + "are supported in this release.\n") + rp.pre_download = _( + "Follow these instructions to download the radio memory:\n" + "1 - Connect your interface cable\n" + "2 - Radio > Download from radio: Don't adjust any settings\n" + "on the radio head!\n" + "3 - Disconnect your interface cable\n") + rp.pre_upload = _( + "Follow these instructions to upload the radio memory:\n" + "1 - Connect your interface cable\n" + "2 - Radio > Upload to radio: Don't adjust any settings\n" + "on the radio head!\n" + "3 - Disconnect your interface cable\n") return rp def sync_in(self): @@ -675,9 +664,23 @@ class TS480_CRadio(chirp_common.CloneModeRadio): options = [0.5, 1.0, 2.5, 5.0, 10.0] # SSB/CS/FSK steps if _mem.xmode == 4 or _mem.xmode == 5: # AM/FM options = TS480_TUNE_STEPS[3:] - _mem.step = options.index(mem.tuning_step) + try: + _mem.step = options.index(mem.tuning_step) + except ValueError: + _mem.step = options[0] return + def validate_memory(self, mem): + msgs = super().validate_memory(mem) + if mem.mode in ('AM', 'FM'): + if mem.tuning_step not in TS480_TUNE_STEPS[3:]: + msgs.append(chirp_common.ValidationError( + 'Tuning step %s must be in list %s for %s' % ( + mem.tuning_step, + ','.join(str(x) for x in TS480_TUNE_STEPS[3:]), + mem.mode))) + return msgs + def _parse_mem_spec(self, spec0, spec1): """ Extract ascii memory parameters; build data string """ # spec0 is Rx freq string, spec1 is Tx @@ -763,7 +766,7 @@ class TS480_CRadio(chirp_common.CloneModeRadio): return def my_mhz_val(setting, obj, atrb, ndx=-1): - """ Callback to set freq back to Htz""" + """ Callback to set freq back to Hz """ vx = float(str(setting.value)) vx = int(vx * mhz1) if ndx < 0: @@ -1136,7 +1139,7 @@ class TS480_CRadio(chirp_common.CloneModeRadio): elif element.value.get_mutable(): LOG.debug("Setting %s = %s" % (setting, element.value)) setattr(obj, setting, element.value) - except Exception as e: + except Exception: LOG.debug(element.get_name()) raise return diff --git a/chirp/drivers/ts590.py b/chirp/drivers/ts590.py index 4ca6bf4..091a51c 100644 --- a/chirp/drivers/ts590.py +++ b/chirp/drivers/ts590.py @@ -17,18 +17,14 @@ # along with this program. If not, see . import time -import struct import logging -import re -import math import threading from chirp import chirp_common, directory, memmap -from chirp import bitwise, errors, util +from chirp import bitwise, errors from chirp.settings import RadioSettingGroup, RadioSetting, \ RadioSettingValueBoolean, RadioSettingValueList, \ RadioSettingValueString, RadioSettingValueInteger, \ - RadioSettingValueFloat, RadioSettings, InvalidValueError -from textwrap import dedent + RadioSettingValueFloat, RadioSettings LOG = logging.getLogger(__name__) @@ -142,9 +138,6 @@ TS590_SKIP = ["", "S"] TS590_MODES = ["LSB", "USB", "CW", "FM", "AM", "FSK", "CW-R", "FSK-R", "Data+LSB", "Data+USB", "Data+FM"] EX_MODES = ["FSK-R", "CW-R", "Data+LSB", "Data+USB", "Data+FM"] -for ix in EX_MODES: - if ix not in chirp_common.MODES: - chirp_common.MODES.append(ix) TS590_TONES = list(chirp_common.TONES) TS590_TONES.append(1750.0) @@ -211,7 +204,6 @@ def _connect_radio(radio): (RADIO_IDS[resp], radio.MODEL) raise errors.RadioError(msg) raise errors.RadioError("No response from radio") - return def read_str(radio, trm=";"): @@ -595,10 +587,10 @@ class TS590Radio(chirp_common.CloneModeRadio): 11: " Auto Announcement", 12: " MHz step", 13: " Tuning control adj rate (Hz)", - 16: " SSB tune step (KHz)", - 17: " CW/FSK tune step (KHz)", - 18: " AM tune step (KHz)", - 19: " FM tune step (KHz)", + 16: " SSB tune step (kHz)", + 17: " CW/FSK tune step (kHz)", + 18: " AM tune step (kHz)", + 19: " FM tune step (kHz)", 21: " Max number of Quick Mem chans", 22: " Temporary MR Chan freq allowed", 23: " Program Scan slowdown", @@ -674,28 +666,25 @@ class TS590Radio(chirp_common.CloneModeRadio): @classmethod def get_prompts(cls): rp = chirp_common.RadioPrompts() - rp.info = _(dedent("""\ - Click on the "Special Channels" toggle-button of the memory - editor to see/set the EXT channels. P-VFO channels 100-109 - are considered Settings.\n - Only a subset of the over 200 available radio settings - are supported in this release.\n - Ignore the beeps from the radio on upload and download. - """)) - rp.pre_download = _(dedent("""\ - Follow these instructions to download the radio memory: - 1 - Connect your interface cable - 2 - Radio > Download from radio: DO NOT mess with the radio - during download! - 3 - Disconnect your interface cable - """)) - rp.pre_upload = _(dedent("""\ - Follow these instructions to upload the radio memory: - 1 - Connect your interface cable - 2 - Radio > Upload to radio: DO NOT mess with the radio - during upload! - 3 - Disconnect your interface cable - """)) + rp.info = _( + "Click on the \"Special Channels\" toggle-button of the memory\n" + "editor to see/set the EXT channels. P-VFO channels 100-109\n" + "are considered Settings.\n" + "Only a subset of the over 200 available radio settings\n" + "are supported in this release.\n" + "Ignore the beeps from the radio on upload and download.\n") + rp.pre_download = _( + "Follow these instructions to download the radio memory:\n" + "1 - Connect your interface cable\n" + "2 - Radio > Download from radio: DO NOT mess with the radio\n" + "during download!\n" + "3 - Disconnect your interface cable\n") + rp.pre_upload = _( + "Follow these instructions to upload the radio memory:\n" + "1 - Connect your interface cable\n" + "2 - Radio > Upload to radio: DO NOT mess with the radio\n" + "during upload!\n" + "3 - Disconnect your interface cable\n") return rp def sync_in(self): @@ -979,7 +968,7 @@ class TS590Radio(chirp_common.CloneModeRadio): return def my_mhz_val(setting, obj, atrb, ndx=-1): - """ Callback to set freq back to Htz""" + """ Callback to set freq back to Hz """ vx = float(str(setting.value)) vx = int(vx * mhz1) if ndx < 0: @@ -1289,7 +1278,7 @@ class TS590Radio(chirp_common.CloneModeRadio): rx = RadioSettingValueList(options, options[_mex[mx].ex016]) sx = my_labels(16) if nsg: - sx = "014: Tuning step for SSB/CW/FSK (KHz)" + sx = "014: Tuning step for SSB/CW/FSK (kHz)" rset = RadioSetting("exset.ex016/%d" % mx, sx, rx) rset.set_apply_callback(my_val_list, options, _mex, "ex016", 0, mx) @@ -1644,7 +1633,7 @@ class TS590Radio(chirp_common.CloneModeRadio): elif element.value.get_mutable(): LOG.debug("Setting %s = %s" % (setting, element.value)) setattr(obj, setting, element.value) - except Exception as e: + except Exception: LOG.debug(element.get_name()) raise @@ -1662,7 +1651,7 @@ class TS590SRadio(TS590Radio): ID = "ID021;" SG = False # This is the equivalent Menu A/B list for the TS-590S - # The equivalnt S param is stored in the SG Mem_Format slot + # The equivalent S param is stored in the SG Mem_Format slot EX = ["EX087", "EX000", "EX001", "EX003", "EX004", "EX005", "EX006", "EX007", "EX008", "EX009", "EX010", "EX011", "EX014", "EX014", "EX015", "EX016", "EX017", "EX018", "EX019", "EX020", diff --git a/chirp/drivers/ts850.py b/chirp/drivers/ts850.py index 8fb453d..d367a14 100644 --- a/chirp/drivers/ts850.py +++ b/chirp/drivers/ts850.py @@ -26,8 +26,8 @@ TS850_TMODES = ["", "Tone"] TS850_SKIP = ["", "S"] TS850_MODES = { - "N/A": " ", - "N/A": "0", + "N/A0": " ", + "N/A1": "0", "LSB": "1", "USB": "2", "CW": "3", diff --git a/chirp/drivers/uv5r.py b/chirp/drivers/uv5r.py index a801c8e..ceea43f 100644 --- a/chirp/drivers/uv5r.py +++ b/chirp/drivers/uv5r.py @@ -17,7 +17,6 @@ from builtins import bytes import struct import time -import os import logging from chirp import chirp_common, errors, util, directory, memmap @@ -26,7 +25,6 @@ from chirp.settings import RadioSetting, RadioSettingGroup, \ RadioSettingValueInteger, RadioSettingValueList, \ RadioSettingValueBoolean, RadioSettingValueString, \ RadioSettingValueFloat, InvalidValueError, RadioSettings -from textwrap import dedent LOG = logging.getLogger(__name__) @@ -195,8 +193,10 @@ struct { txpower3:2; } vfob; -#seekto 0x0F56; -u16 fm_presets; +#seekto 0x0F48; // some new radios do not support this feature +char bcstfmlo[14]; // broadcast FM 65-75 MHz band +u16 fm_presets; // broadcast FM frequency +char bcstfmhi[14]; // broadcast FM 75-108 MHz band #seekto 0x1008; struct { @@ -302,7 +302,7 @@ MODE_LIST = ["Channel", "Name", "Frequency"] PONMSG_LIST = ["Full", "Message"] PTTID_LIST = ["Off", "BOT", "EOT", "Both"] PTTIDCODE_LIST = ["%s" % x for x in range(1, 16)] -RTONE_LIST = ["1000 Hz", "1450 Hz", "1750 Hz", "2100Hz"] +RTONE_LIST = ["1000 Hz", "1450 Hz", "1750 Hz", "2100 Hz"] RESUME_LIST = ["TO", "CO", "SE"] ROGERRX_LIST = ["Off"] + AB_LIST RPSTE_LIST = ["OFF"] + ["%s" % x for x in range(1, 11)] @@ -324,64 +324,31 @@ VOICE_LIST = ["Off", "English", "Chinese"] VOX_LIST = ["OFF"] + ["%s" % x for x in range(1, 11)] WORKMODE_LIST = ["Frequency", "Channel"] -SETTING_LISTS = { - "almod": ALMOD_LIST, - "aniid": PTTID_LIST, - "displayab": AB_LIST, - "dtmfst": DTMFST_LIST, - "dtmfspeed": DTMFSPEED_LIST, - "mdfa": MODE_LIST, - "mdfb": MODE_LIST, - "ponmsg": PONMSG_LIST, - "pttid": PTTID_LIST, - "rtone": RTONE_LIST, - "rogerrx": ROGERRX_LIST, - "rpste": RPSTE_LIST, - "rxled": COLOR_LIST, - "save": SAVE_LIST, - "scode": PTTIDCODE_LIST, - "screv": RESUME_LIST, - "sftd": SHIFTD_LIST, - "stedelay": STEDELAY_LIST, - "step": STEP_LIST, - "step291": STEP291_LIST, - "tdrab": TDRAB_LIST, - "tdrch": TDRCH_LIST, - "timeout": TIMEOUT_LIST, - "txled": COLOR_LIST, - "txpower": TXPOWER_LIST, - "txpower3": TXPOWER3_LIST, - "voice": VOICE_LIST, - "vox": VOX_LIST, - "widenarr": BANDWIDTH_LIST, - "workmode": WORKMODE_LIST, - "wtled": COLOR_LIST -} - -GMRS_FREQS1 = [462.5625, 462.5875, 462.6125, 462.6375, 462.6625, - 462.6875, 462.7125] -GMRS_FREQS2 = [467.5625, 467.5875, 467.6125, 467.6375, 467.6625, - 467.6875, 467.7125] -GMRS_FREQS3 = [462.5500, 462.5750, 462.6000, 462.6250, 462.6500, - 462.6750, 462.7000, 462.7250] +GMRS_FREQS1 = [462562500, 462587500, 462612500, 462637500, 462662500, + 462687500, 462712500] +GMRS_FREQS2 = [467562500, 467587500, 467612500, 467637500, 467662500, + 467687500, 467712500] +GMRS_FREQS3 = [462550000, 462575000, 462600000, 462625000, 462650000, + 462675000, 462700000, 462725000] GMRS_FREQS = GMRS_FREQS1 + GMRS_FREQS2 + GMRS_FREQS3 * 2 -def _do_status(radio, block): +def _do_status(radio, direction, block): status = chirp_common.Status() - status.msg = "Cloning" + status.msg = "Cloning %s radio" % direction status.cur = block status.max = radio.get_memsize() radio.status_fn(status) -UV5R_MODEL_ORIG = bytes(b"\x50\xBB\xFF\x01\x25\x98\x4D") -UV5R_MODEL_291 = bytes(b"\x50\xBB\xFF\x20\x12\x07\x25") -UV5R_MODEL_F11 = bytes(b"\x50\xBB\xFF\x13\xA1\x11\xDD") -UV5R_MODEL_UV82 = bytes(b"\x50\xBB\xFF\x20\x13\x01\x05") -UV5R_MODEL_UV6 = bytes(b"\x50\xBB\xFF\x20\x12\x08\x23") -UV5R_MODEL_UV6_ORIG = bytes(b"\x50\xBB\xFF\x12\x03\x98\x4D") -UV5R_MODEL_A58 = bytes(b"\x50\xBB\xFF\x20\x14\x04\x13") -UV5R_MODEL_UV5G = bytes(b"\x50\xBB\xFF\x20\x12\x06\x25") + +UV5R_MODEL_ORIG = b"\x50\xBB\xFF\x01\x25\x98\x4D" +UV5R_MODEL_291 = b"\x50\xBB\xFF\x20\x12\x07\x25" +UV5R_MODEL_F11 = b"\x50\xBB\xFF\x13\xA1\x11\xDD" +UV5R_MODEL_UV82 = b"\x50\xBB\xFF\x20\x13\x01\x05" +UV5R_MODEL_UV6 = b"\x50\xBB\xFF\x20\x12\x08\x23" +UV5R_MODEL_UV6_ORIG = b"\x50\xBB\xFF\x12\x03\x98\x4D" +UV5R_MODEL_A58 = b"\x50\xBB\xFF\x20\x14\x04\x13" +UV5R_MODEL_UV5G = b"\x50\xBB\xFF\x20\x12\x06\x25" def _upper_band_from_data(data): @@ -402,7 +369,6 @@ def _firmware_version_from_image(radio): radio.get_mmap().get_byte_compatible(), radio._fw_ver_file_start, radio._fw_ver_file_stop) - LOG.debug("_firmware_version_from_image: " + util.hexprint(version)) return version @@ -421,7 +387,7 @@ def _do_ident(radio, magic, secondack=True): LOG.debug(repr(ack)) raise errors.RadioError("Radio did not respond") - serial.write(bytes(b"\x02")) + serial.write(b"\x02") # Until recently, the "ident" returned by the radios supported by this # driver have always been 8 bytes long. The image structure is the 8 byte @@ -435,7 +401,7 @@ def _do_ident(radio, magic, secondack=True): # image data aligned with the existing settings structures. # Ok, get the response - response = bytes(b"") + response = b"" for i in range(1, 13): byte = serial.read(1) response += byte @@ -489,7 +455,7 @@ def _read_block(radio, start, size, first_command=False): LOG.debug("CMD: %s ADDR: %04x SIZE: %02x" % (cmd, addr, length)) raise errors.RadioError("Unknown response from radio") - chunk = radio.pipe.read(0x40) + chunk = radio.pipe.read(size) if not chunk: raise errors.RadioError("Radio did not send block 0x%04x" % start) elif len(chunk) != size: @@ -507,10 +473,12 @@ def _get_radio_firmware_version(radio): block = _read_block(radio, 0x1FF0, 0x40, True) version = block[0:6] else: - block1 = _read_block(radio, 0x1EC0, 0x40, True) - block2 = _read_block(radio, 0x1F00, 0x40, False) - block = block1 + block2 - version = block[48:62] + block1 = _read_block(radio, 0x1E80, 0x40, True) + block2 = _read_block(radio, 0x1EC0, 0x40, False) + block3 = _read_block(radio, 0x0F40, 0x40, False) + version = block2[48:62] + brdcstfm = block3[0:30] + return version, brdcstfm return version @@ -534,7 +502,7 @@ def _ident_radio(radio): for magic, reason in list(IDENT_BLACKLIST.items()): try: _do_ident(radio, magic, secondack=False) - except errors.RadioError as e: + except errors.RadioError: # No match, try the next one continue @@ -554,7 +522,10 @@ def _ident_radio(radio): def _do_download(radio): data = _ident_radio(radio) - radio_version = _get_radio_firmware_version(radio) + if radio.MODEL == "BJ-UV55": + radio_version = _get_radio_firmware_version(radio) + else: + radio_version, radio_fm = _get_radio_firmware_version(radio) LOG.info("Radio Version is %s" % repr(radio_version)) if b"HN5RV" in radio_version: @@ -572,7 +543,7 @@ def _do_download(radio): # then append that model type to the end of the image so it can # be properly detected when loaded. append_model = True - elif "\x20" * 14 in radio_version: + elif b"\x20" * 14 in radio_version: # A radio UV-5R style radio that reports no firmware version has # been detected. # We are going to count on the user to make the right choice and @@ -592,8 +563,8 @@ def _do_download(radio): LOG.debug("downloading main block...") for i in range(0, 0x1800, 0x40): data += _read_block(radio, i, 0x40, False) - _do_status(radio, i) - _do_status(radio, radio.get_memsize()) + _do_status(radio, "from", i) + _do_status(radio, "from", radio.get_memsize()) LOG.debug("done.") if radio._aux_block: LOG.debug("downloading aux block...") @@ -628,10 +599,16 @@ def _do_upload(radio): raise errors.RadioError("Image not supported by radio") image_version = _firmware_version_from_image(radio) - radio_version = _get_radio_firmware_version(radio) + if radio.MODEL == "BJ-UV55": + radio_version = _get_radio_firmware_version(radio) + else: + radio_version, radio_fm = _get_radio_firmware_version(radio) LOG.info("Image Version is %s" % repr(image_version)) LOG.info("Radio Version is %s" % repr(radio_version)) + imagev_matched_radiov = image_version == radio_version + _skip_aux_block = False + # default ranges _ranges_main_default = [ (0x0008, 0x0CF8), @@ -639,58 +616,93 @@ def _do_upload(radio): (0x0E08, 0x1808) ] _ranges_aux_default = [ - (0x1EC0, 0x1EF0), + (0x1EC0, 0x1EF0) # 6 key power-on & welcome messages + ] + + # skip broadcast fm range + _ranges_main_no_fm = [ + (0x0008, 0x0CF8), + (0x0D08, 0x0DF8), + (0x0E08, 0x0F48), + (0x0F68, 0x1808) ] # extra aux ranges _ranges_aux_extra = [ - (0x1F60, 0x1F70), - (0x1F80, 0x1F90), - (0x1FC0, 0x1FE0) + (0x1F60, 0x1F70), # squelch thresholds - vhf + (0x1F80, 0x1F90), # squelch thresholds - uhf + (0x1FC0, 0x1FE0) # band limits ] - if image_version == radio_version: - image_matched_radio = True - ranges_main = _ranges_main_default + # set default ranges + ranges_main = _ranges_main_default + ranges_aux = _ranges_aux_default + + # check destination radio for invalid bcst FM data + if b"\xFF" in radio_fm: + # 0x0F48-0x0F65 contains invalid data + # This radio is likely to 'break' the Aux block if it is changed. + # The safest thing to do is to skip uploading of the Aux block. + ranges_main = _ranges_main_no_fm + _skip_aux_block = True + # check source image for invalid bcst FM data + elif "\xFF" in str(radio._memobj.bcstfmlo) or \ + "\xFF" in str(radio._memobj.bcstfmhi): + # 0x0F48-0x0F65 contains invalid data + # This image appears to be from a radio that was likely to 'break' + # the Aux block if it is changed (and could be broken). + # The safest thing to do is to skip uploading of the Aux block. + ranges_main = _ranges_main_no_fm + _skip_aux_block = True + # check if radio and image firmware versions match + elif imagev_matched_radiov: + # matched - allow all safe Aux block ranges ranges_aux = _ranges_aux_default + _ranges_aux_extra - elif any(type in radio_version for type in radio._basetype): - image_matched_radio = False - ranges_main = _ranges_main_default - ranges_aux = _ranges_aux_default - else: - msg = ("The upload was stopped because the firmware " - "version of the image (%s) does not match that " - "of the radio (%s).") - raise errors.RadioError(msg % (image_version, radio_version)) - if not radio._aux_block: - image_matched_radio = True + if radio._all_range_flag: + _skip_aux_block = False + ranges_main = radio._ranges_main + ranges_aux = radio._ranges_aux + LOG.warning('Sending all ranges to radio as instructed') # Main block mmap = radio.get_mmap().get_byte_compatible() for start_addr, end_addr in ranges_main: for i in range(start_addr, end_addr, 0x10): _send_block(radio, i - 0x08, mmap[i:i + 0x10]) - _do_status(radio, i) - _do_status(radio, radio.get_memsize()) + _do_status(radio, "to", i) + _do_status(radio, "to", radio.get_memsize()) if len(mmap.get_packed()) == 0x1808: LOG.info("Old image, not writing aux block") return # Old image, no aux block + if _skip_aux_block: + LOG.info("Skipped writing aux block") + return # Aux block skipped + # Auxiliary block at radio address 0x1EC0, our offset 0x1808 for start_addr, end_addr in ranges_aux: for i in range(start_addr, end_addr, 0x10): addr = 0x1808 + (i - 0x1EC0) _send_block(radio, i, mmap[addr:addr + 0x10]) - if not image_matched_radio: - msg = ("Upload finished, but the 'Other Settings' " - "could not be sent because the firmware " - "version of the image (%s) does not match " - "that of the radio (%s).") + if radio._all_range_flag: + radio._all_range_flag = False + LOG.warning('Sending all ranges to radio has completed') + raise errors.RadioError( + "This is NOT an error.\n" + "The upload has finished successfully.\n" + "Please restart CHIRP.") + + if radio._aux_block and not imagev_matched_radiov: + msg = ("This is NOT an error. The upload finished successfully.\n" + "The 'Other Settings' and 'Service Settings' were skipped " + "because the firmware version of the image (%s) does not " + "match that of the radio (%s).") raise errors.RadioError(msg % (image_version, radio_version)) + UV5R_POWER_LEVELS = [chirp_common.PowerLevel("High", watts=4.00), chirp_common.PowerLevel("Low", watts=1.00)] @@ -698,7 +710,7 @@ UV5R_POWER_LEVELS3 = [chirp_common.PowerLevel("High", watts=8.00), chirp_common.PowerLevel("Med", watts=4.00), chirp_common.PowerLevel("Low", watts=1.00)] -UV5R_DTCS = sorted(chirp_common.DTCS_CODES + [645]) +UV5R_DTCS = tuple(sorted(chirp_common.DTCS_CODES + (645,))) UV5R_CHARSET = chirp_common.CHARSET_UPPER_NUMERIC + \ "!@#$%^&*()+-=[]:\";'<>?,./" @@ -736,7 +748,7 @@ class BaofengUV5R(chirp_common.CloneModeRadio): _uhf_range = (400000000, 520000000) _aux_block = True _tri_power = False - _gmrs = False + _bw_shift = False _mem_params = (0x1828 # poweron_msg offset ) # offset of fw version in image file @@ -761,20 +773,22 @@ class BaofengUV5R(chirp_common.CloneModeRadio): 'your device. Thus far and to the best knowledge of the ' 'author, no UV-5R radios have been harmed by using CHIRP. ' 'However, proceed at your own risk!') - rp.pre_download = _(dedent("""\ - 1. Turn radio off. - 2. Connect cable to mic/spkr connector. - 3. Make sure connector is firmly connected. - 4. Turn radio on (volume may need to be set at 100%). - 5. Ensure that the radio is tuned to channel with no activity. - 6. Click OK to download image from device.""")) - rp.pre_upload = _(dedent("""\ - 1. Turn radio off. - 2. Connect cable to mic/spkr connector. - 3. Make sure connector is firmly connected. - 4. Turn radio on (volume may need to be set at 100%). - 5. Ensure that the radio is tuned to channel with no activity. - 6. Click OK to upload image to device.""")) + rp.pre_download = _( + "1. Turn radio off.\n" + "2. Connect cable to mic/spkr connector.\n" + "3. Make sure connector is firmly connected.\n" + "4. Turn radio on (volume may need to be set at 100%).\n" + "5. Ensure that the radio is tuned to channel with no" + " activity.\n" + "6. Click OK to download image from device.\n") + rp.pre_upload = _( + "1. Turn radio off.\n" + "2. Connect cable to mic/spkr connector.\n" + "3. Make sure connector is firmly connected.\n" + "4. Turn radio on (volume may need to be set at 100%).\n" + "5. Ensure that the radio is tuned to channel with no" + " activity.\n" + "6. Click OK to upload image to device.\n") return rp def get_features(self): @@ -824,31 +838,7 @@ class BaofengUV5R(chirp_common.CloneModeRadio): def process_mmap(self): self._memobj = bitwise.parse(MEM_FORMAT % self._mem_params, self._mmap) - - def validate_memory(self, mem): - msgs = chirp_common.CloneModeRadio.validate_memory(self, mem) - - _msg_duplex2 = 'Memory location only supports "(None)" or "off"' - _msg_duplex3 = 'Memory location only supports "(None)", "+" or "off"' - - if self._gmrs: - if mem.number < 1 or mem.number > 30: - if float(mem.freq) / 1000000 in GMRS_FREQS1: - if mem.duplex not in ['', 'off']: - # warn user wrong Duplex - msgs.append(chirp_common.ValidationError(_msg_duplex2)) - - if float(mem.freq) / 1000000 in GMRS_FREQS2: - if mem.duplex not in ['', 'off']: - # warn user wrong Duplex - msgs.append(chirp_common.ValidationError(_msg_duplex2)) - - if float(mem.freq) / 1000000 in GMRS_FREQS3: - if mem.duplex not in ['', '+', 'off']: - # warn user wrong Duplex - msgs.append(chirp_common.ValidationError(_msg_duplex3)) - - return msgs + self._all_range_flag = False def sync_in(self): try: @@ -992,6 +982,17 @@ class BaofengUV5R(chirp_common.CloneModeRadio): PTTIDCODE_LIST[_mem.scode])) mem.extra.append(rs) + immutable = [] + + if self.MODEL == "GT-5R": + if not ((mem.freq >= self.vhftx[0] and mem.freq < self.vhftx[1]) or + (mem.freq >= self.uhftx[0] and mem.freq < self.uhftx[1])): + mem.duplex = 'off' + mem.offset = 0 + immutable = ["duplex", "offset"] + + mem.immutable = immutable + return mem def _set_mem(self, number): @@ -1025,33 +1026,6 @@ class BaofengUV5R(chirp_common.CloneModeRadio): _mem.set_raw("\x00" * 16) - if self._gmrs: - if mem.number >= 1 and mem.number <= 30: - GMRS_FREQ = int(GMRS_FREQS[mem.number - 1] * 1000000) - mem.freq = GMRS_FREQ - if mem.number <= 22: - mem.duplex = '' - mem.offset = 0 - if mem.number >= 8 and mem.number <= 14: - mem.mode = "NFM" - mem.power = UV5R_POWER_LEVELS[1] - if mem.number > 22: - mem.duplex = '+' - mem.offset = 5000000 - elif float(mem.freq) / 1000000 in GMRS_FREQS: - if float(mem.freq) / 1000000 in GMRS_FREQS2: - mem.offset = 0 - mem.mode = "NFM" - mem.power = UV5R_POWER_LEVELS[1] - if float(mem.freq) / 1000000 in GMRS_FREQS3: - if mem.duplex == '+': - mem.offset = 5000000 - else: - mem.offset = 0 - else: - mem.duplex = 'off' - mem.offset = 0 - _mem.rxfreq = mem.freq / 10 if mem.duplex == "off": @@ -1130,7 +1104,6 @@ class BaofengUV5R(chirp_common.CloneModeRadio): def _is_orig(self): version_tag = _firmware_version_from_image(self) - LOG.debug("@_is_orig, version_tag: %s", util.hexprint(version_tag)) try: if b'BFB' in version_tag: idx = version_tag.index(b"BFB") + 3 @@ -1155,6 +1128,7 @@ class BaofengUV5R(chirp_common.CloneModeRadio): return band_tag def _get_settings(self): + _mem = self._memobj _ani = self._memobj.ani _fm_presets = self._memobj.fm_presets _settings = self._memobj.settings @@ -1162,6 +1136,9 @@ class BaofengUV5R(chirp_common.CloneModeRadio): _vfoa = self._memobj.vfoa _vfob = self._memobj.vfob _wmchannel = self._memobj.wmchannel + _has_fmradio = (str(_mem.bcstfmlo) == " FM 65-75M" and + str(_mem.bcstfmhi) == " FM 76-108M") + basic = RadioSettingGroup("basic", "Basic Settings") advanced = RadioSettingGroup("advanced", "Advanced Settings") @@ -1367,6 +1344,19 @@ class BaofengUV5R(chirp_common.CloneModeRadio): RadioSettingValueList(RTONE_LIST, RTONE_LIST[_settings.tdrch])) advanced.append(rs) + def set_range_flag(setting): + val = [85, 115, 101, 65, 116, 79, 119, 110, 82, 105, 115, 107] + if [ord(x) for x in str(setting.value).strip()] == val: + self._all_range_flag = True + else: + self._all_range_flag = False + LOG.debug('Set range flag to %s' % self._all_range_flag) + + rs = RadioSetting("allrange", "Range Override Parameter", + RadioSettingValueString(0, 12, "Default")) + rs.set_apply_callback(set_range_flag) + advanced.append(rs) + if len(self._mmap.get_packed()) == 0x1808: # Old image, without aux block return group @@ -1395,30 +1385,35 @@ class BaofengUV5R(chirp_common.CloneModeRadio): rs = RadioSetting("firmware_msg.line2", "Firmware Message 2", val) other.append(rs) + aux_settings = [] + _msg = self._memobj.sixpoweron_msg - rs = RadioSetting("sixpoweron_msg.line1", "6+Power-On Message 1", + rs = RadioSetting("sixpoweron_msg.line1", + "6+Power-On Message 1", RadioSettingValueString( 0, 7, _filter(_msg.line1))) - other.append(rs) - rs = RadioSetting("sixpoweron_msg.line2", "6+Power-On Message 2", + aux_settings.append(rs) + rs = RadioSetting("sixpoweron_msg.line2", + "6+Power-On Message 2", RadioSettingValueString( 0, 7, _filter(_msg.line2))) - other.append(rs) + aux_settings.append(rs) _msg = self._memobj.poweron_msg rs = RadioSetting("poweron_msg.line1", "Power-On Message 1", RadioSettingValueString( 0, 7, _filter(_msg.line1))) - other.append(rs) + aux_settings.append(rs) rs = RadioSetting("poweron_msg.line2", "Power-On Message 2", RadioSettingValueString( 0, 7, _filter(_msg.line2))) - other.append(rs) + aux_settings.append(rs) rs = RadioSetting("ponmsg", "Power-On Message", RadioSettingValueList( - PONMSG_LIST, PONMSG_LIST[_settings.ponmsg])) - other.append(rs) + PONMSG_LIST, + PONMSG_LIST[_settings.ponmsg])) + aux_settings.append(rs) if self._is_orig(): limit = "limits_old" @@ -1426,32 +1421,46 @@ class BaofengUV5R(chirp_common.CloneModeRadio): limit = "limits_new" vhf_limit = getattr(self._memobj, limit).vhf - rs = RadioSetting("%s.vhf.lower" % limit, "VHF Lower Limit (MHz)", + rs = RadioSetting("%s.vhf.lower" % limit, + "VHF Lower Limit (MHz)", RadioSettingValueInteger(1, 1000, vhf_limit.lower)) - other.append(rs) + aux_settings.append(rs) - rs = RadioSetting("%s.vhf.upper" % limit, "VHF Upper Limit (MHz)", + rs = RadioSetting("%s.vhf.upper" % limit, + "VHF Upper Limit (MHz)", RadioSettingValueInteger(1, 1000, vhf_limit.upper)) - other.append(rs) + aux_settings.append(rs) rs = RadioSetting("%s.vhf.enable" % limit, "VHF TX Enabled", RadioSettingValueBoolean(vhf_limit.enable)) - other.append(rs) + aux_settings.append(rs) uhf_limit = getattr(self._memobj, limit).uhf - rs = RadioSetting("%s.uhf.lower" % limit, "UHF Lower Limit (MHz)", + 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)", + aux_settings.append(rs) + rs = RadioSetting("%s.uhf.upper" % limit, + "UHF Upper Limit (MHz)", RadioSettingValueInteger(1, 1000, uhf_limit.upper)) - other.append(rs) + aux_settings.append(rs) rs = RadioSetting("%s.uhf.enable" % limit, "UHF TX Enabled", RadioSettingValueBoolean(uhf_limit.enable)) - other.append(rs) + aux_settings.append(rs) + + hn5rv_warn = ('This setting will not be uploaded to your radio ' + 'because some radios with your firmware version are ' + 'known to be broken when CHIRP sends that data ' + 'to them. Please see bug #10505 on the CHIRP ' + 'issue tracker for more details.') + for setting in aux_settings: + if not _has_fmradio: + setting.set_warning(hn5rv_warn) + other.append(setting) if self.MODEL != "UV-6": workmode = RadioSettingGroup("workmode", "Work Mode Settings") @@ -1626,18 +1635,30 @@ class BaofengUV5R(chirp_common.CloneModeRadio): STEP_LIST, STEP_LIST[_vfob.step])) workmode.append(rs) - fm_preset = RadioSettingGroup("fm_preset", "FM Radio Preset") - group.append(fm_preset) - - 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) + if _has_fmradio: + fm_preset = RadioSettingGroup("fm_preset", "FM Radio Preset") + group.append(fm_preset) + + # broadcast FM settings + value = self._memobj.fm_presets + value_shifted = ((value & 0x00FF) << 8) | ((value & 0xFF00) >> 8) + if value_shifted >= 65.0 * 10 and value_shifted <= 108.0 * 10: + # storage method 3 (discovered 2022) + self._bw_shift = True + preset = value_shifted / 10.0 + elif value >= 65.0 * 10 and value <= 108.0 * 10: + # storage method 2 + preset = value / 10.0 + elif value <= 108.0 * 10 - 650: + # original storage method (2012) + preset = value / 10.0 + 65 + else: + # unknown (undiscovered method or no FM chip?) + preset = False + if preset: + rs = RadioSettingValueFloat(65, 108.0, preset, 0.1, 1) + rset = RadioSetting("fm_presets", "FM Preset(MHz)", rs) + fm_preset.append(rset) dtmf = RadioSettingGroup("dtmf", "DTMF Settings") group.append(dtmf) @@ -1750,6 +1771,8 @@ class BaofengUV5R(chirp_common.CloneModeRadio): RadioSettingValueInteger( 0, 123, getattr(_obj, "sql%i" % (index)))) + if not _has_fmradio: + rs.set_warning(hn5rv_warn) service.append(rs) return group @@ -1795,7 +1818,7 @@ class BaofengUV5R(chirp_common.CloneModeRadio): elif element.value.get_mutable(): LOG.debug("Setting %s = %s" % (setting, element.value)) setattr(obj, setting, element.value) - except Exception as e: + except Exception: LOG.debug(element.get_name()) raise @@ -1808,8 +1831,10 @@ class BaofengUV5R(chirp_common.CloneModeRadio): else: value = int(val.get_value() * 10) LOG.debug("Setting fm_presets = %s" % (value)) + if self._bw_shift: + value = ((value & 0x00FF) << 8) | ((value & 0xFF00) >> 8) self._memobj.fm_presets = value - except Exception as e: + except Exception: LOG.debug(element.get_name()) raise @@ -2061,17 +2086,22 @@ class RadioddityGT5RRadio(BaofengUV5R): vhftx = [144000000, 148000000] uhftx = [420000000, 450000000] - def set_memory(self, mem): - # If memory is outside the TX limits, the radio will refuse - # transmit. Radioddity asked for us to enforce this behavior - # in chirp for consistency. - if not (mem.freq >= self.vhftx[0] and mem.freq < self.vhftx[1]) and \ - not (mem.freq >= self.uhftx[0] and mem.freq < self.uhftx[1]): - LOG.info('Memory frequency outside TX limits of radio; ' - 'forcing duplex=off') - mem.duplex = 'off' - mem.offset = 0 - BaofengUV5R.set_memory(self, mem) + def validate_memory(self, mem): + msgs = super().validate_memory(mem) + + _msg_duplex = 'Duplex must be "off" for this frequency' + _msg_offset = 'Only simplex or +5 MHz offset allowed on GMRS' + + if not ((mem.freq >= self.vhftx[0] and mem.freq < self.vhftx[1]) or + (mem.freq >= self.uhftx[0] and mem.freq < self.uhftx[1])): + if mem.duplex != "off": + msgs.append(chirp_common.ValidationWarning(_msg_duplex)) + + return msgs + + def check_set_memory_immutable_policy(self, existing, new): + existing.immutable = [] + super().check_set_memory_immutable_policy(existing, new) @classmethod def match_model(cls, filename, filedata): @@ -2085,7 +2115,6 @@ class RadioddityUV5GRadio(BaofengUV5R): _basetype = BASETYPE_UV5R _idents = [UV5R_MODEL_UV5G] - _gmrs = True @classmethod def match_model(cls, filename, filedata): diff --git a/chirp/drivers/uv5x3.py b/chirp/drivers/uv5x3.py index 039edec..3f633e9 100644 --- a/chirp/drivers/uv5x3.py +++ b/chirp/drivers/uv5x3.py @@ -14,40 +14,36 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import time -import struct import logging -import re from chirp.drivers import baofeng_common -from chirp import chirp_common, directory, memmap -from chirp import bitwise, errors, util +from chirp import chirp_common, directory +from chirp import bitwise from chirp.settings import RadioSettingGroup, RadioSetting, \ RadioSettingValueBoolean, RadioSettingValueList, \ RadioSettingValueString, RadioSettingValueInteger, \ RadioSettingValueFloat, RadioSettings, \ InvalidValueError -from textwrap import dedent LOG = logging.getLogger(__name__) # #### MAGICS ######################################################### # BTECH UV-5X3 magic string -MSTRING_UV5X3 = "\x50\x0D\x0C\x20\x16\x03\x28" +MSTRING_UV5X3 = b"\x50\x0D\x0C\x20\x16\x03\x28" # MTC UV-5R-3 magic string -MSTRING_UV5R3 = "\x50\x0D\x0C\x20\x17\x09\x19" +MSTRING_UV5R3 = b"\x50\x0D\x0C\x20\x17\x09\x19" # #### ID strings ##################################################### # BTECH UV-5X3 -UV5X3_fp1 = "UVVG302" # BFB300 original -UV5X3_fp2 = "UVVG301" # UVV300 original -UV5X3_fp3 = "UVVG306" # UVV306 original +UV5X3_fp1 = b"UVVG302" # BFB300 original +UV5X3_fp2 = b"UVVG301" # UVV300 original +UV5X3_fp3 = b"UVVG306" # UVV306 original # MTC UV-5R-3 -UV5R3_fp1 = "5R31709" +UV5R3_fp1 = b"5R31709" DTMF_CHARS = " 1234567890*#ABCD" STEPS = [2.5, 5.0, 6.25, 10.0, 12.5, 20.0, 25.0, 50.0] @@ -102,6 +98,7 @@ class UV5X3(baofeng_common.BaofengCommonHT): """BTech UV-5X3""" VENDOR = "BTECH" MODEL = "UV-5X3" + NEEDS_COMPAT_SERIAL = False _fileid = [UV5X3_fp3, UV5X3_fp2, @@ -129,7 +126,7 @@ class UV5X3(baofeng_common.BaofengCommonHT): "!@#$%^&*()+-=[]:\";'<>?,./" LENGTH_NAME = 7 SKIP_VALUES = ["", "S"] - DTCS_CODES = sorted(chirp_common.DTCS_CODES + [645]) + DTCS_CODES = tuple(sorted(chirp_common.DTCS_CODES + (645,))) POWER_LEVELS = [chirp_common.PowerLevel("High", watts=5.00), chirp_common.PowerLevel("Low", watts=1.00)] VALID_BANDS = [(130000000, 180000000), @@ -417,22 +414,18 @@ class UV5X3(baofeng_common.BaofengCommonHT): ('Please save an unedited copy of your first successful\n' 'download to a CHIRP Radio Images(*.img) file.' ) - rp.pre_download = _(dedent("""\ - Follow these instructions to download your info: - - 1 - Turn off your radio - 2 - Connect your interface cable - 3 - Turn on your radio - 4 - Do the download of your radio data - """)) - rp.pre_upload = _(dedent("""\ - Follow this instructions to upload your info: - - 1 - Turn off your radio - 2 - Connect your interface cable - 3 - Turn on your radio - 4 - Do the upload of your radio data - """)) + rp.pre_download = _( + "Follow these instructions to download your info:\n" + "1 - Turn off your radio\n" + "2 - Connect your interface cable\n" + "3 - Turn on your radio\n" + "4 - Do the download of your radio data\n") + rp.pre_upload = _( + "Follow this instructions to upload your info:\n" + "1 - Turn off your radio\n" + "2 - Connect your interface cable\n" + "3 - Turn on your radio\n" + "4 - Do the upload of your radio data\n") return rp def process_mmap(self): diff --git a/chirp/drivers/uv6r.py b/chirp/drivers/uv6r.py index 0cbc7d8..0acca29 100644 --- a/chirp/drivers/uv6r.py +++ b/chirp/drivers/uv6r.py @@ -14,33 +14,29 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import time -import struct import logging -import re from chirp.drivers import baofeng_common -from chirp import chirp_common, directory, memmap -from chirp import bitwise, errors, util +from chirp import chirp_common, directory +from chirp import bitwise from chirp.settings import RadioSettingGroup, RadioSetting, \ RadioSettingValueBoolean, RadioSettingValueList, \ RadioSettingValueString, RadioSettingValueInteger, \ RadioSettingValueFloat, RadioSettings, \ InvalidValueError -from textwrap import dedent LOG = logging.getLogger(__name__) # #### MAGICS ######################################################### # Baofeng UV-6R magic string -MSTRING_UV6R = "\x50\xBB\xFF\x20\x14\x11\x22" +MSTRING_UV6R = b"\x50\xBB\xFF\x20\x14\x11\x22" # #### ID strings ##################################################### # Baofeng UV-6R -UV6R_fp1 = " BF230#1" -UV6R_fp2 = " BF230#2" +UV6R_fp1 = b" BF230#1" +UV6R_fp2 = b" BF230#2" DTMF_CHARS = "0123456789 *#ABCD" STEPS = [2.5, 5.0, 6.25, 10.0, 12.5, 20.0, 25.0, 50.0] @@ -83,7 +79,7 @@ def model_match(cls, data): rid2 = data[0x1FD0:0x1FD5] - if rid2 == cls.MODEL: + if rid2 == cls.MODEL.encode(): match_rid2 = True if match_rid1 and match_rid2: @@ -97,6 +93,7 @@ class UV6R(baofeng_common.BaofengCommonHT): """Baofeng UV-6R""" VENDOR = "Baofeng" MODEL = "UV-6R" + NEEDS_COMPAT_SERIAL = False _fileid = [UV6R_fp2, UV6R_fp1, ] @@ -116,9 +113,9 @@ class UV6R(baofeng_common.BaofengCommonHT): MODES = ["FM", "NFM"] VALID_CHARS = chirp_common.CHARSET_ALPHANUMERIC + \ "!@#$%^&*()+-=[]:\";'<>?,./" - LENGTH_NAME = 6 + LENGTH_NAME = 7 # older radios may only support 6 character names SKIP_VALUES = ["", "S"] - DTCS_CODES = sorted(chirp_common.DTCS_CODES + [645]) + DTCS_CODES = tuple(sorted(chirp_common.DTCS_CODES + (645,))) POWER_LEVELS = [chirp_common.PowerLevel("High", watts=5.00), chirp_common.PowerLevel("Low", watts=1.00)] VALID_BANDS = [(136000000, 174000000), @@ -282,8 +279,8 @@ class UV6R(baofeng_common.BaofengCommonHT): #seekto 0x1000; struct { - char name[6]; - u8 unknown[10]; + char name[7]; + u8 unknown[9]; } names[128]; #seekto 0x1F40; @@ -341,22 +338,18 @@ class UV6R(baofeng_common.BaofengCommonHT): 'Please save an unedited copy of your first successful\n' 'download to a CHIRP Radio Images(*.img) file.' ) - rp.pre_download = _(dedent("""\ - Follow these instructions to download your info: - - 1 - Turn off your radio - 2 - Connect your interface cable - 3 - Turn on your radio - 4 - Do the download of your radio data - """)) - rp.pre_upload = _(dedent("""\ - Follow this instructions to upload your info: - - 1 - Turn off your radio - 2 - Connect your interface cable - 3 - Turn on your radio - 4 - Do the upload of your radio data - """)) + rp.pre_download = _( + "Follow these instructions to download your info:\n" + "1 - Turn off your radio\n" + "2 - Connect your interface cable\n" + "3 - Turn on your radio\n" + "4 - Do the download of your radio data\n") + rp.pre_upload = _( + "Follow this instructions to upload your info:\n" + "1 - Turn off your radio\n" + "2 - Connect your interface cable\n" + "3 - Turn on your radio\n" + "4 - Do the upload of your radio data\n") return rp def process_mmap(self): diff --git a/chirp/drivers/uvb5.py b/chirp/drivers/uvb5.py index 32e2a89..d0ec2c4 100644 --- a/chirp/drivers/uvb5.py +++ b/chirp/drivers/uvb5.py @@ -22,7 +22,6 @@ from chirp.settings import RadioSetting, RadioSettingGroup, \ RadioSettingValueBoolean, RadioSettingValueList, \ RadioSettingValueInteger, RadioSettingValueString, \ RadioSettingValueFloat, RadioSettings -from textwrap import dedent LOG = logging.getLogger(__name__) @@ -209,7 +208,7 @@ def do_download(radio): data += (b"\x00" * 16) firstack = None for i in range(0, 0x1000, 16): - frame = struct.pack(">cHB", "R", i, 16) + frame = struct.pack(">cHB", b"R", i, 16) radio.pipe.write(frame) result = radio.pipe.read(20) if frame[1:4] != result[1:4]: @@ -252,6 +251,7 @@ def do_upload(radio): LOG.debug("Radio ACK'd block at address 0x%04x" % i) do_status(radio, "to", i) + DUPLEX = ["", "-", "+"] UVB5_STEPS = [5.00, 6.25, 10.0, 12.5, 20.0, 25.0] CHARSET = "0123456789- ABCDEFGHIJKLMNOPQRSTUVWXYZ/_+*" @@ -284,20 +284,22 @@ class BaofengUVB5(chirp_common.CloneModeRadio, 'safe thing to do. However, modifications to these values may ' 'have unintended consequences, including damage to your ' 'device. You have been warned. Proceed at your own risk!') - rp.pre_download = _(dedent("""\ - 1. Turn radio off. - 2. Connect cable to mic/spkr connector. - 3. Make sure connector is firmly connected. - 4. Turn radio on. - 5. Ensure that the radio is tuned to channel with no activity. - 6. Click OK to download image from device.""")) - rp.pre_upload = _(dedent("""\ - 1. Turn radio off. - 2. Connect cable to mic/spkr connector. - 3. Make sure connector is firmly connected. - 4. Turn radio on. - 5. Ensure that the radio is tuned to channel with no activity. - 6. Click OK to upload image to device.""")) + rp.pre_download = _( + "1. Turn radio off.\n" + "2. Connect cable to mic/spkr connector.\n" + "3. Make sure connector is firmly connected.\n" + "4. Turn radio on.\n" + "5. Ensure that the radio is tuned to channel with no" + " activity.\n" + "6. Click OK to download image from device.\n") + rp.pre_upload = _( + "1. Turn radio off.\n" + "2. Connect cable to mic/spkr connector.\n" + "3. Make sure connector is firmly connected.\n" + "4. Turn radio on.\n" + "5. Ensure that the radio is tuned to channel with no" + " activity.\n" + "6. Click OK to upload image to device.\n") return rp def get_features(self): @@ -388,7 +390,7 @@ class BaofengUVB5(chirp_common.CloneModeRadio, if isinstance(number, str): return (getattr(self._memobj, number.lower()), None) elif number < 0: - for k, v in list(SPECIALS.items()): + for k, v in list(self.SPECIALS.items()): if number == v: return (getattr(self._memobj, k.lower()), None) else: @@ -702,7 +704,7 @@ class BaofengUVB5(chirp_common.CloneModeRadio, 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], + name = "%s MHz %s Power" % (vhfdata[index], powernamedata[power]) rs = RadioSetting( key, name, RadioSettingValueInteger( @@ -714,7 +716,7 @@ class BaofengUVB5(chirp_common.CloneModeRadio, 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], + name = "%s MHz %s Power" % (uhfdata[index], powernamedata[power]) rs = RadioSetting( key, name, RadioSettingValueInteger( @@ -773,7 +775,7 @@ class BaofengUVB5(chirp_common.CloneModeRadio, else: LOG.debug("Setting %s = %s" % (setting, element.value)) setattr(obj, setting, element.value) - except Exception as e: + except Exception: LOG.debug(element.get_name()) raise @@ -789,7 +791,7 @@ class BaofengUVB5(chirp_common.CloneModeRadio, LOG.debug("Setting fm_presets[%1i] = %s" % (index, value)) setting = self._memobj.fm_presets setting[index] = value - except Exception as e: + except Exception: LOG.debug(element.get_name()) raise diff --git a/chirp/drivers/uvk5.py b/chirp/drivers/uvk5.py new file mode 100644 index 0000000..aba8408 --- /dev/null +++ b/chirp/drivers/uvk5.py @@ -0,0 +1,2058 @@ +# Quansheng UV-K5 driver (c) 2023 Jacek Lipkowski +# +# based on template.py Copyright 2012 Dan Smith +# +# +# This is a preliminary version of a driver for the UV-K5 +# It is based on my reverse engineering effort described here: +# https://github.com/sq5bpf/uvk5-reverse-engineering +# +# Warning: this driver is experimental, it may brick your radio, +# eat your lunch and mess up your configuration. +# +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + + +import struct +import logging + +from chirp import chirp_common, directory, bitwise, memmap, errors, util +from chirp.settings import RadioSetting, RadioSettingGroup, \ + RadioSettingValueBoolean, RadioSettingValueList, \ + RadioSettingValueInteger, RadioSettingValueString, \ + RadioSettings + +LOG = logging.getLogger(__name__) + +# Show the obfuscated version of commands. Not needed normally, but +# might be useful for someone who is debugging a similar radio +DEBUG_SHOW_OBFUSCATED_COMMANDS = False + +# Show the memory being written/received. Not needed normally, because +# this is the same information as in the packet hexdumps, but +# might be useful for someone debugging some obscure memory issue +DEBUG_SHOW_MEMORY_ACTIONS = False + +MEM_FORMAT = """ +#seekto 0x0000; +struct { + ul32 freq; + ul32 offset; + u8 rxcode; + u8 txcode; + + u8 unknown1:2, + txcodeflag:2, + unknown2:2, + rxcodeflag:2; + + //u8 flags1; + u8 flags1_unknown7:1, + flags1_unknown6:1, + flags1_unknown5:1, + enable_am:1, + flags1_unknown3:1, + is_in_scanlist:1, + shift:2; + + //u8 flags2; + u8 flags2_unknown7:1, + flags2_unknown6:1, + flags2_unknown5:1, + bclo:1, + txpower:2, + bandwidth:1, + freq_reverse:1; + + //u8 dtmf_flags; + u8 dtmf_flags_unknown7:1, + dtmf_flags_unknown6:1, + dtmf_flags_unknown5:1, + dtmf_flags_unknown4:1, + dtmf_flags_unknown3:1, + dtmf_pttid:2, + dtmf_decode:1; + + + u8 step; + u8 scrambler; +} channel[214]; + +#seekto 0xd60; +struct { +u8 is_scanlist1:1, +is_scanlist2:1, +unknown1:1, +unknown2:1, +is_free:1, +band:3; +} channel_attributes[200]; + +#seekto 0xe40; +ul16 fmfreq[20]; + +#seekto 0xe70; +u8 call_channel; +u8 squelch; +u8 max_talk_time; +u8 noaa_autoscan; +u8 key_lock; +u8 vox_switch; +u8 vox_level; +u8 mic_gain; +u8 unknown3; +u8 channel_display_mode; +u8 crossband; +u8 battery_save; +u8 dual_watch; +u8 backlight_auto_mode; +u8 tail_note_elimination; +u8 vfo_open; + +#seekto 0xe90; +u8 beep_control; +u8 key1_shortpress_action; +u8 key1_longpress_action; +u8 key2_shortpress_action; +u8 key2_longpress_action; +u8 scan_resume_mode; +u8 auto_keypad_lock; +u8 power_on_dispmode; +u8 password[4]; + +#seekto 0xea0; +u8 keypad_tone; +u8 language; + +#seekto 0xea8; +u8 alarm_mode; +u8 reminding_of_end_talk; +u8 repeater_tail_elimination; + +#seekto 0xeb0; +char logo_line1[16]; +char logo_line2[16]; + +#seekto 0xed0; +struct { +u8 side_tone; +char separate_code; +char group_call_code; +u8 decode_response; +u8 auto_reset_time; +u8 preload_time; +u8 first_code_persist_time; +u8 hash_persist_time; +u8 code_persist_time; +u8 code_interval_time; +u8 permit_remote_kill; +} dtmf_settings; + +#seekto 0xee0; +struct { +char dtmf_local_code[3]; +char unused1[5]; +char kill_code[5]; +char unused2[3]; +char revive_code[5]; +char unused3[3]; +char dtmf_up_code[16]; +char dtmf_down_code[16]; +} dtmf_settings_numbers; + +#seekto 0xf18; +u8 scanlist_default; +u8 scanlist1_priority_scan; +u8 scanlist1_priority_ch1; +u8 scanlist1_priority_ch2; +u8 scanlist2_priority_scan; +u8 scanlist2_priority_ch1; +u8 scanlist2_priority_ch2; +u8 scanlist_unknown_0xff; + + +#seekto 0xf40; +struct { +u8 flock; +u8 tx350; +u8 killed; +u8 tx200; +u8 tx500; +u8 en350; +u8 enscramble; +} lock; + +#seekto 0xf50; +struct { +char name[16]; +} channelname[200]; + +#seekto 0x1c00; +struct { +char name[8]; +char number[3]; +char unused_00[5]; +} dtmfcontact[16]; + +#seekto 0x1ed0; +struct { +struct { + u8 start; + u8 mid; + u8 end; +} low; +struct { + u8 start; + u8 mid; + u8 end; +} medium; +struct { + u8 start; + u8 mid; + u8 end; +} high; +u8 unused_00[7]; +} perbandpowersettings[7]; + +#seekto 0x1f40; +ul16 battery_level[6]; +""" +# bits that we will save from the channel structure (mostly unknown) +SAVE_MASK_0A = 0b11001100 +SAVE_MASK_0B = 0b11101100 +SAVE_MASK_0C = 0b11100000 +SAVE_MASK_0D = 0b11111000 +SAVE_MASK_0E = 0b11110001 +SAVE_MASK_0F = 0b11110000 + +# flags1 +FLAGS1_OFFSET_NONE = 0b00 +FLAGS1_OFFSET_MINUS = 0b10 +FLAGS1_OFFSET_PLUS = 0b01 + +POWER_HIGH = 0b10 +POWER_MEDIUM = 0b01 +POWER_LOW = 0b00 + +# dtmf_flags +PTTID_LIST = ["off", "BOT", "EOT", "BOTH"] + +# power +UVK5_POWER_LEVELS = [chirp_common.PowerLevel("Low", watts=1.50), + chirp_common.PowerLevel("Med", watts=3.00), + chirp_common.PowerLevel("High", watts=5.00), + ] + +# scrambler +SCRAMBLER_LIST = ["off", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10"] + +# channel display mode +CHANNELDISP_LIST = ["Frequency", "Channel No", "Channel Name"] +# battery save +BATSAVE_LIST = ["OFF", "1:1", "1:2", "1:3", "1:4"] + +# Backlight auto mode +BACKLIGHT_LIST = ["Off", "1s", "2s", "3s", "4s", "5s"] + +# Crossband receiving/transmitting +CROSSBAND_LIST = ["Off", "Band A", "Band B"] +DUALWATCH_LIST = CROSSBAND_LIST + +# steps +STEPS = [2.5, 5.0, 6.25, 10.0, 12.5, 25.0, 8.33] + +# ctcss/dcs codes +TMODES = ["", "Tone", "DTCS", "DTCS"] +TONE_NONE = 0 +TONE_CTCSS = 1 +TONE_DCS = 2 +TONE_RDCS = 3 + + +CTCSS_TONES = [ + 67.0, 69.3, 71.9, 74.4, 77.0, 79.7, 82.5, 85.4, + 88.5, 91.5, 94.8, 97.4, 100.0, 103.5, 107.2, 110.9, + 114.8, 118.8, 123.0, 127.3, 131.8, 136.5, 141.3, 146.2, + 151.4, 156.7, 159.8, 162.2, 165.5, 167.9, 171.3, 173.8, + 177.3, 179.9, 183.5, 186.2, 189.9, 192.8, 196.6, 199.5, + 203.5, 206.5, 210.7, 218.1, 225.7, 229.1, 233.6, 241.8, + 250.3, 254.1 +] + +# lifted from ft4.py +DTCS_CODES = [ + 23, 25, 26, 31, 32, 36, 43, 47, 51, 53, 54, + 65, 71, 72, 73, 74, 114, 115, 116, 122, 125, 131, + 132, 134, 143, 145, 152, 155, 156, 162, 165, 172, 174, + 205, 212, 223, 225, 226, 243, 244, 245, 246, 251, 252, + 255, 261, 263, 265, 266, 271, 274, 306, 311, 315, 325, + 331, 332, 343, 346, 351, 356, 364, 365, 371, 411, 412, + 413, 423, 431, 432, 445, 446, 452, 454, 455, 462, 464, + 465, 466, 503, 506, 516, 523, 526, 532, 546, 565, 606, + 612, 624, 627, 631, 632, 654, 662, 664, 703, 712, 723, + 731, 732, 734, 743, 754 +] + +FLOCK_LIST = ["Off", "FCC", "CE", "GB", "430", "438"] + +SCANRESUME_LIST = ["TO: Resume after 5 seconds", + "CO: Resume after signal disappears", + "SE: Stop scanning after receiving a signal"] + +WELCOME_LIST = ["Full Screen", "Welcome Info", "Voltage"] +KEYPADTONE_LIST = ["Off", "Chinese", "English"] +LANGUAGE_LIST = ["Chinese", "English"] +ALARMMODE_LIST = ["SITE", "TONE"] +REMENDOFTALK_LIST = ["Off", "ROGER", "MDC"] +RTE_LIST = ["Off", "100ms", "200ms", "300ms", "400ms", + "500ms", "600ms", "700ms", "800ms", "900ms"] + +MEM_SIZE = 0x2000 # size of all memory +PROG_SIZE = 0x1d00 # size of the memory that we will write +MEM_BLOCK = 0x80 # largest block of memory that we can reliably write + +# fm radio supported frequencies +FMMIN = 76.0 +FMMAX = 108.0 + +# bands supported by the UV-K5 +BANDS = { + 0: [50.0, 76.0], + 1: [108.0, 135.9999], + 2: [136.0, 199.9990], + 3: [200.0, 299.9999], + 4: [350.0, 399.9999], + 5: [400.0, 469.9999], + 6: [470.0, 600.0] + } + +# for radios with modified firmware: +BANDS_NOLIMITS = { + 0: [18.0, 76.0], + 1: [108.0, 135.9999], + 2: [136.0, 199.9990], + 3: [200.0, 299.9999], + 4: [350.0, 399.9999], + 5: [400.0, 469.9999], + 6: [470.0, 1300.0] + } + +SPECIALS = { + "F1(50M-76M)A": 200, + "F1(50M-76M)B": 201, + "F2(108M-136M)A": 202, + "F2(108M-136M)B": 203, + "F3(136M-174M)A": 204, + "F3(136M-174M)B": 205, + "F4(174M-350M)A": 206, + "F4(174M-350M)B": 207, + "F5(350M-400M)A": 208, + "F5(350M-400M)B": 209, + "F6(400M-470M)A": 210, + "F6(400M-470M)B": 211, + "F7(470M-600M)A": 212, + "F7(470M-600M)B": 213 + } + +VFO_CHANNEL_NAMES = ["F1(50M-76M)A", "F1(50M-76M)B", + "F2(108M-136M)A", "F2(108M-136M)B", + "F3(136M-174M)A", "F3(136M-174M)B", + "F4(174M-350M)A", "F4(174M-350M)B", + "F5(350M-400M)A", "F5(350M-400M)B", + "F6(400M-470M)A", "F6(400M-470M)B", + "F7(470M-600M)A", "F7(470M-600M)B"] + +SCANLIST_LIST = ["None", "1", "2", "1+2"] + +DTMF_CHARS = "0123456789ABCD*# " +DTMF_CHARS_ID = "0123456789ABCDabcd" +DTMF_CHARS_KILL = "0123456789ABCDabcd" +DTMF_CHARS_UPDOWN = "0123456789ABCDabcd#* " +DTMF_CODE_CHARS = "ABCD*# " +DTMF_DECODE_RESPONSE_LIST = ["None", "Ring", "Reply", "Both"] + +KEYACTIONS_LIST = ["None", "Flashlight on/off", "Power select", + "Monitor", "Scan on/off", "VOX on/off", + "Alarm on/off", "FM radio on/off", "Transmit 1750 Hz"] + + +# the communication is obfuscated using this fine mechanism +def xorarr(data: bytes): + tbl = [22, 108, 20, 230, 46, 145, 13, 64, 33, 53, 213, 64, 19, 3, 233, 128] + x = b"" + r = 0 + for byte in data: + x += bytes([byte ^ tbl[r]]) + r = (r+1) % len(tbl) + return x + + +# if this crc was used for communication to AND from the radio, then it +# would be a measure to increase reliability. +# but it's only used towards the radio, so it's for further obfuscation +def calculate_crc16_xmodem(data: bytes): + poly = 0x1021 + crc = 0x0 + for byte in data: + crc = crc ^ (byte << 8) + for i in range(8): + crc = crc << 1 + if (crc & 0x10000): + crc = (crc ^ poly) & 0xFFFF + return crc & 0xFFFF + + +def _send_command(serport, data: bytes): + """Send a command to UV-K5 radio""" + LOG.debug("Sending command (unobfuscated) len=0x%4.4x:\n%s" % + (len(data), util.hexprint(data))) + + crc = calculate_crc16_xmodem(data) + data2 = data + struct.pack("HBB", 0xabcd, len(data), 0) + \ + xorarr(data2) + \ + struct.pack(">H", 0xdcba) + if DEBUG_SHOW_OBFUSCATED_COMMANDS: + LOG.debug("Sending command (obfuscated):\n%s" % util.hexprint(command)) + try: + result = serport.write(command) + except Exception: + raise errors.RadioError("Error writing data to radio") + return result + + +def _receive_reply(serport): + header = serport.read(4) + if len(header) != 4: + LOG.warning("Header short read: [%s] len=%i" % + (util.hexprint(header), len(header))) + raise errors.RadioError("Header short read") + if header[0] != 0xAB or header[1] != 0xCD or header[3] != 0x00: + LOG.warning("Bad response header: %s len=%i" % + (util.hexprint(header), len(header))) + raise errors.RadioError("Bad response header") + + cmd = serport.read(int(header[2])) + if len(cmd) != int(header[2]): + LOG.warning("Body short read: [%s] len=%i" % + (util.hexprint(cmd), len(cmd))) + raise errors.RadioError("Command body short read") + + footer = serport.read(4) + + if len(footer) != 4: + LOG.warning("Footer short read: [%s] len=%i" % + (util.hexprint(footer), len(footer))) + raise errors.RadioError("Footer short read") + + if footer[2] != 0xDC or footer[3] != 0xBA: + LOG.debug( + "Reply before bad response footer (obfuscated)" + "len=0x%4.4x:\n%s" % (len(cmd), util.hexprint(cmd))) + LOG.warning("Bad response footer: %s len=%i" % + (util.hexprint(footer), len(footer))) + raise errors.RadioError("Bad response footer") + + if DEBUG_SHOW_OBFUSCATED_COMMANDS: + LOG.debug("Received reply (obfuscated) len=0x%4.4x:\n%s" % + (len(cmd), util.hexprint(cmd))) + + cmd2 = xorarr(cmd) + + LOG.debug("Received reply (unobfuscated) len=0x%4.4x:\n%s" % + (len(cmd2), util.hexprint(cmd2))) + + return cmd2 + + +def _getstring(data: bytes, begin, maxlen): + tmplen = min(maxlen+1, len(data)) + s = [data[i] for i in range(begin, tmplen)] + for key, val in enumerate(s): + if val < ord(' ') or val > ord('~'): + break + return ''.join(chr(x) for x in s[0:key]) + + +def _sayhello(serport): + hellopacket = b"\x14\x05\x04\x00\x6a\x39\x57\x64" + + tries = 5 + while True: + LOG.debug("Sending hello packet") + _send_command(serport, hellopacket) + o = _receive_reply(serport) + if (o): + break + tries -= 1 + if tries == 0: + LOG.warning("Failed to initialise radio") + raise errors.RadioError("Failed to initialize radio") + firmware = _getstring(o, 4, 16) + LOG.info("Found firmware: %s" % firmware) + return firmware + + +def _readmem(serport, offset, length): + LOG.debug("Sending readmem offset=0x%4.4x len=0x%4.4x" % (offset, length)) + + readmem = b"\x1b\x05\x08\x00" + \ + struct.pack("> 8) & 0xff): + return True + else: + LOG.warning("Bad data from writemem") + raise errors.RadioError("Bad response to writemem") + + +def _resetradio(serport): + resetpacket = b"\xdd\x05\x00\x00" + _send_command(serport, resetpacket) + + +def do_download(radio): + serport = radio.pipe + serport.timeout = 0.5 + status = chirp_common.Status() + status.cur = 0 + status.max = MEM_SIZE + status.msg = "Downloading from radio" + radio.status_fn(status) + + eeprom = b"" + f = _sayhello(serport) + if f: + radio.FIRMWARE_VERSION = f + else: + return False + + addr = 0 + while addr < MEM_SIZE: + o = _readmem(serport, addr, MEM_BLOCK) + status.cur = addr + radio.status_fn(status) + + if o and len(o) == MEM_BLOCK: + eeprom += o + addr += MEM_BLOCK + else: + raise errors.RadioError("Memory download incomplete") + + return memmap.MemoryMapBytes(eeprom) + + +def do_upload(radio): + serport = radio.pipe + serport.timeout = 0.5 + status = chirp_common.Status() + status.cur = 0 + status.max = PROG_SIZE + status.msg = "Uploading to radio" + radio.status_fn(status) + + f = _sayhello(serport) + if f: + radio.FIRMWARE_VERSION = f + else: + return False + + addr = 0 + while addr < PROG_SIZE: + o = radio.get_mmap()[addr:addr+MEM_BLOCK] + _writemem(serport, o, addr) + status.cur = addr + radio.status_fn(status) + if o: + addr += MEM_BLOCK + else: + raise errors.RadioError("Memory upload incomplete") + status.msg = "Uploaded OK" + + _resetradio(serport) + + return True + + +def _find_band(nolimits, hz): + mhz = hz/1000000.0 + if nolimits: + B = BANDS_NOLIMITS + else: + B = BANDS + + # currently the hacked firmware sets band=1 below 50 MHz + if nolimits and mhz < 50.0: + return 1 + + for a in B: + if mhz >= B[a][0] and mhz <= B[a][1]: + return a + return False + + +@directory.register +class UVK5Radio(chirp_common.CloneModeRadio): + """Quansheng UV-K5""" + VENDOR = "Quansheng" + MODEL = "UV-K5" + BAUD_RATE = 38400 + NEEDS_COMPAT_SERIAL = False + FIRMWARE_VERSION = "" + _expanded_limits = False + + def get_prompts(x=None): + rp = chirp_common.RadioPrompts() + rp.experimental = \ + ('This is an experimental driver for the Quansheng UV-K5. ' + 'It may harm your radio, or worse. Use at your own risk.\n\n' + 'Before attempting to do any changes please download ' + 'the memory image from the radio with chirp ' + 'and keep it. This can be later used to recover the ' + 'original settings. \n\n' + 'some details are not yet implemented') + rp.pre_download = _( + "1. Turn radio on.\n" + "2. Connect cable to mic/spkr connector.\n" + "3. Make sure connector is firmly connected.\n" + "4. Click OK to download image from device.\n\n" + "It will may not work if you turn on the radio " + "with the cable already attached\n") + rp.pre_upload = _( + "1. Turn radio on.\n" + "2. Connect cable to mic/spkr connector.\n" + "3. Make sure connector is firmly connected.\n" + "4. Click OK to upload the image to device.\n\n" + "It will may not work if you turn on the radio " + "with the cable already attached") + return rp + + # Return information about this radio's features, including + # how many memories it has, what bands it supports, etc + def get_features(self): + rf = chirp_common.RadioFeatures() + rf.has_bank = False + rf.valid_dtcs_codes = DTCS_CODES + rf.has_rx_dtcs = True + rf.has_ctone = True + rf.has_settings = True + rf.has_comment = False + rf.valid_name_length = 10 + rf.valid_power_levels = UVK5_POWER_LEVELS + rf.valid_special_chans = list(SPECIALS.keys()) + rf.valid_duplexes = ["", "-", "+", "off"] + + # hack so we can input any frequency, + # the 0.1 and 0.01 steps don't work unfortunately + rf.valid_tuning_steps = [0.01, 0.1, 1.0] + STEPS + + rf.valid_tmodes = ["", "Tone", "TSQL", "DTCS", "Cross"] + rf.valid_cross_modes = ["Tone->Tone", "Tone->DTCS", "DTCS->Tone", + "->Tone", "->DTCS", "DTCS->", "DTCS->DTCS"] + + rf.valid_characters = chirp_common.CHARSET_ASCII + rf.valid_modes = ["FM", "NFM", "AM", "NAM"] + rf.valid_tmodes = ["", "Tone", "TSQL", "DTCS", "Cross"] + + rf.valid_skips = [""] + + # This radio supports memories 1-200, 201-214 are the VFO memories + rf.memory_bounds = (1, 200) + + rf.valid_bands = [] + for a in BANDS_NOLIMITS: + rf.valid_bands.append( + (int(BANDS_NOLIMITS[a][0]*1000000), + int(BANDS_NOLIMITS[a][1]*1000000))) + return rf + + # Do a download of the radio from the serial port + def sync_in(self): + self._mmap = do_download(self) + self.process_mmap() + + # Do an upload of the radio to the serial port + def sync_out(self): + do_upload(self) + + # Convert the raw byte array into a memory object structure + def process_mmap(self): + self._memobj = bitwise.parse(MEM_FORMAT, self._mmap) + + # Return a raw representation of the memory object, which + # is very helpful for development + def get_raw_memory(self, number): + return repr(self._memobj.channel[number-1]) + + def validate_memory(self, mem): + msgs = super().validate_memory(mem) + + if mem.duplex == 'off': + return msgs + + # find tx frequency + if mem.duplex == '-': + txfreq = mem.freq - mem.offset + elif mem.duplex == '+': + txfreq = mem.freq + mem.offset + else: + txfreq = mem.freq + + # find band + band = _find_band(self._expanded_limits, txfreq) + if band is False: + msg = "Transmit frequency %.4f MHz is not supported by this radio"\ + % (txfreq/1000000.0) + msgs.append(chirp_common.ValidationError(msg)) + + band = _find_band(self._expanded_limits, mem.freq) + if band is False: + msg = "The frequency %.4f MHz is not supported by this radio" \ + % (mem.freq/1000000.0) + msgs.append(chirp_common.ValidationError(msg)) + + return msgs + + def _set_tone(self, mem, _mem): + ((txmode, txtone, txpol), + (rxmode, rxtone, rxpol)) = chirp_common.split_tone_encode(mem) + + if txmode == "Tone": + txtoval = CTCSS_TONES.index(txtone) + txmoval = 0b01 + elif txmode == "DTCS": + txmoval = txpol == "R" and 0b11 or 0b10 + txtoval = DTCS_CODES.index(txtone) + else: + txmoval = 0 + txtoval = 0 + + if rxmode == "Tone": + rxtoval = CTCSS_TONES.index(rxtone) + rxmoval = 0b01 + elif rxmode == "DTCS": + rxmoval = rxpol == "R" and 0b11 or 0b10 + rxtoval = DTCS_CODES.index(rxtone) + else: + rxmoval = 0 + rxtoval = 0 + + _mem.rxcodeflag = rxmoval + _mem.txcodeflag = txmoval + _mem.unknown1 = 0 + _mem.unknown2 = 0 + _mem.rxcode = rxtoval + _mem.txcode = txtoval + + def _get_tone(self, mem, _mem): + rxtype = _mem.rxcodeflag + txtype = _mem.txcodeflag + rx_tmode = TMODES[rxtype] + tx_tmode = TMODES[txtype] + + rx_tone = tx_tone = None + + if tx_tmode == "Tone": + if _mem.txcode < len(CTCSS_TONES): + tx_tone = CTCSS_TONES[_mem.txcode] + else: + tx_tone = 0 + tx_tmode = "" + elif tx_tmode == "DTCS": + if _mem.txcode < len(DTCS_CODES): + tx_tone = DTCS_CODES[_mem.txcode] + else: + tx_tone = 0 + tx_tmode = "" + + if rx_tmode == "Tone": + if _mem.rxcode < len(CTCSS_TONES): + rx_tone = CTCSS_TONES[_mem.rxcode] + else: + rx_tone = 0 + rx_tmode = "" + elif rx_tmode == "DTCS": + if _mem.rxcode < len(DTCS_CODES): + rx_tone = DTCS_CODES[_mem.rxcode] + else: + rx_tone = 0 + rx_tmode = "" + + tx_pol = txtype == 0x03 and "R" or "N" + rx_pol = rxtype == 0x03 and "R" or "N" + + chirp_common.split_tone_decode(mem, (tx_tmode, tx_tone, tx_pol), + (rx_tmode, rx_tone, rx_pol)) + + # Extract a high-level memory object from the low-level memory map + # This is called to populate a memory in the UI + def get_memory(self, number2): + + mem = chirp_common.Memory() + + if isinstance(number2, str): + number = SPECIALS[number2] + mem.extd_number = number2 + else: + number = number2 - 1 + + mem.number = number + 1 + + _mem = self._memobj.channel[number] + + tmpcomment = "" + + is_empty = False + # We'll consider any blank (i.e. 0 MHz frequency) to be empty + if (_mem.freq == 0xffffffff) or (_mem.freq == 0): + is_empty = True + + tmpscn = SCANLIST_LIST[0] + + # We'll also look at the channel attributes if a memory has them + if number < 200: + _mem3 = self._memobj.channel_attributes[number] + # free memory bit + if _mem3.is_free > 0: + is_empty = True + # scanlists + if _mem3.is_scanlist1 > 0 and _mem3.is_scanlist2 > 0: + tmpscn = SCANLIST_LIST[3] # "1+2" + elif _mem3.is_scanlist1 > 0: + tmpscn = SCANLIST_LIST[1] # "1" + elif _mem3.is_scanlist2 > 0: + tmpscn = SCANLIST_LIST[2] # "2" + + if is_empty: + mem.empty = True + # set some sane defaults: + mem.power = UVK5_POWER_LEVELS[2] + mem.extra = RadioSettingGroup("Extra", "extra") + rs = RadioSetting("bclo", "BCLO", RadioSettingValueBoolean(False)) + mem.extra.append(rs) + rs = RadioSetting("frev", "FreqRev", + RadioSettingValueBoolean(False)) + mem.extra.append(rs) + rs = RadioSetting("pttid", "PTTID", RadioSettingValueList( + PTTID_LIST, PTTID_LIST[0])) + mem.extra.append(rs) + rs = RadioSetting("dtmfdecode", "DTMF decode", + RadioSettingValueBoolean(False)) + mem.extra.append(rs) + rs = RadioSetting("scrambler", "Scrambler", RadioSettingValueList( + SCRAMBLER_LIST, SCRAMBLER_LIST[0])) + mem.extra.append(rs) + + rs = RadioSetting("scanlists", "Scanlists", RadioSettingValueList( + SCANLIST_LIST, SCANLIST_LIST[0])) + mem.extra.append(rs) + + # actually the step and duplex are overwritten by chirp based on + # bandplan. they are here to document sane defaults for IARU r1 + # mem.tuning_step = 25.0 + # mem.duplex = "" + + return mem + + if number > 199: + mem.immutable = ["name", "scanlists"] + else: + _mem2 = self._memobj.channelname[number] + for char in _mem2.name: + if str(char) == "\xFF" or str(char) == "\x00": + break + mem.name += str(char) + mem.name = mem.name.rstrip() + + # Convert your low-level frequency to Hertz + mem.freq = int(_mem.freq)*10 + mem.offset = int(_mem.offset)*10 + + if (mem.offset == 0): + mem.duplex = '' + else: + if _mem.shift == FLAGS1_OFFSET_MINUS: + if _mem.freq == _mem.offset: + # fake tx disable by setting tx to 0 MHz + mem.duplex = 'off' + mem.offset = 0 + else: + mem.duplex = '-' + elif _mem.shift == FLAGS1_OFFSET_PLUS: + mem.duplex = '+' + else: + mem.duplex = '' + + # tone data + self._get_tone(mem, _mem) + + # mode + if _mem.enable_am > 0: + if _mem.bandwidth > 0: + mem.mode = "NAM" + else: + mem.mode = "AM" + else: + if _mem.bandwidth > 0: + mem.mode = "NFM" + else: + mem.mode = "FM" + + # tuning step + tstep = _mem.step & 0x7 + if tstep < len(STEPS): + mem.tuning_step = STEPS[tstep] + else: + mem.tuning_step = 2.5 + + # power + if _mem.txpower == POWER_HIGH: + mem.power = UVK5_POWER_LEVELS[2] + elif _mem.txpower == POWER_MEDIUM: + mem.power = UVK5_POWER_LEVELS[1] + else: + mem.power = UVK5_POWER_LEVELS[0] + + # We'll consider any blank (i.e. 0 MHz frequency) to be empty + if (_mem.freq == 0xffffffff) or (_mem.freq == 0): + mem.empty = True + else: + mem.empty = False + + mem.extra = RadioSettingGroup("Extra", "extra") + + # BCLO + is_bclo = bool(_mem.bclo > 0) + rs = RadioSetting("bclo", "BCLO", RadioSettingValueBoolean(is_bclo)) + mem.extra.append(rs) + tmpcomment += "BCLO:"+(is_bclo and "ON" or "off")+" " + + # Frequency reverse - whatever that means, don't see it in the manual + is_frev = bool(_mem.freq_reverse > 0) + rs = RadioSetting("frev", "FreqRev", RadioSettingValueBoolean(is_frev)) + mem.extra.append(rs) + tmpcomment += "FreqReverse:"+(is_frev and "ON" or "off")+" " + + # PTTID + pttid = _mem.dtmf_pttid + rs = RadioSetting("pttid", "PTTID", RadioSettingValueList( + PTTID_LIST, PTTID_LIST[pttid])) + mem.extra.append(rs) + tmpcomment += "PTTid:"+PTTID_LIST[pttid]+" " + + # DTMF DECODE + is_dtmf = bool(_mem.dtmf_decode > 0) + rs = RadioSetting("dtmfdecode", "DTMF decode", + RadioSettingValueBoolean(is_dtmf)) + mem.extra.append(rs) + tmpcomment += "DTMFdecode:"+(is_dtmf and "ON" or "off")+" " + + # Scrambler + if _mem.scrambler & 0x0f < len(SCRAMBLER_LIST): + enc = _mem.scrambler & 0x0f + else: + enc = 0 + + rs = RadioSetting("scrambler", "Scrambler", RadioSettingValueList( + SCRAMBLER_LIST, SCRAMBLER_LIST[enc])) + mem.extra.append(rs) + tmpcomment += "Scrambler:"+SCRAMBLER_LIST[enc]+" " + + rs = RadioSetting("scanlists", "Scanlists", RadioSettingValueList( + SCANLIST_LIST, tmpscn)) + mem.extra.append(rs) + + return mem + + def set_settings(self, settings): + _mem = self._memobj + for element in settings: + if not isinstance(element, RadioSetting): + self.set_settings(element) + continue + + # basic settings + + # call channel + if element.get_name() == "call_channel": + _mem.call_channel = int(element.value)-1 + + # squelch + if element.get_name() == "squelch": + _mem.squelch = int(element.value) + # TOT + if element.get_name() == "tot": + _mem.max_talk_time = int(element.value) + + # NOAA autoscan + if element.get_name() == "noaa_autoscan": + _mem.noaa_autoscan = element.value and 1 or 0 + + # VOX switch + if element.get_name() == "vox_switch": + _mem.vox_switch = element.value and 1 or 0 + + # vox level + if element.get_name() == "vox_level": + _mem.vox_level = int(element.value)-1 + + # mic gain + if element.get_name() == "mic_gain": + _mem.mic_gain = int(element.value) + + # Channel display mode + if element.get_name() == "channel_display_mode": + _mem.channel_display_mode = CHANNELDISP_LIST.index( + str(element.value)) + + # Crossband receiving/transmitting + if element.get_name() == "crossband": + _mem.crossband = CROSSBAND_LIST.index(str(element.value)) + + # Battery Save + if element.get_name() == "battery_save": + _mem.battery_save = BATSAVE_LIST.index(str(element.value)) + # Dual Watch + if element.get_name() == "dualwatch": + _mem.dual_watch = DUALWATCH_LIST.index(str(element.value)) + + # Backlight auto mode + if element.get_name() == "backlight_auto_mode": + _mem.backlight_auto_mode = \ + BACKLIGHT_LIST.index(str(element.value)) + + # Tail tone elimination + if element.get_name() == "tail_note_elimination": + _mem.tail_note_elimination = element.value and 1 or 0 + + # VFO Open + if element.get_name() == "vfo_open": + _mem.vfo_open = element.value and 1 or 0 + + # Beep control + if element.get_name() == "beep_control": + _mem.beep_control = element.value and 1 or 0 + + # Scan resume mode + if element.get_name() == "scan_resume_mode": + _mem.scan_resume_mode = SCANRESUME_LIST.index( + str(element.value)) + + # Keypad lock + if element.get_name() == "key_lock": + _mem.key_lock = element.value and 1 or 0 + + # Auto keypad lock + if element.get_name() == "auto_keypad_lock": + _mem.auto_keypad_lock = element.value and 1 or 0 + + # Power on display mode + if element.get_name() == "welcome_mode": + _mem.power_on_dispmode = WELCOME_LIST.index(str(element.value)) + + # Keypad Tone + if element.get_name() == "keypad_tone": + _mem.keypad_tone = KEYPADTONE_LIST.index(str(element.value)) + + # Language + if element.get_name() == "language": + _mem.language = LANGUAGE_LIST.index(str(element.value)) + + # Alarm mode + if element.get_name() == "alarm_mode": + _mem.alarm_mode = ALARMMODE_LIST.index(str(element.value)) + + # Reminding of end of talk + if element.get_name() == "reminding_of_end_talk": + _mem.reminding_of_end_talk = REMENDOFTALK_LIST.index( + str(element.value)) + + # Repeater tail tone elimination + if element.get_name() == "repeater_tail_elimination": + _mem.repeater_tail_elimination = RTE_LIST.index( + str(element.value)) + + # Logo string 1 + if element.get_name() == "logo1": + b = str(element.value).rstrip("\x20\xff\x00")+"\x00"*12 + _mem.logo_line1 = b[0:12]+"\x00\xff\xff\xff" + + # Logo string 2 + if element.get_name() == "logo2": + b = str(element.value).rstrip("\x20\xff\x00")+"\x00"*12 + _mem.logo_line2 = b[0:12]+"\x00\xff\xff\xff" + + # unlock settings + + # FLOCK + if element.get_name() == "flock": + _mem.lock.flock = FLOCK_LIST.index(str(element.value)) + + # 350TX + if element.get_name() == "tx350": + _mem.lock.tx350 = element.value and 1 or 0 + + # 200TX + if element.get_name() == "tx200": + _mem.lock.tx200 = element.value and 1 or 0 + + # 500TX + if element.get_name() == "tx500": + _mem.lock.tx500 = element.value and 1 or 0 + + # 350EN + if element.get_name() == "en350": + _mem.lock.en350 = element.value and 1 or 0 + + # SCREN + if element.get_name() == "enscramble": + _mem.lock.enscramble = element.value and 1 or 0 + + # KILLED + if element.get_name() == "killed": + _mem.lock.killed = element.value and 1 or 0 + + # fm radio + for i in range(1, 21): + freqname = "FM_" + str(i) + if element.get_name() == freqname: + val = str(element.value).strip() + try: + val2 = int(float(val)*10) + except Exception: + val2 = 0xffff + + if val2 < FMMIN*10 or val2 > FMMAX*10: + val2 = 0xffff +# raise errors.InvalidValueError( +# "FM radio frequency should be a value " +# "in the range %.1f - %.1f" % (FMMIN , FMMAX)) + _mem.fmfreq[i-1] = val2 + + # dtmf settings + if element.get_name() == "dtmf_side_tone": + _mem.dtmf_settings.side_tone = \ + element.value and 1 or 0 + + if element.get_name() == "dtmf_separate_code": + _mem.dtmf_settings.separate_code = str(element.value) + + if element.get_name() == "dtmf_group_call_code": + _mem.dtmf_settings.group_call_code = element.value + + if element.get_name() == "dtmf_decode_response": + _mem.dtmf_settings.decode_response = \ + DTMF_DECODE_RESPONSE_LIST.index(str(element.value)) + + if element.get_name() == "dtmf_auto_reset_time": + _mem.dtmf_settings.auto_reset_time = \ + int(int(element.value)/10) + + if element.get_name() == "dtmf_preload_time": + _mem.dtmf_settings.preload_time = \ + int(int(element.value)/10) + + if element.get_name() == "dtmf_first_code_persist_time": + _mem.dtmf_settings.first_code_persist_time = \ + int(int(element.value)/10) + + if element.get_name() == "dtmf_hash_persist_time": + _mem.dtmf_settings.hash_persist_time = \ + int(int(element.value)/10) + + if element.get_name() == "dtmf_code_persist_time": + _mem.dtmf_settings.code_persist_time = \ + int(int(element.value)/10) + + if element.get_name() == "dtmf_code_interval_time": + _mem.dtmf_settings.code_interval_time = \ + int(int(element.value)/10) + + if element.get_name() == "dtmf_permit_remote_kill": + _mem.dtmf_settings.permit_remote_kill = \ + element.value and 1 or 0 + + if element.get_name() == "dtmf_dtmf_local_code": + k = str(element.value).rstrip("\x20\xff\x00") + "\x00"*3 + _mem.dtmf_settings_numbers.dtmf_local_code = k[0:3] + + if element.get_name() == "dtmf_dtmf_up_code": + k = str(element.value).strip("\x20\xff\x00") + "\x00"*16 + _mem.dtmf_settings_numbers.dtmf_up_code = k[0:16] + + if element.get_name() == "dtmf_dtmf_down_code": + k = str(element.value).rstrip("\x20\xff\x00") + "\x00"*16 + _mem.dtmf_settings_numbers.dtmf_down_code = k[0:16] + + if element.get_name() == "dtmf_kill_code": + k = str(element.value).strip("\x20\xff\x00") + "\x00"*5 + _mem.dtmf_settings_numbers.kill_code = k[0:5] + + if element.get_name() == "dtmf_revive_code": + k = str(element.value).strip("\x20\xff\x00") + "\x00"*5 + _mem.dtmf_settings_numbers.revive_code = k[0:5] + + # dtmf contacts + for i in range(1, 17): + varname = "DTMF_" + str(i) + if element.get_name() == varname: + k = str(element.value).rstrip("\x20\xff\x00") + "\x00"*8 + _mem.dtmfcontact[i-1].name = k[0:8] + + varnumname = "DTMFNUM_" + str(i) + if element.get_name() == varnumname: + k = str(element.value).rstrip("\x20\xff\x00") + "\xff"*3 + _mem.dtmfcontact[i-1].number = k[0:3] + + # scanlist stuff + if element.get_name() == "scanlist_default": + val = (int(element.value) == 2) and 1 or 0 + _mem.scanlist_default = val + + if element.get_name() == "scanlist1_priority_scan": + _mem.scanlist1_priority_scan = \ + element.value and 1 or 0 + + if element.get_name() == "scanlist2_priority_scan": + _mem.scanlist2_priority_scan = \ + element.value and 1 or 0 + + if element.get_name() == "scanlist1_priority_ch1" or \ + element.get_name() == "scanlist1_priority_ch2" or \ + element.get_name() == "scanlist2_priority_ch1" or \ + element.get_name() == "scanlist2_priority_ch2": + + val = int(element.value) + + if val > 200 or val < 1: + val = 0xff + else: + val -= 1 + + if element.get_name() == "scanlist1_priority_ch1": + _mem.scanlist1_priority_ch1 = val + if element.get_name() == "scanlist1_priority_ch2": + _mem.scanlist1_priority_ch2 = val + if element.get_name() == "scanlist2_priority_ch1": + _mem.scanlist2_priority_ch1 = val + if element.get_name() == "scanlist2_priority_ch2": + _mem.scanlist2_priority_ch2 = val + + if element.get_name() == "key1_shortpress_action": + _mem.key1_shortpress_action = KEYACTIONS_LIST.index( + str(element.value)) + + if element.get_name() == "key1_longpress_action": + _mem.key1_longpress_action = KEYACTIONS_LIST.index( + str(element.value)) + + if element.get_name() == "key2_shortpress_action": + _mem.key2_shortpress_action = KEYACTIONS_LIST.index( + str(element.value)) + + if element.get_name() == "key2_longpress_action": + _mem.key2_longpress_action = KEYACTIONS_LIST.index( + str(element.value)) + + if element.get_name() == "nolimits": + LOG.warning("User expanded band limits") + self._expanded_limits = bool(element.value) + + def get_settings(self): + _mem = self._memobj + basic = RadioSettingGroup("basic", "Basic Settings") + keya = RadioSettingGroup("keya", "Programmable keys") + dtmf = RadioSettingGroup("dtmf", "DTMF Settings") + dtmfc = RadioSettingGroup("dtmfc", "DTMF Contacts") + scanl = RadioSettingGroup("scn", "Scan Lists") + unlock = RadioSettingGroup("unlock", "Unlock Settings") + fmradio = RadioSettingGroup("fmradio", "FM Radio") + + roinfo = RadioSettingGroup("roinfo", "Driver information") + + top = RadioSettings( + basic, keya, dtmf, dtmfc, scanl, unlock, fmradio, roinfo) + + # Programmable keys + tmpval = int(_mem.key1_shortpress_action) + if tmpval >= len(KEYACTIONS_LIST): + tmpval = 0 + rs = RadioSetting("key1_shortpress_action", "Side key 1 short press", + RadioSettingValueList( + KEYACTIONS_LIST, KEYACTIONS_LIST[tmpval])) + keya.append(rs) + + tmpval = int(_mem.key1_longpress_action) + if tmpval >= len(KEYACTIONS_LIST): + tmpval = 0 + rs = RadioSetting("key1_longpress_action", "Side key 1 long press", + RadioSettingValueList( + KEYACTIONS_LIST, KEYACTIONS_LIST[tmpval])) + keya.append(rs) + + tmpval = int(_mem.key2_shortpress_action) + if tmpval >= len(KEYACTIONS_LIST): + tmpval = 0 + rs = RadioSetting("key2_shortpress_action", "Side key 2 short press", + RadioSettingValueList( + KEYACTIONS_LIST, KEYACTIONS_LIST[tmpval])) + keya.append(rs) + + tmpval = int(_mem.key2_longpress_action) + if tmpval >= len(KEYACTIONS_LIST): + tmpval = 0 + rs = RadioSetting("key2_longpress_action", "Side key 2 long press", + RadioSettingValueList( + KEYACTIONS_LIST, KEYACTIONS_LIST[tmpval])) + keya.append(rs) + + # DTMF settings + tmppr = bool(_mem.dtmf_settings.side_tone > 0) + rs = RadioSetting( + "dtmf_side_tone", + "DTMF Sidetone", + RadioSettingValueBoolean(tmppr)) + dtmf.append(rs) + + tmpval = str(_mem.dtmf_settings.separate_code) + if tmpval not in DTMF_CODE_CHARS: + tmpval = '*' + val = RadioSettingValueString(1, 1, tmpval) + val.set_charset(DTMF_CODE_CHARS) + rs = RadioSetting("dtmf_separate_code", "Separate Code", val) + dtmf.append(rs) + + tmpval = str(_mem.dtmf_settings.group_call_code) + if tmpval not in DTMF_CODE_CHARS: + tmpval = '#' + val = RadioSettingValueString(1, 1, tmpval) + val.set_charset(DTMF_CODE_CHARS) + rs = RadioSetting("dtmf_group_call_code", "Group Call Code", val) + dtmf.append(rs) + + tmpval = _mem.dtmf_settings.decode_response + if tmpval >= len(DTMF_DECODE_RESPONSE_LIST): + tmpval = 0 + rs = RadioSetting("dtmf_decode_response", "Decode Response", + RadioSettingValueList( + DTMF_DECODE_RESPONSE_LIST, + DTMF_DECODE_RESPONSE_LIST[tmpval])) + dtmf.append(rs) + + tmpval = _mem.dtmf_settings.auto_reset_time + if tmpval > 60 or tmpval < 5: + tmpval = 5 + rs = RadioSetting("dtmf_auto_reset_time", + "Auto reset time (s)", + RadioSettingValueInteger(5, 60, tmpval)) + dtmf.append(rs) + + tmpval = int(_mem.dtmf_settings.preload_time) + if tmpval > 100 or tmpval < 3: + tmpval = 30 + tmpval *= 10 + rs = RadioSetting("dtmf_preload_time", + "Pre-load time (ms)", + RadioSettingValueInteger(30, 1000, tmpval, 10)) + dtmf.append(rs) + + tmpval = int(_mem.dtmf_settings.first_code_persist_time) + if tmpval > 100 or tmpval < 3: + tmpval = 30 + tmpval *= 10 + rs = RadioSetting("dtmf_first_code_persist_time", + "First code persist time (ms)", + RadioSettingValueInteger(30, 1000, tmpval, 10)) + dtmf.append(rs) + + tmpval = int(_mem.dtmf_settings.hash_persist_time) + if tmpval > 100 or tmpval < 3: + tmpval = 30 + tmpval *= 10 + rs = RadioSetting("dtmf_hash_persist_time", + "#/* persist time (ms)", + RadioSettingValueInteger(30, 1000, tmpval, 10)) + dtmf.append(rs) + + tmpval = int(_mem.dtmf_settings.code_persist_time) + if tmpval > 100 or tmpval < 3: + tmpval = 30 + tmpval *= 10 + rs = RadioSetting("dtmf_code_persist_time", + "Code persist time (ms)", + RadioSettingValueInteger(30, 1000, tmpval, 10)) + dtmf.append(rs) + + tmpval = int(_mem.dtmf_settings.code_interval_time) + if tmpval > 100 or tmpval < 3: + tmpval = 30 + tmpval *= 10 + rs = RadioSetting("dtmf_code_interval_time", + "Code interval time (ms)", + RadioSettingValueInteger(30, 1000, tmpval, 10)) + dtmf.append(rs) + + tmpval = bool(_mem.dtmf_settings.permit_remote_kill > 0) + rs = RadioSetting( + "dtmf_permit_remote_kill", + "Permit remote kill", + RadioSettingValueBoolean(tmpval)) + dtmf.append(rs) + + tmpval = str(_mem.dtmf_settings_numbers.dtmf_local_code).upper().strip( + "\x00\xff\x20") + for i in tmpval: + if i in DTMF_CHARS_ID: + continue + else: + tmpval = "103" + break + val = RadioSettingValueString(3, 3, tmpval) + val.set_charset(DTMF_CHARS_ID) + rs = RadioSetting("dtmf_dtmf_local_code", + "Local code (3 chars 0-9 ABCD)", val) + dtmf.append(rs) + + tmpval = str(_mem.dtmf_settings_numbers.dtmf_up_code).upper().strip( + "\x00\xff\x20") + for i in tmpval: + if i in DTMF_CHARS_UPDOWN or i == "": + continue + else: + tmpval = "123" + break + val = RadioSettingValueString(1, 16, tmpval) + val.set_charset(DTMF_CHARS_UPDOWN) + rs = RadioSetting("dtmf_dtmf_up_code", + "Up code (1-16 chars 0-9 ABCD*#)", val) + dtmf.append(rs) + + tmpval = str(_mem.dtmf_settings_numbers.dtmf_down_code).upper().strip( + "\x00\xff\x20") + for i in tmpval: + if i in DTMF_CHARS_UPDOWN: + continue + else: + tmpval = "456" + break + val = RadioSettingValueString(1, 16, tmpval) + val.set_charset(DTMF_CHARS_UPDOWN) + rs = RadioSetting("dtmf_dtmf_down_code", + "Down code (1-16 chars 0-9 ABCD*#)", val) + dtmf.append(rs) + + tmpval = str(_mem.dtmf_settings_numbers.kill_code).upper().strip( + "\x00\xff\x20") + for i in tmpval: + if i in DTMF_CHARS_KILL: + continue + else: + tmpval = "77777" + break + if not len(tmpval) == 5: + tmpval = "77777" + val = RadioSettingValueString(5, 5, tmpval) + val.set_charset(DTMF_CHARS_KILL) + rs = RadioSetting("dtmf_kill_code", + "Kill code (5 chars 0-9 ABCD)", val) + dtmf.append(rs) + + tmpval = str(_mem.dtmf_settings_numbers.revive_code).upper().strip( + "\x00\xff\x20") + for i in tmpval: + if i in DTMF_CHARS_KILL: + continue + else: + tmpval = "88888" + break + if not len(tmpval) == 5: + tmpval = "88888" + val = RadioSettingValueString(5, 5, tmpval) + val.set_charset(DTMF_CHARS_KILL) + rs = RadioSetting("dtmf_revive_code", + "Revive code (5 chars 0-9 ABCD)", val) + dtmf.append(rs) + + val = RadioSettingValueString(0, 80, + "All DTMF Contacts are 3 codes " + "(valid: 0-9 * # ABCD), " + "or an empty string") + val.set_mutable(False) + rs = RadioSetting("dtmf_descr1", "DTMF Contacts", val) + dtmfc.append(rs) + + for i in range(1, 17): + varname = "DTMF_"+str(i) + varnumname = "DTMFNUM_"+str(i) + vardescr = "DTMF Contact "+str(i)+" name" + varinumdescr = "DTMF Contact "+str(i)+" number" + + cntn = str(_mem.dtmfcontact[i-1].name).strip("\x20\x00\xff") + cntnum = str(_mem.dtmfcontact[i-1].number).strip("\x20\x00\xff") + + val = RadioSettingValueString(0, 8, cntn) + rs = RadioSetting(varname, vardescr, val) + dtmfc.append(rs) + + val = RadioSettingValueString(0, 3, cntnum) + val.set_charset(DTMF_CHARS) + rs = RadioSetting(varnumname, varinumdescr, val) + dtmfc.append(rs) + + # scanlists + if _mem.scanlist_default == 1: + tmpsc = 2 + else: + tmpsc = 1 + rs = RadioSetting("scanlist_default", + "Default scanlist", + RadioSettingValueInteger(1, 2, tmpsc)) + scanl.append(rs) + + tmppr = bool((_mem.scanlist1_priority_scan & 1) > 0) + rs = RadioSetting( + "scanlist1_priority_scan", + "Scanlist 1 priority channel scan", + RadioSettingValueBoolean(tmppr)) + scanl.append(rs) + + tmpch = _mem.scanlist1_priority_ch1 + 1 + if tmpch > 200: + tmpch = 0 + rs = RadioSetting("scanlist1_priority_ch1", + "Scanlist 1 priority channel 1 (0 - off)", + RadioSettingValueInteger(0, 200, tmpch)) + scanl.append(rs) + + tmpch = _mem.scanlist1_priority_ch2 + 1 + if tmpch > 200: + tmpch = 0 + rs = RadioSetting("scanlist1_priority_ch2", + "Scanlist 1 priority channel 2 (0 - off)", + RadioSettingValueInteger(0, 200, tmpch)) + scanl.append(rs) + + tmppr = bool((_mem.scanlist2_priority_scan & 1) > 0) + rs = RadioSetting( + "scanlist2_priority_scan", + "Scanlist 2 priority channel scan", + RadioSettingValueBoolean(tmppr)) + scanl.append(rs) + + tmpch = _mem.scanlist2_priority_ch1 + 1 + if tmpch > 200: + tmpch = 0 + rs = RadioSetting("scanlist2_priority_ch1", + "Scanlist 2 priority channel 1 (0 - off)", + RadioSettingValueInteger(0, 200, tmpch)) + scanl.append(rs) + + tmpch = _mem.scanlist2_priority_ch2 + 1 + if tmpch > 200: + tmpch = 0 + rs = RadioSetting("scanlist2_priority_ch2", + "Scanlist 2 priority channel 2 (0 - off)", + RadioSettingValueInteger(0, 200, tmpch)) + scanl.append(rs) + + # basic settings + + # call channel + tmpc = _mem.call_channel+1 + if tmpc > 200: + tmpc = 1 + rs = RadioSetting("call_channel", "One key call channel", + RadioSettingValueInteger(1, 200, tmpc)) + basic.append(rs) + + # squelch + tmpsq = _mem.squelch + if tmpsq > 9: + tmpsq = 1 + rs = RadioSetting("squelch", "Squelch", + RadioSettingValueInteger(0, 9, tmpsq)) + basic.append(rs) + + # TOT + tmptot = _mem.max_talk_time + if tmptot > 10: + tmptot = 10 + rs = RadioSetting( + "tot", + "Max talk time [min]", + RadioSettingValueInteger(0, 10, tmptot)) + basic.append(rs) + + # NOAA autoscan + rs = RadioSetting( + "noaa_autoscan", + "NOAA Autoscan", RadioSettingValueBoolean( + bool(_mem.noaa_autoscan > 0))) + basic.append(rs) + + # VOX switch + rs = RadioSetting( + "vox_switch", + "VOX enabled", RadioSettingValueBoolean( + bool(_mem.vox_switch > 0))) + basic.append(rs) + + # VOX Level + tmpvox = _mem.vox_level+1 + if tmpvox > 10: + tmpvox = 10 + rs = RadioSetting("vox_level", "VOX Level", + RadioSettingValueInteger(1, 10, tmpvox)) + basic.append(rs) + + # Mic gain + tmpmicgain = _mem.mic_gain + if tmpmicgain > 4: + tmpmicgain = 4 + rs = RadioSetting("mic_gain", "Mic Gain", + RadioSettingValueInteger(0, 4, tmpmicgain)) + basic.append(rs) + + # Channel display mode + tmpchdispmode = _mem.channel_display_mode + if tmpchdispmode >= len(CHANNELDISP_LIST): + tmpchdispmode = 0 + rs = RadioSetting( + "channel_display_mode", + "Channel display mode", + RadioSettingValueList( + CHANNELDISP_LIST, + CHANNELDISP_LIST[tmpchdispmode])) + basic.append(rs) + + # Crossband receiving/transmitting + tmpcross = _mem.crossband + if tmpcross >= len(CROSSBAND_LIST): + tmpcross = 0 + rs = RadioSetting( + "crossband", + "Cross-band receiving/transmitting", + RadioSettingValueList( + CROSSBAND_LIST, + CROSSBAND_LIST[tmpcross])) + basic.append(rs) + + # Battery save + tmpbatsave = _mem.battery_save + if tmpbatsave >= len(BATSAVE_LIST): + tmpbatsave = BATSAVE_LIST.index("1:4") + rs = RadioSetting( + "battery_save", + "Battery Save", + RadioSettingValueList( + BATSAVE_LIST, + BATSAVE_LIST[tmpbatsave])) + basic.append(rs) + + # Dual watch + tmpdual = _mem.dual_watch + if tmpdual >= len(DUALWATCH_LIST): + tmpdual = 0 + rs = RadioSetting("dualwatch", "Dual Watch", RadioSettingValueList( + DUALWATCH_LIST, DUALWATCH_LIST[tmpdual])) + basic.append(rs) + + # Backlight auto mode + tmpback = _mem.backlight_auto_mode + if tmpback >= len(BACKLIGHT_LIST): + tmpback = 0 + rs = RadioSetting("backlight_auto_mode", + "Backlight auto mode", + RadioSettingValueList( + BACKLIGHT_LIST, + BACKLIGHT_LIST[tmpback])) + basic.append(rs) + + # Tail tone elimination + rs = RadioSetting( + "tail_note_elimination", + "Tail tone elimination", + RadioSettingValueBoolean( + bool(_mem.tail_note_elimination > 0))) + basic.append(rs) + + # VFO open + rs = RadioSetting("vfo_open", "VFO open", + RadioSettingValueBoolean(bool(_mem.vfo_open > 0))) + basic.append(rs) + + # Beep control + rs = RadioSetting( + "beep_control", + "Beep control", + RadioSettingValueBoolean(bool(_mem.beep_control > 0))) + basic.append(rs) + + # Scan resume mode + tmpscanres = _mem.scan_resume_mode + if tmpscanres >= len(SCANRESUME_LIST): + tmpscanres = 0 + rs = RadioSetting( + "scan_resume_mode", + "Scan resume mode", + RadioSettingValueList( + SCANRESUME_LIST, + SCANRESUME_LIST[tmpscanres])) + basic.append(rs) + + # Keypad locked + rs = RadioSetting( + "key_lock", + "Keypad lock", + RadioSettingValueBoolean(bool(_mem.key_lock > 0))) + basic.append(rs) + + # Auto keypad lock + rs = RadioSetting( + "auto_keypad_lock", + "Auto keypad lock", + RadioSettingValueBoolean(bool(_mem.auto_keypad_lock > 0))) + basic.append(rs) + + # Power on display mode + tmpdispmode = _mem.power_on_dispmode + if tmpdispmode >= len(WELCOME_LIST): + tmpdispmode = 0 + rs = RadioSetting( + "welcome_mode", + "Power on display mode", + RadioSettingValueList( + WELCOME_LIST, + WELCOME_LIST[tmpdispmode])) + basic.append(rs) + + # Keypad Tone + tmpkeypadtone = _mem.keypad_tone + if tmpkeypadtone >= len(KEYPADTONE_LIST): + tmpkeypadtone = 0 + rs = RadioSetting("keypad_tone", "Keypad tone", RadioSettingValueList( + KEYPADTONE_LIST, KEYPADTONE_LIST[tmpkeypadtone])) + basic.append(rs) + + # Language + tmplanguage = _mem.language + if tmplanguage >= len(LANGUAGE_LIST): + tmplanguage = 0 + rs = RadioSetting("language", "Language", RadioSettingValueList( + LANGUAGE_LIST, LANGUAGE_LIST[tmplanguage])) + basic.append(rs) + + # Alarm mode + tmpalarmmode = _mem.alarm_mode + if tmpalarmmode >= len(ALARMMODE_LIST): + tmpalarmmode = 0 + rs = RadioSetting("alarm_mode", "Alarm mode", RadioSettingValueList( + ALARMMODE_LIST, ALARMMODE_LIST[tmpalarmmode])) + basic.append(rs) + + # Reminding of end of talk + tmpalarmmode = _mem.reminding_of_end_talk + if tmpalarmmode >= len(REMENDOFTALK_LIST): + tmpalarmmode = 0 + rs = RadioSetting( + "reminding_of_end_talk", + "Reminding of end of talk", + RadioSettingValueList( + REMENDOFTALK_LIST, + REMENDOFTALK_LIST[tmpalarmmode])) + basic.append(rs) + + # Repeater tail tone elimination + tmprte = _mem.repeater_tail_elimination + if tmprte >= len(RTE_LIST): + tmprte = 0 + rs = RadioSetting( + "repeater_tail_elimination", + "Repeater tail tone elimination", + RadioSettingValueList(RTE_LIST, RTE_LIST[tmprte])) + basic.append(rs) + + # Logo string 1 + logo1 = str(_mem.logo_line1).strip("\x20\x00\xff") + "\x00" + logo1 = _getstring(logo1.encode('ascii', errors='ignore'), 0, 12) + rs = RadioSetting("logo1", "Logo string 1 (12 characters)", + RadioSettingValueString(0, 12, logo1)) + basic.append(rs) + + # Logo string 2 + logo2 = str(_mem.logo_line2).strip("\x20\x00\xff") + "\x00" + logo2 = _getstring(logo2.encode('ascii', errors='ignore'), 0, 12) + rs = RadioSetting("logo2", "Logo string 2 (12 characters)", + RadioSettingValueString(0, 12, logo2)) + basic.append(rs) + + # FM radio + for i in range(1, 21): + freqname = "FM_"+str(i) + fmfreq = _mem.fmfreq[i-1]/10.0 + if fmfreq < FMMIN or fmfreq > FMMAX: + rs = RadioSetting(freqname, freqname, + RadioSettingValueString(0, 5, "")) + else: + rs = RadioSetting(freqname, freqname, + RadioSettingValueString(0, 5, str(fmfreq))) + + fmradio.append(rs) + + # unlock settings + + # F-LOCK + tmpflock = _mem.lock.flock + if tmpflock >= len(FLOCK_LIST): + tmpflock = 0 + rs = RadioSetting( + "flock", "F-LOCK", + RadioSettingValueList(FLOCK_LIST, FLOCK_LIST[tmpflock])) + unlock.append(rs) + + # 350TX + rs = RadioSetting("tx350", "350TX - unlock 350-400 MHz TX", + RadioSettingValueBoolean( + bool(_mem.lock.tx350 > 0))) + unlock.append(rs) + + # Killed + rs = RadioSetting("Killed", "KILLED Device was disabled (via DTMF)", + RadioSettingValueBoolean( + bool(_mem.lock.killed > 0))) + unlock.append(rs) + + # 200TX + rs = RadioSetting("tx200", "200TX - unlock 174-350 MHz TX", + RadioSettingValueBoolean( + bool(_mem.lock.tx200 > 0))) + unlock.append(rs) + + # 500TX + rs = RadioSetting("tx500", "500TX - unlock 500-600 MHz TX", + RadioSettingValueBoolean( + bool(_mem.lock.tx500 > 0))) + unlock.append(rs) + + # 350EN + rs = RadioSetting("en350", "350EN - unlock 350-400 MHz RX", + RadioSettingValueBoolean( + bool(_mem.lock.en350 > 0))) + unlock.append(rs) + + # SCREEN + rs = RadioSetting("scrambler", "SCREN - scrambler enable", + RadioSettingValueBoolean( + bool(_mem.lock.enscramble > 0))) + unlock.append(rs) + + # readonly info + # Firmware + if self.FIRMWARE_VERSION == "": + firmware = "To get the firmware version please download" + "the image from the radio first" + else: + firmware = self.FIRMWARE_VERSION + + val = RadioSettingValueString(0, 128, firmware) + val.set_mutable(False) + rs = RadioSetting("fw_ver", "Firmware Version", val) + roinfo.append(rs) + + # No limits version for hacked firmware + val = RadioSettingValueBoolean(self._expanded_limits) + rs = RadioSetting("nolimits", "Limits disabled for modified firmware", + val) + rs.set_warning(_( + 'This should only be enabled if you are using modified firmware ' + 'that supports wider frequency coverage. Enabling this will cause ' + 'CHIRP not to enforce OEM restrictions and may lead to undefined ' + 'or unregulated behavior. Use at your own risk!'), + safe_value=False) + roinfo.append(rs) + + return top + + # Store details about a high-level memory to the memory map + # This is called when a user edits a memory in the UI + def set_memory(self, mem): + number = mem.number-1 + + # Get a low-level memory object mapped to the image + _mem = self._memobj.channel[number] + _mem4 = self._memobj + # empty memory + if mem.empty: + _mem.set_raw("\xFF" * 16) + if number < 200: + _mem2 = self._memobj.channelname[number] + _mem2.set_raw("\xFF" * 16) + _mem4.channel_attributes[number].is_scanlist1 = 0 + _mem4.channel_attributes[number].is_scanlist2 = 0 + _mem4.channel_attributes[number].unknown1 = 0 + _mem4.channel_attributes[number].unknown2 = 0 + _mem4.channel_attributes[number].is_free = 1 + _mem4.channel_attributes[number].band = 0x7 + return mem + + # clean the channel memory, restore some bits if it was used before + if _mem.get_raw()[0] == "\xff": + # this was an empty memory + _mem.set_raw("\x00" * 16) + else: + # this memory wasn't empty, save some bits that we don't know the + # meaning of, or that we don't support yet + prev_0a = _mem.get_raw(asbytes=True)[0x0a] & SAVE_MASK_0A + prev_0b = _mem.get_raw(asbytes=True)[0x0b] & SAVE_MASK_0B + prev_0c = _mem.get_raw(asbytes=True)[0x0c] & SAVE_MASK_0C + prev_0d = _mem.get_raw(asbytes=True)[0x0d] & SAVE_MASK_0D + prev_0e = _mem.get_raw(asbytes=True)[0x0e] & SAVE_MASK_0E + prev_0f = _mem.get_raw(asbytes=True)[0x0f] & SAVE_MASK_0F + _mem.set_raw("\x00" * 10 + + chr(prev_0a) + chr(prev_0b) + chr(prev_0c) + + chr(prev_0d) + chr(prev_0e) + chr(prev_0f)) + + if number < 200: + _mem4.channel_attributes[number].is_scanlist1 = 0 + _mem4.channel_attributes[number].is_scanlist2 = 0 + _mem4.channel_attributes[number].unknown1 = 0 + _mem4.channel_attributes[number].unknown2 = 0 + _mem4.channel_attributes[number].is_free = 1 + _mem4.channel_attributes[number].band = 0x7 + + # find band + band = _find_band(self, mem.freq) + + # mode + if mem.mode == "NFM": + _mem.bandwidth = 1 + _mem.enable_am = 0 + elif mem.mode == "FM": + _mem.bandwidth = 0 + _mem.enable_am = 0 + elif mem.mode == "NAM": + _mem.bandwidth = 1 + _mem.enable_am = 1 + elif mem.mode == "AM": + _mem.bandwidth = 0 + _mem.enable_am = 1 + + # frequency/offset + _mem.freq = mem.freq/10 + _mem.offset = mem.offset/10 + + if mem.duplex == "": + _mem.offset = 0 + _mem.shift = 0 + elif mem.duplex == '-': + _mem.shift = FLAGS1_OFFSET_MINUS + elif mem.duplex == '+': + _mem.shift = FLAGS1_OFFSET_PLUS + elif mem.duplex == 'off': + # we fake tx disable by setting the tx freq to 0 MHz + _mem.shift = FLAGS1_OFFSET_MINUS + _mem.offset = _mem.freq + + # set band + if number < 200: + _mem4.channel_attributes[number].is_free = 0 + _mem4.channel_attributes[number].band = band + + # channels >200 are the 14 VFO chanells and don't have names + if number < 200: + _mem2 = self._memobj.channelname[number] + tag = mem.name.ljust(10) + "\x00"*6 + _mem2.name = tag # Store the alpha tag + + # tone data + self._set_tone(mem, _mem) + + # step + _mem.step = STEPS.index(mem.tuning_step) + + # tx power + if str(mem.power) == str(UVK5_POWER_LEVELS[2]): + _mem.txpower = POWER_HIGH + elif str(mem.power) == str(UVK5_POWER_LEVELS[1]): + _mem.txpower = POWER_MEDIUM + else: + _mem.txpower = POWER_LOW + + for setting in mem.extra: + sname = setting.get_name() + svalue = setting.value.get_value() + + if sname == "bclo": + _mem.bclo = svalue and 1 or 0 + + if sname == "pttid": + _mem.dtmf_pttid = PTTID_LIST.index(svalue) + + if sname == "frev": + _mem.freq_reverse = svalue and 1 or 0 + + if sname == "dtmfdecode": + _mem.dtmf_decode = svalue and 1 or 0 + + if sname == "scrambler": + _mem.scrambler = ( + _mem.scrambler & 0xf0) | SCRAMBLER_LIST.index(svalue) + + if number < 200 and sname == "scanlists": + if svalue == "1": + _mem4.channel_attributes[number].is_scanlist1 = 1 + _mem4.channel_attributes[number].is_scanlist2 = 0 + elif svalue == "2": + _mem4.channel_attributes[number].is_scanlist1 = 0 + _mem4.channel_attributes[number].is_scanlist2 = 1 + elif svalue == "1+2": + _mem4.channel_attributes[number].is_scanlist1 = 1 + _mem4.channel_attributes[number].is_scanlist2 = 1 + else: + _mem4.channel_attributes[number].is_scanlist1 = 0 + _mem4.channel_attributes[number].is_scanlist2 = 0 + + return mem diff --git a/chirp/drivers/vgc.py b/chirp/drivers/vgc.py index 97aece3..72e63df 100644 --- a/chirp/drivers/vgc.py +++ b/chirp/drivers/vgc.py @@ -15,7 +15,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import time import struct import logging import re @@ -26,7 +25,6 @@ from chirp.settings import RadioSettingGroup, RadioSetting, \ RadioSettingValueBoolean, RadioSettingValueList, \ RadioSettingValueString, RadioSettingValueInteger, \ RadioSettingValueFloat, RadioSettings -from textwrap import dedent LOG = logging.getLogger(__name__) @@ -320,7 +318,7 @@ LIST_WBANDA = ["Line-in", "AM", "FM"] + LIST_WBANDB LIST_SQL = ["Open"] + ["%s" % x for x in range(1, 10)] _STEP_LIST = [2.5, 5., 6.25, 8.33, 9., 10., 12.5, 15., 20., 25., 50., 100., 200.] -LIST_STEP = ["Auto"] + ["{0:.2f} KHz".format(x) for x in _STEP_LIST] +LIST_STEP = ["Auto"] + ["{0:.2f} kHz".format(x) for x in _STEP_LIST] LIST_SMODE = ["F-1", "F-2"] # DTMF settings lists @@ -345,7 +343,7 @@ POWER_LEVELS = [chirp_common.PowerLevel("Low", watts=5), chirp_common.PowerLevel("High", watts=50)] # B-TECH UV-50X3 id string -UV50X3_id = "VGC6600MD" +UV50X3_id = b"VGC6600MD" def _clean_buffer(radio): @@ -353,21 +351,21 @@ def _clean_buffer(radio): junk = radio.pipe.read(256) radio.pipe.timeout = STIMEOUT if junk: - Log.debug("Got %i bytes of junk before starting" % len(junk)) + LOG.debug("Got %i bytes of junk before starting" % len(junk)) def _check_for_double_ack(radio): radio.pipe.timeout = 0.005 c = radio.pipe.read(1) radio.pipe.timeout = STIMEOUT - if c and c != '\x06': + if c and c != b'\x06': _exit_program_mode(radio) raise errors.RadioError('Expected nothing or ACK, got %r' % c) def _rawrecv(radio, amount): """Raw read from the radio device""" - data = "" + data = b"" try: data = radio.pipe.read(amount) except: @@ -392,7 +390,7 @@ def _rawsend(radio, data): def _make_frame(cmd, addr, length, data=""): - """Pack the info in the headder format""" + """Pack the info in the header format""" frame = struct.pack(">BHB", ord(cmd), addr, length) # add the data if set if len(data) != 0: @@ -408,7 +406,7 @@ def _recv(radio, addr, length=BLOCK_SIZE): # check for unexpected extra command byte c, a, l = struct.unpack(">BHB", hdr) - if hdr[0:2] == "WW" and a != addr: + if hdr[0:2] == b"WW" and a != addr: # extra command byte detected # throw away the 1st byte and add the next byte in the buffer hdr = hdr[1:] + _rawrecv(radio, 1) @@ -421,7 +419,7 @@ def _recv(radio, addr, length=BLOCK_SIZE): LOG.debug(util.hexprint(hdr + data)) c, a, l = struct.unpack(">BHB", hdr) - if a != addr or l != length or c != ord("W"): + if a != addr or l != length or c != ord(b"W"): _exit_program_mode(radio) LOG.error("Invalid answer for block 0x%04x:" % addr) LOG.debug("CMD: %s ADDR: %04x SIZE: %02x" % (c, a, l)) @@ -440,7 +438,7 @@ def _do_ident(radio): # flush input buffer _clean_buffer(radio) - magic = "V66LINK" + magic = b"V66LINK" _rawsend(radio, magic) @@ -463,7 +461,7 @@ def _do_ident(radio): def _exit_program_mode(radio): - endframe = "\x45" + endframe = b"\x45" _rawsend(radio, endframe) @@ -476,13 +474,13 @@ def _download(radio): # UI progress status = chirp_common.Status() status.cur = 0 - status.max = MEM_SIZE / BLOCK_SIZE + status.max = MEM_SIZE // BLOCK_SIZE status.msg = "Cloning from radio..." radio.status_fn(status) - data = "" + data = b"" for addr in range(0, MEM_SIZE, BLOCK_SIZE): - frame = _make_frame("R", addr, BLOCK_SIZE) + frame = _make_frame(b"R", addr, BLOCK_SIZE) # DEBUG LOG.info("Request sent:") LOG.debug(util.hexprint(frame)) @@ -497,7 +495,7 @@ def _download(radio): data += d # UI Update - status.cur = addr / BLOCK_SIZE + status.cur = addr // BLOCK_SIZE status.msg = "Cloning from radio..." radio.status_fn(status) @@ -517,7 +515,7 @@ def _upload(radio): # UI progress status = chirp_common.Status() status.cur = 0 - status.max = MEM_SIZE / BLOCK_SIZE + status.max = MEM_SIZE // BLOCK_SIZE status.msg = "Cloning to radio..." radio.status_fn(status) @@ -526,13 +524,13 @@ def _upload(radio): # sending the data data = radio.get_mmap()[addr:addr + BLOCK_SIZE] - frame = _make_frame("W", addr, BLOCK_SIZE, data) + frame = _make_frame(b"W", addr, BLOCK_SIZE, data) _rawsend(radio, frame) # receiving the response ack = _rawrecv(radio, 1) - if ack != "\x06": + if ack != b"\x06": _exit_program_mode(radio) msg = "Bad ack writing block 0x%04x" % addr raise errors.RadioError(msg) @@ -540,7 +538,7 @@ def _upload(radio): _check_for_double_ack(radio) # UI Update - status.cur = addr / BLOCK_SIZE + status.cur = addr // BLOCK_SIZE status.msg = "Cloning to radio..." radio.status_fn(status) @@ -551,16 +549,32 @@ def model_match(cls, data): """Match the opened/downloaded image to the correct version""" rid = data[0x6140:0x6148] - if rid in cls.IDENT.encode(): + if rid in cls.IDENT: return True return False +def _split(rf, f1, f2): + """Returns False if the two freqs are in the same band (no split) + or True otherwise""" + + # determine if the two freqs are in the same band + for low, high in rf.valid_bands: + if f1 >= low and f1 <= high and \ + f2 >= low and f2 <= high: + # if the two freqs are on the same Band this is not a split + return False + + # if you get here is because the freq pairs are split + return True + + class VGCStyleRadio(chirp_common.CloneModeRadio, chirp_common.ExperimentalRadio): """BTECH's UV-50X3""" VENDOR = "BTECH" + NEEDS_COMPAT_SERIAL = False _air_range = (108000000, 136000000) _vhf_range = (136000000, 174000000) _vhf2_range = (174000000, 250000000) @@ -581,22 +595,18 @@ class VGCStyleRadio(chirp_common.CloneModeRadio, 'Please save an unedited copy of your first successful\n' 'download to a CHIRP Radio Images(*.img) file.' ) - rp.pre_download = _(dedent("""\ - Follow this instructions to download your info: - - 1 - Turn off your radio - 2 - Connect your interface cable - 3 - Turn on your radio - 4 - Do the download of your radio data - """)) - rp.pre_upload = _(dedent("""\ - Follow this instructions to upload your info: - - 1 - Turn off your radio - 2 - Connect your interface cable - 3 - Turn on your radio - 4 - Do the upload of your radio data - """)) + rp.pre_download = _( + "Follow this instructions to download your info:\n" + "1 - Turn off your radio\n" + "2 - Connect your interface cable\n" + "3 - Turn on your radio\n" + "4 - Do the download of your radio data\n") + rp.pre_upload = _( + "Follow this instructions to upload your info:\n" + "1 - Turn off your radio\n" + "2 - Connect your interface cable\n" + "3 - Turn on your radio\n" + "4 - Do the upload of your radio data\n") return rp def get_features(self): @@ -657,7 +667,7 @@ class VGCStyleRadio(chirp_common.CloneModeRadio, LOG.exception('Unexpected error during download') raise errors.RadioError('Unexpected error communicating ' 'with the radio') - self._mmap = memmap.MemoryMap(data) + self._mmap = memmap.MemoryMapBytes(data) self.process_mmap() def sync_out(self): @@ -754,12 +764,17 @@ class VGCStyleRadio(chirp_common.CloneModeRadio, else: # TX feq set offset = (int(_mem.txfreq) * 10) - mem.freq - if offset < 0: - mem.offset = abs(offset) - mem.duplex = "-" - elif offset > 0: - mem.offset = offset - mem.duplex = "+" + if offset != 0: + if _split(self.get_features(), mem.freq, int( + _mem.txfreq) * 10): + mem.duplex = "split" + mem.offset = int(_mem.txfreq) * 10 + elif offset < 0: + mem.offset = abs(offset) + mem.duplex = "-" + elif offset > 0: + mem.offset = offset + mem.duplex = "+" else: mem.offset = 0 @@ -841,7 +856,7 @@ class VGCStyleRadio(chirp_common.CloneModeRadio, self.encode_tone(_mem.rxtone, rxmode, rxtone, rxpol) # name TAG of the channel - _names.name = mem.name.ljust(6, "\xFF") + _names.name = mem.name.rstrip().ljust(6, "\xFF") # power level, # default power level is low _mem.txp = 0 if mem.power is None else POWER_LEVELS.index(mem.power) @@ -1411,7 +1426,7 @@ class VGCStyleRadio(chirp_common.CloneModeRadio, setattr(obj, setting, int(element.value) + 5) elif setting in ["tt1stdly", "ttdlyqt"]: setattr(obj, setting, int(element.value) + 2) - elif re.match('code\d', setting): + elif re.match(r'code\d', setting): # set dtmf length field and then get bcd dtmf dtmfstrlen = len(str(element.value).strip()) setattr(_mem.dtmfcode, setting + "_len", dtmfstrlen) @@ -1420,7 +1435,7 @@ class VGCStyleRadio(chirp_common.CloneModeRadio, elif element.value.get_mutable(): LOG.debug("Setting %s = %s" % (setting, element.value)) setattr(obj, setting, element.value) - except Exception as e: + except Exception: LOG.debug(element.get_name()) raise diff --git a/chirp/drivers/vx170.py b/chirp/drivers/vx170.py index dde182c..0f81c8b 100644 --- a/chirp/drivers/vx170.py +++ b/chirp/drivers/vx170.py @@ -14,10 +14,7 @@ # along with this program. If not, see . from chirp.drivers import yaesu_clone, ft7800 -from chirp import chirp_common, directory, memmap, bitwise, errors -from textwrap import dedent -import time -import os +from chirp import chirp_common, directory, bitwise MEM_FORMAT = """ #seekto 0x018A; @@ -100,20 +97,25 @@ class VX170Radio(ft7800.FTx800Radio): @classmethod def get_prompts(cls): rp = chirp_common.RadioPrompts() - rp.pre_download = _(dedent("""\ -1. Turn radio off. -2. Connect cable to MIC/SP jack. -3. Press and hold in the [moni] key while turning the radio on. -4. Select CLONE in menu, then press F. Radio restarts in clone mode. - ("CLONE" will appear on the display). -5. After clicking OK, briefly hold [PTT] key to send image. - ("-TX-" will appear on the LCD). """)) - rp.pre_upload = _(dedent("""\ -1. Turn radio off. -3. Press and hold in the [moni] key while turning the radio on. -4. Select CLONE in menu, then press F. Radio restarts in clone mode. - ("CLONE" will appear on the display). -5. Press the [moni] key ("-RX-" will appear on the LCD).""")) + rp.pre_download = _( + "1. Turn radio off.\n" + "2. Connect cable to MIC/SP jack.\n" + "3. Press and hold in the [moni] key while turning the radio" + " on.\n" + "4. Select CLONE in menu, then press F. Radio restarts in clone" + " mode.\n" + " (\"CLONE\" will appear on the display).\n" + "5. After clicking OK, briefly hold [PTT] key to send" + " image.\n" + " (\"-TX-\" will appear on the LCD). \n") + rp.pre_upload = _( + "1. Turn radio off.\n" + "3. Press and hold in the [moni] key while turning the radio" + " on.\n" + "4. Select CLONE in menu, then press F. Radio restarts in clone" + " mode.\n" + " (\"CLONE\" will appear on the display).\n" + "5. Press the [moni] key (\"-RX-\" will appear on the LCD).\n") return rp def _checksums(self): diff --git a/chirp/drivers/vx2.py b/chirp/drivers/vx2.py index 91867b6..41ee3f4 100644 --- a/chirp/drivers/vx2.py +++ b/chirp/drivers/vx2.py @@ -17,11 +17,8 @@ from chirp.drivers import yaesu_clone from chirp import chirp_common, directory, bitwise from chirp.settings import RadioSetting, RadioSettingGroup, \ - RadioSettingValueInteger, RadioSettingValueList, \ - RadioSettingValueBoolean, RadioSettingValueString, \ - RadioSettings -import os -import traceback + RadioSettingValueList, RadioSettingValueBoolean, \ + RadioSettingValueString, RadioSettings import re import logging @@ -275,7 +272,7 @@ def _wipe_memory(mem): class VX2Radio(yaesu_clone.YaesuCloneModeRadio): """Yaesu VX-2""" MODEL = "VX-2" - _model = "AH015" + _model = b"AH015" BAUD_RATE = 19200 _block_lengths = [10, 8, 32577] _memsize = 32595 @@ -714,7 +711,7 @@ class VX2Radio(yaesu_clone.YaesuCloneModeRadio): try: setting = element.get_name() _settings = self._memobj.settings - if re.match('dtmf\d', setting): + if re.match(r'dtmf\d', setting): # set dtmf fields dtmfstr = str(element.value).strip() newval = [] @@ -746,6 +743,6 @@ class VX2Radio(yaesu_clone.YaesuCloneModeRadio): newval = self._encode_chars(newval, 6) LOG.debug("Setting %s(%s) <= %s" % (setting, oldval, newval)) setattr(_settings, setting, newval) - except Exception as e: + except Exception: LOG.debug(element.get_name()) raise diff --git a/chirp/drivers/vx3.py b/chirp/drivers/vx3.py index 39ff85e..fcbbd05 100644 --- a/chirp/drivers/vx3.py +++ b/chirp/drivers/vx3.py @@ -17,11 +17,8 @@ from chirp.drivers import yaesu_clone from chirp import chirp_common, directory, bitwise from chirp.settings import RadioSetting, RadioSettingGroup, \ - RadioSettingValueInteger, RadioSettingValueList, \ - RadioSettingValueBoolean, RadioSettingValueString, \ - RadioSettings -from textwrap import dedent -import os + RadioSettingValueList, RadioSettingValueBoolean, \ + RadioSettingValueString, RadioSettings import re import logging @@ -363,7 +360,7 @@ class VX3Radio(yaesu_clone.YaesuCloneModeRadio): MODEL = "VX-3" # 41 48 30 32 38 - _model = "AH028" + _model = b"AH028" _memsize = 32587 _block_lengths = [10, 32577] # right now this reads in 45 seconds and writes in 41 seconds @@ -372,18 +369,19 @@ class VX3Radio(yaesu_clone.YaesuCloneModeRadio): @classmethod def get_prompts(cls): rp = chirp_common.RadioPrompts() - rp.pre_download = _(dedent("""\ -1. Turn radio off. -2. Connect cable to MIC/SP jack. -3. Press and hold in the [F/W] key while turning the radio on - ("CLONE" will appear on the display). -4. After clicking OK, press the [BAND] key to send image.""")) - rp.pre_upload = _(dedent("""\ -1. Turn radio off. -2. Connect cable to MIC/SP jack. -3. Press and hold in the [F/W] key while turning the radio on - ("CLONE" will appear on the display). -4. Press the [V/M] key ("-WAIT-" will appear on the LCD).""")) + rp.pre_download = _( + "1. Turn radio off.\n" + "2. Connect cable to MIC/SP jack.\n" + "3. Press and hold in the [F/W] key while turning the radio on\n" + " (\"CLONE\" will appear on the display).\n" + "4. After clicking OK, press the [BAND] key to send" + " image.\n") + rp.pre_upload = _( + "1. Turn radio off.\n" + "2. Connect cable to MIC/SP jack.\n" + "3. Press and hold in the [F/W] key while turning the radio on\n" + " (\"CLONE\" will appear on the display).\n" + "4. Press the [V/M] key (\"-WAIT-\" will appear on the LCD).\n") return rp def _checksums(self): @@ -622,7 +620,7 @@ class VX3Radio(yaesu_clone.YaesuCloneModeRadio): "apo", "APO time (hrs)", RadioSettingValueList(opts, opts[_settings.apo]))) - opts = ["+/- 5 MHZ", "+/- 10 MHZ", "+/- 50 MHZ", "+/- 100 MHZ"] + opts = ["+/- 5 MHz", "+/- 10 MHz", "+/- 50 MHz", "+/- 100 MHz"] basic.append(RadioSetting( "channel_counter", "Channel counter", RadioSettingValueList(opts, opts[_settings.channel_counter]))) @@ -939,7 +937,7 @@ class VX3Radio(yaesu_clone.YaesuCloneModeRadio): try: setting = element.get_name() _settings = self._memobj.settings - if re.match('dtmf\d', setting): + if re.match(r'dtmf\d', setting): # set dtmf fields dtmfstr = str(element.value).strip() newval = [] @@ -973,6 +971,6 @@ class VX3Radio(yaesu_clone.YaesuCloneModeRadio): newval = self._encode_chars(newval, 6) LOG.debug("Setting %s(%s) <= %s" % (setting, oldval, newval)) setattr(_settings, setting, newval) - except Exception as e: + except Exception: LOG.debug(element.get_name()) raise diff --git a/chirp/drivers/vx5.py b/chirp/drivers/vx5.py index e14c1f2..bf88337 100644 --- a/chirp/drivers/vx5.py +++ b/chirp/drivers/vx5.py @@ -16,7 +16,6 @@ from chirp.drivers import yaesu_clone from chirp import chirp_common, directory, errors, bitwise -from textwrap import dedent MEM_FORMAT = """ struct mem_struct { @@ -157,7 +156,7 @@ class VX5BankModel(chirp_common.BankModel): for bank in self.get_mappings(): if memory.number in [x.number for x in self.get_mapping_memories(bank)]: - banks.append(bank) + banks.append(bank) return banks @@ -314,21 +313,22 @@ class VX5Radio(yaesu_clone.YaesuCloneModeRadio): @classmethod def get_prompts(cls): rp = chirp_common.RadioPrompts() - rp.pre_download = _(dedent("""\ - 1. Turn radio off. - 2. Connect cable to MIC/EAR jack. - 3. Press and hold in the [F/W] key while turning the radio on - ("CLONE" will appear on the display). - 4. After clicking OK, press the [VFO(DW)SC] key to receive - the image from the radio.""")) - rp.pre_upload = _(dedent("""\ - 1. Turn radio off. - 2. Connect cable to MIC/EAR jack. - 3. Press and hold in the [F/W] key while turning the radio on - ("CLONE" will appear on the display). - 4. Press the [MR(SKP)SC] key ("CLONE WAIT" will appear - on the LCD). - 5. Click OK to send image to radio.""")) + rp.pre_download = _( + "1. Turn radio off.\n" + "2. Connect cable to MIC/EAR jack.\n" + "3. Press and hold in the [F/W] key while turning the radio on\n" + " (\"CLONE\" will appear on the display).\n" + "4. After clicking OK, press the [VFO(DW)SC] key to" + " receive\n" + " the image from the radio.\n") + rp.pre_upload = _( + "1. Turn radio off.\n" + "2. Connect cable to MIC/EAR jack.\n" + "3. Press and hold in the [F/W] key while turning the radio on\n" + " (\"CLONE\" will appear on the display).\n" + "4. Press the [MR(SKP)SC] key (\"CLONE WAIT\" will appear\n" + " on the LCD).\n" + "5. Click OK to send image to radio.\n") return rp @classmethod diff --git a/chirp/drivers/vx510.py b/chirp/drivers/vx510.py index 49570e2..f5c498d 100644 --- a/chirp/drivers/vx510.py +++ b/chirp/drivers/vx510.py @@ -14,7 +14,7 @@ # along with this program. If not, see . from chirp.drivers import yaesu_clone -from chirp import chirp_common, directory, bitwise +from chirp import chirp_common, bitwise # This driver is unfinished and therefore does not register itself with Chirp. # @@ -55,7 +55,8 @@ char imgname[10]; STEPS = [5.0, 6.25] CHARSET = "".join([chr(x) for x in range(ord("0"), ord("9")+1)] + - [chr(x) for x in range(ord("A"), ord("Z")+1)]) + "<=>*+-\/_ " + [chr(x) for x in range(ord("A"), ord("Z")+1)]) + \ + r"<=>*+-\/_ " TONES = list(chirp_common.TONES) TONES.remove(165.5) TONES.remove(171.3) diff --git a/chirp/drivers/vx6.py b/chirp/drivers/vx6.py index 4616fe2..080570a 100644 --- a/chirp/drivers/vx6.py +++ b/chirp/drivers/vx6.py @@ -13,14 +13,17 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +import logging + from chirp.drivers import yaesu_clone from chirp import chirp_common, directory, bitwise from chirp.settings import RadioSettingGroup, RadioSetting, RadioSettings from chirp.settings import RadioSettingValueString, RadioSettingValueList from chirp.settings import RadioSettingValueBoolean -from textwrap import dedent import re +LOG = logging.getLogger(__name__) + # flags.{even|odd}_pskip: These are actually "preferential *scan* channels". # Is that what they mean on other radios as well? @@ -193,14 +196,16 @@ struct { DUPLEX = ["", "-", "+", "split"] MODES = ["FM", "AM", "WFM", "FM"] # last is auto -TMODES = ["", "Tone", "TSQL", "DTCS"] +TMODES = ["", "Tone", "TSQL", + "TSQL-R", # This is "RV TN" as Yaesu calls it + "DTCS", "DTCS->", "Tone->DTCS", "DTCS->Tone"] DTMFCHARSET = list("0123456789ABCD*#-") STEPS = [5.0, 10.0, 12.5, 15.0, 20.0, 25.0, 50.0, 100.0, 9.0, 200.0, 5.0] # last is auto, 9.0k and 200.0k are unadvertised CHARSET = ["%i" % int(x) for x in range(10)] + \ [chr(x) for x in range(ord("A"), ord("Z")+1)] + \ - list(" +-/\x00[]__" + ("\x00" * 9) + "$%%\x00**.|=\\\x00@") + \ + list(" +-/?[]u_" + ("\x00" * 9) + "$%%\x00*#.|=\\o@") + \ list("\x00" * 100) PASS_CHARSET = list("0123456789ABCDEF") @@ -316,7 +321,7 @@ class VX6Radio(yaesu_clone.YaesuCloneModeRadio): VENDOR = "Yaesu" MODEL = "VX-6" - _model = "AH021" + _model = b"AH021" _memsize = 32587 _block_lengths = [10, 32577] _block_size = 16 @@ -326,7 +331,7 @@ class VX6Radio(yaesu_clone.YaesuCloneModeRadio): _ARTS_INT = ("15 S", "25 S") _BELL = ("OFF", "1", "3", "5", "8", "Continuous") _BEEP_LEVEL = ["%i" % int(x) for x in range(1, 10)] - _CH_CNT = ("5 MHZ", "10 MHZ", "50 MHZ", "100 MHZ") + _CH_CNT = ("5 MHz", "10 MHz", "50 MHz", "100 MHz") _DIM_LEVEL = ["%i" % int(x) for x in range(0, 13)] _EMERGENCY = ("Beep", "Strobe", "Bp+Str", "Beam", "Bp+Bem", "CW", "Bp+CW", "CWT") @@ -346,10 +351,10 @@ class VX6Radio(yaesu_clone.YaesuCloneModeRadio): _ON_TIMER = ["OFF"] + \ ["%02d:%02d" % (t / 60, t % 60) for t in range(10, 1450, 10)] _OPEN_MSG = ("Off", "DC Voltage", "Message") - _PTT_DELAY = ("OFF", "20MS", "50MS", "100MS", "200MS") + _PTT_DELAY = ("OFF", "20 ms", "50 ms", "100 ms", "200 ms") _RF_SQL = ("OFF", "S1", "S2", "S3", "S4", "S5", "S6", "S7", "S8", "S9", "S9+") - _RX_SAVE = ("OFF", "200 ms", "300 MS", "500 MS", "1 S", "2 S") + _RX_SAVE = ("OFF", "200 ms", "300 ms", "500 ms", "1 s", "2 s") _RESUME = ("3 SEC", "5 SEC", "10 SEC", "BUSY", "HOLD") _SMART_SEARCH = ("SINGLE", "CONT") _TOT = ("OFF", "1MIN", "3MIN", "5MIN", "10MIN") @@ -360,18 +365,19 @@ class VX6Radio(yaesu_clone.YaesuCloneModeRadio): @classmethod def get_prompts(cls): rp = chirp_common.RadioPrompts() - rp.pre_download = _(dedent("""\ -1. Turn radio off. -2. Connect cable to MIC/SP jack. -3. Press and hold in the [F/W] key while turning the radio on - ("CLONE" will appear on the display). -4. After clicking OK, press the [BAND] key to send image.""")) - rp.pre_upload = _(dedent("""\ -1. Turn radio off. -2. Connect cable to MIC/SP jack. -3. Press and hold in the [F/W] key while turning the radio on - ("CLONE" will appear on the display). -4. Press the [V/M] key ("-WAIT-" will appear on the LCD).""")) + rp.pre_download = _( + "1. Turn radio off.\n" + "2. Connect cable to MIC/SP jack.\n" + "3. Press and hold in the [F/W] key while turning the radio on\n" + " (\"CLONE\" will appear on the display).\n" + "4. After clicking OK, press the [BAND] key to send" + " image.\n") + rp.pre_upload = _( + "1. Turn radio off.\n" + "2. Connect cable to MIC/SP jack.\n" + "3. Press and hold in the [F/W] key while turning the radio on\n" + " (\"CLONE\" will appear on the display).\n" + "4. Press the [V/M] key (\"-WAIT-\" will appear on the LCD).\n") return rp def _checksums(self): @@ -386,7 +392,8 @@ class VX6Radio(yaesu_clone.YaesuCloneModeRadio): rf.has_bank_names = True rf.has_dtcs_polarity = False rf.valid_modes = ["FM", "WFM", "AM", "NFM"] - rf.valid_tmodes = ["", "Tone", "TSQL", "DTCS"] + rf.valid_tmodes = ["", "Tone", "TSQL", "DTCS", "TSQL-R", "Cross"] + rf.valid_cross_modes = [x for x in TMODES if '->' in x] rf.valid_duplexes = DUPLEX rf.valid_tuning_steps = STEPS rf.valid_power_levels = POWER_LEVELS @@ -426,7 +433,12 @@ class VX6Radio(yaesu_clone.YaesuCloneModeRadio): mem.freq = chirp_common.fix_rounded_step(int(_mem.freq) * 1000) mem.offset = chirp_common.fix_rounded_step(int(_mem.offset) * 1000) mem.rtone = mem.ctone = chirp_common.TONES[_mem.tone & 0x3f] - mem.tmode = TMODES[_mem.tmode] + tmode = TMODES[_mem.tmode] + if '->' in tmode: + mem.tmode = 'Cross' + mem.cross_mode = tmode + else: + mem.tmode = tmode mem.duplex = DUPLEX[_mem.duplex] mem.mode = MODES[_mem.mode] if mem.mode == "FM" and _mem.half_deviation: @@ -478,7 +490,10 @@ class VX6Radio(yaesu_clone.YaesuCloneModeRadio): _mem.freq = mem.freq / 1000 _mem.offset = mem.offset / 1000 _mem.tone = chirp_common.TONES.index(mem.rtone) - _mem.tmode = TMODES.index(mem.tmode) + if mem.tmode == 'Cross': + _mem.tmode = TMODES.index(mem.cross_mode) + else: + _mem.tmode = TMODES.index(mem.tmode) _mem.duplex = DUPLEX.index(mem.duplex) if mem.mode == "NFM": _mem.mode = MODES.index("FM") @@ -489,7 +504,7 @@ class VX6Radio(yaesu_clone.YaesuCloneModeRadio): _mem.dcs = chirp_common.DTCS_CODES.index(mem.dtcs) _mem.tune_step = STEPS.index(mem.tuning_step) if mem.power: - _mem.power = 3 - POWER_LEVELS.index(mem.power) + _mem.power = 3 - self._resolve_power(mem) else: _mem.power = 0 @@ -503,6 +518,24 @@ class VX6Radio(yaesu_clone.YaesuCloneModeRadio): if mem.name.strip(): _mem.name[0] |= 0x80 + def _resolve_power(self, mem): + # Since we have two sets of power levels, we may need to match the + # one in mem.power by name instead of absolute power to handle things + # like editing a 2m channel to a 220 MHz frequency, etc. + by_name = [str(x) for x in POWER_LEVELS] + index = by_name.index(str(mem.power)) + LOG.debug('Resolving power %r by name to index %i' % ( + mem.power, index)) + return index + + def validate_memory(self, mem): + # Override memory validation with by-name power level matching, + # since we do not expose those power levels in our RadioFeatures. + if mem.power and mem.power not in POWER_LEVELS: + mem = mem.dupe() + mem.power = POWER_LEVELS[self._resolve_power(mem)] + return super().validate_memory(mem) + def get_bank_model(self): return VX6BankModel(self) @@ -511,7 +544,9 @@ class VX6Radio(yaesu_clone.YaesuCloneModeRadio): for i in inarr: if i == 0xFF: break - outstr += CHARSET[i & 0x7F] + outchar = CHARSET[i & 0x7F] + if outchar != "\x00": + outstr += outchar return outstr.rstrip() def _encode_chars(self, instr, length=16): @@ -836,7 +871,7 @@ class VX6Radio(yaesu_clone.YaesuCloneModeRadio): try: setting = element.get_name() _settings = self._memobj.settings - if re.match('internet_dtmf_\d', setting): + if re.match(r'internet_dtmf_\d', setting): # set dtmf fields dtmfstr = str(element.value).strip() newval = [] @@ -849,7 +884,7 @@ class VX6Radio(yaesu_clone.YaesuCloneModeRadio): _settings = self._memobj.internet_dtmf[idx] _settings.memory = newval continue - elif re.match('dtmf_\d', setting): + elif re.match(r'dtmf_\d', setting): # set dtmf fields dtmfstr = str(element.value).strip() newval = [] @@ -871,5 +906,5 @@ class VX6Radio(yaesu_clone.YaesuCloneModeRadio): elif setting == "password": newval = self._encode_chars(newval, 4) setattr(_settings, setting, newval) - except Exception as e: + except Exception: raise diff --git a/chirp/drivers/vx7.py b/chirp/drivers/vx7.py index 1dedfaf..01b8543 100644 --- a/chirp/drivers/vx7.py +++ b/chirp/drivers/vx7.py @@ -15,7 +15,6 @@ from chirp.drivers import yaesu_clone from chirp import chirp_common, directory, bitwise -from textwrap import dedent import logging LOG = logging.getLogger(__name__) @@ -139,9 +138,8 @@ class VX7BankModel(chirp_common.BankModel): remaining_members += 1 if not found: - raise Exception("Memory {num} not in " + - "bank {bank}".format(num=memory.number, - bank=bank)) + raise Exception("Memory {num} is not in bank {bank}".format( + num=memory.number, bank=bank)) if not remaining_members: _bank_used.in_use = 0xFFFF @@ -190,18 +188,22 @@ class VX7Radio(yaesu_clone.YaesuCloneModeRadio): @classmethod def get_prompts(cls): rp = chirp_common.RadioPrompts() - rp.pre_download = _(dedent("""\ -1. Turn radio off. -2. Connect cable to MIC/SP jack. -3. Press and hold in the [MON-F] key while turning the radio on - ("CLONE" will appear on the display). -4. After clicking OK, press the [BAND] key to send image.""")) - rp.pre_upload = _(dedent("""\ -1. Turn radio off. -2. Connect cable to MIC/SP jack. -3. Press and hold in the [MON-F] key while turning the radio on - ("CLONE" will appear on the display). -4. Press the [V/M] key ("CLONE WAIT" will appear on the LCD).""")) + rp.pre_download = _( + "1. Turn radio off.\n" + "2. Connect cable to MIC/SP jack.\n" + "3. Press and hold in the [MON-F] key while turning the radio" + " on\n" + " (\"CLONE\" will appear on the display).\n" + "4. After clicking OK, press the [BAND] key to send" + " image.\n") + rp.pre_upload = _( + "1. Turn radio off.\n" + "2. Connect cable to MIC/SP jack.\n" + "3. Press and hold in the [MON-F] key while turning the radio" + " on\n" + " (\"CLONE\" will appear on the display).\n" + "4. Press the [V/M] key (\"CLONE WAIT\" will appear on the" + " LCD).\n") return rp def _checksums(self): @@ -349,7 +351,7 @@ class VX7Radio(yaesu_clone.YaesuCloneModeRadio): if _is220(mem.freq): if str(mem.power) not in [str(l) for l in POWER_LEVELS_220]: msgs.append(chirp_common.ValidationError( - "Power level %s not supported on 220MHz band" % + "Power level %s not supported on 220 MHz band" % mem.power)) return msgs diff --git a/chirp/drivers/vx8.py b/chirp/drivers/vx8.py index 43c3102..2f6e571 100644 --- a/chirp/drivers/vx8.py +++ b/chirp/drivers/vx8.py @@ -13,7 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import os import re import logging @@ -22,7 +21,6 @@ from chirp import chirp_common, directory, bitwise from chirp.settings import RadioSettingGroup, RadioSetting, RadioSettings from chirp.settings import RadioSettingValueInteger, RadioSettingValueString from chirp.settings import RadioSettingValueList, RadioSettingValueBoolean -from textwrap import dedent LOG = logging.getLogger(__name__) @@ -340,10 +338,8 @@ u8 checksum; TMODES = ["", "Tone", "TSQL", "DTCS"] DUPLEX = ["", "-", "+", "split"] MODES = ["FM", "AM", "WFM", "NFM"] -STEPS = list(chirp_common.TUNING_STEPS) -STEPS.remove(30.0) -STEPS.append(100.0) -STEPS.insert(2, 8.33) # Index 2 is 8.33kHz airband step +STEPS = [5.0, 6.25, 8.33, 9.0, 10.0, 12.5, 15.0, 20.0, 25.0, 50.0, + 100.0, 200.0] SKIPS = ["", "S", "P"] VX8_DTMF_CHARS = list("0123456789ABCD*#-") @@ -510,7 +506,7 @@ class VX8Radio(yaesu_clone.YaesuCloneModeRadio): VENDOR = "Yaesu" MODEL = "VX-8R" - _model = "AH029" + _model = b"AH029" _memsize = 65227 _block_lengths = [10, 65217] _block_size = 32 @@ -526,7 +522,7 @@ class VX8Radio(yaesu_clone.YaesuCloneModeRadio): _has_af_dual = True _SG_RE = re.compile(r"(?P[-+NESW]?)(?P[\d]+)[\s\.,]*" - "(?P[\d]*)[\s\']*(?P[\d]*)") + r"(?P[\d]*)[\s\']*(?P[\d]*)") _RX_BAUD = ("off", "1200 baud", "9600 baud") _TX_DELAY = ("100ms", "200ms", "300ms", @@ -584,18 +580,19 @@ class VX8Radio(yaesu_clone.YaesuCloneModeRadio): @classmethod def get_prompts(cls): rp = chirp_common.RadioPrompts() - rp.pre_download = _(dedent("""\ -1. Turn radio off. -2. Connect cable to DATA jack. -3. Press and hold in the [FW] key while turning the radio on - ("CLONE" will appear on the display). -4. After clicking OK, press the [BAND] key to send image.""")) - rp.pre_upload = _(dedent("""\ -1. Turn radio off. -2. Connect cable to DATA jack. -3. Press and hold in the [FW] key while turning the radio on - ("CLONE" will appear on the display). -4. Press the [MODE] key ("-WAIT-" will appear on the LCD).""")) + rp.pre_download = _( + "1. Turn radio off.\n" + "2. Connect cable to DATA jack.\n" + "3. Press and hold in the [FW] key while turning the radio on\n" + " (\"CLONE\" will appear on the display).\n" + "4. After clicking OK, press the [BAND] key to send" + " image.\n") + rp.pre_upload = _( + "1. Turn radio off.\n" + "2. Connect cable to DATA jack.\n" + "3. Press and hold in the [FW] key while turning the radio on\n" + " (\"CLONE\" will appear on the display).\n" + "4. Press the [MODE] key (\"-WAIT-\" will appear on the LCD).\n") return rp def process_mmap(self): @@ -669,7 +666,7 @@ class VX8Radio(yaesu_clone.YaesuCloneModeRadio): mem.skip = flag.pskip and "P" or flag.skip and "S" or "" charset = ''.join(CHARSET).ljust(256, '.') - mem.name = str(_mem.label).rstrip("\xFF").translate(charset) + mem.name = str(_mem.label).rstrip("\xFF").translate(charset).rstrip() return mem @@ -724,7 +721,7 @@ class VX8Radio(yaesu_clone.YaesuCloneModeRadio): label = "".join([chr(CHARSET.index(x)) for x in mem.name.rstrip()]) _mem.label = self._add_ff_pad(label, 16) - # We only speak english here in chirpville + # We only speak English here in chirpville _mem.charsetbits[0] = 0x00 _mem.charsetbits[1] = 0x00 @@ -1436,7 +1433,7 @@ class VX8Radio(yaesu_clone.YaesuCloneModeRadio): except AttributeError as e: LOG.error("Setting %s is not in the memory map: %s" % (element.get_name(), e)) - except Exception as e: + except Exception: LOG.debug(element.get_name()) raise @@ -1472,7 +1469,7 @@ class VX8Radio(yaesu_clone.YaesuCloneModeRadio): class VX8DRadio(VX8Radio): """Yaesu VX-8DR""" MODEL = "VX-8DR" - _model = "AH29D" + _model = b"AH29D" _mem_params = (0xC128, # APRS message macros 7, # Number of message macros 0xC198, # APRS2 @@ -1672,6 +1669,6 @@ class VX8DRadio(VX8Radio): class VX8GERadio(VX8DRadio): """Yaesu VX-8GE""" MODEL = "VX-8GE" - _model = "AH041" + _model = b"AH041" _has_vibrate = True _has_af_dual = False diff --git a/chirp/drivers/vxa700.py b/chirp/drivers/vxa700.py index 421abe2..604f3d3 100644 --- a/chirp/drivers/vxa700.py +++ b/chirp/drivers/vxa700.py @@ -34,7 +34,7 @@ def _send(radio, data): def _spoonfeed(radio, data): # count = 0 - _debug("Writing %i:\n%s" % (len(data), util.hexprint(data))) + LOG.debug("Writing %i:\n%s" % (len(data), util.hexprint(data))) for byte in data: radio.pipe.write(byte) radio.pipe.flush() @@ -113,6 +113,7 @@ def _upload(radio): status.max = radio.get_memsize() radio.status_fn(status) + MEM_FORMAT = """ struct memory_struct { u8 unknown1; diff --git a/chirp/drivers/wouxun.py b/chirp/drivers/wouxun.py index d0f55b8..fb3e1f1 100644 --- a/chirp/drivers/wouxun.py +++ b/chirp/drivers/wouxun.py @@ -16,15 +16,13 @@ """Wouxun radios management module""" import time -import os import logging from chirp import util, chirp_common, bitwise, memmap, errors, directory from chirp.settings import RadioSetting, RadioSettingGroup, \ RadioSettingValueBoolean, RadioSettingValueList, \ RadioSettingValueInteger, RadioSettingValueString, \ RadioSettingValueFloat, RadioSettings -from wouxun_common import wipe_memory, do_download, do_upload -from textwrap import dedent +from chirp.drivers.wouxun_common import wipe_memory, do_download, do_upload LOG = logging.getLogger(__name__) @@ -32,18 +30,18 @@ FREQ_ENCODE_TABLE = [0x7, 0xa, 0x0, 0x9, 0xb, 0x2, 0xe, 0x1, 0x3, 0xf] def encode_freq(freq): - """Convert frequency (4 decimal digits) to wouxun format (2 bytes)""" + """Convert frequency (4 decimal digits) to Wouxun format (2 bytes)""" enc = 0 div = 1000 for i in range(0, 4): enc <<= 4 - enc |= FREQ_ENCODE_TABLE[(freq/div) % 10] + enc |= FREQ_ENCODE_TABLE[int((freq/div) % 10)] div /= 10 return enc def decode_freq(data): - """Convert from wouxun format (2 bytes) to frequency (4 decimal digits)""" + """Convert from Wouxun format (2 bytes) to frequency (4 decimal digits)""" freq = 0 shift = 12 for i in range(0, 4): @@ -60,9 +58,10 @@ class KGUVD1PRadio(chirp_common.CloneModeRadio, """Wouxun KG-UVD1P,UV2,UV3""" VENDOR = "Wouxun" MODEL = "KG-UVD1P" - _model = "KG669V" + _model = b"KG669V" + NEEDS_COMPAT_SERIAL = False - _querymodel = ("HiWOUXUN\x02", "PROGUV6X\x02") + _querymodel = (b"HiWOUXUN\x02", b"PROGUV6X\x02") CHARSET = list("0123456789") + \ [chr(x + ord("A")) for x in range(0, 26)] + list("?+-") @@ -211,20 +210,22 @@ class KGUVD1PRadio(chirp_common.CloneModeRadio, 'thing to do. However, modifications to this value may have ' 'unintended consequences, including damage to your device. ' 'You have been warned. Proceed at your own risk!') - rp.pre_download = _(dedent("""\ - 1. Turn radio off. - 2. Connect cable to mic/spkr connector. - 3. Make sure connector is firmly connected. - 4. Turn radio on. - 5. Ensure that the radio is tuned to channel with no activity. - 6. Click OK to download image from device.""")) - rp.pre_upload = _(dedent("""\ - 1. Turn radio off. - 2. Connect cable to mic/spkr connector. - 3. Make sure connector is firmly connected. - 4. Turn radio on. - 5. Ensure that the radio is tuned to channel with no activity. - 6. Click OK to upload image to device.""")) + rp.pre_download = _( + "1. Turn radio off.\n" + "2. Connect cable to mic/spkr connector.\n" + "3. Make sure connector is firmly connected.\n" + "4. Turn radio on.\n" + "5. Ensure that the radio is tuned to channel with no" + " activity.\n" + "6. Click OK to download image from device.\n") + rp.pre_upload = _( + "1. Turn radio off.\n" + "2. Connect cable to mic/spkr connector.\n" + "3. Make sure connector is firmly connected.\n" + "4. Turn radio on.\n" + "5. Ensure that the radio is tuned to channel with no" + " activity.\n" + "6. Click OK to upload image to device.\n") return rp @classmethod @@ -239,10 +240,10 @@ class KGUVD1PRadio(chirp_common.CloneModeRadio, i += 1 def _identify(self): - """Do the original wouxun identification dance""" + """Do the original Wouxun identification dance""" query = self._get_querymodel() for _i in range(0, 10): - self.pipe.write(query.next()) + self.pipe.write(next(query)) resp = self.pipe.read(9) if len(resp) != 9: LOG.debug("Got:\n%s" % util.hexprint(resp)) @@ -260,32 +261,32 @@ class KGUVD1PRadio(chirp_common.CloneModeRadio, def _start_transfer(self): """Tell the radio to go into transfer mode""" - self.pipe.write("\x02\x06") + self.pipe.write(b"\x02\x06") time.sleep(0.05) ack = self.pipe.read(1) - if ack != "\x06": + if ack != b"\x06": raise Exception("Radio refused transfer mode") def _download(self): - """Talk to an original wouxun and do a download""" + """Talk to an original Wouxun and do a download""" try: self._identify() self._start_transfer() return do_download(self, 0x0000, 0x2000, 0x0040) except errors.RadioError: raise - except Exception, e: + except Exception as e: raise errors.RadioError("Failed to communicate with radio: %s" % e) def _upload(self): - """Talk to an original wouxun and do an upload""" + """Talk to an original Wouxun and do an upload""" try: self._identify() self._start_transfer() return do_upload(self, 0x0000, 0x2000, 0x0010) except errors.RadioError: raise - except Exception, e: + except Exception as e: raise errors.RadioError("Failed to communicate with radio: %s" % e) def sync_in(self): @@ -298,7 +299,7 @@ class KGUVD1PRadio(chirp_common.CloneModeRadio, def process_mmap(self): if len(self._mmap.get_packed()) != 8192: LOG.info("Fixing old-style Wouxun image") - # Originally, CHIRP's wouxun image had eight bytes of + # Originally, CHIRP's Wouxun image had eight bytes of # static data, followed by the first memory at offset # 0x0008. Between 0.1.11 and 0.1.12, this was fixed to 16 # bytes of (whatever) followed by the first memory at @@ -658,7 +659,7 @@ class KGUVD1PRadio(chirp_common.CloneModeRadio, else: LOG.debug("Setting %s = %s" % (setting, element.value)) setattr(obj, setting, element.value) - except Exception, e: + except Exception: LOG.debug(element.get_name()) raise @@ -680,7 +681,7 @@ class KGUVD1PRadio(chirp_common.CloneModeRadio, else: setting = self._memobj.fm_presets_1 setting[index] = value - except Exception, e: + except Exception: LOG.debug(element.get_name()) raise @@ -690,7 +691,7 @@ class KGUVD1PRadio(chirp_common.CloneModeRadio, setattr(self._memobj.freq_ranges, element.get_name(), encode_freq(int(element.value))) - except Exception, e: + except Exception: LOG.debug(element.get_name()) raise @@ -890,16 +891,17 @@ class KGUVD1PRadio(chirp_common.CloneModeRadio, def match_model(cls, filedata, filename): # New-style image (CHIRP 0.1.12) if len(filedata) == 8192 and \ - filedata[0x60:0x64] != "2009" and \ - filedata[0x170:0x173] != "LX-" and \ - filedata[0x1f77:0x1f7d] == "\xff\xff\xff\xff\xff\xff" and \ - filedata[0x0d70:0x0d80] == "\xff\xff\xff\xff\xff\xff\xff\xff" \ - "\xff\xff\xff\xff\xff\xff\xff\xff": - # those areas are (seems to be) unused + filedata[0x60:0x64] != b"2009" and \ + filedata[0x170:0x173] != b"LX-" and \ + filedata[0x1f77:0x1f7d] == b"\xff\xff\xff\xff\xff\xff" and \ + filedata[0x0d70:0x0d80] == \ + b"\xff\xff\xff\xff\xff\xff\xff\xff" \ + b"\xff\xff\xff\xff\xff\xff\xff\xff": + # those areas are (seems to be) unused return True # Old-style image (CHIRP 0.1.11) if len(filedata) == 8200 and \ - filedata[0:4] == "\x01\x00\x00\x00": + filedata[0:4] == b"\x01\x00\x00\x00": return True return False @@ -909,7 +911,7 @@ class KGUV6DRadio(KGUVD1PRadio): """Wouxun KG-UV6 (D and X variants)""" MODEL = "KG-UV6" - _querymodel = ("HiWXUVD1\x02", "HiKGUVD1\x02") + _querymodel = (b"HiWXUVD1\x02", b"HiKGUVD1\x02") _MEM_FORMAT = """ #seekto 0x0010; @@ -1397,7 +1399,7 @@ class KGUV6DRadio(KGUVD1PRadio): else: LOG.debug("Setting %s = %s" % (setting, element.value)) setattr(obj, setting, element.value) - except Exception, e: + except Exception: LOG.debug(element.get_name()) raise @@ -1419,14 +1421,14 @@ class KGUV6DRadio(KGUVD1PRadio): else: setting = self._memobj.fm_presets_1 setting[index] = value - except Exception, e: + except Exception: LOG.debug(element.get_name()) raise @classmethod def match_model(cls, filedata, filename): if len(filedata) == 8192 and \ - filedata[0x1f77:0x1f7d] == "WELCOM": + filedata[0x1f77:0x1f7d] == b"WELCOM": return True return False @@ -1436,7 +1438,7 @@ class KG816Radio(KGUVD1PRadio, chirp_common.ExperimentalRadio): """Wouxun KG-816""" MODEL = "KG-816" - _querymodel = "HiWOUXUN\x02" + _querymodel = b"HiWOUXUN\x02" _MEM_FORMAT = """ #seekto 0x0010; @@ -1547,12 +1549,13 @@ class KG816Radio(KGUVD1PRadio, chirp_common.ExperimentalRadio): @classmethod def match_model(cls, filedata, filename): if len(filedata) == 8192 and \ - filedata[0x60:0x64] != "2009" and \ - filedata[0x170:0x173] != "LX-" and \ - filedata[0xF7E:0xF80] != "\x01\xE2" and \ - filedata[0x1f77:0x1f7d] == "\xff\xff\xff\xff\xff\xff" and \ - filedata[0x0d70:0x0d80] != "\xff\xff\xff\xff\xff\xff\xff\xff" \ - "\xff\xff\xff\xff\xff\xff\xff\xff": + filedata[0x60:0x64] != b"2009" and \ + filedata[0x170:0x173] != b"LX-" and \ + filedata[0xF7E:0xF80] != b"\x01\xE2" and \ + filedata[0x1f77:0x1f7d] == b"\xff\xff\xff\xff\xff\xff" and \ + filedata[0x0d70:0x0d80] != ( + b"\xff\xff\xff\xff\xff\xff\xff\xff" + b"\xff\xff\xff\xff\xff\xff\xff\xff"): return True return False diff --git a/chirp/drivers/wouxun_common.py b/chirp/drivers/wouxun_common.py index b665c20..1aaf546 100644 --- a/chirp/drivers/wouxun_common.py +++ b/chirp/drivers/wouxun_common.py @@ -14,28 +14,27 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -"""vcommon function for wouxun (or similar) radios""" +"""vcommon function for Wouxun (or similar) radios""" import struct -import os import logging -from chirp import util, chirp_common, memmap, bitwise +from chirp import util, chirp_common, memmap LOG = logging.getLogger(__name__) def wipe_memory(_mem, byte): """Cleanup a memory""" - _mem.set_raw(byte * (_mem.size() / 8)) + _mem.set_raw(byte * (_mem.size() // 8)) def do_download(radio, start, end, blocksize): """Initiate a download of @radio between @start and @end""" - image = "" + image = b"" for i in range(start, end, blocksize): cmd = struct.pack(">cHb", b"R", i, blocksize) LOG.debug(util.hexprint(cmd)) - radio.pipe.write(bitwise.string_straight_decode(cmd)) + radio.pipe.write(cmd) length = len(cmd) + blocksize resp = radio.pipe.read(length) if len(resp) != (len(cmd) + blocksize): @@ -43,7 +42,7 @@ def do_download(radio, start, end, blocksize): raise Exception("Failed to read full block (%i!=%i)" % (len(resp), len(cmd) + blocksize)) - radio.pipe.write("\x06") + radio.pipe.write(b"\x06") radio.pipe.read(1) image += resp[4:] @@ -54,7 +53,7 @@ def do_download(radio, start, end, blocksize): status.msg = "Cloning from radio" radio.status_fn(status) - return memmap.MemoryMap(image) + return memmap.MemoryMapBytes(image) def do_upload(radio, start, end, blocksize): @@ -62,13 +61,13 @@ def do_upload(radio, start, end, blocksize): ptr = start for i in range(start, end, blocksize): cmd = struct.pack(">cHb", b"W", i, blocksize) - chunk = radio.get_mmap().get_byte_compatible()[ptr:ptr+blocksize] + chunk = radio.get_mmap()[ptr:ptr+blocksize] ptr += blocksize - radio.pipe.write(bitwise.string_straight_decode(cmd + chunk)) + radio.pipe.write(cmd + chunk) LOG.debug(util.hexprint(cmd + chunk)) ack = radio.pipe.read(1) - if not ack == "\x06": + if not ack == b"\x06": raise Exception("Radio did not ack block %i" % ptr) # radio.pipe.write(ack) diff --git a/chirp/drivers/yaesu_clone.py b/chirp/drivers/yaesu_clone.py index 2fbad4d..b5a8697 100644 --- a/chirp/drivers/yaesu_clone.py +++ b/chirp/drivers/yaesu_clone.py @@ -15,9 +15,7 @@ from builtins import bytes import time -import os import logging -from textwrap import dedent from chirp import bitwise from chirp import chirp_common, util, memmap, errors @@ -232,21 +230,21 @@ class YaesuCloneModeRadio(chirp_common.CloneModeRadio): VENDOR = "Yaesu" NEEDS_COMPAT_SERIAL = False - _model = "ABCDE" + _model = b"ABCDE" @classmethod def get_prompts(cls): rp = chirp_common.RadioPrompts() - rp.pre_download = _(dedent("""\ - 1. Turn radio off. - 2. Connect data cable. - 3. Prepare radio for clone. - 4. After clicking OK, press the key to send image.""")) - rp.pre_upload = _(dedent("""\ - 1. Turn radio off. - 2. Connect data cable. - 3. Prepare radio for clone. - 4. Press the key to receive the image.""")) + rp.pre_download = _( + "1. Turn radio off.\n" + "2. Connect data cable.\n" + "3. Prepare radio for clone.\n" + "4. After clicking OK, press the key to send image.\n") + rp.pre_upload = _( + "1. Turn radio off.\n" + "2. Connect data cable.\n" + "3. Prepare radio for clone.\n" + "4. Press the key to receive the image.\n") return rp def _checksums(self): diff --git a/chirp/elib_intl.py b/chirp/elib_intl.py deleted file mode 100644 index 6603e0b..0000000 --- a/chirp/elib_intl.py +++ /dev/null @@ -1,520 +0,0 @@ -# -*- coding: utf-8 -*- -# -# Copyright © 2007-2010 Dieter Verfaillie -# -# This file is part of elib.intl. -# -# elib.intl is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# elib.intl is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public License -# along with elib.intl. If not, see . - - -''' -The elib.intl module provides enhanced internationalization (I18N) -services for your Python modules and applications. - -elib.intl wraps Python's :func:`gettext` functionality and adds the -following on Microsoft Windows systems: - - - automatic detection of the current screen language (not necessarily - the same as the installation language) provided by MUI packs, - - makes sure internationalized C libraries which internally invoke - gettext() or dcgettext() can properly locate their message catalogs. - This fixes a known limitation in gettext's Windows support when using - eg. gtk.builder or gtk.glade. - -See http://www.gnu.org/software/gettext/FAQ.html#windows_setenv for more -information. - -The elib.intl module defines the following functions: -''' - -import os -import sys -import locale -import gettext - -from logging import getLogger - -__all__ = ['install', 'install_module'] -__version__ = '0.0.3' -__docformat__ = 'restructuredtext' - -logger = getLogger('elib.intl') - - -def _isofromlcid(lcid): - ''' - :param lcid: Microsoft Windows LCID - :returns: the ISO 639-1 language code for a given lcid. If there is no - ISO 639-1 language code assigned to the language specified - by lcid, the ISO 639-2 language code is returned. If the - language specified by lcid is unknown in the ISO 639-x - database, None is returned. - - More information can be found on the following websites: - - List of ISO 639-1 and ISO 639-2 language codes: - http://www.loc.gov/standards/iso639-2/ - - List of known lcid's: - http://www.microsoft.com/globaldev/reference/lcid-all.mspx - - List of known MUI packs: - http://www.microsoft.com/globaldev/reference/win2k/setup/Langid.mspx - ''' - mapping = {1078: 'af', # frikaans - South Africa - 1052: 'sq', # lbanian - Albania - 1118: 'am', # mharic - Ethiopia - 1025: 'ar', # rabic - Saudi Arabia - 5121: 'ar', # rabic - Algeria - 15361: 'ar', # rabic - Bahrain - 3073: 'ar', # rabic - Egypt - 2049: 'ar', # rabic - Iraq - 11265: 'ar', # rabic - Jordan - 13313: 'ar', # rabic - Kuwait - 12289: 'ar', # rabic - Lebanon - 4097: 'ar', # rabic - Libya - 6145: 'ar', # rabic - Morocco - 8193: 'ar', # rabic - Oman - 16385: 'ar', # rabic - Qatar - 10241: 'ar', # rabic - Syria - 7169: 'ar', # rabic - Tunisia - 14337: 'ar', # rabic - U.A.E. - 9217: 'ar', # rabic - Yemen - 1067: 'hy', # rmenian - Armenia - 1101: 'as', # ssamese - 2092: 'az', # zeri (Cyrillic) - 1068: 'az', # zeri (Latin) - 1069: 'eu', # asque - 1059: 'be', # elarusian - 1093: 'bn', # engali (India) - 2117: 'bn', # engali (Bangladesh) - 5146: 'bs', # osnian (Bosnia/Herzegovina) - 1026: 'bg', # ulgarian - 1109: 'my', # urmese - 1027: 'ca', # atalan - 1116: 'chr', # herokee - United States - 2052: 'zh', # hinese - People's Republic of China - 4100: 'zh', # hinese - Singapore - 1028: 'zh', # hinese - Taiwan - 3076: 'zh', # hinese - Hong Kong SAR - 5124: 'zh', # hinese - Macao SAR - 1050: 'hr', # roatian - 4122: 'hr', # roatian (Bosnia/Herzegovina) - 1029: 'cs', # zech - 1030: 'da', # anish - 1125: 'dv', # ivehi - 1043: 'nl', # utch - Netherlands - 2067: 'nl', # utch - Belgium - 1126: 'bin', # do - 1033: 'en', # nglish - United States - 2057: 'en', # nglish - United Kingdom - 3081: 'en', # nglish - Australia - 10249: 'en', # nglish - Belize - 4105: 'en', # nglish - Canada - 9225: 'en', # nglish - Caribbean - 15369: 'en', # nglish - Hong Kong SAR - 16393: 'en', # nglish - India - 14345: 'en', # nglish - Indonesia - 6153: 'en', # nglish - Ireland - 8201: 'en', # nglish - Jamaica - 17417: 'en', # nglish - Malaysia - 5129: 'en', # nglish - New Zealand - 13321: 'en', # nglish - Philippines - 18441: 'en', # nglish - Singapore - 7177: 'en', # nglish - South Africa - 11273: 'en', # nglish - Trinidad - 12297: 'en', # nglish - Zimbabwe - 1061: 'et', # stonian - 1080: 'fo', # aroese - 1065: None, # ODO: Farsi - 1124: 'fil', # ilipino - 1035: 'fi', # innish - 1036: 'fr', # rench - France - 2060: 'fr', # rench - Belgium - 11276: 'fr', # rench - Cameroon - 3084: 'fr', # rench - Canada - 9228: 'fr', # rench - Democratic Rep. of Congo - 12300: 'fr', # rench - Cote d'Ivoire - 15372: 'fr', # rench - Haiti - 5132: 'fr', # rench - Luxembourg - 13324: 'fr', # rench - Mali - 6156: 'fr', # rench - Monaco - 14348: 'fr', # rench - Morocco - 58380: 'fr', # rench - North Africa - 8204: 'fr', # rench - Reunion - 10252: 'fr', # rench - Senegal - 4108: 'fr', # rench - Switzerland - 7180: 'fr', # rench - West Indies - 1122: 'fy', # risian - Netherlands - 1127: None, # ODO: Fulfulde - Nigeria - 1071: 'mk', # YRO Macedonian - 2108: 'ga', # aelic (Ireland) - 1084: 'gd', # aelic (Scotland) - 1110: 'gl', # alician - 1079: 'ka', # eorgian - 1031: 'de', # erman - Germany - 3079: 'de', # erman - Austria - 5127: 'de', # erman - Liechtenstein - 4103: 'de', # erman - Luxembourg - 2055: 'de', # erman - Switzerland - 1032: 'el', # reek - 1140: 'gn', # uarani - Paraguay - 1095: 'gu', # ujarati - 1128: 'ha', # ausa - Nigeria - 1141: 'haw', # awaiian - United States - 1037: 'he', # ebrew - 1081: 'hi', # indi - 1038: 'hu', # ungarian - 1129: None, # ODO: Ibibio - Nigeria - 1039: 'is', # celandic - 1136: 'ig', # gbo - Nigeria - 1057: 'id', # ndonesian - 1117: 'iu', # nuktitut - 1040: 'it', # talian - Italy - 2064: 'it', # talian - Switzerland - 1041: 'ja', # apanese - 1099: 'kn', # annada - 1137: 'kr', # anuri - Nigeria - 2144: 'ks', # ashmiri - 1120: 'ks', # ashmiri (Arabic) - 1087: 'kk', # azakh - 1107: 'km', # hmer - 1111: 'kok', # onkani - 1042: 'ko', # orean - 1088: 'ky', # yrgyz (Cyrillic) - 1108: 'lo', # ao - 1142: 'la', # atin - 1062: 'lv', # atvian - 1063: 'lt', # ithuanian - 1086: 'ms', # alay - Malaysia - 2110: 'ms', # alay - Brunei Darussalam - 1100: 'ml', # alayalam - 1082: 'mt', # altese - 1112: 'mni', # anipuri - 1153: 'mi', # aori - New Zealand - 1102: 'mr', # arathi - 1104: 'mn', # ongolian (Cyrillic) - 2128: 'mn', # ongolian (Mongolian) - 1121: 'ne', # epali - 2145: 'ne', # epali - India - 1044: 'no', # orwegian (Bokmᅢᆬl) - 2068: 'no', # orwegian (Nynorsk) - 1096: 'or', # riya - 1138: 'om', # romo - 1145: 'pap', # apiamentu - 1123: 'ps', # ashto - 1045: 'pl', # olish - 1046: 'pt', # ortuguese - Brazil - 2070: 'pt', # ortuguese - Portugal - 1094: 'pa', # unjabi - 2118: 'pa', # unjabi (Pakistan) - 1131: 'qu', # uecha - Bolivia - 2155: 'qu', # uecha - Ecuador - 3179: 'qu', # uecha - Peru - 1047: 'rm', # haeto-Romanic - 1048: 'ro', # omanian - 2072: 'ro', # omanian - Moldava - 1049: 'ru', # ussian - 2073: 'ru', # ussian - Moldava - 1083: 'se', # ami (Lappish) - 1103: 'sa', # anskrit - 1132: 'nso', # epedi - 3098: 'sr', # erbian (Cyrillic) - 2074: 'sr', # erbian (Latin) - 1113: 'sd', # indhi - India - 2137: 'sd', # indhi - Pakistan - 1115: 'si', # inhalese - Sri Lanka - 1051: 'sk', # lovak - 1060: 'sl', # lovenian - 1143: 'so', # omali - 1070: 'wen', # orbian - 3082: 'es', # panish - Spain (Modern Sort) - 1034: 'es', # panish - Spain (Traditional Sort) - 11274: 'es', # panish - Argentina - 16394: 'es', # panish - Bolivia - 13322: 'es', # panish - Chile - 9226: 'es', # panish - Colombia - 5130: 'es', # panish - Costa Rica - 7178: 'es', # panish - Dominican Republic - 12298: 'es', # panish - Ecuador - 17418: 'es', # panish - El Salvador - 4106: 'es', # panish - Guatemala - 18442: 'es', # panish - Honduras - 58378: 'es', # panish - Latin America - 2058: 'es', # panish - Mexico - 19466: 'es', # panish - Nicaragua - 6154: 'es', # panish - Panama - 15370: 'es', # panish - Paraguay - 10250: 'es', # panish - Peru - 20490: 'es', # panish - Puerto Rico - 21514: 'es', # panish - United States - 14346: 'es', # panish - Uruguay - 8202: 'es', # panish - Venezuela - 1072: None, # ODO: Sutu - 1089: 'sw', # wahili - 1053: 'sv', # wedish - 2077: 'sv', # wedish - Finland - 1114: 'syr', # yriac - 1064: 'tg', # ajik - 1119: None, # ODO: Tamazight (Arabic) - 2143: None, # ODO: Tamazight (Latin) - 1097: 'ta', # amil - 1092: 'tt', # atar - 1098: 'te', # elugu - 1054: 'th', # hai - 2129: 'bo', # ibetan - Bhutan - 1105: 'bo', # ibetan - People's Republic of China - 2163: 'ti', # igrigna - Eritrea - 1139: 'ti', # igrigna - Ethiopia - 1073: 'ts', # songa - 1074: 'tn', # swana - 1055: 'tr', # urkish - 1090: 'tk', # urkmen - 1152: 'ug', # ighur - China - 1058: 'uk', # krainian - 1056: 'ur', # rdu - 2080: 'ur', # rdu - India - 2115: 'uz', # zbek (Cyrillic) - 1091: 'uz', # zbek (Latin) - 1075: 've', # enda - 1066: 'vi', # ietnamese - 1106: 'cy', # elsh - 1076: 'xh', # hosa - 1144: 'ii', # i - 1085: 'yi', # iddish - 1130: 'yo', # oruba - 1077: 'zu'} # ulu - - return mapping[lcid] - - -def _getscreenlanguage(): - ''' - :returns: the ISO 639-x language code for this session. - - If the LANGUAGE environment variable is set, it's value overrides - the screen language detection. Otherwise the screen language is - determined by the currently selected Microsoft Windows MUI language - pack or the Microsoft Windows installation language. - - Works on Microsoft Windows 2000 and up. - ''' - if sys.platform == 'win32' or sys.platform == 'nt': - # Start with nothing - lang = None - - # Check the LANGUAGE environment variable - lang = os.getenv('LANGUAGE') - - if lang is None: - # Start with nothing - lcid = None - - try: - from ctypes import windll - lcid = windll.kernel32.GetUserDefaultUILanguage() - except: - logger.debug('Failed to get current screen language ' - 'with \'GetUserDefaultUILanguage\'') - finally: - if lcid is None: - lang = 'C' - else: - lang = _isofromlcid(lcid) - - logger.debug('Windows screen language is \'%s\' ' - '(lcid %s)' % (lang, lcid)) - - return lang - - -def _putenv(name, value): - ''' - :param name: environment variable name - :param value: environment variable value - - This function ensures that changes to an environment variable are - applied to each copy of the environment variables used by a process. - Starting from Python 2.4, os.environ changes only apply to the copy - Python keeps (os.environ) and are no longer automatically applied to - the other copies for the process. - - On Microsoft Windows, each process has multiple copies of the - environment variables, one managed by the OS and one managed by the - C library. We also need to take care of the fact that the C library - used by Python is not necessarily the same as the C library used by - pygtk and friends. This because the latest releases of pygtk and - friends are built with mingw32 and are thus linked against - msvcrt.dll. The official gtk+ binaries have always been built in - this way. - ''' - - if sys.platform == 'win32' or sys.platform == 'nt': - from ctypes import windll - from ctypes import cdll - from ctypes.util import find_msvcrt - - # Update Python's copy of the environment variables - os.environ[name] = value - - # Update the copy maintained by Windows (so SysInternals - # Process Explorer sees it) - try: - result = windll.kernel32.SetEnvironmentVariableW(name, value) - if result == 0: - raise Warning - except Exception: - logger.debug('Failed to set environment variable \'%s\' ' - '(\'kernel32.SetEnvironmentVariableW\')' % name) - else: - logger.debug('Set environment variable \'%s\' to \'%s\' ' - '(\'kernel32.SetEnvironmentVariableW\')' % - (name, value)) - - # Update the copy maintained by msvcrt (used by gtk+ runtime) - try: - result = cdll.msvcrt._putenv('%s=%s' % (name, value)) - if result != 0: - raise Warning - except Exception: - logger.debug('Failed to set environment variable \'%s\' ' - '(\'msvcrt._putenv\')' % name) - else: - logger.debug('Set environment variable \'%s\' to \'%s\' ' - '(\'msvcrt._putenv\')' % (name, value)) - - # Update the copy maintained by whatever c runtime is used by Python - try: - msvcrt = find_msvcrt() - msvcrtname = str(msvcrt).split('.')[0] \ - if '.' in msvcrt else str(msvcrt) - result = cdll.LoadLibrary(msvcrt)._putenv('%s=%s' % (name, value)) - if result != 0: - raise Warning - except Exception: - logger.debug('Failed to set environment variable \'%s\' ' - '(\'%s._putenv\')' % (name, msvcrtname)) - else: - logger.debug('Set environment variable \'%s\' to \'%s\' ' - '(\'%s._putenv\')' % (name, value, msvcrtname)) - - -def _dugettext(domain, message): - ''' - :param domain: translation domain - :param message: message to translate - :returns: the translated message - - Unicode version of :func:`gettext.dgettext`. - ''' - try: - t = gettext.translation(domain, gettext._localedirs.get(domain, None), - codeset=gettext._localecodesets.get(domain)) - except IOError: - return message - else: - return t.ugettext(message) - - -def _install(domain, localedir, asglobal=False): - ''' - :param domain: translation domain - :param localedir: locale directory - :param asglobal: if True, installs the function _() in Python’s - builtin namespace. Default is False - - Private function doing all the work for the :func:`elib.intl.install` and - :func:`elib.intl.install_module` functions. - ''' - # prep locale system - if asglobal: - locale.setlocale(locale.LC_ALL, '') - - # on windows systems, set the LANGUAGE environment variable - if sys.platform == 'win32' or sys.platform == 'nt': - _putenv('LANGUAGE', _getscreenlanguage()) - - # The locale module on Max OS X lacks bindtextdomain so we specifically - # test on linux2 here. See commit 4ae8b26fd569382ab66a9e844daa0e01de409ceb - if sys.platform == 'linux2': - locale.bindtextdomain(domain, localedir) - locale.bind_textdomain_codeset(domain, 'UTF-8') - locale.textdomain(domain) - - # initialize Python's gettext interface - gettext.bindtextdomain(domain, localedir) - gettext.bind_textdomain_codeset(domain, 'UTF-8') - - if asglobal: - gettext.textdomain(domain) - - # on windows systems, initialize libintl - if sys.platform == 'win32' or sys.platform == 'nt': - from ctypes import cdll - libintl = cdll.intl - libintl.bindtextdomain(domain, localedir) - libintl.bind_textdomain_codeset(domain, 'UTF-8') - - if asglobal: - libintl.textdomain(domain) - - del libintl - - -def install(domain, localedir): - ''' - :param domain: translation domain - :param localedir: locale directory - - Installs the function _() in Python’s builtin namespace, based on - domain and localedir. Codeset is always UTF-8. - - As seen below, you usually mark the strings in your application that are - candidates for translation, by wrapping them in a call to the _() function, - like this: - - .. sourcecode:: python - - import elib.intl - elib.intl.install('myapplication', '/path/to/usr/share/locale') - print _('This string will be translated.') - - Note that this is only one way, albeit the most convenient way, - to make the _() function available to your application. Because it affects - the entire application globally, and specifically Python’s built-in - namespace, localized modules should never install _(). Instead, you should - use :func:`elib.intl.install_module` to make _() available to your module. - ''' - _install(domain, localedir, True) - gettext.install(domain, localedir, unicode=True) - - -def install_module(domain, localedir): - ''' - :param domain: translation domain - :param localedir: locale directory - :returns: an anonymous function object, based on domain and localedir. - Codeset is always UTF-8. - - You may find this function useful when writing localized modules. - Use this code to make _() available to your module: - - .. sourcecode:: python - - import elib.intl - _ = elib.intl.install_module('mymodule', '/path/to/usr/share/locale') - print _('This string will be translated.') - - When writing packages, you can usually do this in the package's __init__.py - file and import the _() function from the package namespace as needed. - ''' - _install(domain, localedir, False) - return lambda message: _dugettext(domain, message) diff --git a/chirp/import_logic.py b/chirp/import_logic.py index cc6a366..2e096e1 100644 --- a/chirp/import_logic.py +++ b/chirp/import_logic.py @@ -74,25 +74,53 @@ def _import_name(dst_radio, _srcrf, mem): mem.name = dst_radio.filter_name(mem.name) +def find_closest_power(needle_watts, levels_haystack): + deltas = [abs(needle_watts - chirp_common.dBm_to_watts(int(power))) + for power in levels_haystack] + return levels_haystack[deltas.index(min(deltas))] + + def _import_power(dst_radio, _srcrf, mem): levels = dst_radio.get_features().valid_power_levels + dstrf = dst_radio.get_features() if not levels: mem.power = None return elif mem.power is None: # Source radio did not support power levels, so choose the - # first (highest) level from the destination radio. - mem.power = levels[0] + # highest level from the destination radio. If the destination radio + # has variable power support, choose the middle power level (if there + # is one) as that is probably the default. This is kindof a hack to + # avoid pushing everything to 1500W in the CSV driver. + if dstrf.has_variable_power and len(levels) > 2 and len(levels) % 2: + mem.power = levels[len(levels) // 2] + else: + try: + mem.power = next(reversed(sorted(levels))) + except StopIteration: + # No power levels on the destination, so leave power=None + pass + return + elif dstrf.has_variable_power: + # If the destination radio has variable power support, clamp to its + # ranges if out of bounds. Otherwise just pass through and let it + # interpret the absolute power level. + if mem.power < min(levels): + mem.power = min(levels) + elif mem.power > max(levels): + mem.power = max(levels) return - # If both radios support power levels, we need to decide how to + # If both radios support discrete power levels, we need to decide how to # convert the source power level to a valid one for the destination # radio. To do that, find the absolute level of the source value - # and calculate the different between it and all the levels of the - # destination, choosing the one that matches most closely. + # and calculate the difference between it and all the levels of the + # destination, choosing the one that matches most closely. Do this in + # watts not dBm because we will make the wrong decision otherwise due + # to the logarithmic scale. - deltas = [abs(mem.power - power) for power in levels] - mem.power = levels[deltas.index(min(deltas))] + mem.power = find_closest_power(chirp_common.dBm_to_watts(int(mem.power)), + levels) def _import_tone(dst_radio, srcrf, mem): @@ -175,8 +203,9 @@ def _make_offset_with_split(rxfreq, txfreq): def _import_duplex(dst_radio, srcrf, mem): dstrf = dst_radio.get_features() - # If a radio does not support odd split, we can use an equivalent offset if mem.duplex == "split" and mem.duplex not in dstrf.valid_duplexes: + # If a radio does not support odd split, we can use an equivalent + # offset mem.duplex, mem.offset = _make_offset_with_split(mem.freq, mem.offset) # Enforce maximum offset @@ -186,23 +215,35 @@ def _import_duplex(dst_radio, srcrf, mem): for lo, hi, limit in ranges: if lo < mem.freq <= hi: if abs(mem.offset) > limit: - raise DestNotCompatible("Unable to create import memory: " - "offset is abnormally large.") + raise DestNotCompatible("offset is abnormally large.") + elif mem.duplex == 'off' and mem.duplex not in dstrf.valid_duplexes: + # If a radio does not support duplex=off, we should just convert to + # simplex + mem.duplex = '' -def import_mem(dst_radio, src_features, src_mem, overrides={}): +def import_mem(dst_radio, src_features, src_mem, overrides={}, mem_cls=None): """Perform import logic to create a destination memory from src_mem that will be compatible with @dst_radio""" dst_rf = dst_radio.get_features() if isinstance(src_mem, chirp_common.DVMemory): - if not isinstance(dst_radio, chirp_common.IcomDstarSupport): + # DV memory import logic: If the radio supports D-STAR and requires + # call lists, then we set the call list. Otherwise, if it just + # supports DV mode we don't, but allow the memory (i.e. CSV, etc). + # If neither, then it's not compatible. + if isinstance(dst_radio, chirp_common.IcomDstarSupport): + if dst_rf.requires_call_lists: + ensure_has_calls(dst_radio, src_mem) + elif 'DV' not in dst_rf.valid_modes: raise DestNotCompatible( "Destination radio does not support D-STAR") - if dst_rf.requires_call_lists: - ensure_has_calls(dst_radio, src_mem) - dst_mem = src_mem.dupe() + if mem_cls: + dst_mem = mem_cls() + dst_mem.clone(src_mem) + else: + dst_mem = src_mem.dupe() # The source's immutable list almost definitely does not match the # latter, so eliminate that list here and rely on set_memory() on # the destination to enforce anything that should not be set. @@ -222,11 +263,16 @@ def import_mem(dst_radio, src_features, src_mem, overrides={}): for helper in helpers: helper(dst_radio, src_features, dst_mem) + # If we can, grab the current existing destination memory and check the + # radio's immutable set_memory() policy + if not isinstance(dst_radio, chirp_common.LiveRadio): + cur_mem = dst_radio.get_memory(dst_mem.number) + dst_radio.check_set_memory_immutable_policy(cur_mem, dst_mem) + msgs = dst_radio.validate_memory(dst_mem) errs = [x for x in msgs if isinstance(x, chirp_common.ValidationError)] if errs: - raise DestNotCompatible("Unable to create import memory: %s" % - ", ".join(errs)) + raise DestNotCompatible(", ".join(errs)) return dst_mem diff --git a/chirp/locale/de/LC_MESSAGES/CHIRP.mo b/chirp/locale/de/LC_MESSAGES/CHIRP.mo new file mode 100644 index 0000000..f04f7a7 Binary files /dev/null and b/chirp/locale/de/LC_MESSAGES/CHIRP.mo differ diff --git a/chirp/locale/el/LC_MESSAGES/CHIRP.mo b/chirp/locale/el/LC_MESSAGES/CHIRP.mo new file mode 100644 index 0000000..b127b5c Binary files /dev/null and b/chirp/locale/el/LC_MESSAGES/CHIRP.mo differ diff --git a/chirp/locale/en_US/LC_MESSAGES/CHIRP.mo b/chirp/locale/en_US/LC_MESSAGES/CHIRP.mo new file mode 100644 index 0000000..da634de Binary files /dev/null and b/chirp/locale/en_US/LC_MESSAGES/CHIRP.mo differ diff --git a/chirp/locale/es/LC_MESSAGES/CHIRP.mo b/chirp/locale/es/LC_MESSAGES/CHIRP.mo new file mode 100644 index 0000000..ef20806 Binary files /dev/null and b/chirp/locale/es/LC_MESSAGES/CHIRP.mo differ diff --git a/chirp/locale/fr/LC_MESSAGES/CHIRP.mo b/chirp/locale/fr/LC_MESSAGES/CHIRP.mo new file mode 100644 index 0000000..71435f6 Binary files /dev/null and b/chirp/locale/fr/LC_MESSAGES/CHIRP.mo differ diff --git a/chirp/locale/hu/LC_MESSAGES/CHIRP.mo b/chirp/locale/hu/LC_MESSAGES/CHIRP.mo new file mode 100644 index 0000000..ce503e6 Binary files /dev/null and b/chirp/locale/hu/LC_MESSAGES/CHIRP.mo differ diff --git a/chirp/locale/it/LC_MESSAGES/CHIRP.mo b/chirp/locale/it/LC_MESSAGES/CHIRP.mo new file mode 100644 index 0000000..bb8e631 Binary files /dev/null and b/chirp/locale/it/LC_MESSAGES/CHIRP.mo differ diff --git a/chirp/locale/nl/LC_MESSAGES/CHIRP.mo b/chirp/locale/nl/LC_MESSAGES/CHIRP.mo new file mode 100644 index 0000000..755a288 Binary files /dev/null and b/chirp/locale/nl/LC_MESSAGES/CHIRP.mo differ diff --git a/chirp/locale/pl/LC_MESSAGES/CHIRP.mo b/chirp/locale/pl/LC_MESSAGES/CHIRP.mo new file mode 100644 index 0000000..f3d9e4f Binary files /dev/null and b/chirp/locale/pl/LC_MESSAGES/CHIRP.mo differ diff --git a/chirp/locale/pt_BR/LC_MESSAGES/CHIRP.mo b/chirp/locale/pt_BR/LC_MESSAGES/CHIRP.mo new file mode 100644 index 0000000..5b27c88 Binary files /dev/null and b/chirp/locale/pt_BR/LC_MESSAGES/CHIRP.mo differ diff --git a/chirp/locale/ru/LC_MESSAGES/CHIRP.mo b/chirp/locale/ru/LC_MESSAGES/CHIRP.mo new file mode 100644 index 0000000..e75bc04 Binary files /dev/null and b/chirp/locale/ru/LC_MESSAGES/CHIRP.mo differ diff --git a/chirp/locale/tr_TR/LC_MESSAGES/CHIRP.mo b/chirp/locale/tr_TR/LC_MESSAGES/CHIRP.mo new file mode 100644 index 0000000..aa6e695 Binary files /dev/null and b/chirp/locale/tr_TR/LC_MESSAGES/CHIRP.mo differ diff --git a/chirp/locale/uk_UA/LC_MESSAGES/CHIRP.mo b/chirp/locale/uk_UA/LC_MESSAGES/CHIRP.mo new file mode 100644 index 0000000..5c9bd6f Binary files /dev/null and b/chirp/locale/uk_UA/LC_MESSAGES/CHIRP.mo differ diff --git a/chirp/locale/zh_CN/LC_MESSAGES/CHIRP.mo b/chirp/locale/zh_CN/LC_MESSAGES/CHIRP.mo new file mode 100644 index 0000000..96b79a3 Binary files /dev/null and b/chirp/locale/zh_CN/LC_MESSAGES/CHIRP.mo differ diff --git a/chirp/logger.py b/chirp/logger.py index d063f37..64e93f7 100644 --- a/chirp/logger.py +++ b/chirp/logger.py @@ -46,6 +46,7 @@ def add_version_argument(parser): parser.add_argument("--version", action=VersionAction, nargs=0, help="Print version and exit") + #: Map human-readable logging levels to their internal values. log_level_names = {"critical": logging.CRITICAL, "error": logging.ERROR, @@ -96,6 +97,9 @@ class Logger(object): console_stream = log console_format = self.log_format self.early_level = logging.DEBUG + self.has_debug_log_file = True + else: + self.has_debug_log_file = False self.console = logging.StreamHandler(console_stream) self.console_level = self.early_level @@ -121,7 +125,7 @@ class Logger(object): if self.logfile is None: self.logname = name # always truncate the log file - with open(name, "w") as fh: + with open(name, "w"): pass self.logfile = logging.FileHandler(name) format_str = self.log_format @@ -148,6 +152,7 @@ class Logger(object): instance = None + Logger.instance = Logger() diff --git a/chirp/memmap.py b/chirp/memmap.py index 9a16ee2..ca27b53 100644 --- a/chirp/memmap.py +++ b/chirp/memmap.py @@ -103,7 +103,7 @@ class MemoryMapBytes(object): return self.get_packed() def __repr__(self): - return self.printable(printit=False) + return self.printable() def truncate(self, size): """Truncate the memory map to @size""" @@ -126,7 +126,7 @@ class MemoryMap(MemoryMapBytes): if six.PY3 and isinstance(data, bytes): # Be graceful if py3-enabled code uses this, # just don't encode it - encode = lambda d: d + encode = bytes else: encode = self._bitwise.string_straight_encode super(MemoryMap, self).__init__(encode(data)) diff --git a/chirp/platform.py b/chirp/platform.py index 3b282de..d2c587f 100644 --- a/chirp/platform.py +++ b/chirp/platform.py @@ -14,8 +14,8 @@ # along with this program. If not, see . import os +from pathlib import Path import sys -import glob import re import logging from subprocess import Popen @@ -25,52 +25,18 @@ import six LOG = logging.getLogger(__name__) -def win32_comports_bruteforce(): - import win32file - import win32con - - ports = [] - for i in range(1, 257): - portname = "\\\\.\\COM%i" % i - try: - mode = win32con.GENERIC_READ | win32con.GENERIC_WRITE - port = \ - win32file.CreateFile(portname, - mode, - win32con.FILE_SHARE_READ, - None, - win32con.OPEN_EXISTING, - 0, - None) - if portname.startswith("\\"): - portname = portname[4:] - ports.append((portname, "Unknown", "Serial")) - win32file.CloseHandle(port) - port = None - except Exception as e: - pass - - return ports - - -try: - from serial.tools.list_ports import comports -except: - comports = win32_comports_bruteforce - - def _find_me(): return sys.modules["chirp.platform"].__file__ -def natural_sorted(l): +def natural_sorted(lst): def convert(text): return int(text) if text.isdigit() else text.lower() def natural_key(key): return [convert(c) for c in re.split('([0-9]+)', key)] - return sorted(l, key=natural_key) + return sorted(lst, key=natural_key) class Platform: @@ -124,111 +90,10 @@ class Platform: """Spawn the necessary program to open an HTML file at @path""" raise NotImplementedError("The base class can't do that") - def list_serial_ports(self): - """Return a list of valid serial ports""" - return [] - def default_dir(self): """Return the default directory for this platform""" return "." - def gui_open_file(self, start_dir=None, types=[]): - """Prompt the user to pick a file to open""" - import gtk - - if not start_dir: - start_dir = self._last_dir - - dlg = gtk.FileChooserDialog("Select a file to open", - None, - gtk.FILE_CHOOSER_ACTION_OPEN, - (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, - gtk.STOCK_OPEN, gtk.RESPONSE_OK)) - if start_dir and os.path.isdir(start_dir): - dlg.set_current_folder(start_dir) - - for desc, spec in types: - ff = gtk.FileFilter() - ff.set_name(desc) - ff.add_pattern(spec) - dlg.add_filter(ff) - - res = dlg.run() - fname = dlg.get_filename() - dlg.destroy() - - if res == gtk.RESPONSE_OK: - self._last_dir = os.path.dirname(fname) - return fname - else: - return None - - def gui_save_file(self, start_dir=None, default_name=None, types=[]): - """Prompt the user to pick a filename to save""" - import gtk - - if not start_dir: - start_dir = self._last_dir - - dlg = gtk.FileChooserDialog("Save file as", - None, - gtk.FILE_CHOOSER_ACTION_SAVE, - (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, - gtk.STOCK_SAVE, gtk.RESPONSE_OK)) - if start_dir and os.path.isdir(start_dir): - dlg.set_current_folder(start_dir) - - if default_name: - dlg.set_current_name(default_name) - - extensions = {} - for desc, ext in types: - ff = gtk.FileFilter() - ff.set_name(desc) - ff.add_pattern("*.%s" % ext) - extensions[desc] = ext - dlg.add_filter(ff) - - res = dlg.run() - - fname = dlg.get_filename() - ext = extensions[dlg.get_filter().get_name()] - if fname and not fname.endswith(".%s" % ext): - fname = "%s.%s" % (fname, ext) - - dlg.destroy() - - if res == gtk.RESPONSE_OK: - self._last_dir = os.path.dirname(fname) - return fname - else: - return None - - def gui_select_dir(self, start_dir=None): - """Prompt the user to pick a directory""" - import gtk - - if not start_dir: - start_dir = self._last_dir - - dlg = gtk.FileChooserDialog("Choose folder", - None, - gtk.FILE_CHOOSER_ACTION_SELECT_FOLDER, - (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, - gtk.STOCK_SAVE, gtk.RESPONSE_OK)) - if start_dir and os.path.isdir(start_dir): - dlg.set_current_folder(start_dir) - - res = dlg.run() - fname = dlg.get_filename() - dlg.destroy() - - if res == gtk.RESPONSE_OK and os.path.isdir(fname): - self._last_dir = fname - return fname - else: - return None - def os_version_string(self): """Return a string that describes the OS/platform version""" return "Unknown Operating System" @@ -279,28 +144,14 @@ class UnixPlatform(Platform): """A platform module suitable for UNIX systems""" def __init__(self, basepath): if not basepath: - basepath = os.path.abspath(os.path.join(self.default_dir(), - ".chirp")) - - try: - os.mkdir(basepath) - except FileExistsError: - pass - - Platform.__init__(self, basepath) - - # This is a hack that needs to be properly fixed by importing the - # latest changes to this module from d-rats. In the interest of - # time, however, I'll throw it here - if sys.platform == "darwin": - if "DISPLAY" not in os.environ: - LOG.info("Forcing DISPLAY for MacOS") - os.environ["DISPLAY"] = ":0" + basepath = os.path.join(self.default_dir(), + ".chirp") - os.environ["PANGO_RC_FILE"] = "../Resources/etc/pango/pangorc" + Path(basepath).mkdir(exist_ok=True) + super().__init__(str(basepath)) def default_dir(self): - return os.path.abspath(os.getenv("HOME")) + return str(Path.home()) def filter_filename(self, filename): return filename.replace("/", "") @@ -322,21 +173,9 @@ class UnixPlatform(Platform): def open_html_file(self, path): os.system("firefox '%s'" % path) - def list_serial_ports(self): - ports = ["/dev/ttyS*", - "/dev/ttyUSB*", - "/dev/ttyAMA*", - "/dev/ttyACM*", - "/dev/cu.*", - "/dev/cuaU*", - "/dev/cua0*", - "/dev/term/*", - "/dev/tty.KeySerial*"] - return natural_sorted(sum([glob.glob(x) for x in ports], [])) - def os_version_string(self): try: - issue = file("/etc/issue.net", "r") + issue = open("/etc/issue.net", "r") ver = issue.read().strip().replace("\r", "").replace("\n", "")[:64] issue.close() ver = "%s - %s" % (os.uname()[0], ver) @@ -380,75 +219,6 @@ class Win32Platform(Platform): def open_html_file(self, path): os.system("explorer %s" % path) - def list_serial_ports(self): - try: - ports = list(comports()) - except Exception as e: - if comports != win32_comports_bruteforce: - LOG.error("Failed to detect win32 serial ports: %s" % e) - ports = win32_comports_bruteforce() - return natural_sorted([port for port, name, url in ports]) - - def gui_open_file(self, start_dir=None, types=[]): - import win32gui - - typestrs = "" - for desc, spec in types: - typestrs += "%s\0%s\0" % (desc, spec) - if not typestrs: - typestrs = None - - try: - fname, _, _ = win32gui.GetOpenFileNameW(Filter=typestrs) - except Exception as e: - LOG.error("Failed to get filename: %s" % e) - return None - - return str(fname) - - def gui_save_file(self, start_dir=None, default_name=None, types=[]): - import win32gui - import win32api - - (pform, _, _, _, _) = win32api.GetVersionEx() - - typestrs = "" - custom = "%s\0*.%s\0" % (types[0][0], types[0][1]) - for desc, ext in types[1:]: - typestrs += "%s\0%s\0" % (desc, "*.%s" % ext) - - if pform > 5: - typestrs = "%s\0%s\0" % (types[0][0], "*.%s" % types[0][1]) + \ - typestrs - - if not typestrs: - typestrs = custom - custom = None - - def_ext = "*.%s" % types[0][1] - try: - fname, _, _ = win32gui.GetSaveFileNameW(File=default_name, - CustomFilter=custom, - DefExt=def_ext, - Filter=typestrs) - except Exception as e: - LOG.error("Failed to get filename: %s" % e) - return None - - return str(fname) - - def gui_select_dir(self, start_dir=None): - from win32com.shell import shell - - try: - pidl, _, _ = shell.SHBrowseForFolder() - fname = shell.SHGetPathFromIDList(pidl) - except Exception as e: - LOG.error("Failed to get directory: %s" % e) - return None - - return str(fname) - def os_version_string(self): import win32api @@ -469,6 +239,7 @@ def _get_platform(basepath): else: return UnixPlatform(basepath) + PLATFORM = None @@ -488,13 +259,9 @@ def _do_test(): print("Config dir: %s" % __pform.config_dir()) print("Default dir: %s" % __pform.default_dir()) print("Log file (foo): %s" % __pform.log_file("foo")) - print("Serial ports: %s" % __pform.list_serial_ports()) print("OS Version: %s" % __pform.os_version_string()) # __pform.open_text_file("d-rats.py") - # print "Open file: %s" % __pform.gui_open_file() - # print "Save file: %s" % __pform.gui_save_file(default_name="Foo.txt") - print("Open folder: %s" % __pform.gui_select_dir("/tmp")) if __name__ == "__main__": _do_test() diff --git a/chirp/pyPEG.py b/chirp/pyPEG.py index 772ed95..3e27e74 100644 --- a/chirp/pyPEG.py +++ b/chirp/pyPEG.py @@ -4,7 +4,6 @@ import re import sys -import codecs import collections import six @@ -54,6 +53,7 @@ class Symbol(list): def __repr__(self): return str(self) + word_regex = re.compile(r"\w+") rest_regex = re.compile(r".*") @@ -62,16 +62,6 @@ print_trace = False def u(text): return six.text_type(text) - if isinstance(text, exceptions.BaseException): - text = text.args[0] - if type(text) is str: - return text - if isinstance(text, str): - if sys.stdin.encoding: - return codecs.decode(text, sys.stdin.encoding) - else: - return codecs.decode(text, "utf-8") - return str(text) def skip(skipper, text, skipWS, skipComments): @@ -85,7 +75,7 @@ def skip(skipper, text, skipWS, skipComments): skip, t = skipper.parseLine(t, skipComments, [], skipWS, None) if skipWS: t = t.lstrip() - except: + except Exception: pass return t @@ -93,7 +83,7 @@ def skip(skipper, text, skipWS, skipComments): class parser(object): def __init__(self, another=False, p=False): self.restlen = -1 - if not(another): + if not (another): self.skipper = parser(True, p) self.skipper.packrat = p else: @@ -131,7 +121,7 @@ class parser(object): if _pattern.__name__ != "comment": sys.stderr.write("match: " + _pattern.__name__ + "\n") - except: + except Exception: pass if self.restlen == -1: @@ -166,7 +156,7 @@ class parser(object): return result else: raise SyntaxError() - except: + except Exception: pass if isinstance(pattern, collections.abc.Callable): @@ -177,7 +167,7 @@ class parser(object): sys.stderr.write("testing with " + pattern.__name__ + ": " + textline[:40] + "\n") - except: + except Exception: pass if pattern.__name__[0] != "_": @@ -215,7 +205,7 @@ class parser(object): try: r, t = self.parseLine(text, pattern.obj, [], skipWS, skipComments) - except: + except Exception: return resultSoFar, textline syntaxError() @@ -267,7 +257,7 @@ class parser(object): result, text, found = newResult, newText, True except SyntaxError: break - if n == -2 and not(found): + if n == -2 and not (found): syntaxError() n = 1 return R(result, text) @@ -293,7 +283,7 @@ class parser(object): raise SyntaxError("illegal type in grammar: " + u(pattern_type)) def lineNo(self): - if not(self.lines): + if not (self.lines): return "" if self.restlen == -1: return "" @@ -309,15 +299,15 @@ class parser(object): try: return u(self.lines[mid + 1][1]) + \ ":" + u(self.lines[mid + 1][2]) - except: + except Exception: return "" else: left = mid + 1 - except: + except Exception: try: return u(self.lines[mid + 1][1]) + \ ":" + u(self.lines[mid + 1][2]) - except: + except Exception: return "" else: right = mid - 1 @@ -380,7 +370,7 @@ def parse(language, lineSource, skipWS=True, skipComments=None, if text: raise SyntaxError() - except SyntaxError as msg: + except SyntaxError: parsed = textlen - p.restlen textlen = 0 nn, lineNo, file = 0, 0, "" diff --git a/chirp/radioreference.py b/chirp/radioreference.py deleted file mode 100644 index 7c4d427..0000000 --- a/chirp/radioreference.py +++ /dev/null @@ -1,224 +0,0 @@ -# Copyright 2012 Tom Hayward -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -import logging -from chirp import chirp_common, errors - -LOG = logging.getLogger(__name__) - -try: - from suds.client import Client - from suds import WebFault - HAVE_SUDS = True -except ImportError: - HAVE_SUDS = False - -MODES = { - "FM": "FM", - "AM": "AM", - "FMN": "NFM", - "D-STAR": "DV", - "USB": "USB", - "LSB": "LSB", - "P25": "P25", -} - - -class RadioReferenceRadio(chirp_common.NetworkSourceRadio): - """RadioReference.com data source""" - VENDOR = "Radio Reference LLC" - MODEL = "RadioReference.com" - - URL = "http://api.radioreference.com/soap2/?wsdl" - APPKEY = "46785108" - - def __init__(self, *args, **kwargs): - chirp_common.NetworkSourceRadio.__init__(self, *args, **kwargs) - - if not HAVE_SUDS: - raise errors.RadioError( - "Suds library required for RadioReference.com import.\n" + - "Try installing your distribution's python-suds package.") - - self._auth = {"appKey": self.APPKEY, "username": "", "password": ""} - self._client = Client(self.URL) - self._freqs = None - self._modes = None - self._zipcounty = None - self._country = None - - def set_params(self, zipcounty, username, password, country): - """Set the parameters to be used for a query""" - self._country = country - self._zipcounty = zipcounty - self._auth["username"] = username - self._auth["password"] = password - - def do_getcanadacounties(self): - try: - service = self._client.service - provincelist = service.getCountryInfo(2, self._auth) - provinces = {} - clist = [] - for province in provincelist: - provinces[province[2]] = province[0] - provinceinfo = service.getStateInfo(province[0], self._auth) - for county in provinceinfo.countyList: - if (county[1] != 'UNKNOWN' and county[1] != 'N/A' and - county[1] != 'Provincewide'): - # some counties are actually cities but whatever fml - clist.append([province[0], province[2], - county[0], county[1]]) - except WebFault as err: - raise errors.RadioError(err) - return clist, provinces - - def do_fetch(self): - """Fetches frequencies for all subcategories in a county - (or zip if USA).""" - self._freqs = [] - # if this method was accessed for the USA, use the zip; otherwise - # use the county ID - if self._country == 'US': - try: - service = self._client.service - zipcode = service.getZipcodeInfo(self._zipcounty, self._auth) - county = service.getCountyInfo(zipcode.ctid, self._auth) - except WebFault as err: - raise errors.RadioError(err) - if self._country == 'CA': - try: - service = self._client.service - county = service.getCountyInfo(self._zipcounty, self._auth) - except WebFault as err: - raise errors.RadioError(err) - - status = chirp_common.Status() - status.max = 0 - for cat in county.cats: - status.max += len(cat.subcats) - status.max += len(county.agencyList) - - for cat in county.cats: - LOG.debug("Fetching category:", cat.cName) - for subcat in cat.subcats: - LOG.debug("\t", subcat.scName) - result = self._client.service.getSubcatFreqs(subcat.scid, - self._auth) - self._freqs += result - status.cur += 1 - self.status_fn(status) - status.max -= len(county.agencyList) - for agency in county.agencyList: - agency = self._client.service.getAgencyInfo(agency.aid, self._auth) - for cat in agency.cats: - status.max += len(cat.subcats) - for cat in agency.cats: - LOG.debug("Fetching category:", cat.cName) - for subcat in cat.subcats: - try: - LOG.debug("\t", subcat.scName) - except AttributeError: - pass - result = self._client.service.getSubcatFreqs(subcat.scid, - self._auth) - self._freqs += result - status.cur += 1 - self.status_fn(status) - - def get_features(self): - if not self._freqs: - self.do_fetch() - - rf = chirp_common.RadioFeatures() - rf.memory_bounds = (0, len(self._freqs)-1) - rf.has_bank = False - rf.has_ctone = False - rf.valid_tmodes = ["", "TSQL", "DTCS"] - return rf - - def get_raw_memory(self, number): - return repr(self._freqs[number]) - - def get_memory(self, number): - if not self._freqs: - self.do_fetch() - - freq = self._freqs[number] - - mem = chirp_common.Memory() - mem.number = number - - mem.name = freq.alpha or freq.descr or "" - mem.freq = chirp_common.parse_freq(str(freq.out)) - if freq["in"] == 0.0: - mem.duplex = "" - else: - mem.duplex = "split" - mem.offset = chirp_common.parse_freq(str(freq["in"])) - if freq.tone is not None: - if str(freq.tone) == "CSQ": # Carrier Squelch - mem.tmode = "" - else: - try: - tone, tmode = freq.tone.split(" ") - except Exception: - tone, tmode = None, None - if tmode == "PL": - mem.tmode = "TSQL" - mem.rtone = mem.ctone = float(tone) - elif tmode == "DPL": - mem.tmode = "DTCS" - mem.dtcs = int(tone) - else: - LOG.error("Error: unsupported tone: %s" % freq) - try: - mem.mode = self._get_mode(freq.mode) - except KeyError: - # skip memory if mode is unsupported - mem.empty = True - return mem - mem.comment = freq.descr.strip() - - return mem - - def _get_mode(self, modeid): - if not self._modes: - self._modes = {} - for mode in self._client.service.getMode("0", self._auth): - # sax.text.Text cannot be coerced directly to int - self._modes[int(str(mode.mode))] = str(mode.modeName) - return MODES[self._modes[int(str(modeid))]] - - -def main(): - """ - Usage: - cd ~/src/chirp.hg - python ./chirp/radioreference.py [USERNAME] [PASSWORD] \ - [COUNTRY - 2 LETTER] [US ZIP(USA) OR COUNTY ID(CANADA)] - """ - import sys - rrr = RadioReferenceRadio(None) - rrr.set_params(username=sys.argv[1], - password=sys.argv[2], - country=sys.argv[3], - zipcounty=sys.argv[4]) - rrr.do_fetch() - print(rrr.get_raw_memory(0)) - print(rrr.get_memory(0)) - -if __name__ == "__main__": - main() diff --git a/chirp/settings.py b/chirp/settings.py index d49df4e..9d9cfe4 100644 --- a/chirp/settings.py +++ b/chirp/settings.py @@ -15,6 +15,8 @@ from chirp import chirp_common +BANNED_NAME_CHARACTERS = r'%' + class InvalidValueError(Exception): @@ -28,6 +30,11 @@ class InternalError(Exception): pass +class InvalidNameError(Exception): + """A driver provided a setting with an invalid name""" + pass + + class RadioSettingValue: """Base class for a single radio setting""" @@ -35,9 +42,12 @@ class RadioSettingValue: def __init__(self): self._current = None self._has_changed = False - self._validate_callback = lambda x: x + self._validate_callback = self.null_callback self._mutable = True + def null_callback(self, x): + return x + def set_mutable(self, mutable): self._mutable = mutable @@ -67,6 +77,9 @@ class RadioSettingValue: def __trunc__(self): return int(self.get_value()) + def __float__(self): + return float(self.get_value()) + def __str__(self): return str(self.get_value()) @@ -85,7 +98,7 @@ class RadioSettingValueInteger(RadioSettingValue): def set_value(self, value): try: value = int(value) - except: + except Exception: raise InvalidValueError("An integer is required") if value > self._max or value < self._min: raise InvalidValueError("Value %i not in range %i-%i" % @@ -127,7 +140,7 @@ class RadioSettingValueFloat(RadioSettingValue): def set_value(self, value): try: value = float(value) - except: + except Exception: raise InvalidValueError("A floating point value is required") if value > self._max or value < self._min: raise InvalidValueError("Value %s not in range %s-%s" % ( @@ -316,6 +329,10 @@ class RadioSettingGroup(object): raise InternalError("Incorrect type %s" % type(element)) def __init__(self, name, shortname, *elements): + for c in BANNED_NAME_CHARACTERS: + if c in name: + raise InvalidNameError( + 'Name must not contain %r character' % c) self._name = name # Setting identifier self._shortname = shortname # Short human-readable name/description self.__doc__ = name # Longer explanation/documentation @@ -341,7 +358,8 @@ class RadioSettingGroup(object): def __str__(self): string = "group '%s': {\n" % self._name for element in sorted(self._elements.values()): - string += "\t" + str(element) + "\n" + for line in str(element).split("\n"): + string += "\t" + line + "\n" string += "}" return string @@ -389,6 +407,9 @@ class RadioSettingGroup(object): self._elements[name] = value self._element_order.append(name) + def __contains__(self, name): + return name in self._elements + def items(self): """Returns a key=>value set of elements, like a dict""" return [(name, self._elements[name]) for name in self._element_order] @@ -412,6 +433,16 @@ class RadioSetting(RadioSettingGroup): def __init__(self, *args): super(RadioSetting, self).__init__(*args) self._apply_callback = None + self._warning_text = None + self._safe_value = None + self._volatile = False + + @property + def volatile(self): + return self._volatile + + def set_volatile(self, value): + self._volatile = value def set_apply_callback(self, callback, *args): self._apply_callback = lambda: callback(self, *args) @@ -422,6 +453,22 @@ class RadioSetting(RadioSettingGroup): def run_apply_callback(self): return self._apply_callback() + def set_warning(self, warning_text, safe_value=None): + """Set a warning message to be shown to the user when changed. + + This should not be over-used as it will be annoying (on purpose). This + message will be shown to the user with an option to continue to abort. + It should be used to warn the user of potential invalid operation or + compatibility issues. If safe_value is set, this will only warn the + user if the value is changed *to* something other than the safe_value. + """ + self._warning_text = warning_text + self._safe_value = safe_value + + def get_warning(self, value): + if value != self._safe_value: + return self._warning_text + def _validate(self, value): # RadioSetting can only contain RadioSettingValue objects if not isinstance(value, RadioSettingValue): @@ -447,7 +494,9 @@ class RadioSetting(RadioSettingGroup): if len(self) == 1: return self._elements[self._element_order[0]] else: - return self._elements.values() + return list(self._elements.values()) + elif name in ('__getstate__', '__setstate__'): + super().__getattr__(name) else: return self.__dict__[name] diff --git a/chirp/share/chirp.desktop b/chirp/share/chirp.desktop new file mode 100644 index 0000000..b202e44 --- /dev/null +++ b/chirp/share/chirp.desktop @@ -0,0 +1,13 @@ +[Desktop Entry] +Type=Application +Version=1.0 +Name=CHIRP +GenericName=Radio Programming Tool +Comment=Program amateur radios +Icon=chirp +Exec=chirp %F +Terminal=false +MimeType=inode/directory +Categories=Utility;HamRadio +Keywords=Hamradio;Programming;Handheld;Radio;Amateur;Programmer +StartupNotify=true diff --git a/chirp/share/chirp.ico b/chirp/share/chirp.ico new file mode 100755 index 0000000..4006ff9 Binary files /dev/null and b/chirp/share/chirp.ico differ diff --git a/chirp/share/chirp.png b/chirp/share/chirp.png new file mode 100644 index 0000000..fe57c1a Binary files /dev/null and b/chirp/share/chirp.png differ diff --git a/chirp/share/chirp.svg b/chirp/share/chirp.svg new file mode 100644 index 0000000..38d0d05 --- /dev/null +++ b/chirp/share/chirp.svg @@ -0,0 +1,224 @@ + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + c h i r p + + + + + + + + diff --git a/chirp/share/chirpw.1 b/chirp/share/chirpw.1 new file mode 100644 index 0000000..ba9b9e8 --- /dev/null +++ b/chirp/share/chirpw.1 @@ -0,0 +1,46 @@ +.\" Hey, EMACS: -*- nroff -*- +.\" First parameter, NAME, should be all caps +.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection +.\" other parameters are allowed: see man(7), man(1) +.TH CHIRP 1 "February 12, 2011" +.\" Please adjust this date whenever revising the manpage. +.\" +.\" Some roff macros, for reference: +.\" .nh disable hyphenation +.\" .hy enable hyphenation +.\" .ad l left justify +.\" .ad b justify to both left and right margins +.\" .nf disable filling +.\" .fi enable filling +.\" .br insert line break +.\" .sp insert n+1 empty lines +.\" for manpage-specific macros, see man(7) +.SH NAME +chirpw \- A tool for programming two-way radio equipment +.SH SYNOPSIS +.B chirpw +.RI [ options ] +.br +.SH DESCRIPTION +This manual page documents briefly the +.B chirpw +command. +.PP +\fBchirpw\fP is a tool for programming two-way radio equipment +It provides a generic user interface to the programming data and +process that can drive many radio models under the hood. +.SH OPTIONS +This program follows the usual GNU command line syntax, with long +options starting with two dashes (`--'). +A summary of options is included below. +.TP +.B \-\-help +Show summary of options. +.TP +.B \-\-profile +Enable Profiling. +.SH AUTHOR +chirpw was written by Dan Smith. +.PP +This manual page was written by Dan Smith (with help from Steve Conklin), +for the Debian project (and may be used by others). diff --git a/chirp/share/plus-icon.png b/chirp/share/plus-icon.png new file mode 100644 index 0000000..cecbe80 Binary files /dev/null and b/chirp/share/plus-icon.png differ diff --git a/chirp/share/welcome_screen.png b/chirp/share/welcome_screen.png new file mode 100644 index 0000000..2144125 Binary files /dev/null and b/chirp/share/welcome_screen.png differ diff --git a/chirp/sources/__init__.py b/chirp/sources/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/chirp/sources/base.py b/chirp/sources/base.py new file mode 100644 index 0000000..8e6f7e1 --- /dev/null +++ b/chirp/sources/base.py @@ -0,0 +1,61 @@ +import logging +import sys + +from chirp import CHIRP_VERSION +from chirp import chirp_common +from chirp import errors + +LOG = logging.getLogger(__name__) +HEADERS = { + 'User-Agent': 'chirp/%s Python %i.%i.%i %s' % ( + CHIRP_VERSION, + sys.version_info.major, sys.version_info.minor, sys.version_info.micro, + sys.platform), +} + + +class QueryStatus: + def send_status(self, status, percent): + LOG.info('QueryStatus[%i%%]: %s' % (percent, status)) + + def send_end(self): + LOG.info('QueryStatus: END') + + def send_fail(self, reason): + LOG.error('QueryStatus Failed: %s' % reason) + + +class NetworkResultRadio(chirp_common.NetworkSourceRadio): + VENDOR = 'Query' + MODEL = 'Result' + + def __init__(self): + self._memories = [] + + def do_fetch(self, status, params): + pass + + def get_label(self): + return 'QueryResult' + + def get_features(self): + rf = chirp_common.RadioFeatures() + rf.memory_bounds = (0, len(self._memories) - 1) + rf.has_rx_dtcs = True + rf.has_cross = True + rf.has_bank = False + rf.has_settings = False + rf.has_comment = True + rf.valid_skips = [] + rf.valid_cross_modes = chirp_common.CROSS_MODES + rf.valid_tmodes = chirp_common.TONE_MODES + return rf + + def get_memory(self, number): + return self._memories[number] + + def set_memory(self, memory): + raise errors.RadioError('Network source is immutable') + + def validate_memory(self, memory): + return ['Network source is immutable'] diff --git a/chirp/sources/dmrmarc.py b/chirp/sources/dmrmarc.py new file mode 100644 index 0000000..39b5599 --- /dev/null +++ b/chirp/sources/dmrmarc.py @@ -0,0 +1,118 @@ +# Copyright 2016 Tom Hayward +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +import logging +import requests +from chirp import chirp_common +from chirp.sources import base +from chirp.settings import RadioSetting, RadioSettingGroup, \ + RadioSettingValueList + +LOG = logging.getLogger(__name__) + + +def list_filter(haystack, attr, needles): + if not needles or not needles[0]: + return haystack + return [x for x in haystack if x[attr] in needles] + + +class DMRMARCRadio(base.NetworkResultRadio): + """DMR-MARC data source""" + VENDOR = "DMR-MARC" + + def get_label(self): + return 'DMR-MARC' + + def do_fetch(self, status, params): + status.send_status('Querying', 10) + try: + r = requests.get('https://radioid.net/api/dmr/repeater/', + headers=base.HEADERS, + params={'city': params['city'], + 'state': params['state'], + 'country': params['country']}) + r.raise_for_status() + except requests.exceptions.RequestException as e: + LOG.error('Failed to query DMR-MARC: %s' % e) + status.send_fail('Unable to query DMR-MARC') + return + status.send_status('Parsing', 20) + self._repeaters = r.json()['results'] + self._memories = [self.make_memory(i) + for i in range(0, len(self._repeaters))] + status.send_end() + + def get_raw_memory(self, number): + return repr(self._repeaters[number]) + + def make_memory(self, number): + repeater = self._repeaters[number] + + mem = chirp_common.Memory() + mem.number = number + + mem.name = repeater.get('city') + mem.freq = chirp_common.parse_freq(repeater.get('frequency')) + offset = chirp_common.parse_freq(repeater.get('offset', '0')) + if offset > 0: + mem.duplex = "+" + elif offset < 0: + mem.duplex = "-" + else: + mem.duplex = "" + mem.offset = abs(offset) + mem.mode = 'DMR' + mem.comment = repeater.get('details') + + mem.extra = RadioSettingGroup("Extra", "extra") + + rs = RadioSetting( + "color_code", "Color Code", RadioSettingValueList( + range(16), int(repeater.get('color_code', 0)))) + mem.extra.append(rs) + + return mem + + +def main(): + import argparse + from pprint import PrettyPrinter + + parser = argparse.ArgumentParser( + description=("Fetch DMR-MARC repeater " + "database and filter by city, state, and/or country. " + "Multiple items combined with a , will be filtered with " + "logical OR.")) + parser.add_argument( + "-c", "--city", + help="Comma-separated list of cities to include in output.") + parser.add_argument( + "-s", "--state", + help="Comma-separated list of states to include in output.") + parser.add_argument( + "--country", + help="Comma-separated list of countries to include in output.") + args = parser.parse_args() + + dmrmarc = DMRMARCRadio(None) + dmrmarc.set_params(**vars(args)) + dmrmarc.do_fetch() + pp = PrettyPrinter(indent=2) + pp.pprint(dmrmarc._repeaters) + + +if __name__ == "__main__": + main() diff --git a/chirp/sources/przemienniki.py b/chirp/sources/przemienniki.py new file mode 100644 index 0000000..b84cd83 --- /dev/null +++ b/chirp/sources/przemienniki.py @@ -0,0 +1,71 @@ +# Copyright 2023 Dan Smith +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +import logging + +import requests + +from chirp.drivers import generic_csv +from chirp import errors +from chirp.sources import base + +LOG = logging.getLogger(__name__) + + +class Przemienniki(base.NetworkResultRadio): + VENDOR = 'przemienniki.net' + + def get_label(self): + return 'przemienniki.net' + + def do_fetch(self, status, params): + status.send_status('Querying', 10) + if not params['range'] or int(params['range']) == 0: + params.pop('range') + LOG.debug('query params: %s' % str(params)) + try: + r = requests.get('http://przemienniki.net/export/chirp.csv', + headers=base.HEADERS, + params=params, + stream=True) + r.raise_for_status() + except requests.exceptions.RequestException as e: + LOG.error('Failed to query przemienniki: %s' % e) + status.send_fail(_('Unable to query')) + return + status.send_status(_('Parsing'), 20) + try: + csv = generic_csv.CSVRadio(None) + csv._load(x.decode() for x in r.iter_lines()) + except errors.InvalidDataError: + status.send_fail(_('No results')) + return + except Exception as e: + LOG.error('Error parsing result: %s' % e) + status.send_fail(_('Failed to parse result')) + return + + status.send_status(_('Sorting'), 80) + + self._memories = [csv.get_memory(x) for x in range(1, 999) + if not csv.get_memory(x).empty] + if not any([params['latitude'], params['longitude']]): + LOG.debug('Sorting memories by name') + self._memories.sort(key=lambda m: m.name) + # Now renumber them + for i, mem in enumerate(self._memories): + mem.number = i + 1 + + return status.send_end() diff --git a/chirp/sources/radioreference.py b/chirp/sources/radioreference.py new file mode 100644 index 0000000..e4f85f1 --- /dev/null +++ b/chirp/sources/radioreference.py @@ -0,0 +1,263 @@ +# Copyright 2012 Tom Hayward +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +import logging +import threading + +from chirp import chirp_common, errors +from chirp.sources import base +from chirp.wxui import config + +LOG = logging.getLogger(__name__) +CONF = config.get() + +try: + from suds.client import Client + from suds import WebFault + HAVE_SUDS = True +except ImportError: + HAVE_SUDS = False + +MODES = { + "FM": "FM", + "AM": "AM", + "FMN": "NFM", + "D-STAR": "DV", + "USB": "USB", + "LSB": "LSB", + "P25": "P25", + "DMR": "DMR", +} + +CA_COUNTIES = [] +CA_PROVINCES = {} +logging.getLogger('suds').setLevel(logging.WARNING) + + +class RadioReferenceCAData(threading.Thread): + def __init__(self, callback, username, password): + super().__init__() + self._callback = callback + self._username = username + self._password = password + + def run(self): + radio = RadioReferenceRadio() + radio.set_auth(self._username, self._password) + try: + counties, provinces = radio.do_getcanadacounties() + LOG.debug('Got counties: %r' % counties) + LOG.debug('Got provinces: %r' % provinces) + CA_COUNTIES.clear() + CA_COUNTIES.extend(counties) + CA_PROVINCES.clear() + CA_PROVINCES.update(provinces) + self._callback(True) + except Exception as e: + LOG.exception('Failed to query RR: %s' % e) + self._callback(e) + + +class RadioReferenceRadio(base.NetworkResultRadio): + """RadioReference.com data source""" + VENDOR = "RadioReference" + + URL = "http://api.radioreference.com/soap2/?wsdl" + APPKEY = "46785108" + + def __init__(self): + chirp_common.NetworkSourceRadio.__init__(self, None) + + if not HAVE_SUDS: + raise errors.RadioError( + "Suds library required for RadioReference.com import.\n" + + "Try installing your distribution's python-suds package.") + + self._auth = {"appKey": self.APPKEY, "username": "", "password": ""} + self._client = Client(self.URL) + self._freqs = [] + self._modes = None + self._zipcounty = None + self._country = None + + def set_auth(self, username, password): + self._auth["username"] = username + self._auth["password"] = password + + def do_getcanadacounties(self): + try: + service = self._client.service + provincelist = service.getCountryInfo(2, self._auth) + provinces = {} + clist = [] + for province in provincelist: + provinces[province[2]] = province[0] + provinceinfo = service.getStateInfo(province[0], self._auth) + for county in provinceinfo.countyList: + if (county[1] != 'UNKNOWN' and county[1] != 'N/A' and + county[1] != 'Provincewide'): + # some counties are actually cities but whatever fml + clist.append([province[0], province[2], + county[0], county[1]]) + except WebFault as err: + raise errors.RadioError(err) + return clist, provinces + + def do_fetch(self, status, params): + """Fetches frequencies for all subcategories in a county + (or zip if USA).""" + status.send_status('Querying...', 5) + self._freqs = [] + # if this method was accessed for the USA, use the zip; otherwise + # use the county ID + if params['country'] == 'US': + try: + service = self._client.service + zipcode = service.getZipcodeInfo(params['zipcounty'], + self._auth) + county = service.getCountyInfo(zipcode.ctid, self._auth) + except WebFault as err: + raise errors.RadioError(err) + elif params['country'] == 'CA': + try: + service = self._client.service + county = service.getCountyInfo(params['zipcounty'], + self._auth) + except WebFault as err: + raise errors.RadioError(err) + + status_max = 0 + status_cur = 0 + for cat in county.cats: + status_max += len(cat.subcats) + status_max += len(county.agencyList) + + for cat in county.cats: + for subcat in cat.subcats: + result = self._client.service.getSubcatFreqs(subcat.scid, + self._auth) + self._freqs += result + status_cur += 1 + status.send_status( + 'Fetching %s:%s' % (cat.cName, subcat.scName), + status_cur / status_max * 100) + + for agency in county.agencyList: + agency = self._client.service.getAgencyInfo(agency.aid, self._auth) + for cat in agency.cats: + status_max += len(cat.subcats) + for cat in agency.cats: + for subcat in cat.subcats: + result = self._client.service.getSubcatFreqs(subcat.scid, + self._auth) + self._freqs += result + status_cur += 1 + try: + sc_name = subcat.scName + except AttributeError: + sc_name = 'Unknown Category' + + status.send_status( + 'Fetching agency %s %s:%s' % (agency.aid, + cat.cName, + sc_name), + status_cur / status_max * 100) + status.send_end() + + def get_features(self): + rf = chirp_common.RadioFeatures() + rf.memory_bounds = (0, len(self._freqs)-1) + rf.has_bank = False + rf.has_ctone = False + rf.has_comment = True + rf.valid_tmodes = ["", "TSQL", "DTCS"] + return rf + + def get_raw_memory(self, number): + return repr(self._freqs[number]) + + def get_memory(self, number): + if not self._freqs: + self.do_fetch() + + freq = self._freqs[number] + + mem = chirp_common.Memory() + mem.number = number + + mem.name = freq.alpha or freq.descr or "" + mem.freq = chirp_common.parse_freq(str(freq.out)) + if freq["in"] == 0.0: + mem.duplex = "" + else: + mem.duplex = "split" + mem.offset = chirp_common.parse_freq(str(freq["in"])) + if freq.tone is not None: + if str(freq.tone) == "CSQ": # Carrier Squelch + mem.tmode = "" + else: + try: + tone, tmode = freq.tone.split(" ") + except Exception: + tone, tmode = None, None + if tmode == "PL": + mem.tmode = "TSQL" + mem.rtone = mem.ctone = float(tone) + elif tmode == "DPL": + mem.tmode = "DTCS" + mem.dtcs = int(tone) + else: + LOG.error("Error: unsupported tone: %s" % freq) + try: + mem.mode = self._get_mode(freq.mode) + except KeyError: + LOG.debug('Mode %s (%s) is unsupported' % ( + freq.mode, self._modes[int(str(freq.mode))])) + # skip memory if mode is unsupported + mem.empty = True + return mem + mem.comment = freq.descr.strip() + + return mem + + def _get_mode(self, modeid): + if not self._modes: + self._modes = {} + for mode in self._client.service.getMode("0", self._auth): + # sax.text.Text cannot be coerced directly to int + self._modes[int(str(mode.mode))] = str(mode.modeName) + return MODES[self._modes[int(str(modeid))]] + + +def main(): + """ + Usage: + cd ~/src/chirp.hg + python ./chirp/radioreference.py [USERNAME] [PASSWORD] \ + [COUNTRY - 2 LETTER] [US ZIP(USA) OR COUNTY ID(CANADA)] + """ + import sys + rrr = RadioReferenceRadio(None) + rrr.set_params(username=sys.argv[1], + password=sys.argv[2], + country=sys.argv[3], + zipcounty=sys.argv[4]) + rrr.do_fetch() + print(rrr.get_raw_memory(0)) + print(rrr.get_memory(0)) + + +if __name__ == "__main__": + main() diff --git a/chirp/sources/repeaterbook.py b/chirp/sources/repeaterbook.py new file mode 100644 index 0000000..63ebca7 --- /dev/null +++ b/chirp/sources/repeaterbook.py @@ -0,0 +1,393 @@ +import datetime +import json +import logging +import math +import os + +import requests + +from chirp import chirp_common +from chirp import errors +from chirp import platform as chirp_platform +from chirp.sources import base +from chirp.wxui import fips + +LOG = logging.getLogger(__name__) + +NA_COUNTRIES = [ + 'United States', + 'Canada', + 'Mexico', +] +MEXICO_STATES = [ + "Aguascalientes", "Baja California Sur", "Baja California", + "Campeche", "Chiapas", "Chihuahua", "Coahuila", "Colima", + "Durango", "Guanajuato", "Guerrero", "Hidalgo", "Jalisco", + "Mexico City", "Mexico", "Michoacán", "Morelos", "Nayarit", + "Nuevo Leon", "Puebla", "Queretaro", "Quintana Roo", "San Luis Potosi", + "Sinaloa", "Sonora", "Tabasco", "Tamaulipas", "Tlaxcala", "Veracruz", + "Yucatan", "Zacatecas", +] +STATES = { + 'United States': [s for s, i in fips.FIPS_STATES.items() + if isinstance(i, int)], + 'Canada': [s for s, i in fips.FIPS_STATES.items() + if isinstance(i, str)], + 'Mexico': MEXICO_STATES, +} +MODES = ['FM', 'DV', 'DMR', 'DN'] + + +def parse_tone(val): + if val.startswith('D'): + mode = 'DTCS' + val = int(val[1:]) + elif '.' in val: + mode = 'Tone' + val = float(val) + elif val in ('CSQ', 'Restricted'): + val = mode = None + elif val: + LOG.warning('Unsupported PL format: %r' % val) + val = mode = None + else: + val = mode = None + return mode, val + + +def distance(lat_a, lon_a, lat_b, lon_b): + lat_a = math.radians(lat_a) + lon_a = math.radians(lon_a) + + lat_b = math.radians(lat_b) + lon_b = math.radians(lon_b) + + earth_radius_km = 6371 + + dlon = lon_b - lon_a + dlat = lat_b - lat_a + + a = math.sin(dlat / 2)**2 + math.cos(lat_a) * \ + math.cos(lat_b) * math.sin(dlon / 2)**2 + c = 2 * math.atan2(math.sqrt(a), math.sqrt(1 - a)) + return earth_radius_km * c + + +class RepeaterBook(base.NetworkResultRadio): + VENDOR = 'RepeaterBook' + + def get_label(self): + return 'RepeaterBook' + + def get_data(self, status, country, state, service): + # Ideally we would be able to pull the whole database, but right + # now this is limited to 3500 results, so we need to filter and + # cache by state to stay under that limit. + fn = 'rb%s-%s-%s.json' % (service, + country.lower().replace(' ', '_'), + state.lower().replace(' ', '_')) + db_dir = chirp_platform.get_platform().config_file('repeaterbook') + try: + os.mkdir(db_dir) + except FileExistsError: + pass + except Exception as e: + LOG.exception('Failed to create %s: %s' % (db_dir, e)) + status.set_fail('Internal error - check log') + return + data_file = os.path.join(db_dir, fn) + try: + modified = os.path.getmtime(data_file) + except FileNotFoundError: + modified = 0 + modified_dt = datetime.datetime.fromtimestamp(modified) + interval = datetime.timedelta(days=30) + if datetime.datetime.now() - modified_dt < interval: + return data_file + if modified == 0: + LOG.debug('RepeaterBook database %s not cached' % fn) + else: + LOG.debug('RepeaterBook database %s too old: %s', + fn, modified_dt) + + params = {'country': country, + 'stype': service} + if country in NA_COUNTRIES: + export = 'export.php' + else: + export = 'exportROW.php' + if country in STATES: + params['state'] = state + + r = requests.get('https://www.repeaterbook.com/api/%s' % export, + headers=base.HEADERS, + params=params, + stream=True) + if r.status_code != 200: + if modified: + status.send_status('Using cached data', 50) + status.send_fail('Got error code %i from server' % r.status_code) + return + tmp = data_file + '.tmp' + chunk_size = 8192 + probable_end = 3 << 20 + counter = 0 + data = b'' + with open(tmp, 'wb') as f: + for chunk in r.iter_content(chunk_size=chunk_size): + f.write(chunk) + data += chunk + counter += len(chunk) + status.send_status('Downloading', counter / probable_end * 50) + try: + results = json.loads(data) + except Exception as e: + LOG.exception('Invalid JSON in response: %s' % e) + status.send_fail('RepeaterBook returned invalid response') + return + + if results['count']: + try: + os.rename(tmp, data_file) + except FileExistsError: + # Windows can't do atomic rename + os.remove(data_file) + os.rename(tmp, data_file) + else: + os.remove(tmp) + status.send_fail('No results!') + return + + status.send_status('Download complete', 50) + return data_file + + def item_to_memory(self, item, number): + if item.get('D-Star') == 'Yes': + m = chirp_common.DVMemory() + m.dv_urcall = 'CQCQCQ'.ljust(8) + m.dv_rpt1call = item.get('Callsign')[:8].ljust(8) + m.dv_rpt2call = item.get('Callsign')[:8].ljust(8) + else: + m = chirp_common.Memory() + m.number = number + m.freq = chirp_common.parse_freq(item['Frequency']) + try: + m.tuning_step = chirp_common.required_step(m.freq) + except errors.InvalidDataError as e: + LOG.debug(e) + txf = chirp_common.parse_freq(item['Input Freq']) + if txf == 0: + m.duplex = 'off' + else: + chirp_common.split_to_offset(m, m.freq, txf) + txm, tx = parse_tone(item['PL']) + rxm, rx = parse_tone(item['TSQ']) + chirp_common.split_tone_decode(m, (txm, tx, 'N'), (rxm, rx, 'N')) + if item['DMR'] == 'Yes': + m.mode = 'DMR' + elif item['D-Star'] == 'Yes': + m.mode = 'DV' + elif item['System Fusion'] == 'Yes': + m.mode = 'DN' + elif item['FM Analog'] == 'Yes': + m.mode = 'FM' + else: + LOG.warning('Unable to determine mode for repeater %s' % ( + item['Rptr ID'])) + return None + if 'State' in item and 'County' in item: + m.comment = ( + '%(Callsign)s near %(Nearest City)s, %(County)s County, ' + '%(State)s %(Use)s') % item + else: + m.comment = ( + '%(Callsign)s near %(Nearest City)s, %(Region)s ' + '%(Use)s') % item + m.comment += ' ' + item.get('Notes', '') + m.comment = m.comment.strip() + m.name = item['Landmark'] or item['Callsign'] + return m + + def do_fetch(self, status, params): + lat = float(params.pop('lat') or 0) + lon = float(params.pop('lon') or 0) + dist = int(params.pop('dist') or 0) + search_filter = params.pop('filter', '') + bands = params.pop('bands', []) + modes = params.pop('modes', []) + data_file = self.get_data(status, + params.get('country'), + params.pop('state'), + params.get('service', '')) + if not data_file: + return + + status.send_status('Parsing', 50) + + def sorter(item): + if lat == 0 and lon == 0: + # No sort if not provided + return 0 + return distance(lat, lon, + float(item.get('Lat', 0)), + float(item.get('Long', 0))) + + def match(item): + search_fields = ('County', 'State', 'Landmark', 'Nearest City', + 'Callsign', 'Region', 'Notes') + content = ' '.join(item.get(k) or '' for k in search_fields + if k in item) + return (not search_filter or + search_filter.lower() in content.lower()) + + def included_band(item): + if not bands: + return True + for lo, hi in bands: + if lo < chirp_common.parse_freq(item['Frequency']) < hi: + return True + return False + + i = 0 + for item in sorted(json.loads(open(data_file, 'rb').read())['results'], + key=sorter): + if not item: + continue + if item['Operational Status'] != 'On-air': + continue + if dist and lat and lon and ( + distance(lat, lon, + float(item.get('Lat') or 0), + float(item.get('Long') or 0)) > dist): + continue + if not match(item): + continue + if not included_band(item): + continue + i += 1 + try: + m = self.item_to_memory(item, i) + except Exception as e: + LOG.warning('Unable to convert repeater %s: %s', + item['Rptr ID'], e) + continue + if not m: + continue + if modes and m.mode not in modes: + continue + self._memories.append(m) + + self.MODEL = '%s %s' % (params.get('country'), + params.get('service_display') or 'Result') + + if not self._memories: + status.send_fail(_('No results!')) + return + + status.send_end() + + +ROW_COUNTRIES = [ + "Albania", + "Andorra", + "Argentina", + "Australia", + "Austria", + "Azerbaijan", + "Bahamas", + "Barbados", + "Belarus", + "Belgium", + "Belize", + "Bolivia", + "Bosnia and Herzegovina", + "Brazil", + "Bulgaria", + "Caribbean Netherlands", + "Cayman Islands", + "Chile", + "China", + "Colombia", + "Costa Rica", + "Croatia", + "Curacao", + "Cyprus", + "Czech Republic", + "Denmark", + "Dominican Republic", + "Ecuador", + "El Salvador", + "Estonia", + "Faroe Islands", + "Finland", + "France", + "Georgia", + "Germany", + "Greece", + "Grenada", + "Guatemala", + "Guernsey", + "Haiti", + "Honduras", + "Hungary", + "Iceland", + "India", + "Indonesia", + "Ireland", + "Isle of Man", + "Israel", + "Italy", + "Jamaica", + "Japan", + "Jersey", + "Kosovo", + "Kuwait", + "Latvia", + "Liechtenstein", + "Lithuania", + "Luxembourg", + "Macedonia", + "Malaysia", + "Malta", + "Moldova", + "Morocco", + "Namibia", + "Nepal", + "Netherlands", + "New Zealand", + "Nicaragua", + "Norway", + "Oman", + "Panama", + "Paraguay", + "Peru", + "Philippines", + "Poland", + "Portugal", + "Romania", + "Russian Federation", + "Saint Kitts and Nevis", + "Saint Vincent and the Grenadines", + "San Marino", + "Serbia", + "Singapore", + "Slovakia", + "Slovenia", + "South Africa", + "South Korea", + "Spain", + "Sri Lanka", + "Sweden", + "Switzerland", + "Taiwan", + "Thailand", + "Trinidad and Tobago", + "Turkey", + "Ukraine", + "United Arab Emirates", + "United Kingdom", + "Uruguay", + "Venezuela", +] + +COUNTRIES = list(sorted(NA_COUNTRIES + ROW_COUNTRIES)) diff --git a/chirp/stock_configs/AU NZ UHF Citizens Band.csv b/chirp/stock_configs/AU NZ UHF Citizens Band.csv new file mode 100644 index 0000000..758b395 --- /dev/null +++ b/chirp/stock_configs/AU NZ UHF Citizens Band.csv @@ -0,0 +1,82 @@ +Location,Name,Frequency,Duplex,Offset,Tone,rToneFreq,cToneFreq,DtcsCode,DtcsPolarity,Mode,TStep,Skip,Comment,URCALL,RPT1CALL,RPT2CALL +1,CB 01RP,476.425,+,0.75,,88.5,88.5,23,NN,NFM,12.5,,Channel 01 duplex,,, +2,CB 02RP,476.45,+,0.75,,88.5,88.5,23,NN,NFM,12.5,,Channel 02 duplex,,, +3,CB 03RP,476.475,+,0.75,,88.5,88.5,23,NN,NFM,12.5,,Channel 03 duplex,,, +4,CB 04RP,476.5,+,0.75,,88.5,88.5,23,NN,NFM,12.5,,Channel 04 duplex,,, +5,CB 05,476.525,,,,88.5,88.5,23,NN,NFM,12.5,,Channel 05 emergency simplex,,, +6,CB 05RP,476.525,+,0.75,,88.5,88.5,23,NN,NFM,12.5,,Channel 05 emergency duplex,,, +7,CB 06RP,476.55,+,0.75,,88.5,88.5,23,NN,NFM,12.5,,Channel 06 duplex,,, +8,CB 07RP,476.575,+,0.75,,88.5,88.5,23,NN,NFM,12.5,,Channel 07 duplex,,, +9,CB 08RP,476.6,+,0.75,,88.5,88.5,23,NN,NFM,12.5,,Channel 08 duplex,,, +10,CB 09,476.625,,,,88.5,88.5,23,NN,NFM,12.5,,,,, +11,CB 10,476.65,,,,88.5,88.5,23,NN,NFM,12.5,,,,, +12,CB 11,476.675,,,,88.5,88.5,23,NN,NFM,12.5,,AU CB Call channel,,, +13,CB 12,476.7,,,,88.5,88.5,23,NN,NFM,12.5,,,,, +14,CB 13,476.725,,,,88.5,88.5,23,NN,NFM,12.5,,,,, +15,CB 14,476.75,,,,88.5,88.5,23,NN,NFM,12.5,,,,, +16,CB 15,476.775,,,,88.5,88.5,23,NN,NFM,12.5,,,,, +17,CB 16,476.8,,,,88.5,88.5,23,NN,NFM,12.5,,,,, +18,CB 17,476.825,,,,88.5,88.5,23,NN,NFM,12.5,,,,, +19,CB 18,476.85,,,,88.5,88.5,23,NN,NFM,12.5,,"Caravan, RV & Convoy channel",,, +20,CB 19,476.875,,,,88.5,88.5,23,NN,NFM,12.5,,,,, +21,CB 20,476.9,,,,88.5,88.5,23,NN,NFM,12.5,,,,, +22,CB 21,476.925,,,,88.5,88.5,23,NN,NFM,12.5,,,,, +23,CB 22T,476.95,,,,88.5,88.5,23,NN,NFM,12.5,,Telemetery & Telecommand (no voice allowed),,, +24,CB 23T,476.975,,,,88.5,88.5,23,NN,NFM,12.5,,Telemetery & Telecommand (no voice allowed),,, +25,CB 24,477,,,,88.5,88.5,23,NN,NFM,12.5,,,,, +26,CB 25,477.025,,,,88.5,88.5,23,NN,NFM,12.5,,,,, +27,CB 26,477.05,,,,88.5,88.5,23,NN,NFM,12.5,,,,, +28,CB 27,477.075,,,,88.5,88.5,23,NN,NFM,12.5,,,,, +29,CB 28,477.1,,,,88.5,88.5,23,NN,NFM,12.5,,,,, +30,CB 29,477.125,,,,88.5,88.5,23,NN,NFM,12.5,,,,, +31,CB 30,477.15,,,,88.5,88.5,23,NN,NFM,12.5,,,,, +32,CB 31,477.175,,,,88.5,88.5,23,NN,NFM,12.5,,Chan 1 repeater input (use chan 1 duplex for repeater),,, +33,CB 32,477.2,,,,88.5,88.5,23,NN,NFM,12.5,,Chan 2 repeater input (use chan 2 duplex for repeater),,, +34,CB 33,477.225,,,,88.5,88.5,23,NN,NFM,12.5,,Chan 3 repeater input (use chan 3 duplex for repeater),,, +35,CB 34,477.25,,,,88.5,88.5,23,NN,NFM,12.5,,Chan 4 repeater input (use chan 4 duplex for repeater),,, +36,CB 35,477.275,,,,88.5,88.5,23,NN,NFM,12.5,,Chan 5 EMERGENCY repeater input (use chan 5 duplex for repeater),,, +37,CB 36,477.3,,,,88.5,88.5,23,NN,NFM,12.5,,Chan 6 repeater input (use chan 6 duplex for repeater),,, +38,CB 37,477.325,,,,88.5,88.5,23,NN,NFM,12.5,,Chan 7 repeater input (use chan 7 duplex for repeater),,, +39,CB 38,477.35,,,,88.5,88.5,23,NN,NFM,12.5,,Chan 8 repeater input (use chan 8 duplex for repeater),,, +40,CB 39,477.375,,,,88.5,88.5,23,NN,NFM,12.5,,Road safety channel secondary,,, +41,CB 40,477.4,,,,88.5,88.5,23,NN,NFM,12.5,,Road safety channel primary,,, +42,CB 41R,476.4375,+,0.75,,88.5,88.5,23,NN,NFM,12.5,,Channel 41 duplex,,, +43,CB 42R,476.4625,+,0.75,,88.5,88.5,23,NN,NFM,12.5,,Channel 42 duplex,,, +44,CB 43R,476.4875,+,0.75,,88.5,88.5,23,NN,NFM,12.5,,Channel 43 duplex,,, +45,CB 44R,476.5125,+,0.75,,88.5,88.5,23,NN,NFM,12.5,,Channel 44 duplex,,, +46,CB 45R,476.5375,+,0.75,,88.5,88.5,23,NN,NFM,12.5,,Channel 45 duplex,,, +47,CB 46R,476.5625,+,0.75,,88.5,88.5,23,NN,NFM,12.5,,Channel 46 duplex,,, +48,CB 47R,476.5875,+,0.75,,88.5,88.5,23,NN,NFM,12.5,,Channel 47 duplex,,, +49,CB 48R,476.6125,+,0.75,,88.5,88.5,23,NN,NFM,12.5,,Channel 48 duplex,,, +50,CB 49,476.6375,,,,88.5,88.5,23,NN,NFM,12.5,,,,, +51,CB 50,476.6625,,,,88.5,88.5,23,NN,NFM,12.5,,,,, +52,CB 51,476.6875,,,,88.5,88.5,23,NN,NFM,12.5,,,,, +53,CB 52,476.7125,,,,88.5,88.5,23,NN,NFM,12.5,,,,, +54,CB 53,476.7375,,,,88.5,88.5,23,NN,NFM,12.5,,,,, +55,CB 54,476.7625,,,,88.5,88.5,23,NN,NFM,12.5,,,,, +56,CB 55,476.7875,,,,88.5,88.5,23,NN,NFM,12.5,,,,, +57,CB 56,476.8125,,,,88.5,88.5,23,NN,NFM,12.5,,,,, +58,CB 57,476.8375,,,,88.5,88.5,23,NN,NFM,12.5,,,,, +59,CB 58,476.8625,,,,88.5,88.5,23,NN,NFM,12.5,,,,, +60,CB 59,476.8875,,,,88.5,88.5,23,NN,NFM,12.5,,,,, +61,CB 60,476.9125,,,,88.5,88.5,23,NN,NFM,12.5,,,,, +62,CB 61*,476.9375,,,,88.5,88.5,23,NN,NFM,12.5,,Reserved for future use,,, +63,CB 62*,476.9625,,,,88.5,88.5,23,NN,NFM,12.5,,Reserved for future use,,, +64,CB 63*,476.9875,,,,88.5,88.5,23,NN,NFM,12.5,,Reserved for future use,,, +65,CB 64,477.0125,,,,88.5,88.5,23,NN,NFM,12.5,,,,, +66,CB 65,477.0375,,,,88.5,88.5,23,NN,NFM,12.5,,,,, +67,CB 66,477.0625,,,,88.5,88.5,23,NN,NFM,12.5,,,,, +68,CB 67,477.0875,,,,88.5,88.5,23,NN,NFM,12.5,,,,, +69,CB 68,477.1125,,,,88.5,88.5,23,NN,NFM,12.5,,,,, +70,CB 69,477.1375,,,,88.5,88.5,23,NN,NFM,12.5,,,,, +71,CB 70,477.1625,,,,88.5,88.5,23,NN,NFM,12.5,,,,, +72,CB 71R,477.1875,,,,88.5,88.5,23,NN,NFM,12.5,,Chan 41 repeater input (use chan 41 duplex for repeater),,, +73,CB 72R,477.2125,,,,88.5,88.5,23,NN,NFM,12.5,,Chan 42 repeater input (use chan 42 duplex for repeater),,, +74,CB 73R,477.2375,,,,88.5,88.5,23,NN,NFM,12.5,,Chan 43 repeater input (use chan 43 duplex for repeater),,, +75,CB 74R,477.2625,,,,88.5,88.5,23,NN,NFM,12.5,,Chan 44 repeater input (use chan 44 duplex for repeater),,, +76,CB 75R,477.2875,,,,88.5,88.5,23,NN,NFM,12.5,,Chan 45 repeater input (use chan 45 duplex for repeater),,, +77,CB 76R,477.3125,,,,88.5,88.5,23,NN,NFM,12.5,,Chan 46 repeater input (use chan 46 duplex for repeater),,, +78,CB 77R,477.3375,,,,88.5,88.5,23,NN,NFM,12.5,,Chan 47 repeater input (use chan 47 duplex for repeater),,, +79,CB 78R,477.3625,,,,88.5,88.5,23,NN,NFM,12.5,,Chan 48 repeater input (use chan 48 duplex for repeater),,, +80,CB 79,477.3875,,,,88.5,88.5,23,NN,NFM,12.5,,,,, +81,CB 80,477.4125,,,,88.5,88.5,23,NN,NFM,12.5,,,,, diff --git a/chirp/stock_configs/DE Freenet Frequencies.csv b/chirp/stock_configs/DE Freenet Frequencies.csv new file mode 100644 index 0000000..e9ec9bc --- /dev/null +++ b/chirp/stock_configs/DE Freenet Frequencies.csv @@ -0,0 +1,7 @@ +Location,Name,Frequency,Duplex,Offset,Tone,rToneFreq,cToneFreq,DtcsCode,DtcsPolarity,Mode,TStep,Skip,Comment,URCALL,RPT1CALL,RPT2CALL +1,FRNET1,149.025000,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, +2,FRNET2,149.037500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, +3,FRNET3,149.050000,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, +4,FRNET4,149.087500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, +5,FRNET5,149.100000,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, +6,FRNET6,149.112500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, diff --git a/chirp/stock_configs/EU LPD and PMR Channels.csv b/chirp/stock_configs/EU LPD and PMR Channels.csv new file mode 100644 index 0000000..19d9e14 --- /dev/null +++ b/chirp/stock_configs/EU LPD and PMR Channels.csv @@ -0,0 +1,86 @@ +Location,Name,Frequency,Duplex,Offset,Tone,rToneFreq,cToneFreq,DtcsCode,DtcsPolarity,Mode,TStep,Skip,Comment,URCALL,RPT1CALL,RPT2CALL +1,LPD 01,433.075000,,0.600000,,88.5,88.5,023,NN,FM,5.00,,,,, +2,LPD 02,433.100000,,0.600000,,88.5,88.5,023,NN,FM,5.00,,,,, +3,LPD 03,433.125000,,0.600000,,88.5,88.5,023,NN,FM,5.00,,,,, +4,LPD 04,433.150000,,0.600000,,88.5,88.5,023,NN,FM,5.00,,,,, +5,LPD 05,433.175000,,0.600000,,88.5,88.5,023,NN,FM,5.00,,,,, +6,LPD 06,433.200000,,0.600000,,88.5,88.5,023,NN,FM,5.00,,,,, +7,LPD 07,433.225000,,0.600000,,88.5,88.5,023,NN,FM,5.00,,,,, +8,LPD 08,433.250000,,0.600000,,88.5,88.5,023,NN,FM,5.00,,,,, +9,LPD 09,433.275000,,0.600000,,88.5,88.5,023,NN,FM,5.00,,,,, +10,LPD 10,433.300000,,0.600000,,88.5,88.5,023,NN,FM,5.00,,,,, +11,LPD 11,433.325000,,0.600000,,88.5,88.5,023,NN,FM,5.00,,,,, +12,LPD 12,433.350000,,0.600000,,88.5,88.5,023,NN,FM,5.00,,,,, +13,LPD 13,433.375000,,0.600000,,88.5,88.5,023,NN,FM,5.00,,,,, +14,LPD 14,433.400000,,0.600000,,88.5,88.5,023,NN,FM,5.00,,,,, +15,LPD 15,433.425000,,0.600000,,88.5,88.5,023,NN,FM,5.00,,,,, +16,LPD 16,433.450000,,0.600000,,88.5,88.5,023,NN,FM,5.00,,,,, +17,LPD 17,433.475000,,0.600000,,88.5,88.5,023,NN,FM,5.00,,,,, +18,LPD 18,433.500000,,0.600000,,88.5,88.5,023,NN,FM,5.00,,,,, +19,LPD 19,433.525000,,0.600000,,88.5,88.5,023,NN,FM,5.00,,,,, +20,LPD 20,433.550000,,0.600000,,88.5,88.5,023,NN,FM,5.00,,,,, +21,LPD 21,433.575000,,0.600000,,88.5,88.5,023,NN,FM,5.00,,,,, +22,LPD 22,433.600000,,0.600000,,88.5,88.5,023,NN,FM,5.00,,,,, +23,LPD 23,433.625000,,0.600000,,88.5,88.5,023,NN,FM,5.00,,,,, +24,LPD 24,433.650000,,0.600000,,88.5,88.5,023,NN,FM,5.00,,,,, +25,LPD 25,433.675000,,0.600000,,88.5,88.5,023,NN,FM,5.00,,,,, +26,LPD 26,433.700000,,0.600000,,88.5,88.5,023,NN,FM,5.00,,,,, +27,LPD 27,433.725000,,0.600000,,88.5,88.5,023,NN,FM,5.00,,,,, +28,LPD 28,433.750000,,0.600000,,88.5,88.5,023,NN,FM,5.00,,,,, +29,LPD 29,433.775000,,0.600000,,88.5,88.5,023,NN,FM,5.00,,,,, +30,LPD 30,433.800000,,0.600000,,88.5,88.5,023,NN,FM,5.00,,,,, +31,LPD 31,433.825000,,0.600000,,88.5,88.5,023,NN,FM,5.00,,,,, +32,LPD 32,433.850000,,0.600000,,88.5,88.5,023,NN,FM,5.00,,,,, +33,LPD 33,433.875000,,0.600000,,88.5,88.5,023,NN,FM,5.00,,,,, +34,LPD 34,433.900000,,0.600000,,88.5,88.5,023,NN,FM,5.00,,,,, +35,LPD 35,433.925000,,0.600000,,88.5,88.5,023,NN,FM,5.00,,,,, +36,LPD 36,433.950000,,0.600000,,88.5,88.5,023,NN,FM,5.00,,,,, +37,LPD 37,433.975000,,0.600000,,88.5,88.5,023,NN,FM,5.00,,,,, +38,LPD 38,434.000000,,0.600000,,88.5,88.5,023,NN,FM,5.00,,,,, +39,LPD 39,434.025000,,0.600000,,88.5,88.5,023,NN,FM,5.00,,,,, +40,LPD 40,434.050000,,0.600000,,88.5,88.5,023,NN,FM,5.00,,,,, +41,LPD 41,434.075000,,0.600000,,88.5,88.5,023,NN,FM,5.00,,,,, +42,LPD 42,434.100000,,0.600000,,88.5,88.5,023,NN,FM,5.00,,,,, +43,LPD 43,434.125000,,0.600000,,88.5,88.5,023,NN,FM,5.00,,,,, +44,LPD 44,434.150000,,0.600000,,88.5,88.5,023,NN,FM,5.00,,,,, +45,LPD 45,434.175000,,0.600000,,88.5,88.5,023,NN,FM,5.00,,,,, +46,LPD 46,434.200000,,0.600000,,88.5,88.5,023,NN,FM,5.00,,,,, +47,LPD 47,434.225000,,0.600000,,88.5,88.5,023,NN,FM,5.00,,,,, +48,LPD 48,434.250000,,0.600000,,88.5,88.5,023,NN,FM,5.00,,,,, +49,LPD 49,434.275000,,0.600000,,88.5,88.5,023,NN,FM,5.00,,,,, +50,LPD 50,434.300000,,0.600000,,88.5,88.5,023,NN,FM,5.00,,,,, +51,LPD 51,434.325000,,0.600000,,88.5,88.5,023,NN,FM,5.00,,,,, +52,LPD 52,434.350000,,0.600000,,88.5,88.5,023,NN,FM,5.00,,,,, +53,LPD 53,434.375000,,0.600000,,88.5,88.5,023,NN,FM,5.00,,,,, +54,LPD 54,434.400000,,0.600000,,88.5,88.5,023,NN,FM,5.00,,,,, +55,LPD 55,434.425000,,0.600000,,88.5,88.5,023,NN,FM,5.00,,,,, +56,LPD 56,434.450000,,0.600000,,88.5,88.5,023,NN,FM,5.00,,,,, +57,LPD 57,434.475000,,0.600000,,88.5,88.5,023,NN,FM,5.00,,,,, +58,LPD 58,434.500000,,0.600000,,88.5,88.5,023,NN,FM,5.00,,,,, +59,LPD 59,434.525000,,0.600000,,88.5,88.5,023,NN,FM,5.00,,,,, +60,LPD 60,434.550000,,0.600000,,88.5,88.5,023,NN,FM,5.00,,,,, +61,LPD 61,434.575000,,0.600000,,88.5,88.5,023,NN,FM,5.00,,,,, +62,LPD 62,434.600000,,0.600000,,88.5,88.5,023,NN,FM,5.00,,,,, +63,LPD 63,434.625000,,0.600000,,88.5,88.5,023,NN,FM,5.00,,,,, +64,LPD 64,434.650000,,0.600000,,88.5,88.5,023,NN,FM,5.00,,,,, +65,LPD 65,434.675000,,0.600000,,88.5,88.5,023,NN,FM,5.00,,,,, +66,LPD 66,434.700000,,0.600000,,88.5,88.5,023,NN,FM,5.00,,,,, +67,LPD 67,434.725000,,0.600000,,88.5,88.5,023,NN,FM,5.00,,,,, +68,LPD 68,434.750000,,0.600000,,88.5,88.5,023,NN,FM,5.00,,,,, +69,LPD 69,434.775000,,0.600000,,88.5,88.5,023,NN,FM,5.00,,,,, +71,PMR 01,446.006250,,0.600000,,88.5,88.5,023,NN,NFM,6.25,,,,, +72,PMR 02,446.018750,,0.600000,,88.5,88.5,023,NN,NFM,6.25,,,,, +73,PMR 03,446.031250,,0.600000,,88.5,88.5,023,NN,NFM,6.25,,,,, +74,PMR 04,446.043750,,0.600000,,88.5,88.5,023,NN,NFM,6.25,,,,, +75,PMR 05,446.056250,,0.600000,,88.5,88.5,023,NN,NFM,6.25,,,,, +76,PMR 06,446.068750,,0.600000,,88.5,88.5,023,NN,NFM,6.25,,,,, +77,PMR 07,446.081250,,0.600000,,88.5,88.5,023,NN,NFM,6.25,,,,, +78,PMR 08,446.093750,,0.600000,,88.5,88.5,023,NN,NFM,6.25,,,,, +81,PMR 09,446.106250,,0.600000,,88.5,88.5,023,NN,NFM,6.25,,,,, +82,PMR 10,446.118750,,0.600000,,88.5,88.5,023,NN,NFM,6.25,,,,, +83,PMR 11,446.131250,,0.600000,,88.5,88.5,023,NN,NFM,6.25,,,,, +84,PMR 12,446.143750,,0.600000,,88.5,88.5,023,NN,NFM,6.25,,,,, +85,PMR 13,446.156250,,0.600000,,88.5,88.5,023,NN,NFM,6.25,,,,, +86,PMR 14,446.168750,,0.600000,,88.5,88.5,023,NN,NFM,6.25,,,,, +87,PMR 15,446.181250,,0.600000,,88.5,88.5,023,NN,NFM,6.25,,,,, +88,PMR 16,446.193750,,0.600000,,88.5,88.5,023,NN,NFM,6.25,,,,, diff --git a/chirp/stock_configs/FR Marine VHF Channels.csv b/chirp/stock_configs/FR Marine VHF Channels.csv new file mode 100644 index 0000000..da8bac7 --- /dev/null +++ b/chirp/stock_configs/FR Marine VHF Channels.csv @@ -0,0 +1,58 @@ +Location,Name,Frequency,Duplex,Offset,Tone,rToneFreq,cToneFreq,DtcsCode,DtcsPolarity,Mode,TStep,Skip,Comment,URCALL,RPT1CALL,RPT2CALL +1,SEA 01,160.650000,-,4.600000,,88.5,88.5,023,NN,FM,5.00,,,,, +2,SEA 02,160.700000,-,4.600000,,88.5,88.5,023,NN,FM,5.00,,,,, +3,SEA 03,160.750000,-,4.600000,,88.5,88.5,023,NN,FM,5.00,,,,, +4,SEA 04,160.800000,-,4.600000,,88.5,88.5,023,NN,FM,5.00,,,,, +5,SEA 05,160.850000,-,4.600000,,88.5,88.5,023,NN,FM,5.00,,,,, +6,SEA 06,156.300000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, +7,SEA 07,160.950000,-,4.600000,,88.5,88.5,023,NN,FM,5.00,,,,, +8,SEA 08,156.400000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, +9,SEA 09,156.450000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, +10,SEA 10,156.500000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, +11,SEA 11,156.550000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, +12,SEA 12,156.600000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, +13,SEA 13,156.650000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, +14,SEA 14,156.700000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, +15,SEA 15,156.750000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, +16,SEA 16,156.800000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, +17,SEA 17,156.850000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, +18,SEA 18,161.500000,-,4.600000,,88.5,88.5,023,NN,FM,5.00,,,,, +19,SEA 19,161.550000,-,4.600000,,88.5,88.5,023,NN,FM,5.00,,,,, +20,SEA 20,161.600000,-,4.600000,,88.5,88.5,023,NN,FM,5.00,,,,, +21,SEA 21,161.650000,-,4.600000,,88.5,88.5,023,NN,FM,5.00,,,,, +22,SEA 22,161.700000,-,4.600000,,88.5,88.5,023,NN,FM,5.00,,,,, +23,SEA 23,161.750000,-,4.600000,,88.5,88.5,023,NN,FM,5.00,,,,, +24,SEA 24,161.800000,-,4.600000,,88.5,88.5,023,NN,FM,5.00,,,,, +25,SEA 25,161.850000,-,4.600000,,88.5,88.5,023,NN,FM,5.00,,,,, +26,SEA 26,161.900000,-,4.600000,,88.5,88.5,023,NN,FM,5.00,,,,, +27,SEA 27,161.950000,-,4.600000,,88.5,88.5,023,NN,FM,5.00,,,,, +28,SEA 28,162.000000,-,4.600000,,88.5,88.5,023,NN,FM,5.00,,,,, +29,SEA 60,160.625000,-,4.600000,,88.5,88.5,023,NN,FM,5.00,,,,, +30,SEA 61,160.675000,-,4.600000,,88.5,88.5,023,NN,FM,5.00,,,,, +31,SEA 62,160.725000,-,4.600000,,88.5,88.5,023,NN,FM,5.00,,,,, +32,SEA 63,160.775000,-,4.600000,,88.5,88.5,023,NN,FM,5.00,,,,, +33,SEA 64,160.825000,-,4.600000,,88.5,88.5,023,NN,FM,5.00,,,,, +34,SEA 65,160.875000,-,4.600000,,88.5,88.5,023,NN,FM,5.00,,,,, +35,SEA 66,160.925000,-,4.600000,,88.5,88.5,023,NN,FM,5.00,,,,, +36,SEA 67,156.375000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, +37,SEA 68,156.425000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, +38,SEA 69,156.475000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, +39,SEA 70,156.525000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, +40,SEA 71,156.575000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, +41,SEA 72,156.625000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, +42,SEA 73,156.675000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, +43,SEA 74,156.725000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, +44,SEA 75,156.775000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, +45,SEA 76,156.825000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, +46,SEA 77,156.875000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, +47,SEA 78,161.525000,-,4.600000,,88.5,88.5,023,NN,FM,5.00,,,,, +48,SEA 79,161.575000,-,4.600000,,88.5,88.5,023,NN,FM,5.00,,,,, +49,SEA 80,161.625000,-,4.600000,,88.5,88.5,023,NN,FM,5.00,,,,, +50,SEA 81,161.675000,-,4.600000,,88.5,88.5,023,NN,FM,5.00,,,,, +51,SEA 82,161.725000,-,4.600000,,88.5,88.5,023,NN,FM,5.00,,,,, +52,SEA 83,161.775000,-,4.600000,,88.5,88.5,023,NN,FM,5.00,,,,, +53,SEA 84,161.825000,-,4.600000,,88.5,88.5,023,NN,FM,5.00,,,,, +54,SEA 85,161.875000,-,4.600000,,88.5,88.5,023,NN,FM,5.00,,,,, +55,SEA 86,161.925000,-,4.600000,,88.5,88.5,023,NN,FM,5.00,,,,, +56,SEA 87,157.375000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, +57,SEA 88,157.425000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, diff --git a/chirp/stock_configs/PL Calling Frequencies and Simplex.csv b/chirp/stock_configs/PL Calling Frequencies and Simplex.csv new file mode 100644 index 0000000..5d22189 --- /dev/null +++ b/chirp/stock_configs/PL Calling Frequencies and Simplex.csv @@ -0,0 +1,51 @@ +Location,Name,Frequency,Duplex,Offset,Tone,rToneFreq,cToneFreq,DtcsCode,DtcsPolarity,RxDtcsCode,CrossMode,Mode,TStep,Skip,Power,Comment,URCALL,RPT1CALL,RPT2CALL,DVCODE +0,VHF SSTV,144.500000,,0.000000,,88.5,88.5,023,NN,023,Tone->Tone,NFM,12.50,,5.0W,[2m] Częstotliwość SSTV,,,, +1,VHF APRS,144.800000,,0.000000,,88.5,88.5,023,NN,023,Tone->Tone,NFM,12.50,,5.0W,[2m] Częstotliwość APRS 2m,,,, +2,VHF WX,144.950000,,0.000000,,88.5,88.5,023,NN,023,Tone->Tone,NFM,12.50,,5.0W,[2m] Częstotliwość pracy stacji pogodowych SR0WX ,,,, +3,VHF CQ,145.375000,,0.000000,,88.5,88.5,023,NN,023,Tone->Tone,NFM,12.50,,5.0W,[2m] Częstotliwość wywoławcza,,,, +4,VHF CQ M,145.500000,,0.000000,,88.5,88.5,023,NN,023,Tone->Tone,NFM,12.50,,5.0W,[2m] Częstotliwość wywoławcza dla stacji mobilnych oraz EMCOM,,,, +5,VHF SOTA,145.550000,,0.000000,,88.5,88.5,023,NN,023,Tone->Tone,NFM,12.50,,5.0W,"[2m] Częstotliwość wywoławcza programów SOTA,POTA oraz podobnych",,,, +7,UHF APRS,432.500000,,0.000000,,88.5,88.5,023,NN,023,Tone->Tone,NFM,12.50,,5.0W,[70cm] Częstotliwość APRS 70cm,,,, +8,UHF CQ,433.450000,,0.000000,,88.5,88.5,023,NN,023,Tone->Tone,NFM,12.50,,5.0W,[70cm] Częstotliwość wywoławcza,,,, +9,UHF CQ M,433.500000,,0.000000,,88.5,88.5,023,NN,023,Tone->Tone,NFM,12.50,,5.0W,[70cm] Częstotliwość wywoławcza dla stacji mobilnych oraz EMCOM,,,, +11,,145.212500,,0.600000,,88.5,88.5,023,NN,023,Tone->Tone,NFM,12.50,,5.0W,[2m] Kanał FM/DV,,,, +12,,145.225000,,0.600000,,88.5,88.5,023,NN,023,Tone->Tone,NFM,12.50,,5.0W,[2m] Kanał FM/DV,,,, +13,,145.250000,,0.600000,,88.5,88.5,023,NN,023,Tone->Tone,NFM,12.50,,5.0W,[2m] Kanał FM/DV,,,, +14,,145.262500,,0.600000,,88.5,88.5,023,NN,023,Tone->Tone,NFM,12.50,,5.0W,[2m] Kanał FM/DV,,,, +15,,145.275000,,0.600000,,88.5,88.5,023,NN,023,Tone->Tone,NFM,12.50,,5.0W,[2m] Kanał FM/DV,,,, +16,,145.300000,,0.600000,,88.5,88.5,023,NN,023,Tone->Tone,NFM,12.50,,5.0W,[2m] Kanał FM/DV,,,, +17,,145.312500,,0.600000,,88.5,88.5,023,NN,023,Tone->Tone,NFM,12.50,,5.0W,[2m] Kanał FM/DV,,,, +18,,145.325000,,0.600000,,88.5,88.5,023,NN,023,Tone->Tone,NFM,12.50,,5.0W,[2m] Kanał FM/DV,,,, +19,,145.350000,,0.600000,,88.5,88.5,023,NN,023,Tone->Tone,NFM,12.50,,5.0W,[2m] Kanał FM/DV,,,, +20,,145.362500,,0.600000,,88.5,88.5,023,NN,023,Tone->Tone,NFM,12.50,,5.0W,[2m] Kanał FM/DV,,,, +21,VHF CQ,145.375000,,0.600000,,88.5,88.5,023,NN,023,Tone->Tone,NFM,12.50,,5.0W,[2m] Częstotliwość wywoławcza,,,, +22,,145.387500,,0.600000,,88.5,88.5,023,NN,023,Tone->Tone,NFM,12.50,,5.0W,[2m] Kanał FM/DV,,,, +23,,145.400000,,0.600000,,88.5,88.5,023,NN,023,Tone->Tone,NFM,12.50,,5.0W,[2m] Kanał FM/DV,,,, +24,,145.412500,,0.600000,,88.5,88.5,023,NN,023,Tone->Tone,NFM,12.50,,5.0W,[2m] Kanał FM/DV,,,, +25,,145.425000,,0.600000,,88.5,88.5,023,NN,023,Tone->Tone,NFM,12.50,,5.0W,[2m] Kanał FM/DV,,,, +26,,145.437500,,0.600000,,88.5,88.5,023,NN,023,Tone->Tone,NFM,12.50,,5.0W,[2m] Kanał FM/DV,,,, +27,,145.450000,,0.600000,,88.5,88.5,023,NN,023,Tone->Tone,NFM,12.50,,5.0W,[2m] Kanał FM/DV,,,, +28,,145.462500,,0.600000,,88.5,88.5,023,NN,023,Tone->Tone,NFM,12.50,,5.0W,[2m] Kanał FM/DV,,,, +29,,145.475000,,0.600000,,88.5,88.5,023,NN,023,Tone->Tone,NFM,12.50,,5.0W,[2m] Kanał FM/DV,,,, +30,,145.487500,,0.600000,,88.5,88.5,023,NN,023,Tone->Tone,NFM,12.50,,5.0W,[2m] Kanał FM/DV,,,, +31,VHF CQ M,145.500000,,0.600000,,88.5,88.5,023,NN,023,Tone->Tone,NFM,12.50,,5.0W,[2m] Częstotliwość wywoławcza dla stacji mobilnych oraz EMCOM,,,, +32,,145.512500,,0.000000,,88.5,88.5,023,NN,023,Tone->Tone,NFM,12.50,,5.0W,[2m] Kanał FM/DV,,,, +33,,145.525000,,0.000000,,88.5,88.5,023,NN,023,Tone->Tone,NFM,12.50,,5.0W,[2m] Kanał FM/DV,,,, +34,,145.537500,,0.000000,,88.5,88.5,023,NN,023,Tone->Tone,NFM,12.50,,5.0W,[2m] Kanał FM/DV,,,, +35,VHF SOTA,145.550000,,0.600000,,88.5,88.5,023,NN,023,Tone->Tone,NFM,12.50,,5.0W,"[2m] Częstotliwość wywoławcza programów SOTA,POTA oraz podobnych",,,, +36,,145.562500,,0.600000,,88.5,88.5,023,NN,023,Tone->Tone,NFM,12.50,,5.0W,[2m] Kanał FM/DV,,,, +38,,433.400000,,0.600000,,88.5,88.5,023,NN,023,Tone->Tone,NFM,12.50,,5.0W,[70cm] Kanał FM/DV,,,, +39,,433.412500,,0.600000,,88.5,88.5,023,NN,023,Tone->Tone,NFM,12.50,,5.0W,[70cm] Kanał FM/DV,,,, +40,,433.425000,,0.600000,,88.5,88.5,023,NN,023,Tone->Tone,NFM,12.50,,5.0W,[70cm] Kanał FM/DV,,,, +41,,433.437500,,0.600000,,88.5,88.5,023,NN,023,Tone->Tone,NFM,12.50,,5.0W,[70cm] Kanał FM/DV,,,, +42,UHF CQ,433.450000,,0.600000,,88.5,88.5,023,NN,023,Tone->Tone,NFM,12.50,,5.0W,[70cm] Częstotliwość wywoławcza,,,, +43,,433.462500,,0.600000,,88.5,88.5,023,NN,023,Tone->Tone,NFM,12.50,,5.0W,[70cm] Kanał FM/DV,,,, +44,,433.475000,,0.600000,,88.5,88.5,023,NN,023,Tone->Tone,NFM,12.50,,5.0W,[70cm] Kanał FM/DV,,,, +45,,433.487500,,0.600000,,88.5,88.5,023,NN,023,Tone->Tone,NFM,12.50,,5.0W,[70cm] Kanał FM/DV,,,, +46,UHF CQ M,433.500000,,0.600000,,88.5,88.5,023,NN,023,Tone->Tone,NFM,12.50,,5.0W,[70cm] Częstotliwość wywoławcza dla stacji mobilnych oraz EMCOM,,,, +47,,433.512500,,0.600000,,88.5,88.5,023,NN,023,Tone->Tone,NFM,12.50,,5.0W,[70cm] Kanał FM/DV,,,, +48,,433.525000,,0.600000,,88.5,88.5,023,NN,023,Tone->Tone,NFM,12.50,,5.0W,[70cm] Kanał FM/DV,,,, +49,,433.537500,,0.600000,,88.5,88.5,023,NN,023,Tone->Tone,NFM,12.50,,5.0W,[70cm] Kanał FM/DV,,,, +50,,433.550000,,0.600000,,88.5,88.5,023,NN,023,Tone->Tone,NFM,12.50,,5.0W,[70cm] Kanał FM/DV,,,, +51,,433.562500,,0.600000,,88.5,88.5,023,NN,023,Tone->Tone,NFM,12.50,,5.0W,[70cm] Kanał FM/DV,,,, +52,,433.575000,,0.600000,,88.5,88.5,023,NN,023,Tone->Tone,NFM,12.50,,5.0W,[70cm] Kanał FM/DV,,,, diff --git a/chirp/stock_configs/SE Jaktradio 155MHz.csv b/chirp/stock_configs/SE Jaktradio 155MHz.csv new file mode 100644 index 0000000..34f47dc --- /dev/null +++ b/chirp/stock_configs/SE Jaktradio 155MHz.csv @@ -0,0 +1,8 @@ +Location,Name,Frequency,Duplex,Offset,Tone,rToneFreq,cToneFreq,DtcsCode,DtcsPolarity,Mode,TStep,Skip,Comment,URCALL,RPT1CALL,RPT2CALL +1,JAKT 1,155.425,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, +2,JAKT 2,155.475,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, +3,JAKT 3,155.500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, +4,JAKT 4,155.525,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, +5,JAKT 5,156.000,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, +6,JAKT 6,156.400,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, +7,JAKT 7,156.450,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, diff --git a/chirp/stock_configs/SE NO KDR444.csv b/chirp/stock_configs/SE NO KDR444.csv new file mode 100644 index 0000000..7ab0e42 --- /dev/null +++ b/chirp/stock_configs/SE NO KDR444.csv @@ -0,0 +1,9 @@ +Location,Name,Frequency,Duplex,Offset,Tone,rToneFreq,cToneFreq,DtcsCode,DtcsPolarity,Mode,TStep,Skip,Comment,URCALL,RPT1CALL,RPT2CALL +1,KDR444 1,444.600,,0.600000,,88.5,88.5,023,NN,NFM,6.25,,,,, +2,KDR444 2,444.650,,0.600000,,88.5,88.5,023,NN,NFM,6.25,,,,, +3,KDR444 3,444.800,,0.600000,,88.5,88.5,023,NN,NFM,6.25,,,,, +4,KDR444 4,444.825,,0.600000,,88.5,88.5,023,NN,NFM,6.25,,,,, +5,KDR444 5,444.850,,0.600000,,88.5,88.5,023,NN,NFM,6.25,,,,, +6,KDR444 6,444.875,,0.600000,,88.5,88.5,023,NN,NFM,6.25,,,,, +7,KDR444 7,444.925,,0.600000,,88.5,88.5,023,NN,NFM,6.25,,,,, +8,KDR444 8,444.975,,0.600000,,88.5,88.5,023,NN,NFM,6.25,,,,, diff --git a/chirp/stock_configs/UK Business Radio Simple Light Frequencies.csv b/chirp/stock_configs/UK Business Radio Simple Light Frequencies.csv new file mode 100644 index 0000000..803995b --- /dev/null +++ b/chirp/stock_configs/UK Business Radio Simple Light Frequencies.csv @@ -0,0 +1,16 @@ +Location,Name,Frequency,Duplex,Offset,Tone,rToneFreq,cToneFreq,DtcsCode,DtcsPolarity,Mode,TStep,Skip,Comment,URCALL,RPT1CALL,RPT2CALL +1,BRSL1,77.687500,,0.000000,,88.5,88.5,023,NN,NFM,12.50,,,,, +2,BRSL2,86.337500,,0.000000,,88.5,88.5,023,NN,NFM,12.50,,,,, +3,BRSL3,86.350000,,0.000000,,88.5,88.5,023,NN,NFM,12.50,,,,, +4,BRSL4,86.362500,,0.000000,,88.5,88.5,023,NN,NFM,12.50,,,,, +5,BRSL5,86.375000,,0.000000,,88.5,88.5,023,NN,NFM,12.50,,,,, +6,BRSL6,164.050000,,0.000000,,88.5,88.5,023,NN,NFM,12.50,,,,, +7,BRSL7,164.062500,,0.000000,,88.5,88.5,023,NN,NFM,12.50,,,,, +8,BRSL8,169.087500,,0.000000,,88.5,88.5,023,NN,NFM,12.50,,,,, +9,BRSL9,169.312500,,0.000000,,88.5,88.5,023,NN,NFM,12.50,,,,, +10,BRSL10,173.050000,,0.000000,,88.5,88.5,023,NN,NFM,12.50,,,,, +11,BRSL11,173.062500,,0.000000,,88.5,88.5,023,NN,NFM,12.50,,,,, +12,BRSL12,173.087500,,0.000000,,88.5,88.5,023,NN,NFM,12.50,,,,, +13,BRSL13,449.312500,,0.000000,,88.5,88.5,023,NN,NFM,12.50,,,,, +14,BRSL14,449.400000,,0.000000,,88.5,88.5,023,NN,NFM,12.50,,,,, +15,BRSL15,449.475000,,0.000000,,88.5,88.5,023,NN,NFM,12.50,,,,, diff --git a/chirp/stock_configs/US 60 meter channels (Center).csv b/chirp/stock_configs/US 60 meter channels (Center).csv new file mode 100644 index 0000000..df22f65 --- /dev/null +++ b/chirp/stock_configs/US 60 meter channels (Center).csv @@ -0,0 +1,6 @@ +Location,Name,Frequency,Duplex,Offset,Tone,rToneFreq,cToneFreq,DtcsCode,DtcsPolarity,Mode,TStep,Skip,Comment,URCALL,RPT1CALL,RPT2CALL +1,60m CH1,5.332000,,0.600000,,88.5,88.5,023,NN,USB,5.00,,,,, +2,60m CH2,5.348000,,0.600000,,88.5,88.5,023,NN,USB,5.00,,,,, +3,60m CH3,5.358500,,0.600000,,88.5,88.5,023,NN,USB,5.00,,,,, +4,60m CH4,5.373000,,0.600000,,88.5,88.5,023,NN,USB,5.00,,,,, +5,60m CH5,5.405000,,0.600000,,88.5,88.5,023,NN,USB,5.00,,,,, diff --git a/chirp/stock_configs/US 60 meter channels (Dial).csv b/chirp/stock_configs/US 60 meter channels (Dial).csv new file mode 100644 index 0000000..ed016f3 --- /dev/null +++ b/chirp/stock_configs/US 60 meter channels (Dial).csv @@ -0,0 +1,6 @@ +Location,Name,Frequency,Duplex,Offset,Tone,rToneFreq,cToneFreq,DtcsCode,DtcsPolarity,Mode,TStep,Skip,Comment,URCALL,RPT1CALL,RPT2CALL +1,60m CH1,5.330500,,0.600000,,88.5,88.5,023,NN,USB,5.00,,,,, +2,60m CH2,5.346500,,0.600000,,88.5,88.5,023,NN,USB,5.00,,,,, +3,60m CH3,5.357000,,0.600000,,88.5,88.5,023,NN,USB,5.00,,,,, +4,60m CH4,5.371500,,0.600000,,88.5,88.5,023,NN,USB,5.00,,,,, +5,60m CH5,5.403500,,0.600000,,88.5,88.5,023,NN,USB,5.00,,,,, diff --git a/chirp/stock_configs/US CA Railroad Channels.csv b/chirp/stock_configs/US CA Railroad Channels.csv new file mode 100644 index 0000000..fe5f4e6 --- /dev/null +++ b/chirp/stock_configs/US CA Railroad Channels.csv @@ -0,0 +1,187 @@ +Location,Name,Frequency,Duplex,Offset,Tone,rToneFreq,cToneFreq,DtcsCode,DtcsPolarity,Mode,Tstep,Skip,Comment,URCALL,RPT1CALL,RPT2CALL +1,AAR002,159.810000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, +2,AAR003,159.930000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, +3,AAR004,160.050000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, +4,AAR005,160.185000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, +5,AAR006,160.200000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, +6,AAR007,160.215000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, +7,AAR008,160.230000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, +8,AAR009,160.245000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, +9,AAR010,160.260000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, +10,AAR011,160.275000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, +11,AAR012,160.290000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, +12,AAR013,160.305000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, +13,AAR014,160.320000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, +14,AAR015,160.335000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, +15,AAR016,160.350000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, +16,AAR017,160.365000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, +17,AAR018,160.380000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, +18,AAR019,160.395000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, +19,AAR020,160.410000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, +20,AAR021,160.425000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, +21,AAR022,160.440000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, +22,AAR023,160.455000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, +23,AAR024,160.470000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, +24,AAR025,160.485000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, +25,AAR026,160.500000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, +26,AAR027,160.515000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, +27,AAR028,160.530000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, +28,AAR029,160.545000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, +29,AAR030,160.560000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, +30,AAR031,160.575000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, +31,AAR032,160.590000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, +32,AAR033,160.605000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, +33,AAR034,160.620000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, +34,AAR035,160.635000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, +35,AAR036,160.650000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, +36,AAR037,160.665000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, +37,AAR038,160.680000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, +38,AAR039,160.695000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, +39,AAR040,160.710000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, +40,AAR041,160.725000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, +41,AAR042,160.740000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, +42,AAR043,160.755000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, +43,AAR044,160.770000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, +44,AAR045,160.785000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, +45,AAR046,160.800000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, +46,AAR047,160.815000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, +47,AAR048,160.830000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, +48,AAR049,160.845000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, +49,AAR050,160.860000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, +50,AAR051,160.875000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, +51,AAR052,160.890000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, +52,AAR053,160.905000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, +53,AAR054,160.920000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, +54,AAR055,160.935000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, +55,AAR056,160.950000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, +56,AAR057,160.965000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, +57,AAR058,160.980000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, +58,AAR059,160.995000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, +59,AAR060,161.010000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, +60,AAR061,161.025000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, +61,AAR062,161.040000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, +62,AAR063,161.055000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, +63,AAR064,161.070000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, +64,AAR065,161.085000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, +65,AAR066,161.100000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, +66,AAR067,161.115000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, +67,AAR068,161.130000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, +68,AAR069,161.145000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, +69,AAR070,161.160000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, +70,AAR071,161.175000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, +71,AAR072,161.190000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, +72,AAR073,161.205000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, +73,AAR074,161.220000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, +74,AAR075,161.235000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, +75,AAR076,161.250000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, +76,AAR077,161.265000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, +77,AAR078,161.280000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, +78,AAR079,161.295000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, +79,AAR080,161.310000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, +80,AAR081,161.325000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, +81,AAR082,161.340000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, +82,AAR083,161.355000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, +83,AAR084,161.370000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, +84,AAR085,161.385000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, +85,AAR086,161.400000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, +86,AAR087,161.415000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, +87,AAR088,161.430000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, +88,AAR089,161.445000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, +89,AAR090,161.460000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, +90,AAR091,161.475000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, +91,AAR092,161.490000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, +92,AAR093,161.505000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, +93,AAR094,161.520000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, +94,AAR095,161.535000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, +95,AAR096,161.550000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, +96,AAR097,161.565000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, +97,AAR107,160.222500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, +98,AAR108,160.237500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, +99,AAR109,160.252500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, +100,AAR110,160.267500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, +101,AAR111,160.282500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, +102,AAR112,160.297500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, +103,AAR113,160.312500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, +104,AAR114,160.327500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, +105,AAR115,160.342500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, +106,AAR116,160.357500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, +107,AAR117,160.372500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, +108,AAR118,160.387500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, +109,AAR119,160.402500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, +110,AAR120,160.417500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, +111,AAR121,160.432500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, +112,AAR122,160.447500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, +113,AAR123,160.462500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, +114,AAR124,160.477500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, +115,AAR125,160.492500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, +116,AAR126,160.507500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, +117,AAR127,160.522500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, +118,AAR128,160.537500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, +119,AAR129,160.552500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, +120,AAR130,160.567500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, +121,AAR131,160.582500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, +122,AAR132,160.597500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, +123,AAR133,160.612500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, +124,AAR134,160.627500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, +125,AAR135,160.642500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, +126,AAR136,160.657500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, +127,AAR137,160.672500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, +128,AAR138,160.687500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, +129,AAR139,160.702500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, +130,AAR140,160.717500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, +131,AAR141,160.732500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, +132,AAR142,160.747500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, +133,AAR143,160.762500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, +134,AAR144,160.777500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, +135,AAR145,160.792500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, +136,AAR146,160.807500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, +137,AAR147,160.822500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, +138,AAR148,160.837500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, +139,AAR149,160.852500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, +140,AAR150,160.867500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, +141,AAR151,160.882500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, +142,AAR152,160.897500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, +143,AAR153,160.912500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, +144,AAR154,160.927500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, +145,AAR155,160.942500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, +146,AAR156,160.957500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, +147,AAR157,160.972500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, +148,AAR158,160.987500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, +149,AAR159,161.002500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, +150,AAR160,161.017500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, +151,AAR161,161.032500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, +152,AAR162,161.047500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, +153,AAR163,161.062500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, +154,AAR164,161.077500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, +155,AAR165,161.092500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, +156,AAR166,161.107500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, +157,AAR167,161.122500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, +158,AAR168,161.137500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, +159,AAR169,161.152500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, +160,AAR170,161.167500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, +161,AAR171,161.182500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, +162,AAR172,161.197500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, +163,AAR173,161.212500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, +164,AAR174,161.227500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, +165,AAR175,161.242500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, +166,AAR176,161.257500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, +167,AAR177,161.272500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, +168,AAR178,161.287500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, +169,AAR179,161.302500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, +170,AAR180,161.317500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, +171,AAR181,161.332500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, +172,AAR182,161.347500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, +173,AAR183,161.362500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, +174,AAR184,161.377500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, +175,AAR185,161.392500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, +176,AAR186,161.407500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, +177,AAR187,161.422500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, +178,AAR188,161.437500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, +179,AAR189,161.452500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, +180,AAR190,161.467500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, +181,AAR191,161.482500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, +182,AAR192,161.497500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, +183,AAR193,161.512500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, +184,AAR194,161.527500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, +185,AAR195,161.542500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, +186,AAR196,161.557500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, diff --git a/chirp/stock_configs/US Calling Frequencies.csv b/chirp/stock_configs/US Calling Frequencies.csv new file mode 100644 index 0000000..d597d86 --- /dev/null +++ b/chirp/stock_configs/US Calling Frequencies.csv @@ -0,0 +1,5 @@ +Location,Name,Frequency,Duplex,Offset,Tone,rToneFreq,cToneFreq,DtcsCode,DtcsPolarity,Mode,TStep,Skip,Comment,URCALL,RPT1CALL,RPT2CALL +1,6m Call,52.525000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, +2,2m Call,146.520000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, +3,220 Call,223.500000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, +4,70cm Call,446.000000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, diff --git a/chirp/stock_configs/US FRS and GMRS Channels.csv b/chirp/stock_configs/US FRS and GMRS Channels.csv new file mode 100644 index 0000000..76a58ac --- /dev/null +++ b/chirp/stock_configs/US FRS and GMRS Channels.csv @@ -0,0 +1,53 @@ +Location,Name,Frequency,Duplex,Offset,Tone,rToneFreq,cToneFreq,DtcsCode,DtcsPolarity,Mode,TStep,Skip,Comment,URCALL,RPT1CALL,RPT2CALL +1,FRS 1,462.562500,,5.000000,,88.5,88.5,023,NN,NFM,12.50,,,,, +2,FRS 2,462.587500,,5.000000,,88.5,88.5,023,NN,NFM,12.50,,,,, +3,FRS 3,462.612500,,5.000000,,88.5,88.5,023,NN,NFM,12.50,,,,, +4,FRS 4,462.637500,,5.000000,,88.5,88.5,023,NN,NFM,12.50,,,,, +5,FRS 5,462.662500,,5.000000,,88.5,88.5,023,NN,NFM,12.50,,,,, +6,FRS 6,462.687500,,5.000000,,88.5,88.5,023,NN,NFM,12.50,,,,, +7,FRS 7,462.712500,,5.000000,,88.5,88.5,023,NN,NFM,12.50,,,,, +8,FRS 8,467.562500,,5.000000,,88.5,88.5,023,NN,NFM,12.50,,,,, +9,FRS 9,467.587500,,5.000000,,88.5,88.5,023,NN,NFM,12.50,,,,, +10,FRS 10,467.612500,,5.000000,,88.5,88.5,023,NN,NFM,12.50,,,,, +11,FRS 11,467.637500,,5.000000,,88.5,88.5,023,NN,NFM,12.50,,,,, +12,FRS 12,467.662500,,5.000000,,88.5,88.5,023,NN,NFM,12.50,,,,, +13,FRS 13,467.687500,,5.000000,,88.5,88.5,023,NN,NFM,12.50,,,,, +14,FRS 14,467.712500,,5.000000,,88.5,88.5,023,NN,NFM,12.50,,,,, +15,FRS 15,462.550000,,5.000000,,88.5,88.5,023,NN,NFM,12.50,,,,, +16,FRS 16,462.575000,,5.000000,,88.5,88.5,023,NN,NFM,12.50,,,,, +17,FRS 17,462.600000,,5.000000,,88.5,88.5,023,NN,NFM,12.50,,,,, +18,FRS 18,462.625000,,5.000000,,88.5,88.5,023,NN,NFM,12.50,,,,, +19,FRS 19,462.650000,,5.000000,,88.5,88.5,023,NN,NFM,12.50,,,,, +20,FRS 20,462.675000,,5.000000,,88.5,88.5,023,NN,NFM,12.50,,,,, +21,FRS 21,462.700000,,5.000000,,88.5,88.5,023,NN,NFM,12.50,,,,, +22,FRS 22,462.725000,,5.000000,,88.5,88.5,023,NN,NFM,12.50,,,,, +23,GMRS 1,462.562500,,5.000000,,88.5,88.5,023,NN,FM,12.50,,,,, +24,GMRS 2,462.587500,,5.000000,,88.5,88.5,023,NN,FM,12.50,,,,, +25,GMRS 3,462.612500,,5.000000,,88.5,88.5,023,NN,FM,12.50,,,,, +26,GMRS 4,462.637500,,5.000000,,88.5,88.5,023,NN,FM,12.50,,,,, +27,GMRS 5,462.662500,,5.000000,,88.5,88.5,023,NN,FM,12.50,,,,, +28,GMRS 6,462.687500,,5.000000,,88.5,88.5,023,NN,FM,12.50,,,,, +29,GMRS 7,462.712500,,5.000000,,88.5,88.5,023,NN,FM,12.50,,,,, +30,GMRS 8,467.562500,,5.000000,,88.5,88.5,023,NN,NFM,12.50,,,,, +31,GMRS 9,467.587500,,5.000000,,88.5,88.5,023,NN,NFM,12.50,,,,, +32,GMRS 10,467.612500,,5.000000,,88.5,88.5,023,NN,NFM,12.50,,,,, +33,GMRS 11,467.637500,,5.000000,,88.5,88.5,023,NN,NFM,12.50,,,,, +34,GMRS 12,467.662500,,5.000000,,88.5,88.5,023,NN,NFM,12.50,,,,, +35,GMRS 13,467.687500,,5.000000,,88.5,88.5,023,NN,NFM,12.50,,,,, +36,GMRS 14,467.712500,,5.000000,,88.5,88.5,023,NN,NFM,12.50,,,,, +37,GMRS 15,462.550000,,5.000000,,88.5,88.5,023,NN,FM,12.50,,,,, +38,GMRS 16,462.575000,,5.000000,,88.5,88.5,023,NN,FM,12.50,,,,, +39,GMRS 17,462.600000,,5.000000,,88.5,88.5,023,NN,FM,12.50,,,,, +40,GMRS 18,462.625000,,5.000000,,88.5,88.5,023,NN,FM,12.50,,,,, +41,GMRS 19,462.650000,,5.000000,,88.5,88.5,023,NN,FM,12.50,,,,, +42,GMRS 20,462.675000,,5.000000,,88.5,88.5,023,NN,FM,12.50,,,,, +43,GMRS 21,462.700000,,5.000000,,88.5,88.5,023,NN,FM,12.50,,,,, +44,GMRS 22,462.725000,,5.000000,,88.5,88.5,023,NN,FM,12.50,,,,, +45,GMRS 550/15R,462.550000,+,5.000000,,88.5,88.5,023,NN,FM,12.50,,,,, +46,GMRS 575/16R,462.575000,+,5.000000,,88.5,88.5,023,NN,FM,12.50,,,,, +47,GMRS 600/17R,462.600000,+,5.000000,,88.5,88.5,023,NN,FM,12.50,,,,, +48,GMRS 625/18R,462.625000,+,5.000000,,88.5,88.5,023,NN,FM,12.50,,,,, +49,GMRS 650/19R,462.650000,+,5.000000,,88.5,88.5,023,NN,FM,12.50,,,,, +50,GMRS 675/20R,462.675000,+,5.000000,,88.5,88.5,023,NN,FM,12.50,,,,, +51,GMRS 700/21R,462.700000,+,5.000000,,88.5,88.5,023,NN,FM,12.50,,,,, +52,GMRS 725/22R,462.725000,+,5.000000,,88.5,88.5,023,NN,FM,12.50,,,,, diff --git a/chirp/stock_configs/US MURS Channels.csv b/chirp/stock_configs/US MURS Channels.csv new file mode 100644 index 0000000..e6fed17 --- /dev/null +++ b/chirp/stock_configs/US MURS Channels.csv @@ -0,0 +1,6 @@ +Location,Name,Frequency,Duplex,Offset,Tone,rToneFreq,cToneFreq,DtcsCode,DtcsPolarity,Mode,TStep,Skip,Comment,URCALL,RPT1CALL,RPT2CALL +1,MURS 1,151.820000,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, +2,MURS 2,151.880000,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, +3,MURS 3,151.940000,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, +4,Blue Dot,154.570000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, +5,Green Dot,154.600000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, diff --git a/chirp/stock_configs/US Marine VHF Channels.csv b/chirp/stock_configs/US Marine VHF Channels.csv new file mode 100644 index 0000000..21a6f79 --- /dev/null +++ b/chirp/stock_configs/US Marine VHF Channels.csv @@ -0,0 +1,61 @@ +Location,Name,Frequency,Duplex,Offset,Tone,rToneFreq,cToneFreq,DtcsCode,DtcsPolarity,Mode,TStep,Skip,Comment,URCALL,RPT1CALL,RPT2CALL +1,SEA 01,160.650000,-,4.600000,,88.5,88.5,023,NN,FM,25.00,,,,, +2,SEA 02,160.700000,-,4.600000,,88.5,88.5,023,NN,FM,25.00,,,,, +3,SEA 03,160.750000,-,4.600000,,88.5,88.5,023,NN,FM,25.00,,,,, +4,SEA 04,160.800000,-,4.600000,,88.5,88.5,023,NN,FM,25.00,,,,, +5,SEA 05,160.850000,-,4.600000,,88.5,88.5,023,NN,FM,25.00,,,,, +6,SEA 06,156.300000,,0.000000,,88.5,88.5,023,NN,FM,25.00,,,,, +7,SEA 07,160.950000,-,4.600000,,88.5,88.5,023,NN,FM,25.00,,,,, +8,SEA 08,156.400000,,0.000000,,88.5,88.5,023,NN,FM,25.00,,,,, +9,SEA 09,156.450000,,0.000000,,88.5,88.5,023,NN,FM,25.00,,,,, +10,SEA 10,156.500000,,0.000000,,88.5,88.5,023,NN,FM,25.00,,,,, +11,SEA 11,156.550000,,0.000000,,88.5,88.5,023,NN,FM,25.00,,,,, +12,SEA 12,156.600000,,0.000000,,88.5,88.5,023,NN,FM,25.00,,,,, +13,SEA 13,156.650000,,0.000000,,88.5,88.5,023,NN,FM,25.00,,,,, +14,SEA 14,156.700000,,0.000000,,88.5,88.5,023,NN,FM,25.00,,,,, +15,SEA 15,156.750000,,0.000000,,88.5,88.5,023,NN,FM,25.00,,,,, +16,SEA 16,156.800000,,0.000000,,88.5,88.5,023,NN,FM,25.00,,,,, +17,SEA 17,156.850000,,0.000000,,88.5,88.5,023,NN,FM,25.00,,,,, +18,SEA 18,161.500000,-,4.600000,,88.5,88.5,023,NN,FM,25.00,,,,, +19,SEA 19,161.550000,-,4.600000,,88.5,88.5,023,NN,FM,25.00,,,,, +20,SEA 20,161.600000,-,4.600000,,88.5,88.5,023,NN,FM,25.00,,,,, +21,SEA 21,161.650000,-,4.600000,,88.5,88.5,023,NN,FM,25.00,,,,, +22,SEA 22,161.700000,-,4.600000,,88.5,88.5,023,NN,FM,25.00,,,,, +23,SEA 23,161.750000,-,4.600000,,88.5,88.5,023,NN,FM,25.00,,,,, +24,SEA 24,161.800000,-,4.600000,,88.5,88.5,023,NN,FM,25.00,,,,, +25,SEA 25,161.850000,-,4.600000,,88.5,88.5,023,NN,FM,25.00,,,,, +26,SEA 26,161.900000,-,4.600000,,88.5,88.5,023,NN,FM,25.00,,,,, +27,SEA 27,161.950000,-,4.600000,,88.5,88.5,023,NN,FM,25.00,,,,, +28,SEA 28,162.000000,-,4.600000,,88.5,88.5,023,NN,FM,25.00,,,,, +29,SEA 60,160.625000,-,4.600000,,88.5,88.5,023,NN,FM,25.00,,,,, +30,SEA 61,160.675000,-,4.600000,,88.5,88.5,023,NN,FM,25.00,,,,, +31,SEA 62,160.725000,-,4.600000,,88.5,88.5,023,NN,FM,25.00,,,,, +32,SEA 63,160.775000,-,4.600000,,88.5,88.5,023,NN,FM,25.00,,,,, +33,SEA 64,160.825000,-,4.600000,,88.5,88.5,023,NN,FM,25.00,,,,, +34,SEA 65,160.875000,-,4.600000,,88.5,88.5,023,NN,FM,25.00,,,,, +35,SEA 66,160.925000,-,4.600000,,88.5,88.5,023,NN,FM,25.00,,,,, +36,SEA 67,156.375000,,0.000000,,88.5,88.5,023,NN,FM,25.00,,,,, +37,SEA 68,156.425000,,0.000000,,88.5,88.5,023,NN,FM,25.00,,,,, +38,SEA 69,156.475000,,0.000000,,88.5,88.5,023,NN,FM,25.00,,,,, +39,DSC 70,156.525000,,0.000000,,88.5,88.5,023,NN,FM,25.00,,,,, +40,SEA 71,156.575000,,0.000000,,88.5,88.5,023,NN,FM,25.00,,,,, +41,SEA 72,156.625000,,0.000000,,88.5,88.5,023,NN,FM,25.00,,,,, +42,SEA 73,156.675000,,0.000000,,88.5,88.5,023,NN,FM,25.00,,,,, +43,SEA 74,156.725000,,0.000000,,88.5,88.5,023,NN,FM,25.00,,,,, +44,SEA 77,156.875000,,0.000000,,88.5,88.5,023,NN,FM,25.00,,,,, +45,SEA 78,161.525000,-,4.600000,,88.5,88.5,023,NN,FM,25.00,,,,, +46,SEA 79,161.575000,-,4.600000,,88.5,88.5,023,NN,FM,25.00,,,,, +47,SEA 80,161.625000,-,4.600000,,88.5,88.5,023,NN,FM,25.00,,,,, +48,SEA 81,161.675000,-,4.600000,,88.5,88.5,023,NN,FM,25.00,,,,, +49,SEA 82,161.725000,-,4.600000,,88.5,88.5,023,NN,FM,25.00,,,,, +50,SEA 83,161.775000,-,4.600000,,88.5,88.5,023,NN,FM,25.00,,,,, +51,SEA 84,161.825000,-,4.600000,,88.5,88.5,023,NN,FM,25.00,,,,, +52,SEA 85,161.875000,-,4.600000,,88.5,88.5,023,NN,FM,25.00,,,,, +53,SEA 86,161.925000,-,4.600000,,88.5,88.5,023,NN,FM,25.00,,,,, +54,AIS 87,161.975000,-,4.600000,,88.5,88.5,023,NN,FM,25.00,,,,, +55,AIS 88,162.025000,-,4.600000,,88.5,88.5,023,NN,FM,25.00,,,,, +56,SEA F1,155.625000,,0.000000,,88.5,88.5,023,NN,FM,25.00,,,,, +57,SEA F2,155.775000,,0.000000,,88.5,88.5,023,NN,FM,25.00,,,,, +58,SEA F3,155.825000,,0.000000,,88.5,88.5,023,NN,FM,25.00,,,,, +59,SEA L1,155.500000,,0.000000,,88.5,88.5,023,NN,FM,25.00,,,,, +60,SEA L2,155.525000,,0.000000,,88.5,88.5,023,NN,FM,25.00,,,,, diff --git a/chirp/stock_configs/US NOAA Weather Alert.csv b/chirp/stock_configs/US NOAA Weather Alert.csv new file mode 100644 index 0000000..d3abd65 --- /dev/null +++ b/chirp/stock_configs/US NOAA Weather Alert.csv @@ -0,0 +1,11 @@ +Location,Name,Frequency,Duplex,Offset,Tone,rToneFreq,cToneFreq,DtcsCode,DtcsPolarity,Mode,TStep,Skip,Comment,URCALL,RPT1CALL,RPT2CALL +1,WX1PA7,162.550000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, +2,WX2PA1,162.400000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, +3,WX3PA4,162.475000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, +4,WX4PA2,162.425000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, +5,WX5PA3,162.450000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, +6,WX6PA5,162.500000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, +7,WX7PA6,162.525000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, +8,WX8,161.650000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, +9,WX9,161.775000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, +10,WX10,163.275000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, diff --git a/chirp/ui/__init__.py b/chirp/ui/__init__.py deleted file mode 100644 index a2a6f35..0000000 --- a/chirp/ui/__init__.py +++ /dev/null @@ -1,14 +0,0 @@ -# Copyright 2008 Dan Smith -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . diff --git a/chirp/ui/bandplans.py b/chirp/ui/bandplans.py deleted file mode 100644 index f5d204c..0000000 --- a/chirp/ui/bandplans.py +++ /dev/null @@ -1,51 +0,0 @@ -# Copyright 2013 Sean Burford -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -import gtk -import logging -from chirp import bandplan, bandplan_na, bandplan_au -from chirp import bandplan_iaru_r1, bandplan_iaru_r2, bandplan_iaru_r3 -from chirp.ui import inputdialog - -LOG = logging.getLogger(__name__) - - -def select_bandplan(bandplans, parent_window): - plans = ["None"] - for shortname, details in bandplans.plans.iteritems(): - if bandplans._config.get_bool(shortname, "bandplan"): - plans.insert(0, details[0]) - else: - plans.append(details[0]) - - d = inputdialog.ChoiceDialog(plans, parent=parent_window, - title="Choose Defaults") - d.label.set_text(_("Band plans define default channel settings for " - "frequencies in a region. Choose a band plan " - "or None for completely manual channel " - "settings.")) - d.label.set_line_wrap(True) - r = d.run() - - if r == gtk.RESPONSE_OK: - selection = d.choice.get_active_text() - for shortname, details in bandplans.plans.iteritems(): - bandplans._config.set_bool(shortname, selection == details[0], - "bandplan") - if selection == details[0]: - LOG.info("Selected band plan %s: %s" % - (shortname, selection)) - - d.destroy() diff --git a/chirp/ui/bankedit.py b/chirp/ui/bankedit.py deleted file mode 100644 index 339a42c..0000000 --- a/chirp/ui/bankedit.py +++ /dev/null @@ -1,419 +0,0 @@ -# Copyright 2008 Dan Smith -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -import gtk -import gobject -import time -import logging - -from gobject import TYPE_INT, TYPE_STRING, TYPE_BOOLEAN - -from chirp import chirp_common -from chirp.ui import common, miscwidgets - -LOG = logging.getLogger(__name__) - - -class MappingNamesJob(common.RadioJob): - def __init__(self, model, editor, cb): - common.RadioJob.__init__(self, cb, None) - self.__model = model - self.__editor = editor - - def execute(self, radio): - self.__editor.mappings = [] - - mappings = self.__model.get_mappings() - for mapping in mappings: - self.__editor.mappings.append((mapping, mapping.get_name())) - - gobject.idle_add(self.cb, *self.cb_args) - - -class MappingNameEditor(common.Editor): - def refresh(self): - def got_mappings(): - self._keys = [] - for mapping, name in self.mappings: - self._keys.append(mapping.get_index()) - self.listw.set_item(mapping.get_index(), - mapping.get_index(), - name) - - self.listw.connect("item-set", self.mapping_changed) - - job = MappingNamesJob(self._model, self, got_mappings) - job.set_desc(_("Retrieving %s information") % self._type) - self.rthread.submit(job) - - def get_mapping_list(self): - mappings = [] - keys = self.listw.get_keys() - for key in keys: - mappings.append(self.listw.get_item(key)[2]) - - return mappings - - def mapping_changed(self, listw, key): - def cb(*args): - self.emit("changed") - - name = self.listw.get_item(key)[2] - mapping, oldname = self.mappings[self._keys.index(key)] - - def trigger_changed(*args): - self.emit("changed") - - job = common.RadioJob(trigger_changed, "set_name", name) - job.set_target(mapping) - job.set_desc(_("Setting name on %s") % self._type.lower()) - self.rthread.submit(job) - - return True - - def __init__(self, rthread, model): - super(MappingNameEditor, self).__init__(rthread) - self._model = model - self._type = common.unpluralize(model.get_name()) - - types = [(gobject.TYPE_STRING, "key"), - (gobject.TYPE_STRING, self._type), - (gobject.TYPE_STRING, _("Name"))] - - self.listw = miscwidgets.KeyedListWidget(types) - self.listw.set_editable(1, True) - self.listw.set_sort_column(0, 1) - self.listw.set_sort_column(1, -1) - self.listw.show() - - self.mappings = [] - - sw = gtk.ScrolledWindow() - sw.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) - sw.add_with_viewport(self.listw) - - self.root = sw - self._loaded = False - - def focus(self): - if self._loaded: - return - - self.refresh() - self._loaded = True - - def other_editor_changed(self, target_editor): - self._loaded = False - if self.is_focused(): - self.refresh_all_memories() - - def mappings_changed(self): - pass - - -class MemoryMappingsJob(common.RadioJob): - def __init__(self, model, cb, number): - common.RadioJob.__init__(self, cb, None) - self.__model = model - self.__number = number - - def execute(self, radio): - mem = radio.get_memory(self.__number) - if mem.empty: - mappings = [] - indexes = [] - else: - mappings = self.__model.get_memory_mappings(mem) - indexes = [] - if isinstance(self.__model, - chirp_common.MappingModelIndexInterface): - for mapping in mappings: - indexes.append(self.__model.get_memory_index(mem, mapping)) - self.cb(mem, mappings, indexes, *self.cb_args) - - -class MappingMembershipEditor(common.Editor): - def _number_to_path(self, number): - return (number - self._rf.memory_bounds[0],) - - def _get_next_mapping_index(self, mapping): - # NB: Only works for one-to-one models right now! - iter = self._store.get_iter_first() - indexes = [] - ncols = len(self._cols) + len(self.mappings) - while iter: - vals = self._store.get(iter, *tuple([n for n in range(0, ncols)])) - loc = vals[self.C_LOC] - index = vals[self.C_INDEX] - mappings = vals[self.C_MAPPINGS:] - if True in mappings and mappings.index(True) == mapping: - indexes.append(index) - iter = self._store.iter_next(iter) - - index_bounds = self._model.get_index_bounds() - num_indexes = index_bounds[1] - index_bounds[0] - indexes.sort() - for i in range(0, num_indexes): - if i not in indexes: - return i + index_bounds[0] # In case not zero-origin index - - return 0 # If the mapping is full, just wrap around! - - def _toggled_cb(self, rend, path, colnum): - try: - if not rend.get_sensitive(): - return - except AttributeError: - # support PyGTK < 2.22 - iter = self._store.get_iter(path) - if not self._store.get(iter, self.C_FILLED)[0]: - return - - # The mapping index is the column number, minus the 3 label columns - mapping, name = self.mappings[colnum - len(self._cols)] - loc, = self._store.get(self._store.get_iter(path), self.C_LOC) - - is_indexed = isinstance(self._model, - chirp_common.MappingModelIndexInterface) - - if rend.get_active(): - # Changing from True to False - fn = "remove_memory_from_mapping" - index = None - else: - # Changing from False to True - fn = "add_memory_to_mapping" - if is_indexed: - index = self._get_next_mapping_index(colnum - len(self._cols)) - else: - index = None - - def do_refresh_memory(*args): - # Step 2: Update our notion of the memory's mapping information - self.refresh_memory(loc) - - def do_mapping_index(result, memory): - if isinstance(result, Exception): - common.show_error("Failed to add {mem} to mapping: {err}" - .format(mem=memory.number, - err=str(result)), - parent=self.editorset.parent_window) - return - self.emit("changed") - # Step 3: Set the memory's mapping index (maybe) - if not is_indexed or index is None: - return do_refresh_memory() - - job = common.RadioJob(do_refresh_memory, - "set_memory_index", memory, mapping, index) - job.set_target(self._model) - job.set_desc(_("Updating {type} index " - "for memory {num}").format(type=self._type, - num=memory.number)) - self.rthread.submit(job) - - def do_mapping_adjustment(memory): - # Step 1: Do the mapping add/remove - job = common.RadioJob(do_mapping_index, fn, memory, mapping) - job.set_target(self._model) - job.set_cb_args(memory) - job.set_desc(_("Updating mapping information " - "for memory {num}").format(num=memory.number)) - self.rthread.submit(job) - - # Step 0: Fetch the memory - job = common.RadioJob(do_mapping_adjustment, "get_memory", loc) - job.set_desc(_("Getting memory {num}").format(num=loc)) - self.rthread.submit(job) - - def _index_edited_cb(self, rend, path, new): - loc, = self._store.get(self._store.get_iter(path), self.C_LOC) - - def refresh_memory(*args): - self.refresh_memory(loc) - - def set_index(mappings, memory): - self.emit("changed") - # Step 2: Set the index - job = common.RadioJob(refresh_memory, "set_memory_index", - memory, mappings[0], int(new)) - job.set_target(self._model) - job.set_desc(_("Setting index " - "for memory {num}").format(num=memory.number)) - self.rthread.submit(job) - - def get_mapping(memory): - # Step 1: Get the first/only mapping - job = common.RadioJob(set_index, "get_memory_mappings", memory) - job.set_cb_args(memory) - job.set_target(self._model) - job.set_desc(_("Getting {type} for " - "memory {num}").format(type=self._type, - num=memory.number)) - self.rthread.submit(job) - - # Step 0: Get the memory - job = common.RadioJob(get_mapping, "get_memory", loc) - job.set_desc(_("Getting memory {num}").format(num=loc)) - self.rthread.submit(job) - - def __init__(self, rthread, editorset, model): - super(MappingMembershipEditor, self).__init__(rthread) - - self.editorset = editorset - self._rf = rthread.radio.get_features() - self._model = model - self._type = common.unpluralize(model.get_name()) - - self._view_cols = [ - (_("Loc"), TYPE_INT, gtk.CellRendererText, ), - (_("Frequency"), TYPE_STRING, gtk.CellRendererText, ), - (_("Name"), TYPE_STRING, gtk.CellRendererText, ), - (_("Index"), TYPE_INT, gtk.CellRendererText, ), - ] - - self._cols = [ - ("_filled", TYPE_BOOLEAN, None, ), - ] + self._view_cols - - self.C_FILLED = 0 - self.C_LOC = 1 - self.C_FREQ = 2 - self.C_NAME = 3 - self.C_INDEX = 4 - self.C_MAPPINGS = 5 # and beyond - - cols = list(self._cols) - - self._index_cache = [] - - for i in range(0, self._model.get_num_mappings()): - label = "%s %i" % (self._type, (i+1)) - cols.append((label, TYPE_BOOLEAN, gtk.CellRendererToggle)) - - self._store = gtk.ListStore(*tuple([y for x, y, z in cols])) - self._view = gtk.TreeView(self._store) - - is_indexed = isinstance(self._model, - chirp_common.MappingModelIndexInterface) - - colnum = 0 - for label, dtype, rtype in cols: - if not rtype: - colnum += 1 - continue - rend = rtype() - if dtype == TYPE_BOOLEAN: - rend.set_property("activatable", True) - rend.connect("toggled", self._toggled_cb, colnum) - col = gtk.TreeViewColumn(label, rend, active=colnum, - sensitive=self.C_FILLED) - else: - col = gtk.TreeViewColumn(label, rend, text=colnum, - sensitive=self.C_FILLED) - - self._view.append_column(col) - col.set_resizable(True) - if colnum == self.C_NAME: - col.set_visible(self._rf.has_name) - elif colnum == self.C_INDEX: - rend.set_property("editable", True) - rend.connect("edited", self._index_edited_cb) - col.set_visible(is_indexed) - colnum += 1 - - # A non-rendered column to absorb extra space in the row - self._view.append_column(gtk.TreeViewColumn()) - - sw = gtk.ScrolledWindow() - sw.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) - sw.add(self._view) - self._view.show() - - (min, max) = self._rf.memory_bounds - for i in range(min, max+1): - iter = self._store.append() - self._store.set(iter, - self.C_FILLED, False, - self.C_LOC, i, - self.C_FREQ, "", - self.C_NAME, "", - self.C_INDEX, 0) - - self.root = sw - self._loaded = False - - def refresh_memory(self, number): - def got_mem(memory, mappings, indexes): - iter = self._store.get_iter(self._number_to_path(memory.number)) - row = [self.C_FILLED, not memory.empty, - self.C_LOC, memory.number, - self.C_FREQ, chirp_common.format_freq(memory.freq), - self.C_NAME, memory.name, - # Hack for only one index right now - self.C_INDEX, indexes and indexes[0] or 0, - ] - for i in range(0, len(self.mappings)): - row.append(i + len(self._cols)) - row.append(self.mappings[i][0] in mappings) - - self._store.set(iter, *tuple(row)) - - job = MemoryMappingsJob(self._model, got_mem, number) - job.set_desc(_("Getting {type} information " - "for memory {num}").format(type=self._type, num=number)) - self.rthread.submit(job) - - def refresh_all_memories(self): - start = time.time() - (min, max) = self._rf.memory_bounds - for i in range(min, max+1): - self.refresh_memory(i) - LOG.debug("Got all %s info in %s" % - (self._type, (time.time() - start))) - - def refresh_mappings(self, and_memories=False): - def got_mappings(): - for i in range(len(self._cols) - len(self._view_cols) - 1, - len(self.mappings)): - col = self._view.get_column(i + len(self._view_cols)) - mapping, name = self.mappings[i] - if name: - col.set_title(name) - else: - col.set_title("(%s)" % i) - if and_memories: - self.refresh_all_memories() - - job = MappingNamesJob(self._model, self, got_mappings) - job.set_desc(_("Getting %s information") % self._type) - self.rthread.submit(job) - - def focus(self): - common.Editor.focus(self) - if self._loaded: - return - - self.refresh_mappings(True) - - self._loaded = True - - def other_editor_changed(self, target_editor): - self._loaded = False - if self.is_focused(): - self.refresh_all_memories() - - def mappings_changed(self): - self.refresh_mappings() diff --git a/chirp/ui/clone.py b/chirp/ui/clone.py deleted file mode 100644 index aea00c2..0000000 --- a/chirp/ui/clone.py +++ /dev/null @@ -1,277 +0,0 @@ -# Copyright 2008 Dan Smith -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -import collections -import threading -import logging -import os - -import gtk -import gobject - -from chirp import platform, directory, detect, chirp_common -from chirp.ui import miscwidgets, cloneprog, inputdialog, common, config - -LOG = logging.getLogger(__name__) - -AUTO_DETECT_STRING = "Auto Detect (Icom Only)" - - -class CloneSettings: - def __init__(self): - self.port = None - self.radio_class = None - - def __str__(self): - s = "" - if self.radio_class: - return _("{vendor} {model} on {port}").format( - vendor=self.radio_class.VENDOR, - model=self.radio_class.MODEL, - port=self.port) - - -class CloneSettingsDialog(gtk.Dialog): - def __make_field(self, label, widget): - l = gtk.Label(label + ":") - l.set_alignment(1.0, 0.5) - self.__table.attach(l, 0, 1, self.__row, self.__row+1) - self.__table.attach(widget, 1, 2, self.__row, self.__row+1) - self.__row += 1 - - l.show() - widget.show() - - def __make_port(self, port): - conf = config.get("state") - - ports = platform.get_platform().list_serial_ports() - if not port: - if conf.get("last_port"): - port = conf.get("last_port") - elif ports: - port = ports[0] - else: - port = "" - if port not in ports: - ports.insert(0, port) - - return miscwidgets.make_choice(ports, True, port) - - def __make_model(self): - return miscwidgets.make_choice([], False) - - def __make_vendor(self, modelbox): - vendors = collections.defaultdict(list) - for name, rclass in sorted(directory.DRV_TO_RADIO.items()): - if not issubclass(rclass, chirp_common.CloneModeRadio) and \ - not issubclass(rclass, chirp_common.LiveRadio): - continue - - vendors[rclass.VENDOR].append(rclass) - for alias in rclass.ALIASES: - vendors[alias.VENDOR].append(alias) - - self.__vendors = vendors - - conf = config.get("state") - if not conf.get("last_vendor"): - conf.set("last_vendor", sorted(vendors.keys())[0]) - - last_vendor = conf.get("last_vendor") - if last_vendor not in list(vendors.keys()): - last_vendor = list(vendors.keys())[0] - - v = miscwidgets.make_choice(sorted(vendors.keys()), False, last_vendor) - - def _changed(box, vendors, boxes): - (vendorbox, modelbox) = boxes - models = vendors[vendorbox.value] - - added_models = [] - - model_store = modelbox.get_model() - model_store.clear() - for rclass in sorted(models, key=lambda c: c.MODEL): - if rclass.MODEL not in added_models: - model_store.append([rclass.MODEL]) - added_models.append(rclass.MODEL) - - if vendorbox.value in detect.DETECT_FUNCTIONS: - model_store.append([_("Detect")]) - added_models.insert(0, _("Detect")) - - model_names = [x.MODEL for x in models] - if conf.get("last_model") in model_names: - modelbox.value = conf.get("last_model") - elif added_models: - modelbox.value = added_models[0] - - v.widget.connect("changed", _changed, vendors, (v, modelbox)) - _changed(v, vendors, (v, modelbox)) - - return v - - def __make_ui(self, settings): - self.__table = gtk.Table(3, 2) - self.__table.set_row_spacings(3) - self.__table.set_col_spacings(10) - self.__row = 0 - - self.__port = self.__make_port(settings and settings.port or None) - self.__modl = self.__make_model() - self.__vend = self.__make_vendor(self.__modl) - - self.__make_field(_("Port"), self.__port.widget) - self.__make_field(_("Vendor"), self.__vend.widget) - self.__make_field(_("Model"), self.__modl.widget) - - if settings and settings.radio_class: - self.__vend.value = settings.radio_class.VENDOR - self.__modl.value = settings.radio_class.MODEL - self.__vend.widget.set_sensitive(False) - self.__modl.widget.set_sensitive(False) - - self.__table.show() - self.vbox.pack_start(self.__table, 1, 1, 1) - - def __init__(self, settings=None, parent=None, title=_("Radio")): - buttons = (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, - gtk.STOCK_OK, gtk.RESPONSE_OK) - gtk.Dialog.__init__(self, title, - parent=parent, - buttons=buttons, - flags=gtk.DIALOG_MODAL) - self.set_default_response(gtk.RESPONSE_OK) - self.set_alternative_button_order([gtk.RESPONSE_OK, - gtk.RESPONSE_CANCEL]) - self.__make_ui(settings) - - def run(self): - r = gtk.Dialog.run(self) - if r != gtk.RESPONSE_OK: - return None - - vendor = self.__vend.value - model = self.__modl.value - - cs = CloneSettings() - cs.port = self.__port.value - if model == _("Detect"): - try: - cs.radio_class = detect.DETECT_FUNCTIONS[vendor](cs.port) - if not cs.radio_class: - raise Exception( - _("Unable to detect radio on {port}").format( - port=cs.port)) - except Exception as e: - d = inputdialog.ExceptionDialog(e) - d.run() - d.destroy() - return None - else: - for rclass in list(directory.DRV_TO_RADIO.values()): - if rclass.MODEL == model: - cs.radio_class = rclass - break - alias_match = None - for alias in rclass.ALIASES: - if alias.MODEL == model: - alias_match = rclass - alias_class = alias - break - if alias_match: - - class DynamicRadioAlias(rclass): - VENDOR = alias.VENDOR - MODEL = alias.MODEL - VARIANT = alias.VARIANT - - cs.radio_class = DynamicRadioAlias - LOG.debug( - 'Chose %s alias for %s because model %s selected' % ( - alias_match, cs.radio_class, model)) - break - if not cs.radio_class: - common.show_error( - _("Internal error: Unable to upload to {model}").format( - model=model)) - LOG.info(self.__vendors) - return None - - conf = config.get("state") - conf.set("last_port", cs.port) - conf.set("last_vendor", cs.radio_class.VENDOR) - conf.set("last_model", model) - - return cs - - -class CloneCancelledException(Exception): - pass - - -class CloneThread(threading.Thread): - def __status(self, status): - gobject.idle_add(self.__progw.status, status) - - def __init__(self, radio, direction, cb=None, parent=None): - threading.Thread.__init__(self) - - self.__radio = radio - self.__out = direction == "out" - self.__cback = cb - self.__cancelled = False - - self.__progw = cloneprog.CloneProg(parent=parent, cancel=self.cancel) - - def cancel(self): - self.__radio.pipe.close() - self.__cancelled = True - - def run(self): - LOG.debug("Clone thread started") - - gobject.idle_add(self.__progw.show) - - self.__radio.status_fn = self.__status - - try: - if self.__out: - self.__radio.sync_out() - else: - self.__radio.sync_in() - - emsg = None - except Exception as e: - common.log_exception() - LOG.error("Clone failed: {error}".format(error=e)) - emsg = e - - gobject.idle_add(self.__progw.hide) - - # NB: Compulsory close of the radio's serial connection - self.__radio.pipe.close() - - LOG.debug("Clone thread ended") - - if self.__cback and not self.__cancelled: - gobject.idle_add(self.__cback, self.__radio, emsg) - - -if __name__ == "__main__": - d = CloneSettingsDialog("/dev/ttyUSB0") - r = d.run() - print(r) diff --git a/chirp/ui/cloneprog.py b/chirp/ui/cloneprog.py deleted file mode 100644 index 99beea9..0000000 --- a/chirp/ui/cloneprog.py +++ /dev/null @@ -1,66 +0,0 @@ -# Copyright 2008 Dan Smith -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -import gtk - - -class CloneProg(gtk.Window): - def __init__(self, **args): - if "parent" in args: - parent = args["parent"] - del args["parent"] - else: - parent = None - - if "cancel" in args: - cancel = args["cancel"] - del args["cancel"] - else: - cancel = None - - gtk.Window.__init__(self, **args) - - self.set_transient_for(parent) - self.set_modal(True) - self.set_type_hint(gtk.gdk.WINDOW_TYPE_HINT_DIALOG) - self.set_position(gtk.WIN_POS_CENTER_ON_PARENT) - - vbox = gtk.VBox(False, 2) - vbox.show() - self.add(vbox) - - self.set_title(_("Clone Progress")) - self.set_resizable(False) - - self.infolabel = gtk.Label(_("Cloning")) - self.infolabel.show() - vbox.pack_start(self.infolabel, 1, 1, 1) - - self.progbar = gtk.ProgressBar() - self.progbar.set_fraction(0.0) - self.progbar.show() - vbox.pack_start(self.progbar, 0, 0, 0) - - cancel_b = gtk.Button(_("Cancel")) - cancel_b.connect("clicked", lambda b: cancel()) - cancel_b.show() - vbox.pack_start(cancel_b, 0, 0, 0) - - def status(self, _status): - self.infolabel.set_text(_status.msg) - - if _status.cur > _status.max: - _status.cur = _status.max - self.progbar.set_fraction(_status.cur / float(_status.max)) diff --git a/chirp/ui/common.py b/chirp/ui/common.py deleted file mode 100644 index a6b90ee..0000000 --- a/chirp/ui/common.py +++ /dev/null @@ -1,451 +0,0 @@ -# Copyright 2008 Dan Smith -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -import gtk -import gobject -import pango - -import threading -import time -import os -import traceback -import logging - -from chirp import errors -from chirp.ui import reporting, config - -LOG = logging.getLogger(__name__) - -CONF = config.get() - - -class Editor(gobject.GObject): - __gsignals__ = { - 'changed': (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, ()), - 'usermsg': (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, - (gobject.TYPE_STRING,)), - } - - root = None - - def __init__(self, rthread): - gobject.GObject.__init__(self) - self.read_only = False - self._focused = False - self.rthread = rthread - - def is_focused(self): - return self._focused - - def focus(self): - self._focused = True - - def unfocus(self): - self._focused = False - - def copy_selection(self, cut=False): - pass - - def paste_selection(self): - pass - - def hotkey(self, action): - pass - - def set_read_only(self, read_only): - self.read_only = read_only - - def get_read_only(self): - return self.read_only - - def prepare_close(self): - pass - - def other_editor_changed(self, editor): - pass - -gobject.type_register(Editor) - - -def DBG(*args): - if False: - LOG.debug(" ".join(args)) - - -class RadioJob: - def __init__(self, cb, func, *args, **kwargs): - self.cb = cb - self.cb_args = () - self.func = func - self.args = args - self.kwargs = kwargs - self.desc = "Working" - self.target = None - self.tb = traceback.format_stack() - - def __str__(self): - return "RadioJob(%s,%s,%s)" % (self.func, self.args, self.kwargs) - - def set_desc(self, desc): - self.desc = desc - - def set_cb_args(self, *args): - self.cb_args = args - - def set_target(self, target): - self.target = target - - def _execute(self, target, func): - try: - DBG("Running %s (%s %s)" % (self.func, - str(self.args), - str(self.kwargs))) - DBG(self.desc) - result = func(*self.args, **self.kwargs) - except errors.InvalidMemoryLocation as e: - result = e - except Exception as e: - LOG.error("Exception running RadioJob: %s" % e) - log_exception() - LOG.error("Job Args: %s" % str(self.args)) - LOG.error("Job KWArgs: %s" % str(self.kwargs)) - LOG.error("Job Called from:%s%s" % - (os.linesep, "".join(self.tb[:-1]))) - result = e - - if self.cb: - gobject.idle_add(self.cb, result, *self.cb_args) - - def execute(self, radio): - if not self.target: - self.target = radio - - try: - func = getattr(self.target, self.func) - except AttributeError as e: - LOG.error("No such radio function `%s' in %s" % - (self.func, self.target)) - return - - self._execute(self.target, func) - - -class RadioThread(threading.Thread, gobject.GObject): - __gsignals__ = { - "status": (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, - (gobject.TYPE_STRING,)), - } - - def __init__(self, radio, parent=None): - threading.Thread.__init__(self) - gobject.GObject.__init__(self) - self.__queue = {} - if parent: - self.__runlock = parent._get_run_lock() - self.status = lambda msg: parent.status(msg) - else: - self.__runlock = threading.Lock() - self.status = self._status - - self.__counter = threading.Semaphore(0) - self.__lock = threading.Lock() - - self.__enabled = True - self.radio = radio - - def _get_run_lock(self): - return self.__runlock - - def _qlock(self): - self.__lock.acquire() - - def _qunlock(self): - self.__lock.release() - - def _qsubmit(self, job, priority): - if priority not in self.__queue: - self.__queue[priority] = [] - - self.__queue[priority].append(job) - self.__counter.release() - - def _queue_clear_below(self, priority): - for i in range(0, priority): - if i in self.__queue and len(self.__queue[i]) != 0: - return False - - return True - - def _qlock_when_idle(self, priority=10): - while True: - DBG("Attempting queue lock (%i)" % len(self.__queue)) - self._qlock() - if self._queue_clear_below(priority): - return - self._qunlock() - time.sleep(0.1) - - # This is the external lock, which stops any threads from running - # so that the radio can be operated synchronously - def lock(self): - self.__runlock.acquire() - - def unlock(self): - self.__runlock.release() - - def submit(self, job, priority=0): - self._qlock() - self._qsubmit(job, priority) - self._qunlock() - - def flush(self, priority=None): - self._qlock() - - if priority is None: - for i in self.__queue.keys(): - self.__queue[i] = [] - else: - self.__queue[priority] = [] - - self._qunlock() - - def stop(self): - self.flush() - self.__counter.release() - self.__enabled = False - - def _status(self, msg): - jobs = 0 - for i in dict(self.__queue): - jobs += len(self.__queue[i]) - gobject.idle_add(self.emit, "status", "[%i] %s" % (jobs, msg)) - - def _queue_pop(self, priority): - try: - return self.__queue[priority].pop(0) - except IndexError: - return None - - def run(self): - last_job_desc = "idle" - while self.__enabled: - DBG("Waiting for a job") - if last_job_desc: - self.status(_("Completed") + " " + last_job_desc + - " (" + _("idle") + ")") - self.__counter.acquire() - - self._qlock() - for i in sorted(self.__queue.keys()): - job = self._queue_pop(i) - if job: - DBG("Running job at priority %i" % i) - break - self._qunlock() - - if job: - self.lock() - self.status(job.desc) - job.execute(self.radio) - last_job_desc = job.desc - self.unlock() - - LOG.debug("RadioThread exiting") - - -def log_exception(): - import traceback - import sys - - reporting.report_exception(traceback.format_exc(limit=30)) - - LOG.error("-- Exception: --") - LOG.error(traceback.format_exc(limit=30)) - LOG.error("----------------") - - -def show_error(msg, parent=None): - d = gtk.MessageDialog(buttons=gtk.BUTTONS_OK, parent=parent, - type=gtk.MESSAGE_ERROR) - d.set_property("text", msg) - - if not parent: - d.set_position(gtk.WIN_POS_CENTER_ALWAYS) - - d.run() - d.destroy() - - -def ask_yesno_question(msg, parent=None): - d = gtk.MessageDialog(buttons=gtk.BUTTONS_YES_NO, parent=parent, - type=gtk.MESSAGE_QUESTION) - d.set_property("text", msg) - - if not parent: - d.set_position(gtk.WIN_POS_CENTER_ALWAYS) - - r = d.run() - d.destroy() - - return r == gtk.RESPONSE_YES - - -def combo_select(box, value): - store = box.get_model() - iter = store.get_iter_first() - while iter: - if store.get(iter, 0)[0] == value: - box.set_active_iter(iter) - return True - iter = store.iter_next(iter) - - return False - - -def _add_text(d, text): - v = gtk.TextView() - v.get_buffer().set_text(text) - v.set_editable(False) - v.set_cursor_visible(False) - v.show() - sw = gtk.ScrolledWindow() - sw.add(v) - sw.show() - d.vbox.pack_start(sw, 1, 1, 1) - return v - - -def show_error_text(msg, text, parent=None): - d = gtk.MessageDialog(buttons=gtk.BUTTONS_OK, parent=parent, - type=gtk.MESSAGE_ERROR) - d.set_property("text", msg) - - _add_text(d, text) - if not parent: - d.set_position(gtk.WIN_POS_CENTER_ALWAYS) - - d.set_size_request(600, 400) - d.run() - d.destroy() - - -def show_warning(msg, text, - parent=None, buttons=None, title="Warning", - can_squelch=False): - if buttons is None: - buttons = gtk.BUTTONS_OK - d = gtk.MessageDialog(buttons=buttons, - parent=parent, - type=gtk.MESSAGE_WARNING) - d.set_title(title) - d.set_property("text", msg) - l = gtk.Label(_("Details") + ":") - l.show() - d.vbox.pack_start(l, 0, 0, 0) - l = gtk.Label(_("Proceed?")) - l.show() - d.get_action_area().pack_start(l, 0, 0, 0) - d.get_action_area().reorder_child(l, 0) - textview = _add_text(d, text) - textview.set_wrap_mode(gtk.WRAP_WORD) - if not parent: - d.set_position(gtk.WIN_POS_CENTER_ALWAYS) - if can_squelch: - cb = gtk.CheckButton(_("Do not show this next time")) - cb.show() - d.vbox.pack_start(cb, 0, 0, 0) - - d.set_size_request(600, 400) - r = d.run() - d.destroy() - if can_squelch: - return r, cb.get_active() - return r - - -def simple_diff(a, b, diffsonly=False): - lines_a = a.split(os.linesep) - lines_b = b.split(os.linesep) - blankprinted = True - - diff = "" - for i in range(0, len(lines_a)): - if lines_a[i] != lines_b[i]: - diff += "-%s%s" % (lines_a[i], os.linesep) - diff += "+%s%s" % (lines_b[i], os.linesep) - blankprinted = False - elif diffsonly is True: - if blankprinted: - continue - diff += os.linesep - blankprinted = True - else: - diff += " %s%s" % (lines_a[i], os.linesep) - return diff - - -# A quick hacked up tool to show a blob of text in a dialog window -# using fixed-width fonts. It also highlights lines that start with -# a '-' in red bold font and '+' with blue bold font. -def show_diff_blob(title, result): - d = gtk.Dialog(title=title, - buttons=(gtk.STOCK_OK, gtk.RESPONSE_OK)) - b = gtk.TextBuffer() - - tags = b.get_tag_table() - for color in ["red", "blue", "green", "grey"]: - tag = gtk.TextTag(color) - tag.set_property("foreground", color) - tags.add(tag) - tag = gtk.TextTag("bold") - tag.set_property("weight", pango.WEIGHT_BOLD) - tags.add(tag) - - try: - fontsize = CONF.get_int("diff_fontsize", "developer") - except Exception: - fontsize = 11 - if fontsize < 4 or fontsize > 144: - LOG.info("Unsupported diff_fontsize %i. Using 11." % fontsize) - fontsize = 11 - - lines = result.split(os.linesep) - for line in lines: - if line.startswith("-"): - tags = ("red", "bold") - elif line.startswith("+"): - tags = ("blue", "bold") - else: - tags = () - b.insert_with_tags_by_name(b.get_end_iter(), line + os.linesep, *tags) - v = gtk.TextView(b) - fontdesc = pango.FontDescription("Courier %i" % fontsize) - v.modify_font(fontdesc) - v.set_editable(False) - v.show() - s = gtk.ScrolledWindow() - s.add(v) - s.show() - d.vbox.pack_start(s, 1, 1, 1) - d.set_size_request(600, 400) - d.run() - d.destroy() - - -def unpluralize(string): - if string.endswith("s"): - return string[:-1] - else: - return string diff --git a/chirp/ui/compat.py b/chirp/ui/compat.py deleted file mode 100644 index b4ac7d2..0000000 --- a/chirp/ui/compat.py +++ /dev/null @@ -1,82 +0,0 @@ -import contextlib -import logging -import serial as base_serial -import six - -try: - import gtk -except ImportError: - # FIXME - # For chirpc - gtk = None - -from chirp import bitwise - -LOG = logging.getLogger('uicompat') - - -@contextlib.contextmanager -def py3safe(quiet=False): - try: - yield - except Exception as e: - if not quiet: - LOG.exception('FIXMEPY3: %s' % e) - - -def SpinButton(adj): - try: - return gtk.SpinButton(adj) - except TypeError: - sb = gtk.SpinButton() - sb.configure(adj, 1.0, 0) - return sb - -def Frame(label): - try: - return gtk.Frame(label) - except TypeError: - f = gtk.Frame() - f.set_label(label) - return f - - -class CompatSerial(base_serial.Serial): - """A PY2-compatible Serial class - - This wraps serial.Serial to provide translation between - hex-char-having unicode strings in radios and the bytes-wanting - serial channel. See bitwise.string_straigth_encode() and - bitwise.string_straight_decode() for more details. - - This should only be used as a bridge for older drivers until - they can be rewritten. - """ - def write(self, data): - data = bitwise.string_straight_encode(data) - return super(CompatSerial, self).write(data) - - def read(self, count): - data = super(CompatSerial, self).read(count) - return bitwise.string_straight_decode(data) - - @classmethod - def get(cls, needs_compat, *args, **kwargs): - if six.PY3 and needs_compat: - return cls(*args, **kwargs) - else: - return base_serial.Serial(*args, **kwargs) - - -class CompatTooltips(object): - def __init__(self): - try: - self.tips = gtk.Tooltips() - except AttributeError: - self.tips = None - - def set_tip(self, widget, tip): - if self.tips: - self.tips.set_tip(widget, tip) - else: - widget.set_tooltip_text(tip) diff --git a/chirp/ui/config.py b/chirp/ui/config.py deleted file mode 100644 index 3867d4a..0000000 --- a/chirp/ui/config.py +++ /dev/null @@ -1,131 +0,0 @@ -# Copyright 2011 Dan Smith -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -from chirp import platform -try: - from ConfigParser import ConfigParser -except ImportError: - from configparser import ConfigParser -import os - - -class ChirpConfig: - def __init__(self, basepath, name="chirp.config"): - self.__basepath = basepath - self.__name = name - - self._default_section = "global" - - self.__config = ConfigParser() - - cfg = os.path.join(basepath, name) - if os.path.exists(cfg): - self.__config.read(cfg) - - def save(self): - cfg = os.path.join(self.__basepath, self.__name) - with open(cfg, "w") as cfg_file: - self.__config.write(cfg_file) - - def get(self, key, section, raw=False): - if not self.__config.has_section(section): - return None - - if not self.__config.has_option(section, key): - return None - - return self.__config.get(section, key, raw=raw) - - def set(self, key, value, section): - if not self.__config.has_section(section): - self.__config.add_section(section) - - self.__config.set(section, key, value) - - def is_defined(self, key, section): - return self.__config.has_option(section, key) - - def remove_option(self, section, key): - self.__config.remove_option(section, key) - - if not self.__config.items(section): - self.__config.remove_section(section) - - -class ChirpConfigProxy: - def __init__(self, config, section="global"): - self._config = config - self._section = section - - def get(self, key, section=None, raw=False): - return self._config.get(key, section or self._section, - raw=raw) - - def set(self, key, value, section=None): - return self._config.set(key, value, section or self._section) - - def get_int(self, key, section=None): - try: - return int(self.get(key, section)) - except ValueError: - return 0 - - def set_int(self, key, value, section=None): - if not isinstance(value, int): - raise ValueError("Value is not an integer") - - self.set(key, "%i" % value, section) - - def get_float(self, key, section=None): - try: - return float(self.get(key, section)) - except ValueError: - return 0 - - def set_float(self, key, value, section=None): - if not isinstance(value, float): - raise ValueError("Value is not an integer") - - self.set(key, "%i" % value, section) - - def get_bool(self, key, section=None, default=False): - val = self.get(key, section) - if val is None: - return default - else: - return val == "True" - - def set_bool(self, key, value, section=None): - self.set(key, str(bool(value)), section) - - def is_defined(self, key, section=None): - return self._config.is_defined(key, section or self._section) - - def remove_option(self, key, section): - self._config.remove_option(section, key) - - -_CONFIG = None - - -def get(section="global"): - global _CONFIG - - p = platform.get_platform() - - if not _CONFIG: - _CONFIG = ChirpConfig(p.config_dir()) - - return ChirpConfigProxy(_CONFIG, section) diff --git a/chirp/ui/dstaredit.py b/chirp/ui/dstaredit.py deleted file mode 100644 index 4d122f2..0000000 --- a/chirp/ui/dstaredit.py +++ /dev/null @@ -1,202 +0,0 @@ -# Copyright 2008 Dan Smith -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -import gtk -import gobject -import logging - -from chirp.ui import common, miscwidgets -from chirp.ui import compat - -LOG = logging.getLogger(__name__) - -WIDGETW = 80 -WIDGETH = 30 - - -class CallsignEditor(gtk.HBox): - __gsignals__ = { - "changed": (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, ()), - } - - def _cs_changed(self, listw, callid): - if callid == 0 and self.first_fixed: - return False - - self.emit("changed") - - return True - - def make_list(self, width): - cols = [(gobject.TYPE_INT, ""), - (gobject.TYPE_INT, ""), - (gobject.TYPE_STRING, _("Callsign")), - ] - - self.listw = miscwidgets.KeyedListWidget(cols) - self.listw.show() - - self.listw.set_editable(1, True) - self.listw.connect("item-set", self._cs_changed) - - with compat.py3safe(): - rend = self.listw.get_renderer(1) - rend.set_property("family", "Monospace") - rend.set_property("width-chars", width) - - sw = gtk.ScrolledWindow() - sw.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) - sw.add_with_viewport(self.listw) - sw.show() - - return sw - - def __init__(self, first_fixed=False, width=8): - gtk.HBox.__init__(self, False, 2) - - self.first_fixed = first_fixed - - self.listw = None - - self.pack_start(self.make_list(width), 1, 1, 1) - - def set_callsigns(self, calls): - if self.first_fixed: - st = 1 - else: - st = 0 - - values = [] - i = 1 - for call in calls[st:]: - self.listw.set_item(i, i, call) - i += 1 - - def get_callsigns(self): - calls = [] - keys = self.listw.get_keys() - for key in keys: - id, idx, call = self.listw.get_item(key) - calls.append(call) - - if self.first_fixed: - calls.insert(0, "") - - return calls - - -class DStarEditor(common.Editor): - def __cs_changed(self, cse): - job = None - - LOG.debug("Callsigns: %s" % cse.get_callsigns()) - if cse == self.editor_ucall: - job = common.RadioJob(None, - "set_urcall_list", - cse.get_callsigns()) - LOG.debug("Set urcall") - elif cse == self.editor_rcall: - job = common.RadioJob(None, - "set_repeater_call_list", - cse.get_callsigns()) - LOG.debug("Set rcall") - elif cse == self.editor_mcall: - job = common.RadioJob(None, - "set_mycall_list", - cse.get_callsigns()) - - if job: - LOG.debug("Submitting job to update call lists") - self.rthread.submit(job) - - self.emit("changed") - - def make_callsigns(self): - box = gtk.HBox(True, 2) - - fixed = self.rthread.radio.get_features().has_implicit_calls - - frame = compat.Frame(_("Your callsign")) - self.editor_ucall = CallsignEditor(first_fixed=fixed) - self.editor_ucall.set_size_request(-1, 200) - self.editor_ucall.show() - frame.add(self.editor_ucall) - frame.show() - box.pack_start(frame, 1, 1, 0) - - frame = compat.Frame(_("Repeater callsign")) - self.editor_rcall = CallsignEditor(first_fixed=fixed) - self.editor_rcall.set_size_request(-1, 200) - self.editor_rcall.show() - frame.add(self.editor_rcall) - frame.show() - box.pack_start(frame, 1, 1, 0) - - frame = compat.Frame(_("My callsign")) - self.editor_mcall = CallsignEditor() - self.editor_mcall.set_size_request(-1, 200) - self.editor_mcall.show() - frame.add(self.editor_mcall) - frame.show() - box.pack_start(frame, 1, 1, 0) - - box.show() - return box - - def focus(self): - if self.loaded: - return - self.loaded = True - LOG.debug("Loading callsigns...") - - def set_ucall(calls): - self.editor_ucall.set_callsigns(calls) - self.editor_ucall.connect("changed", self.__cs_changed) - - def set_rcall(calls): - self.editor_rcall.set_callsigns(calls) - self.editor_rcall.connect("changed", self.__cs_changed) - - def set_mcall(calls): - self.editor_mcall.set_callsigns(calls) - self.editor_mcall.connect("changed", self.__cs_changed) - - job = common.RadioJob(set_ucall, "get_urcall_list") - job.set_desc(_("Downloading URCALL list")) - self.rthread.submit(job) - - job = common.RadioJob(set_rcall, "get_repeater_call_list") - job.set_desc(_("Downloading RPTCALL list")) - self.rthread.submit(job) - - job = common.RadioJob(set_mcall, "get_mycall_list") - job.set_desc(_("Downloading MYCALL list")) - self.rthread.submit(job) - - def __init__(self, rthread): - super(DStarEditor, self).__init__(rthread) - - self.loaded = False - - self.editor_ucall = self.editor_rcall = None - - vbox = gtk.VBox(False, 2) - vbox.pack_start(self.make_callsigns(), 0, 0, 0) - - tmp = gtk.Label("") - tmp.show() - vbox.pack_start(tmp, 1, 1, 1) - - self.root = vbox diff --git a/chirp/ui/editorset.py b/chirp/ui/editorset.py deleted file mode 100644 index c030595..0000000 --- a/chirp/ui/editorset.py +++ /dev/null @@ -1,419 +0,0 @@ -# Copyright 2008 Dan Smith -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -import os -import gtk -import gobject -import logging - -from chirp import chirp_common, directory -from chirp.drivers import generic_csv -from chirp.ui import memedit, dstaredit, bankedit, common, importdialog -from chirp.ui import inputdialog, reporting, settingsedit, radiobrowser, config - -LOG = logging.getLogger(__name__) - - -class EditorSet(gtk.VBox): - __gsignals__ = { - "want-close": (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, ()), - "status": (gobject.SIGNAL_RUN_LAST, - gobject.TYPE_NONE, - (gobject.TYPE_STRING,)), - "usermsg": (gobject.SIGNAL_RUN_LAST, - gobject.TYPE_NONE, - (gobject.TYPE_STRING,)), - "editor-selected": (gobject.SIGNAL_RUN_LAST, - gobject.TYPE_NONE, - (gobject.TYPE_STRING,)), - } - - def _make_device_mapping_editors(self, device, devrthread, index): - sub_index = 0 - memory_editor = self.editors["memedit%i" % index] - mappings = device.get_mapping_models() - for mapping_model in mappings: - members = bankedit.MappingMembershipEditor(devrthread, self, - mapping_model) - label = mapping_model.get_name() - if self.rf.has_sub_devices: - label += "(%s)" % device.VARIANT - lab = gtk.Label(label) - self.tabs.append_page(members.root, lab) - self.editors["mapping_members%i%i" % (index, sub_index)] = members - - basename = common.unpluralize(mapping_model.get_name()) - names = bankedit.MappingNameEditor(devrthread, mapping_model) - label = "%s Names" % basename - if self.rf.has_sub_devices: - label += " (%s)" % device.VARIANT - lab = gtk.Label(label) - self.tabs.append_page(names.root, lab) - self.editors["mapping_names%i%i" % (index, sub_index)] = names - - members.root.show() - members.connect("changed", self.editor_changed) - if hasattr(mapping_model.get_mappings()[0], "set_name"): - names.root.show() - members.connect("changed", lambda x: names.mappings_changed()) - names.connect("changed", lambda x: members.mappings_changed()) - names.connect("changed", self.editor_changed) - sub_index += 1 - - def _make_device_editors(self, device, devrthread, index): - if isinstance(device, chirp_common.IcomDstarSupport): - memories = memedit.DstarMemoryEditor(devrthread) - else: - memories = memedit.MemoryEditor(devrthread) - - memories.connect("usermsg", lambda e, m: self.emit("usermsg", m)) - memories.connect("changed", self.editor_changed) - - if self.rf.has_sub_devices: - label = (_("Memories (%(variant)s)") % - dict(variant=device.VARIANT)) - rf = device.get_features() - else: - label = _("Memories") - rf = self.rf - lab = gtk.Label(label) - self.tabs.append_page(memories.root, lab) - memories.root.show() - self.editors["memedit%i" % index] = memories - - self._make_device_mapping_editors(device, devrthread, index) - - if isinstance(device, chirp_common.IcomDstarSupport): - editor = dstaredit.DStarEditor(devrthread) - self.tabs.append_page(editor.root, gtk.Label(_("D-STAR"))) - editor.root.show() - editor.connect("changed", self.dstar_changed, memories) - editor.connect("changed", self.editor_changed) - self.editors["dstar"] = editor - - def __init__(self, source, parent_window=None, - filename=None, tempname=None): - gtk.VBox.__init__(self, True, 0) - - self.parent_window = parent_window - - if isinstance(source, str): - self.filename = source - self.radio = directory.get_radio_by_image(self.filename) - elif isinstance(source, chirp_common.Radio): - self.radio = source - self.filename = filename or tempname or source.VARIANT - else: - raise Exception("Unknown source type") - - rthread = common.RadioThread(self.radio) - rthread.setDaemon(True) - rthread.start() - - rthread.connect("status", lambda e, m: self.emit("status", m)) - - self.tabs = gtk.Notebook() - self.tabs.connect("switch-page", self.tab_selected) - self.tabs.set_tab_pos(gtk.POS_LEFT) - - self.editors = {} - - self.rf = self.radio.get_features() - if self.rf.has_sub_devices: - devices = self.radio.get_sub_devices() - else: - devices = [self.radio] - - index = 0 - for device in devices: - devrthread = common.RadioThread(device, rthread) - devrthread.setDaemon(True) - devrthread.start() - self._make_device_editors(device, devrthread, index) - index += 1 - - if self.rf.has_settings: - editor = settingsedit.SettingsEditor(rthread) - self.tabs.append_page(editor.root, gtk.Label(_("Settings"))) - editor.root.show() - editor.connect("changed", self.editor_changed) - self.editors["settings"] = editor - - conf = config.get() - if (hasattr(self.rthread.radio, '_memobj') and - conf.get_bool("developer", "state")): - editor = radiobrowser.RadioBrowser(self.rthread) - lab = gtk.Label(_("Browser")) - self.tabs.append_page(editor.root, lab) - editor.connect("changed", self.editor_changed) - self.editors["browser"] = editor - - self.pack_start(self.tabs) - self.tabs.show() - - self.label = self.text_label = None - self.make_label() - self.modified = (tempname is not None) - if tempname: - self.filename = tempname - self.tooltip_filename = None - self.update_tab() - - def make_label(self): - self.label = gtk.HBox(False, 0) - - self.text_label = gtk.Label("") - self.text_label.show() - self.label.pack_start(self.text_label, 1, 1, 1) - - button = gtk.Button() - button.set_relief(gtk.RELIEF_NONE) - button.set_focus_on_click(False) - - icon = gtk.image_new_from_stock(gtk.STOCK_CLOSE, gtk.ICON_SIZE_MENU) - icon.show() - button.add(icon) - - button.connect("clicked", lambda x: self.emit("want-close")) - button.show() - self.label.pack_start(button, 0, 0, 0) - - self.label.show() - - def update_tab(self): - fn = os.path.basename(self.filename) - if self.modified: - text = "%s*" % fn - else: - text = fn - - self.text_label.set_text(self.radio.get_name() + ": " + text) - if self.filename != self.tooltip_filename: - self.text_label.set_tooltip_text(self.filename) - self.tooltip_filename = self.filename - - def save(self, fname=None): - if not fname: - fname = self.filename - if not os.path.exists(self.filename): - return # Probably before the first "Save as" - else: - self.filename = fname - - self.rthread.lock() - try: - self.radio.save(fname) - except: - self.rthread.unlock() - raise - self.rthread.unlock() - - self.modified = False - self.update_tab() - - def dstar_changed(self, dstared, memedit): - memedit.set_urcall_list(dstared.editor_ucall.get_callsigns()) - memedit.set_repeater_list(dstared.editor_rcall.get_callsigns()) - memedit.prefill() - - def editor_changed(self, target_editor=None): - LOG.debug("%s changed" % target_editor) - if not isinstance(self.radio, chirp_common.LiveRadio): - self.modified = True - self.update_tab() - for editor in list(self.editors.values()): - if editor != target_editor: - editor.other_editor_changed(target_editor) - - def get_tab_label(self): - return self.label - - def is_modified(self): - return self.modified - - def _do_import_locked(self, dlgclass, src_radio, dst_rthread): - - # An import/export action needs to be done in the absence of any - # other queued changes. So, we make sure that nothing else is - # staged for the thread and lock it up. Then we use the hidden - # interface to queue our own changes before opening it up to the - # rest of the world. - - dst_rthread._qlock_when_idle(5) # Suspend job submission when idle - - dialog = dlgclass(src_radio, dst_rthread.radio, self.parent_window) - r = dialog.run() - dialog.hide() - if r != gtk.RESPONSE_OK: - dst_rthread._qunlock() - return - - count = dialog.do_import(dst_rthread) - LOG.debug("Imported %i" % count) - dst_rthread._qunlock() - - if count > 0: - self.editor_changed() - current_editor = self.get_current_editor() - gobject.idle_add(current_editor.prefill) - - return count - - def choose_sub_device(self, radio): - devices = radio.get_sub_devices() - choices = [x.VARIANT for x in devices] - - d = inputdialog.ChoiceDialog(choices) - text = _("The {vendor} {model} has multiple independent sub-devices") - d.label.set_text(text.format(vendor=radio.VENDOR, model=radio.MODEL) + - os.linesep + _("Choose one to import from:")) - r = d.run() - chosen = d.choice.get_active_text() - d.destroy() - if r == gtk.RESPONSE_CANCEL: - raise Exception(_("Cancelled")) - for d in devices: - if d.VARIANT == chosen: - return d - - raise Exception(_("Internal Error")) - - def do_import(self, filen): - current_editor = self.get_current_editor() - if not isinstance(current_editor, memedit.MemoryEditor): - # FIXME: We need a nice message to let the user know that they - # need to select the appropriate memory editor tab before doing - # and import so that we know which thread and editor to import - # into and refresh. This will do for the moment. - common.show_error("Memory editor must be selected before import") - try: - src_radio = directory.get_radio_by_image(filen) - except Exception as e: - common.show_error(e) - return - - if isinstance(src_radio, chirp_common.NetworkSourceRadio): - ww = importdialog.WaitWindow("Querying...", self.parent_window) - ww.show() - - def status(status): - ww.set(float(status.cur) / float(status.max)) - - try: - src_radio.status_fn = status - src_radio.do_fetch() - except Exception as e: - common.show_error(e) - ww.hide() - return - ww.hide() - - try: - if src_radio.get_features().has_sub_devices: - src_radio = self.choose_sub_device(src_radio) - except Exception as e: - common.show_error(e) - return - - if len(src_radio.errors) > 0: - _filen = os.path.basename(filen) - common.show_error_text(_("There were errors while opening {file}. " - "The affected memories will not " - "be importable!").format(file=_filen), - "\r\n".join(src_radio.errors)) - - try: - count = self._do_import_locked(importdialog.ImportDialog, - src_radio, - self.rthread) - reporting.report_model_usage(src_radio, "importsrc", True) - except Exception as e: - common.log_exception() - common.show_error(_("There was an error during " - "import: {error}").format(error=e)) - - def do_export(self, filen): - try: - if filen.lower().endswith(".csv"): - dst_radio = generic_csv.CSVRadio(filen) - else: - raise Exception(_("Unsupported file type")) - except Exception as e: - common.log_exception() - common.show_error(e) - return - - dst_rthread = common.RadioThread(dst_radio) - dst_rthread.setDaemon(True) - dst_rthread.start() - - try: - count = self._do_import_locked(importdialog.ExportDialog, - self.rthread.radio, - dst_rthread) - except Exception as e: - common.log_exception() - common.show_error(_("There was an error during " - "export: {error}").format(error=e), - self.parent_window) - return - - if count <= 0: - return - - # Wait for thread queue to complete - dst_rthread._qlock_when_idle() - - try: - dst_radio.save(filename=filen) - except Exception as e: - common.log_exception() - common.show_error(_("There was an error during " - "export: {error}").format(error=e), - self) - - def tab_selected(self, notebook, foo, pagenum): - widget = notebook.get_nth_page(pagenum) - for k, v in list(self.editors.items()): - if v and v.root == widget: - v.focus() - self.emit("editor-selected", k) - elif v: - v.unfocus() - - def set_read_only(self, read_only=True): - for editor in list(self.editors.values()): - editor and editor.set_read_only(read_only) - - def get_read_only(self): - return self.editors["memedit0"].get_read_only() - - def prepare_close(self): - for editor in list(self.editors.values()): - editor and editor.prepare_close() - - def get_current_editor(self): - tabs = self.tabs - for lab, e in list(self.editors.items()): - if e and tabs.page_num(e.root) == tabs.get_current_page(): - return e - raise Exception("No editor selected?") - - @property - def rthread(self): - """Magic rthread property to return the rthread of the currently- - selected editor""" - e = self.get_current_editor() - return e.rthread diff --git a/chirp/ui/fips.py b/chirp/ui/fips.py deleted file mode 100644 index a7089e7..0000000 --- a/chirp/ui/fips.py +++ /dev/null @@ -1,6605 +0,0 @@ -# Copyright 2012 Tom Hayward -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - - -FIPS_STATES = { - "Alaska": 2, - "Alabama": 1, - "Arkansas": 5, - "Arizona": 4, - "California": 6, - "Colorado": 8, - "Connecticut": 9, - "District of Columbia": 11, - "Delaware": 10, - "Florida": 12, - "Georgia": 13, - "Guam": 66, - "Hawaii": 15, - "Iowa": 19, - "Idaho": 16, - "Illinois": 17, - "Indiana": 18, - "Kansas": 20, - "Kentucky": 21, - "Louisiana": 22, - "Massachusetts": 25, - "Maryland": 24, - "Maine": 23, - "Michigan": 26, - "Minnesota": 27, - "Missouri": 29, - "Mississippi": 28, - "Montana": 30, - "North Carolina": 37, - "North Dakota": 38, - "Nebraska": 31, - "New Hampshire": 33, - "New Jersey": 34, - "New Mexico": 35, - "Nevada": 32, - "New York": 36, - "Ohio": 39, - "Oklahoma": 40, - "Oregon": 41, - "Pennsylvania": 42, - "Puerto Rico": 72, - "Rhode Island": 44, - "South Carolina": 45, - "South Dakota": 46, - "Tennessee": 47, - "Texas": 48, - "Utah": 49, - "Virginia": 51, - "Virgin Islands": 78, - "Vermont": 50, - "Washington": 53, - "Wisconsin": 55, - "West Virginia": 54, - "Wyoming": 56, - "Alberta": "CA01", - "British Columbia": "CA02", - "Manitoba": "CA03", - "New Brunswick": "CA04", - "Newfoundland and Labrador": "CA05", - "Northwest Territories": "CA13", - "Nova Scotia": "CA07", - "Nunavut": "CA14", - "Ontario": "CA08", - "Prince Edward Island": "CA09", - "Quebec": "CA10", - "Saskatchewan": "CA11", - "Yukon": "CA12", -} - -FIPS_COUNTIES = { - 1: {'--All--': '%', - 'Autauga County, AL': '001', - 'Baldwin County, AL': '003', - 'Barbour County, AL': '005', - 'Bibb County, AL': '007', - 'Blount County, AL': '009', - 'Bullock County, AL': '011', - 'Butler County, AL': '013', - 'Calhoun County, AL': '015', - 'Chambers County, AL': '017', - 'Cherokee County, AL': '019', - 'Chilton County, AL': '021', - 'Choctaw County, AL': '023', - 'Clarke County, AL': '025', - 'Clay County, AL': '027', - 'Cleburne County, AL': '029', - 'Coffee County, AL': '031', - 'Colbert County, AL': '033', - 'Conecuh County, AL': '035', - 'Coosa County, AL': '037', - 'Covington County, AL': '039', - 'Crenshaw County, AL': '041', - 'Cullman County, AL': '043', - 'Dale County, AL': '045', - 'Dallas County, AL': '047', - 'DeKalb County, AL': '049', - 'Elmore County, AL': '051', - 'Escambia County, AL': '053', - 'Etowah County, AL': '055', - 'Fayette County, AL': '057', - 'Franklin County, AL': '059', - 'Geneva County, AL': '061', - 'Greene County, AL': '063', - 'Hale County, AL': '065', - 'Henry County, AL': '067', - 'Houston County, AL': '069', - 'Jackson County, AL': '071', - 'Jefferson County, AL': '073', - 'Lamar County, AL': '075', - 'Lauderdale County, AL': '077', - 'Lawrence County, AL': '079', - 'Lee County, AL': '081', - 'Limestone County, AL': '083', - 'Lowndes County, AL': '085', - 'Macon County, AL': '087', - 'Madison County, AL': '089', - 'Marengo County, AL': '091', - 'Marion County, AL': '093', - 'Marshall County, AL': '095', - 'Mobile County, AL': '097', - 'Monroe County, AL': '099', - 'Montgomery County, AL': '101', - 'Morgan County, AL': '103', - 'Perry County, AL': '105', - 'Pickens County, AL': '107', - 'Pike County, AL': '109', - 'Randolph County, AL': '111', - 'Russell County, AL': '113', - 'Shelby County, AL': '117', - 'St. Clair County, AL': '115', - 'Sumter County, AL': '119', - 'Talladega County, AL': '121', - 'Tallapoosa County, AL': '123', - 'Tuscaloosa County, AL': '125', - 'Walker County, AL': '127', - 'Washington County, AL': '129', - 'Wilcox County, AL': '131', - 'Winston County, AL': '133'}, - 2: {'--All--': '%', - 'Aleutians East Borough, AK': '013', - 'Aleutians West Census Area, AK': '016', - 'Anchorage Borough/municipality, AK': '020', - 'Bethel Census Area, AK': '050', - 'Bristol Bay Borough, AK': '060', - 'Denali Borough, AK': '068', - 'Dillingham Census Area, AK': '070', - 'Fairbanks North Star Borough, AK': '090', - 'Haines Borough, AK': '100', - 'Juneau Borough/city, AK': '110', - 'Kenai Peninsula Borough, AK': '122', - 'Ketchikan Gateway Borough, AK': '130', - 'Kodiak Island Borough, AK': '150', - 'Lake and Peninsula Borough, AK': '164', - 'Matanuska-Susitna Borough, AK': '170', - 'Nome Census Area, AK': '180', - 'North Slope Borough, AK': '185', - 'Northwest Arctic Borough, AK': '188', - 'Prince of Wales-Outer Ketchikan Census Area, AK': '201', - 'Sitka Borough/city, AK': '220', - 'Skagway-Hoonah-Angoon Census Area, AK': '232', - 'Southeast Fairbanks Census Area, AK': '240', - 'Valdez-Cordova Census Area, AK': '261', - 'Wade Hampton Census Area, AK': '270', - 'Wrangell-Petersburg Census Area, AK': '280', - 'Yakutat Borough, AK': '282', - 'Yukon-Koyukuk Census Area, AK': '290'}, - 4: {'--All--': '%', - 'Apache County, AZ': '001', - 'Cochise County, AZ': '003', - 'Coconino County, AZ': '005', - 'Gila County, AZ': '007', - 'Graham County, AZ': '009', - 'Greenlee County, AZ': '011', - 'La Paz County, AZ': '012', - 'Maricopa County, AZ': '013', - 'Mohave County, AZ': '015', - 'Navajo County, AZ': '017', - 'Pima County, AZ': '019', - 'Pinal County, AZ': '021', - 'Santa Cruz County, AZ': '023', - 'Yavapai County, AZ': '025', - 'Yuma County, AZ': '027'}, - 5: {'--All--': '%', - 'Arkansas County, AR': '001', - 'Ashley County, AR': '003', - 'Baxter County, AR': '005', - 'Benton County, AR': '007', - 'Boone County, AR': '009', - 'Bradley County, AR': '011', - 'Calhoun County, AR': '013', - 'Carroll County, AR': '015', - 'Chicot County, AR': '017', - 'Clark County, AR': '019', - 'Clay County, AR': '021', - 'Cleburne County, AR': '023', - 'Cleveland County, AR': '025', - 'Columbia County, AR': '027', - 'Conway County, AR': '029', - 'Craighead County, AR': '031', - 'Crawford County, AR': '033', - 'Crittenden County, AR': '035', - 'Cross County, AR': '037', - 'Dallas County, AR': '039', - 'Desha County, AR': '041', - 'Drew County, AR': '043', - 'Faulkner County, AR': '045', - 'Franklin County, AR': '047', - 'Fulton County, AR': '049', - 'Garland County, AR': '051', - 'Grant County, AR': '053', - 'Greene County, AR': '055', - 'Hempstead County, AR': '057', - 'Hot Spring County, AR': '059', - 'Howard County, AR': '061', - 'Independence County, AR': '063', - 'Izard County, AR': '065', - 'Jackson County, AR': '067', - 'Jefferson County, AR': '069', - 'Johnson County, AR': '071', - 'Lafayette County, AR': '073', - 'Lawrence County, AR': '075', - 'Lee County, AR': '077', - 'Lincoln County, AR': '079', - 'Little River County, AR': '081', - 'Logan County, AR': '083', - 'Lonoke County, AR': '085', - 'Madison County, AR': '087', - 'Marion County, AR': '089', - 'Miller County, AR': '091', - 'Mississippi County, AR': '093', - 'Monroe County, AR': '095', - 'Montgomery County, AR': '097', - 'Nevada County, AR': '099', - 'Newton County, AR': '101', - 'Ouachita County, AR': '103', - 'Perry County, AR': '105', - 'Phillips County, AR': '107', - 'Pike County, AR': '109', - 'Poinsett County, AR': '111', - 'Polk County, AR': '113', - 'Pope County, AR': '115', - 'Prairie County, AR': '117', - 'Pulaski County, AR': '119', - 'Randolph County, AR': '121', - 'Saline County, AR': '125', - 'Scott County, AR': '127', - 'Searcy County, AR': '129', - 'Sebastian County, AR': '131', - 'Sevier County, AR': '133', - 'Sharp County, AR': '135', - 'St. Francis County, AR': '123', - 'Stone County, AR': '137', - 'Union County, AR': '139', - 'Van Buren County, AR': '141', - 'Washington County, AR': '143', - 'White County, AR': '145', - 'Woodruff County, AR': '147', - 'Yell County, AR': '149'}, - 6: {'--All--': '%', - 'Alameda County, CA': '001', - 'Alpine County, CA': '003', - 'Amador County, CA': '005', - 'Butte County, CA': '007', - 'Calaveras County, CA': '009', - 'Colusa County, CA': '011', - 'Contra Costa County, CA': '013', - 'Del Norte County, CA': '015', - 'El Dorado County, CA': '017', - 'Fresno County, CA': '019', - 'Glenn County, CA': '021', - 'Humboldt County, CA': '023', - 'Imperial County, CA': '025', - 'Inyo County, CA': '027', - 'Kern County, CA': '029', - 'Kings County, CA': '031', - 'Lake County, CA': '033', - 'Lassen County, CA': '035', - 'Los Angeles County, CA': '037', - 'Madera County, CA': '039', - 'Marin County, CA': '041', - 'Mariposa County, CA': '043', - 'Mendocino County, CA': '045', - 'Merced County, CA': '047', - 'Modoc County, CA': '049', - 'Mono County, CA': '051', - 'Monterey County, CA': '053', - 'Napa County, CA': '055', - 'Nevada County, CA': '057', - 'Orange County, CA': '059', - 'Placer County, CA': '061', - 'Plumas County, CA': '063', - 'Riverside County, CA': '065', - 'Sacramento County, CA': '067', - 'San Benito County, CA': '069', - 'San Bernardino County, CA': '071', - 'San Diego County, CA': '073', - 'San Francisco County/city, CA': '075', - 'San Joaquin County, CA': '077', - 'San Luis Obispo County, CA': '079', - 'San Mateo County, CA': '081', - 'Santa Barbara County, CA': '083', - 'Santa Clara County, CA': '085', - 'Santa Cruz County, CA': '087', - 'Shasta County, CA': '089', - 'Sierra County, CA': '091', - 'Siskiyou County, CA': '093', - 'Solano County, CA': '095', - 'Sonoma County, CA': '097', - 'Stanislaus County, CA': '099', - 'Sutter County, CA': '101', - 'Tehama County, CA': '103', - 'Trinity County, CA': '105', - 'Tulare County, CA': '107', - 'Tuolumne County, CA': '109', - 'Ventura County, CA': '111', - 'Yolo County, CA': '113', - 'Yuba County, CA': '115'}, - 8: {'--All--': '%', - 'Adams County, CO': '001', - 'Alamosa County, CO': '003', - 'Arapahoe County, CO': '005', - 'Archuleta County, CO': '007', - 'Baca County, CO': '009', - 'Bent County, CO': '011', - 'Boulder County, CO': '013', - 'Broomfield County/city, CO': '014', - 'Chaffee County, CO': '015', - 'Cheyenne County, CO': '017', - 'Clear Creek County, CO': '019', - 'Conejos County, CO': '021', - 'Costilla County, CO': '023', - 'Crowley County, CO': '025', - 'Custer County, CO': '027', - 'Delta County, CO': '029', - 'Denver County/city, CO': '031', - 'Dolores County, CO': '033', - 'Douglas County, CO': '035', - 'Eagle County, CO': '037', - 'El Paso County, CO': '041', - 'Elbert County, CO': '039', - 'Fremont County, CO': '043', - 'Garfield County, CO': '045', - 'Gilpin County, CO': '047', - 'Grand County, CO': '049', - 'Gunnison County, CO': '051', - 'Hinsdale County, CO': '053', - 'Huerfano County, CO': '055', - 'Jackson County, CO': '057', - 'Jefferson County, CO': '059', - 'Kiowa County, CO': '061', - 'Kit Carson County, CO': '063', - 'La Plata County, CO': '067', - 'Lake County, CO': '065', - 'Larimer County, CO': '069', - 'Las Animas County, CO': '071', - 'Lincoln County, CO': '073', - 'Logan County, CO': '075', - 'Mesa County, CO': '077', - 'Mineral County, CO': '079', - 'Moffat County, CO': '081', - 'Montezuma County, CO': '083', - 'Montrose County, CO': '085', - 'Morgan County, CO': '087', - 'Otero County, CO': '089', - 'Ouray County, CO': '091', - 'Park County, CO': '093', - 'Phillips County, CO': '095', - 'Pitkin County, CO': '097', - 'Prowers County, CO': '099', - 'Pueblo County, CO': '101', - 'Rio Blanco County, CO': '103', - 'Rio Grande County, CO': '105', - 'Routt County, CO': '107', - 'Saguache County, CO': '109', - 'San Juan County, CO': '111', - 'San Miguel County, CO': '113', - 'Sedgwick County, CO': '115', - 'Summit County, CO': '117', - 'Teller County, CO': '119', - 'Washington County, CO': '121', - 'Weld County, CO': '123', - 'Yuma County, CO': '125'}, - 9: {'--All--': '%', - 'Fairfield County, CT': '001', - 'Hartford County, CT': '003', - 'Litchfield County, CT': '005', - 'Middlesex County, CT': '007', - 'New Haven County, CT': '009', - 'New London County, CT': '011', - 'Tolland County, CT': '013', - 'Windham County, CT': '015'}, - 10: {'--All--': '%', - 'Kent County, DE': '001', - 'New Castle County, DE': '003', - 'Sussex County, DE': '005'}, - 11: {'--All--': '%', 'District of Columbia': '001'}, - 12: {'--All--': '%', - 'Alachua County, FL': '001', - 'Baker County, FL': '003', - 'Bay County, FL': '005', - 'Bradford County, FL': '007', - 'Brevard County, FL': '009', - 'Broward County, FL': '011', - 'Calhoun County, FL': '013', - 'Charlotte County, FL': '015', - 'Citrus County, FL': '017', - 'Clay County, FL': '019', - 'Collier County, FL': '021', - 'Columbia County, FL': '023', - 'DeSoto County, FL': '027', - 'Dixie County, FL': '029', - 'Duval County, FL': '031', - 'Escambia County, FL': '033', - 'Flagler County, FL': '035', - 'Franklin County, FL': '037', - 'Gadsden County, FL': '039', - 'Gilchrist County, FL': '041', - 'Glades County, FL': '043', - 'Gulf County, FL': '045', - 'Hamilton County, FL': '047', - 'Hardee County, FL': '049', - 'Hendry County, FL': '051', - 'Hernando County, FL': '053', - 'Highlands County, FL': '055', - 'Hillsborough County, FL': '057', - 'Holmes County, FL': '059', - 'Indian River County, FL': '061', - 'Jackson County, FL': '063', - 'Jefferson County, FL': '065', - 'Lafayette County, FL': '067', - 'Lake County, FL': '069', - 'Lee County, FL': '071', - 'Leon County, FL': '073', - 'Levy County, FL': '075', - 'Liberty County, FL': '077', - 'Madison County, FL': '079', - 'Manatee County, FL': '081', - 'Marion County, FL': '083', - 'Martin County, FL': '085', - 'Miami-Dade County, FL': '086', - 'Monroe County, FL': '087', - 'Nassau County, FL': '089', - 'Okaloosa County, FL': '091', - 'Okeechobee County, FL': '093', - 'Orange County, FL': '095', - 'Osceola County, FL': '097', - 'Palm Beach County, FL': '099', - 'Pasco County, FL': '101', - 'Pinellas County, FL': '103', - 'Polk County, FL': '105', - 'Putnam County, FL': '107', - 'Santa Rosa County, FL': '113', - 'Sarasota County, FL': '115', - 'Seminole County, FL': '117', - 'St. Johns County, FL': '109', - 'St. Lucie County, FL': '111', - 'Sumter County, FL': '119', - 'Suwannee County, FL': '121', - 'Taylor County, FL': '123', - 'Union County, FL': '125', - 'Volusia County, FL': '127', - 'Wakulla County, FL': '129', - 'Walton County, FL': '131', - 'Washington County, FL': '133'}, - 13: {'--All--': '%', - 'Appling County, GA': '001', - 'Atkinson County, GA': '003', - 'Bacon County, GA': '005', - 'Baker County, GA': '007', - 'Baldwin County, GA': '009', - 'Banks County, GA': '011', - 'Barrow County, GA': '013', - 'Bartow County, GA': '015', - 'Ben Hill County, GA': '017', - 'Berrien County, GA': '019', - 'Bibb County, GA': '021', - 'Bleckley County, GA': '023', - 'Brantley County, GA': '025', - 'Brooks County, GA': '027', - 'Bryan County, GA': '029', - 'Bulloch County, GA': '031', - 'Burke County, GA': '033', - 'Butts County, GA': '035', - 'Calhoun County, GA': '037', - 'Camden County, GA': '039', - 'Candler County, GA': '043', - 'Carroll County, GA': '045', - 'Catoosa County, GA': '047', - 'Charlton County, GA': '049', - 'Chatham County, GA': '051', - 'Chattahoochee County, GA': '053', - 'Chattooga County, GA': '055', - 'Cherokee County, GA': '057', - 'Clarke County, GA': '059', - 'Clay County, GA': '061', - 'Clayton County, GA': '063', - 'Clinch County, GA': '065', - 'Cobb County, GA': '067', - 'Coffee County, GA': '069', - 'Colquitt County, GA': '071', - 'Columbia County, GA': '073', - 'Cook County, GA': '075', - 'Coweta County, GA': '077', - 'Crawford County, GA': '079', - 'Crisp County, GA': '081', - 'Dade County, GA': '083', - 'Dawson County, GA': '085', - 'DeKalb County, GA': '089', - 'Decatur County, GA': '087', - 'Dodge County, GA': '091', - 'Dooly County, GA': '093', - 'Dougherty County, GA': '095', - 'Douglas County, GA': '097', - 'Early County, GA': '099', - 'Echols County, GA': '101', - 'Effingham County, GA': '103', - 'Elbert County, GA': '105', - 'Emanuel County, GA': '107', - 'Evans County, GA': '109', - 'Fannin County, GA': '111', - 'Fayette County, GA': '113', - 'Floyd County, GA': '115', - 'Forsyth County, GA': '117', - 'Franklin County, GA': '119', - 'Fulton County, GA': '121', - 'Gilmer County, GA': '123', - 'Glascock County, GA': '125', - 'Glynn County, GA': '127', - 'Gordon County, GA': '129', - 'Grady County, GA': '131', - 'Greene County, GA': '133', - 'Gwinnett County, GA': '135', - 'Habersham County, GA': '137', - 'Hall County, GA': '139', - 'Hancock County, GA': '141', - 'Haralson County, GA': '143', - 'Harris County, GA': '145', - 'Hart County, GA': '147', - 'Heard County, GA': '149', - 'Henry County, GA': '151', - 'Houston County, GA': '153', - 'Irwin County, GA': '155', - 'Jackson County, GA': '157', - 'Jasper County, GA': '159', - 'Jeff Davis County, GA': '161', - 'Jefferson County, GA': '163', - 'Jenkins County, GA': '165', - 'Johnson County, GA': '167', - 'Jones County, GA': '169', - 'Lamar County, GA': '171', - 'Lanier County, GA': '173', - 'Laurens County, GA': '175', - 'Lee County, GA': '177', - 'Liberty County, GA': '179', - 'Lincoln County, GA': '181', - 'Long County, GA': '183', - 'Lowndes County, GA': '185', - 'Lumpkin County, GA': '187', - 'Macon County, GA': '193', - 'Madison County, GA': '195', - 'Marion County, GA': '197', - 'McDuffie County, GA': '189', - 'McIntosh County, GA': '191', - 'Meriwether County, GA': '199', - 'Miller County, GA': '201', - 'Mitchell County, GA': '205', - 'Monroe County, GA': '207', - 'Montgomery County, GA': '209', - 'Morgan County, GA': '211', - 'Murray County, GA': '213', - 'Muscogee County, GA': '215', - 'Newton County, GA': '217', - 'Oconee County, GA': '219', - 'Oglethorpe County, GA': '221', - 'Paulding County, GA': '223', - 'Peach County, GA': '225', - 'Pickens County, GA': '227', - 'Pierce County, GA': '229', - 'Pike County, GA': '231', - 'Polk County, GA': '233', - 'Pulaski County, GA': '235', - 'Putnam County, GA': '237', - 'Quitman County, GA': '239', - 'Rabun County, GA': '241', - 'Randolph County, GA': '243', - 'Richmond County, GA': '245', - 'Rockdale County, GA': '247', - 'Schley County, GA': '249', - 'Screven County, GA': '251', - 'Seminole County, GA': '253', - 'Spalding County, GA': '255', - 'Stephens County, GA': '257', - 'Stewart County, GA': '259', - 'Sumter County, GA': '261', - 'Talbot County, GA': '263', - 'Taliaferro County, GA': '265', - 'Tattnall County, GA': '267', - 'Taylor County, GA': '269', - 'Telfair County, GA': '271', - 'Terrell County, GA': '273', - 'Thomas County, GA': '275', - 'Tift County, GA': '277', - 'Toombs County, GA': '279', - 'Towns County, GA': '281', - 'Treutlen County, GA': '283', - 'Troup County, GA': '285', - 'Turner County, GA': '287', - 'Twiggs County, GA': '289', - 'Union County, GA': '291', - 'Upson County, GA': '293', - 'Walker County, GA': '295', - 'Walton County, GA': '297', - 'Ware County, GA': '299', - 'Warren County, GA': '301', - 'Washington County, GA': '303', - 'Wayne County, GA': '305', - 'Webster County, GA': '307', - 'Wheeler County, GA': '309', - 'White County, GA': '311', - 'Whitfield County, GA': '313', - 'Wilcox County, GA': '315', - 'Wilkes County, GA': '317', - 'Wilkinson County, GA': '319', - 'Worth County, GA': '321'}, - 15: {'--All--': '%', - 'Hawaii County, HI': '001', - 'Honolulu County/city, HI': '003', - 'Kauai County, HI': '007', - 'Maui County, HI': '009'}, - 16: {'--All--': '%', - 'Ada County, ID': '001', - 'Adams County, ID': '003', - 'Bannock County, ID': '005', - 'Bear Lake County, ID': '007', - 'Benewah County, ID': '009', - 'Bingham County, ID': '011', - 'Blaine County, ID': '013', - 'Boise County, ID': '015', - 'Bonner County, ID': '017', - 'Bonneville County, ID': '019', - 'Boundary County, ID': '021', - 'Butte County, ID': '023', - 'Camas County, ID': '025', - 'Canyon County, ID': '027', - 'Caribou County, ID': '029', - 'Cassia County, ID': '031', - 'Clark County, ID': '033', - 'Clearwater County, ID': '035', - 'Custer County, ID': '037', - 'Elmore County, ID': '039', - 'Franklin County, ID': '041', - 'Fremont County, ID': '043', - 'Gem County, ID': '045', - 'Gooding County, ID': '047', - 'Idaho County, ID': '049', - 'Jefferson County, ID': '051', - 'Jerome County, ID': '053', - 'Kootenai County, ID': '055', - 'Latah County, ID': '057', - 'Lemhi County, ID': '059', - 'Lewis County, ID': '061', - 'Lincoln County, ID': '063', - 'Madison County, ID': '065', - 'Minidoka County, ID': '067', - 'Nez Perce County, ID': '069', - 'Oneida County, ID': '071', - 'Owyhee County, ID': '073', - 'Payette County, ID': '075', - 'Power County, ID': '077', - 'Shoshone County, ID': '079', - 'Teton County, ID': '081', - 'Twin Falls County, ID': '083', - 'Valley County, ID': '085', - 'Washington County, ID': '087'}, - 17: {'--All--': '%', - 'Adams County, IL': '001', - 'Alexander County, IL': '003', - 'Bond County, IL': '005', - 'Boone County, IL': '007', - 'Brown County, IL': '009', - 'Bureau County, IL': '011', - 'Calhoun County, IL': '013', - 'Carroll County, IL': '015', - 'Cass County, IL': '017', - 'Champaign County, IL': '019', - 'Christian County, IL': '021', - 'Clark County, IL': '023', - 'Clay County, IL': '025', - 'Clinton County, IL': '027', - 'Coles County, IL': '029', - 'Cook County, IL': '031', - 'Crawford County, IL': '033', - 'Cumberland County, IL': '035', - 'De Witt County, IL': '039', - 'DeKalb County, IL': '037', - 'Douglas County, IL': '041', - 'DuPage County, IL': '043', - 'Edgar County, IL': '045', - 'Edwards County, IL': '047', - 'Effingham County, IL': '049', - 'Fayette County, IL': '051', - 'Ford County, IL': '053', - 'Franklin County, IL': '055', - 'Fulton County, IL': '057', - 'Gallatin County, IL': '059', - 'Greene County, IL': '061', - 'Grundy County, IL': '063', - 'Hamilton County, IL': '065', - 'Hancock County, IL': '067', - 'Hardin County, IL': '069', - 'Henderson County, IL': '071', - 'Henry County, IL': '073', - 'Iroquois County, IL': '075', - 'Jackson County, IL': '077', - 'Jasper County, IL': '079', - 'Jefferson County, IL': '081', - 'Jersey County, IL': '083', - 'Jo Daviess County, IL': '085', - 'Johnson County, IL': '087', - 'Kane County, IL': '089', - 'Kankakee County, IL': '091', - 'Kendall County, IL': '093', - 'Knox County, IL': '095', - 'La Salle County, IL': '099', - 'Lake County, IL': '097', - 'Lawrence County, IL': '101', - 'Lee County, IL': '103', - 'Livingston County, IL': '105', - 'Logan County, IL': '107', - 'Macon County, IL': '115', - 'Macoupin County, IL': '117', - 'Madison County, IL': '119', - 'Marion County, IL': '121', - 'Marshall County, IL': '123', - 'Mason County, IL': '125', - 'Massac County, IL': '127', - 'McDonough County, IL': '109', - 'McHenry County, IL': '111', - 'McLean County, IL': '113', - 'Menard County, IL': '129', - 'Mercer County, IL': '131', - 'Monroe County, IL': '133', - 'Montgomery County, IL': '135', - 'Morgan County, IL': '137', - 'Moultrie County, IL': '139', - 'Ogle County, IL': '141', - 'Peoria County, IL': '143', - 'Perry County, IL': '145', - 'Piatt County, IL': '147', - 'Pike County, IL': '149', - 'Pope County, IL': '151', - 'Pulaski County, IL': '153', - 'Putnam County, IL': '155', - 'Randolph County, IL': '157', - 'Richland County, IL': '159', - 'Rock Island County, IL': '161', - 'Saline County, IL': '165', - 'Sangamon County, IL': '167', - 'Schuyler County, IL': '169', - 'Scott County, IL': '171', - 'Shelby County, IL': '173', - 'St. Clair County, IL': '163', - 'Stark County, IL': '175', - 'Stephenson County, IL': '177', - 'Tazewell County, IL': '179', - 'Union County, IL': '181', - 'Vermilion County, IL': '183', - 'Wabash County, IL': '185', - 'Warren County, IL': '187', - 'Washington County, IL': '189', - 'Wayne County, IL': '191', - 'White County, IL': '193', - 'Whiteside County, IL': '195', - 'Will County, IL': '197', - 'Williamson County, IL': '199', - 'Winnebago County, IL': '201', - 'Woodford County, IL': '203'}, - 18: {'--All--': '%', - 'Adams County, IN': '001', - 'Allen County, IN': '003', - 'Bartholomew County, IN': '005', - 'Benton County, IN': '007', - 'Blackford County, IN': '009', - 'Boone County, IN': '011', - 'Brown County, IN': '013', - 'Carroll County, IN': '015', - 'Cass County, IN': '017', - 'Clark County, IN': '019', - 'Clay County, IN': '021', - 'Clinton County, IN': '023', - 'Crawford County, IN': '025', - 'Daviess County, IN': '027', - 'DeKalb County, IN': '033', - 'Dearborn County, IN': '029', - 'Decatur County, IN': '031', - 'Delaware County, IN': '035', - 'Dubois County, IN': '037', - 'Elkhart County, IN': '039', - 'Fayette County, IN': '041', - 'Floyd County, IN': '043', - 'Fountain County, IN': '045', - 'Franklin County, IN': '047', - 'Fulton County, IN': '049', - 'Gibson County, IN': '051', - 'Grant County, IN': '053', - 'Greene County, IN': '055', - 'Hamilton County, IN': '057', - 'Hancock County, IN': '059', - 'Harrison County, IN': '061', - 'Hendricks County, IN': '063', - 'Henry County, IN': '065', - 'Howard County, IN': '067', - 'Huntington County, IN': '069', - 'Jackson County, IN': '071', - 'Jasper County, IN': '073', - 'Jay County, IN': '075', - 'Jefferson County, IN': '077', - 'Jennings County, IN': '079', - 'Johnson County, IN': '081', - 'Knox County, IN': '083', - 'Kosciusko County, IN': '085', - 'LaGrange County, IN': '087', - 'LaPorte County, IN': '091', - 'Lake County, IN': '089', - 'Lawrence County, IN': '093', - 'Madison County, IN': '095', - 'Marion County, IN': '097', - 'Marshall County, IN': '099', - 'Martin County, IN': '101', - 'Miami County, IN': '103', - 'Monroe County, IN': '105', - 'Montgomery County, IN': '107', - 'Morgan County, IN': '109', - 'Newton County, IN': '111', - 'Noble County, IN': '113', - 'Ohio County, IN': '115', - 'Orange County, IN': '117', - 'Owen County, IN': '119', - 'Parke County, IN': '121', - 'Perry County, IN': '123', - 'Pike County, IN': '125', - 'Porter County, IN': '127', - 'Posey County, IN': '129', - 'Pulaski County, IN': '131', - 'Putnam County, IN': '133', - 'Randolph County, IN': '135', - 'Ripley County, IN': '137', - 'Rush County, IN': '139', - 'Scott County, IN': '143', - 'Shelby County, IN': '145', - 'Spencer County, IN': '147', - 'St. Joseph County, IN': '141', - 'Starke County, IN': '149', - 'Steuben County, IN': '151', - 'Sullivan County, IN': '153', - 'Switzerland County, IN': '155', - 'Tippecanoe County, IN': '157', - 'Tipton County, IN': '159', - 'Union County, IN': '161', - 'Vanderburgh County, IN': '163', - 'Vermillion County, IN': '165', - 'Vigo County, IN': '167', - 'Wabash County, IN': '169', - 'Warren County, IN': '171', - 'Warrick County, IN': '173', - 'Washington County, IN': '175', - 'Wayne County, IN': '177', - 'Wells County, IN': '179', - 'White County, IN': '181', - 'Whitley County, IN': '183'}, - 19: {'--All--': '%', - 'Adair County, IA': '001', - 'Adams County, IA': '003', - 'Allamakee County, IA': '005', - 'Appanoose County, IA': '007', - 'Audubon County, IA': '009', - 'Benton County, IA': '011', - 'Black Hawk County, IA': '013', - 'Boone County, IA': '015', - 'Bremer County, IA': '017', - 'Buchanan County, IA': '019', - 'Buena Vista County, IA': '021', - 'Butler County, IA': '023', - 'Calhoun County, IA': '025', - 'Carroll County, IA': '027', - 'Cass County, IA': '029', - 'Cedar County, IA': '031', - 'Cerro Gordo County, IA': '033', - 'Cherokee County, IA': '035', - 'Chickasaw County, IA': '037', - 'Clarke County, IA': '039', - 'Clay County, IA': '041', - 'Clayton County, IA': '043', - 'Clinton County, IA': '045', - 'Crawford County, IA': '047', - 'Dallas County, IA': '049', - 'Davis County, IA': '051', - 'Decatur County, IA': '053', - 'Delaware County, IA': '055', - 'Des Moines County, IA': '057', - 'Dickinson County, IA': '059', - 'Dubuque County, IA': '061', - 'Emmet County, IA': '063', - 'Fayette County, IA': '065', - 'Floyd County, IA': '067', - 'Franklin County, IA': '069', - 'Fremont County, IA': '071', - 'Greene County, IA': '073', - 'Grundy County, IA': '075', - 'Guthrie County, IA': '077', - 'Hamilton County, IA': '079', - 'Hancock County, IA': '081', - 'Hardin County, IA': '083', - 'Harrison County, IA': '085', - 'Henry County, IA': '087', - 'Howard County, IA': '089', - 'Humboldt County, IA': '091', - 'Ida County, IA': '093', - 'Iowa County, IA': '095', - 'Jackson County, IA': '097', - 'Jasper County, IA': '099', - 'Jefferson County, IA': '101', - 'Johnson County, IA': '103', - 'Jones County, IA': '105', - 'Keokuk County, IA': '107', - 'Kossuth County, IA': '109', - 'Lee County, IA': '111', - 'Linn County, IA': '113', - 'Louisa County, IA': '115', - 'Lucas County, IA': '117', - 'Lyon County, IA': '119', - 'Madison County, IA': '121', - 'Mahaska County, IA': '123', - 'Marion County, IA': '125', - 'Marshall County, IA': '127', - 'Mills County, IA': '129', - 'Mitchell County, IA': '131', - 'Monona County, IA': '133', - 'Monroe County, IA': '135', - 'Montgomery County, IA': '137', - 'Muscatine County, IA': '139', - "O'Brien County, IA": '141', - 'Osceola County, IA': '143', - 'Page County, IA': '145', - 'Palo Alto County, IA': '147', - 'Plymouth County, IA': '149', - 'Pocahontas County, IA': '151', - 'Polk County, IA': '153', - 'Pottawattamie County, IA': '155', - 'Poweshiek County, IA': '157', - 'Ringgold County, IA': '159', - 'Sac County, IA': '161', - 'Scott County, IA': '163', - 'Shelby County, IA': '165', - 'Sioux County, IA': '167', - 'Story County, IA': '169', - 'Tama County, IA': '171', - 'Taylor County, IA': '173', - 'Union County, IA': '175', - 'Van Buren County, IA': '177', - 'Wapello County, IA': '179', - 'Warren County, IA': '181', - 'Washington County, IA': '183', - 'Wayne County, IA': '185', - 'Webster County, IA': '187', - 'Winnebago County, IA': '189', - 'Winneshiek County, IA': '191', - 'Woodbury County, IA': '193', - 'Worth County, IA': '195', - 'Wright County, IA': '197'}, - 20: {'--All--': '%', - 'Allen County, KS': '001', - 'Anderson County, KS': '003', - 'Atchison County, KS': '005', - 'Barber County, KS': '007', - 'Barton County, KS': '009', - 'Bourbon County, KS': '011', - 'Brown County, KS': '013', - 'Butler County, KS': '015', - 'Chase County, KS': '017', - 'Chautauqua County, KS': '019', - 'Cherokee County, KS': '021', - 'Cheyenne County, KS': '023', - 'Clark County, KS': '025', - 'Clay County, KS': '027', - 'Cloud County, KS': '029', - 'Coffey County, KS': '031', - 'Comanche County, KS': '033', - 'Cowley County, KS': '035', - 'Crawford County, KS': '037', - 'Decatur County, KS': '039', - 'Dickinson County, KS': '041', - 'Doniphan County, KS': '043', - 'Douglas County, KS': '045', - 'Edwards County, KS': '047', - 'Elk County, KS': '049', - 'Ellis County, KS': '051', - 'Ellsworth County, KS': '053', - 'Finney County, KS': '055', - 'Ford County, KS': '057', - 'Franklin County, KS': '059', - 'Geary County, KS': '061', - 'Gove County, KS': '063', - 'Graham County, KS': '065', - 'Grant County, KS': '067', - 'Gray County, KS': '069', - 'Greeley County, KS': '071', - 'Greenwood County, KS': '073', - 'Hamilton County, KS': '075', - 'Harper County, KS': '077', - 'Harvey County, KS': '079', - 'Haskell County, KS': '081', - 'Hodgeman County, KS': '083', - 'Jackson County, KS': '085', - 'Jefferson County, KS': '087', - 'Jewell County, KS': '089', - 'Johnson County, KS': '091', - 'Kearny County, KS': '093', - 'Kingman County, KS': '095', - 'Kiowa County, KS': '097', - 'Labette County, KS': '099', - 'Lane County, KS': '101', - 'Leavenworth County, KS': '103', - 'Lincoln County, KS': '105', - 'Linn County, KS': '107', - 'Logan County, KS': '109', - 'Lyon County, KS': '111', - 'Marion County, KS': '115', - 'Marshall County, KS': '117', - 'McPherson County, KS': '113', - 'Meade County, KS': '119', - 'Miami County, KS': '121', - 'Mitchell County, KS': '123', - 'Montgomery County, KS': '125', - 'Morris County, KS': '127', - 'Morton County, KS': '129', - 'Nemaha County, KS': '131', - 'Neosho County, KS': '133', - 'Ness County, KS': '135', - 'Norton County, KS': '137', - 'Osage County, KS': '139', - 'Osborne County, KS': '141', - 'Ottawa County, KS': '143', - 'Pawnee County, KS': '145', - 'Phillips County, KS': '147', - 'Pottawatomie County, KS': '149', - 'Pratt County, KS': '151', - 'Rawlins County, KS': '153', - 'Reno County, KS': '155', - 'Republic County, KS': '157', - 'Rice County, KS': '159', - 'Riley County, KS': '161', - 'Rooks County, KS': '163', - 'Rush County, KS': '165', - 'Russell County, KS': '167', - 'Saline County, KS': '169', - 'Scott County, KS': '171', - 'Sedgwick County, KS': '173', - 'Seward County, KS': '175', - 'Shawnee County, KS': '177', - 'Sheridan County, KS': '179', - 'Sherman County, KS': '181', - 'Smith County, KS': '183', - 'Stafford County, KS': '185', - 'Stanton County, KS': '187', - 'Stevens County, KS': '189', - 'Sumner County, KS': '191', - 'Thomas County, KS': '193', - 'Trego County, KS': '195', - 'Wabaunsee County, KS': '197', - 'Wallace County, KS': '199', - 'Washington County, KS': '201', - 'Wichita County, KS': '203', - 'Wilson County, KS': '205', - 'Woodson County, KS': '207', - 'Wyandotte County, KS': '209'}, - 21: {'--All--': '%', - 'Adair County, KY': '001', - 'Allen County, KY': '003', - 'Anderson County, KY': '005', - 'Ballard County, KY': '007', - 'Barren County, KY': '009', - 'Bath County, KY': '011', - 'Bell County, KY': '013', - 'Boone County, KY': '015', - 'Bourbon County, KY': '017', - 'Boyd County, KY': '019', - 'Boyle County, KY': '021', - 'Bracken County, KY': '023', - 'Breathitt County, KY': '025', - 'Breckinridge County, KY': '027', - 'Bullitt County, KY': '029', - 'Butler County, KY': '031', - 'Caldwell County, KY': '033', - 'Calloway County, KY': '035', - 'Campbell County, KY': '037', - 'Carlisle County, KY': '039', - 'Carroll County, KY': '041', - 'Carter County, KY': '043', - 'Casey County, KY': '045', - 'Christian County, KY': '047', - 'Clark County, KY': '049', - 'Clay County, KY': '051', - 'Clinton County, KY': '053', - 'Crittenden County, KY': '055', - 'Cumberland County, KY': '057', - 'Daviess County, KY': '059', - 'Edmonson County, KY': '061', - 'Elliott County, KY': '063', - 'Estill County, KY': '065', - 'Fayette County, KY': '067', - 'Fleming County, KY': '069', - 'Floyd County, KY': '071', - 'Franklin County, KY': '073', - 'Fulton County, KY': '075', - 'Gallatin County, KY': '077', - 'Garrard County, KY': '079', - 'Grant County, KY': '081', - 'Graves County, KY': '083', - 'Grayson County, KY': '085', - 'Green County, KY': '087', - 'Greenup County, KY': '089', - 'Hancock County, KY': '091', - 'Hardin County, KY': '093', - 'Harlan County, KY': '095', - 'Harrison County, KY': '097', - 'Hart County, KY': '099', - 'Henderson County, KY': '101', - 'Henry County, KY': '103', - 'Hickman County, KY': '105', - 'Hopkins County, KY': '107', - 'Jackson County, KY': '109', - 'Jefferson County, KY': '111', - 'Jessamine County, KY': '113', - 'Johnson County, KY': '115', - 'Kenton County, KY': '117', - 'Knott County, KY': '119', - 'Knox County, KY': '121', - 'Larue County, KY': '123', - 'Laurel County, KY': '125', - 'Lawrence County, KY': '127', - 'Lee County, KY': '129', - 'Leslie County, KY': '131', - 'Letcher County, KY': '133', - 'Lewis County, KY': '135', - 'Lincoln County, KY': '137', - 'Livingston County, KY': '139', - 'Logan County, KY': '141', - 'Lyon County, KY': '143', - 'Madison County, KY': '151', - 'Magoffin County, KY': '153', - 'Marion County, KY': '155', - 'Marshall County, KY': '157', - 'Martin County, KY': '159', - 'Mason County, KY': '161', - 'McCracken County, KY': '145', - 'McCreary County, KY': '147', - 'McLean County, KY': '149', - 'Meade County, KY': '163', - 'Menifee County, KY': '165', - 'Mercer County, KY': '167', - 'Metcalfe County, KY': '169', - 'Monroe County, KY': '171', - 'Montgomery County, KY': '173', - 'Morgan County, KY': '175', - 'Muhlenberg County, KY': '177', - 'Nelson County, KY': '179', - 'Nicholas County, KY': '181', - 'Ohio County, KY': '183', - 'Oldham County, KY': '185', - 'Owen County, KY': '187', - 'Owsley County, KY': '189', - 'Pendleton County, KY': '191', - 'Perry County, KY': '193', - 'Pike County, KY': '195', - 'Powell County, KY': '197', - 'Pulaski County, KY': '199', - 'Robertson County, KY': '201', - 'Rockcastle County, KY': '203', - 'Rowan County, KY': '205', - 'Russell County, KY': '207', - 'Scott County, KY': '209', - 'Shelby County, KY': '211', - 'Simpson County, KY': '213', - 'Spencer County, KY': '215', - 'Taylor County, KY': '217', - 'Todd County, KY': '219', - 'Trigg County, KY': '221', - 'Trimble County, KY': '223', - 'Union County, KY': '225', - 'Warren County, KY': '227', - 'Washington County, KY': '229', - 'Wayne County, KY': '231', - 'Webster County, KY': '233', - 'Whitley County, KY': '235', - 'Wolfe County, KY': '237', - 'Woodford County, KY': '239'}, - 22: {'--All--': '%', - 'Acadia Parish, LA': '001', - 'Allen Parish, LA': '003', - 'Ascension Parish, LA': '005', - 'Assumption Parish, LA': '007', - 'Avoyelles Parish, LA': '009', - 'Beauregard Parish, LA': '011', - 'Bienville Parish, LA': '013', - 'Bossier Parish, LA': '015', - 'Caddo Parish, LA': '017', - 'Calcasieu Parish, LA': '019', - 'Caldwell Parish, LA': '021', - 'Cameron Parish, LA': '023', - 'Catahoula Parish, LA': '025', - 'Claiborne Parish, LA': '027', - 'Concordia Parish, LA': '029', - 'De Soto Parish, LA': '031', - 'East Baton Rouge Parish, LA': '033', - 'East Carroll Parish, LA': '035', - 'East Feliciana Parish, LA': '037', - 'Evangeline Parish, LA': '039', - 'Franklin Parish, LA': '041', - 'Grant Parish, LA': '043', - 'Iberia Parish, LA': '045', - 'Iberville Parish, LA': '047', - 'Jackson Parish, LA': '049', - 'Jefferson Davis Parish, LA': '053', - 'Jefferson Parish, LA': '051', - 'La Salle Parish, LA': '059', - 'Lafayette Parish, LA': '055', - 'Lafourche Parish, LA': '057', - 'Lincoln Parish, LA': '061', - 'Livingston Parish, LA': '063', - 'Madison Parish, LA': '065', - 'Morehouse Parish, LA': '067', - 'Natchitoches Parish, LA': '069', - 'Orleans Parish, LA': '071', - 'Ouachita Parish, LA': '073', - 'Plaquemines Parish, LA': '075', - 'Pointe Coupee Parish, LA': '077', - 'Rapides Parish, LA': '079', - 'Red River Parish, LA': '081', - 'Richland Parish, LA': '083', - 'Sabine Parish, LA': '085', - 'St. Bernard Parish, LA': '087', - 'St. Charles Parish, LA': '089', - 'St. Helena Parish, LA': '091', - 'St. James Parish, LA': '093', - 'St. John the Baptist Parish, LA': '095', - 'St. Landry Parish, LA': '097', - 'St. Martin Parish, LA': '099', - 'St. Mary Parish, LA': '101', - 'St. Tammany Parish, LA': '103', - 'Tangipahoa Parish, LA': '105', - 'Tensas Parish, LA': '107', - 'Terrebonne Parish, LA': '109', - 'Union Parish, LA': '111', - 'Vermilion Parish, LA': '113', - 'Vernon Parish, LA': '115', - 'Washington Parish, LA': '117', - 'Webster Parish, LA': '119', - 'West Baton Rouge Parish, LA': '121', - 'West Carroll Parish, LA': '123', - 'West Feliciana Parish, LA': '125', - 'Winn Parish, LA': '127'}, - 23: {'--All--': '%', - 'Androscoggin County, ME': '001', - 'Aroostook County, ME': '003', - 'Cumberland County, ME': '005', - 'Franklin County, ME': '007', - 'Hancock County, ME': '009', - 'Kennebec County, ME': '011', - 'Knox County, ME': '013', - 'Lincoln County, ME': '015', - 'Oxford County, ME': '017', - 'Penobscot County, ME': '019', - 'Piscataquis County, ME': '021', - 'Sagadahoc County, ME': '023', - 'Somerset County, ME': '025', - 'Waldo County, ME': '027', - 'Washington County, ME': '029', - 'York County, ME': '031'}, - 24: {'--All--': '%', - 'Allegany County, MD': '001', - 'Anne Arundel County, MD': '003', - 'Baltimore County, MD': '005', - 'Baltimore city, MD': '510', - 'Calvert County, MD': '009', - 'Caroline County, MD': '011', - 'Carroll County, MD': '013', - 'Cecil County, MD': '015', - 'Charles County, MD': '017', - 'Dorchester County, MD': '019', - 'Frederick County, MD': '021', - 'Garrett County, MD': '023', - 'Harford County, MD': '025', - 'Howard County, MD': '027', - 'Kent County, MD': '029', - 'Montgomery County, MD': '031', - "Prince George's County, MD": '033', - "Queen Anne's County, MD": '035', - 'Somerset County, MD': '039', - "St. Mary's County, MD": '037', - 'Talbot County, MD': '041', - 'Washington County, MD': '043', - 'Wicomico County, MD': '045', - 'Worcester County, MD': '047'}, - 25: {'--All--': '%', - 'Barnstable County, MA': '001', - 'Berkshire County, MA': '003', - 'Bristol County, MA': '005', - 'Dukes County, MA': '007', - 'Essex County, MA': '009', - 'Franklin County, MA': '011', - 'Hampden County, MA': '013', - 'Hampshire County, MA': '015', - 'Middlesex County, MA': '017', - 'Nantucket County/town, MA': '019', - 'Norfolk County, MA': '021', - 'Plymouth County, MA': '023', - 'Suffolk County, MA': '025', - 'Worcester County, MA': '027'}, - 26: {'--All--': '%', - 'Alcona County, MI': '001', - 'Alger County, MI': '003', - 'Allegan County, MI': '005', - 'Alpena County, MI': '007', - 'Antrim County, MI': '009', - 'Arenac County, MI': '011', - 'Baraga County, MI': '013', - 'Barry County, MI': '015', - 'Bay County, MI': '017', - 'Benzie County, MI': '019', - 'Berrien County, MI': '021', - 'Branch County, MI': '023', - 'Calhoun County, MI': '025', - 'Cass County, MI': '027', - 'Charlevoix County, MI': '029', - 'Cheboygan County, MI': '031', - 'Chippewa County, MI': '033', - 'Clare County, MI': '035', - 'Clinton County, MI': '037', - 'Crawford County, MI': '039', - 'Delta County, MI': '041', - 'Dickinson County, MI': '043', - 'Eaton County, MI': '045', - 'Emmet County, MI': '047', - 'Genesee County, MI': '049', - 'Gladwin County, MI': '051', - 'Gogebic County, MI': '053', - 'Grand Traverse County, MI': '055', - 'Gratiot County, MI': '057', - 'Hillsdale County, MI': '059', - 'Houghton County, MI': '061', - 'Huron County, MI': '063', - 'Ingham County, MI': '065', - 'Ionia County, MI': '067', - 'Iosco County, MI': '069', - 'Iron County, MI': '071', - 'Isabella County, MI': '073', - 'Jackson County, MI': '075', - 'Kalamazoo County, MI': '077', - 'Kalkaska County, MI': '079', - 'Kent County, MI': '081', - 'Keweenaw County, MI': '083', - 'Lake County, MI': '085', - 'Lapeer County, MI': '087', - 'Leelanau County, MI': '089', - 'Lenawee County, MI': '091', - 'Livingston County, MI': '093', - 'Luce County, MI': '095', - 'Mackinac County, MI': '097', - 'Macomb County, MI': '099', - 'Manistee County, MI': '101', - 'Marquette County, MI': '103', - 'Mason County, MI': '105', - 'Mecosta County, MI': '107', - 'Menominee County, MI': '109', - 'Midland County, MI': '111', - 'Missaukee County, MI': '113', - 'Monroe County, MI': '115', - 'Montcalm County, MI': '117', - 'Montmorency County, MI': '119', - 'Muskegon County, MI': '121', - 'Newaygo County, MI': '123', - 'Oakland County, MI': '125', - 'Oceana County, MI': '127', - 'Ogemaw County, MI': '129', - 'Ontonagon County, MI': '131', - 'Osceola County, MI': '133', - 'Oscoda County, MI': '135', - 'Otsego County, MI': '137', - 'Ottawa County, MI': '139', - 'Presque Isle County, MI': '141', - 'Roscommon County, MI': '143', - 'Saginaw County, MI': '145', - 'Sanilac County, MI': '151', - 'Schoolcraft County, MI': '153', - 'Shiawassee County, MI': '155', - 'St. Clair County, MI': '147', - 'St. Joseph County, MI': '149', - 'Tuscola County, MI': '157', - 'Van Buren County, MI': '159', - 'Washtenaw County, MI': '161', - 'Wayne County, MI': '163', - 'Wexford County, MI': '165'}, - 27: {'--All--': '%', - 'Aitkin County, MN': '001', - 'Anoka County, MN': '003', - 'Becker County, MN': '005', - 'Beltrami County, MN': '007', - 'Benton County, MN': '009', - 'Big Stone County, MN': '011', - 'Blue Earth County, MN': '013', - 'Brown County, MN': '015', - 'Carlton County, MN': '017', - 'Carver County, MN': '019', - 'Cass County, MN': '021', - 'Chippewa County, MN': '023', - 'Chisago County, MN': '025', - 'Clay County, MN': '027', - 'Clearwater County, MN': '029', - 'Cook County, MN': '031', - 'Cottonwood County, MN': '033', - 'Crow Wing County, MN': '035', - 'Dakota County, MN': '037', - 'Dodge County, MN': '039', - 'Douglas County, MN': '041', - 'Faribault County, MN': '043', - 'Fillmore County, MN': '045', - 'Freeborn County, MN': '047', - 'Goodhue County, MN': '049', - 'Grant County, MN': '051', - 'Hennepin County, MN': '053', - 'Houston County, MN': '055', - 'Hubbard County, MN': '057', - 'Isanti County, MN': '059', - 'Itasca County, MN': '061', - 'Jackson County, MN': '063', - 'Kanabec County, MN': '065', - 'Kandiyohi County, MN': '067', - 'Kittson County, MN': '069', - 'Koochiching County, MN': '071', - 'Lac qui Parle County, MN': '073', - 'Lake County, MN': '075', - 'Lake of the Woods County, MN': '077', - 'Le Sueur County, MN': '079', - 'Lincoln County, MN': '081', - 'Lyon County, MN': '083', - 'Mahnomen County, MN': '087', - 'Marshall County, MN': '089', - 'Martin County, MN': '091', - 'McLeod County, MN': '085', - 'Meeker County, MN': '093', - 'Mille Lacs County, MN': '095', - 'Morrison County, MN': '097', - 'Mower County, MN': '099', - 'Murray County, MN': '101', - 'Nicollet County, MN': '103', - 'Nobles County, MN': '105', - 'Norman County, MN': '107', - 'Olmsted County, MN': '109', - 'Otter Tail County, MN': '111', - 'Pennington County, MN': '113', - 'Pine County, MN': '115', - 'Pipestone County, MN': '117', - 'Polk County, MN': '119', - 'Pope County, MN': '121', - 'Ramsey County, MN': '123', - 'Red Lake County, MN': '125', - 'Redwood County, MN': '127', - 'Renville County, MN': '129', - 'Rice County, MN': '131', - 'Rock County, MN': '133', - 'Roseau County, MN': '135', - 'Scott County, MN': '139', - 'Sherburne County, MN': '141', - 'Sibley County, MN': '143', - 'St. Louis County, MN': '137', - 'Stearns County, MN': '145', - 'Steele County, MN': '147', - 'Stevens County, MN': '149', - 'Swift County, MN': '151', - 'Todd County, MN': '153', - 'Traverse County, MN': '155', - 'Wabasha County, MN': '157', - 'Wadena County, MN': '159', - 'Waseca County, MN': '161', - 'Washington County, MN': '163', - 'Watonwan County, MN': '165', - 'Wilkin County, MN': '167', - 'Winona County, MN': '169', - 'Wright County, MN': '171', - 'Yellow Medicine County, MN': '173'}, - 28: {'--All--': '%', - 'Adams County, MS': '001', - 'Alcorn County, MS': '003', - 'Amite County, MS': '005', - 'Attala County, MS': '007', - 'Benton County, MS': '009', - 'Bolivar County, MS': '011', - 'Calhoun County, MS': '013', - 'Carroll County, MS': '015', - 'Chickasaw County, MS': '017', - 'Choctaw County, MS': '019', - 'Claiborne County, MS': '021', - 'Clarke County, MS': '023', - 'Clay County, MS': '025', - 'Coahoma County, MS': '027', - 'Copiah County, MS': '029', - 'Covington County, MS': '031', - 'DeSoto County, MS': '033', - 'Forrest County, MS': '035', - 'Franklin County, MS': '037', - 'George County, MS': '039', - 'Greene County, MS': '041', - 'Grenada County, MS': '043', - 'Hancock County, MS': '045', - 'Harrison County, MS': '047', - 'Hinds County, MS': '049', - 'Holmes County, MS': '051', - 'Humphreys County, MS': '053', - 'Issaquena County, MS': '055', - 'Itawamba County, MS': '057', - 'Jackson County, MS': '059', - 'Jasper County, MS': '061', - 'Jefferson County, MS': '063', - 'Jefferson Davis County, MS': '065', - 'Jones County, MS': '067', - 'Kemper County, MS': '069', - 'Lafayette County, MS': '071', - 'Lamar County, MS': '073', - 'Lauderdale County, MS': '075', - 'Lawrence County, MS': '077', - 'Leake County, MS': '079', - 'Lee County, MS': '081', - 'Leflore County, MS': '083', - 'Lincoln County, MS': '085', - 'Lowndes County, MS': '087', - 'Madison County, MS': '089', - 'Marion County, MS': '091', - 'Marshall County, MS': '093', - 'Monroe County, MS': '095', - 'Montgomery County, MS': '097', - 'Neshoba County, MS': '099', - 'Newton County, MS': '101', - 'Noxubee County, MS': '103', - 'Oktibbeha County, MS': '105', - 'Panola County, MS': '107', - 'Pearl River County, MS': '109', - 'Perry County, MS': '111', - 'Pike County, MS': '113', - 'Pontotoc County, MS': '115', - 'Prentiss County, MS': '117', - 'Quitman County, MS': '119', - 'Rankin County, MS': '121', - 'Scott County, MS': '123', - 'Sharkey County, MS': '125', - 'Simpson County, MS': '127', - 'Smith County, MS': '129', - 'Stone County, MS': '131', - 'Sunflower County, MS': '133', - 'Tallahatchie County, MS': '135', - 'Tate County, MS': '137', - 'Tippah County, MS': '139', - 'Tishomingo County, MS': '141', - 'Tunica County, MS': '143', - 'Union County, MS': '145', - 'Walthall County, MS': '147', - 'Warren County, MS': '149', - 'Washington County, MS': '151', - 'Wayne County, MS': '153', - 'Webster County, MS': '155', - 'Wilkinson County, MS': '157', - 'Winston County, MS': '159', - 'Yalobusha County, MS': '161', - 'Yazoo County, MS': '163'}, - 29: {'--All--': '%', - 'Adair County, MO': '001', - 'Andrew County, MO': '003', - 'Atchison County, MO': '005', - 'Audrain County, MO': '007', - 'Barry County, MO': '009', - 'Barton County, MO': '011', - 'Bates County, MO': '013', - 'Benton County, MO': '015', - 'Bollinger County, MO': '017', - 'Boone County, MO': '019', - 'Buchanan County, MO': '021', - 'Butler County, MO': '023', - 'Caldwell County, MO': '025', - 'Callaway County, MO': '027', - 'Camden County, MO': '029', - 'Cape Girardeau County, MO': '031', - 'Carroll County, MO': '033', - 'Carter County, MO': '035', - 'Cass County, MO': '037', - 'Cedar County, MO': '039', - 'Chariton County, MO': '041', - 'Christian County, MO': '043', - 'Clark County, MO': '045', - 'Clay County, MO': '047', - 'Clinton County, MO': '049', - 'Cole County, MO': '051', - 'Cooper County, MO': '053', - 'Crawford County, MO': '055', - 'Dade County, MO': '057', - 'Dallas County, MO': '059', - 'Daviess County, MO': '061', - 'DeKalb County, MO': '063', - 'Dent County, MO': '065', - 'Douglas County, MO': '067', - 'Dunklin County, MO': '069', - 'Franklin County, MO': '071', - 'Gasconade County, MO': '073', - 'Gentry County, MO': '075', - 'Greene County, MO': '077', - 'Grundy County, MO': '079', - 'Harrison County, MO': '081', - 'Henry County, MO': '083', - 'Hickory County, MO': '085', - 'Holt County, MO': '087', - 'Howard County, MO': '089', - 'Howell County, MO': '091', - 'Iron County, MO': '093', - 'Jackson County, MO': '095', - 'Jasper County, MO': '097', - 'Jefferson County, MO': '099', - 'Johnson County, MO': '101', - 'Knox County, MO': '103', - 'Laclede County, MO': '105', - 'Lafayette County, MO': '107', - 'Lawrence County, MO': '109', - 'Lewis County, MO': '111', - 'Lincoln County, MO': '113', - 'Linn County, MO': '115', - 'Livingston County, MO': '117', - 'Macon County, MO': '121', - 'Madison County, MO': '123', - 'Maries County, MO': '125', - 'Marion County, MO': '127', - 'McDonald County, MO': '119', - 'Mercer County, MO': '129', - 'Miller County, MO': '131', - 'Mississippi County, MO': '133', - 'Moniteau County, MO': '135', - 'Monroe County, MO': '137', - 'Montgomery County, MO': '139', - 'Morgan County, MO': '141', - 'New Madrid County, MO': '143', - 'Newton County, MO': '145', - 'Nodaway County, MO': '147', - 'Oregon County, MO': '149', - 'Osage County, MO': '151', - 'Ozark County, MO': '153', - 'Pemiscot County, MO': '155', - 'Perry County, MO': '157', - 'Pettis County, MO': '159', - 'Phelps County, MO': '161', - 'Pike County, MO': '163', - 'Platte County, MO': '165', - 'Polk County, MO': '167', - 'Pulaski County, MO': '169', - 'Putnam County, MO': '171', - 'Ralls County, MO': '173', - 'Randolph County, MO': '175', - 'Ray County, MO': '177', - 'Reynolds County, MO': '179', - 'Ripley County, MO': '181', - 'Saline County, MO': '195', - 'Schuyler County, MO': '197', - 'Scotland County, MO': '199', - 'Scott County, MO': '201', - 'Shannon County, MO': '203', - 'Shelby County, MO': '205', - 'St. Charles County, MO': '183', - 'St. Clair County, MO': '185', - 'St. Francois County, MO': '187', - 'St. Louis County, MO': '189', - 'St. Louis city, MO': '510', - 'Ste. Genevieve County, MO': '186', - 'Stoddard County, MO': '207', - 'Stone County, MO': '209', - 'Sullivan County, MO': '211', - 'Taney County, MO': '213', - 'Texas County, MO': '215', - 'Vernon County, MO': '217', - 'Warren County, MO': '219', - 'Washington County, MO': '221', - 'Wayne County, MO': '223', - 'Webster County, MO': '225', - 'Worth County, MO': '227', - 'Wright County, MO': '229'}, - 30: {'--All--': '%', - 'Beaverhead County, MT': '001', - 'Big Horn County, MT': '003', - 'Blaine County, MT': '005', - 'Broadwater County, MT': '007', - 'Carbon County, MT': '009', - 'Carter County, MT': '011', - 'Cascade County, MT': '013', - 'Chouteau County, MT': '015', - 'Custer County, MT': '017', - 'Daniels County, MT': '019', - 'Dawson County, MT': '021', - 'Deer Lodge County, MT': '023', - 'Fallon County, MT': '025', - 'Fergus County, MT': '027', - 'Flathead County, MT': '029', - 'Gallatin County, MT': '031', - 'Garfield County, MT': '033', - 'Glacier County, MT': '035', - 'Golden Valley County, MT': '037', - 'Granite County, MT': '039', - 'Hill County, MT': '041', - 'Jefferson County, MT': '043', - 'Judith Basin County, MT': '045', - 'Lake County, MT': '047', - 'Lewis and Clark County, MT': '049', - 'Liberty County, MT': '051', - 'Lincoln County, MT': '053', - 'Madison County, MT': '057', - 'McCone County, MT': '055', - 'Meagher County, MT': '059', - 'Mineral County, MT': '061', - 'Missoula County, MT': '063', - 'Musselshell County, MT': '065', - 'Park County, MT': '067', - 'Petroleum County, MT': '069', - 'Phillips County, MT': '071', - 'Pondera County, MT': '073', - 'Powder River County, MT': '075', - 'Powell County, MT': '077', - 'Prairie County, MT': '079', - 'Ravalli County, MT': '081', - 'Richland County, MT': '083', - 'Roosevelt County, MT': '085', - 'Rosebud County, MT': '087', - 'Sanders County, MT': '089', - 'Sheridan County, MT': '091', - 'Silver Bow County, MT': '093', - 'Stillwater County, MT': '095', - 'Sweet Grass County, MT': '097', - 'Teton County, MT': '099', - 'Toole County, MT': '101', - 'Treasure County, MT': '103', - 'Valley County, MT': '105', - 'Wheatland County, MT': '107', - 'Wibaux County, MT': '109', - 'Yellowstone County, MT': '111'}, - 31: {'--All--': '%', - 'Adams County, NE': '001', - 'Antelope County, NE': '003', - 'Arthur County, NE': '005', - 'Banner County, NE': '007', - 'Blaine County, NE': '009', - 'Boone County, NE': '011', - 'Box Butte County, NE': '013', - 'Boyd County, NE': '015', - 'Brown County, NE': '017', - 'Buffalo County, NE': '019', - 'Burt County, NE': '021', - 'Butler County, NE': '023', - 'Cass County, NE': '025', - 'Cedar County, NE': '027', - 'Chase County, NE': '029', - 'Cherry County, NE': '031', - 'Cheyenne County, NE': '033', - 'Clay County, NE': '035', - 'Colfax County, NE': '037', - 'Cuming County, NE': '039', - 'Custer County, NE': '041', - 'Dakota County, NE': '043', - 'Dawes County, NE': '045', - 'Dawson County, NE': '047', - 'Deuel County, NE': '049', - 'Dixon County, NE': '051', - 'Dodge County, NE': '053', - 'Douglas County, NE': '055', - 'Dundy County, NE': '057', - 'Fillmore County, NE': '059', - 'Franklin County, NE': '061', - 'Frontier County, NE': '063', - 'Furnas County, NE': '065', - 'Gage County, NE': '067', - 'Garden County, NE': '069', - 'Garfield County, NE': '071', - 'Gosper County, NE': '073', - 'Grant County, NE': '075', - 'Greeley County, NE': '077', - 'Hall County, NE': '079', - 'Hamilton County, NE': '081', - 'Harlan County, NE': '083', - 'Hayes County, NE': '085', - 'Hitchcock County, NE': '087', - 'Holt County, NE': '089', - 'Hooker County, NE': '091', - 'Howard County, NE': '093', - 'Jefferson County, NE': '095', - 'Johnson County, NE': '097', - 'Kearney County, NE': '099', - 'Keith County, NE': '101', - 'Keya Paha County, NE': '103', - 'Kimball County, NE': '105', - 'Knox County, NE': '107', - 'Lancaster County, NE': '109', - 'Lincoln County, NE': '111', - 'Logan County, NE': '113', - 'Loup County, NE': '115', - 'Madison County, NE': '119', - 'McPherson County, NE': '117', - 'Merrick County, NE': '121', - 'Morrill County, NE': '123', - 'Nance County, NE': '125', - 'Nemaha County, NE': '127', - 'Nuckolls County, NE': '129', - 'Otoe County, NE': '131', - 'Pawnee County, NE': '133', - 'Perkins County, NE': '135', - 'Phelps County, NE': '137', - 'Pierce County, NE': '139', - 'Platte County, NE': '141', - 'Polk County, NE': '143', - 'Red Willow County, NE': '145', - 'Richardson County, NE': '147', - 'Rock County, NE': '149', - 'Saline County, NE': '151', - 'Sarpy County, NE': '153', - 'Saunders County, NE': '155', - 'Scotts Bluff County, NE': '157', - 'Seward County, NE': '159', - 'Sheridan County, NE': '161', - 'Sherman County, NE': '163', - 'Sioux County, NE': '165', - 'Stanton County, NE': '167', - 'Thayer County, NE': '169', - 'Thomas County, NE': '171', - 'Thurston County, NE': '173', - 'Valley County, NE': '175', - 'Washington County, NE': '177', - 'Wayne County, NE': '179', - 'Webster County, NE': '181', - 'Wheeler County, NE': '183', - 'York County, NE': '185'}, - 32: {'--All--': '%', - 'Carson City, NV': '510', - 'Churchill County, NV': '001', - 'Clark County, NV': '003', - 'Douglas County, NV': '005', - 'Elko County, NV': '007', - 'Esmeralda County, NV': '009', - 'Eureka County, NV': '011', - 'Humboldt County, NV': '013', - 'Lander County, NV': '015', - 'Lincoln County, NV': '017', - 'Lyon County, NV': '019', - 'Mineral County, NV': '021', - 'Nye County, NV': '023', - 'Pershing County, NV': '027', - 'Storey County, NV': '029', - 'Washoe County, NV': '031', - 'White Pine County, NV': '033'}, - 33: {'--All--': '%', - 'Belknap County, NH': '001', - 'Carroll County, NH': '003', - 'Cheshire County, NH': '005', - 'Coos County, NH': '007', - 'Grafton County, NH': '009', - 'Hillsborough County, NH': '011', - 'Merrimack County, NH': '013', - 'Rockingham County, NH': '015', - 'Strafford County, NH': '017', - 'Sullivan County, NH': '019'}, - 34: {'--All--': '%', - 'Atlantic County, NJ': '001', - 'Bergen County, NJ': '003', - 'Burlington County, NJ': '005', - 'Camden County, NJ': '007', - 'Cape May County, NJ': '009', - 'Cumberland County, NJ': '011', - 'Essex County, NJ': '013', - 'Gloucester County, NJ': '015', - 'Hudson County, NJ': '017', - 'Hunterdon County, NJ': '019', - 'Mercer County, NJ': '021', - 'Middlesex County, NJ': '023', - 'Monmouth County, NJ': '025', - 'Morris County, NJ': '027', - 'Ocean County, NJ': '029', - 'Passaic County, NJ': '031', - 'Salem County, NJ': '033', - 'Somerset County, NJ': '035', - 'Sussex County, NJ': '037', - 'Union County, NJ': '039', - 'Warren County, NJ': '041'}, - 35: {'--All--': '%', - 'Bernalillo County, NM': '001', - 'Catron County, NM': '003', - 'Chaves County, NM': '005', - 'Cibola County, NM': '006', - 'Colfax County, NM': '007', - 'Curry County, NM': '009', - 'DeBaca County, NM': '011', - 'Dona Ana County, NM': '013', - 'Eddy County, NM': '015', - 'Grant County, NM': '017', - 'Guadalupe County, NM': '019', - 'Harding County, NM': '021', - 'Hidalgo County, NM': '023', - 'Lea County, NM': '025', - 'Lincoln County, NM': '027', - 'Los Alamos County, NM': '028', - 'Luna County, NM': '029', - 'McKinley County, NM': '031', - 'Mora County, NM': '033', - 'Otero County, NM': '035', - 'Quay County, NM': '037', - 'Rio Arriba County, NM': '039', - 'Roosevelt County, NM': '041', - 'San Juan County, NM': '045', - 'San Miguel County, NM': '047', - 'Sandoval County, NM': '043', - 'Santa Fe County, NM': '049', - 'Sierra County, NM': '051', - 'Socorro County, NM': '053', - 'Taos County, NM': '055', - 'Torrance County, NM': '057', - 'Union County, NM': '059', - 'Valencia County, NM': '061'}, - 36: {'--All--': '%', - 'Albany County, NY': '001', - 'Allegany County, NY': '003', - 'Bronx County, NY': '005', - 'Broome County, NY': '007', - 'Cattaraugus County, NY': '009', - 'Cayuga County, NY': '011', - 'Chautauqua County, NY': '013', - 'Chemung County, NY': '015', - 'Chenango County, NY': '017', - 'Clinton County, NY': '019', - 'Columbia County, NY': '021', - 'Cortland County, NY': '023', - 'Delaware County, NY': '025', - 'Dutchess County, NY': '027', - 'Erie County, NY': '029', - 'Essex County, NY': '031', - 'Franklin County, NY': '033', - 'Fulton County, NY': '035', - 'Genesee County, NY': '037', - 'Greene County, NY': '039', - 'Hamilton County, NY': '041', - 'Herkimer County, NY': '043', - 'Jefferson County, NY': '045', - 'Kings County, NY': '047', - 'Lewis County, NY': '049', - 'Livingston County, NY': '051', - 'Madison County, NY': '053', - 'Monroe County, NY': '055', - 'Montgomery County, NY': '057', - 'Nassau County, NY': '059', - 'New York County, NY': '061', - 'Niagara County, NY': '063', - 'Oneida County, NY': '065', - 'Onondaga County, NY': '067', - 'Ontario County, NY': '069', - 'Orange County, NY': '071', - 'Orleans County, NY': '073', - 'Oswego County, NY': '075', - 'Otsego County, NY': '077', - 'Putnam County, NY': '079', - 'Queens County, NY': '081', - 'Rensselaer County, NY': '083', - 'Richmond County, NY': '085', - 'Rockland County, NY': '087', - 'Saratoga County, NY': '091', - 'Schenectady County, NY': '093', - 'Schoharie County, NY': '095', - 'Schuyler County, NY': '097', - 'Seneca County, NY': '099', - 'St. Lawrence County, NY': '089', - 'Steuben County, NY': '101', - 'Suffolk County, NY': '103', - 'Sullivan County, NY': '105', - 'Tioga County, NY': '107', - 'Tompkins County, NY': '109', - 'Ulster County, NY': '111', - 'Warren County, NY': '113', - 'Washington County, NY': '115', - 'Wayne County, NY': '117', - 'Westchester County, NY': '119', - 'Wyoming County, NY': '121', - 'Yates County, NY': '123'}, - 37: {'--All--': '%', - 'Alamance County, NC': '001', - 'Alexander County, NC': '003', - 'Alleghany County, NC': '005', - 'Anson County, NC': '007', - 'Ashe County, NC': '009', - 'Avery County, NC': '011', - 'Beaufort County, NC': '013', - 'Bertie County, NC': '015', - 'Bladen County, NC': '017', - 'Brunswick County, NC': '019', - 'Buncombe County, NC': '021', - 'Burke County, NC': '023', - 'Cabarrus County, NC': '025', - 'Caldwell County, NC': '027', - 'Camden County, NC': '029', - 'Carteret County, NC': '031', - 'Caswell County, NC': '033', - 'Catawba County, NC': '035', - 'Chatham County, NC': '037', - 'Cherokee County, NC': '039', - 'Chowan County, NC': '041', - 'Clay County, NC': '043', - 'Cleveland County, NC': '045', - 'Columbus County, NC': '047', - 'Craven County, NC': '049', - 'Cumberland County, NC': '051', - 'Currituck County, NC': '053', - 'Dare County, NC': '055', - 'Davidson County, NC': '057', - 'Davie County, NC': '059', - 'Duplin County, NC': '061', - 'Durham County, NC': '063', - 'Edgecombe County, NC': '065', - 'Forsyth County, NC': '067', - 'Franklin County, NC': '069', - 'Gaston County, NC': '071', - 'Gates County, NC': '073', - 'Graham County, NC': '075', - 'Granville County, NC': '077', - 'Greene County, NC': '079', - 'Guilford County, NC': '081', - 'Halifax County, NC': '083', - 'Harnett County, NC': '085', - 'Haywood County, NC': '087', - 'Henderson County, NC': '089', - 'Hertford County, NC': '091', - 'Hoke County, NC': '093', - 'Hyde County, NC': '095', - 'Iredell County, NC': '097', - 'Jackson County, NC': '099', - 'Johnston County, NC': '101', - 'Jones County, NC': '103', - 'Lee County, NC': '105', - 'Lenoir County, NC': '107', - 'Lincoln County, NC': '109', - 'Macon County, NC': '113', - 'Madison County, NC': '115', - 'Martin County, NC': '117', - 'McDowell County, NC': '111', - 'Mecklenburg County, NC': '119', - 'Mitchell County, NC': '121', - 'Montgomery County, NC': '123', - 'Moore County, NC': '125', - 'Nash County, NC': '127', - 'New Hanover County, NC': '129', - 'Northampton County, NC': '131', - 'Onslow County, NC': '133', - 'Orange County, NC': '135', - 'Pamlico County, NC': '137', - 'Pasquotank County, NC': '139', - 'Pender County, NC': '141', - 'Perquimans County, NC': '143', - 'Person County, NC': '145', - 'Pitt County, NC': '147', - 'Polk County, NC': '149', - 'Randolph County, NC': '151', - 'Richmond County, NC': '153', - 'Robeson County, NC': '155', - 'Rockingham County, NC': '157', - 'Rowan County, NC': '159', - 'Rutherford County, NC': '161', - 'Sampson County, NC': '163', - 'Scotland County, NC': '165', - 'Stanly County, NC': '167', - 'Stokes County, NC': '169', - 'Surry County, NC': '171', - 'Swain County, NC': '173', - 'Transylvania County, NC': '175', - 'Tyrrell County, NC': '177', - 'Union County, NC': '179', - 'Vance County, NC': '181', - 'Wake County, NC': '183', - 'Warren County, NC': '185', - 'Washington County, NC': '187', - 'Watauga County, NC': '189', - 'Wayne County, NC': '191', - 'Wilkes County, NC': '193', - 'Wilson County, NC': '195', - 'Yadkin County, NC': '197', - 'Yancey County, NC': '199'}, - 38: {'--All--': '%', - 'Adams County, ND': '001', - 'Barnes County, ND': '003', - 'Benson County, ND': '005', - 'Billings County, ND': '007', - 'Bottineau County, ND': '009', - 'Bowman County, ND': '011', - 'Burke County, ND': '013', - 'Burleigh County, ND': '015', - 'Cass County, ND': '017', - 'Cavalier County, ND': '019', - 'Dickey County, ND': '021', - 'Divide County, ND': '023', - 'Dunn County, ND': '025', - 'Eddy County, ND': '027', - 'Emmons County, ND': '029', - 'Foster County, ND': '031', - 'Golden Valley County, ND': '033', - 'Grand Forks County, ND': '035', - 'Grant County, ND': '037', - 'Griggs County, ND': '039', - 'Hettinger County, ND': '041', - 'Kidder County, ND': '043', - 'LaMoure County, ND': '045', - 'Logan County, ND': '047', - 'McHenry County, ND': '049', - 'McIntosh County, ND': '051', - 'McKenzie County, ND': '053', - 'McLean County, ND': '055', - 'Mercer County, ND': '057', - 'Morton County, ND': '059', - 'Mountrail County, ND': '061', - 'Nelson County, ND': '063', - 'Oliver County, ND': '065', - 'Pembina County, ND': '067', - 'Pierce County, ND': '069', - 'Ramsey County, ND': '071', - 'Ransom County, ND': '073', - 'Renville County, ND': '075', - 'Richland County, ND': '077', - 'Rolette County, ND': '079', - 'Sargent County, ND': '081', - 'Sheridan County, ND': '083', - 'Sioux County, ND': '085', - 'Slope County, ND': '087', - 'Stark County, ND': '089', - 'Steele County, ND': '091', - 'Stutsman County, ND': '093', - 'Towner County, ND': '095', - 'Traill County, ND': '097', - 'Walsh County, ND': '099', - 'Ward County, ND': '101', - 'Wells County, ND': '103', - 'Williams County, ND': '105'}, - 39: {'--All--': '%', - 'Adams County, OH': '001', - 'Allen County, OH': '003', - 'Ashland County, OH': '005', - 'Ashtabula County, OH': '007', - 'Athens County, OH': '009', - 'Auglaize County, OH': '011', - 'Belmont County, OH': '013', - 'Brown County, OH': '015', - 'Butler County, OH': '017', - 'Carroll County, OH': '019', - 'Champaign County, OH': '021', - 'Clark County, OH': '023', - 'Clermont County, OH': '025', - 'Clinton County, OH': '027', - 'Columbiana County, OH': '029', - 'Coshocton County, OH': '031', - 'Crawford County, OH': '033', - 'Cuyahoga County, OH': '035', - 'Darke County, OH': '037', - 'Defiance County, OH': '039', - 'Delaware County, OH': '041', - 'Erie County, OH': '043', - 'Fairfield County, OH': '045', - 'Fayette County, OH': '047', - 'Franklin County, OH': '049', - 'Fulton County, OH': '051', - 'Gallia County, OH': '053', - 'Geauga County, OH': '055', - 'Greene County, OH': '057', - 'Guernsey County, OH': '059', - 'Hamilton County, OH': '061', - 'Hancock County, OH': '063', - 'Hardin County, OH': '065', - 'Harrison County, OH': '067', - 'Henry County, OH': '069', - 'Highland County, OH': '071', - 'Hocking County, OH': '073', - 'Holmes County, OH': '075', - 'Huron County, OH': '077', - 'Jackson County, OH': '079', - 'Jefferson County, OH': '081', - 'Knox County, OH': '083', - 'Lake County, OH': '085', - 'Lawrence County, OH': '087', - 'Licking County, OH': '089', - 'Logan County, OH': '091', - 'Lorain County, OH': '093', - 'Lucas County, OH': '095', - 'Madison County, OH': '097', - 'Mahoning County, OH': '099', - 'Marion County, OH': '101', - 'Medina County, OH': '103', - 'Meigs County, OH': '105', - 'Mercer County, OH': '107', - 'Miami County, OH': '109', - 'Monroe County, OH': '111', - 'Montgomery County, OH': '113', - 'Morgan County, OH': '115', - 'Morrow County, OH': '117', - 'Muskingum County, OH': '119', - 'Noble County, OH': '121', - 'Ottawa County, OH': '123', - 'Paulding County, OH': '125', - 'Perry County, OH': '127', - 'Pickaway County, OH': '129', - 'Pike County, OH': '131', - 'Portage County, OH': '133', - 'Preble County, OH': '135', - 'Putnam County, OH': '137', - 'Richland County, OH': '139', - 'Ross County, OH': '141', - 'Sandusky County, OH': '143', - 'Scioto County, OH': '145', - 'Seneca County, OH': '147', - 'Shelby County, OH': '149', - 'Stark County, OH': '151', - 'Summit County, OH': '153', - 'Trumbull County, OH': '155', - 'Tuscarawas County, OH': '157', - 'Union County, OH': '159', - 'Van Wert County, OH': '161', - 'Vinton County, OH': '163', - 'Warren County, OH': '165', - 'Washington County, OH': '167', - 'Wayne County, OH': '169', - 'Williams County, OH': '171', - 'Wood County, OH': '173', - 'Wyandot County, OH': '175'}, - 40: {'--All--': '%', - 'Adair County, OK': '001', - 'Alfalfa County, OK': '003', - 'Atoka County, OK': '005', - 'Beaver County, OK': '007', - 'Beckham County, OK': '009', - 'Blaine County, OK': '011', - 'Bryan County, OK': '013', - 'Caddo County, OK': '015', - 'Canadian County, OK': '017', - 'Carter County, OK': '019', - 'Cherokee County, OK': '021', - 'Choctaw County, OK': '023', - 'Cimarron County, OK': '025', - 'Cleveland County, OK': '027', - 'Coal County, OK': '029', - 'Comanche County, OK': '031', - 'Cotton County, OK': '033', - 'Craig County, OK': '035', - 'Creek County, OK': '037', - 'Custer County, OK': '039', - 'Delaware County, OK': '041', - 'Dewey County, OK': '043', - 'Ellis County, OK': '045', - 'Garfield County, OK': '047', - 'Garvin County, OK': '049', - 'Grady County, OK': '051', - 'Grant County, OK': '053', - 'Greer County, OK': '055', - 'Harmon County, OK': '057', - 'Harper County, OK': '059', - 'Haskell County, OK': '061', - 'Hughes County, OK': '063', - 'Jackson County, OK': '065', - 'Jefferson County, OK': '067', - 'Johnston County, OK': '069', - 'Kay County, OK': '071', - 'Kingfisher County, OK': '073', - 'Kiowa County, OK': '075', - 'Latimer County, OK': '077', - 'Le Flore County, OK': '079', - 'Lincoln County, OK': '081', - 'Logan County, OK': '083', - 'Love County, OK': '085', - 'Major County, OK': '093', - 'Marshall County, OK': '095', - 'Mayes County, OK': '097', - 'McClain County, OK': '087', - 'McCurtain County, OK': '089', - 'McIntosh County, OK': '091', - 'Murray County, OK': '099', - 'Muskogee County, OK': '101', - 'Noble County, OK': '103', - 'Nowata County, OK': '105', - 'Okfuskee County, OK': '107', - 'Oklahoma County, OK': '109', - 'Okmulgee County, OK': '111', - 'Osage County, OK': '113', - 'Ottawa County, OK': '115', - 'Pawnee County, OK': '117', - 'Payne County, OK': '119', - 'Pittsburg County, OK': '121', - 'Pontotoc County, OK': '123', - 'Pottawatomie County, OK': '125', - 'Pushmataha County, OK': '127', - 'Roger Mills County, OK': '129', - 'Rogers County, OK': '131', - 'Seminole County, OK': '133', - 'Sequoyah County, OK': '135', - 'Stephens County, OK': '137', - 'Texas County, OK': '139', - 'Tillman County, OK': '141', - 'Tulsa County, OK': '143', - 'Wagoner County, OK': '145', - 'Washington County, OK': '147', - 'Washita County, OK': '149', - 'Woods County, OK': '151', - 'Woodward County, OK': '153'}, - 41: {'--All--': '%', - 'Baker County, OR': '001', - 'Benton County, OR': '003', - 'Clackamas County, OR': '005', - 'Clatsop County, OR': '007', - 'Columbia County, OR': '009', - 'Coos County, OR': '011', - 'Crook County, OR': '013', - 'Curry County, OR': '015', - 'Deschutes County, OR': '017', - 'Douglas County, OR': '019', - 'Gilliam County, OR': '021', - 'Grant County, OR': '023', - 'Harney County, OR': '025', - 'Hood River County, OR': '027', - 'Jackson County, OR': '029', - 'Jefferson County, OR': '031', - 'Josephine County, OR': '033', - 'Klamath County, OR': '035', - 'Lake County, OR': '037', - 'Lane County, OR': '039', - 'Lincoln County, OR': '041', - 'Linn County, OR': '043', - 'Malheur County, OR': '045', - 'Marion County, OR': '047', - 'Morrow County, OR': '049', - 'Multnomah County, OR': '051', - 'Polk County, OR': '053', - 'Sherman County, OR': '055', - 'Tillamook County, OR': '057', - 'Umatilla County, OR': '059', - 'Union County, OR': '061', - 'Wallowa County, OR': '063', - 'Wasco County, OR': '065', - 'Washington County, OR': '067', - 'Wheeler County, OR': '069', - 'Yamhill County, OR': '071'}, - 42: {'--All--': '%', - 'Adams County, PA': '001', - 'Allegheny County, PA': '003', - 'Armstrong County, PA': '005', - 'Beaver County, PA': '007', - 'Bedford County, PA': '009', - 'Berks County, PA': '011', - 'Blair County, PA': '013', - 'Bradford County, PA': '015', - 'Bucks County, PA': '017', - 'Butler County, PA': '019', - 'Cambria County, PA': '021', - 'Cameron County, PA': '023', - 'Carbon County, PA': '025', - 'Centre County, PA': '027', - 'Chester County, PA': '029', - 'Clarion County, PA': '031', - 'Clearfield County, PA': '033', - 'Clinton County, PA': '035', - 'Columbia County, PA': '037', - 'Crawford County, PA': '039', - 'Cumberland County, PA': '041', - 'Dauphin County, PA': '043', - 'Delaware County, PA': '045', - 'Elk County, PA': '047', - 'Erie County, PA': '049', - 'Fayette County, PA': '051', - 'Forest County, PA': '053', - 'Franklin County, PA': '055', - 'Fulton County, PA': '057', - 'Greene County, PA': '059', - 'Huntingdon County, PA': '061', - 'Indiana County, PA': '063', - 'Jefferson County, PA': '065', - 'Juniata County, PA': '067', - 'Lackawanna County, PA': '069', - 'Lancaster County, PA': '071', - 'Lawrence County, PA': '073', - 'Lebanon County, PA': '075', - 'Lehigh County, PA': '077', - 'Luzerne County, PA': '079', - 'Lycoming County, PA': '081', - 'McKean County, PA': '083', - 'Mercer County, PA': '085', - 'Mifflin County, PA': '087', - 'Monroe County, PA': '089', - 'Montgomery County, PA': '091', - 'Montour County, PA': '093', - 'Northampton County, PA': '095', - 'Northumberland County, PA': '097', - 'Perry County, PA': '099', - 'Philadelphia County/city, PA': '101', - 'Pike County, PA': '103', - 'Potter County, PA': '105', - 'Schuylkill County, PA': '107', - 'Snyder County, PA': '109', - 'Somerset County, PA': '111', - 'Sullivan County, PA': '113', - 'Susquehanna County, PA': '115', - 'Tioga County, PA': '117', - 'Union County, PA': '119', - 'Venango County, PA': '121', - 'Warren County, PA': '123', - 'Washington County, PA': '125', - 'Wayne County, PA': '127', - 'Westmoreland County, PA': '129', - 'Wyoming County, PA': '131', - 'York County, PA': '133'}, - 44: {'--All--': '%', - 'Bristol County, RI': '001', - 'Kent County, RI': '003', - 'Newport County, RI': '005', - 'Providence County, RI': '007', - 'Washington County, RI': '009'}, - 45: {'--All--': '%', - 'Abbeville County, SC': '001', - 'Aiken County, SC': '003', - 'Allendale County, SC': '005', - 'Anderson County, SC': '007', - 'Bamberg County, SC': '009', - 'Barnwell County, SC': '011', - 'Beaufort County, SC': '013', - 'Berkeley County, SC': '015', - 'Calhoun County, SC': '017', - 'Charleston County, SC': '019', - 'Cherokee County, SC': '021', - 'Chester County, SC': '023', - 'Chesterfield County, SC': '025', - 'Clarendon County, SC': '027', - 'Colleton County, SC': '029', - 'Darlington County, SC': '031', - 'Dillon County, SC': '033', - 'Dorchester County, SC': '035', - 'Edgefield County, SC': '037', - 'Fairfield County, SC': '039', - 'Florence County, SC': '041', - 'Georgetown County, SC': '043', - 'Greenville County, SC': '045', - 'Greenwood County, SC': '047', - 'Hampton County, SC': '049', - 'Horry County, SC': '051', - 'Jasper County, SC': '053', - 'Kershaw County, SC': '055', - 'Lancaster County, SC': '057', - 'Laurens County, SC': '059', - 'Lee County, SC': '061', - 'Lexington County, SC': '063', - 'Marion County, SC': '067', - 'Marlboro County, SC': '069', - 'McCormick County, SC': '065', - 'Newberry County, SC': '071', - 'Oconee County, SC': '073', - 'Orangeburg County, SC': '075', - 'Pickens County, SC': '077', - 'Richland County, SC': '079', - 'Saluda County, SC': '081', - 'Spartanburg County, SC': '083', - 'Sumter County, SC': '085', - 'Union County, SC': '087', - 'Williamsburg County, SC': '089', - 'York County, SC': '091'}, - 46: {'--All--': '%', - 'Aurora County, SD': '003', - 'Beadle County, SD': '005', - 'Bennett County, SD': '007', - 'Bon Homme County, SD': '009', - 'Brookings County, SD': '011', - 'Brown County, SD': '013', - 'Brule County, SD': '015', - 'Buffalo County, SD': '017', - 'Butte County, SD': '019', - 'Campbell County, SD': '021', - 'Charles Mix County, SD': '023', - 'Clark County, SD': '025', - 'Clay County, SD': '027', - 'Codington County, SD': '029', - 'Corson County, SD': '031', - 'Custer County, SD': '033', - 'Davison County, SD': '035', - 'Day County, SD': '037', - 'Deuel County, SD': '039', - 'Dewey County, SD': '041', - 'Douglas County, SD': '043', - 'Edmunds County, SD': '045', - 'Fall River County, SD': '047', - 'Faulk County, SD': '049', - 'Grant County, SD': '051', - 'Gregory County, SD': '053', - 'Haakon County, SD': '055', - 'Hamlin County, SD': '057', - 'Hand County, SD': '059', - 'Hanson County, SD': '061', - 'Harding County, SD': '063', - 'Hughes County, SD': '065', - 'Hutchinson County, SD': '067', - 'Hyde County, SD': '069', - 'Jackson County, SD': '071', - 'Jerauld County, SD': '073', - 'Jones County, SD': '075', - 'Kingsbury County, SD': '077', - 'Lake County, SD': '079', - 'Lawrence County, SD': '081', - 'Lincoln County, SD': '083', - 'Lyman County, SD': '085', - 'Marshall County, SD': '091', - 'McCook County, SD': '087', - 'McPherson County, SD': '089', - 'Meade County, SD': '093', - 'Mellette County, SD': '095', - 'Miner County, SD': '097', - 'Minnehaha County, SD': '099', - 'Moody County, SD': '101', - 'Pennington County, SD': '103', - 'Perkins County, SD': '105', - 'Potter County, SD': '107', - 'Roberts County, SD': '109', - 'Sanborn County, SD': '111', - 'Shannon County, SD': '113', - 'Spink County, SD': '115', - 'Stanley County, SD': '117', - 'Sully County, SD': '119', - 'Todd County, SD': '121', - 'Tripp County, SD': '123', - 'Turner County, SD': '125', - 'Union County, SD': '127', - 'Walworth County, SD': '129', - 'Yankton County, SD': '135', - 'Ziebach County, SD': '137'}, - 47: {'--All--': '%', - 'Anderson County, TN': '001', - 'Bedford County, TN': '003', - 'Benton County, TN': '005', - 'Bledsoe County, TN': '007', - 'Blount County, TN': '009', - 'Bradley County, TN': '011', - 'Campbell County, TN': '013', - 'Cannon County, TN': '015', - 'Carroll County, TN': '017', - 'Carter County, TN': '019', - 'Cheatham County, TN': '021', - 'Chester County, TN': '023', - 'Claiborne County, TN': '025', - 'Clay County, TN': '027', - 'Cocke County, TN': '029', - 'Coffee County, TN': '031', - 'Crockett County, TN': '033', - 'Cumberland County, TN': '035', - 'Davidson County, TN': '037', - 'DeKalb County, TN': '041', - 'Decatur County, TN': '039', - 'Dickson County, TN': '043', - 'Dyer County, TN': '045', - 'Fayette County, TN': '047', - 'Fentress County, TN': '049', - 'Franklin County, TN': '051', - 'Gibson County, TN': '053', - 'Giles County, TN': '055', - 'Grainger County, TN': '057', - 'Greene County, TN': '059', - 'Grundy County, TN': '061', - 'Hamblen County, TN': '063', - 'Hamilton County, TN': '065', - 'Hancock County, TN': '067', - 'Hardeman County, TN': '069', - 'Hardin County, TN': '071', - 'Hawkins County, TN': '073', - 'Haywood County, TN': '075', - 'Henderson County, TN': '077', - 'Henry County, TN': '079', - 'Hickman County, TN': '081', - 'Houston County, TN': '083', - 'Humphreys County, TN': '085', - 'Jackson County, TN': '087', - 'Jefferson County, TN': '089', - 'Johnson County, TN': '091', - 'Knox County, TN': '093', - 'Lake County, TN': '095', - 'Lauderdale County, TN': '097', - 'Lawrence County, TN': '099', - 'Lewis County, TN': '101', - 'Lincoln County, TN': '103', - 'Loudon County, TN': '105', - 'Macon County, TN': '111', - 'Madison County, TN': '113', - 'Marion County, TN': '115', - 'Marshall County, TN': '117', - 'Maury County, TN': '119', - 'McMinn County, TN': '107', - 'McNairy County, TN': '109', - 'Meigs County, TN': '121', - 'Monroe County, TN': '123', - 'Montgomery County, TN': '125', - 'Moore County, TN': '127', - 'Morgan County, TN': '129', - 'Obion County, TN': '131', - 'Overton County, TN': '133', - 'Perry County, TN': '135', - 'Pickett County, TN': '137', - 'Polk County, TN': '139', - 'Putnam County, TN': '141', - 'Rhea County, TN': '143', - 'Roane County, TN': '145', - 'Robertson County, TN': '147', - 'Rutherford County, TN': '149', - 'Scott County, TN': '151', - 'Sequatchie County, TN': '153', - 'Sevier County, TN': '155', - 'Shelby County, TN': '157', - 'Smith County, TN': '159', - 'Stewart County, TN': '161', - 'Sullivan County, TN': '163', - 'Sumner County, TN': '165', - 'Tipton County, TN': '167', - 'Trousdale County, TN': '169', - 'Unicoi County, TN': '171', - 'Union County, TN': '173', - 'Van Buren County, TN': '175', - 'Warren County, TN': '177', - 'Washington County, TN': '179', - 'Wayne County, TN': '181', - 'Weakley County, TN': '183', - 'White County, TN': '185', - 'Williamson County, TN': '187', - 'Wilson County, TN': '189'}, - 48: {'--All--': '%', - 'Anderson County, TX': '001', - 'Andrews County, TX': '003', - 'Angelina County, TX': '005', - 'Aransas County, TX': '007', - 'Archer County, TX': '009', - 'Armstrong County, TX': '011', - 'Atascosa County, TX': '013', - 'Austin County, TX': '015', - 'Bailey County, TX': '017', - 'Bandera County, TX': '019', - 'Bastrop County, TX': '021', - 'Baylor County, TX': '023', - 'Bee County, TX': '025', - 'Bell County, TX': '027', - 'Bexar County, TX': '029', - 'Blanco County, TX': '031', - 'Borden County, TX': '033', - 'Bosque County, TX': '035', - 'Bowie County, TX': '037', - 'Brazoria County, TX': '039', - 'Brazos County, TX': '041', - 'Brewster County, TX': '043', - 'Briscoe County, TX': '045', - 'Brooks County, TX': '047', - 'Brown County, TX': '049', - 'Burleson County, TX': '051', - 'Burnet County, TX': '053', - 'Caldwell County, TX': '055', - 'Calhoun County, TX': '057', - 'Callahan County, TX': '059', - 'Cameron County, TX': '061', - 'Camp County, TX': '063', - 'Carson County, TX': '065', - 'Cass County, TX': '067', - 'Castro County, TX': '069', - 'Chambers County, TX': '071', - 'Cherokee County, TX': '073', - 'Childress County, TX': '075', - 'Clay County, TX': '077', - 'Cochran County, TX': '079', - 'Coke County, TX': '081', - 'Coleman County, TX': '083', - 'Collin County, TX': '085', - 'Collingsworth County, TX': '087', - 'Colorado County, TX': '089', - 'Comal County, TX': '091', - 'Comanche County, TX': '093', - 'Concho County, TX': '095', - 'Cooke County, TX': '097', - 'Coryell County, TX': '099', - 'Cottle County, TX': '101', - 'Crane County, TX': '103', - 'Crockett County, TX': '105', - 'Crosby County, TX': '107', - 'Culberson County, TX': '109', - 'Dallam County, TX': '111', - 'Dallas County, TX': '113', - 'Dawson County, TX': '115', - 'DeWitt County, TX': '123', - 'Deaf Smith County, TX': '117', - 'Delta County, TX': '119', - 'Denton County, TX': '121', - 'Dickens County, TX': '125', - 'Dimmit County, TX': '127', - 'Donley County, TX': '129', - 'Duval County, TX': '131', - 'Eastland County, TX': '133', - 'Ector County, TX': '135', - 'Edwards County, TX': '137', - 'El Paso County, TX': '141', - 'Ellis County, TX': '139', - 'Erath County, TX': '143', - 'Falls County, TX': '145', - 'Fannin County, TX': '147', - 'Fayette County, TX': '149', - 'Fisher County, TX': '151', - 'Floyd County, TX': '153', - 'Foard County, TX': '155', - 'Fort Bend County, TX': '157', - 'Franklin County, TX': '159', - 'Freestone County, TX': '161', - 'Frio County, TX': '163', - 'Gaines County, TX': '165', - 'Galveston County, TX': '167', - 'Garza County, TX': '169', - 'Gillespie County, TX': '171', - 'Glasscock County, TX': '173', - 'Goliad County, TX': '175', - 'Gonzales County, TX': '177', - 'Gray County, TX': '179', - 'Grayson County, TX': '181', - 'Gregg County, TX': '183', - 'Grimes County, TX': '185', - 'Guadalupe County, TX': '187', - 'Hale County, TX': '189', - 'Hall County, TX': '191', - 'Hamilton County, TX': '193', - 'Hansford County, TX': '195', - 'Hardeman County, TX': '197', - 'Hardin County, TX': '199', - 'Harris County, TX': '201', - 'Harrison County, TX': '203', - 'Hartley County, TX': '205', - 'Haskell County, TX': '207', - 'Hays County, TX': '209', - 'Hemphill County, TX': '211', - 'Henderson County, TX': '213', - 'Hidalgo County, TX': '215', - 'Hill County, TX': '217', - 'Hockley County, TX': '219', - 'Hood County, TX': '221', - 'Hopkins County, TX': '223', - 'Houston County, TX': '225', - 'Howard County, TX': '227', - 'Hudspeth County, TX': '229', - 'Hunt County, TX': '231', - 'Hutchinson County, TX': '233', - 'Irion County, TX': '235', - 'Jack County, TX': '237', - 'Jackson County, TX': '239', - 'Jasper County, TX': '241', - 'Jeff Davis County, TX': '243', - 'Jefferson County, TX': '245', - 'Jim Hogg County, TX': '247', - 'Jim Wells County, TX': '249', - 'Johnson County, TX': '251', - 'Jones County, TX': '253', - 'Karnes County, TX': '255', - 'Kaufman County, TX': '257', - 'Kendall County, TX': '259', - 'Kenedy County, TX': '261', - 'Kent County, TX': '263', - 'Kerr County, TX': '265', - 'Kimble County, TX': '267', - 'King County, TX': '269', - 'Kinney County, TX': '271', - 'Kleberg County, TX': '273', - 'Knox County, TX': '275', - 'La Salle County, TX': '283', - 'Lamar County, TX': '277', - 'Lamb County, TX': '279', - 'Lampasas County, TX': '281', - 'Lavaca County, TX': '285', - 'Lee County, TX': '287', - 'Leon County, TX': '289', - 'Liberty County, TX': '291', - 'Limestone County, TX': '293', - 'Lipscomb County, TX': '295', - 'Live Oak County, TX': '297', - 'Llano County, TX': '299', - 'Loving County, TX': '301', - 'Lubbock County, TX': '303', - 'Lynn County, TX': '305', - 'Madison County, TX': '313', - 'Marion County, TX': '315', - 'Martin County, TX': '317', - 'Mason County, TX': '319', - 'Matagorda County, TX': '321', - 'Maverick County, TX': '323', - 'McCulloch County, TX': '307', - 'McLennan County, TX': '309', - 'McMullen County, TX': '311', - 'Medina County, TX': '325', - 'Menard County, TX': '327', - 'Midland County, TX': '329', - 'Milam County, TX': '331', - 'Mills County, TX': '333', - 'Mitchell County, TX': '335', - 'Montague County, TX': '337', - 'Montgomery County, TX': '339', - 'Moore County, TX': '341', - 'Morris County, TX': '343', - 'Motley County, TX': '345', - 'Nacogdoches County, TX': '347', - 'Navarro County, TX': '349', - 'Newton County, TX': '351', - 'Nolan County, TX': '353', - 'Nueces County, TX': '355', - 'Ochiltree County, TX': '357', - 'Oldham County, TX': '359', - 'Orange County, TX': '361', - 'Palo Pinto County, TX': '363', - 'Panola County, TX': '365', - 'Parker County, TX': '367', - 'Parmer County, TX': '369', - 'Pecos County, TX': '371', - 'Polk County, TX': '373', - 'Potter County, TX': '375', - 'Presidio County, TX': '377', - 'Rains County, TX': '379', - 'Randall County, TX': '381', - 'Reagan County, TX': '383', - 'Real County, TX': '385', - 'Red River County, TX': '387', - 'Reeves County, TX': '389', - 'Refugio County, TX': '391', - 'Roberts County, TX': '393', - 'Robertson County, TX': '395', - 'Rockwall County, TX': '397', - 'Runnels County, TX': '399', - 'Rusk County, TX': '401', - 'Sabine County, TX': '403', - 'San Augustine County, TX': '405', - 'San Jacinto County, TX': '407', - 'San Patricio County, TX': '409', - 'San Saba County, TX': '411', - 'Schleicher County, TX': '413', - 'Scurry County, TX': '415', - 'Shackelford County, TX': '417', - 'Shelby County, TX': '419', - 'Sherman County, TX': '421', - 'Smith County, TX': '423', - 'Somervell County, TX': '425', - 'Starr County, TX': '427', - 'Stephens County, TX': '429', - 'Sterling County, TX': '431', - 'Stonewall County, TX': '433', - 'Sutton County, TX': '435', - 'Swisher County, TX': '437', - 'Tarrant County, TX': '439', - 'Taylor County, TX': '441', - 'Terrell County, TX': '443', - 'Terry County, TX': '445', - 'Throckmorton County, TX': '447', - 'Titus County, TX': '449', - 'Tom Green County, TX': '451', - 'Travis County, TX': '453', - 'Trinity County, TX': '455', - 'Tyler County, TX': '457', - 'Upshur County, TX': '459', - 'Upton County, TX': '461', - 'Uvalde County, TX': '463', - 'Val Verde County, TX': '465', - 'Van Zandt County, TX': '467', - 'Victoria County, TX': '469', - 'Walker County, TX': '471', - 'Waller County, TX': '473', - 'Ward County, TX': '475', - 'Washington County, TX': '477', - 'Webb County, TX': '479', - 'Wharton County, TX': '481', - 'Wheeler County, TX': '483', - 'Wichita County, TX': '485', - 'Wilbarger County, TX': '487', - 'Willacy County, TX': '489', - 'Williamson County, TX': '491', - 'Wilson County, TX': '493', - 'Winkler County, TX': '495', - 'Wise County, TX': '497', - 'Wood County, TX': '499', - 'Yoakum County, TX': '501', - 'Young County, TX': '503', - 'Zapata County, TX': '505', - 'Zavala County, TX': '507'}, - 49: {'--All--': '%', - 'Beaver County, UT': '001', - 'Box Elder County, UT': '003', - 'Cache County, UT': '005', - 'Carbon County, UT': '007', - 'Daggett County, UT': '009', - 'Davis County, UT': '011', - 'Duchesne County, UT': '013', - 'Emery County, UT': '015', - 'Garfield County, UT': '017', - 'Grand County, UT': '019', - 'Iron County, UT': '021', - 'Juab County, UT': '023', - 'Kane County, UT': '025', - 'Millard County, UT': '027', - 'Morgan County, UT': '029', - 'Piute County, UT': '031', - 'Rich County, UT': '033', - 'Salt Lake County, UT': '035', - 'San Juan County, UT': '037', - 'Sanpete County, UT': '039', - 'Sevier County, UT': '041', - 'Summit County, UT': '043', - 'Tooele County, UT': '045', - 'Uintah County, UT': '047', - 'Utah County, UT': '049', - 'Wasatch County, UT': '051', - 'Washington County, UT': '053', - 'Wayne County, UT': '055', - 'Weber County, UT': '057'}, - 50: {'--All--': '%', - 'Addison County, VT': '001', - 'Bennington County, VT': '003', - 'Caledonia County, VT': '005', - 'Chittenden County, VT': '007', - 'Essex County, VT': '009', - 'Franklin County, VT': '011', - 'Grand Isle County, VT': '013', - 'Lamoille County, VT': '015', - 'Orange County, VT': '017', - 'Orleans County, VT': '019', - 'Rutland County, VT': '021', - 'Washington County, VT': '023', - 'Windham County, VT': '025', - 'Windsor County, VT': '027'}, - 51: {'--All--': '%', - 'Accomack County, VA': '001', - 'Albemarle County, VA': '003', - 'Alexandria city, VA': '510', - 'Alleghany County, VA': '005', - 'Amelia County, VA': '007', - 'Amherst County, VA': '009', - 'Appomattox County, VA': '011', - 'Arlington County, VA': '013', - 'Augusta County, VA': '015', - 'Bath County, VA': '017', - 'Bedford County, VA': '019', - 'Bedford city, VA': '515', - 'Bland County, VA': '021', - 'Botetourt County, VA': '023', - 'Bristol city, VA': '520', - 'Brunswick County, VA': '025', - 'Buchanan County, VA': '027', - 'Buckingham County, VA': '029', - 'Buena Vista city, VA': '530', - 'Campbell County, VA': '031', - 'Caroline County, VA': '033', - 'Carroll County, VA': '035', - 'Charles City County, VA': '036', - 'Charlotte County, VA': '037', - 'Charlottesville city, VA': '540', - 'Chesapeake city, VA': '550', - 'Chesterfield County, VA': '041', - 'Clarke County, VA': '043', - 'Colonial Heights city, VA': '570', - 'Covington city, VA': '580', - 'Craig County, VA': '045', - 'Culpeper County, VA': '047', - 'Cumberland County, VA': '049', - 'Danville city, VA': '590', - 'Dickenson County, VA': '051', - 'Dinwiddie County, VA': '053', - 'Emporia city, VA': '595', - 'Essex County, VA': '057', - 'Fairfax County, VA': '059', - 'Fairfax city, VA': '600', - 'Falls Church city, VA': '610', - 'Fauquier County, VA': '061', - 'Floyd County, VA': '063', - 'Fluvanna County, VA': '065', - 'Franklin County, VA': '067', - 'Franklin city, VA': '620', - 'Frederick County, VA': '069', - 'Fredericksburg city, VA': '630', - 'Galax city, VA': '640', - 'Giles County, VA': '071', - 'Gloucester County, VA': '073', - 'Goochland County, VA': '075', - 'Grayson County, VA': '077', - 'Greene County, VA': '079', - 'Greensville County, VA': '081', - 'Halifax County, VA': '083', - 'Hampton city, VA': '650', - 'Hanover County, VA': '085', - 'Harrisonburg city, VA': '660', - 'Henrico County, VA': '087', - 'Henry County, VA': '089', - 'Highland County, VA': '091', - 'Hopewell city, VA': '670', - 'Isle of Wight County, VA': '093', - 'James City County, VA': '095', - 'King George County, VA': '099', - 'King William County, VA': '101', - 'King and Queen County, VA': '097', - 'Lancaster County, VA': '103', - 'Lee County, VA': '105', - 'Lexington city, VA': '678', - 'Loudoun County, VA': '107', - 'Louisa County, VA': '109', - 'Lunenburg County, VA': '111', - 'Lynchburg city, VA': '680', - 'Madison County, VA': '113', - 'Manassas Park city, VA': '685', - 'Manassas city, VA': '683', - 'Martinsville city, VA': '690', - 'Mathews County, VA': '115', - 'Mecklenburg County, VA': '117', - 'Middlesex County, VA': '119', - 'Montgomery County, VA': '121', - 'Nelson County, VA': '125', - 'New Kent County, VA': '127', - 'Newport News city, VA': '700', - 'Norfolk city, VA': '710', - 'Northampton County, VA': '131', - 'Northumberland County, VA': '133', - 'Norton city, VA': '720', - 'Nottoway County, VA': '135', - 'Orange County, VA': '137', - 'Page County, VA': '139', - 'Patrick County, VA': '141', - 'Petersburg city, VA': '730', - 'Pittsylvania County, VA': '143', - 'Poquoson city, VA': '735', - 'Portsmouth city, VA': '740', - 'Powhatan County, VA': '145', - 'Prince Edward County, VA': '147', - 'Prince George County, VA': '149', - 'Prince William County, VA': '153', - 'Pulaski County, VA': '155', - 'Radford city, VA': '750', - 'Rappahannock County, VA': '157', - 'Richmond County, VA': '159', - 'Richmond city, VA': '760', - 'Roanoke County, VA': '161', - 'Roanoke city, VA': '770', - 'Rockbridge County, VA': '163', - 'Rockingham County, VA': '165', - 'Russell County, VA': '167', - 'Salem city, VA': '775', - 'Scott County, VA': '169', - 'Shenandoah County, VA': '171', - 'Smyth County, VA': '173', - 'Southampton County, VA': '175', - 'Spotsylvania County, VA': '177', - 'Stafford County, VA': '179', - 'Staunton city, VA': '790', - 'Suffolk city, VA': '800', - 'Surry County, VA': '181', - 'Sussex County, VA': '183', - 'Tazewell County, VA': '185', - 'Virginia Beach city, VA': '810', - 'Warren County, VA': '187', - 'Washington County, VA': '191', - 'Waynesboro city, VA': '820', - 'Westmoreland County, VA': '193', - 'Williamsburg city, VA': '830', - 'Winchester city, VA': '840', - 'Wise County, VA': '195', - 'Wythe County, VA': '197', - 'York County, VA': '199'}, - 53: {'--All--': '%', - 'Adams County, WA': '001', - 'Asotin County, WA': '003', - 'Benton County, WA': '005', - 'Chelan County, WA': '007', - 'Clallam County, WA': '009', - 'Clark County, WA': '011', - 'Columbia County, WA': '013', - 'Cowlitz County, WA': '015', - 'Douglas County, WA': '017', - 'Ferry County, WA': '019', - 'Franklin County, WA': '021', - 'Garfield County, WA': '023', - 'Grant County, WA': '025', - 'Grays Harbor County, WA': '027', - 'Island County, WA': '029', - 'Jefferson County, WA': '031', - 'King County, WA': '033', - 'Kitsap County, WA': '035', - 'Kittitas County, WA': '037', - 'Klickitat County, WA': '039', - 'Lewis County, WA': '041', - 'Lincoln County, WA': '043', - 'Mason County, WA': '045', - 'Okanogan County, WA': '047', - 'Pacific County, WA': '049', - 'Pend Oreille County, WA': '051', - 'Pierce County, WA': '053', - 'San Juan County, WA': '055', - 'Skagit County, WA': '057', - 'Skamania County, WA': '059', - 'Snohomish County, WA': '061', - 'Spokane County, WA': '063', - 'Stevens County, WA': '065', - 'Thurston County, WA': '067', - 'Wahkiakum County, WA': '069', - 'Walla Walla County, WA': '071', - 'Whatcom County, WA': '073', - 'Whitman County, WA': '075', - 'Yakima County, WA': '077'}, - 54: {'--All--': '%', - 'Barbour County, WV': '001', - 'Berkeley County, WV': '003', - 'Boone County, WV': '005', - 'Braxton County, WV': '007', - 'Brooke County, WV': '009', - 'Cabell County, WV': '011', - 'Calhoun County, WV': '013', - 'Clay County, WV': '015', - 'Doddridge County, WV': '017', - 'Fayette County, WV': '019', - 'Gilmer County, WV': '021', - 'Grant County, WV': '023', - 'Greenbrier County, WV': '025', - 'Hampshire County, WV': '027', - 'Hancock County, WV': '029', - 'Hardy County, WV': '031', - 'Harrison County, WV': '033', - 'Jackson County, WV': '035', - 'Jefferson County, WV': '037', - 'Kanawha County, WV': '039', - 'Lewis County, WV': '041', - 'Lincoln County, WV': '043', - 'Logan County, WV': '045', - 'Marion County, WV': '049', - 'Marshall County, WV': '051', - 'Mason County, WV': '053', - 'McDowell County, WV': '047', - 'Mercer County, WV': '055', - 'Mineral County, WV': '057', - 'Mingo County, WV': '059', - 'Monongalia County, WV': '061', - 'Monroe County, WV': '063', - 'Morgan County, WV': '065', - 'Nicholas County, WV': '067', - 'Ohio County, WV': '069', - 'Pendleton County, WV': '071', - 'Pleasants County, WV': '073', - 'Pocahontas County, WV': '075', - 'Preston County, WV': '077', - 'Putnam County, WV': '079', - 'Raleigh County, WV': '081', - 'Randolph County, WV': '083', - 'Ritchie County, WV': '085', - 'Roane County, WV': '087', - 'Summers County, WV': '089', - 'Taylor County, WV': '091', - 'Tucker County, WV': '093', - 'Tyler County, WV': '095', - 'Upshur County, WV': '097', - 'Wayne County, WV': '099', - 'Webster County, WV': '101', - 'Wetzel County, WV': '103', - 'Wirt County, WV': '105', - 'Wood County, WV': '107', - 'Wyoming County, WV': '109'}, - 55: {'--All--': '%', - 'Adams County, WI': '001', - 'Ashland County, WI': '003', - 'Barron County, WI': '005', - 'Bayfield County, WI': '007', - 'Brown County, WI': '009', - 'Buffalo County, WI': '011', - 'Burnett County, WI': '013', - 'Calumet County, WI': '015', - 'Chippewa County, WI': '017', - 'Clark County, WI': '019', - 'Columbia County, WI': '021', - 'Crawford County, WI': '023', - 'Dane County, WI': '025', - 'Dodge County, WI': '027', - 'Door County, WI': '029', - 'Douglas County, WI': '031', - 'Dunn County, WI': '033', - 'Eau Claire County, WI': '035', - 'Florence County, WI': '037', - 'Fond du Lac County, WI': '039', - 'Forest County, WI': '041', - 'Grant County, WI': '043', - 'Green County, WI': '045', - 'Green Lake County, WI': '047', - 'Iowa County, WI': '049', - 'Iron County, WI': '051', - 'Jackson County, WI': '053', - 'Jefferson County, WI': '055', - 'Juneau County, WI': '057', - 'Kenosha County, WI': '059', - 'Kewaunee County, WI': '061', - 'La Crosse County, WI': '063', - 'Lafayette County, WI': '065', - 'Langlade County, WI': '067', - 'Lincoln County, WI': '069', - 'Manitowoc County, WI': '071', - 'Marathon County, WI': '073', - 'Marinette County, WI': '075', - 'Marquette County, WI': '077', - 'Menominee County, WI': '078', - 'Milwaukee County, WI': '079', - 'Monroe County, WI': '081', - 'Oconto County, WI': '083', - 'Oneida County, WI': '085', - 'Outagamie County, WI': '087', - 'Ozaukee County, WI': '089', - 'Pepin County, WI': '091', - 'Pierce County, WI': '093', - 'Polk County, WI': '095', - 'Portage County, WI': '097', - 'Price County, WI': '099', - 'Racine County, WI': '101', - 'Richland County, WI': '103', - 'Rock County, WI': '105', - 'Rusk County, WI': '107', - 'Sauk County, WI': '111', - 'Sawyer County, WI': '113', - 'Shawano County, WI': '115', - 'Sheboygan County, WI': '117', - 'St. Croix County, WI': '109', - 'Taylor County, WI': '119', - 'Trempealeau County, WI': '121', - 'Vernon County, WI': '123', - 'Vilas County, WI': '125', - 'Walworth County, WI': '127', - 'Washburn County, WI': '129', - 'Washington County, WI': '131', - 'Waukesha County, WI': '133', - 'Waupaca County, WI': '135', - 'Waushara County, WI': '137', - 'Winnebago County, WI': '139', - 'Wood County, WI': '141'}, - 56: {'--All--': '%', - 'Albany County, WY': '001', - 'Big Horn County, WY': '003', - 'Campbell County, WY': '005', - 'Carbon County, WY': '007', - 'Converse County, WY': '009', - 'Crook County, WY': '011', - 'Fremont County, WY': '013', - 'Goshen County, WY': '015', - 'Hot Springs County, WY': '017', - 'Johnson County, WY': '019', - 'Laramie County, WY': '021', - 'Lincoln County, WY': '023', - 'Natrona County, WY': '025', - 'Niobrara County, WY': '027', - 'Park County, WY': '029', - 'Platte County, WY': '031', - 'Sheridan County, WY': '033', - 'Sublette County, WY': '035', - 'Sweetwater County, WY': '037', - 'Teton County, WY': '039', - 'Uinta County, WY': '041', - 'Washakie County, WY': '043', - 'Weston County, WY': '045'}, - 72: {'--All--': '%', - 'Adjuntas Municipio, PR': '001', - 'Aguada Municipio, PR': '003', - 'Aguadilla Municipio, PR': '005', - 'Aguas Buenas Municipio, PR': '007', - 'Aibonito Municipio, PR': '009', - 'Anasco Municipio, PR': '011', - 'Arecibo Municipio, PR': '013', - 'Arroyo Municipio, PR': '015', - 'Barceloneta Municipio, PR': '017', - 'Barranquitas Municipio, PR': '019', - 'Bayamon Municipio, PR': '021', - 'Cabo Rojo Municipio, PR': '023', - 'Caguas Municipio, PR': '025', - 'Camuy Municipio, PR': '027', - 'Canovanas Municipio, PR': '029', - 'Carolina Municipio, PR': '031', - 'Catano Municipio, PR': '033', - 'Cayey Municipio, PR': '035', - 'Ceiba Municipio, PR': '037', - 'Ciales Municipio, PR': '039', - 'Cidra Municipio, PR': '041', - 'Coamo Municipio, PR': '043', - 'Comerio Municipio, PR': '045', - 'Corozal Municipio, PR': '047', - 'Culebra Municipio, PR': '049', - 'Dorado Municipio, PR': '051', - 'Fajardo Municipio, PR': '053', - 'Florida Municipio, PR': '054', - 'Guanica Municipio, PR': '055', - 'Guayama Municipio, PR': '057', - 'Guayanilla Municipio, PR': '059', - 'Guaynabo Municipio, PR': '061', - 'Gurabo Municipio, PR': '063', - 'Hatillo Municipio, PR': '065', - 'Hormigueros Municipio, PR': '067', - 'Humacao Municipio, PR': '069', - 'Isabela Municipio, PR': '071', - 'Jayuya Municipio, PR': '073', - 'Juana Diaz Municipio, PR': '075', - 'Juncos Municipio, PR': '077', - 'Lajas Municipio, PR': '079', - 'Lares Municipio, PR': '081', - 'Las Marias Municipio, PR': '083', - 'Las Piedras Municipio, PR': '085', - 'Loiza Municipio, PR': '087', - 'Luquillo Municipio, PR': '089', - 'Manati Municipio, PR': '091', - 'Maricao Municipio, PR': '093', - 'Maunabo Municipio, PR': '095', - 'Mayaguez Municipio, PR': '097', - 'Moca Municipio, PR': '099', - 'Morovis Municipio, PR': '101', - 'Naguabo Municipio, PR': '103', - 'Naranjito Municipio, PR': '105', - 'Orocovis Municipio, PR': '107', - 'Patillas Municipio, PR': '109', - 'Penuelas Municipio, PR': '111', - 'Ponce Municipio, PR': '113', - 'Quebradillas Municipio, PR': '115', - 'Rincon Municipio, PR': '117', - 'Rio Grande Municipio, PR': '119', - 'Sabana Grande Municipio, PR': '121', - 'Salinas Municipio, PR': '123', - 'San German Municipio, PR': '125', - 'San Juan Municipio, PR': '127', - 'San Lorenzo Municipio, PR': '129', - 'San Sebastian Municipio, PR': '131', - 'Santa Isabel Municipio, PR': '133', - 'Toa Alta Municipio, PR': '135', - 'Toa Baja Municipio, PR': '137', - 'Trujillo Alto Municipio, PR': '139', - 'Utuado Municipio, PR': '141', - 'Vega Alta Municipio, PR': '143', - 'Vega Baja Municipio, PR': '145', - 'Vieques Municipio, PR': '147', - 'Villalba Municipio, PR': '149', - 'Yabucoa Municipio, PR': '151', - 'Yauco Municipio, PR': '153'}, - '01': {'Autauga County, AL': '001', - 'Baldwin County, AL': '003', - 'Barbour County, AL': '005', - 'Bibb County, AL': '007', - 'Blount County, AL': '009', - 'Bullock County, AL': '011', - 'Butler County, AL': '013', - 'Calhoun County, AL': '015', - 'Chambers County, AL': '017', - 'Cherokee County, AL': '019', - 'Chilton County, AL': '021', - 'Choctaw County, AL': '023', - 'Clarke County, AL': '025', - 'Clay County, AL': '027', - 'Cleburne County, AL': '029', - 'Coffee County, AL': '031', - 'Colbert County, AL': '033', - 'Conecuh County, AL': '035', - 'Coosa County, AL': '037', - 'Covington County, AL': '039', - 'Crenshaw County, AL': '041', - 'Cullman County, AL': '043', - 'Dale County, AL': '045', - 'Dallas County, AL': '047', - 'DeKalb County, AL': '049', - 'Elmore County, AL': '051', - 'Escambia County, AL': '053', - 'Etowah County, AL': '055', - 'Fayette County, AL': '057', - 'Franklin County, AL': '059', - 'Geneva County, AL': '061', - 'Greene County, AL': '063', - 'Hale County, AL': '065', - 'Henry County, AL': '067', - 'Houston County, AL': '069', - 'Jackson County, AL': '071', - 'Jefferson County, AL': '073', - 'Lamar County, AL': '075', - 'Lauderdale County, AL': '077', - 'Lawrence County, AL': '079', - 'Lee County, AL': '081', - 'Limestone County, AL': '083', - 'Lowndes County, AL': '085', - 'Macon County, AL': '087', - 'Madison County, AL': '089', - 'Marengo County, AL': '091', - 'Marion County, AL': '093', - 'Marshall County, AL': '095', - 'Mobile County, AL': '097', - 'Monroe County, AL': '099', - 'Montgomery County, AL': '101', - 'Morgan County, AL': '103', - 'Perry County, AL': '105', - 'Pickens County, AL': '107', - 'Pike County, AL': '109', - 'Randolph County, AL': '111', - 'Russell County, AL': '113', - 'Shelby County, AL': '117', - 'St. Clair County, AL': '115', - 'Sumter County, AL': '119', - 'Talladega County, AL': '121', - 'Tallapoosa County, AL': '123', - 'Tuscaloosa County, AL': '125', - 'Walker County, AL': '127', - 'Washington County, AL': '129', - 'Wilcox County, AL': '131', - 'Winston County, AL': '133'}, - '02': {'Aleutians East Borough, AK': '013', - 'Aleutians West Census Area, AK': '016', - 'Anchorage Borough/municipality, AK': '020', - 'Bethel Census Area, AK': '050', - 'Bristol Bay Borough, AK': '060', - 'Denali Borough, AK': '068', - 'Dillingham Census Area, AK': '070', - 'Fairbanks North Star Borough, AK': '090', - 'Haines Borough, AK': '100', - 'Juneau Borough/city, AK': '110', - 'Kenai Peninsula Borough, AK': '122', - 'Ketchikan Gateway Borough, AK': '130', - 'Kodiak Island Borough, AK': '150', - 'Lake and Peninsula Borough, AK': '164', - 'Matanuska-Susitna Borough, AK': '170', - 'Nome Census Area, AK': '180', - 'North Slope Borough, AK': '185', - 'Northwest Arctic Borough, AK': '188', - 'Prince of Wales-Outer Ketchikan Census Area, AK': '201', - 'Sitka Borough/city, AK': '220', - 'Skagway-Hoonah-Angoon Census Area, AK': '232', - 'Southeast Fairbanks Census Area, AK': '240', - 'Valdez-Cordova Census Area, AK': '261', - 'Wade Hampton Census Area, AK': '270', - 'Wrangell-Petersburg Census Area, AK': '280', - 'Yakutat Borough, AK': '282', - 'Yukon-Koyukuk Census Area, AK': '290'}, - '04': {'Apache County, AZ': '001', - 'Cochise County, AZ': '003', - 'Coconino County, AZ': '005', - 'Gila County, AZ': '007', - 'Graham County, AZ': '009', - 'Greenlee County, AZ': '011', - 'La Paz County, AZ': '012', - 'Maricopa County, AZ': '013', - 'Mohave County, AZ': '015', - 'Navajo County, AZ': '017', - 'Pima County, AZ': '019', - 'Pinal County, AZ': '021', - 'Santa Cruz County, AZ': '023', - 'Yavapai County, AZ': '025', - 'Yuma County, AZ': '027'}, - '05': {'Arkansas County, AR': '001', - 'Ashley County, AR': '003', - 'Baxter County, AR': '005', - 'Benton County, AR': '007', - 'Boone County, AR': '009', - 'Bradley County, AR': '011', - 'Calhoun County, AR': '013', - 'Carroll County, AR': '015', - 'Chicot County, AR': '017', - 'Clark County, AR': '019', - 'Clay County, AR': '021', - 'Cleburne County, AR': '023', - 'Cleveland County, AR': '025', - 'Columbia County, AR': '027', - 'Conway County, AR': '029', - 'Craighead County, AR': '031', - 'Crawford County, AR': '033', - 'Crittenden County, AR': '035', - 'Cross County, AR': '037', - 'Dallas County, AR': '039', - 'Desha County, AR': '041', - 'Drew County, AR': '043', - 'Faulkner County, AR': '045', - 'Franklin County, AR': '047', - 'Fulton County, AR': '049', - 'Garland County, AR': '051', - 'Grant County, AR': '053', - 'Greene County, AR': '055', - 'Hempstead County, AR': '057', - 'Hot Spring County, AR': '059', - 'Howard County, AR': '061', - 'Independence County, AR': '063', - 'Izard County, AR': '065', - 'Jackson County, AR': '067', - 'Jefferson County, AR': '069', - 'Johnson County, AR': '071', - 'Lafayette County, AR': '073', - 'Lawrence County, AR': '075', - 'Lee County, AR': '077', - 'Lincoln County, AR': '079', - 'Little River County, AR': '081', - 'Logan County, AR': '083', - 'Lonoke County, AR': '085', - 'Madison County, AR': '087', - 'Marion County, AR': '089', - 'Miller County, AR': '091', - 'Mississippi County, AR': '093', - 'Monroe County, AR': '095', - 'Montgomery County, AR': '097', - 'Nevada County, AR': '099', - 'Newton County, AR': '101', - 'Ouachita County, AR': '103', - 'Perry County, AR': '105', - 'Phillips County, AR': '107', - 'Pike County, AR': '109', - 'Poinsett County, AR': '111', - 'Polk County, AR': '113', - 'Pope County, AR': '115', - 'Prairie County, AR': '117', - 'Pulaski County, AR': '119', - 'Randolph County, AR': '121', - 'Saline County, AR': '125', - 'Scott County, AR': '127', - 'Searcy County, AR': '129', - 'Sebastian County, AR': '131', - 'Sevier County, AR': '133', - 'Sharp County, AR': '135', - 'St. Francis County, AR': '123', - 'Stone County, AR': '137', - 'Union County, AR': '139', - 'Van Buren County, AR': '141', - 'Washington County, AR': '143', - 'White County, AR': '145', - 'Woodruff County, AR': '147', - 'Yell County, AR': '149'}, - '06': {'Alameda County, CA': '001', - 'Alpine County, CA': '003', - 'Amador County, CA': '005', - 'Butte County, CA': '007', - 'Calaveras County, CA': '009', - 'Colusa County, CA': '011', - 'Contra Costa County, CA': '013', - 'Del Norte County, CA': '015', - 'El Dorado County, CA': '017', - 'Fresno County, CA': '019', - 'Glenn County, CA': '021', - 'Humboldt County, CA': '023', - 'Imperial County, CA': '025', - 'Inyo County, CA': '027', - 'Kern County, CA': '029', - 'Kings County, CA': '031', - 'Lake County, CA': '033', - 'Lassen County, CA': '035', - 'Los Angeles County, CA': '037', - 'Madera County, CA': '039', - 'Marin County, CA': '041', - 'Mariposa County, CA': '043', - 'Mendocino County, CA': '045', - 'Merced County, CA': '047', - 'Modoc County, CA': '049', - 'Mono County, CA': '051', - 'Monterey County, CA': '053', - 'Napa County, CA': '055', - 'Nevada County, CA': '057', - 'Orange County, CA': '059', - 'Placer County, CA': '061', - 'Plumas County, CA': '063', - 'Riverside County, CA': '065', - 'Sacramento County, CA': '067', - 'San Benito County, CA': '069', - 'San Bernardino County, CA': '071', - 'San Diego County, CA': '073', - 'San Francisco County/city, CA': '075', - 'San Joaquin County, CA': '077', - 'San Luis Obispo County, CA': '079', - 'San Mateo County, CA': '081', - 'Santa Barbara County, CA': '083', - 'Santa Clara County, CA': '085', - 'Santa Cruz County, CA': '087', - 'Shasta County, CA': '089', - 'Sierra County, CA': '091', - 'Siskiyou County, CA': '093', - 'Solano County, CA': '095', - 'Sonoma County, CA': '097', - 'Stanislaus County, CA': '099', - 'Sutter County, CA': '101', - 'Tehama County, CA': '103', - 'Trinity County, CA': '105', - 'Tulare County, CA': '107', - 'Tuolumne County, CA': '109', - 'Ventura County, CA': '111', - 'Yolo County, CA': '113', - 'Yuba County, CA': '115'}, - '08': {'Adams County, CO': '001', - 'Alamosa County, CO': '003', - 'Arapahoe County, CO': '005', - 'Archuleta County, CO': '007', - 'Baca County, CO': '009', - 'Bent County, CO': '011', - 'Boulder County, CO': '013', - 'Broomfield County/city, CO': '014', - 'Chaffee County, CO': '015', - 'Cheyenne County, CO': '017', - 'Clear Creek County, CO': '019', - 'Conejos County, CO': '021', - 'Costilla County, CO': '023', - 'Crowley County, CO': '025', - 'Custer County, CO': '027', - 'Delta County, CO': '029', - 'Denver County/city, CO': '031', - 'Dolores County, CO': '033', - 'Douglas County, CO': '035', - 'Eagle County, CO': '037', - 'El Paso County, CO': '041', - 'Elbert County, CO': '039', - 'Fremont County, CO': '043', - 'Garfield County, CO': '045', - 'Gilpin County, CO': '047', - 'Grand County, CO': '049', - 'Gunnison County, CO': '051', - 'Hinsdale County, CO': '053', - 'Huerfano County, CO': '055', - 'Jackson County, CO': '057', - 'Jefferson County, CO': '059', - 'Kiowa County, CO': '061', - 'Kit Carson County, CO': '063', - 'La Plata County, CO': '067', - 'Lake County, CO': '065', - 'Larimer County, CO': '069', - 'Las Animas County, CO': '071', - 'Lincoln County, CO': '073', - 'Logan County, CO': '075', - 'Mesa County, CO': '077', - 'Mineral County, CO': '079', - 'Moffat County, CO': '081', - 'Montezuma County, CO': '083', - 'Montrose County, CO': '085', - 'Morgan County, CO': '087', - 'Otero County, CO': '089', - 'Ouray County, CO': '091', - 'Park County, CO': '093', - 'Phillips County, CO': '095', - 'Pitkin County, CO': '097', - 'Prowers County, CO': '099', - 'Pueblo County, CO': '101', - 'Rio Blanco County, CO': '103', - 'Rio Grande County, CO': '105', - 'Routt County, CO': '107', - 'Saguache County, CO': '109', - 'San Juan County, CO': '111', - 'San Miguel County, CO': '113', - 'Sedgwick County, CO': '115', - 'Summit County, CO': '117', - 'Teller County, CO': '119', - 'Washington County, CO': '121', - 'Weld County, CO': '123', - 'Yuma County, CO': '125'}, - '09': {'Fairfield County, CT': '001', - 'Hartford County, CT': '003', - 'Litchfield County, CT': '005', - 'Middlesex County, CT': '007', - 'New Haven County, CT': '009', - 'New London County, CT': '011', - 'Tolland County, CT': '013', - 'Windham County, CT': '015'}, - '10': {'Kent County, DE': '001', - 'New Castle County, DE': '003', - 'Sussex County, DE': '005'}, - '11': {'District of Columbia': '001'}, - '12': {'Alachua County, FL': '001', - 'Baker County, FL': '003', - 'Bay County, FL': '005', - 'Bradford County, FL': '007', - 'Brevard County, FL': '009', - 'Broward County, FL': '011', - 'Calhoun County, FL': '013', - 'Charlotte County, FL': '015', - 'Citrus County, FL': '017', - 'Clay County, FL': '019', - 'Collier County, FL': '021', - 'Columbia County, FL': '023', - 'DeSoto County, FL': '027', - 'Dixie County, FL': '029', - 'Duval County, FL': '031', - 'Escambia County, FL': '033', - 'Flagler County, FL': '035', - 'Franklin County, FL': '037', - 'Gadsden County, FL': '039', - 'Gilchrist County, FL': '041', - 'Glades County, FL': '043', - 'Gulf County, FL': '045', - 'Hamilton County, FL': '047', - 'Hardee County, FL': '049', - 'Hendry County, FL': '051', - 'Hernando County, FL': '053', - 'Highlands County, FL': '055', - 'Hillsborough County, FL': '057', - 'Holmes County, FL': '059', - 'Indian River County, FL': '061', - 'Jackson County, FL': '063', - 'Jefferson County, FL': '065', - 'Lafayette County, FL': '067', - 'Lake County, FL': '069', - 'Lee County, FL': '071', - 'Leon County, FL': '073', - 'Levy County, FL': '075', - 'Liberty County, FL': '077', - 'Madison County, FL': '079', - 'Manatee County, FL': '081', - 'Marion County, FL': '083', - 'Martin County, FL': '085', - 'Miami-Dade County, FL': '086', - 'Monroe County, FL': '087', - 'Nassau County, FL': '089', - 'Okaloosa County, FL': '091', - 'Okeechobee County, FL': '093', - 'Orange County, FL': '095', - 'Osceola County, FL': '097', - 'Palm Beach County, FL': '099', - 'Pasco County, FL': '101', - 'Pinellas County, FL': '103', - 'Polk County, FL': '105', - 'Putnam County, FL': '107', - 'Santa Rosa County, FL': '113', - 'Sarasota County, FL': '115', - 'Seminole County, FL': '117', - 'St. Johns County, FL': '109', - 'St. Lucie County, FL': '111', - 'Sumter County, FL': '119', - 'Suwannee County, FL': '121', - 'Taylor County, FL': '123', - 'Union County, FL': '125', - 'Volusia County, FL': '127', - 'Wakulla County, FL': '129', - 'Walton County, FL': '131', - 'Washington County, FL': '133'}, - '13': {'Appling County, GA': '001', - 'Atkinson County, GA': '003', - 'Bacon County, GA': '005', - 'Baker County, GA': '007', - 'Baldwin County, GA': '009', - 'Banks County, GA': '011', - 'Barrow County, GA': '013', - 'Bartow County, GA': '015', - 'Ben Hill County, GA': '017', - 'Berrien County, GA': '019', - 'Bibb County, GA': '021', - 'Bleckley County, GA': '023', - 'Brantley County, GA': '025', - 'Brooks County, GA': '027', - 'Bryan County, GA': '029', - 'Bulloch County, GA': '031', - 'Burke County, GA': '033', - 'Butts County, GA': '035', - 'Calhoun County, GA': '037', - 'Camden County, GA': '039', - 'Candler County, GA': '043', - 'Carroll County, GA': '045', - 'Catoosa County, GA': '047', - 'Charlton County, GA': '049', - 'Chatham County, GA': '051', - 'Chattahoochee County, GA': '053', - 'Chattooga County, GA': '055', - 'Cherokee County, GA': '057', - 'Clarke County, GA': '059', - 'Clay County, GA': '061', - 'Clayton County, GA': '063', - 'Clinch County, GA': '065', - 'Cobb County, GA': '067', - 'Coffee County, GA': '069', - 'Colquitt County, GA': '071', - 'Columbia County, GA': '073', - 'Cook County, GA': '075', - 'Coweta County, GA': '077', - 'Crawford County, GA': '079', - 'Crisp County, GA': '081', - 'Dade County, GA': '083', - 'Dawson County, GA': '085', - 'DeKalb County, GA': '089', - 'Decatur County, GA': '087', - 'Dodge County, GA': '091', - 'Dooly County, GA': '093', - 'Dougherty County, GA': '095', - 'Douglas County, GA': '097', - 'Early County, GA': '099', - 'Echols County, GA': '101', - 'Effingham County, GA': '103', - 'Elbert County, GA': '105', - 'Emanuel County, GA': '107', - 'Evans County, GA': '109', - 'Fannin County, GA': '111', - 'Fayette County, GA': '113', - 'Floyd County, GA': '115', - 'Forsyth County, GA': '117', - 'Franklin County, GA': '119', - 'Fulton County, GA': '121', - 'Gilmer County, GA': '123', - 'Glascock County, GA': '125', - 'Glynn County, GA': '127', - 'Gordon County, GA': '129', - 'Grady County, GA': '131', - 'Greene County, GA': '133', - 'Gwinnett County, GA': '135', - 'Habersham County, GA': '137', - 'Hall County, GA': '139', - 'Hancock County, GA': '141', - 'Haralson County, GA': '143', - 'Harris County, GA': '145', - 'Hart County, GA': '147', - 'Heard County, GA': '149', - 'Henry County, GA': '151', - 'Houston County, GA': '153', - 'Irwin County, GA': '155', - 'Jackson County, GA': '157', - 'Jasper County, GA': '159', - 'Jeff Davis County, GA': '161', - 'Jefferson County, GA': '163', - 'Jenkins County, GA': '165', - 'Johnson County, GA': '167', - 'Jones County, GA': '169', - 'Lamar County, GA': '171', - 'Lanier County, GA': '173', - 'Laurens County, GA': '175', - 'Lee County, GA': '177', - 'Liberty County, GA': '179', - 'Lincoln County, GA': '181', - 'Long County, GA': '183', - 'Lowndes County, GA': '185', - 'Lumpkin County, GA': '187', - 'Macon County, GA': '193', - 'Madison County, GA': '195', - 'Marion County, GA': '197', - 'McDuffie County, GA': '189', - 'McIntosh County, GA': '191', - 'Meriwether County, GA': '199', - 'Miller County, GA': '201', - 'Mitchell County, GA': '205', - 'Monroe County, GA': '207', - 'Montgomery County, GA': '209', - 'Morgan County, GA': '211', - 'Murray County, GA': '213', - 'Muscogee County, GA': '215', - 'Newton County, GA': '217', - 'Oconee County, GA': '219', - 'Oglethorpe County, GA': '221', - 'Paulding County, GA': '223', - 'Peach County, GA': '225', - 'Pickens County, GA': '227', - 'Pierce County, GA': '229', - 'Pike County, GA': '231', - 'Polk County, GA': '233', - 'Pulaski County, GA': '235', - 'Putnam County, GA': '237', - 'Quitman County, GA': '239', - 'Rabun County, GA': '241', - 'Randolph County, GA': '243', - 'Richmond County, GA': '245', - 'Rockdale County, GA': '247', - 'Schley County, GA': '249', - 'Screven County, GA': '251', - 'Seminole County, GA': '253', - 'Spalding County, GA': '255', - 'Stephens County, GA': '257', - 'Stewart County, GA': '259', - 'Sumter County, GA': '261', - 'Talbot County, GA': '263', - 'Taliaferro County, GA': '265', - 'Tattnall County, GA': '267', - 'Taylor County, GA': '269', - 'Telfair County, GA': '271', - 'Terrell County, GA': '273', - 'Thomas County, GA': '275', - 'Tift County, GA': '277', - 'Toombs County, GA': '279', - 'Towns County, GA': '281', - 'Treutlen County, GA': '283', - 'Troup County, GA': '285', - 'Turner County, GA': '287', - 'Twiggs County, GA': '289', - 'Union County, GA': '291', - 'Upson County, GA': '293', - 'Walker County, GA': '295', - 'Walton County, GA': '297', - 'Ware County, GA': '299', - 'Warren County, GA': '301', - 'Washington County, GA': '303', - 'Wayne County, GA': '305', - 'Webster County, GA': '307', - 'Wheeler County, GA': '309', - 'White County, GA': '311', - 'Whitfield County, GA': '313', - 'Wilcox County, GA': '315', - 'Wilkes County, GA': '317', - 'Wilkinson County, GA': '319', - 'Worth County, GA': '321'}, - '15': {'Hawaii County, HI': '001', - 'Honolulu County/city, HI': '003', - 'Kauai County, HI': '007', - 'Maui County, HI': '009'}, - '16': {'Ada County, ID': '001', - 'Adams County, ID': '003', - 'Bannock County, ID': '005', - 'Bear Lake County, ID': '007', - 'Benewah County, ID': '009', - 'Bingham County, ID': '011', - 'Blaine County, ID': '013', - 'Boise County, ID': '015', - 'Bonner County, ID': '017', - 'Bonneville County, ID': '019', - 'Boundary County, ID': '021', - 'Butte County, ID': '023', - 'Camas County, ID': '025', - 'Canyon County, ID': '027', - 'Caribou County, ID': '029', - 'Cassia County, ID': '031', - 'Clark County, ID': '033', - 'Clearwater County, ID': '035', - 'Custer County, ID': '037', - 'Elmore County, ID': '039', - 'Franklin County, ID': '041', - 'Fremont County, ID': '043', - 'Gem County, ID': '045', - 'Gooding County, ID': '047', - 'Idaho County, ID': '049', - 'Jefferson County, ID': '051', - 'Jerome County, ID': '053', - 'Kootenai County, ID': '055', - 'Latah County, ID': '057', - 'Lemhi County, ID': '059', - 'Lewis County, ID': '061', - 'Lincoln County, ID': '063', - 'Madison County, ID': '065', - 'Minidoka County, ID': '067', - 'Nez Perce County, ID': '069', - 'Oneida County, ID': '071', - 'Owyhee County, ID': '073', - 'Payette County, ID': '075', - 'Power County, ID': '077', - 'Shoshone County, ID': '079', - 'Teton County, ID': '081', - 'Twin Falls County, ID': '083', - 'Valley County, ID': '085', - 'Washington County, ID': '087'}, - '17': {'Adams County, IL': '001', - 'Alexander County, IL': '003', - 'Bond County, IL': '005', - 'Boone County, IL': '007', - 'Brown County, IL': '009', - 'Bureau County, IL': '011', - 'Calhoun County, IL': '013', - 'Carroll County, IL': '015', - 'Cass County, IL': '017', - 'Champaign County, IL': '019', - 'Christian County, IL': '021', - 'Clark County, IL': '023', - 'Clay County, IL': '025', - 'Clinton County, IL': '027', - 'Coles County, IL': '029', - 'Cook County, IL': '031', - 'Crawford County, IL': '033', - 'Cumberland County, IL': '035', - 'De Witt County, IL': '039', - 'DeKalb County, IL': '037', - 'Douglas County, IL': '041', - 'DuPage County, IL': '043', - 'Edgar County, IL': '045', - 'Edwards County, IL': '047', - 'Effingham County, IL': '049', - 'Fayette County, IL': '051', - 'Ford County, IL': '053', - 'Franklin County, IL': '055', - 'Fulton County, IL': '057', - 'Gallatin County, IL': '059', - 'Greene County, IL': '061', - 'Grundy County, IL': '063', - 'Hamilton County, IL': '065', - 'Hancock County, IL': '067', - 'Hardin County, IL': '069', - 'Henderson County, IL': '071', - 'Henry County, IL': '073', - 'Iroquois County, IL': '075', - 'Jackson County, IL': '077', - 'Jasper County, IL': '079', - 'Jefferson County, IL': '081', - 'Jersey County, IL': '083', - 'Jo Daviess County, IL': '085', - 'Johnson County, IL': '087', - 'Kane County, IL': '089', - 'Kankakee County, IL': '091', - 'Kendall County, IL': '093', - 'Knox County, IL': '095', - 'La Salle County, IL': '099', - 'Lake County, IL': '097', - 'Lawrence County, IL': '101', - 'Lee County, IL': '103', - 'Livingston County, IL': '105', - 'Logan County, IL': '107', - 'Macon County, IL': '115', - 'Macoupin County, IL': '117', - 'Madison County, IL': '119', - 'Marion County, IL': '121', - 'Marshall County, IL': '123', - 'Mason County, IL': '125', - 'Massac County, IL': '127', - 'McDonough County, IL': '109', - 'McHenry County, IL': '111', - 'McLean County, IL': '113', - 'Menard County, IL': '129', - 'Mercer County, IL': '131', - 'Monroe County, IL': '133', - 'Montgomery County, IL': '135', - 'Morgan County, IL': '137', - 'Moultrie County, IL': '139', - 'Ogle County, IL': '141', - 'Peoria County, IL': '143', - 'Perry County, IL': '145', - 'Piatt County, IL': '147', - 'Pike County, IL': '149', - 'Pope County, IL': '151', - 'Pulaski County, IL': '153', - 'Putnam County, IL': '155', - 'Randolph County, IL': '157', - 'Richland County, IL': '159', - 'Rock Island County, IL': '161', - 'Saline County, IL': '165', - 'Sangamon County, IL': '167', - 'Schuyler County, IL': '169', - 'Scott County, IL': '171', - 'Shelby County, IL': '173', - 'St. Clair County, IL': '163', - 'Stark County, IL': '175', - 'Stephenson County, IL': '177', - 'Tazewell County, IL': '179', - 'Union County, IL': '181', - 'Vermilion County, IL': '183', - 'Wabash County, IL': '185', - 'Warren County, IL': '187', - 'Washington County, IL': '189', - 'Wayne County, IL': '191', - 'White County, IL': '193', - 'Whiteside County, IL': '195', - 'Will County, IL': '197', - 'Williamson County, IL': '199', - 'Winnebago County, IL': '201', - 'Woodford County, IL': '203'}, - '18': {'Adams County, IN': '001', - 'Allen County, IN': '003', - 'Bartholomew County, IN': '005', - 'Benton County, IN': '007', - 'Blackford County, IN': '009', - 'Boone County, IN': '011', - 'Brown County, IN': '013', - 'Carroll County, IN': '015', - 'Cass County, IN': '017', - 'Clark County, IN': '019', - 'Clay County, IN': '021', - 'Clinton County, IN': '023', - 'Crawford County, IN': '025', - 'Daviess County, IN': '027', - 'DeKalb County, IN': '033', - 'Dearborn County, IN': '029', - 'Decatur County, IN': '031', - 'Delaware County, IN': '035', - 'Dubois County, IN': '037', - 'Elkhart County, IN': '039', - 'Fayette County, IN': '041', - 'Floyd County, IN': '043', - 'Fountain County, IN': '045', - 'Franklin County, IN': '047', - 'Fulton County, IN': '049', - 'Gibson County, IN': '051', - 'Grant County, IN': '053', - 'Greene County, IN': '055', - 'Hamilton County, IN': '057', - 'Hancock County, IN': '059', - 'Harrison County, IN': '061', - 'Hendricks County, IN': '063', - 'Henry County, IN': '065', - 'Howard County, IN': '067', - 'Huntington County, IN': '069', - 'Jackson County, IN': '071', - 'Jasper County, IN': '073', - 'Jay County, IN': '075', - 'Jefferson County, IN': '077', - 'Jennings County, IN': '079', - 'Johnson County, IN': '081', - 'Knox County, IN': '083', - 'Kosciusko County, IN': '085', - 'LaGrange County, IN': '087', - 'LaPorte County, IN': '091', - 'Lake County, IN': '089', - 'Lawrence County, IN': '093', - 'Madison County, IN': '095', - 'Marion County, IN': '097', - 'Marshall County, IN': '099', - 'Martin County, IN': '101', - 'Miami County, IN': '103', - 'Monroe County, IN': '105', - 'Montgomery County, IN': '107', - 'Morgan County, IN': '109', - 'Newton County, IN': '111', - 'Noble County, IN': '113', - 'Ohio County, IN': '115', - 'Orange County, IN': '117', - 'Owen County, IN': '119', - 'Parke County, IN': '121', - 'Perry County, IN': '123', - 'Pike County, IN': '125', - 'Porter County, IN': '127', - 'Posey County, IN': '129', - 'Pulaski County, IN': '131', - 'Putnam County, IN': '133', - 'Randolph County, IN': '135', - 'Ripley County, IN': '137', - 'Rush County, IN': '139', - 'Scott County, IN': '143', - 'Shelby County, IN': '145', - 'Spencer County, IN': '147', - 'St. Joseph County, IN': '141', - 'Starke County, IN': '149', - 'Steuben County, IN': '151', - 'Sullivan County, IN': '153', - 'Switzerland County, IN': '155', - 'Tippecanoe County, IN': '157', - 'Tipton County, IN': '159', - 'Union County, IN': '161', - 'Vanderburgh County, IN': '163', - 'Vermillion County, IN': '165', - 'Vigo County, IN': '167', - 'Wabash County, IN': '169', - 'Warren County, IN': '171', - 'Warrick County, IN': '173', - 'Washington County, IN': '175', - 'Wayne County, IN': '177', - 'Wells County, IN': '179', - 'White County, IN': '181', - 'Whitley County, IN': '183'}, - '19': {'Adair County, IA': '001', - 'Adams County, IA': '003', - 'Allamakee County, IA': '005', - 'Appanoose County, IA': '007', - 'Audubon County, IA': '009', - 'Benton County, IA': '011', - 'Black Hawk County, IA': '013', - 'Boone County, IA': '015', - 'Bremer County, IA': '017', - 'Buchanan County, IA': '019', - 'Buena Vista County, IA': '021', - 'Butler County, IA': '023', - 'Calhoun County, IA': '025', - 'Carroll County, IA': '027', - 'Cass County, IA': '029', - 'Cedar County, IA': '031', - 'Cerro Gordo County, IA': '033', - 'Cherokee County, IA': '035', - 'Chickasaw County, IA': '037', - 'Clarke County, IA': '039', - 'Clay County, IA': '041', - 'Clayton County, IA': '043', - 'Clinton County, IA': '045', - 'Crawford County, IA': '047', - 'Dallas County, IA': '049', - 'Davis County, IA': '051', - 'Decatur County, IA': '053', - 'Delaware County, IA': '055', - 'Des Moines County, IA': '057', - 'Dickinson County, IA': '059', - 'Dubuque County, IA': '061', - 'Emmet County, IA': '063', - 'Fayette County, IA': '065', - 'Floyd County, IA': '067', - 'Franklin County, IA': '069', - 'Fremont County, IA': '071', - 'Greene County, IA': '073', - 'Grundy County, IA': '075', - 'Guthrie County, IA': '077', - 'Hamilton County, IA': '079', - 'Hancock County, IA': '081', - 'Hardin County, IA': '083', - 'Harrison County, IA': '085', - 'Henry County, IA': '087', - 'Howard County, IA': '089', - 'Humboldt County, IA': '091', - 'Ida County, IA': '093', - 'Iowa County, IA': '095', - 'Jackson County, IA': '097', - 'Jasper County, IA': '099', - 'Jefferson County, IA': '101', - 'Johnson County, IA': '103', - 'Jones County, IA': '105', - 'Keokuk County, IA': '107', - 'Kossuth County, IA': '109', - 'Lee County, IA': '111', - 'Linn County, IA': '113', - 'Louisa County, IA': '115', - 'Lucas County, IA': '117', - 'Lyon County, IA': '119', - 'Madison County, IA': '121', - 'Mahaska County, IA': '123', - 'Marion County, IA': '125', - 'Marshall County, IA': '127', - 'Mills County, IA': '129', - 'Mitchell County, IA': '131', - 'Monona County, IA': '133', - 'Monroe County, IA': '135', - 'Montgomery County, IA': '137', - 'Muscatine County, IA': '139', - "O'Brien County, IA": '141', - 'Osceola County, IA': '143', - 'Page County, IA': '145', - 'Palo Alto County, IA': '147', - 'Plymouth County, IA': '149', - 'Pocahontas County, IA': '151', - 'Polk County, IA': '153', - 'Pottawattamie County, IA': '155', - 'Poweshiek County, IA': '157', - 'Ringgold County, IA': '159', - 'Sac County, IA': '161', - 'Scott County, IA': '163', - 'Shelby County, IA': '165', - 'Sioux County, IA': '167', - 'Story County, IA': '169', - 'Tama County, IA': '171', - 'Taylor County, IA': '173', - 'Union County, IA': '175', - 'Van Buren County, IA': '177', - 'Wapello County, IA': '179', - 'Warren County, IA': '181', - 'Washington County, IA': '183', - 'Wayne County, IA': '185', - 'Webster County, IA': '187', - 'Winnebago County, IA': '189', - 'Winneshiek County, IA': '191', - 'Woodbury County, IA': '193', - 'Worth County, IA': '195', - 'Wright County, IA': '197'}, - '20': {'Allen County, KS': '001', - 'Anderson County, KS': '003', - 'Atchison County, KS': '005', - 'Barber County, KS': '007', - 'Barton County, KS': '009', - 'Bourbon County, KS': '011', - 'Brown County, KS': '013', - 'Butler County, KS': '015', - 'Chase County, KS': '017', - 'Chautauqua County, KS': '019', - 'Cherokee County, KS': '021', - 'Cheyenne County, KS': '023', - 'Clark County, KS': '025', - 'Clay County, KS': '027', - 'Cloud County, KS': '029', - 'Coffey County, KS': '031', - 'Comanche County, KS': '033', - 'Cowley County, KS': '035', - 'Crawford County, KS': '037', - 'Decatur County, KS': '039', - 'Dickinson County, KS': '041', - 'Doniphan County, KS': '043', - 'Douglas County, KS': '045', - 'Edwards County, KS': '047', - 'Elk County, KS': '049', - 'Ellis County, KS': '051', - 'Ellsworth County, KS': '053', - 'Finney County, KS': '055', - 'Ford County, KS': '057', - 'Franklin County, KS': '059', - 'Geary County, KS': '061', - 'Gove County, KS': '063', - 'Graham County, KS': '065', - 'Grant County, KS': '067', - 'Gray County, KS': '069', - 'Greeley County, KS': '071', - 'Greenwood County, KS': '073', - 'Hamilton County, KS': '075', - 'Harper County, KS': '077', - 'Harvey County, KS': '079', - 'Haskell County, KS': '081', - 'Hodgeman County, KS': '083', - 'Jackson County, KS': '085', - 'Jefferson County, KS': '087', - 'Jewell County, KS': '089', - 'Johnson County, KS': '091', - 'Kearny County, KS': '093', - 'Kingman County, KS': '095', - 'Kiowa County, KS': '097', - 'Labette County, KS': '099', - 'Lane County, KS': '101', - 'Leavenworth County, KS': '103', - 'Lincoln County, KS': '105', - 'Linn County, KS': '107', - 'Logan County, KS': '109', - 'Lyon County, KS': '111', - 'Marion County, KS': '115', - 'Marshall County, KS': '117', - 'McPherson County, KS': '113', - 'Meade County, KS': '119', - 'Miami County, KS': '121', - 'Mitchell County, KS': '123', - 'Montgomery County, KS': '125', - 'Morris County, KS': '127', - 'Morton County, KS': '129', - 'Nemaha County, KS': '131', - 'Neosho County, KS': '133', - 'Ness County, KS': '135', - 'Norton County, KS': '137', - 'Osage County, KS': '139', - 'Osborne County, KS': '141', - 'Ottawa County, KS': '143', - 'Pawnee County, KS': '145', - 'Phillips County, KS': '147', - 'Pottawatomie County, KS': '149', - 'Pratt County, KS': '151', - 'Rawlins County, KS': '153', - 'Reno County, KS': '155', - 'Republic County, KS': '157', - 'Rice County, KS': '159', - 'Riley County, KS': '161', - 'Rooks County, KS': '163', - 'Rush County, KS': '165', - 'Russell County, KS': '167', - 'Saline County, KS': '169', - 'Scott County, KS': '171', - 'Sedgwick County, KS': '173', - 'Seward County, KS': '175', - 'Shawnee County, KS': '177', - 'Sheridan County, KS': '179', - 'Sherman County, KS': '181', - 'Smith County, KS': '183', - 'Stafford County, KS': '185', - 'Stanton County, KS': '187', - 'Stevens County, KS': '189', - 'Sumner County, KS': '191', - 'Thomas County, KS': '193', - 'Trego County, KS': '195', - 'Wabaunsee County, KS': '197', - 'Wallace County, KS': '199', - 'Washington County, KS': '201', - 'Wichita County, KS': '203', - 'Wilson County, KS': '205', - 'Woodson County, KS': '207', - 'Wyandotte County, KS': '209'}, - '21': {'Adair County, KY': '001', - 'Allen County, KY': '003', - 'Anderson County, KY': '005', - 'Ballard County, KY': '007', - 'Barren County, KY': '009', - 'Bath County, KY': '011', - 'Bell County, KY': '013', - 'Boone County, KY': '015', - 'Bourbon County, KY': '017', - 'Boyd County, KY': '019', - 'Boyle County, KY': '021', - 'Bracken County, KY': '023', - 'Breathitt County, KY': '025', - 'Breckinridge County, KY': '027', - 'Bullitt County, KY': '029', - 'Butler County, KY': '031', - 'Caldwell County, KY': '033', - 'Calloway County, KY': '035', - 'Campbell County, KY': '037', - 'Carlisle County, KY': '039', - 'Carroll County, KY': '041', - 'Carter County, KY': '043', - 'Casey County, KY': '045', - 'Christian County, KY': '047', - 'Clark County, KY': '049', - 'Clay County, KY': '051', - 'Clinton County, KY': '053', - 'Crittenden County, KY': '055', - 'Cumberland County, KY': '057', - 'Daviess County, KY': '059', - 'Edmonson County, KY': '061', - 'Elliott County, KY': '063', - 'Estill County, KY': '065', - 'Fayette County, KY': '067', - 'Fleming County, KY': '069', - 'Floyd County, KY': '071', - 'Franklin County, KY': '073', - 'Fulton County, KY': '075', - 'Gallatin County, KY': '077', - 'Garrard County, KY': '079', - 'Grant County, KY': '081', - 'Graves County, KY': '083', - 'Grayson County, KY': '085', - 'Green County, KY': '087', - 'Greenup County, KY': '089', - 'Hancock County, KY': '091', - 'Hardin County, KY': '093', - 'Harlan County, KY': '095', - 'Harrison County, KY': '097', - 'Hart County, KY': '099', - 'Henderson County, KY': '101', - 'Henry County, KY': '103', - 'Hickman County, KY': '105', - 'Hopkins County, KY': '107', - 'Jackson County, KY': '109', - 'Jefferson County, KY': '111', - 'Jessamine County, KY': '113', - 'Johnson County, KY': '115', - 'Kenton County, KY': '117', - 'Knott County, KY': '119', - 'Knox County, KY': '121', - 'Larue County, KY': '123', - 'Laurel County, KY': '125', - 'Lawrence County, KY': '127', - 'Lee County, KY': '129', - 'Leslie County, KY': '131', - 'Letcher County, KY': '133', - 'Lewis County, KY': '135', - 'Lincoln County, KY': '137', - 'Livingston County, KY': '139', - 'Logan County, KY': '141', - 'Lyon County, KY': '143', - 'Madison County, KY': '151', - 'Magoffin County, KY': '153', - 'Marion County, KY': '155', - 'Marshall County, KY': '157', - 'Martin County, KY': '159', - 'Mason County, KY': '161', - 'McCracken County, KY': '145', - 'McCreary County, KY': '147', - 'McLean County, KY': '149', - 'Meade County, KY': '163', - 'Menifee County, KY': '165', - 'Mercer County, KY': '167', - 'Metcalfe County, KY': '169', - 'Monroe County, KY': '171', - 'Montgomery County, KY': '173', - 'Morgan County, KY': '175', - 'Muhlenberg County, KY': '177', - 'Nelson County, KY': '179', - 'Nicholas County, KY': '181', - 'Ohio County, KY': '183', - 'Oldham County, KY': '185', - 'Owen County, KY': '187', - 'Owsley County, KY': '189', - 'Pendleton County, KY': '191', - 'Perry County, KY': '193', - 'Pike County, KY': '195', - 'Powell County, KY': '197', - 'Pulaski County, KY': '199', - 'Robertson County, KY': '201', - 'Rockcastle County, KY': '203', - 'Rowan County, KY': '205', - 'Russell County, KY': '207', - 'Scott County, KY': '209', - 'Shelby County, KY': '211', - 'Simpson County, KY': '213', - 'Spencer County, KY': '215', - 'Taylor County, KY': '217', - 'Todd County, KY': '219', - 'Trigg County, KY': '221', - 'Trimble County, KY': '223', - 'Union County, KY': '225', - 'Warren County, KY': '227', - 'Washington County, KY': '229', - 'Wayne County, KY': '231', - 'Webster County, KY': '233', - 'Whitley County, KY': '235', - 'Wolfe County, KY': '237', - 'Woodford County, KY': '239'}, - '22': {'Acadia Parish, LA': '001', - 'Allen Parish, LA': '003', - 'Ascension Parish, LA': '005', - 'Assumption Parish, LA': '007', - 'Avoyelles Parish, LA': '009', - 'Beauregard Parish, LA': '011', - 'Bienville Parish, LA': '013', - 'Bossier Parish, LA': '015', - 'Caddo Parish, LA': '017', - 'Calcasieu Parish, LA': '019', - 'Caldwell Parish, LA': '021', - 'Cameron Parish, LA': '023', - 'Catahoula Parish, LA': '025', - 'Claiborne Parish, LA': '027', - 'Concordia Parish, LA': '029', - 'De Soto Parish, LA': '031', - 'East Baton Rouge Parish, LA': '033', - 'East Carroll Parish, LA': '035', - 'East Feliciana Parish, LA': '037', - 'Evangeline Parish, LA': '039', - 'Franklin Parish, LA': '041', - 'Grant Parish, LA': '043', - 'Iberia Parish, LA': '045', - 'Iberville Parish, LA': '047', - 'Jackson Parish, LA': '049', - 'Jefferson Davis Parish, LA': '053', - 'Jefferson Parish, LA': '051', - 'La Salle Parish, LA': '059', - 'Lafayette Parish, LA': '055', - 'Lafourche Parish, LA': '057', - 'Lincoln Parish, LA': '061', - 'Livingston Parish, LA': '063', - 'Madison Parish, LA': '065', - 'Morehouse Parish, LA': '067', - 'Natchitoches Parish, LA': '069', - 'Orleans Parish, LA': '071', - 'Ouachita Parish, LA': '073', - 'Plaquemines Parish, LA': '075', - 'Pointe Coupee Parish, LA': '077', - 'Rapides Parish, LA': '079', - 'Red River Parish, LA': '081', - 'Richland Parish, LA': '083', - 'Sabine Parish, LA': '085', - 'St. Bernard Parish, LA': '087', - 'St. Charles Parish, LA': '089', - 'St. Helena Parish, LA': '091', - 'St. James Parish, LA': '093', - 'St. John the Baptist Parish, LA': '095', - 'St. Landry Parish, LA': '097', - 'St. Martin Parish, LA': '099', - 'St. Mary Parish, LA': '101', - 'St. Tammany Parish, LA': '103', - 'Tangipahoa Parish, LA': '105', - 'Tensas Parish, LA': '107', - 'Terrebonne Parish, LA': '109', - 'Union Parish, LA': '111', - 'Vermilion Parish, LA': '113', - 'Vernon Parish, LA': '115', - 'Washington Parish, LA': '117', - 'Webster Parish, LA': '119', - 'West Baton Rouge Parish, LA': '121', - 'West Carroll Parish, LA': '123', - 'West Feliciana Parish, LA': '125', - 'Winn Parish, LA': '127'}, - '23': {'Androscoggin County, ME': '001', - 'Aroostook County, ME': '003', - 'Cumberland County, ME': '005', - 'Franklin County, ME': '007', - 'Hancock County, ME': '009', - 'Kennebec County, ME': '011', - 'Knox County, ME': '013', - 'Lincoln County, ME': '015', - 'Oxford County, ME': '017', - 'Penobscot County, ME': '019', - 'Piscataquis County, ME': '021', - 'Sagadahoc County, ME': '023', - 'Somerset County, ME': '025', - 'Waldo County, ME': '027', - 'Washington County, ME': '029', - 'York County, ME': '031'}, - '24': {'Allegany County, MD': '001', - 'Anne Arundel County, MD': '003', - 'Baltimore County, MD': '005', - 'Baltimore city, MD': '510', - 'Calvert County, MD': '009', - 'Caroline County, MD': '011', - 'Carroll County, MD': '013', - 'Cecil County, MD': '015', - 'Charles County, MD': '017', - 'Dorchester County, MD': '019', - 'Frederick County, MD': '021', - 'Garrett County, MD': '023', - 'Harford County, MD': '025', - 'Howard County, MD': '027', - 'Kent County, MD': '029', - 'Montgomery County, MD': '031', - "Prince George's County, MD": '033', - "Queen Anne's County, MD": '035', - 'Somerset County, MD': '039', - "St. Mary's County, MD": '037', - 'Talbot County, MD': '041', - 'Washington County, MD': '043', - 'Wicomico County, MD': '045', - 'Worcester County, MD': '047'}, - '25': {'Barnstable County, MA': '001', - 'Berkshire County, MA': '003', - 'Bristol County, MA': '005', - 'Dukes County, MA': '007', - 'Essex County, MA': '009', - 'Franklin County, MA': '011', - 'Hampden County, MA': '013', - 'Hampshire County, MA': '015', - 'Middlesex County, MA': '017', - 'Nantucket County/town, MA': '019', - 'Norfolk County, MA': '021', - 'Plymouth County, MA': '023', - 'Suffolk County, MA': '025', - 'Worcester County, MA': '027'}, - '26': {'Alcona County, MI': '001', - 'Alger County, MI': '003', - 'Allegan County, MI': '005', - 'Alpena County, MI': '007', - 'Antrim County, MI': '009', - 'Arenac County, MI': '011', - 'Baraga County, MI': '013', - 'Barry County, MI': '015', - 'Bay County, MI': '017', - 'Benzie County, MI': '019', - 'Berrien County, MI': '021', - 'Branch County, MI': '023', - 'Calhoun County, MI': '025', - 'Cass County, MI': '027', - 'Charlevoix County, MI': '029', - 'Cheboygan County, MI': '031', - 'Chippewa County, MI': '033', - 'Clare County, MI': '035', - 'Clinton County, MI': '037', - 'Crawford County, MI': '039', - 'Delta County, MI': '041', - 'Dickinson County, MI': '043', - 'Eaton County, MI': '045', - 'Emmet County, MI': '047', - 'Genesee County, MI': '049', - 'Gladwin County, MI': '051', - 'Gogebic County, MI': '053', - 'Grand Traverse County, MI': '055', - 'Gratiot County, MI': '057', - 'Hillsdale County, MI': '059', - 'Houghton County, MI': '061', - 'Huron County, MI': '063', - 'Ingham County, MI': '065', - 'Ionia County, MI': '067', - 'Iosco County, MI': '069', - 'Iron County, MI': '071', - 'Isabella County, MI': '073', - 'Jackson County, MI': '075', - 'Kalamazoo County, MI': '077', - 'Kalkaska County, MI': '079', - 'Kent County, MI': '081', - 'Keweenaw County, MI': '083', - 'Lake County, MI': '085', - 'Lapeer County, MI': '087', - 'Leelanau County, MI': '089', - 'Lenawee County, MI': '091', - 'Livingston County, MI': '093', - 'Luce County, MI': '095', - 'Mackinac County, MI': '097', - 'Macomb County, MI': '099', - 'Manistee County, MI': '101', - 'Marquette County, MI': '103', - 'Mason County, MI': '105', - 'Mecosta County, MI': '107', - 'Menominee County, MI': '109', - 'Midland County, MI': '111', - 'Missaukee County, MI': '113', - 'Monroe County, MI': '115', - 'Montcalm County, MI': '117', - 'Montmorency County, MI': '119', - 'Muskegon County, MI': '121', - 'Newaygo County, MI': '123', - 'Oakland County, MI': '125', - 'Oceana County, MI': '127', - 'Ogemaw County, MI': '129', - 'Ontonagon County, MI': '131', - 'Osceola County, MI': '133', - 'Oscoda County, MI': '135', - 'Otsego County, MI': '137', - 'Ottawa County, MI': '139', - 'Presque Isle County, MI': '141', - 'Roscommon County, MI': '143', - 'Saginaw County, MI': '145', - 'Sanilac County, MI': '151', - 'Schoolcraft County, MI': '153', - 'Shiawassee County, MI': '155', - 'St. Clair County, MI': '147', - 'St. Joseph County, MI': '149', - 'Tuscola County, MI': '157', - 'Van Buren County, MI': '159', - 'Washtenaw County, MI': '161', - 'Wayne County, MI': '163', - 'Wexford County, MI': '165'}, - '27': {'Aitkin County, MN': '001', - 'Anoka County, MN': '003', - 'Becker County, MN': '005', - 'Beltrami County, MN': '007', - 'Benton County, MN': '009', - 'Big Stone County, MN': '011', - 'Blue Earth County, MN': '013', - 'Brown County, MN': '015', - 'Carlton County, MN': '017', - 'Carver County, MN': '019', - 'Cass County, MN': '021', - 'Chippewa County, MN': '023', - 'Chisago County, MN': '025', - 'Clay County, MN': '027', - 'Clearwater County, MN': '029', - 'Cook County, MN': '031', - 'Cottonwood County, MN': '033', - 'Crow Wing County, MN': '035', - 'Dakota County, MN': '037', - 'Dodge County, MN': '039', - 'Douglas County, MN': '041', - 'Faribault County, MN': '043', - 'Fillmore County, MN': '045', - 'Freeborn County, MN': '047', - 'Goodhue County, MN': '049', - 'Grant County, MN': '051', - 'Hennepin County, MN': '053', - 'Houston County, MN': '055', - 'Hubbard County, MN': '057', - 'Isanti County, MN': '059', - 'Itasca County, MN': '061', - 'Jackson County, MN': '063', - 'Kanabec County, MN': '065', - 'Kandiyohi County, MN': '067', - 'Kittson County, MN': '069', - 'Koochiching County, MN': '071', - 'Lac qui Parle County, MN': '073', - 'Lake County, MN': '075', - 'Lake of the Woods County, MN': '077', - 'Le Sueur County, MN': '079', - 'Lincoln County, MN': '081', - 'Lyon County, MN': '083', - 'Mahnomen County, MN': '087', - 'Marshall County, MN': '089', - 'Martin County, MN': '091', - 'McLeod County, MN': '085', - 'Meeker County, MN': '093', - 'Mille Lacs County, MN': '095', - 'Morrison County, MN': '097', - 'Mower County, MN': '099', - 'Murray County, MN': '101', - 'Nicollet County, MN': '103', - 'Nobles County, MN': '105', - 'Norman County, MN': '107', - 'Olmsted County, MN': '109', - 'Otter Tail County, MN': '111', - 'Pennington County, MN': '113', - 'Pine County, MN': '115', - 'Pipestone County, MN': '117', - 'Polk County, MN': '119', - 'Pope County, MN': '121', - 'Ramsey County, MN': '123', - 'Red Lake County, MN': '125', - 'Redwood County, MN': '127', - 'Renville County, MN': '129', - 'Rice County, MN': '131', - 'Rock County, MN': '133', - 'Roseau County, MN': '135', - 'Scott County, MN': '139', - 'Sherburne County, MN': '141', - 'Sibley County, MN': '143', - 'St. Louis County, MN': '137', - 'Stearns County, MN': '145', - 'Steele County, MN': '147', - 'Stevens County, MN': '149', - 'Swift County, MN': '151', - 'Todd County, MN': '153', - 'Traverse County, MN': '155', - 'Wabasha County, MN': '157', - 'Wadena County, MN': '159', - 'Waseca County, MN': '161', - 'Washington County, MN': '163', - 'Watonwan County, MN': '165', - 'Wilkin County, MN': '167', - 'Winona County, MN': '169', - 'Wright County, MN': '171', - 'Yellow Medicine County, MN': '173'}, - '28': {'Adams County, MS': '001', - 'Alcorn County, MS': '003', - 'Amite County, MS': '005', - 'Attala County, MS': '007', - 'Benton County, MS': '009', - 'Bolivar County, MS': '011', - 'Calhoun County, MS': '013', - 'Carroll County, MS': '015', - 'Chickasaw County, MS': '017', - 'Choctaw County, MS': '019', - 'Claiborne County, MS': '021', - 'Clarke County, MS': '023', - 'Clay County, MS': '025', - 'Coahoma County, MS': '027', - 'Copiah County, MS': '029', - 'Covington County, MS': '031', - 'DeSoto County, MS': '033', - 'Forrest County, MS': '035', - 'Franklin County, MS': '037', - 'George County, MS': '039', - 'Greene County, MS': '041', - 'Grenada County, MS': '043', - 'Hancock County, MS': '045', - 'Harrison County, MS': '047', - 'Hinds County, MS': '049', - 'Holmes County, MS': '051', - 'Humphreys County, MS': '053', - 'Issaquena County, MS': '055', - 'Itawamba County, MS': '057', - 'Jackson County, MS': '059', - 'Jasper County, MS': '061', - 'Jefferson County, MS': '063', - 'Jefferson Davis County, MS': '065', - 'Jones County, MS': '067', - 'Kemper County, MS': '069', - 'Lafayette County, MS': '071', - 'Lamar County, MS': '073', - 'Lauderdale County, MS': '075', - 'Lawrence County, MS': '077', - 'Leake County, MS': '079', - 'Lee County, MS': '081', - 'Leflore County, MS': '083', - 'Lincoln County, MS': '085', - 'Lowndes County, MS': '087', - 'Madison County, MS': '089', - 'Marion County, MS': '091', - 'Marshall County, MS': '093', - 'Monroe County, MS': '095', - 'Montgomery County, MS': '097', - 'Neshoba County, MS': '099', - 'Newton County, MS': '101', - 'Noxubee County, MS': '103', - 'Oktibbeha County, MS': '105', - 'Panola County, MS': '107', - 'Pearl River County, MS': '109', - 'Perry County, MS': '111', - 'Pike County, MS': '113', - 'Pontotoc County, MS': '115', - 'Prentiss County, MS': '117', - 'Quitman County, MS': '119', - 'Rankin County, MS': '121', - 'Scott County, MS': '123', - 'Sharkey County, MS': '125', - 'Simpson County, MS': '127', - 'Smith County, MS': '129', - 'Stone County, MS': '131', - 'Sunflower County, MS': '133', - 'Tallahatchie County, MS': '135', - 'Tate County, MS': '137', - 'Tippah County, MS': '139', - 'Tishomingo County, MS': '141', - 'Tunica County, MS': '143', - 'Union County, MS': '145', - 'Walthall County, MS': '147', - 'Warren County, MS': '149', - 'Washington County, MS': '151', - 'Wayne County, MS': '153', - 'Webster County, MS': '155', - 'Wilkinson County, MS': '157', - 'Winston County, MS': '159', - 'Yalobusha County, MS': '161', - 'Yazoo County, MS': '163'}, - '29': {'Adair County, MO': '001', - 'Andrew County, MO': '003', - 'Atchison County, MO': '005', - 'Audrain County, MO': '007', - 'Barry County, MO': '009', - 'Barton County, MO': '011', - 'Bates County, MO': '013', - 'Benton County, MO': '015', - 'Bollinger County, MO': '017', - 'Boone County, MO': '019', - 'Buchanan County, MO': '021', - 'Butler County, MO': '023', - 'Caldwell County, MO': '025', - 'Callaway County, MO': '027', - 'Camden County, MO': '029', - 'Cape Girardeau County, MO': '031', - 'Carroll County, MO': '033', - 'Carter County, MO': '035', - 'Cass County, MO': '037', - 'Cedar County, MO': '039', - 'Chariton County, MO': '041', - 'Christian County, MO': '043', - 'Clark County, MO': '045', - 'Clay County, MO': '047', - 'Clinton County, MO': '049', - 'Cole County, MO': '051', - 'Cooper County, MO': '053', - 'Crawford County, MO': '055', - 'Dade County, MO': '057', - 'Dallas County, MO': '059', - 'Daviess County, MO': '061', - 'DeKalb County, MO': '063', - 'Dent County, MO': '065', - 'Douglas County, MO': '067', - 'Dunklin County, MO': '069', - 'Franklin County, MO': '071', - 'Gasconade County, MO': '073', - 'Gentry County, MO': '075', - 'Greene County, MO': '077', - 'Grundy County, MO': '079', - 'Harrison County, MO': '081', - 'Henry County, MO': '083', - 'Hickory County, MO': '085', - 'Holt County, MO': '087', - 'Howard County, MO': '089', - 'Howell County, MO': '091', - 'Iron County, MO': '093', - 'Jackson County, MO': '095', - 'Jasper County, MO': '097', - 'Jefferson County, MO': '099', - 'Johnson County, MO': '101', - 'Knox County, MO': '103', - 'Laclede County, MO': '105', - 'Lafayette County, MO': '107', - 'Lawrence County, MO': '109', - 'Lewis County, MO': '111', - 'Lincoln County, MO': '113', - 'Linn County, MO': '115', - 'Livingston County, MO': '117', - 'Macon County, MO': '121', - 'Madison County, MO': '123', - 'Maries County, MO': '125', - 'Marion County, MO': '127', - 'McDonald County, MO': '119', - 'Mercer County, MO': '129', - 'Miller County, MO': '131', - 'Mississippi County, MO': '133', - 'Moniteau County, MO': '135', - 'Monroe County, MO': '137', - 'Montgomery County, MO': '139', - 'Morgan County, MO': '141', - 'New Madrid County, MO': '143', - 'Newton County, MO': '145', - 'Nodaway County, MO': '147', - 'Oregon County, MO': '149', - 'Osage County, MO': '151', - 'Ozark County, MO': '153', - 'Pemiscot County, MO': '155', - 'Perry County, MO': '157', - 'Pettis County, MO': '159', - 'Phelps County, MO': '161', - 'Pike County, MO': '163', - 'Platte County, MO': '165', - 'Polk County, MO': '167', - 'Pulaski County, MO': '169', - 'Putnam County, MO': '171', - 'Ralls County, MO': '173', - 'Randolph County, MO': '175', - 'Ray County, MO': '177', - 'Reynolds County, MO': '179', - 'Ripley County, MO': '181', - 'Saline County, MO': '195', - 'Schuyler County, MO': '197', - 'Scotland County, MO': '199', - 'Scott County, MO': '201', - 'Shannon County, MO': '203', - 'Shelby County, MO': '205', - 'St. Charles County, MO': '183', - 'St. Clair County, MO': '185', - 'St. Francois County, MO': '187', - 'St. Louis County, MO': '189', - 'St. Louis city, MO': '510', - 'Ste. Genevieve County, MO': '186', - 'Stoddard County, MO': '207', - 'Stone County, MO': '209', - 'Sullivan County, MO': '211', - 'Taney County, MO': '213', - 'Texas County, MO': '215', - 'Vernon County, MO': '217', - 'Warren County, MO': '219', - 'Washington County, MO': '221', - 'Wayne County, MO': '223', - 'Webster County, MO': '225', - 'Worth County, MO': '227', - 'Wright County, MO': '229'}, - '30': {'Beaverhead County, MT': '001', - 'Big Horn County, MT': '003', - 'Blaine County, MT': '005', - 'Broadwater County, MT': '007', - 'Carbon County, MT': '009', - 'Carter County, MT': '011', - 'Cascade County, MT': '013', - 'Chouteau County, MT': '015', - 'Custer County, MT': '017', - 'Daniels County, MT': '019', - 'Dawson County, MT': '021', - 'Deer Lodge County, MT': '023', - 'Fallon County, MT': '025', - 'Fergus County, MT': '027', - 'Flathead County, MT': '029', - 'Gallatin County, MT': '031', - 'Garfield County, MT': '033', - 'Glacier County, MT': '035', - 'Golden Valley County, MT': '037', - 'Granite County, MT': '039', - 'Hill County, MT': '041', - 'Jefferson County, MT': '043', - 'Judith Basin County, MT': '045', - 'Lake County, MT': '047', - 'Lewis and Clark County, MT': '049', - 'Liberty County, MT': '051', - 'Lincoln County, MT': '053', - 'Madison County, MT': '057', - 'McCone County, MT': '055', - 'Meagher County, MT': '059', - 'Mineral County, MT': '061', - 'Missoula County, MT': '063', - 'Musselshell County, MT': '065', - 'Park County, MT': '067', - 'Petroleum County, MT': '069', - 'Phillips County, MT': '071', - 'Pondera County, MT': '073', - 'Powder River County, MT': '075', - 'Powell County, MT': '077', - 'Prairie County, MT': '079', - 'Ravalli County, MT': '081', - 'Richland County, MT': '083', - 'Roosevelt County, MT': '085', - 'Rosebud County, MT': '087', - 'Sanders County, MT': '089', - 'Sheridan County, MT': '091', - 'Silver Bow County, MT': '093', - 'Stillwater County, MT': '095', - 'Sweet Grass County, MT': '097', - 'Teton County, MT': '099', - 'Toole County, MT': '101', - 'Treasure County, MT': '103', - 'Valley County, MT': '105', - 'Wheatland County, MT': '107', - 'Wibaux County, MT': '109', - 'Yellowstone County, MT': '111'}, - '31': {'Adams County, NE': '001', - 'Antelope County, NE': '003', - 'Arthur County, NE': '005', - 'Banner County, NE': '007', - 'Blaine County, NE': '009', - 'Boone County, NE': '011', - 'Box Butte County, NE': '013', - 'Boyd County, NE': '015', - 'Brown County, NE': '017', - 'Buffalo County, NE': '019', - 'Burt County, NE': '021', - 'Butler County, NE': '023', - 'Cass County, NE': '025', - 'Cedar County, NE': '027', - 'Chase County, NE': '029', - 'Cherry County, NE': '031', - 'Cheyenne County, NE': '033', - 'Clay County, NE': '035', - 'Colfax County, NE': '037', - 'Cuming County, NE': '039', - 'Custer County, NE': '041', - 'Dakota County, NE': '043', - 'Dawes County, NE': '045', - 'Dawson County, NE': '047', - 'Deuel County, NE': '049', - 'Dixon County, NE': '051', - 'Dodge County, NE': '053', - 'Douglas County, NE': '055', - 'Dundy County, NE': '057', - 'Fillmore County, NE': '059', - 'Franklin County, NE': '061', - 'Frontier County, NE': '063', - 'Furnas County, NE': '065', - 'Gage County, NE': '067', - 'Garden County, NE': '069', - 'Garfield County, NE': '071', - 'Gosper County, NE': '073', - 'Grant County, NE': '075', - 'Greeley County, NE': '077', - 'Hall County, NE': '079', - 'Hamilton County, NE': '081', - 'Harlan County, NE': '083', - 'Hayes County, NE': '085', - 'Hitchcock County, NE': '087', - 'Holt County, NE': '089', - 'Hooker County, NE': '091', - 'Howard County, NE': '093', - 'Jefferson County, NE': '095', - 'Johnson County, NE': '097', - 'Kearney County, NE': '099', - 'Keith County, NE': '101', - 'Keya Paha County, NE': '103', - 'Kimball County, NE': '105', - 'Knox County, NE': '107', - 'Lancaster County, NE': '109', - 'Lincoln County, NE': '111', - 'Logan County, NE': '113', - 'Loup County, NE': '115', - 'Madison County, NE': '119', - 'McPherson County, NE': '117', - 'Merrick County, NE': '121', - 'Morrill County, NE': '123', - 'Nance County, NE': '125', - 'Nemaha County, NE': '127', - 'Nuckolls County, NE': '129', - 'Otoe County, NE': '131', - 'Pawnee County, NE': '133', - 'Perkins County, NE': '135', - 'Phelps County, NE': '137', - 'Pierce County, NE': '139', - 'Platte County, NE': '141', - 'Polk County, NE': '143', - 'Red Willow County, NE': '145', - 'Richardson County, NE': '147', - 'Rock County, NE': '149', - 'Saline County, NE': '151', - 'Sarpy County, NE': '153', - 'Saunders County, NE': '155', - 'Scotts Bluff County, NE': '157', - 'Seward County, NE': '159', - 'Sheridan County, NE': '161', - 'Sherman County, NE': '163', - 'Sioux County, NE': '165', - 'Stanton County, NE': '167', - 'Thayer County, NE': '169', - 'Thomas County, NE': '171', - 'Thurston County, NE': '173', - 'Valley County, NE': '175', - 'Washington County, NE': '177', - 'Wayne County, NE': '179', - 'Webster County, NE': '181', - 'Wheeler County, NE': '183', - 'York County, NE': '185'}, - '32': {'Carson City, NV': '510', - 'Churchill County, NV': '001', - 'Clark County, NV': '003', - 'Douglas County, NV': '005', - 'Elko County, NV': '007', - 'Esmeralda County, NV': '009', - 'Eureka County, NV': '011', - 'Humboldt County, NV': '013', - 'Lander County, NV': '015', - 'Lincoln County, NV': '017', - 'Lyon County, NV': '019', - 'Mineral County, NV': '021', - 'Nye County, NV': '023', - 'Pershing County, NV': '027', - 'Storey County, NV': '029', - 'Washoe County, NV': '031', - 'White Pine County, NV': '033'}, - '33': {'Belknap County, NH': '001', - 'Carroll County, NH': '003', - 'Cheshire County, NH': '005', - 'Coos County, NH': '007', - 'Grafton County, NH': '009', - 'Hillsborough County, NH': '011', - 'Merrimack County, NH': '013', - 'Rockingham County, NH': '015', - 'Strafford County, NH': '017', - 'Sullivan County, NH': '019'}, - '34': {'Atlantic County, NJ': '001', - 'Bergen County, NJ': '003', - 'Burlington County, NJ': '005', - 'Camden County, NJ': '007', - 'Cape May County, NJ': '009', - 'Cumberland County, NJ': '011', - 'Essex County, NJ': '013', - 'Gloucester County, NJ': '015', - 'Hudson County, NJ': '017', - 'Hunterdon County, NJ': '019', - 'Mercer County, NJ': '021', - 'Middlesex County, NJ': '023', - 'Monmouth County, NJ': '025', - 'Morris County, NJ': '027', - 'Ocean County, NJ': '029', - 'Passaic County, NJ': '031', - 'Salem County, NJ': '033', - 'Somerset County, NJ': '035', - 'Sussex County, NJ': '037', - 'Union County, NJ': '039', - 'Warren County, NJ': '041'}, - '35': {'Bernalillo County, NM': '001', - 'Catron County, NM': '003', - 'Chaves County, NM': '005', - 'Cibola County, NM': '006', - 'Colfax County, NM': '007', - 'Curry County, NM': '009', - 'DeBaca County, NM': '011', - 'Dona Ana County, NM': '013', - 'Eddy County, NM': '015', - 'Grant County, NM': '017', - 'Guadalupe County, NM': '019', - 'Harding County, NM': '021', - 'Hidalgo County, NM': '023', - 'Lea County, NM': '025', - 'Lincoln County, NM': '027', - 'Los Alamos County, NM': '028', - 'Luna County, NM': '029', - 'McKinley County, NM': '031', - 'Mora County, NM': '033', - 'Otero County, NM': '035', - 'Quay County, NM': '037', - 'Rio Arriba County, NM': '039', - 'Roosevelt County, NM': '041', - 'San Juan County, NM': '045', - 'San Miguel County, NM': '047', - 'Sandoval County, NM': '043', - 'Santa Fe County, NM': '049', - 'Sierra County, NM': '051', - 'Socorro County, NM': '053', - 'Taos County, NM': '055', - 'Torrance County, NM': '057', - 'Union County, NM': '059', - 'Valencia County, NM': '061'}, - '36': {'Albany County, NY': '001', - 'Allegany County, NY': '003', - 'Bronx County, NY': '005', - 'Broome County, NY': '007', - 'Cattaraugus County, NY': '009', - 'Cayuga County, NY': '011', - 'Chautauqua County, NY': '013', - 'Chemung County, NY': '015', - 'Chenango County, NY': '017', - 'Clinton County, NY': '019', - 'Columbia County, NY': '021', - 'Cortland County, NY': '023', - 'Delaware County, NY': '025', - 'Dutchess County, NY': '027', - 'Erie County, NY': '029', - 'Essex County, NY': '031', - 'Franklin County, NY': '033', - 'Fulton County, NY': '035', - 'Genesee County, NY': '037', - 'Greene County, NY': '039', - 'Hamilton County, NY': '041', - 'Herkimer County, NY': '043', - 'Jefferson County, NY': '045', - 'Kings County, NY': '047', - 'Lewis County, NY': '049', - 'Livingston County, NY': '051', - 'Madison County, NY': '053', - 'Monroe County, NY': '055', - 'Montgomery County, NY': '057', - 'Nassau County, NY': '059', - 'New York County, NY': '061', - 'Niagara County, NY': '063', - 'Oneida County, NY': '065', - 'Onondaga County, NY': '067', - 'Ontario County, NY': '069', - 'Orange County, NY': '071', - 'Orleans County, NY': '073', - 'Oswego County, NY': '075', - 'Otsego County, NY': '077', - 'Putnam County, NY': '079', - 'Queens County, NY': '081', - 'Rensselaer County, NY': '083', - 'Richmond County, NY': '085', - 'Rockland County, NY': '087', - 'Saratoga County, NY': '091', - 'Schenectady County, NY': '093', - 'Schoharie County, NY': '095', - 'Schuyler County, NY': '097', - 'Seneca County, NY': '099', - 'St. Lawrence County, NY': '089', - 'Steuben County, NY': '101', - 'Suffolk County, NY': '103', - 'Sullivan County, NY': '105', - 'Tioga County, NY': '107', - 'Tompkins County, NY': '109', - 'Ulster County, NY': '111', - 'Warren County, NY': '113', - 'Washington County, NY': '115', - 'Wayne County, NY': '117', - 'Westchester County, NY': '119', - 'Wyoming County, NY': '121', - 'Yates County, NY': '123'}, - '37': {'Alamance County, NC': '001', - 'Alexander County, NC': '003', - 'Alleghany County, NC': '005', - 'Anson County, NC': '007', - 'Ashe County, NC': '009', - 'Avery County, NC': '011', - 'Beaufort County, NC': '013', - 'Bertie County, NC': '015', - 'Bladen County, NC': '017', - 'Brunswick County, NC': '019', - 'Buncombe County, NC': '021', - 'Burke County, NC': '023', - 'Cabarrus County, NC': '025', - 'Caldwell County, NC': '027', - 'Camden County, NC': '029', - 'Carteret County, NC': '031', - 'Caswell County, NC': '033', - 'Catawba County, NC': '035', - 'Chatham County, NC': '037', - 'Cherokee County, NC': '039', - 'Chowan County, NC': '041', - 'Clay County, NC': '043', - 'Cleveland County, NC': '045', - 'Columbus County, NC': '047', - 'Craven County, NC': '049', - 'Cumberland County, NC': '051', - 'Currituck County, NC': '053', - 'Dare County, NC': '055', - 'Davidson County, NC': '057', - 'Davie County, NC': '059', - 'Duplin County, NC': '061', - 'Durham County, NC': '063', - 'Edgecombe County, NC': '065', - 'Forsyth County, NC': '067', - 'Franklin County, NC': '069', - 'Gaston County, NC': '071', - 'Gates County, NC': '073', - 'Graham County, NC': '075', - 'Granville County, NC': '077', - 'Greene County, NC': '079', - 'Guilford County, NC': '081', - 'Halifax County, NC': '083', - 'Harnett County, NC': '085', - 'Haywood County, NC': '087', - 'Henderson County, NC': '089', - 'Hertford County, NC': '091', - 'Hoke County, NC': '093', - 'Hyde County, NC': '095', - 'Iredell County, NC': '097', - 'Jackson County, NC': '099', - 'Johnston County, NC': '101', - 'Jones County, NC': '103', - 'Lee County, NC': '105', - 'Lenoir County, NC': '107', - 'Lincoln County, NC': '109', - 'Macon County, NC': '113', - 'Madison County, NC': '115', - 'Martin County, NC': '117', - 'McDowell County, NC': '111', - 'Mecklenburg County, NC': '119', - 'Mitchell County, NC': '121', - 'Montgomery County, NC': '123', - 'Moore County, NC': '125', - 'Nash County, NC': '127', - 'New Hanover County, NC': '129', - 'Northampton County, NC': '131', - 'Onslow County, NC': '133', - 'Orange County, NC': '135', - 'Pamlico County, NC': '137', - 'Pasquotank County, NC': '139', - 'Pender County, NC': '141', - 'Perquimans County, NC': '143', - 'Person County, NC': '145', - 'Pitt County, NC': '147', - 'Polk County, NC': '149', - 'Randolph County, NC': '151', - 'Richmond County, NC': '153', - 'Robeson County, NC': '155', - 'Rockingham County, NC': '157', - 'Rowan County, NC': '159', - 'Rutherford County, NC': '161', - 'Sampson County, NC': '163', - 'Scotland County, NC': '165', - 'Stanly County, NC': '167', - 'Stokes County, NC': '169', - 'Surry County, NC': '171', - 'Swain County, NC': '173', - 'Transylvania County, NC': '175', - 'Tyrrell County, NC': '177', - 'Union County, NC': '179', - 'Vance County, NC': '181', - 'Wake County, NC': '183', - 'Warren County, NC': '185', - 'Washington County, NC': '187', - 'Watauga County, NC': '189', - 'Wayne County, NC': '191', - 'Wilkes County, NC': '193', - 'Wilson County, NC': '195', - 'Yadkin County, NC': '197', - 'Yancey County, NC': '199'}, - '38': {'Adams County, ND': '001', - 'Barnes County, ND': '003', - 'Benson County, ND': '005', - 'Billings County, ND': '007', - 'Bottineau County, ND': '009', - 'Bowman County, ND': '011', - 'Burke County, ND': '013', - 'Burleigh County, ND': '015', - 'Cass County, ND': '017', - 'Cavalier County, ND': '019', - 'Dickey County, ND': '021', - 'Divide County, ND': '023', - 'Dunn County, ND': '025', - 'Eddy County, ND': '027', - 'Emmons County, ND': '029', - 'Foster County, ND': '031', - 'Golden Valley County, ND': '033', - 'Grand Forks County, ND': '035', - 'Grant County, ND': '037', - 'Griggs County, ND': '039', - 'Hettinger County, ND': '041', - 'Kidder County, ND': '043', - 'LaMoure County, ND': '045', - 'Logan County, ND': '047', - 'McHenry County, ND': '049', - 'McIntosh County, ND': '051', - 'McKenzie County, ND': '053', - 'McLean County, ND': '055', - 'Mercer County, ND': '057', - 'Morton County, ND': '059', - 'Mountrail County, ND': '061', - 'Nelson County, ND': '063', - 'Oliver County, ND': '065', - 'Pembina County, ND': '067', - 'Pierce County, ND': '069', - 'Ramsey County, ND': '071', - 'Ransom County, ND': '073', - 'Renville County, ND': '075', - 'Richland County, ND': '077', - 'Rolette County, ND': '079', - 'Sargent County, ND': '081', - 'Sheridan County, ND': '083', - 'Sioux County, ND': '085', - 'Slope County, ND': '087', - 'Stark County, ND': '089', - 'Steele County, ND': '091', - 'Stutsman County, ND': '093', - 'Towner County, ND': '095', - 'Traill County, ND': '097', - 'Walsh County, ND': '099', - 'Ward County, ND': '101', - 'Wells County, ND': '103', - 'Williams County, ND': '105'}, - '39': {'Adams County, OH': '001', - 'Allen County, OH': '003', - 'Ashland County, OH': '005', - 'Ashtabula County, OH': '007', - 'Athens County, OH': '009', - 'Auglaize County, OH': '011', - 'Belmont County, OH': '013', - 'Brown County, OH': '015', - 'Butler County, OH': '017', - 'Carroll County, OH': '019', - 'Champaign County, OH': '021', - 'Clark County, OH': '023', - 'Clermont County, OH': '025', - 'Clinton County, OH': '027', - 'Columbiana County, OH': '029', - 'Coshocton County, OH': '031', - 'Crawford County, OH': '033', - 'Cuyahoga County, OH': '035', - 'Darke County, OH': '037', - 'Defiance County, OH': '039', - 'Delaware County, OH': '041', - 'Erie County, OH': '043', - 'Fairfield County, OH': '045', - 'Fayette County, OH': '047', - 'Franklin County, OH': '049', - 'Fulton County, OH': '051', - 'Gallia County, OH': '053', - 'Geauga County, OH': '055', - 'Greene County, OH': '057', - 'Guernsey County, OH': '059', - 'Hamilton County, OH': '061', - 'Hancock County, OH': '063', - 'Hardin County, OH': '065', - 'Harrison County, OH': '067', - 'Henry County, OH': '069', - 'Highland County, OH': '071', - 'Hocking County, OH': '073', - 'Holmes County, OH': '075', - 'Huron County, OH': '077', - 'Jackson County, OH': '079', - 'Jefferson County, OH': '081', - 'Knox County, OH': '083', - 'Lake County, OH': '085', - 'Lawrence County, OH': '087', - 'Licking County, OH': '089', - 'Logan County, OH': '091', - 'Lorain County, OH': '093', - 'Lucas County, OH': '095', - 'Madison County, OH': '097', - 'Mahoning County, OH': '099', - 'Marion County, OH': '101', - 'Medina County, OH': '103', - 'Meigs County, OH': '105', - 'Mercer County, OH': '107', - 'Miami County, OH': '109', - 'Monroe County, OH': '111', - 'Montgomery County, OH': '113', - 'Morgan County, OH': '115', - 'Morrow County, OH': '117', - 'Muskingum County, OH': '119', - 'Noble County, OH': '121', - 'Ottawa County, OH': '123', - 'Paulding County, OH': '125', - 'Perry County, OH': '127', - 'Pickaway County, OH': '129', - 'Pike County, OH': '131', - 'Portage County, OH': '133', - 'Preble County, OH': '135', - 'Putnam County, OH': '137', - 'Richland County, OH': '139', - 'Ross County, OH': '141', - 'Sandusky County, OH': '143', - 'Scioto County, OH': '145', - 'Seneca County, OH': '147', - 'Shelby County, OH': '149', - 'Stark County, OH': '151', - 'Summit County, OH': '153', - 'Trumbull County, OH': '155', - 'Tuscarawas County, OH': '157', - 'Union County, OH': '159', - 'Van Wert County, OH': '161', - 'Vinton County, OH': '163', - 'Warren County, OH': '165', - 'Washington County, OH': '167', - 'Wayne County, OH': '169', - 'Williams County, OH': '171', - 'Wood County, OH': '173', - 'Wyandot County, OH': '175'}, - '40': {'Adair County, OK': '001', - 'Alfalfa County, OK': '003', - 'Atoka County, OK': '005', - 'Beaver County, OK': '007', - 'Beckham County, OK': '009', - 'Blaine County, OK': '011', - 'Bryan County, OK': '013', - 'Caddo County, OK': '015', - 'Canadian County, OK': '017', - 'Carter County, OK': '019', - 'Cherokee County, OK': '021', - 'Choctaw County, OK': '023', - 'Cimarron County, OK': '025', - 'Cleveland County, OK': '027', - 'Coal County, OK': '029', - 'Comanche County, OK': '031', - 'Cotton County, OK': '033', - 'Craig County, OK': '035', - 'Creek County, OK': '037', - 'Custer County, OK': '039', - 'Delaware County, OK': '041', - 'Dewey County, OK': '043', - 'Ellis County, OK': '045', - 'Garfield County, OK': '047', - 'Garvin County, OK': '049', - 'Grady County, OK': '051', - 'Grant County, OK': '053', - 'Greer County, OK': '055', - 'Harmon County, OK': '057', - 'Harper County, OK': '059', - 'Haskell County, OK': '061', - 'Hughes County, OK': '063', - 'Jackson County, OK': '065', - 'Jefferson County, OK': '067', - 'Johnston County, OK': '069', - 'Kay County, OK': '071', - 'Kingfisher County, OK': '073', - 'Kiowa County, OK': '075', - 'Latimer County, OK': '077', - 'Le Flore County, OK': '079', - 'Lincoln County, OK': '081', - 'Logan County, OK': '083', - 'Love County, OK': '085', - 'Major County, OK': '093', - 'Marshall County, OK': '095', - 'Mayes County, OK': '097', - 'McClain County, OK': '087', - 'McCurtain County, OK': '089', - 'McIntosh County, OK': '091', - 'Murray County, OK': '099', - 'Muskogee County, OK': '101', - 'Noble County, OK': '103', - 'Nowata County, OK': '105', - 'Okfuskee County, OK': '107', - 'Oklahoma County, OK': '109', - 'Okmulgee County, OK': '111', - 'Osage County, OK': '113', - 'Ottawa County, OK': '115', - 'Pawnee County, OK': '117', - 'Payne County, OK': '119', - 'Pittsburg County, OK': '121', - 'Pontotoc County, OK': '123', - 'Pottawatomie County, OK': '125', - 'Pushmataha County, OK': '127', - 'Roger Mills County, OK': '129', - 'Rogers County, OK': '131', - 'Seminole County, OK': '133', - 'Sequoyah County, OK': '135', - 'Stephens County, OK': '137', - 'Texas County, OK': '139', - 'Tillman County, OK': '141', - 'Tulsa County, OK': '143', - 'Wagoner County, OK': '145', - 'Washington County, OK': '147', - 'Washita County, OK': '149', - 'Woods County, OK': '151', - 'Woodward County, OK': '153'}, - '41': {'Baker County, OR': '001', - 'Benton County, OR': '003', - 'Clackamas County, OR': '005', - 'Clatsop County, OR': '007', - 'Columbia County, OR': '009', - 'Coos County, OR': '011', - 'Crook County, OR': '013', - 'Curry County, OR': '015', - 'Deschutes County, OR': '017', - 'Douglas County, OR': '019', - 'Gilliam County, OR': '021', - 'Grant County, OR': '023', - 'Harney County, OR': '025', - 'Hood River County, OR': '027', - 'Jackson County, OR': '029', - 'Jefferson County, OR': '031', - 'Josephine County, OR': '033', - 'Klamath County, OR': '035', - 'Lake County, OR': '037', - 'Lane County, OR': '039', - 'Lincoln County, OR': '041', - 'Linn County, OR': '043', - 'Malheur County, OR': '045', - 'Marion County, OR': '047', - 'Morrow County, OR': '049', - 'Multnomah County, OR': '051', - 'Polk County, OR': '053', - 'Sherman County, OR': '055', - 'Tillamook County, OR': '057', - 'Umatilla County, OR': '059', - 'Union County, OR': '061', - 'Wallowa County, OR': '063', - 'Wasco County, OR': '065', - 'Washington County, OR': '067', - 'Wheeler County, OR': '069', - 'Yamhill County, OR': '071'}, - '42': {'Adams County, PA': '001', - 'Allegheny County, PA': '003', - 'Armstrong County, PA': '005', - 'Beaver County, PA': '007', - 'Bedford County, PA': '009', - 'Berks County, PA': '011', - 'Blair County, PA': '013', - 'Bradford County, PA': '015', - 'Bucks County, PA': '017', - 'Butler County, PA': '019', - 'Cambria County, PA': '021', - 'Cameron County, PA': '023', - 'Carbon County, PA': '025', - 'Centre County, PA': '027', - 'Chester County, PA': '029', - 'Clarion County, PA': '031', - 'Clearfield County, PA': '033', - 'Clinton County, PA': '035', - 'Columbia County, PA': '037', - 'Crawford County, PA': '039', - 'Cumberland County, PA': '041', - 'Dauphin County, PA': '043', - 'Delaware County, PA': '045', - 'Elk County, PA': '047', - 'Erie County, PA': '049', - 'Fayette County, PA': '051', - 'Forest County, PA': '053', - 'Franklin County, PA': '055', - 'Fulton County, PA': '057', - 'Greene County, PA': '059', - 'Huntingdon County, PA': '061', - 'Indiana County, PA': '063', - 'Jefferson County, PA': '065', - 'Juniata County, PA': '067', - 'Lackawanna County, PA': '069', - 'Lancaster County, PA': '071', - 'Lawrence County, PA': '073', - 'Lebanon County, PA': '075', - 'Lehigh County, PA': '077', - 'Luzerne County, PA': '079', - 'Lycoming County, PA': '081', - 'McKean County, PA': '083', - 'Mercer County, PA': '085', - 'Mifflin County, PA': '087', - 'Monroe County, PA': '089', - 'Montgomery County, PA': '091', - 'Montour County, PA': '093', - 'Northampton County, PA': '095', - 'Northumberland County, PA': '097', - 'Perry County, PA': '099', - 'Philadelphia County/city, PA': '101', - 'Pike County, PA': '103', - 'Potter County, PA': '105', - 'Schuylkill County, PA': '107', - 'Snyder County, PA': '109', - 'Somerset County, PA': '111', - 'Sullivan County, PA': '113', - 'Susquehanna County, PA': '115', - 'Tioga County, PA': '117', - 'Union County, PA': '119', - 'Venango County, PA': '121', - 'Warren County, PA': '123', - 'Washington County, PA': '125', - 'Wayne County, PA': '127', - 'Westmoreland County, PA': '129', - 'Wyoming County, PA': '131', - 'York County, PA': '133'}, - '44': {'Bristol County, RI': '001', - 'Kent County, RI': '003', - 'Newport County, RI': '005', - 'Providence County, RI': '007', - 'Washington County, RI': '009'}, - '45': {'Abbeville County, SC': '001', - 'Aiken County, SC': '003', - 'Allendale County, SC': '005', - 'Anderson County, SC': '007', - 'Bamberg County, SC': '009', - 'Barnwell County, SC': '011', - 'Beaufort County, SC': '013', - 'Berkeley County, SC': '015', - 'Calhoun County, SC': '017', - 'Charleston County, SC': '019', - 'Cherokee County, SC': '021', - 'Chester County, SC': '023', - 'Chesterfield County, SC': '025', - 'Clarendon County, SC': '027', - 'Colleton County, SC': '029', - 'Darlington County, SC': '031', - 'Dillon County, SC': '033', - 'Dorchester County, SC': '035', - 'Edgefield County, SC': '037', - 'Fairfield County, SC': '039', - 'Florence County, SC': '041', - 'Georgetown County, SC': '043', - 'Greenville County, SC': '045', - 'Greenwood County, SC': '047', - 'Hampton County, SC': '049', - 'Horry County, SC': '051', - 'Jasper County, SC': '053', - 'Kershaw County, SC': '055', - 'Lancaster County, SC': '057', - 'Laurens County, SC': '059', - 'Lee County, SC': '061', - 'Lexington County, SC': '063', - 'Marion County, SC': '067', - 'Marlboro County, SC': '069', - 'McCormick County, SC': '065', - 'Newberry County, SC': '071', - 'Oconee County, SC': '073', - 'Orangeburg County, SC': '075', - 'Pickens County, SC': '077', - 'Richland County, SC': '079', - 'Saluda County, SC': '081', - 'Spartanburg County, SC': '083', - 'Sumter County, SC': '085', - 'Union County, SC': '087', - 'Williamsburg County, SC': '089', - 'York County, SC': '091'}, - '46': {'Aurora County, SD': '003', - 'Beadle County, SD': '005', - 'Bennett County, SD': '007', - 'Bon Homme County, SD': '009', - 'Brookings County, SD': '011', - 'Brown County, SD': '013', - 'Brule County, SD': '015', - 'Buffalo County, SD': '017', - 'Butte County, SD': '019', - 'Campbell County, SD': '021', - 'Charles Mix County, SD': '023', - 'Clark County, SD': '025', - 'Clay County, SD': '027', - 'Codington County, SD': '029', - 'Corson County, SD': '031', - 'Custer County, SD': '033', - 'Davison County, SD': '035', - 'Day County, SD': '037', - 'Deuel County, SD': '039', - 'Dewey County, SD': '041', - 'Douglas County, SD': '043', - 'Edmunds County, SD': '045', - 'Fall River County, SD': '047', - 'Faulk County, SD': '049', - 'Grant County, SD': '051', - 'Gregory County, SD': '053', - 'Haakon County, SD': '055', - 'Hamlin County, SD': '057', - 'Hand County, SD': '059', - 'Hanson County, SD': '061', - 'Harding County, SD': '063', - 'Hughes County, SD': '065', - 'Hutchinson County, SD': '067', - 'Hyde County, SD': '069', - 'Jackson County, SD': '071', - 'Jerauld County, SD': '073', - 'Jones County, SD': '075', - 'Kingsbury County, SD': '077', - 'Lake County, SD': '079', - 'Lawrence County, SD': '081', - 'Lincoln County, SD': '083', - 'Lyman County, SD': '085', - 'Marshall County, SD': '091', - 'McCook County, SD': '087', - 'McPherson County, SD': '089', - 'Meade County, SD': '093', - 'Mellette County, SD': '095', - 'Miner County, SD': '097', - 'Minnehaha County, SD': '099', - 'Moody County, SD': '101', - 'Pennington County, SD': '103', - 'Perkins County, SD': '105', - 'Potter County, SD': '107', - 'Roberts County, SD': '109', - 'Sanborn County, SD': '111', - 'Shannon County, SD': '113', - 'Spink County, SD': '115', - 'Stanley County, SD': '117', - 'Sully County, SD': '119', - 'Todd County, SD': '121', - 'Tripp County, SD': '123', - 'Turner County, SD': '125', - 'Union County, SD': '127', - 'Walworth County, SD': '129', - 'Yankton County, SD': '135', - 'Ziebach County, SD': '137'}, - '47': {'Anderson County, TN': '001', - 'Bedford County, TN': '003', - 'Benton County, TN': '005', - 'Bledsoe County, TN': '007', - 'Blount County, TN': '009', - 'Bradley County, TN': '011', - 'Campbell County, TN': '013', - 'Cannon County, TN': '015', - 'Carroll County, TN': '017', - 'Carter County, TN': '019', - 'Cheatham County, TN': '021', - 'Chester County, TN': '023', - 'Claiborne County, TN': '025', - 'Clay County, TN': '027', - 'Cocke County, TN': '029', - 'Coffee County, TN': '031', - 'Crockett County, TN': '033', - 'Cumberland County, TN': '035', - 'Davidson County, TN': '037', - 'DeKalb County, TN': '041', - 'Decatur County, TN': '039', - 'Dickson County, TN': '043', - 'Dyer County, TN': '045', - 'Fayette County, TN': '047', - 'Fentress County, TN': '049', - 'Franklin County, TN': '051', - 'Gibson County, TN': '053', - 'Giles County, TN': '055', - 'Grainger County, TN': '057', - 'Greene County, TN': '059', - 'Grundy County, TN': '061', - 'Hamblen County, TN': '063', - 'Hamilton County, TN': '065', - 'Hancock County, TN': '067', - 'Hardeman County, TN': '069', - 'Hardin County, TN': '071', - 'Hawkins County, TN': '073', - 'Haywood County, TN': '075', - 'Henderson County, TN': '077', - 'Henry County, TN': '079', - 'Hickman County, TN': '081', - 'Houston County, TN': '083', - 'Humphreys County, TN': '085', - 'Jackson County, TN': '087', - 'Jefferson County, TN': '089', - 'Johnson County, TN': '091', - 'Knox County, TN': '093', - 'Lake County, TN': '095', - 'Lauderdale County, TN': '097', - 'Lawrence County, TN': '099', - 'Lewis County, TN': '101', - 'Lincoln County, TN': '103', - 'Loudon County, TN': '105', - 'Macon County, TN': '111', - 'Madison County, TN': '113', - 'Marion County, TN': '115', - 'Marshall County, TN': '117', - 'Maury County, TN': '119', - 'McMinn County, TN': '107', - 'McNairy County, TN': '109', - 'Meigs County, TN': '121', - 'Monroe County, TN': '123', - 'Montgomery County, TN': '125', - 'Moore County, TN': '127', - 'Morgan County, TN': '129', - 'Obion County, TN': '131', - 'Overton County, TN': '133', - 'Perry County, TN': '135', - 'Pickett County, TN': '137', - 'Polk County, TN': '139', - 'Putnam County, TN': '141', - 'Rhea County, TN': '143', - 'Roane County, TN': '145', - 'Robertson County, TN': '147', - 'Rutherford County, TN': '149', - 'Scott County, TN': '151', - 'Sequatchie County, TN': '153', - 'Sevier County, TN': '155', - 'Shelby County, TN': '157', - 'Smith County, TN': '159', - 'Stewart County, TN': '161', - 'Sullivan County, TN': '163', - 'Sumner County, TN': '165', - 'Tipton County, TN': '167', - 'Trousdale County, TN': '169', - 'Unicoi County, TN': '171', - 'Union County, TN': '173', - 'Van Buren County, TN': '175', - 'Warren County, TN': '177', - 'Washington County, TN': '179', - 'Wayne County, TN': '181', - 'Weakley County, TN': '183', - 'White County, TN': '185', - 'Williamson County, TN': '187', - 'Wilson County, TN': '189'}, - '48': {'Anderson County, TX': '001', - 'Andrews County, TX': '003', - 'Angelina County, TX': '005', - 'Aransas County, TX': '007', - 'Archer County, TX': '009', - 'Armstrong County, TX': '011', - 'Atascosa County, TX': '013', - 'Austin County, TX': '015', - 'Bailey County, TX': '017', - 'Bandera County, TX': '019', - 'Bastrop County, TX': '021', - 'Baylor County, TX': '023', - 'Bee County, TX': '025', - 'Bell County, TX': '027', - 'Bexar County, TX': '029', - 'Blanco County, TX': '031', - 'Borden County, TX': '033', - 'Bosque County, TX': '035', - 'Bowie County, TX': '037', - 'Brazoria County, TX': '039', - 'Brazos County, TX': '041', - 'Brewster County, TX': '043', - 'Briscoe County, TX': '045', - 'Brooks County, TX': '047', - 'Brown County, TX': '049', - 'Burleson County, TX': '051', - 'Burnet County, TX': '053', - 'Caldwell County, TX': '055', - 'Calhoun County, TX': '057', - 'Callahan County, TX': '059', - 'Cameron County, TX': '061', - 'Camp County, TX': '063', - 'Carson County, TX': '065', - 'Cass County, TX': '067', - 'Castro County, TX': '069', - 'Chambers County, TX': '071', - 'Cherokee County, TX': '073', - 'Childress County, TX': '075', - 'Clay County, TX': '077', - 'Cochran County, TX': '079', - 'Coke County, TX': '081', - 'Coleman County, TX': '083', - 'Collin County, TX': '085', - 'Collingsworth County, TX': '087', - 'Colorado County, TX': '089', - 'Comal County, TX': '091', - 'Comanche County, TX': '093', - 'Concho County, TX': '095', - 'Cooke County, TX': '097', - 'Coryell County, TX': '099', - 'Cottle County, TX': '101', - 'Crane County, TX': '103', - 'Crockett County, TX': '105', - 'Crosby County, TX': '107', - 'Culberson County, TX': '109', - 'Dallam County, TX': '111', - 'Dallas County, TX': '113', - 'Dawson County, TX': '115', - 'DeWitt County, TX': '123', - 'Deaf Smith County, TX': '117', - 'Delta County, TX': '119', - 'Denton County, TX': '121', - 'Dickens County, TX': '125', - 'Dimmit County, TX': '127', - 'Donley County, TX': '129', - 'Duval County, TX': '131', - 'Eastland County, TX': '133', - 'Ector County, TX': '135', - 'Edwards County, TX': '137', - 'El Paso County, TX': '141', - 'Ellis County, TX': '139', - 'Erath County, TX': '143', - 'Falls County, TX': '145', - 'Fannin County, TX': '147', - 'Fayette County, TX': '149', - 'Fisher County, TX': '151', - 'Floyd County, TX': '153', - 'Foard County, TX': '155', - 'Fort Bend County, TX': '157', - 'Franklin County, TX': '159', - 'Freestone County, TX': '161', - 'Frio County, TX': '163', - 'Gaines County, TX': '165', - 'Galveston County, TX': '167', - 'Garza County, TX': '169', - 'Gillespie County, TX': '171', - 'Glasscock County, TX': '173', - 'Goliad County, TX': '175', - 'Gonzales County, TX': '177', - 'Gray County, TX': '179', - 'Grayson County, TX': '181', - 'Gregg County, TX': '183', - 'Grimes County, TX': '185', - 'Guadalupe County, TX': '187', - 'Hale County, TX': '189', - 'Hall County, TX': '191', - 'Hamilton County, TX': '193', - 'Hansford County, TX': '195', - 'Hardeman County, TX': '197', - 'Hardin County, TX': '199', - 'Harris County, TX': '201', - 'Harrison County, TX': '203', - 'Hartley County, TX': '205', - 'Haskell County, TX': '207', - 'Hays County, TX': '209', - 'Hemphill County, TX': '211', - 'Henderson County, TX': '213', - 'Hidalgo County, TX': '215', - 'Hill County, TX': '217', - 'Hockley County, TX': '219', - 'Hood County, TX': '221', - 'Hopkins County, TX': '223', - 'Houston County, TX': '225', - 'Howard County, TX': '227', - 'Hudspeth County, TX': '229', - 'Hunt County, TX': '231', - 'Hutchinson County, TX': '233', - 'Irion County, TX': '235', - 'Jack County, TX': '237', - 'Jackson County, TX': '239', - 'Jasper County, TX': '241', - 'Jeff Davis County, TX': '243', - 'Jefferson County, TX': '245', - 'Jim Hogg County, TX': '247', - 'Jim Wells County, TX': '249', - 'Johnson County, TX': '251', - 'Jones County, TX': '253', - 'Karnes County, TX': '255', - 'Kaufman County, TX': '257', - 'Kendall County, TX': '259', - 'Kenedy County, TX': '261', - 'Kent County, TX': '263', - 'Kerr County, TX': '265', - 'Kimble County, TX': '267', - 'King County, TX': '269', - 'Kinney County, TX': '271', - 'Kleberg County, TX': '273', - 'Knox County, TX': '275', - 'La Salle County, TX': '283', - 'Lamar County, TX': '277', - 'Lamb County, TX': '279', - 'Lampasas County, TX': '281', - 'Lavaca County, TX': '285', - 'Lee County, TX': '287', - 'Leon County, TX': '289', - 'Liberty County, TX': '291', - 'Limestone County, TX': '293', - 'Lipscomb County, TX': '295', - 'Live Oak County, TX': '297', - 'Llano County, TX': '299', - 'Loving County, TX': '301', - 'Lubbock County, TX': '303', - 'Lynn County, TX': '305', - 'Madison County, TX': '313', - 'Marion County, TX': '315', - 'Martin County, TX': '317', - 'Mason County, TX': '319', - 'Matagorda County, TX': '321', - 'Maverick County, TX': '323', - 'McCulloch County, TX': '307', - 'McLennan County, TX': '309', - 'McMullen County, TX': '311', - 'Medina County, TX': '325', - 'Menard County, TX': '327', - 'Midland County, TX': '329', - 'Milam County, TX': '331', - 'Mills County, TX': '333', - 'Mitchell County, TX': '335', - 'Montague County, TX': '337', - 'Montgomery County, TX': '339', - 'Moore County, TX': '341', - 'Morris County, TX': '343', - 'Motley County, TX': '345', - 'Nacogdoches County, TX': '347', - 'Navarro County, TX': '349', - 'Newton County, TX': '351', - 'Nolan County, TX': '353', - 'Nueces County, TX': '355', - 'Ochiltree County, TX': '357', - 'Oldham County, TX': '359', - 'Orange County, TX': '361', - 'Palo Pinto County, TX': '363', - 'Panola County, TX': '365', - 'Parker County, TX': '367', - 'Parmer County, TX': '369', - 'Pecos County, TX': '371', - 'Polk County, TX': '373', - 'Potter County, TX': '375', - 'Presidio County, TX': '377', - 'Rains County, TX': '379', - 'Randall County, TX': '381', - 'Reagan County, TX': '383', - 'Real County, TX': '385', - 'Red River County, TX': '387', - 'Reeves County, TX': '389', - 'Refugio County, TX': '391', - 'Roberts County, TX': '393', - 'Robertson County, TX': '395', - 'Rockwall County, TX': '397', - 'Runnels County, TX': '399', - 'Rusk County, TX': '401', - 'Sabine County, TX': '403', - 'San Augustine County, TX': '405', - 'San Jacinto County, TX': '407', - 'San Patricio County, TX': '409', - 'San Saba County, TX': '411', - 'Schleicher County, TX': '413', - 'Scurry County, TX': '415', - 'Shackelford County, TX': '417', - 'Shelby County, TX': '419', - 'Sherman County, TX': '421', - 'Smith County, TX': '423', - 'Somervell County, TX': '425', - 'Starr County, TX': '427', - 'Stephens County, TX': '429', - 'Sterling County, TX': '431', - 'Stonewall County, TX': '433', - 'Sutton County, TX': '435', - 'Swisher County, TX': '437', - 'Tarrant County, TX': '439', - 'Taylor County, TX': '441', - 'Terrell County, TX': '443', - 'Terry County, TX': '445', - 'Throckmorton County, TX': '447', - 'Titus County, TX': '449', - 'Tom Green County, TX': '451', - 'Travis County, TX': '453', - 'Trinity County, TX': '455', - 'Tyler County, TX': '457', - 'Upshur County, TX': '459', - 'Upton County, TX': '461', - 'Uvalde County, TX': '463', - 'Val Verde County, TX': '465', - 'Van Zandt County, TX': '467', - 'Victoria County, TX': '469', - 'Walker County, TX': '471', - 'Waller County, TX': '473', - 'Ward County, TX': '475', - 'Washington County, TX': '477', - 'Webb County, TX': '479', - 'Wharton County, TX': '481', - 'Wheeler County, TX': '483', - 'Wichita County, TX': '485', - 'Wilbarger County, TX': '487', - 'Willacy County, TX': '489', - 'Williamson County, TX': '491', - 'Wilson County, TX': '493', - 'Winkler County, TX': '495', - 'Wise County, TX': '497', - 'Wood County, TX': '499', - 'Yoakum County, TX': '501', - 'Young County, TX': '503', - 'Zapata County, TX': '505', - 'Zavala County, TX': '507'}, - '49': {'Beaver County, UT': '001', - 'Box Elder County, UT': '003', - 'Cache County, UT': '005', - 'Carbon County, UT': '007', - 'Daggett County, UT': '009', - 'Davis County, UT': '011', - 'Duchesne County, UT': '013', - 'Emery County, UT': '015', - 'Garfield County, UT': '017', - 'Grand County, UT': '019', - 'Iron County, UT': '021', - 'Juab County, UT': '023', - 'Kane County, UT': '025', - 'Millard County, UT': '027', - 'Morgan County, UT': '029', - 'Piute County, UT': '031', - 'Rich County, UT': '033', - 'Salt Lake County, UT': '035', - 'San Juan County, UT': '037', - 'Sanpete County, UT': '039', - 'Sevier County, UT': '041', - 'Summit County, UT': '043', - 'Tooele County, UT': '045', - 'Uintah County, UT': '047', - 'Utah County, UT': '049', - 'Wasatch County, UT': '051', - 'Washington County, UT': '053', - 'Wayne County, UT': '055', - 'Weber County, UT': '057'}, - '50': {'Addison County, VT': '001', - 'Bennington County, VT': '003', - 'Caledonia County, VT': '005', - 'Chittenden County, VT': '007', - 'Essex County, VT': '009', - 'Franklin County, VT': '011', - 'Grand Isle County, VT': '013', - 'Lamoille County, VT': '015', - 'Orange County, VT': '017', - 'Orleans County, VT': '019', - 'Rutland County, VT': '021', - 'Washington County, VT': '023', - 'Windham County, VT': '025', - 'Windsor County, VT': '027'}, - '51': {'Accomack County, VA': '001', - 'Albemarle County, VA': '003', - 'Alexandria city, VA': '510', - 'Alleghany County, VA': '005', - 'Amelia County, VA': '007', - 'Amherst County, VA': '009', - 'Appomattox County, VA': '011', - 'Arlington County, VA': '013', - 'Augusta County, VA': '015', - 'Bath County, VA': '017', - 'Bedford County, VA': '019', - 'Bedford city, VA': '515', - 'Bland County, VA': '021', - 'Botetourt County, VA': '023', - 'Bristol city, VA': '520', - 'Brunswick County, VA': '025', - 'Buchanan County, VA': '027', - 'Buckingham County, VA': '029', - 'Buena Vista city, VA': '530', - 'Campbell County, VA': '031', - 'Caroline County, VA': '033', - 'Carroll County, VA': '035', - 'Charles City County, VA': '036', - 'Charlotte County, VA': '037', - 'Charlottesville city, VA': '540', - 'Chesapeake city, VA': '550', - 'Chesterfield County, VA': '041', - 'Clarke County, VA': '043', - 'Colonial Heights city, VA': '570', - 'Covington city, VA': '580', - 'Craig County, VA': '045', - 'Culpeper County, VA': '047', - 'Cumberland County, VA': '049', - 'Danville city, VA': '590', - 'Dickenson County, VA': '051', - 'Dinwiddie County, VA': '053', - 'Emporia city, VA': '595', - 'Essex County, VA': '057', - 'Fairfax County, VA': '059', - 'Fairfax city, VA': '600', - 'Falls Church city, VA': '610', - 'Fauquier County, VA': '061', - 'Floyd County, VA': '063', - 'Fluvanna County, VA': '065', - 'Franklin County, VA': '067', - 'Franklin city, VA': '620', - 'Frederick County, VA': '069', - 'Fredericksburg city, VA': '630', - 'Galax city, VA': '640', - 'Giles County, VA': '071', - 'Gloucester County, VA': '073', - 'Goochland County, VA': '075', - 'Grayson County, VA': '077', - 'Greene County, VA': '079', - 'Greensville County, VA': '081', - 'Halifax County, VA': '083', - 'Hampton city, VA': '650', - 'Hanover County, VA': '085', - 'Harrisonburg city, VA': '660', - 'Henrico County, VA': '087', - 'Henry County, VA': '089', - 'Highland County, VA': '091', - 'Hopewell city, VA': '670', - 'Isle of Wight County, VA': '093', - 'James City County, VA': '095', - 'King George County, VA': '099', - 'King William County, VA': '101', - 'King and Queen County, VA': '097', - 'Lancaster County, VA': '103', - 'Lee County, VA': '105', - 'Lexington city, VA': '678', - 'Loudoun County, VA': '107', - 'Louisa County, VA': '109', - 'Lunenburg County, VA': '111', - 'Lynchburg city, VA': '680', - 'Madison County, VA': '113', - 'Manassas Park city, VA': '685', - 'Manassas city, VA': '683', - 'Martinsville city, VA': '690', - 'Mathews County, VA': '115', - 'Mecklenburg County, VA': '117', - 'Middlesex County, VA': '119', - 'Montgomery County, VA': '121', - 'Nelson County, VA': '125', - 'New Kent County, VA': '127', - 'Newport News city, VA': '700', - 'Norfolk city, VA': '710', - 'Northampton County, VA': '131', - 'Northumberland County, VA': '133', - 'Norton city, VA': '720', - 'Nottoway County, VA': '135', - 'Orange County, VA': '137', - 'Page County, VA': '139', - 'Patrick County, VA': '141', - 'Petersburg city, VA': '730', - 'Pittsylvania County, VA': '143', - 'Poquoson city, VA': '735', - 'Portsmouth city, VA': '740', - 'Powhatan County, VA': '145', - 'Prince Edward County, VA': '147', - 'Prince George County, VA': '149', - 'Prince William County, VA': '153', - 'Pulaski County, VA': '155', - 'Radford city, VA': '750', - 'Rappahannock County, VA': '157', - 'Richmond County, VA': '159', - 'Richmond city, VA': '760', - 'Roanoke County, VA': '161', - 'Roanoke city, VA': '770', - 'Rockbridge County, VA': '163', - 'Rockingham County, VA': '165', - 'Russell County, VA': '167', - 'Salem city, VA': '775', - 'Scott County, VA': '169', - 'Shenandoah County, VA': '171', - 'Smyth County, VA': '173', - 'Southampton County, VA': '175', - 'Spotsylvania County, VA': '177', - 'Stafford County, VA': '179', - 'Staunton city, VA': '790', - 'Suffolk city, VA': '800', - 'Surry County, VA': '181', - 'Sussex County, VA': '183', - 'Tazewell County, VA': '185', - 'Virginia Beach city, VA': '810', - 'Warren County, VA': '187', - 'Washington County, VA': '191', - 'Waynesboro city, VA': '820', - 'Westmoreland County, VA': '193', - 'Williamsburg city, VA': '830', - 'Winchester city, VA': '840', - 'Wise County, VA': '195', - 'Wythe County, VA': '197', - 'York County, VA': '199'}, - '53': {'Adams County, WA': '001', - 'Asotin County, WA': '003', - 'Benton County, WA': '005', - 'Chelan County, WA': '007', - 'Clallam County, WA': '009', - 'Clark County, WA': '011', - 'Columbia County, WA': '013', - 'Cowlitz County, WA': '015', - 'Douglas County, WA': '017', - 'Ferry County, WA': '019', - 'Franklin County, WA': '021', - 'Garfield County, WA': '023', - 'Grant County, WA': '025', - 'Grays Harbor County, WA': '027', - 'Island County, WA': '029', - 'Jefferson County, WA': '031', - 'King County, WA': '033', - 'Kitsap County, WA': '035', - 'Kittitas County, WA': '037', - 'Klickitat County, WA': '039', - 'Lewis County, WA': '041', - 'Lincoln County, WA': '043', - 'Mason County, WA': '045', - 'Okanogan County, WA': '047', - 'Pacific County, WA': '049', - 'Pend Oreille County, WA': '051', - 'Pierce County, WA': '053', - 'San Juan County, WA': '055', - 'Skagit County, WA': '057', - 'Skamania County, WA': '059', - 'Snohomish County, WA': '061', - 'Spokane County, WA': '063', - 'Stevens County, WA': '065', - 'Thurston County, WA': '067', - 'Wahkiakum County, WA': '069', - 'Walla Walla County, WA': '071', - 'Whatcom County, WA': '073', - 'Whitman County, WA': '075', - 'Yakima County, WA': '077'}, - '54': {'Barbour County, WV': '001', - 'Berkeley County, WV': '003', - 'Boone County, WV': '005', - 'Braxton County, WV': '007', - 'Brooke County, WV': '009', - 'Cabell County, WV': '011', - 'Calhoun County, WV': '013', - 'Clay County, WV': '015', - 'Doddridge County, WV': '017', - 'Fayette County, WV': '019', - 'Gilmer County, WV': '021', - 'Grant County, WV': '023', - 'Greenbrier County, WV': '025', - 'Hampshire County, WV': '027', - 'Hancock County, WV': '029', - 'Hardy County, WV': '031', - 'Harrison County, WV': '033', - 'Jackson County, WV': '035', - 'Jefferson County, WV': '037', - 'Kanawha County, WV': '039', - 'Lewis County, WV': '041', - 'Lincoln County, WV': '043', - 'Logan County, WV': '045', - 'Marion County, WV': '049', - 'Marshall County, WV': '051', - 'Mason County, WV': '053', - 'McDowell County, WV': '047', - 'Mercer County, WV': '055', - 'Mineral County, WV': '057', - 'Mingo County, WV': '059', - 'Monongalia County, WV': '061', - 'Monroe County, WV': '063', - 'Morgan County, WV': '065', - 'Nicholas County, WV': '067', - 'Ohio County, WV': '069', - 'Pendleton County, WV': '071', - 'Pleasants County, WV': '073', - 'Pocahontas County, WV': '075', - 'Preston County, WV': '077', - 'Putnam County, WV': '079', - 'Raleigh County, WV': '081', - 'Randolph County, WV': '083', - 'Ritchie County, WV': '085', - 'Roane County, WV': '087', - 'Summers County, WV': '089', - 'Taylor County, WV': '091', - 'Tucker County, WV': '093', - 'Tyler County, WV': '095', - 'Upshur County, WV': '097', - 'Wayne County, WV': '099', - 'Webster County, WV': '101', - 'Wetzel County, WV': '103', - 'Wirt County, WV': '105', - 'Wood County, WV': '107', - 'Wyoming County, WV': '109'}, - '55': {'Adams County, WI': '001', - 'Ashland County, WI': '003', - 'Barron County, WI': '005', - 'Bayfield County, WI': '007', - 'Brown County, WI': '009', - 'Buffalo County, WI': '011', - 'Burnett County, WI': '013', - 'Calumet County, WI': '015', - 'Chippewa County, WI': '017', - 'Clark County, WI': '019', - 'Columbia County, WI': '021', - 'Crawford County, WI': '023', - 'Dane County, WI': '025', - 'Dodge County, WI': '027', - 'Door County, WI': '029', - 'Douglas County, WI': '031', - 'Dunn County, WI': '033', - 'Eau Claire County, WI': '035', - 'Florence County, WI': '037', - 'Fond du Lac County, WI': '039', - 'Forest County, WI': '041', - 'Grant County, WI': '043', - 'Green County, WI': '045', - 'Green Lake County, WI': '047', - 'Iowa County, WI': '049', - 'Iron County, WI': '051', - 'Jackson County, WI': '053', - 'Jefferson County, WI': '055', - 'Juneau County, WI': '057', - 'Kenosha County, WI': '059', - 'Kewaunee County, WI': '061', - 'La Crosse County, WI': '063', - 'Lafayette County, WI': '065', - 'Langlade County, WI': '067', - 'Lincoln County, WI': '069', - 'Manitowoc County, WI': '071', - 'Marathon County, WI': '073', - 'Marinette County, WI': '075', - 'Marquette County, WI': '077', - 'Menominee County, WI': '078', - 'Milwaukee County, WI': '079', - 'Monroe County, WI': '081', - 'Oconto County, WI': '083', - 'Oneida County, WI': '085', - 'Outagamie County, WI': '087', - 'Ozaukee County, WI': '089', - 'Pepin County, WI': '091', - 'Pierce County, WI': '093', - 'Polk County, WI': '095', - 'Portage County, WI': '097', - 'Price County, WI': '099', - 'Racine County, WI': '101', - 'Richland County, WI': '103', - 'Rock County, WI': '105', - 'Rusk County, WI': '107', - 'Sauk County, WI': '111', - 'Sawyer County, WI': '113', - 'Shawano County, WI': '115', - 'Sheboygan County, WI': '117', - 'St. Croix County, WI': '109', - 'Taylor County, WI': '119', - 'Trempealeau County, WI': '121', - 'Vernon County, WI': '123', - 'Vilas County, WI': '125', - 'Walworth County, WI': '127', - 'Washburn County, WI': '129', - 'Washington County, WI': '131', - 'Waukesha County, WI': '133', - 'Waupaca County, WI': '135', - 'Waushara County, WI': '137', - 'Winnebago County, WI': '139', - 'Wood County, WI': '141'}, - '56': {'Albany County, WY': '001', - 'Big Horn County, WY': '003', - 'Campbell County, WY': '005', - 'Carbon County, WY': '007', - 'Converse County, WY': '009', - 'Crook County, WY': '011', - 'Fremont County, WY': '013', - 'Goshen County, WY': '015', - 'Hot Springs County, WY': '017', - 'Johnson County, WY': '019', - 'Laramie County, WY': '021', - 'Lincoln County, WY': '023', - 'Natrona County, WY': '025', - 'Niobrara County, WY': '027', - 'Park County, WY': '029', - 'Platte County, WY': '031', - 'Sheridan County, WY': '033', - 'Sublette County, WY': '035', - 'Sweetwater County, WY': '037', - 'Teton County, WY': '039', - 'Uinta County, WY': '041', - 'Washakie County, WY': '043', - 'Weston County, WY': '045'}, - '72': {'Adjuntas Municipio, PR': '001', - 'Aguada Municipio, PR': '003', - 'Aguadilla Municipio, PR': '005', - 'Aguas Buenas Municipio, PR': '007', - 'Aibonito Municipio, PR': '009', - 'Anasco Municipio, PR': '011', - 'Arecibo Municipio, PR': '013', - 'Arroyo Municipio, PR': '015', - 'Barceloneta Municipio, PR': '017', - 'Barranquitas Municipio, PR': '019', - 'Bayamon Municipio, PR': '021', - 'Cabo Rojo Municipio, PR': '023', - 'Caguas Municipio, PR': '025', - 'Camuy Municipio, PR': '027', - 'Canovanas Municipio, PR': '029', - 'Carolina Municipio, PR': '031', - 'Catano Municipio, PR': '033', - 'Cayey Municipio, PR': '035', - 'Ceiba Municipio, PR': '037', - 'Ciales Municipio, PR': '039', - 'Cidra Municipio, PR': '041', - 'Coamo Municipio, PR': '043', - 'Comerio Municipio, PR': '045', - 'Corozal Municipio, PR': '047', - 'Culebra Municipio, PR': '049', - 'Dorado Municipio, PR': '051', - 'Fajardo Municipio, PR': '053', - 'Florida Municipio, PR': '054', - 'Guanica Municipio, PR': '055', - 'Guayama Municipio, PR': '057', - 'Guayanilla Municipio, PR': '059', - 'Guaynabo Municipio, PR': '061', - 'Gurabo Municipio, PR': '063', - 'Hatillo Municipio, PR': '065', - 'Hormigueros Municipio, PR': '067', - 'Humacao Municipio, PR': '069', - 'Isabela Municipio, PR': '071', - 'Jayuya Municipio, PR': '073', - 'Juana Diaz Municipio, PR': '075', - 'Juncos Municipio, PR': '077', - 'Lajas Municipio, PR': '079', - 'Lares Municipio, PR': '081', - 'Las Marias Municipio, PR': '083', - 'Las Piedras Municipio, PR': '085', - 'Loiza Municipio, PR': '087', - 'Luquillo Municipio, PR': '089', - 'Manati Municipio, PR': '091', - 'Maricao Municipio, PR': '093', - 'Maunabo Municipio, PR': '095', - 'Mayaguez Municipio, PR': '097', - 'Moca Municipio, PR': '099', - 'Morovis Municipio, PR': '101', - 'Naguabo Municipio, PR': '103', - 'Naranjito Municipio, PR': '105', - 'Orocovis Municipio, PR': '107', - 'Patillas Municipio, PR': '109', - 'Penuelas Municipio, PR': '111', - 'Ponce Municipio, PR': '113', - 'Quebradillas Municipio, PR': '115', - 'Rincon Municipio, PR': '117', - 'Rio Grande Municipio, PR': '119', - 'Sabana Grande Municipio, PR': '121', - 'Salinas Municipio, PR': '123', - 'San German Municipio, PR': '125', - 'San Juan Municipio, PR': '127', - 'San Lorenzo Municipio, PR': '129', - 'San Sebastian Municipio, PR': '131', - 'Santa Isabel Municipio, PR': '133', - 'Toa Alta Municipio, PR': '135', - 'Toa Baja Municipio, PR': '137', - 'Trujillo Alto Municipio, PR': '139', - 'Utuado Municipio, PR': '141', - 'Vega Alta Municipio, PR': '143', - 'Vega Baja Municipio, PR': '145', - 'Vieques Municipio, PR': '147', - 'Villalba Municipio, PR': '149', - 'Yabucoa Municipio, PR': '151', - 'Yauco Municipio, PR': '153'}, - "CA01": {'--All--': '%', }, - "CA02": {'--All--': '%', }, - "CA03": {'--All--': '%', }, - "CA04": {'--All--': '%', }, - "CA05": {'--All--': '%', }, - "CA13": {'--All--': '%', }, - "CA07": {'--All--': '%', }, - "CA14": {'--All--': '%', }, - "CA08": {'--All--': '%', }, - "CA09": {'--All--': '%', }, - "CA10": {'--All--': '%', }, - "CA11": {'--All--': '%', }, - "CA12": {'--All--': '%', }, -} - - -if __name__ == "__main__": - from sys import argv - from pprint import PrettyPrinter - pp = PrettyPrinter(indent=2) - - import csv - fipsreader = csv.reader(open(argv[1], 'rb'), delimiter=',', quotechar='"') - for row in fipsreader: - try: - FIPS_COUNTIES[int(row[1])][row[3]] = row[2] - except KeyError: - FIPS_COUNTIES[int(row[1])] = {'--All--': '%'} - FIPS_COUNTIES[int(row[1])][row[3]] = row[2] - - pp.pprint(FIPS_COUNTIES) diff --git a/chirp/ui/importdialog.py b/chirp/ui/importdialog.py deleted file mode 100644 index 548b4e2..0000000 --- a/chirp/ui/importdialog.py +++ /dev/null @@ -1,655 +0,0 @@ -# Copyright 2008 Dan Smith -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -import gtk -import gobject -import pango -import logging - -from chirp import errors, chirp_common, import_logic -from chirp.ui import common - -LOG = logging.getLogger(__name__) - - -class WaitWindow(gtk.Window): - def __init__(self, msg, parent=None): - gtk.Window.__init__(self) - self.set_title("Please Wait") - self.set_type_hint(gtk.gdk.WINDOW_TYPE_HINT_DIALOG) - if parent: - self.set_transient_for(parent) - self.set_position(gtk.WIN_POS_CENTER_ON_PARENT) - else: - self.set_position(gtk.WIN_POS_CENTER) - - vbox = gtk.VBox(False, 2) - - l = gtk.Label(msg) - l.show() - vbox.pack_start(l) - - self.prog = gtk.ProgressBar() - self.prog.show() - vbox.pack_start(self.prog) - - vbox.show() - self.add(vbox) - - def grind(self): - while gtk.events_pending(): - gtk.main_iteration(False) - - self.prog.pulse() - - def set(self, fraction): - while gtk.events_pending(): - gtk.main_iteration(False) - - self.prog.set_fraction(fraction) - - -class ImportMemoryBankJob(common.RadioJob): - def __init__(self, cb, dst_mem, src_radio, src_mem): - common.RadioJob.__init__(self, cb, None) - self.__dst_mem = dst_mem - self.__src_radio = src_radio - self.__src_mem = src_mem - - def execute(self, radio): - import_logic.import_bank(radio, self.__src_radio, - self.__dst_mem, self.__src_mem) - if self.cb: - gobject.idle_add(self.cb, *self.cb_args) - - -class ImportDialog(gtk.Dialog): - - def _check_for_dupe(self, location): - iter = self.__store.get_iter_first() - while iter: - imp, loc = self.__store.get(iter, self.col_import, self.col_nloc) - if imp and loc == location: - return True - iter = self.__store.iter_next(iter) - - return False - - def _toggle(self, rend, path, col): - iter = self.__store.get_iter(path) - imp, nloc = self.__store.get(iter, self.col_import, self.col_nloc) - if not imp and self._check_for_dupe(nloc): - d = gtk.MessageDialog(parent=self, buttons=gtk.BUTTONS_OK) - d.set_property("text", - _("Location {number} is already being imported. " - "Choose another value for 'New Location' " - "before selection 'Import'").format(number=nloc)) - d.run() - d.destroy() - else: - self.__store[path][col] = not imp - - def _render(self, _, rend, model, iter, colnum): - newloc, imp = model.get(iter, self.col_nloc, self.col_import) - lo, hi = self.dst_radio.get_features().memory_bounds - - rend.set_property("text", "%i" % newloc) - if newloc in self.used_list and imp: - rend.set_property("foreground", "goldenrod") - rend.set_property("weight", pango.WEIGHT_BOLD) - elif newloc < lo or newloc > hi: - rend.set_property("foreground", "red") - rend.set_property("weight", pango.WEIGHT_BOLD) - else: - rend.set_property("foreground", "black") - rend.set_property("weight", pango.WEIGHT_NORMAL) - - def _edited(self, rend, path, new, col): - iter = self.__store.get_iter(path) - - if col == self.col_nloc: - nloc, = self.__store.get(iter, self.col_nloc) - - try: - val = int(new) - except ValueError: - common.show_error(_("Invalid value. Must be an integer.")) - return - - if val == nloc: - return - - if self._check_for_dupe(val): - d = gtk.MessageDialog(parent=self, buttons=gtk.BUTTONS_OK) - d.set_property("text", - _("Location {number} is already being " - "imported").format(number=val)) - d.run() - d.destroy() - return - - self.record_use_of(val) - - elif col == self.col_name or col == self.col_comm: - val = str(new) - - else: - return - - self.__store.set(iter, col, val) - - def get_import_list(self): - import_list = [] - iter = self.__store.get_iter_first() - while iter: - old, new, name, comm, enb = \ - self.__store.get(iter, self.col_oloc, self.col_nloc, - self.col_name, self.col_comm, self.col_import) - if enb: - import_list.append((old, new, name, comm)) - iter = self.__store.iter_next(iter) - - return import_list - - def ensure_calls(self, dst_rthread, import_list): - rlist_changed = False - ulist_changed = False - - if not isinstance(self.dst_radio, chirp_common.IcomDstarSupport): - return - - ulist = self.dst_radio.get_urcall_list() - rlist = self.dst_radio.get_repeater_call_list() - - for old, new in import_list: - mem = self.src_radio.get_memory(old) - if isinstance(mem, chirp_common.DVMemory): - if mem.dv_urcall not in ulist: - LOG.debug("Adding %s to ucall list" % mem.dv_urcall) - ulist.append(mem.dv_urcall) - ulist_changed = True - if mem.dv_rpt1call not in rlist: - LOG.debug("Adding %s to rcall list" % mem.dv_rpt1call) - rlist.append(mem.dv_rpt1call) - rlist_changed = True - if mem.dv_rpt2call not in rlist: - LOG.debug("Adding %s to rcall list" % mem.dv_rpt2call) - rlist.append(mem.dv_rpt2call) - rlist_changed = True - - if ulist_changed: - job = common.RadioJob(None, "set_urcall_list", ulist) - job.set_desc(_("Updating URCALL list")) - dst_rthread._qsubmit(job, 0) - - if rlist_changed: - job = common.RadioJob(None, "set_repeater_call_list", ulist) - job.set_desc(_("Updating RPTCALL list")) - dst_rthread._qsubmit(job, 0) - - return - - def _convert_power(self, dst_levels, src_levels, mem): - if not dst_levels: - mem.power = None - return - elif not mem.power: - # Source radio does not support power levels, so choose the - # first (highest) level from the destination radio. - mem.power = dst_levels[0] - return "" - - # If both radios support power levels, we need to decide how to - # convert the source power level to a valid one for the destination - # radio. To do that, find the absolute level of the source value - # and calculate the different between it and all the levels of the - # destination, choosing the one that matches most closely. - - deltas = [abs(mem.power - power) for power in dst_levels] - mem.power = dst_levels[deltas.index(min(deltas))] - - def do_soft_conversions(self, dst_features, src_features, mem): - self._convert_power(dst_features.valid_power_levels, - src_features.valid_power_levels, - mem) - - return mem - - def do_import_banks(self): - try: - dst_banks = self.dst_radio.get_banks() - src_banks = self.src_radio.get_banks() - if not dst_banks or not src_banks: - raise Exception() - except Exception: - LOG.error("One or more of the radios doesn't support banks") - return - - if len(dst_banks) != len(src_banks): - LOG.warn("Source and destination radios have " - "a different number of banks") - else: - self.dst_radio.set_banks(src_banks) - - def do_import(self, dst_rthread): - i = 0 - error_messages = {} - import_list = self.get_import_list() - - src_features = self.src_radio.get_features() - - for old, new, name, comm in import_list: - i += 1 - LOG.debug("%sing %i -> %i" % (self.ACTION, old, new)) - - src = self.src_radio.get_memory(old) - - try: - mem = import_logic.import_mem(self.dst_radio, - src_features, - src, - {"number": new, - "name": name, - "comment": comm}) - except import_logic.ImportError as e: - LOG.error("Import error: %s", e) - error_messages[new] = str(e) - continue - - job = common.RadioJob(None, "set_memory", mem) - desc = _("Setting memory {number}").format(number=mem.number) - job.set_desc(desc) - dst_rthread._qsubmit(job, 0) - - job = ImportMemoryBankJob(None, mem, self.src_radio, src) - job.set_desc(_("Importing bank information")) - dst_rthread._qsubmit(job, 0) - - if list(error_messages.keys()): - msg = _("Error importing memories:") + "\r\n" - for num, msgs in list(error_messages.items()): - msg += "%s: %s" % (num, ",".join(msgs)) - common.show_error(msg) - - return i - - def make_view(self): - editable = [self.col_nloc, self.col_name, self.col_comm] - - self.__store = gtk.ListStore(gobject.TYPE_BOOLEAN, # Import - gobject.TYPE_INT, # Source loc - gobject.TYPE_INT, # Destination loc - gobject.TYPE_STRING, # Name - gobject.TYPE_STRING, # Frequency - gobject.TYPE_STRING, # Comment - gobject.TYPE_BOOLEAN, - gobject.TYPE_STRING) - self.__view = gtk.TreeView(self.__store) - self.__view.show() - - tips = gtk.Tooltips() - - for k in list(self.caps.keys()): - t = self.types[k] - - if t == gobject.TYPE_BOOLEAN: - rend = gtk.CellRendererToggle() - rend.connect("toggled", self._toggle, k) - column = gtk.TreeViewColumn(self.caps[k], rend, - active=k, - sensitive=self.col_okay, - activatable=self.col_okay) - else: - rend = gtk.CellRendererText() - if k in editable: - rend.set_property("editable", True) - rend.connect("edited", self._edited, k) - column = gtk.TreeViewColumn(self.caps[k], rend, - text=k, - sensitive=self.col_okay) - - if k == self.col_nloc: - column.set_cell_data_func(rend, self._render, k) - - if k in list(self.tips.keys()): - LOG.debug("Doing %s" % k) - lab = gtk.Label(self.caps[k]) - column.set_widget(lab) - tips.set_tip(lab, self.tips[k]) - lab.show() - column.set_sort_column_id(k) - self.__view.append_column(column) - - self.__view.set_tooltip_column(self.col_tmsg) - - sw = gtk.ScrolledWindow() - sw.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) - sw.add(self.__view) - sw.show() - - return sw - - def __select_all(self, button, state): - iter = self.__store.get_iter_first() - while iter: - _state, okay, = self.__store.get(iter, - self.col_import, - self.col_okay) - if state is None: - _state = not _state and okay - else: - _state = state and okay - self.__store.set(iter, self.col_import, _state) - iter = self.__store.iter_next(iter) - - def __incrnew(self, button, delta): - iter = self.__store.get_iter_first() - while iter: - pos = self.__store.get(iter, self.col_nloc)[0] - pos += delta - if pos < 0: - pos = 0 - self.__store.set(iter, self.col_nloc, pos) - iter = self.__store.iter_next(iter) - - def __autonew(self, button): - pos = self.dst_radio.get_features().memory_bounds[0] - iter = self.__store.get_iter_first() - while iter: - selected, okay = self.__store.get(iter, - self.col_import, self.col_okay) - if selected and okay: - self.__store.set(iter, self.col_nloc, pos) - pos += 1 - iter = self.__store.iter_next(iter) - - def __revrnew(self, button): - positions = [] - iter = self.__store.get_iter_first() - while iter: - positions.append(self.__store.get(iter, self.col_nloc)[0]) - iter = self.__store.iter_next(iter) - - iter = self.__store.get_iter_first() - while iter: - self.__store.set(iter, self.col_nloc, positions.pop()) - iter = self.__store.iter_next(iter) - - def make_select(self): - hbox = gtk.HBox(True, 2) - - all = gtk.Button(_("All")) - all.connect("clicked", self.__select_all, True) - all.set_size_request(50, 25) - all.show() - hbox.pack_start(all, 0, 0, 0) - - none = gtk.Button(_("None")) - none.connect("clicked", self.__select_all, False) - none.set_size_request(50, 25) - none.show() - hbox.pack_start(none, 0, 0, 0) - - inv = gtk.Button(_("Inverse")) - inv.connect("clicked", self.__select_all, None) - inv.set_size_request(50, 25) - inv.show() - hbox.pack_start(inv, 0, 0, 0) - - frame = gtk.Frame(_("Select")) - frame.show() - frame.add(hbox) - hbox.show() - - return frame - - def make_adjust(self): - hbox = gtk.HBox(True, 2) - - incr = gtk.Button("+100") - incr.connect("clicked", self.__incrnew, 100) - incr.set_size_request(50, 25) - incr.show() - hbox.pack_start(incr, 0, 0, 0) - - incr = gtk.Button("+10") - incr.connect("clicked", self.__incrnew, 10) - incr.set_size_request(50, 25) - incr.show() - hbox.pack_start(incr, 0, 0, 0) - - incr = gtk.Button("+1") - incr.connect("clicked", self.__incrnew, 1) - incr.set_size_request(50, 25) - incr.show() - hbox.pack_start(incr, 0, 0, 0) - - decr = gtk.Button("-1") - decr.connect("clicked", self.__incrnew, -1) - decr.set_size_request(50, 25) - decr.show() - hbox.pack_start(decr, 0, 0, 0) - - decr = gtk.Button("-10") - decr.connect("clicked", self.__incrnew, -10) - decr.set_size_request(50, 25) - decr.show() - hbox.pack_start(decr, 0, 0, 0) - - decr = gtk.Button("-100") - decr.connect("clicked", self.__incrnew, -100) - decr.set_size_request(50, 25) - decr.show() - hbox.pack_start(decr, 0, 0, 0) - - auto = gtk.Button(_("Auto")) - auto.connect("clicked", self.__autonew) - auto.set_size_request(50, 25) - auto.show() - hbox.pack_start(auto, 0, 0, 0) - - revr = gtk.Button(_("Reverse")) - revr.connect("clicked", self.__revrnew) - revr.set_size_request(50, 25) - revr.show() - hbox.pack_start(revr, 0, 0, 0) - - frame = gtk.Frame(_("Adjust New Location")) - frame.show() - frame.add(hbox) - hbox.show() - - return frame - - def make_options(self): - hbox = gtk.HBox(True, 2) - - confirm = gtk.CheckButton(_("Confirm overwrites")) - confirm.connect("toggled", __set_confirm) - confirm.show() - - hbox.pack_start(confirm, 0, 0, 0) - - frame = gtk.Frame(_("Options")) - frame.add(hbox) - frame.show() - hbox.show() - - return frame - - def make_controls(self): - hbox = gtk.HBox(False, 2) - - hbox.pack_start(self.make_select(), 0, 0, 0) - hbox.pack_start(self.make_adjust(), 0, 0, 0) - # hbox.pack_start(self.make_options(), 0, 0, 0) - hbox.show() - - return hbox - - def build_ui(self): - self.vbox.pack_start(self.make_view(), 1, 1, 1) - self.vbox.pack_start(self.make_controls(), 0, 0, 0) - - def record_use_of(self, number): - lo, hi = self.dst_radio.get_features().memory_bounds - - if number < lo or number > hi: - return - - try: - mem = self.dst_radio.get_memory(number) - if mem and not mem.empty and number not in self.used_list: - self.used_list.append(number) - except errors.InvalidMemoryLocation: - LOG.error("Location %i empty or at limit of destination radio" % - number) - except errors.InvalidDataError as e: - LOG.error("Got error from radio, assuming %i beyond limits: %s" % - (number, e)) - - def populate_list(self): - start, end = self.src_radio.get_features().memory_bounds - for i in range(start, end+1): - if end > 50 and i % (end/50) == 0: - self.ww.set(float(i) / end) - try: - mem = self.src_radio.get_memory(i) - except errors.InvalidMemoryLocation as e: - continue - except Exception as e: - self.__store.append(row=(False, - i, - i, - "ERROR", - chirp_common.format_freq(0), - "", - False, - str(e), - )) - self.record_use_of(i) - continue - if mem.empty: - continue - - self.ww.set(float(i) / end) - try: - msgs = self.dst_radio.validate_memory( - import_logic.import_mem(self.dst_radio, - self.src_radio.get_features(), - mem)) - except import_logic.DestNotCompatible: - msgs = self.dst_radio.validate_memory(mem) - errs = [x for x in msgs - if isinstance(x, chirp_common.ValidationError)] - if errs: - msg = _("Cannot be imported because") + ":\r\n" - msg += ",".join(errs) - else: - errs = [] - msg = "Memory can be imported into target" - - self.__store.append(row=(not bool(msgs), - mem.number, - mem.number, - mem.name, - chirp_common.format_freq(mem.freq), - mem.comment, - not bool(errs), - msg - )) - self.record_use_of(mem.number) - - TITLE = _("Import From File") - ACTION = _("Import") - - def __init__(self, src_radio, dst_radio, parent=None): - buttons = (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, - gtk.STOCK_OK, gtk.RESPONSE_OK) - gtk.Dialog.__init__(self, - buttons=buttons, - title=self.TITLE, - parent=parent) - self.set_default_response(gtk.RESPONSE_OK) - self.set_alternative_button_order([gtk.RESPONSE_OK, - gtk.RESPONSE_CANCEL]) - self.col_import = 0 - self.col_nloc = 1 - self.col_oloc = 2 - self.col_name = 3 - self.col_freq = 4 - self.col_comm = 5 - self.col_okay = 6 - self.col_tmsg = 7 - - self.caps = { - self.col_import: self.ACTION, - self.col_nloc: _("To"), - self.col_oloc: _("From"), - self.col_name: _("Name"), - self.col_freq: _("Frequency"), - self.col_comm: _("Comment"), - } - - self.tips = { - self.col_nloc: _("Location memory will be imported into"), - self.col_oloc: _("Location of memory in the file being imported"), - } - - self.types = { - self.col_import: gobject.TYPE_BOOLEAN, - self.col_oloc: gobject.TYPE_INT, - self.col_nloc: gobject.TYPE_INT, - self.col_name: gobject.TYPE_STRING, - self.col_freq: gobject.TYPE_STRING, - self.col_comm: gobject.TYPE_STRING, - self.col_okay: gobject.TYPE_BOOLEAN, - self.col_tmsg: gobject.TYPE_STRING, - } - - self.src_radio = src_radio - self.dst_radio = dst_radio - - self.used_list = [] - self.not_used_list = [] - - self.build_ui() - self.set_default_size(600, 400) - - self.ww = WaitWindow(_("Preparing memory list..."), parent=parent) - self.ww.show() - self.ww.grind() - - self.populate_list() - - self.ww.hide() - - -class ExportDialog(ImportDialog): - TITLE = _("Export To File") - ACTION = _("Export") - -if __name__ == "__main__": - from chirp.ui import editorset - import sys - - f = sys.argv[1] - rc = editorset.radio_class_from_file(f) - radio = rc(f) - - d = ImportDialog(radio) - d.run() - - print(d.get_import_list()) diff --git a/chirp/ui/inputdialog.py b/chirp/ui/inputdialog.py deleted file mode 100644 index 74362dc..0000000 --- a/chirp/ui/inputdialog.py +++ /dev/null @@ -1,160 +0,0 @@ -# Copyright 2008 Dan Smith -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -import gtk -import logging - -from chirp.ui.miscwidgets import make_choice -from chirp.ui import reporting - -LOG = logging.getLogger(__name__) - - -class TextInputDialog(gtk.Dialog): - def respond_ok(self, _): - self.response(gtk.RESPONSE_OK) - - def __init__(self, **args): - buttons = (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, - gtk.STOCK_OK, gtk.RESPONSE_OK) - gtk.Dialog.__init__(self, buttons=buttons, **args) - - self.label = gtk.Label() - self.label.set_size_request(300, 100) - self.label.set_alignment(0.0, 0.5) - - # pylint: disable-msg=E1101 - self.vbox.pack_start(self.label, 1, 1, 0) - - self.text = gtk.Entry() - self.text.connect("activate", self.respond_ok, None) - # pylint: disable-msg=E1101 - self.vbox.pack_start(self.text, 1, 1, 0) - - self.label.show() - self.text.show() - - -class ChoiceDialog(gtk.Dialog): - editable = False - - def __init__(self, choices, **args): - buttons = (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, - gtk.STOCK_OK, gtk.RESPONSE_OK) - gtk.Dialog.__init__(self, buttons=buttons, **args) - - self.set_default_response(gtk.RESPONSE_OK) - self.set_alternative_button_order([gtk.RESPONSE_OK, - gtk.RESPONSE_CANCEL]) - - self.label = gtk.Label() - self.label.set_size_request(300, 100) - self.label.set_alignment(0.0, 0.5) - # pylint: disable-msg=E1101 - self.vbox.pack_start(self.label, 1, 1, 0) - self.label.show() - - try: - default = choices[0] - except IndexError: - default = None - - self.choice = make_choice(sorted(choices), self.editable, default) - # pylint: disable-msg=E1101 - self.vbox.pack_start(self.choice, 1, 1, 0) - self.choice.show() - - -class EditableChoiceDialog(ChoiceDialog): - editable = True - - def __init__(self, choices, **args): - ChoiceDialog.__init__(self, choices, **args) - - self.choice.child.set_activates_default(True) - - -class ExceptionDialog(gtk.MessageDialog): - def __init__(self, exception, **args): - gtk.MessageDialog.__init__(self, buttons=gtk.BUTTONS_OK, - type=gtk.MESSAGE_ERROR, **args) - self.set_default_response(gtk.RESPONSE_OK) - self.set_property("text", _("An error has occurred")) - self.format_secondary_text(str(exception)) - - import traceback - import sys - reporting.report_exception(traceback.format_exc(limit=30)) - LOG.error("--- Exception Dialog: %s ---" % exception) - LOG.error(traceback.format_exc(limit=100)) - LOG.error("----------------------------") - - -class FieldDialog(gtk.Dialog): - def __init__(self, **args): - buttons = (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, - gtk.STOCK_OK, gtk.RESPONSE_OK) - - gtk.Dialog.__init__(self, buttons=buttons, **args) - - self.set_default_response(gtk.RESPONSE_OK) - self.set_alternative_button_order([gtk.RESPONSE_OK, - gtk.RESPONSE_CANCEL]) - - self.__fields = {} - - def response(self, _): - LOG.debug("Blocking response") - return - - def add_field(self, label, widget, validator=None): - box = gtk.HBox(True, 2) - - lab = gtk.Label(label + ":") - lab.set_alignment(1.0, 0.5) - lab.show() - - widget.set_size_request(150, -1) - widget.show() - - box.pack_start(lab, 0, 0, 0) - box.pack_start(widget, 0, 0, 0) - box.show() - - # pylint: disable-msg=E1101 - self.vbox.pack_start(box, 0, 0, 0) - - self.__fields[label] = widget - - def get_field(self, label): - return self.__fields.get(label, None) - - -class OverwriteDialog(gtk.MessageDialog): - def __init__(self, filename): - - buttons = (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, - gtk.STOCK_OK, gtk.RESPONSE_OK) - gtk.Dialog.__init__(self, buttons=buttons) - self.set_alternative_button_order([gtk.RESPONSE_OK, - gtk.RESPONSE_CANCEL]) - - self.set_property("text", _("File Exists")) - - text = \ - _("The file {name} already exists. " - "Do you want to overwrite it?").format(name=filename) - - self.format_secondary_text(text) diff --git a/chirp/ui/mainapp.py b/chirp/ui/mainapp.py deleted file mode 100644 index adbd9a9..0000000 --- a/chirp/ui/mainapp.py +++ /dev/null @@ -1,2379 +0,0 @@ -# Copyright 2008 Dan Smith -# Copyright 2012 Tom Hayward -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -from datetime import datetime -import os -import tempfile -import webbrowser -from glob import glob -import shutil -import time -import logging -import gtk -import gobject -import sys - -from chirp.ui import inputdialog, common -from chirp.ui import compat -from chirp import platform, directory, util -from chirp.drivers import generic_csv, repeaterbook -from chirp.drivers import ic9x, kenwood_live, idrp, vx7, vx5, vx6 -from chirp.drivers import icf, ic9x_icf -from chirp import CHIRP_VERSION, chirp_common, detect, errors -from chirp import bandplan -from chirp.ui import editorset, clone, miscwidgets, config, reporting, fips -from chirp.ui import bandplans - -gobject.threads_init() - -LOG = logging.getLogger(__name__) - -if __name__ == "__main__": - sys.path.insert(0, "..") - -try: - import serial -except ImportError as e: - common.log_exception() - common.show_error("\nThe Pyserial module is not installed!") - - -CONF = config.get() - -KEEP_RECENT = 8 - -RB_BANDS = { - "--All--": 0, - "10 meters (29MHz)": 29, - "6 meters (54MHz)": 5, - "2 meters (144MHz)": 14, - "1.25 meters (220MHz)": 22, - "70 centimeters (440MHz)": 4, - "33 centimeters (900MHz)": 9, - "23 centimeters (1.2GHz)": 12, -} - - -def key_bands(band): - if band.startswith("-"): - return -1 - - amount, units, mhz = band.split(" ") - scale = units == "meters" and 100 or 1 - - return 100000 - (float(amount) * scale) - - -class ModifiedError(Exception): - pass - - -class ChirpMain(gtk.Window): - - def get_current_editorset(self): - page = self.tabs.get_current_page() - if page is not None: - return self.tabs.get_nth_page(page) - else: - return None - - def ev_tab_switched(self, pagenum=None): - def set_action_sensitive(action, sensitive): - self.menu_ag.get_action(action).set_sensitive(sensitive) - - if pagenum is not None: - eset = self.tabs.get_nth_page(pagenum) - else: - eset = self.get_current_editorset() - - upload_sens = bool(eset and - isinstance(eset.radio, chirp_common.CloneModeRadio)) - - if not eset or isinstance(eset.radio, chirp_common.LiveRadio): - save_sens = False - elif isinstance(eset.radio, chirp_common.NetworkSourceRadio): - save_sens = False - else: - save_sens = True - - for i in ["import", "importsrc", "stock"]: - set_action_sensitive(i, - eset is not None and not eset.get_read_only()) - - for i in ["save", "saveas"]: - set_action_sensitive(i, save_sens) - - for i in ["upload"]: - set_action_sensitive(i, upload_sens) - - for i in ["cancelq"]: - set_action_sensitive(i, eset is not None and not save_sens) - - for i in ["export", "close", "columns", "irbook", "irfinder", - "move_up", "move_dn", "exchange", "iradioreference", - "cut", "copy", "paste", "delete", "viewdeveloper", - "all", "properties"]: - set_action_sensitive(i, eset is not None) - - def ev_status(self, editorset, msg): - self.sb_radio.pop(0) - self.sb_radio.push(0, msg) - - def ev_usermsg(self, editorset, msg): - self.sb_general.pop(0) - self.sb_general.push(0, msg) - - def ev_editor_selected(self, editorset, editortype): - mappings = { - "memedit": ["view", "edit"], - } - - for _editortype, actions in mappings.items(): - for _action in actions: - action = self.menu_ag.get_action(_action) - action.set_sensitive(editortype.startswith(_editortype)) - - def _connect_editorset(self, eset): - eset.connect("want-close", self.do_close) - eset.connect("status", self.ev_status) - eset.connect("usermsg", self.ev_usermsg) - eset.connect("editor-selected", self.ev_editor_selected) - - def do_diff_radio(self): - if self.tabs.get_n_pages() < 2: - common.show_error("Diff tabs requires at least two open tabs!") - return - - esets = [] - for i in range(0, self.tabs.get_n_pages()): - esets.append(self.tabs.get_nth_page(i)) - - buttons = (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, - gtk.STOCK_OK, gtk.RESPONSE_OK) - d = gtk.Dialog(title="Diff Radios", - buttons=buttons, - parent=self) - d.set_default_response(gtk.RESPONSE_OK) - d.set_alternative_button_order([gtk.RESPONSE_OK, - gtk.RESPONSE_CANCEL]) - - label = gtk.Label("") - label.set_markup("-1 for either Mem # does a full-file hex " + - "dump with diffs highlighted.\n" + - "-2 for first Mem # shows " + - "only the diffs.") - d.vbox.pack_start(label, True, True, 0) - label.show() - - choices = [] - for eset in esets: - choices.append("%s %s (%s)" % (eset.rthread.radio.VENDOR, - eset.rthread.radio.MODEL, - eset.filename)) - choice_a = miscwidgets.make_choice(choices, False, choices[0]) - choice_a.show() - chan_a = gtk.SpinButton() - chan_a.get_adjustment().set_all(1, -2, 999, 1, 10, 0) - chan_a.show() - hbox = gtk.HBox(False, 3) - hbox.pack_start(choice_a, 1, 1, 1) - hbox.pack_start(chan_a, 0, 0, 0) - hbox.show() - d.vbox.pack_start(hbox, 0, 0, 0) - - choice_b = miscwidgets.make_choice(choices, False, choices[1]) - choice_b.show() - chan_b = gtk.SpinButton() - chan_b.get_adjustment().set_all(1, -1, 999, 1, 10, 0) - chan_b.show() - hbox = gtk.HBox(False, 3) - hbox.pack_start(choice_b, 1, 1, 1) - hbox.pack_start(chan_b, 0, 0, 0) - hbox.show() - d.vbox.pack_start(hbox, 0, 0, 0) - - r = d.run() - sel_a = choice_a.get_active_text() - sel_chan_a = chan_a.get_value() - sel_b = choice_b.get_active_text() - sel_chan_b = chan_b.get_value() - d.destroy() - if r == gtk.RESPONSE_CANCEL: - return - - if sel_a == sel_b: - common.show_error("Can't diff the same tab!") - return - - LOG.debug("Selected %s@%i and %s@%i" % - (sel_a, sel_chan_a, sel_b, sel_chan_b)) - name_a = os.path.basename(sel_a) - name_a = name_a[:name_a.rindex(")")] - name_b = os.path.basename(sel_b) - name_b = name_b[:name_b.rindex(")")] - diffwintitle = "%s@%i diff %s@%i" % ( - name_a, sel_chan_a, name_b, sel_chan_b) - - eset_a = esets[choices.index(sel_a)] - eset_b = esets[choices.index(sel_b)] - - def _show_diff(mem_b, mem_a): - # Step 3: Show the diff - diff = common.simple_diff(mem_a, mem_b) - common.show_diff_blob(diffwintitle, diff) - - def _get_mem_b(mem_a): - # Step 2: Get memory b - job = common.RadioJob(_show_diff, "get_raw_memory", - int(sel_chan_b)) - job.set_cb_args(mem_a) - eset_b.rthread.submit(job) - - if sel_chan_a >= 0 and sel_chan_b >= 0: - # Diff numbered memory - # Step 1: Get memory a - job = common.RadioJob(_get_mem_b, "get_raw_memory", - int(sel_chan_a)) - eset_a.rthread.submit(job) - elif isinstance(eset_a.rthread.radio, chirp_common.CloneModeRadio) and\ - isinstance(eset_b.rthread.radio, chirp_common.CloneModeRadio): - # Diff whole (can do this without a job, since both are clone-mode) - try: - addrfmt = CONF.get('hexdump_addrfmt', section='developer', - raw=True) - except: - pass - a = util.hexprint(eset_a.rthread.radio._mmap.get_packed(), - addrfmt=addrfmt) - b = util.hexprint(eset_b.rthread.radio._mmap.get_packed(), - addrfmt=addrfmt) - if sel_chan_a == -2: - diffsonly = True - else: - diffsonly = False - common.show_diff_blob(diffwintitle, - common.simple_diff(a, b, diffsonly)) - else: - common.show_error("Cannot diff whole live-mode radios!") - - def do_new(self): - eset = editorset.EditorSet(_("Untitled") + ".csv", self) - self._connect_editorset(eset) - eset.show() - - tab = self.tabs.append_page(eset, eset.get_tab_label()) - self.tabs.set_current_page(tab) - - def _do_manual_select(self, filename): - radiolist = {} - for drv, radio in directory.DRV_TO_RADIO.items(): - if not issubclass(radio, chirp_common.CloneModeRadio): - continue - radiolist["%s %s" % (radio.VENDOR, radio.MODEL)] = drv - - lab = gtk.Label("""Unable to detect model! - -If you think that it is valid, you can select a radio model below to -force an open attempt. If selecting the model manually works, please -file a bug on the website and attach your image. If selecting the model -does not work, it is likely that you are trying to open some other type -of file. -""") - - lab.set_justify(gtk.JUSTIFY_FILL) - lab.set_line_wrap(True) - lab.set_use_markup(True) - lab.show() - choice = miscwidgets.make_choice(sorted(radiolist.keys()), False, - sorted(radiolist.keys())[0]) - buttons = (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, - gtk.STOCK_OK, gtk.RESPONSE_OK) - d = gtk.Dialog(title="Detection Failed", - buttons=buttons) - d.set_default_response(gtk.RESPONSE_OK) - d.set_alternative_button_order([gtk.RESPONSE_OK, - gtk.RESPONSE_CANCEL]) - d.vbox.pack_start(lab, 0, 0, 0) - d.vbox.pack_start(choice, 0, 0, 0) - d.vbox.set_spacing(5) - choice.show() - d.set_default_size(400, 200) - # d.set_resizable(False) - r = d.run() - d.destroy() - if r != gtk.RESPONSE_OK: - return - try: - rc = directory.DRV_TO_RADIO[radiolist[choice.get_active_text()]] - return rc(filename) - except: - return - - def do_open(self, fname=None, tempname=None): - if not fname: - types = [(_("All files") + " (*.*)", "*"), - (_("CHIRP Radio Images") + " (*.img)", "*.img"), - (_("CSV Files") + " (*.csv)", "*.csv"), - (_("DAT Files") + " (*.dat)", "*.dat"), - (_("EVE Files (VX5)") + " (*.eve)", "*.eve"), - (_("ICF Files") + " (*.icf)", "*.icf"), - (_("VX5 Commander Files") + " (*.vx5)", "*.vx5"), - (_("VX6 Commander Files") + " (*.vx6)", "*.vx6"), - (_("VX7 Commander Files") + " (*.vx7)", "*.vx7"), - ] - fname = platform.get_platform().gui_open_file(types=types) - if not fname: - return - - if not os.path.exists(fname): - LOG.error("Unable to find file %s" % fname) - return - - self.record_recent_file(fname) - - if icf.is_icf_file(fname): - a = common.ask_yesno_question( - _("ICF files cannot be edited, only displayed or imported " - "into another file. Open in read-only mode?"), - self) - if not a: - return - read_only = True - else: - read_only = False - - if icf.is_9x_icf(fname): - # We have to actually instantiate the IC9xICFRadio to get its - # sub-devices - radio = ic9x_icf.IC9xICFRadio(fname) - else: - try: - radio = directory.get_radio_by_image(fname) - except errors.ImageMetadataInvalidModel as e: - version = e.metadata.get('chirp_version') - if version: - newer = chirp_common.is_version_newer(version) - LOG.error('Image is from newer CHIRP with a model we ' - 'do not support') - common.show_error( - _('Unable to open this image. It was generated ' - 'with a newer version of CHIRP and thus may ' - 'be for a radio model that is not supported ' - 'by this version. Please update to the latest ' - 'version of CHIRP and try again.')) - else: - LOG.error('Image has metadata but has no chirp_version ' - 'and we do not support the model') - common.show_error( - _('Unable to open this image: unsupported model')) - return - except errors.ImageDetectFailed: - radio = self._do_manual_select(fname) - if not radio: - return - LOG.debug("Manually selected %s" % radio) - except Exception as e: - common.log_exception() - common.show_error(os.path.basename(fname) + ": " + str(e)) - return - - first_tab = False - try: - eset = editorset.EditorSet(radio, self, - filename=fname, - tempname=tempname) - except Exception as e: - common.log_exception() - common.show_error( - _("There was an error opening {fname}: {error}").format( - fname=fname, - error=e)) - return - - eset.set_read_only(read_only) - self._connect_editorset(eset) - eset.show() - self.tabs.append_page(eset, eset.get_tab_label()) - - if hasattr(eset.rthread.radio, "errors") and \ - eset.rthread.radio.errors: - msg = _("{num} errors during open:").format( - num=len(eset.rthread.radio.errors)) - common.show_error_text(msg, - "\r\n".join(eset.rthread.radio.errors)) - self._show_information(radio) - - def do_live_warning(self, radio): - d = gtk.MessageDialog(parent=self, buttons=gtk.BUTTONS_OK) - d.set_markup("" + _("Note:") + "") - msg = _("The {vendor} {model} operates in live mode. " - "This means that any changes you make are immediately sent " - "to the radio. Because of this, you cannot perform the " - "Save or Upload operations. If you wish to " - "edit the contents offline, please Export to a CSV " - "file, using the File menu.") - msg = msg.format(vendor=radio.VENDOR, model=radio.MODEL) - d.format_secondary_markup(msg) - - again = gtk.CheckButton(_("Don't show this again")) - again.show() - d.vbox.pack_start(again, 0, 0, 0) - d.run() - CONF.set_bool("live_mode", again.get_active(), "noconfirm") - d.destroy() - - def do_open_live(self, radio, tempname=None, read_only=False): - eset = editorset.EditorSet(radio, self, tempname=tempname) - eset.connect("want-close", self.do_close) - eset.connect("status", self.ev_status) - eset.set_read_only(read_only) - eset.show() - self.tabs.append_page(eset, eset.get_tab_label()) - - if isinstance(radio, chirp_common.LiveRadio): - reporting.report_model_usage(radio, "live", True) - if not CONF.get_bool("live_mode", "noconfirm"): - self.do_live_warning(radio) - - def do_save(self, eset=None): - if not eset: - eset = self.get_current_editorset() - - # For usability, allow Ctrl-S to short-circuit to Save-As if - # we are working on a yet-to-be-saved image - if not os.path.exists(eset.filename): - return self.do_saveas() - - eset.save() - - def do_saveas(self): - eset = self.get_current_editorset() - - label = _("{vendor} {model} image file").format( - vendor=eset.radio.VENDOR, - model=eset.radio.MODEL) - - defname_format = CONF.get("default_filename", "global") or \ - "{vendor}_{model}_{date}" - defname = defname_format.format( - vendor=eset.radio.VENDOR, - model=eset.radio.MODEL, - date=datetime.now().strftime('%Y%m%d') - ).replace('/', '_') - - types = [(label + " (*.%s)" % eset.radio.FILE_EXTENSION, - eset.radio.FILE_EXTENSION)] - - if isinstance(eset.radio, vx7.VX7Radio): - types += [(_("VX7 Commander") + " (*.vx7)", "vx7")] - elif isinstance(eset.radio, vx6.VX6Radio): - types += [(_("VX6 Commander") + " (*.vx6)", "vx6")] - elif isinstance(eset.radio, vx5.VX5Radio): - types += [(_("EVE") + " (*.eve)", "eve")] - types += [(_("VX5 Commander") + " (*.vx5)", "vx5")] - - while True: - fname = platform.get_platform().gui_save_file(default_name=defname, - types=types) - if not fname: - return - - if os.path.exists(fname): - dlg = inputdialog.OverwriteDialog(fname) - owrite = dlg.run() - dlg.destroy() - if owrite == gtk.RESPONSE_OK: - break - else: - break - - try: - eset.save(fname) - except Exception as e: - d = inputdialog.ExceptionDialog(e) - d.run() - d.destroy() - - def cb_clonein(self, radio, emsg=None): - radio.pipe.close() - reporting.report_model_usage(radio, "download", bool(emsg)) - if not emsg: - self.do_open_live(radio, tempname="(" + _("Untitled") + ")") - else: - d = inputdialog.ExceptionDialog(emsg, parent=self) - d.run() - d.destroy() - - def cb_cloneout(self, radio, emsg=None): - radio.pipe.close() - reporting.report_model_usage(radio, "upload", True) - if emsg: - d = inputdialog.ExceptionDialog(emsg) - d.run() - d.destroy() - - def _get_recent_list(self): - recent = [] - for i in range(0, KEEP_RECENT): - fn = CONF.get("recent%i" % i, "state") - if fn: - recent.append(fn) - return recent - - def _set_recent_list(self, recent): - for index in range(0, KEEP_RECENT): - key = "recent%i" % index - if (index < len(recent)): - fn = recent[index] - CONF.set(key, fn, "state") - else: - CONF.remove_option(key, "state") - self.recent_files = None - - def update_recent_files(self): - if self.recent_files is not None: - return - - self.recent_files = self._get_recent_list() - for index in range(0, KEEP_RECENT): - action_name = "recent%i" % index - path = "/MenuBar/file/recent" - - old_action = self.menu_ag.get_action(action_name) - if old_action: - old_action.set_visible(False) - self.menu_ag.remove_action(old_action) - - if (index < len(self.recent_files)): - fname = self.recent_files[index] - widget_label = os.path.basename(fname).replace("_", "__") - widget_tip = _("Open recent file") + (" {name}").format( - name=fname) - widget_path = path + "/" + action_name - - action = gtk.Action(action_name, widget_label, widget_tip, "") - action.connect("activate", lambda a, f: self.do_open(f), fname) - - mid = self.menu_uim.new_merge_id() - self.menu_uim.add_ui(mid, path, - action_name, action_name, - gtk.UI_MANAGER_MENUITEM, True) - self.menu_ag.add_action(action) - - try: - widget = self.menu_uim.get_widget(widget_path) - widget.set_tooltip_text(tip) - except: - pass - - def record_recent_file(self, fname): - recent_files = self._get_recent_list() - if fname in recent_files: - recent_files.remove(fname) - if len(recent_files) == KEEP_RECENT: - recent_files.pop(0) - recent_files.append(fname) - - self._set_recent_list(recent_files) - - def clear_recent_files(self): - self._set_recent_list([]) - - def import_stock_config(self, action, config): - eset = self.get_current_editorset() - count = eset.do_import(config) - - def copy_shipped_stock_configs(self, stock_dir): - basepath = platform.get_platform().find_resource("stock_configs") - - files = glob(os.path.join(basepath, "*.csv")) - for fn in files: - if os.path.exists(os.path.join(stock_dir, os.path.basename(fn))): - LOG.info("Skipping existing stock config") - continue - try: - shutil.copy(fn, stock_dir) - LOG.debug("Copying %s -> %s" % (fn, stock_dir)) - except Exception as e: - LOG.error("Unable to copy %s to %s: %s" % (fn, stock_dir, e)) - return False - return True - - def update_stock_configs(self): - stock_dir = platform.get_platform().config_file("stock_configs") - if not os.path.isdir(stock_dir): - try: - os.mkdir(stock_dir) - except Exception as e: - LOG.error("Unable to create directory: %s" % stock_dir) - return - if not self.copy_shipped_stock_configs(stock_dir): - return - - def _do_import_action(config): - name = os.path.splitext(os.path.basename(config))[0] - action_name = "stock-%i" % configs.index(config) - path = "/MenuBar/radio/stock" - action = gtk.Action(action_name, - name, - _("Import stock " - "configuration {name}").format(name=name), - "") - action.connect("activate", self.import_stock_config, config) - mid = self.menu_uim.new_merge_id() - self.menu_uim.add_ui(mid, path, - action_name, action_name, - gtk.UI_MANAGER_MENUITEM, False) - self.menu_ag.add_action(action) - - def _do_open_action(config): - name = os.path.splitext(os.path.basename(config))[0] - action_name = "openstock-%i" % configs.index(config) - path = "/MenuBar/file/openstock" - action = gtk.Action(action_name, - name, - _("Open stock " - "configuration {name}").format(name=name), - "") - action.connect("activate", lambda a, c: self.do_open(c), config) - mid = self.menu_uim.new_merge_id() - self.menu_uim.add_ui(mid, path, - action_name, action_name, - gtk.UI_MANAGER_MENUITEM, False) - self.menu_ag.add_action(action) - - configs = glob(os.path.join(stock_dir, "*.csv")) - for config in configs: - _do_import_action(config) - _do_open_action(config) - - def _confirm_experimental(self, rclass): - sql_key = "warn_experimental_%s" % directory.radio_class_id(rclass) - if CONF.is_defined(sql_key, "state") and \ - not CONF.get_bool(sql_key, "state"): - return True - - title = _("Proceed with experimental driver?") - text = rclass.get_prompts().experimental - msg = _("This radio's driver is experimental. " - "Do you want to proceed?") - resp, squelch = common.show_warning(msg, text, - title=title, - buttons=gtk.BUTTONS_YES_NO, - can_squelch=True) - if resp == gtk.RESPONSE_YES: - CONF.set_bool(sql_key, not squelch, "state") - return resp == gtk.RESPONSE_YES - - def _show_information(self, radio): - message = radio.get_prompts().info - if message is None: - return - - if CONF.get_bool("clone_information", "noconfirm"): - return - - d = gtk.MessageDialog(parent=self, buttons=gtk.BUTTONS_OK) - d.set_markup("" + _("{name} Information").format( - name=radio.get_name()) + "") - msg = _("{information}").format(information=message) - d.format_secondary_markup(msg) - - again = gtk.CheckButton( - _("Don't show information for any radio again")) - again.show() - again.connect("toggled", lambda action: - self.infomenu.set_active(not action.get_active())) - d.vbox.pack_start(again, 0, 0, 0) - h_button_box = d.vbox.get_children()[2] - try: - ok_button = h_button_box.get_children()[0] - ok_button.grab_default() - ok_button.grab_focus() - except AttributeError: - # don't grab focus on GTK+ 2.0 - pass - d.run() - d.destroy() - - def _show_instructions(self, radio, message): - if message is None: - return - - if CONF.get_bool("clone_instructions", "noconfirm"): - return - - d = gtk.MessageDialog(parent=self, buttons=gtk.BUTTONS_OK) - d.set_markup("" + _("{name} Instructions").format( - name=radio.get_name()) + "") - msg = _("{instructions}").format(instructions=message) - d.format_secondary_markup(msg) - - again = gtk.CheckButton( - _("Don't show instructions for any radio again")) - again.show() - again.connect("toggled", lambda action: - self.clonemenu.set_active(not action.get_active())) - d.vbox.pack_start(again, 0, 0, 0) - h_button_box = d.vbox.get_children()[2] - try: - ok_button = h_button_box.get_children()[0] - ok_button.grab_default() - ok_button.grab_focus() - except AttributeError: - # don't grab focus on GTK+ 2.0 - pass - d.run() - d.destroy() - - def do_download(self, port=None, rtype=None): - d = clone.CloneSettingsDialog(parent=self) - settings = d.run() - d.destroy() - if not settings: - return - - rclass = settings.radio_class - if issubclass(rclass, chirp_common.ExperimentalRadio) and \ - not self._confirm_experimental(rclass): - # User does not want to proceed with experimental driver - return - - self._show_instructions(rclass, rclass.get_prompts().pre_download) - - LOG.debug("User selected %s %s on port %s" % - (rclass.VENDOR, rclass.MODEL, settings.port)) - - try: - ser = compat.CompatSerial.get(rclass.NEEDS_COMPAT_SERIAL, - port=settings.port, - baudrate=rclass.BAUD_RATE, - rtscts=rclass.HARDWARE_FLOW, - timeout=0.25) - ser.flushInput() - except serial.SerialException as e: - d = inputdialog.ExceptionDialog(e, parent=self) - d.run() - d.destroy() - return - - radio = settings.radio_class(ser) - - fn = tempfile.mktemp() - if isinstance(radio, chirp_common.CloneModeRadio): - ct = clone.CloneThread(radio, "in", cb=self.cb_clonein, - parent=self) - ct.start() - else: - self.do_open_live(radio) - self._show_information(rclass) # show Info prompt now - - def do_upload(self, port=None, rtype=None): - eset = self.get_current_editorset() - radio = eset.radio - - settings = clone.CloneSettings() - settings.radio_class = radio.__class__ - - d = clone.CloneSettingsDialog(settings, parent=self) - settings = d.run() - d.destroy() - if not settings: - return - prompts = radio.get_prompts() - - if prompts.display_pre_upload_prompt_before_opening_port is True: - LOG.debug("Opening port after pre_upload prompt.") - self._show_instructions(radio, prompts.pre_upload) - - if isinstance(radio, chirp_common.ExperimentalRadio) and \ - not self._confirm_experimental(radio.__class__): - # User does not want to proceed with experimental driver - return - - try: - ser = compat.CompatSerial.get(radio.NEEDS_COMPAT_SERIAL, - port=settings.port, - baudrate=radio.BAUD_RATE, - rtscts=radio.HARDWARE_FLOW, - timeout=0.25) - ser.flushInput() - except serial.SerialException as e: - d = inputdialog.ExceptionDialog(e) - d.run() - d.destroy() - return - - if prompts.display_pre_upload_prompt_before_opening_port is False: - LOG.debug("Opening port before pre_upload prompt.") - self._show_instructions(radio, prompts.pre_upload) - - radio.set_pipe(ser) - - ct = clone.CloneThread(radio, "out", cb=self.cb_cloneout, parent=self) - ct.start() - - def do_close(self, tab_child=None): - if tab_child: - eset = tab_child - else: - eset = self.get_current_editorset() - - if not eset: - return False - - if eset.is_modified(): - buttons = (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, - gtk.STOCK_NO, gtk.RESPONSE_NO, - gtk.STOCK_YES, gtk.RESPONSE_YES) - dlg = miscwidgets.YesNoDialog( - title=_("Save Changes?"), parent=self, - buttons=buttons) - dlg.set_default_response(gtk.RESPONSE_YES) - dlg.set_alternative_button_order([gtk.RESPONSE_YES, - gtk.RESPONSE_NO, - gtk.RESPONSE_CANCEL]) - dlg.set_text(_("File is modified, save changes before closing?")) - res = dlg.run() - dlg.destroy() - - if res == gtk.RESPONSE_YES: - self.do_save(eset) - elif res != gtk.RESPONSE_NO: - raise ModifiedError() - - eset.rthread.stop() - eset.rthread.join() - - eset.prepare_close() - - if eset.radio.pipe: - eset.radio.pipe.close() - - if isinstance(eset.radio, chirp_common.LiveRadio): - action = self.menu_ag.get_action("openlive") - if action: - action.set_sensitive(True) - - page = self.tabs.page_num(eset) - if page is not None: - self.tabs.remove_page(page) - - return True - - def do_import(self): - types = [(_("All files") + " (*.*)", "*"), - (_("CHIRP Radio Images") + " (*.img)", "*.img"), - (_("CSV Files") + " (*.csv)", "*.csv"), - (_("DAT Files") + " (*.dat)", "*.dat"), - (_("EVE Files (VX5)") + " (*.eve)", "*.eve"), - (_("ICF Files") + " (*.icf)", "*.icf"), - (_("Kenwood HMK Files") + " (*.hmk)", "*.hmk"), - (_("Kenwood ITM Files") + " (*.itm)", "*.itm"), - (_("Travel Plus Files") + " (*.tpe)", "*.tpe"), - (_("VX5 Commander Files") + " (*.vx5)", "*.vx5"), - (_("VX6 Commander Files") + " (*.vx6)", "*.vx6"), - (_("VX7 Commander Files") + " (*.vx7)", "*.vx7")] - filen = platform.get_platform().gui_open_file(types=types) - if not filen: - return - - eset = self.get_current_editorset() - count = eset.do_import(filen) - reporting.report_model_usage(eset.rthread.radio, "import", count > 0) - - def do_clear_recently_opened(self): - self.clear_recent_files() - - def do_dmrmarc_prompt(self): - fields = {"1City": (gtk.Entry(), lambda x: x), - "2State": (gtk.Entry(), lambda x: x), - "3Country": (gtk.Entry(), lambda x: x), - } - - d = inputdialog.FieldDialog(title=_("DMR-MARC Repeater Database Dump"), - parent=self) - for k in sorted(fields.keys()): - d.add_field(k[1:], fields[k][0]) - fields[k][0].set_text(CONF.get(k[1:], "dmrmarc") or "") - - while d.run() == gtk.RESPONSE_OK: - for k in sorted(fields.keys()): - widget, validator = fields[k] - try: - if validator(widget.get_text()): - CONF.set(k[1:], widget.get_text(), "dmrmarc") - continue - except Exception: - pass - - d.destroy() - return True - - d.destroy() - return False - - def do_dmrmarc(self, do_import): - self.window.set_cursor(gtk.gdk.Cursor(gtk.gdk.WATCH)) - if not self.do_dmrmarc_prompt(): - self.window.set_cursor(None) - return - - city = CONF.get("city", "dmrmarc") - state = CONF.get("state", "dmrmarc") - country = CONF.get("country", "dmrmarc") - - # Do this in case the import process is going to take a while - # to make sure we process events leading up to this - gtk.gdk.window_process_all_updates() - while gtk.events_pending(): - gtk.main_iteration(False) - - if do_import: - eset = self.get_current_editorset() - dmrmarcstr = "dmrmarc://%s/%s/%s" % (city, state, country) - eset.do_import(dmrmarcstr) - else: - try: - from chirp import dmrmarc - radio = dmrmarc.DMRMARCRadio(None) - radio.set_params(city, state, country) - self.do_open_live(radio, read_only=True) - except errors.RadioError as e: - common.show_error(e) - - self.window.set_cursor(None) - - def do_repeaterbook_political_prompt(self): - if not CONF.get_bool("has_seen_credit", "repeaterbook"): - d = gtk.MessageDialog(parent=self, buttons=gtk.BUTTONS_OK) - d.set_markup("RepeaterBook\r\n" + - "North American Repeater Directory") - d.format_secondary_markup("For more information about this " + - "free service, please go to\r\n" + - "http://www.repeaterbook.com") - d.run() - d.destroy() - CONF.set_bool("has_seen_credit", True, "repeaterbook") - - default_state = "Oregon" - default_county = "--All--" - default_band = "--All--" - try: - try: - code = int(CONF.get("state", "repeaterbook")) - except: - code = CONF.get("state", "repeaterbook") - for k, v in fips.FIPS_STATES.items(): - if code == v: - default_state = k - break - - code = CONF.get("county", "repeaterbook") - items = fips.FIPS_COUNTIES[fips.FIPS_STATES[default_state]].items() - for k, v in items: - if code == v: - default_county = k - break - - code = int(CONF.get("band", "repeaterbook")) - for k, v in RB_BANDS.items(): - if code == v: - default_band = k - break - except: - pass - - state = miscwidgets.make_choice(sorted(fips.FIPS_STATES.keys()), - False, default_state) - county = miscwidgets.make_choice( - sorted(fips.FIPS_COUNTIES[fips.FIPS_STATES[default_state]].keys()), - False, default_county) - band = miscwidgets.make_choice(sorted(RB_BANDS.keys(), key=key_bands), - False, default_band) - - def _changed(box, state, county): - state = fips.FIPS_STATES[state.get_active_text()] - county.get_model().clear() - for fips_county in sorted(fips.FIPS_COUNTIES[state].keys()): - county.append_text(fips_county) - county.value = list(sorted(fips.FIPS_COUNTIES[state].keys()))[0] - - state.widget.connect("changed", _changed, state, county) - - d = inputdialog.FieldDialog(title=_("RepeaterBook Query"), parent=self) - d.add_field("State", state.widget) - d.add_field("County", county.widget) - d.add_field("Band", band.widget) - - r = d.run() - chose_state = state.get_active_text() - chose_county = county.get_active_text() - chose_band = band.get_active_text() - d.destroy() - if r != gtk.RESPONSE_OK: - return False - - code = fips.FIPS_STATES[chose_state] - county_id = fips.FIPS_COUNTIES[code][chose_county] - freq = RB_BANDS[chose_band] - CONF.set("state", str(code), "repeaterbook") - CONF.set("county", str(county_id), "repeaterbook") - CONF.set("band", str(freq), "repeaterbook") - - return True - - def do_repeaterbook_political(self, do_import): - self.window.set_cursor(gtk.gdk.Cursor(gtk.gdk.WATCH)) - if not self.do_repeaterbook_political_prompt(): - self.window.set_cursor(None) - return - - try: - code = "%02i" % int(CONF.get("state", "repeaterbook")) - except: - try: - code = CONF.get("state", "repeaterbook") - except: - code = '41' # Oregon default - - try: - county = CONF.get("county", "repeaterbook") - except: - county = '%' # --All-- default - - try: - band = int(CONF.get("band", "repeaterbook")) - except: - band = 14 # 2m default - - query = "http://chirp.danplanet.com/query/rb/1.0/chirp" + \ - "?func=default&state_id=%s&band=%s&freq=%%&band6=%%&loc=%%" + \ - "&county_id=%s&status_id=%%&features=%%&coverage=%%&use=%%" - query = query % (code, - band and band or "%%", - county and county or "%%") - - # Do this in case the import process is going to take a while - # to make sure we process events leading up to this - with compat.py3safe(): - gtk.gdk.window_process_all_updates() - while gtk.events_pending(): - gtk.main_iteration(False) - - fn = tempfile.mktemp(".csv") - try: - chirp_common.urlretrieve(query, fn) - except Exception as e: - LOG.error('Failed to fetch %s: %s' % (query, e)) - if not os.path.exists(fn): - common.show_error(_("RepeaterBook query failed")) - self.window.set_cursor(None) - return - - try: - # Validate CSV - radio = repeaterbook.RBRadio(fn) - if radio.errors: - reporting.report_misc_error("repeaterbook", - ("query=%s\n" % query) + - ("\n") + - ("\n".join(radio.errors))) - except errors.InvalidDataError as e: - common.show_error(str(e)) - self.window.set_cursor(None) - return - except Exception as e: - common.log_exception() - - reporting.report_model_usage(radio, "import", True) - - self.window.set_cursor(None) - if do_import: - eset = self.get_current_editorset() - count = eset.do_import(fn) - else: - self.do_open_live(radio, read_only=True) - - def do_repeaterbook_proximity_prompt(self): - default_band = "--All--" - try: - code = int(CONF.get("band", "repeaterbook")) - for k, v in RB_BANDS.items(): - if code == v: - default_band = k - break - except: - pass - fields = {"1Location": (gtk.Entry(), lambda x: x.get_text()), - "2Distance": (gtk.Entry(), lambda x: x.get_text()), - "3Band": (miscwidgets.make_choice( - sorted(RB_BANDS.keys(), key=key_bands), - False, default_band), - lambda x: RB_BANDS[x.get_active_text()]), - } - - d = inputdialog.FieldDialog(title=_("RepeaterBook Query"), - parent=self) - for k in sorted(fields.keys()): - widget = fields[k][0] - if isinstance(widget, miscwidgets.EditableChoiceBase): - widget = widget.widget - d.add_field(k[1:], widget) - if isinstance(fields[k][0], gtk.Entry): - fields[k][0].set_text( - CONF.get(k[1:].lower(), "repeaterbook") or "") - - while d.run() == gtk.RESPONSE_OK: - valid = True - for k, (widget, fn) in fields.items(): - try: - CONF.set(k[1:].lower(), str(fn(widget)), "repeaterbook") - continue - except: - pass - common.show_error("Invalid value for %s" % k[1:]) - valid = False - break - - if valid: - d.destroy() - return True - - d.destroy() - return False - - def do_repeaterbook_proximity(self, do_import): - self.window.set_cursor(gtk.gdk.Cursor(gtk.gdk.WATCH)) - if not self.do_repeaterbook_proximity_prompt(): - self.window.set_cursor(None) - return - - loc = CONF.get("location", "repeaterbook") - - try: - dist = int(CONF.get("distance", "repeaterbook")) - except: - dist = 20 - - try: - band = int(CONF.get("band", "repeaterbook")) or '%' - band = str(band) - except: - band = '%' - - query = "http://chirp.danplanet.com/query/rb/1.0/app_direct" \ - "?loc=%s&band=%s&dist=%s" % (loc, band, dist) - print(query) - - # Do this in case the import process is going to take a while - # to make sure we process events leading up to this - with compat.py3safe(): - gtk.gdk.window_process_all_updates() - while gtk.events_pending(): - gtk.main_iteration(False) - - fn = tempfile.mktemp(".csv") - try: - chirp_common.urlretrieve(query, fn) - except Exception as e: - LOG.error('Failed to fetch %s: %s' % (query, e)) - if not os.path.exists(fn): - common.show_error(_("RepeaterBook query failed")) - self.window.set_cursor(None) - return - - try: - # Validate CSV - radio = repeaterbook.RBRadio(fn) - if radio.errors: - reporting.report_misc_error("repeaterbook", - ("query=%s\n" % query) + - ("\n") + - ("\n".join(radio.errors))) - except errors.InvalidDataError as e: - common.show_error(str(e)) - self.window.set_cursor(None) - return - except Exception as e: - common.log_exception() - - reporting.report_model_usage(radio, "import", True) - - self.window.set_cursor(None) - if do_import: - eset = self.get_current_editorset() - count = eset.do_import(fn) - else: - self.do_open_live(radio, read_only=True) - - def do_przemienniki_prompt(self): - d = inputdialog.FieldDialog(title='przemienniki.net query', - parent=self) - fields = { - "Country": - (miscwidgets.make_choice( - ['at', 'bg', 'by', 'ch', 'cz', 'de', 'dk', 'es', 'fi', - 'fr', 'hu', 'it', 'lt', 'lv', 'no', 'pl', 'ro', 'se', - 'sk', 'ua', 'uk'], False), - lambda x: str(x.get_active_text())), - "Band": - (miscwidgets.make_choice(['10m', '4m', '6m', '2m', '70cm', - '23cm', '13cm', '3cm'], False, '2m'), - lambda x: str(x.get_active_text())), - "Mode": - (miscwidgets.make_choice(['fm', 'dv'], False), - lambda x: str(x.get_active_text())), - "Only Working": - (miscwidgets.make_choice(['', 'yes'], False), - lambda x: str(x.get_active_text())), - "Latitude": (gtk.Entry(), lambda x: float(x.get_text())), - "Longitude": (gtk.Entry(), lambda x: float(x.get_text())), - "Range": (gtk.Entry(), lambda x: int(x.get_text())), - } - for name in sorted(fields.keys()): - value, fn = fields[name] - d.add_field(name, value) - while d.run() == gtk.RESPONSE_OK: - query = "http://przemienniki.net/export/chirp.csv?" - args = [] - for name, (value, fn) in fields.items(): - if isinstance(value, gtk.Entry): - contents = value.get_text() - else: - contents = value.get_active_text() - if contents: - try: - _value = fn(value) - except ValueError: - common.show_error(_("Invalid value for %s") % name) - query = None - continue - - args.append("=".join((name.replace(" ", "").lower(), - contents))) - query += "&".join(args) - LOG.debug(query) - d.destroy() - return query - - d.destroy() - return query - - def do_przemienniki(self, do_import): - url = self.do_przemienniki_prompt() - if not url: - return - - fn = tempfile.mktemp(".csv") - try: - chirp_common.urlretrieve(url, fn) - except Exception as e: - LOG.error('Failed to fetch %s: %s' % (url, e)) - if not os.path.exists(fn): - common.show_error(_("Query failed")) - return - - class PRRadio(generic_csv.CSVRadio, - chirp_common.NetworkSourceRadio): - VENDOR = "przemienniki.net" - MODEL = "" - - try: - radio = PRRadio(fn) - except Exception as e: - common.show_error(str(e)) - return - - if do_import: - eset = self.get_current_editorset() - count = eset.do_import(fn) - else: - self.do_open_live(radio, read_only=True) - - def do_rfinder_prompt(self): - fields = {"1Email": (gtk.Entry(), lambda x: "@" in x), - "2Password": (gtk.Entry(), lambda x: x), - "3Latitude": (gtk.Entry(), - lambda x: float(x) < 90 and float(x) > -90), - "4Longitude": (gtk.Entry(), - lambda x: float(x) < 180 and float(x) > -180), - "5Range_in_Miles": (gtk.Entry(), - lambda x: int(x) > 0 and int(x) < 5000), - } - - d = inputdialog.FieldDialog(title="RFinder Login", parent=self) - for k in sorted(fields.keys()): - d.add_field(k[1:].replace("_", " "), fields[k][0]) - fields[k][0].set_text(CONF.get(k[1:], "rfinder") or "") - fields[k][0].set_visibility(k != "2Password") - - while d.run() == gtk.RESPONSE_OK: - valid = True - for k in sorted(fields.keys()): - widget, validator = fields[k] - try: - if validator(widget.get_text()): - CONF.set(k[1:], widget.get_text(), "rfinder") - continue - except Exception: - pass - common.show_error("Invalid value for %s" % k[1:]) - valid = False - break - - if valid: - d.destroy() - return True - - d.destroy() - return False - - def do_rfinder(self, do_import): - self.window.set_cursor(gtk.gdk.Cursor(gtk.gdk.WATCH)) - if not self.do_rfinder_prompt(): - self.window.set_cursor(None) - return - - lat = CONF.get_float("Latitude", "rfinder") - lon = CONF.get_float("Longitude", "rfinder") - passwd = CONF.get("Password", "rfinder") - email = CONF.get("Email", "rfinder") - miles = CONF.get_int("Range_in_Miles", "rfinder") - - # Do this in case the import process is going to take a while - # to make sure we process events leading up to this - gtk.gdk.window_process_all_updates() - while gtk.events_pending(): - gtk.main_iteration(False) - - if do_import: - eset = self.get_current_editorset() - rfstr = "rfinder://%s/%s/%f/%f/%i" % \ - (email, passwd, lat, lon, miles) - count = eset.do_import(rfstr) - else: - from chirp.drivers import rfinder - radio = rfinder.RFinderRadio(None) - radio.set_params((lat, lon), miles, email, passwd) - self.do_open_live(radio, read_only=True) - - self.window.set_cursor(None) - - def do_radioreference_prompt(self): - fields = {"1Username": (gtk.Entry(), lambda x: x), - "2Password": (gtk.Entry(), lambda x: x), - "3Zipcode": (gtk.Entry(), lambda x: x), - } - - d = inputdialog.FieldDialog(title=_("RadioReference.com Query"), - parent=self) - for k in sorted(fields.keys()): - d.add_field(k[1:], fields[k][0]) - fields[k][0].set_text(CONF.get(k[1:], "radioreference") or "") - fields[k][0].set_visibility(k != "2Password") - - while d.run() == gtk.RESPONSE_OK: - valid = True - for k in sorted(fields.keys()): - widget, validator = fields[k] - try: - if validator(widget.get_text()): - CONF.set(k[1:], widget.get_text(), "radioreference") - continue - except Exception: - pass - common.show_error("Invalid value for %s" % k[1:]) - valid = False - break - - if valid: - d.destroy() - return True - - d.destroy() - return False - - def do_radioreference(self, do_import): - self.window.set_cursor(gtk.gdk.Cursor(gtk.gdk.WATCH)) - if not self.do_radioreference_prompt(): - self.window.set_cursor(None) - return - - username = CONF.get("Username", "radioreference") - passwd = CONF.get("Password", "radioreference") - zipcode = CONF.get("Zipcode", "radioreference") - - # Do this in case the import process is going to take a while - # to make sure we process events leading up to this - gtk.gdk.window_process_all_updates() - while gtk.events_pending(): - gtk.main_iteration(False) - - if do_import: - eset = self.get_current_editorset() - rrstr = "radioreference://%s/%s/%s/%s" % (zipcode, username, - passwd, 'US') - count = eset.do_import(rrstr) - else: - try: - from chirp import radioreference - radio = radioreference.RadioReferenceRadio(None) - radio.set_params(zipcode, username, passwd, 'US') - self.do_open_live(radio, read_only=True) - except errors.RadioError, e: - common.show_error(e) - - self.window.set_cursor(None) - - def do_radioreference_promptcanada(self): - fields = {"1Username": (gtk.Entry(), lambda x: x), - "2Password": (gtk.Entry(), lambda x: x) - } - - d = inputdialog.FieldDialog(title=_("RadioReference.com Query"), - parent=self) - for k in sorted(fields.keys()): - d.add_field(k[1:], fields[k][0]) - fields[k][0].set_text(CONF.get(k[1:], "radioreference") or "") - fields[k][0].set_visibility(k != "2Password") - - while d.run() == gtk.RESPONSE_OK: - valid = True - for k in sorted(fields.keys()): - widget, validator = fields[k] - try: - if validator(widget.get_text()): - CONF.set(k[1:], widget.get_text(), "radioreference") - continue - except Exception: - pass - common.show_error("Invalid value for %s" % k[1:]) - valid = False - break - - if valid: - d.destroy() - return True - - d.destroy() - return False - - def do_radioreference_promptcounty(self, username, passwd): - """gotta get the fkn province list (they do change sometimes) - and the absurd arbitrary county list - """ - from chirp import radioreference - provincecounty = radioreference.RadioReferenceRadio(None) - provincecounty.set_params(None, username, passwd, None) - cancounties = provincecounty.do_getcanadacounties() - clist = cancounties[0] - provinces = cancounties[1] - default_prov = "" - default_county = "" - try: - code = int(CONF.get("province", "radioreference")) - for k, v in provinces.items(): - if code == v: - default_prov = k - break - code = int(CONF.get("county", "radioreference")) - for row in clist: - if code == row[2]: - default_county = row[3] - break - except: - pass - province = miscwidgets.make_choice(sorted(provinces.keys()), - False, default_prov) - counties = [] - for x in clist: - if x[1] == default_prov: - counties.append(x[3]) - county = miscwidgets.make_choice(counties, False, default_county) - - def _changed(box, county): - selectedprov = provinces[box.get_active_text()] - county.get_model().clear() - for list_county in clist: - if list_county[0] == selectedprov: - county.append_text(list_county[3]) - county.set_active(0) - province.connect("changed", _changed, county) - - d = inputdialog.FieldDialog( - title=_("RadioReference.com Province Query"), parent=self) - d.add_field("Province", province) - d.add_field("Region/City", county) - r = d.run() - d.destroy() - if r != gtk.RESPONSE_OK: - return False - - code = provinces[province.get_active_text()] - for row in clist: # this is absolutely not the right way to do this! - if row[3] == county.get_active_text() and \ - row[1] == province.get_active_text(): - county_id = row[2] - CONF.set("province", str(code), "radioreference") - CONF.set("county", str(county_id), "radioreference") - - return True - - def do_radioreferencecanada(self, do_import): - self.window.set_cursor(gtk.gdk.Cursor(gtk.gdk.WATCH)) - if not self.do_radioreference_promptcanada(): - self.window.set_cursor(None) - return - username = CONF.get("Username", "radioreference") - passwd = CONF.get("Password", "radioreference") - - self.window.set_cursor(gtk.gdk.Cursor(gtk.gdk.WATCH)) - if not self.do_radioreference_promptcounty(username, passwd): - self.window.set_cursor(None) - return - county = CONF.get("County", "radioreference") - - # Do this in case the import process is going to take a while - # to make sure we process events leading up to this - gtk.gdk.window_process_all_updates() - while gtk.events_pending(): - gtk.main_iteration(False) - - if do_import: - eset = self.get_current_editorset() - rrstr = "radioreference://%s/%s/%s/%s" % (county, username, - passwd, 'CA') - count = eset.do_import(rrstr) - else: - try: - from chirp import radioreference - radio = radioreference.RadioReferenceRadio(None) - radio.set_params(county, username, passwd, 'CA') - self.do_open_live(radio, read_only=True) - except errors.RadioError as e: - common.show_error(e) - - self.window.set_cursor(None) - - def do_export(self): - types = [(_("CSV Files") + " (*.csv)", "csv"), - ] - - eset = self.get_current_editorset() - - if os.path.exists(eset.filename): - base = os.path.basename(eset.filename) - if "." in base: - base = base[:base.rindex(".")] - defname = base - else: - defname = "radio" - - filen = platform.get_platform().gui_save_file(default_name=defname, - types=types) - if not filen: - return - - if os.path.exists(filen): - dlg = inputdialog.OverwriteDialog(filen) - owrite = dlg.run() - dlg.destroy() - if owrite != gtk.RESPONSE_OK: - return - os.remove(filen) - - count = eset.do_export(filen) - reporting.report_model_usage(eset.rthread.radio, "export", count > 0) - - def do_about(self): - d = gtk.AboutDialog() - d.set_transient_for(self) - import sys - verinfo = "GTK %s\nPyGTK %s\nPython %s\n" % ( - ".".join([str(x) for x in gtk.gtk_version]), - ".".join([str(x) for x in gtk.pygtk_version]), - sys.version.split()[0]) - - # Set url hook to handle user activating a URL link in the about dialog - with compat.py3safe(): - gtk.about_dialog_set_url_hook( - lambda dlg, url: webbrowser.open(url)) - - d.set_name("CHIRP") - d.set_version(CHIRP_VERSION) - d.set_copyright("Copyright 2019 CHIRP Software LLC") - d.set_website("http://chirp.danplanet.com") - d.set_translator_credits("Polish: Grzegorz SQ2RBY" + - os.linesep + - "Italian: Fabio IZ2QDH" + - os.linesep + - "Dutch: Michael PD4MT" + - os.linesep + - "German: Benjamin HB9EUK" + - os.linesep + - "Hungarian: Attila HA5JA" + - os.linesep + - "Russian: Dmitry Slukin" + - os.linesep + - "Portuguese (BR): Crezivando PP7CJ" + - os.linesep + - "Chinese (Simplified): DuckSoft BH2UEP") - d.set_comments(verinfo) - - d.run() - d.destroy() - - def do_gethelp(self): - webbrowser.open("http://chirp.danplanet.com") - - def do_columns(self): - eset = self.get_current_editorset() - driver = directory.get_driver(eset.rthread.radio.__class__) - radio_name = "%s %s %s" % (eset.rthread.radio.VENDOR, - eset.rthread.radio.MODEL, - eset.rthread.radio.VARIANT) - buttons = (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, - gtk.STOCK_OK, gtk.RESPONSE_OK) - d = gtk.Dialog(title=_("Select Columns"), - parent=self, - buttons=buttons) - d.set_default_response(gtk.RESPONSE_OK) - d.set_alternative_button_order([gtk.RESPONSE_OK, - gtk.RESPONSE_CANCEL]) - - vbox = gtk.VBox() - vbox.show() - sw = gtk.ScrolledWindow() - sw.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC) - sw.add_with_viewport(vbox) - sw.show() - d.vbox.pack_start(sw, 1, 1, 1) - d.set_size_request(-1, 300) - d.set_resizable(False) - - labelstr = _("Visible columns for {radio}").format(radio=radio_name) - label = gtk.Label(labelstr) - label.show() - vbox.pack_start(label) - - fields = [] - memedit = eset.get_current_editor() # .editors["memedit"] - unsupported = memedit.get_unsupported_columns() - for colspec in memedit.cols: - if colspec[0].startswith("_"): - continue - elif colspec[0] in unsupported: - continue - label = colspec[0] - visible = memedit.get_column_visible(memedit.col(label)) - widget = gtk.CheckButton(label) - widget.set_active(visible) - fields.append(widget) - vbox.pack_start(widget, 1, 1, 1) - widget.show() - - res = d.run() - selected_columns = [] - if res == gtk.RESPONSE_OK: - for widget in fields: - colnum = memedit.col(widget.get_label()) - memedit.set_column_visible(colnum, widget.get_active()) - if widget.get_active(): - selected_columns.append(widget.get_label()) - - d.destroy() - - CONF.set(driver, ",".join(selected_columns), "memedit_columns") - - def do_hide_unused(self, action): - eset = self.get_current_editorset() - if eset is None: - conf = config.get("memedit") - conf.set_bool("hide_unused", action.get_active()) - else: - for editortype, editor in eset.editors.iteritems(): - if "memedit" in editortype: - editor.set_hide_unused(action.get_active()) - - def do_clearq(self): - eset = self.get_current_editorset() - eset.rthread.flush() - - def do_copy(self, cut): - eset = self.get_current_editorset() - eset.get_current_editor().copy_selection(cut) - - def do_paste(self): - eset = self.get_current_editorset() - eset.get_current_editor().paste_selection() - - def do_delete(self): - eset = self.get_current_editorset() - eset.get_current_editor().copy_selection(True) - - def do_toggle_report(self, action): - if not action.get_active(): - d = gtk.MessageDialog(buttons=gtk.BUTTONS_YES_NO, parent=self) - markup = "" + _("Reporting is disabled") + "" - d.set_markup(markup) - msg = _("The reporting feature of CHIRP is designed to help " - "improve quality by allowing the authors to focus " - "on the radio drivers used most often and errors " - "experienced by the users. The reports contain no " - "identifying information and are used only for " - "statistical purposes by the authors. Your privacy is " - "extremely important, but please consider leaving " - "this feature enabled to help make CHIRP better!\n\n" - "Are you sure you want to disable this feature?") - d.format_secondary_markup(msg.replace("\n", "\r\n")) - r = d.run() - d.destroy() - if r == gtk.RESPONSE_NO: - action.set_active(not action.get_active()) - - conf = config.get() - conf.set_bool("no_report", not action.get_active()) - - def do_toggle_no_smart_tmode(self, action): - CONF.set_bool("no_smart_tmode", not action.get_active(), "memedit") - - def do_toggle_developer(self, action): - conf = config.get() - conf.set_bool("developer", action.get_active(), "state") - - for name in ["viewdeveloper", "loadmod"]: - devaction = self.menu_ag.get_action(name) - devaction.set_visible(action.get_active()) - - def do_toggle_clone_information(self, action): - CONF.set_bool("clone_information", - not action.get_active(), "noconfirm") - - def do_toggle_clone_instructions(self, action): - CONF.set_bool("clone_instructions", - not action.get_active(), "noconfirm") - - def do_change_language(self): - langs = ["Auto", "English", "Polish", "Italian", "Dutch", "German", - "Hungarian", "Russian", "Portuguese (BR)", "French", - "Spanish", 'Chinese (Simplified)', 'Ukrainian', 'Turkish'] - d = inputdialog.ChoiceDialog(langs, parent=self, - title="Choose Language") - d.label.set_text(_("Choose a language or Auto to use the " - "operating system default. You will need to " - "restart the application before the change " - "will take effect")) - d.label.set_line_wrap(True) - r = d.run() - if r == gtk.RESPONSE_OK: - LOG.debug("Chose language %s" % d.choice.get_active_text()) - conf = config.get() - conf.set("language", d.choice.get_active_text(), "state") - d.destroy() - - def load_module(self, filen=None): - types = [(_("Python Modules") + " *.py", "*.py"), - (_("Modules") + " *.mod", "*.mod")] - - if filen is None: - filen = platform.get_platform().gui_open_file(types=types) - if not filen: - return - - # We're in development mode, so we need to tell the directory to - # allow a loaded module to override an existing driver, against - # its normal better judgement - directory.enable_reregistrations() - - self.modify_bg(gtk.STATE_NORMAL, gtk.gdk.Color('#ea6262')) - - try: - with file(filen) as module: - code = module.read() - pyc = compile(code, filen, 'exec') - # See this for why: - # http://stackoverflow.com/questions/2904274/globals-and-locals-in-python-exec - exec(pyc, globals(), globals()) - except Exception as e: - common.log_exception() - common.show_error("Unable to load module: %s" % e) - - def mh(self, _action, *args): - action = _action.get_name() - - if action == "quit": - gtk.main_quit() - elif action == "new": - self.do_new() - elif action == "open": - self.do_open() - elif action == "save": - self.do_save() - elif action == "saveas": - self.do_saveas() - elif action.startswith("download"): - self.do_download(*args) - elif action.startswith("upload"): - self.do_upload(*args) - elif action == "close": - self.do_close() - elif action == "import": - self.do_import() - elif action == "clearrecent": - self.do_clear_recently_opened() - elif action in ["qdmrmarc", "idmrmarc"]: - self.do_dmrmarc(action[0] == "i") - elif action in ["qrfinder", "irfinder"]: - self.do_rfinder(action[0] == "i") - elif action in ["qradioreference", "iradioreference"]: - self.do_radioreference(action[0] == "i") - elif action in ["qradioreferencecanada", "iradioreferencecanada"]: - self.do_radioreferencecanada(action[0] == "i") - elif action == "export": - self.do_export() - elif action in ["qrbookpolitical", "irbookpolitical"]: - self.do_repeaterbook_political(action[0] == "i") - elif action in ["qrbookproximity", "irbookproximity"]: - self.do_repeaterbook_proximity(action[0] == "i") - elif action in ["qpr", "ipr"]: - self.do_przemienniki(action[0] == "i") - elif action == "about": - self.do_about() - elif action == "gethelp": - self.do_gethelp() - elif action == "columns": - self.do_columns() - elif action == "hide_unused": - self.do_hide_unused(_action) - elif action == "cancelq": - self.do_clearq() - elif action == "report": - self.do_toggle_report(_action) - elif action == "channel_defaults": - # The memedit thread also has an instance of bandplans. - bp = bandplan.BandPlans(CONF) - bandplans.select_bandplan(bp) - elif action == "no_smart_tmode": - self.do_toggle_no_smart_tmode(_action) - elif action == "developer": - self.do_toggle_developer(_action) - elif action == "clone_information": - self.do_toggle_clone_information(_action) - elif action == "clone_instructions": - self.do_toggle_clone_instructions(_action) - elif action in ["cut", "copy", "paste", "delete", - "move_up", "move_dn", "exchange", "all", - "devshowraw", "devdiffraw", "properties"]: - self.get_current_editorset().get_current_editor().hotkey(_action) - elif action == "devdifftab": - self.do_diff_radio() - elif action == "language": - self.do_change_language() - elif action == "loadmod": - self.load_module() - else: - return - - self.ev_tab_switched() - - def make_menubar(self): - menu_xml = """ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -""" - ALT_KEY = "" - CTRL_KEY = "" - if sys.platform == 'darwin': - ALT_KEY = "" - CTRL_KEY = "" - actions = [ - ('file', None, _("_File"), None, None, self.mh), - ('new', gtk.STOCK_NEW, None, None, None, self.mh), - ('open', gtk.STOCK_OPEN, None, None, None, self.mh), - ('openstock', None, _("Open Stock Config"), None, None, self.mh), - ('recent', None, _("Open _Recent"), None, None, self.mh), - ('clearrecent', None, _("Clear Recently Opened"), None, None, - self.mh), - ('save', gtk.STOCK_SAVE, None, None, None, self.mh), - ('saveas', gtk.STOCK_SAVE_AS, None, None, None, self.mh), - ('loadmod', None, _("Load Module"), None, None, self.mh), - ('close', gtk.STOCK_CLOSE, None, None, None, self.mh), - ('quit', gtk.STOCK_QUIT, None, None, None, self.mh), - ('edit', None, _("_Edit"), None, None, self.mh), - ('cut', None, _("_Cut"), "%sx" % CTRL_KEY, None, self.mh), - ('copy', None, _("_Copy"), "%sc" % CTRL_KEY, None, self.mh), - ('paste', None, _("_Paste"), - "%sv" % CTRL_KEY, None, self.mh), - ('delete', None, _("_Delete"), "Delete", None, self.mh), - ('all', None, _("Select _All"), None, None, self.mh), - ('move_up', None, _("Move _Up"), - "%sUp" % CTRL_KEY, None, self.mh), - ('move_dn', None, _("Move Dow_n"), - "%sDown" % CTRL_KEY, None, self.mh), - ('exchange', None, _("E_xchange"), - "%sx" % CTRL_KEY, None, self.mh), - ('properties', None, _("P_roperties"), None, None, self.mh), - ('view', None, _("_View"), None, None, self.mh), - ('columns', None, _("Columns"), None, None, self.mh), - ('viewdeveloper', None, _("Developer"), None, None, self.mh), - ('devshowraw', None, _('Show Raw Memory'), - "%sr" % CTRL_KEY, None, self.mh), - ('devdiffraw', None, _("Diff Raw Memories"), - "%sd" % CTRL_KEY, None, self.mh), - ('devdifftab', None, _("Diff Tabs"), - "%st" % CTRL_KEY, None, self.mh), - ('language', None, _("Change Language"), None, None, self.mh), - ('radio', None, _("_Radio"), None, None, self.mh), - ('download', None, _("Download From Radio"), - "%sd" % ALT_KEY, None, self.mh), - ('upload', None, _("Upload To Radio"), - "%su" % ALT_KEY, None, self.mh), - ('import', None, _("Import"), "%si" % ALT_KEY, None, self.mh), - ('export', None, _("Export"), "%se" % ALT_KEY, None, self.mh), - ('importsrc', None, _("Import From Data Source"), - None, None, self.mh), - ('idmrmarc', None, _("DMR-MARC Repeaters"), None, None, self.mh), - ('iradioref', None, _("RadioReference"), None, None, self.mh), - ('iradioreference', None, _("RadioReference.com US"), - None, None, self.mh), - ('iradioreferencecanada', None, _("RadioReference.com Canada"), - None, None, self.mh), - ('irfinder', None, _("RFinder"), None, None, self.mh), - ('irbook', None, _("RepeaterBook"), None, None, self.mh), - ('irbookpolitical', None, _("RepeaterBook Political Query"), None, - None, self.mh), - ('irbookproximity', None, _("RepeaterBook Proximity Query"), None, - None, self.mh), - ('ipr', None, _("przemienniki.net"), None, None, self.mh), - ('querysrc', None, _("Query Data Source"), None, None, self.mh), - ('qdmrmarc', None, _("DMR-MARC Repeaters"), None, None, self.mh), - ('qradioref', None, _("RadioReference"), None, None, self.mh), - ('qradioreference', None, _("RadioReference.com US"), - None, None, self.mh), - ('qradioreferencecanada', None, _("RadioReference.com Canada"), - None, None, self.mh), - ('qrfinder', None, _("RFinder"), None, None, self.mh), - ('qpr', None, _("przemienniki.net"), None, None, self.mh), - ('qrbook', None, _("RepeaterBook"), None, None, self.mh), - ('qrbookpolitical', None, _("RepeaterBook Political Query"), None, - None, self.mh), - ('qrbookproximity', None, _("RepeaterBook Proximity Query"), None, - None, self.mh), - ('export_chirp', None, _("CHIRP Native File"), - None, None, self.mh), - ('export_csv', None, _("CSV File"), None, None, self.mh), - ('stock', None, _("Import From Stock Config"), - None, None, self.mh), - ('channel_defaults', None, _("Channel Defaults"), - None, None, self.mh), - ('cancelq', gtk.STOCK_STOP, None, "Escape", None, self.mh), - ('help', None, _('Help'), None, None, self.mh), - ('about', gtk.STOCK_ABOUT, None, None, None, self.mh), - ('gethelp', None, _("Get Help Online..."), None, None, self.mh), - ] - - conf = config.get() - re = not conf.get_bool("no_report") - hu = conf.get_bool("hide_unused", "memedit", default=True) - dv = conf.get_bool("developer", "state") - cf = not conf.get_bool("clone_information", "noconfirm") - ci = not conf.get_bool("clone_instructions", "noconfirm") - st = not conf.get_bool("no_smart_tmode", "memedit") - - toggles = [('report', None, _("Report Statistics"), - None, None, self.mh, re), - ('hide_unused', None, _("Hide Unused Fields"), - None, None, self.mh, hu), - ('no_smart_tmode', None, _("Smart Tone Modes"), - None, None, self.mh, st), - ('clone_information', None, _("Show Information"), - None, None, self.mh, cf), - ('clone_instructions', None, _("Show Instructions"), - None, None, self.mh, ci), - ('developer', None, _("Enable Developer Functions"), - None, None, self.mh, dv), - ] - - self.menu_uim = gtk.UIManager() - self.menu_ag = gtk.ActionGroup("MenuBar") - self.menu_ag.add_actions(actions) - self.menu_ag.add_toggle_actions(toggles) - - self.menu_uim.insert_action_group(self.menu_ag, 0) - self.menu_uim.add_ui_from_string(menu_xml) - - self.add_accel_group(self.menu_uim.get_accel_group()) - - self.recentmenu = self.menu_uim.get_widget( - "/MenuBar/file/recent") - - self.infomenu = self.menu_uim.get_widget( - "/MenuBar/help/clone_information") - - self.clonemenu = self.menu_uim.get_widget( - "/MenuBar/help/clone_instructions") - - # Initialize - self.do_toggle_developer(self.menu_ag.get_action("developer")) - self.recentmenu.connect("activate", - lambda a: self.update_recent_files()) - - return self.menu_uim.get_widget("/MenuBar") - - def make_tabs(self): - self.tabs = gtk.Notebook() - self.tabs.set_scrollable(True) - - return self.tabs - - def close_out(self): - num = self.tabs.get_n_pages() - while num > 0: - num -= 1 - LOG.debug("Closing %i" % num) - try: - self.do_close(self.tabs.get_nth_page(num)) - except ModifiedError: - return False - - gtk.main_quit() - - return True - - def make_status_bar(self): - box = gtk.HBox(False, 2) - - self.sb_general = gtk.Statusbar() - self.sb_general.show() - box.pack_start(self.sb_general, 1, 1, 1) - - self.sb_radio = gtk.Statusbar() - self.sb_radio.show() - box.pack_start(self.sb_radio, 1, 1, 1) - - with compat.py3safe(quiet=True): - # Gtk2 had resize grips on the status bars, so remove them - # if we can - self.sb_general.set_has_resize_grip(False) - self.sb_radio.set_has_resize_grip(True) - - box.show() - return box - - def ev_delete(self, window, event): - if not self.close_out(): - return True # Don't exit - - def ev_destroy(self, window): - if not self.close_out(): - return True # Don't exit - - def setup_extra_hotkeys(self): - accelg = self.menu_uim.get_accel_group() - - def memedit(a): - self.get_current_editorset().editors["memedit"].hotkey(a) - - actions = [ - # ("action_name", "key", function) - ] - - for name, key, fn in actions: - a = gtk.Action(name, name, name, "") - a.connect("activate", fn) - self.menu_ag.add_action_with_accel(a, key) - a.set_accel_group(accelg) - a.connect_accelerator() - - def _set_icon(self): - this_platform = platform.get_platform() - path = (this_platform.find_resource("chirp.png") or - this_platform.find_resource(os.path.join("pixmaps", - "chirp.png"))) - if os.path.exists(path): - self.set_icon_from_file(path) - else: - LOG.warn("Icon %s not found" % path) - - def _updates(self, version): - if not version: - return - - if version == CHIRP_VERSION: - return - - LOG.info("Server reports version %s is available" % version) - - # Report new updates every three days - intv = 3600 * 24 * 3 - - if CONF.is_defined("last_update_check", "state") and \ - (time.time() - CONF.get_int("last_update_check", "state")) < intv: - return - - CONF.set_int("last_update_check", int(time.time()), "state") - d = gtk.MessageDialog(buttons=gtk.BUTTONS_OK_CANCEL, parent=self, - type=gtk.MESSAGE_INFO) - d.label.set_markup( - _('A new version of CHIRP is available: ' + - '{ver}. '.format(ver=version) + - 'It is recommended that you upgrade as soon as possible. ' - 'Please go to: \r\n\r\n' + - 'http://chirp.danplanet.com')) - response = d.run() - d.destroy() - if response == gtk.RESPONSE_OK: - webbrowser.open('http://chirp.danplanet.com/' - 'projects/chirp/wiki/Download') - - def _init_macos(self, menu_bar): - macapp = None - - # for KK7DS runtime <= R10 - try: - import gtk_osxapplication - macapp = gtk_osxapplication.OSXApplication() - except ImportError as e: - pass - - # for gtk-mac-integration >= 2.0.7 - try: - import gtkosx_application - macapp = gtkosx_application.Application() - except ImportError as e: - pass - - # for gtk-mac-integration 2.1.3 in brew - try: - from gi.repository import GtkosxApplication - macapp = GtkosxApplication.Application() - except ImportError: - pass - - if macapp is None: - LOG.error("No MacOS support") - return - - this_platform = platform.get_platform() - icon = (this_platform.find_resource("chirp.png") or - this_platform.find_resource(os.path.join("pixmaps", - "chirp.png"))) - if os.path.exists(icon): - icon_pixmap = gtk.gdk.pixbuf_new_from_file(icon) - macapp.set_dock_icon_pixbuf(icon_pixmap) - - menu_bar.hide() - macapp.set_menu_bar(menu_bar) - - quititem = self.menu_uim.get_widget("/MenuBar/file/quit") - quititem.hide() - - aboutitem = self.menu_uim.get_widget("/MenuBar/help/about") - macapp.insert_app_menu_item(aboutitem, 0) - - documentationitem = self.menu_uim.get_widget("/MenuBar/help/gethelp") - macapp.insert_app_menu_item(documentationitem, 0) - - macapp.set_use_quartz_accelerators(False) - macapp.ready() - - LOG.debug("Initialized MacOS support") - - def __init__(self, *args, **kwargs): - gtk.Window.__init__(self, *args, **kwargs) - - def expose(window, event=None): - allocation = window.get_allocation() - CONF.set_int("window_w", allocation.width, "state") - CONF.set_int("window_h", allocation.height, "state") - - with compat.py3safe(quiet=True): - # GTK3 does not have 'expose_event' and I am not sure which - # is a suitable replacement. We only need this to save window - # size in the config, so don't warn about it. - self.connect("expose_event", expose) - - def state_change(window, event): - CONF.set_bool( - "window_maximized", - event.new_window_state == gtk.gdk.WINDOW_STATE_MAXIMIZED, - "state") - self.connect("window-state-event", state_change) - - d = CONF.get("last_dir", "state") - if d and os.path.isdir(d): - platform.get_platform().set_last_dir(d) - - vbox = gtk.VBox(False, 2) - - self.menu_ag = None - mbar = self.make_menubar() - - if os.name != "nt": - self._set_icon() # Windows gets the icon from the exe - if os.uname()[0] == "Darwin": - self._init_macos(mbar) - - vbox.pack_start(mbar, 0, 0, 0) - - self.tabs = None - tabs = self.make_tabs() - tabs.connect("switch-page", lambda n, _, p: self.ev_tab_switched(p)) - tabs.connect("page-removed", lambda *a: self.ev_tab_switched()) - tabs.show() - self.ev_tab_switched() - vbox.pack_start(tabs, 1, 1, 1) - - vbox.pack_start(self.make_status_bar(), 0, 0, 0) - - vbox.show() - - self.add(vbox) - - try: - width = CONF.get_int("window_w", "state") - height = CONF.get_int("window_h", "state") - except Exception: - width = 800 - height = 600 - - self.set_default_size(width, height) - if CONF.get_bool("window_maximized", "state"): - self.maximize() - self.set_title("CHIRP") - - self.connect("delete_event", self.ev_delete) - self.connect("destroy", self.ev_destroy) - - if not CONF.get_bool("warned_about_reporting") and \ - not CONF.get_bool("no_report"): - d = gtk.MessageDialog(buttons=gtk.BUTTONS_OK, parent=self) - d.set_markup("" + - _("Error reporting is enabled") + - "") - d.format_secondary_markup( - _("If you wish to disable this feature you may do so in " - "the Help menu")) - d.run() - d.destroy() - CONF.set_bool("warned_about_reporting", True) - - self.recent_files = None - self.update_recent_files() - try: - self.update_stock_configs() - except UnicodeDecodeError: - LOG.exception('We hit bug #272 while working with unicode paths. ' - 'Not copying stock configs so we can continue ' - 'startup.') - self.setup_extra_hotkeys() - - def updates_callback(ver): - gobject.idle_add(self._updates, ver) - - if not CONF.get_bool("skip_update_check", "state"): - reporting.check_for_updates(updates_callback) diff --git a/chirp/ui/memdetail.py b/chirp/ui/memdetail.py deleted file mode 100644 index abbe8c4..0000000 --- a/chirp/ui/memdetail.py +++ /dev/null @@ -1,449 +0,0 @@ -# Copyright 2012 Dan Smith -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -import gtk -import os -import logging - -from chirp import chirp_common, settings -from chirp.ui import miscwidgets, common -from chirp.ui import compat - -LOG = logging.getLogger(__name__) - -POL = ["NN", "NR", "RN", "RR"] - - -class ValueEditor: - """Base class""" - def __init__(self, features, memory, errfn, name, data=None): - self._features = features - self._memory = memory - self._errfn = errfn - self._name = name - self._widget = None - self._init(data) - - def _init(self, data): - """Type-specific initialization""" - - def set_sensitive(self, sensitive): - self._widget.set_sensitive(sensitive) - - def get_widget(self): - """Returns the widget associated with this editor""" - return self._widget - - def _mem_value(self): - """Returns the raw value from the memory associated with this name""" - if self._name.startswith("extra_"): - return self._memory.extra[self._name.split("_", 1)[1]].value - else: - return getattr(self._memory, self._name) - - def _get_value(self): - """Returns the value from the widget that - should be set in the memory""" - - def update(self): - """Updates the memory object with self._getvalue()""" - - try: - newval = self._get_value() - except ValueError as e: - self._errfn(self._name, str(e)) - return str(e) - - if self._name.startswith("extra_"): - try: - extra_name = self._name.split("_", 1)[1] - LOG.debug('Setting extra %s=%r' % (extra_name, newval)) - self._memory.extra[extra_name].value = newval - except settings.InternalError as e: - self._errfn(self._name, str(e)) - return str(e) - else: - try: - setattr(self._memory, self._name, newval) - except chirp_common.ImmutableValueError as e: - if getattr(self._memory, self._name) != self._get_value(): - self._errfn(self._name, str(e)) - return str(e) - except ValueError as e: - self._errfn(self._name, str(e)) - return str(e) - - all_msgs = self._features.validate_memory(self._memory) - errs = [] - for msg in all_msgs: - if isinstance(msg, chirp_common.ValidationError): - errs.append(str(msg)) - if errs: - self._errfn(self._name, errs) - else: - self._errfn(self._name, None) - - -class StringEditor(ValueEditor): - def _init(self, data): - try: - self._widget = gtk.Entry(int(data)) - except TypeError: - self._widget = gtk.Entry() - self._widget.set_max_length(int(data)) - self._widget.set_text(str(self._mem_value())) - self._widget.connect("changed", self.changed) - - def _get_value(self): - return self._widget.get_text() - - def changed(self, _widget): - self.update() - - -class IntegerEditor(ValueEditor): - def _init(self, data): - self._widget = gtk.SpinButton() - adj = self._widget.get_adjustment() - adj.configure(data.get_value(), - data.get_min(), data.get_max(), - data.get_step(), 1, 0) - self._widget.connect('value-changed', self.changed) - - def changed(self, _widget): - self.update() - - def _get_value(self): - return int(self._widget.get_value()) - - -class ChoiceEditor(ValueEditor): - def _init(self, data): - self._choice = miscwidgets.make_choice([str(x) for x in data], - False, - str(self._mem_value())) - self._widget = self._choice.widget - - self._widget.connect("changed", self.changed) - - def _get_value(self): - return self._choice.value - - def changed(self, _widget): - self.update() - - -class PowerChoiceEditor(ChoiceEditor): - def _init(self, data): - self._choices = data - ChoiceEditor._init(self, data) - - def _get_value(self): - choice = self._widget.get_active_text() - for level in self._choices: - if str(level) == choice: - return level - raise Exception("Internal error: power level went missing") - - -class IntChoiceEditor(ChoiceEditor): - def _get_value(self): - return int(self._widget.get_active_text()) - - -class FloatChoiceEditor(ChoiceEditor): - def _get_value(self): - return float(self._widget.get_active_text()) - - -class FreqEditor(StringEditor): - def _init(self, data): - StringEditor._init(self, 0) - - def _mem_value(self): - return chirp_common.format_freq(StringEditor._mem_value(self)) - - def _get_value(self): - return chirp_common.parse_freq(self._widget.get_text()) - - -class BooleanEditor(ValueEditor): - def _init(self, data): - self._widget = gtk.CheckButton("Enabled") - self._widget.set_active(self._mem_value()) - self._widget.connect("toggled", self.toggled) - - def _get_value(self): - return self._widget.get_active() - - def toggled(self, _widget): - self.update() - - -class OffsetEditor(FreqEditor): - pass - - -class MemoryDetailEditor(gtk.Dialog): - """Detail editor for a memory""" - - def _add(self, tab, row, name, editor, text, colindex=0): - label = gtk.Label(text + ":") - label.set_alignment(1.0, 0.5) - label.show() - tab.attach(label, colindex, colindex + 1, row, row + 1, - xoptions=gtk.FILL, yoptions=0, xpadding=6, ypadding=3) - - widget = editor.get_widget() - widget.show() - tab.attach(widget, colindex + 1, colindex + 2, row, row + 1, - xoptions=gtk.FILL, yoptions=0, xpadding=3, ypadding=3) - - img = gtk.Image() - img.set_size_request(16, -1) - img.show() - tab.attach(img, colindex + 2, colindex + 3, row, row + 1, - xoptions=gtk.FILL, yoptions=0, xpadding=3, ypadding=3) - - self._editors[name] = label, editor, img - return label, editor, img - - def _set_doc(self, name, doc): - label, editor, _img = self._editors[name] - self._tips.set_tip(label, doc) - - def _make_ui(self): - - box = gtk.VBox() - box.show() - - notebook = gtk.Notebook() - notebook.set_show_border(False) - notebook.show() - - sw = gtk.ScrolledWindow() - sw.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC) - sw.show() - - hbox = gtk.HBox() - hbox.pack_start(sw, 1, 1, 1) - hbox.show() - - tab = notebook.append_page(hbox, gtk.Label(_("General"))) - - table = gtk.Table(len(self._order), 4, False) - table.set_resize_mode(gtk.RESIZE_IMMEDIATE) - table.show() - sw.add_with_viewport(table) - - def _err(name, msg): - try: - _img = self._editors[name][2] - except KeyError: - LOG.error(self._editors.keys()) - if msg is None: - _img.clear() - self._tips.set_tip(_img, "") - else: - _img.set_from_stock(gtk.STOCK_DIALOG_WARNING, - gtk.ICON_SIZE_MENU) - self._tips.set_tip(_img, str(msg)) - self._errors[self._order.index(name)] = msg is not None - self.set_response_sensitive(gtk.RESPONSE_OK, - True not in self._errors) - - row = 0 - for name in self._order: - text, editorcls, data = self._elements[name] - editor = editorcls(self._features, self._memory, - _err, name, data) - - self._add(table, row, name, editor, text) - self._set_doc(name, text) - row += 1 - - if len(self._memory.extra): - sw = gtk.ScrolledWindow() - sw.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC) - sw.show() - - hbox = gtk.HBox() - hbox.pack_start(sw, 1, 1, 1) - hbox.show() - - tab = notebook.append_page(hbox, gtk.Label(_("Other"))) - - table = gtk.Table(len(self._memory.extra), 4, False) - table.set_resize_mode(gtk.RESIZE_IMMEDIATE) - table.show() - sw.add_with_viewport(table) - - for setting in self._memory.extra: - name = "extra_%s" % setting.get_name() - if isinstance(setting.value, - settings.RadioSettingValueBoolean): - editor = BooleanEditor(self._features, self._memory, - _err, name) - self._add(table, row, name, editor, - setting.get_shortname()) - self._set_doc(name, setting.__doc__) - elif isinstance(setting.value, - settings.RadioSettingValueList): - editor = ChoiceEditor(self._features, self._memory, _err, - name, setting.value.get_options()) - self._add(table, row, name, editor, - setting.get_shortname()) - self._set_doc(name, setting.__doc__) - elif isinstance(setting.value, - settings.RadioSettingValueInteger): - editor = IntegerEditor(self._features, self._memory, - _err, name, setting.value) - self._add(table, row, name, editor, - setting.get_shortname()) - row += 1 - self._order.append(name) - - self.vbox.pack_start(notebook, 1, 1, 1) - - def __init__(self, features, memory, parent=None): - self._memory = memory - buttons = (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, - gtk.STOCK_OK, gtk.RESPONSE_OK) - gtk.Dialog.__init__(self, - title="Memory Properties", - flags=gtk.DIALOG_MODAL, - parent=parent, - buttons=buttons) - self.set_default_response(gtk.RESPONSE_OK) - self.set_alternative_button_order([gtk.RESPONSE_OK, - gtk.RESPONSE_CANCEL]) - self.set_size_request(-1, 500) - self._tips = compat.CompatTooltips() - - self._features = features - - self._editors = {} - self._elements = { - "freq": (_("Frequency"), - FreqEditor, None), - "name": (_("Name"), - StringEditor, features.valid_name_length), - "tmode": (_("Tone Mode"), - ChoiceEditor, features.valid_tmodes), - "rtone": (_("Tone"), - FloatChoiceEditor, chirp_common.TONES), - "ctone": (_("ToneSql"), - FloatChoiceEditor, chirp_common.TONES), - "dtcs": (_("DTCS Code"), - IntChoiceEditor, chirp_common.DTCS_CODES), - "rx_dtcs": (_("RX DTCS Code"), - IntChoiceEditor, chirp_common.DTCS_CODES), - "dtcs_polarity": (_("DTCS Pol"), - ChoiceEditor, POL), - "cross_mode": (_("Cross mode"), - ChoiceEditor, features.valid_cross_modes), - "duplex": (_("Duplex"), - ChoiceEditor, features.valid_duplexes), - "offset": (_("Offset"), - OffsetEditor, None), - "mode": (_("Mode"), - ChoiceEditor, features.valid_modes), - "tuning_step": (_("Tune Step"), - FloatChoiceEditor, features.valid_tuning_steps), - "skip": (_("Skip"), - ChoiceEditor, features.valid_skips), - "power": (_("Power"), - PowerChoiceEditor, features.valid_power_levels), - "comment": (_("Comment"), - StringEditor, 256), - } - - self._order = [ - "freq", "name", "tmode", "rtone", "ctone", "cross_mode", - "dtcs", "rx_dtcs", "dtcs_polarity", "duplex", "offset", - "mode", "tuning_step", "skip", "power", "comment" - ] - - hide_rules = [ - ("name", features.has_name), - ("tmode", len(features.valid_tmodes) > 0), - ("ctone", features.has_ctone), - ("dtcs", features.has_dtcs), - ("rx_dtcs", features.has_rx_dtcs), - ("dtcs_polarity", features.has_dtcs_polarity), - ("cross_mode", "Cross" in features.valid_tmodes), - ("duplex", len(features.valid_duplexes) > 0), - ("offset", features.has_offset), - ("mode", len(features.valid_modes) > 0), - ("tuning_step", features.has_tuning_step), - ("skip", len(features.valid_skips) > 0), - ("power", features.valid_power_levels), - ("comment", features.has_comment), - ] - - for name, visible in hide_rules: - if not visible: - del self._elements[name] - self._order.remove(name) - - self._make_ui() - - self._errors = [False] * len(self._order) - - self.connect("response", self._validate) - - def _validate(self, _dialog, response): - if response == gtk.RESPONSE_OK: - all_msgs = self._features.validate_memory(self._memory) - errors = [] - for msg in all_msgs: - if isinstance(msg, chirp_common.ValidationError): - errors.append(msg) - if errors: - common.show_error_text(_("Memory validation failed:"), - os.linesep + - os.linesep.join(errors)) - self.emit_stop_by_name('response') - - def get_memory(self): - self._memory.empty = False - return self._memory - - -class MultiMemoryDetailEditor(MemoryDetailEditor): - - def __init__(self, features, memory, parent=None): - self._selections = dict() - super(MultiMemoryDetailEditor, self).__init__(features, memory, parent) - - def _toggle_selector(self, selector, *widgets): - for widget in widgets: - widget.set_sensitive(selector.get_active()) - - def _add(self, tab, row, name, editor, text): - - label, editor, img = super(MultiMemoryDetailEditor, self)._add( - tab, row, name, editor, text, 1) - - selector = gtk.CheckButton() - tab.attach(selector, 0, 1, row, row + 1, - xoptions=gtk.FILL, yoptions=0, xpadding=0, ypadding=3) - selector.show() - self._toggle_selector(selector, label, editor, img) - selector.connect("toggled", self._toggle_selector, label, editor, img) - self._selections[name] = selector - - def get_fields(self): - return [k for k, v in self._selections.items() if v.get_active()] diff --git a/chirp/ui/memedit.py b/chirp/ui/memedit.py deleted file mode 100644 index 3cc2059..0000000 --- a/chirp/ui/memedit.py +++ /dev/null @@ -1,1757 +0,0 @@ -# -# Copyright 2008 Dan Smith -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -import threading - -import base64 -import gtk -import pango -from gobject import TYPE_INT, \ - TYPE_DOUBLE as TYPE_FLOAT, \ - TYPE_STRING, \ - TYPE_BOOLEAN, \ - TYPE_PYOBJECT, \ - TYPE_INT64 -import gobject -import pickle -import os -import logging - -import six - -from chirp.ui import common, shiftdialog, miscwidgets, config, memdetail -from chirp.ui import compat -from chirp.ui import bandplans -from chirp import chirp_common, errors, directory, import_logic - -LOG = logging.getLogger(__name__) - - -if __name__ == "__main__": - import sys - sys.path.insert(0, "..") - - -def handle_toggle(_, path, store, col): - store[path][col] = not store[path][col] - - -class ValueErrorDialog(gtk.MessageDialog): - def __init__(self, exception, **args): - gtk.MessageDialog.__init__(self, buttons=gtk.BUTTONS_OK, **args) - self.set_default_response(gtk.RESPONSE_OK) - self.set_property("text", _("Invalid value for this field")) - self.format_secondary_text(str(exception)) - - -def iter_prev(store, iter): - row = store.get_path(iter)[0] - if row == 0: - return None - return store.get_iter((row - 1,)) - - -class MemoryEditor(common.Editor): - cols = [ - (_("Loc"), TYPE_INT, gtk.CellRendererText,), - (_("Frequency"), TYPE_INT64, gtk.CellRendererText,), - (_("Name"), TYPE_STRING, gtk.CellRendererText,), - (_("Tone Mode"), TYPE_STRING, gtk.CellRendererCombo,), - (_("Tone"), TYPE_FLOAT, gtk.CellRendererCombo,), - (_("ToneSql"), TYPE_FLOAT, gtk.CellRendererCombo,), - (_("DTCS Code"), TYPE_INT, gtk.CellRendererCombo,), - (_("DTCS Rx Code"), TYPE_INT, gtk.CellRendererCombo,), - (_("DTCS Pol"), TYPE_STRING, gtk.CellRendererCombo,), - (_("Cross Mode"), TYPE_STRING, gtk.CellRendererCombo,), - (_("Duplex"), TYPE_STRING, gtk.CellRendererCombo,), - (_("Offset"), TYPE_INT64, gtk.CellRendererText,), - (_("Mode"), TYPE_STRING, gtk.CellRendererCombo,), - (_("Power"), TYPE_STRING, gtk.CellRendererCombo,), - (_("Tune Step"), TYPE_FLOAT, gtk.CellRendererCombo,), - (_("Skip"), TYPE_STRING, gtk.CellRendererCombo,), - (_("Comment"), TYPE_STRING, gtk.CellRendererText,), - ("_filled", TYPE_BOOLEAN, None,), - ("_hide_cols", TYPE_PYOBJECT, None,), - ("_extd", TYPE_STRING, None,), - ] - - defaults = { - _("Name"): "", - _("Frequency"): 146010000, - _("Tone"): 88.5, - _("ToneSql"): 88.5, - _("DTCS Code"): 23, - _("DTCS Rx Code"): 23, - _("DTCS Pol"): "NN", - _("Cross Mode"): "Tone->Tone", - _("Duplex"): "", - _("Offset"): 0, - _("Mode"): "FM", - _("Power"): "", - _("Tune Step"): 5.0, - _("Tone Mode"): "", - _("Skip"): "", - _("Comment"): "", - } - - choices = { - _("Tone"): chirp_common.TONES, - _("ToneSql"): chirp_common.TONES, - _("DTCS Code"): chirp_common.ALL_DTCS_CODES, - _("DTCS Rx Code"): chirp_common.ALL_DTCS_CODES, - _("DTCS Pol"): ["NN", "NR", "RN", "RR"], - _("Mode"): chirp_common.MODES, - _("Power"): [], - _("Duplex"): ["", "-", "+", "split", "off"], - _("Tune Step"): chirp_common.TUNING_STEPS, - _("Tone Mode"): ["", "Tone", "TSQL", "DTCS"], - _("Cross Mode"): chirp_common.CROSS_MODES, - } - - def ed_name(self, _, __, new, ___): - return self.rthread.radio.filter_name(new) - - def ed_offset(self, _, path, new, __): - new = chirp_common.parse_freq(new) - return abs(new) - - def ed_freq(self, _foo, path, new, colnum): - iter = self.store.get_iter(path) - was_filled, prev = self.store.get(iter, self.col("_filled"), colnum) - - def set_offset(offset): - if offset > 0: - dup = "+" - elif offset == 0: - dup = "" - else: - dup = "-" - offset *= -1 - - if dup not in self.choices[_("Duplex")]: - LOG.warn("Duplex %s not supported by this radio" % dup) - return - - if offset: - self.store.set(iter, self.col(_("Offset")), offset) - - self.store.set(iter, self.col(_("Duplex")), dup) - - def set_ts(ts): - if ts in self.choices[_("Tune Step")]: - self.store.set(iter, self.col(_("Tune Step")), ts) - else: - LOG.warn("Tune step %s not supported by this radio" % ts) - - def get_ts(path): - return self.store.get(iter, self.col(_("Tune Step")))[0] - - def set_mode(mode): - if mode in self.choices[_("Mode")]: - self.store.set(iter, self.col(_("Mode")), mode) - else: - LOG.warn("Mode %s not supported by this radio (%s)" % - (mode, self.choices[_("Mode")])) - - def set_tone(tone): - if tone in self.choices[_("Tone")]: - self.store.set(iter, self.col(_("Tone")), tone) - else: - LOG.warn("Tone %s not supported by this radio" % tone) - - try: - new = chirp_common.parse_freq(new) - except ValueError as e: - LOG.error("chirp_common.parse_freq error: %s", e) - new = None - - if not self._features.has_nostep_tuning: - set_ts(chirp_common.required_step(new)) - - is_changed = new != prev if was_filled else True - if new is not None and is_changed: - defaults = self.bandplans.get_defaults_for_frequency(new) - set_offset(defaults.offset or 0) - if defaults.step_khz: - set_ts(defaults.step_khz) - if defaults.mode: - set_mode(defaults.mode) - if defaults.tones: - set_tone(defaults.tones[0]) - - return new - - def ed_loc(self, _, path, new, __): - iter = self.store.get_iter(path) - curloc, = self.store.get(iter, self.col(_("Loc"))) - - job = common.RadioJob(None, "erase_memory", curloc) - job.set_desc(_("Erasing memory {loc}").format(loc=curloc)) - self.rthread.submit(job) - - self.need_refresh = True - - return new - - def ed_duplex(self, _foo1, path, new, _foo2): - if new == "": - return # Fast path outta here - - iter = self.store.get_iter(path) - freq, = self.store.get(iter, self.col(_("Frequency"))) - if new == "split": - # If we're going to split mode, use the current - # RX frequency as the default TX frequency - self.store.set(iter, self.col("Offset"), freq) - else: - defaults = self.bandplans.get_defaults_for_frequency(freq) - offset = defaults.offset or 0 - self.store.set(iter, self.col(_("Offset")), abs(offset)) - - return new - - def ed_tone_field(self, _foo, path, new, col): - if self._config.get_bool("no_smart_tmode"): - return new - - iter = self.store.get_iter(path) - - # Python scoping hurts us here, so store this as a list - # that we can modify, instead of helpful variables :( - modes = list(self.store.get(iter, - self.col(_("Tone Mode")), - self.col(_("Cross Mode")))) - - def _tm(*tmodes): - if modes[0] not in tmodes: - modes[0] = tmodes[0] - self.store.set(iter, self.col(_("Tone Mode")), modes[0]) - - def _cm(*cmodes): - if modes[0] == "Cross" and modes[1] not in cmodes: - modes[1] = cmodes[0] - self.store.set(iter, self.col(_("Cross Mode")), modes[1]) - - if col == self.col(_("DTCS Code")): - _tm("DTCS", "Cross") - _cm(*tuple([x for x in chirp_common.CROSS_MODES - if x.startswith("DTCS->")])) - elif col == self.col(_("DTCS Rx Code")): - _tm("Cross") - _cm(*tuple([x for x in chirp_common.CROSS_MODES - if x.endswith("->DTCS")])) - elif col == self.col(_("DTCS Pol")): - _tm("DTCS", "Cross") - _cm(*tuple([x for x in chirp_common.CROSS_MODES - if "DTCS" in x])) - elif col == self.col(_("Tone")): - _tm("Tone", "Cross") - _cm(*tuple([x for x in chirp_common.CROSS_MODES - if x.startswith("Tone->")])) - elif col == self.col(_("ToneSql")): - _tm("TSQL", "Cross") - _cm(*tuple([x for x in chirp_common.CROSS_MODES - if x.endswith("->Tone")])) - elif col == self.col(_("Cross Mode")): - _tm("Cross") - - return new - - def _get_cols_to_hide(self, iter): - tmode, duplex, cmode = self.store.get(iter, - self.col(_("Tone Mode")), - self.col(_("Duplex")), - self.col(_("Cross Mode"))) - - hide = [] - txmode, rxmode = cmode.split("->") - - if tmode == "Tone": - hide += [self.col(_("ToneSql")), - self.col(_("DTCS Code")), - self.col(_("DTCS Rx Code")), - self.col(_("DTCS Pol")), - self.col(_("Cross Mode"))] - elif tmode == "TSQL" or tmode == "TSQL-R": - if self._features.has_ctone: - hide += [self.col(_("Tone"))] - - hide += [self.col(_("DTCS Code")), - self.col(_("DTCS Rx Code")), - self.col(_("DTCS Pol")), - self.col(_("Cross Mode"))] - elif tmode == "DTCS" or tmode == "DTCS-R": - hide += [self.col(_("Tone")), - self.col(_("ToneSql")), - self.col(_("Cross Mode")), - self.col(_("DTCS Rx Code"))] - elif tmode == "" or tmode == "(None)": - hide += [self.col(_("Tone")), - self.col(_("ToneSql")), - self.col(_("DTCS Code")), - self.col(_("DTCS Rx Code")), - self.col(_("DTCS Pol")), - self.col(_("Cross Mode"))] - elif tmode == "Cross": - if txmode != "Tone": - hide += [self.col(_("Tone"))] - if txmode != "DTCS": - hide += [self.col(_("DTCS Code"))] - if rxmode != "Tone": - hide += [self.col(_("ToneSql"))] - if rxmode != "DTCS": - hide += [self.col(_("DTCS Rx Code"))] - if "DTCS" not in cmode: - hide += [self.col(_("DTCS Pol"))] - - if duplex == "" or duplex == "(None)" or duplex == "off": - hide += [self.col(_("Offset"))] - - return hide - - def maybe_hide_cols(self, iter): - hide_cols = self._get_cols_to_hide(iter) - self.store.set(iter, self.col("_hide_cols"), hide_cols) - - def edited(self, rend, path, new, cap): - if self.read_only: - common.show_error(_("Unable to make changes to this model")) - return - - iter = self.store.get_iter(path) - vals = self.store.get(iter, *range(0, len(self.cols))) - prev, = self.store.get(iter, self.col(cap)) - filled, = self.store.get(iter, self.col("_filled")) - freq, = self.store.get(iter, self.col(_("Frequency"))) - - # Take default values, if not yet edited - if not filled and freq == 0: - self.insert_new(iter) - - colnum = self.col(cap) - funcs = { - _("Loc"): self.ed_loc, - _("Name"): self.ed_name, - _("Frequency"): self.ed_freq, - _("Duplex"): self.ed_duplex, - _("Offset"): self.ed_offset, - _("Tone"): self.ed_tone_field, - _("ToneSql"): self.ed_tone_field, - _("DTCS Code"): self.ed_tone_field, - _("DTCS Rx Code"): self.ed_tone_field, - _("DTCS Pol"): self.ed_tone_field, - _("Cross Mode"): self.ed_tone_field, - } - - # Call the specific editor for the given column - if cap in funcs: - new = funcs[cap](rend, path, new, colnum) - - # Sanity check - if new is None: - LOG.error("Bad value for {col}: {val}".format(col=cap, val=new)) - return - - # Convert type based on column - if self.store.get_column_type(colnum) == TYPE_INT: - new = int(new) - elif self.store.get_column_type(colnum) == TYPE_FLOAT: - new = float(new) - elif self.store.get_column_type(colnum) == TYPE_BOOLEAN: - new = bool(new) - elif self.store.get_column_type(colnum) == TYPE_STRING: - if new == "(None)": - new = "" - - # Verify a change was made - if new == prev: - # Restore all columns to their original values, a given editor - # may modify multiple columns so we need to restore each of them - # to their previous values in order to restore the original state. - self._restore(iter, vals) - return - - # Finally, set the new value - self.store.set(iter, self.col(cap), new) - - # Have the radio validate the memory - mem = self._get_memory(iter) - msgs = self.rthread.radio.validate_memory(mem) - if msgs: - common.show_error(_("Error setting memory") + ": " + - "\r\n\r\n".join(msgs)) - # Restore to original values and exit - self._restore(iter, vals) - return - - mem.empty = False - - # Kick off job to write memory - job = common.RadioJob(self._set_memory_cb, "set_memory", mem) - job.set_desc(_("Writing memory {number}").format(number=mem.number)) - self.rthread.submit(job) - - self.store.set(iter, self.col("_filled"), True) - - self.maybe_hide_cols(iter) - - persist_defaults = [_("Power"), _("Frequency"), _("Mode")] - if cap in persist_defaults: - self.defaults[cap] = new - - def _render(self, colnum, val, iter=None, hide=[]): - if colnum in hide and self.hide_unused: - return "" - - if colnum == self.col(_("Frequency")): - val = chirp_common.format_freq(val) - elif colnum in [self.col(_("DTCS Code")), self.col(_("DTCS Rx Code"))]: - val = "%03i" % int(val) - elif colnum == self.col(_("Offset")): - val = chirp_common.format_freq(val) - elif colnum in [self.col(_("Tone")), self.col(_("ToneSql"))]: - val = "%.1f" % val - elif colnum in [self.col(_("Tone Mode")), self.col(_("Duplex"))]: - if not val: - val = "(None)" - elif colnum == self.col(_("Loc")) and iter is not None: - extd, = self.store.get(iter, self.col("_extd")) - if extd: - val = extd - - return str(val) - - def render(self, _, rend, model, iter, colnum): - val, hide, filled = model.get(iter, colnum, self.col("_hide_cols"), - self.col('_filled')) - val = self._render(colnum, val, iter, hide or []) - rend.set_property("text", "%s" % val) - rend.set_sensitive(filled) - - def insert_new(self, iter, loc=None): - line = [] - for key, val in self.defaults.items(): - line.append(self.col(key)) - line.append(val) - - if not loc: - loc, = self.store.get(iter, self.col(_("Loc"))) - - self.store.set(iter, - 0, loc, - *tuple(line)) - - return self._get_memory(iter) - - def insert_easy(self, store, _iter, delta): - if delta < 0: - iter = store.insert_before(_iter) - else: - iter = store.insert_after(_iter) - - newpos, = store.get(_iter, self.col(_("Loc"))) - newpos += delta - - LOG.debug("Insert easy: %i" % delta) - - mem = self.insert_new(iter, newpos) - job = common.RadioJob(None, "set_memory", mem) - job.set_desc(_("Writing memory {number}").format(number=mem.number)) - self.rthread.submit(job) - - def insert_hard(self, store, _iter, delta, warn=True): - if isinstance(self.rthread.radio, chirp_common.LiveRadio) and warn: - txt = _("This operation requires moving all subsequent channels " - "by one spot until an empty location is reached. This " - "can take a LONG time. Are you sure you want to do this?") - if not common.ask_yesno_question(txt): - return False # No change - - if delta <= 0: - iter = _iter - else: - iter = store.iter_next(_iter) - - pos, = store.get(iter, self.col(_("Loc"))) - - sd = shiftdialog.ShiftDialog(self.rthread) - - if delta == 0: - sd.delete(pos) - sd.destroy() - self.prefill() - else: - sd.insert(pos) - sd.destroy() - job = common.RadioJob( - lambda x: self.prefill(), "erase_memory", pos) - job.set_desc(_("Adding memory {number}").format(number=pos)) - self.rthread.submit(job) - - return True # We changed memories - - def _delete_rows(self, paths): - to_remove = [] - for path in paths: - iter = self.store.get_iter(path) - cur_pos, = self.store.get(iter, self.col(_("Loc"))) - to_remove.append(cur_pos) - self.store.set(iter, self.col("_filled"), False) - job = common.RadioJob(None, "erase_memory", cur_pos) - job.set_desc(_("Erasing memory {number}").format(number=cur_pos)) - self.rthread.submit(job) - - def handler(mem): - if not isinstance(mem, Exception): - if not mem.empty or self.show_empty: - gobject.idle_add(self.set_memory, mem) - - job = common.RadioJob(handler, "get_memory", cur_pos) - job.set_desc(_("Getting memory {number}").format(number=cur_pos)) - self.rthread.submit(job) - - if not self.show_empty: - # We need to actually remove the rows from the store - # now, but carefully! Get a list of deleted locations - # in order and proceed from the first path in the list - # until we run out of rows or we've removed all the - # desired ones. - to_remove.sort() - to_remove.reverse() - iter = self.store.get_iter(paths[0]) - while to_remove and iter: - pos, = self.store.get(iter, self.col(_("Loc"))) - if pos in to_remove: - to_remove.remove(pos) - if not self.store.remove(iter): - break # This was the last row - else: - iter = self.store.iter_next(iter) - - return True # We changed memories - - def _delete_rows_and_shift(self, paths, all=False): - iter = self.store.get_iter(paths[0]) - starting_loc, = self.store.get(iter, self.col(_("Loc"))) - for i in range(0, len(paths)): - sd = shiftdialog.ShiftDialog(self.rthread) - sd.delete(starting_loc, quiet=True, all=all) - sd.destroy() - - self.prefill() - return True # We changed memories - - def _move_up_down(self, paths, action): - if action.endswith("up"): - delta = -1 - donor_path = paths[-1] - victim_path = paths[0] - else: - delta = 1 - donor_path = paths[0] - victim_path = paths[-1] - - try: - victim_path = (victim_path[0] + delta,) - if victim_path[0] < 0: - raise ValueError() - donor_loc = self.store.get(self.store.get_iter(donor_path), - self.col(_("Loc")))[0] - victim_loc = self.store.get(self.store.get_iter(victim_path), - self.col(_("Loc")))[0] - except ValueError: - self.emit("usermsg", "No room to %s" % (action.replace("_", " "))) - return False # No change - - class Context: - pass - ctx = Context() - - ctx.victim_mem = None - ctx.donor_loc = donor_loc - ctx.done_count = 0 - ctx.path_count = len(paths) - - # Steps: - # 1. Grab the victim (the one that will need to be saved and moved - # from the front to the back or back to the front) and save it - # 2. Grab each memory along the way, storing it in the +delta - # destination location after we get it - # 3. If we're the final move, then schedule storing the victim - # in the hole we created - - def update_selection(): - sel = self.view.get_selection() - sel.unselect_all() - for path in paths: - gobject.idle_add(sel.select_path, (path[0]+delta,)) - - def save_victim(mem, ctx): - ctx.victim_mem = mem - - def store_victim(mem, dest): - old = mem.number - mem.number = dest - job = common.RadioJob(None, "set_memory", mem) - job.set_desc( - _("Moving memory from {old} to {new}").format(old=old, - new=dest)) - self.rthread.submit(job) - self._set_memory(self.store.get_iter(donor_path), mem) - update_selection() - - def move_mem(mem, delta, ctx, iter): - old = mem.number - mem.number += delta - job = common.RadioJob(None, "set_memory", mem) - job.set_desc( - _("Moving memory from {old} to {new}").format(old=old, - new=old+delta)) - self.rthread.submit(job) - self._set_memory(iter, mem) - ctx.done_count += 1 - if ctx.done_count == ctx.path_count: - store_victim(ctx.victim_mem, ctx.donor_loc) - - job = common.RadioJob(lambda m: save_victim(m, ctx), - "get_memory", victim_loc) - job.set_desc(_("Getting memory {number}").format(number=victim_loc)) - self.rthread.submit(job) - - for i in range(len(paths)): - path = paths[i] - if delta > 0: - dest = i+1 - else: - dest = i-1 - - if dest < 0 or dest >= len(paths): - dest = victim_path - else: - dest = paths[dest] - - iter = self.store.get_iter(path) - loc, = self.store.get(iter, self.col(_("Loc"))) - job = common.RadioJob(move_mem, "get_memory", loc) - job.set_cb_args(delta, ctx, self.store.get_iter(dest)) - job.set_desc("Getting memory %i" % loc) - self.rthread.submit(job) - - return True # We (scheduled some) change to the memories - - def _exchange_memories(self, paths): - if len(paths) != 2: - self.emit("usermsg", "Select two memories first") - return False - - loc_a, = self.store.get(self.store.get_iter(paths[0]), - self.col(_("Loc"))) - loc_b, = self.store.get(self.store.get_iter(paths[1]), - self.col(_("Loc"))) - - def store_mem(mem, dst): - src = mem.number - mem.number = dst - job = common.RadioJob(None, "set_memory", mem) - job.set_desc( - _("Moving memory from {old} to {new}").format( - old=src, new=dst)) - self.rthread.submit(job) - if dst == loc_a: - self.prefill() - - job = common.RadioJob(lambda m: store_mem(m, loc_b), - "get_memory", loc_a) - job.set_desc(_("Getting memory {number}").format(number=loc_a)) - self.rthread.submit(job) - - job = common.RadioJob(lambda m: store_mem(m, loc_a), - "get_memory", loc_b) - job.set_desc(_("Getting memory {number}").format(number=loc_b)) - self.rthread.submit(job) - - # We (scheduled some) change to the memories - return True - - def _show_raw(self, cur_pos): - def idle_show_raw(result): - gobject.idle_add(common.show_diff_blob, - _("Raw memory {number}").format( - number=cur_pos), result) - - job = common.RadioJob(idle_show_raw, "get_raw_memory", cur_pos) - job.set_desc(_("Getting raw memory {number}").format(number=cur_pos)) - self.rthread.submit(job) - - def _diff_raw(self, paths): - if len(paths) != 2: - common.show_error(_("You can only diff two memories!")) - return - - loc_a = self.store.get(self.store.get_iter(paths[0]), - self.col(_("Loc")))[0] - loc_b = self.store.get(self.store.get_iter(paths[1]), - self.col(_("Loc")))[0] - - raw = {} - - def diff_raw(which, result): - raw[which] = _("Memory {number}").format(number=which) + \ - os.linesep + result - - if len(raw.keys()) == 2: - diff = common.simple_diff(raw[loc_a], raw[loc_b]) - gobject.idle_add(common.show_diff_blob, - _("Diff of {a} and {b}").format(a=loc_a, - b=loc_b), - diff) - - job = common.RadioJob(lambda r: diff_raw(loc_a, r), - "get_raw_memory", loc_a) - job.set_desc(_("Getting raw memory {number}").format(number=loc_a)) - self.rthread.submit(job) - - job = common.RadioJob(lambda r: diff_raw(loc_b, r), - "get_raw_memory", loc_b) - job.set_desc(_("Getting raw memory {number}").format(number=loc_b)) - self.rthread.submit(job) - - def _copy_field(self, src_memory, dst_memory, field): - if field.startswith("extra_"): - field = field.split("_", 1)[1] - value = src_memory.extra[field].value.get_value() - dst_memory.extra[field].value = value - else: - setattr(dst_memory, field, getattr(src_memory, field)) - - def _apply_multiple(self, src_memory, fields, locations): - for location in locations: - def apply_and_set(memory): - for field in fields: - self._copy_field(src_memory, memory, field) - cb = (memory.number == locations[-1] and - self._set_memory_cb or None) - job = common.RadioJob(cb, "set_memory", memory) - job.set_desc(_("Writing memory {number}").format( - number=memory.number)) - self.rthread.submit(job) - job = common.RadioJob(apply_and_set, "get_memory", location) - job.set_desc(_("Getting original memory {number}").format( - number=location)) - self.rthread.submit(job) - - def edit_memory(self, memory, locations): - if len(locations) > 1: - dlg = memdetail.MultiMemoryDetailEditor(self._features, memory) - else: - dlg = memdetail.MemoryDetailEditor(self._features, memory) - r = dlg.run() - if r == gtk.RESPONSE_OK: - self.need_refresh = True - mem = dlg.get_memory() - if len(locations) > 1: - self._apply_multiple(memory, dlg.get_fields(), locations) - else: - if "name" not in mem.immutable: - mem.name = self.rthread.radio.filter_name(mem.name) - job = common.RadioJob(self._set_memory_cb, "set_memory", mem) - job.set_desc(_("Writing memory {number}").format( - number=mem.number)) - self.rthread.submit(job) - dlg.destroy() - - def mh(self, _action, store, paths): - action = _action.get_name() - selected = [] - for path in paths: - iter = store.get_iter(path) - loc, = store.get(iter, self.col(_("Loc"))) - selected.append(loc) - cur_pos = selected[0] - - require_contiguous = ["delete_s", "move_up", "move_dn"] - if action in require_contiguous: - last = paths[0][0] - for path in paths[1:]: - if path[0] != last+1: - self.emit("usermsg", _("Memories must be contiguous")) - return - last = path[0] - - changed = False - - if action == "insert_next": - changed = self.insert_hard(store, iter, 1) - elif action == "insert_prev": - changed = self.insert_hard(store, iter, -1) - elif action == "delete": - changed = self._delete_rows(paths) - elif action == "delete_s": - changed = self._delete_rows_and_shift(paths) - elif action == "delete_sall": - changed = self._delete_rows_and_shift(paths, all=True) - elif action in ["move_up", "move_dn"]: - changed = self._move_up_down(paths, action) - elif action == "exchange": - changed = self._exchange_memories(paths) - elif action in ["cut", "copy"]: - changed = self.copy_selection(action == "cut") - elif action == "paste": - changed = self.paste_selection() - elif action == "all": - changed = self.select_all() - elif action == "devshowraw": - self._show_raw(cur_pos) - elif action == "devdiffraw": - self._diff_raw(paths) - elif action == "properties": - job = common.RadioJob(self.edit_memory, "get_memory", cur_pos) - job.set_cb_args(selected) - self.rthread.submit(job) - - if changed: - self.emit("changed") - - def hotkey(self, action): - if self._in_editing: - # Don't forward potentially-dangerous hotkeys to the menu - # handler if we're editing a cell right now - return - - self.emit("usermsg", "") - (store, paths) = self.view.get_selection().get_selected_rows() - if len(paths) == 0: - return - self.mh(action, store, paths) - - def make_context_menu(self): - if self._config.get_bool("developer", "state"): - devmenu = """ - - - -""" - else: - devmenu = "" - - menu_xml = """ - - - - - - - - - - - - - - - - - - - - - %s - - -""" % devmenu - - (store, paths) = self.view.get_selection().get_selected_rows() - issingle = len(paths) == 1 - istwo = len(paths) == 2 - - actions = [ - ("cut", _("Cut")), - ("copy", _("Copy")), - ("paste", _("Paste")), - ("all", _("Select All")), - ("insert_prev", _("Insert row above")), - ("insert_next", _("Insert row below")), - ("deletes", _("Delete")), - ("delete", issingle and _("this memory") or _("these memories")), - ("delete_s", _("...and shift block up")), - ("delete_sall", _("...and shift all memories up")), - ("move_up", _("Move up")), - ("move_dn", _("Move down")), - ("exchange", _("Exchange memories")), - ("properties", _("P_roperties")), - ("devshowraw", _("Show Raw Memory")), - ("devdiffraw", _("Diff Raw Memories")), - ] - - no_multiple = ["insert_prev", "insert_next", "paste", "devshowraw"] - only_two = ["devdiffraw", "exchange"] - - ag = gtk.ActionGroup("Menu") - - for name, label in actions: - a = gtk.Action(name, label, "", 0) - a.connect("activate", self.mh, store, paths) - if name in no_multiple: - a.set_sensitive(issingle) - if name in only_two: - a.set_sensitive(istwo) - ag.add_action(a) - - if issingle: - iter = store.get_iter(paths[0]) - cur_pos, = store.get(iter, self.col(_("Loc"))) - if cur_pos == self._features.memory_bounds[1]: - ag.get_action("delete_s").set_sensitive(False) - - uim = gtk.UIManager() - uim.insert_action_group(ag, 0) - uim.add_ui_from_string(menu_xml) - - return uim.get_widget("/Menu") - - def double_click_empty_memory(self, treeiter, path, col): - loc = self.store.get(treeiter, self.col(_('Loc'))) - # Make this filled=True, thus sensitive=True - self.store.set(treeiter, self.col(_('_filled')), True) - # Set the cursor and stat editing - self.view.set_cursor(path, col, True) - - def click_cb(self, view, event): - self.emit("usermsg", "") - - pathinfo = view.get_path_at_pos(int(event.x), int(event.y)) - if pathinfo is None: - return - path, col, x, y = pathinfo - treeiter = self.store.get_iter(path) - - if hasattr(gtk.gdk.EventType, '_2BUTTON_PRESS'): - double_click = event.type == gtk.gdk.EventType._2BUTTON_PRESS - else: - double_click = False - - if event.button == 1 and double_click: - filled, = self.store.get(treeiter, self.col(_('_filled'))) - if not filled: - self.double_click_empty_memory(treeiter, path, col) - return True - elif event.button == 3: - view.set_cursor(path, col) - menu = self.make_context_menu() - try: - menu.popup(None, None, None, event.button, event.time) - except TypeError: - # GTK3 - menu.popup(None, None, None, None, event.button, - event.time) - return True - - def get_column_visible(self, col): - column = self.view.get_column(col) - return column.get_visible() - - def set_column_visible(self, col, visible): - column = self.view.get_column(col) - column.set_visible(visible) - - def cell_editing_started(self, rend, event, path): - self._in_editing = True - self._edit_path = self.view.get_cursor() - - def cell_editing_stopped(self, *args): - self._in_editing = False - self.view.grab_focus() - self.view.set_cursor(*self._edit_path) - - def make_editor(self): - types = tuple([x[1] for x in self.cols]) - self.store = gtk.ListStore(*types) - - self.view = gtk.TreeView(self.store) - self.view.get_selection().set_mode(gtk.SELECTION_MULTIPLE) - self.view.set_rules_hint(True) - - hbox = gtk.HBox() - - sw = gtk.ScrolledWindow() - sw.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) - sw.add(self.view) - - filled = self.col("_filled") - - default_col_order = [x for x, y, z in self.cols if z] - try: - config_setting = self._config.get("column_order_%s" % - self.__class__.__name__) - if config_setting is None: - col_order = default_col_order - else: - col_order = config_setting.split(",") - if len(col_order) != len(default_col_order): - raise Exception() - for i in col_order: - if i not in default_col_order: - raise Exception() - except Exception as e: - LOG.error("column order setting: %s", e) - col_order = default_col_order - - non_editable = [_("Loc")] - - unsupported_cols = self.get_unsupported_columns() - visible_cols = self.get_columns_visible() - - self._renderers = {} - cols = {} - i = 0 - for _cap, _type, _rend in self.cols: - if not _rend: - continue - rend = _rend() - self._renderers[_cap] = rend - rend.connect('editing-started', self.cell_editing_started) - rend.connect('editing-canceled', self.cell_editing_stopped) - rend.connect('edited', self.cell_editing_stopped) - - if _type == TYPE_BOOLEAN: - # rend.set_property("activatable", True) - # rend.connect("toggled", handle_toggle, self.store, i) - col = gtk.TreeViewColumn(_cap, rend, active=i, - sensitive=filled) - elif _rend == gtk.CellRendererCombo: - if isinstance(self.choices[_cap], gtk.ListStore): - choices = self.choices[_cap] - else: - choices = gtk.ListStore(TYPE_STRING, TYPE_STRING) - for choice in self.choices[_cap]: - choices.append([str(choice), self._render(i, choice)]) - rend.set_property("model", choices) - rend.set_property("text-column", 1) - rend.set_property("editable", True) - rend.set_property("has-entry", False) - rend.connect("edited", self.edited, _cap) - col = gtk.TreeViewColumn(_cap, rend, text=i) - col.set_cell_data_func(rend, self.render, i) - else: - rend.set_property("editable", _cap not in non_editable) - rend.connect("edited", self.edited, _cap) - col = gtk.TreeViewColumn(_cap, rend, text=i) - col.set_cell_data_func(rend, self.render, i) - - col.set_reorderable(True) - col.set_sort_column_id(i) - col.set_resizable(True) - col.set_min_width(1) - col.set_visible(not _cap.startswith("_") and - _cap in visible_cols and - _cap not in unsupported_cols) - cols[_cap] = col - i += 1 - - for cap in col_order: - self.view.append_column(cols[cap]) - - self.store.set_sort_column_id(self.col(_("Loc")), gtk.SORT_ASCENDING) - - self.view.show() - sw.show() - hbox.pack_start(sw, 1, 1, 1) - - self.view.connect("button_press_event", self.click_cb) - - hbox.show() - - return hbox - - def col(self, caption): - try: - return self._cached_cols[caption] - except KeyError: - raise Exception( - _("Internal Error: Column {name} not found").format( - name=caption)) - - def rend(self, caption): - try: - return self._renderers[caption] - except KeyError: - print(self._renderers) - raise Exception( - _('Internal Error: Renderer for column %s not found') % ( - caption)) - - def _prefill(self, num): - def handler(mem, number): - if not isinstance(mem, Exception): - if not mem.empty or self.show_empty: - gobject.idle_add(self.set_memory, mem) - else: - mem = chirp_common.Memory(number, True, "Error") - gobject.idle_add(self.set_memory, mem) - - job = common.RadioJob(handler, "get_memory", num) - job.set_desc(_("Getting memory {number}").format(number=num)) - job.set_cb_args(num) - self.rthread.submit(job, 2) - - def prefill(self): - self.store.clear() - self._rows_in_store = 0 - - lo = int(self.lo_limit_adj.get_value()) - hi = int(self.hi_limit_adj.get_value()) - - for i in range(lo, hi+1): - self._prefill(i) - - if self.show_special: - for i in self._features.valid_special_chans: - self._prefill(i) - - def _restore(self, iter, vals): - for col, val in enumerate(vals): - self.store.set(iter, col, val) - - def _set_memory(self, iter, memory): - self.store.set(iter, - self.col("_filled"), not memory.empty, - self.col(_("Loc")), memory.number, - self.col("_extd"), memory.extd_number, - self.col(_("Name")), memory.name, - self.col(_("Frequency")), memory.freq, - self.col(_("Tone Mode")), memory.tmode, - self.col(_("Tone")), memory.rtone, - self.col(_("ToneSql")), memory.ctone, - self.col(_("DTCS Code")), memory.dtcs, - self.col(_("DTCS Rx Code")), memory.rx_dtcs, - self.col(_("DTCS Pol")), memory.dtcs_polarity, - self.col(_("Cross Mode")), memory.cross_mode, - self.col(_("Duplex")), memory.duplex, - self.col(_("Offset")), memory.offset, - self.col(_("Mode")), memory.mode, - self.col(_("Power")), (memory.power and - str(memory.power) or - ""), - self.col(_("Tune Step")), memory.tuning_step, - self.col(_("Skip")), memory.skip, - self.col(_("Comment")), memory.comment) - - hide = self._get_cols_to_hide(iter) - self.store.set(iter, self.col("_hide_cols"), hide) - - def set_memory(self, memory): - iter = self.store.get_iter_first() - - while iter is not None: - loc, = self.store.get(iter, self.col(_("Loc"))) - if loc == memory.number: - return self._set_memory(iter, memory) - - iter = self.store.iter_next(iter) - - iter = self.store.append() - self._rows_in_store += 1 - self._set_memory(iter, memory) - - def clear_memory(self, number): - iter = self.store.get_iter_first() - while iter: - loc, = self.store.get(iter, self.col(_("Loc"))) - if loc == number: - LOG.debug("Deleting %i" % number) - # FIXME: Make the actual remove happen on callback - self.store.remove(iter) - job = common.RadioJob(None, "erase_memory", number) - job.set_desc( - _("Erasing memory {number}").format(number=number)) - self.rthread.submit() - break - iter = self.store.iter_next(iter) - - def _set_mem_vals(self, mem, vals, iter): - power_levels = {"": None} - for i in self._features.valid_power_levels: - power_levels[str(i)] = i - - mem.freq = vals[self.col(_("Frequency"))] - mem.number = vals[self.col(_("Loc"))] - mem.extd_number = vals[self.col("_extd")] - mem.name = vals[self.col(_("Name"))] - mem.vfo = 0 - mem.rtone = vals[self.col(_("Tone"))] - mem.ctone = vals[self.col(_("ToneSql"))] - mem.dtcs = vals[self.col(_("DTCS Code"))] - mem.rx_dtcs = vals[self.col(_("DTCS Rx Code"))] - mem.tmode = vals[self.col(_("Tone Mode"))] - mem.cross_mode = vals[self.col(_("Cross Mode"))] - mem.dtcs_polarity = vals[self.col(_("DTCS Pol"))] - mem.duplex = vals[self.col(_("Duplex"))] - mem.offset = vals[self.col(_("Offset"))] - mem.mode = vals[self.col(_("Mode"))] - mem.power = power_levels[vals[self.col(_("Power"))]] - mem.tuning_step = vals[self.col(_("Tune Step"))] - mem.skip = vals[self.col(_("Skip"))] - mem.comment = vals[self.col(_("Comment"))] - mem.empty = not vals[self.col("_filled")] - - def _get_memory(self, iter): - vals = self.store.get(iter, *range(0, len(self.cols))) - mem = chirp_common.Memory() - self._set_mem_vals(mem, vals, iter) - - return mem - - def _limit_key(self, which): - if which not in ["lo", "hi"]: - raise Exception(_("Internal Error: Invalid limit {number}").format( - number=which)) - return "%s_%s" % \ - (directory.radio_class_id(self.rthread.radio.__class__), which) - - def _store_limit(self, sb, which): - self._config.set_int(self._limit_key(which), int(sb.get_value())) - - def make_controls(self, min, max): - hbox = gtk.HBox(False, 2) - - lab = gtk.Label(_("Memory Range:")) - lab.show() - hbox.pack_start(lab, 0, 0, 0) - - lokey = self._limit_key("lo") - hikey = self._limit_key("hi") - lostart = self._config.is_defined(lokey) and \ - self._config.get_int(lokey) or min - histart = self._config.is_defined(hikey) and \ - self._config.get_int(hikey) or 999 - - self.lo_limit_adj = gtk.Adjustment(lostart, min, max-1, 1, 10) - lo = compat.SpinButton(self.lo_limit_adj) - lo.set_value(lostart) - lo.connect("value-changed", self._store_limit, "lo") - lo.show() - hbox.pack_start(lo, 0, 0, 0) - - lab = gtk.Label(" - ") - lab.show() - hbox.pack_start(lab, 0, 0, 0) - - self.hi_limit_adj = gtk.Adjustment(histart, min+1, max, 1, 10) - hi = compat.SpinButton(self.hi_limit_adj) - hi.set_value(histart) - hi.connect("value-changed", self._store_limit, "hi") - hi.show() - hbox.pack_start(hi, 0, 0, 0) - - refresh = gtk.Button(_("Refresh")) - refresh.set_relief(gtk.RELIEF_NONE) - refresh.connect("clicked", lambda x: self.prefill()) - refresh.show() - hbox.pack_start(refresh, 0, 0, 0) - - def activate_go(widget): - refresh.clicked() - - def set_hi(widget, event): - loval = self.lo_limit_adj.get_value() - hival = self.hi_limit_adj.get_value() - if loval >= hival: - self.hi_limit_adj.set_value(loval + 25) - - lo.connect_after("focus-out-event", set_hi) - lo.connect_after("activate", activate_go) - hi.connect_after("activate", activate_go) - - sep = gtk.VSeparator() - sep.show() - hbox.pack_start(sep, 0, 0, 2) - - showspecial = gtk.ToggleButton(_("Special Channels")) - showspecial.set_relief(gtk.RELIEF_NONE) - showspecial.set_active(self.show_special) - showspecial.connect("toggled", - lambda x: self.set_show_special(x.get_active())) - showspecial.show() - hbox.pack_start(showspecial, 0, 0, 0) - - showempty = gtk.ToggleButton(_("Show Empty")) - showempty.set_relief(gtk.RELIEF_NONE) - showempty.set_active(self.show_empty) - showempty.connect("toggled", - lambda x: self.set_show_empty(x.get_active())) - showempty.show() - hbox.pack_start(showempty, 0, 0, 0) - - sep = gtk.VSeparator() - sep.show() - hbox.pack_start(sep, 0, 0, 2) - - props = gtk.Button(_("Properties")) - props.set_relief(gtk.RELIEF_NONE) - props.connect("clicked", - lambda x: self.hotkey( - gtk.Action("properties", "", "", 0))) - props.show() - hbox.pack_start(props, 0, 0, 0) - - hbox.show() - - return hbox - - def set_show_special(self, show): - self.show_special = show - self.prefill() - self._config.set_bool("show_special", show) - - def set_show_empty(self, show): - self.show_empty = show - self.prefill() - self._config.set_bool("hide_empty", not show) - - def set_hide_unused(self, hide_unused): - self.hide_unused = hide_unused - self.prefill() - self._config.set_bool("hide_unused", hide_unused) - - def __cache_columns(self): - # We call self.col() a lot. Caching the name->column# lookup - # makes a significant performance improvement - self._cached_cols = {} - i = 0 - for x in self.cols: - self._cached_cols[x[0]] = i - i += 1 - - def get_unsupported_columns(self): - maybe_hide = [ - ("has_dtcs", _("DTCS Code")), - ("has_rx_dtcs", _("DTCS Rx Code")), - ("has_dtcs_polarity", _("DTCS Pol")), - ("has_mode", _("Mode")), - ("has_offset", _("Offset")), - ("has_name", _("Name")), - ("has_tuning_step", _("Tune Step")), - ("has_name", _("Name")), - ("has_ctone", _("ToneSql")), - ("has_cross", _("Cross Mode")), - ("has_comment", _("Comment")), - ("valid_tmodes", _("Tone Mode")), - ("valid_tmodes", _("Tone")), - ("valid_duplexes", _("Duplex")), - ("valid_skips", _("Skip")), - ("valid_power_levels", _("Power")), - ] - - unsupported = [] - for feature, colname in maybe_hide: - if feature.startswith("has_"): - supported = self._features[feature] - LOG.info("%s supported: %s" % (colname, supported)) - elif feature.startswith("valid_"): - supported = len(self._features[feature]) != 0 - - if not supported: - unsupported.append(colname) - - return unsupported - - def get_columns_visible(self): - unsupported = self.get_unsupported_columns() - driver = directory.radio_class_id(self.rthread.radio.__class__) - user_visible = self._config.get(driver, "memedit_columns") - if user_visible: - user_visible = user_visible.split(",") - else: - # No setting for this radio, so assume all - user_visible = [x[0] for x in self.cols if x not in unsupported] - return user_visible - - def __init__(self, rthread): - super(MemoryEditor, self).__init__(rthread) - - self.defaults = dict(self.defaults) - - self._config = config.get("memedit") - - self.bandplans = bandplans.BandPlans(config.get()) - - self.allowed_bands = [144, 440] - self.count = 100 - self.show_special = self._config.get_bool("show_special") - self.show_empty = not self._config.get_bool("hide_empty") - self.hide_unused = self._config.get_bool("hide_unused", default=True) - self.read_only = False - - self.need_refresh = False - self._in_editing = False - - self.lo_limit_adj = self.hi_limit_adj = None - self.store = self.view = None - - self.__cache_columns() - - self._features = self.rthread.radio.get_features() - - (min, max) = self._features.memory_bounds - - self.choices[_("Mode")] = self._features["valid_modes"] - self.choices[_("Tone Mode")] = self._features["valid_tmodes"] - self.choices[_("Cross Mode")] = self._features["valid_cross_modes"] - self.choices[_("Skip")] = self._features["valid_skips"] - self.choices[_("Power")] = [str(x) for x in - self._features["valid_power_levels"]] - self.choices[_("DTCS Pol")] = self._features["valid_dtcs_pols"] - self.choices[_("DTCS Code")] = self._features["valid_dtcs_codes"] - self.choices[_("DTCS Rx Code")] = self._features["valid_dtcs_codes"] - - if self._features["valid_power_levels"]: - self.defaults[_("Power")] = self._features["valid_power_levels"][0] - - self.choices[_("Tune Step")] = self._features["valid_tuning_steps"] - - self.choices[_("Duplex")] = list(self._features.valid_duplexes) - - if self.defaults[_("Mode")] not in self._features.valid_modes: - self.defaults[_("Mode")] = self._features.valid_modes[0] - - vbox = gtk.VBox(False, 2) - vbox.pack_start(self.make_controls(min, max), 0, 0, 0) - vbox.pack_start(self.make_editor(), 1, 1, 1) - vbox.show() - - self.prefill() - - self.root = vbox - - # Run low priority jobs to get the rest of the memories - hi = int(self.hi_limit_adj.get_value()) - for i in range(hi+1, max+1): - job = common.RadioJob(None, "get_memory", i) - job.set_desc(_("Getting memory {number}").format(number=i)) - self.rthread.submit(job, 10) - - def _set_memory_cb(self, result): - if isinstance(result, Exception): - # FIXME: This can't be in the thread - dlg = ValueErrorDialog(result) - dlg.run() - dlg.destroy() - self.prefill() - elif self.need_refresh: - self.prefill() - self.need_refresh = False - - self.emit('changed') - - def copy_selection(self, cut=False): - (store, paths) = self.view.get_selection().get_selected_rows() - - maybe_cut = [] - selection = [] - - for path in paths: - iter = store.get_iter(path) - mem = self._get_memory(iter) - selection.append(mem.dupe()) - maybe_cut.append((iter, mem)) - - if cut: - for iter, mem in maybe_cut: - mem.empty = True - job = common.RadioJob(self._set_memory_cb, - "erase_memory", mem.number) - job.set_desc( - _("Cutting memory {number}").format(number=mem.number)) - self.rthread.submit(job) - - self._set_memory(iter, mem) - - result = base64.b64encode(pickle.dumps((self._features, - selection))).decode() - if hasattr(gtk.Clipboard, 'get'): - # GTK3 - clipboard = gtk.Clipboard.get(gtk.gdk.SELECTION_CLIPBOARD) - clipboard.set_text(result, len(result)) - else: - # GTK2 - clipboard = gtk.Clipboard(selection="CLIPBOARD") - clipboard.set_text(result) - clipboard.store() - - return cut # Only changed if we did a cut - - def _paste_selection(self, clipboard, text, data): - if not text: - return - - (store, paths) = self.view.get_selection().get_selected_rows() - if len(paths) > 1: - common.show_error("To paste, select only the starting location") - return - - iter = store.get_iter(paths[0]) - - always = False - - try: - src_features, mem_list = pickle.loads(base64.b64decode(text)) - except Exception: - LOG.error("Paste failed to unpickle") - return - - if (paths[0][0] + len(mem_list)) > self._rows_in_store: - common.show_error(_("Unable to paste {src} memories into " - "{dst} rows. Increase the memory bounds " - "or show empty memories.").format( - src=len(mem_list), - dst=(self._rows_in_store - paths[0][0]))) - return - - for mem in mem_list: - if mem.empty: - iter = self.store.iter_next(iter) - continue - loc, filled = store.get(iter, - self.col(_("Loc")), self.col("_filled")) - if filled and not always: - buttons = (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, - gtk.STOCK_NO, gtk.RESPONSE_NO, - _("Yes to All"), gtk.RESPONSE_ACCEPT, - gtk.STOCK_YES, gtk.RESPONSE_YES) - d = miscwidgets.YesNoDialog(title=_("Overwrite?"), - parent=None, - buttons=buttons) - d.set_default_response(gtk.RESPONSE_YES) - d.set_alternative_button_order([gtk.RESPONSE_YES, - gtk.RESPONSE_ACCEPT, - gtk.RESPONSE_NO, - gtk.RESPONSE_CANCEL]) - d.set_text( - _("Overwrite location {number}?").format(number=loc)) - r = d.run() - d.destroy() - if r == gtk.RESPONSE_ACCEPT: - always = True - elif r == gtk.RESPONSE_CANCEL: - break - elif r == gtk.RESPONSE_NO: - iter = store.iter_next(iter) - continue - - mem.name = self.rthread.radio.filter_name(mem.name) - - src_number = mem.number - mem.number = loc - - try: - mem = import_logic.import_mem(self.rthread.radio, - src_features, - mem) - except import_logic.DestNotCompatible: - msgs = self.rthread.radio.validate_memory(mem) - errs = [x for x in msgs - if isinstance(x, chirp_common.ValidationError)] - if errs: - buttons = (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, - gtk.STOCK_OK, gtk.RESPONSE_OK) - d = miscwidgets.YesNoDialog(title=_("Incompatible Memory"), - buttons=buttons) - d.set_default_response(gtk.RESPONSE_OK) - d.set_alternative_button_order([gtk.RESPONSE_OK, - gtk.RESPONSE_CANCEL]) - d.set_text( - _("Pasted memory {number} is not compatible with " - "this radio because:").format(number=src_number) + - os.linesep + os.linesep.join(msgs)) - r = d.run() - d.destroy() - if r == gtk.RESPONSE_CANCEL: - break - else: - iter = store.iter_next(iter) - continue - - self._set_memory(iter, mem) - iter = store.iter_next(iter) - - job = common.RadioJob(self._set_memory_cb, "set_memory", mem) - job.set_desc( - _("Writing memory {number}").format(number=mem.number)) - self.rthread.submit(job) - - def paste_selection(self): - if hasattr(gtk.Clipboard, 'get'): - # GTK3 - clipboard = gtk.Clipboard.get(gtk.gdk.SELECTION_CLIPBOARD) - text = clipboard.wait_for_text() - self._paste_selection(clipboard, text, None) - else: - # GTK2 - clipboard = gtk.Clipboard(selection="CLIPBOARD") - clipboard.request_text(self._paste_selection) - - def select_all(self): - self.view.get_selection().select_all() - - def prepare_close(self): - cols = self.view.get_columns() - self._config.set("column_order_%s" % self.__class__.__name__, - ",".join([x.get_title() for x in cols])) - - def other_editor_changed(self, target_editor): - self.need_refresh = True - - -class DstarMemoryEditor(MemoryEditor): - def _get_cols_to_hide(self, iter): - hide = MemoryEditor._get_cols_to_hide(self, iter) - - mode, = self.store.get(iter, self.col(_("Mode"))) - if mode != "DV": - hide += [self.col("URCALL"), - self.col("RPT1CALL"), - self.col("RPT2CALL")] - - return hide - - def render(self, null, rend, model, iter, colnum): - MemoryEditor.render(self, null, rend, model, iter, colnum) - - vals = model.get(iter, *tuple(range(0, len(self.cols)))) - val = vals[colnum] - - def _enabled(sensitive): - rend.set_property("sensitive", sensitive) - - def d_unless_mode(mode): - _enabled(vals[self.col(_("Mode"))] == mode) - - _dv_columns = [_("URCALL"), _("RPT1CALL"), _("RPT2CALL"), - _("Digital Code")] - dv_columns = [self.col(x) for x in _dv_columns] - if colnum in dv_columns: - d_unless_mode("DV") - - def _get_memory(self, iter): - vals = self.store.get(iter, *range(0, len(self.cols))) - if vals[self.col(_("Mode"))] != "DV": - return MemoryEditor._get_memory(self, iter) - - mem = chirp_common.DVMemory() - - MemoryEditor._set_mem_vals(self, mem, vals, iter) - - mem.dv_urcall = vals[self.col(_("URCALL"))] - mem.dv_rpt1call = vals[self.col(_("RPT1CALL"))] - mem.dv_rpt2call = vals[self.col(_("RPT2CALL"))] - mem.dv_code = vals[self.col(_("Digital Code"))] - - return mem - - def __init__(self, rthread): - # I think self.cols is "static" or "unbound" or something else - # like that and += modifies the type, not self (how bizarre) - self.cols = list(self.cols) - new_cols = [("URCALL", TYPE_STRING, gtk.CellRendererCombo), - ("RPT1CALL", TYPE_STRING, gtk.CellRendererCombo), - ("RPT2CALL", TYPE_STRING, gtk.CellRendererCombo), - ("Digital Code", TYPE_INT, gtk.CellRendererText), - ] - for col in new_cols: - index = self.cols.index(("_filled", TYPE_BOOLEAN, None)) - self.cols.insert(index, col) - - self.choices = dict(self.choices) - self.defaults = dict(self.defaults) - - self.choices["URCALL"] = gtk.ListStore(TYPE_STRING, TYPE_STRING) - self.choices["RPT1CALL"] = gtk.ListStore(TYPE_STRING, TYPE_STRING) - self.choices["RPT2CALL"] = gtk.ListStore(TYPE_STRING, TYPE_STRING) - - self.defaults["URCALL"] = "" - self.defaults["RPT1CALL"] = "" - self.defaults["RPT2CALL"] = "" - self.defaults["Digital Code"] = 0 - - MemoryEditor.__init__(self, rthread) - - def ucall_cb(calls): - self.defaults["URCALL"] = calls[0] - for call in calls: - self.choices["URCALL"].append((call, call)) - - if self._features.requires_call_lists: - ujob = common.RadioJob(ucall_cb, "get_urcall_list") - ujob.set_desc(_("Downloading URCALL list")) - rthread.submit(ujob) - - def rcall_cb(calls): - self.defaults["RPT1CALL"] = calls[0] - self.defaults["RPT2CALL"] = calls[0] - for call in calls: - self.choices["RPT1CALL"].append((call, call)) - self.choices["RPT2CALL"].append((call, call)) - - if self._features.requires_call_lists: - rjob = common.RadioJob(rcall_cb, "get_repeater_call_list") - rjob.set_desc(_("Downloading RPTCALL list")) - rthread.submit(rjob) - - _dv_columns = ["URCALL", "RPT1CALL", "RPT2CALL", "Digital Code"] - - if not self._features.requires_call_lists: - for i in _dv_columns: - if i not in self.choices: - continue - rend = self.rend(i) - rend.set_property("has-entry", True) - - for i in _dv_columns: - rend = self.rend(i) - rend.set_property("family", "Monospace") - - def set_urcall_list(self, urcalls): - store = self.choices["URCALL"] - - store.clear() - for call in urcalls: - store.append((call, call)) - - def set_repeater_list(self, repeaters): - for listname in ["RPT1CALL", "RPT2CALL"]: - store = self.choices[listname] - - store.clear() - for call in repeaters: - store.append((call, call)) - - def _set_memory(self, iter, memory): - MemoryEditor._set_memory(self, iter, memory) - - if isinstance(memory, chirp_common.DVMemory): - self.store.set(iter, - self.col("URCALL"), memory.dv_urcall, - self.col("RPT1CALL"), memory.dv_rpt1call, - self.col("RPT2CALL"), memory.dv_rpt2call, - self.col("Digital Code"), memory.dv_code, - ) - else: - self.store.set(iter, - self.col("URCALL"), "", - self.col("RPT1CALL"), "", - self.col("RPT2CALL"), "", - self.col("Digital Code"), 0, - ) diff --git a/chirp/ui/miscwidgets.py b/chirp/ui/miscwidgets.py deleted file mode 100644 index a7e8b78..0000000 --- a/chirp/ui/miscwidgets.py +++ /dev/null @@ -1,883 +0,0 @@ -# Copyright 2008 Dan Smith -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -import abc -import gtk -import gobject -import pango - -import os -import logging - -import six - -from chirp import platform -from chirp.ui import compat -from chirp.ui import common - -LOG = logging.getLogger(__name__) - - -class KeyedListWidget(gtk.HBox): - __gsignals__ = { - "item-selected": (gobject.SIGNAL_RUN_LAST, - gobject.TYPE_NONE, - (gobject.TYPE_STRING,)), - "item-toggled": (gobject.SIGNAL_ACTION, - gobject.TYPE_BOOLEAN, - (gobject.TYPE_STRING, gobject.TYPE_BOOLEAN)), - "item-set": (gobject.SIGNAL_ACTION, - gobject.TYPE_BOOLEAN, - (gobject.TYPE_STRING,)), - } - - def _toggle(self, rend, path, colnum): - if self.__toggle_connected: - self.__store[path][colnum] = not self.__store[path][colnum] - iter = self.__store.get_iter(path) - id, = self.__store.get(iter, 0) - self.emit("item-toggled", id, self.__store[path][colnum]) - - def _edited(self, rend, path, new, colnum): - iter = self.__store.get_iter(path) - key, oldval = self.__store.get(iter, 0, colnum) - self.__store.set(iter, colnum, new) - if not self.emit("item-set", key): - self.__store.set(iter, colnum, oldval) - - def _mouse(self, view, event): - x, y = event.get_coords() - path = self.__view.get_path_at_pos(int(x), int(y)) - if path: - self.__view.set_cursor_on_cell(path[0]) - - sel = self.get_selected() - if sel: - self.emit("item-selected", sel) - - def _make_view(self): - colnum = -1 - - self._renderers = [] - - for typ, cap in self.columns: - colnum += 1 - if colnum == 0: - continue # Key column - - if typ in [gobject.TYPE_STRING, gobject.TYPE_INT, - gobject.TYPE_FLOAT]: - rend = gtk.CellRendererText() - rend.set_property("ellipsize", pango.ELLIPSIZE_END) - column = gtk.TreeViewColumn(cap, rend, text=colnum) - elif typ in [gobject.TYPE_BOOLEAN]: - rend = gtk.CellRendererToggle() - rend.connect("toggled", self._toggle, colnum) - column = gtk.TreeViewColumn(cap, rend, active=colnum) - else: - raise Exception("Unsupported type %s" % typ) - - self._renderers.append(rend) - - column.set_sort_column_id(colnum) - self.__view.append_column(column) - - self.__view.connect("button_press_event", self._mouse) - - def set_item(self, key, *values): - iter = self.__store.get_iter_first() - while iter: - id, = self.__store.get(iter, 0) - if id == key: - self.__store.insert_after(iter, row=(id,)+values) - self.__store.remove(iter) - return - iter = self.__store.iter_next(iter) - - self.__store.append(row=(key,) + values) - - self.emit("item-set", key) - - def get_item(self, key): - iter = self.__store.get_iter_first() - while iter: - vals = self.__store.get(iter, *tuple(range(len(self.columns)))) - if vals[0] == key: - return vals - iter = self.__store.iter_next(iter) - - return None - - def del_item(self, key): - iter = self.__store.get_iter_first() - while iter: - id, = self.__store.get(iter, 0) - if id == key: - self.__store.remove(iter) - return True - - iter = self.__store.iter_next(iter) - - return False - - def has_item(self, key): - return self.get_item(key) is not None - - def get_selected(self): - try: - (store, iter) = self.__view.get_selection().get_selected() - return store.get(iter, 0)[0] - except Exception as e: - LOG.error("Unable to find selected: %s" % e) - return None - - def select_item(self, key): - if key is None: - sel = self.__view.get_selection() - sel.unselect_all() - return True - - iter = self.__store.get_iter_first() - while iter: - if self.__store.get(iter, 0)[0] == key: - selection = self.__view.get_selection() - path = self.__store.get_path(iter) - selection.select_path(path) - return True - iter = self.__store.iter_next(iter) - - return False - - def get_keys(self): - keys = [] - iter = self.__store.get_iter_first() - while iter: - key, = self.__store.get(iter, 0) - keys.append(key) - iter = self.__store.iter_next(iter) - - return keys - - def __init__(self, columns): - gtk.HBox.__init__(self, True, 0) - - self.columns = columns - - types = tuple([x for x, y in columns]) - - self.__store = gtk.ListStore(*types) - self.__view = gtk.TreeView(self.__store) - - self.pack_start(self.__view, 1, 1, 1) - - self.__toggle_connected = False - - self._make_view() - self.__view.show() - - def connect(self, signame, *args): - if signame == "item-toggled": - self.__toggle_connected = True - - gtk.HBox.connect(self, signame, *args) - - def set_editable(self, column, is_editable): - rend = self.get_renderer(column) - rend.set_property("editable", True) - rend.connect("edited", self._edited, column + 1) - - def set_sort_column(self, column, value=None): - if not value: - value = column - col = self.__view.get_column(column) - col.set_sort_column_id(value) - - def get_renderer(self, colnum): - return self._renderers[colnum] - - -class ListWidget(gtk.HBox): - __gsignals__ = { - "click-on-list": (gobject.SIGNAL_RUN_LAST, - gobject.TYPE_NONE, - (gtk.TreeView, gtk.gdk.Event)), - "item-toggled": (gobject.SIGNAL_RUN_LAST, - gobject.TYPE_NONE, - (gobject.TYPE_PYOBJECT,)), - } - - store_type = gtk.ListStore - - def mouse_cb(self, view, event): - self.emit("click-on-list", view, event) - - # pylint: disable-msg=W0613 - def _toggle(self, render, path, column): - self._store[path][column] = not self._store[path][column] - iter = self._store.get_iter(path) - vals = tuple(self._store.get(iter, *tuple(range(self._ncols)))) - for cb in self.toggle_cb: - cb(*vals) - self.emit("item-toggled", vals) - - def make_view(self, columns): - self._view = gtk.TreeView(self._store) - - for _type, _col in columns: - if _col.startswith("__"): - continue - - index = columns.index((_type, _col)) - if _type == gobject.TYPE_STRING or \ - _type == gobject.TYPE_INT or \ - _type == gobject.TYPE_FLOAT: - rend = gtk.CellRendererText() - column = gtk.TreeViewColumn(_col, rend, text=index) - column.set_resizable(True) - rend.set_property("ellipsize", pango.ELLIPSIZE_END) - elif _type == gobject.TYPE_BOOLEAN: - rend = gtk.CellRendererToggle() - rend.connect("toggled", self._toggle, index) - column = gtk.TreeViewColumn(_col, rend, active=index) - else: - raise Exception("Unknown column type (%i)" % index) - - column.set_sort_column_id(index) - self._view.append_column(column) - - self._view.connect("button_press_event", self.mouse_cb) - - def __init__(self, columns, parent=True): - gtk.HBox.__init__(self) - - # pylint: disable-msg=W0612 - col_types = tuple([x for x, y in columns]) - self._ncols = len(col_types) - - self._store = self.store_type(*col_types) - self._view = None - self.make_view(columns) - - self._view.show() - if parent: - self.pack_start(self._view, 1, 1, 1) - - self.toggle_cb = [] - - def packable(self): - return self._view - - def add_item(self, *vals): - if len(vals) != self._ncols: - raise Exception("Need %i columns" % self._ncols) - - args = [] - i = 0 - for val in vals: - args.append(i) - args.append(val) - i += 1 - - args = tuple(args) - - iter = self._store.append() - self._store.set(iter, *args) - - def _remove_item(self, model, path, iter, match): - vals = model.get(iter, *tuple(range(0, self._ncols))) - if vals == match: - model.remove(iter) - - def remove_item(self, *vals): - if len(vals) != self._ncols: - raise Exception("Need %i columns" % self._ncols) - - def remove_selected(self): - try: - (lst, iter) = self._view.get_selection().get_selected() - lst.remove(iter) - except Exception as e: - LOG.error("Unable to remove selected: %s" % e) - - def get_selected(self, take_default=False): - (lst, iter) = self._view.get_selection().get_selected() - if not iter and take_default: - iter = lst.get_iter_first() - - return lst.get(iter, *tuple(range(self._ncols))) - - def move_selected(self, delta): - (lst, iter) = self._view.get_selection().get_selected() - - pos = int(lst.get_path(iter)[0]) - - try: - target = None - - if delta > 0 and pos > 0: - target = lst.get_iter(pos-1) - elif delta < 0: - target = lst.get_iter(pos+1) - except Exception as e: - return False - - if target: - return lst.swap(iter, target) - - def _get_value(self, model, path, iter, lst): - lst.append(model.get(iter, *tuple(range(0, self._ncols)))) - - def get_values(self): - lst = [] - - self._store.foreach(self._get_value, lst) - - return lst - - def set_values(self, lst): - self._store.clear() - - for i in lst: - self.add_item(*i) - - -class TreeWidget(ListWidget): - store_type = gtk.TreeStore - - # pylint: disable-msg=W0613 - def _toggle(self, render, path, column): - self._store[path][column] = not self._store[path][column] - iter = self._store.get_iter(path) - vals = tuple(self._store.get(iter, *tuple(range(self._ncols)))) - - piter = self._store.iter_parent(iter) - if piter: - parent = self._store.get(piter, self._key)[0] - else: - parent = None - - for cb in self.toggle_cb: - cb(parent, *vals) - - def __init__(self, columns, key, parent=True): - ListWidget.__init__(self, columns, parent) - - self._key = key - - def _add_item(self, piter, *vals): - args = [] - i = 0 - for val in vals: - args.append(i) - args.append(val) - i += 1 - - args = tuple(args) - - iter = self._store.append(piter) - self._store.set(iter, *args) - - def _iter_of(self, key, iter=None): - if not iter: - iter = self._store.get_iter_first() - - while iter is not None: - _id = self._store.get(iter, self._key)[0] - if _id == key: - return iter - - iter = self._store.iter_next(iter) - - return None - - def add_item(self, parent, *vals): - if len(vals) != self._ncols: - raise Exception("Need %i columns" % self._ncols) - - if not parent: - self._add_item(None, *vals) - else: - iter = self._iter_of(parent) - if iter: - self._add_item(iter, *vals) - else: - raise Exception("Parent not found: %s", parent) - - def _set_values(self, parent, vals): - if isinstance(vals, dict): - for key, val in vals.items(): - iter = self._store.append(parent) - self._store.set(iter, self._key, key) - self._set_values(iter, val) - elif isinstance(vals, list): - for i in vals: - self._set_values(parent, i) - elif isinstance(vals, tuple): - self._add_item(parent, *vals) - else: - LOG.error("Unknown type: %s" % vals) - - def set_values(self, vals): - self._store.clear() - self._set_values(self._store.get_iter_first(), vals) - - def del_item(self, parent, key): - iter = self._iter_of(key, - self._store.iter_children(self._iter_of(parent))) - if iter: - self._store.remove(iter) - else: - raise Exception("Item not found") - - def get_item(self, parent, key): - iter = self._iter_of(key, - self._store.iter_children(self._iter_of(parent))) - - if iter: - return self._store.get(iter, *(tuple(range(0, self._ncols)))) - else: - raise Exception("Item not found") - - def set_item(self, parent, *vals): - iter = self._iter_of(vals[self._key], - self._store.iter_children(self._iter_of(parent))) - - if iter: - args = [] - i = 0 - - for val in vals: - args.append(i) - args.append(val) - i += 1 - - self._store.set(iter, *(tuple(args))) - else: - raise Exception("Item not found") - - -class ProgressDialog(gtk.Window): - def __init__(self, title, parent=None): - gtk.Window.__init__(self, gtk.WINDOW_TOPLEVEL) - self.set_modal(True) - self.set_type_hint(gtk.gdk.WINDOW_TYPE_HINT_DIALOG) - self.set_title(title) - if parent: - self.set_transient_for(parent) - - self.set_resizable(False) - - vbox = gtk.VBox(False, 2) - - self.label = gtk.Label("") - self.label.set_size_request(100, 50) - self.label.show() - - self.pbar = gtk.ProgressBar() - self.pbar.show() - - vbox.pack_start(self.label, 0, 0, 0) - vbox.pack_start(self.pbar, 0, 0, 0) - - vbox.show() - - self.add(vbox) - - def set_text(self, text): - self.label.set_text(text) - self.queue_draw() - - while gtk.events_pending(): - gtk.main_iteration_do(False) - - def set_fraction(self, frac): - self.pbar.set_fraction(frac) - self.queue_draw() - - while gtk.events_pending(): - gtk.main_iteration_do(False) - - -class LatLonEntry(gtk.Entry): - def __init__(self, *args): - gtk.Entry.__init__(self, *args) - - self.connect("changed", self.format) - - def format(self, entry): - string = entry.get_text() - if string is None: - return - - deg = u"\u00b0" - - while " " in string: - if "." in string: - break - elif deg not in string: - string = string.replace(" ", deg) - elif "'" not in string: - string = string.replace(" ", "'") - elif '"' not in string: - string = string.replace(" ", '"') - else: - string = string.replace(" ", "") - - entry.set_text(string) - - def parse_dd(self, string): - return float(string) - - def parse_dm(self, string): - string = string.strip() - string = string.replace(' ', ' ') - - (_degrees, _minutes) = string.split(' ', 2) - - degrees = int(_degrees) - minutes = float(_minutes) - - return degrees + (minutes / 60.0) - - def parse_dms(self, string): - string = string.replace(u"\u00b0", " ") - string = string.replace('"', ' ') - string = string.replace("'", ' ') - string = string.replace(' ', ' ') - string = string.strip() - - items = string.split(' ') - - if len(items) > 3: - raise Exception("Invalid format") - elif len(items) == 3: - deg = items[0] - mns = items[1] - sec = items[2] - elif len(items) == 2: - deg = items[0] - mns = items[1] - sec = 0 - elif len(items) == 1: - deg = items[0] - mns = 0 - sec = 0 - else: - deg = 0 - mns = 0 - sec = 0 - - degrees = int(deg) - minutes = int(mns) - seconds = float(sec) - - return degrees + (minutes / 60.0) + (seconds / 3600.0) - - def value(self): - string = self.get_text() - - try: - return self.parse_dd(string) - except: - try: - return self.parse_dm(string) - except: - try: - return self.parse_dms(string) - except Exception as e: - LOG.error("DMS: %s" % e) - - raise Exception("Invalid format") - - def validate(self): - try: - self.value() - return True - except: - return False - - -class YesNoDialog(gtk.Dialog): - def __init__(self, title="", parent=None, buttons=None): - gtk.Dialog.__init__(self, - title=title, - parent=parent, - buttons=buttons) - - self._label = gtk.Label("") - self._label.set_alignment(0.0, 0.5) - self._label.show() - - # pylint: disable-msg=E1101 - self.vbox.pack_start(self._label, 1, 1, 1) - - def set_text(self, text): - self._label.set_text(text) - - -@six.add_metaclass(abc.ABCMeta) -class EditableChoiceBase(object): - def __init__(self, options, editable, default): - pass - - @property - @abc.abstractmethod - def widget(self): - raise NotImplementedError() - - @property - @abc.abstractmethod - def value(self): - pass - - @value.setter - @abc.abstractmethod - def value(self): - pass - - @abc.abstractmethod - def get_model(self): - pass - - @abc.abstractmethod - def append_text(self, text): - """Add a choice option""" - pass - - def set_active(self, text): - """Legacy compat""" - self.value = text - - def get_active_text(self): - """Legacy compat""" - return self.value - - def set_sensitive(self, sensitive): - self.widget.set_sensitive(sensitive) - - def connect(self, signal, fn, data): - self.widget.connect(signal, lambda *a: fn(self, data)) - - -class EditableChoiceGTK3(EditableChoiceBase): - def __init__(self, options, editable, default): - self.store = gtk.ListStore(str) - for i, option in enumerate(options): - self.store.append([option]) - if editable: - self.sel = gtk.ComboBox.new_with_model_and_entry(self.store) - self.sel.set_entry_text_column(0) - else: - self.sel = gtk.ComboBox.new_with_model(self.store) - renderer_text = gtk.CellRendererText() - self.sel.pack_start(renderer_text, True) - self.sel.add_attribute(renderer_text, "text", 0) - if default: - self.value = default - - @property - def widget(self): - return self.sel - - @property - def value(self): - modeliter = self.sel.get_active_iter() - if modeliter: - return self.store[modeliter][0] - else: - LOG.warning('No active iter') - - @value.setter - def value(self, val): - modeliter = self.store.get_iter_first() - while modeliter is not None: - row = self.store[modeliter] - if row[0] == val: - self.sel.set_active_iter(modeliter) - break - modeliter = self.store.iter_next(modeliter) - - def get_model(self): - return self.store - - def append_text(self, text): - self.store.append([text]) - - -class EditableChoiceGTK2(EditableChoiceBase): - def __init__(self, options, editable, default): - if editable: - self.sel = gtk.combo_box_entry_new_text() - else: - self.sel = gtk.combo_box_new_text() - - for opt in options: - self.sel.append_text(opt) - - if default: - try: - idx = options.index(default) - self.sel.set_active(idx) - except Exception as e: - pass - - @property - def widget(self): - return self.sel - - @property - def value(self): - store = self.sel.get_model() - modeliter = self.sel.get_active_iter() - return store[modeliter][0] - - @value.setter - def value(self, val): - common.combo_select(self.sel, val) - - def get_model(self): - return self.sel.get_model() - - def append_text(self, text): - self.sel.append_text(text) - - -def make_choice(options, editable=True, default=None): - if hasattr(gtk.ComboBox, 'new_with_entry'): - return EditableChoiceGTK3(options, editable, default) - else: - return EditableChoiceGTK2(options, editable, default) - - -class FilenameBox(gtk.HBox): - __gsignals__ = { - "filename-changed": (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, ()), - } - - def do_browse(self, _, dir): - if self.filename.get_text(): - start = os.path.dirname(self.filename.get_text()) - else: - start = None - - if dir: - fn = platform.get_platform().gui_select_dir(start) - else: - fn = platform.get_platform().gui_save_file(start, types=self.types) - if fn: - self.filename.set_text(fn) - - def do_changed(self, _): - self.emit("filename_changed") - - def __init__(self, find_dir=False, types=[]): - gtk.HBox.__init__(self, False, 0) - - self.types = types - - self.filename = gtk.Entry() - self.filename.show() - self.pack_start(self.filename, 1, 1, 1) - - browse = gtk.Button("...") - browse.show() - self.pack_start(browse, 0, 0, 0) - - self.filename.connect("changed", self.do_changed) - browse.connect("clicked", self.do_browse, find_dir) - - def set_filename(self, fn): - self.filename.set_text(fn) - - def get_filename(self): - return self.filename.get_text() - - -def make_pixbuf_choice(options, default=None): - store = gtk.ListStore(gtk.gdk.Pixbuf, gobject.TYPE_STRING) - box = gtk.ComboBox(store) - - cell = gtk.CellRendererPixbuf() - box.pack_start(cell, True) - box.add_attribute(cell, "pixbuf", 0) - - cell = gtk.CellRendererText() - box.pack_start(cell, True) - box.add_attribute(cell, "text", 1) - - _default = None - for pic, value in options: - iter = store.append() - store.set(iter, 0, pic, 1, value) - if default == value: - _default = options.index((pic, value)) - - if _default: - box.set_active(_default) - - return box - - -def test(): - win = gtk.Window(gtk.WINDOW_TOPLEVEL) - lst = ListWidget([(gobject.TYPE_STRING, "Foo"), - (gobject.TYPE_BOOLEAN, "Bar")]) - - lst.add_item("Test1", True) - lst.set_values([("Test2", True), ("Test3", False)]) - - lst.show() - win.add(lst) - win.show() - - win1 = ProgressDialog("foo") - win1.show() - - win2 = gtk.Window(gtk.WINDOW_TOPLEVEL) - lle = LatLonEntry() - lle.show() - win2.add(lle) - win2.show() - - win3 = gtk.Window(gtk.WINDOW_TOPLEVEL) - lst = TreeWidget([(gobject.TYPE_STRING, "Id"), - (gobject.TYPE_STRING, "Value")], - 1) - lst.set_values({"Fruit": [("Apple", "Red"), ("Orange", "Orange")], - "Pizza": [("Cheese", "Simple"), ("Pepperoni", "Yummy")]}) - lst.add_item("Fruit", "Bananna", "Yellow") - lst.show() - win3.add(lst) - win3.show() - - def print_val(entry): - if entry.validate(): - print("Valid: %s" % entry.value()) - else: - print("Invalid") - lle.connect("activate", print_val) - - lle.set_text("45 13 12") - - try: - gtk.main() - except KeyboardInterrupt: - pass - - print(lst.get_values()) - - -if __name__ == "__main__": - test() diff --git a/chirp/ui/radiobrowser.py b/chirp/ui/radiobrowser.py deleted file mode 100644 index 90b2981..0000000 --- a/chirp/ui/radiobrowser.py +++ /dev/null @@ -1,350 +0,0 @@ -import gtk -import gobject -import pango -import re -import os -import logging - -from chirp import bitwise -from chirp.ui import common, config - -LOG = logging.getLogger(__name__) - -CONF = config.get() - - -def do_insert_line_with_tags(b, line): - def i(text, *tags): - b.insert_with_tags_by_name(b.get_end_iter(), text, *tags) - - def ident(name): - if "unknown" in name: - i(name, 'grey', 'bold') - else: - i(name, 'bold') - - def nonzero(value): - i(value, 'red', 'bold') - - def foo(value): - i(value, 'blue', 'bold') - - m = re.match("^( *)([A-z0-9_]+: )(0x[A-F0-9]+) \((.*)\)$", line) - if m: - i(m.group(1)) - ident(m.group(2)) - if m.group(3) == '0x00': - i(m.group(3)) - else: - nonzero(m.group(3)) - i(' (') - for char in m.group(4): - if char == '1': - nonzero(char) - else: - i(char) - i(')') - return - - m = re.match("^( *)([A-z0-9_]+: )(.*)$", line) - if m: - i(m.group(1)) - ident(m.group(2)) - i(m.group(3)) - return - - m = re.match("^(.*} )([A-z0-9_]+)( \()([0-9]+)( bytes at )(0x[A-F0-9]+)", - line) - if m: - i(m.group(1)) - ident(m.group(2)) - i(m.group(3)) - foo(m.group(4)) - i(m.group(5)) - foo(m.group(6)) - i(")") - return - - i(line) - - -def do_insert_with_tags(buf, text): - buf.set_text('') - lines = text.split(os.linesep) - for line in lines: - do_insert_line_with_tags(buf, line) - buf.insert_with_tags_by_name(buf.get_end_iter(), os.linesep) - - -def classname(obj): - return str(obj.__class__).split('.')[-1] - - -def bitwise_type(classname): - return classname.split("DataElement")[0] - - -class FixedEntry(gtk.Entry): - def __init__(self, *args, **kwargs): - super(FixedEntry, self).__init__(*args, **kwargs) - - try: - fontsize = CONF.get_int("browser_fontsize", "developer") - except Exception: - fontsize = 10 - if fontsize < 4 or fontsize > 144: - LOG.warn("Unsupported browser_fontsize %i. Using 10." % fontsize) - fontsize = 11 - - fontdesc = pango.FontDescription("Courier bold %i" % fontsize) - self.modify_font(fontdesc) - - -class IntegerEntry(FixedEntry): - def _colorize(self, _self): - value = self.get_text() - if value.startswith("0x"): - value = value[2:] - value = value.replace("0", "") - if not value: - self.modify_text(gtk.STATE_NORMAL, None) - else: - self.modify_text(gtk.STATE_NORMAL, gtk.gdk.color_parse('red')) - - def __init__(self, *args, **kwargs): - super(IntegerEntry, self).__init__(*args, **kwargs) - self.connect("changed", self._colorize) - - -class BitwiseEditor(gtk.HBox): - def __init__(self, element): - super(BitwiseEditor, self).__init__(False, 3) - self._element = element - self._build_ui() - - -class IntegerEditor(BitwiseEditor): - def _changed(self, entry, base): - if not self._update: - return - value = entry.get_text() - if value.startswith("0x"): - value = value[2:] - self._element.set_value(int(value, base)) - self._update_entries(skip=entry) - - def _update_entries(self, skip=None): - self._update = False - for ent, format_spec in self._entries: - if ent != skip: - ent.set_text(format_spec.format(int(self._element))) - self._update = True - - def _build_ui(self): - self._entries = [] - self._update = True - - hexdigits = ((self._element.size() / 4) + - (self._element.size() % 4 and 1 or 0)) - formats = [('Hex', 16, '0x{:0%iX}' % hexdigits), - ('Dec', 10, '{:d}'), - ('Bin', 2, '{:0%ib}' % self._element.size())] - for name, base, format_spec in formats: - lab = gtk.Label(name) - self.pack_start(lab, 0, 0, 0) - lab.show() - int(self._element) - ent = IntegerEntry() - self._entries.append((ent, format_spec)) - ent.connect('changed', self._changed, base) - self.pack_start(ent, 0, 0, 0) - ent.show() - self._update_entries() - - -class BCDArrayEditor(BitwiseEditor): - def _changed(self, entry, hexent): - self._element.set_value(int(entry.get_text())) - self._format_hexent(hexent) - - def _format_hexent(self, hexent): - value = "" - for i in self._element: - a, b = i.get_value() - value += "%i%i" % (a, b) - hexent.set_text(value) - - def _build_ui(self): - lab = gtk.Label("Dec") - lab.show() - self.pack_start(lab, 0, 0, 0) - ent = FixedEntry() - ent.set_text(str(int(self._element))) - ent.show() - self.pack_start(ent, 1, 1, 1) - - lab = gtk.Label("Hex") - lab.show() - self.pack_start(lab, 0, 0, 0) - - hexent = FixedEntry() - hexent.show() - self.pack_start(hexent, 1, 1, 1) - hexent.set_editable(False) - - ent.connect('changed', self._changed, hexent) - self._format_hexent(hexent) - - -class CharArrayEditor(BitwiseEditor): - def _changed(self, entry): - self._element.set_value(entry.get_text().ljust(len(self._element))) - - def _build_ui(self): - ent = FixedEntry(len(self._element)) - ent.set_text(str(self._element).rstrip("\x00")) - ent.connect('changed', self._changed) - ent.show() - self.pack_start(ent, 1, 1, 1) - - -class OtherEditor(BitwiseEditor): - def _build_ui(self): - name = classname(self._element) - name = bitwise_type(name) - if isinstance(self._element, bitwise.arrayDataElement): - name += " %s[%i]" % ( - bitwise_type(classname(self._element[0])), - len(self._element)) - - l = gtk.Label(name) - l.show() - self.pack_start(l, 1, 1, 1) - - -class RadioBrowser(common.Editor): - def _build_ui(self): - self._display = gtk.Table(20, 2) - - self._store = gtk.TreeStore(gobject.TYPE_STRING, gobject.TYPE_PYOBJECT) - self._tree = gtk.TreeView(self._store) - - rend = gtk.CellRendererText() - tvc = gtk.TreeViewColumn('Element', rend, text=0) - self._tree.append_column(tvc) - self._tree.connect('button_press_event', self._tree_click) - - self.root = gtk.HPaned() - self.root.set_position(200) - sw = gtk.ScrolledWindow() - sw.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) - sw.add(self._tree) - sw.show() - self.root.add1(sw) - sw = gtk.ScrolledWindow() - sw.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) - sw.add_with_viewport(self._display) - sw.show() - self.root.add2(sw) - self._tree.show() - self._display.show() - self.root.show() - - def _fill(self, name, obj, parent=None): - iter = self._store.append(parent, (name, obj)) - - if isinstance(obj, bitwise.structDataElement): - for name, item in obj.items(): - if isinstance(item, bitwise.structDataElement): - self._fill(name, item, iter) - elif isinstance(item, bitwise.arrayDataElement): - self._fill("%s[%i]" % (name, len(item)), item, iter) - elif isinstance(obj, bitwise.arrayDataElement): - i = 0 - for item in obj: - if isinstance(obj[0], bitwise.structDataElement): - self._fill("%s[%i]" % (name, i), item, iter) - i += 1 - - def _tree_click(self, view, event): - if event.button != 1: - return - - index = [0] - - def pack(widget, pos): - self._display.attach(widget, pos, pos + 1, index[0], index[0] + 1, - xoptions=gtk.FILL, yoptions=0) - - def next_row(): - index[0] += 1 - - def abandon(child): - self._display.remove(child) - - pathinfo = view.get_path_at_pos(int(event.x), int(event.y)) - path = pathinfo[0] - iter = self._store.get_iter(path) - name, obj = self._store.get(iter, 0, 1) - - self._display.foreach(abandon) - - for name, item in obj.items(): - if item.size() % 8 == 0: - name = '%s (%s %i bytes)' % ( - name, bitwise_type(classname(item)), item.size() / 8) - else: - name = '%s (%s %i bits)' % ( - name, bitwise_type(classname(item)), item.size()) - l = gtk.Label(name + " ") - l.set_use_markup(True) - l.show() - pack(l, 0) - - if (isinstance(item, bitwise.intDataElement) or - isinstance(item, bitwise.bcdDataElement)): - e = IntegerEditor(item) - elif (isinstance(item, bitwise.arrayDataElement) and - isinstance(item[0], bitwise.bcdDataElement)): - e = BCDArrayEditor(item) - elif (isinstance(item, bitwise.arrayDataElement) and - isinstance(item[0], bitwise.charDataElement)): - e = CharArrayEditor(item) - else: - e = OtherEditor(item) - e.show() - pack(e, 1) - next_row() - - def __init__(self, rthread): - super(RadioBrowser, self).__init__(rthread) - self._radio = rthread.radio - self._focused = False - self._build_ui() - self._fill('root', self._radio._memobj) - - def focus(self): - self._focused = True - - def unfocus(self): - if self._focused: - self.emit("changed") - self._focused = False - - -if __name__ == "__main__": - from chirp.drivers import * - from chirp import directory - import sys - - r = directory.get_radio_by_image(sys.argv[1]) - - class Foo: - radio = r - - w = gtk.Window() - b = RadioBrowser(Foo) - w.set_default_size(1024, 768) - w.add(b.root) - w.show() - gtk.main() diff --git a/chirp/ui/reporting.py b/chirp/ui/reporting.py deleted file mode 100644 index ad52be9..0000000 --- a/chirp/ui/reporting.py +++ /dev/null @@ -1,195 +0,0 @@ -# Copyright 2011 Dan Smith -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -# README: -# -# I know that collecting data is not very popular. I don't like it -# either. However, it's hard to tell what drivers people are using -# and I think it would be helpful if I had that information. This is -# completely optional, so you can turn it off if you want. It doesn't -# report anything other than version and model usage information. The -# code below is very conservative, and will disable itself if reporting -# fails even once or takes too long to perform. It's run in a thread -# so that the user shouldn't even notice it's happening. -# - -import threading -import os -import time -import logging - -from chirp import CHIRP_VERSION, platform - -REPORT_URL = "http://chirp.danplanet.com/report/report.php?do_report" -ENABLED = True -THREAD_SEM = threading.Semaphore(10) # Maximum number of outstanding threads -LAST = 0 -LAST_TYPE = None - -LOG = logging.getLogger(__name__) - -try: - # Don't let failure to import any of these modules cause trouble - from chirp.ui import config - import xmlrpclib -except: - ENABLED = False - - -def should_report(): - if not ENABLED: - LOG.info("Not reporting due to recent failure") - return False - - conf = config.get() - if conf.get_bool("no_report"): - LOG.info("Reporting disabled") - return False - - return True - - -def _report_model_usage(model, direction, success): - global ENABLED - if direction not in ["live", "download", "upload", - "import", "export", "importsrc"]: - LOG.warn("Invalid direction `%s'" % direction) - return True # This is a bug, but not fatal - - model = "%s_%s" % (model.VENDOR, model.MODEL) - data = "%s,%s,%s" % (model, direction, success) - - LOG.debug("Reporting model usage: %s" % data) - - proxy = xmlrpclib.ServerProxy(REPORT_URL) - id = proxy.report_stats(CHIRP_VERSION, - platform.get_platform().os_version_string(), - "model_use", - data) - - # If the server returns zero, it wants us to shut up - return id != 0 - - -def _report_exception(stack): - global ENABLED - - LOG.debug("Reporting exception") - - proxy = xmlrpclib.ServerProxy(REPORT_URL) - id = proxy.report_exception(CHIRP_VERSION, - platform.get_platform().os_version_string(), - "exception", - stack) - - # If the server returns zero, it wants us to shut up - return id != 0 - - -def _report_misc_error(module, data): - global ENABLED - - LOG.debug("Reporting misc error with %s" % module) - - proxy = xmlrpclib.ServerProxy(REPORT_URL) - id = proxy.report_misc_error(CHIRP_VERSION, - platform.get_platform().os_version_string(), - module, data) - - # If the server returns zero, it wants us to shut up - return id != 0 - - -def _check_for_updates(callback): - LOG.debug("Checking for updates") - proxy = xmlrpclib.ServerProxy(REPORT_URL) - ver = proxy.check_for_updates(CHIRP_VERSION, - platform.get_platform().os_version_string()) - - LOG.debug("Server reports version %s is latest" % ver) - callback(ver) - return True - - -class ReportThread(threading.Thread): - def __init__(self, func, *args): - threading.Thread.__init__(self) - self.__func = func - self.__args = args - - def _run(self): - try: - return self.__func(*self.__args) - except Exception as e: - LOG.debug("Failed to report: %s" % e) - return False - - def run(self): - start = time.time() - result = self._run() - if not result: - # Reporting failed - ENABLED = False - elif (time.time() - start) > 15: - # Reporting took too long - LOG.debug("Time to report was %.2f sec -- Disabling" % - (time.time()-start)) - ENABLED = False - - THREAD_SEM.release() - - -def dispatch_thread(func, *args): - global LAST - global LAST_TYPE - - # If reporting is disabled or failing, bail - if not should_report(): - LOG.debug("Reporting is disabled") - return - - # If the time between now and the last report is less than 5 seconds, bail - delta = time.time() - LAST - if delta < 5 and func == LAST_TYPE: - LOG.debug("Throttling...") - return - - LAST = time.time() - LAST_TYPE = func - - # If there are already too many threads running, bail - if not THREAD_SEM.acquire(False): - LOG.debug("Too many threads already running") - return - - t = ReportThread(func, *args) - t.start() - - -def report_model_usage(model, direction, success): - dispatch_thread(_report_model_usage, model, direction, success) - - -def report_exception(stack): - dispatch_thread(_report_exception, stack) - - -def report_misc_error(module, data): - dispatch_thread(_report_misc_error, module, data) - - -# Calls callback with the latest version -def check_for_updates(callback): - dispatch_thread(_check_for_updates, callback) diff --git a/chirp/ui/settingsedit.py b/chirp/ui/settingsedit.py deleted file mode 100644 index 98d1066..0000000 --- a/chirp/ui/settingsedit.py +++ /dev/null @@ -1,233 +0,0 @@ -# Copyright 2012 Dan Smith -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -import gtk -import gobject -import logging - -from chirp import chirp_common -from chirp import settings -from chirp.ui import common, miscwidgets - -LOG = logging.getLogger(__name__) - - -class RadioSettingProxy(settings.RadioSetting): - - def __init__(self, setting, editor): - self._setting = setting - self._editor = editor - - -class SettingsEditor(common.Editor): - - def __init__(self, rthread): - super(SettingsEditor, self).__init__(rthread) - - # The main box - self.root = gtk.HBox(False, 0) - - # The pane - paned = gtk.HPaned() - paned.show() - self.root.pack_start(paned, 1, 1, 0) - - # The selection tree - self._store = gtk.TreeStore(gobject.TYPE_STRING, gobject.TYPE_INT) - self._view = gtk.TreeView(self._store) - self._view.get_selection().connect("changed", self._view_changed_cb) - column = gtk.TreeViewColumn("", gtk.CellRendererText(), text=0) - column.set_widget(gtk.Label()) - self._view.append_column(column) - self._view.show() - scrolled_window = gtk.ScrolledWindow() - scrolled_window.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) - scrolled_window.add_with_viewport(self._view) - scrolled_window.set_size_request(200, -1) - scrolled_window.show() - paned.pack1(scrolled_window) - - # The settings notebook - self._notebook = gtk.Notebook() - self._notebook.set_show_tabs(False) - self._notebook.set_show_border(False) - self._notebook.show() - paned.pack2(self._notebook) - - self._changed = False - self._settings = None - - job = common.RadioJob(self._get_settings_cb, "get_settings") - job.set_desc("Getting radio settings") - self.rthread.submit(job) - - def _save_settings(self): - if self._settings is None: - return - - def setting_cb(result): - if isinstance(result, Exception): - common.show_error(_("Error in setting value: %s") % result) - elif self._changed: - self.emit("changed") - self._changed = False - - job = common.RadioJob(setting_cb, "set_settings", - self._settings) - job.set_desc("Setting radio settings") - self.rthread.submit(job) - - def _do_save_setting(self, widget, value): - if isinstance(value, settings.RadioSettingValueInteger): - value.set_value(widget.get_adjustment().get_value()) - elif isinstance(value, settings.RadioSettingValueFloat): - value.set_value(widget.get_text()) - elif isinstance(value, settings.RadioSettingValueBoolean): - value.set_value(widget.get_active()) - elif isinstance(value, settings.RadioSettingValueList): - value.set_value(widget.value) - elif isinstance(value, settings.RadioSettingValueString): - value.set_value(widget.get_text()) - else: - LOG.error("Unsupported widget type %s for %s" % - (element.value.__class__, element.get_name())) - - self._changed = True - self._save_settings() - - def _save_setting(self, widget, value): - try: - self._do_save_setting(widget, value) - except settings.InvalidValueError as e: - common.show_error(_("Invalid setting value: %s") % e) - - def _build_ui_tab(self, group): - - # The scrolled window - sw = gtk.ScrolledWindow() - sw.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) - sw.show() - - # Notebook tab - tab = self._notebook.append_page(sw, gtk.Label(_(group.get_name()))) - - # Settings table - table = gtk.Table(len(group), 2, False) - table.set_resize_mode(gtk.RESIZE_IMMEDIATE) - table.show() - sw.add_with_viewport(table) - - row = 0 - for element in group: - if not isinstance(element, settings.RadioSetting): - continue - - # Label - label = gtk.Label(element.get_shortname() + ":") - label.set_alignment(1.0, 0.5) - label.show() - - table.attach(label, 0, 1, row, row + 1, - xoptions=gtk.FILL, yoptions=0, - xpadding=6, ypadding=3) - - if isinstance(element.value, list) and \ - isinstance(element.value[0], - settings.RadioSettingValueInteger): - box = gtk.HBox(True) - else: - box = gtk.VBox(True) - - # Widget container - box.show() - table.attach(box, 1, 2, row, row + 1, - xoptions=gtk.FILL, yoptions=0, - xpadding=12, ypadding=3) - - for i in list(element.keys()): - value = element[i] - if isinstance(value, settings.RadioSettingValueInteger): - widget = gtk.SpinButton() - adj = widget.get_adjustment() - adj.configure(value.get_value(), - value.get_min(), value.get_max(), - value.get_step(), 1, 0) - widget.connect("value-changed", self._save_setting, value) - elif isinstance(value, settings.RadioSettingValueFloat): - widget = gtk.Entry() - widget.set_width_chars(16) - widget.set_text(value.format()) - widget.connect("focus-out-event", lambda w, e, v: - self._save_setting(w, v), value) - elif isinstance(value, settings.RadioSettingValueBoolean): - widget = gtk.CheckButton(_("Enabled")) - widget.set_active(value.get_value()) - widget.connect("toggled", self._save_setting, value) - elif isinstance(value, settings.RadioSettingValueList): - choice = miscwidgets.make_choice([], editable=False) - model = choice.get_model() - model.clear() - for option in value.get_options(): - choice.append_text(option) - choice.value = value.get_value() - widget = choice.widget - choice.connect("changed", self._save_setting, value) - elif isinstance(value, settings.RadioSettingValueString): - widget = gtk.Entry() - widget.set_width_chars(32) - widget.set_text(str(value).rstrip()) - widget.connect("focus-out-event", lambda w, e, v: - self._save_setting(w, v), value) - else: - LOG.error("Unsupported widget type: %s" % value.__class__) - - widget.set_sensitive(value.get_mutable()) - label.set_mnemonic_widget(widget) - widget.get_accessible().set_name(element.get_shortname()) - widget.show() - - box.pack_start(widget, 1, 1, 1) - - row += 1 - - return tab - - def _build_ui_group(self, group, parent): - tab = self._build_ui_tab(group) - - iter = self._store.append(parent) - self._store.set(iter, 0, group.get_shortname(), 1, tab) - - for element in group: - if not isinstance(element, settings.RadioSetting): - self._build_ui_group(element, iter) - - def _build_ui(self, settings): - if not isinstance(settings, list): - raise Exception("Invalid Radio Settings") - return - - self._settings = settings - for group in settings: - self._build_ui_group(group, None) - self._view.expand_all() - - def _get_settings_cb(self, settings): - gobject.idle_add(self._build_ui, settings) - - def _view_changed_cb(self, selection): - (lst, iter) = selection.get_selected() - tab, = self._store.get(iter, 1) - self._notebook.set_current_page(tab) diff --git a/chirp/ui/shiftdialog.py b/chirp/ui/shiftdialog.py deleted file mode 100644 index dee1cb4..0000000 --- a/chirp/ui/shiftdialog.py +++ /dev/null @@ -1,162 +0,0 @@ -# -# Copyright 2008 Dan Smith -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -import gtk -import gobject -import threading -import logging - -from chirp import errors, chirp_common - -LOG = logging.getLogger(__name__) - - -class ShiftDialog(gtk.Dialog): - def __init__(self, rthread, parent=None): - buttons = (gtk.STOCK_CLOSE, gtk.RESPONSE_OK) - gtk.Dialog.__init__(self, - title=_("Shift"), - buttons=buttons) - self.set_default_response(gtk.RESPONSE_OK) - self.set_position(gtk.WIN_POS_CENTER_ALWAYS) - - self.rthread = rthread - - self.__prog = gtk.ProgressBar() - self.__prog.show() - - self.__labl = gtk.Label("") - self.__labl.show() - - self.vbox.pack_start(self.__prog, 1, 1, 1) - self.vbox.pack_start(self.__labl, 0, 0, 0) - - self.quiet = False - - self.thread = None - - def _status(self, msg, prog): - self.__labl.set_text(msg) - self.__prog.set_fraction(prog) - - def status(self, msg, prog): - gobject.idle_add(self._status, msg, prog) - - def _shift_memories(self, delta, memories): - count = 0.0 - for i in memories: - src = i.number - dst = src + delta - - LOG.info("Moving %i to %i" % (src, dst)) - self.status(_("Moving {src} to {dst}").format(src=src, - dst=dst), - count / len(memories)) - - i.number = dst - if i.empty: - self.rthread.radio.erase_memory(i.number) - else: - self.rthread.radio.set_memory(i) - count += 1.0 - - return int(count) - - def _get_mems_until_hole(self, start, endokay=False, all=False): - mems = [] - - llimit, ulimit = self.rthread.radio.get_features().memory_bounds - - pos = start - while pos <= ulimit: - self.status(_("Looking for a free spot ({number})").format( - number=pos), 0) - try: - mem = self.rthread.radio.get_memory(pos) - if mem.empty and not all: - break - except errors.InvalidMemoryLocation: - break - - mems.append(mem) - pos += 1 - - if pos > ulimit and not endokay: - raise errors.InvalidMemoryLocation(_("No space to insert a row")) - - LOG.debug("Found a hole: %i" % pos) - - return mems - - def _insert_hole(self, start): - mems = self._get_mems_until_hole(start) - mems.reverse() - if mems: - ret = self._shift_memories(1, mems) - if ret: - # Clear the hole we made - self.rthread.radio.erase_memory(start) - return ret - else: - LOG.warn("No memory list?") - return 0 - - def _delete_hole(self, start, all=False): - mems = self._get_mems_until_hole(start+1, endokay=True, all=all) - if mems: - count = self._shift_memories(-1, mems) - self.rthread.radio.erase_memory(count+start) - return count - else: - LOG.warn("No memory list?") - return 0 - - def finished(self): - if self.quiet: - gobject.idle_add(self.response, gtk.RESPONSE_OK) - else: - gobject.idle_add(self.set_response_sensitive, - gtk.RESPONSE_OK, True) - - def threadfn(self, newhole, func, *args): - self.status("Waiting for radio to become available", 0) - self.rthread.lock() - - try: - count = func(newhole, *args) - except errors.InvalidMemoryLocation as e: - self.status(str(e), 0) - self.finished() - return - - self.rthread.unlock() - self.status(_("Moved {count} memories").format(count=count), 1) - - self.finished() - - def insert(self, newhole, quiet=False): - self.quiet = quiet - self.thread = threading.Thread(target=self.threadfn, - args=(newhole, self._insert_hole)) - self.thread.start() - gtk.Dialog.run(self) - - def delete(self, newhole, quiet=False, all=False): - self.quiet = quiet - self.thread = threading.Thread(target=self.threadfn, - args=(newhole, self._delete_hole, all)) - self.thread.start() - gtk.Dialog.run(self) diff --git a/chirp/util.py b/chirp/util.py index 001f749..392c05f 100644 --- a/chirp/util.py +++ b/chirp/util.py @@ -13,36 +13,43 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import six import struct +import sys -def hexprint(data, addrfmt=None): - """Return a hexdump-like encoding of @data""" - if addrfmt is None: - addrfmt = '%(addr)03i' +def byte_to_int(b): + """This does what is needed to convert a bytes()[i] to an int""" + + if sys.version_info.major == 3 and isinstance(b, int): + return b + else: + return ord(b) - block_size = 8 - lines = len(data) // block_size +def int_to_byte(i): + """This does what is needed to convert an int to a bytes""" - if six.PY3 and isinstance(data, bytes): - pad = bytes([0]) + if sys.version_info.major == 3 and isinstance(i, int): + return bytes([i]) + elif isinstance(i, int): + return chr(i) else: - pad = '\x00' + return i - if (len(data) % block_size) != 0: - lines += 1 - data += pad * ((lines * block_size) - len(data)) +def hexprint(data, addrfmt=None): + """Return a hexdump-like encoding of @data""" + if addrfmt is None: + addrfmt = '%(addr)03i' + + block_size = 8 out = "" - if six.PY3 and isinstance(data, bytes): - byte_to_int = lambda b: b - else: - byte_to_int = ord + blocks = len(data) // block_size + if len(data) % block_size: + blocks += 1 - for block in range(0, (len(data) // block_size)): + for block in range(0, blocks): addr = block * block_size try: out += addrfmt % locals() @@ -50,26 +57,22 @@ def hexprint(data, addrfmt=None): out += "%03i" % addr out += ': ' - left = len(data) - (block * block_size) - if left < block_size: - limit = left - else: - limit = block_size - - for j in range(0, limit): - byte = data[(block * block_size) + j] - if isinstance(byte, str): - byte = ord(byte) - out += "%02x " % byte + for j in range(0, block_size): + try: + out += "%02x " % byte_to_int(data[(block * block_size) + j]) + except IndexError: + out += " " out += " " - for j in range(0, limit): - byte = data[(block * block_size) + j] - if isinstance(byte, str): - byte = ord(byte) - if byte > 0x20 and byte < 0x7E: - out += "%s" % chr(byte) + for j in range(0, block_size): + try: + char = byte_to_int(data[(block * block_size) + j]) + except IndexError: + char = ord('.') + + if char > 0x20 and char < 0x7E: + out += "%s" % chr(char) else: out += "." diff --git a/chirp/wxui/__init__.py b/chirp/wxui/__init__.py index e69de29..e2f9a6b 100644 --- a/chirp/wxui/__init__.py +++ b/chirp/wxui/__init__.py @@ -0,0 +1,214 @@ +import argparse +import builtins +import logging +import os +import sys + +if sys.version_info < (3, 10): + import importlib_resources +else: + import importlib.resources as importlib_resources + +from chirp import directory +from chirp import logger + +LOG = logging.getLogger(__name__) +CONF = None + + +def maybe_install_desktop(): + local = os.path.join(os.path.expanduser('~'), '.local') + desktop_path = os.path.join(local, 'share', + 'applications', 'chirp.desktop') + with importlib_resources.as_file( + importlib_resources.files('chirp.share') + .joinpath('chirp.desktop')) as desktop_src: + with open(desktop_src) as f: + desktop_content = f.readlines() + with importlib_resources.as_file( + importlib_resources.files('chirp.share') + .joinpath('chirp.ico')) as p: + icon_path = str(p) + if os.path.exists(desktop_path): + return + + import wx + r = wx.MessageBox( + _('Would you like CHIRP to install a desktop icon for you?'), + _('Install desktop icon?'), style=wx.YES_NO) + if r != wx.YES: + CONF.set_bool('offered_desktop', True, 'state') + return + + os.makedirs(os.path.dirname(desktop_path), exist_ok=True) + + # Try to run chirp by name from ~/.local/bin + exec_path = os.path.join(local, 'bin', 'chirp') + if not os.path.exists(exec_path): + # If that doesn't work, then just run it with our python via + # module, which should always work + exec_path = '%s -mchirp.wxui' % sys.executable + with open(desktop_path, 'w') as f: + for line in desktop_content: + if line.startswith('Exec'): + f.write('Exec=%s\n' % exec_path) + elif line.startswith('Icon'): + f.write('Icon=%s\n' % icon_path) + else: + f.write(line) + LOG.debug('Wrote %s with exec=%r icon=%r' % ( + f.name, exec_path, icon_path)) + + +def chirpmain(): + global CONF + import wx + # This must be imported before wx.App() to squelch warnings on startup + # about duplicate "Windows bitmap file" handlers + import wx.richtext + + from chirp.wxui import config + CONF = config.get() + + actions = ['upload', 'download', 'query_rr', 'query_mg', + 'query_rb', 'query_dm', 'new'] + + parser = argparse.ArgumentParser() + parser.add_argument("files", metavar="file", nargs='*', + help="File to open") + parser.add_argument("--module", metavar="module", + help="Load module on startup") + logger.add_version_argument(parser) + parser.add_argument("--profile", action="store_true", + help="Enable profiling") + parser.add_argument("--onlydriver", nargs="+", + help="Include this driver while loading") + parser.add_argument("--inspect", action="store_true", + help="Show wxPython inspector") + parser.add_argument('--page', default=None, + help='Select this page of the default editor at start') + parser.add_argument('--action', default=None, choices=actions, + help='Start UI action immediately') + parser.add_argument('--restore', default=None, action='store_true', + help="Restore previous tabs") + parser.add_argument('--force-language', default=None, + help='Force locale to this ISO language code') + if sys.platform == 'linux': + parser.add_argument('--no-linux-gdk-backend', action='store_true', + help='Do not force GDK_BACKEND=x11') + parser.add_argument('--install-desktop-app', action='store_true', + default=not CONF.get_bool('offered_desktop', + 'state'), + help='Prompt to install a desktop icon') + logger.add_arguments(parser) + args = parser.parse_args() + logger.handle_options(args) + + app = wx.App() + if args.force_language: + force_lang = wx.Locale.FindLanguageInfo(args.force_language) + if force_lang is None: + print('Failed to find language %r' % args.force_language) + return 1 + LOG.info('Forcing locale to %r (%s)' % ( + args.force_language, force_lang.Description)) + lang = force_lang.Language + elif CONF.is_defined('force_language', 'prefs'): + prefs_lang = CONF.get('force_language', 'prefs') + force_lang = wx.Locale.FindLanguageInfo(prefs_lang) + if force_lang is None: + LOG.warning('Config prefs.force_language specifies unknown ' + 'language %r', prefs_lang) + lang = wx.Locale.GetSystemLanguage() + else: + LOG.info('Forcing locale to %r (%s) via config', prefs_lang, + force_lang.Description) + lang = force_lang.Language + else: + lang = wx.Locale.GetSystemLanguage() + + localedir = str(os.path.join(importlib_resources.files('chirp'), + 'locale')) + app._lc = wx.Locale() + if localedir and os.path.isdir(localedir): + wx.Locale.AddCatalogLookupPathPrefix(localedir) + else: + LOG.warning('Did not find localedir: %s' % localedir) + + if lang != wx.LANGUAGE_UNKNOWN: + app._lc.Init(lang) + else: + LOG.warning('Initializing locale without known language') + app._lc.Init() + app._lc.AddCatalog('CHIRP') + builtins._ = wx.GetTranslation + LOG.debug('Using locale: %s (%i)', + app._lc.GetCanonicalName(), + lang) + LOG.debug('Translation loaded=%s for CHIRP: %s (%s) from %s', + app._lc.IsLoaded('CHIRP'), + wx.Translations.Get().GetBestTranslation('CHIRP'), + ','.join( + wx.Translations.Get().GetAvailableTranslations('CHIRP')), + localedir) + LOG.debug('Translation loaded=%s for wxstd: %s (%s)', + app._lc.IsLoaded('wxstd'), + wx.Translations.Get().GetBestTranslation('wxstd'), + ','.join( + wx.Translations.Get().GetAvailableTranslations('wxstd'))) + + from chirp.wxui import main + from chirp.wxui import report + + logging.getLogger('main').info(report.get_environment()) + + directory.import_drivers(limit=args.onlydriver) + + if CONF.get('developer', 'state'): + from chirp.drivers import fake + fake.register_fakes() + + # wxGTK on Wayland seems to have problems. Override GDK_BACKEND to + # use X11, unless we were asked not to + if sys.platform == 'linux' and not args.no_linux_gdk_backend: + os.putenv('GDK_BACKEND', 'x11') + + app.SetAppName('CHIRP') + mainwindow = main.ChirpMain(None, title='CHIRP') + mainwindow.Show() + + if args.module: + mainwindow.load_module(args.module) + + if args.restore or CONF.get_bool('restore_tabs', 'prefs'): + restored = mainwindow.restore_tabs(None) + else: + restored = [] + + for fn in args.files: + if os.path.abspath(fn) in restored: + LOG.info('File %s on the command line is already being restored', + fn) + continue + mainwindow.open_file(fn, select=False) + + if args.page: + mainwindow.current_editorset.select_editor(name=args.page) + + if args.inspect: + from wx.lib import inspection + inspection.InspectionTool().Show() + + if args.action: + wx.CallAfter(getattr(mainwindow, '_menu_%s' % args.action), None) + + report.check_for_updates( + lambda ver: wx.CallAfter(main.display_update_notice, ver)) + + if sys.platform == 'linux' and args.install_desktop_app: + try: + maybe_install_desktop() + except Exception as e: + LOG.exception('Failed to run linux desktop installer: %s', e) + + app.MainLoop() diff --git a/chirp/wxui/__main__.py b/chirp/wxui/__main__.py new file mode 100755 index 0000000..537d07d --- /dev/null +++ b/chirp/wxui/__main__.py @@ -0,0 +1,6 @@ +import sys + +from chirp.wxui import chirpmain + +if __name__ == '__main__': + sys.exit(chirpmain()) diff --git a/chirp/wxui/bankedit.py b/chirp/wxui/bankedit.py new file mode 100644 index 0000000..91129e4 --- /dev/null +++ b/chirp/wxui/bankedit.py @@ -0,0 +1,305 @@ +# Copyright 2022 Dan Smith +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +import platform + +import wx +import wx.grid + +from chirp import chirp_common +from chirp.wxui import common +from chirp.wxui import config +from chirp.wxui import memedit + +CONF = config.get() + + +if platform.system() == 'Linux': + BANK_SET_VALUE = 'X' +else: + BANK_SET_VALUE = '1' + + +class ChirpBankToggleColumn(memedit.ChirpMemoryColumn): + def __init__(self, bank, radio): + self.bank = bank + super().__init__('bank-%s' % bank.get_index(), radio) + + @property + def label(self): + return '%s(%s)' % (self.bank.get_name(), + self.bank.get_index()) + + def hidden_for(self, memory): + return False + + def get_editor(self): + return wx.grid.GridCellBoolEditor() + + def get_renderer(self): + return wx.grid.GridCellBoolRenderer() + + +class ChirpBankIndexColumn(memedit.ChirpMemoryColumn): + def __init__(self, model, radio): + self.model = model + super().__init__('bank_index', radio) + + @property + def label(self): + return _('Index') + + def get_editor(self): + lower, upper = self.model.get_index_bounds() + return wx.grid.GridCellNumberEditor(lower, upper) + + +class ChirpBankEdit(common.ChirpEditor): + def __init__(self, radio, *a, **k): + super(ChirpBankEdit, self).__init__(*a, **k) + + self._radio = radio + self._features = radio.get_features() + self._bankmodel = radio.get_bank_model() + + self._col_defs = self._setup_columns() + + self._grid = memedit.ChirpMemoryGrid(self) + self._grid.CreateGrid( + self._features.memory_bounds[1] - self._features.memory_bounds[0] + + 1, len(self._col_defs)) + # GridSelectNone only available in >=4.2.0 + if hasattr(wx.grid.Grid, 'GridSelectNone'): + self._grid.SetSelectionMode(wx.grid.Grid.GridSelectNone) + self._grid.DisableDragRowSize() + self._grid.SetFocus() + + sizer = wx.BoxSizer(wx.VERTICAL) + sizer.Add(self._grid, proportion=1, flag=wx.EXPAND) + self.SetSizer(sizer) + + self._fixed_font = wx.Font(pointSize=10, + family=wx.FONTFAMILY_TELETYPE, + style=wx.FONTSTYLE_NORMAL, + weight=wx.FONTWEIGHT_NORMAL) + self._variable_font = self._grid.GetDefaultCellFont() + self.update_font(False) + + for col, col_def in enumerate(self._col_defs): + self._grid.SetColLabelValue(col, col_def.label) + attr = wx.grid.GridCellAttr() + if platform.system() != 'Linux': + attr.SetEditor(col_def.get_editor()) + attr.SetRenderer(col_def.get_renderer()) + attr.SetReadOnly(not (isinstance(col_def, ChirpBankToggleColumn) or + isinstance(col_def, ChirpBankIndexColumn))) + attr.SetAlignment(wx.ALIGN_CENTER, wx.ALIGN_CENTER) + self._grid.SetColAttr(col, attr) + + self._memory_cache = {} + + self._grid.Bind(wx.grid.EVT_GRID_CELL_CHANGING, self._index_changed) + self._grid.Bind(wx.grid.EVT_GRID_CELL_LEFT_CLICK, self._memory_changed) + self._grid.Bind(wx.grid.EVT_GRID_LABEL_LEFT_DCLICK, self._label_click) + self._grid.GetGridColLabelWindow().Bind(wx.EVT_MOTION, + self._colheader_mouseover) + + def update_font(self, refresh=True): + fixed = CONF.get_bool('font_fixed', 'state', False) + large = CONF.get_bool('font_large', 'state', False) + if fixed: + font = self._fixed_font + else: + font = self._variable_font + if large: + font = wx.Font(font) + font.SetPointSize(font.PointSize + 2) + self._grid.SetDefaultCellFont(font) + if refresh: + self.refresh() + wx.CallAfter(self._grid.AutoSizeColumns, setAsMin=False) + wx.CallAfter(self._grid.AutoSizeRows, setAsMin=False) + + def selected(self): + self.refresh_memories() + + def refresh_memories(self): + self._memory_cache = {} + lower, upper = self._features.memory_bounds + + for i in range(lower, upper + 1): + mem = self._radio.get_memory(i) + self._refresh_memory(mem) + + wx.CallAfter(self._grid.AutoSizeColumns, setAsMin=True) + + def _setup_columns(self): + defs = [ + memedit.ChirpFrequencyColumn('freq', self._radio), + memedit.ChirpMemoryColumn('name', self._radio), + ] + if isinstance(self._bankmodel, + chirp_common.MappingModelIndexInterface): + defs.append(ChirpBankIndexColumn(self._bankmodel, self._radio)) + + self._meta_cols = len(defs) + + self._bank_indexes = {} + self._bank_index_order = [] + for bank in self._bankmodel.get_mappings(): + self._bank_index_order.append(bank.get_index()) + self._bank_indexes[bank.get_index()] = bank + defs.append(ChirpBankToggleColumn(bank, self._radio)) + + return defs + + def col2bank(self, col): + if col < self._meta_cols: + raise RuntimeError('Error: column %i is not a bank' % col) + return col - self._meta_cols + + def bank2col(self, bank): + return bank + self._meta_cols + + def row2mem(self, row): + return row + self._features.memory_bounds[0] + + def mem2row(self, mem): + return mem - self._features.memory_bounds[0] + + def _colheader_mouseover(self, event): + x = event.GetX() + y = event.GetY() + col = self._grid.XToCol(x, y) + tip = '' + if col >= self._meta_cols: + bank = self._bankmodel.get_mappings()[self.col2bank(col)] + if hasattr(bank, 'set_name'): + tip = _('Double-click to change bank name') + self._grid.GetGridColLabelWindow().SetToolTip(tip) + + def _label_click(self, event): + row = event.GetRow() + col = event.GetCol() + if row != -1: + # Row labels do not change + return + bank = self._bankmodel.get_mappings()[self.col2bank(col)] + if not hasattr(bank, 'set_name'): + return + d = wx.TextEntryDialog(self, + _('Enter a new name for bank %s:') % ( + bank.get_index()), + _('Rename bank')) + d.SetValue(bank.get_name()) + if d.ShowModal() == wx.ID_OK: + self.change_bank_name(col, bank, d.GetValue()) + wx.PostEvent(self, common.EditorChanged(self.GetId())) + + def change_bank_name(self, col, bank, name): + bank.set_name(name) + # Refresh the column from the col def to make sure it stuck + col_def = self._col_defs[col] + self._grid.SetColLabelValue(col, col_def.label) + wx.CallAfter(self._grid.AutoSizeColumns, setAsMin=True) + + @common.error_proof() + def _index_changed(self, event): + row = event.GetRow() + col = event.GetCol() + value = event.GetString() + if isinstance(self._col_defs[col], ChirpBankIndexColumn): + self._change_memory_index(self.row2mem(row), int(value)) + + def _change_memory_index(self, number, index): + for i, bank_index in enumerate(self._bank_index_order): + if self._grid.GetCellValue(self.mem2row(number), + self.bank2col(i)) == BANK_SET_VALUE: + member_bank = self._bank_indexes[bank_index] + break + else: + raise Exception(_('Memory must be in a bank to be edited')) + + self._bankmodel.set_memory_index(self._memory_cache[number], + member_bank, + index) + + wx.PostEvent(self, common.EditorChanged(self.GetId())) + + @common.error_proof() + def _memory_changed(self, event): + row = event.GetRow() + col = event.GetCol() + value = self._grid.GetCellValue(row, col) + + if isinstance(self._col_defs[col], ChirpBankIndexColumn): + event.Skip() + elif col < self._meta_cols: + event.Skip() + else: + self._change_memory_mapping(self.row2mem(row), + self.col2bank(col), + value != BANK_SET_VALUE) + + def _change_memory_mapping(self, number, bank, present): + mem = self._memory_cache[number] + bank = self._bank_indexes[self._bank_index_order[bank]] + if present: + self._bankmodel.add_memory_to_mapping(mem, bank) + else: + self._bankmodel.remove_memory_from_mapping(mem, bank) + + self._refresh_memory(mem) + + wx.PostEvent(self, common.EditorChanged(self.GetId())) + + @common.error_proof() + def _refresh_memory(self, mem): + self._memory_cache[mem.number] = mem + self._grid.SetRowLabelValue(self.mem2row(mem.number), + '%i' % mem.number) + + bank_index = None + member = [bank.get_index() + for bank in self._bankmodel.get_memory_mappings(mem)] + for i, bank in enumerate(self._bank_indexes.values()): + present = bank.get_index() in member and not mem.empty + self._grid.SetCellValue(self.mem2row(mem.number), + self.bank2col(i), + present and BANK_SET_VALUE or '') + if present and isinstance(self._bankmodel, + chirp_common.MappingModelIndexInterface): + # NOTE: if this is somehow an indexed many-to-one model, + # we will only get the last index! + bank_index = self._bankmodel.get_memory_index(mem, bank) + + for i in range(0, self._meta_cols): + meta_col = self._col_defs[i] + if meta_col.name == 'freq': + freq = '' if mem.empty else chirp_common.format_freq(mem.freq) + self._grid.SetCellValue( + self.mem2row(mem.number), i, freq) + elif meta_col.name == 'name': + self._grid.SetCellValue( + self.mem2row(mem.number), + i, '' if mem.empty else mem.name) + elif meta_col.name == 'bank_index' and bank_index is not None: + self._grid.SetCellValue( + self.mem2row(mem.number), + i, '' if mem.empty else '%i' % bank_index) + + +class ChirpBankEditSync(ChirpBankEdit, common.ChirpSyncEditor): + pass diff --git a/chirp/wxui/clone.py b/chirp/wxui/clone.py index a3bb41d..35e07e9 100644 --- a/chirp/wxui/clone.py +++ b/chirp/wxui/clone.py @@ -1,20 +1,45 @@ +# Copyright 2022 Dan Smith +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + import collections import logging import textwrap import threading import serial +from serial.tools import list_ports import wx import wx.lib.sized_controls from chirp import chirp_common from chirp import directory -from chirp import platform -from chirp.ui import config +from chirp.drivers import fake +from chirp.wxui import config from chirp.wxui import common +from chirp.wxui import developer LOG = logging.getLogger(__name__) CONF = config.get() +HELPME = _('Help Me...') +CUSTOM = _('Custom...') + +FAKES = { + 'Fake NOP': developer.FakeSerial(), + 'Fake Echo NOP': developer.FakeEchoSerial(), + 'Fake F7E': fake.FakeKenwoodSerial(), +} class CloneThread(threading.Thread): @@ -25,6 +50,17 @@ class CloneThread(threading.Thread): self._fn = getattr(self._radio, fn) self._radio.status_fn = self._status + def stop(self): + LOG.warning('Stopping clone thread') + + # Clear out our dialog reference, which should stop us from + # eventing to a missing window, and reporting error, when we have + # already been asked to cancel + self._dialog = None + + # Close the serial, which should stop the clone soon + self._radio.pipe.close() + def _status(self, status): self._dialog._status(status) @@ -32,10 +68,21 @@ class CloneThread(threading.Thread): try: self._fn() except Exception as e: - LOG.exception('Failed to clone: %s' % e) - self._dialog.fail(str(e)) + if self._dialog: + LOG.exception('Failed to clone: %s' % e) + self._dialog.fail(str(e)) + else: + LOG.warning('Clone failed after cancel: %s', e) else: - self._dialog.complete() + if self._dialog: + self._dialog.complete() + finally: + try: + self._radio.pipe.close() + except OSError: + # If we were canceled and we have already closed an active + # serial, this will fail with EBADF + pass # NOTE: This is the legacy settings thread that facilitates @@ -73,6 +120,30 @@ class SettingsThread(threading.Thread): wx.CallAfter(self._dialog.Update, 100, newmsg=_('Complete')) +def open_serial(port, rclass): + if port.startswith('Fake'): + return FAKES[port] + if '://' in port: + pipe = serial.serial_for_url(port, do_not_open=True) + pipe.timeout = 0.25 + pipe.rtscts = rclass.HARDWARE_FLOW + pipe.rts = rclass.WANTS_RTS + pipe.dtr = rclass.WANTS_DTR + pipe.open() + pipe.baudrate = rclass.BAUD_RATE + else: + pipe = serial.Serial(baudrate=rclass.BAUD_RATE, + rtscts=rclass.HARDWARE_FLOW, timeout=0.25) + pipe.rts = rclass.WANTS_RTS + pipe.dtr = rclass.WANTS_DTR + pipe.port = port + pipe.open() + + LOG.debug('Serial opened: %s (rts=%s dtr=%s)', + pipe, pipe.rts, pipe.dtr) + return pipe + + class ChirpRadioPromptDialog(wx.Dialog): def __init__(self, *a, **k): self.radio = k.pop('radio') @@ -83,17 +154,21 @@ class ChirpRadioPromptDialog(wx.Dialog): prompts = self.radio.get_prompts() self.message = getattr(prompts, self.prompt) + if '\n' not in self.message: + self.message = '\n'.join(textwrap.wrap(self.message)) + bs = self.CreateButtonSizer(buttons) vbox = wx.BoxSizer(wx.VERTICAL) self.SetSizer(vbox) - vbox.Add(wx.StaticText(self, - label='\n'.join(textwrap.wrap(self.message))), + instructions = wx.StaticText(self) + instructions.SetLabelMarkup(self.message) + vbox.Add(instructions, border=20, flag=wx.ALL) - self.cb = wx.CheckBox(self, - label="Do not prompt again for %s %s" % ( - self.radio.VENDOR, self.radio.MODEL)) + self.cb = wx.CheckBox( + self, label=_("Do not prompt again for %s") % ( + '%s %s' % (self.radio.VENDOR, self.radio.MODEL))) vbox.Add(self.cb, border=20, flag=wx.ALL) - vbox.Add(bs) + vbox.Add(bs, flag=wx.ALL, border=10) self.Fit() self.Centre() @@ -122,56 +197,77 @@ class ChirpRadioPromptDialog(wx.Dialog): return status +def port_label(port): + if not port.description: + return port.device + elif port.description == 'n/a': + return port.device + elif port.device not in port.description: + return '%s (%s)' % (port.description, port.device) + else: + return port.description + + +# Make this global so it sticks for a session +CUSTOM_PORTS = [] + + class ChirpCloneDialog(wx.Dialog): def __init__(self, *a, **k): super(ChirpCloneDialog, self).__init__( - *a, title='Communicate with radio', **k) + *a, title=_('Communicate with radio'), **k) + self._clone_thread = None + grid = wx.FlexGridSizer(2, 5, 5) + grid.AddGrowableCol(1) + bs = self.CreateButtonSizer(wx.OK | wx.CANCEL) - self.SetSize(-1, 260) - - try: - grid = wx.FlexGridSizer(3, 2) - except TypeError: - grid = wx.FlexGridSizer(2, 5, 0) + if CONF.get_bool('developer', 'state'): + for fakeserial in FAKES.keys(): + if fakeserial not in CUSTOM_PORTS: + CUSTOM_PORTS.append(fakeserial) def _add_grid(label, control): grid.Add(wx.StaticText(self, label=label), - border=20, flag=wx.ALIGN_CENTER | wx.RIGHT | wx.LEFT) - grid.Add(control, 1, flag=wx.EXPAND) - - ports = platform.get_platform().list_serial_ports() - last_port = CONF.get('last_port', 'state') - if last_port and last_port not in ports: - ports.insert(0, last_port) - elif not last_port: - last_port = ports[0] - self._port = wx.ComboBox(self, choices=ports, style=wx.CB_DROPDOWN) - self._port.SetValue(last_port) - self.Bind(wx.EVT_COMBOBOX, self._selected_port, self._port) - _add_grid('Port', self._port) + proportion=1, border=10, + flag=wx.ALIGN_CENTER | wx.RIGHT | wx.LEFT) + grid.Add(control, + proportion=1, border=10, + flag=wx.EXPAND | wx.RIGHT | wx.LEFT) + + self._port = wx.Choice(self, choices=[]) + self._port.SetMaxSize((50, -1)) + self.set_ports() + self.Bind(wx.EVT_CHOICE, self._selected_port, self._port) + _add_grid(_('Port'), self._port) self._vendor = wx.Choice(self, choices=['Icom', 'Yaesu']) - _add_grid('Vendor', self._vendor) + _add_grid(_('Vendor'), self._vendor) self.Bind(wx.EVT_CHOICE, self._selected_vendor, self._vendor) self._model = wx.Choice(self, choices=[]) - _add_grid('Model', self._model) + _add_grid(_('Model'), self._model) self.Bind(wx.EVT_CHOICE, self._selected_model, self._model) self.gauge = wx.Gauge(self) - bs = self.CreateButtonSizer(wx.OK | wx.CANCEL) self.Bind(wx.EVT_BUTTON, self._action) vbox = wx.BoxSizer(wx.VERTICAL) - vbox.Add(grid, proportion=0, flag=wx.ALIGN_CENTER_HORIZONTAL | wx.TOP, + vbox.Add(grid, proportion=1, + flag=wx.TOP | wx.BOTTOM | wx.EXPAND, border=20) - vbox.Add(self.gauge, flag=wx.EXPAND | wx.LEFT | wx.RIGHT, border=10, + self.status_msg = wx.StaticText( + self, label='', + style=(wx.ALIGN_CENTER_HORIZONTAL | wx.ST_NO_AUTORESIZE | + wx.ELLIPSIZE_END)) + vbox.Add(self.status_msg, + border=5, proportion=0, + flag=wx.EXPAND | wx.BOTTOM) + vbox.Add(self.gauge, flag=wx.EXPAND | wx.RIGHT | wx.LEFT, border=10, proportion=0) - vbox.Add(wx.StaticLine(self), flag=wx.EXPAND | wx.TOP, border=10) - vbox.Add(bs) + vbox.Add(wx.StaticLine(self), flag=wx.EXPAND | wx.ALL, border=5) + vbox.Add(bs, flag=wx.ALL, border=10) self.SetSizer(vbox) - self.Layout() self.Center() self._vendors = collections.defaultdict(list) @@ -180,8 +276,7 @@ class ChirpCloneDialog(wx.Dialog): not issubclass(rclass, chirp_common.LiveRadio)): continue self._vendors[rclass.VENDOR].append(rclass) - for alias in rclass.ALIASES: - self._vendors[alias.VENDOR].append(alias) + self._add_aliases(rclass) for models in self._vendors.values(): models.sort(key=lambda x: '%s %s' % (x.MODEL, x.VARIANT)) @@ -193,6 +288,107 @@ class ChirpCloneDialog(wx.Dialog): except ValueError: LOG.warning('Last vendor/model not found') + self.SetMinSize((400, 200)) + self.Fit() + + def set_ports(self, system_ports=None, select=None): + if not system_ports: + system_ports = list_ports.comports() + + # These are ports that we should never offer to the user because + # they get picked up by the list but are not usable or relevant. + filter_ports = [ + # MacOS unpaired bluetooth serial + '/dev/cu.Bluetooth-Incoming-Port', + ] + + self.ports = [(port.device, port_label(port)) + for port in system_ports + if port.device not in filter_ports] + self.ports.sort() + + favorite_ports = CONF.get('favorite_ports', 'state') or '' + for port in favorite_ports.split(','): + if port and port not in [x[0] for x in self.ports]: + self.ports.insert(0, (port, port)) + + for port in CUSTOM_PORTS: + if port not in [x[0] for x in self.ports]: + self.ports.insert(0, (port, port)) + + if not select: + select = CONF.get('last_port', 'state') + + if not self.ports: + LOG.warning('No ports available; action will be disabled') + okay_btn = self.FindWindowById(self.GetAffirmativeId()) + okay_btn.Enable(bool(self.ports)) + + self._port.SetItems([x[1] for x in self.ports] + + [CUSTOM, HELPME]) + for device, name in self.ports: + if device == select: + self._port.SetStringSelection(name) + break + else: + LOG.warning('Unable to select %r' % select) + + def get_selected_port(self): + selected = self._port.GetStringSelection() + for device, name in self.ports: + if name == selected: + return device + LOG.warning('Did not find device for selected port %s' % selected) + return selected + + def _port_assist(self, event): + r = wx.MessageBox( + _('Unplug your cable (if needed) and then click OK'), + _('USB Port Finder'), + style=wx.OK | wx.CANCEL | wx.OK_DEFAULT) + if r == wx.CANCEL: + return + before = list_ports.comports() + r = wx.MessageBox( + _('Plug in your cable and then click OK'), + _('USB Port Finder'), + style=wx.OK | wx.CANCEL | wx.OK_DEFAULT) + if r == wx.CANCEL: + return + after = list_ports.comports() + changed = set(after) - set(before) + found = None + if not changed: + wx.MessageBox( + _('Unable to determine port for your cable. ' + 'Check your drivers and connections.'), + _('USB Port Finder')) + self.set_ports(after) + return + elif len(changed) == 1: + found = list(changed)[0] + wx.MessageBox( + '%s\n%s' % (_('Your cable appears to be on port:'), + port_label(found)), + _('USB Port Finder')) + else: + wx.MessageBox( + _('More than one port found: %s') % ', '.join(changed), + _('USB Port Finder')) + self.set_ports(after) + return + self.set_ports(after, select=found.device) + + def _add_aliases(self, rclass): + for alias in rclass.ALIASES: + class DynamicRadioAlias(rclass): + _orig_rclass = rclass + VENDOR = alias.VENDOR + MODEL = alias.MODEL + VARIANT = alias.VARIANT + + self._vendors[alias.VENDOR].append(DynamicRadioAlias) + def disable_model_select(self): self._vendor.Disable() self._model.Disable() @@ -204,9 +400,20 @@ class ChirpCloneDialog(wx.Dialog): def _persist_choices(self): CONF.set('last_vendor', self._vendor.GetStringSelection(), 'state') CONF.set('last_model', self._model.GetStringSelection(), 'state') - CONF.set('last_port', self._port.GetValue(), 'state') + CONF.set('last_port', self.get_selected_port(), 'state') def _selected_port(self, event): + if self._port.GetStringSelection() == CUSTOM: + port = wx.GetTextFromUser(_('Enter custom port:'), + _('Custom Port'), + parent=self) + if port: + CUSTOM_PORTS.append(port) + self.set_ports(select=port or None) + return + elif self._port.GetStringSelection() == HELPME: + self._port_assist(event) + return self._persist_choices() def _select_vendor(self, vendor): @@ -230,7 +437,8 @@ class ChirpCloneDialog(wx.Dialog): def _status(self, status): def _safe_status(): self.gauge.SetRange(status.max) - self.gauge.SetValue(status.cur) + self.gauge.SetValue(min(status.cur, status.max)) + self.status_msg.SetLabel(status.msg) wx.CallAfter(_safe_status) @@ -241,7 +449,7 @@ class ChirpCloneDialog(wx.Dialog): def fail(self, message): def safe_fail(): wx.MessageBox(message, - 'Error communicating with radio', + _('Error communicating with radio'), wx.ICON_ERROR) self.cancel_action() wx.CallAfter(safe_fail) @@ -251,6 +459,11 @@ class ChirpCloneDialog(wx.Dialog): self._vendor.Enable() self._model.Enable() self._port.Enable() + s = chirp_common.Status() + s.cur = 0 + s.max = 1 + s.msg = '' + self._status(s) self.FindWindowById(wx.ID_OK).Enable() def get_selected_rclass(self): @@ -267,27 +480,31 @@ class ChirpDownloadDialog(ChirpCloneDialog): prompts = rclass.get_prompts() if prompts.experimental: d = ChirpRadioPromptDialog(self, - title='Experimental driver', + title=_('Experimental driver'), buttons=wx.OK, radio=rclass, prompt='experimental') d.ShowModal() def _action(self, event): - if event.GetEventObject().GetId() != wx.ID_OK: + if event.GetEventObject().GetId() == wx.ID_CANCEL: + if self._clone_thread: + self._clone_thread.stop() self.EndModal(event.GetEventObject().GetId()) return + self._persist_choices() self.disable_model_select() self.disable_running() - port = self._port.GetValue() + port = self.get_selected_port() + LOG.debug('Using port %r' % port) rclass = self.get_selected_rclass() prompts = rclass.get_prompts() if prompts.info: d = ChirpRadioPromptDialog(self, - title='Radio information', + title=_('Radio information'), radio=rclass, prompt='info') if d.ShowModal() != wx.ID_OK: @@ -295,7 +512,7 @@ class ChirpDownloadDialog(ChirpCloneDialog): return if prompts.pre_download: d = ChirpRadioPromptDialog(self, - title='Download instructions', + title=_('Download instructions'), radio=rclass, prompt='pre_download') if d.ShowModal() != wx.ID_OK: @@ -303,10 +520,9 @@ class ChirpDownloadDialog(ChirpCloneDialog): return try: - pipe = serial.Serial(port=port, baudrate=rclass.BAUD_RATE, - rtscts=rclass.HARDWARE_FLOW, timeout=0.25) - self._radio = rclass(pipe) + self._radio = rclass(open_serial(port, rclass)) except Exception as e: + LOG.exception('Failed to open serial: %s' % e) self.fail(str(e)) return @@ -340,39 +556,60 @@ class ChirpUploadDialog(ChirpCloneDialog): self._radio = common.LiveAdapter(self._radio) def _action(self, event): - if event.GetEventObject().GetId() != wx.ID_OK: + if event.GetEventObject().GetId() == wx.ID_CANCEL: + if self._clone_thread: + self._clone_thread.stop() self.EndModal(event.GetEventObject().GetId()) return + self._persist_choices() self.disable_running() + port = self.get_selected_port() prompts = self._radio.get_prompts() if prompts.info: d = ChirpRadioPromptDialog(self, - title='Radio information', + title=_('Radio information'), radio=self._radio, prompt='info') if d.ShowModal() != wx.ID_OK: self.cancel_action() return + + if prompts.display_pre_upload_prompt_before_opening_port: + s = None + else: + LOG.debug('Opening serial %r before upload prompt' % port) + s = open_serial(port, self._radio) + if prompts.pre_upload: d = ChirpRadioPromptDialog(self, - title='Upload instructions', + title=_('Upload instructions'), radio=self._radio, prompt='pre_upload') if d.ShowModal() != wx.ID_OK: self.cancel_action() + if s: + s.close() return - port = self._port.GetValue() - baud = self._radio.BAUD_RATE if self._radio.pipe: baud = self._radio.pipe.baudrate - pipe = serial.Serial(port=port, baudrate=baud, - rtscts=self._radio.HARDWARE_FLOW, timeout=0.25) - self._radio.set_pipe(pipe) + if s is None: + LOG.debug('Opening serial %r after upload prompt' % port) + s = open_serial(port, self._radio) + + try: + self._radio.set_pipe(s) + # Short-circuit straight to the previous baudrate for variable- + # rate radios to sync back up faster + self._radio.pipe.baudrate = baud + except Exception as e: + self.fail(str(e)) + return + self._radio._status_fn = self._status self._clone_thread = CloneThread(self._radio, self, 'sync_out') diff --git a/chirp/wxui/common.py b/chirp/wxui/common.py index 9ae48f8..eb3c177 100644 --- a/chirp/wxui/common.py +++ b/chirp/wxui/common.py @@ -1,5 +1,25 @@ +# Copyright 2022 Dan Smith +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +import atexit import functools import logging +import os +import platform +import shutil +import tempfile import threading import wx @@ -7,14 +27,18 @@ import wx from chirp import chirp_common from chirp.drivers import generic_csv from chirp import errors +from chirp import platform as chirp_platform from chirp import settings +from chirp.wxui import config from chirp.wxui import radiothread LOG = logging.getLogger(__name__) +CONF = config.get() CHIRP_DATA_MEMORY = wx.DataFormat('x-chirp/memory-channel') EditorChanged, EVT_EDITOR_CHANGED = wx.lib.newevent.NewCommandEvent() StatusMessage, EVT_STATUS_MESSAGE = wx.lib.newevent.NewCommandEvent() +INDEX_CHAR = settings.BANNED_NAME_CHARACTERS[0] # This is a lock that can be used to exclude edit-specific operations # from happening at the same time, like radiothread async @@ -25,6 +49,18 @@ StatusMessage, EVT_STATUS_MESSAGE = wx.lib.newevent.NewCommandEvent() EDIT_LOCK = threading.Lock() +def closes_clipboard(fn): + @functools.wraps(fn) + def wrapper(*a, **k): + try: + return fn(*a, **k) + finally: + if wx.TheClipboard.IsOpened(): + LOG.warning('Closing clipboard left open by %s' % fn) + wx.TheClipboard.Close() + return wrapper + + class LiveAdapter(generic_csv.CSVRadio): FILE_EXTENSION = 'img' @@ -75,7 +111,7 @@ class LiveAdapter(generic_csv.CSVRadio): status = chirp_common.Status() status.max = self._features.memory_bounds[1] status.cur = i - status.msg = 'Cloning' + status.msg = _('Cloning') self.status_fn(status) def get_settings(self): @@ -85,18 +121,70 @@ class LiveAdapter(generic_csv.CSVRadio): return self._liveradio.set_settings(settings) +class EditorMenuItem(wx.MenuItem): + MENU_VIEW = 'View' + MENU_EDIT = 'Edit' + ITEMS = {} + + def __init__(self, cls, callback_name, *a, **k): + self._wx_id = wx.NewId() + super().__init__(None, self._wx_id, *a, **k) + self._cls = cls + self._callback_name = callback_name + self.ITEMS[self.key] = self._wx_id + + @property + def key(self): + return '%s:%s' % (self._cls.__name__, self._callback_name) + + @property + def editor_class(self): + return self._cls + + def editor_callback(self, editor, event): + getattr(editor, self._callback_name)(event) + + def add_menu_callback(self): + # Some platforms won't actually set the accelerator (macOS) or allow + # enable/check (linux) before we are in a menu. + accel = self.GetAccel() + self.SetAccel(None) + self.SetAccel(accel) + + +class EditorMenuItemToggle(EditorMenuItem): + """An EditorMenuItem that manages boolean/check state in CONF""" + def __init__(self, cls, callback_name, conf_tuple, *a, **k): + k['kind'] = wx.ITEM_CHECK + super().__init__(cls, callback_name, *a, **k) + self._conf_key, self._conf_section = conf_tuple + + def editor_callback(self, editor, event): + menuitem = event.GetEventObject().FindItemById(event.GetId()) + CONF.set_bool(self._conf_key, menuitem.IsChecked(), self._conf_section) + super().editor_callback(editor, event) + + def add_menu_callback(self): + super().add_menu_callback() + self.Check(CONF.get_bool(self._conf_key, self._conf_section, False)) + + class ChirpEditor(wx.Panel): def __init__(self, *a, **k): super().__init__(*a, **k) self.setup_radio_interface() self.wait_dialog = None + @property + def radio(self): + return self._radio + def start_wait_dialog(self, message): if self.wait_dialog: LOG.error('Wait dialog already in progress!') return - self.wait_dialog = wx.ProgressDialog('Please wait', message, 100, + self.wait_dialog = wx.ProgressDialog(_('Please wait'), message, 100, parent=self) wx.CallAfter(self.wait_dialog.Show) @@ -117,10 +205,37 @@ class ChirpEditor(wx.Panel): def status_message(self, message): wx.PostEvent(self, StatusMessage(self.GetId(), message=message)) + def refresh(self): + pass + def cb_copy(self, cut=False): + raise NotImplementedError() + + @closes_clipboard + def cb_copy_data(self, data): + if wx.TheClipboard.Open(): + wx.TheClipboard.SetData(data) + wx.TheClipboard.Close() + else: + raise RuntimeError(_('Unable to open the clipboard')) + + @closes_clipboard + def cb_paste(self): + memdata = wx.CustomDataObject(CHIRP_DATA_MEMORY) + textdata = wx.TextDataObject() + if wx.TheClipboard.Open(): + gotchirpmem = wx.TheClipboard.GetData(memdata) + got = wx.TheClipboard.GetData(textdata) + wx.TheClipboard.Close() + if gotchirpmem: + return memdata + elif got: + return textdata + + def cb_delete(self): pass - def cb_paste(self, data): + def cb_find(self, text): pass def select_all(self): @@ -132,6 +247,24 @@ class ChirpEditor(wx.Panel): def selected(self): pass + def get_scroll_pos(self): + return None + + def set_scroll_pos(self, pos): + LOG.warning('Editor %s does not support set_scroll_pos()' % ( + self.__class__.__name__)) + + def update_font(self): + pass + + @classmethod + def get_menu_items(self): + """Return a dict of menu items specific to this editor class + + Example: {'Edit': [wx.MenuItem], 'View': [wx.MenuItem]} + """ + return {} + class ChirpSyncEditor: """Radio interface that makes synchronous calls. @@ -153,9 +286,15 @@ class ChirpSyncEditor: if cb: cb(job) + do_lazy_radio = do_radio + def setup_radio_interface(self): pass + @property + def busy(self): + return False + class ChirpAsyncEditor(ChirpSyncEditor): """Radio interface that makes async calls in a helper thread. @@ -167,17 +306,22 @@ class ChirpAsyncEditor(ChirpSyncEditor): def do_radio(self, cb, fn, *a, **k): self._jobs[self._radio_thread.submit(self, fn, *a, **k)] = cb + def do_lazy_radio(self, cb, fn, *a, **k): + self._jobs[self._radio_thread.background(self, fn, *a, **k)] = cb + def radio_thread_event(self, job, block=True): if job.fn == 'get_memory': - msg = 'Refreshed memory %s' % job.args[0] + msg = _('Refreshed memory %s') % job.args[0] elif job.fn == 'set_memory': - msg = 'Uploaded memory %s' % job.args[0].number + msg = _('Uploaded memory %s') % job.args[0].number elif job.fn == 'get_settings': - msg = 'Retrieved settings' + msg = _('Retrieved settings') elif job.fn == 'set_settings': - msg = 'Saved settings' + msg = _('Saved settings') + elif job.fn == 'erase_memory': + msg = _('Erased memory %s') % job.args[0] else: - msg = 'Finished radio job %s' % job.fn + msg = _('Finished radio job %s') % job.fn if not EDIT_LOCK.acquire(block): return False @@ -200,11 +344,16 @@ class ChirpAsyncEditor(ChirpSyncEditor): def setup_radio_interface(self): self._jobs = {} + @property + def busy(self): + return self._radio_thread.pending != 0 + class ChirpSettingGrid(wx.Panel): def __init__(self, settinggroup, *a, **k): super(ChirpSettingGrid, self).__init__(*a, **k) self._group = settinggroup + self._needs_reload = False self.pg = wx.propgrid.PropertyGrid( self, @@ -223,6 +372,10 @@ class ChirpSettingGrid(wx.Panel): if not isinstance(element, settings.RadioSetting): LOG.debug('Skipping nested group %s' % element) continue + if len(element.keys()) > 1: + self.pg.Append(wx.propgrid.PropertyCategory( + element.get_shortname())) + for i in element.keys(): value = element[i] if isinstance(value, settings.RadioSettingValueInteger): @@ -238,39 +391,94 @@ class ChirpSettingGrid(wx.Panel): else: LOG.warning('Unsupported setting type %r' % value) editor = None - if editor: - self.pg.Append(editor) + if not editor: + continue + + editor.SetName('%s%s%i' % (name, INDEX_CHAR, i)) + if len(element.keys()) > 1: + editor.SetLabel('') + editor.Enable(value.get_mutable()) + self.pg.Append(editor) + self.pg.Bind(wx.propgrid.EVT_PG_CHANGING, self._check_change) + + def get_setting_by_name(self, name, index=0): + if INDEX_CHAR in name: + # FIXME: This will only work for single-index settings of course + name, _ = name.split(INDEX_CHAR, 1) + for setting_name, setting in self._group.items(): + if name == setting_name: + return setting + + def _check_change(self, event): + setting = self.get_setting_by_name(event.GetPropertyName()) + if not setting: + LOG.error('Got change event for unknown setting %s' % ( + event.GetPropertyName())) + return + warning = setting.get_warning(event.GetValue()) + if warning: + r = wx.MessageBox(warning, _('WARNING!'), + wx.OK | wx.CANCEL | wx.CANCEL_DEFAULT) + if r == wx.CANCEL: + LOG.info('User aborted setting %s=%s with warning message', + event.GetPropertyName(), event.GetValue()) + event.SetValidationFailureBehavior(0) + event.Veto() + return + else: + LOG.info('User made change to %s=%s despite warning', + event.GetPropertyName(), event.GetValue()) + self._needs_reload = setting.volatile + if self.needs_reload: + wx.MessageBox(_( + 'Changing this setting requires refreshing the settings from ' + 'the image, which will happen now.'), + _('Refresh required'), wx.OK) @property def name(self): return self._group.get_name() + @property + def needs_reload(self): + return self._needs_reload + + @property + def propgrid(self): + return self.pg + def _pg_changed(self, event): wx.PostEvent(self, EditorChanged(self.GetId())) def _get_editor_int(self, setting, value): - class ChirpIntProperty(wx.propgrid.IntProperty): + e = wx.propgrid.IntProperty(setting.get_shortname(), + setting.get_name(), + value=int(value)) + e.SetEditor('SpinCtrl') + e.SetAttribute(wx.propgrid.PG_ATTR_MIN, value.get_min()) + e.SetAttribute(wx.propgrid.PG_ATTR_MAX, value.get_max()) + e.SetAttribute(wx.propgrid.PG_ATTR_SPINCTRL_STEP, value.get_step()) + return e + + def _get_editor_float(self, setting, value): + class ChirpFloatProperty(wx.propgrid.FloatProperty): def ValidateValue(self, val, info): - if not (val > value.get_min() and val < value.get_max()): + if value.get_min() and not val >= value.get_min(): + info.SetFailureMessage( + _('Value must be at least %.4f' % value.get_min())) + return False + if value.get_max() and not val <= value.get_max(): info.SetFailureMessage( - _('Value must be between %i and %i') % ( - value.get_min(), value.get_max())) + _('Value must be at most %.4f' % value.get_max())) return False return True - return ChirpIntProperty(setting.get_shortname(), - setting.get_name(), - value=int(value)) - def _get_editor_float(self, setting, value): - class ChirpFloatProperty(wx.propgrid.IntProperty): - def ValidateValue(self, val, info): - if not (val > value.get_min() and val < value.get_max()): - info.SetFailureMessage( - _('Value must be between %.4f and %.4f') % ( - value.get_min(), value.get_max())) + def ValueToString(self, _value, flags=0): + return value.format(_value) + return ChirpFloatProperty(setting.get_shortname(), setting.get_name(), - value=int(value)) + value=float(value)) def _get_editor_choice(self, setting, value): choices = value.get_options() @@ -306,11 +514,14 @@ class ChirpSettingGrid(wx.Panel): """Return a dict of {name: (RadioSetting, newvalue)}""" values = {} for prop in self.pg._Items(): + if prop.IsCategory(): + continue + basename = prop.GetName().split(INDEX_CHAR)[0] if isinstance(prop, wx.propgrid.EnumProperty): - value = self._choices[prop.GetName()][prop.GetValue()] + value = self._choices[basename][prop.GetValue()] else: value = prop.GetValue() - setting = self._group[prop.GetName()] + setting = self._group[basename] values[prop.GetName()] = setting, value return values @@ -331,7 +542,7 @@ def _error_proof(*expected_errors): """ def show_error(msg): - d = wx.MessageDialog(None, str(msg), 'An error has occurred', + d = wx.MessageDialog(None, str(msg), _('An error has occurred'), style=wx.OK | wx.ICON_ERROR) d.ShowModal() @@ -357,7 +568,7 @@ class error_proof(object): @staticmethod def show_error(msg): - d = wx.MessageDialog(None, str(msg), 'An error has occurred', + d = wx.MessageDialog(None, str(msg), _('An error has occurred'), style=wx.OK | wx.ICON_ERROR) d.ShowModal() @@ -392,3 +603,40 @@ class error_proof(object): LOG.exception('Context raised unexpected_exception', exc_info=(exc_type, exc_val, traceback)) self.show_error(exc_val) + + +def reveal_location(path): + LOG.debug('Revealing path %s', path) + system = platform.system() + if system == 'Windows': + if not os.path.isdir(path): + # Windows can only reveal the containing directory of a file + path = os.path.dirname(path) + wx.Execute('explorer %s' % path) + elif system == 'Darwin': + wx.Execute('open -R %s' % path) + else: + raise Exception(_('Unable to reveal %s on this system') % path) + + +def delete_atexit(path_): + def do(path): + try: + os.remove(path) + LOG.debug('Removed temporary file %s', path) + except Exception as e: + LOG.warning('Failed to remove %s: %s', path, e) + + atexit.register(do, path_) + + +def temporary_debug_log(): + """Return a temporary copy of our debug log""" + pf = chirp_platform.get_platform() + src = pf.config_file('debug.log') + fd, dst = tempfile.mkstemp( + prefix='chirp_debug-', + suffix='.txt') + delete_atexit(dst) + shutil.copy(src, dst) + return dst diff --git a/chirp/wxui/config.py b/chirp/wxui/config.py new file mode 100644 index 0000000..fa435d8 --- /dev/null +++ b/chirp/wxui/config.py @@ -0,0 +1,174 @@ +# Copyright 2011 Dan Smith +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +import base64 +import binascii + +from chirp import platform +try: + from ConfigParser import ConfigParser +except ImportError: + from configparser import ConfigParser +import os + + +class ChirpConfig: + def __init__(self, basepath, name="chirp.config"): + self.__basepath = basepath + self.__name = name + + self._default_section = "global" + + self.__config = ConfigParser(interpolation=None) + + cfg = os.path.join(basepath, name) + if os.path.exists(cfg): + self.__config.read(cfg) + + def save(self): + cfg = os.path.join(self.__basepath, self.__name) + with open(cfg, "w") as cfg_file: + self.__config.write(cfg_file) + + def get(self, key, section, raw=False): + if not self.__config.has_section(section): + return None + + if not self.__config.has_option(section, key): + return None + + return self.__config.get(section, key, raw=raw) + + def set(self, key, value, section): + if not self.__config.has_section(section): + self.__config.add_section(section) + + self.__config.set(section, key, value) + + def is_defined(self, key, section): + return self.__config.has_option(section, key) + + def remove_option(self, section, key): + self.__config.remove_option(section, key) + + if not self.__config.items(section): + self.__config.remove_section(section) + + +class ChirpConfigProxy: + def __init__(self, config, section="global"): + self._config = config + self._section = section + + def get(self, key, section=None, raw=False): + return self._config.get(key, section or self._section, + raw=raw) + + def get_password(self, key, section): + # So, we used to store the password in plaintext in $key. Then some + # dumb guy stored the base64-encoded password in $key also. However, + # if the plaintext password happens to be valid base64, we'll decode it + # to some random binary, and then fail to decode UTF-8 from it. So, + # for people already in this situation, first try the "new" location + # of $key_encoded, if it exists. If it doesn't honor the old place + # and return the exact string if base64 or UTF-8 decoding fails, + # otherwise return the fully decoded thing. Conversion will happen + # when people update passwords and set_passwoord() is called, which + # always stores the new format. + encoded = self.get('%s_encoded' % key, section) + if encoded is None: + encoded = self.get(key, section) + if encoded: + try: + return base64.b64decode(encoded.encode()).decode() + except binascii.Error: + # Likely not stored encoded, return as-is + return encoded + except UnicodeDecodeError: + # This means it must be stored in plaintext but we did + # actually decode it with base64, but not to a valid string + return encoded + else: + return encoded + + def set(self, key, value, section=None): + return self._config.set(key, value, section or self._section) + + def set_password(self, key, value, section): + """Store a password slightly obfuscated. + + THIS IS NOT SECURE. It just avoids storing the password + in complete cleartext. It is trivial to read them in this + format. + """ + value = base64.b64encode(value.encode()).decode() + # Clean up old cleartext passwords + if self.is_defined(key, section): + self.remove_option(key, section) + self.set('%s_encoded' % key, value, section) + + def get_int(self, key, section=None): + try: + return int(self.get(key, section)) + except ValueError: + return 0 + + def set_int(self, key, value, section=None): + if not isinstance(value, int): + raise ValueError("Value is not an integer") + + self.set(key, "%i" % value, section) + + def get_float(self, key, section=None): + try: + return float(self.get(key, section)) + except ValueError: + return 0 + + def set_float(self, key, value, section=None): + if not isinstance(value, float): + raise ValueError("Value is not an integer") + + self.set(key, "%i" % value, section) + + def get_bool(self, key, section=None, default=False): + val = self.get(key, section) + if val is None: + return default + else: + return val == "True" + + def set_bool(self, key, value, section=None): + self.set(key, str(bool(value)), section) + + def is_defined(self, key, section=None): + return self._config.is_defined(key, section or self._section) + + def remove_option(self, key, section): + self._config.remove_option(section, key) + + +_CONFIG = None + + +def get(section="global"): + global _CONFIG + + p = platform.get_platform() + + if not _CONFIG: + _CONFIG = ChirpConfig(p.config_dir()) + + return ChirpConfigProxy(_CONFIG, section) diff --git a/chirp/wxui/developer.py b/chirp/wxui/developer.py index fbe13d7..37e288e 100644 --- a/chirp/wxui/developer.py +++ b/chirp/wxui/developer.py @@ -1,15 +1,38 @@ +# Copyright 2022 Dan Smith +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + import functools import logging import os +import serial +import sys +import tempfile +import requests import wx import wx.richtext import wx.lib.scrolledpanel from chirp import bitwise +from chirp import util from chirp.wxui import common +from chirp.wxui import report LOG = logging.getLogger(__name__) +BrowserChanged, EVT_BROWSER_CHANGED = wx.lib.newevent.NewCommandEvent() +FROZEN = getattr(sys, 'frozen', False) def simple_diff(a, b, diffsonly=False): @@ -47,9 +70,10 @@ class MemoryDialog(wx.Dialog): sizer.Add(wx.StaticLine(self), 0) - btn = wx.Button(self, wx.OK, 'OK') - btn.Bind(wx.EVT_BUTTON, lambda e: self.EndModal(wx.OK)) - sizer.Add(btn, 0) + bs = self.CreateButtonSizer(wx.OK | wx.OK_DEFAULT) + sizer.Add(bs) + + self.Bind(wx.EVT_BUTTON, lambda e: self.EndModal(wx.CLOSE)) font = wx.Font(12, wx.FONTFAMILY_MODERN, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL) @@ -62,6 +86,7 @@ class MemoryDialog(wx.Dialog): else: self._raw_memory(mem) + self.SetSize(640, 480) self.Centre() def _raw_memory(self, mem): @@ -86,7 +111,7 @@ class MemoryDialog(wx.Dialog): class ChirpEditor(wx.Panel): def __init__(self, parent, obj): - super(ChirpEditor, self).__init__(parent) + super(ChirpEditor, self).__init__(parent, ) self._obj = obj self._fixed_font = wx.Font(pointSize=10, family=wx.FONTFAMILY_TELETYPE, @@ -95,6 +120,10 @@ class ChirpEditor(wx.Panel): self._changed_color = wx.Colour(0, 255, 0) self._error_color = wx.Colour(255, 0, 0) + def refresh(self): + """Called to refresh the widget from memory""" + pass + def set_up(self): pass @@ -104,11 +133,13 @@ class ChirpEditor(wx.Panel): if not tt: tt = wx.ToolTip('') thing.SetToolTip(tt) - tt.SetTip('Press enter to set this in memory') + tt.SetTip(_('Press enter to set this in memory')) - def _mark_unchanged(self, thing): + def _mark_unchanged(self, thing, mem_changed=True): thing.SetBackgroundColour(wx.NullColour) thing.UnsetToolTip() + if mem_changed: + wx.PostEvent(self, BrowserChanged(self.GetId())) def _mark_error(self, thing, reason): tt = thing.GetToolTip() @@ -126,30 +157,38 @@ class ChirpEditor(wx.Panel): if isinstance(self._obj, bitwise.arrayDataElement): innertype = list(self._obj.items())[0][1] - return '%s[%i] (%i bytes each) @ %s' % (typestr(innertype), - len(self._obj), - innertype.size() / 8, - addr) + return '%s[%i] (%i %s) @ %s' % (typestr(innertype), + len(self._obj), + innertype.size() / 8, + _('bytes each'), + addr) elif self._obj.size() % 8 == 0: - return '%s (%i bytes) @ %s' % (typestr(self._obj), - self._obj.size() / 8, - addr) + return '%s (%i %s) @ %s' % (typestr(self._obj), + self._obj.size() / 8, + _('bytes'), + addr) else: - return '%s bits @ %s' % (self._obj.size(), - addr) + return '%s %s @ %s' % (self._obj.size(), + _('bits'), + addr) class ChirpStringEditor(ChirpEditor): def set_up(self): sizer = wx.BoxSizer(wx.HORIZONTAL) - entry = wx.TextCtrl(self, value=str(self._obj), - style=wx.TE_PROCESS_ENTER) - entry.SetMaxLength(len(self._obj)) + self._entry = wx.TextCtrl(self, value=str(self._obj), + style=wx.TE_PROCESS_ENTER) + self._entry.SetMaxLength(len(self._obj)) self.SetSizer(sizer) - sizer.Add(entry, 1, wx.EXPAND) + sizer.Add(self._entry, 1, wx.EXPAND) + + self._entry.Bind(wx.EVT_TEXT, self._edited) + self._entry.Bind(wx.EVT_TEXT_ENTER, self._changed) + self._entry.SetEditable(not FROZEN) - entry.Bind(wx.EVT_TEXT, self._edited) - entry.Bind(wx.EVT_TEXT_ENTER, self._changed) + def refresh(self): + self._entry.SetValue(str(self._obj)) + self._mark_unchanged(self._entry, mem_changed=False) def _edited(self, event): entry = event.GetEventObject() @@ -157,7 +196,7 @@ class ChirpStringEditor(ChirpEditor): if len(value) == len(self._obj): self._mark_changed(entry) else: - self._mark_error(entry, 'Length must be %i' % len(self._obj)) + self._mark_error(entry, _('Length must be %i') % len(self._obj)) @common.error_proof() def _changed(self, event): @@ -176,15 +215,16 @@ class ChirpIntegerEditor(ChirpEditor): hexdigits = (self._obj.size() / 4) + (self._obj.size() % 4 and 1 or 0) bindigits = self._obj.size() - self._editors = {'Hex': (16, '{:0%iX}' % hexdigits), - 'Dec': (10, '{:d}'), - 'Bin': (2, '{:0%ib}' % bindigits)} + self._editors = {_('Hex'): (16, '{:0%iX}' % hexdigits), + _('Dec'): (10, '{:d}'), + _('Bin'): (2, '{:0%ib}' % bindigits)} self._entries = {} for name, (base, fmt) in self._editors.items(): label = wx.StaticText(self, label=name) entry = wx.TextCtrl(self, value=fmt.format(int(self._obj)), style=wx.TE_PROCESS_ENTER) entry.SetFont(self._fixed_font) + entry.SetEditable(not FROZEN) sizer.Add(label, 0, wx.ALIGN_CENTER) sizer.Add(entry, 1, flag=wx.EXPAND) self._entries[name] = entry @@ -194,6 +234,12 @@ class ChirpIntegerEditor(ChirpEditor): entry.Bind(wx.EVT_TEXT_ENTER, functools.partial(self._changed, base=base)) + def refresh(self): + for name, (base, fmt) in self._editors.items(): + self._entries[name].SetValue(fmt.format(int(self._obj))) + self._mark_unchanged(self._entries[name], + mem_changed=False) + def _edited(self, event, base=10): entry = event.GetEventObject() others = {n: e for n, e in self._entries.items() @@ -201,9 +247,9 @@ class ChirpIntegerEditor(ChirpEditor): try: val = int(entry.GetValue(), base) - assert val >= 0, 'Value must be zero or greater' + assert val >= 0, _('Value must be zero or greater') assert val < pow(2, self._obj.size()), \ - 'Value does not fit in %i bits' % self._obj.size() + _('Value does not fit in %i bits') % self._obj.size() except (ValueError, AssertionError) as e: self._mark_error(entry, str(e)) return @@ -227,21 +273,27 @@ class ChirpBCDEditor(ChirpEditor): def set_up(self): sizer = wx.BoxSizer(wx.HORIZONTAL) self.SetSizer(sizer) - entry = wx.TextCtrl(self, value=str(int(self._obj)), - style=wx.TE_PROCESS_ENTER) - entry.SetFont(self._fixed_font) - sizer.Add(entry, 1, wx.EXPAND) - entry.Bind(wx.EVT_TEXT, self._edited) - entry.Bind(wx.EVT_TEXT_ENTER, self._changed) + self._entry = wx.TextCtrl(self, value=str(int(self._obj)), + style=wx.TE_PROCESS_ENTER) + self._entry.SetFont(self._fixed_font) + self._entry.SetEditable(not FROZEN) + sizer.Add(self._entry, 1, wx.EXPAND) + self._entry.Bind(wx.EVT_TEXT, self._edited) + self._entry.Bind(wx.EVT_TEXT_ENTER, self._changed) + + def refresh(self): + self._entry.SetValue(str(int(self._obj))) + self._mark_unchanged(self._entry, + mem_changed=False) def _edited(self, event): entry = event.GetEventObject() try: val = int(entry.GetValue()) digits = self._obj.size() // 4 - assert val >= 0, 'Value must be zero or greater' + assert val >= 0, _('Value must be zero or greater') assert len(entry.GetValue()) == digits, \ - 'Value must be exactly %i decimal digits' % digits + _('Value must be exactly %i decimal digits') % digits except (ValueError, AssertionError) as e: self._mark_error(entry, str(e)) else: @@ -257,29 +309,72 @@ class ChirpBCDEditor(ChirpEditor): class ChirpBrowserPanel(wx.lib.scrolledpanel.ScrolledPanel): - def __init__(self, parent): + def __init__(self, parent, memobj): super(ChirpBrowserPanel, self).__init__(parent) self._sizer = wx.FlexGridSizer(2) self._sizer.AddGrowableCol(1) self.SetSizer(self._sizer) self.SetupScrolling() + self._parent = parent + self._memobj = memobj self._editors = {} + self._initialized = False def add_editor(self, name, editor): self._editors[name] = editor + editor.Bind(EVT_BROWSER_CHANGED, self._panel_changed) + + def _panel_changed(self, event): + wx.PostEvent(self, BrowserChanged(self.GetId())) + + def _initialize(self): + for name, obj in self._memobj.items(): + editor = None + if isinstance(obj, bitwise.arrayDataElement): + if isinstance(obj[0], bitwise.charDataElement): + editor = ChirpStringEditor(self, obj) + elif isinstance(obj[0], bitwise.bcdDataElement): + editor = ChirpBCDEditor(self, obj) + else: + self._parent.add_sub_panel(name, obj, self) + elif isinstance(obj, bitwise.intDataElement): + editor = ChirpIntegerEditor(self, obj) + elif isinstance(obj, bitwise.structDataElement): + self._parent.add_sub_panel(name, obj, self) + if editor: + self.add_editor(name, editor) + self._initialized = True + + def add_sub_panel(self, name, obj, parent): + # This just forwards until we get to the browser + self._parent.add_sub_panel(name, obj, parent) def selected(self): - for name, editor in self._editors.items(): - editor.set_up() - label = wx.StaticText(self, label='%s: ' % name) - tt = wx.ToolTip(repr(editor)) - label.SetToolTip(tt) - + if not self._initialized: + self._initialize() + + label = wx.StaticText(self) + pos = wx.StaticText(self, label='%i bits (%i bytes) at 0x%06x' % ( + self._memobj.size(), + self._memobj.size() // 8, + self._memobj.get_offset())) self._sizer.Add(label, 0, wx.ALIGN_CENTER) - self._sizer.Add(editor, 1, flag=wx.EXPAND) + self._sizer.Add(pos, 1, flag=wx.EXPAND) + + for name, editor in self._editors.items(): + editor.set_up() + label = wx.StaticText(self, label='%s: ' % name) + tt = wx.ToolTip(repr(editor)) + label.SetToolTip(tt) + + self._sizer.Add(label, 0, wx.ALIGN_CENTER) + self._sizer.Add(editor, 1, flag=wx.EXPAND) + else: + for editor in self._editors.values(): + editor.refresh() - self._editors = {} self._sizer.Layout() + self.FitInside() class ChirpRadioBrowser(common.ChirpEditor, common.ChirpSyncEditor): @@ -289,7 +384,7 @@ class ChirpRadioBrowser(common.ChirpEditor, common.ChirpSyncEditor): self._radio = radio self._features = radio.get_features() - self._treebook = wx.Treebook(self) + self._treebook = ChirpBrowserTreeBook(self) try: view = self._treebook.GetTreeCtrl() @@ -308,15 +403,20 @@ class ChirpRadioBrowser(common.ChirpEditor, common.ChirpSyncEditor): def selected(self): if self._loaded: + self._treebook.CurrentPage.selected() return - self.start_wait_dialog('Building Radio Browser') - + self.start_wait_dialog(_('Building Radio Browser')) self._loaded = True - self._load_from_radio('%s %s' % (self._radio.VENDOR, - self._radio.MODEL), - self._radio._memobj) - self.stop_wait_dialog() + try: + self._treebook.add_sub_panel('%s %s' % (self._radio.VENDOR, + self._radio.MODEL), + self._radio._memobj, self._treebook) + except Exception as e: + LOG.exception('Failed to load browser: %s' % e) + common.error_proof.show_error(_('Failed to load radio browser')) + finally: + self.stop_wait_dialog() if self._treebook.GetPageCount(): self._treebook.ExpandNode(0) @@ -324,42 +424,147 @@ class ChirpRadioBrowser(common.ChirpEditor, common.ChirpSyncEditor): page = self._treebook.GetPage(event.GetSelection()) page.selected() - def _load_from_radio(self, name, memobj, parent=None): - editor = None - - def sub_panel(name, memobj, parent): - page = ChirpBrowserPanel(self) - if parent: - pos = self._treebook.FindPage(parent) - self._treebook.InsertSubPage(pos, page, name) - else: - self._treebook.AddPage(page, name) - - for subname, item in memobj.items(): - self._load_from_radio(subname, item, parent=page) - - # Stop updating the progress dialog once we get past the - # first generation in the tree because it slows us down - # a lot. - - if isinstance(memobj, bitwise.structDataElement): - if not parent: - self.bump_wait_dialog(message='Loading %s' % name) - sub_panel(name, memobj, parent) - elif isinstance(memobj, bitwise.arrayDataElement): - if isinstance(memobj[0], bitwise.charDataElement): - editor = ChirpStringEditor(parent, memobj) - elif isinstance(memobj[0], bitwise.bcdDataElement): - editor = ChirpBCDEditor(parent, memobj) - else: - if not parent: - self.bump_wait_dialog(message='Loading %s' % name) - sub_panel('%s[%i]' % (name, len(memobj)), memobj, parent) - elif isinstance(memobj, bitwise.intDataElement): - editor = ChirpIntegerEditor(parent, memobj) + +class ChirpBrowserTreeBook(wx.Treebook): + def add_sub_panel(self, name, memobj, parent): + LOG.debug('Adding sub panel for %s' % name) + page = ChirpBrowserPanel(self, memobj) + page.Bind(EVT_BROWSER_CHANGED, self._page_changed) + if parent != self: + pos = self.FindPage(parent) + self.InsertSubPage(pos, page, name) + self.ExpandNode(pos) else: - print('Unsupported editor type for %s (%s)' % ( - name, memobj.__class__)) + self.AddPage(page, name) + + def _page_changed(self, event): + wx.PostEvent(self, common.EditorChanged(self.GetId())) - if editor: - parent.add_editor(name, editor) + +class FakeSerial(serial.SerialBase): + def write(self, buf): + LOG.debug('Fake serial write:\n%s' % util.hexprint(buf)) + + def read(self, count): + LOG.debug('Fake serial read %i' % count) + return b'' + + +class FakeEchoSerial(FakeSerial): + def __init__(self, *a, **k): + super().__init__(*a, **k) + self._buf = [] + + def write(self, buf): + super().write(buf) + self._buf.extend(b for b in buf) + + def read(self, count): + super().read(count) + try: + return bytes([self._buf.pop(0)]) + except IndexError: + LOG.warning('Empty echo buffer') + return b'' + + +class IssueModuleLoader: + def __init__(self, parent): + self._parent = parent + report.ensure_session() + self.session = report.SESSION + + def get_attachments_from_issue(self, issue): + r = self.session.get( + 'https://chirp.danplanet.com/issues/%i.json' % issue, + params={'include': 'attachments'}) + LOG.debug('Fetched attachments for issue %i (status %s)' % ( + issue, r.status_code)) + r.raise_for_status() + data = r.json()['issue']['attachments'] + return [a for a in data if + a['filename'].endswith('.py') and + a.get('content_type', '').startswith('text/') and + a['filesize'] < (256 * 1024)] + + def get_user_is_developer(self, uid): + r = self.session.get('https://chirp.danplanet.com/users/%i.json' % uid, + params={'include': 'memberships'}) + LOG.debug('Fetched info for user %i (status %s)', + uid, r.status_code) + r.raise_for_status() + data = r.json() + try: + membership = data['user']['memberships'][0] + except IndexError: + LOG.debug('User %s(%i) has no roles', data['user']['login'], uid) + return False + roles = [r['name'] for r in membership['roles']] + return 'Developer' in roles or 'Manager' in roles + + def get_attachment_from_user(self, issue, attachments): + attachment_strings = { + '%s from %s (%s)' % (a['filename'], + a['author']['name'], + a['created_on']): a + for a in sorted(attachments, key=lambda a: a['created_on']) + } + choices = list(attachment_strings.keys()) + choice = wx.GetSingleChoice( + _('Choose the module to load from issue %i:' % issue), + _('Available modules'), + choices, + len(choices) - 1, + parent=self._parent) + if choice: + isdev = self.get_user_is_developer( + attachment_strings[choice]['author']['id']) + if not isdev: + r = wx.MessageBox( + _('The author of this module is not a recognized ' + 'CHIRP developer. It is recommended that you not ' + 'load this module as it could pose a security risk. ' + 'Proceed anyway?'), _('Security Risk'), + wx.YES_NO | wx.NO_DEFAULT) + if r != wx.YES: + return + return attachment_strings[choice] + + def run(self): + msg = _('This will load a module from a website issue') + issue = wx.GetNumberFromUser(msg, + _('Issue number:'), + _('Load module from issue'), + 0, 0, 999999, parent=self._parent) + if issue < 0: + return + + try: + attachments = self.get_attachments_from_issue(issue) + except Exception as e: + LOG.exception('Failed to load attachments from %i: %s' % ( + issue, e)) + raise Exception('Unable to load modules from that issue') + LOG.debug('Found %i valid module attachments from issue %i' % ( + len(attachments), issue)) + if not attachments: + wx.MessageBox(_('No modules found in issue %i') % issue, + _('No modules found'), + wx.ICON_WARNING) + return + attachment = self.get_attachment_from_user(issue, attachments) + if not attachment: + return + LOG.debug('User chose attachment %s' % attachment) + + LOG.debug('Fetching attachment URL %s' % attachment['content_url']) + r = requests.get(attachment['content_url']) + modfile = tempfile.mktemp('.py', 'loaded-%i-' % attachment['id']) + trailer = ('\n\n# Loaded from issue %i attachment %i: %s\n' % ( + issue, attachment['id'], attachment['content_url'])) + with open(modfile, 'wb') as f: + f.write(r.content) + f.write(trailer.encode()) + + LOG.debug('Wrote attachment to %s' % modfile) + return modfile diff --git a/chirp/wxui/fips.py b/chirp/wxui/fips.py new file mode 100644 index 0000000..49e144d --- /dev/null +++ b/chirp/wxui/fips.py @@ -0,0 +1,6620 @@ +# Copyright 2012 Tom Hayward +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + + +FIPS_STATES = { + "Alaska": 2, + "Alabama": 1, + "Arkansas": 5, + "Arizona": 4, + "California": 6, + "Colorado": 8, + "Connecticut": 9, + "District of Columbia": 11, + "Delaware": 10, + "Florida": 12, + "Georgia": 13, + "Guam": 66, + "Hawaii": 15, + "Iowa": 19, + "Idaho": 16, + "Illinois": 17, + "Indiana": 18, + "Kansas": 20, + "Kentucky": 21, + "Louisiana": 22, + "Massachusetts": 25, + "Maryland": 24, + "Maine": 23, + "Michigan": 26, + "Minnesota": 27, + "Missouri": 29, + "Mississippi": 28, + "Montana": 30, + "North Carolina": 37, + "North Dakota": 38, + "Nebraska": 31, + "New Hampshire": 33, + "New Jersey": 34, + "New Mexico": 35, + "Nevada": 32, + "New York": 36, + "Ohio": 39, + "Oklahoma": 40, + "Oregon": 41, + "Pennsylvania": 42, + "Puerto Rico": 72, + "Rhode Island": 44, + "South Carolina": 45, + "South Dakota": 46, + "Tennessee": 47, + "Texas": 48, + "Utah": 49, + "Virginia": 51, + "Virgin Islands": 78, + "Vermont": 50, + "Washington": 53, + "Wisconsin": 55, + "West Virginia": 54, + "Wyoming": 56, + "Alberta": "CA01", + "British Columbia": "CA02", + "Manitoba": "CA03", + "New Brunswick": "CA04", + "Newfoundland": "CA05", + "Northwest Territories": "CA13", + "Nova Scotia": "CA07", + "Nunavut": "CA14", + "Ontario": "CA08", + "Prince Edward Island": "CA09", + "Quebec": "CA10", + "Saskatchewan": "CA11", + "Yukon Territory": "CA12", +} + +FIPS_COUNTIES = { + 1: {'--All--': '%', + 'Autauga County, AL': '001', + 'Baldwin County, AL': '003', + 'Barbour County, AL': '005', + 'Bibb County, AL': '007', + 'Blount County, AL': '009', + 'Bullock County, AL': '011', + 'Butler County, AL': '013', + 'Calhoun County, AL': '015', + 'Chambers County, AL': '017', + 'Cherokee County, AL': '019', + 'Chilton County, AL': '021', + 'Choctaw County, AL': '023', + 'Clarke County, AL': '025', + 'Clay County, AL': '027', + 'Cleburne County, AL': '029', + 'Coffee County, AL': '031', + 'Colbert County, AL': '033', + 'Conecuh County, AL': '035', + 'Coosa County, AL': '037', + 'Covington County, AL': '039', + 'Crenshaw County, AL': '041', + 'Cullman County, AL': '043', + 'Dale County, AL': '045', + 'Dallas County, AL': '047', + 'DeKalb County, AL': '049', + 'Elmore County, AL': '051', + 'Escambia County, AL': '053', + 'Etowah County, AL': '055', + 'Fayette County, AL': '057', + 'Franklin County, AL': '059', + 'Geneva County, AL': '061', + 'Greene County, AL': '063', + 'Hale County, AL': '065', + 'Henry County, AL': '067', + 'Houston County, AL': '069', + 'Jackson County, AL': '071', + 'Jefferson County, AL': '073', + 'Lamar County, AL': '075', + 'Lauderdale County, AL': '077', + 'Lawrence County, AL': '079', + 'Lee County, AL': '081', + 'Limestone County, AL': '083', + 'Lowndes County, AL': '085', + 'Macon County, AL': '087', + 'Madison County, AL': '089', + 'Marengo County, AL': '091', + 'Marion County, AL': '093', + 'Marshall County, AL': '095', + 'Mobile County, AL': '097', + 'Monroe County, AL': '099', + 'Montgomery County, AL': '101', + 'Morgan County, AL': '103', + 'Perry County, AL': '105', + 'Pickens County, AL': '107', + 'Pike County, AL': '109', + 'Randolph County, AL': '111', + 'Russell County, AL': '113', + 'Shelby County, AL': '117', + 'St. Clair County, AL': '115', + 'Sumter County, AL': '119', + 'Talladega County, AL': '121', + 'Tallapoosa County, AL': '123', + 'Tuscaloosa County, AL': '125', + 'Walker County, AL': '127', + 'Washington County, AL': '129', + 'Wilcox County, AL': '131', + 'Winston County, AL': '133'}, + 2: {'--All--': '%', + 'Aleutians East Borough, AK': '013', + 'Aleutians West Census Area, AK': '016', + 'Anchorage Borough/municipality, AK': '020', + 'Bethel Census Area, AK': '050', + 'Bristol Bay Borough, AK': '060', + 'Denali Borough, AK': '068', + 'Dillingham Census Area, AK': '070', + 'Fairbanks North Star Borough, AK': '090', + 'Haines Borough, AK': '100', + 'Juneau Borough/city, AK': '110', + 'Kenai Peninsula Borough, AK': '122', + 'Ketchikan Gateway Borough, AK': '130', + 'Kodiak Island Borough, AK': '150', + 'Lake and Peninsula Borough, AK': '164', + 'Matanuska-Susitna Borough, AK': '170', + 'Nome Census Area, AK': '180', + 'North Slope Borough, AK': '185', + 'Northwest Arctic Borough, AK': '188', + 'Prince of Wales-Outer Ketchikan Census Area, AK': '201', + 'Sitka Borough/city, AK': '220', + 'Skagway-Hoonah-Angoon Census Area, AK': '232', + 'Southeast Fairbanks Census Area, AK': '240', + 'Valdez-Cordova Census Area, AK': '261', + 'Wade Hampton Census Area, AK': '270', + 'Wrangell-Petersburg Census Area, AK': '280', + 'Yakutat Borough, AK': '282', + 'Yukon-Koyukuk Census Area, AK': '290'}, + 4: {'--All--': '%', + 'Apache County, AZ': '001', + 'Cochise County, AZ': '003', + 'Coconino County, AZ': '005', + 'Gila County, AZ': '007', + 'Graham County, AZ': '009', + 'Greenlee County, AZ': '011', + 'La Paz County, AZ': '012', + 'Maricopa County, AZ': '013', + 'Mohave County, AZ': '015', + 'Navajo County, AZ': '017', + 'Pima County, AZ': '019', + 'Pinal County, AZ': '021', + 'Santa Cruz County, AZ': '023', + 'Yavapai County, AZ': '025', + 'Yuma County, AZ': '027'}, + 5: {'--All--': '%', + 'Arkansas County, AR': '001', + 'Ashley County, AR': '003', + 'Baxter County, AR': '005', + 'Benton County, AR': '007', + 'Boone County, AR': '009', + 'Bradley County, AR': '011', + 'Calhoun County, AR': '013', + 'Carroll County, AR': '015', + 'Chicot County, AR': '017', + 'Clark County, AR': '019', + 'Clay County, AR': '021', + 'Cleburne County, AR': '023', + 'Cleveland County, AR': '025', + 'Columbia County, AR': '027', + 'Conway County, AR': '029', + 'Craighead County, AR': '031', + 'Crawford County, AR': '033', + 'Crittenden County, AR': '035', + 'Cross County, AR': '037', + 'Dallas County, AR': '039', + 'Desha County, AR': '041', + 'Drew County, AR': '043', + 'Faulkner County, AR': '045', + 'Franklin County, AR': '047', + 'Fulton County, AR': '049', + 'Garland County, AR': '051', + 'Grant County, AR': '053', + 'Greene County, AR': '055', + 'Hempstead County, AR': '057', + 'Hot Spring County, AR': '059', + 'Howard County, AR': '061', + 'Independence County, AR': '063', + 'Izard County, AR': '065', + 'Jackson County, AR': '067', + 'Jefferson County, AR': '069', + 'Johnson County, AR': '071', + 'Lafayette County, AR': '073', + 'Lawrence County, AR': '075', + 'Lee County, AR': '077', + 'Lincoln County, AR': '079', + 'Little River County, AR': '081', + 'Logan County, AR': '083', + 'Lonoke County, AR': '085', + 'Madison County, AR': '087', + 'Marion County, AR': '089', + 'Miller County, AR': '091', + 'Mississippi County, AR': '093', + 'Monroe County, AR': '095', + 'Montgomery County, AR': '097', + 'Nevada County, AR': '099', + 'Newton County, AR': '101', + 'Ouachita County, AR': '103', + 'Perry County, AR': '105', + 'Phillips County, AR': '107', + 'Pike County, AR': '109', + 'Poinsett County, AR': '111', + 'Polk County, AR': '113', + 'Pope County, AR': '115', + 'Prairie County, AR': '117', + 'Pulaski County, AR': '119', + 'Randolph County, AR': '121', + 'Saline County, AR': '125', + 'Scott County, AR': '127', + 'Searcy County, AR': '129', + 'Sebastian County, AR': '131', + 'Sevier County, AR': '133', + 'Sharp County, AR': '135', + 'St. Francis County, AR': '123', + 'Stone County, AR': '137', + 'Union County, AR': '139', + 'Van Buren County, AR': '141', + 'Washington County, AR': '143', + 'White County, AR': '145', + 'Woodruff County, AR': '147', + 'Yell County, AR': '149'}, + 6: {'--All--': '%', + 'Alameda County, CA': '001', + 'Alpine County, CA': '003', + 'Amador County, CA': '005', + 'Butte County, CA': '007', + 'Calaveras County, CA': '009', + 'Colusa County, CA': '011', + 'Contra Costa County, CA': '013', + 'Del Norte County, CA': '015', + 'El Dorado County, CA': '017', + 'Fresno County, CA': '019', + 'Glenn County, CA': '021', + 'Humboldt County, CA': '023', + 'Imperial County, CA': '025', + 'Inyo County, CA': '027', + 'Kern County, CA': '029', + 'Kings County, CA': '031', + 'Lake County, CA': '033', + 'Lassen County, CA': '035', + 'Los Angeles County, CA': '037', + 'Madera County, CA': '039', + 'Marin County, CA': '041', + 'Mariposa County, CA': '043', + 'Mendocino County, CA': '045', + 'Merced County, CA': '047', + 'Modoc County, CA': '049', + 'Mono County, CA': '051', + 'Monterey County, CA': '053', + 'Napa County, CA': '055', + 'Nevada County, CA': '057', + 'Orange County, CA': '059', + 'Placer County, CA': '061', + 'Plumas County, CA': '063', + 'Riverside County, CA': '065', + 'Sacramento County, CA': '067', + 'San Benito County, CA': '069', + 'San Bernardino County, CA': '071', + 'San Diego County, CA': '073', + 'San Francisco County/city, CA': '075', + 'San Joaquin County, CA': '077', + 'San Luis Obispo County, CA': '079', + 'San Mateo County, CA': '081', + 'Santa Barbara County, CA': '083', + 'Santa Clara County, CA': '085', + 'Santa Cruz County, CA': '087', + 'Shasta County, CA': '089', + 'Sierra County, CA': '091', + 'Siskiyou County, CA': '093', + 'Solano County, CA': '095', + 'Sonoma County, CA': '097', + 'Stanislaus County, CA': '099', + 'Sutter County, CA': '101', + 'Tehama County, CA': '103', + 'Trinity County, CA': '105', + 'Tulare County, CA': '107', + 'Tuolumne County, CA': '109', + 'Ventura County, CA': '111', + 'Yolo County, CA': '113', + 'Yuba County, CA': '115'}, + 8: {'--All--': '%', + 'Adams County, CO': '001', + 'Alamosa County, CO': '003', + 'Arapahoe County, CO': '005', + 'Archuleta County, CO': '007', + 'Baca County, CO': '009', + 'Bent County, CO': '011', + 'Boulder County, CO': '013', + 'Broomfield County/city, CO': '014', + 'Chaffee County, CO': '015', + 'Cheyenne County, CO': '017', + 'Clear Creek County, CO': '019', + 'Conejos County, CO': '021', + 'Costilla County, CO': '023', + 'Crowley County, CO': '025', + 'Custer County, CO': '027', + 'Delta County, CO': '029', + 'Denver County/city, CO': '031', + 'Dolores County, CO': '033', + 'Douglas County, CO': '035', + 'Eagle County, CO': '037', + 'El Paso County, CO': '041', + 'Elbert County, CO': '039', + 'Fremont County, CO': '043', + 'Garfield County, CO': '045', + 'Gilpin County, CO': '047', + 'Grand County, CO': '049', + 'Gunnison County, CO': '051', + 'Hinsdale County, CO': '053', + 'Huerfano County, CO': '055', + 'Jackson County, CO': '057', + 'Jefferson County, CO': '059', + 'Kiowa County, CO': '061', + 'Kit Carson County, CO': '063', + 'La Plata County, CO': '067', + 'Lake County, CO': '065', + 'Larimer County, CO': '069', + 'Las Animas County, CO': '071', + 'Lincoln County, CO': '073', + 'Logan County, CO': '075', + 'Mesa County, CO': '077', + 'Mineral County, CO': '079', + 'Moffat County, CO': '081', + 'Montezuma County, CO': '083', + 'Montrose County, CO': '085', + 'Morgan County, CO': '087', + 'Otero County, CO': '089', + 'Ouray County, CO': '091', + 'Park County, CO': '093', + 'Phillips County, CO': '095', + 'Pitkin County, CO': '097', + 'Prowers County, CO': '099', + 'Pueblo County, CO': '101', + 'Rio Blanco County, CO': '103', + 'Rio Grande County, CO': '105', + 'Routt County, CO': '107', + 'Saguache County, CO': '109', + 'San Juan County, CO': '111', + 'San Miguel County, CO': '113', + 'Sedgwick County, CO': '115', + 'Summit County, CO': '117', + 'Teller County, CO': '119', + 'Washington County, CO': '121', + 'Weld County, CO': '123', + 'Yuma County, CO': '125'}, + 9: {'--All--': '%', + 'Fairfield County, CT': '001', + 'Hartford County, CT': '003', + 'Litchfield County, CT': '005', + 'Middlesex County, CT': '007', + 'New Haven County, CT': '009', + 'New London County, CT': '011', + 'Tolland County, CT': '013', + 'Windham County, CT': '015'}, + 10: {'--All--': '%', + 'Kent County, DE': '001', + 'New Castle County, DE': '003', + 'Sussex County, DE': '005'}, + 11: {'--All--': '%', 'District of Columbia': '001'}, + 12: {'--All--': '%', + 'Alachua County, FL': '001', + 'Baker County, FL': '003', + 'Bay County, FL': '005', + 'Bradford County, FL': '007', + 'Brevard County, FL': '009', + 'Broward County, FL': '011', + 'Calhoun County, FL': '013', + 'Charlotte County, FL': '015', + 'Citrus County, FL': '017', + 'Clay County, FL': '019', + 'Collier County, FL': '021', + 'Columbia County, FL': '023', + 'DeSoto County, FL': '027', + 'Dixie County, FL': '029', + 'Duval County, FL': '031', + 'Escambia County, FL': '033', + 'Flagler County, FL': '035', + 'Franklin County, FL': '037', + 'Gadsden County, FL': '039', + 'Gilchrist County, FL': '041', + 'Glades County, FL': '043', + 'Gulf County, FL': '045', + 'Hamilton County, FL': '047', + 'Hardee County, FL': '049', + 'Hendry County, FL': '051', + 'Hernando County, FL': '053', + 'Highlands County, FL': '055', + 'Hillsborough County, FL': '057', + 'Holmes County, FL': '059', + 'Indian River County, FL': '061', + 'Jackson County, FL': '063', + 'Jefferson County, FL': '065', + 'Lafayette County, FL': '067', + 'Lake County, FL': '069', + 'Lee County, FL': '071', + 'Leon County, FL': '073', + 'Levy County, FL': '075', + 'Liberty County, FL': '077', + 'Madison County, FL': '079', + 'Manatee County, FL': '081', + 'Marion County, FL': '083', + 'Martin County, FL': '085', + 'Miami-Dade County, FL': '086', + 'Monroe County, FL': '087', + 'Nassau County, FL': '089', + 'Okaloosa County, FL': '091', + 'Okeechobee County, FL': '093', + 'Orange County, FL': '095', + 'Osceola County, FL': '097', + 'Palm Beach County, FL': '099', + 'Pasco County, FL': '101', + 'Pinellas County, FL': '103', + 'Polk County, FL': '105', + 'Putnam County, FL': '107', + 'Santa Rosa County, FL': '113', + 'Sarasota County, FL': '115', + 'Seminole County, FL': '117', + 'St. Johns County, FL': '109', + 'St. Lucie County, FL': '111', + 'Sumter County, FL': '119', + 'Suwannee County, FL': '121', + 'Taylor County, FL': '123', + 'Union County, FL': '125', + 'Volusia County, FL': '127', + 'Wakulla County, FL': '129', + 'Walton County, FL': '131', + 'Washington County, FL': '133'}, + 13: {'--All--': '%', + 'Appling County, GA': '001', + 'Atkinson County, GA': '003', + 'Bacon County, GA': '005', + 'Baker County, GA': '007', + 'Baldwin County, GA': '009', + 'Banks County, GA': '011', + 'Barrow County, GA': '013', + 'Bartow County, GA': '015', + 'Ben Hill County, GA': '017', + 'Berrien County, GA': '019', + 'Bibb County, GA': '021', + 'Bleckley County, GA': '023', + 'Brantley County, GA': '025', + 'Brooks County, GA': '027', + 'Bryan County, GA': '029', + 'Bulloch County, GA': '031', + 'Burke County, GA': '033', + 'Butts County, GA': '035', + 'Calhoun County, GA': '037', + 'Camden County, GA': '039', + 'Candler County, GA': '043', + 'Carroll County, GA': '045', + 'Catoosa County, GA': '047', + 'Charlton County, GA': '049', + 'Chatham County, GA': '051', + 'Chattahoochee County, GA': '053', + 'Chattooga County, GA': '055', + 'Cherokee County, GA': '057', + 'Clarke County, GA': '059', + 'Clay County, GA': '061', + 'Clayton County, GA': '063', + 'Clinch County, GA': '065', + 'Cobb County, GA': '067', + 'Coffee County, GA': '069', + 'Colquitt County, GA': '071', + 'Columbia County, GA': '073', + 'Cook County, GA': '075', + 'Coweta County, GA': '077', + 'Crawford County, GA': '079', + 'Crisp County, GA': '081', + 'Dade County, GA': '083', + 'Dawson County, GA': '085', + 'DeKalb County, GA': '089', + 'Decatur County, GA': '087', + 'Dodge County, GA': '091', + 'Dooly County, GA': '093', + 'Dougherty County, GA': '095', + 'Douglas County, GA': '097', + 'Early County, GA': '099', + 'Echols County, GA': '101', + 'Effingham County, GA': '103', + 'Elbert County, GA': '105', + 'Emanuel County, GA': '107', + 'Evans County, GA': '109', + 'Fannin County, GA': '111', + 'Fayette County, GA': '113', + 'Floyd County, GA': '115', + 'Forsyth County, GA': '117', + 'Franklin County, GA': '119', + 'Fulton County, GA': '121', + 'Gilmer County, GA': '123', + 'Glascock County, GA': '125', + 'Glynn County, GA': '127', + 'Gordon County, GA': '129', + 'Grady County, GA': '131', + 'Greene County, GA': '133', + 'Gwinnett County, GA': '135', + 'Habersham County, GA': '137', + 'Hall County, GA': '139', + 'Hancock County, GA': '141', + 'Haralson County, GA': '143', + 'Harris County, GA': '145', + 'Hart County, GA': '147', + 'Heard County, GA': '149', + 'Henry County, GA': '151', + 'Houston County, GA': '153', + 'Irwin County, GA': '155', + 'Jackson County, GA': '157', + 'Jasper County, GA': '159', + 'Jeff Davis County, GA': '161', + 'Jefferson County, GA': '163', + 'Jenkins County, GA': '165', + 'Johnson County, GA': '167', + 'Jones County, GA': '169', + 'Lamar County, GA': '171', + 'Lanier County, GA': '173', + 'Laurens County, GA': '175', + 'Lee County, GA': '177', + 'Liberty County, GA': '179', + 'Lincoln County, GA': '181', + 'Long County, GA': '183', + 'Lowndes County, GA': '185', + 'Lumpkin County, GA': '187', + 'Macon County, GA': '193', + 'Madison County, GA': '195', + 'Marion County, GA': '197', + 'McDuffie County, GA': '189', + 'McIntosh County, GA': '191', + 'Meriwether County, GA': '199', + 'Miller County, GA': '201', + 'Mitchell County, GA': '205', + 'Monroe County, GA': '207', + 'Montgomery County, GA': '209', + 'Morgan County, GA': '211', + 'Murray County, GA': '213', + 'Muscogee County, GA': '215', + 'Newton County, GA': '217', + 'Oconee County, GA': '219', + 'Oglethorpe County, GA': '221', + 'Paulding County, GA': '223', + 'Peach County, GA': '225', + 'Pickens County, GA': '227', + 'Pierce County, GA': '229', + 'Pike County, GA': '231', + 'Polk County, GA': '233', + 'Pulaski County, GA': '235', + 'Putnam County, GA': '237', + 'Quitman County, GA': '239', + 'Rabun County, GA': '241', + 'Randolph County, GA': '243', + 'Richmond County, GA': '245', + 'Rockdale County, GA': '247', + 'Schley County, GA': '249', + 'Screven County, GA': '251', + 'Seminole County, GA': '253', + 'Spalding County, GA': '255', + 'Stephens County, GA': '257', + 'Stewart County, GA': '259', + 'Sumter County, GA': '261', + 'Talbot County, GA': '263', + 'Taliaferro County, GA': '265', + 'Tattnall County, GA': '267', + 'Taylor County, GA': '269', + 'Telfair County, GA': '271', + 'Terrell County, GA': '273', + 'Thomas County, GA': '275', + 'Tift County, GA': '277', + 'Toombs County, GA': '279', + 'Towns County, GA': '281', + 'Treutlen County, GA': '283', + 'Troup County, GA': '285', + 'Turner County, GA': '287', + 'Twiggs County, GA': '289', + 'Union County, GA': '291', + 'Upson County, GA': '293', + 'Walker County, GA': '295', + 'Walton County, GA': '297', + 'Ware County, GA': '299', + 'Warren County, GA': '301', + 'Washington County, GA': '303', + 'Wayne County, GA': '305', + 'Webster County, GA': '307', + 'Wheeler County, GA': '309', + 'White County, GA': '311', + 'Whitfield County, GA': '313', + 'Wilcox County, GA': '315', + 'Wilkes County, GA': '317', + 'Wilkinson County, GA': '319', + 'Worth County, GA': '321'}, + 15: {'--All--': '%', + 'Hawaii County, HI': '001', + 'Honolulu County/city, HI': '003', + 'Kauai County, HI': '007', + 'Maui County, HI': '009'}, + 16: {'--All--': '%', + 'Ada County, ID': '001', + 'Adams County, ID': '003', + 'Bannock County, ID': '005', + 'Bear Lake County, ID': '007', + 'Benewah County, ID': '009', + 'Bingham County, ID': '011', + 'Blaine County, ID': '013', + 'Boise County, ID': '015', + 'Bonner County, ID': '017', + 'Bonneville County, ID': '019', + 'Boundary County, ID': '021', + 'Butte County, ID': '023', + 'Camas County, ID': '025', + 'Canyon County, ID': '027', + 'Caribou County, ID': '029', + 'Cassia County, ID': '031', + 'Clark County, ID': '033', + 'Clearwater County, ID': '035', + 'Custer County, ID': '037', + 'Elmore County, ID': '039', + 'Franklin County, ID': '041', + 'Fremont County, ID': '043', + 'Gem County, ID': '045', + 'Gooding County, ID': '047', + 'Idaho County, ID': '049', + 'Jefferson County, ID': '051', + 'Jerome County, ID': '053', + 'Kootenai County, ID': '055', + 'Latah County, ID': '057', + 'Lemhi County, ID': '059', + 'Lewis County, ID': '061', + 'Lincoln County, ID': '063', + 'Madison County, ID': '065', + 'Minidoka County, ID': '067', + 'Nez Perce County, ID': '069', + 'Oneida County, ID': '071', + 'Owyhee County, ID': '073', + 'Payette County, ID': '075', + 'Power County, ID': '077', + 'Shoshone County, ID': '079', + 'Teton County, ID': '081', + 'Twin Falls County, ID': '083', + 'Valley County, ID': '085', + 'Washington County, ID': '087'}, + 17: {'--All--': '%', + 'Adams County, IL': '001', + 'Alexander County, IL': '003', + 'Bond County, IL': '005', + 'Boone County, IL': '007', + 'Brown County, IL': '009', + 'Bureau County, IL': '011', + 'Calhoun County, IL': '013', + 'Carroll County, IL': '015', + 'Cass County, IL': '017', + 'Champaign County, IL': '019', + 'Christian County, IL': '021', + 'Clark County, IL': '023', + 'Clay County, IL': '025', + 'Clinton County, IL': '027', + 'Coles County, IL': '029', + 'Cook County, IL': '031', + 'Crawford County, IL': '033', + 'Cumberland County, IL': '035', + 'De Witt County, IL': '039', + 'DeKalb County, IL': '037', + 'Douglas County, IL': '041', + 'DuPage County, IL': '043', + 'Edgar County, IL': '045', + 'Edwards County, IL': '047', + 'Effingham County, IL': '049', + 'Fayette County, IL': '051', + 'Ford County, IL': '053', + 'Franklin County, IL': '055', + 'Fulton County, IL': '057', + 'Gallatin County, IL': '059', + 'Greene County, IL': '061', + 'Grundy County, IL': '063', + 'Hamilton County, IL': '065', + 'Hancock County, IL': '067', + 'Hardin County, IL': '069', + 'Henderson County, IL': '071', + 'Henry County, IL': '073', + 'Iroquois County, IL': '075', + 'Jackson County, IL': '077', + 'Jasper County, IL': '079', + 'Jefferson County, IL': '081', + 'Jersey County, IL': '083', + 'Jo Daviess County, IL': '085', + 'Johnson County, IL': '087', + 'Kane County, IL': '089', + 'Kankakee County, IL': '091', + 'Kendall County, IL': '093', + 'Knox County, IL': '095', + 'La Salle County, IL': '099', + 'Lake County, IL': '097', + 'Lawrence County, IL': '101', + 'Lee County, IL': '103', + 'Livingston County, IL': '105', + 'Logan County, IL': '107', + 'Macon County, IL': '115', + 'Macoupin County, IL': '117', + 'Madison County, IL': '119', + 'Marion County, IL': '121', + 'Marshall County, IL': '123', + 'Mason County, IL': '125', + 'Massac County, IL': '127', + 'McDonough County, IL': '109', + 'McHenry County, IL': '111', + 'McLean County, IL': '113', + 'Menard County, IL': '129', + 'Mercer County, IL': '131', + 'Monroe County, IL': '133', + 'Montgomery County, IL': '135', + 'Morgan County, IL': '137', + 'Moultrie County, IL': '139', + 'Ogle County, IL': '141', + 'Peoria County, IL': '143', + 'Perry County, IL': '145', + 'Piatt County, IL': '147', + 'Pike County, IL': '149', + 'Pope County, IL': '151', + 'Pulaski County, IL': '153', + 'Putnam County, IL': '155', + 'Randolph County, IL': '157', + 'Richland County, IL': '159', + 'Rock Island County, IL': '161', + 'Saline County, IL': '165', + 'Sangamon County, IL': '167', + 'Schuyler County, IL': '169', + 'Scott County, IL': '171', + 'Shelby County, IL': '173', + 'St. Clair County, IL': '163', + 'Stark County, IL': '175', + 'Stephenson County, IL': '177', + 'Tazewell County, IL': '179', + 'Union County, IL': '181', + 'Vermilion County, IL': '183', + 'Wabash County, IL': '185', + 'Warren County, IL': '187', + 'Washington County, IL': '189', + 'Wayne County, IL': '191', + 'White County, IL': '193', + 'Whiteside County, IL': '195', + 'Will County, IL': '197', + 'Williamson County, IL': '199', + 'Winnebago County, IL': '201', + 'Woodford County, IL': '203'}, + 18: {'--All--': '%', + 'Adams County, IN': '001', + 'Allen County, IN': '003', + 'Bartholomew County, IN': '005', + 'Benton County, IN': '007', + 'Blackford County, IN': '009', + 'Boone County, IN': '011', + 'Brown County, IN': '013', + 'Carroll County, IN': '015', + 'Cass County, IN': '017', + 'Clark County, IN': '019', + 'Clay County, IN': '021', + 'Clinton County, IN': '023', + 'Crawford County, IN': '025', + 'Daviess County, IN': '027', + 'DeKalb County, IN': '033', + 'Dearborn County, IN': '029', + 'Decatur County, IN': '031', + 'Delaware County, IN': '035', + 'Dubois County, IN': '037', + 'Elkhart County, IN': '039', + 'Fayette County, IN': '041', + 'Floyd County, IN': '043', + 'Fountain County, IN': '045', + 'Franklin County, IN': '047', + 'Fulton County, IN': '049', + 'Gibson County, IN': '051', + 'Grant County, IN': '053', + 'Greene County, IN': '055', + 'Hamilton County, IN': '057', + 'Hancock County, IN': '059', + 'Harrison County, IN': '061', + 'Hendricks County, IN': '063', + 'Henry County, IN': '065', + 'Howard County, IN': '067', + 'Huntington County, IN': '069', + 'Jackson County, IN': '071', + 'Jasper County, IN': '073', + 'Jay County, IN': '075', + 'Jefferson County, IN': '077', + 'Jennings County, IN': '079', + 'Johnson County, IN': '081', + 'Knox County, IN': '083', + 'Kosciusko County, IN': '085', + 'LaGrange County, IN': '087', + 'LaPorte County, IN': '091', + 'Lake County, IN': '089', + 'Lawrence County, IN': '093', + 'Madison County, IN': '095', + 'Marion County, IN': '097', + 'Marshall County, IN': '099', + 'Martin County, IN': '101', + 'Miami County, IN': '103', + 'Monroe County, IN': '105', + 'Montgomery County, IN': '107', + 'Morgan County, IN': '109', + 'Newton County, IN': '111', + 'Noble County, IN': '113', + 'Ohio County, IN': '115', + 'Orange County, IN': '117', + 'Owen County, IN': '119', + 'Parke County, IN': '121', + 'Perry County, IN': '123', + 'Pike County, IN': '125', + 'Porter County, IN': '127', + 'Posey County, IN': '129', + 'Pulaski County, IN': '131', + 'Putnam County, IN': '133', + 'Randolph County, IN': '135', + 'Ripley County, IN': '137', + 'Rush County, IN': '139', + 'Scott County, IN': '143', + 'Shelby County, IN': '145', + 'Spencer County, IN': '147', + 'St. Joseph County, IN': '141', + 'Starke County, IN': '149', + 'Steuben County, IN': '151', + 'Sullivan County, IN': '153', + 'Switzerland County, IN': '155', + 'Tippecanoe County, IN': '157', + 'Tipton County, IN': '159', + 'Union County, IN': '161', + 'Vanderburgh County, IN': '163', + 'Vermillion County, IN': '165', + 'Vigo County, IN': '167', + 'Wabash County, IN': '169', + 'Warren County, IN': '171', + 'Warrick County, IN': '173', + 'Washington County, IN': '175', + 'Wayne County, IN': '177', + 'Wells County, IN': '179', + 'White County, IN': '181', + 'Whitley County, IN': '183'}, + 19: {'--All--': '%', + 'Adair County, IA': '001', + 'Adams County, IA': '003', + 'Allamakee County, IA': '005', + 'Appanoose County, IA': '007', + 'Audubon County, IA': '009', + 'Benton County, IA': '011', + 'Black Hawk County, IA': '013', + 'Boone County, IA': '015', + 'Bremer County, IA': '017', + 'Buchanan County, IA': '019', + 'Buena Vista County, IA': '021', + 'Butler County, IA': '023', + 'Calhoun County, IA': '025', + 'Carroll County, IA': '027', + 'Cass County, IA': '029', + 'Cedar County, IA': '031', + 'Cerro Gordo County, IA': '033', + 'Cherokee County, IA': '035', + 'Chickasaw County, IA': '037', + 'Clarke County, IA': '039', + 'Clay County, IA': '041', + 'Clayton County, IA': '043', + 'Clinton County, IA': '045', + 'Crawford County, IA': '047', + 'Dallas County, IA': '049', + 'Davis County, IA': '051', + 'Decatur County, IA': '053', + 'Delaware County, IA': '055', + 'Des Moines County, IA': '057', + 'Dickinson County, IA': '059', + 'Dubuque County, IA': '061', + 'Emmet County, IA': '063', + 'Fayette County, IA': '065', + 'Floyd County, IA': '067', + 'Franklin County, IA': '069', + 'Fremont County, IA': '071', + 'Greene County, IA': '073', + 'Grundy County, IA': '075', + 'Guthrie County, IA': '077', + 'Hamilton County, IA': '079', + 'Hancock County, IA': '081', + 'Hardin County, IA': '083', + 'Harrison County, IA': '085', + 'Henry County, IA': '087', + 'Howard County, IA': '089', + 'Humboldt County, IA': '091', + 'Ida County, IA': '093', + 'Iowa County, IA': '095', + 'Jackson County, IA': '097', + 'Jasper County, IA': '099', + 'Jefferson County, IA': '101', + 'Johnson County, IA': '103', + 'Jones County, IA': '105', + 'Keokuk County, IA': '107', + 'Kossuth County, IA': '109', + 'Lee County, IA': '111', + 'Linn County, IA': '113', + 'Louisa County, IA': '115', + 'Lucas County, IA': '117', + 'Lyon County, IA': '119', + 'Madison County, IA': '121', + 'Mahaska County, IA': '123', + 'Marion County, IA': '125', + 'Marshall County, IA': '127', + 'Mills County, IA': '129', + 'Mitchell County, IA': '131', + 'Monona County, IA': '133', + 'Monroe County, IA': '135', + 'Montgomery County, IA': '137', + 'Muscatine County, IA': '139', + "O'Brien County, IA": '141', + 'Osceola County, IA': '143', + 'Page County, IA': '145', + 'Palo Alto County, IA': '147', + 'Plymouth County, IA': '149', + 'Pocahontas County, IA': '151', + 'Polk County, IA': '153', + 'Pottawattamie County, IA': '155', + 'Poweshiek County, IA': '157', + 'Ringgold County, IA': '159', + 'Sac County, IA': '161', + 'Scott County, IA': '163', + 'Shelby County, IA': '165', + 'Sioux County, IA': '167', + 'Story County, IA': '169', + 'Tama County, IA': '171', + 'Taylor County, IA': '173', + 'Union County, IA': '175', + 'Van Buren County, IA': '177', + 'Wapello County, IA': '179', + 'Warren County, IA': '181', + 'Washington County, IA': '183', + 'Wayne County, IA': '185', + 'Webster County, IA': '187', + 'Winnebago County, IA': '189', + 'Winneshiek County, IA': '191', + 'Woodbury County, IA': '193', + 'Worth County, IA': '195', + 'Wright County, IA': '197'}, + 20: {'--All--': '%', + 'Allen County, KS': '001', + 'Anderson County, KS': '003', + 'Atchison County, KS': '005', + 'Barber County, KS': '007', + 'Barton County, KS': '009', + 'Bourbon County, KS': '011', + 'Brown County, KS': '013', + 'Butler County, KS': '015', + 'Chase County, KS': '017', + 'Chautauqua County, KS': '019', + 'Cherokee County, KS': '021', + 'Cheyenne County, KS': '023', + 'Clark County, KS': '025', + 'Clay County, KS': '027', + 'Cloud County, KS': '029', + 'Coffey County, KS': '031', + 'Comanche County, KS': '033', + 'Cowley County, KS': '035', + 'Crawford County, KS': '037', + 'Decatur County, KS': '039', + 'Dickinson County, KS': '041', + 'Doniphan County, KS': '043', + 'Douglas County, KS': '045', + 'Edwards County, KS': '047', + 'Elk County, KS': '049', + 'Ellis County, KS': '051', + 'Ellsworth County, KS': '053', + 'Finney County, KS': '055', + 'Ford County, KS': '057', + 'Franklin County, KS': '059', + 'Geary County, KS': '061', + 'Gove County, KS': '063', + 'Graham County, KS': '065', + 'Grant County, KS': '067', + 'Gray County, KS': '069', + 'Greeley County, KS': '071', + 'Greenwood County, KS': '073', + 'Hamilton County, KS': '075', + 'Harper County, KS': '077', + 'Harvey County, KS': '079', + 'Haskell County, KS': '081', + 'Hodgeman County, KS': '083', + 'Jackson County, KS': '085', + 'Jefferson County, KS': '087', + 'Jewell County, KS': '089', + 'Johnson County, KS': '091', + 'Kearny County, KS': '093', + 'Kingman County, KS': '095', + 'Kiowa County, KS': '097', + 'Labette County, KS': '099', + 'Lane County, KS': '101', + 'Leavenworth County, KS': '103', + 'Lincoln County, KS': '105', + 'Linn County, KS': '107', + 'Logan County, KS': '109', + 'Lyon County, KS': '111', + 'Marion County, KS': '115', + 'Marshall County, KS': '117', + 'McPherson County, KS': '113', + 'Meade County, KS': '119', + 'Miami County, KS': '121', + 'Mitchell County, KS': '123', + 'Montgomery County, KS': '125', + 'Morris County, KS': '127', + 'Morton County, KS': '129', + 'Nemaha County, KS': '131', + 'Neosho County, KS': '133', + 'Ness County, KS': '135', + 'Norton County, KS': '137', + 'Osage County, KS': '139', + 'Osborne County, KS': '141', + 'Ottawa County, KS': '143', + 'Pawnee County, KS': '145', + 'Phillips County, KS': '147', + 'Pottawatomie County, KS': '149', + 'Pratt County, KS': '151', + 'Rawlins County, KS': '153', + 'Reno County, KS': '155', + 'Republic County, KS': '157', + 'Rice County, KS': '159', + 'Riley County, KS': '161', + 'Rooks County, KS': '163', + 'Rush County, KS': '165', + 'Russell County, KS': '167', + 'Saline County, KS': '169', + 'Scott County, KS': '171', + 'Sedgwick County, KS': '173', + 'Seward County, KS': '175', + 'Shawnee County, KS': '177', + 'Sheridan County, KS': '179', + 'Sherman County, KS': '181', + 'Smith County, KS': '183', + 'Stafford County, KS': '185', + 'Stanton County, KS': '187', + 'Stevens County, KS': '189', + 'Sumner County, KS': '191', + 'Thomas County, KS': '193', + 'Trego County, KS': '195', + 'Wabaunsee County, KS': '197', + 'Wallace County, KS': '199', + 'Washington County, KS': '201', + 'Wichita County, KS': '203', + 'Wilson County, KS': '205', + 'Woodson County, KS': '207', + 'Wyandotte County, KS': '209'}, + 21: {'--All--': '%', + 'Adair County, KY': '001', + 'Allen County, KY': '003', + 'Anderson County, KY': '005', + 'Ballard County, KY': '007', + 'Barren County, KY': '009', + 'Bath County, KY': '011', + 'Bell County, KY': '013', + 'Boone County, KY': '015', + 'Bourbon County, KY': '017', + 'Boyd County, KY': '019', + 'Boyle County, KY': '021', + 'Bracken County, KY': '023', + 'Breathitt County, KY': '025', + 'Breckinridge County, KY': '027', + 'Bullitt County, KY': '029', + 'Butler County, KY': '031', + 'Caldwell County, KY': '033', + 'Calloway County, KY': '035', + 'Campbell County, KY': '037', + 'Carlisle County, KY': '039', + 'Carroll County, KY': '041', + 'Carter County, KY': '043', + 'Casey County, KY': '045', + 'Christian County, KY': '047', + 'Clark County, KY': '049', + 'Clay County, KY': '051', + 'Clinton County, KY': '053', + 'Crittenden County, KY': '055', + 'Cumberland County, KY': '057', + 'Daviess County, KY': '059', + 'Edmonson County, KY': '061', + 'Elliott County, KY': '063', + 'Estill County, KY': '065', + 'Fayette County, KY': '067', + 'Fleming County, KY': '069', + 'Floyd County, KY': '071', + 'Franklin County, KY': '073', + 'Fulton County, KY': '075', + 'Gallatin County, KY': '077', + 'Garrard County, KY': '079', + 'Grant County, KY': '081', + 'Graves County, KY': '083', + 'Grayson County, KY': '085', + 'Green County, KY': '087', + 'Greenup County, KY': '089', + 'Hancock County, KY': '091', + 'Hardin County, KY': '093', + 'Harlan County, KY': '095', + 'Harrison County, KY': '097', + 'Hart County, KY': '099', + 'Henderson County, KY': '101', + 'Henry County, KY': '103', + 'Hickman County, KY': '105', + 'Hopkins County, KY': '107', + 'Jackson County, KY': '109', + 'Jefferson County, KY': '111', + 'Jessamine County, KY': '113', + 'Johnson County, KY': '115', + 'Kenton County, KY': '117', + 'Knott County, KY': '119', + 'Knox County, KY': '121', + 'Larue County, KY': '123', + 'Laurel County, KY': '125', + 'Lawrence County, KY': '127', + 'Lee County, KY': '129', + 'Leslie County, KY': '131', + 'Letcher County, KY': '133', + 'Lewis County, KY': '135', + 'Lincoln County, KY': '137', + 'Livingston County, KY': '139', + 'Logan County, KY': '141', + 'Lyon County, KY': '143', + 'Madison County, KY': '151', + 'Magoffin County, KY': '153', + 'Marion County, KY': '155', + 'Marshall County, KY': '157', + 'Martin County, KY': '159', + 'Mason County, KY': '161', + 'McCracken County, KY': '145', + 'McCreary County, KY': '147', + 'McLean County, KY': '149', + 'Meade County, KY': '163', + 'Menifee County, KY': '165', + 'Mercer County, KY': '167', + 'Metcalfe County, KY': '169', + 'Monroe County, KY': '171', + 'Montgomery County, KY': '173', + 'Morgan County, KY': '175', + 'Muhlenberg County, KY': '177', + 'Nelson County, KY': '179', + 'Nicholas County, KY': '181', + 'Ohio County, KY': '183', + 'Oldham County, KY': '185', + 'Owen County, KY': '187', + 'Owsley County, KY': '189', + 'Pendleton County, KY': '191', + 'Perry County, KY': '193', + 'Pike County, KY': '195', + 'Powell County, KY': '197', + 'Pulaski County, KY': '199', + 'Robertson County, KY': '201', + 'Rockcastle County, KY': '203', + 'Rowan County, KY': '205', + 'Russell County, KY': '207', + 'Scott County, KY': '209', + 'Shelby County, KY': '211', + 'Simpson County, KY': '213', + 'Spencer County, KY': '215', + 'Taylor County, KY': '217', + 'Todd County, KY': '219', + 'Trigg County, KY': '221', + 'Trimble County, KY': '223', + 'Union County, KY': '225', + 'Warren County, KY': '227', + 'Washington County, KY': '229', + 'Wayne County, KY': '231', + 'Webster County, KY': '233', + 'Whitley County, KY': '235', + 'Wolfe County, KY': '237', + 'Woodford County, KY': '239'}, + 22: {'--All--': '%', + 'Acadia Parish, LA': '001', + 'Allen Parish, LA': '003', + 'Ascension Parish, LA': '005', + 'Assumption Parish, LA': '007', + 'Avoyelles Parish, LA': '009', + 'Beauregard Parish, LA': '011', + 'Bienville Parish, LA': '013', + 'Bossier Parish, LA': '015', + 'Caddo Parish, LA': '017', + 'Calcasieu Parish, LA': '019', + 'Caldwell Parish, LA': '021', + 'Cameron Parish, LA': '023', + 'Catahoula Parish, LA': '025', + 'Claiborne Parish, LA': '027', + 'Concordia Parish, LA': '029', + 'De Soto Parish, LA': '031', + 'East Baton Rouge Parish, LA': '033', + 'East Carroll Parish, LA': '035', + 'East Feliciana Parish, LA': '037', + 'Evangeline Parish, LA': '039', + 'Franklin Parish, LA': '041', + 'Grant Parish, LA': '043', + 'Iberia Parish, LA': '045', + 'Iberville Parish, LA': '047', + 'Jackson Parish, LA': '049', + 'Jefferson Davis Parish, LA': '053', + 'Jefferson Parish, LA': '051', + 'La Salle Parish, LA': '059', + 'Lafayette Parish, LA': '055', + 'Lafourche Parish, LA': '057', + 'Lincoln Parish, LA': '061', + 'Livingston Parish, LA': '063', + 'Madison Parish, LA': '065', + 'Morehouse Parish, LA': '067', + 'Natchitoches Parish, LA': '069', + 'Orleans Parish, LA': '071', + 'Ouachita Parish, LA': '073', + 'Plaquemines Parish, LA': '075', + 'Pointe Coupee Parish, LA': '077', + 'Rapides Parish, LA': '079', + 'Red River Parish, LA': '081', + 'Richland Parish, LA': '083', + 'Sabine Parish, LA': '085', + 'St. Bernard Parish, LA': '087', + 'St. Charles Parish, LA': '089', + 'St. Helena Parish, LA': '091', + 'St. James Parish, LA': '093', + 'St. John the Baptist Parish, LA': '095', + 'St. Landry Parish, LA': '097', + 'St. Martin Parish, LA': '099', + 'St. Mary Parish, LA': '101', + 'St. Tammany Parish, LA': '103', + 'Tangipahoa Parish, LA': '105', + 'Tensas Parish, LA': '107', + 'Terrebonne Parish, LA': '109', + 'Union Parish, LA': '111', + 'Vermilion Parish, LA': '113', + 'Vernon Parish, LA': '115', + 'Washington Parish, LA': '117', + 'Webster Parish, LA': '119', + 'West Baton Rouge Parish, LA': '121', + 'West Carroll Parish, LA': '123', + 'West Feliciana Parish, LA': '125', + 'Winn Parish, LA': '127'}, + 23: {'--All--': '%', + 'Androscoggin County, ME': '001', + 'Aroostook County, ME': '003', + 'Cumberland County, ME': '005', + 'Franklin County, ME': '007', + 'Hancock County, ME': '009', + 'Kennebec County, ME': '011', + 'Knox County, ME': '013', + 'Lincoln County, ME': '015', + 'Oxford County, ME': '017', + 'Penobscot County, ME': '019', + 'Piscataquis County, ME': '021', + 'Sagadahoc County, ME': '023', + 'Somerset County, ME': '025', + 'Waldo County, ME': '027', + 'Washington County, ME': '029', + 'York County, ME': '031'}, + 24: {'--All--': '%', + 'Allegany County, MD': '001', + 'Anne Arundel County, MD': '003', + 'Baltimore County, MD': '005', + 'Baltimore city, MD': '510', + 'Calvert County, MD': '009', + 'Caroline County, MD': '011', + 'Carroll County, MD': '013', + 'Cecil County, MD': '015', + 'Charles County, MD': '017', + 'Dorchester County, MD': '019', + 'Frederick County, MD': '021', + 'Garrett County, MD': '023', + 'Harford County, MD': '025', + 'Howard County, MD': '027', + 'Kent County, MD': '029', + 'Montgomery County, MD': '031', + "Prince George's County, MD": '033', + "Queen Anne's County, MD": '035', + 'Somerset County, MD': '039', + "St. Mary's County, MD": '037', + 'Talbot County, MD': '041', + 'Washington County, MD': '043', + 'Wicomico County, MD': '045', + 'Worcester County, MD': '047'}, + 25: {'--All--': '%', + 'Barnstable County, MA': '001', + 'Berkshire County, MA': '003', + 'Bristol County, MA': '005', + 'Dukes County, MA': '007', + 'Essex County, MA': '009', + 'Franklin County, MA': '011', + 'Hampden County, MA': '013', + 'Hampshire County, MA': '015', + 'Middlesex County, MA': '017', + 'Nantucket County/town, MA': '019', + 'Norfolk County, MA': '021', + 'Plymouth County, MA': '023', + 'Suffolk County, MA': '025', + 'Worcester County, MA': '027'}, + 26: {'--All--': '%', + 'Alcona County, MI': '001', + 'Alger County, MI': '003', + 'Allegan County, MI': '005', + 'Alpena County, MI': '007', + 'Antrim County, MI': '009', + 'Arenac County, MI': '011', + 'Baraga County, MI': '013', + 'Barry County, MI': '015', + 'Bay County, MI': '017', + 'Benzie County, MI': '019', + 'Berrien County, MI': '021', + 'Branch County, MI': '023', + 'Calhoun County, MI': '025', + 'Cass County, MI': '027', + 'Charlevoix County, MI': '029', + 'Cheboygan County, MI': '031', + 'Chippewa County, MI': '033', + 'Clare County, MI': '035', + 'Clinton County, MI': '037', + 'Crawford County, MI': '039', + 'Delta County, MI': '041', + 'Dickinson County, MI': '043', + 'Eaton County, MI': '045', + 'Emmet County, MI': '047', + 'Genesee County, MI': '049', + 'Gladwin County, MI': '051', + 'Gogebic County, MI': '053', + 'Grand Traverse County, MI': '055', + 'Gratiot County, MI': '057', + 'Hillsdale County, MI': '059', + 'Houghton County, MI': '061', + 'Huron County, MI': '063', + 'Ingham County, MI': '065', + 'Ionia County, MI': '067', + 'Iosco County, MI': '069', + 'Iron County, MI': '071', + 'Isabella County, MI': '073', + 'Jackson County, MI': '075', + 'Kalamazoo County, MI': '077', + 'Kalkaska County, MI': '079', + 'Kent County, MI': '081', + 'Keweenaw County, MI': '083', + 'Lake County, MI': '085', + 'Lapeer County, MI': '087', + 'Leelanau County, MI': '089', + 'Lenawee County, MI': '091', + 'Livingston County, MI': '093', + 'Luce County, MI': '095', + 'Mackinac County, MI': '097', + 'Macomb County, MI': '099', + 'Manistee County, MI': '101', + 'Marquette County, MI': '103', + 'Mason County, MI': '105', + 'Mecosta County, MI': '107', + 'Menominee County, MI': '109', + 'Midland County, MI': '111', + 'Missaukee County, MI': '113', + 'Monroe County, MI': '115', + 'Montcalm County, MI': '117', + 'Montmorency County, MI': '119', + 'Muskegon County, MI': '121', + 'Newaygo County, MI': '123', + 'Oakland County, MI': '125', + 'Oceana County, MI': '127', + 'Ogemaw County, MI': '129', + 'Ontonagon County, MI': '131', + 'Osceola County, MI': '133', + 'Oscoda County, MI': '135', + 'Otsego County, MI': '137', + 'Ottawa County, MI': '139', + 'Presque Isle County, MI': '141', + 'Roscommon County, MI': '143', + 'Saginaw County, MI': '145', + 'Sanilac County, MI': '151', + 'Schoolcraft County, MI': '153', + 'Shiawassee County, MI': '155', + 'St. Clair County, MI': '147', + 'St. Joseph County, MI': '149', + 'Tuscola County, MI': '157', + 'Van Buren County, MI': '159', + 'Washtenaw County, MI': '161', + 'Wayne County, MI': '163', + 'Wexford County, MI': '165'}, + 27: {'--All--': '%', + 'Aitkin County, MN': '001', + 'Anoka County, MN': '003', + 'Becker County, MN': '005', + 'Beltrami County, MN': '007', + 'Benton County, MN': '009', + 'Big Stone County, MN': '011', + 'Blue Earth County, MN': '013', + 'Brown County, MN': '015', + 'Carlton County, MN': '017', + 'Carver County, MN': '019', + 'Cass County, MN': '021', + 'Chippewa County, MN': '023', + 'Chisago County, MN': '025', + 'Clay County, MN': '027', + 'Clearwater County, MN': '029', + 'Cook County, MN': '031', + 'Cottonwood County, MN': '033', + 'Crow Wing County, MN': '035', + 'Dakota County, MN': '037', + 'Dodge County, MN': '039', + 'Douglas County, MN': '041', + 'Faribault County, MN': '043', + 'Fillmore County, MN': '045', + 'Freeborn County, MN': '047', + 'Goodhue County, MN': '049', + 'Grant County, MN': '051', + 'Hennepin County, MN': '053', + 'Houston County, MN': '055', + 'Hubbard County, MN': '057', + 'Isanti County, MN': '059', + 'Itasca County, MN': '061', + 'Jackson County, MN': '063', + 'Kanabec County, MN': '065', + 'Kandiyohi County, MN': '067', + 'Kittson County, MN': '069', + 'Koochiching County, MN': '071', + 'Lac qui Parle County, MN': '073', + 'Lake County, MN': '075', + 'Lake of the Woods County, MN': '077', + 'Le Sueur County, MN': '079', + 'Lincoln County, MN': '081', + 'Lyon County, MN': '083', + 'Mahnomen County, MN': '087', + 'Marshall County, MN': '089', + 'Martin County, MN': '091', + 'McLeod County, MN': '085', + 'Meeker County, MN': '093', + 'Mille Lacs County, MN': '095', + 'Morrison County, MN': '097', + 'Mower County, MN': '099', + 'Murray County, MN': '101', + 'Nicollet County, MN': '103', + 'Nobles County, MN': '105', + 'Norman County, MN': '107', + 'Olmsted County, MN': '109', + 'Otter Tail County, MN': '111', + 'Pennington County, MN': '113', + 'Pine County, MN': '115', + 'Pipestone County, MN': '117', + 'Polk County, MN': '119', + 'Pope County, MN': '121', + 'Ramsey County, MN': '123', + 'Red Lake County, MN': '125', + 'Redwood County, MN': '127', + 'Renville County, MN': '129', + 'Rice County, MN': '131', + 'Rock County, MN': '133', + 'Roseau County, MN': '135', + 'Scott County, MN': '139', + 'Sherburne County, MN': '141', + 'Sibley County, MN': '143', + 'St. Louis County, MN': '137', + 'Stearns County, MN': '145', + 'Steele County, MN': '147', + 'Stevens County, MN': '149', + 'Swift County, MN': '151', + 'Todd County, MN': '153', + 'Traverse County, MN': '155', + 'Wabasha County, MN': '157', + 'Wadena County, MN': '159', + 'Waseca County, MN': '161', + 'Washington County, MN': '163', + 'Watonwan County, MN': '165', + 'Wilkin County, MN': '167', + 'Winona County, MN': '169', + 'Wright County, MN': '171', + 'Yellow Medicine County, MN': '173'}, + 28: {'--All--': '%', + 'Adams County, MS': '001', + 'Alcorn County, MS': '003', + 'Amite County, MS': '005', + 'Attala County, MS': '007', + 'Benton County, MS': '009', + 'Bolivar County, MS': '011', + 'Calhoun County, MS': '013', + 'Carroll County, MS': '015', + 'Chickasaw County, MS': '017', + 'Choctaw County, MS': '019', + 'Claiborne County, MS': '021', + 'Clarke County, MS': '023', + 'Clay County, MS': '025', + 'Coahoma County, MS': '027', + 'Copiah County, MS': '029', + 'Covington County, MS': '031', + 'DeSoto County, MS': '033', + 'Forrest County, MS': '035', + 'Franklin County, MS': '037', + 'George County, MS': '039', + 'Greene County, MS': '041', + 'Grenada County, MS': '043', + 'Hancock County, MS': '045', + 'Harrison County, MS': '047', + 'Hinds County, MS': '049', + 'Holmes County, MS': '051', + 'Humphreys County, MS': '053', + 'Issaquena County, MS': '055', + 'Itawamba County, MS': '057', + 'Jackson County, MS': '059', + 'Jasper County, MS': '061', + 'Jefferson County, MS': '063', + 'Jefferson Davis County, MS': '065', + 'Jones County, MS': '067', + 'Kemper County, MS': '069', + 'Lafayette County, MS': '071', + 'Lamar County, MS': '073', + 'Lauderdale County, MS': '075', + 'Lawrence County, MS': '077', + 'Leake County, MS': '079', + 'Lee County, MS': '081', + 'Leflore County, MS': '083', + 'Lincoln County, MS': '085', + 'Lowndes County, MS': '087', + 'Madison County, MS': '089', + 'Marion County, MS': '091', + 'Marshall County, MS': '093', + 'Monroe County, MS': '095', + 'Montgomery County, MS': '097', + 'Neshoba County, MS': '099', + 'Newton County, MS': '101', + 'Noxubee County, MS': '103', + 'Oktibbeha County, MS': '105', + 'Panola County, MS': '107', + 'Pearl River County, MS': '109', + 'Perry County, MS': '111', + 'Pike County, MS': '113', + 'Pontotoc County, MS': '115', + 'Prentiss County, MS': '117', + 'Quitman County, MS': '119', + 'Rankin County, MS': '121', + 'Scott County, MS': '123', + 'Sharkey County, MS': '125', + 'Simpson County, MS': '127', + 'Smith County, MS': '129', + 'Stone County, MS': '131', + 'Sunflower County, MS': '133', + 'Tallahatchie County, MS': '135', + 'Tate County, MS': '137', + 'Tippah County, MS': '139', + 'Tishomingo County, MS': '141', + 'Tunica County, MS': '143', + 'Union County, MS': '145', + 'Walthall County, MS': '147', + 'Warren County, MS': '149', + 'Washington County, MS': '151', + 'Wayne County, MS': '153', + 'Webster County, MS': '155', + 'Wilkinson County, MS': '157', + 'Winston County, MS': '159', + 'Yalobusha County, MS': '161', + 'Yazoo County, MS': '163'}, + 29: {'--All--': '%', + 'Adair County, MO': '001', + 'Andrew County, MO': '003', + 'Atchison County, MO': '005', + 'Audrain County, MO': '007', + 'Barry County, MO': '009', + 'Barton County, MO': '011', + 'Bates County, MO': '013', + 'Benton County, MO': '015', + 'Bollinger County, MO': '017', + 'Boone County, MO': '019', + 'Buchanan County, MO': '021', + 'Butler County, MO': '023', + 'Caldwell County, MO': '025', + 'Callaway County, MO': '027', + 'Camden County, MO': '029', + 'Cape Girardeau County, MO': '031', + 'Carroll County, MO': '033', + 'Carter County, MO': '035', + 'Cass County, MO': '037', + 'Cedar County, MO': '039', + 'Chariton County, MO': '041', + 'Christian County, MO': '043', + 'Clark County, MO': '045', + 'Clay County, MO': '047', + 'Clinton County, MO': '049', + 'Cole County, MO': '051', + 'Cooper County, MO': '053', + 'Crawford County, MO': '055', + 'Dade County, MO': '057', + 'Dallas County, MO': '059', + 'Daviess County, MO': '061', + 'DeKalb County, MO': '063', + 'Dent County, MO': '065', + 'Douglas County, MO': '067', + 'Dunklin County, MO': '069', + 'Franklin County, MO': '071', + 'Gasconade County, MO': '073', + 'Gentry County, MO': '075', + 'Greene County, MO': '077', + 'Grundy County, MO': '079', + 'Harrison County, MO': '081', + 'Henry County, MO': '083', + 'Hickory County, MO': '085', + 'Holt County, MO': '087', + 'Howard County, MO': '089', + 'Howell County, MO': '091', + 'Iron County, MO': '093', + 'Jackson County, MO': '095', + 'Jasper County, MO': '097', + 'Jefferson County, MO': '099', + 'Johnson County, MO': '101', + 'Knox County, MO': '103', + 'Laclede County, MO': '105', + 'Lafayette County, MO': '107', + 'Lawrence County, MO': '109', + 'Lewis County, MO': '111', + 'Lincoln County, MO': '113', + 'Linn County, MO': '115', + 'Livingston County, MO': '117', + 'Macon County, MO': '121', + 'Madison County, MO': '123', + 'Maries County, MO': '125', + 'Marion County, MO': '127', + 'McDonald County, MO': '119', + 'Mercer County, MO': '129', + 'Miller County, MO': '131', + 'Mississippi County, MO': '133', + 'Moniteau County, MO': '135', + 'Monroe County, MO': '137', + 'Montgomery County, MO': '139', + 'Morgan County, MO': '141', + 'New Madrid County, MO': '143', + 'Newton County, MO': '145', + 'Nodaway County, MO': '147', + 'Oregon County, MO': '149', + 'Osage County, MO': '151', + 'Ozark County, MO': '153', + 'Pemiscot County, MO': '155', + 'Perry County, MO': '157', + 'Pettis County, MO': '159', + 'Phelps County, MO': '161', + 'Pike County, MO': '163', + 'Platte County, MO': '165', + 'Polk County, MO': '167', + 'Pulaski County, MO': '169', + 'Putnam County, MO': '171', + 'Ralls County, MO': '173', + 'Randolph County, MO': '175', + 'Ray County, MO': '177', + 'Reynolds County, MO': '179', + 'Ripley County, MO': '181', + 'Saline County, MO': '195', + 'Schuyler County, MO': '197', + 'Scotland County, MO': '199', + 'Scott County, MO': '201', + 'Shannon County, MO': '203', + 'Shelby County, MO': '205', + 'St. Charles County, MO': '183', + 'St. Clair County, MO': '185', + 'St. Francois County, MO': '187', + 'St. Louis County, MO': '189', + 'St. Louis city, MO': '510', + 'Ste. Genevieve County, MO': '186', + 'Stoddard County, MO': '207', + 'Stone County, MO': '209', + 'Sullivan County, MO': '211', + 'Taney County, MO': '213', + 'Texas County, MO': '215', + 'Vernon County, MO': '217', + 'Warren County, MO': '219', + 'Washington County, MO': '221', + 'Wayne County, MO': '223', + 'Webster County, MO': '225', + 'Worth County, MO': '227', + 'Wright County, MO': '229'}, + 30: {'--All--': '%', + 'Beaverhead County, MT': '001', + 'Big Horn County, MT': '003', + 'Blaine County, MT': '005', + 'Broadwater County, MT': '007', + 'Carbon County, MT': '009', + 'Carter County, MT': '011', + 'Cascade County, MT': '013', + 'Chouteau County, MT': '015', + 'Custer County, MT': '017', + 'Daniels County, MT': '019', + 'Dawson County, MT': '021', + 'Deer Lodge County, MT': '023', + 'Fallon County, MT': '025', + 'Fergus County, MT': '027', + 'Flathead County, MT': '029', + 'Gallatin County, MT': '031', + 'Garfield County, MT': '033', + 'Glacier County, MT': '035', + 'Golden Valley County, MT': '037', + 'Granite County, MT': '039', + 'Hill County, MT': '041', + 'Jefferson County, MT': '043', + 'Judith Basin County, MT': '045', + 'Lake County, MT': '047', + 'Lewis and Clark County, MT': '049', + 'Liberty County, MT': '051', + 'Lincoln County, MT': '053', + 'Madison County, MT': '057', + 'McCone County, MT': '055', + 'Meagher County, MT': '059', + 'Mineral County, MT': '061', + 'Missoula County, MT': '063', + 'Musselshell County, MT': '065', + 'Park County, MT': '067', + 'Petroleum County, MT': '069', + 'Phillips County, MT': '071', + 'Pondera County, MT': '073', + 'Powder River County, MT': '075', + 'Powell County, MT': '077', + 'Prairie County, MT': '079', + 'Ravalli County, MT': '081', + 'Richland County, MT': '083', + 'Roosevelt County, MT': '085', + 'Rosebud County, MT': '087', + 'Sanders County, MT': '089', + 'Sheridan County, MT': '091', + 'Silver Bow County, MT': '093', + 'Stillwater County, MT': '095', + 'Sweet Grass County, MT': '097', + 'Teton County, MT': '099', + 'Toole County, MT': '101', + 'Treasure County, MT': '103', + 'Valley County, MT': '105', + 'Wheatland County, MT': '107', + 'Wibaux County, MT': '109', + 'Yellowstone County, MT': '111'}, + 31: {'--All--': '%', + 'Adams County, NE': '001', + 'Antelope County, NE': '003', + 'Arthur County, NE': '005', + 'Banner County, NE': '007', + 'Blaine County, NE': '009', + 'Boone County, NE': '011', + 'Box Butte County, NE': '013', + 'Boyd County, NE': '015', + 'Brown County, NE': '017', + 'Buffalo County, NE': '019', + 'Burt County, NE': '021', + 'Butler County, NE': '023', + 'Cass County, NE': '025', + 'Cedar County, NE': '027', + 'Chase County, NE': '029', + 'Cherry County, NE': '031', + 'Cheyenne County, NE': '033', + 'Clay County, NE': '035', + 'Colfax County, NE': '037', + 'Cuming County, NE': '039', + 'Custer County, NE': '041', + 'Dakota County, NE': '043', + 'Dawes County, NE': '045', + 'Dawson County, NE': '047', + 'Deuel County, NE': '049', + 'Dixon County, NE': '051', + 'Dodge County, NE': '053', + 'Douglas County, NE': '055', + 'Dundy County, NE': '057', + 'Fillmore County, NE': '059', + 'Franklin County, NE': '061', + 'Frontier County, NE': '063', + 'Furnas County, NE': '065', + 'Gage County, NE': '067', + 'Garden County, NE': '069', + 'Garfield County, NE': '071', + 'Gosper County, NE': '073', + 'Grant County, NE': '075', + 'Greeley County, NE': '077', + 'Hall County, NE': '079', + 'Hamilton County, NE': '081', + 'Harlan County, NE': '083', + 'Hayes County, NE': '085', + 'Hitchcock County, NE': '087', + 'Holt County, NE': '089', + 'Hooker County, NE': '091', + 'Howard County, NE': '093', + 'Jefferson County, NE': '095', + 'Johnson County, NE': '097', + 'Kearney County, NE': '099', + 'Keith County, NE': '101', + 'Keya Paha County, NE': '103', + 'Kimball County, NE': '105', + 'Knox County, NE': '107', + 'Lancaster County, NE': '109', + 'Lincoln County, NE': '111', + 'Logan County, NE': '113', + 'Loup County, NE': '115', + 'Madison County, NE': '119', + 'McPherson County, NE': '117', + 'Merrick County, NE': '121', + 'Morrill County, NE': '123', + 'Nance County, NE': '125', + 'Nemaha County, NE': '127', + 'Nuckolls County, NE': '129', + 'Otoe County, NE': '131', + 'Pawnee County, NE': '133', + 'Perkins County, NE': '135', + 'Phelps County, NE': '137', + 'Pierce County, NE': '139', + 'Platte County, NE': '141', + 'Polk County, NE': '143', + 'Red Willow County, NE': '145', + 'Richardson County, NE': '147', + 'Rock County, NE': '149', + 'Saline County, NE': '151', + 'Sarpy County, NE': '153', + 'Saunders County, NE': '155', + 'Scotts Bluff County, NE': '157', + 'Seward County, NE': '159', + 'Sheridan County, NE': '161', + 'Sherman County, NE': '163', + 'Sioux County, NE': '165', + 'Stanton County, NE': '167', + 'Thayer County, NE': '169', + 'Thomas County, NE': '171', + 'Thurston County, NE': '173', + 'Valley County, NE': '175', + 'Washington County, NE': '177', + 'Wayne County, NE': '179', + 'Webster County, NE': '181', + 'Wheeler County, NE': '183', + 'York County, NE': '185'}, + 32: {'--All--': '%', + 'Carson City, NV': '510', + 'Churchill County, NV': '001', + 'Clark County, NV': '003', + 'Douglas County, NV': '005', + 'Elko County, NV': '007', + 'Esmeralda County, NV': '009', + 'Eureka County, NV': '011', + 'Humboldt County, NV': '013', + 'Lander County, NV': '015', + 'Lincoln County, NV': '017', + 'Lyon County, NV': '019', + 'Mineral County, NV': '021', + 'Nye County, NV': '023', + 'Pershing County, NV': '027', + 'Storey County, NV': '029', + 'Washoe County, NV': '031', + 'White Pine County, NV': '033'}, + 33: {'--All--': '%', + 'Belknap County, NH': '001', + 'Carroll County, NH': '003', + 'Cheshire County, NH': '005', + 'Coos County, NH': '007', + 'Grafton County, NH': '009', + 'Hillsborough County, NH': '011', + 'Merrimack County, NH': '013', + 'Rockingham County, NH': '015', + 'Strafford County, NH': '017', + 'Sullivan County, NH': '019'}, + 34: {'--All--': '%', + 'Atlantic County, NJ': '001', + 'Bergen County, NJ': '003', + 'Burlington County, NJ': '005', + 'Camden County, NJ': '007', + 'Cape May County, NJ': '009', + 'Cumberland County, NJ': '011', + 'Essex County, NJ': '013', + 'Gloucester County, NJ': '015', + 'Hudson County, NJ': '017', + 'Hunterdon County, NJ': '019', + 'Mercer County, NJ': '021', + 'Middlesex County, NJ': '023', + 'Monmouth County, NJ': '025', + 'Morris County, NJ': '027', + 'Ocean County, NJ': '029', + 'Passaic County, NJ': '031', + 'Salem County, NJ': '033', + 'Somerset County, NJ': '035', + 'Sussex County, NJ': '037', + 'Union County, NJ': '039', + 'Warren County, NJ': '041'}, + 35: {'--All--': '%', + 'Bernalillo County, NM': '001', + 'Catron County, NM': '003', + 'Chaves County, NM': '005', + 'Cibola County, NM': '006', + 'Colfax County, NM': '007', + 'Curry County, NM': '009', + 'DeBaca County, NM': '011', + 'Dona Ana County, NM': '013', + 'Eddy County, NM': '015', + 'Grant County, NM': '017', + 'Guadalupe County, NM': '019', + 'Harding County, NM': '021', + 'Hidalgo County, NM': '023', + 'Lea County, NM': '025', + 'Lincoln County, NM': '027', + 'Los Alamos County, NM': '028', + 'Luna County, NM': '029', + 'McKinley County, NM': '031', + 'Mora County, NM': '033', + 'Otero County, NM': '035', + 'Quay County, NM': '037', + 'Rio Arriba County, NM': '039', + 'Roosevelt County, NM': '041', + 'San Juan County, NM': '045', + 'San Miguel County, NM': '047', + 'Sandoval County, NM': '043', + 'Santa Fe County, NM': '049', + 'Sierra County, NM': '051', + 'Socorro County, NM': '053', + 'Taos County, NM': '055', + 'Torrance County, NM': '057', + 'Union County, NM': '059', + 'Valencia County, NM': '061'}, + 36: {'--All--': '%', + 'Albany County, NY': '001', + 'Allegany County, NY': '003', + 'Bronx County, NY': '005', + 'Broome County, NY': '007', + 'Cattaraugus County, NY': '009', + 'Cayuga County, NY': '011', + 'Chautauqua County, NY': '013', + 'Chemung County, NY': '015', + 'Chenango County, NY': '017', + 'Clinton County, NY': '019', + 'Columbia County, NY': '021', + 'Cortland County, NY': '023', + 'Delaware County, NY': '025', + 'Dutchess County, NY': '027', + 'Erie County, NY': '029', + 'Essex County, NY': '031', + 'Franklin County, NY': '033', + 'Fulton County, NY': '035', + 'Genesee County, NY': '037', + 'Greene County, NY': '039', + 'Hamilton County, NY': '041', + 'Herkimer County, NY': '043', + 'Jefferson County, NY': '045', + 'Kings County, NY': '047', + 'Lewis County, NY': '049', + 'Livingston County, NY': '051', + 'Madison County, NY': '053', + 'Monroe County, NY': '055', + 'Montgomery County, NY': '057', + 'Nassau County, NY': '059', + 'New York County, NY': '061', + 'Niagara County, NY': '063', + 'Oneida County, NY': '065', + 'Onondaga County, NY': '067', + 'Ontario County, NY': '069', + 'Orange County, NY': '071', + 'Orleans County, NY': '073', + 'Oswego County, NY': '075', + 'Otsego County, NY': '077', + 'Putnam County, NY': '079', + 'Queens County, NY': '081', + 'Rensselaer County, NY': '083', + 'Richmond County, NY': '085', + 'Rockland County, NY': '087', + 'Saratoga County, NY': '091', + 'Schenectady County, NY': '093', + 'Schoharie County, NY': '095', + 'Schuyler County, NY': '097', + 'Seneca County, NY': '099', + 'St. Lawrence County, NY': '089', + 'Steuben County, NY': '101', + 'Suffolk County, NY': '103', + 'Sullivan County, NY': '105', + 'Tioga County, NY': '107', + 'Tompkins County, NY': '109', + 'Ulster County, NY': '111', + 'Warren County, NY': '113', + 'Washington County, NY': '115', + 'Wayne County, NY': '117', + 'Westchester County, NY': '119', + 'Wyoming County, NY': '121', + 'Yates County, NY': '123'}, + 37: {'--All--': '%', + 'Alamance County, NC': '001', + 'Alexander County, NC': '003', + 'Alleghany County, NC': '005', + 'Anson County, NC': '007', + 'Ashe County, NC': '009', + 'Avery County, NC': '011', + 'Beaufort County, NC': '013', + 'Bertie County, NC': '015', + 'Bladen County, NC': '017', + 'Brunswick County, NC': '019', + 'Buncombe County, NC': '021', + 'Burke County, NC': '023', + 'Cabarrus County, NC': '025', + 'Caldwell County, NC': '027', + 'Camden County, NC': '029', + 'Carteret County, NC': '031', + 'Caswell County, NC': '033', + 'Catawba County, NC': '035', + 'Chatham County, NC': '037', + 'Cherokee County, NC': '039', + 'Chowan County, NC': '041', + 'Clay County, NC': '043', + 'Cleveland County, NC': '045', + 'Columbus County, NC': '047', + 'Craven County, NC': '049', + 'Cumberland County, NC': '051', + 'Currituck County, NC': '053', + 'Dare County, NC': '055', + 'Davidson County, NC': '057', + 'Davie County, NC': '059', + 'Duplin County, NC': '061', + 'Durham County, NC': '063', + 'Edgecombe County, NC': '065', + 'Forsyth County, NC': '067', + 'Franklin County, NC': '069', + 'Gaston County, NC': '071', + 'Gates County, NC': '073', + 'Graham County, NC': '075', + 'Granville County, NC': '077', + 'Greene County, NC': '079', + 'Guilford County, NC': '081', + 'Halifax County, NC': '083', + 'Harnett County, NC': '085', + 'Haywood County, NC': '087', + 'Henderson County, NC': '089', + 'Hertford County, NC': '091', + 'Hoke County, NC': '093', + 'Hyde County, NC': '095', + 'Iredell County, NC': '097', + 'Jackson County, NC': '099', + 'Johnston County, NC': '101', + 'Jones County, NC': '103', + 'Lee County, NC': '105', + 'Lenoir County, NC': '107', + 'Lincoln County, NC': '109', + 'Macon County, NC': '113', + 'Madison County, NC': '115', + 'Martin County, NC': '117', + 'McDowell County, NC': '111', + 'Mecklenburg County, NC': '119', + 'Mitchell County, NC': '121', + 'Montgomery County, NC': '123', + 'Moore County, NC': '125', + 'Nash County, NC': '127', + 'New Hanover County, NC': '129', + 'Northampton County, NC': '131', + 'Onslow County, NC': '133', + 'Orange County, NC': '135', + 'Pamlico County, NC': '137', + 'Pasquotank County, NC': '139', + 'Pender County, NC': '141', + 'Perquimans County, NC': '143', + 'Person County, NC': '145', + 'Pitt County, NC': '147', + 'Polk County, NC': '149', + 'Randolph County, NC': '151', + 'Richmond County, NC': '153', + 'Robeson County, NC': '155', + 'Rockingham County, NC': '157', + 'Rowan County, NC': '159', + 'Rutherford County, NC': '161', + 'Sampson County, NC': '163', + 'Scotland County, NC': '165', + 'Stanly County, NC': '167', + 'Stokes County, NC': '169', + 'Surry County, NC': '171', + 'Swain County, NC': '173', + 'Transylvania County, NC': '175', + 'Tyrrell County, NC': '177', + 'Union County, NC': '179', + 'Vance County, NC': '181', + 'Wake County, NC': '183', + 'Warren County, NC': '185', + 'Washington County, NC': '187', + 'Watauga County, NC': '189', + 'Wayne County, NC': '191', + 'Wilkes County, NC': '193', + 'Wilson County, NC': '195', + 'Yadkin County, NC': '197', + 'Yancey County, NC': '199'}, + 38: {'--All--': '%', + 'Adams County, ND': '001', + 'Barnes County, ND': '003', + 'Benson County, ND': '005', + 'Billings County, ND': '007', + 'Bottineau County, ND': '009', + 'Bowman County, ND': '011', + 'Burke County, ND': '013', + 'Burleigh County, ND': '015', + 'Cass County, ND': '017', + 'Cavalier County, ND': '019', + 'Dickey County, ND': '021', + 'Divide County, ND': '023', + 'Dunn County, ND': '025', + 'Eddy County, ND': '027', + 'Emmons County, ND': '029', + 'Foster County, ND': '031', + 'Golden Valley County, ND': '033', + 'Grand Forks County, ND': '035', + 'Grant County, ND': '037', + 'Griggs County, ND': '039', + 'Hettinger County, ND': '041', + 'Kidder County, ND': '043', + 'LaMoure County, ND': '045', + 'Logan County, ND': '047', + 'McHenry County, ND': '049', + 'McIntosh County, ND': '051', + 'McKenzie County, ND': '053', + 'McLean County, ND': '055', + 'Mercer County, ND': '057', + 'Morton County, ND': '059', + 'Mountrail County, ND': '061', + 'Nelson County, ND': '063', + 'Oliver County, ND': '065', + 'Pembina County, ND': '067', + 'Pierce County, ND': '069', + 'Ramsey County, ND': '071', + 'Ransom County, ND': '073', + 'Renville County, ND': '075', + 'Richland County, ND': '077', + 'Rolette County, ND': '079', + 'Sargent County, ND': '081', + 'Sheridan County, ND': '083', + 'Sioux County, ND': '085', + 'Slope County, ND': '087', + 'Stark County, ND': '089', + 'Steele County, ND': '091', + 'Stutsman County, ND': '093', + 'Towner County, ND': '095', + 'Traill County, ND': '097', + 'Walsh County, ND': '099', + 'Ward County, ND': '101', + 'Wells County, ND': '103', + 'Williams County, ND': '105'}, + 39: {'--All--': '%', + 'Adams County, OH': '001', + 'Allen County, OH': '003', + 'Ashland County, OH': '005', + 'Ashtabula County, OH': '007', + 'Athens County, OH': '009', + 'Auglaize County, OH': '011', + 'Belmont County, OH': '013', + 'Brown County, OH': '015', + 'Butler County, OH': '017', + 'Carroll County, OH': '019', + 'Champaign County, OH': '021', + 'Clark County, OH': '023', + 'Clermont County, OH': '025', + 'Clinton County, OH': '027', + 'Columbiana County, OH': '029', + 'Coshocton County, OH': '031', + 'Crawford County, OH': '033', + 'Cuyahoga County, OH': '035', + 'Darke County, OH': '037', + 'Defiance County, OH': '039', + 'Delaware County, OH': '041', + 'Erie County, OH': '043', + 'Fairfield County, OH': '045', + 'Fayette County, OH': '047', + 'Franklin County, OH': '049', + 'Fulton County, OH': '051', + 'Gallia County, OH': '053', + 'Geauga County, OH': '055', + 'Greene County, OH': '057', + 'Guernsey County, OH': '059', + 'Hamilton County, OH': '061', + 'Hancock County, OH': '063', + 'Hardin County, OH': '065', + 'Harrison County, OH': '067', + 'Henry County, OH': '069', + 'Highland County, OH': '071', + 'Hocking County, OH': '073', + 'Holmes County, OH': '075', + 'Huron County, OH': '077', + 'Jackson County, OH': '079', + 'Jefferson County, OH': '081', + 'Knox County, OH': '083', + 'Lake County, OH': '085', + 'Lawrence County, OH': '087', + 'Licking County, OH': '089', + 'Logan County, OH': '091', + 'Lorain County, OH': '093', + 'Lucas County, OH': '095', + 'Madison County, OH': '097', + 'Mahoning County, OH': '099', + 'Marion County, OH': '101', + 'Medina County, OH': '103', + 'Meigs County, OH': '105', + 'Mercer County, OH': '107', + 'Miami County, OH': '109', + 'Monroe County, OH': '111', + 'Montgomery County, OH': '113', + 'Morgan County, OH': '115', + 'Morrow County, OH': '117', + 'Muskingum County, OH': '119', + 'Noble County, OH': '121', + 'Ottawa County, OH': '123', + 'Paulding County, OH': '125', + 'Perry County, OH': '127', + 'Pickaway County, OH': '129', + 'Pike County, OH': '131', + 'Portage County, OH': '133', + 'Preble County, OH': '135', + 'Putnam County, OH': '137', + 'Richland County, OH': '139', + 'Ross County, OH': '141', + 'Sandusky County, OH': '143', + 'Scioto County, OH': '145', + 'Seneca County, OH': '147', + 'Shelby County, OH': '149', + 'Stark County, OH': '151', + 'Summit County, OH': '153', + 'Trumbull County, OH': '155', + 'Tuscarawas County, OH': '157', + 'Union County, OH': '159', + 'Van Wert County, OH': '161', + 'Vinton County, OH': '163', + 'Warren County, OH': '165', + 'Washington County, OH': '167', + 'Wayne County, OH': '169', + 'Williams County, OH': '171', + 'Wood County, OH': '173', + 'Wyandot County, OH': '175'}, + 40: {'--All--': '%', + 'Adair County, OK': '001', + 'Alfalfa County, OK': '003', + 'Atoka County, OK': '005', + 'Beaver County, OK': '007', + 'Beckham County, OK': '009', + 'Blaine County, OK': '011', + 'Bryan County, OK': '013', + 'Caddo County, OK': '015', + 'Canadian County, OK': '017', + 'Carter County, OK': '019', + 'Cherokee County, OK': '021', + 'Choctaw County, OK': '023', + 'Cimarron County, OK': '025', + 'Cleveland County, OK': '027', + 'Coal County, OK': '029', + 'Comanche County, OK': '031', + 'Cotton County, OK': '033', + 'Craig County, OK': '035', + 'Creek County, OK': '037', + 'Custer County, OK': '039', + 'Delaware County, OK': '041', + 'Dewey County, OK': '043', + 'Ellis County, OK': '045', + 'Garfield County, OK': '047', + 'Garvin County, OK': '049', + 'Grady County, OK': '051', + 'Grant County, OK': '053', + 'Greer County, OK': '055', + 'Harmon County, OK': '057', + 'Harper County, OK': '059', + 'Haskell County, OK': '061', + 'Hughes County, OK': '063', + 'Jackson County, OK': '065', + 'Jefferson County, OK': '067', + 'Johnston County, OK': '069', + 'Kay County, OK': '071', + 'Kingfisher County, OK': '073', + 'Kiowa County, OK': '075', + 'Latimer County, OK': '077', + 'Le Flore County, OK': '079', + 'Lincoln County, OK': '081', + 'Logan County, OK': '083', + 'Love County, OK': '085', + 'Major County, OK': '093', + 'Marshall County, OK': '095', + 'Mayes County, OK': '097', + 'McClain County, OK': '087', + 'McCurtain County, OK': '089', + 'McIntosh County, OK': '091', + 'Murray County, OK': '099', + 'Muskogee County, OK': '101', + 'Noble County, OK': '103', + 'Nowata County, OK': '105', + 'Okfuskee County, OK': '107', + 'Oklahoma County, OK': '109', + 'Okmulgee County, OK': '111', + 'Osage County, OK': '113', + 'Ottawa County, OK': '115', + 'Pawnee County, OK': '117', + 'Payne County, OK': '119', + 'Pittsburg County, OK': '121', + 'Pontotoc County, OK': '123', + 'Pottawatomie County, OK': '125', + 'Pushmataha County, OK': '127', + 'Roger Mills County, OK': '129', + 'Rogers County, OK': '131', + 'Seminole County, OK': '133', + 'Sequoyah County, OK': '135', + 'Stephens County, OK': '137', + 'Texas County, OK': '139', + 'Tillman County, OK': '141', + 'Tulsa County, OK': '143', + 'Wagoner County, OK': '145', + 'Washington County, OK': '147', + 'Washita County, OK': '149', + 'Woods County, OK': '151', + 'Woodward County, OK': '153'}, + 41: {'--All--': '%', + 'Baker County, OR': '001', + 'Benton County, OR': '003', + 'Clackamas County, OR': '005', + 'Clatsop County, OR': '007', + 'Columbia County, OR': '009', + 'Coos County, OR': '011', + 'Crook County, OR': '013', + 'Curry County, OR': '015', + 'Deschutes County, OR': '017', + 'Douglas County, OR': '019', + 'Gilliam County, OR': '021', + 'Grant County, OR': '023', + 'Harney County, OR': '025', + 'Hood River County, OR': '027', + 'Jackson County, OR': '029', + 'Jefferson County, OR': '031', + 'Josephine County, OR': '033', + 'Klamath County, OR': '035', + 'Lake County, OR': '037', + 'Lane County, OR': '039', + 'Lincoln County, OR': '041', + 'Linn County, OR': '043', + 'Malheur County, OR': '045', + 'Marion County, OR': '047', + 'Morrow County, OR': '049', + 'Multnomah County, OR': '051', + 'Polk County, OR': '053', + 'Sherman County, OR': '055', + 'Tillamook County, OR': '057', + 'Umatilla County, OR': '059', + 'Union County, OR': '061', + 'Wallowa County, OR': '063', + 'Wasco County, OR': '065', + 'Washington County, OR': '067', + 'Wheeler County, OR': '069', + 'Yamhill County, OR': '071'}, + 42: {'--All--': '%', + 'Adams County, PA': '001', + 'Allegheny County, PA': '003', + 'Armstrong County, PA': '005', + 'Beaver County, PA': '007', + 'Bedford County, PA': '009', + 'Berks County, PA': '011', + 'Blair County, PA': '013', + 'Bradford County, PA': '015', + 'Bucks County, PA': '017', + 'Butler County, PA': '019', + 'Cambria County, PA': '021', + 'Cameron County, PA': '023', + 'Carbon County, PA': '025', + 'Centre County, PA': '027', + 'Chester County, PA': '029', + 'Clarion County, PA': '031', + 'Clearfield County, PA': '033', + 'Clinton County, PA': '035', + 'Columbia County, PA': '037', + 'Crawford County, PA': '039', + 'Cumberland County, PA': '041', + 'Dauphin County, PA': '043', + 'Delaware County, PA': '045', + 'Elk County, PA': '047', + 'Erie County, PA': '049', + 'Fayette County, PA': '051', + 'Forest County, PA': '053', + 'Franklin County, PA': '055', + 'Fulton County, PA': '057', + 'Greene County, PA': '059', + 'Huntingdon County, PA': '061', + 'Indiana County, PA': '063', + 'Jefferson County, PA': '065', + 'Juniata County, PA': '067', + 'Lackawanna County, PA': '069', + 'Lancaster County, PA': '071', + 'Lawrence County, PA': '073', + 'Lebanon County, PA': '075', + 'Lehigh County, PA': '077', + 'Luzerne County, PA': '079', + 'Lycoming County, PA': '081', + 'McKean County, PA': '083', + 'Mercer County, PA': '085', + 'Mifflin County, PA': '087', + 'Monroe County, PA': '089', + 'Montgomery County, PA': '091', + 'Montour County, PA': '093', + 'Northampton County, PA': '095', + 'Northumberland County, PA': '097', + 'Perry County, PA': '099', + 'Philadelphia County/city, PA': '101', + 'Pike County, PA': '103', + 'Potter County, PA': '105', + 'Schuylkill County, PA': '107', + 'Snyder County, PA': '109', + 'Somerset County, PA': '111', + 'Sullivan County, PA': '113', + 'Susquehanna County, PA': '115', + 'Tioga County, PA': '117', + 'Union County, PA': '119', + 'Venango County, PA': '121', + 'Warren County, PA': '123', + 'Washington County, PA': '125', + 'Wayne County, PA': '127', + 'Westmoreland County, PA': '129', + 'Wyoming County, PA': '131', + 'York County, PA': '133'}, + 44: {'--All--': '%', + 'Bristol County, RI': '001', + 'Kent County, RI': '003', + 'Newport County, RI': '005', + 'Providence County, RI': '007', + 'Washington County, RI': '009'}, + 45: {'--All--': '%', + 'Abbeville County, SC': '001', + 'Aiken County, SC': '003', + 'Allendale County, SC': '005', + 'Anderson County, SC': '007', + 'Bamberg County, SC': '009', + 'Barnwell County, SC': '011', + 'Beaufort County, SC': '013', + 'Berkeley County, SC': '015', + 'Calhoun County, SC': '017', + 'Charleston County, SC': '019', + 'Cherokee County, SC': '021', + 'Chester County, SC': '023', + 'Chesterfield County, SC': '025', + 'Clarendon County, SC': '027', + 'Colleton County, SC': '029', + 'Darlington County, SC': '031', + 'Dillon County, SC': '033', + 'Dorchester County, SC': '035', + 'Edgefield County, SC': '037', + 'Fairfield County, SC': '039', + 'Florence County, SC': '041', + 'Georgetown County, SC': '043', + 'Greenville County, SC': '045', + 'Greenwood County, SC': '047', + 'Hampton County, SC': '049', + 'Horry County, SC': '051', + 'Jasper County, SC': '053', + 'Kershaw County, SC': '055', + 'Lancaster County, SC': '057', + 'Laurens County, SC': '059', + 'Lee County, SC': '061', + 'Lexington County, SC': '063', + 'Marion County, SC': '067', + 'Marlboro County, SC': '069', + 'McCormick County, SC': '065', + 'Newberry County, SC': '071', + 'Oconee County, SC': '073', + 'Orangeburg County, SC': '075', + 'Pickens County, SC': '077', + 'Richland County, SC': '079', + 'Saluda County, SC': '081', + 'Spartanburg County, SC': '083', + 'Sumter County, SC': '085', + 'Union County, SC': '087', + 'Williamsburg County, SC': '089', + 'York County, SC': '091'}, + 46: {'--All--': '%', + 'Aurora County, SD': '003', + 'Beadle County, SD': '005', + 'Bennett County, SD': '007', + 'Bon Homme County, SD': '009', + 'Brookings County, SD': '011', + 'Brown County, SD': '013', + 'Brule County, SD': '015', + 'Buffalo County, SD': '017', + 'Butte County, SD': '019', + 'Campbell County, SD': '021', + 'Charles Mix County, SD': '023', + 'Clark County, SD': '025', + 'Clay County, SD': '027', + 'Codington County, SD': '029', + 'Corson County, SD': '031', + 'Custer County, SD': '033', + 'Davison County, SD': '035', + 'Day County, SD': '037', + 'Deuel County, SD': '039', + 'Dewey County, SD': '041', + 'Douglas County, SD': '043', + 'Edmunds County, SD': '045', + 'Fall River County, SD': '047', + 'Faulk County, SD': '049', + 'Grant County, SD': '051', + 'Gregory County, SD': '053', + 'Haakon County, SD': '055', + 'Hamlin County, SD': '057', + 'Hand County, SD': '059', + 'Hanson County, SD': '061', + 'Harding County, SD': '063', + 'Hughes County, SD': '065', + 'Hutchinson County, SD': '067', + 'Hyde County, SD': '069', + 'Jackson County, SD': '071', + 'Jerauld County, SD': '073', + 'Jones County, SD': '075', + 'Kingsbury County, SD': '077', + 'Lake County, SD': '079', + 'Lawrence County, SD': '081', + 'Lincoln County, SD': '083', + 'Lyman County, SD': '085', + 'Marshall County, SD': '091', + 'McCook County, SD': '087', + 'McPherson County, SD': '089', + 'Meade County, SD': '093', + 'Mellette County, SD': '095', + 'Miner County, SD': '097', + 'Minnehaha County, SD': '099', + 'Moody County, SD': '101', + 'Pennington County, SD': '103', + 'Perkins County, SD': '105', + 'Potter County, SD': '107', + 'Roberts County, SD': '109', + 'Sanborn County, SD': '111', + 'Shannon County, SD': '113', + 'Spink County, SD': '115', + 'Stanley County, SD': '117', + 'Sully County, SD': '119', + 'Todd County, SD': '121', + 'Tripp County, SD': '123', + 'Turner County, SD': '125', + 'Union County, SD': '127', + 'Walworth County, SD': '129', + 'Yankton County, SD': '135', + 'Ziebach County, SD': '137'}, + 47: {'--All--': '%', + 'Anderson County, TN': '001', + 'Bedford County, TN': '003', + 'Benton County, TN': '005', + 'Bledsoe County, TN': '007', + 'Blount County, TN': '009', + 'Bradley County, TN': '011', + 'Campbell County, TN': '013', + 'Cannon County, TN': '015', + 'Carroll County, TN': '017', + 'Carter County, TN': '019', + 'Cheatham County, TN': '021', + 'Chester County, TN': '023', + 'Claiborne County, TN': '025', + 'Clay County, TN': '027', + 'Cocke County, TN': '029', + 'Coffee County, TN': '031', + 'Crockett County, TN': '033', + 'Cumberland County, TN': '035', + 'Davidson County, TN': '037', + 'DeKalb County, TN': '041', + 'Decatur County, TN': '039', + 'Dickson County, TN': '043', + 'Dyer County, TN': '045', + 'Fayette County, TN': '047', + 'Fentress County, TN': '049', + 'Franklin County, TN': '051', + 'Gibson County, TN': '053', + 'Giles County, TN': '055', + 'Grainger County, TN': '057', + 'Greene County, TN': '059', + 'Grundy County, TN': '061', + 'Hamblen County, TN': '063', + 'Hamilton County, TN': '065', + 'Hancock County, TN': '067', + 'Hardeman County, TN': '069', + 'Hardin County, TN': '071', + 'Hawkins County, TN': '073', + 'Haywood County, TN': '075', + 'Henderson County, TN': '077', + 'Henry County, TN': '079', + 'Hickman County, TN': '081', + 'Houston County, TN': '083', + 'Humphreys County, TN': '085', + 'Jackson County, TN': '087', + 'Jefferson County, TN': '089', + 'Johnson County, TN': '091', + 'Knox County, TN': '093', + 'Lake County, TN': '095', + 'Lauderdale County, TN': '097', + 'Lawrence County, TN': '099', + 'Lewis County, TN': '101', + 'Lincoln County, TN': '103', + 'Loudon County, TN': '105', + 'Macon County, TN': '111', + 'Madison County, TN': '113', + 'Marion County, TN': '115', + 'Marshall County, TN': '117', + 'Maury County, TN': '119', + 'McMinn County, TN': '107', + 'McNairy County, TN': '109', + 'Meigs County, TN': '121', + 'Monroe County, TN': '123', + 'Montgomery County, TN': '125', + 'Moore County, TN': '127', + 'Morgan County, TN': '129', + 'Obion County, TN': '131', + 'Overton County, TN': '133', + 'Perry County, TN': '135', + 'Pickett County, TN': '137', + 'Polk County, TN': '139', + 'Putnam County, TN': '141', + 'Rhea County, TN': '143', + 'Roane County, TN': '145', + 'Robertson County, TN': '147', + 'Rutherford County, TN': '149', + 'Scott County, TN': '151', + 'Sequatchie County, TN': '153', + 'Sevier County, TN': '155', + 'Shelby County, TN': '157', + 'Smith County, TN': '159', + 'Stewart County, TN': '161', + 'Sullivan County, TN': '163', + 'Sumner County, TN': '165', + 'Tipton County, TN': '167', + 'Trousdale County, TN': '169', + 'Unicoi County, TN': '171', + 'Union County, TN': '173', + 'Van Buren County, TN': '175', + 'Warren County, TN': '177', + 'Washington County, TN': '179', + 'Wayne County, TN': '181', + 'Weakley County, TN': '183', + 'White County, TN': '185', + 'Williamson County, TN': '187', + 'Wilson County, TN': '189'}, + 48: {'--All--': '%', + 'Anderson County, TX': '001', + 'Andrews County, TX': '003', + 'Angelina County, TX': '005', + 'Aransas County, TX': '007', + 'Archer County, TX': '009', + 'Armstrong County, TX': '011', + 'Atascosa County, TX': '013', + 'Austin County, TX': '015', + 'Bailey County, TX': '017', + 'Bandera County, TX': '019', + 'Bastrop County, TX': '021', + 'Baylor County, TX': '023', + 'Bee County, TX': '025', + 'Bell County, TX': '027', + 'Bexar County, TX': '029', + 'Blanco County, TX': '031', + 'Borden County, TX': '033', + 'Bosque County, TX': '035', + 'Bowie County, TX': '037', + 'Brazoria County, TX': '039', + 'Brazos County, TX': '041', + 'Brewster County, TX': '043', + 'Briscoe County, TX': '045', + 'Brooks County, TX': '047', + 'Brown County, TX': '049', + 'Burleson County, TX': '051', + 'Burnet County, TX': '053', + 'Caldwell County, TX': '055', + 'Calhoun County, TX': '057', + 'Callahan County, TX': '059', + 'Cameron County, TX': '061', + 'Camp County, TX': '063', + 'Carson County, TX': '065', + 'Cass County, TX': '067', + 'Castro County, TX': '069', + 'Chambers County, TX': '071', + 'Cherokee County, TX': '073', + 'Childress County, TX': '075', + 'Clay County, TX': '077', + 'Cochran County, TX': '079', + 'Coke County, TX': '081', + 'Coleman County, TX': '083', + 'Collin County, TX': '085', + 'Collingsworth County, TX': '087', + 'Colorado County, TX': '089', + 'Comal County, TX': '091', + 'Comanche County, TX': '093', + 'Concho County, TX': '095', + 'Cooke County, TX': '097', + 'Coryell County, TX': '099', + 'Cottle County, TX': '101', + 'Crane County, TX': '103', + 'Crockett County, TX': '105', + 'Crosby County, TX': '107', + 'Culberson County, TX': '109', + 'Dallam County, TX': '111', + 'Dallas County, TX': '113', + 'Dawson County, TX': '115', + 'DeWitt County, TX': '123', + 'Deaf Smith County, TX': '117', + 'Delta County, TX': '119', + 'Denton County, TX': '121', + 'Dickens County, TX': '125', + 'Dimmit County, TX': '127', + 'Donley County, TX': '129', + 'Duval County, TX': '131', + 'Eastland County, TX': '133', + 'Ector County, TX': '135', + 'Edwards County, TX': '137', + 'El Paso County, TX': '141', + 'Ellis County, TX': '139', + 'Erath County, TX': '143', + 'Falls County, TX': '145', + 'Fannin County, TX': '147', + 'Fayette County, TX': '149', + 'Fisher County, TX': '151', + 'Floyd County, TX': '153', + 'Foard County, TX': '155', + 'Fort Bend County, TX': '157', + 'Franklin County, TX': '159', + 'Freestone County, TX': '161', + 'Frio County, TX': '163', + 'Gaines County, TX': '165', + 'Galveston County, TX': '167', + 'Garza County, TX': '169', + 'Gillespie County, TX': '171', + 'Glasscock County, TX': '173', + 'Goliad County, TX': '175', + 'Gonzales County, TX': '177', + 'Gray County, TX': '179', + 'Grayson County, TX': '181', + 'Gregg County, TX': '183', + 'Grimes County, TX': '185', + 'Guadalupe County, TX': '187', + 'Hale County, TX': '189', + 'Hall County, TX': '191', + 'Hamilton County, TX': '193', + 'Hansford County, TX': '195', + 'Hardeman County, TX': '197', + 'Hardin County, TX': '199', + 'Harris County, TX': '201', + 'Harrison County, TX': '203', + 'Hartley County, TX': '205', + 'Haskell County, TX': '207', + 'Hays County, TX': '209', + 'Hemphill County, TX': '211', + 'Henderson County, TX': '213', + 'Hidalgo County, TX': '215', + 'Hill County, TX': '217', + 'Hockley County, TX': '219', + 'Hood County, TX': '221', + 'Hopkins County, TX': '223', + 'Houston County, TX': '225', + 'Howard County, TX': '227', + 'Hudspeth County, TX': '229', + 'Hunt County, TX': '231', + 'Hutchinson County, TX': '233', + 'Irion County, TX': '235', + 'Jack County, TX': '237', + 'Jackson County, TX': '239', + 'Jasper County, TX': '241', + 'Jeff Davis County, TX': '243', + 'Jefferson County, TX': '245', + 'Jim Hogg County, TX': '247', + 'Jim Wells County, TX': '249', + 'Johnson County, TX': '251', + 'Jones County, TX': '253', + 'Karnes County, TX': '255', + 'Kaufman County, TX': '257', + 'Kendall County, TX': '259', + 'Kenedy County, TX': '261', + 'Kent County, TX': '263', + 'Kerr County, TX': '265', + 'Kimble County, TX': '267', + 'King County, TX': '269', + 'Kinney County, TX': '271', + 'Kleberg County, TX': '273', + 'Knox County, TX': '275', + 'La Salle County, TX': '283', + 'Lamar County, TX': '277', + 'Lamb County, TX': '279', + 'Lampasas County, TX': '281', + 'Lavaca County, TX': '285', + 'Lee County, TX': '287', + 'Leon County, TX': '289', + 'Liberty County, TX': '291', + 'Limestone County, TX': '293', + 'Lipscomb County, TX': '295', + 'Live Oak County, TX': '297', + 'Llano County, TX': '299', + 'Loving County, TX': '301', + 'Lubbock County, TX': '303', + 'Lynn County, TX': '305', + 'Madison County, TX': '313', + 'Marion County, TX': '315', + 'Martin County, TX': '317', + 'Mason County, TX': '319', + 'Matagorda County, TX': '321', + 'Maverick County, TX': '323', + 'McCulloch County, TX': '307', + 'McLennan County, TX': '309', + 'McMullen County, TX': '311', + 'Medina County, TX': '325', + 'Menard County, TX': '327', + 'Midland County, TX': '329', + 'Milam County, TX': '331', + 'Mills County, TX': '333', + 'Mitchell County, TX': '335', + 'Montague County, TX': '337', + 'Montgomery County, TX': '339', + 'Moore County, TX': '341', + 'Morris County, TX': '343', + 'Motley County, TX': '345', + 'Nacogdoches County, TX': '347', + 'Navarro County, TX': '349', + 'Newton County, TX': '351', + 'Nolan County, TX': '353', + 'Nueces County, TX': '355', + 'Ochiltree County, TX': '357', + 'Oldham County, TX': '359', + 'Orange County, TX': '361', + 'Palo Pinto County, TX': '363', + 'Panola County, TX': '365', + 'Parker County, TX': '367', + 'Parmer County, TX': '369', + 'Pecos County, TX': '371', + 'Polk County, TX': '373', + 'Potter County, TX': '375', + 'Presidio County, TX': '377', + 'Rains County, TX': '379', + 'Randall County, TX': '381', + 'Reagan County, TX': '383', + 'Real County, TX': '385', + 'Red River County, TX': '387', + 'Reeves County, TX': '389', + 'Refugio County, TX': '391', + 'Roberts County, TX': '393', + 'Robertson County, TX': '395', + 'Rockwall County, TX': '397', + 'Runnels County, TX': '399', + 'Rusk County, TX': '401', + 'Sabine County, TX': '403', + 'San Augustine County, TX': '405', + 'San Jacinto County, TX': '407', + 'San Patricio County, TX': '409', + 'San Saba County, TX': '411', + 'Schleicher County, TX': '413', + 'Scurry County, TX': '415', + 'Shackelford County, TX': '417', + 'Shelby County, TX': '419', + 'Sherman County, TX': '421', + 'Smith County, TX': '423', + 'Somervell County, TX': '425', + 'Starr County, TX': '427', + 'Stephens County, TX': '429', + 'Sterling County, TX': '431', + 'Stonewall County, TX': '433', + 'Sutton County, TX': '435', + 'Swisher County, TX': '437', + 'Tarrant County, TX': '439', + 'Taylor County, TX': '441', + 'Terrell County, TX': '443', + 'Terry County, TX': '445', + 'Throckmorton County, TX': '447', + 'Titus County, TX': '449', + 'Tom Green County, TX': '451', + 'Travis County, TX': '453', + 'Trinity County, TX': '455', + 'Tyler County, TX': '457', + 'Upshur County, TX': '459', + 'Upton County, TX': '461', + 'Uvalde County, TX': '463', + 'Val Verde County, TX': '465', + 'Van Zandt County, TX': '467', + 'Victoria County, TX': '469', + 'Walker County, TX': '471', + 'Waller County, TX': '473', + 'Ward County, TX': '475', + 'Washington County, TX': '477', + 'Webb County, TX': '479', + 'Wharton County, TX': '481', + 'Wheeler County, TX': '483', + 'Wichita County, TX': '485', + 'Wilbarger County, TX': '487', + 'Willacy County, TX': '489', + 'Williamson County, TX': '491', + 'Wilson County, TX': '493', + 'Winkler County, TX': '495', + 'Wise County, TX': '497', + 'Wood County, TX': '499', + 'Yoakum County, TX': '501', + 'Young County, TX': '503', + 'Zapata County, TX': '505', + 'Zavala County, TX': '507'}, + 49: {'--All--': '%', + 'Beaver County, UT': '001', + 'Box Elder County, UT': '003', + 'Cache County, UT': '005', + 'Carbon County, UT': '007', + 'Daggett County, UT': '009', + 'Davis County, UT': '011', + 'Duchesne County, UT': '013', + 'Emery County, UT': '015', + 'Garfield County, UT': '017', + 'Grand County, UT': '019', + 'Iron County, UT': '021', + 'Juab County, UT': '023', + 'Kane County, UT': '025', + 'Millard County, UT': '027', + 'Morgan County, UT': '029', + 'Piute County, UT': '031', + 'Rich County, UT': '033', + 'Salt Lake County, UT': '035', + 'San Juan County, UT': '037', + 'Sanpete County, UT': '039', + 'Sevier County, UT': '041', + 'Summit County, UT': '043', + 'Tooele County, UT': '045', + 'Uintah County, UT': '047', + 'Utah County, UT': '049', + 'Wasatch County, UT': '051', + 'Washington County, UT': '053', + 'Wayne County, UT': '055', + 'Weber County, UT': '057'}, + 50: {'--All--': '%', + 'Addison County, VT': '001', + 'Bennington County, VT': '003', + 'Caledonia County, VT': '005', + 'Chittenden County, VT': '007', + 'Essex County, VT': '009', + 'Franklin County, VT': '011', + 'Grand Isle County, VT': '013', + 'Lamoille County, VT': '015', + 'Orange County, VT': '017', + 'Orleans County, VT': '019', + 'Rutland County, VT': '021', + 'Washington County, VT': '023', + 'Windham County, VT': '025', + 'Windsor County, VT': '027'}, + 51: {'--All--': '%', + 'Accomack County, VA': '001', + 'Albemarle County, VA': '003', + 'Alexandria city, VA': '510', + 'Alleghany County, VA': '005', + 'Amelia County, VA': '007', + 'Amherst County, VA': '009', + 'Appomattox County, VA': '011', + 'Arlington County, VA': '013', + 'Augusta County, VA': '015', + 'Bath County, VA': '017', + 'Bedford County, VA': '019', + 'Bedford city, VA': '515', + 'Bland County, VA': '021', + 'Botetourt County, VA': '023', + 'Bristol city, VA': '520', + 'Brunswick County, VA': '025', + 'Buchanan County, VA': '027', + 'Buckingham County, VA': '029', + 'Buena Vista city, VA': '530', + 'Campbell County, VA': '031', + 'Caroline County, VA': '033', + 'Carroll County, VA': '035', + 'Charles City County, VA': '036', + 'Charlotte County, VA': '037', + 'Charlottesville city, VA': '540', + 'Chesapeake city, VA': '550', + 'Chesterfield County, VA': '041', + 'Clarke County, VA': '043', + 'Colonial Heights city, VA': '570', + 'Covington city, VA': '580', + 'Craig County, VA': '045', + 'Culpeper County, VA': '047', + 'Cumberland County, VA': '049', + 'Danville city, VA': '590', + 'Dickenson County, VA': '051', + 'Dinwiddie County, VA': '053', + 'Emporia city, VA': '595', + 'Essex County, VA': '057', + 'Fairfax County, VA': '059', + 'Fairfax city, VA': '600', + 'Falls Church city, VA': '610', + 'Fauquier County, VA': '061', + 'Floyd County, VA': '063', + 'Fluvanna County, VA': '065', + 'Franklin County, VA': '067', + 'Franklin city, VA': '620', + 'Frederick County, VA': '069', + 'Fredericksburg city, VA': '630', + 'Galax city, VA': '640', + 'Giles County, VA': '071', + 'Gloucester County, VA': '073', + 'Goochland County, VA': '075', + 'Grayson County, VA': '077', + 'Greene County, VA': '079', + 'Greensville County, VA': '081', + 'Halifax County, VA': '083', + 'Hampton city, VA': '650', + 'Hanover County, VA': '085', + 'Harrisonburg city, VA': '660', + 'Henrico County, VA': '087', + 'Henry County, VA': '089', + 'Highland County, VA': '091', + 'Hopewell city, VA': '670', + 'Isle of Wight County, VA': '093', + 'James City County, VA': '095', + 'King George County, VA': '099', + 'King William County, VA': '101', + 'King and Queen County, VA': '097', + 'Lancaster County, VA': '103', + 'Lee County, VA': '105', + 'Lexington city, VA': '678', + 'Loudoun County, VA': '107', + 'Louisa County, VA': '109', + 'Lunenburg County, VA': '111', + 'Lynchburg city, VA': '680', + 'Madison County, VA': '113', + 'Manassas Park city, VA': '685', + 'Manassas city, VA': '683', + 'Martinsville city, VA': '690', + 'Mathews County, VA': '115', + 'Mecklenburg County, VA': '117', + 'Middlesex County, VA': '119', + 'Montgomery County, VA': '121', + 'Nelson County, VA': '125', + 'New Kent County, VA': '127', + 'Newport News city, VA': '700', + 'Norfolk city, VA': '710', + 'Northampton County, VA': '131', + 'Northumberland County, VA': '133', + 'Norton city, VA': '720', + 'Nottoway County, VA': '135', + 'Orange County, VA': '137', + 'Page County, VA': '139', + 'Patrick County, VA': '141', + 'Petersburg city, VA': '730', + 'Pittsylvania County, VA': '143', + 'Poquoson city, VA': '735', + 'Portsmouth city, VA': '740', + 'Powhatan County, VA': '145', + 'Prince Edward County, VA': '147', + 'Prince George County, VA': '149', + 'Prince William County, VA': '153', + 'Pulaski County, VA': '155', + 'Radford city, VA': '750', + 'Rappahannock County, VA': '157', + 'Richmond County, VA': '159', + 'Richmond city, VA': '760', + 'Roanoke County, VA': '161', + 'Roanoke city, VA': '770', + 'Rockbridge County, VA': '163', + 'Rockingham County, VA': '165', + 'Russell County, VA': '167', + 'Salem city, VA': '775', + 'Scott County, VA': '169', + 'Shenandoah County, VA': '171', + 'Smyth County, VA': '173', + 'Southampton County, VA': '175', + 'Spotsylvania County, VA': '177', + 'Stafford County, VA': '179', + 'Staunton city, VA': '790', + 'Suffolk city, VA': '800', + 'Surry County, VA': '181', + 'Sussex County, VA': '183', + 'Tazewell County, VA': '185', + 'Virginia Beach city, VA': '810', + 'Warren County, VA': '187', + 'Washington County, VA': '191', + 'Waynesboro city, VA': '820', + 'Westmoreland County, VA': '193', + 'Williamsburg city, VA': '830', + 'Winchester city, VA': '840', + 'Wise County, VA': '195', + 'Wythe County, VA': '197', + 'York County, VA': '199'}, + 53: {'--All--': '%', + 'Adams County, WA': '001', + 'Asotin County, WA': '003', + 'Benton County, WA': '005', + 'Chelan County, WA': '007', + 'Clallam County, WA': '009', + 'Clark County, WA': '011', + 'Columbia County, WA': '013', + 'Cowlitz County, WA': '015', + 'Douglas County, WA': '017', + 'Ferry County, WA': '019', + 'Franklin County, WA': '021', + 'Garfield County, WA': '023', + 'Grant County, WA': '025', + 'Grays Harbor County, WA': '027', + 'Island County, WA': '029', + 'Jefferson County, WA': '031', + 'King County, WA': '033', + 'Kitsap County, WA': '035', + 'Kittitas County, WA': '037', + 'Klickitat County, WA': '039', + 'Lewis County, WA': '041', + 'Lincoln County, WA': '043', + 'Mason County, WA': '045', + 'Okanogan County, WA': '047', + 'Pacific County, WA': '049', + 'Pend Oreille County, WA': '051', + 'Pierce County, WA': '053', + 'San Juan County, WA': '055', + 'Skagit County, WA': '057', + 'Skamania County, WA': '059', + 'Snohomish County, WA': '061', + 'Spokane County, WA': '063', + 'Stevens County, WA': '065', + 'Thurston County, WA': '067', + 'Wahkiakum County, WA': '069', + 'Walla Walla County, WA': '071', + 'Whatcom County, WA': '073', + 'Whitman County, WA': '075', + 'Yakima County, WA': '077'}, + 54: {'--All--': '%', + 'Barbour County, WV': '001', + 'Berkeley County, WV': '003', + 'Boone County, WV': '005', + 'Braxton County, WV': '007', + 'Brooke County, WV': '009', + 'Cabell County, WV': '011', + 'Calhoun County, WV': '013', + 'Clay County, WV': '015', + 'Doddridge County, WV': '017', + 'Fayette County, WV': '019', + 'Gilmer County, WV': '021', + 'Grant County, WV': '023', + 'Greenbrier County, WV': '025', + 'Hampshire County, WV': '027', + 'Hancock County, WV': '029', + 'Hardy County, WV': '031', + 'Harrison County, WV': '033', + 'Jackson County, WV': '035', + 'Jefferson County, WV': '037', + 'Kanawha County, WV': '039', + 'Lewis County, WV': '041', + 'Lincoln County, WV': '043', + 'Logan County, WV': '045', + 'Marion County, WV': '049', + 'Marshall County, WV': '051', + 'Mason County, WV': '053', + 'McDowell County, WV': '047', + 'Mercer County, WV': '055', + 'Mineral County, WV': '057', + 'Mingo County, WV': '059', + 'Monongalia County, WV': '061', + 'Monroe County, WV': '063', + 'Morgan County, WV': '065', + 'Nicholas County, WV': '067', + 'Ohio County, WV': '069', + 'Pendleton County, WV': '071', + 'Pleasants County, WV': '073', + 'Pocahontas County, WV': '075', + 'Preston County, WV': '077', + 'Putnam County, WV': '079', + 'Raleigh County, WV': '081', + 'Randolph County, WV': '083', + 'Ritchie County, WV': '085', + 'Roane County, WV': '087', + 'Summers County, WV': '089', + 'Taylor County, WV': '091', + 'Tucker County, WV': '093', + 'Tyler County, WV': '095', + 'Upshur County, WV': '097', + 'Wayne County, WV': '099', + 'Webster County, WV': '101', + 'Wetzel County, WV': '103', + 'Wirt County, WV': '105', + 'Wood County, WV': '107', + 'Wyoming County, WV': '109'}, + 55: {'--All--': '%', + 'Adams County, WI': '001', + 'Ashland County, WI': '003', + 'Barron County, WI': '005', + 'Bayfield County, WI': '007', + 'Brown County, WI': '009', + 'Buffalo County, WI': '011', + 'Burnett County, WI': '013', + 'Calumet County, WI': '015', + 'Chippewa County, WI': '017', + 'Clark County, WI': '019', + 'Columbia County, WI': '021', + 'Crawford County, WI': '023', + 'Dane County, WI': '025', + 'Dodge County, WI': '027', + 'Door County, WI': '029', + 'Douglas County, WI': '031', + 'Dunn County, WI': '033', + 'Eau Claire County, WI': '035', + 'Florence County, WI': '037', + 'Fond du Lac County, WI': '039', + 'Forest County, WI': '041', + 'Grant County, WI': '043', + 'Green County, WI': '045', + 'Green Lake County, WI': '047', + 'Iowa County, WI': '049', + 'Iron County, WI': '051', + 'Jackson County, WI': '053', + 'Jefferson County, WI': '055', + 'Juneau County, WI': '057', + 'Kenosha County, WI': '059', + 'Kewaunee County, WI': '061', + 'La Crosse County, WI': '063', + 'Lafayette County, WI': '065', + 'Langlade County, WI': '067', + 'Lincoln County, WI': '069', + 'Manitowoc County, WI': '071', + 'Marathon County, WI': '073', + 'Marinette County, WI': '075', + 'Marquette County, WI': '077', + 'Menominee County, WI': '078', + 'Milwaukee County, WI': '079', + 'Monroe County, WI': '081', + 'Oconto County, WI': '083', + 'Oneida County, WI': '085', + 'Outagamie County, WI': '087', + 'Ozaukee County, WI': '089', + 'Pepin County, WI': '091', + 'Pierce County, WI': '093', + 'Polk County, WI': '095', + 'Portage County, WI': '097', + 'Price County, WI': '099', + 'Racine County, WI': '101', + 'Richland County, WI': '103', + 'Rock County, WI': '105', + 'Rusk County, WI': '107', + 'Sauk County, WI': '111', + 'Sawyer County, WI': '113', + 'Shawano County, WI': '115', + 'Sheboygan County, WI': '117', + 'St. Croix County, WI': '109', + 'Taylor County, WI': '119', + 'Trempealeau County, WI': '121', + 'Vernon County, WI': '123', + 'Vilas County, WI': '125', + 'Walworth County, WI': '127', + 'Washburn County, WI': '129', + 'Washington County, WI': '131', + 'Waukesha County, WI': '133', + 'Waupaca County, WI': '135', + 'Waushara County, WI': '137', + 'Winnebago County, WI': '139', + 'Wood County, WI': '141'}, + 56: {'--All--': '%', + 'Albany County, WY': '001', + 'Big Horn County, WY': '003', + 'Campbell County, WY': '005', + 'Carbon County, WY': '007', + 'Converse County, WY': '009', + 'Crook County, WY': '011', + 'Fremont County, WY': '013', + 'Goshen County, WY': '015', + 'Hot Springs County, WY': '017', + 'Johnson County, WY': '019', + 'Laramie County, WY': '021', + 'Lincoln County, WY': '023', + 'Natrona County, WY': '025', + 'Niobrara County, WY': '027', + 'Park County, WY': '029', + 'Platte County, WY': '031', + 'Sheridan County, WY': '033', + 'Sublette County, WY': '035', + 'Sweetwater County, WY': '037', + 'Teton County, WY': '039', + 'Uinta County, WY': '041', + 'Washakie County, WY': '043', + 'Weston County, WY': '045'}, + 72: {'--All--': '%', + 'Adjuntas Municipio, PR': '001', + 'Aguada Municipio, PR': '003', + 'Aguadilla Municipio, PR': '005', + 'Aguas Buenas Municipio, PR': '007', + 'Aibonito Municipio, PR': '009', + 'Anasco Municipio, PR': '011', + 'Arecibo Municipio, PR': '013', + 'Arroyo Municipio, PR': '015', + 'Barceloneta Municipio, PR': '017', + 'Barranquitas Municipio, PR': '019', + 'Bayamon Municipio, PR': '021', + 'Cabo Rojo Municipio, PR': '023', + 'Caguas Municipio, PR': '025', + 'Camuy Municipio, PR': '027', + 'Canovanas Municipio, PR': '029', + 'Carolina Municipio, PR': '031', + 'Catano Municipio, PR': '033', + 'Cayey Municipio, PR': '035', + 'Ceiba Municipio, PR': '037', + 'Ciales Municipio, PR': '039', + 'Cidra Municipio, PR': '041', + 'Coamo Municipio, PR': '043', + 'Comerio Municipio, PR': '045', + 'Corozal Municipio, PR': '047', + 'Culebra Municipio, PR': '049', + 'Dorado Municipio, PR': '051', + 'Fajardo Municipio, PR': '053', + 'Florida Municipio, PR': '054', + 'Guanica Municipio, PR': '055', + 'Guayama Municipio, PR': '057', + 'Guayanilla Municipio, PR': '059', + 'Guaynabo Municipio, PR': '061', + 'Gurabo Municipio, PR': '063', + 'Hatillo Municipio, PR': '065', + 'Hormigueros Municipio, PR': '067', + 'Humacao Municipio, PR': '069', + 'Isabela Municipio, PR': '071', + 'Jayuya Municipio, PR': '073', + 'Juana Diaz Municipio, PR': '075', + 'Juncos Municipio, PR': '077', + 'Lajas Municipio, PR': '079', + 'Lares Municipio, PR': '081', + 'Las Marias Municipio, PR': '083', + 'Las Piedras Municipio, PR': '085', + 'Loiza Municipio, PR': '087', + 'Luquillo Municipio, PR': '089', + 'Manati Municipio, PR': '091', + 'Maricao Municipio, PR': '093', + 'Maunabo Municipio, PR': '095', + 'Mayaguez Municipio, PR': '097', + 'Moca Municipio, PR': '099', + 'Morovis Municipio, PR': '101', + 'Naguabo Municipio, PR': '103', + 'Naranjito Municipio, PR': '105', + 'Orocovis Municipio, PR': '107', + 'Patillas Municipio, PR': '109', + 'Penuelas Municipio, PR': '111', + 'Ponce Municipio, PR': '113', + 'Quebradillas Municipio, PR': '115', + 'Rincon Municipio, PR': '117', + 'Rio Grande Municipio, PR': '119', + 'Sabana Grande Municipio, PR': '121', + 'Salinas Municipio, PR': '123', + 'San German Municipio, PR': '125', + 'San Juan Municipio, PR': '127', + 'San Lorenzo Municipio, PR': '129', + 'San Sebastian Municipio, PR': '131', + 'Santa Isabel Municipio, PR': '133', + 'Toa Alta Municipio, PR': '135', + 'Toa Baja Municipio, PR': '137', + 'Trujillo Alto Municipio, PR': '139', + 'Utuado Municipio, PR': '141', + 'Vega Alta Municipio, PR': '143', + 'Vega Baja Municipio, PR': '145', + 'Vieques Municipio, PR': '147', + 'Villalba Municipio, PR': '149', + 'Yabucoa Municipio, PR': '151', + 'Yauco Municipio, PR': '153'}, + '01': {'Autauga County, AL': '001', + 'Baldwin County, AL': '003', + 'Barbour County, AL': '005', + 'Bibb County, AL': '007', + 'Blount County, AL': '009', + 'Bullock County, AL': '011', + 'Butler County, AL': '013', + 'Calhoun County, AL': '015', + 'Chambers County, AL': '017', + 'Cherokee County, AL': '019', + 'Chilton County, AL': '021', + 'Choctaw County, AL': '023', + 'Clarke County, AL': '025', + 'Clay County, AL': '027', + 'Cleburne County, AL': '029', + 'Coffee County, AL': '031', + 'Colbert County, AL': '033', + 'Conecuh County, AL': '035', + 'Coosa County, AL': '037', + 'Covington County, AL': '039', + 'Crenshaw County, AL': '041', + 'Cullman County, AL': '043', + 'Dale County, AL': '045', + 'Dallas County, AL': '047', + 'DeKalb County, AL': '049', + 'Elmore County, AL': '051', + 'Escambia County, AL': '053', + 'Etowah County, AL': '055', + 'Fayette County, AL': '057', + 'Franklin County, AL': '059', + 'Geneva County, AL': '061', + 'Greene County, AL': '063', + 'Hale County, AL': '065', + 'Henry County, AL': '067', + 'Houston County, AL': '069', + 'Jackson County, AL': '071', + 'Jefferson County, AL': '073', + 'Lamar County, AL': '075', + 'Lauderdale County, AL': '077', + 'Lawrence County, AL': '079', + 'Lee County, AL': '081', + 'Limestone County, AL': '083', + 'Lowndes County, AL': '085', + 'Macon County, AL': '087', + 'Madison County, AL': '089', + 'Marengo County, AL': '091', + 'Marion County, AL': '093', + 'Marshall County, AL': '095', + 'Mobile County, AL': '097', + 'Monroe County, AL': '099', + 'Montgomery County, AL': '101', + 'Morgan County, AL': '103', + 'Perry County, AL': '105', + 'Pickens County, AL': '107', + 'Pike County, AL': '109', + 'Randolph County, AL': '111', + 'Russell County, AL': '113', + 'Shelby County, AL': '117', + 'St. Clair County, AL': '115', + 'Sumter County, AL': '119', + 'Talladega County, AL': '121', + 'Tallapoosa County, AL': '123', + 'Tuscaloosa County, AL': '125', + 'Walker County, AL': '127', + 'Washington County, AL': '129', + 'Wilcox County, AL': '131', + 'Winston County, AL': '133'}, + '02': {'Aleutians East Borough, AK': '013', + 'Aleutians West Census Area, AK': '016', + 'Anchorage Borough/municipality, AK': '020', + 'Bethel Census Area, AK': '050', + 'Bristol Bay Borough, AK': '060', + 'Denali Borough, AK': '068', + 'Dillingham Census Area, AK': '070', + 'Fairbanks North Star Borough, AK': '090', + 'Haines Borough, AK': '100', + 'Juneau Borough/city, AK': '110', + 'Kenai Peninsula Borough, AK': '122', + 'Ketchikan Gateway Borough, AK': '130', + 'Kodiak Island Borough, AK': '150', + 'Lake and Peninsula Borough, AK': '164', + 'Matanuska-Susitna Borough, AK': '170', + 'Nome Census Area, AK': '180', + 'North Slope Borough, AK': '185', + 'Northwest Arctic Borough, AK': '188', + 'Prince of Wales-Outer Ketchikan Census Area, AK': '201', + 'Sitka Borough/city, AK': '220', + 'Skagway-Hoonah-Angoon Census Area, AK': '232', + 'Southeast Fairbanks Census Area, AK': '240', + 'Valdez-Cordova Census Area, AK': '261', + 'Wade Hampton Census Area, AK': '270', + 'Wrangell-Petersburg Census Area, AK': '280', + 'Yakutat Borough, AK': '282', + 'Yukon-Koyukuk Census Area, AK': '290'}, + '04': {'Apache County, AZ': '001', + 'Cochise County, AZ': '003', + 'Coconino County, AZ': '005', + 'Gila County, AZ': '007', + 'Graham County, AZ': '009', + 'Greenlee County, AZ': '011', + 'La Paz County, AZ': '012', + 'Maricopa County, AZ': '013', + 'Mohave County, AZ': '015', + 'Navajo County, AZ': '017', + 'Pima County, AZ': '019', + 'Pinal County, AZ': '021', + 'Santa Cruz County, AZ': '023', + 'Yavapai County, AZ': '025', + 'Yuma County, AZ': '027'}, + '05': {'Arkansas County, AR': '001', + 'Ashley County, AR': '003', + 'Baxter County, AR': '005', + 'Benton County, AR': '007', + 'Boone County, AR': '009', + 'Bradley County, AR': '011', + 'Calhoun County, AR': '013', + 'Carroll County, AR': '015', + 'Chicot County, AR': '017', + 'Clark County, AR': '019', + 'Clay County, AR': '021', + 'Cleburne County, AR': '023', + 'Cleveland County, AR': '025', + 'Columbia County, AR': '027', + 'Conway County, AR': '029', + 'Craighead County, AR': '031', + 'Crawford County, AR': '033', + 'Crittenden County, AR': '035', + 'Cross County, AR': '037', + 'Dallas County, AR': '039', + 'Desha County, AR': '041', + 'Drew County, AR': '043', + 'Faulkner County, AR': '045', + 'Franklin County, AR': '047', + 'Fulton County, AR': '049', + 'Garland County, AR': '051', + 'Grant County, AR': '053', + 'Greene County, AR': '055', + 'Hempstead County, AR': '057', + 'Hot Spring County, AR': '059', + 'Howard County, AR': '061', + 'Independence County, AR': '063', + 'Izard County, AR': '065', + 'Jackson County, AR': '067', + 'Jefferson County, AR': '069', + 'Johnson County, AR': '071', + 'Lafayette County, AR': '073', + 'Lawrence County, AR': '075', + 'Lee County, AR': '077', + 'Lincoln County, AR': '079', + 'Little River County, AR': '081', + 'Logan County, AR': '083', + 'Lonoke County, AR': '085', + 'Madison County, AR': '087', + 'Marion County, AR': '089', + 'Miller County, AR': '091', + 'Mississippi County, AR': '093', + 'Monroe County, AR': '095', + 'Montgomery County, AR': '097', + 'Nevada County, AR': '099', + 'Newton County, AR': '101', + 'Ouachita County, AR': '103', + 'Perry County, AR': '105', + 'Phillips County, AR': '107', + 'Pike County, AR': '109', + 'Poinsett County, AR': '111', + 'Polk County, AR': '113', + 'Pope County, AR': '115', + 'Prairie County, AR': '117', + 'Pulaski County, AR': '119', + 'Randolph County, AR': '121', + 'Saline County, AR': '125', + 'Scott County, AR': '127', + 'Searcy County, AR': '129', + 'Sebastian County, AR': '131', + 'Sevier County, AR': '133', + 'Sharp County, AR': '135', + 'St. Francis County, AR': '123', + 'Stone County, AR': '137', + 'Union County, AR': '139', + 'Van Buren County, AR': '141', + 'Washington County, AR': '143', + 'White County, AR': '145', + 'Woodruff County, AR': '147', + 'Yell County, AR': '149'}, + '06': {'Alameda County, CA': '001', + 'Alpine County, CA': '003', + 'Amador County, CA': '005', + 'Butte County, CA': '007', + 'Calaveras County, CA': '009', + 'Colusa County, CA': '011', + 'Contra Costa County, CA': '013', + 'Del Norte County, CA': '015', + 'El Dorado County, CA': '017', + 'Fresno County, CA': '019', + 'Glenn County, CA': '021', + 'Humboldt County, CA': '023', + 'Imperial County, CA': '025', + 'Inyo County, CA': '027', + 'Kern County, CA': '029', + 'Kings County, CA': '031', + 'Lake County, CA': '033', + 'Lassen County, CA': '035', + 'Los Angeles County, CA': '037', + 'Madera County, CA': '039', + 'Marin County, CA': '041', + 'Mariposa County, CA': '043', + 'Mendocino County, CA': '045', + 'Merced County, CA': '047', + 'Modoc County, CA': '049', + 'Mono County, CA': '051', + 'Monterey County, CA': '053', + 'Napa County, CA': '055', + 'Nevada County, CA': '057', + 'Orange County, CA': '059', + 'Placer County, CA': '061', + 'Plumas County, CA': '063', + 'Riverside County, CA': '065', + 'Sacramento County, CA': '067', + 'San Benito County, CA': '069', + 'San Bernardino County, CA': '071', + 'San Diego County, CA': '073', + 'San Francisco County/city, CA': '075', + 'San Joaquin County, CA': '077', + 'San Luis Obispo County, CA': '079', + 'San Mateo County, CA': '081', + 'Santa Barbara County, CA': '083', + 'Santa Clara County, CA': '085', + 'Santa Cruz County, CA': '087', + 'Shasta County, CA': '089', + 'Sierra County, CA': '091', + 'Siskiyou County, CA': '093', + 'Solano County, CA': '095', + 'Sonoma County, CA': '097', + 'Stanislaus County, CA': '099', + 'Sutter County, CA': '101', + 'Tehama County, CA': '103', + 'Trinity County, CA': '105', + 'Tulare County, CA': '107', + 'Tuolumne County, CA': '109', + 'Ventura County, CA': '111', + 'Yolo County, CA': '113', + 'Yuba County, CA': '115'}, + '08': {'Adams County, CO': '001', + 'Alamosa County, CO': '003', + 'Arapahoe County, CO': '005', + 'Archuleta County, CO': '007', + 'Baca County, CO': '009', + 'Bent County, CO': '011', + 'Boulder County, CO': '013', + 'Broomfield County/city, CO': '014', + 'Chaffee County, CO': '015', + 'Cheyenne County, CO': '017', + 'Clear Creek County, CO': '019', + 'Conejos County, CO': '021', + 'Costilla County, CO': '023', + 'Crowley County, CO': '025', + 'Custer County, CO': '027', + 'Delta County, CO': '029', + 'Denver County/city, CO': '031', + 'Dolores County, CO': '033', + 'Douglas County, CO': '035', + 'Eagle County, CO': '037', + 'El Paso County, CO': '041', + 'Elbert County, CO': '039', + 'Fremont County, CO': '043', + 'Garfield County, CO': '045', + 'Gilpin County, CO': '047', + 'Grand County, CO': '049', + 'Gunnison County, CO': '051', + 'Hinsdale County, CO': '053', + 'Huerfano County, CO': '055', + 'Jackson County, CO': '057', + 'Jefferson County, CO': '059', + 'Kiowa County, CO': '061', + 'Kit Carson County, CO': '063', + 'La Plata County, CO': '067', + 'Lake County, CO': '065', + 'Larimer County, CO': '069', + 'Las Animas County, CO': '071', + 'Lincoln County, CO': '073', + 'Logan County, CO': '075', + 'Mesa County, CO': '077', + 'Mineral County, CO': '079', + 'Moffat County, CO': '081', + 'Montezuma County, CO': '083', + 'Montrose County, CO': '085', + 'Morgan County, CO': '087', + 'Otero County, CO': '089', + 'Ouray County, CO': '091', + 'Park County, CO': '093', + 'Phillips County, CO': '095', + 'Pitkin County, CO': '097', + 'Prowers County, CO': '099', + 'Pueblo County, CO': '101', + 'Rio Blanco County, CO': '103', + 'Rio Grande County, CO': '105', + 'Routt County, CO': '107', + 'Saguache County, CO': '109', + 'San Juan County, CO': '111', + 'San Miguel County, CO': '113', + 'Sedgwick County, CO': '115', + 'Summit County, CO': '117', + 'Teller County, CO': '119', + 'Washington County, CO': '121', + 'Weld County, CO': '123', + 'Yuma County, CO': '125'}, + '09': {'Fairfield County, CT': '001', + 'Hartford County, CT': '003', + 'Litchfield County, CT': '005', + 'Middlesex County, CT': '007', + 'New Haven County, CT': '009', + 'New London County, CT': '011', + 'Tolland County, CT': '013', + 'Windham County, CT': '015'}, + '10': {'Kent County, DE': '001', + 'New Castle County, DE': '003', + 'Sussex County, DE': '005'}, + '11': {'District of Columbia': '001'}, + '12': {'Alachua County, FL': '001', + 'Baker County, FL': '003', + 'Bay County, FL': '005', + 'Bradford County, FL': '007', + 'Brevard County, FL': '009', + 'Broward County, FL': '011', + 'Calhoun County, FL': '013', + 'Charlotte County, FL': '015', + 'Citrus County, FL': '017', + 'Clay County, FL': '019', + 'Collier County, FL': '021', + 'Columbia County, FL': '023', + 'DeSoto County, FL': '027', + 'Dixie County, FL': '029', + 'Duval County, FL': '031', + 'Escambia County, FL': '033', + 'Flagler County, FL': '035', + 'Franklin County, FL': '037', + 'Gadsden County, FL': '039', + 'Gilchrist County, FL': '041', + 'Glades County, FL': '043', + 'Gulf County, FL': '045', + 'Hamilton County, FL': '047', + 'Hardee County, FL': '049', + 'Hendry County, FL': '051', + 'Hernando County, FL': '053', + 'Highlands County, FL': '055', + 'Hillsborough County, FL': '057', + 'Holmes County, FL': '059', + 'Indian River County, FL': '061', + 'Jackson County, FL': '063', + 'Jefferson County, FL': '065', + 'Lafayette County, FL': '067', + 'Lake County, FL': '069', + 'Lee County, FL': '071', + 'Leon County, FL': '073', + 'Levy County, FL': '075', + 'Liberty County, FL': '077', + 'Madison County, FL': '079', + 'Manatee County, FL': '081', + 'Marion County, FL': '083', + 'Martin County, FL': '085', + 'Miami-Dade County, FL': '086', + 'Monroe County, FL': '087', + 'Nassau County, FL': '089', + 'Okaloosa County, FL': '091', + 'Okeechobee County, FL': '093', + 'Orange County, FL': '095', + 'Osceola County, FL': '097', + 'Palm Beach County, FL': '099', + 'Pasco County, FL': '101', + 'Pinellas County, FL': '103', + 'Polk County, FL': '105', + 'Putnam County, FL': '107', + 'Santa Rosa County, FL': '113', + 'Sarasota County, FL': '115', + 'Seminole County, FL': '117', + 'St. Johns County, FL': '109', + 'St. Lucie County, FL': '111', + 'Sumter County, FL': '119', + 'Suwannee County, FL': '121', + 'Taylor County, FL': '123', + 'Union County, FL': '125', + 'Volusia County, FL': '127', + 'Wakulla County, FL': '129', + 'Walton County, FL': '131', + 'Washington County, FL': '133'}, + '13': {'Appling County, GA': '001', + 'Atkinson County, GA': '003', + 'Bacon County, GA': '005', + 'Baker County, GA': '007', + 'Baldwin County, GA': '009', + 'Banks County, GA': '011', + 'Barrow County, GA': '013', + 'Bartow County, GA': '015', + 'Ben Hill County, GA': '017', + 'Berrien County, GA': '019', + 'Bibb County, GA': '021', + 'Bleckley County, GA': '023', + 'Brantley County, GA': '025', + 'Brooks County, GA': '027', + 'Bryan County, GA': '029', + 'Bulloch County, GA': '031', + 'Burke County, GA': '033', + 'Butts County, GA': '035', + 'Calhoun County, GA': '037', + 'Camden County, GA': '039', + 'Candler County, GA': '043', + 'Carroll County, GA': '045', + 'Catoosa County, GA': '047', + 'Charlton County, GA': '049', + 'Chatham County, GA': '051', + 'Chattahoochee County, GA': '053', + 'Chattooga County, GA': '055', + 'Cherokee County, GA': '057', + 'Clarke County, GA': '059', + 'Clay County, GA': '061', + 'Clayton County, GA': '063', + 'Clinch County, GA': '065', + 'Cobb County, GA': '067', + 'Coffee County, GA': '069', + 'Colquitt County, GA': '071', + 'Columbia County, GA': '073', + 'Cook County, GA': '075', + 'Coweta County, GA': '077', + 'Crawford County, GA': '079', + 'Crisp County, GA': '081', + 'Dade County, GA': '083', + 'Dawson County, GA': '085', + 'DeKalb County, GA': '089', + 'Decatur County, GA': '087', + 'Dodge County, GA': '091', + 'Dooly County, GA': '093', + 'Dougherty County, GA': '095', + 'Douglas County, GA': '097', + 'Early County, GA': '099', + 'Echols County, GA': '101', + 'Effingham County, GA': '103', + 'Elbert County, GA': '105', + 'Emanuel County, GA': '107', + 'Evans County, GA': '109', + 'Fannin County, GA': '111', + 'Fayette County, GA': '113', + 'Floyd County, GA': '115', + 'Forsyth County, GA': '117', + 'Franklin County, GA': '119', + 'Fulton County, GA': '121', + 'Gilmer County, GA': '123', + 'Glascock County, GA': '125', + 'Glynn County, GA': '127', + 'Gordon County, GA': '129', + 'Grady County, GA': '131', + 'Greene County, GA': '133', + 'Gwinnett County, GA': '135', + 'Habersham County, GA': '137', + 'Hall County, GA': '139', + 'Hancock County, GA': '141', + 'Haralson County, GA': '143', + 'Harris County, GA': '145', + 'Hart County, GA': '147', + 'Heard County, GA': '149', + 'Henry County, GA': '151', + 'Houston County, GA': '153', + 'Irwin County, GA': '155', + 'Jackson County, GA': '157', + 'Jasper County, GA': '159', + 'Jeff Davis County, GA': '161', + 'Jefferson County, GA': '163', + 'Jenkins County, GA': '165', + 'Johnson County, GA': '167', + 'Jones County, GA': '169', + 'Lamar County, GA': '171', + 'Lanier County, GA': '173', + 'Laurens County, GA': '175', + 'Lee County, GA': '177', + 'Liberty County, GA': '179', + 'Lincoln County, GA': '181', + 'Long County, GA': '183', + 'Lowndes County, GA': '185', + 'Lumpkin County, GA': '187', + 'Macon County, GA': '193', + 'Madison County, GA': '195', + 'Marion County, GA': '197', + 'McDuffie County, GA': '189', + 'McIntosh County, GA': '191', + 'Meriwether County, GA': '199', + 'Miller County, GA': '201', + 'Mitchell County, GA': '205', + 'Monroe County, GA': '207', + 'Montgomery County, GA': '209', + 'Morgan County, GA': '211', + 'Murray County, GA': '213', + 'Muscogee County, GA': '215', + 'Newton County, GA': '217', + 'Oconee County, GA': '219', + 'Oglethorpe County, GA': '221', + 'Paulding County, GA': '223', + 'Peach County, GA': '225', + 'Pickens County, GA': '227', + 'Pierce County, GA': '229', + 'Pike County, GA': '231', + 'Polk County, GA': '233', + 'Pulaski County, GA': '235', + 'Putnam County, GA': '237', + 'Quitman County, GA': '239', + 'Rabun County, GA': '241', + 'Randolph County, GA': '243', + 'Richmond County, GA': '245', + 'Rockdale County, GA': '247', + 'Schley County, GA': '249', + 'Screven County, GA': '251', + 'Seminole County, GA': '253', + 'Spalding County, GA': '255', + 'Stephens County, GA': '257', + 'Stewart County, GA': '259', + 'Sumter County, GA': '261', + 'Talbot County, GA': '263', + 'Taliaferro County, GA': '265', + 'Tattnall County, GA': '267', + 'Taylor County, GA': '269', + 'Telfair County, GA': '271', + 'Terrell County, GA': '273', + 'Thomas County, GA': '275', + 'Tift County, GA': '277', + 'Toombs County, GA': '279', + 'Towns County, GA': '281', + 'Treutlen County, GA': '283', + 'Troup County, GA': '285', + 'Turner County, GA': '287', + 'Twiggs County, GA': '289', + 'Union County, GA': '291', + 'Upson County, GA': '293', + 'Walker County, GA': '295', + 'Walton County, GA': '297', + 'Ware County, GA': '299', + 'Warren County, GA': '301', + 'Washington County, GA': '303', + 'Wayne County, GA': '305', + 'Webster County, GA': '307', + 'Wheeler County, GA': '309', + 'White County, GA': '311', + 'Whitfield County, GA': '313', + 'Wilcox County, GA': '315', + 'Wilkes County, GA': '317', + 'Wilkinson County, GA': '319', + 'Worth County, GA': '321'}, + '15': {'Hawaii County, HI': '001', + 'Honolulu County/city, HI': '003', + 'Kauai County, HI': '007', + 'Maui County, HI': '009'}, + '16': {'Ada County, ID': '001', + 'Adams County, ID': '003', + 'Bannock County, ID': '005', + 'Bear Lake County, ID': '007', + 'Benewah County, ID': '009', + 'Bingham County, ID': '011', + 'Blaine County, ID': '013', + 'Boise County, ID': '015', + 'Bonner County, ID': '017', + 'Bonneville County, ID': '019', + 'Boundary County, ID': '021', + 'Butte County, ID': '023', + 'Camas County, ID': '025', + 'Canyon County, ID': '027', + 'Caribou County, ID': '029', + 'Cassia County, ID': '031', + 'Clark County, ID': '033', + 'Clearwater County, ID': '035', + 'Custer County, ID': '037', + 'Elmore County, ID': '039', + 'Franklin County, ID': '041', + 'Fremont County, ID': '043', + 'Gem County, ID': '045', + 'Gooding County, ID': '047', + 'Idaho County, ID': '049', + 'Jefferson County, ID': '051', + 'Jerome County, ID': '053', + 'Kootenai County, ID': '055', + 'Latah County, ID': '057', + 'Lemhi County, ID': '059', + 'Lewis County, ID': '061', + 'Lincoln County, ID': '063', + 'Madison County, ID': '065', + 'Minidoka County, ID': '067', + 'Nez Perce County, ID': '069', + 'Oneida County, ID': '071', + 'Owyhee County, ID': '073', + 'Payette County, ID': '075', + 'Power County, ID': '077', + 'Shoshone County, ID': '079', + 'Teton County, ID': '081', + 'Twin Falls County, ID': '083', + 'Valley County, ID': '085', + 'Washington County, ID': '087'}, + '17': {'Adams County, IL': '001', + 'Alexander County, IL': '003', + 'Bond County, IL': '005', + 'Boone County, IL': '007', + 'Brown County, IL': '009', + 'Bureau County, IL': '011', + 'Calhoun County, IL': '013', + 'Carroll County, IL': '015', + 'Cass County, IL': '017', + 'Champaign County, IL': '019', + 'Christian County, IL': '021', + 'Clark County, IL': '023', + 'Clay County, IL': '025', + 'Clinton County, IL': '027', + 'Coles County, IL': '029', + 'Cook County, IL': '031', + 'Crawford County, IL': '033', + 'Cumberland County, IL': '035', + 'De Witt County, IL': '039', + 'DeKalb County, IL': '037', + 'Douglas County, IL': '041', + 'DuPage County, IL': '043', + 'Edgar County, IL': '045', + 'Edwards County, IL': '047', + 'Effingham County, IL': '049', + 'Fayette County, IL': '051', + 'Ford County, IL': '053', + 'Franklin County, IL': '055', + 'Fulton County, IL': '057', + 'Gallatin County, IL': '059', + 'Greene County, IL': '061', + 'Grundy County, IL': '063', + 'Hamilton County, IL': '065', + 'Hancock County, IL': '067', + 'Hardin County, IL': '069', + 'Henderson County, IL': '071', + 'Henry County, IL': '073', + 'Iroquois County, IL': '075', + 'Jackson County, IL': '077', + 'Jasper County, IL': '079', + 'Jefferson County, IL': '081', + 'Jersey County, IL': '083', + 'Jo Daviess County, IL': '085', + 'Johnson County, IL': '087', + 'Kane County, IL': '089', + 'Kankakee County, IL': '091', + 'Kendall County, IL': '093', + 'Knox County, IL': '095', + 'La Salle County, IL': '099', + 'Lake County, IL': '097', + 'Lawrence County, IL': '101', + 'Lee County, IL': '103', + 'Livingston County, IL': '105', + 'Logan County, IL': '107', + 'Macon County, IL': '115', + 'Macoupin County, IL': '117', + 'Madison County, IL': '119', + 'Marion County, IL': '121', + 'Marshall County, IL': '123', + 'Mason County, IL': '125', + 'Massac County, IL': '127', + 'McDonough County, IL': '109', + 'McHenry County, IL': '111', + 'McLean County, IL': '113', + 'Menard County, IL': '129', + 'Mercer County, IL': '131', + 'Monroe County, IL': '133', + 'Montgomery County, IL': '135', + 'Morgan County, IL': '137', + 'Moultrie County, IL': '139', + 'Ogle County, IL': '141', + 'Peoria County, IL': '143', + 'Perry County, IL': '145', + 'Piatt County, IL': '147', + 'Pike County, IL': '149', + 'Pope County, IL': '151', + 'Pulaski County, IL': '153', + 'Putnam County, IL': '155', + 'Randolph County, IL': '157', + 'Richland County, IL': '159', + 'Rock Island County, IL': '161', + 'Saline County, IL': '165', + 'Sangamon County, IL': '167', + 'Schuyler County, IL': '169', + 'Scott County, IL': '171', + 'Shelby County, IL': '173', + 'St. Clair County, IL': '163', + 'Stark County, IL': '175', + 'Stephenson County, IL': '177', + 'Tazewell County, IL': '179', + 'Union County, IL': '181', + 'Vermilion County, IL': '183', + 'Wabash County, IL': '185', + 'Warren County, IL': '187', + 'Washington County, IL': '189', + 'Wayne County, IL': '191', + 'White County, IL': '193', + 'Whiteside County, IL': '195', + 'Will County, IL': '197', + 'Williamson County, IL': '199', + 'Winnebago County, IL': '201', + 'Woodford County, IL': '203'}, + '18': {'Adams County, IN': '001', + 'Allen County, IN': '003', + 'Bartholomew County, IN': '005', + 'Benton County, IN': '007', + 'Blackford County, IN': '009', + 'Boone County, IN': '011', + 'Brown County, IN': '013', + 'Carroll County, IN': '015', + 'Cass County, IN': '017', + 'Clark County, IN': '019', + 'Clay County, IN': '021', + 'Clinton County, IN': '023', + 'Crawford County, IN': '025', + 'Daviess County, IN': '027', + 'DeKalb County, IN': '033', + 'Dearborn County, IN': '029', + 'Decatur County, IN': '031', + 'Delaware County, IN': '035', + 'Dubois County, IN': '037', + 'Elkhart County, IN': '039', + 'Fayette County, IN': '041', + 'Floyd County, IN': '043', + 'Fountain County, IN': '045', + 'Franklin County, IN': '047', + 'Fulton County, IN': '049', + 'Gibson County, IN': '051', + 'Grant County, IN': '053', + 'Greene County, IN': '055', + 'Hamilton County, IN': '057', + 'Hancock County, IN': '059', + 'Harrison County, IN': '061', + 'Hendricks County, IN': '063', + 'Henry County, IN': '065', + 'Howard County, IN': '067', + 'Huntington County, IN': '069', + 'Jackson County, IN': '071', + 'Jasper County, IN': '073', + 'Jay County, IN': '075', + 'Jefferson County, IN': '077', + 'Jennings County, IN': '079', + 'Johnson County, IN': '081', + 'Knox County, IN': '083', + 'Kosciusko County, IN': '085', + 'LaGrange County, IN': '087', + 'LaPorte County, IN': '091', + 'Lake County, IN': '089', + 'Lawrence County, IN': '093', + 'Madison County, IN': '095', + 'Marion County, IN': '097', + 'Marshall County, IN': '099', + 'Martin County, IN': '101', + 'Miami County, IN': '103', + 'Monroe County, IN': '105', + 'Montgomery County, IN': '107', + 'Morgan County, IN': '109', + 'Newton County, IN': '111', + 'Noble County, IN': '113', + 'Ohio County, IN': '115', + 'Orange County, IN': '117', + 'Owen County, IN': '119', + 'Parke County, IN': '121', + 'Perry County, IN': '123', + 'Pike County, IN': '125', + 'Porter County, IN': '127', + 'Posey County, IN': '129', + 'Pulaski County, IN': '131', + 'Putnam County, IN': '133', + 'Randolph County, IN': '135', + 'Ripley County, IN': '137', + 'Rush County, IN': '139', + 'Scott County, IN': '143', + 'Shelby County, IN': '145', + 'Spencer County, IN': '147', + 'St. Joseph County, IN': '141', + 'Starke County, IN': '149', + 'Steuben County, IN': '151', + 'Sullivan County, IN': '153', + 'Switzerland County, IN': '155', + 'Tippecanoe County, IN': '157', + 'Tipton County, IN': '159', + 'Union County, IN': '161', + 'Vanderburgh County, IN': '163', + 'Vermillion County, IN': '165', + 'Vigo County, IN': '167', + 'Wabash County, IN': '169', + 'Warren County, IN': '171', + 'Warrick County, IN': '173', + 'Washington County, IN': '175', + 'Wayne County, IN': '177', + 'Wells County, IN': '179', + 'White County, IN': '181', + 'Whitley County, IN': '183'}, + '19': {'Adair County, IA': '001', + 'Adams County, IA': '003', + 'Allamakee County, IA': '005', + 'Appanoose County, IA': '007', + 'Audubon County, IA': '009', + 'Benton County, IA': '011', + 'Black Hawk County, IA': '013', + 'Boone County, IA': '015', + 'Bremer County, IA': '017', + 'Buchanan County, IA': '019', + 'Buena Vista County, IA': '021', + 'Butler County, IA': '023', + 'Calhoun County, IA': '025', + 'Carroll County, IA': '027', + 'Cass County, IA': '029', + 'Cedar County, IA': '031', + 'Cerro Gordo County, IA': '033', + 'Cherokee County, IA': '035', + 'Chickasaw County, IA': '037', + 'Clarke County, IA': '039', + 'Clay County, IA': '041', + 'Clayton County, IA': '043', + 'Clinton County, IA': '045', + 'Crawford County, IA': '047', + 'Dallas County, IA': '049', + 'Davis County, IA': '051', + 'Decatur County, IA': '053', + 'Delaware County, IA': '055', + 'Des Moines County, IA': '057', + 'Dickinson County, IA': '059', + 'Dubuque County, IA': '061', + 'Emmet County, IA': '063', + 'Fayette County, IA': '065', + 'Floyd County, IA': '067', + 'Franklin County, IA': '069', + 'Fremont County, IA': '071', + 'Greene County, IA': '073', + 'Grundy County, IA': '075', + 'Guthrie County, IA': '077', + 'Hamilton County, IA': '079', + 'Hancock County, IA': '081', + 'Hardin County, IA': '083', + 'Harrison County, IA': '085', + 'Henry County, IA': '087', + 'Howard County, IA': '089', + 'Humboldt County, IA': '091', + 'Ida County, IA': '093', + 'Iowa County, IA': '095', + 'Jackson County, IA': '097', + 'Jasper County, IA': '099', + 'Jefferson County, IA': '101', + 'Johnson County, IA': '103', + 'Jones County, IA': '105', + 'Keokuk County, IA': '107', + 'Kossuth County, IA': '109', + 'Lee County, IA': '111', + 'Linn County, IA': '113', + 'Louisa County, IA': '115', + 'Lucas County, IA': '117', + 'Lyon County, IA': '119', + 'Madison County, IA': '121', + 'Mahaska County, IA': '123', + 'Marion County, IA': '125', + 'Marshall County, IA': '127', + 'Mills County, IA': '129', + 'Mitchell County, IA': '131', + 'Monona County, IA': '133', + 'Monroe County, IA': '135', + 'Montgomery County, IA': '137', + 'Muscatine County, IA': '139', + "O'Brien County, IA": '141', + 'Osceola County, IA': '143', + 'Page County, IA': '145', + 'Palo Alto County, IA': '147', + 'Plymouth County, IA': '149', + 'Pocahontas County, IA': '151', + 'Polk County, IA': '153', + 'Pottawattamie County, IA': '155', + 'Poweshiek County, IA': '157', + 'Ringgold County, IA': '159', + 'Sac County, IA': '161', + 'Scott County, IA': '163', + 'Shelby County, IA': '165', + 'Sioux County, IA': '167', + 'Story County, IA': '169', + 'Tama County, IA': '171', + 'Taylor County, IA': '173', + 'Union County, IA': '175', + 'Van Buren County, IA': '177', + 'Wapello County, IA': '179', + 'Warren County, IA': '181', + 'Washington County, IA': '183', + 'Wayne County, IA': '185', + 'Webster County, IA': '187', + 'Winnebago County, IA': '189', + 'Winneshiek County, IA': '191', + 'Woodbury County, IA': '193', + 'Worth County, IA': '195', + 'Wright County, IA': '197'}, + '20': {'Allen County, KS': '001', + 'Anderson County, KS': '003', + 'Atchison County, KS': '005', + 'Barber County, KS': '007', + 'Barton County, KS': '009', + 'Bourbon County, KS': '011', + 'Brown County, KS': '013', + 'Butler County, KS': '015', + 'Chase County, KS': '017', + 'Chautauqua County, KS': '019', + 'Cherokee County, KS': '021', + 'Cheyenne County, KS': '023', + 'Clark County, KS': '025', + 'Clay County, KS': '027', + 'Cloud County, KS': '029', + 'Coffey County, KS': '031', + 'Comanche County, KS': '033', + 'Cowley County, KS': '035', + 'Crawford County, KS': '037', + 'Decatur County, KS': '039', + 'Dickinson County, KS': '041', + 'Doniphan County, KS': '043', + 'Douglas County, KS': '045', + 'Edwards County, KS': '047', + 'Elk County, KS': '049', + 'Ellis County, KS': '051', + 'Ellsworth County, KS': '053', + 'Finney County, KS': '055', + 'Ford County, KS': '057', + 'Franklin County, KS': '059', + 'Geary County, KS': '061', + 'Gove County, KS': '063', + 'Graham County, KS': '065', + 'Grant County, KS': '067', + 'Gray County, KS': '069', + 'Greeley County, KS': '071', + 'Greenwood County, KS': '073', + 'Hamilton County, KS': '075', + 'Harper County, KS': '077', + 'Harvey County, KS': '079', + 'Haskell County, KS': '081', + 'Hodgeman County, KS': '083', + 'Jackson County, KS': '085', + 'Jefferson County, KS': '087', + 'Jewell County, KS': '089', + 'Johnson County, KS': '091', + 'Kearny County, KS': '093', + 'Kingman County, KS': '095', + 'Kiowa County, KS': '097', + 'Labette County, KS': '099', + 'Lane County, KS': '101', + 'Leavenworth County, KS': '103', + 'Lincoln County, KS': '105', + 'Linn County, KS': '107', + 'Logan County, KS': '109', + 'Lyon County, KS': '111', + 'Marion County, KS': '115', + 'Marshall County, KS': '117', + 'McPherson County, KS': '113', + 'Meade County, KS': '119', + 'Miami County, KS': '121', + 'Mitchell County, KS': '123', + 'Montgomery County, KS': '125', + 'Morris County, KS': '127', + 'Morton County, KS': '129', + 'Nemaha County, KS': '131', + 'Neosho County, KS': '133', + 'Ness County, KS': '135', + 'Norton County, KS': '137', + 'Osage County, KS': '139', + 'Osborne County, KS': '141', + 'Ottawa County, KS': '143', + 'Pawnee County, KS': '145', + 'Phillips County, KS': '147', + 'Pottawatomie County, KS': '149', + 'Pratt County, KS': '151', + 'Rawlins County, KS': '153', + 'Reno County, KS': '155', + 'Republic County, KS': '157', + 'Rice County, KS': '159', + 'Riley County, KS': '161', + 'Rooks County, KS': '163', + 'Rush County, KS': '165', + 'Russell County, KS': '167', + 'Saline County, KS': '169', + 'Scott County, KS': '171', + 'Sedgwick County, KS': '173', + 'Seward County, KS': '175', + 'Shawnee County, KS': '177', + 'Sheridan County, KS': '179', + 'Sherman County, KS': '181', + 'Smith County, KS': '183', + 'Stafford County, KS': '185', + 'Stanton County, KS': '187', + 'Stevens County, KS': '189', + 'Sumner County, KS': '191', + 'Thomas County, KS': '193', + 'Trego County, KS': '195', + 'Wabaunsee County, KS': '197', + 'Wallace County, KS': '199', + 'Washington County, KS': '201', + 'Wichita County, KS': '203', + 'Wilson County, KS': '205', + 'Woodson County, KS': '207', + 'Wyandotte County, KS': '209'}, + '21': {'Adair County, KY': '001', + 'Allen County, KY': '003', + 'Anderson County, KY': '005', + 'Ballard County, KY': '007', + 'Barren County, KY': '009', + 'Bath County, KY': '011', + 'Bell County, KY': '013', + 'Boone County, KY': '015', + 'Bourbon County, KY': '017', + 'Boyd County, KY': '019', + 'Boyle County, KY': '021', + 'Bracken County, KY': '023', + 'Breathitt County, KY': '025', + 'Breckinridge County, KY': '027', + 'Bullitt County, KY': '029', + 'Butler County, KY': '031', + 'Caldwell County, KY': '033', + 'Calloway County, KY': '035', + 'Campbell County, KY': '037', + 'Carlisle County, KY': '039', + 'Carroll County, KY': '041', + 'Carter County, KY': '043', + 'Casey County, KY': '045', + 'Christian County, KY': '047', + 'Clark County, KY': '049', + 'Clay County, KY': '051', + 'Clinton County, KY': '053', + 'Crittenden County, KY': '055', + 'Cumberland County, KY': '057', + 'Daviess County, KY': '059', + 'Edmonson County, KY': '061', + 'Elliott County, KY': '063', + 'Estill County, KY': '065', + 'Fayette County, KY': '067', + 'Fleming County, KY': '069', + 'Floyd County, KY': '071', + 'Franklin County, KY': '073', + 'Fulton County, KY': '075', + 'Gallatin County, KY': '077', + 'Garrard County, KY': '079', + 'Grant County, KY': '081', + 'Graves County, KY': '083', + 'Grayson County, KY': '085', + 'Green County, KY': '087', + 'Greenup County, KY': '089', + 'Hancock County, KY': '091', + 'Hardin County, KY': '093', + 'Harlan County, KY': '095', + 'Harrison County, KY': '097', + 'Hart County, KY': '099', + 'Henderson County, KY': '101', + 'Henry County, KY': '103', + 'Hickman County, KY': '105', + 'Hopkins County, KY': '107', + 'Jackson County, KY': '109', + 'Jefferson County, KY': '111', + 'Jessamine County, KY': '113', + 'Johnson County, KY': '115', + 'Kenton County, KY': '117', + 'Knott County, KY': '119', + 'Knox County, KY': '121', + 'Larue County, KY': '123', + 'Laurel County, KY': '125', + 'Lawrence County, KY': '127', + 'Lee County, KY': '129', + 'Leslie County, KY': '131', + 'Letcher County, KY': '133', + 'Lewis County, KY': '135', + 'Lincoln County, KY': '137', + 'Livingston County, KY': '139', + 'Logan County, KY': '141', + 'Lyon County, KY': '143', + 'Madison County, KY': '151', + 'Magoffin County, KY': '153', + 'Marion County, KY': '155', + 'Marshall County, KY': '157', + 'Martin County, KY': '159', + 'Mason County, KY': '161', + 'McCracken County, KY': '145', + 'McCreary County, KY': '147', + 'McLean County, KY': '149', + 'Meade County, KY': '163', + 'Menifee County, KY': '165', + 'Mercer County, KY': '167', + 'Metcalfe County, KY': '169', + 'Monroe County, KY': '171', + 'Montgomery County, KY': '173', + 'Morgan County, KY': '175', + 'Muhlenberg County, KY': '177', + 'Nelson County, KY': '179', + 'Nicholas County, KY': '181', + 'Ohio County, KY': '183', + 'Oldham County, KY': '185', + 'Owen County, KY': '187', + 'Owsley County, KY': '189', + 'Pendleton County, KY': '191', + 'Perry County, KY': '193', + 'Pike County, KY': '195', + 'Powell County, KY': '197', + 'Pulaski County, KY': '199', + 'Robertson County, KY': '201', + 'Rockcastle County, KY': '203', + 'Rowan County, KY': '205', + 'Russell County, KY': '207', + 'Scott County, KY': '209', + 'Shelby County, KY': '211', + 'Simpson County, KY': '213', + 'Spencer County, KY': '215', + 'Taylor County, KY': '217', + 'Todd County, KY': '219', + 'Trigg County, KY': '221', + 'Trimble County, KY': '223', + 'Union County, KY': '225', + 'Warren County, KY': '227', + 'Washington County, KY': '229', + 'Wayne County, KY': '231', + 'Webster County, KY': '233', + 'Whitley County, KY': '235', + 'Wolfe County, KY': '237', + 'Woodford County, KY': '239'}, + '22': {'Acadia Parish, LA': '001', + 'Allen Parish, LA': '003', + 'Ascension Parish, LA': '005', + 'Assumption Parish, LA': '007', + 'Avoyelles Parish, LA': '009', + 'Beauregard Parish, LA': '011', + 'Bienville Parish, LA': '013', + 'Bossier Parish, LA': '015', + 'Caddo Parish, LA': '017', + 'Calcasieu Parish, LA': '019', + 'Caldwell Parish, LA': '021', + 'Cameron Parish, LA': '023', + 'Catahoula Parish, LA': '025', + 'Claiborne Parish, LA': '027', + 'Concordia Parish, LA': '029', + 'De Soto Parish, LA': '031', + 'East Baton Rouge Parish, LA': '033', + 'East Carroll Parish, LA': '035', + 'East Feliciana Parish, LA': '037', + 'Evangeline Parish, LA': '039', + 'Franklin Parish, LA': '041', + 'Grant Parish, LA': '043', + 'Iberia Parish, LA': '045', + 'Iberville Parish, LA': '047', + 'Jackson Parish, LA': '049', + 'Jefferson Davis Parish, LA': '053', + 'Jefferson Parish, LA': '051', + 'La Salle Parish, LA': '059', + 'Lafayette Parish, LA': '055', + 'Lafourche Parish, LA': '057', + 'Lincoln Parish, LA': '061', + 'Livingston Parish, LA': '063', + 'Madison Parish, LA': '065', + 'Morehouse Parish, LA': '067', + 'Natchitoches Parish, LA': '069', + 'Orleans Parish, LA': '071', + 'Ouachita Parish, LA': '073', + 'Plaquemines Parish, LA': '075', + 'Pointe Coupee Parish, LA': '077', + 'Rapides Parish, LA': '079', + 'Red River Parish, LA': '081', + 'Richland Parish, LA': '083', + 'Sabine Parish, LA': '085', + 'St. Bernard Parish, LA': '087', + 'St. Charles Parish, LA': '089', + 'St. Helena Parish, LA': '091', + 'St. James Parish, LA': '093', + 'St. John the Baptist Parish, LA': '095', + 'St. Landry Parish, LA': '097', + 'St. Martin Parish, LA': '099', + 'St. Mary Parish, LA': '101', + 'St. Tammany Parish, LA': '103', + 'Tangipahoa Parish, LA': '105', + 'Tensas Parish, LA': '107', + 'Terrebonne Parish, LA': '109', + 'Union Parish, LA': '111', + 'Vermilion Parish, LA': '113', + 'Vernon Parish, LA': '115', + 'Washington Parish, LA': '117', + 'Webster Parish, LA': '119', + 'West Baton Rouge Parish, LA': '121', + 'West Carroll Parish, LA': '123', + 'West Feliciana Parish, LA': '125', + 'Winn Parish, LA': '127'}, + '23': {'Androscoggin County, ME': '001', + 'Aroostook County, ME': '003', + 'Cumberland County, ME': '005', + 'Franklin County, ME': '007', + 'Hancock County, ME': '009', + 'Kennebec County, ME': '011', + 'Knox County, ME': '013', + 'Lincoln County, ME': '015', + 'Oxford County, ME': '017', + 'Penobscot County, ME': '019', + 'Piscataquis County, ME': '021', + 'Sagadahoc County, ME': '023', + 'Somerset County, ME': '025', + 'Waldo County, ME': '027', + 'Washington County, ME': '029', + 'York County, ME': '031'}, + '24': {'Allegany County, MD': '001', + 'Anne Arundel County, MD': '003', + 'Baltimore County, MD': '005', + 'Baltimore city, MD': '510', + 'Calvert County, MD': '009', + 'Caroline County, MD': '011', + 'Carroll County, MD': '013', + 'Cecil County, MD': '015', + 'Charles County, MD': '017', + 'Dorchester County, MD': '019', + 'Frederick County, MD': '021', + 'Garrett County, MD': '023', + 'Harford County, MD': '025', + 'Howard County, MD': '027', + 'Kent County, MD': '029', + 'Montgomery County, MD': '031', + "Prince George's County, MD": '033', + "Queen Anne's County, MD": '035', + 'Somerset County, MD': '039', + "St. Mary's County, MD": '037', + 'Talbot County, MD': '041', + 'Washington County, MD': '043', + 'Wicomico County, MD': '045', + 'Worcester County, MD': '047'}, + '25': {'Barnstable County, MA': '001', + 'Berkshire County, MA': '003', + 'Bristol County, MA': '005', + 'Dukes County, MA': '007', + 'Essex County, MA': '009', + 'Franklin County, MA': '011', + 'Hampden County, MA': '013', + 'Hampshire County, MA': '015', + 'Middlesex County, MA': '017', + 'Nantucket County/town, MA': '019', + 'Norfolk County, MA': '021', + 'Plymouth County, MA': '023', + 'Suffolk County, MA': '025', + 'Worcester County, MA': '027'}, + '26': {'Alcona County, MI': '001', + 'Alger County, MI': '003', + 'Allegan County, MI': '005', + 'Alpena County, MI': '007', + 'Antrim County, MI': '009', + 'Arenac County, MI': '011', + 'Baraga County, MI': '013', + 'Barry County, MI': '015', + 'Bay County, MI': '017', + 'Benzie County, MI': '019', + 'Berrien County, MI': '021', + 'Branch County, MI': '023', + 'Calhoun County, MI': '025', + 'Cass County, MI': '027', + 'Charlevoix County, MI': '029', + 'Cheboygan County, MI': '031', + 'Chippewa County, MI': '033', + 'Clare County, MI': '035', + 'Clinton County, MI': '037', + 'Crawford County, MI': '039', + 'Delta County, MI': '041', + 'Dickinson County, MI': '043', + 'Eaton County, MI': '045', + 'Emmet County, MI': '047', + 'Genesee County, MI': '049', + 'Gladwin County, MI': '051', + 'Gogebic County, MI': '053', + 'Grand Traverse County, MI': '055', + 'Gratiot County, MI': '057', + 'Hillsdale County, MI': '059', + 'Houghton County, MI': '061', + 'Huron County, MI': '063', + 'Ingham County, MI': '065', + 'Ionia County, MI': '067', + 'Iosco County, MI': '069', + 'Iron County, MI': '071', + 'Isabella County, MI': '073', + 'Jackson County, MI': '075', + 'Kalamazoo County, MI': '077', + 'Kalkaska County, MI': '079', + 'Kent County, MI': '081', + 'Keweenaw County, MI': '083', + 'Lake County, MI': '085', + 'Lapeer County, MI': '087', + 'Leelanau County, MI': '089', + 'Lenawee County, MI': '091', + 'Livingston County, MI': '093', + 'Luce County, MI': '095', + 'Mackinac County, MI': '097', + 'Macomb County, MI': '099', + 'Manistee County, MI': '101', + 'Marquette County, MI': '103', + 'Mason County, MI': '105', + 'Mecosta County, MI': '107', + 'Menominee County, MI': '109', + 'Midland County, MI': '111', + 'Missaukee County, MI': '113', + 'Monroe County, MI': '115', + 'Montcalm County, MI': '117', + 'Montmorency County, MI': '119', + 'Muskegon County, MI': '121', + 'Newaygo County, MI': '123', + 'Oakland County, MI': '125', + 'Oceana County, MI': '127', + 'Ogemaw County, MI': '129', + 'Ontonagon County, MI': '131', + 'Osceola County, MI': '133', + 'Oscoda County, MI': '135', + 'Otsego County, MI': '137', + 'Ottawa County, MI': '139', + 'Presque Isle County, MI': '141', + 'Roscommon County, MI': '143', + 'Saginaw County, MI': '145', + 'Sanilac County, MI': '151', + 'Schoolcraft County, MI': '153', + 'Shiawassee County, MI': '155', + 'St. Clair County, MI': '147', + 'St. Joseph County, MI': '149', + 'Tuscola County, MI': '157', + 'Van Buren County, MI': '159', + 'Washtenaw County, MI': '161', + 'Wayne County, MI': '163', + 'Wexford County, MI': '165'}, + '27': {'Aitkin County, MN': '001', + 'Anoka County, MN': '003', + 'Becker County, MN': '005', + 'Beltrami County, MN': '007', + 'Benton County, MN': '009', + 'Big Stone County, MN': '011', + 'Blue Earth County, MN': '013', + 'Brown County, MN': '015', + 'Carlton County, MN': '017', + 'Carver County, MN': '019', + 'Cass County, MN': '021', + 'Chippewa County, MN': '023', + 'Chisago County, MN': '025', + 'Clay County, MN': '027', + 'Clearwater County, MN': '029', + 'Cook County, MN': '031', + 'Cottonwood County, MN': '033', + 'Crow Wing County, MN': '035', + 'Dakota County, MN': '037', + 'Dodge County, MN': '039', + 'Douglas County, MN': '041', + 'Faribault County, MN': '043', + 'Fillmore County, MN': '045', + 'Freeborn County, MN': '047', + 'Goodhue County, MN': '049', + 'Grant County, MN': '051', + 'Hennepin County, MN': '053', + 'Houston County, MN': '055', + 'Hubbard County, MN': '057', + 'Isanti County, MN': '059', + 'Itasca County, MN': '061', + 'Jackson County, MN': '063', + 'Kanabec County, MN': '065', + 'Kandiyohi County, MN': '067', + 'Kittson County, MN': '069', + 'Koochiching County, MN': '071', + 'Lac qui Parle County, MN': '073', + 'Lake County, MN': '075', + 'Lake of the Woods County, MN': '077', + 'Le Sueur County, MN': '079', + 'Lincoln County, MN': '081', + 'Lyon County, MN': '083', + 'Mahnomen County, MN': '087', + 'Marshall County, MN': '089', + 'Martin County, MN': '091', + 'McLeod County, MN': '085', + 'Meeker County, MN': '093', + 'Mille Lacs County, MN': '095', + 'Morrison County, MN': '097', + 'Mower County, MN': '099', + 'Murray County, MN': '101', + 'Nicollet County, MN': '103', + 'Nobles County, MN': '105', + 'Norman County, MN': '107', + 'Olmsted County, MN': '109', + 'Otter Tail County, MN': '111', + 'Pennington County, MN': '113', + 'Pine County, MN': '115', + 'Pipestone County, MN': '117', + 'Polk County, MN': '119', + 'Pope County, MN': '121', + 'Ramsey County, MN': '123', + 'Red Lake County, MN': '125', + 'Redwood County, MN': '127', + 'Renville County, MN': '129', + 'Rice County, MN': '131', + 'Rock County, MN': '133', + 'Roseau County, MN': '135', + 'Scott County, MN': '139', + 'Sherburne County, MN': '141', + 'Sibley County, MN': '143', + 'St. Louis County, MN': '137', + 'Stearns County, MN': '145', + 'Steele County, MN': '147', + 'Stevens County, MN': '149', + 'Swift County, MN': '151', + 'Todd County, MN': '153', + 'Traverse County, MN': '155', + 'Wabasha County, MN': '157', + 'Wadena County, MN': '159', + 'Waseca County, MN': '161', + 'Washington County, MN': '163', + 'Watonwan County, MN': '165', + 'Wilkin County, MN': '167', + 'Winona County, MN': '169', + 'Wright County, MN': '171', + 'Yellow Medicine County, MN': '173'}, + '28': {'Adams County, MS': '001', + 'Alcorn County, MS': '003', + 'Amite County, MS': '005', + 'Attala County, MS': '007', + 'Benton County, MS': '009', + 'Bolivar County, MS': '011', + 'Calhoun County, MS': '013', + 'Carroll County, MS': '015', + 'Chickasaw County, MS': '017', + 'Choctaw County, MS': '019', + 'Claiborne County, MS': '021', + 'Clarke County, MS': '023', + 'Clay County, MS': '025', + 'Coahoma County, MS': '027', + 'Copiah County, MS': '029', + 'Covington County, MS': '031', + 'DeSoto County, MS': '033', + 'Forrest County, MS': '035', + 'Franklin County, MS': '037', + 'George County, MS': '039', + 'Greene County, MS': '041', + 'Grenada County, MS': '043', + 'Hancock County, MS': '045', + 'Harrison County, MS': '047', + 'Hinds County, MS': '049', + 'Holmes County, MS': '051', + 'Humphreys County, MS': '053', + 'Issaquena County, MS': '055', + 'Itawamba County, MS': '057', + 'Jackson County, MS': '059', + 'Jasper County, MS': '061', + 'Jefferson County, MS': '063', + 'Jefferson Davis County, MS': '065', + 'Jones County, MS': '067', + 'Kemper County, MS': '069', + 'Lafayette County, MS': '071', + 'Lamar County, MS': '073', + 'Lauderdale County, MS': '075', + 'Lawrence County, MS': '077', + 'Leake County, MS': '079', + 'Lee County, MS': '081', + 'Leflore County, MS': '083', + 'Lincoln County, MS': '085', + 'Lowndes County, MS': '087', + 'Madison County, MS': '089', + 'Marion County, MS': '091', + 'Marshall County, MS': '093', + 'Monroe County, MS': '095', + 'Montgomery County, MS': '097', + 'Neshoba County, MS': '099', + 'Newton County, MS': '101', + 'Noxubee County, MS': '103', + 'Oktibbeha County, MS': '105', + 'Panola County, MS': '107', + 'Pearl River County, MS': '109', + 'Perry County, MS': '111', + 'Pike County, MS': '113', + 'Pontotoc County, MS': '115', + 'Prentiss County, MS': '117', + 'Quitman County, MS': '119', + 'Rankin County, MS': '121', + 'Scott County, MS': '123', + 'Sharkey County, MS': '125', + 'Simpson County, MS': '127', + 'Smith County, MS': '129', + 'Stone County, MS': '131', + 'Sunflower County, MS': '133', + 'Tallahatchie County, MS': '135', + 'Tate County, MS': '137', + 'Tippah County, MS': '139', + 'Tishomingo County, MS': '141', + 'Tunica County, MS': '143', + 'Union County, MS': '145', + 'Walthall County, MS': '147', + 'Warren County, MS': '149', + 'Washington County, MS': '151', + 'Wayne County, MS': '153', + 'Webster County, MS': '155', + 'Wilkinson County, MS': '157', + 'Winston County, MS': '159', + 'Yalobusha County, MS': '161', + 'Yazoo County, MS': '163'}, + '29': {'Adair County, MO': '001', + 'Andrew County, MO': '003', + 'Atchison County, MO': '005', + 'Audrain County, MO': '007', + 'Barry County, MO': '009', + 'Barton County, MO': '011', + 'Bates County, MO': '013', + 'Benton County, MO': '015', + 'Bollinger County, MO': '017', + 'Boone County, MO': '019', + 'Buchanan County, MO': '021', + 'Butler County, MO': '023', + 'Caldwell County, MO': '025', + 'Callaway County, MO': '027', + 'Camden County, MO': '029', + 'Cape Girardeau County, MO': '031', + 'Carroll County, MO': '033', + 'Carter County, MO': '035', + 'Cass County, MO': '037', + 'Cedar County, MO': '039', + 'Chariton County, MO': '041', + 'Christian County, MO': '043', + 'Clark County, MO': '045', + 'Clay County, MO': '047', + 'Clinton County, MO': '049', + 'Cole County, MO': '051', + 'Cooper County, MO': '053', + 'Crawford County, MO': '055', + 'Dade County, MO': '057', + 'Dallas County, MO': '059', + 'Daviess County, MO': '061', + 'DeKalb County, MO': '063', + 'Dent County, MO': '065', + 'Douglas County, MO': '067', + 'Dunklin County, MO': '069', + 'Franklin County, MO': '071', + 'Gasconade County, MO': '073', + 'Gentry County, MO': '075', + 'Greene County, MO': '077', + 'Grundy County, MO': '079', + 'Harrison County, MO': '081', + 'Henry County, MO': '083', + 'Hickory County, MO': '085', + 'Holt County, MO': '087', + 'Howard County, MO': '089', + 'Howell County, MO': '091', + 'Iron County, MO': '093', + 'Jackson County, MO': '095', + 'Jasper County, MO': '097', + 'Jefferson County, MO': '099', + 'Johnson County, MO': '101', + 'Knox County, MO': '103', + 'Laclede County, MO': '105', + 'Lafayette County, MO': '107', + 'Lawrence County, MO': '109', + 'Lewis County, MO': '111', + 'Lincoln County, MO': '113', + 'Linn County, MO': '115', + 'Livingston County, MO': '117', + 'Macon County, MO': '121', + 'Madison County, MO': '123', + 'Maries County, MO': '125', + 'Marion County, MO': '127', + 'McDonald County, MO': '119', + 'Mercer County, MO': '129', + 'Miller County, MO': '131', + 'Mississippi County, MO': '133', + 'Moniteau County, MO': '135', + 'Monroe County, MO': '137', + 'Montgomery County, MO': '139', + 'Morgan County, MO': '141', + 'New Madrid County, MO': '143', + 'Newton County, MO': '145', + 'Nodaway County, MO': '147', + 'Oregon County, MO': '149', + 'Osage County, MO': '151', + 'Ozark County, MO': '153', + 'Pemiscot County, MO': '155', + 'Perry County, MO': '157', + 'Pettis County, MO': '159', + 'Phelps County, MO': '161', + 'Pike County, MO': '163', + 'Platte County, MO': '165', + 'Polk County, MO': '167', + 'Pulaski County, MO': '169', + 'Putnam County, MO': '171', + 'Ralls County, MO': '173', + 'Randolph County, MO': '175', + 'Ray County, MO': '177', + 'Reynolds County, MO': '179', + 'Ripley County, MO': '181', + 'Saline County, MO': '195', + 'Schuyler County, MO': '197', + 'Scotland County, MO': '199', + 'Scott County, MO': '201', + 'Shannon County, MO': '203', + 'Shelby County, MO': '205', + 'St. Charles County, MO': '183', + 'St. Clair County, MO': '185', + 'St. Francois County, MO': '187', + 'St. Louis County, MO': '189', + 'St. Louis city, MO': '510', + 'Ste. Genevieve County, MO': '186', + 'Stoddard County, MO': '207', + 'Stone County, MO': '209', + 'Sullivan County, MO': '211', + 'Taney County, MO': '213', + 'Texas County, MO': '215', + 'Vernon County, MO': '217', + 'Warren County, MO': '219', + 'Washington County, MO': '221', + 'Wayne County, MO': '223', + 'Webster County, MO': '225', + 'Worth County, MO': '227', + 'Wright County, MO': '229'}, + '30': {'Beaverhead County, MT': '001', + 'Big Horn County, MT': '003', + 'Blaine County, MT': '005', + 'Broadwater County, MT': '007', + 'Carbon County, MT': '009', + 'Carter County, MT': '011', + 'Cascade County, MT': '013', + 'Chouteau County, MT': '015', + 'Custer County, MT': '017', + 'Daniels County, MT': '019', + 'Dawson County, MT': '021', + 'Deer Lodge County, MT': '023', + 'Fallon County, MT': '025', + 'Fergus County, MT': '027', + 'Flathead County, MT': '029', + 'Gallatin County, MT': '031', + 'Garfield County, MT': '033', + 'Glacier County, MT': '035', + 'Golden Valley County, MT': '037', + 'Granite County, MT': '039', + 'Hill County, MT': '041', + 'Jefferson County, MT': '043', + 'Judith Basin County, MT': '045', + 'Lake County, MT': '047', + 'Lewis and Clark County, MT': '049', + 'Liberty County, MT': '051', + 'Lincoln County, MT': '053', + 'Madison County, MT': '057', + 'McCone County, MT': '055', + 'Meagher County, MT': '059', + 'Mineral County, MT': '061', + 'Missoula County, MT': '063', + 'Musselshell County, MT': '065', + 'Park County, MT': '067', + 'Petroleum County, MT': '069', + 'Phillips County, MT': '071', + 'Pondera County, MT': '073', + 'Powder River County, MT': '075', + 'Powell County, MT': '077', + 'Prairie County, MT': '079', + 'Ravalli County, MT': '081', + 'Richland County, MT': '083', + 'Roosevelt County, MT': '085', + 'Rosebud County, MT': '087', + 'Sanders County, MT': '089', + 'Sheridan County, MT': '091', + 'Silver Bow County, MT': '093', + 'Stillwater County, MT': '095', + 'Sweet Grass County, MT': '097', + 'Teton County, MT': '099', + 'Toole County, MT': '101', + 'Treasure County, MT': '103', + 'Valley County, MT': '105', + 'Wheatland County, MT': '107', + 'Wibaux County, MT': '109', + 'Yellowstone County, MT': '111'}, + '31': {'Adams County, NE': '001', + 'Antelope County, NE': '003', + 'Arthur County, NE': '005', + 'Banner County, NE': '007', + 'Blaine County, NE': '009', + 'Boone County, NE': '011', + 'Box Butte County, NE': '013', + 'Boyd County, NE': '015', + 'Brown County, NE': '017', + 'Buffalo County, NE': '019', + 'Burt County, NE': '021', + 'Butler County, NE': '023', + 'Cass County, NE': '025', + 'Cedar County, NE': '027', + 'Chase County, NE': '029', + 'Cherry County, NE': '031', + 'Cheyenne County, NE': '033', + 'Clay County, NE': '035', + 'Colfax County, NE': '037', + 'Cuming County, NE': '039', + 'Custer County, NE': '041', + 'Dakota County, NE': '043', + 'Dawes County, NE': '045', + 'Dawson County, NE': '047', + 'Deuel County, NE': '049', + 'Dixon County, NE': '051', + 'Dodge County, NE': '053', + 'Douglas County, NE': '055', + 'Dundy County, NE': '057', + 'Fillmore County, NE': '059', + 'Franklin County, NE': '061', + 'Frontier County, NE': '063', + 'Furnas County, NE': '065', + 'Gage County, NE': '067', + 'Garden County, NE': '069', + 'Garfield County, NE': '071', + 'Gosper County, NE': '073', + 'Grant County, NE': '075', + 'Greeley County, NE': '077', + 'Hall County, NE': '079', + 'Hamilton County, NE': '081', + 'Harlan County, NE': '083', + 'Hayes County, NE': '085', + 'Hitchcock County, NE': '087', + 'Holt County, NE': '089', + 'Hooker County, NE': '091', + 'Howard County, NE': '093', + 'Jefferson County, NE': '095', + 'Johnson County, NE': '097', + 'Kearney County, NE': '099', + 'Keith County, NE': '101', + 'Keya Paha County, NE': '103', + 'Kimball County, NE': '105', + 'Knox County, NE': '107', + 'Lancaster County, NE': '109', + 'Lincoln County, NE': '111', + 'Logan County, NE': '113', + 'Loup County, NE': '115', + 'Madison County, NE': '119', + 'McPherson County, NE': '117', + 'Merrick County, NE': '121', + 'Morrill County, NE': '123', + 'Nance County, NE': '125', + 'Nemaha County, NE': '127', + 'Nuckolls County, NE': '129', + 'Otoe County, NE': '131', + 'Pawnee County, NE': '133', + 'Perkins County, NE': '135', + 'Phelps County, NE': '137', + 'Pierce County, NE': '139', + 'Platte County, NE': '141', + 'Polk County, NE': '143', + 'Red Willow County, NE': '145', + 'Richardson County, NE': '147', + 'Rock County, NE': '149', + 'Saline County, NE': '151', + 'Sarpy County, NE': '153', + 'Saunders County, NE': '155', + 'Scotts Bluff County, NE': '157', + 'Seward County, NE': '159', + 'Sheridan County, NE': '161', + 'Sherman County, NE': '163', + 'Sioux County, NE': '165', + 'Stanton County, NE': '167', + 'Thayer County, NE': '169', + 'Thomas County, NE': '171', + 'Thurston County, NE': '173', + 'Valley County, NE': '175', + 'Washington County, NE': '177', + 'Wayne County, NE': '179', + 'Webster County, NE': '181', + 'Wheeler County, NE': '183', + 'York County, NE': '185'}, + '32': {'Carson City, NV': '510', + 'Churchill County, NV': '001', + 'Clark County, NV': '003', + 'Douglas County, NV': '005', + 'Elko County, NV': '007', + 'Esmeralda County, NV': '009', + 'Eureka County, NV': '011', + 'Humboldt County, NV': '013', + 'Lander County, NV': '015', + 'Lincoln County, NV': '017', + 'Lyon County, NV': '019', + 'Mineral County, NV': '021', + 'Nye County, NV': '023', + 'Pershing County, NV': '027', + 'Storey County, NV': '029', + 'Washoe County, NV': '031', + 'White Pine County, NV': '033'}, + '33': {'Belknap County, NH': '001', + 'Carroll County, NH': '003', + 'Cheshire County, NH': '005', + 'Coos County, NH': '007', + 'Grafton County, NH': '009', + 'Hillsborough County, NH': '011', + 'Merrimack County, NH': '013', + 'Rockingham County, NH': '015', + 'Strafford County, NH': '017', + 'Sullivan County, NH': '019'}, + '34': {'Atlantic County, NJ': '001', + 'Bergen County, NJ': '003', + 'Burlington County, NJ': '005', + 'Camden County, NJ': '007', + 'Cape May County, NJ': '009', + 'Cumberland County, NJ': '011', + 'Essex County, NJ': '013', + 'Gloucester County, NJ': '015', + 'Hudson County, NJ': '017', + 'Hunterdon County, NJ': '019', + 'Mercer County, NJ': '021', + 'Middlesex County, NJ': '023', + 'Monmouth County, NJ': '025', + 'Morris County, NJ': '027', + 'Ocean County, NJ': '029', + 'Passaic County, NJ': '031', + 'Salem County, NJ': '033', + 'Somerset County, NJ': '035', + 'Sussex County, NJ': '037', + 'Union County, NJ': '039', + 'Warren County, NJ': '041'}, + '35': {'Bernalillo County, NM': '001', + 'Catron County, NM': '003', + 'Chaves County, NM': '005', + 'Cibola County, NM': '006', + 'Colfax County, NM': '007', + 'Curry County, NM': '009', + 'DeBaca County, NM': '011', + 'Dona Ana County, NM': '013', + 'Eddy County, NM': '015', + 'Grant County, NM': '017', + 'Guadalupe County, NM': '019', + 'Harding County, NM': '021', + 'Hidalgo County, NM': '023', + 'Lea County, NM': '025', + 'Lincoln County, NM': '027', + 'Los Alamos County, NM': '028', + 'Luna County, NM': '029', + 'McKinley County, NM': '031', + 'Mora County, NM': '033', + 'Otero County, NM': '035', + 'Quay County, NM': '037', + 'Rio Arriba County, NM': '039', + 'Roosevelt County, NM': '041', + 'San Juan County, NM': '045', + 'San Miguel County, NM': '047', + 'Sandoval County, NM': '043', + 'Santa Fe County, NM': '049', + 'Sierra County, NM': '051', + 'Socorro County, NM': '053', + 'Taos County, NM': '055', + 'Torrance County, NM': '057', + 'Union County, NM': '059', + 'Valencia County, NM': '061'}, + '36': {'Albany County, NY': '001', + 'Allegany County, NY': '003', + 'Bronx County, NY': '005', + 'Broome County, NY': '007', + 'Cattaraugus County, NY': '009', + 'Cayuga County, NY': '011', + 'Chautauqua County, NY': '013', + 'Chemung County, NY': '015', + 'Chenango County, NY': '017', + 'Clinton County, NY': '019', + 'Columbia County, NY': '021', + 'Cortland County, NY': '023', + 'Delaware County, NY': '025', + 'Dutchess County, NY': '027', + 'Erie County, NY': '029', + 'Essex County, NY': '031', + 'Franklin County, NY': '033', + 'Fulton County, NY': '035', + 'Genesee County, NY': '037', + 'Greene County, NY': '039', + 'Hamilton County, NY': '041', + 'Herkimer County, NY': '043', + 'Jefferson County, NY': '045', + 'Kings County, NY': '047', + 'Lewis County, NY': '049', + 'Livingston County, NY': '051', + 'Madison County, NY': '053', + 'Monroe County, NY': '055', + 'Montgomery County, NY': '057', + 'Nassau County, NY': '059', + 'New York County, NY': '061', + 'Niagara County, NY': '063', + 'Oneida County, NY': '065', + 'Onondaga County, NY': '067', + 'Ontario County, NY': '069', + 'Orange County, NY': '071', + 'Orleans County, NY': '073', + 'Oswego County, NY': '075', + 'Otsego County, NY': '077', + 'Putnam County, NY': '079', + 'Queens County, NY': '081', + 'Rensselaer County, NY': '083', + 'Richmond County, NY': '085', + 'Rockland County, NY': '087', + 'Saratoga County, NY': '091', + 'Schenectady County, NY': '093', + 'Schoharie County, NY': '095', + 'Schuyler County, NY': '097', + 'Seneca County, NY': '099', + 'St. Lawrence County, NY': '089', + 'Steuben County, NY': '101', + 'Suffolk County, NY': '103', + 'Sullivan County, NY': '105', + 'Tioga County, NY': '107', + 'Tompkins County, NY': '109', + 'Ulster County, NY': '111', + 'Warren County, NY': '113', + 'Washington County, NY': '115', + 'Wayne County, NY': '117', + 'Westchester County, NY': '119', + 'Wyoming County, NY': '121', + 'Yates County, NY': '123'}, + '37': {'Alamance County, NC': '001', + 'Alexander County, NC': '003', + 'Alleghany County, NC': '005', + 'Anson County, NC': '007', + 'Ashe County, NC': '009', + 'Avery County, NC': '011', + 'Beaufort County, NC': '013', + 'Bertie County, NC': '015', + 'Bladen County, NC': '017', + 'Brunswick County, NC': '019', + 'Buncombe County, NC': '021', + 'Burke County, NC': '023', + 'Cabarrus County, NC': '025', + 'Caldwell County, NC': '027', + 'Camden County, NC': '029', + 'Carteret County, NC': '031', + 'Caswell County, NC': '033', + 'Catawba County, NC': '035', + 'Chatham County, NC': '037', + 'Cherokee County, NC': '039', + 'Chowan County, NC': '041', + 'Clay County, NC': '043', + 'Cleveland County, NC': '045', + 'Columbus County, NC': '047', + 'Craven County, NC': '049', + 'Cumberland County, NC': '051', + 'Currituck County, NC': '053', + 'Dare County, NC': '055', + 'Davidson County, NC': '057', + 'Davie County, NC': '059', + 'Duplin County, NC': '061', + 'Durham County, NC': '063', + 'Edgecombe County, NC': '065', + 'Forsyth County, NC': '067', + 'Franklin County, NC': '069', + 'Gaston County, NC': '071', + 'Gates County, NC': '073', + 'Graham County, NC': '075', + 'Granville County, NC': '077', + 'Greene County, NC': '079', + 'Guilford County, NC': '081', + 'Halifax County, NC': '083', + 'Harnett County, NC': '085', + 'Haywood County, NC': '087', + 'Henderson County, NC': '089', + 'Hertford County, NC': '091', + 'Hoke County, NC': '093', + 'Hyde County, NC': '095', + 'Iredell County, NC': '097', + 'Jackson County, NC': '099', + 'Johnston County, NC': '101', + 'Jones County, NC': '103', + 'Lee County, NC': '105', + 'Lenoir County, NC': '107', + 'Lincoln County, NC': '109', + 'Macon County, NC': '113', + 'Madison County, NC': '115', + 'Martin County, NC': '117', + 'McDowell County, NC': '111', + 'Mecklenburg County, NC': '119', + 'Mitchell County, NC': '121', + 'Montgomery County, NC': '123', + 'Moore County, NC': '125', + 'Nash County, NC': '127', + 'New Hanover County, NC': '129', + 'Northampton County, NC': '131', + 'Onslow County, NC': '133', + 'Orange County, NC': '135', + 'Pamlico County, NC': '137', + 'Pasquotank County, NC': '139', + 'Pender County, NC': '141', + 'Perquimans County, NC': '143', + 'Person County, NC': '145', + 'Pitt County, NC': '147', + 'Polk County, NC': '149', + 'Randolph County, NC': '151', + 'Richmond County, NC': '153', + 'Robeson County, NC': '155', + 'Rockingham County, NC': '157', + 'Rowan County, NC': '159', + 'Rutherford County, NC': '161', + 'Sampson County, NC': '163', + 'Scotland County, NC': '165', + 'Stanly County, NC': '167', + 'Stokes County, NC': '169', + 'Surry County, NC': '171', + 'Swain County, NC': '173', + 'Transylvania County, NC': '175', + 'Tyrrell County, NC': '177', + 'Union County, NC': '179', + 'Vance County, NC': '181', + 'Wake County, NC': '183', + 'Warren County, NC': '185', + 'Washington County, NC': '187', + 'Watauga County, NC': '189', + 'Wayne County, NC': '191', + 'Wilkes County, NC': '193', + 'Wilson County, NC': '195', + 'Yadkin County, NC': '197', + 'Yancey County, NC': '199'}, + '38': {'Adams County, ND': '001', + 'Barnes County, ND': '003', + 'Benson County, ND': '005', + 'Billings County, ND': '007', + 'Bottineau County, ND': '009', + 'Bowman County, ND': '011', + 'Burke County, ND': '013', + 'Burleigh County, ND': '015', + 'Cass County, ND': '017', + 'Cavalier County, ND': '019', + 'Dickey County, ND': '021', + 'Divide County, ND': '023', + 'Dunn County, ND': '025', + 'Eddy County, ND': '027', + 'Emmons County, ND': '029', + 'Foster County, ND': '031', + 'Golden Valley County, ND': '033', + 'Grand Forks County, ND': '035', + 'Grant County, ND': '037', + 'Griggs County, ND': '039', + 'Hettinger County, ND': '041', + 'Kidder County, ND': '043', + 'LaMoure County, ND': '045', + 'Logan County, ND': '047', + 'McHenry County, ND': '049', + 'McIntosh County, ND': '051', + 'McKenzie County, ND': '053', + 'McLean County, ND': '055', + 'Mercer County, ND': '057', + 'Morton County, ND': '059', + 'Mountrail County, ND': '061', + 'Nelson County, ND': '063', + 'Oliver County, ND': '065', + 'Pembina County, ND': '067', + 'Pierce County, ND': '069', + 'Ramsey County, ND': '071', + 'Ransom County, ND': '073', + 'Renville County, ND': '075', + 'Richland County, ND': '077', + 'Rolette County, ND': '079', + 'Sargent County, ND': '081', + 'Sheridan County, ND': '083', + 'Sioux County, ND': '085', + 'Slope County, ND': '087', + 'Stark County, ND': '089', + 'Steele County, ND': '091', + 'Stutsman County, ND': '093', + 'Towner County, ND': '095', + 'Traill County, ND': '097', + 'Walsh County, ND': '099', + 'Ward County, ND': '101', + 'Wells County, ND': '103', + 'Williams County, ND': '105'}, + '39': {'Adams County, OH': '001', + 'Allen County, OH': '003', + 'Ashland County, OH': '005', + 'Ashtabula County, OH': '007', + 'Athens County, OH': '009', + 'Auglaize County, OH': '011', + 'Belmont County, OH': '013', + 'Brown County, OH': '015', + 'Butler County, OH': '017', + 'Carroll County, OH': '019', + 'Champaign County, OH': '021', + 'Clark County, OH': '023', + 'Clermont County, OH': '025', + 'Clinton County, OH': '027', + 'Columbiana County, OH': '029', + 'Coshocton County, OH': '031', + 'Crawford County, OH': '033', + 'Cuyahoga County, OH': '035', + 'Darke County, OH': '037', + 'Defiance County, OH': '039', + 'Delaware County, OH': '041', + 'Erie County, OH': '043', + 'Fairfield County, OH': '045', + 'Fayette County, OH': '047', + 'Franklin County, OH': '049', + 'Fulton County, OH': '051', + 'Gallia County, OH': '053', + 'Geauga County, OH': '055', + 'Greene County, OH': '057', + 'Guernsey County, OH': '059', + 'Hamilton County, OH': '061', + 'Hancock County, OH': '063', + 'Hardin County, OH': '065', + 'Harrison County, OH': '067', + 'Henry County, OH': '069', + 'Highland County, OH': '071', + 'Hocking County, OH': '073', + 'Holmes County, OH': '075', + 'Huron County, OH': '077', + 'Jackson County, OH': '079', + 'Jefferson County, OH': '081', + 'Knox County, OH': '083', + 'Lake County, OH': '085', + 'Lawrence County, OH': '087', + 'Licking County, OH': '089', + 'Logan County, OH': '091', + 'Lorain County, OH': '093', + 'Lucas County, OH': '095', + 'Madison County, OH': '097', + 'Mahoning County, OH': '099', + 'Marion County, OH': '101', + 'Medina County, OH': '103', + 'Meigs County, OH': '105', + 'Mercer County, OH': '107', + 'Miami County, OH': '109', + 'Monroe County, OH': '111', + 'Montgomery County, OH': '113', + 'Morgan County, OH': '115', + 'Morrow County, OH': '117', + 'Muskingum County, OH': '119', + 'Noble County, OH': '121', + 'Ottawa County, OH': '123', + 'Paulding County, OH': '125', + 'Perry County, OH': '127', + 'Pickaway County, OH': '129', + 'Pike County, OH': '131', + 'Portage County, OH': '133', + 'Preble County, OH': '135', + 'Putnam County, OH': '137', + 'Richland County, OH': '139', + 'Ross County, OH': '141', + 'Sandusky County, OH': '143', + 'Scioto County, OH': '145', + 'Seneca County, OH': '147', + 'Shelby County, OH': '149', + 'Stark County, OH': '151', + 'Summit County, OH': '153', + 'Trumbull County, OH': '155', + 'Tuscarawas County, OH': '157', + 'Union County, OH': '159', + 'Van Wert County, OH': '161', + 'Vinton County, OH': '163', + 'Warren County, OH': '165', + 'Washington County, OH': '167', + 'Wayne County, OH': '169', + 'Williams County, OH': '171', + 'Wood County, OH': '173', + 'Wyandot County, OH': '175'}, + '40': {'Adair County, OK': '001', + 'Alfalfa County, OK': '003', + 'Atoka County, OK': '005', + 'Beaver County, OK': '007', + 'Beckham County, OK': '009', + 'Blaine County, OK': '011', + 'Bryan County, OK': '013', + 'Caddo County, OK': '015', + 'Canadian County, OK': '017', + 'Carter County, OK': '019', + 'Cherokee County, OK': '021', + 'Choctaw County, OK': '023', + 'Cimarron County, OK': '025', + 'Cleveland County, OK': '027', + 'Coal County, OK': '029', + 'Comanche County, OK': '031', + 'Cotton County, OK': '033', + 'Craig County, OK': '035', + 'Creek County, OK': '037', + 'Custer County, OK': '039', + 'Delaware County, OK': '041', + 'Dewey County, OK': '043', + 'Ellis County, OK': '045', + 'Garfield County, OK': '047', + 'Garvin County, OK': '049', + 'Grady County, OK': '051', + 'Grant County, OK': '053', + 'Greer County, OK': '055', + 'Harmon County, OK': '057', + 'Harper County, OK': '059', + 'Haskell County, OK': '061', + 'Hughes County, OK': '063', + 'Jackson County, OK': '065', + 'Jefferson County, OK': '067', + 'Johnston County, OK': '069', + 'Kay County, OK': '071', + 'Kingfisher County, OK': '073', + 'Kiowa County, OK': '075', + 'Latimer County, OK': '077', + 'Le Flore County, OK': '079', + 'Lincoln County, OK': '081', + 'Logan County, OK': '083', + 'Love County, OK': '085', + 'Major County, OK': '093', + 'Marshall County, OK': '095', + 'Mayes County, OK': '097', + 'McClain County, OK': '087', + 'McCurtain County, OK': '089', + 'McIntosh County, OK': '091', + 'Murray County, OK': '099', + 'Muskogee County, OK': '101', + 'Noble County, OK': '103', + 'Nowata County, OK': '105', + 'Okfuskee County, OK': '107', + 'Oklahoma County, OK': '109', + 'Okmulgee County, OK': '111', + 'Osage County, OK': '113', + 'Ottawa County, OK': '115', + 'Pawnee County, OK': '117', + 'Payne County, OK': '119', + 'Pittsburg County, OK': '121', + 'Pontotoc County, OK': '123', + 'Pottawatomie County, OK': '125', + 'Pushmataha County, OK': '127', + 'Roger Mills County, OK': '129', + 'Rogers County, OK': '131', + 'Seminole County, OK': '133', + 'Sequoyah County, OK': '135', + 'Stephens County, OK': '137', + 'Texas County, OK': '139', + 'Tillman County, OK': '141', + 'Tulsa County, OK': '143', + 'Wagoner County, OK': '145', + 'Washington County, OK': '147', + 'Washita County, OK': '149', + 'Woods County, OK': '151', + 'Woodward County, OK': '153'}, + '41': {'Baker County, OR': '001', + 'Benton County, OR': '003', + 'Clackamas County, OR': '005', + 'Clatsop County, OR': '007', + 'Columbia County, OR': '009', + 'Coos County, OR': '011', + 'Crook County, OR': '013', + 'Curry County, OR': '015', + 'Deschutes County, OR': '017', + 'Douglas County, OR': '019', + 'Gilliam County, OR': '021', + 'Grant County, OR': '023', + 'Harney County, OR': '025', + 'Hood River County, OR': '027', + 'Jackson County, OR': '029', + 'Jefferson County, OR': '031', + 'Josephine County, OR': '033', + 'Klamath County, OR': '035', + 'Lake County, OR': '037', + 'Lane County, OR': '039', + 'Lincoln County, OR': '041', + 'Linn County, OR': '043', + 'Malheur County, OR': '045', + 'Marion County, OR': '047', + 'Morrow County, OR': '049', + 'Multnomah County, OR': '051', + 'Polk County, OR': '053', + 'Sherman County, OR': '055', + 'Tillamook County, OR': '057', + 'Umatilla County, OR': '059', + 'Union County, OR': '061', + 'Wallowa County, OR': '063', + 'Wasco County, OR': '065', + 'Washington County, OR': '067', + 'Wheeler County, OR': '069', + 'Yamhill County, OR': '071'}, + '42': {'Adams County, PA': '001', + 'Allegheny County, PA': '003', + 'Armstrong County, PA': '005', + 'Beaver County, PA': '007', + 'Bedford County, PA': '009', + 'Berks County, PA': '011', + 'Blair County, PA': '013', + 'Bradford County, PA': '015', + 'Bucks County, PA': '017', + 'Butler County, PA': '019', + 'Cambria County, PA': '021', + 'Cameron County, PA': '023', + 'Carbon County, PA': '025', + 'Centre County, PA': '027', + 'Chester County, PA': '029', + 'Clarion County, PA': '031', + 'Clearfield County, PA': '033', + 'Clinton County, PA': '035', + 'Columbia County, PA': '037', + 'Crawford County, PA': '039', + 'Cumberland County, PA': '041', + 'Dauphin County, PA': '043', + 'Delaware County, PA': '045', + 'Elk County, PA': '047', + 'Erie County, PA': '049', + 'Fayette County, PA': '051', + 'Forest County, PA': '053', + 'Franklin County, PA': '055', + 'Fulton County, PA': '057', + 'Greene County, PA': '059', + 'Huntingdon County, PA': '061', + 'Indiana County, PA': '063', + 'Jefferson County, PA': '065', + 'Juniata County, PA': '067', + 'Lackawanna County, PA': '069', + 'Lancaster County, PA': '071', + 'Lawrence County, PA': '073', + 'Lebanon County, PA': '075', + 'Lehigh County, PA': '077', + 'Luzerne County, PA': '079', + 'Lycoming County, PA': '081', + 'McKean County, PA': '083', + 'Mercer County, PA': '085', + 'Mifflin County, PA': '087', + 'Monroe County, PA': '089', + 'Montgomery County, PA': '091', + 'Montour County, PA': '093', + 'Northampton County, PA': '095', + 'Northumberland County, PA': '097', + 'Perry County, PA': '099', + 'Philadelphia County/city, PA': '101', + 'Pike County, PA': '103', + 'Potter County, PA': '105', + 'Schuylkill County, PA': '107', + 'Snyder County, PA': '109', + 'Somerset County, PA': '111', + 'Sullivan County, PA': '113', + 'Susquehanna County, PA': '115', + 'Tioga County, PA': '117', + 'Union County, PA': '119', + 'Venango County, PA': '121', + 'Warren County, PA': '123', + 'Washington County, PA': '125', + 'Wayne County, PA': '127', + 'Westmoreland County, PA': '129', + 'Wyoming County, PA': '131', + 'York County, PA': '133'}, + '44': {'Bristol County, RI': '001', + 'Kent County, RI': '003', + 'Newport County, RI': '005', + 'Providence County, RI': '007', + 'Washington County, RI': '009'}, + '45': {'Abbeville County, SC': '001', + 'Aiken County, SC': '003', + 'Allendale County, SC': '005', + 'Anderson County, SC': '007', + 'Bamberg County, SC': '009', + 'Barnwell County, SC': '011', + 'Beaufort County, SC': '013', + 'Berkeley County, SC': '015', + 'Calhoun County, SC': '017', + 'Charleston County, SC': '019', + 'Cherokee County, SC': '021', + 'Chester County, SC': '023', + 'Chesterfield County, SC': '025', + 'Clarendon County, SC': '027', + 'Colleton County, SC': '029', + 'Darlington County, SC': '031', + 'Dillon County, SC': '033', + 'Dorchester County, SC': '035', + 'Edgefield County, SC': '037', + 'Fairfield County, SC': '039', + 'Florence County, SC': '041', + 'Georgetown County, SC': '043', + 'Greenville County, SC': '045', + 'Greenwood County, SC': '047', + 'Hampton County, SC': '049', + 'Horry County, SC': '051', + 'Jasper County, SC': '053', + 'Kershaw County, SC': '055', + 'Lancaster County, SC': '057', + 'Laurens County, SC': '059', + 'Lee County, SC': '061', + 'Lexington County, SC': '063', + 'Marion County, SC': '067', + 'Marlboro County, SC': '069', + 'McCormick County, SC': '065', + 'Newberry County, SC': '071', + 'Oconee County, SC': '073', + 'Orangeburg County, SC': '075', + 'Pickens County, SC': '077', + 'Richland County, SC': '079', + 'Saluda County, SC': '081', + 'Spartanburg County, SC': '083', + 'Sumter County, SC': '085', + 'Union County, SC': '087', + 'Williamsburg County, SC': '089', + 'York County, SC': '091'}, + '46': {'Aurora County, SD': '003', + 'Beadle County, SD': '005', + 'Bennett County, SD': '007', + 'Bon Homme County, SD': '009', + 'Brookings County, SD': '011', + 'Brown County, SD': '013', + 'Brule County, SD': '015', + 'Buffalo County, SD': '017', + 'Butte County, SD': '019', + 'Campbell County, SD': '021', + 'Charles Mix County, SD': '023', + 'Clark County, SD': '025', + 'Clay County, SD': '027', + 'Codington County, SD': '029', + 'Corson County, SD': '031', + 'Custer County, SD': '033', + 'Davison County, SD': '035', + 'Day County, SD': '037', + 'Deuel County, SD': '039', + 'Dewey County, SD': '041', + 'Douglas County, SD': '043', + 'Edmunds County, SD': '045', + 'Fall River County, SD': '047', + 'Faulk County, SD': '049', + 'Grant County, SD': '051', + 'Gregory County, SD': '053', + 'Haakon County, SD': '055', + 'Hamlin County, SD': '057', + 'Hand County, SD': '059', + 'Hanson County, SD': '061', + 'Harding County, SD': '063', + 'Hughes County, SD': '065', + 'Hutchinson County, SD': '067', + 'Hyde County, SD': '069', + 'Jackson County, SD': '071', + 'Jerauld County, SD': '073', + 'Jones County, SD': '075', + 'Kingsbury County, SD': '077', + 'Lake County, SD': '079', + 'Lawrence County, SD': '081', + 'Lincoln County, SD': '083', + 'Lyman County, SD': '085', + 'Marshall County, SD': '091', + 'McCook County, SD': '087', + 'McPherson County, SD': '089', + 'Meade County, SD': '093', + 'Mellette County, SD': '095', + 'Miner County, SD': '097', + 'Minnehaha County, SD': '099', + 'Moody County, SD': '101', + 'Pennington County, SD': '103', + 'Perkins County, SD': '105', + 'Potter County, SD': '107', + 'Roberts County, SD': '109', + 'Sanborn County, SD': '111', + 'Shannon County, SD': '113', + 'Spink County, SD': '115', + 'Stanley County, SD': '117', + 'Sully County, SD': '119', + 'Todd County, SD': '121', + 'Tripp County, SD': '123', + 'Turner County, SD': '125', + 'Union County, SD': '127', + 'Walworth County, SD': '129', + 'Yankton County, SD': '135', + 'Ziebach County, SD': '137'}, + '47': {'Anderson County, TN': '001', + 'Bedford County, TN': '003', + 'Benton County, TN': '005', + 'Bledsoe County, TN': '007', + 'Blount County, TN': '009', + 'Bradley County, TN': '011', + 'Campbell County, TN': '013', + 'Cannon County, TN': '015', + 'Carroll County, TN': '017', + 'Carter County, TN': '019', + 'Cheatham County, TN': '021', + 'Chester County, TN': '023', + 'Claiborne County, TN': '025', + 'Clay County, TN': '027', + 'Cocke County, TN': '029', + 'Coffee County, TN': '031', + 'Crockett County, TN': '033', + 'Cumberland County, TN': '035', + 'Davidson County, TN': '037', + 'DeKalb County, TN': '041', + 'Decatur County, TN': '039', + 'Dickson County, TN': '043', + 'Dyer County, TN': '045', + 'Fayette County, TN': '047', + 'Fentress County, TN': '049', + 'Franklin County, TN': '051', + 'Gibson County, TN': '053', + 'Giles County, TN': '055', + 'Grainger County, TN': '057', + 'Greene County, TN': '059', + 'Grundy County, TN': '061', + 'Hamblen County, TN': '063', + 'Hamilton County, TN': '065', + 'Hancock County, TN': '067', + 'Hardeman County, TN': '069', + 'Hardin County, TN': '071', + 'Hawkins County, TN': '073', + 'Haywood County, TN': '075', + 'Henderson County, TN': '077', + 'Henry County, TN': '079', + 'Hickman County, TN': '081', + 'Houston County, TN': '083', + 'Humphreys County, TN': '085', + 'Jackson County, TN': '087', + 'Jefferson County, TN': '089', + 'Johnson County, TN': '091', + 'Knox County, TN': '093', + 'Lake County, TN': '095', + 'Lauderdale County, TN': '097', + 'Lawrence County, TN': '099', + 'Lewis County, TN': '101', + 'Lincoln County, TN': '103', + 'Loudon County, TN': '105', + 'Macon County, TN': '111', + 'Madison County, TN': '113', + 'Marion County, TN': '115', + 'Marshall County, TN': '117', + 'Maury County, TN': '119', + 'McMinn County, TN': '107', + 'McNairy County, TN': '109', + 'Meigs County, TN': '121', + 'Monroe County, TN': '123', + 'Montgomery County, TN': '125', + 'Moore County, TN': '127', + 'Morgan County, TN': '129', + 'Obion County, TN': '131', + 'Overton County, TN': '133', + 'Perry County, TN': '135', + 'Pickett County, TN': '137', + 'Polk County, TN': '139', + 'Putnam County, TN': '141', + 'Rhea County, TN': '143', + 'Roane County, TN': '145', + 'Robertson County, TN': '147', + 'Rutherford County, TN': '149', + 'Scott County, TN': '151', + 'Sequatchie County, TN': '153', + 'Sevier County, TN': '155', + 'Shelby County, TN': '157', + 'Smith County, TN': '159', + 'Stewart County, TN': '161', + 'Sullivan County, TN': '163', + 'Sumner County, TN': '165', + 'Tipton County, TN': '167', + 'Trousdale County, TN': '169', + 'Unicoi County, TN': '171', + 'Union County, TN': '173', + 'Van Buren County, TN': '175', + 'Warren County, TN': '177', + 'Washington County, TN': '179', + 'Wayne County, TN': '181', + 'Weakley County, TN': '183', + 'White County, TN': '185', + 'Williamson County, TN': '187', + 'Wilson County, TN': '189'}, + '48': {'Anderson County, TX': '001', + 'Andrews County, TX': '003', + 'Angelina County, TX': '005', + 'Aransas County, TX': '007', + 'Archer County, TX': '009', + 'Armstrong County, TX': '011', + 'Atascosa County, TX': '013', + 'Austin County, TX': '015', + 'Bailey County, TX': '017', + 'Bandera County, TX': '019', + 'Bastrop County, TX': '021', + 'Baylor County, TX': '023', + 'Bee County, TX': '025', + 'Bell County, TX': '027', + 'Bexar County, TX': '029', + 'Blanco County, TX': '031', + 'Borden County, TX': '033', + 'Bosque County, TX': '035', + 'Bowie County, TX': '037', + 'Brazoria County, TX': '039', + 'Brazos County, TX': '041', + 'Brewster County, TX': '043', + 'Briscoe County, TX': '045', + 'Brooks County, TX': '047', + 'Brown County, TX': '049', + 'Burleson County, TX': '051', + 'Burnet County, TX': '053', + 'Caldwell County, TX': '055', + 'Calhoun County, TX': '057', + 'Callahan County, TX': '059', + 'Cameron County, TX': '061', + 'Camp County, TX': '063', + 'Carson County, TX': '065', + 'Cass County, TX': '067', + 'Castro County, TX': '069', + 'Chambers County, TX': '071', + 'Cherokee County, TX': '073', + 'Childress County, TX': '075', + 'Clay County, TX': '077', + 'Cochran County, TX': '079', + 'Coke County, TX': '081', + 'Coleman County, TX': '083', + 'Collin County, TX': '085', + 'Collingsworth County, TX': '087', + 'Colorado County, TX': '089', + 'Comal County, TX': '091', + 'Comanche County, TX': '093', + 'Concho County, TX': '095', + 'Cooke County, TX': '097', + 'Coryell County, TX': '099', + 'Cottle County, TX': '101', + 'Crane County, TX': '103', + 'Crockett County, TX': '105', + 'Crosby County, TX': '107', + 'Culberson County, TX': '109', + 'Dallam County, TX': '111', + 'Dallas County, TX': '113', + 'Dawson County, TX': '115', + 'DeWitt County, TX': '123', + 'Deaf Smith County, TX': '117', + 'Delta County, TX': '119', + 'Denton County, TX': '121', + 'Dickens County, TX': '125', + 'Dimmit County, TX': '127', + 'Donley County, TX': '129', + 'Duval County, TX': '131', + 'Eastland County, TX': '133', + 'Ector County, TX': '135', + 'Edwards County, TX': '137', + 'El Paso County, TX': '141', + 'Ellis County, TX': '139', + 'Erath County, TX': '143', + 'Falls County, TX': '145', + 'Fannin County, TX': '147', + 'Fayette County, TX': '149', + 'Fisher County, TX': '151', + 'Floyd County, TX': '153', + 'Foard County, TX': '155', + 'Fort Bend County, TX': '157', + 'Franklin County, TX': '159', + 'Freestone County, TX': '161', + 'Frio County, TX': '163', + 'Gaines County, TX': '165', + 'Galveston County, TX': '167', + 'Garza County, TX': '169', + 'Gillespie County, TX': '171', + 'Glasscock County, TX': '173', + 'Goliad County, TX': '175', + 'Gonzales County, TX': '177', + 'Gray County, TX': '179', + 'Grayson County, TX': '181', + 'Gregg County, TX': '183', + 'Grimes County, TX': '185', + 'Guadalupe County, TX': '187', + 'Hale County, TX': '189', + 'Hall County, TX': '191', + 'Hamilton County, TX': '193', + 'Hansford County, TX': '195', + 'Hardeman County, TX': '197', + 'Hardin County, TX': '199', + 'Harris County, TX': '201', + 'Harrison County, TX': '203', + 'Hartley County, TX': '205', + 'Haskell County, TX': '207', + 'Hays County, TX': '209', + 'Hemphill County, TX': '211', + 'Henderson County, TX': '213', + 'Hidalgo County, TX': '215', + 'Hill County, TX': '217', + 'Hockley County, TX': '219', + 'Hood County, TX': '221', + 'Hopkins County, TX': '223', + 'Houston County, TX': '225', + 'Howard County, TX': '227', + 'Hudspeth County, TX': '229', + 'Hunt County, TX': '231', + 'Hutchinson County, TX': '233', + 'Irion County, TX': '235', + 'Jack County, TX': '237', + 'Jackson County, TX': '239', + 'Jasper County, TX': '241', + 'Jeff Davis County, TX': '243', + 'Jefferson County, TX': '245', + 'Jim Hogg County, TX': '247', + 'Jim Wells County, TX': '249', + 'Johnson County, TX': '251', + 'Jones County, TX': '253', + 'Karnes County, TX': '255', + 'Kaufman County, TX': '257', + 'Kendall County, TX': '259', + 'Kenedy County, TX': '261', + 'Kent County, TX': '263', + 'Kerr County, TX': '265', + 'Kimble County, TX': '267', + 'King County, TX': '269', + 'Kinney County, TX': '271', + 'Kleberg County, TX': '273', + 'Knox County, TX': '275', + 'La Salle County, TX': '283', + 'Lamar County, TX': '277', + 'Lamb County, TX': '279', + 'Lampasas County, TX': '281', + 'Lavaca County, TX': '285', + 'Lee County, TX': '287', + 'Leon County, TX': '289', + 'Liberty County, TX': '291', + 'Limestone County, TX': '293', + 'Lipscomb County, TX': '295', + 'Live Oak County, TX': '297', + 'Llano County, TX': '299', + 'Loving County, TX': '301', + 'Lubbock County, TX': '303', + 'Lynn County, TX': '305', + 'Madison County, TX': '313', + 'Marion County, TX': '315', + 'Martin County, TX': '317', + 'Mason County, TX': '319', + 'Matagorda County, TX': '321', + 'Maverick County, TX': '323', + 'McCulloch County, TX': '307', + 'McLennan County, TX': '309', + 'McMullen County, TX': '311', + 'Medina County, TX': '325', + 'Menard County, TX': '327', + 'Midland County, TX': '329', + 'Milam County, TX': '331', + 'Mills County, TX': '333', + 'Mitchell County, TX': '335', + 'Montague County, TX': '337', + 'Montgomery County, TX': '339', + 'Moore County, TX': '341', + 'Morris County, TX': '343', + 'Motley County, TX': '345', + 'Nacogdoches County, TX': '347', + 'Navarro County, TX': '349', + 'Newton County, TX': '351', + 'Nolan County, TX': '353', + 'Nueces County, TX': '355', + 'Ochiltree County, TX': '357', + 'Oldham County, TX': '359', + 'Orange County, TX': '361', + 'Palo Pinto County, TX': '363', + 'Panola County, TX': '365', + 'Parker County, TX': '367', + 'Parmer County, TX': '369', + 'Pecos County, TX': '371', + 'Polk County, TX': '373', + 'Potter County, TX': '375', + 'Presidio County, TX': '377', + 'Rains County, TX': '379', + 'Randall County, TX': '381', + 'Reagan County, TX': '383', + 'Real County, TX': '385', + 'Red River County, TX': '387', + 'Reeves County, TX': '389', + 'Refugio County, TX': '391', + 'Roberts County, TX': '393', + 'Robertson County, TX': '395', + 'Rockwall County, TX': '397', + 'Runnels County, TX': '399', + 'Rusk County, TX': '401', + 'Sabine County, TX': '403', + 'San Augustine County, TX': '405', + 'San Jacinto County, TX': '407', + 'San Patricio County, TX': '409', + 'San Saba County, TX': '411', + 'Schleicher County, TX': '413', + 'Scurry County, TX': '415', + 'Shackelford County, TX': '417', + 'Shelby County, TX': '419', + 'Sherman County, TX': '421', + 'Smith County, TX': '423', + 'Somervell County, TX': '425', + 'Starr County, TX': '427', + 'Stephens County, TX': '429', + 'Sterling County, TX': '431', + 'Stonewall County, TX': '433', + 'Sutton County, TX': '435', + 'Swisher County, TX': '437', + 'Tarrant County, TX': '439', + 'Taylor County, TX': '441', + 'Terrell County, TX': '443', + 'Terry County, TX': '445', + 'Throckmorton County, TX': '447', + 'Titus County, TX': '449', + 'Tom Green County, TX': '451', + 'Travis County, TX': '453', + 'Trinity County, TX': '455', + 'Tyler County, TX': '457', + 'Upshur County, TX': '459', + 'Upton County, TX': '461', + 'Uvalde County, TX': '463', + 'Val Verde County, TX': '465', + 'Van Zandt County, TX': '467', + 'Victoria County, TX': '469', + 'Walker County, TX': '471', + 'Waller County, TX': '473', + 'Ward County, TX': '475', + 'Washington County, TX': '477', + 'Webb County, TX': '479', + 'Wharton County, TX': '481', + 'Wheeler County, TX': '483', + 'Wichita County, TX': '485', + 'Wilbarger County, TX': '487', + 'Willacy County, TX': '489', + 'Williamson County, TX': '491', + 'Wilson County, TX': '493', + 'Winkler County, TX': '495', + 'Wise County, TX': '497', + 'Wood County, TX': '499', + 'Yoakum County, TX': '501', + 'Young County, TX': '503', + 'Zapata County, TX': '505', + 'Zavala County, TX': '507'}, + '49': {'Beaver County, UT': '001', + 'Box Elder County, UT': '003', + 'Cache County, UT': '005', + 'Carbon County, UT': '007', + 'Daggett County, UT': '009', + 'Davis County, UT': '011', + 'Duchesne County, UT': '013', + 'Emery County, UT': '015', + 'Garfield County, UT': '017', + 'Grand County, UT': '019', + 'Iron County, UT': '021', + 'Juab County, UT': '023', + 'Kane County, UT': '025', + 'Millard County, UT': '027', + 'Morgan County, UT': '029', + 'Piute County, UT': '031', + 'Rich County, UT': '033', + 'Salt Lake County, UT': '035', + 'San Juan County, UT': '037', + 'Sanpete County, UT': '039', + 'Sevier County, UT': '041', + 'Summit County, UT': '043', + 'Tooele County, UT': '045', + 'Uintah County, UT': '047', + 'Utah County, UT': '049', + 'Wasatch County, UT': '051', + 'Washington County, UT': '053', + 'Wayne County, UT': '055', + 'Weber County, UT': '057'}, + '50': {'Addison County, VT': '001', + 'Bennington County, VT': '003', + 'Caledonia County, VT': '005', + 'Chittenden County, VT': '007', + 'Essex County, VT': '009', + 'Franklin County, VT': '011', + 'Grand Isle County, VT': '013', + 'Lamoille County, VT': '015', + 'Orange County, VT': '017', + 'Orleans County, VT': '019', + 'Rutland County, VT': '021', + 'Washington County, VT': '023', + 'Windham County, VT': '025', + 'Windsor County, VT': '027'}, + '51': {'Accomack County, VA': '001', + 'Albemarle County, VA': '003', + 'Alexandria city, VA': '510', + 'Alleghany County, VA': '005', + 'Amelia County, VA': '007', + 'Amherst County, VA': '009', + 'Appomattox County, VA': '011', + 'Arlington County, VA': '013', + 'Augusta County, VA': '015', + 'Bath County, VA': '017', + 'Bedford County, VA': '019', + 'Bedford city, VA': '515', + 'Bland County, VA': '021', + 'Botetourt County, VA': '023', + 'Bristol city, VA': '520', + 'Brunswick County, VA': '025', + 'Buchanan County, VA': '027', + 'Buckingham County, VA': '029', + 'Buena Vista city, VA': '530', + 'Campbell County, VA': '031', + 'Caroline County, VA': '033', + 'Carroll County, VA': '035', + 'Charles City County, VA': '036', + 'Charlotte County, VA': '037', + 'Charlottesville city, VA': '540', + 'Chesapeake city, VA': '550', + 'Chesterfield County, VA': '041', + 'Clarke County, VA': '043', + 'Colonial Heights city, VA': '570', + 'Covington city, VA': '580', + 'Craig County, VA': '045', + 'Culpeper County, VA': '047', + 'Cumberland County, VA': '049', + 'Danville city, VA': '590', + 'Dickenson County, VA': '051', + 'Dinwiddie County, VA': '053', + 'Emporia city, VA': '595', + 'Essex County, VA': '057', + 'Fairfax County, VA': '059', + 'Fairfax city, VA': '600', + 'Falls Church city, VA': '610', + 'Fauquier County, VA': '061', + 'Floyd County, VA': '063', + 'Fluvanna County, VA': '065', + 'Franklin County, VA': '067', + 'Franklin city, VA': '620', + 'Frederick County, VA': '069', + 'Fredericksburg city, VA': '630', + 'Galax city, VA': '640', + 'Giles County, VA': '071', + 'Gloucester County, VA': '073', + 'Goochland County, VA': '075', + 'Grayson County, VA': '077', + 'Greene County, VA': '079', + 'Greensville County, VA': '081', + 'Halifax County, VA': '083', + 'Hampton city, VA': '650', + 'Hanover County, VA': '085', + 'Harrisonburg city, VA': '660', + 'Henrico County, VA': '087', + 'Henry County, VA': '089', + 'Highland County, VA': '091', + 'Hopewell city, VA': '670', + 'Isle of Wight County, VA': '093', + 'James City County, VA': '095', + 'King George County, VA': '099', + 'King William County, VA': '101', + 'King and Queen County, VA': '097', + 'Lancaster County, VA': '103', + 'Lee County, VA': '105', + 'Lexington city, VA': '678', + 'Loudoun County, VA': '107', + 'Louisa County, VA': '109', + 'Lunenburg County, VA': '111', + 'Lynchburg city, VA': '680', + 'Madison County, VA': '113', + 'Manassas Park city, VA': '685', + 'Manassas city, VA': '683', + 'Martinsville city, VA': '690', + 'Mathews County, VA': '115', + 'Mecklenburg County, VA': '117', + 'Middlesex County, VA': '119', + 'Montgomery County, VA': '121', + 'Nelson County, VA': '125', + 'New Kent County, VA': '127', + 'Newport News city, VA': '700', + 'Norfolk city, VA': '710', + 'Northampton County, VA': '131', + 'Northumberland County, VA': '133', + 'Norton city, VA': '720', + 'Nottoway County, VA': '135', + 'Orange County, VA': '137', + 'Page County, VA': '139', + 'Patrick County, VA': '141', + 'Petersburg city, VA': '730', + 'Pittsylvania County, VA': '143', + 'Poquoson city, VA': '735', + 'Portsmouth city, VA': '740', + 'Powhatan County, VA': '145', + 'Prince Edward County, VA': '147', + 'Prince George County, VA': '149', + 'Prince William County, VA': '153', + 'Pulaski County, VA': '155', + 'Radford city, VA': '750', + 'Rappahannock County, VA': '157', + 'Richmond County, VA': '159', + 'Richmond city, VA': '760', + 'Roanoke County, VA': '161', + 'Roanoke city, VA': '770', + 'Rockbridge County, VA': '163', + 'Rockingham County, VA': '165', + 'Russell County, VA': '167', + 'Salem city, VA': '775', + 'Scott County, VA': '169', + 'Shenandoah County, VA': '171', + 'Smyth County, VA': '173', + 'Southampton County, VA': '175', + 'Spotsylvania County, VA': '177', + 'Stafford County, VA': '179', + 'Staunton city, VA': '790', + 'Suffolk city, VA': '800', + 'Surry County, VA': '181', + 'Sussex County, VA': '183', + 'Tazewell County, VA': '185', + 'Virginia Beach city, VA': '810', + 'Warren County, VA': '187', + 'Washington County, VA': '191', + 'Waynesboro city, VA': '820', + 'Westmoreland County, VA': '193', + 'Williamsburg city, VA': '830', + 'Winchester city, VA': '840', + 'Wise County, VA': '195', + 'Wythe County, VA': '197', + 'York County, VA': '199'}, + '53': {'Adams County, WA': '001', + 'Asotin County, WA': '003', + 'Benton County, WA': '005', + 'Chelan County, WA': '007', + 'Clallam County, WA': '009', + 'Clark County, WA': '011', + 'Columbia County, WA': '013', + 'Cowlitz County, WA': '015', + 'Douglas County, WA': '017', + 'Ferry County, WA': '019', + 'Franklin County, WA': '021', + 'Garfield County, WA': '023', + 'Grant County, WA': '025', + 'Grays Harbor County, WA': '027', + 'Island County, WA': '029', + 'Jefferson County, WA': '031', + 'King County, WA': '033', + 'Kitsap County, WA': '035', + 'Kittitas County, WA': '037', + 'Klickitat County, WA': '039', + 'Lewis County, WA': '041', + 'Lincoln County, WA': '043', + 'Mason County, WA': '045', + 'Okanogan County, WA': '047', + 'Pacific County, WA': '049', + 'Pend Oreille County, WA': '051', + 'Pierce County, WA': '053', + 'San Juan County, WA': '055', + 'Skagit County, WA': '057', + 'Skamania County, WA': '059', + 'Snohomish County, WA': '061', + 'Spokane County, WA': '063', + 'Stevens County, WA': '065', + 'Thurston County, WA': '067', + 'Wahkiakum County, WA': '069', + 'Walla Walla County, WA': '071', + 'Whatcom County, WA': '073', + 'Whitman County, WA': '075', + 'Yakima County, WA': '077'}, + '54': {'Barbour County, WV': '001', + 'Berkeley County, WV': '003', + 'Boone County, WV': '005', + 'Braxton County, WV': '007', + 'Brooke County, WV': '009', + 'Cabell County, WV': '011', + 'Calhoun County, WV': '013', + 'Clay County, WV': '015', + 'Doddridge County, WV': '017', + 'Fayette County, WV': '019', + 'Gilmer County, WV': '021', + 'Grant County, WV': '023', + 'Greenbrier County, WV': '025', + 'Hampshire County, WV': '027', + 'Hancock County, WV': '029', + 'Hardy County, WV': '031', + 'Harrison County, WV': '033', + 'Jackson County, WV': '035', + 'Jefferson County, WV': '037', + 'Kanawha County, WV': '039', + 'Lewis County, WV': '041', + 'Lincoln County, WV': '043', + 'Logan County, WV': '045', + 'Marion County, WV': '049', + 'Marshall County, WV': '051', + 'Mason County, WV': '053', + 'McDowell County, WV': '047', + 'Mercer County, WV': '055', + 'Mineral County, WV': '057', + 'Mingo County, WV': '059', + 'Monongalia County, WV': '061', + 'Monroe County, WV': '063', + 'Morgan County, WV': '065', + 'Nicholas County, WV': '067', + 'Ohio County, WV': '069', + 'Pendleton County, WV': '071', + 'Pleasants County, WV': '073', + 'Pocahontas County, WV': '075', + 'Preston County, WV': '077', + 'Putnam County, WV': '079', + 'Raleigh County, WV': '081', + 'Randolph County, WV': '083', + 'Ritchie County, WV': '085', + 'Roane County, WV': '087', + 'Summers County, WV': '089', + 'Taylor County, WV': '091', + 'Tucker County, WV': '093', + 'Tyler County, WV': '095', + 'Upshur County, WV': '097', + 'Wayne County, WV': '099', + 'Webster County, WV': '101', + 'Wetzel County, WV': '103', + 'Wirt County, WV': '105', + 'Wood County, WV': '107', + 'Wyoming County, WV': '109'}, + '55': {'Adams County, WI': '001', + 'Ashland County, WI': '003', + 'Barron County, WI': '005', + 'Bayfield County, WI': '007', + 'Brown County, WI': '009', + 'Buffalo County, WI': '011', + 'Burnett County, WI': '013', + 'Calumet County, WI': '015', + 'Chippewa County, WI': '017', + 'Clark County, WI': '019', + 'Columbia County, WI': '021', + 'Crawford County, WI': '023', + 'Dane County, WI': '025', + 'Dodge County, WI': '027', + 'Door County, WI': '029', + 'Douglas County, WI': '031', + 'Dunn County, WI': '033', + 'Eau Claire County, WI': '035', + 'Florence County, WI': '037', + 'Fond du Lac County, WI': '039', + 'Forest County, WI': '041', + 'Grant County, WI': '043', + 'Green County, WI': '045', + 'Green Lake County, WI': '047', + 'Iowa County, WI': '049', + 'Iron County, WI': '051', + 'Jackson County, WI': '053', + 'Jefferson County, WI': '055', + 'Juneau County, WI': '057', + 'Kenosha County, WI': '059', + 'Kewaunee County, WI': '061', + 'La Crosse County, WI': '063', + 'Lafayette County, WI': '065', + 'Langlade County, WI': '067', + 'Lincoln County, WI': '069', + 'Manitowoc County, WI': '071', + 'Marathon County, WI': '073', + 'Marinette County, WI': '075', + 'Marquette County, WI': '077', + 'Menominee County, WI': '078', + 'Milwaukee County, WI': '079', + 'Monroe County, WI': '081', + 'Oconto County, WI': '083', + 'Oneida County, WI': '085', + 'Outagamie County, WI': '087', + 'Ozaukee County, WI': '089', + 'Pepin County, WI': '091', + 'Pierce County, WI': '093', + 'Polk County, WI': '095', + 'Portage County, WI': '097', + 'Price County, WI': '099', + 'Racine County, WI': '101', + 'Richland County, WI': '103', + 'Rock County, WI': '105', + 'Rusk County, WI': '107', + 'Sauk County, WI': '111', + 'Sawyer County, WI': '113', + 'Shawano County, WI': '115', + 'Sheboygan County, WI': '117', + 'St. Croix County, WI': '109', + 'Taylor County, WI': '119', + 'Trempealeau County, WI': '121', + 'Vernon County, WI': '123', + 'Vilas County, WI': '125', + 'Walworth County, WI': '127', + 'Washburn County, WI': '129', + 'Washington County, WI': '131', + 'Waukesha County, WI': '133', + 'Waupaca County, WI': '135', + 'Waushara County, WI': '137', + 'Winnebago County, WI': '139', + 'Wood County, WI': '141'}, + '56': {'Albany County, WY': '001', + 'Big Horn County, WY': '003', + 'Campbell County, WY': '005', + 'Carbon County, WY': '007', + 'Converse County, WY': '009', + 'Crook County, WY': '011', + 'Fremont County, WY': '013', + 'Goshen County, WY': '015', + 'Hot Springs County, WY': '017', + 'Johnson County, WY': '019', + 'Laramie County, WY': '021', + 'Lincoln County, WY': '023', + 'Natrona County, WY': '025', + 'Niobrara County, WY': '027', + 'Park County, WY': '029', + 'Platte County, WY': '031', + 'Sheridan County, WY': '033', + 'Sublette County, WY': '035', + 'Sweetwater County, WY': '037', + 'Teton County, WY': '039', + 'Uinta County, WY': '041', + 'Washakie County, WY': '043', + 'Weston County, WY': '045'}, + '72': {'Adjuntas Municipio, PR': '001', + 'Aguada Municipio, PR': '003', + 'Aguadilla Municipio, PR': '005', + 'Aguas Buenas Municipio, PR': '007', + 'Aibonito Municipio, PR': '009', + 'Anasco Municipio, PR': '011', + 'Arecibo Municipio, PR': '013', + 'Arroyo Municipio, PR': '015', + 'Barceloneta Municipio, PR': '017', + 'Barranquitas Municipio, PR': '019', + 'Bayamon Municipio, PR': '021', + 'Cabo Rojo Municipio, PR': '023', + 'Caguas Municipio, PR': '025', + 'Camuy Municipio, PR': '027', + 'Canovanas Municipio, PR': '029', + 'Carolina Municipio, PR': '031', + 'Catano Municipio, PR': '033', + 'Cayey Municipio, PR': '035', + 'Ceiba Municipio, PR': '037', + 'Ciales Municipio, PR': '039', + 'Cidra Municipio, PR': '041', + 'Coamo Municipio, PR': '043', + 'Comerio Municipio, PR': '045', + 'Corozal Municipio, PR': '047', + 'Culebra Municipio, PR': '049', + 'Dorado Municipio, PR': '051', + 'Fajardo Municipio, PR': '053', + 'Florida Municipio, PR': '054', + 'Guanica Municipio, PR': '055', + 'Guayama Municipio, PR': '057', + 'Guayanilla Municipio, PR': '059', + 'Guaynabo Municipio, PR': '061', + 'Gurabo Municipio, PR': '063', + 'Hatillo Municipio, PR': '065', + 'Hormigueros Municipio, PR': '067', + 'Humacao Municipio, PR': '069', + 'Isabela Municipio, PR': '071', + 'Jayuya Municipio, PR': '073', + 'Juana Diaz Municipio, PR': '075', + 'Juncos Municipio, PR': '077', + 'Lajas Municipio, PR': '079', + 'Lares Municipio, PR': '081', + 'Las Marias Municipio, PR': '083', + 'Las Piedras Municipio, PR': '085', + 'Loiza Municipio, PR': '087', + 'Luquillo Municipio, PR': '089', + 'Manati Municipio, PR': '091', + 'Maricao Municipio, PR': '093', + 'Maunabo Municipio, PR': '095', + 'Mayaguez Municipio, PR': '097', + 'Moca Municipio, PR': '099', + 'Morovis Municipio, PR': '101', + 'Naguabo Municipio, PR': '103', + 'Naranjito Municipio, PR': '105', + 'Orocovis Municipio, PR': '107', + 'Patillas Municipio, PR': '109', + 'Penuelas Municipio, PR': '111', + 'Ponce Municipio, PR': '113', + 'Quebradillas Municipio, PR': '115', + 'Rincon Municipio, PR': '117', + 'Rio Grande Municipio, PR': '119', + 'Sabana Grande Municipio, PR': '121', + 'Salinas Municipio, PR': '123', + 'San German Municipio, PR': '125', + 'San Juan Municipio, PR': '127', + 'San Lorenzo Municipio, PR': '129', + 'San Sebastian Municipio, PR': '131', + 'Santa Isabel Municipio, PR': '133', + 'Toa Alta Municipio, PR': '135', + 'Toa Baja Municipio, PR': '137', + 'Trujillo Alto Municipio, PR': '139', + 'Utuado Municipio, PR': '141', + 'Vega Alta Municipio, PR': '143', + 'Vega Baja Municipio, PR': '145', + 'Vieques Municipio, PR': '147', + 'Villalba Municipio, PR': '149', + 'Yabucoa Municipio, PR': '151', + 'Yauco Municipio, PR': '153'}, + "CA01": {'--All--': '%', }, + "CA02": {'--All--': '%', }, + "CA03": {'--All--': '%', }, + "CA04": {'--All--': '%', }, + "CA05": {'--All--': '%', }, + "CA13": {'--All--': '%', }, + "CA07": {'--All--': '%', }, + "CA14": {'--All--': '%', }, + "CA08": {'--All--': '%', }, + "CA09": {'--All--': '%', }, + "CA10": {'--All--': '%', }, + "CA11": {'--All--': '%', }, + "CA12": {'--All--': '%', }, +} + + +def fips_to_state(fips_code): + if isinstance(fips_code, str) and fips_code.isdigit(): + fips_code = int(fips_code) + for state, code in FIPS_STATES.items(): + if code == fips_code: + return state + raise KeyError('No state found for fips %r' % fips_code) + + +def state_name_to_abbrev(state): + fipscode = FIPS_STATES[state] + firstcounty = sorted(FIPS_COUNTIES[fipscode].keys())[1] + return firstcounty.rsplit(',')[-1].strip() + + +if __name__ == "__main__": + from sys import argv + from pprint import PrettyPrinter + pp = PrettyPrinter(indent=2) + + import csv + fipsreader = csv.reader(open(argv[1], 'rb'), delimiter=',', quotechar='"') + for row in fipsreader: + try: + FIPS_COUNTIES[int(row[1])][row[3]] = row[2] + except KeyError: + FIPS_COUNTIES[int(row[1])] = {'--All--': '%'} + FIPS_COUNTIES[int(row[1])][row[3]] = row[2] + + pp.pprint(FIPS_COUNTIES) diff --git a/chirp/wxui/main.py b/chirp/wxui/main.py index e08a21a..7bd3795 100644 --- a/chirp/wxui/main.py +++ b/chirp/wxui/main.py @@ -1,8 +1,33 @@ +# Copyright 2022 Dan Smith +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + import datetime import functools +import hashlib import logging import os +import pickle +import platform import sys +import time +import webbrowser + +if sys.version_info < (3, 10): + import importlib_resources +else: + import importlib.resources as importlib_resources import wx import wx.aui @@ -11,19 +36,24 @@ import wx.lib.newevent from chirp import bandplan from chirp import chirp_common from chirp import directory -from chirp import platform -from chirp.ui import config +from chirp import errors +from chirp import logger +from chirp import platform as chirp_platform +from chirp.sources import base +from chirp.wxui import config +from chirp.wxui import bankedit from chirp.wxui import common from chirp.wxui import clone from chirp.wxui import developer from chirp.wxui import memedit +from chirp.wxui import printing from chirp.wxui import query_sources +from chirp.wxui import radioinfo from chirp.wxui import radiothread +from chirp.wxui import report from chirp.wxui import settingsedit from chirp import CHIRP_VERSION -from fnmatch import fnmatch - EditorSetChanged, EVT_EDITORSET_CHANGED = wx.lib.newevent.NewCommandEvent() CONF = config.get() LOG = logging.getLogger(__name__) @@ -32,20 +62,97 @@ EMPTY_MENU_LABEL = '(none)' KEEP_RECENT = 8 OPEN_RECENT_MENU = None OPEN_STOCK_CONFIG_MENU = None +CHIRP_TAB_DF = wx.DataFormat('x-chirp/file-tab') +ALL_MAIN_WINDOWS = [] +REVEAL_STOCK_DIR = wx.NewId() + + +def get_stock_configs(): + default_dir = chirp_platform.get_platform().config_file( + "stock_configs") + prefs_dir = CONF.get('stock_configs', 'prefs') + return prefs_dir or default_dir + + +class ChirpDropTarget(wx.DropTarget): + def __init__(self, chirpmain): + super().__init__() + self._main = chirpmain + self.data = wx.DataObjectComposite() + tab_df = wx.CustomDataObject(CHIRP_TAB_DF) + self.data.Add(tab_df) + self.SetDataObject(self.data) + self.SetDefaultAction(wx.DragMove) + + def move_tab(self, source_window, index, target_index): + LOG.debug('Moving page %i to %i', index, target_index) + source = source_window._editors + eset = source.GetPage(index) + source.RemovePage(index) + eset.Reparent(self._main._editors) + self._main.add_editorset(eset, atindex=( + target_index if target_index >= 0 else None)) + + def handle_tab_data(self, x, y): + tab_data = self.data.GetObject(CHIRP_TAB_DF) + src_wid, index = pickle.loads(tab_data.GetData().tobytes()) + source_window = self._main.FindWindowById(src_wid) + try: + target_index, flags = self._main._editors.HitTest(wx.Point(x, y)) + except wx._core.wxAssertionError: + # Apparently AUINotebook has no HitTest implementation on Linux + LOG.warning('Unable to perform HitTest on target: ' + 'no reordering possible') + if source_window is self._main: + # Defeat drag-to-self on this platform entirely since it is + # meaningless + return wx.DragNone + # Default to append since we cannot define an order + target_index = -1 + if source_window is self._main and index == target_index: + LOG.debug('Drag to self without reorder') + return wx.DragNone + self.move_tab(source_window, index, target_index) + return wx.DragMove + + def OnData(self, x, y, defResult): + if self.GetData(): + format = self.data.GetReceivedFormat().GetId() + if format == CHIRP_TAB_DF.GetId(): + return self.handle_tab_data(x, y) + + return wx.DragNone + + def OnDrop(self, x, y): + self._main.add_tab_panel.Hide() + return True + + def OnEnter(self, x, y, defResult): + self._main.add_tab_panel.SetSize(self._main._editors.GetSize()) + self._main.add_tab_panel.Show() + return defResult + + def OnLeave(self): + self._main.add_tab_panel.Hide() + return super().OnLeave() class ChirpEditorSet(wx.Panel): MEMEDIT_CLS = memedit.ChirpMemEdit SETTINGS_CLS = settingsedit.ChirpCloneSettingsEdit + BANK_CLS = bankedit.ChirpBankEditSync @property def tab_name(self): + if isinstance(self._radio, base.NetworkResultRadio): + return self._radio.get_label() return '%s.%s' % (self.default_filename, self._radio.FILE_EXTENSION) def add_editor(self, editor, title): self._editors.AddPage(editor, title) self.Bind(common.EVT_STATUS_MESSAGE, self._editor_status, editor) + self._editor_index[title] = editor def _editor_status(self, event): LOG.info('Editor status: %s' % event.message) @@ -61,39 +168,70 @@ class ChirpEditorSet(wx.Panel): self._filename = filename self._modified = not os.path.exists(filename) - self._editors = wx.Notebook(self, style=wx.NB_TOP) - - self._editors.Bind(wx.EVT_NOTEBOOK_PAGE_CHANGING, - self._editor_selected) - - sizer = wx.BoxSizer() - sizer.Add(self._editors, 1, wx.EXPAND) - self.SetSizer(sizer) + self._editor_index = {} features = radio.get_features() parent_radio = radio if features.has_sub_devices: radios = radio.get_sub_devices() - format = 'Memories (%(variant)s)' + format = '%(type)s (%(variant)s)' + if isinstance(parent_radio, chirp_common.ExternalMemoryProperties): + parent_radio.link_device_metadata(radios) else: radios = [radio] - format = 'Memories' + format = '%(type)s' + + if len(radios) > 2: + LOG.info('Using TreeBook because radio has %i devices', + len(radios)) + self._editors = wx.Treebook(self, style=wx.NB_RIGHT) + self._editors.Bind(wx.EVT_TREEBOOK_PAGE_CHANGED, + self._editor_selected) + else: + self._editors = wx.Notebook(self, style=wx.NB_TOP) + self._editors.Bind(wx.EVT_NOTEBOOK_PAGE_CHANGED, + self._editor_selected) + + sizer = wx.BoxSizer() + sizer.Add(self._editors, 1, wx.EXPAND) + self.SetSizer(sizer) for radio in radios: edit = self.MEMEDIT_CLS(radio, self._editors) - self.add_editor(edit, format % {'variant': radio.VARIANT}) + self.add_editor(edit, format % {'type': _('Memories'), + 'variant': radio.VARIANT}) edit.refresh() self.Bind(common.EVT_EDITOR_CHANGED, self._editor_changed) + sub_features = radio.get_features() + if sub_features.has_bank and self.BANK_CLS: + banks = self.BANK_CLS(radio, self._editors) + self.add_editor(banks, format % {'type': _('Banks'), + 'variant': radio.VARIANT}) + if features.has_settings: settings = self.SETTINGS_CLS(parent_radio, self._editors) - self.add_editor(settings, 'Settings') + self.add_editor(settings, _('Settings')) if (CONF.get_bool('developer', 'state') and - not isinstance(radio, chirp_common.LiveRadio)): + isinstance(radio, chirp_common.CloneModeRadio)): browser = developer.ChirpRadioBrowser(parent_radio, self._editors) - self.add_editor(browser, 'Browser') + browser.Bind(common.EVT_EDITOR_CHANGED, self._refresh_all) + self.add_editor(browser, _('Browser')) + info = radioinfo.ChirpRadioInfo(parent_radio, self._editors) + self.add_editor(info, _('Info')) + + # After the GUI is built, set focus to the current editor + wx.CallAfter(self.current_editor.SetFocus) + + def _refresh_all(self, event): + LOG.info('Radio browser changed; refreshing all others') + for i in range(self._editors.GetPageCount()): + editor = self._editors.GetPage(i) + if editor.GetId() != event.GetId(): + LOG.debug('refreshing %s' % editor) + editor.refresh() def _editor_changed(self, event): self._modified = True @@ -103,6 +241,7 @@ class ChirpEditorSet(wx.Panel): page_index = event.GetSelection() page = self._editors.GetPage(page_index) page.selected() + wx.PostEvent(self, EditorSetChanged(self.GetId(), editorset=self)) def save(self, filename=None): if filename is None: @@ -111,8 +250,7 @@ class ChirpEditorSet(wx.Panel): self._radio.save(filename) self._filename = filename self._modified = False - # FIXME - self._editors.GetPage(1).saved() + self.current_editor.saved() @property def filename(self): @@ -120,6 +258,8 @@ class ChirpEditorSet(wx.Panel): @property def modified(self): + if isinstance(self._radio, base.NetworkResultRadio): + return False return self._modified @property @@ -145,14 +285,30 @@ class ChirpEditorSet(wx.Panel): def current_editor_index(self): return self._editors.GetSelection() - def select_editor(self, index): + def select_editor(self, index=None, name=None): + if index is None and name: + try: + index = self._editors.FindPage(self._editor_index[name]) + except KeyError: + LOG.error('No editor %r to select' % name) + return + if index is None: + LOG.error('Unable to find editor to select (%r/%r', + index, name) + return self._editors.SetSelection(index) def cb_copy(self, cut=False): return self.current_editor.cb_copy(cut=cut) - def cb_paste(self, data): - return self.current_editor.cb_paste(data) + def cb_paste(self): + return self.current_editor.cb_paste() + + def cb_delete(self): + return self.current_editor.cb_delete() + + def cb_find(self, text): + return self.current_editor.cb_find(text) def select_all(self): return self.current_editor.select_all() @@ -160,31 +316,82 @@ class ChirpEditorSet(wx.Panel): def close(self): pass + @common.error_proof() + def export_to_file(self, filename): + current = self.current_editor + if not isinstance(current, memedit.ChirpMemEdit): + raise Exception(_('Only memory tabs may be exported')) + current.export_to_file(filename) + + def update_font(self): + for i in range(0, self._editors.PageCount): + editor = self._editors.GetPage(i) + editor.update_font() + class ChirpLiveEditorSet(ChirpEditorSet): MEMEDIT_CLS = memedit.ChirpLiveMemEdit SETTINGS_CLS = settingsedit.ChirpLiveSettingsEdit + BANK_CLS = None @property def tab_name(self): - return '%s %s@LIVE' % (self._radio.VENDOR, - self._radio.MODEL) + return '%s %s@%s' % (self._radio.VENDOR, + self._radio.MODEL, + _('LIVE')) def __init__(self, radio, *a, **k): - self._radio_thread = radiothread.RadioThread(radio) - self._radio_thread.start() + self._threads = [] super().__init__(radio, *a, **k) def add_editor(self, editor, title): super(ChirpLiveEditorSet, self).add_editor(editor, title) - editor.set_radio_thread(self._radio_thread) + thread = radiothread.RadioThread(editor._radio) + thread.start() + self._threads.append(thread) + editor.set_radio_thread(thread) + + def close(self): + for thread in self._threads: + thread.end() + try: + self._radio.pipe.close() + except Exception as e: + LOG.exception('Failed to close %s: %s', self._radio.pipe, e) + else: + LOG.debug('Closed %s', self._radio.pipe) + + @property + def modified(self): + return any(t.pending != 0 for t in self._threads) + + +class ChirpWelcomePanel(wx.Panel): + """Fake "editorset" that just displays the welcome image.""" + def __init__(self, *a, **k): + super(ChirpWelcomePanel, self).__init__(*a, **k) + + vbox = wx.BoxSizer(wx.VERTICAL) + self.SetSizer(vbox) + with importlib_resources.as_file( + importlib_resources.files('chirp.share') + .joinpath('welcome_screen.png') + ) as welcome: + bmp = wx.Bitmap(str(welcome)) + width, height = self.GetSize() + img = wx.StaticBitmap(self, wx.ID_ANY, bmp) + vbox.Add(img, 1, flag=wx.EXPAND) def close(self): - self._radio_thread.end() + pass @property def modified(self): - return self._radio_thread.pending != 0 + return False + + @property + def filename(self): + return None class ChirpMain(wx.Frame): @@ -193,10 +400,20 @@ class ChirpMain(wx.Frame): self.SetSize(int(CONF.get('window_w', 'state') or 1024), int(CONF.get('window_h', 'state') or 768)) + if not ALL_MAIN_WINDOWS and CONF.is_defined('window_x', 'state'): + # Only restore position for the first window of the session + self.SetPosition((CONF.get_int('window_x', 'state'), + CONF.get_int('window_y', 'state'))) + + ALL_MAIN_WINDOWS.append(self) + + self.set_icon() + self._drop_target = ChirpDropTarget(self) + self.SetDropTarget(self._drop_target) d = CONF.get('last_dir', 'state') if d and os.path.isdir(d): - platform.get_platform().set_last_dir(d) + chirp_platform.get_platform().set_last_dir(d) self.SetMenuBar(self.make_menubar()) @@ -206,68 +423,257 @@ class ChirpMain(wx.Frame): self._editors = wx.aui.AuiNotebook( self, - style=wx.aui.AUI_NB_CLOSE_ON_ALL_TABS | wx.aui.AUI_NB_TAB_MOVE) + style=(wx.aui.AUI_NB_CLOSE_ON_ALL_TABS | + wx.aui.AUI_NB_SCROLL_BUTTONS | + wx.aui.AUI_NB_WINDOWLIST_BUTTON)) + + if len(ALL_MAIN_WINDOWS) == 1: + # Only add the welcome page to the first window opened + welcome_page = ChirpWelcomePanel(self._editors) + self._editors.AddPage(welcome_page, _('Welcome'), select=True) + self.Bind(wx.aui.EVT_AUINOTEBOOK_PAGE_CLOSE, self._editor_close) self.Bind(wx.aui.EVT_AUINOTEBOOK_PAGE_CHANGED, self._editor_page_changed) + self._editors.Bind(wx.aui.EVT_AUINOTEBOOK_BEGIN_DRAG, self._tab_drag) + self._editors.Bind(wx.aui.EVT_AUINOTEBOOK_TAB_RIGHT_DOWN, + self._tab_rclick) self.Bind(wx.EVT_CLOSE, self._window_close) - self.statusbar = self.CreateStatusBar(1) + self.statusbar = self.CreateStatusBar(2) + self.statusbar.SetStatusWidths([-1, 200]) self._update_window_for_editor() + vbox = wx.BoxSizer() + self.SetSizer(vbox) + vbox.Add(self._editors, 1, flag=wx.EXPAND) + + self.add_tab_panel = wx.Panel(self, pos=(0, 0), size=(600, 600)) + self.add_tab_panel.Hide() + + with importlib_resources.as_file( + importlib_resources.files('chirp.share') + .joinpath('plus-icon.png') + ) as icon: + self.add_tab_bm = wx.Bitmap(str(icon), wx.BITMAP_TYPE_ANY) + + self.add_tab_panel.Bind(wx.EVT_PAINT, self._paint_add_tab_panel) + + def _paint_add_tab_panel(self, event): + panel = event.GetEventObject() + dc = wx.PaintDC(panel) + dc.SetBackground(wx.Brush("BLACK")) + + img_size = self.add_tab_bm.GetSize() + my_size = panel.GetSize() + x = (my_size.width // 2) - (img_size.width // 2) + y = (my_size.height // 2) - (img_size.width // 2) + + dc.DrawBitmap(self.add_tab_bm, x, y, True) + + def _remove_welcome_page(self): + def remove(): + for i in range(self._editors.GetPageCount()): + if isinstance(self._editors.GetPage(i), ChirpWelcomePanel): + self._editors.RemovePage(i) + break + wx.CallAfter(remove) + + def _tab_drag(self, event): + event.Skip() + d = wx.CustomDataObject(CHIRP_TAB_DF) + index = self._editors.GetSelection() + if isinstance(self._editors.GetPage(index), ChirpWelcomePanel): + # Don't allow moving the welcome panels + return + d.SetData(pickle.dumps((self.GetId(), index))) + data = wx.DataObjectComposite() + data.Add(d) + ds = wx.DropSource(self) + ds.SetData(data) + result = ds.DoDragDrop(wx.Drag_AllowMove) + if result == wx.DragMove: + LOG.debug('Target took our window') + self._update_window_for_editor() + else: + LOG.debug('Target rejected our window') + + def _tab_rclick(self, event): + selected = event.GetSelection() + eset = self._editors.GetPage(selected) + if isinstance(eset, ChirpWelcomePanel): + return + + def _detach(event): + new = ChirpMain(None, title='CHIRP') + self._editors.RemovePage(selected) + eset.Reparent(new._editors) + new.add_editorset(eset) + new.Show() + + menu = wx.Menu() + detach = wx.MenuItem(menu, wx.ID_ANY, _('Open in new window')) + self.Bind(wx.EVT_MENU, _detach, detach) + menu.Append(detach) + + self.PopupMenu(menu) + + def set_icon(self): + if sys.platform == 'win32': + icon = 'chirp.ico' + else: + icon = 'chirp.png' + with importlib_resources.as_file( + importlib_resources.files('chirp.share') + .joinpath(icon) + ) as path: + self.SetIcon(wx.Icon(str(path))) + @property def current_editorset(self): - return self._editors.GetCurrentPage() + eset = self._editors.GetCurrentPage() + if isinstance(eset, ChirpEditorSet): + return eset - def open_file(self, filename, exists=True, select=True): + @common.error_proof(errors.ImageDetectFailed, FileNotFoundError) + def open_file(self, filename, exists=True, select=True, rclass=None): + CSVRadio = directory.get_radio('Generic_CSV') if exists: - radio = directory.get_radio_by_image(filename) + if not os.path.exists(filename): + raise FileNotFoundError( + _('File does not exist: %s') % filename) + if rclass is None: + radio = directory.get_radio_by_image(filename) + else: + radio = rclass(filename) else: - CSVRadio = directory.get_radio('Generic_CSV') radio = CSVRadio(None) + if (not isinstance(radio, CSVRadio) or + isinstance(radio, chirp_common.NetworkSourceRadio)): + report.report_model(radio, 'open') + self.adj_menu_open_recent(filename) editorset = ChirpEditorSet(radio, filename, self._editors) self.add_editorset(editorset, select=select) - def add_editorset(self, editorset, select=True): - self._editors.AddPage(editorset, - os.path.basename(editorset.filename), - select=select) + def add_editorset(self, editorset, select=True, atindex=None): + self._remove_welcome_page() + if atindex is None: + self._editors.AddPage(editorset, + os.path.basename(editorset.filename), + select=select) + else: + self._editors.InsertPage(atindex, + editorset, + os.path.basename(editorset.filename), + select=select) self.Bind(EVT_EDITORSET_CHANGED, self._editor_changed, editorset) self.Bind(common.EVT_STATUS_MESSAGE, self._editor_status, editorset) self._update_editorset_title(editorset) + def add_stock_menu(self): + stock = wx.Menu() + + try: + user_stock_dir = get_stock_configs() + user_stock_confs = sorted(os.listdir(user_stock_dir)) + except FileNotFoundError: + user_stock_confs = [] + os.makedirs(user_stock_dir, exist_ok=True) + dist_stock_confs = sorted( + [ + (conf.name, hashlib.md5(conf.read_bytes())) for conf + in importlib_resources.files('chirp.stock_configs').iterdir() + if conf.is_file() + ] + ) + + def add_stock(fn): + submenu_item = stock.Append(wx.ID_ANY, fn) + self.Bind(wx.EVT_MENU, + self._menu_open_stock_config, submenu_item) + + found = [] + for fn in user_stock_confs: + add_stock(fn) + found.append(os.path.basename(fn)) + + stock.Append(wx.MenuItem(stock, wx.ID_SEPARATOR)) + + if sys.platform in ('darwin', 'win32'): + reveal = stock.Append(REVEAL_STOCK_DIR, + _('Open stock config directory')) + self.Bind(wx.EVT_MENU, self._menu_open_stock_config, reveal) + + stock.Append(wx.MenuItem(stock, wx.ID_SEPARATOR)) + + for fn, hash in dist_stock_confs: + if os.path.basename(fn) in found: + # Remove old stock configs that were copied to the user's + # directory by legacy chirp. + try: + user_fn = os.path.join(get_stock_configs(), + os.path.basename(fn)) + with open(user_fn, 'rb') as f: + user_hash = hashlib.md5(f.read()) + if hash.digest() == user_hash.digest(): + LOG.info('Removing stale legacy stock config %s', + os.path.basename(fn)) + os.remove(user_fn) + # Since we already added it to the user area, just + # don't add it to system this time. At next startup, + # it will move to the system section. + continue + else: + raise FileExistsError('File is changed') + except Exception as e: + LOG.info('Ignoring dist stock conf %s because same name ' + 'found in user dir: %s', + os.path.basename(fn), e) + continue + add_stock(fn) + + return stock + def make_menubar(self): + self.editor_menu_items = {} + memedit_items = memedit.ChirpMemEdit.get_menu_items() + self.editor_menu_items.update(memedit_items) + file_menu = wx.Menu() new_item = file_menu.Append(wx.ID_NEW) self.Bind(wx.EVT_MENU, self._menu_new, new_item) + new_window = file_menu.Append(wx.ID_ANY, _('New Window')) + self.Bind(wx.EVT_MENU, self._menu_new_window, new_window) + new_window.SetAccel( + wx.AcceleratorEntry( + wx.MOD_CONTROL | wx.ACCEL_SHIFT, ord('N'))) + open_item = file_menu.Append(wx.ID_OPEN) self.Bind(wx.EVT_MENU, self._menu_open, open_item) - stock_dir = platform.get_platform().config_file("stock_configs") - sconfigs = [] - if os.path.isdir(stock_dir): - for fn in os.listdir(stock_dir): - if fnmatch(fn, "*.csv"): - config, ext = os.path.splitext(fn) - sconfigs.append(config) - sconfigs.sort() - if len(sconfigs): - self.OPEN_STOCK_CONFIG_MENU = wx.Menu() - for fn in sconfigs: - submenu_item = self.OPEN_STOCK_CONFIG_MENU.Append( - wx.ID_ANY, fn) - self.Bind(wx.EVT_MENU, - self._menu_open_stock_config, submenu_item) - file_menu.AppendSubMenu(self.OPEN_STOCK_CONFIG_MENU, - "Open Stock Config") + self.OPEN_STOCK_CONFIG_MENU = self.add_stock_menu() + file_menu.AppendSubMenu(self.OPEN_STOCK_CONFIG_MENU, + _("Open Stock Config")) self.OPEN_RECENT_MENU = wx.Menu() + last_files = [ + x for x in (CONF.get('last_open', 'state') or '').split('$') + if x] + self.restore_tabs_item = wx.NewId() + if last_files: + submenu_item = self.OPEN_RECENT_MENU.Append( + self.restore_tabs_item, + _('Restore %i tabs' % len(last_files))) + submenu_item.SetAccel(wx.AcceleratorEntry( + wx.MOD_CONTROL | wx.ACCEL_SHIFT, ord('T'))) + self.Bind(wx.EVT_MENU, self.restore_tabs, submenu_item) + i = 0 fn = CONF.get("recent%i" % i, "state") while fn: @@ -282,17 +688,51 @@ class ChirpMain(wx.Frame): EMPTY_MENU_LABEL) submenu_item.Enable(False) self.Bind(wx.EVT_MENU, self._menu_open_recent, submenu_item) - file_menu.AppendSubMenu(self.OPEN_RECENT_MENU, 'Open Recent') + file_menu.AppendSubMenu(self.OPEN_RECENT_MENU, _('Open Recent')) save_item = file_menu.Append(wx.ID_SAVE) self.Bind(wx.EVT_MENU, self._menu_save, save_item) - save_item = file_menu.Append(wx.ID_SAVEAS) - self.Bind(wx.EVT_MENU, self._menu_save_as, save_item) + saveas_item = file_menu.Append(wx.ID_SAVEAS) + saveas_item.SetAccel(wx.AcceleratorEntry(wx.MOD_CONTROL | wx.ACCEL_ALT, + ord('S'))) + self.Bind(wx.EVT_MENU, self._menu_save_as, saveas_item) + + self._import_menu_item = wx.NewId() + import_item = file_menu.Append(wx.MenuItem(file_menu, + self._import_menu_item, + _('Import from file...'))) + self.Bind(wx.EVT_MENU, self._menu_import, import_item) + + self._export_menu_item = wx.NewId() + export_item = file_menu.Append(wx.MenuItem(file_menu, + self._export_menu_item, + _('Export to CSV...'))) + export_item.SetAccel(wx.AcceleratorEntry(wx.MOD_CONTROL, ord('E'))) + self.Bind(wx.EVT_MENU, self._menu_export, export_item) + + if CONF.get_bool('developer', 'state'): + loadmod_item = file_menu.Append(wx.MenuItem(file_menu, wx.NewId(), + _('Load Module...'))) + self.Bind(wx.EVT_MENU, self._menu_load_module, loadmod_item) file_menu.Append(wx.MenuItem(file_menu, wx.ID_SEPARATOR)) + print_item = file_menu.Append(wx.ID_PRINT) + self.Bind(wx.EVT_MENU, self._menu_print, print_item) + + self._print_preview_item = wx.NewId() + print_preview_item = wx.MenuItem(file_menu, + self._print_preview_item, + _('Print Preview')) + self.Bind(wx.EVT_MENU, self._menu_print, print_preview_item) + # Linux has integrated preview stuff, and the wx preview dialog + # does not work well, so skip this on Linux. + if platform.system() != 'Linux': + file_menu.Append(print_preview_item) + close_item = file_menu.Append(wx.ID_CLOSE) + close_item.SetAccel(wx.AcceleratorEntry(wx.MOD_CONTROL, ord('W'))) self.Bind(wx.EVT_MENU, self._menu_close, close_item) exit_item = file_menu.Append(wx.ID_EXIT) @@ -313,39 +753,118 @@ class ChirpMain(wx.Frame): selall_item = edit_menu.Append(wx.ID_SELECTALL) self.Bind(wx.EVT_MENU, self._menu_selall, selall_item) + delete_item = edit_menu.Append(wx.ID_DELETE) + delete_item.SetAccel(wx.AcceleratorEntry(wx.MOD_CONTROL, wx.WXK_BACK)) + self.Bind(wx.EVT_MENU, self._menu_delete, delete_item) + + edit_menu.Append(wx.MenuItem(edit_menu, wx.ID_SEPARATOR)) + + self._last_search_text = '' + find_item = edit_menu.Append(wx.ID_FIND) + edit_menu.SetLabel(wx.ID_FIND, _('Find...')) + find_item.SetAccel(wx.AcceleratorEntry(wx.MOD_CONTROL, ord('F'))) + self.Bind(wx.EVT_MENU, self._menu_find, find_item) + + if platform.system() == 'Windows': + findnextacc = wx.AcceleratorEntry() + findnextacc.FromString('F3') + else: + findnextacc = wx.AcceleratorEntry(wx.MOD_CONTROL | wx.ACCEL_ALT, + ord('F')) + + self._find_next_item = wx.NewId() + find_next_item = edit_menu.Append(wx.MenuItem(edit_menu, + self._find_next_item, + _('Find Next'))) + find_next_item.SetAccel(findnextacc) + self.Bind(wx.EVT_MENU, self._menu_find, find_next_item, + self._find_next_item) + + edit_menu.Append(wx.MenuItem(edit_menu, wx.ID_SEPARATOR)) + + for item in memedit_items[common.EditorMenuItem.MENU_EDIT]: + edit_menu.Append(item) + self.Bind(wx.EVT_MENU, self.do_editor_callback, item) + item.add_menu_callback() + + view_menu = wx.Menu() + + for item in memedit_items[common.EditorMenuItem.MENU_VIEW]: + view_menu.Append(item) + self.Bind(wx.EVT_MENU, self.do_editor_callback, item) + item.add_menu_callback() + + self._fixed_item = wx.NewId() + fixed_item = wx.MenuItem(view_menu, self._fixed_item, + _('Use fixed-width font'), + kind=wx.ITEM_CHECK) + view_menu.Append(fixed_item) + self.Bind(wx.EVT_MENU, self._menu_fixed_font, fixed_item) + fixed_item.Check(CONF.get_bool('font_fixed', 'state', False)) + + self._large_item = wx.NewId() + large_item = wx.MenuItem(view_menu, self._large_item, + _('Use larger font'), + kind=wx.ITEM_CHECK) + view_menu.Append(large_item) + self.Bind(wx.EVT_MENU, self._menu_large_font, large_item) + large_item.Check(CONF.get_bool('font_large', 'state', False)) + radio_menu = wx.Menu() + if sys.platform == 'darwin': + updownmod = wx.MOD_CONTROL + else: + updownmod = wx.ACCEL_ALT + self._download_menu_item = wx.NewId() - download_item = wx.MenuItem(radio_menu, self._download_menu_item, - 'Download') - download_item.SetAccel(wx.AcceleratorEntry(wx.ACCEL_ALT, ord('D'))) + download_item = wx.MenuItem( + radio_menu, self._download_menu_item, + _('Download from radio...')) + download_item.SetAccel(wx.AcceleratorEntry(updownmod, ord('D'))) self.Bind(wx.EVT_MENU, self._menu_download, download_item) radio_menu.Append(download_item) self._upload_menu_item = wx.NewId() - upload_item = wx.MenuItem(radio_menu, self._upload_menu_item, 'Upload') - upload_item.SetAccel(wx.AcceleratorEntry(wx.ACCEL_ALT, ord('U'))) + upload_item = wx.MenuItem( + radio_menu, self._upload_menu_item, + _('Upload to radio...')) + upload_item.SetAccel(wx.AcceleratorEntry(updownmod, ord('U'))) self.Bind(wx.EVT_MENU, self._menu_upload, upload_item) radio_menu.Append(upload_item) source_menu = wx.Menu() - radio_menu.AppendSubMenu(source_menu, 'Query Source') + radio_menu.AppendSubMenu(source_menu, _('Query Source')) + + query_rr_item = wx.MenuItem(source_menu, + wx.NewId(), 'RadioReference.com') + self.Bind(wx.EVT_MENU, self._menu_query_rr, query_rr_item) + source_menu.Append(query_rr_item) query_rb_item = wx.MenuItem(source_menu, wx.NewId(), 'RepeaterBook') self.Bind(wx.EVT_MENU, self._menu_query_rb, query_rb_item) source_menu.Append(query_rb_item) + query_dm_item = wx.MenuItem(source_menu, wx.NewId(), 'DMR-MARC') + self.Bind(wx.EVT_MENU, self._menu_query_dm, query_dm_item) + source_menu.Append(query_dm_item) + + query_prz_item = wx.MenuItem(source_menu, wx.NewId(), + 'przemienniki.net') + self.Bind(wx.EVT_MENU, self._menu_query_prz, query_prz_item) + source_menu.Append(query_prz_item) + radio_menu.Append(wx.MenuItem(radio_menu, wx.ID_SEPARATOR)) auto_edits = wx.MenuItem(radio_menu, wx.NewId(), - 'Enable Automatic Edits', + _('Enable Automatic Edits'), kind=wx.ITEM_CHECK) self.Bind(wx.EVT_MENU, self._menu_auto_edits, auto_edits) radio_menu.Append(auto_edits) auto_edits.Check(CONF.get_bool('auto_edits', 'state', True)) select_bandplan = wx.MenuItem(radio_menu, wx.NewId(), - 'Select Bandplan') + _('Select Bandplan...')) self.Bind(wx.EVT_MENU, self._menu_select_bandplan, select_bandplan) radio_menu.Append(select_bandplan) @@ -355,20 +874,19 @@ class ChirpMain(wx.Frame): self._reload_driver_item = wx.NewId() reload_drv_item = wx.MenuItem(radio_menu, self._reload_driver_item, - 'Reload Driver') + _('Reload Driver')) reload_drv_item.SetAccel( - wx.AcceleratorEntry(wx.ACCEL_ALT | wx.ACCEL_CTRL, - ord('R'))) + wx.AcceleratorEntry(wx.MOD_CONTROL, ord('R'))) self.Bind(wx.EVT_MENU, self._menu_reload_driver, reload_drv_item) radio_menu.Append(reload_drv_item) self._reload_both_item = wx.NewId() reload_both_item = wx.MenuItem(radio_menu, self._reload_both_item, - 'Reload Driver and File') + _('Reload Driver and File')) reload_both_item.SetAccel( wx.AcceleratorEntry( - wx.ACCEL_ALT | wx.ACCEL_CTRL | wx.ACCEL_SHIFT, + wx.ACCEL_ALT | wx.MOD_CONTROL, ord('R'))) self.Bind( wx.EVT_MENU, @@ -379,18 +897,23 @@ class ChirpMain(wx.Frame): self._interact_driver_item = wx.NewId() interact_drv_item = wx.MenuItem(radio_menu, self._interact_driver_item, - 'Interact with driver') + _('Interact with driver')) self.Bind(wx.EVT_MENU, self._menu_interact_driver, interact_drv_item) radio_menu.Append(interact_drv_item) + else: + self._reload_both_item = None + self._reload_driver_item = None + self._interact_driver_item = None help_menu = wx.Menu() - about_item = wx.MenuItem(help_menu, wx.NewId(), 'About') + about_item = wx.MenuItem(help_menu, wx.NewId(), _('About')) self.Bind(wx.EVT_MENU, self._menu_about, about_item) help_menu.Append(about_item) - developer_menu = wx.MenuItem(help_menu, wx.NewId(), 'Developer Mode', + developer_menu = wx.MenuItem(help_menu, wx.NewId(), + _('Developer Mode'), kind=wx.ITEM_CHECK) self.Bind(wx.EVT_MENU, functools.partial(self._menu_developer, developer_menu), @@ -398,14 +921,60 @@ class ChirpMain(wx.Frame): help_menu.Append(developer_menu) developer_menu.Check(CONF.get_bool('developer', 'state')) + reporting_menu = wx.MenuItem(help_menu, wx.NewId(), + _('Reporting enabled'), + kind=wx.ITEM_CHECK) + self.Bind(wx.EVT_MENU, + functools.partial(self._menu_reporting, reporting_menu), + reporting_menu) + help_menu.Append(reporting_menu) + reporting_menu.Check(not CONF.get_bool('no_report', default=False)) + + if logger.Logger.instance.has_debug_log_file: + # Only expose these debug log menu elements if we are logging to + # a debug.log file this session. + debug_log_menu = wx.MenuItem(help_menu, wx.NewId(), + _('Open debug log')) + self.Bind(wx.EVT_MENU, self._menu_debug_log, debug_log_menu) + help_menu.Append(debug_log_menu) + + if platform.system() in ('Windows', 'Darwin'): + debug_loc_menu = wx.MenuItem(help_menu, wx.NewId(), + _('Show debug log location')) + self.Bind(wx.EVT_MENU, self._menu_debug_loc, debug_loc_menu) + help_menu.Append(debug_loc_menu) + + lmfi_menu = wx.MenuItem(help_menu, wx.NewId(), + _('Load module from issue...')) + self.Bind(wx.EVT_MENU, self._menu_load_from_issue, lmfi_menu) + help_menu.Append(lmfi_menu) + menu_bar = wx.MenuBar() - menu_bar.Append(file_menu, '&File') - menu_bar.Append(edit_menu, '&Edit') - menu_bar.Append(radio_menu, '&Radio') - menu_bar.Append(help_menu, '&Help') + menu_bar.Append(file_menu, wx.GetStockLabel(wx.ID_FILE)) + menu_bar.Append(edit_menu, wx.GetStockLabel(wx.ID_EDIT)) + menu_bar.Append(view_menu, '&' + _('View')) + menu_bar.Append(radio_menu, '&' + _('Radio')) + menu_bar.Append(help_menu, _('Help')) return menu_bar + def do_editor_callback(self, event): + menu = event.GetEventObject() + item = menu.FindItemById(event.GetId()) + item.editor_callback(self.current_editorset.current_editor, event) + + def _menu_print(self, event): + p = printing.MemoryPrinter( + self, + self.current_editorset.radio, + self.current_editorset.current_editor) + + mems = self.current_editorset.current_editor.get_selected_memories() + if event.GetId() == wx.ID_PRINT: + p.print(mems) + else: + p.print_preview(mems) + def make_toolbar(self): tb = self.CreateToolBar() @@ -413,23 +982,29 @@ class ChirpMain(wx.Frame): return wx.ArtProvider.GetBitmap(stock, wx.ART_TOOLBAR, (32, 32)) - tbopen = tb.AddTool(wx.NewId(), 'Open', bm(wx.ART_FILE_OPEN), - 'Open a file') - tb.AddTool(wx.NewId(), 'Save', bm(wx.ART_FILE_SAVE), - 'Save file') - tb.AddTool(wx.NewId(), 'Close', bm(wx.ART_CLOSE), - 'Close file') - tb.AddTool(wx.NewId(), 'Download', bm(wx.ART_GO_DOWN), - 'Download from radio') + tbopen = tb.AddTool(wx.NewId(), _('Open'), bm(wx.ART_FILE_OPEN), + _('Open a file')) + tb.AddTool(wx.NewId(), _('Save'), bm(wx.ART_FILE_SAVE), + _('Save file')) + tb.AddTool(wx.NewId(), _('Close'), bm(wx.ART_CLOSE), + _('Close file')) + tb.AddTool(wx.NewId(), _('Download'), bm(wx.ART_GO_DOWN), + _('Download from radio')) tb.AddTool(wx.NewId(), 'Upload', bm(wx.ART_GO_UP), - 'Upload to radio') + _('Upload to radio')) self.Bind(wx.EVT_MENU, self._menu_open, tbopen) tb.Realize() def adj_menu_open_recent(self, filename): + # Don't persist template names that have not been saved or do not + # exist. + if not os.path.exists(filename): + LOG.debug('Ignoring recent file %s', filename) + return + # Don't add stock config files to the recent files list - stock_dir = platform.get_platform().config_file("stock_configs") + stock_dir = get_stock_configs() this_dir = os.path.dirname(filename) if (stock_dir and os.path.exists(stock_dir) and this_dir and os.path.samefile(stock_dir, this_dir)): @@ -470,6 +1045,8 @@ class ChirpMain(wx.Frame): if i >= KEEP_RECENT: break menu_item = self.OPEN_RECENT_MENU.FindItemByPosition(i) + if menu_item.GetId() == self.restore_tabs_item: + continue fn = menu_item.GetItemLabelText() CONF.set("recent%i" % i, fn, "state") config._CONFIG.save() @@ -488,16 +1065,11 @@ class ChirpMain(wx.Frame): def _editor_close(self, event): eset = self._editors.GetPage(event.GetSelection()) - if eset.modified: - if wx.MessageBox( - '%s has not been saved. Close anyway?' % eset.filename, - 'Close without saving?', - wx.YES_NO | wx.NO_DEFAULT | wx.ICON_WARNING) != wx.YES: - event.Veto() - - eset.close() - - wx.CallAfter(self._update_window_for_editor) + if self._prompt_to_close_editor(eset): + eset.close() + wx.CallAfter(self._update_window_for_editor) + else: + event.Veto() def _update_window_for_editor(self): eset = self.current_editorset @@ -505,33 +1077,78 @@ class ChirpMain(wx.Frame): can_save = False can_saveas = False can_upload = False + can_edit = False + is_memedit = False + is_bank = False CSVRadio = directory.get_radio('Generic_CSV') if eset is not None: is_live = isinstance(eset.radio, chirp_common.LiveRadio) + is_network = isinstance(eset.radio, + base.NetworkResultRadio) can_close = True - can_save = eset.modified and not is_live - can_saveas = not is_live + can_save = eset.modified and not is_live and not is_network + can_saveas = not is_live and not is_network can_upload = (not isinstance(eset.radio, CSVRadio) and not isinstance(eset.radio, common.LiveAdapter) and - not is_live) + not is_live and not is_network) + is_memedit = isinstance(eset.current_editor, memedit.ChirpMemEdit) + is_bank = isinstance(eset.current_editor, bankedit.ChirpBankEdit) + can_edit = not is_network + self.SetTitle('CHIRP (%s)' % os.path.basename(eset.filename)) + else: + self.SetTitle('CHIRP') + + if self.current_editorset: + radio = self.current_editorset.radio + radio_name = '%s %s' % (radio.VENDOR, radio.MODEL) + self.statusbar.SetStatusText(radio_name, i=1) + else: + self.statusbar.SetStatusText('', i=1) items = [ (wx.ID_CLOSE, can_close), (wx.ID_SAVE, can_save), (wx.ID_SAVEAS, can_saveas), (self._upload_menu_item, can_upload), + (self._find_next_item, is_memedit), + (wx.ID_FIND, is_memedit), + (wx.ID_PRINT, is_memedit), + (wx.ID_DELETE, is_memedit and can_edit), + (wx.ID_CUT, is_memedit and can_edit), + (wx.ID_COPY, is_memedit), + (wx.ID_PASTE, is_memedit and can_edit), + (wx.ID_SELECTALL, is_memedit), + (self._print_preview_item, is_memedit), + (self._export_menu_item, can_close), + (self._fixed_item, is_memedit or is_bank), + (self._large_item, is_memedit or is_bank), + (self._reload_driver_item, can_saveas), + (self._reload_both_item, can_saveas), + (self._interact_driver_item, can_close), + (self._import_menu_item, is_memedit and can_edit) ] for ident, enabled in items: + if ident is None: + continue menuitem = self.GetMenuBar().FindItemById(ident) - menuitem.Enable(enabled) + if menuitem: + # Some items may not be present on all systems (i.e. + # print preview on Linux) + menuitem.Enable(enabled) + + for menu, items in self.editor_menu_items.items(): + for item in items: + editor_match = ( + eset and + isinstance(eset.current_editor, item.editor_class) or + False) + item.Enable(editor_match) def _window_close(self, event): - if any([self._editors.GetPage(i).modified - for i in range(self._editors.GetPageCount())]): - if wx.MessageBox( - 'Some files have not been saved. Exit anyway?', - 'Exit without saving?', - wx.YES_NO | wx.NO_DEFAULT | wx.ICON_WARNING) != wx.YES: + for i in range(self._editors.GetPageCount()): + editorset = self._editors.GetPage(i) + self._editors.ChangeSelection(i) + if not self._prompt_to_close_editor(editorset): if event.CanVeto(): event.Veto() return @@ -539,14 +1156,28 @@ class ChirpMain(wx.Frame): size = self.GetSize() CONF.set_int('window_w', size.GetWidth(), 'state') CONF.set_int('window_h', size.GetHeight(), 'state') - config._CONFIG.save() + pos = self.GetPosition() + CONF.set_int('window_x', pos[0], 'state') + CONF.set_int('window_y', pos[1], 'state') + CONF.set('last_dir', chirp_platform.get_platform().get_last_dir(), + 'state') # Make sure we call close on each editor, so it can end # threads and do other cleanup + open_files = [] for i in range(self._editors.GetPageCount()): e = self._editors.GetPage(i) + if e.filename not in open_files: + open_files.append(e.filename) e.close() + CONF.set('last_open', + '$'.join(os.path.abspath(fn) + for fn in open_files if fn), + 'state') + config._CONFIG.save() + + ALL_MAIN_WINDOWS.remove(self) self.Destroy() def _update_editorset_title(self, editorset): @@ -558,30 +1189,82 @@ class ChirpMain(wx.Frame): def _menu_new(self, event): self.open_file('Untitled.csv', exists=False) - def _menu_open(self, event): - wildcard = '|'.join(['Chirp Image Files (*.img)|*.img', - 'CSV Files (*.csv)|*.csv', - 'All Files (*.*)|*.*']) - with wx.FileDialog(self, 'Open a file', - platform.get_platform().get_last_dir(), + def _do_open(self): + all_extensions = ['*.img'] + formats = [_('Chirp Image Files') + ' (*.img)|*.img', + _('All Files') + ' (*.*)|*.*'] + for name, pattern, readonly in directory.AUX_FORMATS: + formats.insert(1, '%s %s (%s)|%s' % ( + name, _('Files'), pattern, pattern)) + all_extensions.append(pattern) + + if CONF.get_bool('open_default_all_formats', 'prefs', True): + i_index = 0 + else: + i_index = len(formats) + formats.insert(i_index, + (_('All supported formats|') + + ';'.join(all_extensions))) + wildcard = '|'.join(formats) + with wx.FileDialog(self, _('Open a file'), + chirp_platform.get_platform().get_last_dir(), wildcard=wildcard, style=wx.FD_OPEN | wx.FD_FILE_MUST_EXIST) as fd: if fd.ShowModal() == wx.ID_CANCEL: return filename = fd.GetPath() d = fd.GetDirectory() - platform.get_platform().set_last_dir(d) + chirp_platform.get_platform().set_last_dir(d) CONF.set('last_dir', d, 'state') config._CONFIG.save() - self.open_file(str(filename)) + return str(filename) + + def _menu_open(self, event): + filename = self._do_open() + if filename is not None: + self.open_file(filename) + @common.error_proof(FileNotFoundError) def _menu_open_stock_config(self, event): - stock_dir = platform.get_platform().config_file("stock_configs") - fn = self.OPEN_STOCK_CONFIG_MENU.FindItemById(event.GetId()).GetLabel() - fn += ".csv" - filename = os.path.join(stock_dir, fn) + if event.GetId() == REVEAL_STOCK_DIR: + common.reveal_location(get_stock_configs()) + return + + fn = self.OPEN_STOCK_CONFIG_MENU.FindItemById( + event.GetId()).GetItemLabelText() + + user_stock_dir = get_stock_configs() + user_stock_conf = os.path.join(user_stock_dir, fn) + with importlib_resources.as_file( + importlib_resources.files('chirp.stock_configs') + .joinpath(fn) + ) as path: + dist_stock_conf = str(path) + if os.path.exists(user_stock_conf): + filename = user_stock_conf + elif os.path.exists(dist_stock_conf): + filename = dist_stock_conf + else: + LOG.error('Unable to find %s or %s' % (user_stock_conf, + dist_stock_conf)) + common.error_proof.show_error( + _('Unable to find stock config %r') % fn) + return + self.open_file(filename) + def restore_tabs(self, event): + if self.OPEN_RECENT_MENU.FindItem(self.restore_tabs_item)[0]: + self.OPEN_RECENT_MENU.Remove(self.restore_tabs_item) + last_files = (CONF.get('last_open', 'state') or '').split('$') + for fn in last_files: + if fn and os.path.exists(fn): + LOG.debug('Restoring tab for file %r' % fn) + self.open_file(fn) + elif fn: + LOG.debug('Previous file %r no longer exists' % fn) + return last_files + def _menu_open_recent(self, event): filename = self.OPEN_RECENT_MENU.FindItemById( event.GetId()).GetItemLabelText() @@ -589,21 +1272,37 @@ class ChirpMain(wx.Frame): def _menu_save_as(self, event): eset = self.current_editorset - wildcard = 'CHIRP %(vendor)s %(model)s Files (*.%(ext)s)|*.%(ext)s' % { - 'vendor': eset._radio.VENDOR, - 'model': eset._radio.MODEL, - 'ext': eset._radio.FILE_EXTENSION} + wildcard = ( + 'CHIRP %(vendor)s %(model)s %(files)s (*.%(ext)s)|*.%(ext)s' % { + 'vendor': eset._radio.VENDOR, + 'model': eset._radio.MODEL, + 'files': _('Files'), + 'ext': eset._radio.FILE_EXTENSION}) + + for name, pattern, readonly in directory.AUX_FORMATS: + if readonly: + continue + if pattern in wildcard: + continue + if name in eset.radio.FORMATS: + wildcard += '|%s %s (%s)|%s' % ( + name, _('Files'), pattern, pattern) style = wx.FD_SAVE | wx.FD_OVERWRITE_PROMPT | wx.FD_CHANGE_DIR - with wx.FileDialog(self, "Save file", defaultFile=eset.filename, + default_filename = os.path.basename(eset.filename) + with wx.FileDialog(self, _("Save file"), defaultFile=default_filename, wildcard=wildcard, style=style) as fd: if fd.ShowModal() == wx.ID_CANCEL: return filename = fd.GetPath() + chirp_platform.get_platform().set_last_dir( + fd.GetDirectory()) eset.save(filename) self.adj_menu_open_recent(filename) self._update_editorset_title(eset) + self._update_window_for_editor() + return True def _menu_save(self, event): editorset = self.current_editorset @@ -616,39 +1315,181 @@ class ChirpMain(wx.Frame): editorset.save() self._update_editorset_title(self.current_editorset) + @common.error_proof(errors.ImageDetectFailed, FileNotFoundError) + def _menu_import(self, event): + filename = self._do_open() + if filename is None: + return + radio = directory.get_radio_by_image(filename) + d = wx.MessageDialog( + self, + _('The recommended procedure for importing memories is to open ' + 'the source file and copy/paste memories from it into your ' + 'target image. If you continue with this import function, CHIRP ' + 'will replace all memories in your currently-open file with ' + 'those in %(file)s. Would you like to open this file to ' + 'copy/paste memories across, or proceed with the import?') % { + 'file': os.path.basename(filename)}, + _('Import not recommended'), + wx.ICON_WARNING | wx.YES_NO | wx.CANCEL | wx.NO_DEFAULT) + d.SetYesNoLabels(_('Import'), _('Open')) + r = d.ShowModal() + if r == wx.ID_YES: + self.current_editorset.current_editor.memedit_import_all(radio) + elif r == wx.ID_NO: + self.open_file(filename) + else: + return + + def _menu_export(self, event): + wildcard = 'CSV %s (*.csv)|*.csv' % _('Files') + defcsv = os.path.splitext(os.path.basename( + self.current_editorset.filename))[0] + '.csv' + style = wx.FD_SAVE | wx.FD_OVERWRITE_PROMPT | wx.FD_CHANGE_DIR + with wx.FileDialog(self, _('Export to CSV'), defaultFile=defcsv, + wildcard=wildcard, style=style) as fd: + if fd.ShowModal() == wx.ID_CANCEL: + return + self.current_editorset.export_to_file(fd.GetPath()) + + def _prompt_to_close_editor(self, editorset): + """Returns True if it is okay to close the editor, False otherwise""" + if not editorset.modified: + return True + + if isinstance(editorset, ChirpLiveEditorSet): + return True + + answer = wx.MessageBox( + _('%s has not been saved. Save before closing?') % ( + editorset.filename), + _('Save before closing?'), + wx.YES_NO | wx.YES_DEFAULT | wx.CANCEL | wx.ICON_WARNING) + if answer == wx.NO: + # User does not want to save, okay to close + return True + elif answer == wx.CANCEL: + # User wants to cancel, not okay to close + return False + else: + if not os.path.exists(editorset.filename): + return self._menu_save_as(None) + else: + editorset.save() + return True + def _menu_close(self, event): - self._editors.DeletePage(self._editors.GetSelection()) - self._update_window_for_editor() + if self._prompt_to_close_editor(self.current_editorset): + self.current_editorset.close() + self._editors.DeletePage(self._editors.GetSelection()) + self._update_window_for_editor() def _menu_exit(self, event): - self.Close(True) + for w in list(ALL_MAIN_WINDOWS): + w.Close(True) + @common.error_proof(RuntimeError, errors.InvalidMemoryLocation) def _menu_copy(self, event, cut=False): - data = self.current_editorset.cb_copy(cut=cut) - if wx.TheClipboard.Open(): - wx.TheClipboard.SetData(data) - wx.TheClipboard.Close() + try: + self.current_editorset.cb_copy(cut=cut) + except NotImplementedError: + LOG.warning('Attempt to cut/copy from %s not supported', + self.current_editorset.current_editor) + @common.error_proof() def _menu_paste(self, event): - memdata = wx.CustomDataObject(common.CHIRP_DATA_MEMORY) - textdata = wx.TextDataObject() - if wx.TheClipboard.Open(): - gotchirpmem = wx.TheClipboard.GetData(memdata) - got = wx.TheClipboard.GetData(textdata) - wx.TheClipboard.Close() - if gotchirpmem: - self.current_editorset.cb_paste(memdata) - if got: - self.current_editorset.cb_paste(textdata) + try: + self.current_editorset.cb_paste() + except NotImplementedError: + LOG.warning('Attempt to paste to %s not supported', + self.current_editorset.current_editor) def _menu_selall(self, event): self.current_editorset.select_all() + def _menu_delete(self, event): + self.current_editorset.cb_delete() + + def _menu_new_window(self, event): + new = ChirpMain(None, title='CHIRP') + new.Show() + + def _menu_find(self, event): + if event.GetId() == wx.ID_FIND: + search = wx.GetTextFromUser(_('Find') + ':', _('Find'), + self._last_search_text, self) + elif not self._last_search_text: + return + else: + search = self._last_search_text + if search: + self._last_search_text = search + self.current_editorset.cb_find(search) + + def _update_font(self): + for i in range(0, self._editors.PageCount): + eset = self._editors.GetPage(i) + eset.update_font() + + def _menu_fixed_font(self, event): + menuitem = event.GetEventObject().FindItemById(event.GetId()) + CONF.set_bool('font_fixed', menuitem.IsChecked(), 'state') + self._update_font() + + def _menu_large_font(self, event): + menuitem = event.GetEventObject().FindItemById(event.GetId()) + CONF.set_bool('font_large', menuitem.IsChecked(), 'state') + self._update_font() + + def _make_backup(self, radio): + if not isinstance(radio, chirp_common.CloneModeRadio): + LOG.debug('Not backing up %s' % radio) + return + backup_dir = chirp_platform.get_platform().config_file('backups') + now = datetime.datetime.now() + fn = os.path.join(backup_dir, + '%s_%s' % (directory.radio_class_id(radio.__class__), + now.strftime('%Y%m%dT%H%M%S.img'))) + try: + os.makedirs(backup_dir, exist_ok=True) + radio.save(fn) + LOG.info('Saved backup to %s', fn) + except Exception as e: + LOG.warning('Failed to backup %s: %s', radio, e) + return + + try: + keep_days = CONF.get_int('keep_backups_days', 'prefs') + except TypeError: + keep_days = 365 + if keep_days < 0: + # Never prune + return + try: + files = os.listdir(backup_dir) + bydate = [(os.stat(os.path.join(backup_dir, f)).st_mtime, f) + for f in files] + now = time.time() + for mtime, fn in sorted(bydate): + age = (now - mtime) // 86400 + if age > keep_days: + os.remove(os.path.join(backup_dir, fn)) + LOG.warning('Pruned backup %s older than %i days', + fn, keep_days) + elif age + 30 > keep_days: + LOG.info('Backup %s will be pruned soon', fn) + else: + break + except Exception as e: + LOG.exception('Failed to prune: %s' % e) + def _menu_download(self, event): with clone.ChirpDownloadDialog(self) as d: d.Centre() if d.ShowModal() == wx.ID_OK: radio = d._radio + self._make_backup(radio) + report.report_model(radio, 'download') if isinstance(radio, chirp_common.LiveRadio): editorset = ChirpLiveEditorSet(radio, None, self._editors) else: @@ -657,6 +1498,7 @@ class ChirpMain(wx.Frame): def _menu_upload(self, event): radio = self.current_editorset.radio + report.report_model(radio, 'upload') with clone.ChirpUploadDialog(radio, self) as d: d.Centre() d.ShowModal() @@ -678,10 +1520,14 @@ class ChirpMain(wx.Frame): # Reload the actual module module = sys.modules[orig_rclass.__module__] - LOG.warning('Going to reload %s' % module) - directory.enable_reregistrations() - import importlib - importlib.reload(module) + if hasattr(module, '_was_loaded'): + LOG.warning('Reloading loaded module %s' % module) + self.load_module(module.__file__) + else: + LOG.warning('Going to reload %s' % module) + directory.enable_reregistrations() + import importlib + importlib.reload(module) # Grab a new reference to the updated module and pick out the # radio class from it. @@ -700,44 +1546,161 @@ class ChirpMain(wx.Frame): new_radio._mmap = mmap new_radio.process_mmap() + # Get the currently-selected memedit row so we can re-select it + editor_pos = self.current_editorset.current_editor.get_scroll_pos() + # Kill the current editorset now that we know the radio loaded # successfully last_editor = self.current_editorset.current_editor_index - self._menu_close(event) + self.current_editorset.close() + self._editors.DeletePage(self._editors.GetSelection()) + self._update_window_for_editor() # Mimic the File->Open process to get a new editorset based # on our franken-radio editorset = ChirpEditorSet(new_radio, filename, self._editors) self.add_editorset(editorset, select=True) - editorset.select_editor(last_editor) + editorset.select_editor(index=last_editor) + editorset.current_editor.set_scroll_pos(editor_pos) LOG.info('Reloaded radio driver%s in place; good luck!' % ( andfile and ' (and file)' or '')) def _menu_interact_driver(self, event): LOG.warning('Going to interact with radio at the console') - radio = self.current_editorset.radio + radio = self.current_editorset.current_editor.radio import code locals = {'main': self, 'radio': radio} + if self.current_editorset.radio != radio: + locals['parent_radio'] = self.current_editorset.radio code.interact(banner='Locals are: %s' % (', '.join(locals.keys())), local=locals) + @common.error_proof() + def load_module(self, filename): + # We're in development mode, so we need to tell the directory to + # allow a loaded module to override an existing driver, against + # its normal better judgement + directory.enable_reregistrations() + self.SetTitle('CHIRP **%s**' % _('Module Loaded')) + + self.SetBackgroundColour((0xEA, 0x62, 0x62, 0xFF)) + + with open(filename) as module: + code = module.read() + sha = hashlib.sha256() + sha.update(code.encode()) + LOG.info('Loading module %s SHA256 %s' % (filename, sha.hexdigest())) + + import importlib.util + import sys + modname = 'chirp.loaded.%s' % os.path.splitext( + os.path.basename(filename))[0] + + spec = importlib.util.spec_from_file_location(modname, filename) + module = importlib.util.module_from_spec(spec) + module._was_loaded = True + sys.modules[modname] = module + try: + spec.loader.exec_module(module) + return True + except Exception as e: + LOG.error('Failed to load module: %s' % e) + raise Exception(_('Invalid or unsupported module file')) + + def _menu_load_module(self, event): + formats = ['Python %s (*.py)|*.py' % _('Files'), + '%s %s (*.mod)|*.mod' % (_('Module'), _('Files'))] + + r = wx.MessageDialog(self, + _('Loading modules can be extremely dangerous, ' + 'leading to damage to your computer, radio, ' + 'or both. NEVER load a module from a source ' + 'you do not trust, and especially not from ' + 'anywhere other than the main CHIRP website ' + '(chirp.danplanet.com). Loading a module from ' + 'another source is akin to giving them direct ' + 'access to your computer and everything on ' + 'it! Proceed despite this risk?'), + 'Warning', + wx.ICON_WARNING | wx.YES_NO) + if r.ShowModal() != wx.ID_YES: + return + + wildcard = '|'.join(formats) + with wx.FileDialog(self, _('Open a module'), + chirp_platform.get_platform().get_last_dir(), + wildcard=wildcard, + style=wx.FD_OPEN | wx.FD_FILE_MUST_EXIST) as fd: + if fd.ShowModal() == wx.ID_CANCEL: + return + filename = fd.GetPath() + self.load_module(filename) + def _menu_about(self, event): pyver = sys.version_info aboutinfo = 'CHIRP %s on Python %s wxPython %s' % ( CHIRP_VERSION, '%s.%s.%s' % (pyver.major, pyver.minor, pyver.micro), wx.version()) - wx.MessageBox(aboutinfo, 'About CHIRP', + wx.MessageBox(aboutinfo, _('About CHIRP'), wx.OK | wx.ICON_INFORMATION) def _menu_developer(self, menuitem, event): CONF.set_bool('developer', menuitem.IsChecked(), 'state') - state = menuitem.IsChecked() and 'enabled' or 'disabled' - wx.MessageBox(('Developer state is now %s. ' - 'CHIRP must be restarted to take effect') % state, - 'Restart Required', wx.OK) + state = menuitem.IsChecked() and _('enabled') or _('disabled') + if menuitem.IsChecked(): + msg = _( + 'Please note that developer mode is intended for use ' + 'by developers of the CHIRP project, or under the ' + 'direction of a developer. It enables behaviors and ' + 'functions that can damage your computer and your ' + 'radio if not used with EXTREME care. You have been ' + 'warned! Proceed anyway?') + d = wx.MessageDialog(self, msg, _('Danger Ahead'), + style=wx.ICON_WARNING | wx.YES_NO) + if d.ShowModal() != wx.ID_YES: + menuitem.Check(False) + return + + wx.MessageBox(_('Developer state is now %s. ' + 'CHIRP must be restarted to take effect') % state, + _('Restart Required'), wx.OK) + + def _menu_reporting(self, menuitem, event): + if not menuitem.IsChecked(): + r = wx.MessageBox( + _('Reporting helps the CHIRP project know which ' + 'radio models and OS platforms to spend our limited ' + 'efforts on. We would really appreciate if you left ' + 'it enabled. Really disable reporting?'), + _('Disable reporting'), + wx.YES_NO | wx.ICON_WARNING | wx.NO_DEFAULT) + if r == wx.NO: + menuitem.Check(True) + return + + CONF.set_bool('no_report', not menuitem.IsChecked()) + + @common.error_proof() + def _menu_debug_log(self, event): + dst = common.temporary_debug_log() + wx.LaunchDefaultApplication(dst) + + @common.error_proof() + def _menu_debug_loc(self, event): + dst = common.temporary_debug_log() + common.reveal_location(dst) + + @common.error_proof() + def _menu_load_from_issue(self, event): + module = developer.IssueModuleLoader(self).run() + if module: + if self.load_module(module): + wx.MessageBox(_('Module loaded successfully'), + _('Success'), + wx.ICON_INFORMATION) def _menu_auto_edits(self, event): CONF.set_bool('auto_edits', event.IsChecked(), 'state') @@ -748,8 +1711,8 @@ class ChirpMain(wx.Frame): plans = sorted([(shortname, details[0]) for shortname, details in bandplans.plans.items()], key=lambda x: x[1]) - d = wx.SingleChoiceDialog(self, 'Select a bandplan', - 'Bandplan', + d = wx.SingleChoiceDialog(self, _('Select a bandplan'), + _('Bandplan'), [x[1] for x in plans]) for index, (shortname, name) in enumerate(plans): if CONF.get_bool(shortname, 'bandplan'): @@ -762,10 +1725,56 @@ class ChirpMain(wx.Frame): for shortname, name in plans: CONF.set_bool(shortname, shortname == selected, 'bandplan') - def _menu_query_rb(self, event): - d = query_sources.RepeaterBookQueryDialog(self, - title='Query Repeaterbook') + def _do_network_query(self, query_cls): + d = query_cls(self, title=_('Query %s') % query_cls.NAME) r = d.ShowModal() if r == wx.ID_OK: - LOG.debug('Result file: %s' % d.result_file) - self.open_file(d.result_file) + report.report_model(d.result_radio, 'query') + editorset = ChirpEditorSet(d.result_radio, + None, self._editors) + self.add_editorset(editorset) + + def _menu_query_rr(self, event): + self._do_network_query(query_sources.RRQueryDialog) + + def _menu_query_rb(self, event): + self._do_network_query(query_sources.RepeaterBookQueryDialog) + + def _menu_query_dm(self, event): + self._do_network_query(query_sources.DMRMARCQueryDialog) + + def _menu_query_prz(self, event): + self._do_network_query(query_sources.PrzemiennikiQueryDialog) + + +def display_update_notice(version): + LOG.info('Server reports %s is latest' % version) + + if version == CHIRP_VERSION: + return + + if CONF.get_bool("skip_update_check", "state"): + return + + if CHIRP_VERSION.endswith('dev'): + return + + # Report new updates occasionally + intv = 3600 * 24 * 7 + + if CONF.is_defined("last_update_check", "state") and \ + (time.time() - CONF.get_int("last_update_check", "state")) < intv: + return + + CONF.set_int("last_update_check", int(time.time()), "state") + + url = 'https://chirp.danplanet.com/projects/chirp/wiki/ChirpNextBuild' + msg = _('A new CHIRP version is available. Please visit the ' + 'website as soon as possible to download it!') + d = wx.MessageDialog(None, msg, _('New version available'), + style=wx.OK | wx.CANCEL | wx.ICON_INFORMATION) + visit = d.ShowModal() + if visit == wx.ID_OK: + wx.MessageBox(_('Please be sure to quit CHIRP before installing ' + 'the new version!')) + webbrowser.open(url) diff --git a/chirp/wxui/memedit.py b/chirp/wxui/memedit.py index 71db547..45a4304 100644 --- a/chirp/wxui/memedit.py +++ b/chirp/wxui/memedit.py @@ -1,6 +1,23 @@ +# Copyright 2022 Dan Smith +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + import functools import logging import pickle +import platform +import sys import wx import wx.lib.newevent @@ -9,8 +26,13 @@ import wx.propgrid import wx.lib.mixins.gridlabelrenderer as glr from chirp import chirp_common +from chirp import directory from chirp import bandplan -from chirp.ui import config +from chirp.drivers import generic_csv +from chirp import errors +from chirp import import_logic +from chirp import settings +from chirp.wxui import config from chirp.wxui import common from chirp.wxui import developer @@ -50,20 +72,31 @@ class ChirpRowLabelRenderer(glr.GridDefaultRowLabelRenderer): class ChirpMemoryColumn(object): - NAME = None DEFAULT = '' - def __init__(self, name, radio): + def __init__(self, name, radio, label=None): """ :param name: The name on the Memory object that this represents + :param label: Static label override """ self._name = name + self._label = label or _(name.title()) self._radio = radio self._features = radio.get_features() + @property + def name(self): + return self._name + @property def label(self): - return self.NAME or self._name.title() + labelwords = self._label.replace('_', ' ').split(' ') + middle = len(labelwords) // 2 + if middle: + return '\n'.join([' '.join(labelwords[:middle]), + ' '.join(labelwords[middle:])]) + else: + return ' '.join(labelwords) def hidden_for(self, memory): return False @@ -79,17 +112,31 @@ class ChirpMemoryColumn(object): except KeyError: pass + if '.' in self._name: + # Assume extra fields are always valid + return True + LOG.error('Unsure if %r is valid' % self._name) return True def _render_value(self, memory, value): if value is []: - raise Exception('Found empty list value for %s: %r' % ( - self._name, value)) + raise Exception( + _('Found empty list value for %(name)s: %(value)r' % { + 'name': self._name, + 'value': value})) return str(value) def value(self, memory): - return getattr(memory, self._name) + if '.' in self._name: + parent, child = self._name.split('.') + try: + return getattr(memory, parent)[child].value + except (AttributeError, KeyError): + LOG.warning('Memory %s does not have field %s', + memory, self._name) + else: + return getattr(memory, self._name) def render_value(self, memory): if memory.empty: @@ -102,11 +149,26 @@ class ChirpMemoryColumn(object): return str(input_value) def digest_value(self, memory, input_value): - setattr(memory, self._name, self._digest_value(memory, input_value)) + if '.' in self._name: + parent, child = self._name.split('.') + try: + getattr(memory, parent)[child].value = self._digest_value( + memory, input_value) + except (AttributeError, KeyError): + LOG.warning('Memory %s does not have field %s', + memory, self._name) + raise ValueError( + _('Unable to set %s on this memory') % self._name) + else: + setattr(memory, self._name, self._digest_value(memory, + input_value)) def get_editor(self): return wx.grid.GridCellTextEditor() + def get_renderer(self): + return None + def get_propeditor(self, memory): class ChirpStringProperty(wx.propgrid.StringProperty): def ValidateValue(myself, value, validationInfo): @@ -115,42 +177,104 @@ class ChirpMemoryColumn(object): return True except ValueError: validationInfo.SetFailureMessage( - 'Invalid value: %r' % value) + _('Invalid value: %r') % value) return False except Exception: LOG.exception('Failed to validate %r for property %s' % ( value, self._name)) validationInfo.SetFailureMessage( - 'Invalid value: %r' % value) + _('Invalid value: %r') % value) return False - editor = ChirpStringProperty(self.label, self._name) + editor = ChirpStringProperty(self.label.replace('\n', ' '), + self._name) editor.SetValue(self.render_value(memory)) return editor + def get_by_prompt(self, parent, memory, message): + common.error_proof.show_error( + 'Internal error: unable to prompt for %s' % self._name) + class ChirpFrequencyColumn(ChirpMemoryColumn): DEFAULT = 0 + def __init__(self, *a, **k): + super().__init__(*a, **k) + self._wants_split = set() + @property def label(self): if self._name == 'offset': - return 'Offset' + return _('Offset') else: - return 'Frequency' + return _('Frequency') def hidden_for(self, memory): - return self._name == 'offset' and not memory.duplex + return (self._name == 'offset' and + memory.duplex in ('', 'off') and + memory.number not in self._wants_split) def _render_value(self, memory, value): if not value: value = 0 - return '%.5f' % (value / 1000000.0) + if (self._name == 'offset' and + memory.number in self._wants_split and + memory.duplex in ('', '-', '+')): + # Radio is returning offset but user wants split, so calculate + # the TX frequency to render what they expect. + value = memory.freq + int('%s%i' % (memory.duplex, value)) + + return chirp_common.format_freq(value) def _digest_value(self, memory, input_value): if not input_value.strip(): input_value = 0 - return int(chirp_common.to_MHz(float(input_value))) + if self._name == 'offset' and memory.number in self._wants_split: + # If we are being edited and the user has requested split for + # this memory, we need to keep requesting split, even if the + # radio is returning an offset-based memory. Otherwise, radios + # that emulate offset-based memories from tx/rx frequencies will + # fight with the user. + memory.duplex = 'split' + return chirp_common.parse_freq(input_value) + + def get_by_prompt(self, parent, memory, message): + if self._name == 'offset': + if memory.duplex == 'split': + default = self._render_value(memory, memory.freq) + else: + default = self._render_value(memory, memory.offset) + else: + default = self._render_value(memory, memory.freq) + d = wx.TextEntryDialog(parent, message, _('Enter Frequency'), + value=default) + while True: + r = d.ShowModal() + if r == wx.ID_CANCEL: + return + try: + return chirp_common.to_MHz(float(d.GetValue())) + except ValueError: + common.error_proof.show_error('Invalid frequency') + + def wants_split(self, memory, split): + if split: + self._wants_split.add(memory.number) + else: + self._wants_split.discard(memory.number) + + +class ChirpVariablePowerColumn(ChirpMemoryColumn): + def __init__(self, name, radio, power_levels): + super().__init__(name, radio) + + @property + def level(self): + return _('Power') + + def _digest_value(self, memory, value): + return chirp_common.parse_power(value) class ChirpChoiceEditor(wx.grid.GridCellChoiceEditor): @@ -175,42 +299,12 @@ class ChirpChoiceEditor(wx.grid.GridCellChoiceEditor): return self.Control.GetStringSelection() -class ChirpToneColumn(ChirpMemoryColumn): - def __init__(self, name, radio): - super(ChirpToneColumn, self).__init__(name, radio) - self._choices = chirp_common.TONES - self._str_choices = [str(x) for x in self._choices] - - @property - def label(self): - if self._name == 'rtone': - return 'Tone' - else: - return 'ToneSql' - - def hidden_for(self, memory): - return ( - (self._name == 'rtone' and memory.tmode not in ('Tone', 'Cross')) - or - (self._name == 'ctone' and memory.tmode not in ('TSQL', 'Cross'))) - - def _digest_value(self, memory, input_value): - return float(input_value) - - def get_editor(self): - return ChirpChoiceEditor(['%.1f' % t for t in chirp_common.TONES]) - - def get_propeditor(self, memory): - current = self.value(memory) - return wx.propgrid.EnumProperty(self.label, self._name, - self._str_choices, - range(len(self._choices)), - self._choices.index(current)) - - class ChirpChoiceColumn(ChirpMemoryColumn): - def __init__(self, name, radio, choices): - super(ChirpChoiceColumn, self).__init__(name, radio) + # This is just here so it is marked for translation + __TITLE1 = _('Tuning Step') + + def __init__(self, name, radio, choices, **k): + super(ChirpChoiceColumn, self).__init__(name, radio, **k) self._choices = choices self._str_choices = [str(x) for x in choices] @@ -223,8 +317,12 @@ class ChirpChoiceColumn(ChirpMemoryColumn): def get_propeditor(self, memory): current = self._render_value(memory, self.value(memory)) + # Since self._render_value() returns str(x), we should do the same + # for our choices when finding the index, since we could have things + # like PowerLevel objects. + choice_strs = [str(x) for x in self._choices] try: - cur_index = self._choices.index(current) + cur_index = choice_strs.index(current) except ValueError: # This means the memory has some value set that the radio # does not support, like the default cross_mode not being @@ -232,24 +330,131 @@ class ChirpChoiceColumn(ChirpMemoryColumn): # just doesn't have that value set, so take the first choice # in this case. cur_index = 0 - return wx.propgrid.EnumProperty(self.label, self._name, + LOG.warning('Failed to find %r in choices %r for %s', + current, choice_strs, self.name) + return wx.propgrid.EnumProperty(self.label.replace('\n', ' '), + self._name, self._str_choices, range(len(self._str_choices)), cur_index) + def get_by_prompt(self, parent, memory, message): + d = wx.SingleChoiceDialog(parent, message, _('Choice Required'), + self._str_choices, + style=wx.OK | wx.CANCEL | wx.CENTER) + if d.ShowModal() == wx.ID_OK: + return self._digest_value(memory, self._choices[d.GetSelection()]) + + +class ChirpToneColumn(ChirpChoiceColumn): + def __init__(self, name, radio): + self.rf = radio.get_features() + tones = self.rf.valid_tones or chirp_common.TONES + tones = [str(x) for x in tones] + super(ChirpToneColumn, self).__init__(name, radio, + tones) + + @property + def label(self): + if self._name == 'rtone': + return _('Tone') + else: + return _('Tone Squelch').replace(' ', '\n', 1) + + def rtone_visible(self, memory): + if not self._features.has_ctone: + tmodes = ['Tone', 'TSQL', 'TSQL-R'] + cross_modes = [x for x in chirp_common.CROSS_MODES + if 'Tone' in x] + else: + tmodes = ['Tone'] + cross_modes = [x for x in chirp_common.CROSS_MODES + if 'Tone->' in x] + if memory.tmode == 'Cross': + return memory.cross_mode in cross_modes + else: + return memory.tmode in tmodes + + def ctone_visible(self, memory): + return memory.tmode == 'TSQL' or (memory.tmode == 'Cross' and + '->Tone' in memory.cross_mode) + + def hidden_for(self, memory): + if self._name == 'rtone': + return not self.rtone_visible(memory) + else: + return not self.ctone_visible(memory) + + def _digest_value(self, memory, input_value): + return float(input_value) + + +class ChirpDuplexColumn(ChirpChoiceColumn): + # This is just here so it is marked for translation + __TITLE = _('Duplex') + + def __init__(self, *a, **k): + super().__init__(*a, **k) + self._wants_split = set() + + def _render_value(self, memory, value): + if memory.number in self._wants_split: + return 'split' + else: + return value + + def _digest_value(self, memory, input_value): + if memory.number in self._wants_split: + # If we are being edited and the user has requested split for + # this memory, we need to avoid requesting a tiny tx frequency + # (i.e. an offset), even if the radio is returning an offset-based + # memory. Otherwise, radios that emulate offset-based memories + # from tx/rx frequencies will fight with the user. + memory.offset = memory.freq + return super()._digest_value(memory, input_value) + + def wants_split(self, memory, split): + if split: + self._wants_split.add(memory.number) + else: + self._wants_split.discard(memory.number) + + +class ChirpFlagColumn(ChirpChoiceColumn): + """Support boolean values as a special case of Choice + + This allows us to have translated strings for the boolean flags, + while retaining choice-like behavior instead of rendering checkboxes, + which is very slow on GTK. + """ + def __init__(self, field, radio, label=None): + super().__init__(field, radio, [_('Disabled'), _('Enabled')], + label=label) + + def _render_value(self, memory, value): + # Convert RadioSettingValueBoolean (or an actual boolean) to one of + # our string choices + return self._choices[int(bool(value))] + + def _digest_value(self, memory, input_value): + # Convert one of our string choices back to boolean + return input_value == self._choices[1] + class ChirpDTCSColumn(ChirpChoiceColumn): def __init__(self, name, radio): - dtcs_codes = ['%03i' % code for code in chirp_common.DTCS_CODES] + rf = radio.get_features() + codes = rf.valid_dtcs_codes or chirp_common.DTCS_CODES + dtcs_codes = ['%03i' % code for code in codes] super(ChirpDTCSColumn, self).__init__(name, radio, dtcs_codes) @property def label(self): if self._name == 'dtcs': - return 'DTCS' + return _('DTCS') elif self._name == 'rx_dtcs': - return 'RX DTCS' + return _('RX DTCS') else: return 'ErrDTCS' @@ -259,52 +464,197 @@ class ChirpDTCSColumn(ChirpChoiceColumn): def _render_value(self, memory, value): return '%03i' % value + def _dtcs_visible(self, memory): + if memory.tmode in ['DTCS', 'DTCS-R']: + return True + if memory.tmode == 'Cross': + if self._features.has_rx_dtcs: + # If we have rx_dtcs then this is only visible for cross modes + # where we are transmitting DTCS + return 'DTCS->' in memory.cross_mode + else: + # If we do not have rx_dtcs then this is used for either tx + # or rx DTCS in cross. + return 'DTCS' in memory.cross_mode + + def _rx_dtcs_visible(self, memory): + return (self._features.has_rx_dtcs and + memory.tmode == 'Cross' and + '>DTCS' in memory.cross_mode) + + def hidden_for(self, memory): + if self._name == 'dtcs': + return not self._dtcs_visible(memory) + elif self._name == 'rx_dtcs': + return not self._rx_dtcs_visible(memory) + else: + raise Exception('Internal error') + + +class ChirpDTCSPolColumn(ChirpChoiceColumn): + def __init__(self, name, radio): + super().__init__(name, radio, + ['NN', 'NR', 'RN', 'RR']) + + @property + def label(self): + return _('DTCS\nPolarity') + def hidden_for(self, memory): - return ( - (self._name == 'dtcs' and not ( - memory.tmode == 'DTCS' or (memory.tmode == 'Cross' and - 'DTCS->' in memory.cross_mode))) - or - (self._name == 'rx_dtcs' and not ( - memory.tmode == 'Cross' and '>DTCS' in memory.cross_mode))) + return not (memory.tmode == 'DTCS' or + 'DTCS' in memory.cross_mode) class ChirpCrossModeColumn(ChirpChoiceColumn): + # This is just here so it is marked for translation + __TITLE = _('Mode') + def __init__(self, name, radio): rf = radio.get_features() super(ChirpCrossModeColumn, self).__init__(name, radio, rf.valid_cross_modes) + @property + def valid(self): + return ('Cross' in self._features.valid_tmodes and + self._features.valid_cross_modes) + @property def label(self): - return 'Cross mode' + return _('Cross mode') def hidden_for(self, memory): return memory.tmode != 'Cross' +class ChirpCommentColumn(ChirpMemoryColumn): + # This is just here so it is marked for translation + __TITLE = _('Comment') + + @property + def valid(self): + return (self._features.has_comment or + isinstance(self._radio, chirp_common.CloneModeRadio)) + + def _digest_value(self, memory, input_value): + # Limit to 128 characters for sanity + return str(input_value)[:256] + + +def title_case_special(string): + return ' '.join(word.title() if word.upper() != word else word + for word in string.split(' ')) + + +def get_column_for_extra(radio, setting): + value = setting.value + field = 'extra.%s' % setting.get_name() + + # Lots of these have all-caps acronyms in them, so we need to do a + # modified title() operation. + label = title_case_special(setting.get_shortname()) + if isinstance(value, settings.RadioSettingValueString): + return ChirpMemoryColumn(field, radio, label=label) + elif isinstance(value, settings.RadioSettingValueList): + return ChirpChoiceColumn(field, radio, value.get_options(), + label=label) + elif isinstance(value, settings.RadioSettingValueBoolean): + return ChirpFlagColumn(field, radio, label=label) + + +class ChirpMemoryDropTarget(wx.DropTarget): + def __init__(self, memedit): + super().__init__() + self._memedit = memedit + self.data = wx.DataObjectComposite() + self.data.Add(wx.CustomDataObject(common.CHIRP_DATA_MEMORY)) + self.SetDataObject(self.data) + + def parse_data(self): + data = self.data.GetObject(common.CHIRP_DATA_MEMORY) + return pickle.loads(data.GetData().tobytes()) + + def OnData(self, x, y, defResult): + if not self.GetData(): + return wx.DragNone + payload = self.parse_data() + x, y = self._memedit._grid.CalcUnscrolledPosition(x, y) + y -= self._memedit._grid.GetColLabelSize() + row, cell = self._memedit._grid.XYToCell(x, y) + start_row = self._memedit.mem2row(payload['mems'][0].number) + if row < 0 or row == start_row: + LOG.debug('Ignoring drag from row %i -> %i', + start_row, row) + return wx.DragCancel + + LOG.debug('Memory dropped on row %s,%s' % (row, cell)) + original_locs = [m.number for m in payload['mems']] + source = self._memedit.FindWindowById(payload.pop('source')) + if not self._memedit._cb_paste_memories(payload, row=row): + return defResult + + if source == self._memedit and defResult == wx.DragMove: + LOG.debug('Same-memedit move requested') + for loc in original_locs: + self._memedit.erase_memory(loc) + + return defResult + + def OnDragOver(self, x, y, defResult): + if self.GetData(): + payload = self.parse_data() + rows = len(payload['mems']) + else: + rows = 1 + + x, y = self._memedit._grid.CalcUnscrolledPosition(x, y) + y -= self._memedit._grid.GetColLabelSize() + row, cell = self._memedit._grid.XYToCell(x, y) + max_row = self._memedit._grid.GetNumberRows() + if row >= 0: + self._memedit._grid.ClearSelection() + for i in range(row, min(max_row, row + rows)): + self._memedit._grid.SelectRow(i, addToSelected=True) + return defResult + + def OnDrop(self, x, y): + return True + + class ChirpMemEdit(common.ChirpEditor, common.ChirpSyncEditor): def __init__(self, radio, *a, **k): super(ChirpMemEdit, self).__init__(*a, **k) + self.SetDropTarget(ChirpMemoryDropTarget(self)) + self._radio = radio self._features = self._radio.get_features() - # This is set based on the radio behavior during refresh() - self._negative_specials = False + # Cache of memories by *row* self._memory_cache = {} + # Maps special memory *names* to rows self._special_rows = {} + # Maps special memory *numbers* to rows + self._special_numbers = {} + # Extra memory column names + self._extra_cols = set() + # Memory errors by row + self._memory_errors = {} self._col_defs = self._setup_columns() self.bandplan = bandplan.BandPlans(CONF) self._grid = ChirpMemoryGrid(self) - self._grid.CreateGrid(self._features.memory_bounds[1] + - len(self._features.valid_special_chans) + 1, - len(self._col_defs)) + self._grid.CreateGrid( + self._features.memory_bounds[1] - self._features.memory_bounds[0] + + len(self._features.valid_special_chans) + 1, + len(self._col_defs)) self._grid.SetSelectionMode(wx.grid.Grid.SelectRows) self._grid.DisableDragRowSize() + self._grid.EnableDragCell() + self._grid.SetFocus() + self._default_cell_bg_color = self._grid.GetCellBackgroundColour(0, 0) sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(self._grid, 1, wx.EXPAND) @@ -314,6 +664,111 @@ class ChirpMemEdit(common.ChirpEditor, common.ChirpSyncEditor): family=wx.FONTFAMILY_TELETYPE, style=wx.FONTSTYLE_NORMAL, weight=wx.FONTWEIGHT_NORMAL) + self._variable_font = self._grid.GetDefaultCellFont() + self.update_font(False) + + self._grid.Bind(wx.grid.EVT_GRID_CELL_CHANGING, + self._memory_edited) + self._grid.Bind(wx.grid.EVT_GRID_CELL_CHANGED, + self._memory_changed) + self._grid.Bind(wx.grid.EVT_GRID_CELL_RIGHT_CLICK, + self._memory_rclick) + self._grid.Bind(wx.grid.EVT_GRID_LABEL_RIGHT_CLICK, + self._memory_rclick) + self._grid.Bind(wx.grid.EVT_GRID_CELL_BEGIN_DRAG, self._memory_drag) + row_labels = self._grid.GetGridRowLabelWindow() + row_labels.Bind(wx.EVT_LEFT_DOWN, self._row_click) + row_labels.Bind(wx.EVT_LEFT_UP, self._row_click) + row_labels.Bind(wx.EVT_MOTION, self._rowheader_mouseover) + self._dragging_rows = None + + self._dc = wx.ScreenDC() + self.set_cell_attrs() + + def _row_click(self, event): + # In order to override the drag-to-multi-select behavior of the base + # grid, we need to basically reimplement what happens when a user + # clicks on a row header. Shift for block select, Ctrl/Cmd for add- + # to-selection, and then drag to actually copy/move memories. + if sys.platform == 'darwin': + multi = event.CmdDown() + else: + multi = event.ControlDown() + cur_selected = self._grid.GetSelectedRows() + x, y = self._grid.CalcUnscrolledPosition(event.GetX(), event.GetY()) + row, _cell = self._grid.XYToCell(x, y) + if event.LeftDown(): + # Record where we clicked in case we start to drag, but only if + # they started that drag from one of the selected memories. + self._dragging_rows = (row, event.GetX(), event.GetY()) + elif self._dragging_rows is not None: + # Never dragged, so skip to get regular behavior + self._dragging_rows = None + try: + first_row = cur_selected[0] + except IndexError: + first_row = 0 + if event.ShiftDown(): + # Find the block the user wants and select all of it + start = min(row, first_row) + end = max(row, first_row) + self._grid.SelectBlock(start, 0, end, 0) + elif multi and row in cur_selected: + # The row is currently selected and we were clicked with the + # multi-select key held, so we need to select everything *but* + # the clicked row. + cur_selected.remove(row) + self._grid.ClearSelection() + for row in cur_selected: + self._grid.SelectRow(row, addToSelected=True) + else: + # They clicked on a row, add to selection if the multi-select + # key is held, otherwise select only this row. + self._grid.SelectRow(row, addToSelected=multi) + else: + # Unclick but we started a drag + self._dragging_rows = None + + def _rowheader_mouseover(self, event): + x, y = self._grid.CalcUnscrolledPosition(event.GetX(), event.GetY()) + row, _cell = self._grid.XYToCell(x, y) + + tip = self._memory_errors.get(row) + event.GetEventObject().SetToolTip(tip) + + if self._dragging_rows is not None: + row, x, y = self._dragging_rows + if row not in self._grid.GetSelectedRows(): + # Drag started from a non-selected cell, so ignore + return + if abs(event.GetX() - x) > 10 or abs(event.GetY() - y) > 10: + # Enough motion to consider this a drag motion + self._dragging_rows = None + return self._memory_drag(event) + + def _memory_drag(self, event): + data = self.cb_copy_getdata() + ds = wx.DropSource(self) + ds.SetData(data) + result = ds.DoDragDrop(wx.Drag_AllowMove) + if result in (wx.DragMove, wx.DragCopy): + LOG.debug('Target took our memories') + else: + LOG.debug('Target rejected our memories') + + @property + def editable(self): + return not isinstance(self._radio, chirp_common.NetworkSourceRadio) + + @property + def comment_col(self): + return self._col_defs.index(self._col_def_by_name('comment')) + + def set_cell_attrs(self): + if platform.system() == 'Linux': + minwidth = 100 + else: + minwidth = 75 for col, col_def in enumerate(self._col_defs): if not col_def.valid: @@ -322,86 +777,346 @@ class ChirpMemEdit(common.ChirpEditor, common.ChirpSyncEditor): self._grid.SetColLabelValue(col, col_def.label) attr = wx.grid.GridCellAttr() attr.SetEditor(col_def.get_editor()) - attr.SetFont(self._fixed_font) self._grid.SetColAttr(col, attr) - self._grid.SetColMinimalWidth(col, 75) - + self._grid.SetColMinimalWidth(col, minwidth) + try: + attr.SetFitMode(wx.grid.GridFitMode.Ellipsize()) + except AttributeError: + # No SetFitMode() support on wxPython 4.0.7 + pass wx.CallAfter(self._grid.AutoSizeColumns, setAsMin=False) - self._grid.Bind(wx.grid.EVT_GRID_CELL_CHANGING, - self._memory_edited) - self._grid.Bind(wx.grid.EVT_GRID_CELL_CHANGED, - self._memory_changed) - self._grid.Bind(wx.grid.EVT_GRID_CELL_RIGHT_CLICK, - self._memory_rclick) - - # For resize calculations - self._dc = wx.ScreenDC() - self._dc.SetFont(self._fixed_font) + @classmethod + def get_menu_items(cls): + move_up = common.EditorMenuItem( + cls, '_move_up', _('Move Up')) + # Control-Up is used by default on macOS, so require shift as well + if sys.platform == 'darwin': + extra_move = wx.MOD_SHIFT + else: + extra_move = 0 + move_up.SetAccel(wx.AcceleratorEntry( + extra_move | wx.ACCEL_RAW_CTRL, wx.WXK_UP)) + + move_dn = common.EditorMenuItem( + cls, '_move_dn', _('Move Down')) + move_dn.SetAccel(wx.AcceleratorEntry( + extra_move | wx.ACCEL_RAW_CTRL, wx.WXK_DOWN)) + + goto = common.EditorMenuItem(cls, '_goto', _('Goto...')) + goto.SetAccel(wx.AcceleratorEntry(wx.MOD_CONTROL, ord('G'))) + + expand_extra = common.EditorMenuItemToggle( + cls, '_set_expand_extra', ('expand_extra', 'state'), + _('Show extra fields')) + + hide_empty = common.EditorMenuItemToggle( + cls, '_set_hide_empty', ('hide_empty', 'memedit'), + _('Hide empty memories')) + + return { + common.EditorMenuItem.MENU_EDIT: [ + goto, + move_up, + move_dn, + ], + common.EditorMenuItem.MENU_VIEW: [ + expand_extra, + hide_empty, + ] + } + + def _set_expand_extra(self, event): + self.refresh() + + def _set_hide_empty(self, event): + self.refresh() + + def _goto(self, event): + l, u = self._features.memory_bounds + a = wx.GetNumberFromUser(_('Goto Memory:'), _('Number'), + _('Goto Memory'), + 1, l, u, self) + if a >= 0: + self.cb_goto(a) + + def _move_dn(self, event): + self.cb_move(1) + + def _move_up(self, event): + self.cb_move(-1) def _setup_columns(self): + def filter_unknowns(items): + return [x for x in items if '?' not in x] + + # Some drivers report invalid enumerations in their lists + # by using strings with question mark characters. Don't let the + # users select these. + valid_tmodes = filter_unknowns(self._features.valid_tmodes) + valid_modes = filter_unknowns(self._features.valid_modes) + valid_skips = filter_unknowns(self._features.valid_skips) + valid_duplexes = filter_unknowns(self._features.valid_duplexes) + valid_power_levels = self._features.valid_power_levels + valid_tuning_steps = self._features.valid_tuning_steps + if self._features.has_variable_power: + power_col_cls = ChirpVariablePowerColumn + else: + power_col_cls = ChirpChoiceColumn defs = [ ChirpFrequencyColumn('freq', self._radio), ChirpMemoryColumn('name', self._radio), ChirpChoiceColumn('tmode', self._radio, - self._features.valid_tmodes), + valid_tmodes, + label=_('Tone Mode')), ChirpToneColumn('rtone', self._radio), ChirpToneColumn('ctone', self._radio), ChirpDTCSColumn('dtcs', self._radio), ChirpDTCSColumn('rx_dtcs', self._radio), - ChirpChoiceColumn('duplex', self._radio, - self._features.valid_duplexes), + ChirpDTCSPolColumn('dtcs_polarity', self._radio), + ChirpCrossModeColumn('cross_mode', self._radio), + ChirpDuplexColumn('duplex', self._radio, + valid_duplexes), ChirpFrequencyColumn('offset', self._radio), ChirpChoiceColumn('mode', self._radio, - self._features.valid_modes), + valid_modes), ChirpChoiceColumn('tuning_step', self._radio, - self._features.valid_tuning_steps), + valid_tuning_steps, + label=_('Tuning Step')), ChirpChoiceColumn('skip', self._radio, - self._features.valid_skips), - ChirpCrossModeColumn('cross_mode', self._radio), - ChirpChoiceColumn('power', self._radio, - self._features.valid_power_levels), - ChirpMemoryColumn('comment', self._radio), + valid_skips), + power_col_cls('power', self._radio, + valid_power_levels), + ChirpCommentColumn('comment', self._radio), ] return defs + def _col_def_by_name(self, name): + for coldef in self._col_defs: + if coldef._name == name: + return coldef + LOG.error('No column definition for %s' % name) + def mem2row(self, number): if isinstance(number, str): return self._special_rows[number] + if number in self._special_numbers: + return self._special_rows[self._special_numbers[number]] return number - self._features.memory_bounds[0] def row2mem(self, row): - return row + self._features.memory_bounds[0] + if row in self._special_rows.values(): + row2number = {v: k for k, v in self._special_rows.items()} + return row2number[row] + else: + return row + self._features.memory_bounds[0] + + def special2mem(self, name): + name2mem = {v: k for k, v in self._special_numbers.items()} + return name2mem[name] + + def _expand_extra_col(self, setting): + # Add this to the list of seen extra columns regardless of if we + # support this type so we never try to add it again + self._extra_cols.add(setting.get_name()) + col = get_column_for_extra(self._radio, setting) + if col: + LOG.debug('Adding mem.extra column %s as %s', + setting.get_name(), col.__class__.__name__) + # We insert extra columns in front of the comment column, which + # should always be last + index = self.comment_col + self._col_defs.insert(index, col) + self._grid.InsertCols(index) + self.set_cell_attrs() + else: + LOG.warning('Unsupported mem.extra type %s', + setting.value.__class__.__name__) + + def _expand_extra(self, memory): + if not CONF.get_bool('expand_extra', 'state'): + return + for setting in memory.extra: + if setting.get_name() not in self._extra_cols: + self._expand_extra_col(setting) - def refresh_memory(self, number, memory): + def _refresh_memory(self, number, memory): row = self.mem2row(number) if isinstance(memory, Exception): LOG.error('Failed to load memory %s as error because: %s' % ( number, memory)) self._row_label_renderers[row].set_error() + self._memory_errors[row] = str(memory) + self._memory_cache[row] = chirp_common.Memory(number=number, + empty=True) self._grid.SetRowLabelValue(row, '!%s' % ( self._grid.GetRowLabelValue(row))) return + if row in self._memory_errors: + del self._memory_errors[row] + + hide_empty = CONF.get_bool('hide_empty', 'memedit', False) + if memory.empty: + # Reset our "wants split" flags if the memory is empty + offset_col = self._col_def_by_name('offset') + duplex_col = self._col_def_by_name('duplex') + offset_col.wants_split(memory, False) + duplex_col.wants_split(memory, False) + if hide_empty: + self._grid.HideRow(row) + else: + self._grid.ShowRow(row) + else: + self._grid.ShowRow(row) + + if memory.extra: + self._expand_extra(memory) + self._memory_cache[row] = memory with wx.grid.GridUpdateLocker(self._grid): - if memory.extd_number: - self._grid.SetRowLabelValue(row, memory.extd_number) - else: - self._grid.SetRowLabelValue(row, str(memory.number)) + self.set_row_finished(row) for col, col_def in enumerate(self._col_defs): self._grid.SetCellValue(row, col, col_def.render_value(memory)) + self._grid.SetReadOnly(row, col, + col_def.name in memory.immutable or + not self.editable) + if col_def.name in memory.immutable: + color = (0xF5, 0xF5, 0xF5, 0xFF) + else: + color = self._default_cell_bg_color + self._grid.SetCellBackgroundColour(row, col, color) + + def synchronous_get_memory(self, number): + """SYNCHRONOUSLY Get memory with extra properties + + This should ideally not be used except in situations (like copy) + where we really have to do the operation synchronously. + """ + mem = self._radio.get_memory(number) + if isinstance(self._radio, chirp_common.ExternalMemoryProperties): + mem = self._radio.get_memory_extra(mem) + return mem + + def set_row_finished(self, row): + self._row_label_renderers[row].clear_error() + memory = self._memory_cache[row] + if memory.extd_number: + self._grid.SetRowLabelValue(row, memory.extd_number) + else: + self._grid.SetRowLabelValue(row, str(memory.number)) + + def set_row_pending(self, row): + self._row_label_renderers[row].set_progress() + memory = self._memory_cache[row] + if memory.extd_number: + self._grid.SetRowLabelValue(row, '*%s' % memory.extd_number) + else: + self._grid.SetRowLabelValue(row, '*%i' % memory.number) + + def refresh_memory(self, number, lazy=False): + if lazy: + executor = self.do_lazy_radio + else: + executor = self.do_radio + + def extra_cb(job): + self._refresh_memory(number, job.result) + + def get_cb(job): + # If get_memory() failed, just refresh with the exception + if isinstance(job.result, Exception): + self._refresh_memory(job.args[0], job.result) + return + + # If this memory is a special, record the mapping of its driver- + # determined virtual number to is special name for use later + if job.result.extd_number: + self._special_numbers[job.result.number] = ( + job.result.extd_number) + # Otherwise augment with extra fields and call refresh with that, + # if appropriate + if isinstance(self._radio, + chirp_common.ExternalMemoryProperties): + executor(extra_cb, 'get_memory_extra', job.result) + else: + extra_cb(job) + + executor(get_cb, 'get_memory', number) + + def set_memory(self, mem, refresh=True): + """Update a memory in the radio and refresh our view on success""" + row = self.mem2row(mem.number) + if refresh: + self.set_row_pending(row) + + def extra_cb(job): + if refresh: + self.refresh_memory(mem.number) + + def set_cb(job): + if isinstance(job.result, Exception): + self._row_label_renderers[row].set_error() + else: + self._row_label_renderers[row].clear_error() + if isinstance(self._radio, + chirp_common.ExternalMemoryProperties): + self.do_radio(extra_cb, 'set_memory_extra', mem) + else: + extra_cb(job) + + # Use a FrozenMemory for the actual set to catch potential attempts + # to modify the memory during set_memory(). + self.do_radio(set_cb, 'set_memory', chirp_common.FrozenMemory(mem)) + + def erase_memory(self, number, refresh=True): + """Erase a memory in the radio and refresh our view on success""" + row = self.mem2row(number) + if refresh: + self.set_row_pending(row) + + def extra_cb(job): + if refresh: + self.refresh_memory(number) - def refresh_memory_from_job(self, job): - self.refresh_memory(job.args[0], job.result) + def erase_cb(job): + if isinstance(job.result, Exception): + self._row_label_renderers[row].set_error() + else: + self._row_label_renderers[row].clear_error() + if isinstance(self._radio, + chirp_common.ExternalMemoryProperties): + self.do_radio(extra_cb, 'erase_memory_extra', number) + else: + extra_cb(job) + + self.do_radio(erase_cb, 'erase_memory', number) + + def _purge_extra_cols(self): + for col in list(self._extra_cols): + self._extra_cols.remove(col) + index = self.comment_col - 1 + # We insert extra columns in front of the comment column, which + # should always be last, so delete the one before the comment + # column until we're out of extra columns. + LOG.debug('Removing extra col %s %s number %s', + col, self._col_defs[-1].__class__.__name__, + index) + del self._col_defs[index] + self._grid.DeleteCols(index) def refresh(self): + if not CONF.get_bool('expand_extra', 'state'): + self._purge_extra_cols() lower, upper = self._features.memory_bounds + def setlabel(row, number): + self._grid.SetRowLabelValue(row, '%s' % number) + # Build our row label renderers so we can set colors to # indicate success or failure self._row_label_renderers = [] @@ -413,40 +1128,174 @@ class ChirpMemEdit(common.ChirpEditor, common.ChirpSyncEditor): row = 0 for i in range(lower, upper + 1): + setlabel(row, i) row += 1 - self.do_radio(self.refresh_memory_from_job, 'get_memory', i) + self.refresh_memory(i, lazy=True) for i in self._features.valid_special_chans: self._special_rows[i] = row + setlabel(row, i) row += 1 - self.do_radio(self.refresh_memory_from_job, 'get_memory', i) + self.refresh_memory(i, lazy=True) + + def _set_memory_defaults(self, mem, *only): + """This is responsible for setting sane default values on memories. - def _set_memory_defaults(self, mem): + For the most part, this just honors the bandplan rules, but it also + tries to do things like calculate the required step for the memory's + frequency, etc. + + If fields are provided as arguments, only set those defaults, else, + set them all. + """ if not CONF.get_bool('auto_edits', 'state', True): return + if not only: + only = ['offset', 'duplex', 'tuning_step', 'mode', 'rtone'] + for prop in mem.immutable: + if prop in only: + only.remove(prop) defaults = self.bandplan.get_defaults_for_frequency(mem.freq) + features = self._features if not defaults.offset: - mem.duplex = '' + want_duplex = '' + want_offset = None elif defaults.offset > 0: - mem.duplex = '+' - mem.offset = defaults.offset + want_duplex = '+' + want_offset = defaults.offset elif defaults.offset < 0: - mem.duplex = '-' - mem.offset = abs(defaults.offset) + want_duplex = '-' + want_offset = abs(defaults.offset) + else: + want_duplex = want_offset = None + + if want_duplex is not None and want_duplex in features.valid_duplexes: + if 'duplex' in only: + mem.duplex = want_duplex + if want_offset is not None and features.has_offset: + if 'offset' in only: + mem.offset = want_offset + + if defaults.step_khz in features.valid_tuning_steps: + LOG.debug( + 'Chose default step %s from bandplan' % defaults.step_khz) + want_tuning_step = defaults.step_khz + else: + want_tuning_step = 5.0 + try: + # First calculate the needed step in case it is not supported + # by the radio. If we fail to find one the radio supports, + # we will use this one and then the error message about it + # being unsupported will be accurate. + want_tuning_step = chirp_common.required_step(mem.freq) + + # Now try to find a suitable one that the radio supports. + want_tuning_step = chirp_common.required_step( + mem.freq, features.valid_tuning_steps) + LOG.debug('Chose radio-supported step %s' % want_tuning_step) + except errors.InvalidDataError as e: + LOG.warning(e) + + if 'tuning_step' in only and want_tuning_step: + mem.tuning_step = want_tuning_step + + if defaults.mode and defaults.mode in features.valid_modes: + if 'mode' in only: + mem.mode = defaults.mode + + if defaults.tones and defaults.tones[0] in features.valid_tones: + if 'rtone' in only: + mem.rtone = defaults.tones[0] + + def _resolve_cross_mode(self, mem): + # Resolve TX/RX tones/codes when "Cross Mode" is changed + txmode, rxmode = mem.cross_mode.split('->') + todo = [('TX', txmode, 'rtone', 'dtcs'), + ('RX', rxmode, 'ctone', 'rx_dtcs')] + setvals = [] + for which, mode, tone_prop, dtcs_prop in todo: + if mode == 'Tone': + msg = _('Choose %s Tone') % which + prop = tone_prop + elif mode == 'DTCS': + msg = _('Choose %s DTCS Code') % which + prop = dtcs_prop + else: + # No value for this element, so do not prompt + continue + + val = self._col_def_by_name(prop).get_by_prompt( + self, mem, msg) + if val is None: + # User hit cancel, so abort + return False + setattr(mem, prop, val) + setvals.append(val) + + if rxmode == txmode and len(setvals) == 2 and setvals[0] == setvals[1]: + if rxmode == 'Tone': + mode = 'TSQL' + name = 'tones' + else: + mode = 'DTCS' + name = 'codes' + wx.MessageBox(_('Channels with equivalent TX and RX %s are ' + 'represented by tone mode of "%s"') % (name, mode), + _('Information')) + + return True + + def _resolve_tmode_cross(self, mem): + # Resolve cross_mode when tmode is changed to Cross + # Triggers resolve_cross_mode() after a selection is made + val = self._col_def_by_name('cross_mode').get_by_prompt( + self, mem, _('Choose Cross Mode')) + if val is None: + return False + mem.cross_mode = val + return self._resolve_cross_mode(mem) + + def _resolve_duplex(self, mem): + self._set_memory_defaults(mem, 'offset') + if mem.duplex == 'split': + msg = _('Enter TX Frequency (MHz)') + elif mem.duplex == 'off': + # Clearly no need to prompt for this duplex + return True + elif 0 < mem.offset < 70000000: + # We don't need to ask, offset looks like an offset + return True + else: + msg = _('Enter Offset (MHz)') - if defaults.step_khz: - mem.tuning_step = defaults.step_khz - if defaults.mode: - mem.mode = defaults.mode - if defaults.tones: - mem.rtone = defaults.tones[0] + offset = self._col_def_by_name('offset').get_by_prompt( + self, mem, msg) + if offset is None: + return False + mem.offset = offset + return True + def _resolve_offset(self, mem): + self._set_memory_defaults(mem, 'duplex') + if mem.duplex == '': + duplex = self._col_def_by_name('duplex').get_by_prompt( + self, mem, _('Choose duplex')) + if duplex is None: + return False + mem.duplex = duplex + return True + + @common.error_proof() def _memory_edited(self, event): """ Called when the memory row in the UI is edited. - Writes the memory to the radio and displays an error if needed. + + Responsible for updating our copy of the memory with changes from the + grid, defaults where appropriate, and extra values when required. + Validates the memory with the radio, then writes the memory to the + radio and displays an error if needed. """ row = event.GetRow() col = event.GetCol() @@ -457,32 +1306,97 @@ class ChirpMemEdit(common.ChirpEditor, common.ChirpSyncEditor): try: mem = self._memory_cache[row] except KeyError: - wx.MessageBox('Unable to edit memory before radio is loaded') + # This means we never loaded this memory from the radio in the + # first place, likely due to some error. + wx.MessageBox(_('Unable to edit memory before radio is loaded')) event.Veto() return - def set_cb(job): - if isinstance(job.result, Exception): - self._row_label_renderers[row].set_error() - else: - self._row_label_renderers[row].clear_error() - - try: - if col_def.label == 'Name': - val = self._radio.filter_name(val) - col_def.digest_value(mem, val) - if col_def.label == 'Frequency': - self._set_memory_defaults(mem) + # Filter the name according to the radio's rules before we try to + # validate it + if col_def.name == 'name': + val = self._radio.filter_name(val) + + # Record the user's desire for this being a split duplex so that + # we can represent it consistently to them. The offset and duplex + # columns need to know so they can behave appropriately. + if col_def.name == 'duplex': + offset_col = self._col_def_by_name('offset') + duplex_col = self._col_def_by_name('duplex') + offset_col.wants_split(mem, val == 'split') + duplex_col.wants_split(mem, val == 'split') + + # Any edited memory is going to be non-empty + if mem.empty: mem.empty = False - self._grid.SetRowLabelValue(row, '*%i' % mem.number) - self._row_label_renderers[row].set_progress() - self.do_radio(set_cb, 'set_memory', mem) - except Exception as e: - LOG.exception('Failed to edit memory') - wx.MessageBox('Invalid edit: %s' % e, 'Error') - event.Veto() - else: - LOG.debug('Memory %i changed, column: %i:%s' % (row, col, mem)) + + # This is where the column definition actually applies the edit they + # made to the memory. + col_def.digest_value(mem, val) + + # If they edited the frequency, we assume that they are likely going + # to want band defaults applied (duplex, offset, etc). + if col_def.name == 'freq': + self._set_memory_defaults(mem) + + # If they edited cross mode, they definitely want a tone mode of + # 'Cross'. For radios that do not store all the tone/code values + # all the time, we need to set certain tones or codes at the same + # time as this selection was made. + if col_def.name == 'cross_mode': + mem.tmode = 'Cross' + if not self._resolve_cross_mode(mem): + event.Veto() + return + elif col_def.name == 'tmode' and val == 'Cross': + if not self._resolve_tmode_cross(mem): + event.Veto() + return + + # If they edited one of the tone values and tmode is not Cross, + # select the right thing for them. Note that we could get fancy + # here and change the TX or RX part of cross_mode, if Cross is + # selected. + if col_def.name == 'rtone' and mem.tmode != 'Cross': + mem.tmode = 'Tone' + elif col_def.name == 'ctone' and mem.tmode != 'Cross': + mem.tmode = 'TSQL' + elif col_def.name == 'dtcs' and mem.tmode != 'Cross': + mem.tmode = 'DTCS' + + # If they edited duplex, we need to prompt them for the value of + # offset in some cases. For radios that do not store offset itself, + # we need to prompt for the offset so it is set in the same operation. + # For split mode, we should always prompt, because trying to set a + # TX frequency of 600 kHz is likely to fail on most radios. + if col_def.name == 'duplex' and val != '': + if not self._resolve_duplex(mem): + event.Veto() + return + + if col_def.name == 'offset' and mem.duplex in ('', 'off'): + if not self._resolve_offset(mem): + event.Veto() + return + + # Try to validate these changes with the radio before we go to store + # them, as now is the best time to present an error to the user. + warnings, errors = chirp_common.split_validation_msgs( + self._radio.validate_memory(mem)) + if errors: + LOG.warning('Memory failed validation: %s' % mem) + wx.MessageBox(_('Invalid edit: %s') % '; '.join(errors), + _('Invalid Entry')) + event.Skip() + return + if warnings: + LOG.warning('Memory validation had warnings: %s' % mem) + wx.MessageBox(_('Warning: %s') % '; '.join(warnings), + _('Warning')) + + self.set_row_pending(row) + self.set_memory(mem) + LOG.debug('Memory %i changed, column: %i:%s' % (row, col, mem)) wx.CallAfter(self._resize_col_after_edit, row, col) @@ -501,59 +1415,241 @@ class ChirpMemEdit(common.ChirpEditor, common.ChirpSyncEditor): Also provides the trigger to the editorset that we have changed. """ row = event.GetRow() - self.do_radio(self.refresh_memory_from_job, 'get_memory', - self.row2mem(row)) + self.refresh_memory(self.row2mem(row)) wx.PostEvent(self, common.EditorChanged(self.GetId())) def delete_memory_at(self, row, event): number = self.row2mem(row) - def del_cb(job): - self.do_radio(self.refresh_memory_from_job, 'get_memory', number) + if 'empty' in self._memory_cache[row].immutable: + raise errors.InvalidMemoryLocation( + _('Memory %i is not deletable') % number) - self.do_radio(del_cb, 'erase_memory', number) - wx.PostEvent(self, common.EditorChanged(self.GetId())) + self.erase_memory(number) + + @common.error_proof(errors.InvalidMemoryLocation) + def _delete_memories_at(self, rows, event, shift_up=None): + if rows: + wx.PostEvent(self, common.EditorChanged(self.GetId())) - def _delete_memories_at(self, rows, event): for row in rows: - self.delete_memory_at(row, event) + if not self._memory_cache[row].empty: + self.delete_memory_at(row, event) + + if not shift_up: + return + + LOG.debug('Shifting up...%s' % shift_up) + next_row = rows[-1] + 1 + delta = len(rows) + mems_to_move = [] + + # Find all the memories we are going to shift up, either to the end + # of the current block, or to the end of the list + for row in range(next_row, self._grid.GetNumberRows()): + if (shift_up == 'block' and + self._memory_cache[row].empty): + # We found the end of the next block + break + elif isinstance(self.row2mem(row), str): + # We hit the specials, stop here + break + mems_to_move.append(self.row2mem(row)) + + if not mems_to_move: + LOG.debug('Delete %s has no memories to move' % shift_up) + return + + # Shift them all up by however many we deleted + for number in mems_to_move: + LOG.debug('Moving memory %i -> %i', number, number - delta) + mem = self._memory_cache[self.mem2row(number)] + mem.number -= delta + if mem.empty: + self.erase_memory(mem.number, refresh=False) + else: + self.set_memory(mem, refresh=False) + + # Delete the memories that are now the hole we made + for number in range(mem.number + 1, mems_to_move[-1] + 1): + LOG.debug('Erasing memory %i', number) + self.erase_memory(number, refresh=False) + + # Refresh the entire range from the top of what we deleted to the + # hole we created + for number in range(self.row2mem(rows[0]), mems_to_move[-1] + 1): + self.refresh_memory(number) + + def _do_sort_memories(self, rows, reverse, sortattr): + memories = [self._memory_cache[r] for r in rows] + LOG.debug('Sorting %s by %s%s', + memories, reversed and '>' or '<', sortattr) + memories.sort(key=lambda m: getattr(m, sortattr), reverse=reverse) + for i, mem in enumerate(memories): + new_number = self.row2mem(rows[0] + i) + LOG.debug('Moving memory %i to %i', mem.number, new_number) + mem.number = new_number + self.set_memory(mem) + LOG.debug('Sorted: %s', memories) + + wx.PostEvent(self, common.EditorChanged(self.GetId())) + + @common.error_proof() + def _sort_memories(self, rows, reverse, event): + choices = [x.label.replace('\n', ' ') for x in self._col_defs] + sortcol = wx.GetSingleChoice( + _('Sort memories'), + _('Sort by column:'), + choices, + parent=self) + if not sortcol: + return + + sortattr = self._col_defs[choices.index(sortcol)].name + + self._do_sort_memories(rows, reverse, sortattr) + + @common.error_proof() + def _arrange_memories(self, rows, event): + self._do_sort_memories(rows, False, 'empty') def _memory_rclick(self, event): + if event.GetRow() == -1: + # This is a right-click on a column header + return menu = wx.Menu() selected_rows = self._grid.GetSelectedRows() if not selected_rows: selected_rows = [event.GetRow()] - props_item = wx.MenuItem(menu, wx.NewId(), 'Properties') + props_item = wx.MenuItem(menu, wx.NewId(), _('Properties')) self.Bind(wx.EVT_MENU, functools.partial(self._mem_properties, selected_rows), props_item) menu.Append(props_item) + props_item.Enable(self.editable) + + insert_item = wx.MenuItem(menu, wx.NewId(), _('Insert Row Above')) + self.Bind(wx.EVT_MENU, + functools.partial(self._mem_insert, selected_rows[0]), + insert_item) + menu.Append(insert_item) + + cut_item = wx.MenuItem(menu, wx.NewId(), _('Cut')) + self.Bind(wx.EVT_MENU, lambda e: self.cb_copy(cut=True), cut_item) + menu.Append(cut_item) + + copy_item = wx.MenuItem(menu, wx.NewId(), _('Copy')) + self.Bind(wx.EVT_MENU, lambda e: self.cb_copy(cut=False), copy_item) + menu.Append(copy_item) + + paste_item = wx.MenuItem(menu, wx.NewId(), _('Paste')) + self.Bind(wx.EVT_MENU, lambda e: self.cb_paste(), paste_item) + menu.Append(paste_item) + + delete_menu = wx.Menu() + delete_menu_item = menu.AppendSubMenu(delete_menu, _('Delete')) + delete_menu_item.Enable(self.editable) if len(selected_rows) > 1: - del_item = wx.MenuItem(menu, wx.NewId(), - 'Delete %i Memories' % len(selected_rows)) + del_item = wx.MenuItem( + delete_menu, wx.NewId(), + _('%i Memories') % len(selected_rows)) + del_block_item = wx.MenuItem( + delete_menu, wx.NewId(), + _('%i Memories and shift block up') % ( + len(selected_rows))) + del_shift_item = wx.MenuItem( + delete_menu, wx.NewId(), + _('%i Memories and shift all up') % len(selected_rows)) to_delete = selected_rows else: - del_item = wx.MenuItem(menu, wx.NewId(), 'Delete') + del_item = wx.MenuItem(delete_menu, wx.NewId(), _('This Memory')) + del_block_item = wx.MenuItem(delete_menu, wx.NewId(), + _('This memory and shift block up')) + del_shift_item = wx.MenuItem(delete_menu, wx.NewId(), + _('This memory and shift all up')) to_delete = [event.GetRow()] self.Bind(wx.EVT_MENU, functools.partial(self._delete_memories_at, to_delete), del_item) - menu.Append(del_item) + self.Bind(wx.EVT_MENU, + functools.partial(self._delete_memories_at, to_delete, + shift_up='block'), + del_block_item) + self.Bind(wx.EVT_MENU, + functools.partial(self._delete_memories_at, to_delete, + shift_up='all'), + del_shift_item) + + delete_menu.Append(del_item) + delete_menu.Append(del_block_item) + delete_menu.Append(del_shift_item) + + # Only offer sort if a contiguous group of non-empty, non-special + # memories is selected + empty_selected = any([self._memory_cache[r].empty + for r in selected_rows]) + used_selected = sum([0 if self._memory_cache[r].empty else 1 + for r in selected_rows]) + special_selected = any([self._memory_cache[r].extd_number + for r in selected_rows]) + contig_selected = ( + selected_rows[-1] - selected_rows[0] == len(selected_rows) - 1) + can_sort = (len(selected_rows) > 1 and contig_selected and + not empty_selected and not special_selected and + self.editable) + sort_menu = wx.Menu() + sort_menu_item = menu.AppendSubMenu( + sort_menu, + _('Sort %i memories') % len(selected_rows)) + sortasc_item = wx.MenuItem( + sort_menu, wx.NewId(), + _('Sort %i memories ascending') % len(selected_rows)) + self.Bind(wx.EVT_MENU, + functools.partial(self._sort_memories, selected_rows, + False), + sortasc_item) + sort_menu.Append(sortasc_item) + + arrange_item = wx.MenuItem( + menu, wx.NewId(), + _('Cluster %i memories') % used_selected) + self.Bind(wx.EVT_MENU, + functools.partial(self._arrange_memories, selected_rows), + arrange_item) + menu.Append(arrange_item) + arrange_item.Enable(empty_selected and used_selected and + not special_selected) + + sortdesc_item = wx.MenuItem( + menu, wx.NewId(), + _('Sort %i memories descending') % len(selected_rows)) + self.Bind(wx.EVT_MENU, + functools.partial(self._sort_memories, selected_rows, + True), + sortdesc_item) + sort_menu.Append(sortdesc_item) + + # Don't allow bulk operations on live radios with pending jobs + del_block_item.Enable(not self.busy) + del_shift_item.Enable(not self.busy) + insert_item.Enable(not self.busy and self.editable) + menu.Enable(sort_menu_item.GetId(), not self.busy and can_sort) if CONF.get_bool('developer', 'state'): menu.Append(wx.MenuItem(menu, wx.ID_SEPARATOR)) - raw_item = wx.MenuItem(menu, wx.NewId(), 'Show Raw Memory') + raw_item = wx.MenuItem(menu, wx.NewId(), _('Show Raw Memory')) self.Bind(wx.EVT_MENU, functools.partial(self._mem_showraw, event.GetRow()), raw_item) menu.Append(raw_item) if len(selected_rows) == 2: - diff_item = wx.MenuItem(menu, wx.NewId(), 'Diff Raw Memories') + diff_item = wx.MenuItem(menu, wx.NewId(), + _('Diff Raw Memories')) self.Bind(wx.EVT_MENU, functools.partial(self._mem_diff, selected_rows), diff_item) @@ -562,16 +1658,55 @@ class ChirpMemEdit(common.ChirpEditor, common.ChirpSyncEditor): self.PopupMenu(menu) menu.Destroy() + @common.error_proof() def _mem_properties(self, rows, event): memories = [ - self._radio.get_memory(self.row2mem(row)) + self.synchronous_get_memory(self.row2mem(row)) for row in rows] - with ChirpMemPropDialog(memories, self) as d: + with ChirpMemPropDialog(self, memories) as d: if d.ShowModal() == wx.ID_OK: - for memory in d._memories: - self._radio.set_memory(memory) - self.refresh_memory(memory.number, memory) - wx.PostEvent(self, common.EditorChanged(self.GetId())) + memories = d._memories + else: + return + + # Schedule all the set jobs + for memory in memories: + self.set_memory(memory) + + wx.PostEvent(self, common.EditorChanged(self.GetId())) + + @common.error_proof() + def _mem_insert(self, row, event): + # Traverse memories downward until we find a hole + for i in range(row, self.mem2row(self._features.memory_bounds[1] + 1)): + mem = self._memory_cache[i] + if mem.empty: + LOG.debug("Found empty memory %i at row %i" % (mem.number, i)) + empty_row = i + break + else: + raise Exception(_('No empty rows below!')) + + mems_to_refresh = [] + # Move memories down in reverse order + for target_row in range(empty_row, row, -1): + mem = self._memory_cache[target_row - 1] + LOG.debug('Moving memory %i -> %i', mem.number, + self.row2mem(target_row)) + mem.number = self.row2mem(target_row) + self.set_memory(mem, refresh=False) + mems_to_refresh.append(mem.number) + + # Erase the memory that is to become the empty row + LOG.debug('Erasing memory %i', self.row2mem(row)) + self.erase_memory(self.row2mem(row), refresh=False) + mems_to_refresh.append(self.row2mem(row)) + + # Refresh all the memories we touched + for number in mems_to_refresh: + self.refresh_memory(number) + + wx.PostEvent(self, common.EditorChanged(self.GetId())) def _mem_showraw(self, row, event): mem = self._radio.get_raw_memory(self.row2mem(row)) @@ -584,47 +1719,294 @@ class ChirpMemEdit(common.ChirpEditor, common.ChirpSyncEditor): with developer.MemoryDialog((mem_a, mem_b), self) as d: d.ShowModal() - def cb_copy(self, cut=False): - rows = self._grid.GetSelectedRows() + def update_font(self, refresh=True): + fixed = CONF.get_bool('font_fixed', 'state', False) + large = CONF.get_bool('font_large', 'state', False) + if fixed: + font = self._fixed_font + else: + font = self._variable_font + if large: + font = wx.Font(font) + font.SetPointSize(font.PointSize + 2) + self._grid.SetDefaultCellFont(font) + if refresh: + self.refresh() + wx.CallAfter(self._grid.AutoSizeColumns, setAsMin=False) + wx.CallAfter(self._grid.AutoSizeRows, setAsMin=False) + wx.CallAfter(self._grid.SetRowLabelSize, wx.grid.GRID_AUTOSIZE) + + def cb_copy_getdata(self, cut=False): + rows = self.get_selected_rows_safe() offset = self._features.memory_bounds[0] mems = [] for row in rows: - mem = self._radio.get_memory(row + offset) - # We can't pickle settings, nor would they apply if we - # paste across models - mem.extra = [] + mem = self.synchronous_get_memory(row + offset) mems.append(mem) - data = wx.CustomDataObject(common.CHIRP_DATA_MEMORY) - data.SetData(pickle.dumps(mems)) - for mem in mems: - if cut: - self._radio.erase_memory(mem.number) - mem = self._radio.get_memory(mem.number) - self.refresh_memory(mem.number, mem) - return data + rcid = directory.radio_class_id(self._radio.__class__) + payload = {'mems': mems, + 'features': self._radio.get_features(), + 'source_radio_id': rcid, + 'source': self.GetId()} + data = wx.DataObjectComposite() + memdata = wx.CustomDataObject(common.CHIRP_DATA_MEMORY) + data.Add(memdata) + memdata.SetData(pickle.dumps(payload)) + strfmt = chirp_common.mem_to_text(mems[0]) + textdata = wx.TextDataObject(strfmt) + data.Add(textdata) + if cut: + if any('empty' in mem.immutable for mem in mems): + raise errors.InvalidMemoryLocation( + _('Some memories are not deletable')) + for mem in mems: + self.erase_memory(mem.number) + + if cut: + wx.PostEvent(self, common.EditorChanged(self.GetId())) - def _cb_paste_memories(self, mems): - try: - row = self._grid.GetSelectedRows()[0] - except IndexError: - LOG.info('No row selected for paste') - return + return data + def cb_copy(self, cut=False): + self.cb_copy_data(self.cb_copy_getdata(cut=cut)) + + def memedit_import_all(self, source_radio): + source_rf = source_radio.get_features() + first = max(source_rf.memory_bounds[0], + self._features.memory_bounds[0]) + last = min(source_rf.memory_bounds[1], + self._features.memory_bounds[1]) + memories = [source_radio.get_memory(i) + for i in range(first, last + 1)] + used = [m.number for m in memories if not m.empty] + # Update the range to be from just the lowest and highest used memory. + # The range of memories that are used in the source will be imported, + # including any gaps. + first = min(used) + last = max(used) + row = self.mem2row(first) + LOG.info('Importing %i-%i starting from %s %s', + first, last, source_radio.VENDOR, source_radio.MODEL) + payload = {'mems': [m for m in memories if first <= m.number <= last], + 'features': source_rf} + self._cb_paste_memories(payload, row=row) + + def _cb_paste_memories(self, payload, row=None): + mems = payload['mems'] + srcrf = payload['features'] + if row is None: + row = self.get_selected_rows_safe()[0] + + overwrite = [] + for i in range(len(mems)): + mem = self._memory_cache[row + i] + if not mem.empty: + overwrite.append(mem.extd_number or mem.number) + + if overwrite: + if len(overwrite) == 1 and len(mems) == 1: + msg = _('Pasted memory will overwrite memory %s') % ( + overwrite[0]) + elif len(overwrite) == 1 and len(mems) > 0: + msg = _('Pasted memories will overwrite memory %s') % ( + overwrite[0]) + elif len(overwrite) > 10: + msg = _('Pasted memories will overwrite %s ' + 'existing memories') % (len(overwrite)) + else: + msg = _('Pasted memories will overwrite memories %s') % ( + ','.join(str(x) for x in overwrite)) + d = wx.MessageDialog(self, msg, + _('Overwrite memories?'), + wx.YES | wx.NO | wx.YES_DEFAULT) + resp = d.ShowModal() + if resp == wx.ID_NO: + return False + + same_class = (payload.get('source_radio_id') == + directory.radio_class_id(self._radio.__class__)) + LOG.debug('Paste is from identical radio class: %s', same_class) + + errormsgs = [] + modified = False for mem in mems: - mem.empty = False - mem.number = row + self._features.memory_bounds[0] + existing = self._memory_cache[row] + number = self.row2mem(row) + # We need to disable immutable checking while we reassign these + # numbers. This might be a flag that we should be copying things + # between memories and not reassigning memories to then set. + immutable = list(mem.immutable) + mem.immutable = [] + # Handle potential need to convert between special and regular + # memories + if isinstance(number, str): + mem.extd_number = number + mem.number = self.special2mem(number) + else: + mem.extd_number = '' + mem.number = number + mem.immutable = immutable row += 1 - self._radio.set_memory(mem) - self.refresh_memory(mem.number, mem) + try: + if mem.empty: + self.erase_memory(mem.number) + self._radio.check_set_memory_immutable_policy(existing, + mem) + else: + mem = import_logic.import_mem(self._radio, srcrf, mem) + warns, errs = chirp_common.split_validation_msgs( + self._radio.validate_memory(mem)) + errormsgs.extend([(mem, e) for e in errs]) + errormsgs.extend([(mem, w) for w in warns]) + + # If we are not pasting into a radio of the same type, + # then unset the mem.extra bits which won't be compatible. + if not same_class: + mem.extra = [] + + if not errs: + # If we got error messages from validate, don't even + # try to set the memory, just like if import_logic + # was unable to make it compatible. + self.set_memory(mem) + modified = True + except (import_logic.DestNotCompatible, + chirp_common.ImmutableValueError, + errors.RadioError) as e: + LOG.warning('Pasted memory %s incompatible: %s' % ( + mem, str(e))) + errormsgs.append((mem, e)) + except Exception as e: + LOG.exception('Failed to paste: %s' % e) + errormsgs.append((mem, e)) + + if modified: + wx.PostEvent(self, common.EditorChanged(self.GetId())) + + if errormsgs: + errorextra = '' + if len(errormsgs) > 19: + errorextra = '\n' + _('...and %i more' % (len(errormsgs) - 19)) + errormsgs = errormsgs[:19] + d = wx.MessageDialog( + self, + _('Some memories are incompatible with this radio')) + msg = '\n'.join('[%s]: %s' % (mem.extd_number or mem.number, e) + for mem, e in errormsgs) + msg += errorextra + d.SetExtendedMessage(msg) + d.ShowModal() + + return True - def cb_paste(self, data): - if data.GetFormat() == common.CHIRP_DATA_MEMORY: - mems = pickle.loads(data.GetData().tobytes()) - self._cb_paste_memories(mems) - elif data.GetFormat() == wx.DF_UNICODETEXT: - LOG.debug('FIXME: handle pasted text: %r' % data.GetText()) + def cb_paste(self): + data = super().cb_paste() + if common.CHIRP_DATA_MEMORY in data.GetAllFormats(): + payload = pickle.loads(data.GetData().tobytes()) + LOG.debug('CHIRP-native paste: %r' % payload) + self._cb_paste_memories(payload) + elif wx.DF_UNICODETEXT in data.GetAllFormats(): + try: + mem = chirp_common.mem_from_text( + data.GetText()) + except Exception as e: + LOG.warning('Failed to parse pasted data %r: %s' % ( + data.GetText(), e)) + return + # Since matching the offset is kinda iffy, set our band plan + # set the offset, if a rule exists. + if mem.duplex in ('-', '+'): + self._set_memory_defaults(mem, 'offset') + LOG.debug('Generic text paste %r: %s' % ( + data.GetText(), mem)) + self._cb_paste_memories({'mems': [mem], + 'features': self._features}) else: - LOG.warning('Unknown data format %s' % data.GetFormat().Type) + LOG.warning('Unknown data format %s paste' % ( + data.GetFormat().Type)) + + def cb_delete(self): + selected_rows = self.get_selected_rows_safe() + for row in selected_rows: + self.delete_memory_at(row, None) + + def get_selected_rows_safe(self): + """Return the currently-selected rows + + If no rows are selected, use the row of the cursor + """ + selected = self._grid.GetSelectedRows() + if not selected: + selected = [self._grid.GetGridCursorRow()] + return selected + + def cb_move(self, direction): + selected = self.get_selected_rows_safe() + last_row = self._grid.GetNumberRows() - 1 + if direction < 0 and selected[0] == 0: + LOG.warning('Unable to move memories above first row') + return + elif direction > 0 and selected[-1] == last_row: + LOG.warning('Unable to move memories below last row') + return + elif abs(direction) != 1: + LOG.error('Move got direction %i; only +/-1 supported', direction) + return + + first = selected[0] + last = selected[-1] + new_indexes = [x + direction for x in selected] + + if direction < 0: + transplant = self._memory_cache[first + direction] + new_number = self.row2mem(last) + elif direction > 0: + transplant = self._memory_cache[last + direction] + new_number = self.row2mem(first) + + LOG.debug('Transplanting %s to %i for move indexes: %s -> %s', + transplant, new_number, selected, new_indexes) + transplant.number = new_number + + to_set = [transplant] + self._grid.ClearSelection() + for old_row, new_row in zip(selected, new_indexes): + mem = self._memory_cache[old_row] + new_number = self.row2mem(new_row) + LOG.debug('Moving %s to %i', mem, new_number) + mem.number = new_number + to_set.append(mem) + self._grid.SelectRow(new_row, True) + + for mem in to_set: + self.set_memory(mem) + cursor_r, cursor_c = self._grid.GetGridCursorCoords() + self._grid.SetGridCursor(cursor_r + direction, cursor_c) + + wx.PostEvent(self, common.EditorChanged(self.GetId())) + + def cb_goto(self, number, column=0): + self._grid.GoToCell(self.mem2row(number), column) + self._grid.SelectRow(self.mem2row(number)) + + def cb_find(self, text): + search_cols = ('freq', 'name', 'comment') + cols = [self._col_defs.index(self._col_def_by_name(x)) + for x in search_cols] + num_rows = self._grid.GetNumberRows() + try: + current_row = self._grid.GetSelectedRows()[0] + 1 + except IndexError: + current_row = 0 + for row in range(current_row, current_row + num_rows): + # Start at current row, and wrap around + row_num = row % num_rows + for col in cols: + if text.lower() in self._grid.GetCellValue( + row_num, col).lower(): + self.cb_goto(self.row2mem(row_num), col) + return True + return False def select_all(self): self._grid.SelectAll() @@ -634,28 +2016,101 @@ class ChirpMemEdit(common.ChirpEditor, common.ChirpSyncEditor): last = first + self._grid.GetScrollPageSize(wx.VERTICAL) return first, last + def get_scroll_pos(self): + return self._grid.GetViewStart() + + def set_scroll_pos(self, pos): + self._grid.Scroll(*pos) + + def export_to_file(self, filename): + if not filename.lower().endswith('.csv'): + raise Exception(_('Export can only write CSV files')) + selected = self._grid.GetSelectedRows() + if len(selected) <= 1: + selected = range(0, self._grid.GetNumberRows()) + + r = generic_csv.CSVRadio(None) + # The CSV driver defaults to a single non-empty memory at location + # zero, so delete it before we go to export. + r.erase_memory(0) + for row in selected: + m = self._memory_cache[row] + if m.extd_number: + # We don't export specials + continue + if not m.empty: + m = import_logic.import_mem(r, self._features, m, + mem_cls=chirp_common.Memory) + r.set_memory(m) + r.save(filename) + LOG.info('Wrote exported CSV to %s' % filename) + + def get_selected_memories(self, or_all=True): + rows = self._grid.GetSelectedRows() + if len(rows) <= 1 and or_all: + rows = list(range(self._grid.GetNumberRows())) + return [self._memory_cache[r] for r in rows] + class ChirpLiveMemEdit(ChirpMemEdit, common.ChirpAsyncEditor): pass +class DVMemoryAsSettings(settings.RadioSettingGroup): + def __init__(self, radio, dvmemory): + self._dvmemory = dvmemory + super(DVMemoryAsSettings, self).__init__('dvmemory', 'DV Memory') + + features = radio.get_features() + + fields = {'dv_urcall': 'URCALL', + 'dv_rpt1call': 'RPT1Call', + 'dv_rpt2call': 'RPT2Call', + 'dv_code': _('Digital Code')} + + for field, title in fields.items(): + value = getattr(dvmemory, field) + + if isinstance(value, int): + rsv = settings.RadioSettingValueInteger(0, 99, value) + elif features.requires_call_lists and 'call' in field: + if 'urcall' in field: + calls = radio.get_urcall_list() + elif 'rpt' in field: + calls = radio.get_repeater_call_list() + else: + LOG.error('Unhandled call type %s' % field) + calls = [] + rsv = settings.RadioSettingValueList( + calls, + getattr(dvmemory, field)) + else: + rsv = settings.RadioSettingValueString(0, 8, str(value)) + + rs = settings.RadioSetting(field, title, rsv) + self.append(rs) + + class ChirpMemPropDialog(wx.Dialog): - def __init__(self, memories, memedit, *a, **k): + def __init__(self, memedit, memories, *a, **k): if len(memories) == 1: - title = 'Edit details for memory %i' % memories[0].number + title = _('Edit details for memory %i') % memories[0].number else: - title = 'Edit details for %i memories' % len(memories) - - super(ChirpMemPropDialog, self).__init__( - memedit, *a, title=title, **k) + title = _('Edit details for %i memories') % len(memories) - self.Centre() + super().__init__(memedit, *a, title=title, **k) - self._memories = memories - self._col_defs = memedit._col_defs + self._memories = [mem.dupe() for mem in memories] + self._col_defs = list(memedit._col_defs) + self._radio = memedit._radio - # The first memory sets the defaults + # The first non-empty memory sets the defaults memory = self._memories[0] + for mem in self._memories: + if not mem.empty: + memory = mem + break + self.default_memory = memory self._tabs = wx.Notebook(self) @@ -663,68 +2118,120 @@ class ChirpMemPropDialog(wx.Dialog): self.SetSizer(vbox) vbox.Add(self._tabs, 1, wx.EXPAND) - self._pg = wx.propgrid.PropertyGrid(self._tabs) - self._tabs.InsertPage(0, self._pg, 'Values') + self._pg = wx.propgrid.PropertyGrid(self._tabs, + style=wx.propgrid.PG_BOLD_MODIFIED) + self._pg.Bind(wx.propgrid.EVT_PG_CHANGED, self._mem_prop_changed) + self._tabs.InsertPage(0, self._pg, _('Values')) + page_index = 0 + self._extra_page = None + self._dv_page = None if memory.extra: - self._tabs.InsertPage(1, common.ChirpSettingGrid(memory.extra, - self._tabs), - 'Extra') - - for coldef in memedit._col_defs: - if coldef.valid: - self._pg.Append(coldef.get_propeditor(memory)) - self._pg.FitColumns() + page_index += 1 + self._extra_page = page_index + self._extra = common.ChirpSettingGrid(memory.extra, self._tabs) + self._tabs.InsertPage(page_index, self._extra, _('Extra')) + self._extra.propgrid.Bind(wx.propgrid.EVT_PG_CHANGED, + self._mem_extra_changed) + + if isinstance(memory, chirp_common.DVMemory): + page_index += 1 + self._dv_page = page_index + self._dv = common.ChirpSettingGrid( + DVMemoryAsSettings(memedit._radio, + memory), + self._tabs) + self._tabs.InsertPage(page_index, self._dv, _('DV Memory')) + self._dv.propgrid.Bind(wx.propgrid.EVT_PG_CHANGED, + self._mem_prop_changed) - hbox = wx.BoxSizer(wx.HORIZONTAL) - hbox.Add(wx.Button(self, wx.ID_OK)) - hbox.Add(wx.Button(self, wx.ID_CANCEL)) + for coldef in self._col_defs: + # Exclude mem.extra fields since they are handled on the extra + # page separately. + if coldef.valid and '.' not in coldef.name: + editor = coldef.get_propeditor(memory) + self._pg.Append(editor) + if coldef.name in memory.immutable: + editor.Enable(False) - vbox.Add(hbox, 0, wx.ALIGN_RIGHT | wx.ALL, border=10) + bs = self.CreateButtonSizer(wx.OK | wx.CANCEL) + vbox.Add(bs, 0, wx.ALIGN_RIGHT | wx.ALL, border=10) self.Bind(wx.EVT_BUTTON, self._button) + # OK button is disabled until something is changed + self.FindWindowById(wx.ID_OK).Enable(False) + + self.SetMinSize((400, 400)) + self.Fit() + self.Center() + wx.CallAfter(self._pg.FitColumns) + def _col_def_by_name(self, name): for coldef in self._col_defs: if coldef._name == name: return coldef LOG.error('No column definition for %s' % name) - def _make_memories(self): - memories = [memory.dupe() for memory in self._memories] - - for mem in memories: - for prop in self._pg._Items(): - name = prop.GetName() - - coldef = self._col_def_by_name(name) - value = prop.GetValueAsString() - value = coldef._digest_value(mem, value) - - if (getattr(self._memories[0], name) == value): - LOG.debug('Skipping unchanged field %s' % name) - continue - - LOG.debug('Value for %s is %r' % (name, value)) - setattr(mem, prop.GetName(), value) - mem.empty = False + def _update_mem(self, mem, prop, coldef): + name = prop.GetName().split(common.INDEX_CHAR)[0] + value = prop.GetValueAsString() + if coldef: + setattr(mem, name, coldef._digest_value(mem, value)) + elif value.isdigit(): + # Assume this is an integer (dv_code) and set it as + # such + setattr(mem, name, prop.GetValue()) + else: + setattr(mem, name, value) + LOG.debug('Changed mem %i %s=%r' % (mem.number, name, + value)) + if prop.GetName() == 'freq': + mem.empty = False - if self._tabs.GetPageCount() == 2: - extra = self._tabs.GetPage(1).get_values() - for setting in mem.extra: - name = setting.get_name() - try: - setting.value = extra[name] - except KeyError: - raise - LOG.warning('Missing setting %r' % name) - continue + def _mem_prop_changed(self, event): + self.FindWindowById(wx.ID_OK).Enable(True) - return memories + prop = event.GetProperty() + coldef = self._col_def_by_name(prop.GetName()) + for mem in self._memories: + try: + self._update_mem(mem, prop, coldef) + except chirp_common.ImmutableValueError as e: + LOG.warning('Memory %s: %s' % (mem.number, e)) + + def _mem_extra_changed(self, event): + self.FindWindowById(wx.ID_OK).Enable(True) + + prop = event.GetProperty() + name = prop.GetName().split(common.INDEX_CHAR)[0] + value = prop.GetValueAsString() + for mem in self._memories: + for setting in mem.extra: + if setting.get_name() == name: + if isinstance(setting.value, + settings.RadioSettingValueBoolean): + setting.value = value = prop.GetValue() + else: + setting.value = value + LOG.debug('Changed mem %i extra %s=%r' % ( + mem.number, setting.get_name(), value)) + + def _validate_memories(self): + for mem in self._memories: + msgs = self._radio.validate_memory(mem) + if msgs: + wx.MessageBox(_('Invalid edit: %s') % '; '.join(msgs), + 'Invalid Entry') + raise errors.InvalidValueError() def _button(self, event): button_id = event.GetEventObject().GetId() if button_id == wx.ID_OK: - self._memories = self._make_memories() + try: + self._validate_memories() + except errors.InvalidValueError: + # Leave the box open + return self.EndModal(button_id) diff --git a/chirp/wxui/printing.py b/chirp/wxui/printing.py new file mode 100644 index 0000000..3deb079 --- /dev/null +++ b/chirp/wxui/printing.py @@ -0,0 +1,117 @@ +# Copyright 2022 Dan Smith +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +import wx.html + +import yattag + +from chirp.wxui import common +from chirp.wxui import config +from chirp.wxui import report + +CONF = config.get() + + +class MemoryPrinter(wx.html.HtmlEasyPrinting): + def __init__(self, parent, radio, memedit): + super().__init__(name=_('Printing'), parentWindow=parent) + self._radio = radio + self._features = radio.get_features() + self._col_defs = memedit._col_defs + # Set some default printer and page options. + self.GetPrintData().SetPaperId(wx.PAPER_LETTER) # wx.PAPER_A4 + self.GetPrintData().SetOrientation(wx.LANDSCAPE) # wx.PORTRAIT + # Black and white printing if False. + self.GetPrintData().SetColour(False) + self.GetPageSetupData().SetMarginTopLeft((0, 5)) + self.GetPageSetupData().SetMarginBottomRight((10, 10)) + + # These are arbitrary defaults that seem to work okay. Let people + # override via the config for now + try: + self._font_size = CONF.get_int('font_size', 'printing') + except TypeError: + self._font_size = 8 + try: + self._rows_per_page = CONF.get_int('rows_per_page', 'printing') + except TypeError: + self._rows_per_page = 35 + self._normal_font = CONF.get('normal_font', 'printing') or 'Sans' + self._fixed_font = CONF.get('fixed_font', 'printing') or 'Courier' + self.SetStandardFonts(self._font_size, self._normal_font, + self._fixed_font) + + def _memory(self, doc, mem): + tag = doc.tag + with tag('td'): + with tag('tt'): + doc.text(mem.number) + for col_def in self._col_defs: + if not col_def.valid: + continue + with tag('td', 'nowrap'): + with tag('tt'): + doc.text(col_def.render_value(mem)) + + def _memory_table(self, doc, memories): + tag = doc.tag + row = 0 + + for i in range(0, len(memories), self._rows_per_page): + with tag('div', ('style', 'page-break-before:always')): + pass + with tag('table', ('border', '1'), ('width', '100%'), + ('cellspacing', '0')): + with tag('tr'): + with tag('th'): + doc.text('#') + for col_def in self._col_defs: + if not col_def.valid: + continue + with tag('th'): + pieces = col_def.label.split() + for piece in pieces: + doc.text(piece) + if piece != pieces[-1]: + doc.stag('br') + for row in range(i, i + self._rows_per_page): + try: + mem = memories[row] + except IndexError: + continue + with tag('tr'): + try: + self._memory(doc, mem) + except IndexError: + pass + + def _print(self, memories): + report.report_model(self._radio, 'print') + memories = [m for m in memories if not m.empty] + doc, tag, text = yattag.Doc().tagtext() + with tag('html'): + with tag('body'): + self._memory_table(doc, memories) + return doc + + @common.error_proof() + def print(self, memories): + doc = self._print(memories) + self.PrintText(doc.getvalue()) + + @common.error_proof() + def print_preview(self, memories): + doc = self._print(memories) + return self.PreviewText(doc.getvalue()) diff --git a/chirp/wxui/query_sources.py b/chirp/wxui/query_sources.py index 890db4e..3d8409c 100644 --- a/chirp/wxui/query_sources.py +++ b/chirp/wxui/query_sources.py @@ -1,39 +1,136 @@ +# Copyright 2022 Dan Smith +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + import logging import queue -import requests -import sys import tempfile import threading +import urllib import wx +import wx.adv -from chirp import CHIRP_VERSION -from chirp.ui import config -from chirp.ui import fips +from chirp import bandplan +from chirp.sources import base +from chirp.sources import dmrmarc +from chirp.sources import radioreference +from chirp.sources import repeaterbook +from chirp.sources import przemienniki +from chirp.wxui import common +from chirp.wxui import config CONF = config.get() LOG = logging.getLogger(__name__) QueryThreadEvent, EVT_QUERY_THREAD = wx.lib.newevent.NewCommandEvent() -HEADERS = { - 'User-Agent': 'chirp/%s Python %i.%i.%i %s' % ( - CHIRP_VERSION, - sys.version_info.major, sys.version_info.minor, sys.version_info.micro, - sys.platform), -} -class QueryThread(threading.Thread): +class NumberValidator(wx.Validator): + THING = 'Number' + MIN = 0 + MAX = 1 + OPTIONAL = True + + def Validate(self, window): + textctrl = self.GetWindow() + strvalue = textctrl.GetValue() + if not strvalue and self.OPTIONAL: + return True + try: + v = float(strvalue) + assert v >= self.MIN and v <= self.MAX + textctrl.SetBackgroundColour( + wx.SystemSettings.GetColour(wx.SYS_COLOUR_WINDOW)) + return True + except ValueError: + msg = _('Invalid %(value)s (use decimal degrees)') + except AssertionError: + msg = _('%(value)s must be between %(min)i and %(max)i') + textctrl.SetFocus() + textctrl.SetBackgroundColour('pink') + catalog = {'value': self.THING, + 'min': self.MIN, + 'max': self.MAX} + wx.MessageBox(msg % catalog, 'Invalid Entry') + return False + + def Clone(self): + return self.__class__() + + def TransferToWindow(self): + return True + + def SetWindow(self, win): + super().SetWindow(win) + # Clear the validation failure background color as soon as the value + # changes to avoid asking them to click OK on a dialog with a warning + # sign. + win.Bind(wx.EVT_TEXT, self._colorchange) + + def _colorchange(self, event): + self.GetWindow().SetBackgroundColour( + wx.SystemSettings.GetColour(wx.SYS_COLOUR_WINDOW)) + + +class LatValidator(NumberValidator): + THING = 'Latitude' + MIN = -90 + MAX = 90 + + +class LonValidator(NumberValidator): + THING = 'Longitude' + MIN = -180 + MAX = 180 + + +class DistValidator(NumberValidator): + THING = 'Distance' + MIN = 0 + MAX = 7000 + + +class ZipValidator(wx.Validator): + def Validate(self, window): + textctrl = self.GetWindow() + strvalue = textctrl.GetValue() + if len(strvalue) == 5 and strvalue.isdigit(): + return True + wx.MessageBox(_('Invalid ZIP code'), 'Invalid Entry') + return False + + def Clone(self): + return self.__class__() + + def TransferToWindow(self): + return True + + +class QueryThread(threading.Thread, base.QueryStatus): END_SENTINEL = object() def __init__(self, *a, **k): self.query_dialog = a[0] - super(QueryThread, self).__init__(*a[1:], **k) + self.radio = a[1] + super(QueryThread, self).__init__(*a[2:], **k) self.status_queue = queue.Queue() def run(self): try: - self.do_query() + self.radio.do_fetch(self, self.query_dialog.get_params()) except Exception as e: + LOG.exception('Failed to execute query: %s' % e) self.send_fail('Failed: %s' % str(e)) def send_status(self, status, percent): @@ -47,33 +144,69 @@ class QueryThread(threading.Thread): class QuerySourceDialog(wx.Dialog): + NAME = 'NetworkSource' + def __init__(self, *a, **k): super(QuerySourceDialog, self).__init__(*a, **k) + self.result_radio = None + vbox = self.build() self.Center() - self.gauge = wx.Gauge(self) - self.gauge.SetRange(100) - vbox.Add(self.gauge, 0, wx.EXPAND) - self.statusmsg = wx.StaticText( self, label='', style=(wx.ALIGN_CENTRE_HORIZONTAL | wx.ST_NO_AUTORESIZE | wx.ST_ELLIPSIZE_END)) - vbox.Add(self.statusmsg, 0, wx.EXPAND) + vbox.Add(self.statusmsg, proportion=0, border=5, + flag=wx.EXPAND | wx.BOTTOM) + + self.gauge = wx.Gauge(self) + self.gauge.SetRange(100) + vbox.Add(self.gauge, proportion=0, border=10, + flag=wx.EXPAND | wx.LEFT | wx.RIGHT) + + link_label = urllib.parse.urlparse(self.get_link()).netloc + link = wx.adv.HyperlinkCtrl(vbox.GetContainingWindow(), + label=link_label, url=self.get_link(), + style=wx.adv.HL_ALIGN_CENTRE) + vbox.Insert(0, link, proportion=0, border=10, + flag=(wx.LEFT | wx.RIGHT | wx.BOTTOM | + wx.ALIGN_CENTER_HORIZONTAL)) + info = wx.StaticText(vbox.GetContainingWindow(), + style=wx.ALIGN_CENTER_HORIZONTAL) + info.SetLabelMarkup(self.get_info()) + vbox.Insert(0, info, proportion=0, border=10, + flag=wx.EXPAND | wx.LEFT | wx.RIGHT | wx.TOP) bs = self.CreateButtonSizer(wx.OK | wx.CANCEL) - vbox.Add(bs) + vbox.Add(bs, border=10, flag=wx.ALL) self.Bind(wx.EVT_BUTTON, self._button) self.Bind(EVT_QUERY_THREAD, self._got_status) - self.result_file = tempfile.NamedTemporaryFile(suffix='.csv').name + self.SetMinSize((400, 200)) + self.Fit() + wx.CallAfter(self.Center) + + vbox.GetContainingWindow().InitDialog() + + self.result_file = tempfile.NamedTemporaryFile( + prefix='%s-' % self.NAME, + suffix='.csv').name + + def _call_validations(self, parent): + for child in parent.GetChildren(): + if not child.Validate(): + return False + self._call_validations(child) + return True def _button(self, event): id = event.GetEventObject().GetId() if id == wx.ID_OK: + if not self._call_validations(self): + return self.FindWindowById(wx.ID_OK).Disable() self.do_query() return @@ -84,8 +217,19 @@ class QuerySourceDialog(wx.Dialog): pass def do_query(self): + LOG.info('Starting QueryThread for %s' % self.result_radio) + LOG.debug('Query Parameters: %s' % self.get_params()) + QueryThread(self, self.result_radio).start() + + def get_params(self): pass + def get_info(self): + return '' + + def get_link(self): + return '' + def status(self, status, percent): wx.PostEvent(self, QueryThreadEvent(self.GetId(), status=status, percent=percent)) @@ -97,7 +241,7 @@ class QuerySourceDialog(wx.Dialog): self.status(reason, 100) def _got_status(self, event): - self.gauge.SetValue(event.percent) + self.gauge.SetValue(int(event.percent)) if event.status is None: self.EndModal(wx.ID_OK) else: @@ -106,200 +250,592 @@ class QuerySourceDialog(wx.Dialog): self.FindWindowById(wx.ID_OK).Enable() -class RepeaterBookQueryThread(QueryThread): - def do_query(self): - self.send_status('Querying', 10) - - params = self.query_dialog.get_rb_params() - r = requests.get('http://chirp.danplanet.com/%s' % params.pop('_url'), - params=params, - headers=HEADERS, - stream=True) - if r.status_code != 200: - self.send_fail('Got error code %i from server' % r.status_code) +class RepeaterBookQueryDialog(QuerySourceDialog): + NAME = 'Repeaterbook' + + def get_info(self): + return ( + "RepeaterBook is Amateur Radio's most comprehensive,\n" + "worldwide, FREE repeater directory.") + + def get_link(self): + return 'https://repeaterbook.com' + + def build(self): + vbox = wx.BoxSizer(wx.VERTICAL) + self.SetSizer(vbox) + panel = wx.Panel(self) + vbox.Add(panel, proportion=1, border=10, + flag=wx.EXPAND | wx.BOTTOM) + grid = wx.FlexGridSizer(2, 5, 0) + grid.AddGrowableCol(1) + panel.SetSizer(grid) + + self._country = wx.Choice(panel, choices=repeaterbook.COUNTRIES) + prev = CONF.get('country', 'repeaterbook') + if prev and prev in repeaterbook.COUNTRIES: + self._country.SetStringSelection(prev) + else: + self._country.SetStringSelection(repeaterbook.NA_COUNTRIES[0]) + self._country.Bind(wx.EVT_CHOICE, self._state_selected) + self._add_grid(grid, _('Country'), self._country) + + self._service = wx.Choice(panel, choices=[_('Amateur'), + _('GMRS')]) + self._service.Bind(wx.EVT_CHOICE, self._service_selected) + self._add_grid(grid, _('Service'), self._service) + + self._state = wx.Choice(panel, choices=[]) + self._add_grid(grid, _('State/Province'), self._state) + + self._lat = wx.TextCtrl(panel, + value=CONF.get('lat', 'repeaterbook') or '', + validator=LatValidator()) + self._lat.SetHint(_('Optional: 45.0000')) + self._lat.SetToolTip(_('If set, sort results by distance from ' + 'these coordinates')) + self._lon = wx.TextCtrl(panel, + value=CONF.get('lon', 'repeaterbook') or '', + validator=LonValidator()) + self._lon.SetHint(_('Optional: -122.0000')) + self._lon.SetToolTip(_('If set, sort results by distance from ' + 'these coordinates')) + self._add_grid(grid, _('Latitude'), self._lat) + self._add_grid(grid, _('Longitude'), self._lon) + + self._dist = wx.TextCtrl(panel, + value=CONF.get('dist', 'repeaterbook') or '', + validator=DistValidator()) + self._dist.SetHint(_('Optional: 100')) + self._dist.SetToolTip(_('Limit results to this distance (km) from ' + 'coordinates')) + self._add_grid(grid, _('Distance'), self._dist) + + self._search = wx.TextCtrl(panel) + self._search.SetHint(_('Optional: County, Hospital, etc.')) + self._search.SetToolTip(_('Filter results with location matching ' + 'this string')) + self._add_grid(grid, _('Filter'), self._search) + + self._bands = bandplan.BandPlans(CONF).get_repeater_bands() + self._limit_bands = [] + self._bandfilter = wx.CheckBox(panel, label=_('Only certain bands')) + self.Bind(wx.EVT_CHECKBOX, self._select_bands, self._bandfilter) + self._add_grid(grid, _('Limit Bands'), self._bandfilter) + + self._limit_modes = list(repeaterbook.MODES) + self._modefilter = wx.CheckBox(panel, label=_('Only certain modes')) + self.Bind(wx.EVT_CHECKBOX, self._select_modes, self._modefilter) + self._add_grid(grid, _('Limit Modes'), self._modefilter) + + self._state_selected(None) + self._service_selected(None) + + self.Layout() + return vbox + + def _service_selected(self, event): + is_gmrs = _('GMRS') in self._service.GetStringSelection() + self._bandfilter.Enable(not is_gmrs) + self._modefilter.Enable(not is_gmrs) + + def _state_selected(self, event): + country = self._country.GetStringSelection() + if country == 'United States': + self._service.Enable(True) + self._service.SetStringSelection( + CONF.get('service', 'repeaterbook') or _('Amateur')) + else: + self._service.Enable(False) + self._service.SetSelection(0) + + try: + states = repeaterbook.STATES[country] + except KeyError: + self._state.SetItems([_('All')]) + self._state.Enable(False) + return + self._state.SetItems(states) + self._state.Enable(True) + prev = CONF.get('state', 'repeaterbook') + if prev and prev in states: + self._state.SetStringSelection(prev) + else: + self._state.SetStringSelection(states[0]) + + def _add_grid(self, grid, label, widget): + grid.Add(wx.StaticText(widget.GetParent(), label=label), + border=20, flag=wx.ALIGN_CENTER | wx.RIGHT | wx.LEFT) + grid.Add(widget, 1, border=20, flag=wx.EXPAND | wx.RIGHT | wx.LEFT) + + def _select_bands(self, event): + if not self._bandfilter.IsChecked(): + self._limit_bands = [] return - self.send_status('Downloading', 20) - - size = 0 - chunks = 0 - LOG.debug('Writing to %s' % self.query_dialog.result_file) - with open(self.query_dialog.result_file, 'wb') as f: - for chunk in r.iter_content(chunk_size=8192): - size += len(chunk) - chunks += 1 - self.send_status('Read %iKiB' % (size // 1024), - 20 + max(chunks * 10, 80)) - f.write(chunk) - - if size <= 105: - self.send_fail('No results!') + band_names = [x.name for x in self._bands] + d = wx.MultiChoiceDialog(self, _('Select Bands'), _('Bands'), + choices=band_names) + prev = CONF.get('bands', 'repeaterbook') or '' + d.SetSelections([i for i, band in enumerate(self._bands) + if band.name in prev.split(',')]) + r = d.ShowModal() + if r == wx.ID_CANCEL or not d.GetSelections(): + self._bandfilter.SetValue(False) + self._limit_bands = [] + else: + self._limit_bands = [self._bands[i].limits + for i in d.GetSelections()] + CONF.set('bands', ','.join(self._bands[i].name + for i in d.GetSelections()), + 'repeaterbook') + + def _select_modes(self, event): + if not self._modefilter.IsChecked(): + self._limit_modes = [] return - self.send_end() + d = wx.MultiChoiceDialog(self, _('Select Modes'), _('Modes'), + choices=repeaterbook.MODES) + r = d.ShowModal() + if r == wx.ID_CANCEL or not d.GetSelections(): + self._modefilter.SetValue(False) + self._limit_modes = [] + else: + self._limit_modes = [repeaterbook.MODES[i] + for i in d.GetSelections()] + def do_query(self): + CONF.set('lat', self._lat.GetValue(), 'repeaterbook') + CONF.set('lon', self._lon.GetValue(), 'repeaterbook') + CONF.set('dist', self._dist.GetValue(), 'repeaterbook') + CONF.set('state', self._state.GetStringSelection(), 'repeaterbook') + CONF.set('country', self._country.GetStringSelection(), 'repeaterbook') + CONF.set('service', self._service.GetStringSelection(), 'repeaterbook') + self.result_radio = repeaterbook.RepeaterBook() + super().do_query() + + def get_params(self): + service = self._service.GetStringSelection() + return { + 'country': self._country.GetStringSelection(), + 'state': self._state.GetStringSelection(), + 'lat': self._lat.GetValue(), + 'lon': self._lon.GetValue(), + 'dist': self._dist.GetValue(), + 'filter': self._search.GetValue(), + 'bands': self._limit_bands, + 'modes': self._limit_modes, + 'service': 'gmrs' if service == _('GMRS') else '', + 'service_display': self._service.GetStringSelection(), + } + + +class DMRMARCQueryDialog(QuerySourceDialog): + NAME = 'DMR-MARC' -class RepeaterBookQueryDialog(QuerySourceDialog): - RB_BANDS = { - "--All--": 0, - "10 meters (29MHz)": 29, - "6 meters (54MHz)": 5, - "2 meters (144MHz)": 14, - "1.25 meters (220MHz)": 22, - "70 centimeters (440MHz)": 4, - "33 centimeters (900MHz)": 9, - "23 centimeters (1.2GHz)": 12, - } + def _add_grid(self, grid, label, widget): + grid.Add(wx.StaticText(widget.GetParent(), label=label), + border=20, flag=wx.ALIGN_CENTER | wx.RIGHT | wx.LEFT) + grid.Add(widget, 1, border=20, flag=wx.EXPAND | wx.RIGHT | wx.LEFT) def build(self): - self.tabs = wx.Notebook(self) vbox = wx.BoxSizer(wx.VERTICAL) self.SetSizer(vbox) - vbox.Add(self.tabs, 1, wx.EXPAND) + panel = wx.Panel(self) + vbox.Add(panel, 1, flag=wx.EXPAND | wx.ALL, border=20) + grid = wx.FlexGridSizer(2, 5, 0) + grid.AddGrowableCol(1) + panel.SetSizer(grid) + + self._city = wx.TextCtrl(panel, + value=CONF.get('city', 'dmrmarc') or '') + self._add_grid(grid, _('City'), self._city) + self._state = wx.TextCtrl(panel, + value=CONF.get('state', 'dmrmarc') or '') + self._add_grid(grid, _('State'), self._state) + self._country = wx.TextCtrl(panel, + value=CONF.get('country', 'dmrmarc') or '') + self._add_grid(grid, _('Country'), self._country) - self.tabs.InsertPage(0, self._build_political(self.tabs), 'Political') - self.tabs.InsertPage(1, self._build_proximity(self.tabs), 'Proximity') - self.Layout() return vbox - def _build_band_choice(self, parent): - return wx.Choice(parent, choices=list(self.RB_BANDS.keys())) + def get_info(self): + return 'The DMR-MARC Worldwide Network' + + def get_link(self): + return 'https://www.dmr-marc.net' + + def do_query(self): + CONF.set('city', self._city.GetValue(), 'dmrmarc') + CONF.set('state', self._state.GetValue(), 'dmrmarc') + CONF.set('country', self._country.GetValue(), 'dmrmarc') + self.result_radio = dmrmarc.DMRMARCRadio() + super().do_query() + + def get_params(self): + return {'city': CONF.get('city', 'dmrmarc'), + 'state': CONF.get('state', 'dmrmarc'), + 'country': CONF.get('country', 'dmrmarc')} + + +class PrzemiennikiQueryDialog(QuerySourceDialog): + NAME = 'przemienniki.net' + _section = 'przemienniki' + _countries = sorted( + ['at', 'bg', 'by', 'ch', 'cz', 'de', 'dk', 'es', 'fi', + 'fr', 'hu', 'is', 'it', 'lt', 'lv', 'no', 'nl', 'pl', + 'ro', 'ru', 'se', 'si', 'sk', 'ua', 'uk']) + _bands = ['10m', '4m', '6m', '2m', '70cm', + '23cm', '13cm', '3cm'] + _modes = ['FM', 'MOTOTRBO', 'DSTAR', 'C4FM', 'ECHOLINK', + 'FMLINK', 'APCO25', 'ATV'] def _add_grid(self, grid, label, widget): grid.Add(wx.StaticText(widget.GetParent(), label=label), border=20, flag=wx.ALIGN_CENTER | wx.RIGHT | wx.LEFT) grid.Add(widget, 1, border=20, flag=wx.EXPAND | wx.RIGHT | wx.LEFT) - def _build_political(self, parent): - panel = wx.Panel(parent) + def build(self): + vbox = wx.BoxSizer(wx.VERTICAL) + self.SetSizer(vbox) + panel = wx.Panel(self) + vbox.Add(panel, 1, flag=wx.EXPAND | wx.ALL, border=20) grid = wx.FlexGridSizer(2, 5, 0) grid.AddGrowableCol(1) + panel.SetSizer(grid) - self._state = wx.Choice(panel, choices=sorted(fips.FIPS_STATES.keys())) - self.Bind(wx.EVT_CHOICE, self._selected_state, self._state) - self._county = wx.Choice(panel, choices=['--All--']) - self.Bind(wx.EVT_CHOICE, self._selected_county, self._county) - self._pol_band = self._build_band_choice(panel) - self.Bind(wx.EVT_CHOICE, self._selected_band, self._pol_band) + # Mode + self._mode = wx.Choice(panel, choices=self._modes) + prev = CONF.get('mode', self._section) - self._fips_to_state = {str(v): k for k, v in fips.FIPS_STATES.items()} + if prev and prev in self._modes: + self._mode.SetStringSelection(prev) + else: + self._mode.SetStringSelection(self._modes[0]) + self._add_grid(grid, _('Mode'), self._mode) - current_state = CONF.get('state', 'repeaterbook') - current_county = CONF.get('county', 'repeaterbook') - if not current_state: - current_state = '1' - self._state.SetSelection( - self._state.FindString(self._fips_to_state[current_state])) - self._selected_state_name(self._fips_to_state[current_state]) + # Band selection + if CONF.is_defined('band', self._section): + CONF.remove_option('band', self._section) - try: - _fips_to_county = { - str(v): k - for k, v in fips.FIPS_COUNTIES[int(current_state)].items()} - self._county.SetSelection( - self._county.FindString(_fips_to_county[current_county])) - except Exception: - if current_county: - LOG.warning('Missing county code %r in state %r' % ( - current_county, - current_state)) - - self._add_grid(grid, 'State', self._state) - self._add_grid(grid, 'County', self._county) - self._add_grid(grid, 'Band', self._pol_band) + self._bandfilter = wx.CheckBox(panel, label=_('Only certain bands')) + self.Bind(wx.EVT_CHECKBOX, self._select_bands, self._bandfilter) + self._add_grid(grid, _('Limit Bands'), self._bandfilter) - vbox = wx.BoxSizer(wx.VERTICAL) - vbox.Add(grid, proportion=0, flag=wx.EXPAND, - border=20) - panel.SetSizer(vbox) - return panel + # Only working + if CONF.is_defined('workingstatus', self._section): + self._limit_onlyworking = CONF.get_bool('workingstatus', + self._section) + else: + self._limit_onlyworking = True + self._onlyworkingfilter = wx.CheckBox(panel, + label=_('Only working repeaters') + ) + self._onlyworkingfilter.SetValue(self._limit_onlyworking) + CONF.set_bool('workingstatus', self._limit_onlyworking, self._section) + self.Bind(wx.EVT_CHECKBOX, self._select_workingstatus, + self._onlyworkingfilter) + self._add_grid(grid, _('Limit Status'), self._onlyworkingfilter) + + # Country + self._country = wx.Choice(panel, choices=self._countries) + prev = CONF.get('country', self._section) + + if prev and prev in self._countries: + self._country.SetStringSelection(prev) + else: + self._country.SetStringSelection('pl') + self._add_grid(grid, _('Country'), self._country) + + # Coordinates + self._lat = wx.TextCtrl(panel, + value=CONF.get('lat', 'repeaterbook') or '', + validator=LatValidator()) + self._lat.SetHint(_('Optional: 45.0000')) + self._lat.SetToolTip(_('If set, sort results by distance from ' + 'these coordinates')) + self._lon = wx.TextCtrl(panel, + value=CONF.get('lon', 'repeaterbook') or '', + validator=LonValidator()) + self._lon.SetHint(_('Optional: -122.0000')) + self._lon.SetToolTip(_('If set, sort results by distance from ' + 'these coordinates')) + self._add_grid(grid, _('Latitude'), self._lat) + self._add_grid(grid, _('Longitude'), self._lon) + self._dist = wx.TextCtrl(panel, + value=CONF.get('dist', 'repeaterbook') or '', + validator=DistValidator()) + self._dist.SetHint(_('Optional: 100')) + self._dist.SetToolTip(_('Limit results to this distance (km) from ' + 'coordinates')) + self._add_grid(grid, _('Distance'), self._dist) - def _selected_state(self, event): - self._selected_state_name(event.GetString()) + return vbox - def _selected_state_name(self, state): - counties = sorted(fips.FIPS_COUNTIES[fips.FIPS_STATES[state]].keys()) - self._county.Set(counties) - CONF.set('state', str(fips.FIPS_STATES[state]), 'repeaterbook') - self._selected_county_name(counties[0]) + def _select_workingstatus(self, event): + if not self._onlyworkingfilter.IsChecked(): + self._limit_onlyworking = False + else: + self._limit_onlyworking = True + CONF.set_bool('workingstatus', self._limit_onlyworking, self._section) + return - def _selected_county(self, event): - self._selected_county_name(event.GetString()) + def _select_bands(self, event): + if not self._bandfilter.IsChecked(): + CONF.set('band', '', self._section) + return - def _selected_county_name(self, county): - state = CONF.get('state', 'repeaterbook') - try: - state = int(state) - except ValueError: - pass - county_code = str(fips.FIPS_COUNTIES[state][county]) - if county_code == '%': - CONF.remove_option('county', 'repeaterbook') + band_names = [x for x in self._bands] + d = wx.MultiChoiceDialog(self, _('Select Bands'), _('Bands'), + choices=band_names) + + d.SetSelections([i for i, band in enumerate(self._bands) + if band in ['2m', '70cm']]) + r = d.ShowModal() + if r == wx.ID_CANCEL or not d.GetSelections(): + self._bandfilter.SetValue(False) else: - CONF.set('county', county_code, 'repeaterbook') + CONF.set('band', ','.join(self._bands[i] + for i in d.GetSelections()), + self._section) + + def get_info(self): + return _('FREE repeater database, which provides most up-to-date\n' + 'information about repeaters in Europe. No account is\n' + 'required.') + + def get_link(self): + return 'https://przemienniki.net' + + def do_query(self): + CONF.set('country', self._country.GetStringSelection(), self._section) + CONF.set('mode', self._mode.GetStringSelection(), self._section) + CONF.set('lat', self._lat.GetValue(), 'repeaterbook') + CONF.set('lon', self._lon.GetValue(), 'repeaterbook') + CONF.set('dist', self._dist.GetValue(), 'repeaterbook') + self.result_radio = przemienniki.Przemienniki() + super().do_query() + + def get_params(self): + params = { + 'country': CONF.get('country', self._section), + 'band': CONF.get('band', self._section), + 'mode': CONF.get('mode', self._section).lower(), + 'latitude': CONF.get('lat', 'repeaterbook'), + 'longitude': CONF.get('lon', 'repeaterbook'), + 'range': CONF.get('dist', 'repeaterbook'), + } + + if CONF.get_bool('workingstatus', self._section): + params['onlyworking'] = 'Yes' + + return params + + +class RRQueryDialog(QuerySourceDialog): + NAME = 'RadioReference' + + def get_info(self): + return ( + "RadioReference.com is the world's largest\n" + "radio communications data provider\n" + "Premium account required") + + def get_link(self): + return 'https://www.radioreference.com/apps/content/?cid=3' + + def _add_grid(self, grid, label, widget): + grid.Add(wx.StaticText(widget.GetParent(), label=label), + border=20, flag=wx.ALIGN_CENTER | wx.RIGHT | wx.LEFT) + grid.Add(widget, 1, border=20, flag=wx.EXPAND | wx.RIGHT | wx.LEFT) - def _build_proximity(self, parent): + def build(self): + self.result_radio = radioreference.RadioReferenceRadio() + self.tabs = wx.Notebook(self) + vbox = wx.BoxSizer(wx.VERTICAL) + self.SetSizer(vbox) + + panel = wx.Panel(self) + grid = wx.FlexGridSizer(3, 5, 0) + grid.AddGrowableCol(1) + panel.SetSizer(grid) + vbox.Add(panel, proportion=0, flag=wx.EXPAND) + + # build the login elements + self._rrusername = wx.TextCtrl( + panel, value=CONF.get('username', 'radioreference') or '') + self._add_grid(grid, 'Username', self._rrusername) + grid.Add(wx.StaticText(panel, label=''), + border=20, flag=wx.ALIGN_CENTER | wx.RIGHT | wx.LEFT) + + self._rrpassword = wx.TextCtrl( + panel, style=wx.TE_PASSWORD, + value=CONF.get_password('password', + 'radioreference') or '') + self._add_grid(grid, 'Password', self._rrpassword) + + vbox.Add(self.tabs, proportion=1, border=10, + flag=wx.EXPAND | wx.BOTTOM | wx.TOP) + self.tabs.InsertPage(0, self.build_us(self.tabs), _('United States')) + self.tabs.InsertPage(1, self.build_ca(self.tabs), _('Canada')) + + return vbox + + def _call_validations(self, parent): + if parent == self: + # If we're calling valiations at the top-level, redirect that to + # the start of our country-specific widgets, based on whatever tab + # is selected. This avoids trying to validate US things when + # Canada is selected and so on. + parent = self.tabs.GetPage(self.tabs.GetSelection()) + return super()._call_validations(parent) + + def build_ca(self, parent): panel = wx.Panel(parent) - grid = wx.FlexGridSizer(2, 5, 0) + grid = wx.FlexGridSizer(3, 5, 0) grid.AddGrowableCol(1) - self._location = wx.TextCtrl(panel) - self._location.AppendText(CONF.get('location', 'repeaterbook') or '') - self.Bind(wx.EVT_TEXT, self._selected_location, self._location) - self._distance = wx.TextCtrl(panel) - self._distance.AppendText(CONF.get('distance', 'repeaterbook') or '') - self.Bind(wx.EVT_TEXT, self._selected_distance, self._distance) - self._prox_band = self._build_band_choice(panel) - self.Bind(wx.EVT_CHOICE, self._selected_band, self._prox_band) + # build a new login button + self._loginbutton = wx.Button(panel, label='Log In') + grid.Add(self._loginbutton) + self._loginbutton.Bind(wx.EVT_BUTTON, self._populateca) - self._add_grid(grid, 'Location', self._location) - self._add_grid(grid, 'Distance', self._distance) - self._add_grid(grid, 'Band', self._prox_band) + # build a prov/county selector grid & add selectors + self._provchoice = wx.Choice(panel, choices=['Log in First']) + self.Bind(wx.EVT_CHOICE, self.selected_province, self._provchoice) + self._add_grid(grid, 'Province', self._provchoice) + grid.Add(wx.StaticText(panel, label=''), + border=20, flag=wx.ALIGN_CENTER | wx.RIGHT | wx.LEFT) - vbox = wx.BoxSizer(wx.VERTICAL) - vbox.Add(grid, flag=wx.EXPAND, - border=20) - panel.SetSizer(vbox) - return panel + self._countychoice = wx.Choice(panel, choices=['Log in First']) + self._add_grid(grid, 'County', self._countychoice) + self.Bind(wx.EVT_CHOICE, self.selected_county, self._countychoice) + grid.Add(wx.StaticText(panel, label=''), + border=20, flag=wx.ALIGN_CENTER | wx.RIGHT | wx.LEFT) - def _selected_location(self, event): - CONF.set('location', event.GetString(), 'repeaterbook') + if radioreference.CA_PROVINCES: + self.populateprov() - def _selected_distance(self, event): - CONF.set('distance', event.GetString(), 'repeaterbook') + panel.SetSizer(grid) + return panel + + def build_us(self, parent): + panel = wx.Panel(parent) + grid = wx.FlexGridSizer(2, 5, 0) + grid.AddGrowableCol(1) + panel.SetSizer(grid) + self._uszip = wx.TextCtrl( + panel, + value=CONF.get('zipcode', 'radioreference') or '', + validator=ZipValidator()) + self._add_grid(grid, 'ZIP Code', self._uszip) - def _selected_band(self, event): - CONF.set('band', str(self.RB_BANDS[event.GetString()]), 'repeaterbook') + return panel + def _populateca(self, event): + button = event.GetEventObject() + button.Disable() + okay = self.FindWindowById(wx.ID_OK) + okay.Disable() + + def cb(result): + wx.CallAfter(okay.Enable) + if isinstance(result, Exception): + self.status('Failed: %s' % result, 0) + wx.CallAfter(button.Enable) + else: + self.status('Logged in', 0) + wx.CallAfter(self.populateprov) + self.status('Attempting login...', 0) + radioreference.RadioReferenceCAData( + cb, + self._rrusername.GetValue(), + self._rrpassword.GetValue()).start() + + def populateprov(self): + self._provchoice.SetItems([str(x) for x in + radioreference.CA_PROVINCES.keys()]) + self.getconfdefaults() + self._provchoice.SetStringSelection(self.default_prov) + self._selected_province(self.default_prov) + self._countychoice.SetStringSelection(self.default_county) + self._selected_county(self.default_county) + self._loginbutton.Enable(False) + + def getconfdefaults(self): + code = CONF.get("province", "radioreference") + for k, v in radioreference.CA_PROVINCES.items(): + if code == str(v): + self.default_prov = k + break + else: + self.default_prov = "BC" + code = CONF.get("county", "radioreference") + for row in radioreference.CA_COUNTIES: + if code == str(row[2]): + self.default_county = row[3] + break + else: + self.default_county = 0 + LOG.debug('Default province=%r county=%r' % (self.default_prov, + self.default_county)) + + def selected_province(self, event): + self._selected_province(event.GetEventObject().GetStringSelection()) + + def _selected_province(self, chosenprov): + # if user alters the province dropdown, load the new counties into + # the county dropdown choice + for name, id in radioreference.CA_PROVINCES.items(): + if name == chosenprov: + CONF.set_int('province', id, 'radioreference') + LOG.debug('Province id %s for %s' % (id, name)) + break + self._countychoice.Clear() + for x in radioreference.CA_COUNTIES: + if x[1] == chosenprov: + self._countychoice.Append(x[3]) + self._selected_county(self._countychoice.GetItems()[0]) + + def selected_county(self, event): + self._selected_county(self._countychoice.GetStringSelection()) + + def _selected_county(self, chosencounty): + self._ca_county_id = 0 + for _, prov, cid, county in radioreference.CA_COUNTIES: + if county == chosencounty: + self._ca_county_id = cid + break + CONF.set_int('county', self._ca_county_id, 'radioreference') + LOG.debug('County id %s for %s' % (self._ca_county_id, chosencounty)) + + @common.error_proof() def do_query(self): - RepeaterBookQueryThread(self).start() - - def get_rb_params(self): - page = self.tabs.GetSelection() - if page == 0: - # Political - return { - '_url': 'query/rb/1.0/chirp', - 'state_id': CONF.get('state', 'repeaterbook'), - 'county_id': CONF.get('county', 'repeaterbook') or '%', - 'func': 'default', - 'band': CONF.get('band', 'repeaterbook') or '%', - 'freq': '%', - 'band6': '%', - 'loc': '%', - 'status_id': '%', - 'features': '%', - 'coverage': '%', - 'use': '%', - } - elif page == 1: - # Proximity - try: - return { - '_url': 'query/rb/1.0/app_direct', - 'loc': CONF.get('location', 'repeaterbook'), - 'dist': int(CONF.get('distance', 'repeaterbook')), - 'band': CONF.get('band', 'repeaterbook') or '%', - } - except (TypeError, ValueError): - raise Exception('Distance must be a number!') + CONF.set('username', self._rrusername.GetValue(), 'radioreference') + CONF.set_password('password', self._rrpassword.GetValue(), + 'radioreference') + + CONF.set('zipcode', self._uszip.GetValue(), 'radioreference') + + self.result_radio.set_auth( + CONF.get('username', 'radioreference'), + CONF.get_password('password', 'radioreference')) + + if self.tabs.GetSelection() == 1: + # CA + if not radioreference.CA_PROVINCES: + raise Exception(_('RadioReference Canada requires a login ' + 'before you can query')) + + super().do_query() + + def get_params(self): + if self.tabs.GetSelection() == 0: + # US + return {'zipcounty': self._uszip.GetValue(), + 'country': 'US'} + else: + # CA + return {'zipcounty': '%s' % self._ca_county_id, + 'country': 'CA'} diff --git a/chirp/wxui/radioinfo.py b/chirp/wxui/radioinfo.py new file mode 100644 index 0000000..8b7f3e9 --- /dev/null +++ b/chirp/wxui/radioinfo.py @@ -0,0 +1,104 @@ +# Copyright 2022 Dan Smith +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +import wx +import wx.propgrid + +from chirp.drivers import icf +from chirp import util +from chirp.wxui import common + + +class ChirpRadioInfo(common.ChirpEditor, common.ChirpSyncEditor): + def __init__(self, radio, *a, **k): + super(ChirpRadioInfo, self).__init__(*a, **k) + + self._radio = radio + self._features = radio.get_features() + + sizer = wx.BoxSizer(wx.VERTICAL) + self.SetSizer(sizer) + + self._group_control = wx.Listbook(self, style=wx.LB_LEFT) + sizer.Add(self._group_control, 1, wx.EXPAND) + + self._add_features_group() + self._add_vendor() + self._add_metadata() + + def _add_features_group(self): + pg = wx.propgrid.PropertyGrid( + self, style=wx.propgrid.PG_SPLITTER_AUTO_CENTER) + self._group_control.AddPage(pg, _('Features')) + + for key in self._features._valid_map.keys(): + value = getattr(self._features, key) + if isinstance(value, list): + value = ','.join(str(v) or _('(none)') for v in value) + p = wx.propgrid.StringProperty( + key, key, + value=str(value)) + p.Enable(False) + pg.Append(p) + + pg.Sort() + + def _add_vendor(self): + # This should really be an interface on the radio, but there + # is only one example for the moment, so just cheat. + if not isinstance(self._radio, icf.IcomCloneModeRadio): + return + + pg = wx.propgrid.PropertyGrid( + self, style=wx.propgrid.PG_SPLITTER_AUTO_CENTER) + self._group_control.AddPage(pg, 'Icom') + + attrs = dict(self._radio._icf_data) + attrs.update({ + 'modelid': ''.join('%02x' % util.byte_to_int(b) + for b in self._radio._model), + 'endframe': self._radio._endframe, + 'raw': self._radio._raw_frames, + 'memsize': '0x%X' % self._radio._memsize, + }) + + for key, value in attrs.items(): + p = wx.propgrid.StringProperty( + key, key, + value=str(value)) + p.Enable(False) + pg.Append(p) + + pg.Sort() + + def _add_metadata(self): + if not self._radio.metadata: + return + + pg = wx.propgrid.PropertyGrid( + self, style=wx.propgrid.PG_SPLITTER_AUTO_CENTER) + self._group_control.AddPage(pg, 'Image Metadata') + # Don't show the icom fields which are displayed elsewhere, and + # don't dump the whole mem_extra blob in here + exclude = ('modelid', 'endframe', 'raw', 'memsize', + 'mem_extra') + for key, value in self._radio.metadata.items(): + if key in exclude: + continue + p = wx.propgrid.StringProperty(key, key, value=str(value)) + p.Enable(False) + pg.Append(p) + + pg.Sort() diff --git a/chirp/wxui/radiothread.py b/chirp/wxui/radiothread.py index 35357c4..47c6e63 100644 --- a/chirp/wxui/radiothread.py +++ b/chirp/wxui/radiothread.py @@ -1,3 +1,18 @@ +# Copyright 2022 Dan Smith +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + import logging import queue import threading @@ -44,7 +59,8 @@ class RadioJob: return self.score < job.score or self.jobnumber < job.jobnumber def __repr__(self): - return '%s(%s,%s)=%r' % ( + return '<%s@%i>%s(%s,%s)=%r' % ( + self.__class__.__name__, self.score, self.fn, ','.join(repr(a) for a in self.args), @@ -61,6 +77,12 @@ class RadioJob: LOG.debug('Radio finished %r' % self) +class BackgroundRadioJob(RadioJob): + @property + def score(self): + return 100 + + class RadioThread(threading.Thread): SENTINEL = RadioJob(None, 'END', [], {}) @@ -76,6 +98,11 @@ class RadioThread(threading.Thread): self._queue.put(job) return job.id + def background(self, editor, fn, *a, **k): + job = BackgroundRadioJob(editor, fn, a, k) + self._queue.put(job) + return job.id + def end(self): self._queue.put(self.SENTINEL) diff --git a/chirp/wxui/report.py b/chirp/wxui/report.py new file mode 100644 index 0000000..d2ca771 --- /dev/null +++ b/chirp/wxui/report.py @@ -0,0 +1,118 @@ +# Copyright 2022 Dan Smith +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +import functools +import logging +import requests +import threading +import uuid +import platform + +try: + import wx +except ImportError: + wx = None + +from chirp import CHIRP_VERSION +from chirp.wxui import config + +CONF = config.get() +LOG = logging.getLogger(__name__) +logging.getLogger('urllib3.connectionpool').setLevel(logging.INFO) +SESSION = None +DISABLED = False +SEM = threading.Semaphore(2) +BASE = 'http://chirp.danplanet.com/report' + + +def get_environment(): + if wx: + wx_ver = wx.version() + else: + wx_ver = 'None' + return ' // '.join(['Python/%s' % platform.python_version(), + '%s/%s' % (platform.system(), + platform.platform()), + 'CHIRP/%s' % CHIRP_VERSION, + 'wx/%s' % wx_ver]) + + +class ReportThread(threading.Thread): + def __init__(self, fn): + self.__fn = fn + super(ReportThread, self).__init__() + + def run(self): + global DISABLED + + try: + self.__fn() + except Exception as e: + LOG.info('Disabling reporting because %s' % e) + DISABLED = True + finally: + SEM.release() + + +def ensure_session(): + global SESSION + if SESSION is None: + SESSION = requests.Session() + SESSION.headers = { + 'User-Agent': 'CHIRP/%s' % CHIRP_VERSION, + 'X-CHIRP-UUID': CONF.get('seat', 'state'), + 'X-CHIRP-Environment': get_environment(), + } + + +def with_session(fn): + + @functools.wraps(fn) + def wrapper(*args, **kwargs): + global DISABLED + + if DISABLED: + return + + if not SEM.acquire(False): + return + + if not CONF.is_defined('seat', 'state'): + CONF.set('seat', str(uuid.uuid4()), 'state') + + ensure_session() + + t = ReportThread(functools.partial(fn, SESSION, *args, **kwargs)) + t.start() + + return wrapper + + +@with_session +def check_for_updates(session, callback): + r = session.get('%s/latest' % BASE) + callback(r.json()['latest']) + + +@with_session +def report_model(session, rclass, op): + if CONF.get_bool('no_report', 'global', False): + return + + session.post('%s/usage' % BASE, + json={'vendor': rclass.VENDOR, + 'model': rclass.MODEL, + 'variant': rclass.VARIANT, + 'op': op}) diff --git a/chirp/wxui/settingsedit.py b/chirp/wxui/settingsedit.py index d68d0d4..24e568d 100644 --- a/chirp/wxui/settingsedit.py +++ b/chirp/wxui/settingsedit.py @@ -1,3 +1,18 @@ +# Copyright 2022 Dan Smith +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + import logging import wx @@ -15,15 +30,17 @@ class ChirpSettingsEdit(common.ChirpEditor): self._radio = radio self._settings = None + self._propgrid = None sizer = wx.BoxSizer(wx.VERTICAL) self.SetSizer(sizer) - self._group_control = wx.Listbook(self, style=wx.LB_LEFT) + self._group_control = wx.Treebook(self, style=wx.LB_LEFT) + self._group_control.GetTreeCtrl().SetMinSize((250, -1)) sizer.Add(self._group_control, 1, wx.EXPAND) self._initialized = False - self._group_control.Bind(wx.EVT_PAINT, self._activate) + self._restore_selection = None def _initialize(self, job): self.stop_wait_dialog() @@ -32,28 +49,55 @@ class ChirpSettingsEdit(common.ChirpEditor): raise job.result self._settings = job.result self._load_settings() + if self._restore_selection is not None: + self._group_control.SetSelection(self._restore_selection) + self._restore_selection = None - def _activate(self, event): + def selected(self): if not self._initialized: self._initialized = True - self.start_wait_dialog('Getting settings') + self.start_wait_dialog(_('Getting settings')) self.do_radio(lambda job: wx.CallAfter(self._initialize, job), 'get_settings') + def get_scroll_pos(self): + return self._group_control.GetSelection() + + def set_scroll_pos(self, pos): + try: + self._group_control.SetSelection(pos) + except AssertionError: + # If we're in the middle of a load, stash the position so we will + # restore it once we have everything. + self._restore_selection = pos + + def refresh(self): + self._restore_selection = self._group_control.GetSelection() + self._group_control.DeleteAllPages() + # Next select will re-load everything + self._initialized = False + def _load_settings(self): for group in self._settings: self._add_group(group) - self._group_control.Layout() + self.Layout() - def _add_group(self, group): + def _add_group(self, group, parent=None): propgrid = common.ChirpSettingGrid(group, self._group_control) + self._propgrid = propgrid self.Bind(common.EVT_EDITOR_CHANGED, self._changed, propgrid) - LOG.debug('Adding page for %s' % group.get_shortname()) - self._group_control.AddPage(propgrid, group.get_shortname()) + LOG.debug('Adding page for %s (parent=%s)' % (group.get_shortname(), + parent)) + if parent is not None: + self._group_control.InsertSubPage(parent, propgrid, + group.get_shortname()) + else: + self._group_control.AddPage(propgrid, group.get_shortname()) for element in group.values(): if not isinstance(element, settings.RadioSetting): - self._add_group(element) + self._add_group(element, + parent=self._group_control.FindPage(propgrid)) def cb_copy(self, cut=False): pass @@ -66,14 +110,26 @@ class ChirpSettingsEdit(common.ChirpEditor): for i in range(self._group_control.GetPageCount()): page = self._group_control.GetPage(i) for name, (setting, val) in page.get_setting_values().items(): - LOG.debug('Setting %s:%s=%r' % (page.name, - setting.get_name(), - val)) - setting.value = val + if isinstance(setting.value, list): + values = setting.value + else: + values = [setting.value] + for j, value in enumerate(values): + if not value.get_mutable(): + LOG.debug('Skipping immutable setting %r' % ( + setting.get_name())) + continue + LOG.debug('Setting %s:%s[%i]=%r' % (page.name, + setting.get_name(), + j, + val)) + realname, index = name.split(common.INDEX_CHAR) + if int(index) == j: + setting[j] = val return True except Exception as e: LOG.exception('Failed to apply settings') - wx.MessageBox(str(e), 'Error applying settings', + wx.MessageBox(str(e), _('Error applying settings'), wx.OK | wx.ICON_ERROR) return False @@ -86,11 +142,22 @@ class ChirpSettingsEdit(common.ChirpEditor): else: self._apply_setting_group(all_values, element) + def _set_settings_cb(self, job): + if isinstance(job.result, Exception): + common.error_proof.show_error(str(job.result)) + + def _reload(self): + self.refresh() + self.selected() + def _changed(self, event): if not self._apply_settings(): return - self.do_radio(None, 'set_settings', self._settings) + self.do_radio(self._set_settings_cb, 'set_settings', self._settings) wx.PostEvent(self, common.EditorChanged(self.GetId())) + if self._propgrid.needs_reload: + LOG.warning('Settings grid needs a reload') + wx.CallAfter(self._reload) def saved(self): for i in range(self._group_control.GetPageCount()): diff --git a/chirpc b/chirpc deleted file mode 100644 index c7aa2cf..0000000 --- a/chirpc +++ /dev/null @@ -1,403 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2008 Dan Smith -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -import glob -import serial -import os -import sys -import argparse -import logging - -from chirp import logger -# from chirp.drivers import * -from chirp import chirp_common, errors, directory, util -from chirp.ui import compat - -directory.safe_import_drivers() - -LOG = logging.getLogger("chirpc") -RADIOS = directory.DRV_TO_RADIO - - -def fail_unsupported(): - LOG.error("Operation not supported by selected radio") - sys.exit(1) - - -def fail_missing_mmap(): - LOG.error("mmap-only operation requires specification of an mmap file") - sys.exit(1) - - -class ToneAction(argparse.Action): - def __call__(self, parser, namespace, values, option_string=None): - value = values[0] - if value not in chirp_common.TONES: - raise argparse.ArgumentError( - self, "Invalid tone value: %.1f" % value) - setattr(namespace, self.dest, value) - - -class DTCSAction(argparse.Action): - def __call__(self, parser, namespace, values, option_string=None): - value = values[0] - if value not in chirp_common.DTCS_CODES: - raise argparse.ArgumentError( - self, "Invalid DTCS value: %03i" % value) - setattr(namespace, self.dest, value) - - -class DTCSPolarityAction(argparse.Action): - def __call__(self, parser, namespace, values, option_string=None): - value = values[0] - if value not in ["NN", "RN", "NR", "RR"]: - raise argparse.ArgumentError( - self, "Invalid DTCS polarity: %s" % value) - setattr(namespace, self.dest, value) - - -def parse_memory_number(radio, args): - if len(args) < 1: - LOG.error("You must provide an argument specifying the memory number.") - sys.exit(1) - - try: - memnum = int(args[0]) - except ValueError: - memnum = args[0] - - rf = radio.get_features() - start, end = rf.memory_bounds - if not (start <= memnum <= end or memnum in rf.valid_special_chans): - if len(rf.valid_special_chans) > 0: - LOG.error( - "memory number must be between %d and %d or one of %s" - " (got %s)", - start, end, ", ".join(rf.valid_special_chans), memnum) - else: - LOG.error("memory number must be between %d and %d (got %s)", - start, end, memnum) - sys.exit(1) - return memnum - - -if __name__ == "__main__": - parser = argparse.ArgumentParser() - logger.add_version_argument(parser) - parser.add_argument("-s", "--serial", dest="serial", - default="mmap", - help="Serial port (default: mmap)") - - parser.add_argument("--list-settings", action="store_true", - help="List settings") - - parser.add_argument("-i", "--id", dest="id", - default=False, - action="store_true", - help="Request radio ID string") - - memarg = parser.add_argument_group("Memory/Channel Options") - memarg.add_argument("--list-mem", action="store_true", - help="List all memory locations") - - memarg.add_argument("--list-special-mem", action="store_true", - help="List all special memory locations") - - memarg.add_argument("--raw", action="store_true", - help="Dump raw memory location") - - memarg.add_argument("--get-mem", action="store_true", - help="Get and print memory location") - memarg.add_argument("--copy-mem", action="store_true", - help="Copy memory location") - memarg.add_argument("--clear-mem", action="store_true", - help="Clear memory location") - - memarg.add_argument("--set-mem-name", help="Set memory name") - memarg.add_argument("--set-mem-freq", type=float, - help="Set memory frequency") - - memarg.add_argument("--set-mem-tencon", action="store_true", - help="Set tone encode enabled flag") - memarg.add_argument("--set-mem-tencoff", action="store_true", - help="Set tone decode disabled flag") - memarg.add_argument("--set-mem-tsqlon", action="store_true", - help="Set tone squelch enabled flag") - memarg.add_argument("--set-mem-tsqloff", action="store_true", - help="Set tone squelch disabled flag") - memarg.add_argument("--set-mem-dtcson", action="store_true", - help="Set DTCS enabled flag") - memarg.add_argument("--set-mem-dtcsoff", action="store_true", - help="Set DTCS disabled flag") - - memarg.add_argument("--set-mem-tenc", - type=float, action=ToneAction, nargs=1, - help="Set memory encode tone") - memarg.add_argument("--set-mem-tsql", - type=float, action=ToneAction, nargs=1, - help="Set memory squelch tone") - - memarg.add_argument("--set-mem-dtcs", - type=int, action=DTCSAction, nargs=1, - help="Set memory DTCS code") - memarg.add_argument("--set-mem-dtcspol", - action=DTCSPolarityAction, nargs=1, - help="Set memory DTCS polarity (NN, NR, RN, RR)") - - memarg.add_argument("--set-mem-dup", - help="Set memory duplex (+,-, or blank)") - memarg.add_argument("--set-mem-offset", type=float, - help="Set memory duplex offset (in MHz)") - - memarg.add_argument("--set-mem-mode", - help="Set mode (%s)" % ",".join(chirp_common.MODES)) - - parser.add_argument("-r", "--radio", dest="radio", - default=None, - help="Radio model (see --list-radios)") - parser.add_argument("--list-radios", action="store_true", - help="List radio models") - parser.add_argument("--mmap", dest="mmap", - default=None, - help="Radio memory map file location") - parser.add_argument("--download-mmap", dest="download_mmap", - action="store_true", - default=False, - help="Download memory map from radio") - parser.add_argument("--upload-mmap", dest="upload_mmap", - action="store_true", - default=False, - help="Upload memory map to radio") - logger.add_arguments(parser) - parser.add_argument("args", metavar="arg", nargs='*', - help="Some commands require additional arguments") - - if len(sys.argv) <= 1: - parser.print_help() - sys.exit(0) - - options = parser.parse_args() - args = options.args - - logger.handle_options(options) - - if options.list_radios: - print("Supported Radios:\n\t", "\n\t".join(sorted(RADIOS.keys()))) - sys.exit(0) - - if options.id: - from chirp import detect - md = detect.detect_icom_radio(options.serial) - print("Model:\n%s" % md.MODEL) - sys.exit(0) - - if not options.radio: - if options.mmap: - rclass = directory.get_radio_by_image(options.mmap).__class__ - else: - print("You must specify a radio model. See --list-radios.") - sys.exit(1) - else: - rclass = directory.get_radio(options.radio) - - if options.serial == "mmap": - if options.mmap: - s = options.mmap - else: - s = options.radio + ".img" - if not os.path.exists(s): - LOG.error("Image file '%s' does not exist" % s) - sys.exit(1) - else: - LOG.info("opening %s at %i" % (options.serial, rclass.BAUD_RATE)) - s = compat.CompatSerial.get(rclass.NEEDS_COMPAT_SERIAL, - port=options.serial, - baudrate=rclass.BAUD_RATE, - timeout=0.5) - - radio = rclass(s) - - if options.list_settings: - print(radio.get_settings()) - sys.exit(0) - - if options.list_mem: - rf = radio.get_features() - start, end = rf.memory_bounds - for i in range(start, end + 1): - mem = radio.get_memory(i) - if mem.empty and not logger.is_visible(logging.INFO): - continue - print(mem) - sys.exit(0) - - if options.list_special_mem: - rf = radio.get_features() - for i in sorted(rf.valid_special_chans): - mem = radio.get_memory(i) - if mem.empty and not logger.is_visible(logging.INFO): - continue - print(mem) - sys.exit(0) - - if options.copy_mem: - src = parse_memory_number(radio, args) - dst = parse_memory_number(radio, args[1:]) - try: - mem = radio.get_memory(src) - except errors.InvalidMemoryLocation as e: - LOG.exception(e) - sys.exit(1) - LOG.info("copying memory %s to %s", src, dst) - mem.number = dst - radio.set_memory(mem) - - if options.clear_mem: - memnum = parse_memory_number(radio, args) - try: - mem = radio.get_memory(memnum) - except errors.InvalidMemoryLocation as e: - LOG.exception(e) - sys.exit(1) - if mem.empty: - LOG.warn("memory %s is already empty, deleting again", memnum) - mem.empty = True - radio.set_memory(mem) - - if options.raw: - memnum = parse_memory_number(radio, args) - data = radio.get_raw_memory(memnum) - for i in data: - if ord(i) > 0x7F: - print("Memory location %s (%i):\n%s" % - (memnum, len(data), util.hexprint(data))) - sys.exit(0) - print(data) - sys.exit(0) - - if options.set_mem_dup is not None: - if options.set_mem_dup != "+" and \ - options.set_mem_dup != "-" and \ - options.set_mem_dup != "": - LOG.error("Invalid duplex value `%s'" % options.set_mem_dup) - LOG.error("Valid values are: '+', '-', ''") - sys.exit(1) - else: - _dup = options.set_mem_dup - else: - _dup = None - - if options.set_mem_mode: - LOG.info("Set mode: %s" % options.set_mem_mode) - if options.set_mem_mode not in chirp_common.MODES: - LOG.error("Invalid mode `%s'") - sys.exit(1) - else: - _mode = options.set_mem_mode - else: - _mode = None - - if options.set_mem_name or options.set_mem_freq or \ - options.set_mem_tencon or options.set_mem_tencoff or \ - options.set_mem_tsqlon or options.set_mem_tsqloff or \ - options.set_mem_dtcson or options.set_mem_dtcsoff or \ - options.set_mem_tenc or options.set_mem_tsql or \ - options.set_mem_dtcs or options.set_mem_dup is not None or \ - options.set_mem_mode or options.set_mem_dtcspol or\ - options.set_mem_offset: - memnum = parse_memory_number(radio, args) - try: - mem = radio.get_memory(memnum) - except errors.InvalidMemoryLocation as e: - LOG.exception(e) - sys.exit(1) - - if mem.empty: - LOG.info("creating new memory (#%s)", memnum) - mem = chirp_common.Memory() - mem.number = memnum - - mem.name = options.set_mem_name or mem.name - mem.freq = options.set_mem_freq or mem.freq - mem.rtone = options.set_mem_tenc or mem.rtone - mem.ctone = options.set_mem_tsql or mem.ctone - mem.dtcs = options.set_mem_dtcs or mem.dtcs - mem.dtcs_polarity = options.set_mem_dtcspol or mem.dtcs_polarity - if _dup is not None: - mem.duplex = _dup - mem.offset = options.set_mem_offset or mem.offset - mem.mode = _mode or mem.mode - - if options.set_mem_tencon: - mem.tencEnabled = True - elif options.set_mem_tencoff: - mem.tencEnabled = False - - if options.set_mem_tsqlon: - mem.tsqlEnabled = True - elif options.set_mem_tsqloff: - mem.tsqlEnabled = False - - if options.set_mem_dtcson: - mem.dtcsEnabled = True - elif options.set_mem_dtcsoff: - mem.dtcsEnabled = False - - radio.set_memory(mem) - - if options.get_mem: - pos = parse_memory_number(radio, args) - try: - mem = radio.get_memory(pos) - except errors.InvalidMemoryLocation as e: - mem = chirp_common.Memory() - mem.number = pos - - print(mem) - sys.exit(0) - - if options.download_mmap: - if not issubclass(rclass, chirp_common.CloneModeRadio): - LOG.error("%s is not a clone mode radio" % options.radio) - sys.exit(1) - if not options.mmap: - LOG.error("You must specify the destination file name with --mmap") - sys.exit(1) - try: - radio.sync_in() - radio.save_mmap(options.mmap) - except Exception as e: - LOG.exception(e) - sys.exit(1) - - if options.upload_mmap: - if not issubclass(rclass, chirp_common.CloneModeRadio): - LOG.error("%s is not a clone mode radio" % options.radio) - sys.exit(1) - if not options.mmap: - LOG.error("You must specify the source file name with --mmap") - sys.exit(1) - try: - radio.load_mmap(options.mmap) - radio.sync_out() - print("Upload successful") - except Exception as e: - LOG.exception(e) - sys.exit(1) - - if options.mmap and isinstance(radio, chirp_common.CloneModeRadio): - radio.save_mmap(options.mmap) diff --git a/chirpw b/chirpw deleted file mode 100755 index 481dd32..0000000 --- a/chirpw +++ /dev/null @@ -1,170 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2014 Dan Smith -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -import glob -import os -import six - -import sys -import os -import locale -import gettext -import argparse -import logging -import urllib - -if six.PY3: - from gi import pygtkcompat - pygtkcompat.enable() - pygtkcompat.enable_gtk(version='3.0') - -from chirp import chirp_common -from chirp import directory -from chirp import logger -from chirp import elib_intl -from chirp import platform -from chirp.ui import config - -directory.safe_import_drivers() - -LOG = logging.getLogger("chirpw") - -# Does not work with python3 chirpw -# urllib.URLopener.version = chirp_common.http_user_agent() - -localepath = platform.get_platform().find_resource("locale") - -conf = config.get() -manual_language = conf.get("language", "state") -langs = [] -if manual_language and manual_language != "Auto": - lang_codes = {"English": "en_US", - "Polish": "pl", - "Italian": "it", - "Dutch": "nl", - "German": "de", - "Hungarian": "hu", - "Russian": "ru", - "Portuguese (BR)": "pt_BR", - "French": "fr", - "Spanish": "es_ES", - "Chinese (Simplified)": "zh_CN", - 'Ukrainian': "uk_UA", - 'Turkish': "tr_TR", - } - try: - LOG.info("Language: %s", lang_codes[manual_language]) - langs = [lang_codes[manual_language]] - except KeyError: - LOG.error("Unsupported language `%s'" % manual_language) -else: - lc, encoding = locale.getdefaultlocale() - if (lc): - langs = [lc] - try: - langs += os.getenv("LANG").split(":") - except: - pass - -try: - if os.name == "nt": - elib_intl._putenv("LANG", langs[0]) - else: - os.putenv("LANG", langs[0]) -except IndexError: - pass -path = "locale" -gettext.bindtextdomain("CHIRP", localepath) -gettext.textdomain("CHIRP") -lang = gettext.translation("CHIRP", localepath, languages=langs, - fallback=True) - - -# Python <2.6 does not have str.format(), which chirp uses to make translation -# strings nicer. So, instead of installing the gettext standard "_()" function, -# we can install our own, which returns a string of the following class, -# which emulates the new behavior, thus allowing us to run on older Python -# versions. -class CompatStr(str): - def format(self, **kwargs): - base = lang.gettext(self) - for k, v in kwargs.items(): - base = base.replace("{%s}" % k, str(v)) - return base - -pyver = sys.version.split()[0] - -try: - vmaj, vmin, vrel = pyver.split(".", 3) -except: - vmaj, vmin = pyver.split(".", 2) - vrel = 0 - -if int(vmaj) == 2 and int(vmin) < 6: - # Python <2.6, emulate str.format() - import __builtin__ - - def lang_with_format(string): - return CompatStr(string) - __builtin__._ = lang_with_format -else: - # Python >=2.6, use normal gettext behavior - lang.install() - -parser = argparse.ArgumentParser() -parser.add_argument("files", metavar="file", nargs='*', help="File to open") -parser.add_argument("--module", metavar="module", - help="Load module on startup") -logger.add_version_argument(parser) -parser.add_argument("--profile", action="store_true", - help="Enable profiling") -logger.add_arguments(parser) -args = parser.parse_args() - -logger.handle_options(args) - -a = None -if True: - from chirp.ui import mainapp - a = mainapp.ChirpMain() - -# Be sure to load module before opening files -if args.module: - a.load_module(args.module) - -for i in args.files: - LOG.info("Opening %s", i) - a.do_open(i) - -a.show() - -if args.profile: - import cProfile - import pstats - import gtk - cProfile.run("gtk.main()", "chirpw.stats") - p = pstats.Stats("chirpw.stats") - p.sort_stats("cumulative").print_stats(10) -else: - import gtk - gtk.main() - -if config._CONFIG: - config._CONFIG.set("last_dir", - platform.get_platform().get_last_dir(), - "state") - config._CONFIG.save() diff --git a/chirpwx.py b/chirpwx.py deleted file mode 100755 index 96d3654..0000000 --- a/chirpwx.py +++ /dev/null @@ -1,64 +0,0 @@ -#!/usr/bin/env python3 - -import argparse -import gettext -import os -import sys - -import wx -import wx.aui -import wx.grid -import wx.lib.newevent - -from chirp import directory -from chirp import logger - -from chirp.ui import config -from chirp.wxui import main - - -if __name__ == '__main__': - gettext.install('CHIRP') - parser = argparse.ArgumentParser() - parser.add_argument("files", metavar="file", nargs='*', - help="File to open") - parser.add_argument("--module", metavar="module", - help="Load module on startup") - logger.add_version_argument(parser) - parser.add_argument("--profile", action="store_true", - help="Enable profiling") - parser.add_argument("--onlydriver", nargs="+", - help="Include this driver while loading") - parser.add_argument("--inspect", action="store_true", - help="Show wxPython inspector") - if sys.platform == 'linux': - parser.add_argument('--no-linux-gdk-backend', action='store_true', - help='Do not force GDK_BACKEND=x11') - logger.add_arguments(parser) - args = parser.parse_args() - - logger.handle_options(args) - - directory.safe_import_drivers(limit=args.onlydriver) - - CONF = config.get() - if CONF.get('developer', 'state'): - from chirp.drivers import fake - fake.register_fakes() - - # wxGTK on Wayland seems to have problems. Override GDK_BACKEND to - # use X11, unless we were asked not to - if sys.platform == 'linux' and not args.no_linux_gdk_backend: - os.putenv('GDK_BACKEND', 'x11') - - app = wx.App() - mainwindow = main.ChirpMain(None, title='CHIRP') - mainwindow.Show() - for fn in args.files: - mainwindow.open_file(fn, select=False) - - if args.inspect: - import wx.lib.inspection - wx.lib.inspection.InspectionTool().Show() - - app.MainLoop() diff --git a/locale/Makefile b/locale/Makefile deleted file mode 100644 index 3b880fa..0000000 --- a/locale/Makefile +++ /dev/null @@ -1,28 +0,0 @@ -LOCALES = en_US pl it nl de hu ru pt_BR fr uk_UA es_ES zh_CN tr_TR -MOFILES = $(patsubst %,%/LC_MESSAGES/CHIRP.mo,$(LOCALES)) - -COPY="Dan Smith " -PKG=CHIRP -XGT_OPTS=--copyright-holder=$(COPY) --package-name=$(PKG) - -all: $(MOFILES) - -clean: - rm -f $(MOFILES) *~ *.orig - find . -name '*.mo' -exec rm -f "{}" \; - find * -depth -type d -exec rmdir "{}" \; - -chirpui.pot: - /usr/bin/find ../chirp/ui -name '*.py' > .files - xgettext -L Python -k_ -o chirpui.pot -f .files $(XGT_OPTS) - -%.po: chirpui.pot - if [ -f $@ ]; then \ - msgmerge -U $@ chirpui.pot; \ - else \ - msginit --input=chirpui.pot --locale=$(@:%.po=%); \ - fi - -%/LC_MESSAGES/CHIRP.mo: %.po - mkdir -p $(shell dirname $@) - msgfmt --output-file=$@ $^ diff --git a/locale/check_parameters.py b/locale/check_parameters.py deleted file mode 100755 index f0f3d51..0000000 --- a/locale/check_parameters.py +++ /dev/null @@ -1,31 +0,0 @@ -#!/usr/bin/env python - -import polib -from string import Formatter -import glob - -filelist = glob.glob("*.po") -pos = {filename: polib.pofile(filename) for filename in filelist} - -formatter = Formatter() - -for name, po in pos.iteritems(): - print "Testing", name - for entry in po: - if len(entry.msgstr) > 0: - try: - ids = [field_name - for literal_text, field_name, format_spec, conversion - in formatter.parse(entry.msgid)] - tids = [field_name - for literal_text, field_name, format_spec, conversion - in formatter.parse(entry.msgstr)] - except Exception as e: - print "Got exception!", e, "for entry", entry.msgid - else: - if tids is not None: - missing = [name for name in tids - if name is not None and name not in ids] - if len(missing) > 0: - print "Missing parameters", missing, \ - "in translation of", entry.msgid diff --git a/locale/de.po b/locale/de.po deleted file mode 100644 index c7c8704..0000000 --- a/locale/de.po +++ /dev/null @@ -1,1081 +0,0 @@ -# German translations for CHIRP package. -# Copyright (C) 2012 Dan Smith -# This file is distributed under the same license as the CHIRP package. -# Dan Smith , 2012. -# -msgid "" -msgstr "" -"Project-Id-Version: CHIRP\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2012-10-02 00:01-0700\n" -"PO-Revision-Date: 2012-10-02 22:11+0100\n" -"Last-Translator: Benjamin, HB9EUK \n" -"Language-Team: German\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Language: de\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" -"X-Generator: Poedit 1.5.3\n" -"X-Poedit-SourceCharset: UTF-8\n" - -#: ../chirpui/bankedit.py:52 -msgid "Retrieving bank information" -msgstr "Abrufen der Speicherbank" - -#: ../chirpui/bankedit.py:75 -msgid "Setting name on bank" -msgstr "Setze Name für Bank" - -#: ../chirpui/bankedit.py:85 -msgid "Bank" -msgstr "Bank" - -#: ../chirpui/bankedit.py:86 ../chirpui/bankedit.py:258 -#: ../chirpui/importdialog.py:576 ../chirpui/memdetail.py:228 -#: ../chirpui/memedit.py:65 ../chirpui/memedit.py:86 ../chirpui/memedit.py:259 -#: ../chirpui/memedit.py:900 ../chirpui/memedit.py:956 -#: ../chirpui/memedit.py:1098 ../chirpui/memedit.py:1100 -msgid "Name" -msgstr "Name" - -#: ../chirpui/bankedit.py:201 -msgid "Updating bank index for memory {num}" -msgstr "Aktualisiere Bank Index für Speicher {num}" - -#: ../chirpui/bankedit.py:210 -msgid "Updating bank information for memory {num}" -msgstr "Aktualisiere Bankinformation für Speicher {num}" - -#: ../chirpui/bankedit.py:216 ../chirpui/bankedit.py:246 -msgid "Getting memory {num}" -msgstr "Lade Speicher {num}" - -#: ../chirpui/bankedit.py:231 -msgid "Setting index for memory {num}" -msgstr "Setze Index für Speicher {num}" - -#: ../chirpui/bankedit.py:240 -msgid "Getting bank for memory {num}" -msgstr "Lade Bank für Speicher {num}" - -#: ../chirpui/bankedit.py:256 ../chirpui/memedit.py:63 -#: ../chirpui/memedit.py:174 ../chirpui/memedit.py:258 -#: ../chirpui/memedit.py:327 ../chirpui/memedit.py:347 -#: ../chirpui/memedit.py:361 ../chirpui/memedit.py:432 -#: ../chirpui/memedit.py:444 ../chirpui/memedit.py:468 -#: ../chirpui/memedit.py:470 ../chirpui/memedit.py:543 -#: ../chirpui/memedit.py:557 ../chirpui/memedit.py:559 -#: ../chirpui/memedit.py:600 ../chirpui/memedit.py:602 -#: ../chirpui/memedit.py:643 ../chirpui/memedit.py:849 -#: ../chirpui/memedit.py:898 ../chirpui/memedit.py:924 -#: ../chirpui/memedit.py:937 ../chirpui/memedit.py:954 -#: ../chirpui/memedit.py:1275 -msgid "Loc" -msgstr "Loc" - -#: ../chirpui/bankedit.py:257 ../chirpui/importdialog.py:577 -#: ../chirpui/memdetail.py:227 ../chirpui/memedit.py:64 -#: ../chirpui/memedit.py:87 ../chirpui/memedit.py:189 -#: ../chirpui/memedit.py:252 ../chirpui/memedit.py:260 -#: ../chirpui/memedit.py:283 ../chirpui/memedit.py:308 -#: ../chirpui/memedit.py:316 ../chirpui/memedit.py:901 -#: ../chirpui/memedit.py:953 -msgid "Frequency" -msgstr "Frequenz" - -#: ../chirpui/bankedit.py:259 -msgid "Index" -msgstr "Index" - -#: ../chirpui/bankedit.py:346 -msgid "Getting bank information for memory {num}" -msgstr "Lade Bankinformation für Speicher {num}" - -#: ../chirpui/bankedit.py:368 -msgid "Getting bank information" -msgstr "Lade Bankinformation" - -#: ../chirpui/clone.py:35 -msgid "{vendor} {model} on {port}" -msgstr "{vendor} {model} auf {port}" - -#: ../chirpui/clone.py:103 ../chirpui/clone.py:104 ../chirpui/clone.py:166 -msgid "Detect" -msgstr "Erkennung" - -#: ../chirpui/clone.py:127 -msgid "Port" -msgstr "Port" - -#: ../chirpui/clone.py:128 -msgid "Vendor" -msgstr "Hersteller" - -#: ../chirpui/clone.py:129 -msgid "Model" -msgstr "Model" - -#: ../chirpui/clone.py:142 -msgid "Radio" -msgstr "Gerät" - -#: ../chirpui/clone.py:170 -msgid "Unable to detect radio on {port}" -msgstr "Kann Gerät auf {port} nicht erkennen" - -#: ../chirpui/clone.py:182 -msgid "Internal error: Unable to upload to {model}" -msgstr "Interner Fehler: Upload zu {model} nicht möglich" - -#: ../chirpui/clone.py:230 -msgid "Clone failed: {error}" -msgstr "Klonen fehlgeschlagen: {error}" - -#: ../chirpui/cloneprog.py:43 -msgid "Clone Progress" -msgstr "Klonen Fortschritt" - -#: ../chirpui/cloneprog.py:46 -msgid "Cloning" -msgstr "Klonen" - -#: ../chirpui/cloneprog.py:55 -msgid "Cancel" -msgstr "Abbrechen" - -#: ../chirpui/common.py:216 -msgid "Completed" -msgstr "Beendet" - -#: ../chirpui/common.py:217 -msgid "idle" -msgstr "Ruhezustand" - -#: ../chirpui/common.py:317 -msgid "Details" -msgstr "Details" - -#: ../chirpui/common.py:320 -msgid "Proceed?" -msgstr "Weiter?" - -#: ../chirpui/common.py:329 -msgid "Do not show this next time" -msgstr "Nicht wieder anzeigen" - -#: ../chirpui/dstaredit.py:40 -msgid "Callsign" -msgstr "Rufzeichen" - -#: ../chirpui/dstaredit.py:124 -msgid "Your callsign" -msgstr "Ihr Rufzeichen" - -#: ../chirpui/dstaredit.py:132 -msgid "Repeater callsign" -msgstr "Repeater Rufzeichen" - -#: ../chirpui/dstaredit.py:140 -msgid "My callsign" -msgstr "Mein Rufzeichen" - -#: ../chirpui/dstaredit.py:170 ../chirpui/memedit.py:1416 -msgid "Downloading URCALL list" -msgstr "Downloading URCALL Liste" - -#: ../chirpui/dstaredit.py:174 ../chirpui/memedit.py:1428 -msgid "Downloading RPTCALL list" -msgstr "Downloading RPTCALL Liste" - -#: ../chirpui/dstaredit.py:178 -msgid "Downloading MYCALL list" -msgstr "Downloading MYCALL Liste" - -#: ../chirpui/editorset.py:91 -msgid "Memories" -msgstr "Speicher" - -#: ../chirpui/editorset.py:96 -msgid "D-STAR" -msgstr "D-Star" - -#: ../chirpui/editorset.py:102 -msgid "Bank Names" -msgstr "Bank Namen" - -#: ../chirpui/editorset.py:108 -msgid "Banks" -msgstr "Bank" - -#: ../chirpui/editorset.py:114 -msgid "Settings" -msgstr "Einstellungen" - -#: ../chirpui/editorset.py:236 -msgid "The {vendor} {model} has multiple independent sub-devices" -msgstr "Der {vendor} {model} hat mehrere unabhängige Sub-Geräte" - -#: ../chirpui/editorset.py:239 -msgid "Choose one to import from:" -msgstr "Importieren von:" - -#: ../chirpui/editorset.py:244 -msgid "Cancelled" -msgstr "Abgebrochen" - -#: ../chirpui/editorset.py:249 -msgid "Internal Error" -msgstr "Interner Fehler" - -#: ../chirpui/editorset.py:281 -msgid "" -"There were errors while opening {file}. The affected memories will not be " -"importable!" -msgstr "" -"Es gab Fehler beim Öffnen {file}. Die betroffenen Speicher werden nicht " -"importiert!" - -#: ../chirpui/editorset.py:293 -msgid "There was an error during import: {error}" -msgstr "Es gab einen Fehler beim Import: {error}" - -#: ../chirpui/editorset.py:303 -msgid "Unsupported file type" -msgstr "Nicht unterstuetzter Dateityp" - -#: ../chirpui/editorset.py:319 ../chirpui/editorset.py:334 -msgid "There was an error during export: {error}" -msgstr "Es gab einen Fehler beim Export: {error}" - -#: ../chirpui/editorset.py:346 -msgid "Priming memory" -msgstr "Primärspeicher" - -#: ../chirpui/importdialog.py:90 -msgid "" -"Location {number} is already being imported. Choose another valü for 'New " -"Location' before selection 'Import'" -msgstr "" -"Standort {number} wurde bereits importiert. Wählen Sie einen anderen Wert " -"für 'Neuen Standort' vor der Auswahl 'Import'" - -#: ../chirpui/importdialog.py:123 -msgid "Invalid value. Must be an integer." -msgstr "Ungültiger Wert. Muss eine ganze Zahl sein." - -#: ../chirpui/importdialog.py:132 -msgid "Location {number} is already being imported" -msgstr "Standort {number} wurde bereits importiert" - -#: ../chirpui/importdialog.py:192 -msgid "Updating URCALL list" -msgstr "Updating URCALL Liste" - -#: ../chirpui/importdialog.py:197 -msgid "Updating RPTCALL list" -msgstr "Updating RPTCALL Liste" - -#: ../chirpui/importdialog.py:270 -msgid "Setting memory {number}" -msgstr "Setze Speicher {number}" - -#: ../chirpui/importdialog.py:274 -msgid "Importing bank information" -msgstr "Importieren von Speicherbänke" - -#: ../chirpui/importdialog.py:278 -msgid "Error importing memories:" -msgstr "Fehler beim Speicherimport" - -#: ../chirpui/importdialog.py:390 -msgid "All" -msgstr "Alle" - -#: ../chirpui/importdialog.py:396 -msgid "None" -msgstr "Keine" - -#: ../chirpui/importdialog.py:402 -msgid "Inverse" -msgstr "Umkehren" - -#: ../chirpui/importdialog.py:408 -msgid "Select" -msgstr "Wählen" - -#: ../chirpui/importdialog.py:454 -msgid "Auto" -msgstr "Auto" - -#: ../chirpui/importdialog.py:460 -msgid "Reverse" -msgstr "Zurücksetzen" - -#: ../chirpui/importdialog.py:466 -msgid "Adjust New Location" -msgstr "Neuen Standort wählen" - -#: ../chirpui/importdialog.py:476 -msgid "Confirm overwrites" -msgstr "Überschreiben bestätigen" - -#: ../chirpui/importdialog.py:482 -msgid "Options" -msgstr "Optionen" - -#: ../chirpui/importdialog.py:535 -msgid "Cannot be imported because" -msgstr "Kann nicht Importiert werden weil" - -#: ../chirpui/importdialog.py:553 -msgid "Import From File" -msgstr "Importieren von Datei" - -#: ../chirpui/importdialog.py:554 ../chirpui/mainapp.py:1360 -msgid "Import" -msgstr "Importieren" - -#: ../chirpui/importdialog.py:574 -msgid "To" -msgstr "Nach" - -#: ../chirpui/importdialog.py:575 -msgid "From" -msgstr "Von" - -#: ../chirpui/importdialog.py:578 ../chirpui/memdetail.py:245 -#: ../chirpui/memedit.py:79 ../chirpui/memedit.py:101 -#: ../chirpui/memedit.py:915 ../chirpui/memedit.py:971 -#: ../chirpui/memedit.py:1103 -msgid "Comment" -msgstr "Kommentar" - -#: ../chirpui/importdialog.py:582 -msgid "Location memory will be imported into" -msgstr "Speicherstandort wird importiert nach" - -#: ../chirpui/importdialog.py:583 -msgid "Location of memory in the file being imported" -msgstr "Speicherposition der importierten Datei" - -#: ../chirpui/importdialog.py:606 -msgid "Preparing memory list..." -msgstr "Speicher Liste vorbereiten..." - -#: ../chirpui/importdialog.py:615 -msgid "Export To File" -msgstr "In Datei exportieren" - -#: ../chirpui/importdialog.py:616 ../chirpui/mainapp.py:1361 -msgid "Export" -msgstr "Exportieren" - -#: ../chirpui/inputdialog.py:81 -msgid "An error has occurred" -msgstr "Ein Fehler ist aufgetreten" - -#: ../chirpui/inputdialog.py:130 -msgid "Overwrite" -msgstr "Überschreiben" - -#: ../chirpui/inputdialog.py:133 -msgid "File Exists" -msgstr "Datei existiert" - -#: ../chirpui/inputdialog.py:136 -msgid "The file {name} already exists. Do you want to overwrite it?" -msgstr "Datei {name} existiert bereit, wollen Sie diese überschreiben?" - -#: ../chirpui/mainapp.py:219 ../chirpui/mainapp.py:442 -msgid "Untitled" -msgstr "Namenlos" - -#: ../chirpui/mainapp.py:266 ../chirpui/mainapp.py:705 -msgid "CHIRP Radio Images" -msgstr "CHIRP Radio Images" - -#: ../chirpui/mainapp.py:267 ../chirpui/mainapp.py:704 -#: ../chirpui/mainapp.py:999 -msgid "CHIRP Files" -msgstr "CHIRP Datei" - -#: ../chirpui/mainapp.py:268 ../chirpui/mainapp.py:706 -#: ../chirpui/mainapp.py:998 -msgid "CSV Files" -msgstr "CSV Datei" - -#: ../chirpui/mainapp.py:269 ../chirpui/mainapp.py:707 -msgid "EVE Files (VX5)" -msgstr "EVE Files (VX5)" - -#: ../chirpui/mainapp.py:270 ../chirpui/mainapp.py:708 -msgid "ICF Files" -msgstr "ICF Datei" - -#: ../chirpui/mainapp.py:271 ../chirpui/mainapp.py:711 -msgid "VX5 Commander Files" -msgstr "VX5 Commander Files" - -#: ../chirpui/mainapp.py:272 ../chirpui/mainapp.py:712 -msgid "VX6 Commander Files" -msgstr "VX6 Commander Files" - -#: ../chirpui/mainapp.py:273 ../chirpui/mainapp.py:713 -msgid "VX7 Commander Files" -msgstr "VX7 Commander Files" - -#: ../chirpui/mainapp.py:283 -msgid "" -"ICF files cannot be edited, only displayed or imported into another file. " -"Open in read-only mode?" -msgstr "" -"ICF-Dateien können nicht bearbeitet werden, nur angezeigt oder importiert in " -"eine andere Datei. Öffnen im Read-Only-Modus?" - -#: ../chirpui/mainapp.py:326 -msgid "There was an error opening {fname}: {error}" -msgstr "Es gab einen Fehler beim Öffnen {fname}: {error}" - -#: ../chirpui/mainapp.py:341 -msgid "{num} errors during open:" -msgstr "{num} Fehler beim Öffnen:" - -#: ../chirpui/mainapp.py:347 -msgid "Note:" -msgstr "Hinweis:" - -#: ../chirpui/mainapp.py:348 -msgid "" -"The {vendor} {model} operates in live mode. This means that any " -"changes you make are immediately sent to the radio. Because of this, you " -"cannot perform the Save or Upload operations. If you wish to " -"edit the contents offline, please Export to a CSV file, using the " -"File menu." -msgstr "" -"Die {vendor} {model} arbeitet im Live-Modus. Dies bedeutet, dass " -"alle Änderungen sofort an das Radio gesendet werden. Aus diesem Grund können " -"Sie die Funktionen Speichern oder hochladen nicht " -"verwenden. Wenn Sie die Inhalte offline bearbeiten wollen, bitte mit " -"Exportieren in eine CSV-Datei speichern, unter Datei Exportieren ." - -#: ../chirpui/mainapp.py:357 -msgid "Don't show this again" -msgstr "Nicht wieder anzeigen" - -#: ../chirpui/mainapp.py:402 -msgid "{vendor} {model} image file" -msgstr "{vendor} {model} Imagedatei" - -#: ../chirpui/mainapp.py:410 -msgid "VX7 Commander" -msgstr "VX7 Commander" - -#: ../chirpui/mainapp.py:412 -msgid "VX6 Commander" -msgstr "VX6 Commander" - -#: ../chirpui/mainapp.py:414 -msgid "EVE" -msgstr "EVE" - -#: ../chirpui/mainapp.py:415 -msgid "VX5 Commander" -msgstr "VX5 Commander" - -#: ../chirpui/mainapp.py:477 -msgid "Open recent file {name}" -msgstr "Letzte Datei öffnen {name}" - -#: ../chirpui/mainapp.py:538 -msgid "Import stock configuration {name}" -msgstr "Speichervorgabe importieren {name}" - -#: ../chirpui/mainapp.py:554 -msgid "Open stock configuration {name}" -msgstr "Vorgaben öffnen {name}" - -#: ../chirpui/mainapp.py:576 -msgid "Proceed with experimental driver?" -msgstr "Weiter mit dem experimentellen Treiber?" - -#: ../chirpui/mainapp.py:578 -msgid "This radio's driver is experimental. Do you want to proceed?" -msgstr "Dieser Geräte Treiber ist experimentell. Wollen Sie fortfahren?" - -#: ../chirpui/mainapp.py:671 -msgid "Save Changes?" -msgstr "Änderungen speichern?" - -#: ../chirpui/mainapp.py:676 -msgid "File is modified, save changes before closing?" -msgstr "Datei wurde geändert, speichern Sie die Änderungen vor dem Schliessen?" - -#: ../chirpui/mainapp.py:709 -msgid "Kenwood HMK Files" -msgstr "Kenwood HMK Datei" - -#: ../chirpui/mainapp.py:710 -msgid "Travel Plus Files" -msgstr "Travel Plus Datei" - -#: ../chirpui/mainapp.py:1042 -msgid "With significant contributions by:" -msgstr "Mit bedeutenden Beiträgen von:" - -#: ../chirpui/mainapp.py:1066 -msgid "Select Columns" -msgstr "Spalten auswählen" - -#: ../chirpui/mainapp.py:1081 -msgid "Visible columns for {radio}" -msgstr "Sichtbare Spalten für {radio}" - -#: ../chirpui/mainapp.py:1138 -msgid "Reporting is disabled" -msgstr "Report ist deaktiviert" - -#: ../chirpui/mainapp.py:1139 -msgid "" -"The reporting feature of CHIRP is designed to help improve quality by " -"allowing the authors to focus on the radio drivers used most often and " -"errors experienced by the users. The reports contain no identifying " -"information and are used only for statistical purposes by the authors. Your " -"privacy is extremely important, but please consider leaving this feature " -"enabled to help make CHIRP better!\n" -"\n" -"Are you sure you want to disable this feature?" -msgstr "" -"Die Reporting-Funktion von CHIRP soll helfen, die Qualität ständig zu " -"verbessern, in dem sich die Autoren auf die Fehler der am häufigsten " -"verwendeten Radio-Treiber konzentrieren können. Die Berichte enthalten keine " -"identifizierbaren Informationen und werden zu rein statistischen Zwecken " -"verwendet. Ihre Privatsphäre ist uns sehr wichtig, bitte lassen Sie diese " -"Funktion aktiviert, so helfen Sie mit, CHIRP weiter zu verbessern! \n" -"\n" -"Sind Sie sicher, dass Sie diese Funktion deaktivieren wollen?" - -#: ../chirpui/mainapp.py:1172 -msgid "" -"Choose a language or Auto to use the operating system default. You will need " -"to restart the application before the change will take effect" -msgstr "" -"Wählen Sie eine Sprache oder Auto, um die Defaultsprache vom Betriebssystem " -"zu verwenden. Bevor die Änderungen wirksam werden, müssen Sie Chirp neu " -"starten." - -#: ../chirpui/mainapp.py:1185 -msgid "Python Modules" -msgstr "Python Modules" - -#: ../chirpui/mainapp.py:1332 -msgid "_File" -msgstr "_Datei" - -#: ../chirpui/mainapp.py:1335 -msgid "Open stock config" -msgstr "Speichervorgaben öffnen" - -#: ../chirpui/mainapp.py:1336 -msgid "_Recent" -msgstr "_Aktuell" - -#: ../chirpui/mainapp.py:1339 -msgid "Load Module" -msgstr "Module laden" - -#: ../chirpui/mainapp.py:1342 -msgid "_Edit" -msgstr "_Bearbeiten" - -#: ../chirpui/mainapp.py:1343 -msgid "_Cut" -msgstr "_Ausschneiden" - -#: ../chirpui/mainapp.py:1344 -msgid "_Copy" -msgstr "_Kopieren" - -#: ../chirpui/mainapp.py:1345 -msgid "_Paste" -msgstr "_Einfügen" - -#: ../chirpui/mainapp.py:1346 -msgid "_Delete" -msgstr "_Löschen" - -#: ../chirpui/mainapp.py:1347 -msgid "Move _Up" -msgstr "Nach _Oben" - -#: ../chirpui/mainapp.py:1348 -msgid "Move Dow_n" -msgstr "Nach _Unten" - -#: ../chirpui/mainapp.py:1349 -msgid "E_xchange" -msgstr "A_ustausch" - -#: ../chirpui/mainapp.py:1350 -msgid "_View" -msgstr "_Ansicht" - -#: ../chirpui/mainapp.py:1351 -msgid "Columns" -msgstr "Spalten" - -#: ../chirpui/mainapp.py:1352 -msgid "Developer" -msgstr "Entwickler" - -#: ../chirpui/mainapp.py:1353 -msgid "Show raw memory" -msgstr "Zeige Roh Speicher" - -#: ../chirpui/mainapp.py:1354 -msgid "Diff raw memories" -msgstr "Vergleiche Roh Speicher" - -#: ../chirpui/mainapp.py:1355 -msgid "Diff tabs" -msgstr "Registerkarten vergleichen" - -#: ../chirpui/mainapp.py:1356 -msgid "Change language" -msgstr "Sprache wählen" - -#: ../chirpui/mainapp.py:1357 -msgid "_Radio" -msgstr "_Gerät" - -#: ../chirpui/mainapp.py:1358 -msgid "Download From Radio" -msgstr "Download vom Gerät" - -#: ../chirpui/mainapp.py:1359 -msgid "Upload To Radio" -msgstr "Upload zum Gerät" - -#: ../chirpui/mainapp.py:1362 -msgid "Import from data source" -msgstr "Import aus der Datenquelle" - -#: ../chirpui/mainapp.py:1363 ../chirpui/mainapp.py:1367 -msgid "RadioReference.com" -msgstr "RadioReference.com" - -#: ../chirpui/mainapp.py:1364 ../chirpui/mainapp.py:1368 -msgid "RFinder" -msgstr "RFinder" - -#: ../chirpui/mainapp.py:1365 ../chirpui/mainapp.py:1369 -msgid "RepeaterBook" -msgstr "RepeaterBook" - -#: ../chirpui/mainapp.py:1366 -msgid "Query data source" -msgstr "Datenquelle abfragen" - -#: ../chirpui/mainapp.py:1370 -msgid "CHIRP Native File" -msgstr "CHIRP Native File" - -#: ../chirpui/mainapp.py:1371 -msgid "CSV File" -msgstr "CSV Datei" - -#: ../chirpui/mainapp.py:1372 -msgid "Import from stock config" -msgstr "Import von der Vorgabe" - -#: ../chirpui/mainapp.py:1374 -msgid "Help" -msgstr "Hilfe" - -#: ../chirpui/mainapp.py:1385 -msgid "Report statistics" -msgstr "Report Statistik" - -#: ../chirpui/mainapp.py:1386 -msgid "Hide Unused Fields" -msgstr "Unbenutzte Felder verbergen" - -#: ../chirpui/mainapp.py:1387 -msgid "Automatic Repeater Offset" -msgstr "Automatischer Repeater-Offset" - -#: ../chirpui/mainapp.py:1388 -msgid "Enable Developer Functions" -msgstr "Entwickler Funktionen aktivieren" - -#: ../chirpui/mainapp.py:1498 -msgid "A new version of CHIRP is available: " -msgstr "Eine neue Version von CHIRP ist verfügbar:" - -#: ../chirpui/mainapp.py:1572 -msgid "Error reporting is enabled" -msgstr "Fehler Reporting ist eingeschaltet" - -#: ../chirpui/mainapp.py:1575 -msgid "" -"If you wish to disable this feature you may do so in the Help menu" -msgstr "" -"Wenn Sie diese Funktion deaktivieren möchten, können Sie das im Hilfe " -"Menu machen" - -#: ../chirpui/memdetail.py:214 -msgid "Edit Memory#{num}" -msgstr "Speiche editieren#{num}" - -#: ../chirpui/memdetail.py:229 ../chirpui/memedit.py:66 -#: ../chirpui/memedit.py:99 ../chirpui/memedit.py:116 -#: ../chirpui/memedit.py:206 ../chirpui/memedit.py:324 -#: ../chirpui/memedit.py:902 ../chirpui/memedit.py:962 -#: ../chirpui/memedit.py:1104 ../chirpui/memedit.py:1168 -msgid "Tone Mode" -msgstr "Tone Mode" - -#: ../chirpui/memdetail.py:230 ../chirpui/memedit.py:67 -#: ../chirpui/memedit.py:88 ../chirpui/memedit.py:105 -#: ../chirpui/memedit.py:218 ../chirpui/memedit.py:227 -#: ../chirpui/memedit.py:230 ../chirpui/memedit.py:322 -#: ../chirpui/memedit.py:903 ../chirpui/memedit.py:958 -#: ../chirpui/memedit.py:1105 -msgid "Tone" -msgstr "Tone" - -#: ../chirpui/memdetail.py:231 ../chirpui/memedit.py:68 -#: ../chirpui/memedit.py:89 ../chirpui/memedit.py:106 -#: ../chirpui/memedit.py:212 ../chirpui/memedit.py:228 -#: ../chirpui/memedit.py:231 ../chirpui/memedit.py:322 -#: ../chirpui/memedit.py:904 ../chirpui/memedit.py:959 -#: ../chirpui/memedit.py:1101 -msgid "ToneSql" -msgstr "ToneSql" - -#: ../chirpui/memdetail.py:232 ../chirpui/memedit.py:69 -#: ../chirpui/memedit.py:90 ../chirpui/memedit.py:107 -#: ../chirpui/memedit.py:213 ../chirpui/memedit.py:220 -#: ../chirpui/memedit.py:225 ../chirpui/memedit.py:232 -#: ../chirpui/memedit.py:318 ../chirpui/memedit.py:905 -#: ../chirpui/memedit.py:960 ../chirpui/memedit.py:1093 -msgid "DTCS Code" -msgstr "DTCS Code" - -#: ../chirpui/memdetail.py:233 ../chirpui/memedit.py:71 -#: ../chirpui/memedit.py:92 ../chirpui/memedit.py:111 -#: ../chirpui/memedit.py:215 ../chirpui/memedit.py:222 -#: ../chirpui/memedit.py:234 ../chirpui/memedit.py:907 -#: ../chirpui/memedit.py:964 ../chirpui/memedit.py:1095 -#: ../chirpui/memedit.py:1173 -msgid "DTCS Pol" -msgstr "DTCS Pol" - -#: ../chirpui/memdetail.py:234 -msgid "Cross mode" -msgstr "Cross Mode" - -#: ../chirpui/memdetail.py:237 ../chirpui/memedit.py:73 -#: ../chirpui/memedit.py:94 ../chirpui/memedit.py:114 -#: ../chirpui/memedit.py:142 ../chirpui/memedit.py:207 -#: ../chirpui/memedit.py:261 ../chirpui/memedit.py:324 -#: ../chirpui/memedit.py:909 ../chirpui/memedit.py:965 -#: ../chirpui/memedit.py:1106 ../chirpui/memedit.py:1178 -msgid "Duplex" -msgstr "Duplex" - -#: ../chirpui/memdetail.py:238 ../chirpui/memedit.py:74 -#: ../chirpui/memedit.py:95 ../chirpui/memedit.py:140 -#: ../chirpui/memedit.py:200 ../chirpui/memedit.py:237 -#: ../chirpui/memedit.py:262 ../chirpui/memedit.py:320 -#: ../chirpui/memedit.py:910 ../chirpui/memedit.py:966 -#: ../chirpui/memedit.py:1097 -msgid "Offset" -msgstr "Offset" - -#: ../chirpui/memdetail.py:239 ../chirpui/memedit.py:75 -#: ../chirpui/memedit.py:96 ../chirpui/memedit.py:112 -#: ../chirpui/memedit.py:308 ../chirpui/memedit.py:911 -#: ../chirpui/memedit.py:967 ../chirpui/memedit.py:1096 -#: ../chirpui/memedit.py:1167 ../chirpui/memedit.py:1180 -#: ../chirpui/memedit.py:1181 ../chirpui/memedit.py:1340 -#: ../chirpui/memedit.py:1358 ../chirpui/memedit.py:1368 -msgid "Mode" -msgstr "Mode" - -#: ../chirpui/memdetail.py:241 ../chirpui/memedit.py:77 -#: ../chirpui/memedit.py:98 ../chirpui/memedit.py:115 -#: ../chirpui/memedit.py:145 ../chirpui/memedit.py:148 -#: ../chirpui/memedit.py:913 ../chirpui/memedit.py:969 -#: ../chirpui/memedit.py:1099 -msgid "Tune Step" -msgstr "Abstimmungsschritt" - -#: ../chirpui/memdetail.py:244 ../chirpui/memedit.py:78 -#: ../chirpui/memedit.py:100 ../chirpui/memedit.py:914 -#: ../chirpui/memedit.py:970 ../chirpui/memedit.py:1107 -#: ../chirpui/memedit.py:1170 -msgid "Skip" -msgstr "Überspringen" - -#: ../chirpui/memdetail.py:289 -msgid "Memory validation failed:" -msgstr "Speicher-Validierung fehlgeschlagen:" - -#: ../chirpui/memedit.py:52 -msgid "Invalid value for this field" -msgstr "Ungültiger Wert für dieses Feld" - -#: ../chirpui/memedit.py:70 ../chirpui/memedit.py:91 ../chirpui/memedit.py:109 -#: ../chirpui/memedit.py:214 ../chirpui/memedit.py:221 -#: ../chirpui/memedit.py:233 ../chirpui/memedit.py:318 -#: ../chirpui/memedit.py:906 ../chirpui/memedit.py:961 -#: ../chirpui/memedit.py:1094 -msgid "DTCS Rx Code" -msgstr "DTCS Rx Code" - -#: ../chirpui/memedit.py:72 ../chirpui/memedit.py:93 ../chirpui/memedit.py:117 -#: ../chirpui/memedit.py:908 ../chirpui/memedit.py:963 -#: ../chirpui/memedit.py:1102 ../chirpui/memedit.py:1169 -msgid "Cross Mode" -msgstr "Cross Mode" - -#: ../chirpui/memedit.py:76 ../chirpui/memedit.py:97 ../chirpui/memedit.py:113 -#: ../chirpui/memedit.py:308 ../chirpui/memedit.py:912 -#: ../chirpui/memedit.py:968 ../chirpui/memedit.py:1108 -#: ../chirpui/memedit.py:1171 ../chirpui/memedit.py:1176 -msgid "Power" -msgstr "Leistung" - -#: ../chirpui/memedit.py:177 -msgid "Erasing memory {loc}" -msgstr "Lösche Speicher {loc}" - -#: ../chirpui/memedit.py:247 -msgid "Unable to make changes to this model" -msgstr "Keine Änderungen bei diesem Modell möglich" - -#: ../chirpui/memedit.py:253 -msgid "Editing new item, taking defaults" -msgstr "Neues Element editieren, verwende Standardwerte" - -#: ../chirpui/memedit.py:269 -msgid "Bad value for {col}: {val}" -msgstr "Falscher Wert für {col}: {val}" - -#: ../chirpui/memedit.py:293 -msgid "Error setting memory" -msgstr "Fehler beim Setzen der Speicher" - -#: ../chirpui/memedit.py:301 ../chirpui/memedit.py:368 -#: ../chirpui/memedit.py:635 ../chirpui/memedit.py:1323 -msgid "Writing memory {number}" -msgstr "Schreibe Speicher {number}" - -#: ../chirpui/memedit.py:373 -msgid "" -"This operation requires moving all subsequent channels by one spot until an " -"empty location is reached. This can take a LONG time. Are you sure you " -"want to do this?" -msgstr "" -"Dieser Vorgang erfordert eine Verschiebung aller nachfolgenden Kanäle, bis " -"eine leere Stelle gefunden wird. Dies kann sehr lange dauern. Sind Sie " -"sicher dass Sie das wollen?" - -#: ../chirpui/memedit.py:396 -msgid "Adding memory {number}" -msgstr "Hinzufügen von Speicher {number}" - -#: ../chirpui/memedit.py:409 ../chirpui/memedit.py:943 -msgid "Erasing memory {number}" -msgstr "Löschen von Speicher {number}" - -#: ../chirpui/memedit.py:418 ../chirpui/memedit.py:527 -#: ../chirpui/memedit.py:573 ../chirpui/memedit.py:578 -#: ../chirpui/memedit.py:884 ../chirpui/memedit.py:1202 -msgid "Getting memory {number}" -msgstr "Lade Speicher {number}" - -#: ../chirpui/memedit.py:506 ../chirpui/memedit.py:517 -#: ../chirpui/memedit.py:565 -msgid "Moving memory from {old} to {new}" -msgstr "Verschiebe Speicher von {old} nach {new}" - -#: ../chirpui/memedit.py:587 -msgid "Raw memory {number}" -msgstr "Rohspeicher {number}" - -#: ../chirpui/memedit.py:591 ../chirpui/memedit.py:619 -#: ../chirpui/memedit.py:624 -msgid "Getting raw memory {number}" -msgstr "Lade Rohspeicher {number}" - -#: ../chirpui/memedit.py:596 -msgid "You can only diff two memories!" -msgstr "Sie können nur zwei Speicher vergleichen!" - -#: ../chirpui/memedit.py:607 -msgid "Memory {number}" -msgstr "Speicher {number}" - -#: ../chirpui/memedit.py:613 -msgid "Diff of {a} and {b}" -msgstr "Diff of {a} and {b}" - -#: ../chirpui/memedit.py:650 -msgid "Memories must be contiguous" -msgstr "Speicher müssen fortlaufend sein" - -#: ../chirpui/memedit.py:726 -msgid "Edit" -msgstr "Bearbeiten" - -#: ../chirpui/memedit.py:727 -msgid "Insert row above" -msgstr "Zeile oben einfügen" - -#: ../chirpui/memedit.py:728 -msgid "Insert row below" -msgstr "Zeile unten einfügen" - -#: ../chirpui/memedit.py:729 -msgid "Delete" -msgstr "Löschen" - -#: ../chirpui/memedit.py:729 -msgid "Delete all" -msgstr "Alles löschen" - -#: ../chirpui/memedit.py:730 -msgid "Delete (and shift up)" -msgstr "Löschen (und nach oben verschieben)" - -#: ../chirpui/memedit.py:731 -msgid "Move up" -msgstr "Nach Oben" - -#: ../chirpui/memedit.py:732 -msgid "Move down" -msgstr "Nach Unten" - -#: ../chirpui/memedit.py:733 -msgid "Exchange memories" -msgstr "Speicher austauschen" - -#: ../chirpui/memedit.py:734 -msgid "Cut" -msgstr "Ausschneiden" - -#: ../chirpui/memedit.py:735 -msgid "Copy" -msgstr "Kopieren" - -#: ../chirpui/memedit.py:736 -msgid "Paste" -msgstr "Einfügen" - -#: ../chirpui/memedit.py:737 -msgid "Show Raw Memory" -msgstr "Zeige RAW Speicher" - -#: ../chirpui/memedit.py:738 -msgid "Diff Raw Memories" -msgstr "Vergleiche Rohspeicher" - -#: ../chirpui/memedit.py:862 -msgid "Internal Error: Column {name} not found" -msgstr "Interner Fehler: Spalte {name} wurde nicht gefunden" - -#: ../chirpui/memedit.py:891 -msgid "Getting channel {chan}" -msgstr "Lade Kanal {chan}" - -#: ../chirpui/memedit.py:983 -msgid "Internal Error: Invalid limit {number}" -msgstr "Interner Fehler: Ungültige Grenzwert {number}" - -#: ../chirpui/memedit.py:993 -msgid "Memory range:" -msgstr "Speicherbereich:" - -#: ../chirpui/memedit.py:1020 -msgid "Go" -msgstr "Go" - -#: ../chirpui/memedit.py:1043 -msgid "Special Channels" -msgstr "Spezial Kanäle" - -#: ../chirpui/memedit.py:1050 -msgid "Show Empty" -msgstr "Leere anzeigen" - -#: ../chirpui/memedit.py:1235 -msgid "Cutting memory {number}" -msgstr "Ausschneiden Speicher {number}" - -#: ../chirpui/memedit.py:1266 -msgid "" -"Unable to paste {src} memories into {dst} rows. Increase the memory bounds " -"or show empty memories." -msgstr "" -"Kann {src} Speicher in {dst} Zeilen einfügen. Erhöhen Sie die Speicher-" -"Grenzen oder zeigen leere Speicher." - -#: ../chirpui/memedit.py:1277 -msgid "Overwrite?" -msgstr "Überschreiben?" - -#: ../chirpui/memedit.py:1282 -msgid "Overwrite location {number}?" -msgstr "Überschreibe Standort {number}" - -#: ../chirpui/memedit.py:1301 -msgid "Incompatible Memory" -msgstr "Speicher nicht kompatibel" - -#: ../chirpui/memedit.py:1304 -msgid "Pasted memory {number} is not compatible with this radio because:" -msgstr "" -"Eingefügter Speicher {number} ist nicht mit diesem Gerät kompatibel weil:" - -#: ../chirpui/memedit.py:1360 ../chirpui/memedit.py:1375 -msgid "URCALL" -msgstr "URCALL" - -#: ../chirpui/memedit.py:1360 ../chirpui/memedit.py:1376 -msgid "RPT1CALL" -msgstr "RPT1CALL" - -#: ../chirpui/memedit.py:1360 ../chirpui/memedit.py:1377 -msgid "RPT2CALL" -msgstr "RPT2CALL" - -#: ../chirpui/memedit.py:1361 ../chirpui/memedit.py:1378 -msgid "Digital Code" -msgstr "Digital Code" - -#: ../chirpui/settingsedit.py:138 -msgid "Enabled" -msgstr "Aktiviert" - -#: ../chirpui/shiftdialog.py:27 -msgid "Shift" -msgstr "verschieben" - -#: ../chirpui/shiftdialog.py:63 -msgid "Moving {src} to {dst}" -msgstr "Verschieben {src} nach {dst}" - -#: ../chirpui/shiftdialog.py:80 -msgid "Looking for a free spot ({number})" -msgstr "Suche nach einer freien Stelle ({number})" - -#: ../chirpui/shiftdialog.py:93 -msgid "No space to insert a row" -msgstr "Kein Platz zum Einfügen einer Zeile" - -#: ../chirpui/shiftdialog.py:140 -msgid "Moved {count} memories" -msgstr "Verschobene {count} Speicher" diff --git a/locale/en_US.po b/locale/en_US.po deleted file mode 100644 index b394796..0000000 --- a/locale/en_US.po +++ /dev/null @@ -1,955 +0,0 @@ -# English translations for CHIRP package. -# Copyright (C) 2011 Dan Smith -# This file is distributed under the same license as the CHIRP package. -# Dan Smith , 2011. -# -msgid "" -msgstr "" -"Project-Id-Version: CHIRP\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2012-02-16 12:06-0800\n" -"PO-Revision-Date: 2011-11-29 16:07-0800\n" -"Last-Translator: Dan Smith \n" -"Language-Team: English\n" -"Language: en_US\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=ASCII\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" - -#: ../chirpui/common.py:204 -msgid "Completed" -msgstr "" - -#: ../chirpui/common.py:205 -msgid "idle" -msgstr "" - -#: ../chirpui/bankedit.py:52 -msgid "Retrieving bank information" -msgstr "" - -#: ../chirpui/bankedit.py:75 -msgid "Setting name on bank" -msgstr "" - -#: ../chirpui/bankedit.py:85 -msgid "Bank" -msgstr "" - -#: ../chirpui/bankedit.py:86 ../chirpui/bankedit.py:240 -#: ../chirpui/importdialog.py:536 ../chirpui/memedit.py:65 -#: ../chirpui/memedit.py:85 ../chirpui/memedit.py:247 -#: ../chirpui/memedit.py:872 ../chirpui/memedit.py:926 -#: ../chirpui/memedit.py:1063 ../chirpui/memedit.py:1065 -msgid "Name" -msgstr "" - -#: ../chirpui/bankedit.py:185 -msgid "Updating bank index for memory {num}" -msgstr "" - -#: ../chirpui/bankedit.py:194 -msgid "Updating bank information for memory {num}" -msgstr "" - -#: ../chirpui/bankedit.py:200 ../chirpui/bankedit.py:229 -msgid "Getting memory {num}" -msgstr "" - -#: ../chirpui/bankedit.py:214 -msgid "Setting index for memory {num}" -msgstr "" - -#: ../chirpui/bankedit.py:223 -msgid "Getting bank for memory {num}" -msgstr "" - -#: ../chirpui/bankedit.py:238 ../chirpui/memedit.py:63 -#: ../chirpui/memedit.py:172 ../chirpui/memedit.py:246 -#: ../chirpui/memedit.py:315 ../chirpui/memedit.py:335 -#: ../chirpui/memedit.py:349 ../chirpui/memedit.py:423 -#: ../chirpui/memedit.py:435 ../chirpui/memedit.py:459 -#: ../chirpui/memedit.py:461 ../chirpui/memedit.py:534 -#: ../chirpui/memedit.py:548 ../chirpui/memedit.py:550 -#: ../chirpui/memedit.py:591 ../chirpui/memedit.py:593 -#: ../chirpui/memedit.py:621 ../chirpui/memedit.py:822 -#: ../chirpui/memedit.py:870 ../chirpui/memedit.py:895 -#: ../chirpui/memedit.py:907 ../chirpui/memedit.py:924 -#: ../chirpui/memedit.py:1230 -msgid "Loc" -msgstr "" - -#: ../chirpui/bankedit.py:239 ../chirpui/importdialog.py:537 -#: ../chirpui/memedit.py:64 ../chirpui/memedit.py:86 ../chirpui/memedit.py:187 -#: ../chirpui/memedit.py:248 ../chirpui/memedit.py:271 -#: ../chirpui/memedit.py:296 ../chirpui/memedit.py:304 -#: ../chirpui/memedit.py:873 ../chirpui/memedit.py:923 -msgid "Frequency" -msgstr "" - -#: ../chirpui/bankedit.py:241 -msgid "Index" -msgstr "" - -#: ../chirpui/bankedit.py:302 -msgid "Getting bank information for memory {num}" -msgstr "" - -#: ../chirpui/bankedit.py:323 -msgid "Getting bank information" -msgstr "" - -#: ../chirpui/inputdialog.py:81 -msgid "An error has occurred" -msgstr "" - -#: ../chirpui/inputdialog.py:130 -msgid "Overwrite" -msgstr "" - -#: ../chirpui/inputdialog.py:133 -msgid "File Exists" -msgstr "" - -#: ../chirpui/inputdialog.py:136 -msgid "The file {name} already exists. Do you want to overwrite it?" -msgstr "" - -#: ../chirpui/importdialog.py:90 -msgid "" -"Location {number} is already being imported. Choose another value for 'New " -"Location' before selection 'Import'" -msgstr "" - -#: ../chirpui/importdialog.py:121 -msgid "Invalid value. Must be an integer." -msgstr "" - -#: ../chirpui/importdialog.py:130 -msgid "Location {number} is already being imported" -msgstr "" - -#: ../chirpui/importdialog.py:182 -msgid "Updating URCALL list" -msgstr "" - -#: ../chirpui/importdialog.py:187 -msgid "Updating RPTCALL list" -msgstr "" - -#: ../chirpui/importdialog.py:256 -msgid "Setting memory {number}" -msgstr "" - -#: ../chirpui/importdialog.py:260 -msgid "Importing bank information" -msgstr "" - -#: ../chirpui/importdialog.py:264 -#, fuzzy -msgid "Error importing memories:" -msgstr "Error reporting is enabled" - -#: ../chirpui/importdialog.py:376 -msgid "All" -msgstr "" - -#: ../chirpui/importdialog.py:382 -msgid "None" -msgstr "" - -#: ../chirpui/importdialog.py:388 -msgid "Inverse" -msgstr "" - -#: ../chirpui/importdialog.py:394 -#, fuzzy -msgid "Select" -msgstr "Select Columns" - -#: ../chirpui/importdialog.py:416 -msgid "Auto" -msgstr "" - -#: ../chirpui/importdialog.py:422 -msgid "Reverse" -msgstr "" - -#: ../chirpui/importdialog.py:428 -msgid "Adjust New Location" -msgstr "" - -#: ../chirpui/importdialog.py:438 -msgid "Confirm overwrites" -msgstr "" - -#: ../chirpui/importdialog.py:444 -msgid "Options" -msgstr "" - -#: ../chirpui/importdialog.py:495 -msgid "Cannot be imported because" -msgstr "" - -#: ../chirpui/importdialog.py:513 -#, fuzzy -msgid "Import From File" -msgstr "Import from RFinder" - -#: ../chirpui/importdialog.py:514 ../chirpui/mainapp.py:1196 -msgid "Import" -msgstr "Import" - -#: ../chirpui/importdialog.py:534 -msgid "To" -msgstr "" - -#: ../chirpui/importdialog.py:535 -msgid "From" -msgstr "" - -#: ../chirpui/importdialog.py:538 ../chirpui/memedit.py:78 -#: ../chirpui/memedit.py:99 ../chirpui/memedit.py:886 -#: ../chirpui/memedit.py:940 ../chirpui/memedit.py:1068 -msgid "Comment" -msgstr "" - -#: ../chirpui/importdialog.py:542 -msgid "Location memory will be imported into" -msgstr "" - -#: ../chirpui/importdialog.py:543 -msgid "Location of memory in the file being imported" -msgstr "" - -#: ../chirpui/importdialog.py:566 -msgid "Preparing memory list..." -msgstr "" - -#: ../chirpui/importdialog.py:575 -#, fuzzy -msgid "Export To File" -msgstr "Import from RFinder" - -#: ../chirpui/importdialog.py:576 ../chirpui/mainapp.py:1197 -msgid "Export" -msgstr "Export" - -#: ../chirpui/mainapp.py:269 ../chirpui/mainapp.py:483 -msgid "Untitled" -msgstr "Untitled" - -#: ../chirpui/mainapp.py:316 ../chirpui/mainapp.py:715 -msgid "CHIRP Radio Images" -msgstr "CHIRP Radio Images" - -#: ../chirpui/mainapp.py:317 ../chirpui/mainapp.py:714 -#: ../chirpui/mainapp.py:880 -msgid "CHIRP Files" -msgstr "CHIRP Files" - -#: ../chirpui/mainapp.py:318 ../chirpui/mainapp.py:716 -#: ../chirpui/mainapp.py:879 -msgid "CSV Files" -msgstr "CSV Files" - -#: ../chirpui/mainapp.py:319 ../chirpui/mainapp.py:717 -msgid "ICF Files" -msgstr "ICF Files" - -#: ../chirpui/mainapp.py:320 ../chirpui/mainapp.py:718 -msgid "VX7 Commander Files" -msgstr "VX7 Commander Files" - -#: ../chirpui/mainapp.py:330 -msgid "" -"ICF files cannot be edited, only displayed or imported into another file. " -"Open in read-only mode?" -msgstr "" -"ICF files cannot be edited, only displayed or imported into another file. " -"Open in read-only mode?" - -#: ../chirpui/mainapp.py:373 -msgid "There was an error opening {fname}: {error}" -msgstr "There was an error opening {fname}: {error}" - -#: ../chirpui/mainapp.py:388 -msgid "{num} errors during open:" -msgstr "" - -#: ../chirpui/mainapp.py:394 -msgid "Note:" -msgstr "Note:" - -#: ../chirpui/mainapp.py:395 -msgid "" -"The {vendor} {model} operates in live mode. This means that any " -"changes you make are immediately sent to the radio. Because of this, you " -"cannot perform the Save or Upload operations. If you wish to " -"edit the contents offline, please Export to a CSV file, using the " -"File menu." -msgstr "" -"The {vendor} {model} operates in live mode. This means that any " -"changes you make are immediately sent to the radio. Because of this, you " -"cannot perform the Save or Upload operations. If you wish to " -"edit the contents offline, please Export to a CSV file, using the " -"File menu." - -#: ../chirpui/mainapp.py:404 -msgid "Don't show this again" -msgstr "Don't show this again" - -#: ../chirpui/mainapp.py:448 -msgid "{vendor} {model} image file" -msgstr "{vendor} {model} image file" - -#: ../chirpui/mainapp.py:456 -msgid "VX7 Commander" -msgstr "VX7 Commander" - -#: ../chirpui/mainapp.py:518 -msgid "Open recent file {name}" -msgstr "Open recent file {name}" - -#: ../chirpui/mainapp.py:579 -msgid "Import stock configuration {name}" -msgstr "" - -#: ../chirpui/mainapp.py:595 -msgid "Open stock configuration {name}" -msgstr "" - -#: ../chirpui/mainapp.py:681 -msgid "Discard Changes?" -msgstr "Discard Changes?" - -#: ../chirpui/mainapp.py:686 -msgid "File is modified, save changes before closing?" -msgstr "File is modified, save changes before closing?" - -#: ../chirpui/mainapp.py:923 -msgid "With significant contributions by:" -msgstr "" - -#: ../chirpui/mainapp.py:940 -msgid "Select Columns" -msgstr "Select Columns" - -#: ../chirpui/mainapp.py:955 -msgid "Visible columns for {radio}" -msgstr "Visible columns for {radio}" - -#: ../chirpui/mainapp.py:1012 -msgid "Reporting is disabled" -msgstr "Reporting is disabled" - -#: ../chirpui/mainapp.py:1013 -msgid "" -"The reporting feature of CHIRP is designed to help improve quality by " -"allowing the authors to focus on the radio drivers used most often and " -"errors experienced by the users. The reports contain no identifying " -"information and are used only for statistical purposes by the authors. Your " -"privacy is extremely important, but please consider leaving this feature " -"enabled to help make CHIRP better!\n" -"\n" -"Are you sure you want to disable this feature?" -msgstr "" -"The reporting feature of CHIRP is designed to help improve quality by " -"allowing the authors to focus on the radio drivers used most often and " -"errors experienced by the users. The reports contain no identifying " -"information and are used only for statistical purposes by the authors. Your " -"privacy is extremely important, but please consider leaving this feature " -"enabled to help make CHIRP better!\n" -"\n" -"Are you sure you want to disable this feature?" - -#: ../chirpui/mainapp.py:1045 -msgid "" -"Choose a language or Auto to use the operating system default. You will need " -"to restart the application before the change will take effect" -msgstr "" - -#: ../chirpui/mainapp.py:1169 -msgid "_File" -msgstr "_File" - -#: ../chirpui/mainapp.py:1172 -msgid "Open stock config" -msgstr "" - -#: ../chirpui/mainapp.py:1173 -msgid "_Recent" -msgstr "_Recent" - -#: ../chirpui/mainapp.py:1178 -msgid "_Edit" -msgstr "_Edit" - -#: ../chirpui/mainapp.py:1179 -msgid "_Cut" -msgstr "_Cut" - -#: ../chirpui/mainapp.py:1180 -msgid "_Copy" -msgstr "_Copy" - -#: ../chirpui/mainapp.py:1181 -msgid "_Paste" -msgstr "_Paste" - -#: ../chirpui/mainapp.py:1182 -msgid "_Delete" -msgstr "_Delete" - -#: ../chirpui/mainapp.py:1183 -msgid "Move _Up" -msgstr "Move _Up" - -#: ../chirpui/mainapp.py:1184 -#, fuzzy -msgid "Move Dow_n" -msgstr "Move D_n" - -#: ../chirpui/mainapp.py:1185 -msgid "E_xchange" -msgstr "E_xchange" - -#: ../chirpui/mainapp.py:1186 -msgid "_View" -msgstr "_View" - -#: ../chirpui/mainapp.py:1187 -msgid "Columns" -msgstr "Columns" - -#: ../chirpui/mainapp.py:1188 -msgid "Developer" -msgstr "Developer" - -#: ../chirpui/mainapp.py:1189 -msgid "Show raw memory" -msgstr "Show raw memory" - -#: ../chirpui/mainapp.py:1190 -msgid "Diff raw memories" -msgstr "Diff raw memories" - -#: ../chirpui/mainapp.py:1191 -msgid "Diff tabs" -msgstr "" - -#: ../chirpui/mainapp.py:1192 -msgid "Change language" -msgstr "" - -#: ../chirpui/mainapp.py:1193 -msgid "_Radio" -msgstr "_Radio" - -#: ../chirpui/mainapp.py:1194 -msgid "Download From Radio" -msgstr "Download From Radio" - -#: ../chirpui/mainapp.py:1195 -msgid "Upload To Radio" -msgstr "Upload To Radio" - -#: ../chirpui/mainapp.py:1198 -msgid "Import from RFinder" -msgstr "Import from RFinder" - -#: ../chirpui/mainapp.py:1199 -msgid "CHIRP Native File" -msgstr "CHIRP Native File" - -#: ../chirpui/mainapp.py:1200 -msgid "CSV File" -msgstr "CSV File" - -#: ../chirpui/mainapp.py:1201 -msgid "Import from RepeaterBook" -msgstr "Import from RepeaterBook" - -#: ../chirpui/mainapp.py:1202 -#, fuzzy -msgid "Import from stock config" -msgstr "Import from RepeaterBook" - -#: ../chirpui/mainapp.py:1204 -msgid "Help" -msgstr "Help" - -#: ../chirpui/mainapp.py:1215 -msgid "Report statistics" -msgstr "Report statistics" - -#: ../chirpui/mainapp.py:1216 -msgid "Hide Unused Fields" -msgstr "Hide Unused Fields" - -#: ../chirpui/mainapp.py:1217 -msgid "Automatic Repeater Offset" -msgstr "Automatic Repeater Offset" - -#: ../chirpui/mainapp.py:1218 -msgid "Enable Developer Functions" -msgstr "Enable Developer Functions" - -#: ../chirpui/mainapp.py:1352 -msgid "Error reporting is enabled" -msgstr "Error reporting is enabled" - -#: ../chirpui/mainapp.py:1355 -msgid "" -"If you wish to disable this feature you may do so in the Help menu" -msgstr "" -"If you wish to disable this feature you may do so in the Help menu" - -#: ../chirpui/cloneprog.py:43 -msgid "Clone Progress" -msgstr "" - -#: ../chirpui/cloneprog.py:46 -msgid "Cloning" -msgstr "" - -#: ../chirpui/cloneprog.py:55 -msgid "Cancel" -msgstr "" - -#: ../chirpui/shiftdialog.py:27 -msgid "Shift" -msgstr "" - -#: ../chirpui/shiftdialog.py:63 -msgid "Moving {src} to {dst}" -msgstr "" - -#: ../chirpui/shiftdialog.py:80 -msgid "Looking for a free spot ({number})" -msgstr "" - -#: ../chirpui/shiftdialog.py:135 -msgid "Moved {count} memories" -msgstr "" - -#: ../chirpui/clone.py:35 -#, fuzzy -msgid "{vendor} {model} on {port}" -msgstr "{vendor} {model} image file" - -#: ../chirpui/clone.py:100 ../chirpui/clone.py:162 -msgid "Detect" -msgstr "" - -#: ../chirpui/clone.py:123 -msgid "Port" -msgstr "" - -#: ../chirpui/clone.py:124 -msgid "Vendor" -msgstr "" - -#: ../chirpui/clone.py:125 -msgid "Model" -msgstr "" - -#: ../chirpui/clone.py:138 -#, fuzzy -msgid "Radio" -msgstr "_Radio" - -#: ../chirpui/clone.py:166 -msgid "Unable to detect radio on {port}" -msgstr "" - -#: ../chirpui/clone.py:178 -msgid "Internal error: Unable to upload to {model}" -msgstr "" - -#: ../chirpui/clone.py:226 -msgid "Clone failed: {error}" -msgstr "" - -#: ../chirpui/dstaredit.py:40 -msgid "Callsign" -msgstr "" - -#: ../chirpui/dstaredit.py:124 -msgid "Your callsign" -msgstr "" - -#: ../chirpui/dstaredit.py:132 -msgid "Repeater callsign" -msgstr "" - -#: ../chirpui/dstaredit.py:140 -msgid "My callsign" -msgstr "" - -#: ../chirpui/dstaredit.py:170 ../chirpui/memedit.py:1365 -msgid "Downloading URCALL list" -msgstr "" - -#: ../chirpui/dstaredit.py:174 ../chirpui/memedit.py:1377 -msgid "Downloading RPTCALL list" -msgstr "" - -#: ../chirpui/dstaredit.py:178 -msgid "Downloading MYCALL list" -msgstr "" - -#: ../chirpui/editorset.py:87 -#, fuzzy -msgid "Memories" -msgstr "Diff raw memories" - -#: ../chirpui/editorset.py:92 -msgid "D-STAR" -msgstr "" - -#: ../chirpui/editorset.py:98 -msgid "Bank Names" -msgstr "" - -#: ../chirpui/editorset.py:104 -msgid "Banks" -msgstr "" - -#: ../chirpui/editorset.py:222 -msgid "The {vendor} {model} has multiple independent sub-devices" -msgstr "" - -#: ../chirpui/editorset.py:225 -msgid "Choose one to import from:" -msgstr "" - -#: ../chirpui/editorset.py:230 -msgid "Cancelled" -msgstr "" - -#: ../chirpui/editorset.py:235 -msgid "Internal Error" -msgstr "" - -#: ../chirpui/editorset.py:248 -msgid "" -"There were errors while opening {file}. The affected memories will not be " -"importable!" -msgstr "" - -#: ../chirpui/editorset.py:260 -#, fuzzy -msgid "There was an error during import: {error}" -msgstr "There was an error opening {fname}: {error}" - -#: ../chirpui/editorset.py:270 -msgid "Unsupported file type" -msgstr "" - -#: ../chirpui/editorset.py:286 ../chirpui/editorset.py:301 -#, fuzzy -msgid "There was an error during export: {error}" -msgstr "There was an error opening {fname}: {error}" - -#: ../chirpui/editorset.py:313 -msgid "Priming memory" -msgstr "" - -#: ../chirpui/memedit.py:52 -msgid "Invalid value for this field" -msgstr "" - -#: ../chirpui/memedit.py:66 ../chirpui/memedit.py:97 ../chirpui/memedit.py:111 -#: ../chirpui/memedit.py:204 ../chirpui/memedit.py:312 -#: ../chirpui/memedit.py:874 ../chirpui/memedit.py:931 -#: ../chirpui/memedit.py:1069 ../chirpui/memedit.py:1133 -msgid "Tone Mode" -msgstr "" - -#: ../chirpui/memedit.py:67 ../chirpui/memedit.py:87 ../chirpui/memedit.py:103 -#: ../chirpui/memedit.py:214 ../chirpui/memedit.py:218 -#: ../chirpui/memedit.py:220 ../chirpui/memedit.py:310 -#: ../chirpui/memedit.py:875 ../chirpui/memedit.py:928 -#: ../chirpui/memedit.py:1070 -msgid "Tone" -msgstr "" - -#: ../chirpui/memedit.py:68 ../chirpui/memedit.py:88 ../chirpui/memedit.py:104 -#: ../chirpui/memedit.py:210 ../chirpui/memedit.py:218 -#: ../chirpui/memedit.py:221 ../chirpui/memedit.py:310 -#: ../chirpui/memedit.py:876 ../chirpui/memedit.py:929 -#: ../chirpui/memedit.py:1066 -msgid "ToneSql" -msgstr "" - -#: ../chirpui/memedit.py:69 ../chirpui/memedit.py:89 ../chirpui/memedit.py:105 -#: ../chirpui/memedit.py:211 ../chirpui/memedit.py:215 -#: ../chirpui/memedit.py:222 ../chirpui/memedit.py:306 -#: ../chirpui/memedit.py:877 ../chirpui/memedit.py:930 -#: ../chirpui/memedit.py:1059 -msgid "DTCS Code" -msgstr "" - -#: ../chirpui/memedit.py:70 ../chirpui/memedit.py:90 ../chirpui/memedit.py:106 -#: ../chirpui/memedit.py:212 ../chirpui/memedit.py:216 -#: ../chirpui/memedit.py:223 ../chirpui/memedit.py:878 -#: ../chirpui/memedit.py:933 ../chirpui/memedit.py:1060 -msgid "DTCS Pol" -msgstr "" - -#: ../chirpui/memedit.py:71 ../chirpui/memedit.py:91 ../chirpui/memedit.py:112 -#: ../chirpui/memedit.py:879 ../chirpui/memedit.py:932 -#: ../chirpui/memedit.py:1067 ../chirpui/memedit.py:1134 -msgid "Cross Mode" -msgstr "" - -#: ../chirpui/memedit.py:72 ../chirpui/memedit.py:92 ../chirpui/memedit.py:109 -#: ../chirpui/memedit.py:137 ../chirpui/memedit.py:205 -#: ../chirpui/memedit.py:249 ../chirpui/memedit.py:312 -#: ../chirpui/memedit.py:880 ../chirpui/memedit.py:934 -#: ../chirpui/memedit.py:1071 ../chirpui/memedit.py:1144 -msgid "Duplex" -msgstr "" - -#: ../chirpui/memedit.py:73 ../chirpui/memedit.py:93 ../chirpui/memedit.py:135 -#: ../chirpui/memedit.py:198 ../chirpui/memedit.py:226 -#: ../chirpui/memedit.py:250 ../chirpui/memedit.py:308 -#: ../chirpui/memedit.py:881 ../chirpui/memedit.py:935 -#: ../chirpui/memedit.py:1062 -msgid "Offset" -msgstr "" - -#: ../chirpui/memedit.py:74 ../chirpui/memedit.py:94 ../chirpui/memedit.py:107 -#: ../chirpui/memedit.py:882 ../chirpui/memedit.py:936 -#: ../chirpui/memedit.py:1061 ../chirpui/memedit.py:1132 -#: ../chirpui/memedit.py:1289 ../chirpui/memedit.py:1307 -#: ../chirpui/memedit.py:1317 -msgid "Mode" -msgstr "" - -#: ../chirpui/memedit.py:75 ../chirpui/memedit.py:95 ../chirpui/memedit.py:108 -#: ../chirpui/memedit.py:296 ../chirpui/memedit.py:883 -#: ../chirpui/memedit.py:937 ../chirpui/memedit.py:1073 -#: ../chirpui/memedit.py:1136 ../chirpui/memedit.py:1140 -msgid "Power" -msgstr "" - -#: ../chirpui/memedit.py:76 ../chirpui/memedit.py:96 ../chirpui/memedit.py:110 -#: ../chirpui/memedit.py:140 ../chirpui/memedit.py:143 -#: ../chirpui/memedit.py:884 ../chirpui/memedit.py:938 -#: ../chirpui/memedit.py:1064 -msgid "Tune Step" -msgstr "" - -#: ../chirpui/memedit.py:77 ../chirpui/memedit.py:98 ../chirpui/memedit.py:885 -#: ../chirpui/memedit.py:939 ../chirpui/memedit.py:1072 -#: ../chirpui/memedit.py:1135 -msgid "Skip" -msgstr "" - -#: ../chirpui/memedit.py:175 -msgid "Erasing memory {loc}" -msgstr "" - -#: ../chirpui/memedit.py:236 -msgid "Unable to make changes to this model" -msgstr "" - -#: ../chirpui/memedit.py:241 -msgid "Editing new item, taking defaults" -msgstr "" - -#: ../chirpui/memedit.py:257 -msgid "Bad value for {col}: {val}" -msgstr "" - -#: ../chirpui/memedit.py:281 -msgid "Error setting memory" -msgstr "" - -#: ../chirpui/memedit.py:289 ../chirpui/memedit.py:356 -#: ../chirpui/memedit.py:1272 -msgid "Writing memory {number}" -msgstr "" - -#: ../chirpui/memedit.py:361 -msgid "" -"This operation requires moving all subsequent channels by one spot until an " -"empty location is reached. This can take a LONG time. Are you sure you " -"want to do this?" -msgstr "" - -#: ../chirpui/memedit.py:387 -msgid "Adding memory {number}" -msgstr "" - -#: ../chirpui/memedit.py:400 ../chirpui/memedit.py:913 -msgid "Erasing memory {number}" -msgstr "" - -#: ../chirpui/memedit.py:409 ../chirpui/memedit.py:518 -#: ../chirpui/memedit.py:564 ../chirpui/memedit.py:569 -#: ../chirpui/memedit.py:856 ../chirpui/memedit.py:1166 -msgid "Getting memory {number}" -msgstr "" - -#: ../chirpui/memedit.py:497 ../chirpui/memedit.py:508 -#: ../chirpui/memedit.py:556 -msgid "Moving memory from {old} to {new}" -msgstr "" - -#: ../chirpui/memedit.py:578 -msgid "Raw memory {number}" -msgstr "" - -#: ../chirpui/memedit.py:582 ../chirpui/memedit.py:610 -#: ../chirpui/memedit.py:615 -msgid "Getting raw memory {number}" -msgstr "" - -#: ../chirpui/memedit.py:587 -msgid "You can only diff two memories!" -msgstr "" - -#: ../chirpui/memedit.py:598 -msgid "Memory {number}" -msgstr "" - -#: ../chirpui/memedit.py:604 -msgid "Diff of {a} and {b}" -msgstr "" - -#: ../chirpui/memedit.py:628 -msgid "Memories must be contiguous" -msgstr "" - -#: ../chirpui/memedit.py:700 -msgid "Insert row above" -msgstr "" - -#: ../chirpui/memedit.py:701 -msgid "Insert row below" -msgstr "" - -#: ../chirpui/memedit.py:702 -#, fuzzy -msgid "Delete" -msgstr "_Delete" - -#: ../chirpui/memedit.py:702 -#, fuzzy -msgid "Delete all" -msgstr "_Delete" - -#: ../chirpui/memedit.py:703 -msgid "Delete (and shift up)" -msgstr "" - -#: ../chirpui/memedit.py:704 -#, fuzzy -msgid "Move up" -msgstr "Move _Up" - -#: ../chirpui/memedit.py:705 -#, fuzzy -msgid "Move down" -msgstr "Move D_n" - -#: ../chirpui/memedit.py:706 -#, fuzzy -msgid "Exchange memories" -msgstr "E_xchange" - -#: ../chirpui/memedit.py:707 -#, fuzzy -msgid "Cut" -msgstr "_Cut" - -#: ../chirpui/memedit.py:708 -#, fuzzy -msgid "Copy" -msgstr "_Copy" - -#: ../chirpui/memedit.py:709 -#, fuzzy -msgid "Paste" -msgstr "_Paste" - -#: ../chirpui/memedit.py:710 -#, fuzzy -msgid "Show Raw Memory" -msgstr "Show raw memory" - -#: ../chirpui/memedit.py:711 -#, fuzzy -msgid "Diff Raw Memories" -msgstr "Diff raw memories" - -#: ../chirpui/memedit.py:835 -msgid "Internal Error: Column {name} not found" -msgstr "" - -#: ../chirpui/memedit.py:863 -msgid "Getting channel {chan}" -msgstr "" - -#: ../chirpui/memedit.py:952 -msgid "Internal Error: Invalid limit {number" -msgstr "" - -#: ../chirpui/memedit.py:962 -msgid "Memory range:" -msgstr "" - -#: ../chirpui/memedit.py:989 -msgid "Go" -msgstr "" - -#: ../chirpui/memedit.py:1012 -msgid "Special Channels" -msgstr "" - -#: ../chirpui/memedit.py:1019 -msgid "Show Empty" -msgstr "" - -#: ../chirpui/memedit.py:1198 -msgid "Cutting memory {number}" -msgstr "" - -#: ../chirpui/memedit.py:1232 -msgid "Overwrite?" -msgstr "" - -#: ../chirpui/memedit.py:1237 -msgid "Overwrite location {number}?" -msgstr "" - -#: ../chirpui/memedit.py:1254 -msgid "Incompatible Memory" -msgstr "" - -#: ../chirpui/memedit.py:1257 -msgid "Pasted memory {number} is not compatible with this radio because:" -msgstr "" - -#: ../chirpui/memedit.py:1309 ../chirpui/memedit.py:1324 -msgid "URCALL" -msgstr "" - -#: ../chirpui/memedit.py:1309 ../chirpui/memedit.py:1325 -msgid "RPT1CALL" -msgstr "" - -#: ../chirpui/memedit.py:1309 ../chirpui/memedit.py:1326 -msgid "RPT2CALL" -msgstr "" - -#: ../chirpui/memedit.py:1310 ../chirpui/memedit.py:1327 -msgid "Digital Code" -msgstr "" - -#~ msgid "%i errors during open, check the debug log for details" -#~ msgstr "%i errors during open, check the debug log for details" diff --git a/locale/es_ES.po b/locale/es_ES.po deleted file mode 100644 index 4fa05d3..0000000 --- a/locale/es_ES.po +++ /dev/null @@ -1,1335 +0,0 @@ -# Spanish translations for CHIRP package. -# Copyright (C) 2022 Dan Smith -# This file is distributed under the same license as the CHIRP package. -# -msgid "" -msgstr "" -"Project-Id-Version: CHIRP\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-06-30 00:10-0400\n" -"PO-Revision-Date: 2022-06-30 00:12-0400\n" -"Last-Translator: MELERIX\n" -"Language-Team: \n" -"Language: es\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" -"X-Generator: Poedit 3.1\n" -"X-Poedit-SourceCharset: UTF-8\n" -"X-Poedit-Basepath: ..\n" -"X-Poedit-SearchPath-0: .\n" - -#: chirp/drivers/bj9900.py:112 -msgid "" -"This is experimental support for BJ-9900 which is still under development.\n" -"Please ensure you have a good backup with OEM software.\n" -"Also please send in bug and enhancement requests!\n" -"You have been warned. Proceed at your own risk!" -msgstr "" -"Este es un soporte experimental para BJ-9900 que aún está en desarrollo.\n" -"Por favor asegúrate de tener un buen respaldo con el software OEM.\n" -"¡También por favor envía en solicitudes de errores y mejoras!\n" -"Has sido advertido. ¡Procede bajo tu propio riesgo!" - -#: chirp/drivers/bj9900.py:137 chirp/drivers/ft450d.py:444 -#: chirp/drivers/ft817.py:339 -msgid "Cloning from radio" -msgstr "Clonando desde radio" - -#: chirp/drivers/bj9900.py:164 chirp/drivers/ft450d.py:473 -#: chirp/drivers/ft817.py:377 -msgid "Cloning to radio" -msgstr "Clonando a radio" - -#: chirp/drivers/ft450d.py:491 chirp/drivers/ft60.py:88 -#: chirp/drivers/ft817.py:403 -#, python-format -msgid "Radio did not ack block %i" -msgstr "La radio no reconoció el bloque %i" - -#: chirp/drivers/ft817.py:318 -msgid "" -"Unable to read last block. This often happens when the selected model is US " -"but the radio is a non-US one (or widebanded). Please choose the correct " -"model and try again." -msgstr "" -"No se puede leer el último bloque. Esto suele suceder cuando el modelo " -"seleccionado es de EE.UU pero la radio no es una de EE.UU (o de banda " -"ancha). Por favor elije el modelo correcto e intenta de nuevo." - -#: chirp/drivers/ft817.py:356 -msgid "Clone completed, checking for spurious bytes" -msgstr "Clonado completado, comprobando por bytes espurios" - -#: chirp/drivers/ft817.py:361 -msgid "" -"Radio sent data after the last awaited block, this happens when the selected " -"model is a non-US but the radio is a US one. Please choose the correct model " -"and try again." -msgstr "" -"La radio envió datos después del último bloque esperado, esto sucede cuando " -"el modelo seleccionado no es de EE.UU. pero la radio es una de EE.UU. Por " -"favor elije el modelo correcto e intenta de nuevo." - -#: chirp/drivers/vx5.py:117 -#, python-brace-format -msgid "{bank} is full" -msgstr "{bank} está lleno" - -#: chirp/drivers/vx5.py:134 -#, python-brace-format -msgid "Memory {num} not in bank {bank}" -msgstr "Memoria {num} no en banco {bank}" - -#: chirp/ui/bandplans.py:96 -msgid "" -"Band plans define default channel settings for frequencies in a region. " -"Choose a band plan or None for completely manual channel settings." -msgstr "" -"Los planes de banda definen los ajustes predeterminados de canal para las " -"frecuencias en una región. Elije una plan de banda o Ninguno para ajustes de " -"canal completamente manuales." - -#: chirp/ui/bankedit.py:58 -#, python-format -msgid "Retrieving %s information" -msgstr "Recuperando %s información" - -#: chirp/ui/bankedit.py:81 -#, python-format -msgid "Setting name on %s" -msgstr "Estableciendo nombre en %s" - -#: chirp/ui/bankedit.py:93 chirp/ui/bankedit.py:283 -#: chirp/ui/importdialog.py:601 chirp/ui/memdetail.py:334 -#: chirp/ui/memedit.py:67 chirp/ui/memedit.py:88 chirp/ui/memedit.py:343 -#: chirp/ui/memedit.py:1093 chirp/ui/memedit.py:1150 chirp/ui/memedit.py:1301 -#: chirp/ui/memedit.py:1303 -msgid "Name" -msgstr "Nombre" - -#: chirp/ui/bankedit.py:222 -#, python-brace-format -msgid "Updating {type} index for memory {num}" -msgstr "Actualizando {type} índice para memoria {num}" - -#: chirp/ui/bankedit.py:232 -#, python-brace-format -msgid "Updating mapping information for memory {num}" -msgstr "Actualizando información de mapeado para memoria {num}" - -#: chirp/ui/bankedit.py:238 chirp/ui/bankedit.py:269 -#, python-brace-format -msgid "Getting memory {num}" -msgstr "Obteniendo memoria {num}" - -#: chirp/ui/bankedit.py:253 -#, python-brace-format -msgid "Setting index for memory {num}" -msgstr "Estableciendo índice para memoria {num}" - -#: chirp/ui/bankedit.py:262 -#, python-brace-format -msgid "Getting {type} for memory {num}" -msgstr "Obteniendo {type} para memoria {num}" - -#: chirp/ui/bankedit.py:281 chirp/ui/memedit.py:65 chirp/ui/memedit.py:195 -#: chirp/ui/memedit.py:342 chirp/ui/memedit.py:426 chirp/ui/memedit.py:445 -#: chirp/ui/memedit.py:459 chirp/ui/memedit.py:482 chirp/ui/memedit.py:504 -#: chirp/ui/memedit.py:530 chirp/ui/memedit.py:542 chirp/ui/memedit.py:566 -#: chirp/ui/memedit.py:568 chirp/ui/memedit.py:641 chirp/ui/memedit.py:655 -#: chirp/ui/memedit.py:657 chirp/ui/memedit.py:699 chirp/ui/memedit.py:701 -#: chirp/ui/memedit.py:775 chirp/ui/memedit.py:909 chirp/ui/memedit.py:983 -#: chirp/ui/memedit.py:1036 chirp/ui/memedit.py:1091 chirp/ui/memedit.py:1117 -#: chirp/ui/memedit.py:1130 chirp/ui/memedit.py:1148 chirp/ui/memedit.py:1477 -msgid "Loc" -msgstr "Lugar" - -#: chirp/ui/bankedit.py:282 chirp/ui/importdialog.py:602 -#: chirp/ui/memdetail.py:332 chirp/ui/memedit.py:66 chirp/ui/memedit.py:89 -#: chirp/ui/memedit.py:210 chirp/ui/memedit.py:334 chirp/ui/memedit.py:344 -#: chirp/ui/memedit.py:407 chirp/ui/memedit.py:415 chirp/ui/memedit.py:1094 -#: chirp/ui/memedit.py:1147 -msgid "Frequency" -msgstr "Frecuencia" - -#: chirp/ui/bankedit.py:284 -msgid "Index" -msgstr "Índice" - -#: chirp/ui/bankedit.py:375 -#, python-brace-format -msgid "Getting {type} information for memory {num}" -msgstr "Obteniendo {type} información para memoria {num}" - -#: chirp/ui/bankedit.py:401 -#, python-format -msgid "Getting %s information" -msgstr "Obteniendo %s información" - -#: chirp/ui/clone.py:40 -#, python-brace-format -msgid "{vendor} {model} on {port}" -msgstr "{vendor} {model} en {port}" - -#: chirp/ui/clone.py:111 chirp/ui/clone.py:112 chirp/ui/clone.py:172 -msgid "Detect" -msgstr "Detectar" - -#: chirp/ui/clone.py:135 -msgid "Port" -msgstr "Puerto" - -#: chirp/ui/clone.py:136 -msgid "Vendor" -msgstr "Vendedor" - -#: chirp/ui/clone.py:137 -msgid "Model" -msgstr "Modelo" - -#: chirp/ui/clone.py:150 -msgid "Radio" -msgstr "Radio" - -#: chirp/ui/clone.py:177 -#, python-brace-format -msgid "Unable to detect radio on {port}" -msgstr "No se puede detectar radio en {port}" - -#: chirp/ui/clone.py:209 -#, python-brace-format -msgid "Internal error: Unable to upload to {model}" -msgstr "Error interno: No se puede subir a {model}" - -#: chirp/ui/cloneprog.py:44 -msgid "Clone Progress" -msgstr "Progreso de clonado" - -#: chirp/ui/cloneprog.py:47 -msgid "Cloning" -msgstr "Clonando" - -#: chirp/ui/cloneprog.py:56 -msgid "Cancel" -msgstr "Cancelar" - -#: chirp/ui/common.py:246 -msgid "Completed" -msgstr "Completado" - -#: chirp/ui/common.py:247 -msgid "idle" -msgstr "inactivo" - -#: chirp/ui/common.py:354 -msgid "Details" -msgstr "Detalles" - -#: chirp/ui/common.py:357 -msgid "Proceed?" -msgstr "¿Proceder?" - -#: chirp/ui/common.py:366 -msgid "Do not show this next time" -msgstr "No mostrar esto la próxima vez" - -#: chirp/ui/dstaredit.py:44 -msgid "Callsign" -msgstr "Señal de llamada" - -#: chirp/ui/dstaredit.py:129 -msgid "Your callsign" -msgstr "Tu señal de llamada" - -#: chirp/ui/dstaredit.py:137 -msgid "Repeater callsign" -msgstr "Señal de llamada del repetidor" - -#: chirp/ui/dstaredit.py:145 -msgid "My callsign" -msgstr "Mi señal de llamada" - -#: chirp/ui/dstaredit.py:175 chirp/ui/memedit.py:1640 -msgid "Downloading URCALL list" -msgstr "Descargando lista URCALL" - -#: chirp/ui/dstaredit.py:179 chirp/ui/memedit.py:1652 -msgid "Downloading RPTCALL list" -msgstr "Descargando lista RPTCALL" - -#: chirp/ui/dstaredit.py:183 -msgid "Downloading MYCALL list" -msgstr "Descargando lista MYCALL" - -#: chirp/ui/editorset.py:85 -#, python-format -msgid "Memories (%(variant)s)" -msgstr "Memorias (%(variant)s)" - -#: chirp/ui/editorset.py:89 -msgid "Memories" -msgstr "Memorias" - -#: chirp/ui/editorset.py:100 -msgid "D-STAR" -msgstr "D-STAR" - -#: chirp/ui/editorset.py:149 -msgid "Settings" -msgstr "Ajustes" - -#: chirp/ui/editorset.py:158 -msgid "Browser" -msgstr "Navegador" - -#: chirp/ui/editorset.py:279 -#, python-brace-format -msgid "The {vendor} {model} has multiple independent sub-devices" -msgstr "El {vendor} {model} tiene múltiples sub dispositivos independientes" - -#: chirp/ui/editorset.py:281 -msgid "Choose one to import from:" -msgstr "Elige uno para importar desde:" - -#: chirp/ui/editorset.py:286 -msgid "Cancelled" -msgstr "Cancelado" - -#: chirp/ui/editorset.py:291 -msgid "Internal Error" -msgstr "Error interno" - -#: chirp/ui/editorset.py:332 -#, python-brace-format -msgid "" -"There were errors while opening {file}. The affected memories will not be " -"importable!" -msgstr "" -"Hubo errores mientras se abría {file}. ¡Las memorias afectadas no serán " -"importables!" - -#: chirp/ui/editorset.py:344 -#, python-brace-format -msgid "There was an error during import: {error}" -msgstr "Hubo un error durante la importación: {error}" - -#: chirp/ui/editorset.py:352 -msgid "Unsupported file type" -msgstr "Tipo de archivo no soportado" - -#: chirp/ui/editorset.py:368 chirp/ui/editorset.py:383 -#, python-brace-format -msgid "There was an error during export: {error}" -msgstr "Hubo un error durante la exportación: {error}" - -#: chirp/ui/importdialog.py:96 -#, python-brace-format -msgid "" -"Location {number} is already being imported. Choose another value for 'New " -"Location' before selection 'Import'" -msgstr "" -"Localización {number} ya está siendo importada. Elije algún otro valor para " -"'Nueva Localización' antes de seleccionar 'Importar'" - -#: chirp/ui/importdialog.py:128 -msgid "Invalid value. Must be an integer." -msgstr "Valor invalido. Debe ser un entero." - -#: chirp/ui/importdialog.py:137 -#, python-brace-format -msgid "Location {number} is already being imported" -msgstr "Localización {number} ya está siendo importada" - -#: chirp/ui/importdialog.py:194 -msgid "Updating URCALL list" -msgstr "Actualizando lista URCALL" - -#: chirp/ui/importdialog.py:199 -msgid "Updating RPTCALL list" -msgstr "Actualizando lista RPTCALL" - -#: chirp/ui/importdialog.py:272 -#, python-brace-format -msgid "Setting memory {number}" -msgstr "Estableciendo memoria {number}" - -#: chirp/ui/importdialog.py:277 -msgid "Importing bank information" -msgstr "Importando información de banco" - -#: chirp/ui/importdialog.py:281 -msgid "Error importing memories:" -msgstr "Error importando memorias:" - -#: chirp/ui/importdialog.py:393 -msgid "All" -msgstr "Todo" - -#: chirp/ui/importdialog.py:399 -msgid "None" -msgstr "Ninguno" - -#: chirp/ui/importdialog.py:405 -msgid "Inverse" -msgstr "Inverso" - -#: chirp/ui/importdialog.py:411 -msgid "Select" -msgstr "Seleccionar" - -#: chirp/ui/importdialog.py:457 -msgid "Auto" -msgstr "Auto" - -#: chirp/ui/importdialog.py:463 -msgid "Reverse" -msgstr "Reverso" - -#: chirp/ui/importdialog.py:469 -msgid "Adjust New Location" -msgstr "Ajustar nueva localización" - -#: chirp/ui/importdialog.py:479 -msgid "Confirm overwrites" -msgstr "Confirmar sobreescritura" - -#: chirp/ui/importdialog.py:485 -msgid "Options" -msgstr "Opciones" - -#: chirp/ui/importdialog.py:558 -msgid "Cannot be imported because" -msgstr "No puede ser importado porque" - -#: chirp/ui/importdialog.py:575 -msgid "Import From File" -msgstr "Importar desde archivo" - -#: chirp/ui/importdialog.py:576 chirp/ui/mainapp.py:2023 -msgid "Import" -msgstr "Importar" - -#: chirp/ui/importdialog.py:599 -msgid "To" -msgstr "A" - -#: chirp/ui/importdialog.py:600 -msgid "From" -msgstr "Desde" - -#: chirp/ui/importdialog.py:603 chirp/ui/memdetail.py:362 -#: chirp/ui/memedit.py:81 chirp/ui/memedit.py:103 chirp/ui/memedit.py:1108 -#: chirp/ui/memedit.py:1165 chirp/ui/memedit.py:1306 -msgid "Comment" -msgstr "Comentario" - -#: chirp/ui/importdialog.py:607 -msgid "Location memory will be imported into" -msgstr "Localización de memoria será importada en" - -#: chirp/ui/importdialog.py:608 -msgid "Location of memory in the file being imported" -msgstr "Localización de la memoria en el archivo siendo importado" - -#: chirp/ui/importdialog.py:631 -msgid "Preparing memory list..." -msgstr "Preparando lista de memoria..." - -#: chirp/ui/importdialog.py:641 -msgid "Export To File" -msgstr "Exportar a archivo" - -#: chirp/ui/importdialog.py:642 chirp/ui/mainapp.py:2024 -msgid "Export" -msgstr "Exportar" - -#: chirp/ui/inputdialog.py:94 -msgid "An error has occurred" -msgstr "Ha ocurrido un error" - -#: chirp/ui/inputdialog.py:154 -msgid "File Exists" -msgstr "Archivo existe" - -#: chirp/ui/inputdialog.py:157 -#, python-brace-format -msgid "The file {name} already exists. Do you want to overwrite it?" -msgstr "El archivo {name} ya existe. ¿Quieres sobrescribirlo?" - -#: chirp/ui/mainapp.py:272 chirp/ui/mainapp.py:513 -msgid "Untitled" -msgstr "Sin título" - -#: chirp/ui/mainapp.py:326 chirp/ui/mainapp.py:875 -msgid "All files" -msgstr "Todos los archivos" - -#: chirp/ui/mainapp.py:327 chirp/ui/mainapp.py:876 -msgid "CHIRP Radio Images" -msgstr "Imagenes de radio CHIRP" - -#: chirp/ui/mainapp.py:328 chirp/ui/mainapp.py:877 chirp/ui/mainapp.py:1557 -msgid "CSV Files" -msgstr "Archivos CSV" - -#: chirp/ui/mainapp.py:329 chirp/ui/mainapp.py:878 -msgid "DAT Files" -msgstr "Archivos DAT" - -#: chirp/ui/mainapp.py:330 chirp/ui/mainapp.py:879 -msgid "EVE Files (VX5)" -msgstr "Archivos EVE (VX5)" - -#: chirp/ui/mainapp.py:331 chirp/ui/mainapp.py:880 -msgid "ICF Files" -msgstr "Archivos ICF" - -#: chirp/ui/mainapp.py:332 chirp/ui/mainapp.py:884 -msgid "VX5 Commander Files" -msgstr "Archivos de VX5 Commander" - -#: chirp/ui/mainapp.py:333 chirp/ui/mainapp.py:885 -msgid "VX6 Commander Files" -msgstr "Archivos de VX6 Commander" - -#: chirp/ui/mainapp.py:334 chirp/ui/mainapp.py:886 -msgid "VX7 Commander Files" -msgstr "Archivos de VX7 Commander" - -#: chirp/ui/mainapp.py:348 -msgid "" -"ICF files cannot be edited, only displayed or imported into another file. " -"Open in read-only mode?" -msgstr "" -"Archivos ICF no se pueden editar, solo mostrarse o importarse en algún otro " -"archivo. ¿Abrir en modo solo lectura?" - -#: chirp/ui/mainapp.py:371 -msgid "" -"Unable to open this image. It was generated with a newer version of CHIRP " -"and thus may be for a radio model that is not supported by this version. " -"Please update to the latest version of CHIRP and try again." -msgstr "" -"No se puede abrir esta imagen. Esta fue generada con una versión más nueva " -"de CHIRP y por lo tanto puede ser para un modelo de radio que no es " -"soportada por esta versión. Por favor actualiza a la última versión de CHIRP " -"e intenta de nuevo." - -#: chirp/ui/mainapp.py:380 -msgid "Unable to open this image: unsupported model" -msgstr "No se puede abrir esta imagen: modelo no soportado" - -#: chirp/ui/mainapp.py:400 -#, python-brace-format -msgid "There was an error opening {fname}: {error}" -msgstr "Hubo un error abriendo {fname}: {error}" - -#: chirp/ui/mainapp.py:412 -#, python-brace-format -msgid "{num} errors during open:" -msgstr "{num} errores mientras se abría:" - -#: chirp/ui/mainapp.py:420 -msgid "Note:" -msgstr "Nota:" - -#: chirp/ui/mainapp.py:421 -#, python-brace-format -msgid "" -"The {vendor} {model} operates in live mode. This means that any " -"changes you make are immediately sent to the radio. Because of this, you " -"cannot perform the Save or Upload operations. If you wish to " -"edit the contents offline, please Export to a CSV file, using the " -"File menu." -msgstr "" -"El {vendor} {model} opera en modo en vivo. Esto significa que " -"cualquier cambio que hagas es enviado inmediatamente a la radio. Debido a " -"esto , no puedes usar las operaciones Guardar o Subir. Si " -"quieres editar el contenido sin conexón, por favor Exporta a un " -"archivo CSV, usando el menú Archivo." - -#: chirp/ui/mainapp.py:430 -msgid "Don't show this again" -msgstr "No mostrar esto de neuvo" - -#: chirp/ui/mainapp.py:464 -#, python-brace-format -msgid "{vendor} {model} image file" -msgstr "archivo de imagen {vendor} {model}" - -#: chirp/ui/mainapp.py:480 -msgid "VX7 Commander" -msgstr "VX7 Commander" - -#: chirp/ui/mainapp.py:482 -msgid "VX6 Commander" -msgstr "VX6 Commander" - -#: chirp/ui/mainapp.py:484 -msgid "EVE" -msgstr "EVE" - -#: chirp/ui/mainapp.py:485 -msgid "VX5 Commander" -msgstr "VX5 Commander" - -#: chirp/ui/mainapp.py:562 -msgid "Open recent file" -msgstr "Abrir archivo reciente" - -#: chirp/ui/mainapp.py:631 -#, python-brace-format -msgid "Import stock configuration {name}" -msgstr "Importar configuración original {name}" - -#: chirp/ui/mainapp.py:647 -#, python-brace-format -msgid "Open stock configuration {name}" -msgstr "Abrir configuración original {name}" - -#: chirp/ui/mainapp.py:668 -msgid "Proceed with experimental driver?" -msgstr "¿Proceder con controlador experimental?" - -#: chirp/ui/mainapp.py:670 -msgid "This radio's driver is experimental. Do you want to proceed?" -msgstr "El controlador de esta radio es experimental. ¿Quieres proceder?" - -#: chirp/ui/mainapp.py:689 -#, python-brace-format -msgid "{name} Information" -msgstr "{name} Información" - -#: chirp/ui/mainapp.py:691 -#, python-brace-format -msgid "{information}" -msgstr "{information}" - -#: chirp/ui/mainapp.py:695 -msgid "Don't show information for any radio again" -msgstr "No mostrar información para alguna radio de nuevo" - -#: chirp/ui/mainapp.py:719 -#, python-brace-format -msgid "{name} Instructions" -msgstr "{name} Instrucciones" - -#: chirp/ui/mainapp.py:721 -#, python-brace-format -msgid "{instructions}" -msgstr "{instructions}" - -#: chirp/ui/mainapp.py:725 -msgid "Don't show instructions for any radio again" -msgstr "No mostrar instrucciones para alguna radio de nuevo" - -#: chirp/ui/mainapp.py:840 -msgid "Save Changes?" -msgstr "¿Guardar cambios?" - -#: chirp/ui/mainapp.py:846 -msgid "File is modified, save changes before closing?" -msgstr "El archivo está modificado, ¿guardar los cambios antes de cerrar?" - -#: chirp/ui/mainapp.py:881 -msgid "Kenwood HMK Files" -msgstr "Archivos Kenwood HMK" - -#: chirp/ui/mainapp.py:882 -msgid "Kenwood ITM Files" -msgstr "Archivos Kenwood ITM" - -#: chirp/ui/mainapp.py:883 -msgid "Travel Plus Files" -msgstr "Archivos Travel Plus" - -#: chirp/ui/mainapp.py:904 -msgid "DMR-MARC Repeater Database Dump" -msgstr "Volcado de la base de datos de repetidor DMR-MARC" - -#: chirp/ui/mainapp.py:1014 chirp/ui/mainapp.py:1121 -msgid "RepeaterBook Query" -msgstr "Consultar RepeaterBook" - -#: chirp/ui/mainapp.py:1075 chirp/ui/mainapp.py:1181 -msgid "RepeaterBook query failed" -msgstr "Consulta RepeaterBook fallida" - -#: chirp/ui/mainapp.py:1248 -#, python-format -msgid "Invalid value for %s" -msgstr "Valor inválido para %s" - -#: chirp/ui/mainapp.py:1271 -msgid "Query failed" -msgstr "Consulta fallida" - -#: chirp/ui/mainapp.py:1366 chirp/ui/mainapp.py:1431 -msgid "RadioReference.com Query" -msgstr "Consultar RadioReference.com" - -#: chirp/ui/mainapp.py:1502 -msgid "RadioReference.com Province Query" -msgstr "Consulta provincia RadioReference.com" - -#: chirp/ui/mainapp.py:1603 -msgid "With significant contributions from:" -msgstr "Con contribuciones significativas de:" - -#: chirp/ui/mainapp.py:1639 -msgid "Select Columns" -msgstr "Seleccionar columnas" - -#: chirp/ui/mainapp.py:1656 -#, python-brace-format -msgid "Visible columns for {radio}" -msgstr "Columnas visibles para {radio}" - -#: chirp/ui/mainapp.py:1719 -msgid "Reporting is disabled" -msgstr "Reportar está deshabilitado" - -#: chirp/ui/mainapp.py:1721 -msgid "" -"The reporting feature of CHIRP is designed to help improve quality by " -"allowing the authors to focus on the radio drivers used most often and " -"errors experienced by the users. The reports contain no identifying " -"information and are used only for statistical purposes by the authors. Your " -"privacy is extremely important, but please consider leaving this feature " -"enabled to help make CHIRP better!\n" -"\n" -"Are you sure you want to disable this feature?" -msgstr "" -"La función de reportar de CHIRP está diseñada para ayudar a mejorar la " -"calidad al permitir a los autores enfocarse en los controladores de las " -"radios usadas mas frecuentemente y errores experimentados por los usuarios. " -"Los reportes no contienen información de identificación y solo son usados " -"para propósitos estadísticos por los autores. Tu privacidad es " -"extremadamente importante, pero ¡por favor considera dejar esta función " -"habilitada para ayudar a hacer a CHIRP mejor!\n" -"\n" -"¿Seguro que quieres deshabilitar esta función?" - -#: chirp/ui/mainapp.py:1764 -msgid "" -"Choose a language or Auto to use the operating system default. You will need " -"to restart the application before the change will take effect" -msgstr "" -"Elige un lenguaje o Auto para usar el por defecto del sistema operativo. " -"Tendrás que reiniciar la aplicación antes para que el cambio surta efecto" - -#: chirp/ui/mainapp.py:1777 -msgid "Python Modules" -msgstr "Módulos Python" - -#: chirp/ui/mainapp.py:1778 -msgid "Modules" -msgstr "Modulos" - -#: chirp/ui/mainapp.py:1982 -msgid "_File" -msgstr "_Archivo" - -#: chirp/ui/mainapp.py:1985 -msgid "Open Stock Config" -msgstr "Abrir configuración original" - -#: chirp/ui/mainapp.py:1986 -msgid "Open _Recent" -msgstr "Abrir _reciente" - -#: chirp/ui/mainapp.py:1987 -msgid "Clear Recently Opened" -msgstr "Limpiar abierto recientemente" - -#: chirp/ui/mainapp.py:1991 -msgid "Load Module" -msgstr "Cargar modulo" - -#: chirp/ui/mainapp.py:1994 -msgid "_Edit" -msgstr "_Editar" - -#: chirp/ui/mainapp.py:1995 -msgid "_Cut" -msgstr "_Cortar" - -#: chirp/ui/mainapp.py:1996 -msgid "_Copy" -msgstr "_Copiar" - -#: chirp/ui/mainapp.py:1997 -msgid "_Paste" -msgstr "_Pegar" - -#: chirp/ui/mainapp.py:1999 -msgid "_Delete" -msgstr "_Borrar" - -#: chirp/ui/mainapp.py:2000 -msgid "Select _All" -msgstr "Seleccionar _todo" - -#: chirp/ui/mainapp.py:2001 -msgid "Move _Up" -msgstr "Mover _arriba" - -#: chirp/ui/mainapp.py:2003 -msgid "Move Dow_n" -msgstr "Mover abaj_o" - -#: chirp/ui/mainapp.py:2005 -msgid "E_xchange" -msgstr "I_ntercambiar" - -#: chirp/ui/mainapp.py:2007 chirp/ui/memedit.py:888 -msgid "P_roperties" -msgstr "P_ropiedades" - -#: chirp/ui/mainapp.py:2008 -msgid "_View" -msgstr "_Ver" - -#: chirp/ui/mainapp.py:2009 -msgid "Columns" -msgstr "Columnas" - -#: chirp/ui/mainapp.py:2010 -msgid "Developer" -msgstr "Desarrollador" - -#: chirp/ui/mainapp.py:2011 chirp/ui/memedit.py:889 -msgid "Show Raw Memory" -msgstr "Mostrar memoria en bruto" - -#: chirp/ui/mainapp.py:2013 chirp/ui/memedit.py:890 -msgid "Diff Raw Memories" -msgstr "Diferenciar memorias en bruto" - -#: chirp/ui/mainapp.py:2015 -msgid "Diff Tabs" -msgstr "Diferenciar pestañas" - -#: chirp/ui/mainapp.py:2017 -msgid "Change Language" -msgstr "Cambiar lenguaje" - -#: chirp/ui/mainapp.py:2018 -msgid "_Radio" -msgstr "_Radio" - -#: chirp/ui/mainapp.py:2019 -msgid "Download From Radio" -msgstr "Descargar desde radio" - -#: chirp/ui/mainapp.py:2021 -msgid "Upload To Radio" -msgstr "Subir a radio" - -#: chirp/ui/mainapp.py:2025 -msgid "Import From Data Source" -msgstr "Importar desde fuente de datos" - -#: chirp/ui/mainapp.py:2027 chirp/ui/mainapp.py:2041 -msgid "DMR-MARC Repeaters" -msgstr "Repetidores DMR-MARC" - -#: chirp/ui/mainapp.py:2028 chirp/ui/mainapp.py:2042 -msgid "RadioReference" -msgstr "RadioReference" - -#: chirp/ui/mainapp.py:2029 chirp/ui/mainapp.py:2043 -msgid "RadioReference.com US" -msgstr "RadioReference.com EE.UU" - -#: chirp/ui/mainapp.py:2031 chirp/ui/mainapp.py:2045 -msgid "RadioReference.com Canada" -msgstr "RadioReference.com Canadá" - -#: chirp/ui/mainapp.py:2033 chirp/ui/mainapp.py:2047 -msgid "RFinder" -msgstr "RFinder" - -#: chirp/ui/mainapp.py:2034 chirp/ui/mainapp.py:2049 -msgid "RepeaterBook" -msgstr "RepeaterBook" - -#: chirp/ui/mainapp.py:2035 chirp/ui/mainapp.py:2050 -msgid "RepeaterBook Political Query" -msgstr "Consulta política de RepeaterBook" - -#: chirp/ui/mainapp.py:2037 chirp/ui/mainapp.py:2052 -msgid "RepeaterBook Proximity Query" -msgstr "Consulta de proximidad de RepeaterBook" - -#: chirp/ui/mainapp.py:2039 chirp/ui/mainapp.py:2048 -msgid "przemienniki.net" -msgstr "przemienniki.net" - -#: chirp/ui/mainapp.py:2040 -msgid "Query Data Source" -msgstr "Consultar fuente de datos" - -#: chirp/ui/mainapp.py:2054 -msgid "CHIRP Native File" -msgstr "Archivo nativo de CHIRP" - -#: chirp/ui/mainapp.py:2056 -msgid "CSV File" -msgstr "Archivo CSV" - -#: chirp/ui/mainapp.py:2057 -msgid "Import From Stock Config" -msgstr "Importar desde configuración original" - -#: chirp/ui/mainapp.py:2059 -msgid "Channel Defaults" -msgstr "Predeterminados del canal" - -#: chirp/ui/mainapp.py:2062 -msgid "Help" -msgstr "Ayuda" - -#: chirp/ui/mainapp.py:2064 -msgid "Get Help Online..." -msgstr "Obtener ayuda en línea..." - -#: chirp/ui/mainapp.py:2075 -msgid "Report Statistics" -msgstr "Reportar estadísticas" - -#: chirp/ui/mainapp.py:2077 -msgid "Hide Unused Fields" -msgstr "Ocultar campos no usados" - -#: chirp/ui/mainapp.py:2079 -msgid "Smart Tone Modes" -msgstr "Modos de tono inteligente" - -#: chirp/ui/mainapp.py:2081 -msgid "Show Information" -msgstr "Mostrar información" - -#: chirp/ui/mainapp.py:2083 -msgid "Show Instructions" -msgstr "Mostrar instrucciones" - -#: chirp/ui/mainapp.py:2085 -msgid "Enable Developer Functions" -msgstr "Habilitar funciones de desarrollador" - -#: chirp/ui/mainapp.py:2206 -#, python-brace-format -msgid "A new version of CHIRP is available: {ver}. " -msgstr "Una nueva versión de CHIRP está disponible: {ver}. " - -#: chirp/ui/mainapp.py:2328 -msgid "Error reporting is enabled" -msgstr "Reporte de errores está habilitado" - -#: chirp/ui/mainapp.py:2331 -msgid "" -"If you wish to disable this feature you may do so in the Help menu" -msgstr "" -"Si deseas deshabilitar esta función puedes hacerlo en el menú Ayuda" - -#: chirp/ui/memdetail.py:237 -msgid "General" -msgstr "General" - -#: chirp/ui/memdetail.py:279 -msgid "Other" -msgstr "Otro" - -#: chirp/ui/memdetail.py:336 chirp/ui/memedit.py:68 chirp/ui/memedit.py:101 -#: chirp/ui/memedit.py:116 chirp/ui/memedit.py:231 chirp/ui/memedit.py:237 -#: chirp/ui/memedit.py:271 chirp/ui/memedit.py:423 chirp/ui/memedit.py:1095 -#: chirp/ui/memedit.py:1156 chirp/ui/memedit.py:1307 chirp/ui/memedit.py:1367 -msgid "Tone Mode" -msgstr "Modo de tono" - -#: chirp/ui/memdetail.py:338 chirp/ui/memedit.py:69 chirp/ui/memedit.py:90 -#: chirp/ui/memedit.py:107 chirp/ui/memedit.py:166 chirp/ui/memedit.py:167 -#: chirp/ui/memedit.py:256 chirp/ui/memedit.py:286 chirp/ui/memedit.py:293 -#: chirp/ui/memedit.py:298 chirp/ui/memedit.py:306 chirp/ui/memedit.py:347 -#: chirp/ui/memedit.py:421 chirp/ui/memedit.py:1096 chirp/ui/memedit.py:1152 -#: chirp/ui/memedit.py:1308 -msgid "Tone" -msgstr "Tono" - -#: chirp/ui/memdetail.py:340 chirp/ui/memedit.py:70 chirp/ui/memedit.py:91 -#: chirp/ui/memedit.py:108 chirp/ui/memedit.py:260 chirp/ui/memedit.py:279 -#: chirp/ui/memedit.py:294 chirp/ui/memedit.py:299 chirp/ui/memedit.py:310 -#: chirp/ui/memedit.py:348 chirp/ui/memedit.py:421 chirp/ui/memedit.py:1097 -#: chirp/ui/memedit.py:1153 chirp/ui/memedit.py:1304 -msgid "ToneSql" -msgstr "ToneSql" - -#: chirp/ui/memdetail.py:342 chirp/ui/memedit.py:71 chirp/ui/memedit.py:92 -#: chirp/ui/memedit.py:109 chirp/ui/memedit.py:244 chirp/ui/memedit.py:280 -#: chirp/ui/memedit.py:288 chirp/ui/memedit.py:300 chirp/ui/memedit.py:308 -#: chirp/ui/memedit.py:349 chirp/ui/memedit.py:417 chirp/ui/memedit.py:1098 -#: chirp/ui/memedit.py:1154 chirp/ui/memedit.py:1296 chirp/ui/memedit.py:1373 -msgid "DTCS Code" -msgstr "Código DTCS" - -#: chirp/ui/memdetail.py:344 -msgid "RX DTCS Code" -msgstr "Código RX DTCS" - -#: chirp/ui/memdetail.py:346 chirp/ui/memedit.py:73 chirp/ui/memedit.py:94 -#: chirp/ui/memedit.py:111 chirp/ui/memedit.py:252 chirp/ui/memedit.py:282 -#: chirp/ui/memedit.py:290 chirp/ui/memedit.py:302 chirp/ui/memedit.py:314 -#: chirp/ui/memedit.py:351 chirp/ui/memedit.py:1100 chirp/ui/memedit.py:1158 -#: chirp/ui/memedit.py:1298 chirp/ui/memedit.py:1372 -msgid "DTCS Pol" -msgstr "Polaridad DTCS" - -#: chirp/ui/memdetail.py:348 -msgid "Cross mode" -msgstr "Modo cruzado" - -#: chirp/ui/memdetail.py:350 chirp/ui/memedit.py:75 chirp/ui/memedit.py:96 -#: chirp/ui/memedit.py:114 chirp/ui/memedit.py:140 chirp/ui/memedit.py:147 -#: chirp/ui/memedit.py:272 chirp/ui/memedit.py:345 chirp/ui/memedit.py:423 -#: chirp/ui/memedit.py:1102 chirp/ui/memedit.py:1159 chirp/ui/memedit.py:1309 -#: chirp/ui/memedit.py:1381 -msgid "Duplex" -msgstr "Dúplex" - -#: chirp/ui/memdetail.py:352 chirp/ui/memedit.py:76 chirp/ui/memedit.py:97 -#: chirp/ui/memedit.py:145 chirp/ui/memedit.py:218 chirp/ui/memedit.py:317 -#: chirp/ui/memedit.py:346 chirp/ui/memedit.py:419 chirp/ui/memedit.py:1103 -#: chirp/ui/memedit.py:1160 chirp/ui/memedit.py:1300 -msgid "Offset" -msgstr "Desplazamiento" - -#: chirp/ui/memdetail.py:354 chirp/ui/memedit.py:77 chirp/ui/memedit.py:98 -#: chirp/ui/memedit.py:112 chirp/ui/memedit.py:159 chirp/ui/memedit.py:160 -#: chirp/ui/memedit.py:163 chirp/ui/memedit.py:407 chirp/ui/memedit.py:1104 -#: chirp/ui/memedit.py:1161 chirp/ui/memedit.py:1299 chirp/ui/memedit.py:1366 -#: chirp/ui/memedit.py:1383 chirp/ui/memedit.py:1384 chirp/ui/memedit.py:1564 -#: chirp/ui/memedit.py:1582 chirp/ui/memedit.py:1592 -msgid "Mode" -msgstr "Modo" - -#: chirp/ui/memdetail.py:356 chirp/ui/memedit.py:79 chirp/ui/memedit.py:100 -#: chirp/ui/memedit.py:115 chirp/ui/memedit.py:150 chirp/ui/memedit.py:151 -#: chirp/ui/memedit.py:156 chirp/ui/memedit.py:1106 chirp/ui/memedit.py:1163 -#: chirp/ui/memedit.py:1302 chirp/ui/memedit.py:1379 -msgid "Tune Step" -msgstr "Paso de sintonización" - -#: chirp/ui/memdetail.py:358 chirp/ui/memedit.py:80 chirp/ui/memedit.py:102 -#: chirp/ui/memedit.py:1107 chirp/ui/memedit.py:1164 chirp/ui/memedit.py:1310 -#: chirp/ui/memedit.py:1369 -msgid "Skip" -msgstr "Omitir" - -#: chirp/ui/memdetail.py:360 chirp/ui/memedit.py:78 chirp/ui/memedit.py:99 -#: chirp/ui/memedit.py:113 chirp/ui/memedit.py:407 chirp/ui/memedit.py:1105 -#: chirp/ui/memedit.py:1162 chirp/ui/memedit.py:1311 chirp/ui/memedit.py:1370 -#: chirp/ui/memedit.py:1377 -msgid "Power" -msgstr "Poder" - -#: chirp/ui/memdetail.py:408 -msgid "Memory validation failed:" -msgstr "Validación de memoria fallida:" - -#: chirp/ui/memedit.py:52 -msgid "Invalid value for this field" -msgstr "Valor invalido para este campo" - -#: chirp/ui/memedit.py:72 chirp/ui/memedit.py:93 chirp/ui/memedit.py:110 -#: chirp/ui/memedit.py:248 chirp/ui/memedit.py:281 chirp/ui/memedit.py:289 -#: chirp/ui/memedit.py:296 chirp/ui/memedit.py:301 chirp/ui/memedit.py:312 -#: chirp/ui/memedit.py:350 chirp/ui/memedit.py:417 chirp/ui/memedit.py:1099 -#: chirp/ui/memedit.py:1155 chirp/ui/memedit.py:1297 chirp/ui/memedit.py:1374 -msgid "DTCS Rx Code" -msgstr "Código DTCS Rx" - -#: chirp/ui/memedit.py:74 chirp/ui/memedit.py:95 chirp/ui/memedit.py:117 -#: chirp/ui/memedit.py:232 chirp/ui/memedit.py:242 chirp/ui/memedit.py:264 -#: chirp/ui/memedit.py:273 chirp/ui/memedit.py:283 chirp/ui/memedit.py:291 -#: chirp/ui/memedit.py:295 chirp/ui/memedit.py:303 chirp/ui/memedit.py:352 -#: chirp/ui/memedit.py:1101 chirp/ui/memedit.py:1157 chirp/ui/memedit.py:1305 -#: chirp/ui/memedit.py:1368 -msgid "Cross Mode" -msgstr "Modo cruzado" - -#: chirp/ui/memedit.py:198 -#, python-brace-format -msgid "Erasing memory {loc}" -msgstr "Borrando memoria {loc}" - -#: chirp/ui/memedit.py:327 -msgid "Unable to make changes to this model" -msgstr "No se pueden hacer cambios a este modelo" - -#: chirp/ui/memedit.py:390 -msgid "Error setting memory" -msgstr "Error estableciendo memoria" - -#: chirp/ui/memedit.py:400 chirp/ui/memedit.py:466 chirp/ui/memedit.py:742 -#: chirp/ui/memedit.py:765 chirp/ui/memedit.py:1541 -#, python-brace-format -msgid "Writing memory {number}" -msgstr "Escribiendo memoria {number}" - -#: chirp/ui/memedit.py:471 -msgid "" -"This operation requires moving all subsequent channels by one spot until an " -"empty location is reached. This can take a LONG time. Are you sure you " -"want to do this?" -msgstr "" -"Esta operación requiere mover los canales subsecuentes un lugar hasta " -"encontrar una localización vacía. Esto puede tomar MUCHO tiempo. ¿Estás " -"seguro de querer hacerlo?" - -#: chirp/ui/memedit.py:495 -#, python-brace-format -msgid "Adding memory {number}" -msgstr "Agregando memoria {number}" - -#: chirp/ui/memedit.py:508 chirp/ui/memedit.py:1137 -#, python-brace-format -msgid "Erasing memory {number}" -msgstr "Borrando memoria {number}" - -#: chirp/ui/memedit.py:517 chirp/ui/memedit.py:625 chirp/ui/memedit.py:672 -#: chirp/ui/memedit.py:677 chirp/ui/memedit.py:1066 chirp/ui/memedit.py:1399 -#, python-brace-format -msgid "Getting memory {number}" -msgstr "Obteniendo memoria {number}" - -#: chirp/ui/memedit.py:604 chirp/ui/memedit.py:615 chirp/ui/memedit.py:664 -#, python-brace-format -msgid "Moving memory from {old} to {new}" -msgstr "Moviendo memoria desde {old} a {new}" - -#: chirp/ui/memedit.py:686 -#, python-brace-format -msgid "Raw memory {number}" -msgstr "Memoria en bruto {number}" - -#: chirp/ui/memedit.py:690 chirp/ui/memedit.py:718 chirp/ui/memedit.py:723 -#, python-brace-format -msgid "Getting raw memory {number}" -msgstr "Obteniendo memoria en bruto {number}" - -#: chirp/ui/memedit.py:695 -msgid "You can only diff two memories!" -msgstr "¡Solo puedes diferenciar dos memorias!" - -#: chirp/ui/memedit.py:706 -#, python-brace-format -msgid "Memory {number}" -msgstr "Memoria {number}" - -#: chirp/ui/memedit.py:712 -#, python-brace-format -msgid "Diff of {a} and {b}" -msgstr "Diferencia de {a} y {b}" - -#: chirp/ui/memedit.py:746 -#, python-brace-format -msgid "Getting original memory {number}" -msgstr "Obteniendo memoria original {number}" - -#: chirp/ui/memedit.py:784 -msgid "Memories must be contiguous" -msgstr "Memorias deben ser contiguas" - -#: chirp/ui/memedit.py:875 -msgid "Cut" -msgstr "Cortar" - -#: chirp/ui/memedit.py:876 -msgid "Copy" -msgstr "Copiar" - -#: chirp/ui/memedit.py:877 -msgid "Paste" -msgstr "Pegar" - -#: chirp/ui/memedit.py:878 -msgid "Select All" -msgstr "Seleccionar todo" - -#: chirp/ui/memedit.py:879 -msgid "Insert row above" -msgstr "Insertar fila encima" - -#: chirp/ui/memedit.py:880 -msgid "Insert row below" -msgstr "Insertar fila debajo" - -#: chirp/ui/memedit.py:881 -msgid "Delete" -msgstr "Borrar" - -#: chirp/ui/memedit.py:882 -msgid "this memory" -msgstr "esta memoria" - -#: chirp/ui/memedit.py:882 -msgid "these memories" -msgstr "estas memorias" - -#: chirp/ui/memedit.py:883 -msgid "...and shift block up" -msgstr "...y desplazar bloque hacia arriba" - -#: chirp/ui/memedit.py:884 -msgid "...and shift all memories up" -msgstr "...y desplazar todas las memorias hacia arriba" - -#: chirp/ui/memedit.py:885 -msgid "Move up" -msgstr "Mover arriba" - -#: chirp/ui/memedit.py:886 -msgid "Move down" -msgstr "Mover abajo" - -#: chirp/ui/memedit.py:887 -msgid "Exchange memories" -msgstr "Intercambiar memorias" - -#: chirp/ui/memedit.py:1053 -#, python-brace-format -msgid "Internal Error: Column {name} not found" -msgstr "Error interno: Columna {name} no encontrada" - -#: chirp/ui/memedit.py:1177 -#, python-brace-format -msgid "Internal Error: Invalid limit {number}" -msgstr "Error interno: límite {number} invalido" - -#: chirp/ui/memedit.py:1188 -msgid "Memory Range:" -msgstr "Rango de memoria:" - -#: chirp/ui/memedit.py:1215 -msgid "Refresh" -msgstr "Actualizar" - -#: chirp/ui/memedit.py:1238 -msgid "Special Channels" -msgstr "Canales especiales" - -#: chirp/ui/memedit.py:1246 -msgid "Show Empty" -msgstr "Mostrar vacío" - -#: chirp/ui/memedit.py:1258 -msgid "Properties" -msgstr "Propiedades" - -#: chirp/ui/memedit.py:1433 -#, python-brace-format -msgid "Cutting memory {number}" -msgstr "Cortando memoria {number}" - -#: chirp/ui/memedit.py:1465 -#, python-brace-format -msgid "" -"Unable to paste {src} memories into {dst} rows. Increase the memory bounds " -"or show empty memories." -msgstr "" -"No se pueden pegar {src} memorias en {dst} filas. Incrementa los límites de " -"la memoria o muestra memorias vacías." - -#: chirp/ui/memedit.py:1481 -msgid "Yes to All" -msgstr "Sí a todo" - -#: chirp/ui/memedit.py:1483 -msgid "Overwrite?" -msgstr "¿Sobrescribir?" - -#: chirp/ui/memedit.py:1492 -#, python-brace-format -msgid "Overwrite location {number}?" -msgstr "¿Sobrescribir localización {number}?" - -#: chirp/ui/memedit.py:1519 -msgid "Incompatible Memory" -msgstr "Memoria incompatible" - -#: chirp/ui/memedit.py:1525 -#, python-brace-format -msgid "Pasted memory {number} is not compatible with this radio because:" -msgstr "Memoria pegada {number} no es compatible con esta radio porque:" - -#: chirp/ui/memedit.py:1584 chirp/ui/memedit.py:1599 -msgid "URCALL" -msgstr "URCALL" - -#: chirp/ui/memedit.py:1584 chirp/ui/memedit.py:1600 -msgid "RPT1CALL" -msgstr "RPT1CALL" - -#: chirp/ui/memedit.py:1584 chirp/ui/memedit.py:1601 -msgid "RPT2CALL" -msgstr "RPT2CALL" - -#: chirp/ui/memedit.py:1585 chirp/ui/memedit.py:1602 -msgid "Digital Code" -msgstr "Código digital" - -#: chirp/ui/settingsedit.py:82 -#, python-format -msgid "Error in setting value: %s" -msgstr "Error en valor de ajuste: %s" - -#: chirp/ui/settingsedit.py:114 -#, python-format -msgid "Invalid setting value: %s" -msgstr "Valor de ajuste inválido: %s" - -#: chirp/ui/settingsedit.py:175 -msgid "Enabled" -msgstr "Habilitado" - -#: chirp/ui/shiftdialog.py:31 -msgid "Shift" -msgstr "Desplazamiento" - -#: chirp/ui/shiftdialog.py:65 -#, python-brace-format -msgid "Moving {src} to {dst}" -msgstr "Moviendo {src} a {dst}" - -#: chirp/ui/shiftdialog.py:85 -#, python-brace-format -msgid "Looking for a free spot ({number})" -msgstr "Buscando un lugar libre ({number})" - -#: chirp/ui/shiftdialog.py:98 -msgid "No space to insert a row" -msgstr "No hay espacio para insertar una fila" - -#: chirp/ui/shiftdialog.py:146 -#, python-brace-format -msgid "Moved {count} memories" -msgstr "Movidas {count} memorias" - -#: share/chirp.desktop:5 -msgid "CHIRP" -msgstr "CHIRP" - -#: share/chirp.desktop:6 -msgid "Radio Programming Tool" -msgstr "Herramienta de programación de radio" - -#: share/chirp.desktop:7 -msgid "Program amateur radios" -msgstr "Programa radioaficionados" - -#: share/chirp.desktop:13 -msgid "Hamradio;Programming;Handheld;Radio;Amateur;Programmer" -msgstr "Radioafición;Programación;Portátil;Radio;Aficionado;Programador" diff --git a/locale/fr.po b/locale/fr.po deleted file mode 100644 index ae230d4..0000000 --- a/locale/fr.po +++ /dev/null @@ -1,944 +0,0 @@ -# French translations for CHIRP package. -# Copyright (C) 2014 Dan Smith -# This file is distributed under the same license as the CHIRP package. -# Dan Smith , 2014. -# -msgid "" -msgstr "" -"Project-Id-Version: CHIRP\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2012-02-16 12:06-0800\n" -"PO-Revision-Date: 2014-04-05 22:18+0100\n" -"Last-Translator: Matthieu Lapadu-Hargues \n" -"Language-Team: French\n" -"Language: fr\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=ASCII\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=2; plural=(n > 1);\n" -"X-Generator: Poedit 1.5.4\n" - -#: ../chirpui/common.py:204 -msgid "Completed" -msgstr "Termine" - -#: ../chirpui/common.py:205 -msgid "idle" -msgstr "Pret" - -#: ../chirpui/bankedit.py:52 -msgid "Retrieving bank information" -msgstr "Recuperation des information de banque" - -#: ../chirpui/bankedit.py:75 -msgid "Setting name on bank" -msgstr "Donner un nom a la banque" - -#: ../chirpui/bankedit.py:85 -msgid "Bank" -msgstr "Banque" - -#: ../chirpui/bankedit.py:86 ../chirpui/bankedit.py:240 -#: ../chirpui/importdialog.py:536 ../chirpui/memedit.py:65 -#: ../chirpui/memedit.py:85 ../chirpui/memedit.py:247 -#: ../chirpui/memedit.py:872 ../chirpui/memedit.py:926 -#: ../chirpui/memedit.py:1063 ../chirpui/memedit.py:1065 -msgid "Name" -msgstr "Nom" - -#: ../chirpui/bankedit.py:185 -msgid "Updating bank index for memory {num}" -msgstr "Mise a jour de l'index de banque pour la memoire {num}" - -#: ../chirpui/bankedit.py:194 -msgid "Updating bank information for memory {num}" -msgstr "Mise a jour des informations de banque pour la memoire {num}" - -#: ../chirpui/bankedit.py:200 ../chirpui/bankedit.py:229 -msgid "Getting memory {num}" -msgstr "Lecture memoire {num}" - -#: ../chirpui/bankedit.py:214 -msgid "Setting index for memory {num}" -msgstr "Assigner son numero a la memoire {num}" - -#: ../chirpui/bankedit.py:223 -msgid "Getting bank for memory {num}" -msgstr "Lecture de la banque pour la memoire {num}" - -#: ../chirpui/bankedit.py:238 ../chirpui/memedit.py:63 -#: ../chirpui/memedit.py:172 ../chirpui/memedit.py:246 -#: ../chirpui/memedit.py:315 ../chirpui/memedit.py:335 -#: ../chirpui/memedit.py:349 ../chirpui/memedit.py:423 -#: ../chirpui/memedit.py:435 ../chirpui/memedit.py:459 -#: ../chirpui/memedit.py:461 ../chirpui/memedit.py:534 -#: ../chirpui/memedit.py:548 ../chirpui/memedit.py:550 -#: ../chirpui/memedit.py:591 ../chirpui/memedit.py:593 -#: ../chirpui/memedit.py:621 ../chirpui/memedit.py:822 -#: ../chirpui/memedit.py:870 ../chirpui/memedit.py:895 -#: ../chirpui/memedit.py:907 ../chirpui/memedit.py:924 -#: ../chirpui/memedit.py:1230 -msgid "Loc" -msgstr "Mem" - -#: ../chirpui/bankedit.py:239 ../chirpui/importdialog.py:537 -#: ../chirpui/memedit.py:64 ../chirpui/memedit.py:86 ../chirpui/memedit.py:187 -#: ../chirpui/memedit.py:248 ../chirpui/memedit.py:271 -#: ../chirpui/memedit.py:296 ../chirpui/memedit.py:304 -#: ../chirpui/memedit.py:873 ../chirpui/memedit.py:923 -msgid "Frequency" -msgstr "Frequence" - -#: ../chirpui/bankedit.py:241 -msgid "Index" -msgstr "Index" - -#: ../chirpui/bankedit.py:302 -msgid "Getting bank information for memory {num}" -msgstr "Lecture de l'information de banque pour la memoire {num}" - -#: ../chirpui/bankedit.py:323 -msgid "Getting bank information" -msgstr "Lecture information de banque" - -#: ../chirpui/inputdialog.py:81 -msgid "An error has occurred" -msgstr "Une erreur s'est produite" - -#: ../chirpui/inputdialog.py:130 -msgid "Overwrite" -msgstr "Ecraser" - -#: ../chirpui/inputdialog.py:133 -msgid "File Exists" -msgstr "Le fichier existe" - -#: ../chirpui/inputdialog.py:136 -msgid "The file {name} already exists. Do you want to overwrite it?" -msgstr "Le fichier {name} existe deja. Voulez-vous l'ecraser ?" - -#: ../chirpui/importdialog.py:90 -msgid "" -"Location {number} is already being imported. Choose another value for 'New " -"Location' before selection 'Import'" -msgstr "" -"L'emplacement {number} a deja ete importe. Choisissez une autre valeur pour " -"'nouvel emplacement' avant d'utiliser 'Importer'" - -#: ../chirpui/importdialog.py:121 -msgid "Invalid value. Must be an integer." -msgstr "Valeur invalide. Doit etre un entier." - -#: ../chirpui/importdialog.py:130 -msgid "Location {number} is already being imported" -msgstr "L'emplacement {number} a deja ete importe" - -#: ../chirpui/importdialog.py:182 -msgid "Updating URCALL list" -msgstr "Mise a jour de la liste URCALL" - -#: ../chirpui/importdialog.py:187 -msgid "Updating RPTCALL list" -msgstr "Mise a jour de la liste RPTCALL" - -#: ../chirpui/importdialog.py:256 -msgid "Setting memory {number}" -msgstr "Regler la memoire {number}" - -#: ../chirpui/importdialog.py:260 -msgid "Importing bank information" -msgstr "Importation de l'information de banque" - -#: ../chirpui/importdialog.py:264 -msgid "Error importing memories:" -msgstr "Erreur lors de l'importation des memoires :" - -#: ../chirpui/importdialog.py:376 -msgid "All" -msgstr "Tout" - -#: ../chirpui/importdialog.py:382 -msgid "None" -msgstr "Aucun" - -#: ../chirpui/importdialog.py:388 -msgid "Inverse" -msgstr "Inverse" - -#: ../chirpui/importdialog.py:394 -msgid "Select" -msgstr "Selectionner" - -#: ../chirpui/importdialog.py:416 -msgid "Auto" -msgstr "Auto" - -#: ../chirpui/importdialog.py:422 -msgid "Reverse" -msgstr "Reverse" - -#: ../chirpui/importdialog.py:428 -msgid "Adjust New Location" -msgstr "Ajuster nouvel emplacement" - -#: ../chirpui/importdialog.py:438 -msgid "Confirm overwrites" -msgstr "Confirmer l'ecrasement" - -#: ../chirpui/importdialog.py:444 -msgid "Options" -msgstr "Options" - -#: ../chirpui/importdialog.py:495 -msgid "Cannot be imported because" -msgstr "Ne peut pas etre importe car" - -#: ../chirpui/importdialog.py:513 -msgid "Import From File" -msgstr "Importer depuis un fichier" - -#: ../chirpui/importdialog.py:514 ../chirpui/mainapp.py:1196 -msgid "Import" -msgstr "Importer" - -#: ../chirpui/importdialog.py:534 -msgid "To" -msgstr "Vers" - -#: ../chirpui/importdialog.py:535 -msgid "From" -msgstr "De" - -#: ../chirpui/importdialog.py:538 ../chirpui/memedit.py:78 -#: ../chirpui/memedit.py:99 ../chirpui/memedit.py:886 -#: ../chirpui/memedit.py:940 ../chirpui/memedit.py:1068 -msgid "Comment" -msgstr "Commentaire" - -#: ../chirpui/importdialog.py:542 -msgid "Location memory will be imported into" -msgstr "L'emplacement memoire sera importe dans" - -#: ../chirpui/importdialog.py:543 -msgid "Location of memory in the file being imported" -msgstr "Emplacement memoire du fichier importe" - -#: ../chirpui/importdialog.py:566 -msgid "Preparing memory list..." -msgstr "Preparation de la liste des memoires..." - -#: ../chirpui/importdialog.py:575 -msgid "Export To File" -msgstr "Exporter vers un fichier" - -#: ../chirpui/importdialog.py:576 ../chirpui/mainapp.py:1197 -msgid "Export" -msgstr "Exporter" - -#: ../chirpui/mainapp.py:269 ../chirpui/mainapp.py:483 -msgid "Untitled" -msgstr "Sans titre" - -#: ../chirpui/mainapp.py:316 ../chirpui/mainapp.py:715 -msgid "CHIRP Radio Images" -msgstr "Images de radio CHIRP" - -#: ../chirpui/mainapp.py:317 ../chirpui/mainapp.py:714 -#: ../chirpui/mainapp.py:880 -msgid "CHIRP Files" -msgstr "Fichiers CHIRP" - -#: ../chirpui/mainapp.py:318 ../chirpui/mainapp.py:716 -#: ../chirpui/mainapp.py:879 -msgid "CSV Files" -msgstr "Fichiers CSV" - -#: ../chirpui/mainapp.py:319 ../chirpui/mainapp.py:717 -msgid "ICF Files" -msgstr "Fichiers ICF" - -#: ../chirpui/mainapp.py:320 ../chirpui/mainapp.py:718 -msgid "VX7 Commander Files" -msgstr "Fichiers VX7 Commander" - -#: ../chirpui/mainapp.py:330 -msgid "" -"ICF files cannot be edited, only displayed or imported into another file. " -"Open in read-only mode?" -msgstr "" -"Les fichiers ICF ne peuvent pas etre edites, uniquement affiches ou importes " -"dans un autre fichier. Ouvrir en lecture seule ?" - -#: ../chirpui/mainapp.py:373 -msgid "There was an error opening {fname}: {error}" -msgstr "Une erreur s'est produite a l'ouverture de {fname} : {error}" - -#: ../chirpui/mainapp.py:388 -msgid "{num} errors during open:" -msgstr "{num} erreurs durant l'ouverture :" - -#: ../chirpui/mainapp.py:394 -msgid "Note:" -msgstr "Note :" - -#: ../chirpui/mainapp.py:395 -msgid "" -"The {vendor} {model} operates in live mode. This means that any " -"changes you make are immediately sent to the radio. Because of this, you " -"cannot perform the Save or Upload operations. If you wish to " -"edit the contents offline, please Export to a CSV file, using the " -"File menu." -msgstr "" -"Le {vendor} {model} fonctionne en live mode. Cela signifie que tous " -"les changements que vous faites sont immediatement envoyes a la radio. Pour " -"cette raison, vous ne pouvez pas utiliser les fonctions Enregistrer " -"ou Telecharger vers la radio. Si vous souhaitez editer le contenu " -"hors connexion, vous pouvez Exporter vers un fichier CSV, en " -"utilisant le menu Fichier." - -#: ../chirpui/mainapp.py:404 -msgid "Don't show this again" -msgstr "Ne plus montrer" - -#: ../chirpui/mainapp.py:448 -msgid "{vendor} {model} image file" -msgstr "Fichier images {vendor} {model}" - -#: ../chirpui/mainapp.py:456 -msgid "VX7 Commander" -msgstr "VX7 Commander" - -#: ../chirpui/mainapp.py:518 -msgid "Open recent file {name}" -msgstr "Ouvrir le fichier recent {name}" - -#: ../chirpui/mainapp.py:579 -msgid "Import stock configuration {name}" -msgstr "Importer la base de donnees {name}" - -#: ../chirpui/mainapp.py:595 -msgid "Open stock configuration {name}" -msgstr "Ouvrir la base de donnees {name}" - -#: ../chirpui/mainapp.py:681 -msgid "Discard Changes?" -msgstr "Annuler les changements ?" - -#: ../chirpui/mainapp.py:686 -msgid "File is modified, save changes before closing?" -msgstr "" -"Le fichier a ete modifie, enregistrer les modifications avant de le fermer ?" - -#: ../chirpui/mainapp.py:923 -msgid "With significant contributions by:" -msgstr "Avec les contributions significatives de :" - -#: ../chirpui/mainapp.py:940 -msgid "Select Columns" -msgstr "Selectionner les colonnes" - -#: ../chirpui/mainapp.py:955 -msgid "Visible columns for {radio}" -msgstr "Colonnes visibles pour {radio}" - -#: ../chirpui/mainapp.py:1012 -msgid "Reporting is disabled" -msgstr "Rapport d'utilisation desactive" - -#: ../chirpui/mainapp.py:1013 -msgid "" -"The reporting feature of CHIRP is designed to help improve quality by " -"allowing the authors to focus on the radio drivers used most often and " -"errors experienced by the users. The reports contain no identifying " -"information and are used only for statistical purposes by the authors. Your " -"privacy is extremely important, but please consider leaving this feature " -"enabled to help make CHIRP better!\n" -"\n" -"Are you sure you want to disable this feature?" -msgstr "" -"La fonction de rapport de CHIRP est concue pour ameliorer " -"l'application en permettant aux auteurs de se concentrer sur les pilotes des " -"radios les plus frequemment utilisees et les errreurs rencontrees par les " -"utilisateurs. Les rapports ne contiennent aucune donnee d'identification et " -"ne sont utilisee qu'a des fins statistiques par les auteurs. Votre vie " -"privee est extremement importante, mais considerez s'il vous plait que " -"laisser cette fonction activee contribuera a rendre CHIRP encore meilleur !\n" -"\n" -"Etes-vous certain de vouloir desactiver cette fonction ?" - -#: ../chirpui/mainapp.py:1045 -msgid "" -"Choose a language or Auto to use the operating system default. You will need " -"to restart the application before the change will take effect" -msgstr "" -"Choisir une langue ou Auto pour utiliser celle du systeme par defaut. Vous " -"devrez redemarrer l'application pour appliquer le changement." - -#: ../chirpui/mainapp.py:1169 -msgid "_File" -msgstr "_Fichier" - -#: ../chirpui/mainapp.py:1172 -msgid "Open stock config" -msgstr "Ouvrir base de donnees" - -#: ../chirpui/mainapp.py:1173 -msgid "_Recent" -msgstr "_Recent" - -#: ../chirpui/mainapp.py:1178 -msgid "_Edit" -msgstr "_Editer" - -#: ../chirpui/mainapp.py:1179 -msgid "_Cut" -msgstr "_Couper" - -#: ../chirpui/mainapp.py:1180 -msgid "_Copy" -msgstr "C_opier" - -#: ../chirpui/mainapp.py:1181 -msgid "_Paste" -msgstr "Co_ller" - -#: ../chirpui/mainapp.py:1182 -msgid "_Delete" -msgstr "_Supprimer" - -#: ../chirpui/mainapp.py:1183 -msgid "Move _Up" -msgstr "_Monter" - -#: ../chirpui/mainapp.py:1184 -msgid "Move Dow_n" -msgstr "Desce_ndre" - -#: ../chirpui/mainapp.py:1185 -msgid "E_xchange" -msgstr "_Permuter" - -#: ../chirpui/mainapp.py:1186 -msgid "_View" -msgstr "_Voir" - -#: ../chirpui/mainapp.py:1187 -msgid "Columns" -msgstr "Colonnes" - -#: ../chirpui/mainapp.py:1188 -msgid "Developer" -msgstr "Developpeur" - -#: ../chirpui/mainapp.py:1189 -msgid "Show raw memory" -msgstr "Montrer les memoires brutes" - -#: ../chirpui/mainapp.py:1190 -msgid "Diff raw memories" -msgstr "Comparaison memoires brutes" - -#: ../chirpui/mainapp.py:1191 -msgid "Diff tabs" -msgstr "Comparaison listes" - -#: ../chirpui/mainapp.py:1192 -msgid "Change language" -msgstr "Changer la langue" - -#: ../chirpui/mainapp.py:1193 -msgid "_Radio" -msgstr "_Radio" - -#: ../chirpui/mainapp.py:1194 -msgid "Download From Radio" -msgstr "Telecharger depuis la radio - Lire" - -#: ../chirpui/mainapp.py:1195 -msgid "Upload To Radio" -msgstr "Telecharger vers la radio - Ecrire" - -#: ../chirpui/mainapp.py:1198 -msgid "Import from RFinder" -msgstr "Importer de RFinder" - -#: ../chirpui/mainapp.py:1199 -msgid "CHIRP Native File" -msgstr "Fichier CHIRP natif" - -#: ../chirpui/mainapp.py:1200 -msgid "CSV File" -msgstr "Fichier CSV" - -#: ../chirpui/mainapp.py:1201 -msgid "Import from RepeaterBook" -msgstr "Importer de RepeaterBook" - -#: ../chirpui/mainapp.py:1202 -msgid "Import from stock config" -msgstr "Importer de la base de donnees" - -#: ../chirpui/mainapp.py:1204 -msgid "Help" -msgstr "Aide" - -#: ../chirpui/mainapp.py:1215 -msgid "Report statistics" -msgstr "Rapporter statistiques" - -#: ../chirpui/mainapp.py:1216 -msgid "Hide Unused Fields" -msgstr "Cacher les champs inutilises" - -#: ../chirpui/mainapp.py:1217 -msgid "Automatic Repeater Offset" -msgstr "Decalage automatique de relais ARS" - -#: ../chirpui/mainapp.py:1218 -msgid "Enable Developer Functions" -msgstr "Activer les fonctions de developpement" - -#: ../chirpui/mainapp.py:1352 -msgid "Error reporting is enabled" -msgstr "Le rapport d'erreur est active" - -#: ../chirpui/mainapp.py:1355 -msgid "" -"If you wish to disable this feature you may do so in the Help menu" -msgstr "Pour desactiver cette fonction, utilisez le menu Aide." - -#: ../chirpui/cloneprog.py:43 -msgid "Clone Progress" -msgstr "Clonage en cours" - -#: ../chirpui/cloneprog.py:46 -msgid "Cloning" -msgstr "Clonage" - -#: ../chirpui/cloneprog.py:55 -msgid "Cancel" -msgstr "Annuler" - -#: ../chirpui/shiftdialog.py:27 -msgid "Shift" -msgstr "Decalage" - -#: ../chirpui/shiftdialog.py:63 -msgid "Moving {src} to {dst}" -msgstr "Deplacer {src} vers {dst}" - -#: ../chirpui/shiftdialog.py:80 -msgid "Looking for a free spot ({number})" -msgstr "Recherche d'un emplacement libre ({number})" - -#: ../chirpui/shiftdialog.py:135 -msgid "Moved {count} memories" -msgstr "{count} memoires deplacees" - -#: ../chirpui/clone.py:35 -msgid "{vendor} {model} on {port}" -msgstr "{vendor} {model} sur {port}" - -#: ../chirpui/clone.py:100 ../chirpui/clone.py:162 -msgid "Detect" -msgstr "Detecter" - -#: ../chirpui/clone.py:123 -msgid "Port" -msgstr "Port" - -#: ../chirpui/clone.py:124 -msgid "Vendor" -msgstr "Fabricant" - -#: ../chirpui/clone.py:125 -msgid "Model" -msgstr "Modele" - -#: ../chirpui/clone.py:138 -msgid "Radio" -msgstr "Radio" - -#: ../chirpui/clone.py:166 -msgid "Unable to detect radio on {port}" -msgstr "Impossible de detecter la radio sur {port}" - -#: ../chirpui/clone.py:178 -msgid "Internal error: Unable to upload to {model}" -msgstr "Erreur interne : impossible de telecharger vers {model}" - -#: ../chirpui/clone.py:226 -msgid "Clone failed: {error}" -msgstr "Erreur de clonage: {error}" - -#: ../chirpui/dstaredit.py:40 -msgid "Callsign" -msgstr "Indicatif" - -#: ../chirpui/dstaredit.py:124 -msgid "Your callsign" -msgstr "Votre indicatif" - -#: ../chirpui/dstaredit.py:132 -msgid "Repeater callsign" -msgstr "Indicatif du relais" - -#: ../chirpui/dstaredit.py:140 -msgid "My callsign" -msgstr "Mon indicatif" - -#: ../chirpui/dstaredit.py:170 ../chirpui/memedit.py:1365 -msgid "Downloading URCALL list" -msgstr "Telechargement de la liste URCALL" - -#: ../chirpui/dstaredit.py:174 ../chirpui/memedit.py:1377 -msgid "Downloading RPTCALL list" -msgstr "Telechargement de la liste RPTCALL" - -#: ../chirpui/dstaredit.py:178 -msgid "Downloading MYCALL list" -msgstr "Telechargement de la liste MYCALL" - -#: ../chirpui/editorset.py:87 -msgid "Memories" -msgstr "Memoires" - -#: ../chirpui/editorset.py:92 -msgid "D-STAR" -msgstr "D-STAR" - -#: ../chirpui/editorset.py:98 -msgid "Bank Names" -msgstr "Nom des banques" - -#: ../chirpui/editorset.py:104 -msgid "Banks" -msgstr "Banques" - -#: ../chirpui/editorset.py:222 -msgid "The {vendor} {model} has multiple independent sub-devices" -msgstr "Le {vendor} {model} a des sous-series multiples et independantes" - -#: ../chirpui/editorset.py:225 -msgid "Choose one to import from:" -msgstr "Selectionner importation depuis : " - -#: ../chirpui/editorset.py:230 -msgid "Cancelled" -msgstr "Annule" - -#: ../chirpui/editorset.py:235 -msgid "Internal Error" -msgstr "Erreur interne" - -#: ../chirpui/editorset.py:248 -msgid "" -"There were errors while opening {file}. The affected memories will not be " -"importable!" -msgstr "" -"Erreurs a l'ouverture de {file}. Les memoires ne peuvent pas etre " -"importees ! " - -#: ../chirpui/editorset.py:260 -msgid "There was an error during import: {error}" -msgstr "Une erreur s'est produite durant l'importation : {error}" - -#: ../chirpui/editorset.py:270 -msgid "Unsupported file type" -msgstr "Type de fichier non-supporte" - -#: ../chirpui/editorset.py:286 ../chirpui/editorset.py:301 -msgid "There was an error during export: {error}" -msgstr "Une erreur s'est produite durant l'exportation : {error}" - -#: ../chirpui/editorset.py:313 -msgid "Priming memory" -msgstr "Memoire d'amorcage" - -#: ../chirpui/memedit.py:52 -msgid "Invalid value for this field" -msgstr "Valeur invalide pour ce champ" - -#: ../chirpui/memedit.py:66 ../chirpui/memedit.py:97 ../chirpui/memedit.py:111 -#: ../chirpui/memedit.py:204 ../chirpui/memedit.py:312 -#: ../chirpui/memedit.py:874 ../chirpui/memedit.py:931 -#: ../chirpui/memedit.py:1069 ../chirpui/memedit.py:1133 -msgid "Tone Mode" -msgstr "Tone Mode" - -#: ../chirpui/memedit.py:67 ../chirpui/memedit.py:87 ../chirpui/memedit.py:103 -#: ../chirpui/memedit.py:214 ../chirpui/memedit.py:218 -#: ../chirpui/memedit.py:220 ../chirpui/memedit.py:310 -#: ../chirpui/memedit.py:875 ../chirpui/memedit.py:928 -#: ../chirpui/memedit.py:1070 -msgid "Tone" -msgstr "Tone" - -#: ../chirpui/memedit.py:68 ../chirpui/memedit.py:88 ../chirpui/memedit.py:104 -#: ../chirpui/memedit.py:210 ../chirpui/memedit.py:218 -#: ../chirpui/memedit.py:221 ../chirpui/memedit.py:310 -#: ../chirpui/memedit.py:876 ../chirpui/memedit.py:929 -#: ../chirpui/memedit.py:1066 -msgid "ToneSql" -msgstr "ToneSql" - -#: ../chirpui/memedit.py:69 ../chirpui/memedit.py:89 ../chirpui/memedit.py:105 -#: ../chirpui/memedit.py:211 ../chirpui/memedit.py:215 -#: ../chirpui/memedit.py:222 ../chirpui/memedit.py:306 -#: ../chirpui/memedit.py:877 ../chirpui/memedit.py:930 -#: ../chirpui/memedit.py:1059 -msgid "DTCS Code" -msgstr "Code DTCS" - -#: ../chirpui/memedit.py:70 ../chirpui/memedit.py:90 ../chirpui/memedit.py:106 -#: ../chirpui/memedit.py:212 ../chirpui/memedit.py:216 -#: ../chirpui/memedit.py:223 ../chirpui/memedit.py:878 -#: ../chirpui/memedit.py:933 ../chirpui/memedit.py:1060 -msgid "DTCS Pol" -msgstr "DTCS Pol" - -#: ../chirpui/memedit.py:71 ../chirpui/memedit.py:91 ../chirpui/memedit.py:112 -#: ../chirpui/memedit.py:879 ../chirpui/memedit.py:932 -#: ../chirpui/memedit.py:1067 ../chirpui/memedit.py:1134 -msgid "Cross Mode" -msgstr "Cross mode" - -#: ../chirpui/memedit.py:72 ../chirpui/memedit.py:92 ../chirpui/memedit.py:109 -#: ../chirpui/memedit.py:137 ../chirpui/memedit.py:205 -#: ../chirpui/memedit.py:249 ../chirpui/memedit.py:312 -#: ../chirpui/memedit.py:880 ../chirpui/memedit.py:934 -#: ../chirpui/memedit.py:1071 ../chirpui/memedit.py:1144 -msgid "Duplex" -msgstr "Duplex" - -#: ../chirpui/memedit.py:73 ../chirpui/memedit.py:93 ../chirpui/memedit.py:135 -#: ../chirpui/memedit.py:198 ../chirpui/memedit.py:226 -#: ../chirpui/memedit.py:250 ../chirpui/memedit.py:308 -#: ../chirpui/memedit.py:881 ../chirpui/memedit.py:935 -#: ../chirpui/memedit.py:1062 -msgid "Offset" -msgstr "Decalage" - -#: ../chirpui/memedit.py:74 ../chirpui/memedit.py:94 ../chirpui/memedit.py:107 -#: ../chirpui/memedit.py:882 ../chirpui/memedit.py:936 -#: ../chirpui/memedit.py:1061 ../chirpui/memedit.py:1132 -#: ../chirpui/memedit.py:1289 ../chirpui/memedit.py:1307 -#: ../chirpui/memedit.py:1317 -msgid "Mode" -msgstr "Mode" - -#: ../chirpui/memedit.py:75 ../chirpui/memedit.py:95 ../chirpui/memedit.py:108 -#: ../chirpui/memedit.py:296 ../chirpui/memedit.py:883 -#: ../chirpui/memedit.py:937 ../chirpui/memedit.py:1073 -#: ../chirpui/memedit.py:1136 ../chirpui/memedit.py:1140 -msgid "Power" -msgstr "Puissance" - -#: ../chirpui/memedit.py:76 ../chirpui/memedit.py:96 ../chirpui/memedit.py:110 -#: ../chirpui/memedit.py:140 ../chirpui/memedit.py:143 -#: ../chirpui/memedit.py:884 ../chirpui/memedit.py:938 -#: ../chirpui/memedit.py:1064 -msgid "Tune Step" -msgstr "Pas" - -#: ../chirpui/memedit.py:77 ../chirpui/memedit.py:98 ../chirpui/memedit.py:885 -#: ../chirpui/memedit.py:939 ../chirpui/memedit.py:1072 -#: ../chirpui/memedit.py:1135 -msgid "Skip" -msgstr "Ignorer" - -#: ../chirpui/memedit.py:175 -msgid "Erasing memory {loc}" -msgstr "Effacer la memoire {loc}" - -#: ../chirpui/memedit.py:236 -msgid "Unable to make changes to this model" -msgstr "Impossible de realiser des changements pour ce modele" - -#: ../chirpui/memedit.py:241 -msgid "Editing new item, taking defaults" -msgstr "Modification nouvel element, valeurs par defaut" - -#: ../chirpui/memedit.py:257 -msgid "Bad value for {col}: {val}" -msgstr "Valeur invalide pour {col} : {val}" - -#: ../chirpui/memedit.py:281 -msgid "Error setting memory" -msgstr "Erreur ecriture memoire" - -#: ../chirpui/memedit.py:289 ../chirpui/memedit.py:356 -#: ../chirpui/memedit.py:1272 -msgid "Writing memory {number}" -msgstr "Ecrire la memoire {number}" - -#: ../chirpui/memedit.py:361 -msgid "" -"This operation requires moving all subsequent channels by one spot until an " -"empty location is reached. This can take a LONG time. Are you sure you " -"want to do this?" -msgstr "" -"Cette operation necessite le deplacement de tous les canaux suivants jusqu'a " -"ce qu'un emplacement libre soit trouve. Cela peut prendre BEAUCOUP de temps. " -"Etes-vous certain de vouloir le faire ?" - -#: ../chirpui/memedit.py:387 -msgid "Adding memory {number}" -msgstr "Ajouter la memoire {number}" - -#: ../chirpui/memedit.py:400 ../chirpui/memedit.py:913 -msgid "Erasing memory {number}" -msgstr "Effacer la memoire {number}" - -#: ../chirpui/memedit.py:409 ../chirpui/memedit.py:518 -#: ../chirpui/memedit.py:564 ../chirpui/memedit.py:569 -#: ../chirpui/memedit.py:856 ../chirpui/memedit.py:1166 -msgid "Getting memory {number}" -msgstr "Lecture memoire {number}" - -#: ../chirpui/memedit.py:497 ../chirpui/memedit.py:508 -#: ../chirpui/memedit.py:556 -msgid "Moving memory from {old} to {new}" -msgstr "Deplacer la memoire de {old} vers {new}" - -#: ../chirpui/memedit.py:578 -msgid "Raw memory {number}" -msgstr "Memoire brute {number}" - -#: ../chirpui/memedit.py:582 ../chirpui/memedit.py:610 -#: ../chirpui/memedit.py:615 -msgid "Getting raw memory {number}" -msgstr "Lecture memoire brute {number}" - -#: ../chirpui/memedit.py:587 -msgid "You can only diff two memories!" -msgstr "Vous ne pouvez comparer que deux memoires !" - -#: ../chirpui/memedit.py:598 -msgid "Memory {number}" -msgstr "Memoire {number}" - -#: ../chirpui/memedit.py:604 -msgid "Diff of {a} and {b}" -msgstr "Comparaison entre {a} et {b}" - -#: ../chirpui/memedit.py:628 -msgid "Memories must be contiguous" -msgstr "Les memoires doivent etre contigues" - -#: ../chirpui/memedit.py:700 -msgid "Insert row above" -msgstr "Inserer une ligne avant" - -#: ../chirpui/memedit.py:701 -msgid "Insert row below" -msgstr "Inserer une ligne apres" - -#: ../chirpui/memedit.py:702 -msgid "Delete" -msgstr "Supprimer" - -#: ../chirpui/memedit.py:702 -msgid "Delete all" -msgstr "Tout supprimer" - -#: ../chirpui/memedit.py:703 -msgid "Delete (and shift up)" -msgstr "Supprimer (et remonter)" - -#: ../chirpui/memedit.py:704 -msgid "Move up" -msgstr "Remonter" - -#: ../chirpui/memedit.py:705 -msgid "Move down" -msgstr "Descendre" - -#: ../chirpui/memedit.py:706 -msgid "Exchange memories" -msgstr "Permuter les memoires" - -#: ../chirpui/memedit.py:707 -msgid "Cut" -msgstr "Couper" - -#: ../chirpui/memedit.py:708 -msgid "Copy" -msgstr "Copier" - -#: ../chirpui/memedit.py:709 -msgid "Paste" -msgstr "Coller" - -#: ../chirpui/memedit.py:710 -msgid "Show Raw Memory" -msgstr "Afficher les donnees de memoires brutes" - -#: ../chirpui/memedit.py:711 -msgid "Diff Raw Memories" -msgstr "Comparaison memoires brutes" - -#: ../chirpui/memedit.py:835 -msgid "Internal Error: Column {name} not found" -msgstr "Erreur interne : colonne {name} non trouvee" - -#: ../chirpui/memedit.py:863 -msgid "Getting channel {chan}" -msgstr "Lecture canal {chan}" - -#: ../chirpui/memedit.py:952 -msgid "Internal Error: Invalid limit {number}" -msgstr "Erreur interne : {number} limite invalide" - -#: ../chirpui/memedit.py:962 -msgid "Memory range:" -msgstr "Etendue memoire :" - -#: ../chirpui/memedit.py:989 -msgid "Go" -msgstr "Aller" - -#: ../chirpui/memedit.py:1012 -msgid "Special Channels" -msgstr "Canaux speciaux" - -#: ../chirpui/memedit.py:1019 -msgid "Show Empty" -msgstr "Montrer vides" - -#: ../chirpui/memedit.py:1198 -msgid "Cutting memory {number}" -msgstr "Couper la memoire {number}" - -#: ../chirpui/memedit.py:1232 -msgid "Overwrite?" -msgstr "Ecraser ?" - -#: ../chirpui/memedit.py:1237 -msgid "Overwrite location {number}?" -msgstr "Ecraser l'emplacement {number} ?" - -#: ../chirpui/memedit.py:1254 -msgid "Incompatible Memory" -msgstr "Memoire incompatible" - -#: ../chirpui/memedit.py:1257 -msgid "Pasted memory {number} is not compatible with this radio because:" -msgstr "La memoire collee {number} n'est pas compatible avec cette radio car :" - -#: ../chirpui/memedit.py:1309 ../chirpui/memedit.py:1324 -msgid "URCALL" -msgstr "URCALL" - -#: ../chirpui/memedit.py:1309 ../chirpui/memedit.py:1325 -msgid "RPT1CALL" -msgstr "RPT1CALL" - -#: ../chirpui/memedit.py:1309 ../chirpui/memedit.py:1326 -msgid "RPT2CALL" -msgstr "RPT2CALL" - -#: ../chirpui/memedit.py:1310 ../chirpui/memedit.py:1327 -msgid "Digital Code" -msgstr "Digital code" diff --git a/locale/hu.po b/locale/hu.po deleted file mode 100644 index 20f9a9b..0000000 --- a/locale/hu.po +++ /dev/null @@ -1,1216 +0,0 @@ -# English translations for CHIRP package. -# Copyright (C) 2011 Dan Smith -# This file is distributed under the same license as the CHIRP package. -# Dan Smith , 2011. -# -msgid "" -msgstr "" -"Project-Id-Version: CHIRP\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2014-10-08 11:40-0700\n" -"PO-Revision-Date: 2015-01-28 13:47+0100\n" -"Last-Translator: Attila Joubert \n" -"Language-Team: English\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" -"X-Generator: Poedit 1.7.4\n" -"Language: hu_HU\n" - -#: ../chirpui/bandplans.py:92 -msgid "" -"Band plans define default channel settings for frequencies in a region. " -"Choose a band plan or None for completely manual channel settings." -msgstr "" -"Egy régió sávtervének alapértelmezett csatorna frekvenciái. Válassz egy " -"sávtervet, vagy ki is hagyhatod a kézi csatorna beállítás befejezéséhez." - -#: ../chirpui/bankedit.py:53 -#, python-format -msgid "Retrieving %s information" -msgstr "%s információk lekérése" - -#: ../chirpui/bankedit.py:76 -#, python-format -msgid "Setting name on %s" -msgstr "A %s név beállítása" - -#: ../chirpui/bankedit.py:88 ../chirpui/bankedit.py:276 -#: ../chirpui/importdialog.py:594 ../chirpui/memdetail.py:257 -#: ../chirpui/memedit.py:66 ../chirpui/memedit.py:87 ../chirpui/memedit.py:338 -#: ../chirpui/memedit.py:1053 ../chirpui/memedit.py:1109 -#: ../chirpui/memedit.py:1245 ../chirpui/memedit.py:1247 -msgid "Name" -msgstr "Név" - -#: ../chirpui/bankedit.py:215 -msgid "Updating {type} index for memory {num}" -msgstr "A {num}. memória {type} index frissítése" - -#: ../chirpui/bankedit.py:225 -msgid "Updating mapping information for memory {num}" -msgstr "A {num}. memória információjának frissítése" - -#: ../chirpui/bankedit.py:231 ../chirpui/bankedit.py:262 -msgid "Getting memory {num}" -msgstr "A {num}. memória beolvasása" - -#: ../chirpui/bankedit.py:246 -msgid "Setting index for memory {num}" -msgstr "A {num}. memória sorszámának beállítása" - -#: ../chirpui/bankedit.py:255 -msgid "Getting {type} for memory {num}" -msgstr "A {num}. memória {type} beolvasása" - -#: ../chirpui/bankedit.py:274 ../chirpui/memedit.py:64 -#: ../chirpui/memedit.py:194 ../chirpui/memedit.py:337 -#: ../chirpui/memedit.py:412 ../chirpui/memedit.py:432 -#: ../chirpui/memedit.py:446 ../chirpui/memedit.py:469 -#: ../chirpui/memedit.py:517 ../chirpui/memedit.py:529 -#: ../chirpui/memedit.py:553 ../chirpui/memedit.py:555 -#: ../chirpui/memedit.py:628 ../chirpui/memedit.py:642 -#: ../chirpui/memedit.py:644 ../chirpui/memedit.py:685 -#: ../chirpui/memedit.py:687 ../chirpui/memedit.py:760 -#: ../chirpui/memedit.py:889 ../chirpui/memedit.py:1002 -#: ../chirpui/memedit.py:1051 ../chirpui/memedit.py:1077 -#: ../chirpui/memedit.py:1090 ../chirpui/memedit.py:1107 -#: ../chirpui/memedit.py:1421 -msgid "Loc" -msgstr "Hely" - -#: ../chirpui/bankedit.py:275 ../chirpui/importdialog.py:595 -#: ../chirpui/memdetail.py:256 ../chirpui/memedit.py:65 -#: ../chirpui/memedit.py:88 ../chirpui/memedit.py:209 -#: ../chirpui/memedit.py:331 ../chirpui/memedit.py:339 -#: ../chirpui/memedit.py:368 ../chirpui/memedit.py:393 -#: ../chirpui/memedit.py:401 ../chirpui/memedit.py:1054 -#: ../chirpui/memedit.py:1106 -msgid "Frequency" -msgstr "Frekvencia" - -#: ../chirpui/bankedit.py:277 -msgid "Index" -msgstr "Sorszám" - -#: ../chirpui/bankedit.py:370 -msgid "Getting {type} information for memory {num}" -msgstr "A {num}. memória {type} adatainak beolvasása" - -#: ../chirpui/bankedit.py:392 -#, python-format -msgid "Getting %s information" -msgstr "%s információk beolvasása" - -#: ../chirpui/clone.py:35 -msgid "{vendor} {model} on {port}" -msgstr "{vendor} {model} a {port} porton" - -#: ../chirpui/clone.py:105 ../chirpui/clone.py:106 ../chirpui/clone.py:168 -msgid "Detect" -msgstr "Érzékelés" - -#: ../chirpui/clone.py:129 -msgid "Port" -msgstr "Port" - -#: ../chirpui/clone.py:130 -msgid "Vendor" -msgstr "Gyártó" - -#: ../chirpui/clone.py:131 -msgid "Model" -msgstr "Modell" - -#: ../chirpui/clone.py:144 -msgid "Radio" -msgstr "Rádió" - -#: ../chirpui/clone.py:172 -msgid "Unable to detect radio on {port}" -msgstr "Nem érzékelek a {port} porton!" - -#: ../chirpui/clone.py:184 -msgid "Internal error: Unable to upload to {model}" -msgstr "Belső hiba: nem tölthető fel a {model} rádióra." - -#: ../chirpui/clone.py:232 -msgid "Clone failed: {error}" -msgstr "A klónozás sikertelen: {error}" - -#: ../chirpui/cloneprog.py:43 -msgid "Clone Progress" -msgstr "Klónozási folyamat" - -#: ../chirpui/cloneprog.py:46 -msgid "Cloning" -msgstr "Klónozás" - -#: ../chirpui/cloneprog.py:55 -msgid "Cancel" -msgstr "Megszakítás" - -#: ../chirpui/common.py:240 -msgid "Completed" -msgstr "Befejeződött" - -#: ../chirpui/common.py:241 -msgid "idle" -msgstr "várakozik" - -#: ../chirpui/common.py:341 -msgid "Details" -msgstr "Részletek" - -#: ../chirpui/common.py:344 -msgid "Proceed?" -msgstr "Folytatod?" - -#: ../chirpui/common.py:353 -msgid "Do not show this next time" -msgstr "Mégegyszer ne mutassa ezt" - -#: ../chirpui/dstaredit.py:40 -msgid "Callsign" -msgstr "Hívójel" - -#: ../chirpui/dstaredit.py:124 -msgid "Your callsign" -msgstr "Az Ön hívójele" - -#: ../chirpui/dstaredit.py:132 -msgid "Repeater callsign" -msgstr "Az átjátszó hívójele" - -#: ../chirpui/dstaredit.py:140 -msgid "My callsign" -msgstr "Az én hívójelem" - -#: ../chirpui/dstaredit.py:170 ../chirpui/memedit.py:1566 -msgid "Downloading URCALL list" -msgstr "Az URCALL lista letöltése" - -#: ../chirpui/dstaredit.py:174 ../chirpui/memedit.py:1578 -msgid "Downloading RPTCALL list" -msgstr "Az RPTCALL lista letöltése" - -#: ../chirpui/dstaredit.py:178 -msgid "Downloading MYCALL list" -msgstr "A MYCALL lista letöltése" - -#: ../chirpui/editorset.py:79 -#, python-format -msgid "Memories (%(variant)s)" -msgstr "Memória (%(variant)s)" - -#: ../chirpui/editorset.py:83 -msgid "Memories" -msgstr "Memória" - -#: ../chirpui/editorset.py:94 -msgid "D-STAR" -msgstr "D-STAR" - -#: ../chirpui/editorset.py:142 -msgid "Settings" -msgstr "Beállítás" - -#: ../chirpui/editorset.py:151 -msgid "Browser" -msgstr "Böngésző" - -#: ../chirpui/editorset.py:262 -msgid "The {vendor} {model} has multiple independent sub-devices" -msgstr "A {vendor} {model} több független altípussal rendelkezik" - -#: ../chirpui/editorset.py:265 -msgid "Choose one to import from:" -msgstr "Válasszon egy importálandót:" - -#: ../chirpui/editorset.py:270 -msgid "Cancelled" -msgstr "Mekszakítva" - -#: ../chirpui/editorset.py:275 -msgid "Internal Error" -msgstr "Belső hiba" - -#: ../chirpui/editorset.py:314 -msgid "" -"There were errors while opening {file}. The affected memories will not be " -"importable!" -msgstr "" -"Hiba történt a {file} fájl megnyitásakor. Az érintett memóriák nem lesznek " -"importálhatók." - -#: ../chirpui/editorset.py:326 -msgid "There was an error during import: {error}" -msgstr "Hiba történt az importáláskor: {error}" - -#: ../chirpui/editorset.py:336 -msgid "Unsupported file type" -msgstr "Nem támogatott fájltípus" - -#: ../chirpui/editorset.py:352 ../chirpui/editorset.py:367 -msgid "There was an error during export: {error}" -msgstr "Hiba a(z) {fname} exportálásakor: {error}" - -#: ../chirpui/editorset.py:381 -msgid "Priming memory" -msgstr "Memória feltöltés" - -#: ../chirpui/importdialog.py:90 -msgid "" -"Location {number} is already being imported. Choose another value for 'New " -"Location' before selection 'Import'" -msgstr "" -"A(z) {number}. hely már importálva van. 'Új hely'-nek válasszon másik " -"értéket, mielőtt az 'importálást' választja!" - -#: ../chirpui/importdialog.py:123 -msgid "Invalid value. Must be an integer." -msgstr "Érvénytelen érték! Egész szám kell legyen." - -#: ../chirpui/importdialog.py:132 -msgid "Location {number} is already being imported" -msgstr "A {number} sorszámú hely már importálva van." - -#: ../chirpui/importdialog.py:192 -msgid "Updating URCALL list" -msgstr "URCALL lista frissítése." - -#: ../chirpui/importdialog.py:197 -msgid "Updating RPTCALL list" -msgstr "RPTCALL lista frissítése" - -#: ../chirpui/importdialog.py:270 -msgid "Setting memory {number}" -msgstr "A {number} memória beállítása" - -#: ../chirpui/importdialog.py:274 -msgid "Importing bank information" -msgstr "Bank információk importálása" - -#: ../chirpui/importdialog.py:278 -msgid "Error importing memories:" -msgstr "Hiba a memória importálásakor:" - -#: ../chirpui/importdialog.py:390 -msgid "All" -msgstr "Mind" - -#: ../chirpui/importdialog.py:396 -msgid "None" -msgstr "Egyik sem" - -#: ../chirpui/importdialog.py:402 -msgid "Inverse" -msgstr "Ellenkező" - -#: ../chirpui/importdialog.py:408 -msgid "Select" -msgstr "Kiválasztás" - -#: ../chirpui/importdialog.py:454 -msgid "Auto" -msgstr "Auto" - -#: ../chirpui/importdialog.py:460 -msgid "Reverse" -msgstr "Fordított" - -#: ../chirpui/importdialog.py:466 -msgid "Adjust New Location" -msgstr "Új hely megadása" - -#: ../chirpui/importdialog.py:476 -msgid "Confirm overwrites" -msgstr "Felülírás jóváhagyása" - -#: ../chirpui/importdialog.py:482 -msgid "Options" -msgstr "Beállítások" - -#: ../chirpui/importdialog.py:553 -msgid "Cannot be imported because" -msgstr "Nem importálható, mert" - -#: ../chirpui/importdialog.py:571 -msgid "Import From File" -msgstr "Importálás fájlból" - -#: ../chirpui/importdialog.py:572 ../chirpui/mainapp.py:1515 -msgid "Import" -msgstr "Importálás" - -#: ../chirpui/importdialog.py:592 -msgid "To" -msgstr "-ig" - -#: ../chirpui/importdialog.py:593 -msgid "From" -msgstr "Forrás" - -#: ../chirpui/importdialog.py:596 ../chirpui/memdetail.py:274 -#: ../chirpui/memedit.py:80 ../chirpui/memedit.py:102 -#: ../chirpui/memedit.py:1068 ../chirpui/memedit.py:1124 -#: ../chirpui/memedit.py:1250 -msgid "Comment" -msgstr "Megjegyzés" - -#: ../chirpui/importdialog.py:600 -msgid "Location memory will be imported into" -msgstr "Memória helye lesz beimportálva" - -#: ../chirpui/importdialog.py:601 -msgid "Location of memory in the file being imported" -msgstr "Memória hely a fájlba importálva" - -#: ../chirpui/importdialog.py:624 -msgid "Preparing memory list..." -msgstr "Memória lista előkészítés..." - -#: ../chirpui/importdialog.py:633 -msgid "Export To File" -msgstr "Export fájlba" - -#: ../chirpui/importdialog.py:634 ../chirpui/mainapp.py:1516 -msgid "Export" -msgstr "Export" - -#: ../chirpui/inputdialog.py:81 -msgid "An error has occurred" -msgstr "Hiba történt" - -#: ../chirpui/inputdialog.py:130 -msgid "Overwrite" -msgstr "Felülírás" - -#: ../chirpui/inputdialog.py:133 -msgid "File Exists" -msgstr "A fájl már létezik" - -#: ../chirpui/inputdialog.py:136 -msgid "The file {name} already exists. Do you want to overwrite it?" -msgstr "A {name} nevű fájl már létezik. Felül akarja írni?" - -#: ../chirpui/mainapp.py:227 ../chirpui/mainapp.py:428 -msgid "Untitled" -msgstr "Névtelen" - -#: ../chirpui/mainapp.py:274 ../chirpui/mainapp.py:734 -msgid "CHIRP Radio Images" -msgstr "CHIRP Radio adatképek" - -#: ../chirpui/mainapp.py:275 ../chirpui/mainapp.py:733 -#: ../chirpui/mainapp.py:1115 -msgid "CHIRP Files" -msgstr "CHIRP fájlok" - -#: ../chirpui/mainapp.py:276 ../chirpui/mainapp.py:735 -#: ../chirpui/mainapp.py:1114 -msgid "CSV Files" -msgstr "CSV fájlok" - -#: ../chirpui/mainapp.py:277 ../chirpui/mainapp.py:736 -msgid "EVE Files (VX5)" -msgstr "EVE fájl (VX5)" - -#: ../chirpui/mainapp.py:278 ../chirpui/mainapp.py:737 -msgid "ICF Files" -msgstr "ICF fájlok" - -#: ../chirpui/mainapp.py:279 ../chirpui/mainapp.py:741 -msgid "VX5 Commander Files" -msgstr "VX5 Commander fájlok" - -#: ../chirpui/mainapp.py:280 ../chirpui/mainapp.py:742 -msgid "VX6 Commander Files" -msgstr "VX6 Commander fájlok" - -#: ../chirpui/mainapp.py:281 ../chirpui/mainapp.py:743 -msgid "VX7 Commander Files" -msgstr "VX7 Commander fájlok" - -#: ../chirpui/mainapp.py:291 -msgid "" -"ICF files cannot be edited, only displayed or imported into another file. " -"Open in read-only mode?" -msgstr "" -"Az ICF fájlok nem szerkeszthetők, csak megnézhetők, vagy másik fájlba " -"importálhatók. Megnyissam olvashatóként?" - -#: ../chirpui/mainapp.py:325 -msgid "There was an error opening {fname}: {error}" -msgstr "A(z) {fname} nevű fájl megnyitásakor fellépő hiba: {error}" - -#: ../chirpui/mainapp.py:337 -msgid "{num} errors during open:" -msgstr "{num} hiba a megnyitás során:" - -#: ../chirpui/mainapp.py:344 -msgid "Note:" -msgstr "Megjegyzés:" - -#: ../chirpui/mainapp.py:345 -msgid "" -"The {vendor} {model} operates in live mode. This means that any " -"changes you make are immediately sent to the radio. Because of this, you " -"cannot perform the Save or Upload operations. If you wish to " -"edit the contents offline, please Export to a CSV file, using the " -"File menu." -msgstr "" -"A {vendor} {model} közvetlen kapcsolatban működik. Ez azt jelenti, " -"hogy minden elvégzett módosítás azonnal a rádióra töltődik. Emiatt Ön nem " -"választhatja a Mentés vagy Feltöltés műveleteket. Ha Ön " -"kapcsolat nélkül akarja a tartalmat szerkeszteni, kérem válassza az CSV-be " -"exportálást a Fájl menüben!" - -#: ../chirpui/mainapp.py:354 -msgid "Don't show this again" -msgstr "Mégegyszer ne mutassa" - -#: ../chirpui/mainapp.py:388 -msgid "{vendor} {model} image file" -msgstr "{vendor} {model} képfájl" - -#: ../chirpui/mainapp.py:396 -msgid "VX7 Commander" -msgstr "VX7 Commander" - -#: ../chirpui/mainapp.py:398 -msgid "VX6 Commander" -msgstr "VX6 Commander" - -#: ../chirpui/mainapp.py:400 -msgid "EVE" -msgstr "EVE" - -#: ../chirpui/mainapp.py:401 -msgid "VX5 Commander" -msgstr "VX5 Commander" - -#: ../chirpui/mainapp.py:467 -msgid "Open recent file {name}" -msgstr "A legutóbbi {name} fájl megnyitása" - -#: ../chirpui/mainapp.py:528 -msgid "Import stock configuration {name}" -msgstr "A(z) {name} konfigurációs készlet beolvasása" - -#: ../chirpui/mainapp.py:544 -msgid "Open stock configuration {name}" -msgstr "A(z) {name} konfigurációs készlet megnyitása" - -#: ../chirpui/mainapp.py:566 -msgid "Proceed with experimental driver?" -msgstr "Folytassam kísérleti driver-rel?" - -#: ../chirpui/mainapp.py:568 -msgid "This radio's driver is experimental. Do you want to proceed?" -msgstr "A rádió driver-e kísérleti. Folytatni akarod?" - -#: ../chirpui/mainapp.py:586 -msgid "{name} Instructions" -msgstr "{name} Utasítások" - -#: ../chirpui/mainapp.py:588 -msgid "{instructions}" -msgstr "{instructions}" - -#: ../chirpui/mainapp.py:591 -msgid "Don't show instructions for any radio again" -msgstr "Mégegyszer ne mutasson utasításokat egy rádióhoz sem" - -#: ../chirpui/mainapp.py:700 -msgid "Save Changes?" -msgstr "Menti a változásokat?" - -#: ../chirpui/mainapp.py:705 -msgid "File is modified, save changes before closing?" -msgstr "A fájl megváltozott! Menti bezárás előtt?" - -#: ../chirpui/mainapp.py:738 -msgid "Kenwood HMK Files" -msgstr "Kenwood HMK fájlok" - -#: ../chirpui/mainapp.py:739 -msgid "Kenwood ITM Files" -msgstr "Kenwood ITM fájlok" - -#: ../chirpui/mainapp.py:740 -msgid "Travel Plus Files" -msgstr "Travel Plus fájlok" - -#: ../chirpui/mainapp.py:805 -msgid "RepeaterBook Query" -msgstr "RepeaterBook lekérdezés" - -#: ../chirpui/mainapp.py:864 -msgid "RepeaterBook query failed" -msgstr "RepeaterBook lekérdezés hiba" - -#: ../chirpui/mainapp.py:934 -#, python-format -msgid "Invalid value for %s" -msgstr "Érvénytelen %s mezőérték" - -#: ../chirpui/mainapp.py:958 -msgid "Query failed" -msgstr "Lekérdezés hiba" - -#: ../chirpui/mainapp.py:1055 -msgid "RadioReference.com Query" -msgstr "RadioReference.com lekérdezés" - -#: ../chirpui/mainapp.py:1158 -msgid "With significant contributions from:" -msgstr "Jelentősen hozzájárultak:" - -#: ../chirpui/mainapp.py:1185 -msgid "CHIRP Documentation" -msgstr "CHIRP dokumentáció" - -#: ../chirpui/mainapp.py:1186 -msgid "" -"Documentation for CHIRP, including FAQs, and help for common problems is " -"available on the CHIRP web site, please go to\n" -"\n" -"http://chirp.danplanet.com/projects/chirp/wiki/Documentation\n" -msgstr "" -"A leggyakoribb problémákhoz, GYIK-et is magába foglaló CHIRP dokumentáció és " -"súgó a CHIRP honlapján érhető el, kérlek látogass oda!\n" -"\n" -"http://chirp.danplanet.com/projects/chirp/wiki/Documentation\n" - -#: ../chirpui/mainapp.py:1202 -msgid "Select Columns" -msgstr "Oszlopok kiválasztása" - -#: ../chirpui/mainapp.py:1217 -msgid "Visible columns for {radio}" -msgstr "A(z) {radio} látható oszlopai" - -#: ../chirpui/mainapp.py:1280 -msgid "Reporting is disabled" -msgstr "Listázás letiltva" - -#: ../chirpui/mainapp.py:1281 -msgid "" -"The reporting feature of CHIRP is designed to help improve quality by " -"allowing the authors to focus on the radio drivers used most often and " -"errors experienced by the users. The reports contain no identifying " -"information and are used only for statistical purposes by the authors. Your " -"privacy is extremely important, but please consider leaving this feature " -"enabled to help make CHIRP better!\n" -"\n" -"Are you sure you want to disable this feature?" -msgstr "" -"A CHIRP jelentéskészítője a minőség növelésére került beépítése " -"lehetővé téve a program fejlesztőinek, hogy a leggyakoribb rádió driver-ekre " -"és a felhasználók által tapasztalt hibákra figyeljenek. A jelentések " -"semmiféle személyes információt nem tartalmaznak és a programozók által, " -"kizárólag statisztikai céllal kerülnek felhasználásra. Az Ön adatainak " -"védelme rendkívül fontos, mi mégis kérjük, engedélyezze a jelentések " -"készítését, hogy a CHIRP egyre jobb legyen!\n" -"\n" -"Biztosan letiltja ezt a lehetőséget?" - -#: ../chirpui/mainapp.py:1315 -msgid "" -"Choose a language or Auto to use the operating system default. You will need " -"to restart the application before the change will take effect" -msgstr "" -"Válasszon egy nyelvet, vagy bízza az automatikus nyelvfelismerést az " -"Operációs rendszerből. Ahhoz, hogy a beállítás érvényre jusson, indítsa újra " -"az CHIRP-et! " - -#: ../chirpui/mainapp.py:1328 -msgid "Python Modules" -msgstr "Python modulok" - -#: ../chirpui/mainapp.py:1487 -msgid "_File" -msgstr "_Fájl" - -#: ../chirpui/mainapp.py:1490 -msgid "Open stock config" -msgstr "A csoportos beállítás megnyitása" - -#: ../chirpui/mainapp.py:1491 -msgid "_Recent" -msgstr "Leg_utóbbi" - -#: ../chirpui/mainapp.py:1494 -msgid "Load Module" -msgstr "Modul betöltése" - -#: ../chirpui/mainapp.py:1497 -msgid "_Edit" -msgstr "Sz_erkesztés" - -#: ../chirpui/mainapp.py:1498 -msgid "_Cut" -msgstr "_Kivágás" - -#: ../chirpui/mainapp.py:1499 -msgid "_Copy" -msgstr "_Másolás" - -#: ../chirpui/mainapp.py:1500 -msgid "_Paste" -msgstr "_Beillesztés" - -#: ../chirpui/mainapp.py:1501 -msgid "_Delete" -msgstr "_Törlés" - -#: ../chirpui/mainapp.py:1502 -msgid "Move _Up" -msgstr "Fe_lfelé" - -#: ../chirpui/mainapp.py:1503 -msgid "Move Dow_n" -msgstr "Lefel_é" - -#: ../chirpui/mainapp.py:1504 -msgid "E_xchange" -msgstr "Cse_re" - -#: ../chirpui/mainapp.py:1505 -msgid "_View" -msgstr "Né_zet" - -#: ../chirpui/mainapp.py:1506 -msgid "Columns" -msgstr "Oszlopok" - -#: ../chirpui/mainapp.py:1507 -msgid "Developer" -msgstr "Fejlesztői" - -#: ../chirpui/mainapp.py:1508 -msgid "Show raw memory" -msgstr "memóriasor mutatása" - -#: ../chirpui/mainapp.py:1509 -msgid "Diff raw memories" -msgstr "Memóriasorok különbsége" - -#: ../chirpui/mainapp.py:1510 -msgid "Diff tabs" -msgstr "Diff tabs" - -#: ../chirpui/mainapp.py:1511 -msgid "Change language" -msgstr "Nyelv választás" - -#: ../chirpui/mainapp.py:1512 -msgid "_Radio" -msgstr "Rá_dió" - -#: ../chirpui/mainapp.py:1513 -msgid "Download From Radio" -msgstr "Letöltés a rádióról" - -#: ../chirpui/mainapp.py:1514 -msgid "Upload To Radio" -msgstr "Feltöltés a rádióra" - -#: ../chirpui/mainapp.py:1517 -msgid "Import from data source" -msgstr "Importálás adatforrásból" - -#: ../chirpui/mainapp.py:1518 ../chirpui/mainapp.py:1523 -msgid "RadioReference.com" -msgstr "RadioReference.com" - -#: ../chirpui/mainapp.py:1519 ../chirpui/mainapp.py:1524 -msgid "RFinder" -msgstr "RFinder" - -#: ../chirpui/mainapp.py:1520 ../chirpui/mainapp.py:1526 -msgid "RepeaterBook" -msgstr "RepeaterBook" - -#: ../chirpui/mainapp.py:1521 ../chirpui/mainapp.py:1525 -msgid "przemienniki.net" -msgstr "przemienniki.net" - -#: ../chirpui/mainapp.py:1522 -msgid "Query data source" -msgstr "Lekérd. adatforrása" - -#: ../chirpui/mainapp.py:1527 -msgid "CHIRP Native File" -msgstr "CHIRP natív fájl" - -#: ../chirpui/mainapp.py:1528 -msgid "CSV File" -msgstr "CSV fájl" - -#: ../chirpui/mainapp.py:1529 -msgid "Import from stock config" -msgstr "Importálás a csoportos beállításokból" - -#: ../chirpui/mainapp.py:1530 -msgid "Channel defaults" -msgstr "Csatorna alapértékek" - -#: ../chirpui/mainapp.py:1532 -msgid "Help" -msgstr "Súgó" - -#: ../chirpui/mainapp.py:1534 -msgid "Documentation" -msgstr "Dokumentáció" - -#: ../chirpui/mainapp.py:1544 -msgid "Report statistics" -msgstr "Statisztikai lista" - -#: ../chirpui/mainapp.py:1545 -msgid "Hide Unused Fields" -msgstr "A nemhasznált mezők elrejtése" - -#: ../chirpui/mainapp.py:1546 -msgid "Smart Tone Modes" -msgstr "Hang (CTCSS) mód" - -#: ../chirpui/mainapp.py:1547 -msgid "Enable Developer Functions" -msgstr "Fejlesztői funkciók engedélyezése" - -#: ../chirpui/mainapp.py:1657 -msgid "A new version of CHIRP is available: " -msgstr "A CHIRP egy új verziója érhető el:" - -#: ../chirpui/mainapp.py:1756 -msgid "Error reporting is enabled" -msgstr "A hibajelentés engedélyezett" - -#: ../chirpui/mainapp.py:1759 -msgid "" -"If you wish to disable this feature you may do so in the Help menu" -msgstr "Ha Ön ezt a lehetőséget le kívánja tiltani, a Súgóban megteheti" - -#: ../chirpui/memdetail.py:239 -msgid "Edit Memory #{num}" -msgstr "A(z) #{num} memória" - -#: ../chirpui/memdetail.py:258 ../chirpui/memedit.py:67 -#: ../chirpui/memedit.py:100 ../chirpui/memedit.py:115 -#: ../chirpui/memedit.py:230 ../chirpui/memedit.py:236 -#: ../chirpui/memedit.py:269 ../chirpui/memedit.py:409 -#: ../chirpui/memedit.py:1055 ../chirpui/memedit.py:1115 -#: ../chirpui/memedit.py:1251 ../chirpui/memedit.py:1311 -msgid "Tone Mode" -msgstr "Hang (CTCSS) mód" - -#: ../chirpui/memdetail.py:259 ../chirpui/memedit.py:68 -#: ../chirpui/memedit.py:89 ../chirpui/memedit.py:106 -#: ../chirpui/memedit.py:165 ../chirpui/memedit.py:166 -#: ../chirpui/memedit.py:254 ../chirpui/memedit.py:284 -#: ../chirpui/memedit.py:291 ../chirpui/memedit.py:296 -#: ../chirpui/memedit.py:304 ../chirpui/memedit.py:342 -#: ../chirpui/memedit.py:407 ../chirpui/memedit.py:1056 -#: ../chirpui/memedit.py:1111 ../chirpui/memedit.py:1252 -msgid "Tone" -msgstr "CTCSS" - -#: ../chirpui/memdetail.py:260 ../chirpui/memedit.py:69 -#: ../chirpui/memedit.py:90 ../chirpui/memedit.py:107 -#: ../chirpui/memedit.py:258 ../chirpui/memedit.py:277 -#: ../chirpui/memedit.py:292 ../chirpui/memedit.py:297 -#: ../chirpui/memedit.py:308 ../chirpui/memedit.py:343 -#: ../chirpui/memedit.py:407 ../chirpui/memedit.py:1057 -#: ../chirpui/memedit.py:1112 ../chirpui/memedit.py:1248 -msgid "ToneSql" -msgstr "ToneSql" - -#: ../chirpui/memdetail.py:261 ../chirpui/memedit.py:70 -#: ../chirpui/memedit.py:91 ../chirpui/memedit.py:108 -#: ../chirpui/memedit.py:242 ../chirpui/memedit.py:278 -#: ../chirpui/memedit.py:286 ../chirpui/memedit.py:298 -#: ../chirpui/memedit.py:306 ../chirpui/memedit.py:344 -#: ../chirpui/memedit.py:403 ../chirpui/memedit.py:1058 -#: ../chirpui/memedit.py:1113 ../chirpui/memedit.py:1240 -#: ../chirpui/memedit.py:1317 -msgid "DTCS Code" -msgstr "DTCS kód" - -#: ../chirpui/memdetail.py:263 ../chirpui/memedit.py:72 -#: ../chirpui/memedit.py:93 ../chirpui/memedit.py:110 -#: ../chirpui/memedit.py:250 ../chirpui/memedit.py:280 -#: ../chirpui/memedit.py:288 ../chirpui/memedit.py:300 -#: ../chirpui/memedit.py:312 ../chirpui/memedit.py:346 -#: ../chirpui/memedit.py:1060 ../chirpui/memedit.py:1117 -#: ../chirpui/memedit.py:1242 ../chirpui/memedit.py:1316 -msgid "DTCS Pol" -msgstr "DTCS pol." - -#: ../chirpui/memdetail.py:264 -msgid "Cross mode" -msgstr "Kereszt-üzem" - -#: ../chirpui/memdetail.py:267 ../chirpui/memedit.py:74 -#: ../chirpui/memedit.py:95 ../chirpui/memedit.py:113 -#: ../chirpui/memedit.py:139 ../chirpui/memedit.py:146 -#: ../chirpui/memedit.py:270 ../chirpui/memedit.py:340 -#: ../chirpui/memedit.py:409 ../chirpui/memedit.py:1062 -#: ../chirpui/memedit.py:1118 ../chirpui/memedit.py:1253 -#: ../chirpui/memedit.py:1323 -msgid "Duplex" -msgstr "Duplex" - -#: ../chirpui/memdetail.py:268 ../chirpui/memedit.py:75 -#: ../chirpui/memedit.py:96 ../chirpui/memedit.py:144 -#: ../chirpui/memedit.py:217 ../chirpui/memedit.py:315 -#: ../chirpui/memedit.py:341 ../chirpui/memedit.py:405 -#: ../chirpui/memedit.py:1063 ../chirpui/memedit.py:1119 -#: ../chirpui/memedit.py:1244 -msgid "Offset" -msgstr "Offszet" - -#: ../chirpui/memdetail.py:269 ../chirpui/memedit.py:76 -#: ../chirpui/memedit.py:97 ../chirpui/memedit.py:111 -#: ../chirpui/memedit.py:158 ../chirpui/memedit.py:159 -#: ../chirpui/memedit.py:162 ../chirpui/memedit.py:393 -#: ../chirpui/memedit.py:1064 ../chirpui/memedit.py:1120 -#: ../chirpui/memedit.py:1243 ../chirpui/memedit.py:1310 -#: ../chirpui/memedit.py:1325 ../chirpui/memedit.py:1326 -#: ../chirpui/memedit.py:1490 ../chirpui/memedit.py:1508 -#: ../chirpui/memedit.py:1518 -msgid "Mode" -msgstr "Mód" - -#: ../chirpui/memdetail.py:270 ../chirpui/memedit.py:78 -#: ../chirpui/memedit.py:99 ../chirpui/memedit.py:114 -#: ../chirpui/memedit.py:149 ../chirpui/memedit.py:150 -#: ../chirpui/memedit.py:155 ../chirpui/memedit.py:1066 -#: ../chirpui/memedit.py:1122 ../chirpui/memedit.py:1246 -msgid "Tune Step" -msgstr "Lépésköz" - -#: ../chirpui/memdetail.py:273 ../chirpui/memedit.py:79 -#: ../chirpui/memedit.py:101 ../chirpui/memedit.py:1067 -#: ../chirpui/memedit.py:1123 ../chirpui/memedit.py:1254 -#: ../chirpui/memedit.py:1313 -msgid "Skip" -msgstr "Ugrás" - -#: ../chirpui/memdetail.py:281 -msgid "RX DTCS Code" -msgstr "RX DTCS kód" - -#: ../chirpui/memdetail.py:287 ../chirpui/memedit.py:77 -#: ../chirpui/memedit.py:98 ../chirpui/memedit.py:112 -#: ../chirpui/memedit.py:393 ../chirpui/memedit.py:1065 -#: ../chirpui/memedit.py:1121 ../chirpui/memedit.py:1255 -#: ../chirpui/memedit.py:1314 ../chirpui/memedit.py:1321 -msgid "Power" -msgstr "Teljesítmény" - -#: ../chirpui/memdetail.py:330 -msgid "Memory validation failed:" -msgstr "Memória érvényesítési hiba:" - -#: ../chirpui/memdetail.py:341 -msgid "Edit Multiple Memories" -msgstr "Több memória szerkesztése" - -#: ../chirpui/memdetail.py:363 -msgid "Check this to change the {name} value" -msgstr "Ennek változtatásához ellenőrizd a {name} értékét" - -#: ../chirpui/memedit.py:53 -msgid "Invalid value for this field" -msgstr "Érvénytelen mezőérték" - -#: ../chirpui/memedit.py:71 ../chirpui/memedit.py:92 ../chirpui/memedit.py:109 -#: ../chirpui/memedit.py:246 ../chirpui/memedit.py:279 -#: ../chirpui/memedit.py:287 ../chirpui/memedit.py:294 -#: ../chirpui/memedit.py:299 ../chirpui/memedit.py:310 -#: ../chirpui/memedit.py:345 ../chirpui/memedit.py:403 -#: ../chirpui/memedit.py:1059 ../chirpui/memedit.py:1114 -#: ../chirpui/memedit.py:1241 ../chirpui/memedit.py:1318 -msgid "DTCS Rx Code" -msgstr "DTCS RX kód" - -#: ../chirpui/memedit.py:73 ../chirpui/memedit.py:94 ../chirpui/memedit.py:116 -#: ../chirpui/memedit.py:231 ../chirpui/memedit.py:240 -#: ../chirpui/memedit.py:262 ../chirpui/memedit.py:271 -#: ../chirpui/memedit.py:281 ../chirpui/memedit.py:289 -#: ../chirpui/memedit.py:293 ../chirpui/memedit.py:301 -#: ../chirpui/memedit.py:347 ../chirpui/memedit.py:1061 -#: ../chirpui/memedit.py:1116 ../chirpui/memedit.py:1249 -#: ../chirpui/memedit.py:1312 -msgid "Cross Mode" -msgstr "Kereszt-üzem" - -#: ../chirpui/memedit.py:197 -msgid "Erasing memory {loc}" -msgstr "A(z) {loc}. memóriahely törlése" - -#: ../chirpui/memedit.py:326 -msgid "Unable to make changes to this model" -msgstr "Ennél a modellnél nem változtatható" - -#: ../chirpui/memedit.py:332 -msgid "Editing new item, taking defaults" -msgstr "Új elem szerkesztése az alapértelmezettek szerint" - -#: ../chirpui/memedit.py:354 -msgid "Bad value for {col}: {val}" -msgstr "Hibás érték {col}: {val}" - -#: ../chirpui/memedit.py:378 -msgid "Error setting memory" -msgstr "Memória beállítási hiba" - -#: ../chirpui/memedit.py:386 ../chirpui/memedit.py:453 -#: ../chirpui/memedit.py:728 ../chirpui/memedit.py:750 -#: ../chirpui/memedit.py:1471 -msgid "Writing memory {number}" -msgstr "A(z) {number}. memória írása" - -#: ../chirpui/memedit.py:458 -msgid "" -"This operation requires moving all subsequent channels by one spot until an " -"empty location is reached. This can take a LONG time. Are you sure you " -"want to do this?" -msgstr "" -"Ez a művelet megköveteli, hogy minden csatorna egyetlen összefüggő, üres " -"területre kerüljön. Ez sokáig eltarthat. Biztos, hogy elkezdjem?" - -#: ../chirpui/memedit.py:481 -msgid "Adding memory {number}" -msgstr "A(z) {number}. memória hozzáadása" - -#: ../chirpui/memedit.py:494 ../chirpui/memedit.py:1096 -msgid "Erasing memory {number}" -msgstr "A(z) {number}. memória törlése" - -#: ../chirpui/memedit.py:503 ../chirpui/memedit.py:612 -#: ../chirpui/memedit.py:658 ../chirpui/memedit.py:663 -#: ../chirpui/memedit.py:1037 ../chirpui/memedit.py:1345 -msgid "Getting memory {number}" -msgstr "A(z) {number}. memória beolvasása" - -#: ../chirpui/memedit.py:591 ../chirpui/memedit.py:602 -#: ../chirpui/memedit.py:650 -msgid "Moving memory from {old} to {new}" -msgstr "Memória átmozgatás {old} -> {new}" - -#: ../chirpui/memedit.py:672 -msgid "Raw memory {number}" -msgstr "{number}. memóriasor" - -#: ../chirpui/memedit.py:676 ../chirpui/memedit.py:704 -#: ../chirpui/memedit.py:709 -msgid "Getting raw memory {number}" -msgstr "A(z) {number}. memóriasor kiolvasása" - -#: ../chirpui/memedit.py:681 -msgid "You can only diff two memories!" -msgstr "Csak két memória hasonlítható össze!" - -#: ../chirpui/memedit.py:692 -msgid "Memory {number}" -msgstr "A(z){number} memória" - -#: ../chirpui/memedit.py:698 -msgid "Diff of {a} and {b}" -msgstr "{a} és {b} összehasonlítása" - -#: ../chirpui/memedit.py:732 -msgid "Getting original memory {number}" -msgstr "A(z) eredeti {number}. memóriasor" - -#: ../chirpui/memedit.py:769 -msgid "Memories must be contiguous" -msgstr "Egybefüggő memóriaterület szükséges" - -#: ../chirpui/memedit.py:856 -msgid "Edit" -msgstr "Sz_erkesztés" - -#: ../chirpui/memedit.py:857 -msgid "Insert row above" -msgstr "Memória beszúrása fölé" - -#: ../chirpui/memedit.py:858 -msgid "Insert row below" -msgstr "Memória beszúrása alá" - -#: ../chirpui/memedit.py:859 -msgid "Delete" -msgstr "Törlés" - -#: ../chirpui/memedit.py:860 -msgid "this memory" -msgstr "ez a memória" - -#: ../chirpui/memedit.py:860 -msgid "these memories" -msgstr "ezek a memóriák" - -#: ../chirpui/memedit.py:861 -msgid "...and shift block up" -msgstr "... és a tömböt felfelé lépteti" - -#: ../chirpui/memedit.py:862 -msgid "...and shift all memories up" -msgstr "...és minden memória felfelé lép" - -#: ../chirpui/memedit.py:863 -msgid "Move up" -msgstr "Mozgatás felfelé" - -#: ../chirpui/memedit.py:864 -msgid "Move down" -msgstr "Mozgatás lefelé" - -#: ../chirpui/memedit.py:865 -msgid "Exchange memories" -msgstr "Memóriák cseréje" - -#: ../chirpui/memedit.py:866 -msgid "Cut" -msgstr "Kivágás" - -#: ../chirpui/memedit.py:867 -msgid "Copy" -msgstr "Másolás" - -#: ../chirpui/memedit.py:868 -msgid "Paste" -msgstr "Beillesztés" - -#: ../chirpui/memedit.py:869 -msgid "Show Raw Memory" -msgstr "Memóriasor mutatása" - -#: ../chirpui/memedit.py:870 -msgid "Diff Raw Memories" -msgstr "Memóriasorok összehasonlítása" - -#: ../chirpui/memedit.py:1015 -msgid "Internal Error: Column {name} not found" -msgstr "Belső hiba: nincs {name} nevű oszlop" - -#: ../chirpui/memedit.py:1044 -msgid "Getting channel {chan}" -msgstr "A(z) {chan}. csatorna kiolvasása" - -#: ../chirpui/memedit.py:1136 -msgid "Internal Error: Invalid limit {number}" -msgstr "Belső hiba: Érvénytelen határ {number}" - -#: ../chirpui/memedit.py:1146 -msgid "Memory range:" -msgstr "Memória tartomány:" - -#: ../chirpui/memedit.py:1173 -msgid "Go" -msgstr "Ok" - -#: ../chirpui/memedit.py:1196 -msgid "Special Channels" -msgstr "Spec. csatornák" - -#: ../chirpui/memedit.py:1203 -msgid "Show Empty" -msgstr "Üreset is" - -#: ../chirpui/memedit.py:1378 -msgid "Cutting memory {number}" -msgstr "A(z) {number}. memória kivágása" - -#: ../chirpui/memedit.py:1409 -msgid "" -"Unable to paste {src} memories into {dst} rows. Increase the memory bounds " -"or show empty memories." -msgstr "" -"Nem sikerült beilleszteni {src} memóriát {dst} sorokba. Növelje a memória " -"határokat, vagy mutasson üres memóriára!" - -#: ../chirpui/memedit.py:1423 -msgid "Overwrite?" -msgstr "Felülírja?" - -#: ../chirpui/memedit.py:1428 -msgid "Overwrite location {number}?" -msgstr "Felülírja a(z) {number}. helyet?" - -#: ../chirpui/memedit.py:1453 -msgid "Incompatible Memory" -msgstr "Nem kompatibilis memória" - -#: ../chirpui/memedit.py:1456 -msgid "Pasted memory {number} is not compatible with this radio because:" -msgstr "" -"A beillesztett {number}. számú memória nem kompatibilis ezzel a rádióval, " -"mert:" - -#: ../chirpui/memedit.py:1510 ../chirpui/memedit.py:1525 -msgid "URCALL" -msgstr "URCALL" - -#: ../chirpui/memedit.py:1510 ../chirpui/memedit.py:1526 -msgid "RPT1CALL" -msgstr "RPT1CALL" - -#: ../chirpui/memedit.py:1510 ../chirpui/memedit.py:1527 -msgid "RPT2CALL" -msgstr "RPT2CALL" - -#: ../chirpui/memedit.py:1511 ../chirpui/memedit.py:1528 -msgid "Digital Code" -msgstr "Digitális kód" - -#: ../chirpui/settingsedit.py:67 -#, python-format -msgid "Error in setting value: %s" -msgstr "Hiba a(z) %s érték beállításakor" - -#: ../chirpui/settingsedit.py:124 -#, python-format -msgid "Invalid setting value: %s" -msgstr "Érvénytelen érték %s" - -#: ../chirpui/settingsedit.py:164 -msgid "Enabled" -msgstr "Engedélyezve" - -#: ../chirpui/shiftdialog.py:27 -msgid "Shift" -msgstr "Eltolás" - -#: ../chirpui/shiftdialog.py:63 -msgid "Moving {src} to {dst}" -msgstr "Mozgatás {src} -> {dst}" - -#: ../chirpui/shiftdialog.py:83 -msgid "Looking for a free spot ({number})" -msgstr "Üres terület keresése ({number})" - -#: ../chirpui/shiftdialog.py:96 -msgid "No space to insert a row" -msgstr "Nincs hely a sor beszúrásához" - -#: ../chirpui/shiftdialog.py:143 -msgid "Moved {count} memories" -msgstr "{count} memória átmozgatva" - -msgid "Automatic Repeater Offset" -msgstr "Automatic Repeater Offset" - -msgid "Delete all" -msgstr "_Törlés" - -msgid "%i errors during open, check the debug log for details" -msgstr "%i errors during open, check the debug log for details" diff --git a/locale/it.po b/locale/it.po deleted file mode 100644 index fb2c688..0000000 --- a/locale/it.po +++ /dev/null @@ -1,944 +0,0 @@ -# English translations for CHIRP package. -# Copyright (C) 2011 Dan Smith -# This file is distributed under the same license as the CHIRP package. -# Dan Smith , 2011. -# -msgid "" -msgstr "" -"Project-Id-Version: CHIRP\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2012-02-16 12:06-0800\n" -"PO-Revision-Date: 2014-11-08 17:58+0100\n" -"Last-Translator: Dan Smith \n" -"Language-Team: English\n" -"Language: it\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=ASCII\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" -"X-Generator: Poedit 1.6.10\n" - -#: ../chirpui/common.py:204 -msgid "Completed" -msgstr "Completato" - -#: ../chirpui/common.py:205 -msgid "idle" -msgstr "pronto" - -#: ../chirpui/bankedit.py:52 -msgid "Retrieving bank information" -msgstr "Recupero informazioni bank" - -#: ../chirpui/bankedit.py:75 -msgid "Setting name on bank" -msgstr "Scrittura nome del bank" - -#: ../chirpui/bankedit.py:85 -msgid "Bank" -msgstr "Bank" - -#: ../chirpui/bankedit.py:86 ../chirpui/bankedit.py:240 -#: ../chirpui/importdialog.py:536 ../chirpui/memedit.py:65 -#: ../chirpui/memedit.py:85 ../chirpui/memedit.py:247 -#: ../chirpui/memedit.py:872 ../chirpui/memedit.py:926 -#: ../chirpui/memedit.py:1063 ../chirpui/memedit.py:1065 -msgid "Name" -msgstr "Nome" - -#: ../chirpui/bankedit.py:185 -msgid "Updating bank index for memory {num}" -msgstr "Aggiornamento indice bank per la memoria {num}" - -#: ../chirpui/bankedit.py:194 -msgid "Updating bank information for memory {num}" -msgstr "Aggiornamento informazioni bank per la memoria {num}" - -#: ../chirpui/bankedit.py:200 ../chirpui/bankedit.py:229 -msgid "Getting memory {num}" -msgstr "Acquisizione memoria {num}" - -#: ../chirpui/bankedit.py:214 -msgid "Setting index for memory {num}" -msgstr "Scrittura indice per la memoria {num}" - -#: ../chirpui/bankedit.py:223 -msgid "Getting bank for memory {num}" -msgstr "Acquisizione bank per la memoria {num}" - -#: ../chirpui/bankedit.py:238 ../chirpui/memedit.py:63 -#: ../chirpui/memedit.py:172 ../chirpui/memedit.py:246 -#: ../chirpui/memedit.py:315 ../chirpui/memedit.py:335 -#: ../chirpui/memedit.py:349 ../chirpui/memedit.py:423 -#: ../chirpui/memedit.py:435 ../chirpui/memedit.py:459 -#: ../chirpui/memedit.py:461 ../chirpui/memedit.py:534 -#: ../chirpui/memedit.py:548 ../chirpui/memedit.py:550 -#: ../chirpui/memedit.py:591 ../chirpui/memedit.py:593 -#: ../chirpui/memedit.py:621 ../chirpui/memedit.py:822 -#: ../chirpui/memedit.py:870 ../chirpui/memedit.py:895 -#: ../chirpui/memedit.py:907 ../chirpui/memedit.py:924 -#: ../chirpui/memedit.py:1230 -msgid "Loc" -msgstr "Pos" - -#: ../chirpui/bankedit.py:239 ../chirpui/importdialog.py:537 -#: ../chirpui/memedit.py:64 ../chirpui/memedit.py:86 ../chirpui/memedit.py:187 -#: ../chirpui/memedit.py:248 ../chirpui/memedit.py:271 -#: ../chirpui/memedit.py:296 ../chirpui/memedit.py:304 -#: ../chirpui/memedit.py:873 ../chirpui/memedit.py:923 -msgid "Frequency" -msgstr "Frequenza" - -#: ../chirpui/bankedit.py:241 -msgid "Index" -msgstr "Indice" - -#: ../chirpui/bankedit.py:302 -msgid "Getting bank information for memory {num}" -msgstr "Acquisizione informazioni bank per la memoria {num}" - -#: ../chirpui/bankedit.py:323 -msgid "Getting bank information" -msgstr "Acquisizione informazioni bank" - -#: ../chirpui/inputdialog.py:81 -msgid "An error has occurred" -msgstr "Si e' verificato un errore" - -#: ../chirpui/inputdialog.py:130 -msgid "Overwrite" -msgstr "Sovrascrivi" - -#: ../chirpui/inputdialog.py:133 -msgid "File Exists" -msgstr "Il File esiste" - -#: ../chirpui/inputdialog.py:136 -msgid "The file {name} already exists. Do you want to overwrite it?" -msgstr "Il file {name} esiste gia. Vuoi sovrascriverlo?" - -#: ../chirpui/importdialog.py:90 -msgid "" -"Location {number} is already being imported. Choose another value for 'New " -"Location' before selection 'Import'" -msgstr "" -"La memoria numero {number} e' gia' stata importata. Scegliere un altro " -"valore per 'Nuova memoria' prima di selezionare 'Importa'" - -#: ../chirpui/importdialog.py:121 -msgid "Invalid value. Must be an integer." -msgstr "Valore non valido. Deve essere un numero intero" - -#: ../chirpui/importdialog.py:130 -msgid "Location {number} is already being imported" -msgstr "La memoria {number} e' gia' stata importata" - -#: ../chirpui/importdialog.py:182 -msgid "Updating URCALL list" -msgstr "Aggiornamento lista URCALL" - -#: ../chirpui/importdialog.py:187 -msgid "Updating RPTCALL list" -msgstr "Aggiornamento lista RPTCALL" - -#: ../chirpui/importdialog.py:256 -msgid "Setting memory {number}" -msgstr "Scrittura memoria {number}" - -#: ../chirpui/importdialog.py:260 -msgid "Importing bank information" -msgstr "Importazione informazioni bank" - -#: ../chirpui/importdialog.py:264 -msgid "Error importing memories:" -msgstr "Errore di importazione memorie:" - -#: ../chirpui/importdialog.py:376 -msgid "All" -msgstr "Tutto" - -#: ../chirpui/importdialog.py:382 -msgid "None" -msgstr "Nessuno" - -#: ../chirpui/importdialog.py:388 -msgid "Inverse" -msgstr "Inverti" - -#: ../chirpui/importdialog.py:394 -msgid "Select" -msgstr "Seleziona" - -#: ../chirpui/importdialog.py:416 -msgid "Auto" -msgstr "Auto" - -#: ../chirpui/importdialog.py:422 -msgid "Reverse" -msgstr "Rovescia" - -#: ../chirpui/importdialog.py:428 -msgid "Adjust New Location" -msgstr "Cambia nuova posizione" - -#: ../chirpui/importdialog.py:438 -msgid "Confirm overwrites" -msgstr "Conferma sovrascrittura" - -#: ../chirpui/importdialog.py:444 -msgid "Options" -msgstr "Opzioni" - -#: ../chirpui/importdialog.py:495 -msgid "Cannot be imported because" -msgstr "Non si puo' importare perche'" - -#: ../chirpui/importdialog.py:513 -msgid "Import From File" -msgstr "Importa da File" - -#: ../chirpui/importdialog.py:514 ../chirpui/mainapp.py:1196 -msgid "Import" -msgstr "Import" - -#: ../chirpui/importdialog.py:534 -msgid "To" -msgstr "A" - -#: ../chirpui/importdialog.py:535 -msgid "From" -msgstr "Da" - -#: ../chirpui/importdialog.py:538 ../chirpui/memedit.py:78 -#: ../chirpui/memedit.py:99 ../chirpui/memedit.py:886 -#: ../chirpui/memedit.py:940 ../chirpui/memedit.py:1068 -msgid "Comment" -msgstr "Commento" - -#: ../chirpui/importdialog.py:542 -msgid "Location memory will be imported into" -msgstr "La memoria verra' importata in" - -#: ../chirpui/importdialog.py:543 -msgid "Location of memory in the file being imported" -msgstr "Posizione della memoria nel file che viene importato" - -#: ../chirpui/importdialog.py:566 -msgid "Preparing memory list..." -msgstr "Preparazione lista memorie..." - -#: ../chirpui/importdialog.py:575 -msgid "Export To File" -msgstr "Esporta in File" - -#: ../chirpui/importdialog.py:576 ../chirpui/mainapp.py:1197 -msgid "Export" -msgstr "Esporta" - -#: ../chirpui/mainapp.py:269 ../chirpui/mainapp.py:483 -msgid "Untitled" -msgstr "Senza Nome" - -#: ../chirpui/mainapp.py:316 ../chirpui/mainapp.py:715 -msgid "CHIRP Radio Images" -msgstr "Immagine Radio CHIRP" - -#: ../chirpui/mainapp.py:317 ../chirpui/mainapp.py:714 -#: ../chirpui/mainapp.py:880 -msgid "CHIRP Files" -msgstr "Files CHIRP" - -#: ../chirpui/mainapp.py:318 ../chirpui/mainapp.py:716 -#: ../chirpui/mainapp.py:879 -msgid "CSV Files" -msgstr "Files CSV" - -#: ../chirpui/mainapp.py:319 ../chirpui/mainapp.py:717 -msgid "ICF Files" -msgstr "Files ICF" - -#: ../chirpui/mainapp.py:320 ../chirpui/mainapp.py:718 -msgid "VX7 Commander Files" -msgstr "Files VX7 Commander" - -#: ../chirpui/mainapp.py:330 -msgid "" -"ICF files cannot be edited, only displayed or imported into another file. " -"Open in read-only mode?" -msgstr "" -"I Files ICF non possono essere modificati, solo visualizzati o importati in " -"un altro file. Aprire in sola lettura?" - -#: ../chirpui/mainapp.py:373 -msgid "There was an error opening {fname}: {error}" -msgstr "Errore durante l'apertura di {fname}: {error}" - -#: ../chirpui/mainapp.py:388 -msgid "{num} errors during open:" -msgstr "{num} errori durante l'apertura:" - -#: ../chirpui/mainapp.py:394 -msgid "Note:" -msgstr "Note:" - -#: ../chirpui/mainapp.py:395 -msgid "" -"The {vendor} {model} operates in live mode. This means that any " -"changes you make are immediately sent to the radio. Because of this, you " -"cannot perform the Save or Upload operations. If you wish to " -"edit the contents offline, please Export to a CSV file, using the " -"File menu." -msgstr "" -"La radio{vendor} {model} opera in live mode. Questo significa che " -"qualsiasi modifica viene immediatamente scritta nella radio. A causa di " -"questo, non puoi utilizzare le funzioni Salva or Scrivi. Se " -"vuoi modificare le memorie offline, per favore Esporta le memorie in " -"un file CSV, usando il menu File." - -#: ../chirpui/mainapp.py:404 -msgid "Don't show this again" -msgstr "Non mostrarlo di nuovo" - -#: ../chirpui/mainapp.py:448 -msgid "{vendor} {model} image file" -msgstr "File immagine {vendor} {model}" - -#: ../chirpui/mainapp.py:456 -msgid "VX7 Commander" -msgstr "VX7 Commander" - -#: ../chirpui/mainapp.py:518 -msgid "Open recent file {name}" -msgstr "Apri file recente {name}" - -#: ../chirpui/mainapp.py:579 -msgid "Import stock configuration {name}" -msgstr "Importazione configurazione stock {name}" - -#: ../chirpui/mainapp.py:595 -msgid "Open stock configuration {name}" -msgstr "Apertura configurazione stock {name}" - -#: ../chirpui/mainapp.py:681 -msgid "Discard Changes?" -msgstr "Scartare le modifiche?" - -#: ../chirpui/mainapp.py:686 -msgid "File is modified, save changes before closing?" -msgstr "Il file e' stato modificato, salvare i cambiamenti prima di chiudere?" - -#: ../chirpui/mainapp.py:923 -msgid "With significant contributions by:" -msgstr "Con il significativo contributo di:" - -#: ../chirpui/mainapp.py:940 -msgid "Select Columns" -msgstr "Seleziona colonne" - -#: ../chirpui/mainapp.py:955 -msgid "Visible columns for {radio}" -msgstr "Colonne visibili per {radio}" - -#: ../chirpui/mainapp.py:1012 -msgid "Reporting is disabled" -msgstr "Reporting disattivato" - -#: ../chirpui/mainapp.py:1013 -msgid "" -"The reporting feature of CHIRP is designed to help improve quality by " -"allowing the authors to focus on the radio drivers used most often and " -"errors experienced by the users. The reports contain no identifying " -"information and are used only for statistical purposes by the authors. Your " -"privacy is extremely important, but please consider leaving this feature " -"enabled to help make CHIRP better!\n" -"\n" -"Are you sure you want to disable this feature?" -msgstr "" -"La funzione reporting di CHIRP e' fatta per migliorare la qualita' " -"consentendo agli autori di concentrarsi sulle radio piu' utilizzate e sugli " -"errori piu' comuni. I report non contengono informazioni personali e sono " -"utilizzati per soli fini statistici dagli autori. La tua provacy e' molto " -"importante ma per favore considera di lasciare attiva questa opzione per " -"aiutarci a migliorare CHIRP!\n" -"\n" -"Sei sicuro di disabilitare questa opzione?" - -#: ../chirpui/mainapp.py:1045 -msgid "" -"Choose a language or Auto to use the operating system default. You will need " -"to restart the application before the change will take effect" -msgstr "" -"Scegli una lingua o usa Auto per utilizzare la lingua del sistema operativo. " -"Devi riavviare l'applicazione per applicare i cambiamenti" - -#: ../chirpui/mainapp.py:1169 -msgid "_File" -msgstr "File" - -#: ../chirpui/mainapp.py:1172 -msgid "Open stock config" -msgstr "Apri configurazione stock" - -#: ../chirpui/mainapp.py:1173 -msgid "_Recent" -msgstr "Recenti" - -#: ../chirpui/mainapp.py:1178 -msgid "_Edit" -msgstr "Modifica" - -#: ../chirpui/mainapp.py:1179 -msgid "_Cut" -msgstr "Taglia" - -#: ../chirpui/mainapp.py:1180 -msgid "_Copy" -msgstr "Copia" - -#: ../chirpui/mainapp.py:1181 -msgid "_Paste" -msgstr "Incolla" - -#: ../chirpui/mainapp.py:1182 -msgid "_Delete" -msgstr "Elimina" - -#: ../chirpui/mainapp.py:1183 -msgid "Move _Up" -msgstr "Muovi Su" - -#: ../chirpui/mainapp.py:1184 -msgid "Move Dow_n" -msgstr "Muovi Giu" - -#: ../chirpui/mainapp.py:1185 -msgid "E_xchange" -msgstr "Scambia" - -#: ../chirpui/mainapp.py:1186 -msgid "_View" -msgstr "Vista" - -#: ../chirpui/mainapp.py:1187 -msgid "Columns" -msgstr "Colonne" - -#: ../chirpui/mainapp.py:1188 -msgid "Developer" -msgstr "Sviluppatore" - -#: ../chirpui/mainapp.py:1189 -msgid "Show raw memory" -msgstr "Mostra memorie Raw" - -#: ../chirpui/mainapp.py:1190 -msgid "Diff raw memories" -msgstr "Differenza memorie Raw" - -#: ../chirpui/mainapp.py:1191 -msgid "Diff tabs" -msgstr "Differenzia tabs" - -#: ../chirpui/mainapp.py:1192 -msgid "Change language" -msgstr "Cambia lingua" - -#: ../chirpui/mainapp.py:1193 -msgid "_Radio" -msgstr "Radio" - -#: ../chirpui/mainapp.py:1194 -msgid "Download From Radio" -msgstr "Leggi da Radio" - -#: ../chirpui/mainapp.py:1195 -msgid "Upload To Radio" -msgstr "Scrivi su Radio" - -#: ../chirpui/mainapp.py:1198 -msgid "Import from RFinder" -msgstr "Importa da RFinder" - -#: ../chirpui/mainapp.py:1199 -msgid "CHIRP Native File" -msgstr "File nativo CHIRP" - -#: ../chirpui/mainapp.py:1200 -msgid "CSV File" -msgstr "File CSV" - -#: ../chirpui/mainapp.py:1201 -msgid "Import from RepeaterBook" -msgstr "Importa da RepeaterBook" - -#: ../chirpui/mainapp.py:1202 -msgid "Import from stock config" -msgstr "Importa da Configurazione Stock" - -#: ../chirpui/mainapp.py:1204 -msgid "Help" -msgstr "Aiuto" - -#: ../chirpui/mainapp.py:1215 -msgid "Report statistics" -msgstr "Report statistiche" - -#: ../chirpui/mainapp.py:1216 -msgid "Hide Unused Fields" -msgstr "Nascondi campi inutilizzati" - -#: ../chirpui/mainapp.py:1217 -msgid "Automatic Repeater Offset" -msgstr "Offset Ripetitori Automatico" - -#: ../chirpui/mainapp.py:1218 -msgid "Enable Developer Functions" -msgstr "Abilita Funzioni Sviluppatore" - -#: ../chirpui/mainapp.py:1352 -msgid "Error reporting is enabled" -msgstr "Rapporto errori abilitato" - -#: ../chirpui/mainapp.py:1355 -msgid "" -"If you wish to disable this feature you may do so in the Help menu" -msgstr "Se vuoi disabilitare questa opzione puoi farlo nel menu Aiuto" - -#: ../chirpui/cloneprog.py:43 -msgid "Clone Progress" -msgstr "Progressione programmazione" - -#: ../chirpui/cloneprog.py:46 -msgid "Cloning" -msgstr "Programmazione" - -#: ../chirpui/cloneprog.py:55 -msgid "Cancel" -msgstr "Annulla" - -#: ../chirpui/shiftdialog.py:27 -msgid "Shift" -msgstr "Shift" - -#: ../chirpui/shiftdialog.py:63 -msgid "Moving {src} to {dst}" -msgstr "Spostamento da {src} a {dst}" - -#: ../chirpui/shiftdialog.py:80 -msgid "Looking for a free spot ({number})" -msgstr "Ricerca di un posto libero ({number})" - -#: ../chirpui/shiftdialog.py:135 -msgid "Moved {count} memories" -msgstr "Spostate {count} memorie" - -#: ../chirpui/clone.py:35 -msgid "{vendor} {model} on {port}" -msgstr "{vendor} {model} su porta {port}" - -#: ../chirpui/clone.py:100 ../chirpui/clone.py:162 -msgid "Detect" -msgstr "Rileva" - -#: ../chirpui/clone.py:123 -msgid "Port" -msgstr "Porta" - -#: ../chirpui/clone.py:124 -msgid "Vendor" -msgstr "Produttore" - -#: ../chirpui/clone.py:125 -msgid "Model" -msgstr "Modello" - -#: ../chirpui/clone.py:138 -msgid "Radio" -msgstr "Radio" - -#: ../chirpui/clone.py:166 -msgid "Unable to detect radio on {port}" -msgstr "Impossibile rilevare radio sulla porta {port}" - -#: ../chirpui/clone.py:178 -msgid "Internal error: Unable to upload to {model}" -msgstr "Errore interno: impossibile caricare su {model}" - -#: ../chirpui/clone.py:226 -msgid "Clone failed: {error}" -msgstr "Programmazione fallita: {error}" - -#: ../chirpui/dstaredit.py:40 -msgid "Callsign" -msgstr "Nominativo" - -#: ../chirpui/dstaredit.py:124 -msgid "Your callsign" -msgstr "Il tuo nominativo" - -#: ../chirpui/dstaredit.py:132 -msgid "Repeater callsign" -msgstr "Nominativo Ripetitore" - -#: ../chirpui/dstaredit.py:140 -msgid "My callsign" -msgstr "Il mio nominativo" - -#: ../chirpui/dstaredit.py:170 ../chirpui/memedit.py:1365 -msgid "Downloading URCALL list" -msgstr "Scaricamento lista URCALL" - -#: ../chirpui/dstaredit.py:174 ../chirpui/memedit.py:1377 -msgid "Downloading RPTCALL list" -msgstr "Scaricamento lista RPTCALL" - -#: ../chirpui/dstaredit.py:178 -msgid "Downloading MYCALL list" -msgstr "Scaricamento lista MYCALL" - -#: ../chirpui/editorset.py:87 -msgid "Memories" -msgstr "Memorie" - -#: ../chirpui/editorset.py:92 -msgid "D-STAR" -msgstr "D-STAR" - -#: ../chirpui/editorset.py:98 -msgid "Bank Names" -msgstr "Nomi Bank" - -#: ../chirpui/editorset.py:104 -msgid "Banks" -msgstr "Bank" - -#: ../chirpui/editorset.py:222 -msgid "The {vendor} {model} has multiple independent sub-devices" -msgstr "Il {vendor} {model} ha sub-device multipli indipendenti" - -#: ../chirpui/editorset.py:225 -msgid "Choose one to import from:" -msgstr "Scegli da dove importare:" - -#: ../chirpui/editorset.py:230 -msgid "Cancelled" -msgstr "Annullato" - -#: ../chirpui/editorset.py:235 -msgid "Internal Error" -msgstr "Errore interno" - -#: ../chirpui/editorset.py:248 -msgid "" -"There were errors while opening {file}. The affected memories will not be " -"importable!" -msgstr "" -"Ci sono stati degli errori nell'apertura del file {file}. Le memorie " -"interessate non potranno essere importate!" - -#: ../chirpui/editorset.py:260 -msgid "There was an error during import: {error}" -msgstr "Errore durante l'apertura del file: {error}" - -#: ../chirpui/editorset.py:270 -msgid "Unsupported file type" -msgstr "Tipo file non supportato" - -#: ../chirpui/editorset.py:286 ../chirpui/editorset.py:301 -msgid "There was an error during export: {error}" -msgstr "Errore durante l'esportazione del file: {error}" - -#: ../chirpui/editorset.py:313 -msgid "Priming memory" -msgstr "Preparazione memoria" - -#: ../chirpui/memedit.py:52 -msgid "Invalid value for this field" -msgstr "Valore non valido per questo campo" - -#: ../chirpui/memedit.py:66 ../chirpui/memedit.py:97 ../chirpui/memedit.py:111 -#: ../chirpui/memedit.py:204 ../chirpui/memedit.py:312 -#: ../chirpui/memedit.py:874 ../chirpui/memedit.py:931 -#: ../chirpui/memedit.py:1069 ../chirpui/memedit.py:1133 -msgid "Tone Mode" -msgstr "Modalita' tono" - -#: ../chirpui/memedit.py:67 ../chirpui/memedit.py:87 ../chirpui/memedit.py:103 -#: ../chirpui/memedit.py:214 ../chirpui/memedit.py:218 -#: ../chirpui/memedit.py:220 ../chirpui/memedit.py:310 -#: ../chirpui/memedit.py:875 ../chirpui/memedit.py:928 -#: ../chirpui/memedit.py:1070 -msgid "Tone" -msgstr "Tone" - -#: ../chirpui/memedit.py:68 ../chirpui/memedit.py:88 ../chirpui/memedit.py:104 -#: ../chirpui/memedit.py:210 ../chirpui/memedit.py:218 -#: ../chirpui/memedit.py:221 ../chirpui/memedit.py:310 -#: ../chirpui/memedit.py:876 ../chirpui/memedit.py:929 -#: ../chirpui/memedit.py:1066 -msgid "ToneSql" -msgstr "ToneSql" - -#: ../chirpui/memedit.py:69 ../chirpui/memedit.py:89 ../chirpui/memedit.py:105 -#: ../chirpui/memedit.py:211 ../chirpui/memedit.py:215 -#: ../chirpui/memedit.py:222 ../chirpui/memedit.py:306 -#: ../chirpui/memedit.py:877 ../chirpui/memedit.py:930 -#: ../chirpui/memedit.py:1059 -msgid "DTCS Code" -msgstr "DTCS Code" - -#: ../chirpui/memedit.py:70 ../chirpui/memedit.py:90 ../chirpui/memedit.py:106 -#: ../chirpui/memedit.py:212 ../chirpui/memedit.py:216 -#: ../chirpui/memedit.py:223 ../chirpui/memedit.py:878 -#: ../chirpui/memedit.py:933 ../chirpui/memedit.py:1060 -msgid "DTCS Pol" -msgstr "DTCS Pol" - -#: ../chirpui/memedit.py:71 ../chirpui/memedit.py:91 ../chirpui/memedit.py:112 -#: ../chirpui/memedit.py:879 ../chirpui/memedit.py:932 -#: ../chirpui/memedit.py:1067 ../chirpui/memedit.py:1134 -msgid "Cross Mode" -msgstr "Cross Mode" - -#: ../chirpui/memedit.py:72 ../chirpui/memedit.py:92 ../chirpui/memedit.py:109 -#: ../chirpui/memedit.py:137 ../chirpui/memedit.py:205 -#: ../chirpui/memedit.py:249 ../chirpui/memedit.py:312 -#: ../chirpui/memedit.py:880 ../chirpui/memedit.py:934 -#: ../chirpui/memedit.py:1071 ../chirpui/memedit.py:1144 -msgid "Duplex" -msgstr "Duplex" - -#: ../chirpui/memedit.py:73 ../chirpui/memedit.py:93 ../chirpui/memedit.py:135 -#: ../chirpui/memedit.py:198 ../chirpui/memedit.py:226 -#: ../chirpui/memedit.py:250 ../chirpui/memedit.py:308 -#: ../chirpui/memedit.py:881 ../chirpui/memedit.py:935 -#: ../chirpui/memedit.py:1062 -msgid "Offset" -msgstr "Offset" - -#: ../chirpui/memedit.py:74 ../chirpui/memedit.py:94 ../chirpui/memedit.py:107 -#: ../chirpui/memedit.py:882 ../chirpui/memedit.py:936 -#: ../chirpui/memedit.py:1061 ../chirpui/memedit.py:1132 -#: ../chirpui/memedit.py:1289 ../chirpui/memedit.py:1307 -#: ../chirpui/memedit.py:1317 -msgid "Mode" -msgstr "Modulazione" - -#: ../chirpui/memedit.py:75 ../chirpui/memedit.py:95 ../chirpui/memedit.py:108 -#: ../chirpui/memedit.py:296 ../chirpui/memedit.py:883 -#: ../chirpui/memedit.py:937 ../chirpui/memedit.py:1073 -#: ../chirpui/memedit.py:1136 ../chirpui/memedit.py:1140 -msgid "Power" -msgstr "Potenza" - -#: ../chirpui/memedit.py:76 ../chirpui/memedit.py:96 ../chirpui/memedit.py:110 -#: ../chirpui/memedit.py:140 ../chirpui/memedit.py:143 -#: ../chirpui/memedit.py:884 ../chirpui/memedit.py:938 -#: ../chirpui/memedit.py:1064 -msgid "Tune Step" -msgstr "Step sintonia" - -#: ../chirpui/memedit.py:77 ../chirpui/memedit.py:98 ../chirpui/memedit.py:885 -#: ../chirpui/memedit.py:939 ../chirpui/memedit.py:1072 -#: ../chirpui/memedit.py:1135 -msgid "Skip" -msgstr "Salta" - -#: ../chirpui/memedit.py:175 -msgid "Erasing memory {loc}" -msgstr "Cancellazione memoria {loc}" - -#: ../chirpui/memedit.py:236 -msgid "Unable to make changes to this model" -msgstr "Impossibile effettuare modifiche su questo modello" - -#: ../chirpui/memedit.py:241 -msgid "Editing new item, taking defaults" -msgstr "Modifica di un nuovo elemento, verranno usati valori di default" - -#: ../chirpui/memedit.py:257 -msgid "Bad value for {col}: {val}" -msgstr "Valore non valido per {col}: {val}" - -#: ../chirpui/memedit.py:281 -msgid "Error setting memory" -msgstr "Errore di scrittura della memoria" - -#: ../chirpui/memedit.py:289 ../chirpui/memedit.py:356 -#: ../chirpui/memedit.py:1272 -msgid "Writing memory {number}" -msgstr "Scrittura memoria {number}" - -#: ../chirpui/memedit.py:361 -msgid "" -"This operation requires moving all subsequent channels by one spot until an " -"empty location is reached. This can take a LONG time. Are you sure you " -"want to do this?" -msgstr "" -"Questa operazione richiede lo spostamento dei canali seguenti di un passo " -"alla volta fino alla nuova posizione. L'operazione puo' durare MOLTO tempo. " -"Sei sicuro di volerlo fare?" - -#: ../chirpui/memedit.py:387 -msgid "Adding memory {number}" -msgstr "Aggiunta memoria {number}" - -#: ../chirpui/memedit.py:400 ../chirpui/memedit.py:913 -msgid "Erasing memory {number}" -msgstr "Cancellatura memoria {number}" - -#: ../chirpui/memedit.py:409 ../chirpui/memedit.py:518 -#: ../chirpui/memedit.py:564 ../chirpui/memedit.py:569 -#: ../chirpui/memedit.py:856 ../chirpui/memedit.py:1166 -msgid "Getting memory {number}" -msgstr "Acquisita memoria {number}" - -#: ../chirpui/memedit.py:497 ../chirpui/memedit.py:508 -#: ../chirpui/memedit.py:556 -msgid "Moving memory from {old} to {new}" -msgstr "Spostata memoria da {old} a {new}" - -#: ../chirpui/memedit.py:578 -msgid "Raw memory {number}" -msgstr "Memoria Raw {number}" - -#: ../chirpui/memedit.py:582 ../chirpui/memedit.py:610 -#: ../chirpui/memedit.py:615 -msgid "Getting raw memory {number}" -msgstr "Acquisizione memoria Raw {number}" - -#: ../chirpui/memedit.py:587 -msgid "You can only diff two memories!" -msgstr "Puoi differenziare solo 2 memorie!" - -#: ../chirpui/memedit.py:598 -msgid "Memory {number}" -msgstr "Memoria {number}" - -#: ../chirpui/memedit.py:604 -msgid "Diff of {a} and {b}" -msgstr "Differenza di {a} e {b}" - -#: ../chirpui/memedit.py:628 -msgid "Memories must be contiguous" -msgstr "Le memorie devono essere contigue" - -#: ../chirpui/memedit.py:700 -msgid "Insert row above" -msgstr "Inserisci riga sopra" - -#: ../chirpui/memedit.py:701 -msgid "Insert row below" -msgstr "Inserisci riga sotto" - -#: ../chirpui/memedit.py:702 -msgid "Delete" -msgstr "Elimina" - -#: ../chirpui/memedit.py:702 -msgid "Delete all" -msgstr "Elimina tutto" - -#: ../chirpui/memedit.py:703 -msgid "Delete (and shift up)" -msgstr "Elimina (e sposta sopra)" - -#: ../chirpui/memedit.py:704 -msgid "Move up" -msgstr "Sposta su" - -#: ../chirpui/memedit.py:705 -msgid "Move down" -msgstr "Muovi giu" - -#: ../chirpui/memedit.py:706 -msgid "Exchange memories" -msgstr "Scambia memorie" - -#: ../chirpui/memedit.py:707 -msgid "Cut" -msgstr "Taglia" - -#: ../chirpui/memedit.py:708 -msgid "Copy" -msgstr "Copia" - -#: ../chirpui/memedit.py:709 -msgid "Paste" -msgstr "Incolla" - -#: ../chirpui/memedit.py:710 -msgid "Show Raw Memory" -msgstr "Mostra memorie Raw" - -#: ../chirpui/memedit.py:711 -msgid "Diff Raw Memories" -msgstr "Diff memorie Raw" - -#: ../chirpui/memedit.py:835 -msgid "Internal Error: Column {name} not found" -msgstr "Errore interno: nome colonna {name} non trovato" - -#: ../chirpui/memedit.py:863 -msgid "Getting channel {chan}" -msgstr "Acquisizione canale {chan}" - -#: ../chirpui/memedit.py:952 -msgid "Internal Error: Invalid limit {number}" -msgstr "Errore interno: limite non valido {number}" - -#: ../chirpui/memedit.py:962 -msgid "Memory range:" -msgstr "Range memorie" - -#: ../chirpui/memedit.py:989 -msgid "Go" -msgstr "Vai" - -#: ../chirpui/memedit.py:1012 -msgid "Special Channels" -msgstr "Canali Speciali" - -#: ../chirpui/memedit.py:1019 -msgid "Show Empty" -msgstr "Mostra Vuoti" - -#: ../chirpui/memedit.py:1198 -msgid "Cutting memory {number}" -msgstr "Taglia memoria {number}" - -#: ../chirpui/memedit.py:1232 -msgid "Overwrite?" -msgstr "Sovrascrivere?" - -#: ../chirpui/memedit.py:1237 -msgid "Overwrite location {number}?" -msgstr "Sovrascrivere posizione {number}?" - -#: ../chirpui/memedit.py:1254 -msgid "Incompatible Memory" -msgstr "Memoria non compatibile" - -#: ../chirpui/memedit.py:1257 -msgid "Pasted memory {number} is not compatible with this radio because:" -msgstr "" -"La memoria incollata {number} non e' compatibile con questa radio perche':" - -#: ../chirpui/memedit.py:1309 ../chirpui/memedit.py:1324 -msgid "URCALL" -msgstr "URCALL" - -#: ../chirpui/memedit.py:1309 ../chirpui/memedit.py:1325 -msgid "RPT1CALL" -msgstr "RPT1CALL" - -#: ../chirpui/memedit.py:1309 ../chirpui/memedit.py:1326 -msgid "RPT2CALL" -msgstr "RPT2CALL" - -#: ../chirpui/memedit.py:1310 ../chirpui/memedit.py:1327 -msgid "Digital Code" -msgstr "Digital Code" - -#~ msgid "%i errors during open, check the debug log for details" -#~ msgstr "%i errors during open, check the debug log for details" diff --git a/locale/nl.po b/locale/nl.po deleted file mode 100644 index e22e916..0000000 --- a/locale/nl.po +++ /dev/null @@ -1,945 +0,0 @@ -# Dutch translations for CHIRP package. -# Copyright (C) 2012 Dan Smith -# This file is distributed under the same license as the CHIRP package. -# Dan Smith , 2012. -# Michael Tel , 2012. -# -msgid "" -msgstr "" -"Project-Id-Version: CHIRP\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2012-02-16 12:06-0800\n" -"PO-Revision-Date: 2012-03-18 12:01+0100\n" -"Last-Translator: Michael Tel \n" -"Language-Team: Dutch\n" -"Language: nl\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=ISO-8859-1\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" - -#: ../chirpui/common.py:204 -msgid "Completed" -msgstr "Volbracht" - -#: ../chirpui/common.py:205 -msgid "idle" -msgstr "luieren" - -#: ../chirpui/bankedit.py:52 -msgid "Retrieving bank information" -msgstr "Informatie van de bank ophalen" - -#: ../chirpui/bankedit.py:75 -msgid "Setting name on bank" -msgstr "Naam van de bank instellen" - -#: ../chirpui/bankedit.py:85 -msgid "Bank" -msgstr "Bank" - -#: ../chirpui/bankedit.py:86 ../chirpui/bankedit.py:240 -#: ../chirpui/importdialog.py:536 ../chirpui/memedit.py:65 -#: ../chirpui/memedit.py:85 ../chirpui/memedit.py:247 -#: ../chirpui/memedit.py:872 ../chirpui/memedit.py:926 -#: ../chirpui/memedit.py:1063 ../chirpui/memedit.py:1065 -msgid "Name" -msgstr "Naam" - -#: ../chirpui/bankedit.py:185 -msgid "Updating bank index for memory {num}" -msgstr "Index van de bank voor kanaal {num} bijwerken" - -#: ../chirpui/bankedit.py:194 -msgid "Updating bank information for memory {num}" -msgstr "Informatie van de bank voor kanaal {num} bijwerken" - -#: ../chirpui/bankedit.py:200 ../chirpui/bankedit.py:229 -msgid "Getting memory {num}" -msgstr "Ophalen kanaal {num}" - -#: ../chirpui/bankedit.py:214 -msgid "Setting index for memory {num}" -msgstr "Instellen van de index voor kanaal {num}" - -#: ../chirpui/bankedit.py:223 -msgid "Getting bank for memory {num}" -msgstr "Bank voor kanaal {num} ophalen" - -#: ../chirpui/bankedit.py:238 ../chirpui/memedit.py:63 -#: ../chirpui/memedit.py:172 ../chirpui/memedit.py:246 -#: ../chirpui/memedit.py:315 ../chirpui/memedit.py:335 -#: ../chirpui/memedit.py:349 ../chirpui/memedit.py:423 -#: ../chirpui/memedit.py:435 ../chirpui/memedit.py:459 -#: ../chirpui/memedit.py:461 ../chirpui/memedit.py:534 -#: ../chirpui/memedit.py:548 ../chirpui/memedit.py:550 -#: ../chirpui/memedit.py:591 ../chirpui/memedit.py:593 -#: ../chirpui/memedit.py:621 ../chirpui/memedit.py:822 -#: ../chirpui/memedit.py:870 ../chirpui/memedit.py:895 -#: ../chirpui/memedit.py:907 ../chirpui/memedit.py:924 -#: ../chirpui/memedit.py:1230 -msgid "Loc" -msgstr "Plaats" - -#: ../chirpui/bankedit.py:239 ../chirpui/importdialog.py:537 -#: ../chirpui/memedit.py:64 ../chirpui/memedit.py:86 ../chirpui/memedit.py:187 -#: ../chirpui/memedit.py:248 ../chirpui/memedit.py:271 -#: ../chirpui/memedit.py:296 ../chirpui/memedit.py:304 -#: ../chirpui/memedit.py:873 ../chirpui/memedit.py:923 -msgid "Frequency" -msgstr "Frequentie" - -#: ../chirpui/bankedit.py:241 -msgid "Index" -msgstr "Index" - -#: ../chirpui/bankedit.py:302 -msgid "Getting bank information for memory {num}" -msgstr "Informatie van de bank voor kanaal {num} ophalen" - -#: ../chirpui/bankedit.py:323 -msgid "Getting bank information" -msgstr "Informatie van de bank ophalen" - -#: ../chirpui/inputdialog.py:81 -msgid "An error has occurred" -msgstr "Er is een fout opgetreden" - -#: ../chirpui/inputdialog.py:130 -msgid "Overwrite" -msgstr "Overschrijven" - -#: ../chirpui/inputdialog.py:133 -msgid "File Exists" -msgstr "Bestand bestaat" - -#: ../chirpui/inputdialog.py:136 -msgid "The file {name} already exists. Do you want to overwrite it?" -msgstr "Het bestand {name} bestaat al. Wilt u het overschrijven?" - -#: ../chirpui/importdialog.py:90 -msgid "" -"Location {number} is already being imported. Choose another value for 'New " -"Location' before selection 'Import'" -msgstr "" -"Plaats {number} wordt al gemporteerd. Kies een andere waarde voor 'Nieuwe " -"locatie' vr 'Importeren' te selecteren" - -#: ../chirpui/importdialog.py:121 -msgid "Invalid value. Must be an integer." -msgstr "Ongeldige waarde. Het moet een integer zijn." - -#: ../chirpui/importdialog.py:130 -msgid "Location {number} is already being imported" -msgstr "Plaats {number} is reeds gemporteerd" - -#: ../chirpui/importdialog.py:182 -msgid "Updating URCALL list" -msgstr "Bijwerken URCALL lijst" - -#: ../chirpui/importdialog.py:187 -msgid "Updating RPTCALL list" -msgstr "Bijwerken RPTCALL lijst" - -#: ../chirpui/importdialog.py:256 -msgid "Setting memory {number}" -msgstr "Kanaal {number} instellen" - -#: ../chirpui/importdialog.py:260 -msgid "Importing bank information" -msgstr "Importeren van informatie van de bank" - -#: ../chirpui/importdialog.py:264 -msgid "Error importing memories:" -msgstr "Fout bij het importen van geheugen" - -#: ../chirpui/importdialog.py:376 -msgid "All" -msgstr "Alles" - -#: ../chirpui/importdialog.py:382 -msgid "None" -msgstr "Geen" - -#: ../chirpui/importdialog.py:388 -msgid "Inverse" -msgstr "Tegengesteld" - -#: ../chirpui/importdialog.py:394 -msgid "Select" -msgstr "Selecteren" - -#: ../chirpui/importdialog.py:416 -msgid "Auto" -msgstr "Auto" - -#: ../chirpui/importdialog.py:422 -msgid "Reverse" -msgstr "Omkeren" - -#: ../chirpui/importdialog.py:428 -msgid "Adjust New Location" -msgstr "Nieuwe locatie aanpassen" - -#: ../chirpui/importdialog.py:438 -msgid "Confirm overwrites" -msgstr "Overschrijven bevestigen" - -#: ../chirpui/importdialog.py:444 -msgid "Options" -msgstr "Opties" - -#: ../chirpui/importdialog.py:495 -msgid "Cannot be imported because" -msgstr "Kan niet worden gemporteerd, omdat" - -#: ../chirpui/importdialog.py:513 -msgid "Import From File" -msgstr "Importeren van bestand" - -#: ../chirpui/importdialog.py:514 ../chirpui/mainapp.py:1196 -msgid "Import" -msgstr "Importeren" - -#: ../chirpui/importdialog.py:534 -msgid "To" -msgstr "Aan" - -#: ../chirpui/importdialog.py:535 -msgid "From" -msgstr "Van" - -#: ../chirpui/importdialog.py:538 ../chirpui/memedit.py:78 -#: ../chirpui/memedit.py:99 ../chirpui/memedit.py:886 -#: ../chirpui/memedit.py:940 ../chirpui/memedit.py:1068 -msgid "Comment" -msgstr "Opmerking" - -#: ../chirpui/importdialog.py:542 -msgid "Location memory will be imported into" -msgstr "Geheugenplaatsen zullen ook gemporteerd worden naar" - -#: ../chirpui/importdialog.py:543 -msgid "Location of memory in the file being imported" -msgstr "Plaats van het kanaal in het bestand wordt gemporteerd" - -#: ../chirpui/importdialog.py:566 -msgid "Preparing memory list..." -msgstr "Lijst van het kanaal wordt voorbereid..." - -#: ../chirpui/importdialog.py:575 -msgid "Export To File" -msgstr "Exporteren naar bestand" - -#: ../chirpui/importdialog.py:576 ../chirpui/mainapp.py:1197 -msgid "Export" -msgstr "Exporteren" - -#: ../chirpui/mainapp.py:269 ../chirpui/mainapp.py:483 -msgid "Untitled" -msgstr "Naamloos" - -#: ../chirpui/mainapp.py:316 ../chirpui/mainapp.py:715 -msgid "CHIRP Radio Images" -msgstr "CHIRP radio afbeeldingen" - -#: ../chirpui/mainapp.py:317 ../chirpui/mainapp.py:714 -#: ../chirpui/mainapp.py:880 -msgid "CHIRP Files" -msgstr "CHIRP bestanden" - -#: ../chirpui/mainapp.py:318 ../chirpui/mainapp.py:716 -#: ../chirpui/mainapp.py:879 -msgid "CSV Files" -msgstr "Komma gescheiden bestanden" - -#: ../chirpui/mainapp.py:319 ../chirpui/mainapp.py:717 -msgid "ICF Files" -msgstr "ICF bestanden" - -#: ../chirpui/mainapp.py:320 ../chirpui/mainapp.py:718 -msgid "VX7 Commander Files" -msgstr "VX7 Commander bestanden" - -#: ../chirpui/mainapp.py:330 -msgid "" -"ICF files cannot be edited, only displayed or imported into another file. " -"Open in read-only mode?" -msgstr "" -"ICF bestanden kunnen niet worden bewerkt, alleen worden weergegeven of in " -"een ander bestand gemporteerd. Openen in de modus alleen-lezen?" - -#: ../chirpui/mainapp.py:373 -msgid "There was an error opening {fname}: {error}" -msgstr "Er is een fout opgetreden bij het openen van {fname}: {error}" - -#: ../chirpui/mainapp.py:388 -msgid "{num} errors during open:" -msgstr "{num} fouten tijdens het openen:" - -#: ../chirpui/mainapp.py:394 -msgid "Note:" -msgstr "Noot:" - -#: ../chirpui/mainapp.py:395 -msgid "" -"The {vendor} {model} operates in live mode. This means that any " -"changes you make are immediately sent to the radio. Because of this, you " -"cannot perform the Save or Upload operations. If you wish to " -"edit the contents offline, please Export to a CSV file, using the " -"File menu." -msgstr "" -"De {vendor} {model} opereert in de live modus. Dit betekent dat " -"wijzigingen die u aanbrengt onmiddellijk naar de radio verzonden worden. " -"Hierdoor kunt u het niet Opslaan of uploaden . Als u wenst de " -"inhoud off line te bewerken, gelieve exporteren naar een CSV-bestand, " -"met behulp van het menu bestand." - -#: ../chirpui/mainapp.py:404 -msgid "Don't show this again" -msgstr "Deze melding niet opnieuw weergeven" - -#: ../chirpui/mainapp.py:448 -msgid "{vendor} {model} image file" -msgstr "{vendor} {model} afbeeldingsbestand" - -#: ../chirpui/mainapp.py:456 -msgid "VX7 Commander" -msgstr "VX7 Commander" - -#: ../chirpui/mainapp.py:518 -msgid "Open recent file {name}" -msgstr "Recent geopend bestand {name}" - -#: ../chirpui/mainapp.py:579 -msgid "Import stock configuration {name}" -msgstr "Importeren van aanwezige configuratie {name}" - -#: ../chirpui/mainapp.py:595 -msgid "Open stock configuration {name}" -msgstr "Openen van aanwezige configuratie {name}" - -#: ../chirpui/mainapp.py:681 -msgid "Discard Changes?" -msgstr "Wijzigen verwerpen?" - -#: ../chirpui/mainapp.py:686 -msgid "File is modified, save changes before closing?" -msgstr "Het bestand is aangepast. Wilt u de wijzigingen opslaan?" - -#: ../chirpui/mainapp.py:923 -msgid "With significant contributions by:" -msgstr "Met dank aan:" - -#: ../chirpui/mainapp.py:940 -msgid "Select Columns" -msgstr "Kolommen selecteren" - -#: ../chirpui/mainapp.py:955 -msgid "Visible columns for {radio}" -msgstr "Zichtbare kolommen voor {radio}" - -#: ../chirpui/mainapp.py:1012 -msgid "Reporting is disabled" -msgstr "Rapportering is uitgeschakeld" - -#: ../chirpui/mainapp.py:1013 -msgid "" -"The reporting feature of CHIRP is designed to help improve quality by " -"allowing the authors to focus on the radio drivers used most often and " -"errors experienced by the users. The reports contain no identifying " -"information and are used only for statistical purposes by the authors. Your " -"privacy is extremely important, but please consider leaving this feature " -"enabled to help make CHIRP better!\n" -"\n" -"Are you sure you want to disable this feature?" -msgstr "" -"De rapportagefunctie van CHIRP is ontworpen om de kwaliteit te helpen " -"verbeteren door de auteurs toe te staan zich te concentreren op de radio " -"stuurprogramma's die het meest gebruikt worden en fouten ervaren door de " -"gebruikers. De verslagen bevatten geen identificerende informatie en worden " -"alleen voor statistische doeleinden gebruikt door de auteurs. Uw privacy is " -"uiterst belangrijk, maar kunt u overwegen deze functie ingeschakeld te " -"laten om zo te helpen CHIRP beter maken!\n" -"\n" -"Weet u zeker dat u deze functie wilt uitschakelen?" - -#: ../chirpui/mainapp.py:1045 -msgid "" -"Choose a language or Auto to use the operating system default. You will need " -"to restart the application before the change will take effect" -msgstr "" -"Kies een taal of Auto voor het gebruik van het standaard besturingssysteem. " -"U dient de toepassing opnieuw te starten voordat de wijziging wordt " -"doorgevoerd" - -#: ../chirpui/mainapp.py:1169 -msgid "_File" -msgstr "_Bestanden" - -#: ../chirpui/mainapp.py:1172 -msgid "Open stock config" -msgstr "Openen aanwezige configuratie" - -#: ../chirpui/mainapp.py:1173 -msgid "_Recent" -msgstr "_Recent" - -#: ../chirpui/mainapp.py:1178 -msgid "_Edit" -msgstr "Be_werken" - -#: ../chirpui/mainapp.py:1179 -msgid "_Cut" -msgstr "_Knippen" - -#: ../chirpui/mainapp.py:1180 -msgid "_Copy" -msgstr "_Kopiren" - -#: ../chirpui/mainapp.py:1181 -msgid "_Paste" -msgstr "_Plakken" - -#: ../chirpui/mainapp.py:1182 -msgid "_Delete" -msgstr "_Verwijderen" - -#: ../chirpui/mainapp.py:1183 -msgid "Move _Up" -msgstr "Verplaats om_hoog" - -#: ../chirpui/mainapp.py:1184 -msgid "Move Dow_n" -msgstr "Verplaats omlaa_g" - -#: ../chirpui/mainapp.py:1185 -msgid "E_xchange" -msgstr "W_isselen" - -#: ../chirpui/mainapp.py:1186 -msgid "_View" -msgstr "Bee_ld" - -#: ../chirpui/mainapp.py:1187 -msgid "Columns" -msgstr "Kolommen" - -#: ../chirpui/mainapp.py:1188 -msgid "Developer" -msgstr "Ontwerper" - -#: ../chirpui/mainapp.py:1189 -msgid "Show raw memory" -msgstr "Toon ruw geheugen" - -#: ../chirpui/mainapp.py:1190 -msgid "Diff raw memories" -msgstr "Verschil ruwe kanalen" - -#: ../chirpui/mainapp.py:1191 -msgid "Diff tabs" -msgstr "Verschillen van tabs" - -#: ../chirpui/mainapp.py:1192 -msgid "Change language" -msgstr "Taal wijzigen" - -#: ../chirpui/mainapp.py:1193 -msgid "_Radio" -msgstr "_Radio" - -#: ../chirpui/mainapp.py:1194 -msgid "Download From Radio" -msgstr "Download van radio" - -#: ../chirpui/mainapp.py:1195 -msgid "Upload To Radio" -msgstr "Naar radio uploaden" - -#: ../chirpui/mainapp.py:1198 -msgid "Import from RFinder" -msgstr "Importeren uit RFinder" - -#: ../chirpui/mainapp.py:1199 -msgid "CHIRP Native File" -msgstr "CHIRP oorspronkelijk bestand" - -#: ../chirpui/mainapp.py:1200 -msgid "CSV File" -msgstr "Komma gescheiden bestand" - -#: ../chirpui/mainapp.py:1201 -msgid "Import from RepeaterBook" -msgstr "Importeren van RepeaterBook" - -#: ../chirpui/mainapp.py:1202 -msgid "Import from stock config" -msgstr "Importeren van aanwezige configuratie" - -#: ../chirpui/mainapp.py:1204 -msgid "Help" -msgstr "Help" - -#: ../chirpui/mainapp.py:1215 -msgid "Report statistics" -msgstr "Statistieken raporteren" - -#: ../chirpui/mainapp.py:1216 -msgid "Hide Unused Fields" -msgstr "Ongebruikte velden verbergen" - -#: ../chirpui/mainapp.py:1217 -msgid "Automatic Repeater Offset" -msgstr "Automatische repeater offset" - -#: ../chirpui/mainapp.py:1218 -msgid "Enable Developer Functions" -msgstr "Ontwikkelaars functies inschakelen" - -#: ../chirpui/mainapp.py:1352 -msgid "Error reporting is enabled" -msgstr "Foutrapportage is aangezet" - -#: ../chirpui/mainapp.py:1355 -msgid "" -"If you wish to disable this feature you may do so in the Help menu" -msgstr "" -"Als u deze functie wilt uitschakelen, dan kunt u dit doen in het menu " -"Help" - -#: ../chirpui/cloneprog.py:43 -msgid "Clone Progress" -msgstr "Vooruitgang van het klonen" - -#: ../chirpui/cloneprog.py:46 -msgid "Cloning" -msgstr "Klonen" - -#: ../chirpui/cloneprog.py:55 -msgid "Cancel" -msgstr "Annuleren" - -#: ../chirpui/shiftdialog.py:27 -msgid "Shift" -msgstr "Shift" - -#: ../chirpui/shiftdialog.py:63 -msgid "Moving {src} to {dst}" -msgstr "Verplaatsen van {src} naar {dst}" - -#: ../chirpui/shiftdialog.py:80 -msgid "Looking for a free spot ({number})" -msgstr "Zoeken naar een vrije plaats ({number})" - -#: ../chirpui/shiftdialog.py:135 -msgid "Moved {count} memories" -msgstr "{count} kanalen verplaatst" - -#: ../chirpui/clone.py:35 -msgid "{vendor} {model} on {port}" -msgstr "{vendor} {model} op {port}" - -#: ../chirpui/clone.py:100 ../chirpui/clone.py:162 -msgid "Detect" -msgstr "Detecteren" - -#: ../chirpui/clone.py:123 -msgid "Port" -msgstr "Poort" - -#: ../chirpui/clone.py:124 -msgid "Vendor" -msgstr "Merk" - -#: ../chirpui/clone.py:125 -msgid "Model" -msgstr "Model" - -#: ../chirpui/clone.py:138 -msgid "Radio" -msgstr "Radio" - -#: ../chirpui/clone.py:166 -msgid "Unable to detect radio on {port}" -msgstr "Niet in staat om de radio op {port} te detecteren" - -#: ../chirpui/clone.py:178 -msgid "Internal error: Unable to upload to {model}" -msgstr "Interne fout: Niet in staat om te uploaden naar {model}" - -#: ../chirpui/clone.py:226 -msgid "Clone failed: {error}" -msgstr "Klonen mislukt: {error}" - -#: ../chirpui/dstaredit.py:40 -msgid "Callsign" -msgstr "Roepletters" - -#: ../chirpui/dstaredit.py:124 -msgid "Your callsign" -msgstr "Uw roepletters" - -#: ../chirpui/dstaredit.py:132 -msgid "Repeater callsign" -msgstr "Roepletters van de repeater" - -#: ../chirpui/dstaredit.py:140 -msgid "My callsign" -msgstr "Mijn roepletters" - -#: ../chirpui/dstaredit.py:170 ../chirpui/memedit.py:1365 -msgid "Downloading URCALL list" -msgstr "Downloaden van URCALL lijst" - -#: ../chirpui/dstaredit.py:174 ../chirpui/memedit.py:1377 -msgid "Downloading RPTCALL list" -msgstr "Downloaden van RPTCALL lijst" - -#: ../chirpui/dstaredit.py:178 -msgid "Downloading MYCALL list" -msgstr "Downloaden van MYCALL lijst" - -#: ../chirpui/editorset.py:87 -msgid "Memories" -msgstr "Kanalen" - -#: ../chirpui/editorset.py:92 -msgid "D-STAR" -msgstr "D-STAR" - -#: ../chirpui/editorset.py:98 -msgid "Bank Names" -msgstr "Banknamen" - -#: ../chirpui/editorset.py:104 -msgid "Banks" -msgstr "Banken" - -#: ../chirpui/editorset.py:222 -msgid "The {vendor} {model} has multiple independent sub-devices" -msgstr "De {vendor} {model} heeft meerdere onafhankelijke sub-apparaten" - -#: ../chirpui/editorset.py:225 -msgid "Choose one to import from:" -msgstr "Kies n om vanuit te importeren:" - -#: ../chirpui/editorset.py:230 -msgid "Cancelled" -msgstr "Geannuleerd" - -#: ../chirpui/editorset.py:235 -msgid "Internal Error" -msgstr "Interne fout" - -#: ../chirpui/editorset.py:248 -msgid "" -"There were errors while opening {file}. The affected memories will not be " -"importable!" -msgstr "" -"Er zijn fouten opgetreden tijdens het openen van {file}. De getroffen " -"kanalen zijn niet importeerbaar!" - -#: ../chirpui/editorset.py:260 -msgid "There was an error during import: {error}" -msgstr "Er is een fout ontstaan tijdens het importeren: {error}" - -#: ../chirpui/editorset.py:270 -msgid "Unsupported file type" -msgstr "Niet-ondersteunende bestandstype" - -#: ../chirpui/editorset.py:286 ../chirpui/editorset.py:301 -msgid "There was an error during export: {error}" -msgstr "Er is een fout opgetreden tijdens het exporteren: {error}" - -#: ../chirpui/editorset.py:313 -msgid "Priming memory" -msgstr "Voorbereiden van geheugen" - -#: ../chirpui/memedit.py:52 -msgid "Invalid value for this field" -msgstr "Ongeldige waarde voor dit veld" - -#: ../chirpui/memedit.py:66 ../chirpui/memedit.py:97 ../chirpui/memedit.py:111 -#: ../chirpui/memedit.py:204 ../chirpui/memedit.py:312 -#: ../chirpui/memedit.py:874 ../chirpui/memedit.py:931 -#: ../chirpui/memedit.py:1069 ../chirpui/memedit.py:1133 -msgid "Tone Mode" -msgstr "Toonmodus" - -#: ../chirpui/memedit.py:67 ../chirpui/memedit.py:87 ../chirpui/memedit.py:103 -#: ../chirpui/memedit.py:214 ../chirpui/memedit.py:218 -#: ../chirpui/memedit.py:220 ../chirpui/memedit.py:310 -#: ../chirpui/memedit.py:875 ../chirpui/memedit.py:928 -#: ../chirpui/memedit.py:1070 -msgid "Tone" -msgstr "Toon" - -#: ../chirpui/memedit.py:68 ../chirpui/memedit.py:88 ../chirpui/memedit.py:104 -#: ../chirpui/memedit.py:210 ../chirpui/memedit.py:218 -#: ../chirpui/memedit.py:221 ../chirpui/memedit.py:310 -#: ../chirpui/memedit.py:876 ../chirpui/memedit.py:929 -#: ../chirpui/memedit.py:1066 -msgid "ToneSql" -msgstr "Toon squelch" - -#: ../chirpui/memedit.py:69 ../chirpui/memedit.py:89 ../chirpui/memedit.py:105 -#: ../chirpui/memedit.py:211 ../chirpui/memedit.py:215 -#: ../chirpui/memedit.py:222 ../chirpui/memedit.py:306 -#: ../chirpui/memedit.py:877 ../chirpui/memedit.py:930 -#: ../chirpui/memedit.py:1059 -msgid "DTCS Code" -msgstr "DTCS code" - -#: ../chirpui/memedit.py:70 ../chirpui/memedit.py:90 ../chirpui/memedit.py:106 -#: ../chirpui/memedit.py:212 ../chirpui/memedit.py:216 -#: ../chirpui/memedit.py:223 ../chirpui/memedit.py:878 -#: ../chirpui/memedit.py:933 ../chirpui/memedit.py:1060 -msgid "DTCS Pol" -msgstr "DTCS Pol" - -#: ../chirpui/memedit.py:71 ../chirpui/memedit.py:91 ../chirpui/memedit.py:112 -#: ../chirpui/memedit.py:879 ../chirpui/memedit.py:932 -#: ../chirpui/memedit.py:1067 ../chirpui/memedit.py:1134 -msgid "Cross Mode" -msgstr "Cross-mode" - -#: ../chirpui/memedit.py:72 ../chirpui/memedit.py:92 ../chirpui/memedit.py:109 -#: ../chirpui/memedit.py:137 ../chirpui/memedit.py:205 -#: ../chirpui/memedit.py:249 ../chirpui/memedit.py:312 -#: ../chirpui/memedit.py:880 ../chirpui/memedit.py:934 -#: ../chirpui/memedit.py:1071 ../chirpui/memedit.py:1144 -msgid "Duplex" -msgstr "Duplex" - -#: ../chirpui/memedit.py:73 ../chirpui/memedit.py:93 ../chirpui/memedit.py:135 -#: ../chirpui/memedit.py:198 ../chirpui/memedit.py:226 -#: ../chirpui/memedit.py:250 ../chirpui/memedit.py:308 -#: ../chirpui/memedit.py:881 ../chirpui/memedit.py:935 -#: ../chirpui/memedit.py:1062 -msgid "Offset" -msgstr "Offset" - -#: ../chirpui/memedit.py:74 ../chirpui/memedit.py:94 ../chirpui/memedit.py:107 -#: ../chirpui/memedit.py:882 ../chirpui/memedit.py:936 -#: ../chirpui/memedit.py:1061 ../chirpui/memedit.py:1132 -#: ../chirpui/memedit.py:1289 ../chirpui/memedit.py:1307 -#: ../chirpui/memedit.py:1317 -msgid "Mode" -msgstr "Mode" - -#: ../chirpui/memedit.py:75 ../chirpui/memedit.py:95 ../chirpui/memedit.py:108 -#: ../chirpui/memedit.py:296 ../chirpui/memedit.py:883 -#: ../chirpui/memedit.py:937 ../chirpui/memedit.py:1073 -#: ../chirpui/memedit.py:1136 ../chirpui/memedit.py:1140 -msgid "Power" -msgstr "Vermogen" - -#: ../chirpui/memedit.py:76 ../chirpui/memedit.py:96 ../chirpui/memedit.py:110 -#: ../chirpui/memedit.py:140 ../chirpui/memedit.py:143 -#: ../chirpui/memedit.py:884 ../chirpui/memedit.py:938 -#: ../chirpui/memedit.py:1064 -msgid "Tune Step" -msgstr "Kanaal-afstand" - -#: ../chirpui/memedit.py:77 ../chirpui/memedit.py:98 ../chirpui/memedit.py:885 -#: ../chirpui/memedit.py:939 ../chirpui/memedit.py:1072 -#: ../chirpui/memedit.py:1135 -msgid "Skip" -msgstr "Overslaan" - -#: ../chirpui/memedit.py:175 -msgid "Erasing memory {loc}" -msgstr "Wis kanaal {loc}" - -#: ../chirpui/memedit.py:236 -msgid "Unable to make changes to this model" -msgstr "Niet in staat om wijzigingen voor dit model te maken" - -#: ../chirpui/memedit.py:241 -msgid "Editing new item, taking defaults" -msgstr "Bewerken van een nieuw item. Standaardwaarden worden genomen" - -#: ../chirpui/memedit.py:257 -msgid "Bad value for {col}: {val}" -msgstr "Foute waarde voor {col}: {val}" - -#: ../chirpui/memedit.py:281 -msgid "Error setting memory" -msgstr "Fout bij het instellen van het geheugen" - -#: ../chirpui/memedit.py:289 ../chirpui/memedit.py:356 -#: ../chirpui/memedit.py:1272 -msgid "Writing memory {number}" -msgstr "Schrijven kanaal {number}" - -#: ../chirpui/memedit.py:361 -msgid "" -"This operation requires moving all subsequent channels by one spot until an " -"empty location is reached. This can take a LONG time. Are you sure you " -"want to do this?" -msgstr "" -"Deze bewerking vereist het verplaatsen van alle volgende kanalen totdat een " -"lege locatie is bereikt. Dit kan een lange tijd duren. Weet u zeker dat u " -"dit wilt doen?" - -#: ../chirpui/memedit.py:387 -msgid "Adding memory {number}" -msgstr "Kanaal toevoegen {number}" - -#: ../chirpui/memedit.py:400 ../chirpui/memedit.py:913 -msgid "Erasing memory {number}" -msgstr "Wis kanaal {number}" - -#: ../chirpui/memedit.py:409 ../chirpui/memedit.py:518 -#: ../chirpui/memedit.py:564 ../chirpui/memedit.py:569 -#: ../chirpui/memedit.py:856 ../chirpui/memedit.py:1166 -msgid "Getting memory {number}" -msgstr "Ophalen kanaal {number}" - -#: ../chirpui/memedit.py:497 ../chirpui/memedit.py:508 -#: ../chirpui/memedit.py:556 -msgid "Moving memory from {old} to {new}" -msgstr "Verplaats kanaal van {old} naar {new}" - -#: ../chirpui/memedit.py:578 -msgid "Raw memory {number}" -msgstr "Ruw kanaal {number}" - -#: ../chirpui/memedit.py:582 ../chirpui/memedit.py:610 -#: ../chirpui/memedit.py:615 -msgid "Getting raw memory {number}" -msgstr "Ophalen van onbewerkt kanaal {number}" - -#: ../chirpui/memedit.py:587 -msgid "You can only diff two memories!" -msgstr "U kunt maar van 2 kanalen de verschillen zien" - -#: ../chirpui/memedit.py:598 -msgid "Memory {number}" -msgstr "Kanaal {number}" - -#: ../chirpui/memedit.py:604 -msgid "Diff of {a} and {b}" -msgstr "Verschil tussen {a} en {b}" - -#: ../chirpui/memedit.py:628 -msgid "Memories must be contiguous" -msgstr "De kanalen moeten aangrenzend zijn" - -#: ../chirpui/memedit.py:700 -msgid "Insert row above" -msgstr "Regel hierboven invoegen" - -#: ../chirpui/memedit.py:701 -msgid "Insert row below" -msgstr "Regel hieronder invoegen" - -#: ../chirpui/memedit.py:702 -msgid "Delete" -msgstr "Verwijderen" - -#: ../chirpui/memedit.py:702 -msgid "Delete all" -msgstr "Alles verwijderen" - -#: ../chirpui/memedit.py:703 -msgid "Delete (and shift up)" -msgstr "Verwijderen (en naar boven verplaatsen)" - -#: ../chirpui/memedit.py:704 -msgid "Move up" -msgstr "Verplaats omhoog" - -#: ../chirpui/memedit.py:705 -msgid "Move down" -msgstr "Verplaats omlaag" - -#: ../chirpui/memedit.py:706 -msgid "Exchange memories" -msgstr "Kanalen wisselen" - -#: ../chirpui/memedit.py:707 -msgid "Cut" -msgstr "Knippen" - -#: ../chirpui/memedit.py:708 -msgid "Copy" -msgstr "Kopiëren" - -#: ../chirpui/memedit.py:709 -msgid "Paste" -msgstr "Plakken" - -#: ../chirpui/memedit.py:710 -msgid "Show Raw Memory" -msgstr "Toon ruw kanaal" - -#: ../chirpui/memedit.py:711 -msgid "Diff Raw Memories" -msgstr "Verschillen ruwe kanalen" - -#: ../chirpui/memedit.py:835 -msgid "Internal Error: Column {name} not found" -msgstr "Interne fout: Kolom {name} niet gevonden" - -#: ../chirpui/memedit.py:863 -msgid "Getting channel {chan}" -msgstr "Ophalen kanaal {chan}" - -# You are missing the last bracket -#: ../chirpui/memedit.py:952 -msgid "Internal Error: Invalid limit {number}" -msgstr "Interne fout: Ongeldige limiet {number}" - -#: ../chirpui/memedit.py:962 -msgid "Memory range:" -msgstr "Geheugenbereik:" - -#: ../chirpui/memedit.py:989 -msgid "Go" -msgstr "Ga" - -#: ../chirpui/memedit.py:1012 -msgid "Special Channels" -msgstr "Speciale kanalen" - -#: ../chirpui/memedit.py:1019 -msgid "Show Empty" -msgstr "Lege tonen" - -#: ../chirpui/memedit.py:1198 -msgid "Cutting memory {number}" -msgstr "Knippen kanaal {number}" - -#: ../chirpui/memedit.py:1232 -msgid "Overwrite?" -msgstr "Overschrijven?" - -#: ../chirpui/memedit.py:1237 -msgid "Overwrite location {number}?" -msgstr "Plaats {number} overschrijven?" - -#: ../chirpui/memedit.py:1254 -msgid "Incompatible Memory" -msgstr "Onverenigbaar kanaal" - -#: ../chirpui/memedit.py:1257 -msgid "Pasted memory {number} is not compatible with this radio because:" -msgstr "Geplakt kanaal {number} is niet compatibel met deze radio omdat:" - -#: ../chirpui/memedit.py:1309 ../chirpui/memedit.py:1324 -msgid "URCALL" -msgstr "URCALL" - -#: ../chirpui/memedit.py:1309 ../chirpui/memedit.py:1325 -msgid "RPT1CALL" -msgstr "RPT1CALL" - -#: ../chirpui/memedit.py:1309 ../chirpui/memedit.py:1326 -msgid "RPT2CALL" -msgstr "RPT2CALL" - -#: ../chirpui/memedit.py:1310 ../chirpui/memedit.py:1327 -msgid "Digital Code" -msgstr "Digitale code" diff --git a/locale/pl.po b/locale/pl.po deleted file mode 100644 index 2e19afc..0000000 --- a/locale/pl.po +++ /dev/null @@ -1,987 +0,0 @@ -# Polish translations for CHIRP package. -# Copyright (C) 2011 Dan Smith -# This file is distributed under the same license as the CHIRP package. -# Dan Smith , 2011. -# -msgid "" -msgstr "" -"Project-Id-Version: CHIRP\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2012-02-16 12:06-0800\n" -"PO-Revision-Date: 2011-12-07 11:35+0100\n" -"Last-Translator: Grzegorz Błoński-Kubiak \n" -"Language-Team: Polish\n" -"Language: pl\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=utf-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 " -"|| n%100>=20) ? 1 : 2);\n" - -#: ../chirpui/common.py:204 -msgid "Completed" -msgstr "Ukończono pomyślnie" - -#: ../chirpui/common.py:205 -msgid "idle" -msgstr "bezczynny" - -#: ../chirpui/bankedit.py:52 -#, fuzzy -msgid "Retrieving bank information" -msgstr "Pobieranie listy banków pamięci" - -#: ../chirpui/bankedit.py:75 -#, fuzzy -msgid "Setting name on bank" -msgstr "Pobieranie listy banków pamięci" - -#: ../chirpui/bankedit.py:85 -msgid "Bank" -msgstr "Bank" - -#: ../chirpui/bankedit.py:86 ../chirpui/bankedit.py:240 -#: ../chirpui/importdialog.py:536 ../chirpui/memedit.py:65 -#: ../chirpui/memedit.py:85 ../chirpui/memedit.py:247 -#: ../chirpui/memedit.py:872 ../chirpui/memedit.py:926 -#: ../chirpui/memedit.py:1063 ../chirpui/memedit.py:1065 -msgid "Name" -msgstr "Nazwa" - -#: ../chirpui/bankedit.py:185 -#, fuzzy -msgid "Updating bank index for memory {num}" -msgstr "Pobieranie surowej pamięci {num}" - -#: ../chirpui/bankedit.py:194 -msgid "Updating bank information for memory {num}" -msgstr "" - -#: ../chirpui/bankedit.py:200 ../chirpui/bankedit.py:229 -#, fuzzy -msgid "Getting memory {num}" -msgstr "Pobieranie pamięci {num}" - -#: ../chirpui/bankedit.py:214 -#, fuzzy -msgid "Setting index for memory {num}" -msgstr "Pobieranie pamięci {num}" - -#: ../chirpui/bankedit.py:223 -#, fuzzy -msgid "Getting bank for memory {num}" -msgstr "Pobieranie surowej pamięci {num}" - -#: ../chirpui/bankedit.py:238 ../chirpui/memedit.py:63 -#: ../chirpui/memedit.py:172 ../chirpui/memedit.py:246 -#: ../chirpui/memedit.py:315 ../chirpui/memedit.py:335 -#: ../chirpui/memedit.py:349 ../chirpui/memedit.py:423 -#: ../chirpui/memedit.py:435 ../chirpui/memedit.py:459 -#: ../chirpui/memedit.py:461 ../chirpui/memedit.py:534 -#: ../chirpui/memedit.py:548 ../chirpui/memedit.py:550 -#: ../chirpui/memedit.py:591 ../chirpui/memedit.py:593 -#: ../chirpui/memedit.py:621 ../chirpui/memedit.py:822 -#: ../chirpui/memedit.py:870 ../chirpui/memedit.py:895 -#: ../chirpui/memedit.py:907 ../chirpui/memedit.py:924 -#: ../chirpui/memedit.py:1230 -msgid "Loc" -msgstr "Lp." - -#: ../chirpui/bankedit.py:239 ../chirpui/importdialog.py:537 -#: ../chirpui/memedit.py:64 ../chirpui/memedit.py:86 ../chirpui/memedit.py:187 -#: ../chirpui/memedit.py:248 ../chirpui/memedit.py:271 -#: ../chirpui/memedit.py:296 ../chirpui/memedit.py:304 -#: ../chirpui/memedit.py:873 ../chirpui/memedit.py:923 -msgid "Frequency" -msgstr "Częstotliwość" - -#: ../chirpui/bankedit.py:241 -#, fuzzy -msgid "Index" -msgstr "Indeks banków" - -#: ../chirpui/bankedit.py:302 -#, fuzzy -msgid "Getting bank information for memory {num}" -msgstr "Pobieranie surowej pamięci {num}" - -#: ../chirpui/bankedit.py:323 -#, fuzzy -msgid "Getting bank information" -msgstr "Pobieranie listy banków pamięci" - -#: ../chirpui/inputdialog.py:81 -msgid "An error has occurred" -msgstr "Wystąpił błąd" - -#: ../chirpui/inputdialog.py:130 -#, fuzzy -msgid "Overwrite" -msgstr "Nadpisać ?" - -#: ../chirpui/inputdialog.py:133 -msgid "File Exists" -msgstr "Plik już istnieje" - -#: ../chirpui/inputdialog.py:136 -msgid "The file {name} already exists. Do you want to overwrite it?" -msgstr "Plik {name} istneje.Czy chcesz nadpisać?" - -#: ../chirpui/importdialog.py:90 -msgid "" -"Location {number} is already being imported. Choose another value for 'New " -"Location' before selection 'Import'" -msgstr "Lokalizacja {number} jest zaimportowana.Wybierz inna lokalizację." - -#: ../chirpui/importdialog.py:121 -msgid "Invalid value. Must be an integer." -msgstr "Błąd.Wartość musi być liczbą." - -#: ../chirpui/importdialog.py:130 -msgid "Location {number} is already being imported" -msgstr "Lokalizacja {number} jest zaimportowana." - -#: ../chirpui/importdialog.py:182 -#, fuzzy -msgid "Updating URCALL list" -msgstr "Pobieranie listy URCALL" - -#: ../chirpui/importdialog.py:187 -#, fuzzy -msgid "Updating RPTCALL list" -msgstr "Pobieranie listy RPTCALL" - -#: ../chirpui/importdialog.py:256 -#, fuzzy -msgid "Setting memory {number}" -msgstr "Pobieranie pamięci {number}" - -#: ../chirpui/importdialog.py:260 -msgid "Importing bank information" -msgstr "" - -#: ../chirpui/importdialog.py:264 -#, fuzzy -msgid "Error importing memories:" -msgstr "Błąd ustawiania pamięci" - -#: ../chirpui/importdialog.py:376 -msgid "All" -msgstr "Wszystkie" - -#: ../chirpui/importdialog.py:382 -msgid "None" -msgstr " Żaden" - -#: ../chirpui/importdialog.py:388 -msgid "Inverse" -msgstr "odwrotność" - -#: ../chirpui/importdialog.py:394 -#, fuzzy -msgid "Select" -msgstr "Wybierz kolumny" - -#: ../chirpui/importdialog.py:416 -msgid "Auto" -msgstr "Auto" - -#: ../chirpui/importdialog.py:422 -msgid "Reverse" -msgstr "Odwrotny" - -#: ../chirpui/importdialog.py:428 -msgid "Adjust New Location" -msgstr "Dostosuj nową lokalizację" - -#: ../chirpui/importdialog.py:438 -msgid "Confirm overwrites" -msgstr "Potwierdź nadpisanie" - -#: ../chirpui/importdialog.py:444 -msgid "Options" -msgstr "Opcje" - -#: ../chirpui/importdialog.py:495 -msgid "Cannot be imported because" -msgstr "" - -#: ../chirpui/importdialog.py:513 -#, fuzzy -msgid "Import From File" -msgstr "Importuj z RFinder" - -#: ../chirpui/importdialog.py:514 ../chirpui/mainapp.py:1196 -msgid "Import" -msgstr "Importuj" - -#: ../chirpui/importdialog.py:534 -#, fuzzy -msgid "To" -msgstr "Ton" - -#: ../chirpui/importdialog.py:535 -msgid "From" -msgstr "" - -#: ../chirpui/importdialog.py:538 ../chirpui/memedit.py:78 -#: ../chirpui/memedit.py:99 ../chirpui/memedit.py:886 -#: ../chirpui/memedit.py:940 ../chirpui/memedit.py:1068 -msgid "Comment" -msgstr "" - -#: ../chirpui/importdialog.py:542 -#, fuzzy -msgid "Location memory will be imported into" -msgstr "Lokalizacja {number} jest zaimportowana." - -#: ../chirpui/importdialog.py:543 -#, fuzzy -msgid "Location of memory in the file being imported" -msgstr "Lokalizacja {number} jest zaimportowana." - -#: ../chirpui/importdialog.py:566 -#, fuzzy -msgid "Preparing memory list..." -msgstr "Kasowanie pamięci {loc}" - -#: ../chirpui/importdialog.py:575 -#, fuzzy -msgid "Export To File" -msgstr "Importuj z RFinder" - -#: ../chirpui/importdialog.py:576 ../chirpui/mainapp.py:1197 -msgid "Export" -msgstr "Eksportuj" - -#: ../chirpui/mainapp.py:269 ../chirpui/mainapp.py:483 -msgid "Untitled" -msgstr "Bez nazwy" - -#: ../chirpui/mainapp.py:316 ../chirpui/mainapp.py:715 -msgid "CHIRP Radio Images" -msgstr "Zrzuty z urządzeń CHIRP" - -#: ../chirpui/mainapp.py:317 ../chirpui/mainapp.py:714 -#: ../chirpui/mainapp.py:880 -msgid "CHIRP Files" -msgstr "Pliki CHIRP" - -#: ../chirpui/mainapp.py:318 ../chirpui/mainapp.py:716 -#: ../chirpui/mainapp.py:879 -msgid "CSV Files" -msgstr "Pliki CSV" - -#: ../chirpui/mainapp.py:319 ../chirpui/mainapp.py:717 -msgid "ICF Files" -msgstr "Pliki ICF" - -#: ../chirpui/mainapp.py:320 ../chirpui/mainapp.py:718 -msgid "VX7 Commander Files" -msgstr "Pliki VX7 Commander " - -#: ../chirpui/mainapp.py:330 -msgid "" -"ICF files cannot be edited, only displayed or imported into another file. " -"Open in read-only mode?" -msgstr "" -"Plik ICF nie może być edytowany, może być wyświetlany oraz importowany do " -"innego pliku.Otworzyć w trybie do odczytu?" - -#: ../chirpui/mainapp.py:373 -msgid "There was an error opening {fname}: {error}" -msgstr "Wystąpił błąd podczas otwierania {fname}: {error}" - -#: ../chirpui/mainapp.py:388 -msgid "{num} errors during open:" -msgstr "" - -#: ../chirpui/mainapp.py:394 -msgid "Note:" -msgstr "Uwaga:" - -#: ../chirpui/mainapp.py:395 -msgid "" -"The {vendor} {model} operates in live mode. This means that any " -"changes you make are immediately sent to the radio. Because of this, you " -"cannot perform the Save or Upload operations. If you wish to " -"edit the contents offline, please Export to a CSV file, using the " -"File menu." -msgstr "" -"Urządzenie {vendor} {model} pracuje w trybie na żywo. To oznacza, że " -"każda zmiana zostaje natychmiast wysłana do urządzenia. Z tego powodu nie " -"możesz wykonać akcji Zapisz lub Wyślij.Jeśli chcesz edytować " -"zwartość w trybie bez połączenia użyj polecenia Eksportuj do pliku " -"CSV korzystając z menu Plik." - -#: ../chirpui/mainapp.py:404 -msgid "Don't show this again" -msgstr "Nie pokazuj tego więcej" - -#: ../chirpui/mainapp.py:448 -msgid "{vendor} {model} image file" -msgstr "{vendor} {model} plik zrzutu" - -#: ../chirpui/mainapp.py:456 -msgid "VX7 Commander" -msgstr "VX7 Commander" - -#: ../chirpui/mainapp.py:518 -msgid "Open recent file {name}" -msgstr "Otwórz poprzednio otwarty plik {name}" - -#: ../chirpui/mainapp.py:579 -msgid "Import stock configuration {name}" -msgstr "" - -#: ../chirpui/mainapp.py:595 -msgid "Open stock configuration {name}" -msgstr "" - -#: ../chirpui/mainapp.py:681 -msgid "Discard Changes?" -msgstr "Anulować zmiany?" - -#: ../chirpui/mainapp.py:686 -msgid "File is modified, save changes before closing?" -msgstr "Plik został zmodyfikowany, zapisać przed zakończeniem?" - -#: ../chirpui/mainapp.py:923 -msgid "With significant contributions by:" -msgstr "" - -#: ../chirpui/mainapp.py:940 -msgid "Select Columns" -msgstr "Wybierz kolumny" - -#: ../chirpui/mainapp.py:955 -msgid "Visible columns for {radio}" -msgstr "Widoczne kolumny dla {radio}" - -#: ../chirpui/mainapp.py:1012 -msgid "Reporting is disabled" -msgstr "Raportowanie jest wyłączone" - -#: ../chirpui/mainapp.py:1013 -msgid "" -"The reporting feature of CHIRP is designed to help improve quality by " -"allowing the authors to focus on the radio drivers used most often and " -"errors experienced by the users. The reports contain no identifying " -"information and are used only for statistical purposes by the authors. Your " -"privacy is extremely important, but please consider leaving this feature " -"enabled to help make CHIRP better!\n" -"\n" -"Are you sure you want to disable this feature?" -msgstr "" -"Funkcja raportowanie programu CHIRP została zaprojektowana by pomóc " -"podnosić jakość dając autorom możliwość skupienia się na sterownikach " -"urządzeń najczęściej używanych i błędach które napotykają użytkowników." -"Raporty nie zawierają danych identyfikujących użytkownika i są " -"wykorzystywane tylko w celach statystycznych przez autorów.Twoja prywatność " -"jest najważniejsza , lecz rozważ pozostawienie tej funkcji włączonej by " -"pomóc ulepszać oprogramowanie CHIRP!" - -#: ../chirpui/mainapp.py:1045 -msgid "" -"Choose a language or Auto to use the operating system default. You will need " -"to restart the application before the change will take effect" -msgstr "" - -#: ../chirpui/mainapp.py:1169 -msgid "_File" -msgstr "_Plik" - -#: ../chirpui/mainapp.py:1172 -msgid "Open stock config" -msgstr "" - -#: ../chirpui/mainapp.py:1173 -msgid "_Recent" -msgstr "_Niedawny" - -#: ../chirpui/mainapp.py:1178 -msgid "_Edit" -msgstr "_Edycja" - -#: ../chirpui/mainapp.py:1179 -msgid "_Cut" -msgstr "_Wytnij" - -#: ../chirpui/mainapp.py:1180 -msgid "_Copy" -msgstr "_Kopiuj" - -#: ../chirpui/mainapp.py:1181 -msgid "_Paste" -msgstr "_Wklej" - -#: ../chirpui/mainapp.py:1182 -msgid "_Delete" -msgstr "_Usuń" - -#: ../chirpui/mainapp.py:1183 -msgid "Move _Up" -msgstr "W górę" - -#: ../chirpui/mainapp.py:1184 -#, fuzzy -msgid "Move Dow_n" -msgstr "W dół" - -#: ../chirpui/mainapp.py:1185 -msgid "E_xchange" -msgstr "Zamień" - -#: ../chirpui/mainapp.py:1186 -msgid "_View" -msgstr "_Podgląd" - -#: ../chirpui/mainapp.py:1187 -msgid "Columns" -msgstr "Kolumny" - -#: ../chirpui/mainapp.py:1188 -msgid "Developer" -msgstr "Deweloper" - -#: ../chirpui/mainapp.py:1189 -msgid "Show raw memory" -msgstr "Pokaż surową pamięć" - -#: ../chirpui/mainapp.py:1190 -msgid "Diff raw memories" -msgstr "Porównaj surowe pamięci" - -#: ../chirpui/mainapp.py:1191 -msgid "Diff tabs" -msgstr "" - -#: ../chirpui/mainapp.py:1192 -msgid "Change language" -msgstr "" - -#: ../chirpui/mainapp.py:1193 -msgid "_Radio" -msgstr "_Urządzenie" - -#: ../chirpui/mainapp.py:1194 -msgid "Download From Radio" -msgstr "Pobierz z urządzenia" - -#: ../chirpui/mainapp.py:1195 -msgid "Upload To Radio" -msgstr "Wyślij do urządzenia" - -#: ../chirpui/mainapp.py:1198 -msgid "Import from RFinder" -msgstr "Importuj z RFinder" - -#: ../chirpui/mainapp.py:1199 -msgid "CHIRP Native File" -msgstr "Natywny plik CHIRP" - -#: ../chirpui/mainapp.py:1200 -msgid "CSV File" -msgstr "Plik CSV" - -#: ../chirpui/mainapp.py:1201 -msgid "Import from RepeaterBook" -msgstr "Importuj z RepeaterBook" - -#: ../chirpui/mainapp.py:1202 -#, fuzzy -msgid "Import from stock config" -msgstr "Importuj z RepeaterBook" - -#: ../chirpui/mainapp.py:1204 -msgid "Help" -msgstr "Pomoc" - -#: ../chirpui/mainapp.py:1215 -msgid "Report statistics" -msgstr "Raport statystyk" - -#: ../chirpui/mainapp.py:1216 -msgid "Hide Unused Fields" -msgstr "Ukryj nieużywane pola" - -#: ../chirpui/mainapp.py:1217 -msgid "Automatic Repeater Offset" -msgstr "Automatyczny offset repeatera" - -#: ../chirpui/mainapp.py:1218 -msgid "Enable Developer Functions" -msgstr "Włącz funkcje deweloperskie" - -#: ../chirpui/mainapp.py:1352 -msgid "Error reporting is enabled" -msgstr "Raportowanie błędów jest włączone" - -#: ../chirpui/mainapp.py:1355 -msgid "" -"If you wish to disable this feature you may do so in the Help menu" -msgstr "Jeśli chcesz wyłączyć tą funkcję możesz to zrobić w menu Pomoc" - -#: ../chirpui/cloneprog.py:43 -msgid "Clone Progress" -msgstr "Postęp klonowania" - -#: ../chirpui/cloneprog.py:46 -msgid "Cloning" -msgstr "Klonowanie" - -#: ../chirpui/cloneprog.py:55 -msgid "Cancel" -msgstr "Anuluj" - -#: ../chirpui/shiftdialog.py:27 -msgid "Shift" -msgstr "Przełącz" - -#: ../chirpui/shiftdialog.py:63 -msgid "Moving {src} to {dst}" -msgstr "Przenoszę {src} do {dst}" - -#: ../chirpui/shiftdialog.py:80 -msgid "Looking for a free spot ({number})" -msgstr "Szukaj wolnego miejsca ({number})" - -#: ../chirpui/shiftdialog.py:135 -msgid "Moved {count} memories" -msgstr "Przeniesiono {count} pamięci" - -#: ../chirpui/clone.py:35 -#, fuzzy -msgid "{vendor} {model} on {port}" -msgstr "{vendor} {model} plik zrzutu" - -#: ../chirpui/clone.py:100 ../chirpui/clone.py:162 -msgid "Detect" -msgstr "Wykryj" - -#: ../chirpui/clone.py:123 -msgid "Port" -msgstr "Port" - -#: ../chirpui/clone.py:124 -msgid "Vendor" -msgstr "Producent" - -#: ../chirpui/clone.py:125 -#, fuzzy -msgid "Model" -msgstr "Tryb" - -#: ../chirpui/clone.py:138 -#, fuzzy -msgid "Radio" -msgstr "_Urządzenie" - -#: ../chirpui/clone.py:166 -msgid "Unable to detect radio on {port}" -msgstr "Nie mogę wykryć urządzenia na porcie {port}" - -#: ../chirpui/clone.py:178 -#, fuzzy -msgid "Internal error: Unable to upload to {model}" -msgstr "Błąd wewnętrzny: Niewłaściwy limit {number}" - -#: ../chirpui/clone.py:226 -msgid "Clone failed: {error}" -msgstr "Klonowanie nieudane: {error}" - -#: ../chirpui/dstaredit.py:40 -msgid "Callsign" -msgstr "Znak wywoławczy" - -#: ../chirpui/dstaredit.py:124 -msgid "Your callsign" -msgstr "Znak wywoławczy korespondenta" - -#: ../chirpui/dstaredit.py:132 -msgid "Repeater callsign" -msgstr "Znak wywoławczy repeatera" - -#: ../chirpui/dstaredit.py:140 -msgid "My callsign" -msgstr "Mój znak wywoławczy" - -#: ../chirpui/dstaredit.py:170 ../chirpui/memedit.py:1365 -msgid "Downloading URCALL list" -msgstr "Pobieranie listy URCALL" - -#: ../chirpui/dstaredit.py:174 ../chirpui/memedit.py:1377 -msgid "Downloading RPTCALL list" -msgstr "Pobieranie listy RPTCALL" - -#: ../chirpui/dstaredit.py:178 -#, fuzzy -msgid "Downloading MYCALL list" -msgstr "Pobieranie listy URCALL" - -#: ../chirpui/editorset.py:87 -#, fuzzy -msgid "Memories" -msgstr "Porównaj surowe pamięci" - -#: ../chirpui/editorset.py:92 -msgid "D-STAR" -msgstr "D-STAR" - -#: ../chirpui/editorset.py:98 -#, fuzzy -msgid "Bank Names" -msgstr "Bank" - -#: ../chirpui/editorset.py:104 -#, fuzzy -msgid "Banks" -msgstr "Bank" - -#: ../chirpui/editorset.py:222 -msgid "The {vendor} {model} has multiple independent sub-devices" -msgstr "{vendor} {model} posiada kilka niezależnych urządzeń wbudowanych" - -#: ../chirpui/editorset.py:225 -msgid "Choose one to import from:" -msgstr "Wybierz do zaimportowania:" - -#: ../chirpui/editorset.py:230 -msgid "Cancelled" -msgstr "Anulowano" - -#: ../chirpui/editorset.py:235 -msgid "Internal Error" -msgstr "Błąd wewnętrzny" - -#: ../chirpui/editorset.py:248 -msgid "" -"There were errors while opening {file}. The affected memories will not be " -"importable!" -msgstr "" - -#: ../chirpui/editorset.py:260 -#, fuzzy -msgid "There was an error during import: {error}" -msgstr "Wystąpił błąd podczas otwierania {fname}: {error}" - -#: ../chirpui/editorset.py:270 -msgid "Unsupported file type" -msgstr "Nieobsługiwany typ pliku" - -#: ../chirpui/editorset.py:286 ../chirpui/editorset.py:301 -#, fuzzy -msgid "There was an error during export: {error}" -msgstr "Wystąpił błąd podczas otwierania {fname}: {error}" - -#: ../chirpui/editorset.py:313 -#, fuzzy -msgid "Priming memory" -msgstr "Zapisywanie pamięci {number}" - -#: ../chirpui/memedit.py:52 -msgid "Invalid value for this field" -msgstr "Niewłaściwa wartość" - -#: ../chirpui/memedit.py:66 ../chirpui/memedit.py:97 ../chirpui/memedit.py:111 -#: ../chirpui/memedit.py:204 ../chirpui/memedit.py:312 -#: ../chirpui/memedit.py:874 ../chirpui/memedit.py:931 -#: ../chirpui/memedit.py:1069 ../chirpui/memedit.py:1133 -msgid "Tone Mode" -msgstr "Tryb tonu" - -#: ../chirpui/memedit.py:67 ../chirpui/memedit.py:87 ../chirpui/memedit.py:103 -#: ../chirpui/memedit.py:214 ../chirpui/memedit.py:218 -#: ../chirpui/memedit.py:220 ../chirpui/memedit.py:310 -#: ../chirpui/memedit.py:875 ../chirpui/memedit.py:928 -#: ../chirpui/memedit.py:1070 -msgid "Tone" -msgstr "Ton" - -#: ../chirpui/memedit.py:68 ../chirpui/memedit.py:88 ../chirpui/memedit.py:104 -#: ../chirpui/memedit.py:210 ../chirpui/memedit.py:218 -#: ../chirpui/memedit.py:221 ../chirpui/memedit.py:310 -#: ../chirpui/memedit.py:876 ../chirpui/memedit.py:929 -#: ../chirpui/memedit.py:1066 -msgid "ToneSql" -msgstr "Blokada tonu" - -#: ../chirpui/memedit.py:69 ../chirpui/memedit.py:89 ../chirpui/memedit.py:105 -#: ../chirpui/memedit.py:211 ../chirpui/memedit.py:215 -#: ../chirpui/memedit.py:222 ../chirpui/memedit.py:306 -#: ../chirpui/memedit.py:877 ../chirpui/memedit.py:930 -#: ../chirpui/memedit.py:1059 -msgid "DTCS Code" -msgstr "Kod DTCS" - -#: ../chirpui/memedit.py:70 ../chirpui/memedit.py:90 ../chirpui/memedit.py:106 -#: ../chirpui/memedit.py:212 ../chirpui/memedit.py:216 -#: ../chirpui/memedit.py:223 ../chirpui/memedit.py:878 -#: ../chirpui/memedit.py:933 ../chirpui/memedit.py:1060 -msgid "DTCS Pol" -msgstr "Polaryzacja DTCS" - -#: ../chirpui/memedit.py:71 ../chirpui/memedit.py:91 ../chirpui/memedit.py:112 -#: ../chirpui/memedit.py:879 ../chirpui/memedit.py:932 -#: ../chirpui/memedit.py:1067 ../chirpui/memedit.py:1134 -msgid "Cross Mode" -msgstr "Tryb krzyżowy" - -#: ../chirpui/memedit.py:72 ../chirpui/memedit.py:92 ../chirpui/memedit.py:109 -#: ../chirpui/memedit.py:137 ../chirpui/memedit.py:205 -#: ../chirpui/memedit.py:249 ../chirpui/memedit.py:312 -#: ../chirpui/memedit.py:880 ../chirpui/memedit.py:934 -#: ../chirpui/memedit.py:1071 ../chirpui/memedit.py:1144 -msgid "Duplex" -msgstr "Dupleks" - -#: ../chirpui/memedit.py:73 ../chirpui/memedit.py:93 ../chirpui/memedit.py:135 -#: ../chirpui/memedit.py:198 ../chirpui/memedit.py:226 -#: ../chirpui/memedit.py:250 ../chirpui/memedit.py:308 -#: ../chirpui/memedit.py:881 ../chirpui/memedit.py:935 -#: ../chirpui/memedit.py:1062 -msgid "Offset" -msgstr "Przesunięcie" - -#: ../chirpui/memedit.py:74 ../chirpui/memedit.py:94 ../chirpui/memedit.py:107 -#: ../chirpui/memedit.py:882 ../chirpui/memedit.py:936 -#: ../chirpui/memedit.py:1061 ../chirpui/memedit.py:1132 -#: ../chirpui/memedit.py:1289 ../chirpui/memedit.py:1307 -#: ../chirpui/memedit.py:1317 -msgid "Mode" -msgstr "Tryb" - -#: ../chirpui/memedit.py:75 ../chirpui/memedit.py:95 ../chirpui/memedit.py:108 -#: ../chirpui/memedit.py:296 ../chirpui/memedit.py:883 -#: ../chirpui/memedit.py:937 ../chirpui/memedit.py:1073 -#: ../chirpui/memedit.py:1136 ../chirpui/memedit.py:1140 -msgid "Power" -msgstr "Moc" - -#: ../chirpui/memedit.py:76 ../chirpui/memedit.py:96 ../chirpui/memedit.py:110 -#: ../chirpui/memedit.py:140 ../chirpui/memedit.py:143 -#: ../chirpui/memedit.py:884 ../chirpui/memedit.py:938 -#: ../chirpui/memedit.py:1064 -msgid "Tune Step" -msgstr "Krok strojenia" - -#: ../chirpui/memedit.py:77 ../chirpui/memedit.py:98 ../chirpui/memedit.py:885 -#: ../chirpui/memedit.py:939 ../chirpui/memedit.py:1072 -#: ../chirpui/memedit.py:1135 -msgid "Skip" -msgstr "Przeskocz" - -#: ../chirpui/memedit.py:175 -msgid "Erasing memory {loc}" -msgstr "Kasowanie pamięci {loc}" - -#: ../chirpui/memedit.py:236 -msgid "Unable to make changes to this model" -msgstr "Nie potrafię wprowadzić zmian w tym modelu" - -#: ../chirpui/memedit.py:241 -msgid "Editing new item, taking defaults" -msgstr "Edycja nowej pozycji, przyjmuję wartości standardowe" - -#: ../chirpui/memedit.py:257 -msgid "Bad value for {col}: {val}" -msgstr "Zła wartość dla {col}: {val}" - -#: ../chirpui/memedit.py:281 -msgid "Error setting memory" -msgstr "Błąd ustawiania pamięci" - -#: ../chirpui/memedit.py:289 ../chirpui/memedit.py:356 -#: ../chirpui/memedit.py:1272 -msgid "Writing memory {number}" -msgstr "Zapisywanie pamięci {number}" - -#: ../chirpui/memedit.py:361 -msgid "" -"This operation requires moving all subsequent channels by one spot until an " -"empty location is reached. This can take a LONG time. Are you sure you " -"want to do this?" -msgstr "" -"Ta operacja wymaga przesunięcia wszystkich komórek pamięci o jeden.Może to " -"zająć dużo czasu.Czy na pewno chcesz to zrobić?" - -#: ../chirpui/memedit.py:387 -msgid "Adding memory {number}" -msgstr "Dodawanie pamięci {number}" - -#: ../chirpui/memedit.py:400 ../chirpui/memedit.py:913 -msgid "Erasing memory {number}" -msgstr "Kasowanie pamięci {number}" - -#: ../chirpui/memedit.py:409 ../chirpui/memedit.py:518 -#: ../chirpui/memedit.py:564 ../chirpui/memedit.py:569 -#: ../chirpui/memedit.py:856 ../chirpui/memedit.py:1166 -msgid "Getting memory {number}" -msgstr "Pobieranie pamięci {number}" - -#: ../chirpui/memedit.py:497 ../chirpui/memedit.py:508 -#: ../chirpui/memedit.py:556 -msgid "Moving memory from {old} to {new}" -msgstr "Przenoszenie pamięci z {old} do {new}" - -#: ../chirpui/memedit.py:578 -msgid "Raw memory {number}" -msgstr "Surowa pamięć {number}" - -#: ../chirpui/memedit.py:582 ../chirpui/memedit.py:610 -#: ../chirpui/memedit.py:615 -msgid "Getting raw memory {number}" -msgstr "Pobieranie surowej pamięci {number}" - -#: ../chirpui/memedit.py:587 -msgid "You can only diff two memories!" -msgstr "Aby porównać wybierz dwie pamięci !" - -#: ../chirpui/memedit.py:598 -msgid "Memory {number}" -msgstr "Pamięć {number}" - -#: ../chirpui/memedit.py:604 -msgid "Diff of {a} and {b}" -msgstr "Różnice {a} i {b}" - -#: ../chirpui/memedit.py:628 -msgid "Memories must be contiguous" -msgstr "Pamięci muszą zachować ciągłość" - -#: ../chirpui/memedit.py:700 -msgid "Insert row above" -msgstr "Umieść wiersz wyżej" - -#: ../chirpui/memedit.py:701 -msgid "Insert row below" -msgstr "Umieść wiersz niżej" - -#: ../chirpui/memedit.py:702 -#, fuzzy -msgid "Delete" -msgstr "_Usuń" - -#: ../chirpui/memedit.py:702 -msgid "Delete all" -msgstr "_Usuń wszystkie" - -#: ../chirpui/memedit.py:703 -msgid "Delete (and shift up)" -msgstr "Skasuj (i skocz wyżej)" - -#: ../chirpui/memedit.py:704 -#, fuzzy -msgid "Move up" -msgstr "W górę" - -#: ../chirpui/memedit.py:705 -#, fuzzy -msgid "Move down" -msgstr "W dół" - -#: ../chirpui/memedit.py:706 -msgid "Exchange memories" -msgstr "Zamień pamięci" - -#: ../chirpui/memedit.py:707 -#, fuzzy -msgid "Cut" -msgstr "_Wytnij" - -#: ../chirpui/memedit.py:708 -#, fuzzy -msgid "Copy" -msgstr "_Kopiuj" - -#: ../chirpui/memedit.py:709 -#, fuzzy -msgid "Paste" -msgstr "_Wklej" - -#: ../chirpui/memedit.py:710 -#, fuzzy -msgid "Show Raw Memory" -msgstr "Pokaż surową pamięć" - -#: ../chirpui/memedit.py:711 -#, fuzzy -msgid "Diff Raw Memories" -msgstr "Porównaj surowe pamięci" - -#: ../chirpui/memedit.py:835 -msgid "Internal Error: Column {name} not found" -msgstr "Błąd wewnętrzny: Kolumna {name} nie znaleziona" - -#: ../chirpui/memedit.py:863 -msgid "Getting channel {chan}" -msgstr "Pobieranie kanału {chan}" - -#: ../chirpui/memedit.py:952 -msgid "Internal Error: Invalid limit {number}" -msgstr "Błąd wewnętrzny: Niewłaściwy limit {number}" - -#: ../chirpui/memedit.py:962 -msgid "Memory range:" -msgstr "Zakres pamięci:" - -#: ../chirpui/memedit.py:989 -msgid "Go" -msgstr "Ok" - -#: ../chirpui/memedit.py:1012 -msgid "Special Channels" -msgstr "Kanały specjalne" - -#: ../chirpui/memedit.py:1019 -msgid "Show Empty" -msgstr "Pokaż puste" - -#: ../chirpui/memedit.py:1198 -msgid "Cutting memory {number}" -msgstr "Wycinanie pamięci {number}" - -#: ../chirpui/memedit.py:1232 -msgid "Overwrite?" -msgstr "Nadpisać ?" - -#: ../chirpui/memedit.py:1237 -msgid "Overwrite location {number}?" -msgstr "Nadpisać pozycję {number}?" - -#: ../chirpui/memedit.py:1254 -msgid "Incompatible Memory" -msgstr "Niekompatybilna pamięć" - -#: ../chirpui/memedit.py:1257 -msgid "Pasted memory {number} is not compatible with this radio because:" -msgstr "" -"Wklejona komórka pamięci {number} jest nie kompatybilna z tym urządzeniem:" - -#: ../chirpui/memedit.py:1309 ../chirpui/memedit.py:1324 -msgid "URCALL" -msgstr "" - -#: ../chirpui/memedit.py:1309 ../chirpui/memedit.py:1325 -msgid "RPT1CALL" -msgstr "" - -#: ../chirpui/memedit.py:1309 ../chirpui/memedit.py:1326 -msgid "RPT2CALL" -msgstr "" - -#: ../chirpui/memedit.py:1310 ../chirpui/memedit.py:1327 -msgid "Digital Code" -msgstr "" - -#~ msgid "Unsuppported by destination radio: {msgs}" -#~ msgstr "Nieobsługiwany przez urządzenie: {msgs}" - -#~ msgid "New location" -#~ msgstr "Nowa lokalizacja" - -#~ msgid "Location" -#~ msgstr "Lokalizacja" - -#~ msgid "%i errors during open, check the debug log for details" -#~ msgstr "%i błędów podczas otwierania, sprawdź log by obejrzeć szczegóły" diff --git a/locale/pt_BR.po b/locale/pt_BR.po deleted file mode 100644 index d3ba3cf..0000000 --- a/locale/pt_BR.po +++ /dev/null @@ -1,897 +0,0 @@ -# Language pt-BR translations for CHIRP package. -# Copyright (C) 2013 Dan Smith -# This file is distributed under the same license as the CHIRP package. -# Dan Smith , 2013. -# -msgid "" -msgstr "" -"Project-Id-Version: CHIRP\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2012-02-16 12:06-0800\n" -"PO-Revision-Date: 2013-03-30 22:04-0300\n" -"Last-Translator: Crezivando \n" -"Language-Team: Language pt-BR\n" -"Language: pt-BR\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=ISO-8859-15\n" -"Content-Transfer-Encoding: 8bit\n" -"X-Generator: Poedit 1.5.5\n" - -#: ../chirpui/common.py:204 -msgid "Completed" -msgstr "Concluído" - -#: ../chirpui/common.py:205 -msgid "idle" -msgstr "ocioso" - -#: ../chirpui/bankedit.py:52 -msgid "Retrieving bank information" -msgstr "Recuperando informações do banco" - -#: ../chirpui/bankedit.py:75 -msgid "Setting name on bank" -msgstr "Configurando nome no banco" - -#: ../chirpui/bankedit.py:85 -msgid "Bank" -msgstr "Banco" - -#: ../chirpui/bankedit.py:86 ../chirpui/bankedit.py:240 -#: ../chirpui/importdialog.py:536 ../chirpui/memedit.py:65 -#: ../chirpui/memedit.py:85 ../chirpui/memedit.py:247 -#: ../chirpui/memedit.py:872 ../chirpui/memedit.py:926 -#: ../chirpui/memedit.py:1063 ../chirpui/memedit.py:1065 -msgid "Name" -msgstr "Nome" - -#: ../chirpui/bankedit.py:185 -msgid "Updating bank index for memory {num}" -msgstr "Atualizando índice do banco para memória {num}" - -#: ../chirpui/bankedit.py:194 -msgid "Updating bank information for memory {num}" -msgstr "Atualizando informação do banco para memória {num}" - -#: ../chirpui/bankedit.py:200 ../chirpui/bankedit.py:229 -msgid "Getting memory {num}" -msgstr "Obtendo memória {num}" - -#: ../chirpui/bankedit.py:214 -msgid "Setting index for memory {num}" -msgstr "Configurando índice para memória {num}" - -#: ../chirpui/bankedit.py:223 -msgid "Getting bank for memory {num}" -msgstr "Obtendo banco para memória {num}" - -#: ../chirpui/bankedit.py:238 ../chirpui/memedit.py:63 -#: ../chirpui/memedit.py:172 ../chirpui/memedit.py:246 -#: ../chirpui/memedit.py:315 ../chirpui/memedit.py:335 -#: ../chirpui/memedit.py:349 ../chirpui/memedit.py:423 -#: ../chirpui/memedit.py:435 ../chirpui/memedit.py:459 -#: ../chirpui/memedit.py:461 ../chirpui/memedit.py:534 -#: ../chirpui/memedit.py:548 ../chirpui/memedit.py:550 -#: ../chirpui/memedit.py:591 ../chirpui/memedit.py:593 -#: ../chirpui/memedit.py:621 ../chirpui/memedit.py:822 -#: ../chirpui/memedit.py:870 ../chirpui/memedit.py:895 -#: ../chirpui/memedit.py:907 ../chirpui/memedit.py:924 -#: ../chirpui/memedit.py:1230 -msgid "Loc" -msgstr "Loc" - -#: ../chirpui/bankedit.py:239 ../chirpui/importdialog.py:537 -#: ../chirpui/memedit.py:64 ../chirpui/memedit.py:86 ../chirpui/memedit.py:187 -#: ../chirpui/memedit.py:248 ../chirpui/memedit.py:271 -#: ../chirpui/memedit.py:296 ../chirpui/memedit.py:304 -#: ../chirpui/memedit.py:873 ../chirpui/memedit.py:923 -msgid "Frequency" -msgstr "Frequência" - -#: ../chirpui/bankedit.py:241 -msgid "Index" -msgstr "Índice" - -#: ../chirpui/bankedit.py:302 -msgid "Getting bank information for memory {num}" -msgstr "Obtendo informação do banco para memória {num}" - -#: ../chirpui/bankedit.py:323 -msgid "Getting bank information" -msgstr "Obtendo informação do banco" - -#: ../chirpui/inputdialog.py:81 -msgid "An error has occurred" -msgstr "Ocorreu um erro" - -#: ../chirpui/inputdialog.py:130 -msgid "Overwrite" -msgstr "Sobrescrever" - -#: ../chirpui/inputdialog.py:133 -msgid "File Exists" -msgstr "Arquivo já Existe" - -#: ../chirpui/inputdialog.py:136 -msgid "The file {name} already exists. Do you want to overwrite it?" -msgstr "O arquivo {name} já existe. Você quer sobrescrevê-lo" - -#: ../chirpui/importdialog.py:90 -msgid "Location {number} is already being imported. Choose another value for 'New Location' before selection 'Import'" -msgstr "Localização {number} está sendo importada. Escolha outro valor para 'Nova Localização' antes de selecionar 'Importar'" - -#: ../chirpui/importdialog.py:121 -msgid "Invalid value. Must be an integer." -msgstr "Valor inválido. Deve ser um número inteiro." - -#: ../chirpui/importdialog.py:130 -msgid "Location {number} is already being imported" -msgstr "Localização {number} está sendo importada" - -#: ../chirpui/importdialog.py:182 -msgid "Updating URCALL list" -msgstr "Atualizando lista URCALL" - -#: ../chirpui/importdialog.py:187 -msgid "Updating RPTCALL list" -msgstr "Atualizando lista RPTCALL" - -#: ../chirpui/importdialog.py:256 -msgid "Setting memory {number}" -msgstr "Configurando memória {number}" - -#: ../chirpui/importdialog.py:260 -msgid "Importing bank information" -msgstr "Importando informação do banco" - -#: ../chirpui/importdialog.py:264 -msgid "Error importing memories:" -msgstr "Erro ao importar memórias:" - -#: ../chirpui/importdialog.py:376 -msgid "All" -msgstr "Tudo" - -#: ../chirpui/importdialog.py:382 -msgid "None" -msgstr "Nenhum" - -#: ../chirpui/importdialog.py:388 -msgid "Inverse" -msgstr "Inverso" - -#: ../chirpui/importdialog.py:394 -msgid "Select" -msgstr "Selecione" - -#: ../chirpui/importdialog.py:416 -msgid "Auto" -msgstr "Auto" - -#: ../chirpui/importdialog.py:422 -msgid "Reverse" -msgstr "Reverso" - -#: ../chirpui/importdialog.py:428 -msgid "Adjust New Location" -msgstr "Ajustar Nova Localização" - -#: ../chirpui/importdialog.py:438 -msgid "Confirm overwrites" -msgstr "Confirmar sobrescrever" - -#: ../chirpui/importdialog.py:444 -msgid "Options" -msgstr "Opções" - -#: ../chirpui/importdialog.py:495 -msgid "Cannot be imported because" -msgstr "Não pode ser importado porque" - -#: ../chirpui/importdialog.py:513 -msgid "Import From File" -msgstr "Importar do Arquivo" - -#: ../chirpui/importdialog.py:514 ../chirpui/mainapp.py:1196 -msgid "Import" -msgstr "Importar" - -#: ../chirpui/importdialog.py:534 -msgid "To" -msgstr "Para" - -#: ../chirpui/importdialog.py:535 -msgid "From" -msgstr "De" - -#: ../chirpui/importdialog.py:538 ../chirpui/memedit.py:78 -#: ../chirpui/memedit.py:99 ../chirpui/memedit.py:886 -#: ../chirpui/memedit.py:940 ../chirpui/memedit.py:1068 -msgid "Comment" -msgstr "Comentário" - -#: ../chirpui/importdialog.py:542 -msgid "Location memory will be imported into" -msgstr "Memória de localização será importada para" - -#: ../chirpui/importdialog.py:543 -msgid "Location of memory in the file being imported" -msgstr "Localização da memória no arquivo sendo importada" - -#: ../chirpui/importdialog.py:566 -msgid "Preparing memory list..." -msgstr "Preparando lista de memória..." - -#: ../chirpui/importdialog.py:575 -msgid "Export To File" -msgstr "Exportar Para Arquivo" - -#: ../chirpui/importdialog.py:576 ../chirpui/mainapp.py:1197 -msgid "Export" -msgstr "Exportar" - -#: ../chirpui/mainapp.py:269 ../chirpui/mainapp.py:483 -msgid "Untitled" -msgstr "Sem-Título" - -#: ../chirpui/mainapp.py:316 ../chirpui/mainapp.py:715 -msgid "CHIRP Radio Images" -msgstr "Rádio Imagens CHIRP" - -#: ../chirpui/mainapp.py:317 ../chirpui/mainapp.py:714 -#: ../chirpui/mainapp.py:880 -msgid "CHIRP Files" -msgstr "Arquivos CHIRP" - -#: ../chirpui/mainapp.py:318 ../chirpui/mainapp.py:716 -#: ../chirpui/mainapp.py:879 -msgid "CSV Files" -msgstr "Arquivos CSV" - -#: ../chirpui/mainapp.py:319 ../chirpui/mainapp.py:717 -msgid "ICF Files" -msgstr "Arquivos ICF" - -#: ../chirpui/mainapp.py:320 ../chirpui/mainapp.py:718 -msgid "VX7 Commander Files" -msgstr "Arquivos VX7 Commander" - -#: ../chirpui/mainapp.py:330 -msgid "ICF files cannot be edited, only displayed or imported into another file. Open in read-only mode?" -msgstr "Arquivos ICF não podem ser editados, somente exibidos ou importados para outro arquivo. Abrir no modo somente-leitura?" - -#: ../chirpui/mainapp.py:373 -msgid "There was an error opening {fname}: {error}" -msgstr "Houve um erro ao abrir {fname}: {error}" - -#: ../chirpui/mainapp.py:388 -msgid "{num} errors during open:" -msgstr "{num} erros durante abertura:" - -#: ../chirpui/mainapp.py:394 -msgid "Note:" -msgstr "Nota:" - -#: ../chirpui/mainapp.py:395 -msgid "The {vendor} {model} operates in live mode. This means that any changes you make are immediately sent to the radio. Because of this, you cannot perform the Save or Upload operations. If you wish to edit the contents offline, please Export to a CSV file, using the File menu." -msgstr "O {vendor} {model} opera em modo ativo. Isto significa que quaisquer alterações que você fizer são imediatamente enviadas para o rádio. Devido a isto você não pode executar as operações Salvar ou Carregar. Se você quiser editar o conteúdo off-line, por favor Exportar para um arquivo CSV, usando o menu Arquivo." - -#: ../chirpui/mainapp.py:404 -msgid "Don't show this again" -msgstr "Não mostrar isto novamente" - -#: ../chirpui/mainapp.py:448 -msgid "{vendor} {model} image file" -msgstr "Arquivo Imagem {vendor} {model}" - -#: ../chirpui/mainapp.py:456 -msgid "VX7 Commander" -msgstr "VX7 Commander" - -#: ../chirpui/mainapp.py:518 -msgid "Open recent file {name}" -msgstr "Abrir arquivo recente {name}" - -#: ../chirpui/mainapp.py:579 -msgid "Import stock configuration {name}" -msgstr "Importar configuração de estoque {name}" - -#: ../chirpui/mainapp.py:595 -msgid "Open stock configuration {name}" -msgstr "Abrir configuração de estoque {name}" - -#: ../chirpui/mainapp.py:681 -msgid "Discard Changes?" -msgstr "Descartar Alterações?" - -#: ../chirpui/mainapp.py:686 -msgid "File is modified, save changes before closing?" -msgstr "Arquivo modificado, salvar alterações antes de fechar?" - -#: ../chirpui/mainapp.py:923 -msgid "With significant contributions by:" -msgstr "Com importantes contribuições de:" - -#: ../chirpui/mainapp.py:940 -msgid "Select Columns" -msgstr "Selecionar Colunas" - -#: ../chirpui/mainapp.py:955 -msgid "Visible columns for {radio}" -msgstr "Colunas Visíveis para {radio}" - -#: ../chirpui/mainapp.py:1012 -msgid "Reporting is disabled" -msgstr "Emissão de Relatórios desabilitada" - -#: ../chirpui/mainapp.py:1013 -msgid "" -"The reporting feature of CHIRP is designed to help improve quality by allowing the authors to focus on the radio drivers used most often and errors experienced by the users. The reports contain no identifying information and are used only for statistical purposes by the authors. Your privacy is extremely important, but please consider leaving this feature enabled to help make CHIRP better!\n" -"\n" -"Are you sure you want to disable this feature?" -msgstr "" -"O recurso de relatório do CHIRP é projetado para ajudar melhorar a qualidade permitindo aos autores focalizar os drivers de rádio mais frequentemente usados e erros experimentados pelos usuários. Os relatórios não contêm nenhuma informação de identificação e são utilizados apenas para fins estatísticos pelos autores. Sua privacidade é extremamente importante, mas por favor considere deixar este recurso ativado para ajudar a melhorar o CHIRP!\n" -"\n" -"Você tem certeza de que quer desabilitar este recurso?" - -#: ../chirpui/mainapp.py:1045 -msgid "Choose a language or Auto to use the operating system default. You will need to restart the application before the change will take effect" -msgstr "Escolha um idioma ou Auto para usar o sistema padrão. Você precisará reinicializar o aplicativo antes para que as mudanças tenham efeito." - -#: ../chirpui/mainapp.py:1169 -msgid "_File" -msgstr "_Arquivo" - -#: ../chirpui/mainapp.py:1172 -msgid "Open stock config" -msgstr "Abrir config do estoque" - -#: ../chirpui/mainapp.py:1173 -msgid "_Recent" -msgstr "_Recente" - -#: ../chirpui/mainapp.py:1178 -msgid "_Edit" -msgstr "_Editar" - -#: ../chirpui/mainapp.py:1179 -msgid "_Cut" -msgstr "_Cut" - -#: ../chirpui/mainapp.py:1180 -msgid "_Copy" -msgstr "_Copiar" - -#: ../chirpui/mainapp.py:1181 -msgid "_Paste" -msgstr "_Colar" - -#: ../chirpui/mainapp.py:1182 -msgid "_Delete" -msgstr "_Apagar" - -#: ../chirpui/mainapp.py:1183 -msgid "Move _Up" -msgstr "Mover _Acima" - -#: ../chirpui/mainapp.py:1184 -msgid "Move Dow_n" -msgstr "Mover Abaix_o" - -#: ../chirpui/mainapp.py:1185 -msgid "E_xchange" -msgstr "T_roca" - -#: ../chirpui/mainapp.py:1186 -msgid "_View" -msgstr "_Visualizar" - -#: ../chirpui/mainapp.py:1187 -msgid "Columns" -msgstr "Colunas" - -#: ../chirpui/mainapp.py:1188 -msgid "Developer" -msgstr "Desenvolvedor" - -#: ../chirpui/mainapp.py:1189 -msgid "Show raw memory" -msgstr "Mostrar memória raw" - -#: ../chirpui/mainapp.py:1190 -msgid "Diff raw memories" -msgstr "Diff memórias raw" - -#: ../chirpui/mainapp.py:1191 -msgid "Diff tabs" -msgstr "Diff tabs" - -#: ../chirpui/mainapp.py:1192 -msgid "Change language" -msgstr "Mudar idioma" - -#: ../chirpui/mainapp.py:1193 -msgid "_Radio" -msgstr "_Rádio" - -#: ../chirpui/mainapp.py:1194 -msgid "Download From Radio" -msgstr "Descarregar a partir do Rádio" - -#: ../chirpui/mainapp.py:1195 -msgid "Upload To Radio" -msgstr "Carregar para o Rádio" - -#: ../chirpui/mainapp.py:1198 -msgid "Import from RFinder" -msgstr "Importar de RFinder" - -#: ../chirpui/mainapp.py:1199 -msgid "CHIRP Native File" -msgstr "Arquivo Nativo CHIRP" - -#: ../chirpui/mainapp.py:1200 -msgid "CSV File" -msgstr "Arquivo CSV" - -#: ../chirpui/mainapp.py:1201 -msgid "Import from RepeaterBook" -msgstr "Importar do Catálogo de Repetidoras" - -#: ../chirpui/mainapp.py:1202 -msgid "Import from stock config" -msgstr "Importar do config estoque" - -#: ../chirpui/mainapp.py:1204 -msgid "Help" -msgstr "Ajuda" - -#: ../chirpui/mainapp.py:1215 -msgid "Report statistics" -msgstr "Relatório estatístico" - -#: ../chirpui/mainapp.py:1216 -msgid "Hide Unused Fields" -msgstr "Ocultar Campos Não-utilizados" - -#: ../chirpui/mainapp.py:1217 -msgid "Automatic Repeater Offset" -msgstr "Offset Automático Repetidoras" - -#: ../chirpui/mainapp.py:1218 -msgid "Enable Developer Functions" -msgstr "Habilitar Funções de Desenvolvedor" - -#: ../chirpui/mainapp.py:1352 -msgid "Error reporting is enabled" -msgstr "Relatório de Erros habilitado" - -#: ../chirpui/mainapp.py:1355 -msgid "If you wish to disable this feature you may do so in the Help menu" -msgstr "Se você desejar desabilitar este recurso você pode fazê-lo no menu Ajuda" - -#: ../chirpui/cloneprog.py:43 -msgid "Clone Progress" -msgstr "Clonagem em Progresso" - -#: ../chirpui/cloneprog.py:46 -msgid "Cloning" -msgstr "Clonando" - -#: ../chirpui/cloneprog.py:55 -msgid "Cancel" -msgstr "Cancelar" - -#: ../chirpui/shiftdialog.py:27 -msgid "Shift" -msgstr "Shift" - -#: ../chirpui/shiftdialog.py:63 -msgid "Moving {src} to {dst}" -msgstr "Movendo {src} para {dst}" - -#: ../chirpui/shiftdialog.py:80 -msgid "Looking for a free spot ({number})" -msgstr "Procurando por um ponto livre ({number})" - -#: ../chirpui/shiftdialog.py:135 -msgid "Moved {count} memories" -msgstr "Memórias {count} movidas" - -#: ../chirpui/clone.py:35 -msgid "{vendor} {model} on {port}" -msgstr "{vendor} {model} na {port}" - -#: ../chirpui/clone.py:100 ../chirpui/clone.py:162 -msgid "Detect" -msgstr "Detectar" - -#: ../chirpui/clone.py:123 -msgid "Port" -msgstr "Porta" - -#: ../chirpui/clone.py:124 -msgid "Vendor" -msgstr "Fornecedor" - -#: ../chirpui/clone.py:125 -msgid "Model" -msgstr "Modelo" - -#: ../chirpui/clone.py:138 -msgid "Radio" -msgstr "Rádio" - -#: ../chirpui/clone.py:166 -msgid "Unable to detect radio on {port}" -msgstr "Incapaz de detectar rádio na {port}" - -#: ../chirpui/clone.py:178 -msgid "Internal error: Unable to upload to {model}" -msgstr "Erro Interno: Incapaz de descarregar para {model}" - -#: ../chirpui/clone.py:226 -msgid "Clone failed: {error}" -msgstr "Clonagem falhou: {error}" - -#: ../chirpui/dstaredit.py:40 -msgid "Callsign" -msgstr "Indicativo" - -#: ../chirpui/dstaredit.py:124 -msgid "Your callsign" -msgstr "Seu indicativo" - -#: ../chirpui/dstaredit.py:132 -msgid "Repeater callsign" -msgstr "Indicativo da Repetidora" - -#: ../chirpui/dstaredit.py:140 -msgid "My callsign" -msgstr "Meu indicativo" - -#: ../chirpui/dstaredit.py:170 ../chirpui/memedit.py:1365 -msgid "Downloading URCALL list" -msgstr "Descarregando lista URCALL" - -#: ../chirpui/dstaredit.py:174 ../chirpui/memedit.py:1377 -msgid "Downloading RPTCALL list" -msgstr "Descarregando lista RPTCALL" - -#: ../chirpui/dstaredit.py:178 -msgid "Downloading MYCALL list" -msgstr "Descarregando lista MYCALL" - -#: ../chirpui/editorset.py:87 -msgid "Memories" -msgstr "Memórias" - -#: ../chirpui/editorset.py:92 -msgid "D-STAR" -msgstr "D-STAR" - -#: ../chirpui/editorset.py:98 -msgid "Bank Names" -msgstr "Nomes do Banco" - -#: ../chirpui/editorset.py:104 -msgid "Banks" -msgstr "Bancos" - -#: ../chirpui/editorset.py:222 -msgid "The {vendor} {model} has multiple independent sub-devices" -msgstr "O {vendor} {model} tem vários sub-dispositivos independentes" - -#: ../chirpui/editorset.py:225 -msgid "Choose one to import from:" -msgstr "Selecionar um para importar de:" - -#: ../chirpui/editorset.py:230 -msgid "Cancelled" -msgstr "Cancelado" - -#: ../chirpui/editorset.py:235 -msgid "Internal Error" -msgstr "Erro Interno" - -#: ../chirpui/editorset.py:248 -msgid "There were errors while opening {file}. The affected memories will not be importable!" -msgstr "Houve erros ao abrir {file}. As memórias afetadas não serão importáveis!" - -#: ../chirpui/editorset.py:260 -msgid "There was an error during import: {error}" -msgstr "Ocorreu um erro durante importação: {error}" - -#: ../chirpui/editorset.py:270 -msgid "Unsupported file type" -msgstr "Tipo de arquivo não-suportado" - -#: ../chirpui/editorset.py:286 ../chirpui/editorset.py:301 -msgid "There was an error during export: {error}" -msgstr "Existiu um erro durante exportação: {error}" - -#: ../chirpui/editorset.py:313 -msgid "Priming memory" -msgstr "Memória de escorva" - -#: ../chirpui/memedit.py:52 -msgid "Invalid value for this field" -msgstr "Valor Inválido para este campo" - -#: ../chirpui/memedit.py:66 ../chirpui/memedit.py:97 ../chirpui/memedit.py:111 -#: ../chirpui/memedit.py:204 ../chirpui/memedit.py:312 -#: ../chirpui/memedit.py:874 ../chirpui/memedit.py:931 -#: ../chirpui/memedit.py:1069 ../chirpui/memedit.py:1133 -msgid "Tone Mode" -msgstr "Modo Tom" - -#: ../chirpui/memedit.py:67 ../chirpui/memedit.py:87 ../chirpui/memedit.py:103 -#: ../chirpui/memedit.py:214 ../chirpui/memedit.py:218 -#: ../chirpui/memedit.py:220 ../chirpui/memedit.py:310 -#: ../chirpui/memedit.py:875 ../chirpui/memedit.py:928 -#: ../chirpui/memedit.py:1070 -msgid "Tone" -msgstr "Tom" - -#: ../chirpui/memedit.py:68 ../chirpui/memedit.py:88 ../chirpui/memedit.py:104 -#: ../chirpui/memedit.py:210 ../chirpui/memedit.py:218 -#: ../chirpui/memedit.py:221 ../chirpui/memedit.py:310 -#: ../chirpui/memedit.py:876 ../chirpui/memedit.py:929 -#: ../chirpui/memedit.py:1066 -msgid "ToneSql" -msgstr "TomSql" - -#: ../chirpui/memedit.py:69 ../chirpui/memedit.py:89 ../chirpui/memedit.py:105 -#: ../chirpui/memedit.py:211 ../chirpui/memedit.py:215 -#: ../chirpui/memedit.py:222 ../chirpui/memedit.py:306 -#: ../chirpui/memedit.py:877 ../chirpui/memedit.py:930 -#: ../chirpui/memedit.py:1059 -msgid "DTCS Code" -msgstr "DTCS Code" - -#: ../chirpui/memedit.py:70 ../chirpui/memedit.py:90 ../chirpui/memedit.py:106 -#: ../chirpui/memedit.py:212 ../chirpui/memedit.py:216 -#: ../chirpui/memedit.py:223 ../chirpui/memedit.py:878 -#: ../chirpui/memedit.py:933 ../chirpui/memedit.py:1060 -msgid "DTCS Pol" -msgstr "DTCS Pol" - -#: ../chirpui/memedit.py:71 ../chirpui/memedit.py:91 ../chirpui/memedit.py:112 -#: ../chirpui/memedit.py:879 ../chirpui/memedit.py:932 -#: ../chirpui/memedit.py:1067 ../chirpui/memedit.py:1134 -msgid "Cross Mode" -msgstr "Modo Cross" - -#: ../chirpui/memedit.py:72 ../chirpui/memedit.py:92 ../chirpui/memedit.py:109 -#: ../chirpui/memedit.py:137 ../chirpui/memedit.py:205 -#: ../chirpui/memedit.py:249 ../chirpui/memedit.py:312 -#: ../chirpui/memedit.py:880 ../chirpui/memedit.py:934 -#: ../chirpui/memedit.py:1071 ../chirpui/memedit.py:1144 -msgid "Duplex" -msgstr "Duplex" - -#: ../chirpui/memedit.py:73 ../chirpui/memedit.py:93 ../chirpui/memedit.py:135 -#: ../chirpui/memedit.py:198 ../chirpui/memedit.py:226 -#: ../chirpui/memedit.py:250 ../chirpui/memedit.py:308 -#: ../chirpui/memedit.py:881 ../chirpui/memedit.py:935 -#: ../chirpui/memedit.py:1062 -msgid "Offset" -msgstr "Offset" - -#: ../chirpui/memedit.py:74 ../chirpui/memedit.py:94 ../chirpui/memedit.py:107 -#: ../chirpui/memedit.py:882 ../chirpui/memedit.py:936 -#: ../chirpui/memedit.py:1061 ../chirpui/memedit.py:1132 -#: ../chirpui/memedit.py:1289 ../chirpui/memedit.py:1307 -#: ../chirpui/memedit.py:1317 -msgid "Mode" -msgstr "Modo" - -#: ../chirpui/memedit.py:75 ../chirpui/memedit.py:95 ../chirpui/memedit.py:108 -#: ../chirpui/memedit.py:296 ../chirpui/memedit.py:883 -#: ../chirpui/memedit.py:937 ../chirpui/memedit.py:1073 -#: ../chirpui/memedit.py:1136 ../chirpui/memedit.py:1140 -msgid "Power" -msgstr "Power" - -#: ../chirpui/memedit.py:76 ../chirpui/memedit.py:96 ../chirpui/memedit.py:110 -#: ../chirpui/memedit.py:140 ../chirpui/memedit.py:143 -#: ../chirpui/memedit.py:884 ../chirpui/memedit.py:938 -#: ../chirpui/memedit.py:1064 -msgid "Tune Step" -msgstr "Tune Step" - -#: ../chirpui/memedit.py:77 ../chirpui/memedit.py:98 ../chirpui/memedit.py:885 -#: ../chirpui/memedit.py:939 ../chirpui/memedit.py:1072 -#: ../chirpui/memedit.py:1135 -msgid "Skip" -msgstr "Skip" - -#: ../chirpui/memedit.py:175 -msgid "Erasing memory {loc}" -msgstr "Apagando memória {loc}" - -#: ../chirpui/memedit.py:236 -msgid "Unable to make changes to this model" -msgstr "Incapaz de efetuar alterações para este modelo" - -#: ../chirpui/memedit.py:241 -msgid "Editing new item, taking defaults" -msgstr "Editando novo item, tomando padrões" - -#: ../chirpui/memedit.py:257 -msgid "Bad value for {col}: {val}" -msgstr "Valor inválido para {col}: {val}" - -#: ../chirpui/memedit.py:281 -msgid "Error setting memory" -msgstr "Erro gravando memória" - -#: ../chirpui/memedit.py:289 ../chirpui/memedit.py:356 -#: ../chirpui/memedit.py:1272 -msgid "Writing memory {number}" -msgstr "Gravando memória {number}" - -#: ../chirpui/memedit.py:361 -msgid "This operation requires moving all subsequent channels by one spot until an empty location is reached. This can take a LONG time. Are you sure you want to do this?" -msgstr "Esta operação requer mover todos os canais subsequentes por um ponto, até que seja preenchido um local vazio. Isto pode levar MUITO tempo. Tem certeza de que quer fazer isto?" - -#: ../chirpui/memedit.py:387 -msgid "Adding memory {number}" -msgstr "Adicionando memória {number}" - -#: ../chirpui/memedit.py:400 ../chirpui/memedit.py:913 -msgid "Erasing memory {number}" -msgstr "Apagando memória {number}" - -#: ../chirpui/memedit.py:409 ../chirpui/memedit.py:518 -#: ../chirpui/memedit.py:564 ../chirpui/memedit.py:569 -#: ../chirpui/memedit.py:856 ../chirpui/memedit.py:1166 -msgid "Getting memory {number}" -msgstr "Obtendo memória {number}" - -#: ../chirpui/memedit.py:497 ../chirpui/memedit.py:508 -#: ../chirpui/memedit.py:556 -msgid "Moving memory from {old} to {new}" -msgstr "Movendo memória de {old} para {new}" - -#: ../chirpui/memedit.py:578 -msgid "Raw memory {number}" -msgstr "Memória raw {number}" - -#: ../chirpui/memedit.py:582 ../chirpui/memedit.py:610 -#: ../chirpui/memedit.py:615 -msgid "Getting raw memory {number}" -msgstr "Obtendo memória raw {number}" - -#: ../chirpui/memedit.py:587 -msgid "You can only diff two memories!" -msgstr "Você só pode diff duas memórias!" - -#: ../chirpui/memedit.py:598 -msgid "Memory {number}" -msgstr "Memória {number}" - -#: ../chirpui/memedit.py:604 -msgid "Diff of {a} and {b}" -msgstr "Diff de {a} e {b}" - -#: ../chirpui/memedit.py:628 -msgid "Memories must be contiguous" -msgstr "Memórias devem ser contíguas" - -#: ../chirpui/memedit.py:700 -msgid "Insert row above" -msgstr "Inserir row acima" - -#: ../chirpui/memedit.py:701 -msgid "Insert row below" -msgstr "Inserir row abaixo" - -#: ../chirpui/memedit.py:702 -msgid "Delete" -msgstr "Apagar" - -#: ../chirpui/memedit.py:702 -msgid "Delete all" -msgstr "Apagar tudo" - -#: ../chirpui/memedit.py:703 -msgid "Delete (and shift up)" -msgstr "Apagar (e deslocar)" - -#: ../chirpui/memedit.py:704 -msgid "Move up" -msgstr "Mover acima" - -#: ../chirpui/memedit.py:705 -msgid "Move down" -msgstr "Mover abaixo" - -#: ../chirpui/memedit.py:706 -msgid "Exchange memories" -msgstr "Trocar memórias" - -#: ../chirpui/memedit.py:707 -msgid "Cut" -msgstr "Cortar" - -#: ../chirpui/memedit.py:708 -msgid "Copy" -msgstr "Copiar" - -#: ../chirpui/memedit.py:709 -msgid "Paste" -msgstr "Colar" - -#: ../chirpui/memedit.py:710 -msgid "Show Raw Memory" -msgstr "Mostrar Memória Raw" - -#: ../chirpui/memedit.py:711 -msgid "Diff Raw Memories" -msgstr "Diff Memórias Raw" - -#: ../chirpui/memedit.py:835 -msgid "Internal Error: Column {name} not found" -msgstr "Erro Interno: Coluna {name} não encontrada" - -#: ../chirpui/memedit.py:863 -msgid "Getting channel {chan}" -msgstr "Obtendo canal {chan}" - -#: ../chirpui/memedit.py:952 -msgid "Internal Error: Invalid limit {number}" -msgstr "Erro Interndo: limite Inválido {number}" - -#: ../chirpui/memedit.py:962 -msgid "Memory range:" -msgstr "Intervalo de Memória" - -#: ../chirpui/memedit.py:989 -msgid "Go" -msgstr "Ir" - -#: ../chirpui/memedit.py:1012 -msgid "Special Channels" -msgstr "Canais Especiais" - -#: ../chirpui/memedit.py:1019 -msgid "Show Empty" -msgstr "Mostrar Vazias" - -#: ../chirpui/memedit.py:1198 -msgid "Cutting memory {number}" -msgstr "Cortando memória {number}" - -#: ../chirpui/memedit.py:1232 -msgid "Overwrite?" -msgstr "Sobrescrever?" - -#: ../chirpui/memedit.py:1237 -msgid "Overwrite location {number}?" -msgstr "Sobrescrever local {number}?" - -#: ../chirpui/memedit.py:1254 -msgid "Incompatible Memory" -msgstr "Memória Incompatível" - -#: ../chirpui/memedit.py:1257 -msgid "Pasted memory {number} is not compatible with this radio because:" -msgstr "Memória colada {number} não é compatível com este rádio porque:" - -#: ../chirpui/memedit.py:1309 ../chirpui/memedit.py:1324 -msgid "URCALL" -msgstr "URCALL" - -#: ../chirpui/memedit.py:1309 ../chirpui/memedit.py:1325 -msgid "RPT1CALL" -msgstr "RPT1CALL" - -#: ../chirpui/memedit.py:1309 ../chirpui/memedit.py:1326 -msgid "RPT2CALL" -msgstr "RPT2CALL" - -#: ../chirpui/memedit.py:1310 ../chirpui/memedit.py:1327 -msgid "Digital Code" -msgstr "Código Digital" - diff --git a/locale/ru.po b/locale/ru.po deleted file mode 100644 index 24b76ef..0000000 --- a/locale/ru.po +++ /dev/null @@ -1,907 +0,0 @@ -msgid "" -msgstr "" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"X-Generator: POEditor.com\n" -"Project-Id-Version: CHIRP\n" -"Language: ru\n" - -#: ../chirpui/common.py:204 -msgid "Completed" -msgstr "Завершено" - -#: ../chirpui/common.py:205 -msgid "idle" -msgstr "ожидание" - -#: ../chirpui/bankedit.py:52 -msgid "Retrieving bank information" -msgstr "Получение информации" - -#: ../chirpui/bankedit.py:75 -msgid "Setting name on bank" -msgstr "Установка имени банка" - -#: ../chirpui/bankedit.py:85 -msgid "Bank" -msgstr "Банк" - -#: ../chirpui/bankedit.py:86 ../chirpui/bankedit.py:240 -#: ../chirpui/importdialog.py:536 ../chirpui/memedit.py:65 -#: ../chirpui/memedit.py:85 ../chirpui/memedit.py:247 -#: ../chirpui/memedit.py:872 ../chirpui/memedit.py:926 -#: ../chirpui/memedit.py:1063 ../chirpui/memedit.py:1065 -msgid "Name" -msgstr "Имя" - -#: ../chirpui/bankedit.py:185 -msgid "Updating bank index for memory {num}" -msgstr "Обновление индекса банка в памяти {num}" - -#: ../chirpui/bankedit.py:194 -msgid "Updating bank information for memory {num}" -msgstr "Обновление информации банка в памяти {num}" - -#: ../chirpui/bankedit.py:200 ../chirpui/bankedit.py:229 -msgid "Getting memory {num}" -msgstr "Получение из памяти {num}" - -#: ../chirpui/bankedit.py:214 -msgid "Setting index for memory {num}" -msgstr "Установка индекса для памяти {num}" - -#: ../chirpui/bankedit.py:223 -msgid "Getting bank for memory {num}" -msgstr "Получение банка памяти {num}" - -#: ../chirpui/bankedit.py:238 ../chirpui/memedit.py:63 -#: ../chirpui/memedit.py:172 ../chirpui/memedit.py:246 -#: ../chirpui/memedit.py:315 ../chirpui/memedit.py:335 -#: ../chirpui/memedit.py:349 ../chirpui/memedit.py:423 -#: ../chirpui/memedit.py:435 ../chirpui/memedit.py:459 -#: ../chirpui/memedit.py:461 ../chirpui/memedit.py:534 -#: ../chirpui/memedit.py:548 ../chirpui/memedit.py:550 -#: ../chirpui/memedit.py:591 ../chirpui/memedit.py:593 -#: ../chirpui/memedit.py:621 ../chirpui/memedit.py:822 -#: ../chirpui/memedit.py:870 ../chirpui/memedit.py:895 -#: ../chirpui/memedit.py:907 ../chirpui/memedit.py:924 -#: ../chirpui/memedit.py:1230 -msgid "Loc" -msgstr "№" - -#: ../chirpui/bankedit.py:239 ../chirpui/importdialog.py:537 -#: ../chirpui/memedit.py:64 ../chirpui/memedit.py:86 ../chirpui/memedit.py:187 -#: ../chirpui/memedit.py:248 ../chirpui/memedit.py:271 -#: ../chirpui/memedit.py:296 ../chirpui/memedit.py:304 -#: ../chirpui/memedit.py:873 ../chirpui/memedit.py:923 -msgid "Frequency" -msgstr "Частота" - -#: ../chirpui/bankedit.py:241 -msgid "Index" -msgstr "Индекс" - -#: ../chirpui/bankedit.py:302 -msgid "Getting bank information for memory {num}" -msgstr "Получение информации банка для памяти {num}" - -#: ../chirpui/bankedit.py:323 -msgid "Getting bank information" -msgstr "Получение информации из банка" - -#: ../chirpui/inputdialog.py:81 -msgid "An error has occurred" -msgstr "Ошибка" - -#: ../chirpui/inputdialog.py:130 -msgid "Overwrite" -msgstr "Перезаписать" - -#: ../chirpui/inputdialog.py:133 -msgid "File Exists" -msgstr "Файл существует" - -#: ../chirpui/inputdialog.py:136 -msgid "The file {name} already exists. Do you want to overwrite it?" -msgstr "Файл {name} уже существует. Перезаписать его?" - -#: ../chirpui/importdialog.py:90 -msgid "Location {number} is already being imported. Choose another value for 'New Location' before selection 'Import'" -msgstr "Позиция {number} уже импортирована. Выберите другое значение для \"Новая позиция\" перед выбором \"Импорт\"" - -#: ../chirpui/importdialog.py:121 -msgid "Invalid value. Must be an integer." -msgstr "Неверное значение. Должно быть целое число." - -#: ../chirpui/importdialog.py:130 -msgid "Location {number} is already being imported" -msgstr "Позиция {number} уже импортирована" - -#: ../chirpui/importdialog.py:182 -msgid "Updating URCALL list" -msgstr "Обновление URCALL" - -#: ../chirpui/importdialog.py:187 -msgid "Updating RPTCALL list" -msgstr "Обновление RPTCALL" - -#: ../chirpui/importdialog.py:256 -msgid "Setting memory {number}" -msgstr "Установка памяти {number}" - -#: ../chirpui/importdialog.py:260 -msgid "Importing bank information" -msgstr "Импорт информации банка" - -#: ../chirpui/importdialog.py:264 -#, fuzzy -msgid "Error importing memories:" -msgstr "Ошибка импорта памяти:" - -#: ../chirpui/importdialog.py:376 -msgid "All" -msgstr "Все" - -#: ../chirpui/importdialog.py:382 -msgid "None" -msgstr "Ничего" - -#: ../chirpui/importdialog.py:388 -msgid "Inverse" -msgstr "Инверсия" - -#: ../chirpui/importdialog.py:394 -#, fuzzy -msgid "Select" -msgstr "Выбор" - -#: ../chirpui/importdialog.py:416 -msgid "Auto" -msgstr "Авто" - -#: ../chirpui/importdialog.py:422 -msgid "Reverse" -msgstr "Обратный" - -#: ../chirpui/importdialog.py:428 -msgid "Adjust New Location" -msgstr "Новая позиция" - -#: ../chirpui/importdialog.py:438 -msgid "Confirm overwrites" -msgstr "Подтверждение перезаписи" - -#: ../chirpui/importdialog.py:444 -msgid "Options" -msgstr "Опции" - -#: ../chirpui/importdialog.py:495 -msgid "Cannot be imported because" -msgstr "Невозможно импортировать, поскольку" - -#: ../chirpui/importdialog.py:513 -#, fuzzy -msgid "Import From File" -msgstr "Импорт из файла" - -#: ../chirpui/importdialog.py:514 ../chirpui/mainapp.py:1196 -msgid "Import" -msgstr "Импорт" - -#: ../chirpui/importdialog.py:534 -msgid "To" -msgstr "Для" - -#: ../chirpui/importdialog.py:535 -msgid "From" -msgstr "От" - -#: ../chirpui/importdialog.py:538 ../chirpui/memedit.py:78 -#: ../chirpui/memedit.py:99 ../chirpui/memedit.py:886 -#: ../chirpui/memedit.py:940 ../chirpui/memedit.py:1068 -msgid "Comment" -msgstr "Комментарий" - -#: ../chirpui/importdialog.py:542 -msgid "Location memory will be imported into" -msgstr "Позиция памяти будет импортирована в" - -#: ../chirpui/importdialog.py:543 -msgid "Location of memory in the file being imported" -msgstr "Позиция памяти в файле импортируется" - -#: ../chirpui/importdialog.py:566 -msgid "Preparing memory list..." -msgstr "Подготовка списка памяти..." - -#: ../chirpui/importdialog.py:575 -#, fuzzy -msgid "Export To File" -msgstr "Экспорт в файл" - -#: ../chirpui/importdialog.py:576 ../chirpui/mainapp.py:1197 -msgid "Export" -msgstr "Экспорт" - -#: ../chirpui/mainapp.py:269 ../chirpui/mainapp.py:483 -msgid "Untitled" -msgstr "Новый" - -#: ../chirpui/mainapp.py:316 ../chirpui/mainapp.py:715 -msgid "CHIRP Radio Images" -msgstr "Образы памяти Chirp" - -#: ../chirpui/mainapp.py:317 ../chirpui/mainapp.py:714 -#: ../chirpui/mainapp.py:880 -msgid "CHIRP Files" -msgstr "CHIRP" - -#: ../chirpui/mainapp.py:318 ../chirpui/mainapp.py:716 -#: ../chirpui/mainapp.py:879 -msgid "CSV Files" -msgstr "CSV" - -#: ../chirpui/mainapp.py:319 ../chirpui/mainapp.py:717 -msgid "ICF Files" -msgstr "ICF" - -#: ../chirpui/mainapp.py:320 ../chirpui/mainapp.py:718 -msgid "VX7 Commander Files" -msgstr "VX7 Commander" - -#: ../chirpui/mainapp.py:330 -msgid "ICF files cannot be edited, only displayed or imported into another file. Open in read-only mode?" -msgstr "Файлы ICF не могут быть отредактированы, возможно только показать или импортировать в другой файл. Открыть только для чтения?" - -#: ../chirpui/mainapp.py:373 -msgid "There was an error opening {fname}: {error}" -msgstr "Ошибка открытия {fname}: {error}" - -#: ../chirpui/mainapp.py:388 -msgid "{num} errors during open:" -msgstr "{num} ошибки(ок) во время открытия:" - -#: ../chirpui/mainapp.py:394 -msgid "Note:" -msgstr "Заметка:" - -#: ../chirpui/mainapp.py:395 -msgid "The {vendor} {model} operates in live mode. This means that any changes you make are immediately sent to the radio. Because of this, you cannot perform the Save or Upload operations. If you wish to edit the contents offline, please Export to a CSV file, using the File menu." -msgstr "{vendor} {model} программируется в режиме онлайн. Это означает, что любые изменения немедленно загружаются в станцию. По этой причине невозможно использовать операции Сохранить или Загрузить. Если вы хотите редактировать данные офлайн, то используйте Экспорт в файл CSV из меню Файл." - -#: ../chirpui/mainapp.py:404 -msgid "Don't show this again" -msgstr "Не отображать снова" - -#: ../chirpui/mainapp.py:448 -msgid "{vendor} {model} image file" -msgstr "Изображение {vendor} {model}" - -#: ../chirpui/mainapp.py:456 -msgid "VX7 Commander" -msgstr "VX7 Commander" - -#: ../chirpui/mainapp.py:518 -msgid "Open recent file {name}" -msgstr "Открыть недавний файл {name}" - -#: ../chirpui/mainapp.py:579 -msgid "Import stock configuration {name}" -msgstr "Импорт предустановленную конфигурацию {name}" - -#: ../chirpui/mainapp.py:595 -msgid "Open stock configuration {name}" -msgstr "Открыть предустановленную конфигурацию {name}" - -#: ../chirpui/mainapp.py:681 -msgid "Discard Changes?" -msgstr "Не сохранять изменения?" - -#: ../chirpui/mainapp.py:686 -msgid "File is modified, save changes before closing?" -msgstr "Файл изменён, сохранить изменения?" - -#: ../chirpui/mainapp.py:923 -msgid "With significant contributions by:" -msgstr "При значительном участии:" - -#: ../chirpui/mainapp.py:940 -msgid "Select Columns" -msgstr "Выбрать столбцы" - -#: ../chirpui/mainapp.py:955 -msgid "Visible columns for {radio}" -msgstr "Видимые столбцы для {radio}" - -#: ../chirpui/mainapp.py:1012 -msgid "Reporting is disabled" -msgstr "Отчёты отключены" - -#: ../chirpui/mainapp.py:1013 -msgid "The reporting feature of CHIRP is designed to help improve quality by allowing the authors to focus on the radio drivers used most often and errors experienced by the users. The reports contain no identifying information and are used only for statistical purposes by the authors. Your privacy is extremely important, but please consider leaving this feature enabled to help make CHIRP better!\n" -"\n" -"Are you sure you want to disable this feature?" -msgstr "Функция отправки отчётов позволяет авторам получать информацию об ошибках программы, чтобы своевремменно улучшать её для Вас. Никакой персональной информации при этом не собирается и не отправляется. Позволяя программе отправлять отчёты вы помогаете авторам в дальнейшем усовершенствовании программы.\n" -"\n" -"\n" -"Вы действительно хотите отключить эту функцию?" - -#: ../chirpui/mainapp.py:1045 -msgid "Choose a language or Auto to use the operating system default. You will need to restart the application before the change will take effect" -msgstr "Выберите язык или Авто для использования языка операционной системы. Вам нужно будет перезапустить приложение, прежде чем изменения вступят в силу." - -#: ../chirpui/mainapp.py:1169 -msgid "_File" -msgstr "_Файл" - -#: ../chirpui/mainapp.py:1172 -msgid "Open stock config" -msgstr "Открыть предустановленные конфигурации" - -#: ../chirpui/mainapp.py:1173 -msgid "_Recent" -msgstr "_Недавние" - -#: ../chirpui/mainapp.py:1178 -msgid "_Edit" -msgstr "_Правка" - -#: ../chirpui/mainapp.py:1179 -msgid "_Cut" -msgstr "_Вырезать" - -#: ../chirpui/mainapp.py:1180 -msgid "_Copy" -msgstr "_Копировать" - -#: ../chirpui/mainapp.py:1181 -msgid "_Paste" -msgstr "_Вставить" - -#: ../chirpui/mainapp.py:1182 -msgid "_Delete" -msgstr "_Удалить" - -#: ../chirpui/mainapp.py:1183 -msgid "Move _Up" -msgstr "Вверх_" - -#: ../chirpui/mainapp.py:1184 -#, fuzzy -msgid "Move Dow_n" -msgstr "Вниз_" - -#: ../chirpui/mainapp.py:1185 -msgid "E_xchange" -msgstr "Обмен_" - -#: ../chirpui/mainapp.py:1186 -msgid "_View" -msgstr "Вид_" - -#: ../chirpui/mainapp.py:1187 -msgid "Columns" -msgstr "Столбцы" - -#: ../chirpui/mainapp.py:1188 -msgid "Developer" -msgstr "Разработчик" - -#: ../chirpui/mainapp.py:1189 -msgid "Show raw memory" -msgstr "Show raw memory" - -#: ../chirpui/mainapp.py:1190 -msgid "Diff raw memories" -msgstr "Diff raw memories" - -#: ../chirpui/mainapp.py:1191 -msgid "Diff tabs" -msgstr "Diff tabs" - -#: ../chirpui/mainapp.py:1192 -msgid "Change language" -msgstr "Изменить язык" - -#: ../chirpui/mainapp.py:1193 -msgid "_Radio" -msgstr "_Станция" - -#: ../chirpui/mainapp.py:1194 -msgid "Download From Radio" -msgstr "Чтение из станции" - -#: ../chirpui/mainapp.py:1195 -msgid "Upload To Radio" -msgstr "Запись в станцию" - -#: ../chirpui/mainapp.py:1198 -msgid "Import from RFinder" -msgstr "Импорт из RFinder" - -#: ../chirpui/mainapp.py:1199 -msgid "CHIRP Native File" -msgstr "Файл CHIRP" - -#: ../chirpui/mainapp.py:1200 -msgid "CSV File" -msgstr "CSV" - -#: ../chirpui/mainapp.py:1201 -msgid "Import from RepeaterBook" -msgstr "Импорт из RepeaterBook" - -#: ../chirpui/mainapp.py:1202 -#, fuzzy -msgid "Import from stock config" -msgstr "Импорт из предустановленных конфигураций" - -#: ../chirpui/mainapp.py:1204 -msgid "Help" -msgstr "Справка" - -#: ../chirpui/mainapp.py:1215 -msgid "Report statistics" -msgstr "Отправка статистики" - -#: ../chirpui/mainapp.py:1216 -msgid "Hide Unused Fields" -msgstr "Скрыть неиспользуемые поля" - -#: ../chirpui/mainapp.py:1217 -msgid "Automatic Repeater Offset" -msgstr "Авторазнос для репитера" - -#: ../chirpui/mainapp.py:1218 -msgid "Enable Developer Functions" -msgstr "Режим разработчика" - -#: ../chirpui/mainapp.py:1352 -msgid "Error reporting is enabled" -msgstr "Отчёты об ошибках включены" - -#: ../chirpui/mainapp.py:1355 -msgid "If you wish to disable this feature you may do so in the Help menu" -msgstr "Отключить эту функцию можно в меню Справка" - -#: ../chirpui/cloneprog.py:43 -msgid "Clone Progress" -msgstr "Загрузка" - -#: ../chirpui/cloneprog.py:46 -msgid "Cloning" -msgstr "Загрузка" - -#: ../chirpui/cloneprog.py:55 -msgid "Cancel" -msgstr "Отмена" - -#: ../chirpui/shiftdialog.py:27 -msgid "Shift" -msgstr "Сдвиг" - -#: ../chirpui/shiftdialog.py:63 -msgid "Moving {src} to {dst}" -msgstr "Перемещение {src} до {dst}" - -#: ../chirpui/shiftdialog.py:80 -msgid "Looking for a free spot ({number})" -msgstr "Поиск свободной точки ({number})" - -#: ../chirpui/shiftdialog.py:135 -msgid "Moved {count} memories" -msgstr "Перемещенно {count} памяти" - -#: ../chirpui/clone.py:35 -#, fuzzy -msgid "{vendor} {model} on {port}" -msgstr "{vendor} {model} на {port}" - -#: ../chirpui/clone.py:100 ../chirpui/clone.py:162 -msgid "Detect" -msgstr "Проверка" - -#: ../chirpui/clone.py:123 -msgid "Port" -msgstr "Порт" - -#: ../chirpui/clone.py:124 -msgid "Vendor" -msgstr "Изготовитель" - -#: ../chirpui/clone.py:125 -msgid "Model" -msgstr "Модель" - -#: ../chirpui/clone.py:138 -#, fuzzy -msgid "Radio" -msgstr "Станция" - -#: ../chirpui/clone.py:166 -msgid "Unable to detect radio on {port}" -msgstr "Станция не обнаружена на {port}" - -#: ../chirpui/clone.py:178 -msgid "Internal error: Unable to upload to {model}" -msgstr "Ошибка: Невозможно загрузить в {model}" - -#: ../chirpui/clone.py:226 -msgid "Clone failed: {error}" -msgstr "Ошибка загрузки {error}" - -#: ../chirpui/dstaredit.py:40 -msgid "Callsign" -msgstr "Позывной" - -#: ../chirpui/dstaredit.py:124 -msgid "Your callsign" -msgstr "Ваш позывной" - -#: ../chirpui/dstaredit.py:132 -msgid "Repeater callsign" -msgstr "Позывной репитера" - -#: ../chirpui/dstaredit.py:140 -msgid "My callsign" -msgstr "Мой позывной" - -#: ../chirpui/dstaredit.py:170 ../chirpui/memedit.py:1365 -msgid "Downloading URCALL list" -msgstr "Загрузка URCALL" - -#: ../chirpui/dstaredit.py:174 ../chirpui/memedit.py:1377 -msgid "Downloading RPTCALL list" -msgstr "Загрузка RPTCALL" - -#: ../chirpui/dstaredit.py:178 -msgid "Downloading MYCALL list" -msgstr "Загрузка MYCALL" - -#: ../chirpui/editorset.py:87 -#, fuzzy -msgid "Memories" -msgstr "Память" - -#: ../chirpui/editorset.py:92 -msgid "D-STAR" -msgstr "D-STAR" - -#: ../chirpui/editorset.py:98 -msgid "Bank Names" -msgstr "Имена банков" - -#: ../chirpui/editorset.py:104 -msgid "Banks" -msgstr "Банки" - -#: ../chirpui/editorset.py:222 -msgid "The {vendor} {model} has multiple independent sub-devices" -msgstr "{vendor} {model} имеет несколько различных подустройства" - -#: ../chirpui/editorset.py:225 -msgid "Choose one to import from:" -msgstr "Выберите один для импорта из:" - -#: ../chirpui/editorset.py:230 -msgid "Cancelled" -msgstr "Отменено" - -#: ../chirpui/editorset.py:235 -msgid "Internal Error" -msgstr "Ошибка" - -#: ../chirpui/editorset.py:248 -msgid "There were errors while opening {file}. The affected memories will not be importable!" -msgstr "Были обнаружены ошибки при открытии. Затронутая память не сможет быть импортирована." - -#: ../chirpui/editorset.py:260 -#, fuzzy -msgid "There was an error during import: {error}" -msgstr "Ошибка открытия{fname}: {error}" - -#: ../chirpui/editorset.py:270 -msgid "Unsupported file type" -msgstr "Неподдерживаемый тип файла" - -#: ../chirpui/editorset.py:286 ../chirpui/editorset.py:301 -#, fuzzy -msgid "There was an error during export: {error}" -msgstr "Ошибка открытия {fname}: {error}" - -#: ../chirpui/editorset.py:313 -msgid "Priming memory" -msgstr "Первичная память" - -#: ../chirpui/memedit.py:52 -msgid "Invalid value for this field" -msgstr "Неверное значение для этого поля" - -#: ../chirpui/memedit.py:66 ../chirpui/memedit.py:97 ../chirpui/memedit.py:111 -#: ../chirpui/memedit.py:204 ../chirpui/memedit.py:312 -#: ../chirpui/memedit.py:874 ../chirpui/memedit.py:931 -#: ../chirpui/memedit.py:1069 ../chirpui/memedit.py:1133 -msgid "Tone Mode" -msgstr "Вид субтона" - -#: ../chirpui/memedit.py:67 ../chirpui/memedit.py:87 ../chirpui/memedit.py:103 -#: ../chirpui/memedit.py:214 ../chirpui/memedit.py:218 -#: ../chirpui/memedit.py:220 ../chirpui/memedit.py:310 -#: ../chirpui/memedit.py:875 ../chirpui/memedit.py:928 -#: ../chirpui/memedit.py:1070 -msgid "Tone" -msgstr "ТонПРД" - -#: ../chirpui/memedit.py:68 ../chirpui/memedit.py:88 ../chirpui/memedit.py:104 -#: ../chirpui/memedit.py:210 ../chirpui/memedit.py:218 -#: ../chirpui/memedit.py:221 ../chirpui/memedit.py:310 -#: ../chirpui/memedit.py:876 ../chirpui/memedit.py:929 -#: ../chirpui/memedit.py:1066 -msgid "ToneSql" -msgstr "ТонШПД" - -#: ../chirpui/memedit.py:69 ../chirpui/memedit.py:89 ../chirpui/memedit.py:105 -#: ../chirpui/memedit.py:211 ../chirpui/memedit.py:215 -#: ../chirpui/memedit.py:222 ../chirpui/memedit.py:306 -#: ../chirpui/memedit.py:877 ../chirpui/memedit.py:930 -#: ../chirpui/memedit.py:1059 -msgid "DTCS Code" -msgstr "DTCSПРД" - -#: ../chirpui/memedit.py:70 ../chirpui/memedit.py:90 ../chirpui/memedit.py:106 -#: ../chirpui/memedit.py:212 ../chirpui/memedit.py:216 -#: ../chirpui/memedit.py:223 ../chirpui/memedit.py:878 -#: ../chirpui/memedit.py:933 ../chirpui/memedit.py:1060 -msgid "DTCS Pol" -msgstr "DTCS Pol" - -#: ../chirpui/memedit.py:71 ../chirpui/memedit.py:91 ../chirpui/memedit.py:112 -#: ../chirpui/memedit.py:879 ../chirpui/memedit.py:932 -#: ../chirpui/memedit.py:1067 ../chirpui/memedit.py:1134 -msgid "Cross Mode" -msgstr "Кроссрежим" - -#: ../chirpui/memedit.py:72 ../chirpui/memedit.py:92 ../chirpui/memedit.py:109 -#: ../chirpui/memedit.py:137 ../chirpui/memedit.py:205 -#: ../chirpui/memedit.py:249 ../chirpui/memedit.py:312 -#: ../chirpui/memedit.py:880 ../chirpui/memedit.py:934 -#: ../chirpui/memedit.py:1071 ../chirpui/memedit.py:1144 -msgid "Duplex" -msgstr "Дуплекс" - -#: ../chirpui/memedit.py:73 ../chirpui/memedit.py:93 ../chirpui/memedit.py:135 -#: ../chirpui/memedit.py:198 ../chirpui/memedit.py:226 -#: ../chirpui/memedit.py:250 ../chirpui/memedit.py:308 -#: ../chirpui/memedit.py:881 ../chirpui/memedit.py:935 -#: ../chirpui/memedit.py:1062 -msgid "Offset" -msgstr "Смещение" - -#: ../chirpui/memedit.py:74 ../chirpui/memedit.py:94 ../chirpui/memedit.py:107 -#: ../chirpui/memedit.py:882 ../chirpui/memedit.py:936 -#: ../chirpui/memedit.py:1061 ../chirpui/memedit.py:1132 -#: ../chirpui/memedit.py:1289 ../chirpui/memedit.py:1307 -#: ../chirpui/memedit.py:1317 -msgid "Mode" -msgstr "Режим" - -#: ../chirpui/memedit.py:75 ../chirpui/memedit.py:95 ../chirpui/memedit.py:108 -#: ../chirpui/memedit.py:296 ../chirpui/memedit.py:883 -#: ../chirpui/memedit.py:937 ../chirpui/memedit.py:1073 -#: ../chirpui/memedit.py:1136 ../chirpui/memedit.py:1140 -msgid "Power" -msgstr "Мощность" - -#: ../chirpui/memedit.py:76 ../chirpui/memedit.py:96 ../chirpui/memedit.py:110 -#: ../chirpui/memedit.py:140 ../chirpui/memedit.py:143 -#: ../chirpui/memedit.py:884 ../chirpui/memedit.py:938 -#: ../chirpui/memedit.py:1064 -msgid "Tune Step" -msgstr "Шаг" - -#: ../chirpui/memedit.py:77 ../chirpui/memedit.py:98 ../chirpui/memedit.py:885 -#: ../chirpui/memedit.py:939 ../chirpui/memedit.py:1072 -#: ../chirpui/memedit.py:1135 -msgid "Skip" -msgstr "Пропуск" - -#: ../chirpui/memedit.py:175 -msgid "Erasing memory {loc}" -msgstr "Стирание памяти {loc}" - -#: ../chirpui/memedit.py:236 -msgid "Unable to make changes to this model" -msgstr "Невозможно внести изменения в эту модель" - -#: ../chirpui/memedit.py:241 -msgid "Editing new item, taking defaults" -msgstr "Для новой позиции настройки по умолчанию" - -#: ../chirpui/memedit.py:257 -msgid "Bad value for {col}: {val}" -msgstr "Некорректное значение для {col}: {val}" - -#: ../chirpui/memedit.py:281 -msgid "Error setting memory" -msgstr "Ошибка установки памяти" - -#: ../chirpui/memedit.py:289 ../chirpui/memedit.py:356 -#: ../chirpui/memedit.py:1272 -msgid "Writing memory {number}" -msgstr "запись памяти {number}" - -#: ../chirpui/memedit.py:361 -msgid "This operation requires moving all subsequent channels by one spot until an empty location is reached. This can take a LONG time. Are you sure you want to do this?" -msgstr "Эта операция потребует перемещения всех последующих каналов в одно место, пока свободное место не дудет достигнуто. Это может занять ОЧЕНЬ много времени. Вы уверены, что хотите это сделать?" - -#: ../chirpui/memedit.py:387 -msgid "Adding memory {number}" -msgstr "Добавление памяти {number}" - -#: ../chirpui/memedit.py:400 ../chirpui/memedit.py:913 -msgid "Erasing memory {number}" -msgstr "Стирание памяти {number}" - -#: ../chirpui/memedit.py:409 ../chirpui/memedit.py:518 -#: ../chirpui/memedit.py:564 ../chirpui/memedit.py:569 -#: ../chirpui/memedit.py:856 ../chirpui/memedit.py:1166 -msgid "Getting memory {number}" -msgstr "Получение памяти {number}" - -#: ../chirpui/memedit.py:497 ../chirpui/memedit.py:508 -#: ../chirpui/memedit.py:556 -msgid "Moving memory from {old} to {new}" -msgstr "Перемещение памяти из {old} в {new}" - -#: ../chirpui/memedit.py:578 -msgid "Raw memory {number}" -msgstr "Бинарная память {number}" - -#: ../chirpui/memedit.py:582 ../chirpui/memedit.py:610 -#: ../chirpui/memedit.py:615 -msgid "Getting raw memory {number}" -msgstr "Получение бинарной памяти {number}" - -#: ../chirpui/memedit.py:587 -msgid "You can only diff two memories!" -msgstr "You can only diff two memories!" - -#: ../chirpui/memedit.py:598 -msgid "Memory {number}" -msgstr "Память {number}" - -#: ../chirpui/memedit.py:604 -msgid "Diff of {a} and {b}" -msgstr "Diff of {a} and {b}" - -#: ../chirpui/memedit.py:628 -msgid "Memories must be contiguous" -msgstr "Память должна быть непрерывной" - -#: ../chirpui/memedit.py:700 -msgid "Insert row above" -msgstr "Вставка строки выше" - -#: ../chirpui/memedit.py:701 -msgid "Insert row below" -msgstr "Вставка строки ниже" - -#: ../chirpui/memedit.py:702 -#, fuzzy -msgid "Delete" -msgstr "_Удалить" - -#: ../chirpui/memedit.py:702 -#, fuzzy -msgid "Delete all" -msgstr "_Удалить всё" - -#: ../chirpui/memedit.py:703 -msgid "Delete (and shift up)" -msgstr "Удалить (и сдвинуть вверх)" - -#: ../chirpui/memedit.py:704 -#, fuzzy -msgid "Move up" -msgstr "Вверх" - -#: ../chirpui/memedit.py:705 -#, fuzzy -msgid "Move down" -msgstr "Вниз" - -#: ../chirpui/memedit.py:706 -#, fuzzy -msgid "Exchange memories" -msgstr "Обмен памяти" - -#: ../chirpui/memedit.py:707 -#, fuzzy -msgid "Cut" -msgstr "Вырезать" - -#: ../chirpui/memedit.py:708 -#, fuzzy -msgid "Copy" -msgstr "Копировать" - -#: ../chirpui/memedit.py:709 -#, fuzzy -msgid "Paste" -msgstr "Вставить" - -#: ../chirpui/memedit.py:710 -#, fuzzy -msgid "Show Raw Memory" -msgstr "Show Raw Memory\t" - -#: ../chirpui/memedit.py:711 -#, fuzzy -msgid "Diff Raw Memories" -msgstr "Diff raw memories" - -#: ../chirpui/memedit.py:835 -msgid "Internal Error: Column {name} not found" -msgstr "Ошибка: Столбец {name} не найден" - -#: ../chirpui/memedit.py:863 -msgid "Getting channel {chan}" -msgstr "Получение канала {chan}" - -#: ../chirpui/memedit.py:952 -msgid "Internal Error: Invalid limit {number}" -msgstr "Ошибка: недопустимый предел {number}" - -#: ../chirpui/memedit.py:962 -msgid "Memory range:" -msgstr "Диапазон каналов" - -#: ../chirpui/memedit.py:989 -msgid "Go" -msgstr "Ок" - -#: ../chirpui/memedit.py:1012 -msgid "Special Channels" -msgstr "Специальные каналы" - -#: ../chirpui/memedit.py:1019 -msgid "Show Empty" -msgstr "Показывать пустые" - -#: ../chirpui/memedit.py:1198 -msgid "Cutting memory {number}" -msgstr "Обрезка памяти {number}" - -#: ../chirpui/memedit.py:1232 -msgid "Overwrite?" -msgstr "Перезаписать?" - -#: ../chirpui/memedit.py:1237 -msgid "Overwrite location {number}?" -msgstr "Перезаписать расположение {number}?" - -#: ../chirpui/memedit.py:1254 -msgid "Incompatible Memory" -msgstr "Несовместимая память" - -#: ../chirpui/memedit.py:1257 -msgid "Pasted memory {number} is not compatible with this radio because:" -msgstr "Вставленная память {number} не совместима с этой станцией, потому что:" - -#: ../chirpui/memedit.py:1309 ../chirpui/memedit.py:1324 -msgid "URCALL" -msgstr "URCALL" - -#: ../chirpui/memedit.py:1309 ../chirpui/memedit.py:1325 -msgid "RPT1CALL" -msgstr "RPT1CALL" - -#: ../chirpui/memedit.py:1309 ../chirpui/memedit.py:1326 -msgid "RPT2CALL" -msgstr "RPT2CALL" - -#: ../chirpui/memedit.py:1310 ../chirpui/memedit.py:1327 -msgid "Digital Code" -msgstr "Цифровой код" - diff --git a/locale/tr_TR.po b/locale/tr_TR.po deleted file mode 100644 index b183300..0000000 --- a/locale/tr_TR.po +++ /dev/null @@ -1,2220 +0,0 @@ -msgid "" -msgstr "" -"Project-Id-Version: CHIRP\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: \n" -"PO-Revision-Date: 2022-09-25 01:05+0300\n" -"Last-Translator: Abdullah YILMAZ (TA1AUB) \n" -"Language-Team: TURKISH\n" -"Language: tr\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" -"X-Generator: Poedit 3.1.1\n" -"X-Poedit-SourceCharset: UTF-8\n" - -msgid "...and shift all memories up" -msgstr "... ve tüm kayıtları yukarı kaydır" - -msgid "...and shift block up" -msgstr "...ve bloğu yukarı kaydır" - -msgid "A new version of CHIRP is available: " -msgstr "CHIRP'in yeni bir sürümü mevcut: " - -msgid "A new version of CHIRP is available: {ver}. " -msgstr "CHIRP'in yeni bir sürümü mevcut: {ver}. " - -msgid "About" -msgstr "Hakkında" - -msgid "Adding memory {number}" -msgstr "{number} kaydı ekleniyor" - -msgid "Adjust New Location" -msgstr "Yeni Konumu Ayarla" - -msgid "All" -msgstr "Tümü" - -msgid "All files" -msgstr "Tüm dosyalar" - -msgid "An error has occurred" -msgstr "Bir hata oluştu" - -msgid "Auto" -msgstr "Otomatik" - -msgid "Automatic Repeater Offset" -msgstr "Otomatik Tekrarlama Ofseti" - -msgid "Bad value for {col}: {val}" -msgstr "{col} için kötü değer: {val}" - -msgid "Band plans define default channel settings for frequencies in a region. Choose a band plan or None for completely manual channel settings." -msgstr "Bant planları, bir bölgedeki frekanslar için varsayılan kanal ayarlarını tanımlar. Tamamen manuel kanal ayarları için bir bant planını veya Hiçbirini seçin." - -msgid "Bank" -msgstr "Banka" - -msgid "Bank Names" -msgstr "Banka İsimleri" - -msgid "Banks" -msgstr "Bankalar" - -msgid "Browser" -msgstr "Tarayıcı" - -msgid "CHIRP" -msgstr "CHIRP" - -msgid "CHIRP Documentation" -msgstr "CHIRP Belgeleri" - -msgid "CHIRP Files" -msgstr "CHIRP Dosyaları" - -msgid "CHIRP Native File" -msgstr "CHIRP Yerel Dosyası" - -msgid "CHIRP Radio Images" -msgstr "CHIRP Telsiz İmajları" - -msgid "CSV File" -msgstr "CSV Dosyası" - -msgid "CSV Files" -msgstr "CSV Dosyası" - -msgid "Callsign" -msgstr "Çağrı işareti" - -msgid "Cancel" -msgstr "İptal" - -msgid "Cancelled" -msgstr "İptal edildi" - -msgid "Cannot be imported because" -msgstr "İçe aktarılamıyor çünkü" - -msgid "Change Language" -msgstr "Dili Değiştir (Change Language)" - -msgid "Change language" -msgstr "Dili değiştir (Change language)" - -msgid "Channel Defaults" -msgstr "Kanal Varsayılanları" - -msgid "Channel defaults" -msgstr "Kanal varsayılanları" - -msgid "Check this to change the {name} value" -msgstr "{name} değerini değiştirmek için bunu kontrol edin" - -msgid "Choose Language" -msgstr "Dil Seçin" - -msgid "Choose a language or Auto to use the operating system default. You will need to restart the application before the change will take effect" -msgstr "Bir dil seçin veya işletim sistemi varsayılanını kullanmak için otomatiği seçin. Değişikliğin uygulanması için uygulamayı yeniden başlatmanız gerekir" - -msgid "Choose one to import from:" -msgstr "İçe aktarılacak bir şey seçin:" - -msgid "Clear Recently Opened" -msgstr "Son Açılanları Temizle" - -msgid "Clone Progress" -msgstr "Klon İlerlemesi" - -msgid "Clone completed, checking for spurious bytes" -msgstr "Klon tamamlandı, sahte baytlar kontrol ediliyor" - -msgid "Clone failed: {error}" -msgstr "Klon başarısız oldu: {error}" - -msgid "Cloning" -msgstr "Klonlanıyor" - -msgid "Cloning from radio" -msgstr "Telsizden klonlama" - -msgid "Cloning to radio" -msgstr "Telsize klonlama" - -msgid "Close" -msgstr "Kapat" - -msgid "Columns" -msgstr "Sütunlar" - -msgid "Comment" -msgstr "Yorum" - -msgid "Completed" -msgstr "Tamamlandı" - -msgid "Confirm overwrites" -msgstr "Üzerine yazmayı onayla" - -msgid "Copy" -msgstr "Kopyala" - -msgid "Cross Mode" -msgstr "Çapraz Mod" - -msgid "Cross mode" -msgstr "Çapraz mod" - -msgid "Cut" -msgstr "Kes" - -msgid "Cutting memory {number}" -msgstr "{number} kaydı kesiliyor" - -msgid "D-STAR" -msgstr "Takas" - -msgid "DAT Files" -msgstr "DAT Dosyaları" - -msgid "DMR-MARC Repeater Database Dump" -msgstr "DMR-MARC Tekrarlayıcı Veritabanı Dökümü" - -msgid "DMR-MARC Repeaters" -msgstr "DMR-MARC Tekrarlayıcılar" - -msgid "DTCS Code" -msgstr "DTCS Kodu" - -msgid "DTCS Pol" -msgstr "DTCS Pol" - -msgid "DTCS Rx Code" -msgstr "DTCS Rx Kodu" - -msgid "Delete" -msgstr "Sil" - -msgid "Delete (and shift up)" -msgstr "Sil (ve yukarı kaydır)" - -msgid "Delete all" -msgstr "Hepsini sil" - -msgid "Details" -msgstr "Detaylar" - -msgid "Detect" -msgstr "Tespit etme" - -msgid "Developer" -msgstr "Geliştirici" - -msgid "Diff Raw Memories" -msgstr "Farklı Ham kayıtlar" - -msgid "Diff Tabs" -msgstr "Fark Sekmeleri" - -msgid "Diff of {a} and {b}" -msgstr "{a} ve {b} arasındaki fark" - -msgid "Diff raw memories" -msgstr "Farklı ham kayıtlar" - -msgid "Diff tabs" -msgstr "Fark sekmeleri" - -msgid "Digital Code" -msgstr "Dijital Kod" - -msgid "Do not show this next time" -msgstr "Bunu bir dahaki sefere gösterme" - -msgid "Documentation" -msgstr "Belgeler" - -msgid "" -"Documentation for CHIRP, including FAQs, and help for common problems is available on the CHIRP web site, please go to\n" -"\n" -"http://chirp.danplanet.com/projects/chirp/wiki/Documentation\n" -msgstr "" -"CHIRP için SSS'leri de içeren dokümantasyon ve yaygın sorunlara yönelik yardım CHIRP web sitesinde mevcuttur, lütfen şu adrese gidin\n" -"\n" -"http://chirp.danplanet.com/projects/chirp/wiki/Documentation\n" - -msgid "Don't show information for any radio again" -msgstr "Bir daha hiçbir telsiz için bilgi gösterme" - -msgid "Don't show instructions for any radio again" -msgstr "Bir daha hiçbir telsiz için talimatları gösterme" - -msgid "Don't show this again" -msgstr "Bunu bir daha gösterme" - -msgid "Download From Radio" -msgstr "Telsizden İndir" - -msgid "Downloading MYCALL list" -msgstr "MYCALL (çağrı listem) indiriliyor" - -msgid "Downloading RPTCALL list" -msgstr "RPTCAL (tekrarlanan çağrı) listesini indiriliyor" - -msgid "Downloading URCALL list" -msgstr "URCALL (sizin çağrı) listesi indiriliyor" - -msgid "Duplex" -msgstr "Duplex" - -msgid "EVE" -msgstr "EVE" - -msgid "EVE Files (VX5)" -msgstr "EVE Dosyaları (VX5)" - -msgid "E_xchange" -msgstr "T_akas" - -msgid "Edit" -msgstr "Düzenle" - -msgid "Edit Memory #{num}" -msgstr "Kaydı Düzenle #{num}" - -msgid "Edit Memory#{num}" -msgstr "Kaydı Düzenle#{num}" - -msgid "Edit Multiple Memories" -msgstr "Birden Fazla Kaydı Düzenle" - -msgid "Editing new item, taking defaults" -msgstr "Yeni öğe düzenleniyor, varsayılanlar alınıyor" - -msgid "Enable Developer Functions" -msgstr "Geliştirici İşlevlerini Etkinleştir" - -msgid "Enabled" -msgstr "Etkin" - -msgid "Erasing memory {loc}" -msgstr "Kayıt siliniyor {loc}" - -msgid "Erasing memory {number}" -msgstr "Kayıt siliniyor {number}" - -msgid "Error importing memories:" -msgstr "Kayıt içe aktarılırken hata oluştu:" - -msgid "Error in setting value: %s" -msgstr "Değer ayarında hata: %s" - -msgid "Error reporting is enabled" -msgstr "Hata raporlama etkinleştirildi" - -msgid "Error setting memory" -msgstr "Kayıt ayarında hata" - -msgid "Exchange memories" -msgstr "Kayıtları değiştir" - -msgid "Export" -msgstr "Dışa Aktar" - -msgid "Export To File" -msgstr "Dosyaya Aktar" - -msgid "File Exists" -msgstr "Dosya Mevcut" - -msgid "File is modified, save changes before closing?" -msgstr "Dosya değiştirildi, kapatmadan önce değişiklikler kaydedilsin mi?" - -msgid "Frequency" -msgstr "Frekans" - -msgid "From" -msgstr "Dan" - -msgid "General" -msgstr "Genel" - -msgid "Get Help Online..." -msgstr "Çevrimiçi Yardım Alın..." - -msgid "Getting %s information" -msgstr "%s bilgisi alınıyor" - -msgid "Getting bank for memory {num}" -msgstr "{num} kaydı için banka alınıyor" - -msgid "Getting bank information" -msgstr "Banka bilgileri alınıyor" - -msgid "Getting bank information for memory {num}" -msgstr "{num} kaydı için banka bilgileri alınıyor" - -msgid "Getting channel {chan}" -msgstr "{chan} kanalı alınıyor" - -msgid "Getting memory {number}" -msgstr "{number} kaydı alınıyor" - -msgid "Getting memory {num}" -msgstr "{num} kaydı alınıyor" - -msgid "Getting original memory {number}" -msgstr "Orijinal {number} kaydı alınıyor" - -msgid "Getting raw memory {number}" -msgstr "{number} ham kaydı alınıyor" - -msgid "Getting {type} for memory {num}" -msgstr "{num} kaydı için {type} alınıyor" - -msgid "Getting {type} information for memory {num}" -msgstr "{num} kaydı için {type} bilgisi alınıyor" - -msgid "Go" -msgstr "Git" - -msgid "Hamradio;Programming;Handheld;Radio;Amateur;Programmer" -msgstr "AmatörTelsiz;Programlama;ElTipi;Telsiz;Amatör;Programcı" - -msgid "Help" -msgstr "Yardım" - -msgid "Hide Unused Fields" -msgstr "Kullanılmayan Alanları Gizle" - -msgid "ICF Files" -msgstr "ICF Dosyaları" - -msgid "ICF files cannot be edited, only displayed or imported into another file. Open in read-only mode?" -msgstr "ICF dosyaları düzenlenemez, yalnızca görüntülenebilir veya başka bir dosyaya aktarılamaz. Salt okunur modda açılsın mı?" - -msgid "If you wish to disable this feature you may do so in the Help menu" -msgstr "Bu özelliği devre dışı bırakmak isterseniz, bunu Yardım menüsünden yapabilirsiniz" - -msgid "Import" -msgstr "İçe Aktar" - -msgid "Import From Data Source" -msgstr "Veri Kaynağından İçe Aktar" - -msgid "Import From File" -msgstr "Dosyadan İçe Aktar" - -msgid "Import From Stock Config" -msgstr "Stok Yapılandırmasından İçe Aktar" - -msgid "Import from RFinder" -msgstr "RFinder'dan içe aktar" - -msgid "Import from data source" -msgstr "Veri kaynağından içe aktar" - -msgid "Import from stock config" -msgstr "Stok yapılandırmasından içe aktar" - -msgid "Import stock configuration {name}" -msgstr "{name} stok yapılandırmasını içe aktar" - -msgid "Importing bank information" -msgstr "Banka bilgileri içe aktarılıyor" - -msgid "Incompatible Memory" -msgstr "Uyumsuz Kayıt" - -msgid "Index" -msgstr "Dizin" - -msgid "Insert row above" -msgstr "Yukarıya satır ekle" - -msgid "Insert row below" -msgstr "Aşağıya satır ekle" - -msgid "Internal Error" -msgstr "İç Hata" - -msgid "Internal Error: Column {name} not found" -msgstr "Dahili Hata: Sütun {name} bulunamadı" - -msgid "Internal Error: Invalid limit {number}" -msgstr "Dahili Hata: Geçersiz limit {number}" - -msgid "Internal error: Unable to upload to {model}" -msgstr "Dahili hata: {model}'e yüklenemiyor" - -msgid "Invalid setting value: %s" -msgstr "Geçersiz ayar değeri: %s" - -msgid "Invalid value for %s" -msgstr "%s için geçersiz değer" - -msgid "Invalid value for this field" -msgstr "Bu alan için geçersiz değer" - -msgid "Invalid value. Must be an integer." -msgstr "Geçersiz değer. Tam sayı olmak zorunda." - -msgid "Inverse" -msgstr "Ters" - -msgid "Kenwood HMK Files" -msgstr "Kenwood HMK Dosyaları" - -msgid "Kenwood ITM Files" -msgstr "Kenwood ITM Dosyaları" - -msgid "Load Module" -msgstr "Modülü Yükle" - -msgid "Loc" -msgstr "Konum" - -msgid "Location memory will be imported into" -msgstr "Konum kaydı şuraya aktarılacak" - -msgid "Location of memory in the file being imported" -msgstr "İçe aktarılan dosyadaki kaydın konumu" - -msgid "Location {number} is already being imported" -msgstr "{number} konumu zaten içe aktarılıyor" - -msgid "Location {number} is already being imported. Choose another valü for 'New Location' before selection 'Import'" -msgstr "{number} konumu zaten içe aktarılıyor. 'İçe Aktar' seçiminden önce 'Yeni Konum' için başka bir değer seçin" - -msgid "Location {number} is already being imported. Choose another value for 'New Location' before selection 'Import'" -msgstr "{number} konumu zaten içe aktarılıyor. 'İçe Aktar' seçiminden önce 'Yeni Konum' için başka bir değer seçin" - -msgid "Looking for a free spot ({number})" -msgstr "Boş yer arıyorum ({number})" - -msgid "Memories" -msgstr "Kayıtlar" - -msgid "Memories (%(variant)s)" -msgstr "Kayıtlar (%(variant)s)" - -msgid "Memories must be contiguous" -msgstr "Kayıtlar bitişik olmalı" - -msgid "Memory Range:" -msgstr "Kayıt Aralığı:" - -msgid "Memory range:" -msgstr "Kayıt aralığı:" - -msgid "Memory validation failed:" -msgstr "Kayıt doğrulaması başarısız oldu:" - -msgid "Memory {number}" -msgstr "Kayıt {number}" - -msgid "Memory {num} not in bank {bank}" -msgstr "{num} kaydı {bank} bankasında değil" - -msgid "Mode" -msgstr "Mod" - -msgid "Model" -msgstr "Model" - -msgid "Modules" -msgstr "Modüller" - -msgid "Move Dow_n" -msgstr "Aşağı Taş_ı" - -msgid "Move _Up" -msgstr "Yukarı _Taşı" - -msgid "Move down" -msgstr "Aşağı taşı" - -msgid "Move up" -msgstr "Yukarı taşı" - -msgid "Moved {count} memories" -msgstr "{count} kaydı taşındı" - -msgid "Moving memory from {old} to {new}" -msgstr "Kayıt {old} olandan {new} olana taşınıyor..." - -msgid "Moving {src} to {dst}" -msgstr "{src}, {dst}'e taşınıyor" - -msgid "My callsign" -msgstr "Benim çağrı işaretim" - -msgid "Name" -msgstr "İsim" - -msgid "New" -msgstr "Yeni" - -msgid "No space to insert a row" -msgstr "Satır eklemek için boşluk yok" - -msgid "None" -msgstr "Hiçbiri" - -msgid "Note:" -msgstr "Not:" - -msgid "Offset" -msgstr "Ofset" - -msgid "Open" -msgstr "Aç" - -msgid "Open Recent" -msgstr "Son Kullanılanları Aç" - -msgid "Open Stock Config" -msgstr "Stok Yapılandırmasını Aç" - -msgid "Open _Recent" -msgstr "Son _Kullanılanları Aç" - -msgid "Open recent file" -msgstr "Son dosyayı aç" - -msgid "Open recent file {name}" -msgstr "{name} geçmiş dosyasını aç" - -msgid "Open stock config" -msgstr "Stok yapılandırmasını aç" - -msgid "Open stock configuration {name}" -msgstr "{name} stok yapılandırmasını aç" - -msgid "Options" -msgstr "Seçenekler" - -msgid "Other" -msgstr "Diğer" - -msgid "Overwrite" -msgstr "Üzerine yaz" - -msgid "Overwrite location {number}?" -msgstr "{number} konumunun üzerine yazılsın mı?" - -msgid "Overwrite?" -msgstr "Üzerine yazılsın mı?" - -msgid "P_roperties" -msgstr "Ö_zellikler" - -msgid "Paste" -msgstr "Yapıştır" - -msgid "Pasted memory {number} is not compatible with this radio because:" -msgstr "Yapıştırılan {number} kaydı bu telsizle uyumlu değil çünkü:" - -msgid "Port" -msgstr "Port" - -msgid "Power" -msgstr "Güç" - -msgid "Preparing memory list..." -msgstr "Kayıt listesi hazırlanıyor..." - -msgid "Priming memory" -msgstr "Kayıt hazırlanıyor" - -msgid "Proceed with experimental driver?" -msgstr "Deneysel sürücü ile devam edilsin mi?" - -msgid "Proceed?" -msgstr "Devam et?" - -msgid "Program amateur radios" -msgstr "Amatör telsizleri programla" - -msgid "Properties" -msgstr "Özellikler" - -msgid "Python Modules" -msgstr "Python Modülleri" - -msgid "Query Data Source" -msgstr "Veri Kaynağını Sorgula" - -msgid "Query data source" -msgstr "Veri kaynağını sorgula" - -msgid "Query failed" -msgstr "Sorgu başarısız" - -msgid "Quit" -msgstr "Çıkış" - -msgid "RFinder" -msgstr "RFinder" - -msgid "RPT1CALL" -msgstr "RFinder" - -msgid "RPT2CALL" -msgstr "RPT2CALL" - -msgid "RX DTCS Code" -msgstr "RX DTCS Kodu" - -msgid "Radio" -msgstr "Telsiz" - -msgid "Radio Programming Tool" -msgstr "Telsiz Programlama Aracı" - -msgid "Radio did not ack block %i" -msgstr "Telsiz %i bloğunu onaylamadı" - -msgid "Radio sent data after the last awaited block, this happens when the selected model is a non-US but the radio is a US one. Please choose the correct model and try again." -msgstr "Telsiz, beklenen son bloktan sonra veri gönderdi, bu, seçilen model ABD dışındaysa gerçekleşir ama telsiz bir ABD telsizi. Lütfen doğru modeli seçin ve tekrar deneyin." - -msgid "RadioReference" -msgstr "RadioReference" - -msgid "RadioReference.com" -msgstr "RadioReference.com" - -msgid "RadioReference.com Canada" -msgstr "RadioReference.com Kanada" - -msgid "RadioReference.com Province Query" -msgstr "RadioReference.com İl Sorgusu" - -msgid "RadioReference.com Query" -msgstr "RadioReference.com Sorgusu" - -msgid "RadioReference.com US" -msgstr "RadioReference.com ABD" - -msgid "Raw memory {number}" -msgstr "Ham kayıt {number}" - -msgid "Refresh" -msgstr "Yenile" - -msgid "Repeater callsign" -msgstr "Tekrarlayıcı çağrı işareti" - -msgid "RepeaterBook" -msgstr "RepeaterBook" - -msgid "RepeaterBook Political Query" -msgstr "RepeaterBook Siyasi Sorgusu" - -msgid "RepeaterBook Proximity Query" -msgstr "RepeaterBook Yakınlık Sorgusu" - -msgid "RepeaterBook Query" -msgstr "RepeaterBook Sorgusu" - -msgid "RepeaterBook query failed" -msgstr "RepeaterBook sorgusu başarısız oldu" - -msgid "Report Statistics" -msgstr "İstatistikleri Rapor Et" - -msgid "Report statistics" -msgstr "İstatistikleri rapor et" - -msgid "Reporting is disabled" -msgstr "Raporlama devre dışı" - -msgid "Retrieving %s information" -msgstr "%s bilgisi alınıyor" - -msgid "Retrieving bank information" -msgstr "Banka bilgileri alınıyor" - -msgid "Reverse" -msgstr "Tersi" - -msgid "Save" -msgstr "Kaydet" - -msgid "Save As" -msgstr "Farklı Kaydet" - -msgid "Save Changes?" -msgstr "Değişiklikleri Kaydet?" - -msgid "Select" -msgstr "Seç" - -msgid "Select All" -msgstr "Tümünü seç" - -msgid "Select Columns" -msgstr "Sütunları Seç" - -msgid "Select _All" -msgstr "Tümünü _Seç" - -msgid "Setting index for memory {num}" -msgstr "{num} kaydı için ayar dizini" - -msgid "Setting memory {number}" -msgstr "Kaydın ayarlanması {sayı}" - -msgid "Setting name on %s" -msgstr "%s üzerinde ad ayarlanıyor" - -msgid "Setting name on bank" -msgstr "Bankada isim ayarlama" - -msgid "Settings" -msgstr "Ayarlar" - -msgid "Shift" -msgstr "Shift" - -msgid "Show Empty" -msgstr "Boş Kayıtlar" - -msgid "Show Information" -msgstr "Bilgi göster" - -msgid "Show Instructions" -msgstr "Talimatları Göster" - -msgid "Show Raw Memory" -msgstr "Ham Kaydı Göster" - -msgid "Show raw memory" -msgstr "Ham kaydı göster" - -msgid "Skip" -msgstr "Atla" - -msgid "Smart Tone Modes" -msgstr "Akıllı Ton Modları" - -msgid "Special Channels" -msgstr "Özel Kanallar" - -msgid "The file {name} already exists. Do you want to overwrite it?" -msgstr "{name} dosyası zaten var. Üzerine yazmak istiyor musunuz?" - -msgid "" -"The reporting feature of CHIRP is designed to help improve quality by allowing the authors to focus on the radio drivers used most often and errors experienced by the users. The reports contain no " -"identifying information and are used only for statistical purposes by the authors. Your privacy is extremely important, but please consider leaving this feature enabled to help make CHIRP better!\n" -"\n" -"Are you sure you want to disable this feature?" -msgstr "" -"CHIRP'in raporlama özelliği, yazarların en sık kullanılan telsiz sürücülerine ve kullanıcıların yaşadığı hatalara odaklanmasını sağlayarak kaliteyi iyileştirmeye yardımcı olmak için tasarlanmıştır. Raporlar " -"tanımlayıcı bilgi içermez ve yazarlar tarafından yalnızca istatistiksel amaçlarla kullanılır. Gizliliğiniz son derece önemlidir, ancak CHIRP'i daha iyi hale getirmeye yardımcı olmak için lütfen bu özelliği " -"etkinleştirmeyi düşünün!\n" -"\n" -"Bu özelliği devre dışı bırakmak istediğinizden emin misiniz?" - -msgid "The {vendor} {model} has multiple independent sub-devices" -msgstr "{vendor} {model} birden çok bağımsız alt cihaza sahip" - -msgid "" -"The {vendor} {model} operates in live mode. This means that any changes you make are immediately sent to the radio. Because of this, you cannot perform the Save or Upload operations. If you " -"wish to edit the contents offline, please Export to a CSV file, using the File menu." -msgstr "" -"{vendor} {model} canlı modda çalışır. Bu, yaptığınız tüm değişikliklerin anında telsize gönderileceği anlamına gelir. Bu nedenle, Kaydet veya Yükle işlemlerini gerçekleştiremezsiniz. İçeriği " -"çevrimdışı düzenlemek istiyorsanız, lütfen Dosya menüsünü kullanarak bir CSV dosyasına Dışa aktarın." - -msgid "There was an error during export: {error}" -msgstr "Dışa aktarma sırasında bir hata oluştu: {error}" - -msgid "There was an error during import: {error}" -msgstr "İçe aktarma sırasında bir hata oluştu: {error}" - -msgid "There was an error opening {fname}: {error}" -msgstr "{fname} açılırken bir hata oluştu: {error}" - -msgid "There were errors while opening {file}. The affected memories will not be importable!" -msgstr "{file} açılırken hatalar oluştu. Etkilenen kayıtlar içe aktarılmayacak!" - -msgid "" -"This is experimental support for BJ-9900 which is still under development.\n" -"Please ensure you have a good backup with OEM software.\n" -"Also please send in bug and enhancement requests!\n" -"You have been warned. Proceed at your own risk!" -msgstr "" -"Bu, halen geliştirilmekte olan BJ-9900 için deneysel destektir.\n" -"Lütfen OEM yazılımıyla iyi bir yedeklemeniz olduğundan emin olun.\n" -"Ayrıca lütfen hata raporu ve geliştirme istekleri gönderin!\n" -"Uyarıldınız. Kendi sorumluluğunuzda ilerleyin!" - -msgid "This operation requires moving all subsequent channels by one spot until an empty location is reached. This can take a LONG time. Are you sure you want to do this?" -msgstr "Bu işlem, boş bir konuma ulaşılana kadar sonraki tüm kanalların bir noktada taşınmasını gerektirir. Bu UZUN zaman alabilir. Bunu yapmak istediğinden emin misin?" - -msgid "This radio's driver is experimental. Do you want to proceed?" -msgstr "Bu telsizin sürücüsü deneyseldir. Devam etmek istiyor musunuz?" - -msgid "To" -msgstr "İle" - -msgid "Tone" -msgstr "Ton" - -msgid "Tone Mode" -msgstr "Ton Modu" - -msgid "ToneSql" -msgstr "ToneSql" - -msgid "Travel Plus Files" -msgstr "Seyahat Artı Dosyaları" - -msgid "Tune Step" -msgstr "Adımı Ayarla" - -msgid "URCALL" -msgstr "URCALL" - -msgid "Unable to detect radio on {port}" -msgstr "{port} üzerinde telsiz algılanamadı" - -msgid "Unable to make changes to this model" -msgstr "Bu modelde değişiklik yapılamıyor" - -msgid "Unable to open this image. It was generated with a newer version of CHIRP and thus may be for a radio model that is not supported by this version. Please update to the latest version of CHIRP and try again." -msgstr "Bu imaj açılamıyor. CHIRP'in daha yeni bir sürümüyle oluşturulmuş ve bu nedenle bu sürüm tarafından desteklenmeyen bir telsiz modeli için olabilir. Lütfen en son CHIRP sürümüne güncelleyin ve tekrar deneyin." - -msgid "Unable to open this image: unsupported model" -msgstr "Bu imaj açılamıyor: desteklenmeyen model" - -msgid "Unable to paste {src} memories into {dst} rows. Increase the memory bounds or show empty memories." -msgstr "{src} kayıtları {dst} satırlarına yapıştırılamıyor. Kayıt sınırlarını artırın veya boş kayıtları gösterin." - -msgid "Unable to read last block. This often happens when the selected model is US but the radio is a non-US one (or widebanded). Please choose the correct model and try again." -msgstr "Son blok okunamıyor. Bu genellikle seçilen model ABD olduğunda olur ama telsiz ABD dışı bir telsizdir (veya geniş bantlıdır). Lütfen doğru modeli seçin ve tekrar deneyin." - -msgid "Unsupported file type" -msgstr "Desteklenmeyen dosya türü" - -msgid "Untitled" -msgstr "Başlıksız" - -msgid "Updating RPTCALL list" -msgstr "RPTCALL listesi güncelleniyor" - -msgid "Updating URCALL list" -msgstr "URCALL listesi güncelleniyor" - -msgid "Updating bank index for memory {num}" -msgstr "{num} kaydı için banka dizini güncelleniyor" - -msgid "Updating bank information for memory {num}" -msgstr "{num} kaydı için banka bilgileri güncelleniyor" - -msgid "Updating mapping information for memory {num}" -msgstr "{num} kaydı için eşleme bilgileri güncelleniyor" - -msgid "Updating {type} index for memory {num}" -msgstr "{num} kayıt için {type} dizini güncelleniyor" - -msgid "Upload To Radio" -msgstr "Telsize Yükle" - -msgid "VX5 Commander" -msgstr "VX5 Commander" - -msgid "VX5 Commander Files" -msgstr "VX5 Commander Dosyaları" - -msgid "VX6 Commander" -msgstr "VX6 Commander" - -msgid "VX6 Commander Files" -msgstr "VX6 Commander Dosyaları" - -msgid "VX7 Commander" -msgstr "VX7 Commander" - -msgid "VX7 Commander Files" -msgstr "VX7 Commander Dosyaları" - -msgid "Vendor" -msgstr "Tedarikçi" - -msgid "Visible columns for {radio}" -msgstr "{radio} için görünür sütunlar" - -msgid "With significant contributions by:" -msgstr "Önemli katkılarıyla:" - -msgid "With significant contributions from:" -msgstr "Önemli katkılarla:" - -msgid "Writing memory {number}" -msgstr "{number} kaydı yazılıyor" - -msgid "Yes to All" -msgstr "Hepsine evet" - -msgid "You can only diff two memories!" -msgstr "Sadece iki kaydı birbirinden ayırabilirsin!" - -msgid "Your callsign" -msgstr "Çağrı işaretiniz" - -msgid "_Copy" -msgstr "_Kopyala" - -msgid "_Cut" -msgstr "_Kes" - -msgid "_Delete" -msgstr "_Sil" - -msgid "_Edit" -msgstr "_Düzen" - -msgid "_File" -msgstr "_Dosya" - -msgid "_Paste" -msgstr "_Yapıştır" - -msgid "_Radio" -msgstr "_Telsiz" - -msgid "_Recent" -msgstr "_Geçmiş" - -msgid "_View" -msgstr "_Görünüm" - -msgid "idle" -msgstr "boşta" - -msgid "przemienniki.net" -msgstr "przemienniki.net" - -msgid "these memories" -msgstr "bu kayıtları" - -msgid "this memory" -msgstr "bu kaydı" - -msgid "{bank} is full" -msgstr "{bank} dolu" - -msgid "{information}" -msgstr "{information}" - -msgid "{instructions}" -msgstr "{instructions}" - -msgid "{name} Information" -msgstr "{name} Bilgi" - -msgid "{name} Instructions" -msgstr "{name} Talimatlar" - -msgid "{num} errors during open:" -msgstr "açma sırasında {num} hatalar:" - -msgid "{vendor} {model} image file" -msgstr "{vendor} {model} imaj dosyası" - -msgid "{vendor} {model} on {port}" -msgstr "{vendor} {model} üzerinde {port}" - -msgid "Memory Properties" -msgstr "Kayıt özellikleri" - -msgid "Yes" -msgstr "Evet" - -msgid "No" -msgstr "Hayır" - -msgid "Ok" -msgstr "Tamam" - -msgid "OK" -msgstr "TAMAM" - -msgid "Off" -msgstr "Kapalı" - -msgid "Both" -msgstr "İkisi de" - -msgid "High" -msgstr "Yüksek" - -msgid "Low" -msgstr "Düşük" - -msgid "Basic Settings" -msgstr "Temel Ayarlar" - -msgid "Advanced Settings" -msgstr "Gelişmiş Ayarlar" - -msgid "Other Settings" -msgstr "Diğer ayarlar" - -msgid "Work Mode Settings" -msgstr "Çalışma Modu Ayarları" - -msgid "FM Radio Preset" -msgstr "FM Radyo Ön Ayarı" - -msgid "DTMF Settings" -msgstr "DTMF Ayarları" - -msgid "Service Settings" -msgstr "Servis Ayarları" - -msgid "" -"A new version of CHIRP is available: {ver}. It is recommended that you upgrade as soon as possible. Please go to: \r\n" -"\r\n" -"http://chirp.danplanet.com" -msgstr "" -"CHIRP'in yeni bir sürümü mevcut: {ver}. En kısa sürede yükseltmeniz önerilir. Lütfen git:\n" -"\n" -"http://chirp.danplanet.com" - -msgid "Escape" -msgstr "Çıkış" - -msgid "Icon %s not found" -msgstr "%s simgesi bulunamadı" - -msgid "Closing %i" -msgstr "%i kapatılıyor" - -msgid "Manually selected %s" -msgstr "Manuel olarak seçildi %s" - -msgid "Server reports version %s is available" -msgstr "Sunucu raporları sürümü %s mevcut" - -#: ../chirpdrivers/alinco.py:624 ../chirpdrivers/alinco.py:634 -msgid "" -"1. Ensure your firmware version is 4_10 or higher\n" -"2. Turn radio off\n" -"3. Connect your interface cable\n" -"4. Turn radio on\n" -"5. Press and release PTT 3 times while holding MONI key\n" -"6. Supported baud rates: 57600 (default) and 19200\n" -" (rotate dial while holding MONI to change)\n" -"7. Click OK\n" -msgstr "" -"1. Donanım yazılımı sürümünüzün 4_10 veya üzeri olduğundan emin olun\n" -"2. Telsizi kapatın\n" -"3. Arayüz kablonuzu bağlayın\n" -"4. Telsizi açın\n" -"5. MONI tuşunu basılı tutarken PTT'ye 3 kez basın ve bırakın\n" -"6. Desteklenen baud hızları: 57600 (varsayılan) ve 19200\n" -" (değiştirmek için MONI'ye basılı tutarken kadranı çevirin)\n" -"7. TAMAM'a tıklayın\n" - -#: ../chirpdrivers/baofeng_wp970i.py:324 ../chirpdrivers/gmrsuv1.py:394 ../chirpdrivers/gmrsv2.py:373 ../chirpdrivers/mursv1.py:345 ../chirpdrivers/tdxone_tdq8a.py:457 ../chirpdrivers/uv5x3.py:420 -#: ../chirpdrivers/uv6r.py:344 ../chirpdrivers/vgc.py:592 -msgid "" -"Follow these instructions to download your info:\n" -"\n" -"1 - Turn off your radio\n" -"2 - Connect your interface cable\n" -"3 - Turn on your radio\n" -"4 - Do the download of your radio data\n" -msgstr "" -"Bilgilerinizi indirmek için şu talimatları izleyin:\n" -"\n" -"1 - Telsizinizi kapatın\n" -"2 - Arayüz kablonuzu bağlayın\n" -"3 - Telsizinizi açın\n" -"4 - Telsiz verilerinizin indirilmesini gerçekleştirin\n" - -#: ../chirpdrivers/baofeng_wp970i.py:332 ../chirpdrivers/gmrsuv1.py:403 ../chirpdrivers/gmrsv2.py:381 ../chirpdrivers/lt725uv.py:519 ../chirpdrivers/mursv1.py:353 ../chirpdrivers/tdxone_tdq8a.py:465 -#: ../chirpdrivers/uv5x3.py:428 ../chirpdrivers/uv6r.py:352 -msgid "" -"Follow this instructions to upload your info:\n" -"\n" -"1 - Turn off your radio\n" -"2 - Connect your interface cable\n" -"3 - Turn on your radio\n" -"4 - Do the upload of your radio data\n" -msgstr "" -"Bilgilerinizi yüklemek için şu talimatları izleyin:\n" -"\n" -"1 - Telsizinizi kapatın\n" -"2 - Arayüz kablonuzu bağlayın\n" -"3 - Telsizinizi açın\n" -"4 - Telsiz verilerinizin yüklemesini gerçekleştirin\n" - -#: ../chirpdrivers/bf-t1.py:482 ../chirpdrivers/btech.py:679 -msgid "" -"Follow these instructions to download your info:\n" -"\n" -"1 - Turn off your radio\n" -"2 - Connect your interface cable\n" -"3 - Turn on your radio\n" -"4 - Do the download of your radio data\n" -"\n" -msgstr "" -"Bilgilerinizi indirmek için şu talimatları izleyin:\n" -"\n" -"1 - Telsizinizi kapatın\n" -"2 - Arayüz kablonuzu bağlayın\n" -"3 - Telsizinizi açın\n" -"4 - Telsiz verilerinizin indirilmesini gerçekleştirin\n" -"\n" - -#: ../chirpdrivers/bf-t1.py:491 ../chirpdrivers/btech.py:688 -msgid "" -"Follow these instructions to upload your info:\n" -"\n" -"1 - Turn off your radio\n" -"2 - Connect your interface cable\n" -"3 - Turn on your radio\n" -"4 - Do the upload of your radio data\n" -"\n" -msgstr "" -"Bilgilerinizi yüklemek için şu talimatları izleyin:\n" -"\n" -"1 - Telsizinizi kapatın\n" -"2 - Arayüz kablonuzu bağlayın\n" -"3 - Telsizinizi açın\n" -"4 - Telsiz verilerinizin yüklenmesini gerçekleştirin\n" -"\n" - -#: ../chirpdrivers/bj9900.py:105 -msgid "" -"1. Turn radio off.\n" -"2. Remove front head.\n" -"3. Connect data cable to radio, use the same connector where\n" -" head was connected to, not the mic connector.\n" -"4. Click OK." -msgstr "" -"1. Telsizi kapatın.\n" -"2. Ön başlığı çıkarın.\n" -"3. Veri kablosunu telsize bağlayın, \n" -" mikrofon konektörüne değil kafanın bağlı olduğu konektörü kullanın.\n" -"4. TAMAM'a tıklayın." - -#: ../chirpdrivers/fd268.py:309../chirpdrivers/fd268.py:318 -msgid "" -"This radio has a tricky way of enter into program mode,\n" -"even the original software has a few tries to get inside.\n" -"\n" -"I will try 8 times (most of the time ~3 will doit) and this\n" -"can take a few seconds, if don't work, try again a few times.\n" -"\n" -"If you can get into it, please check the radio and cable." -msgstr "" -"Bu telsizin program moduna girmenin zor bir yolu var,\n" -"orijinal yazılım ile bile girmek için birkaç deneme yapmak gerekir.\n" -"\n" -"8 kez deneyeceğim (çoğu zaman ~3 de işe yarar) ve bu\n" -"birkaç saniye sürebilir, işe yaramazsa birkaç kez tekrar deneyin.\n" -"\n" -"İşe yaramazsa, lütfen telsizi ve kabloyu kontrol edin." - -#: ../chirpdrivers/ft1d.py:649 -msgid "" -"1. Turn radio off.\n" -"2. Connect cable to DATA terminal.\n" -"3. Press and hold in the [F] key while turning the radio on\n" -" (\"CLONE\" will appear on the display).\n" -"4. After clicking OK, press the [BAND] key to send image." -msgstr "" -"1. Telsizi kapatın.\n" -"2. Kabloyu DATA terminaline bağlayın.\n" -"3. Telsizi açarken [F] tuşunu basılı tutun\n" -" (\"CLONE\" ekranda görünecektir).\n" -"4. TAMAM'ı tıkladıktan sonra, imajı göndermek için [BAND] tuşuna basın." - -#: ../chirpdrivers/ft1d.py:656 -msgid "" -"1. Turn radio off.\n" -"2. Connect cable to DATA terminal.\n" -"3. Press and hold in the [F] key while turning the radio on\n" -" (\"CLONE\" will appear on the display).\n" -"4. Press the [Dx] key (\"-WAIT-\" will appear on the LCD)." -msgstr "" -"1. Telsizi kapatın.\n" -"2. Kabloyu DATA terminaline bağlayın.\n" -"3. Telsizi açarken [F] tuşunu basılı tutun\n" -" (ekranda \"CLONE\" görünecektir).\n" -"4. [Dx] tuşuna basın (ekranda \"-WAIT-\" görünecektir)." - -#: ../chirpdrivers/ft2d.py:85 -msgid "" -"1. Turn radio off.\n" -"2. Connect cable to DATA terminal.\n" -"3. Press and hold [DISP] key while turning on radio\n" -" (\"CLONE\" will appear on the display).\n" -"4. After clicking OK here in chirp,\n" -" press the [Send] screen button." -msgstr "" -"1. Telsizi kapatın.\n" -"2. Kabloyu DATA terminaline bağlayın.\n" -"3. Telsizi açarken [DISP] tuşunu basılı tutun\n" -" (\"CLONE\" ekranda görünecektir).\n" -"4. TAMAM'ı tıkladıktan sonra,\n" -" [Gönder] ekran tuşuna basın." - -#: ../chirpdrivers/ft2d.py:92 -msgid "" -" 1. Turn radio off.\n" -" 2. Connect cable to DATA terminal.\n" -" 3. Press and hold in [DISP] key while turning on radio\n" -" (\"CLONE\" will appear on radio LCD).\n" -" 4. Press [RECEIVE] screen button\n" -" (\"-WAIT-\" will appear on radio LCD).\n" -"5. Finally, press OK button below." -msgstr "" -" 1. Telsizi kapatın.\n" -" 2. Kabloyu DATA terminaline bağlayın.\n" -" 3. Telsizi açarken [DISP] tuşunu basılı tutun\n" -" (telsiz LCD'sinde \"CLONE\" görünecektir).\n" -" 4. [RECEIVE] ekran tuşuna basın\n" -" (telsiz LCD'sinde \"-WAIT-\" görünecektir).\n" -"5. Son olarak aşağıdaki OK tuşuna basın." - -#: ../chirpdrivers/ft4.py:675 -msgid "" -"1. Connect programming cable to MIC jack.\n" -"2. Press OK." -msgstr "" -"1. Programlama kablosunu MIC jakına bağlayın.\n" -"2. TAMAM'a basın." - -#: ../chirpdrivers/ft50.py:195 -msgid "" -"1. Turn radio off.\n" -"2. Connect cable to MIC/SP jack.\n" -"3. Press and hold [PTT] & Knob while turning the\n" -" radio on.\n" -"4. After clicking OK, press the [PTT] switch to send image." -msgstr "" -"1. Telsizi kapatın.\n" -"2. Kabloyu MIC/SP jakına bağlayın.\n" -"3. Telsizi açarken [PTT] & tuşuna basın.\n" -"4. TAMAM'ı tıkladıktan sonra, imaj göndermek\n" -" için [PTT] tuşuna basın." - -#: ../chirpdrivers/ft50.py:201 -msgid "" -"1. Turn radio off.\n" -"2. Connect cable to MIC/SP jack.\n" -"3. Press and hold [PTT] & Knob while turning the\n" -" radio on.\n" -"4. Press the [MONI] switch (\"WAIT\" will appear on the LCD).\n" -"5. Press OK." -msgstr "" -"1. Telsizi kapatın.\n" -"2. Kabloyu MIC/SP jakına bağlayın.\n" -"3. Telsizi açarken [PTT] & tuşuna basın.\n" -"4. [MONI] tuşuna basın (ekranda \"WAIT\" görünecektir).\n" -"5. TAMAM'a basın." - -#: ../chirpdrivers/ft60.py:355 -msgid "" -"1. Turn radio off.\n" -"2. Connect cable to MIC/SP jack.\n" -"3. Press and hold in the [MONI] switch while turning the\n" -" radio on.\n" -"4. Rotate the DIAL job to select \"F8 CLONE\".\n" -"5. Press the [F/W] key momentarily.\n" -"6. After clicking OK, hold the [PTT] switch\n" -" for one second to send image." -msgstr "" -"1. Telsizi kapatın.\n" -"2. Kabloyu MIC/SP jakına bağlayın.\n" -"3. Telsizi açarken [PTT] & tuşuna basın.\n" -"3. Telsizi açarken [MONI] tuşunu basılı tutun.\n" -"4. \"F8 CLONE\" öğesini seçmek için KADRANI çevirin.\n" -"5. Bir an için [F/W] tuşuna basın.\n" -"6. TAMAM'ı tıkladıktan sonra, imaj göndermek için [PTT] tuşunu bir saniye basılı tutun." - -#: ../chirpdrivers/ft60.py:365 -msgid "" -"1. Turn radio off.\n" -"2. Connect cable to MIC/SP jack.\n" -"3. Press and hold in the [MONI] switch while turning the\n" -" radio on.\n" -"4. Rotate the DIAL job to select \"F8 CLONE\".\n" -"5. Press the [F/W] key momentarily.\n" -"6. Press the [MONI] switch (\"--RX--\" will appear on the LCD)." -msgstr "" -"1. Telsizi kapatın.\n" -"2. Kabloyu MIC/SP jakına bağlayın.\n" -"3. Telsizi açarken [MONI] tuşunu basılı tutun.\n" -"4. \"F8 CLONE\" öğesini seçmek için KADRANI çevirin.\n" -"5. Bir an için [F/W] tuşuna basın.\n" -"6. [MONI] tuşuna basın (ekranda \"--RX--\" görünecektir)." - -#: ../chirpdrivers/ft70.py: -msgid "" -"1. Turn radio on.\n" -"2. Connect cable to DATA terminal.\n" -"3. Unclip battery.\n" -"4. Press and hold in the [AMS] key and power key while clipping the battery back in\n" -"(\"ADMS\" will appear on the display).\n" -"5. After clicking OK, press the [BAND] key." -msgstr "" -"1. Telsizi açın.\n" -"2. Kabloyu DATA terminaline bağlayın.\n" -"3. Pilin klipsini açın.\n" -"4. Pili tekrar yerine takarken [AMS] tuşunu ve güç tuşunu basılı tutun.\n" -"(ekranda \"ADMS\" görünecektir).\n" -"5. TAMAM'ı tıkladıktan sonra [BAND] tuşuna basın." - -#: ../chirpdrivers/ft70.py:545 -msgid "" -"1. Turn radio on.\n" -"2. Connect cable to DATA terminal.\n" -"3. Unclip battery.\n" -"4. Press and hold in the [AMS] key and power key while clipping the battery back in\n" -"(\"ADMS\" will appear on the display).\n" -"5. Press the [MODE] key (\"-WAIT-\" will appear on the LCD). Then click OK" -msgstr "" -"1. Telsizi açın.\n" -"2. Kabloyu DATA terminaline bağlayın.\n" -"3. Pilin klipsini açın.\n" -"4. Pili tekrar yerine takarken [AMS] tuşunu ve güç tuşunu basılı tutun.\n" -"(ekranda \"ADMS\" görünecektir).\n" -"5. [MODE] tuşuna basın (ekranda \"-WAIT-\" görünecektir). Ardından TAMAM'ı tıklayın" - -#: ../chirpdrivers/ft90.py:196 -msgid "" -"1. Turn radio off.\n" -"2. Connect mic and hold [ACC] on mic while powering on.\n" -" (\"CLONE\" will appear on the display)\n" -"3. Replace mic with PC programming cable.\n" -"4. After clicking OK, press the [SET] key to send image." -msgstr "" -"1. Telsizi kapatın.\n" -"2. Mikrofonu bağlayın ve açarken mikrofondaki [ACC] tuşunu basılı tutun.\n" -" (\"CLONE\" ekranda görünecektir)\n" -"3. Mikrofonu PC programlama kablosuyla değiştirin.\n" -"4. TAMAM'ı tıkladıktan sonra, imajı göndermek için [SET] tuşuna basın." - -#: ../chirpdrivers/ft90.py:202 -msgid "" -"1. Turn radio off.\n" -"2. Connect mic and hold [ACC] on mic while powering on.\n" -" (\"CLONE\" will appear on the display)\n" -"3. Replace mic with PC programming cable.\n" -"4. Press the [DISP/SS] key\n" -" (\"R\" will appear on the lower left of LCD)." -msgstr "" -"1. Telsizi kapatın.\n" -"2. Mikrofonu bağlayın ve açarken mikrofondaki [ACC] tuşunu basılı tutun.\n" -" (\"CLONE\" ekranda görünecektir)\n" -"3. Mikrofonu PC programlama kablosuyla değiştirin.\n" -"4. [DISP/SS] tuşuna basın\n" -" (LCD'nin sol alt köşesinde \"R\" görünecektir)." - -#: ../chirpdrivers/ft450d.py:387 -msgid "" -"1. Turn radio off.\n" -"2. Connect cable to ACC jack.\n" -"3. Press and hold in the [MODE <] and [MODE >] keys while\n" -" turning the radio on (\"CLONE MODE\" will appear on the\n" -" display).\n" -"4. After clicking OK here, press the [C.S.] key to\n" -" send image." -msgstr "" -"1. Telsizi kapatın.\n" -"2. Kabloyu ACC jakına bağlayın.\n" -"3. Telsizi açarken [MODE <] ve [MODE >] tuşlarını basılı tutun \n" -" (ekranda \"KLON MODU\" görünecektir).\n" -"4. TAMAM'ı tıkladıktan sonra, imajı göndermek için\n" -" [C.S.] tuşuna basın." - -#: ../chirpdrivers/ft450d.py:395 -msgid "" -"1. Turn radio off.\n" -"2. Connect cable to ACC jack.\n" -"3. Press and hold in the [MODE <] and [MODE >] keys while\n" -" turning the radio on (\"CLONE MODE\" will appear on the\n" -" display).\n" -"4. Click OK here.\n" -" (\"Receiving\" will appear on the LCD)." -msgstr "" -"1. Telsizi kapatın.\n" -"2. Kabloyu ACC jakına bağlayın.\n" -"3. Telsizi açarken [MODE <] ve [MODE >] tuşlarını basılı tutun (\"ekranda KLON MODU\" görünecektir).\n" -"4. Burada TAMAM'ı tıklayın.\n" -" (ekranda \"Alınıyor\" görünecektir)." - -#: ../chirpdrivers/ft817.py:280 -msgid "" -"1. Turn radio off.\n" -"2. Connect cable to ACC jack.\n" -"3. Press and hold in the [MODE <] and [MODE >] keys while\n" -" turning the radio on (\"CLONE MODE\" will appear on the\n" -" display).\n" -"4. After clicking OK, press the [A] key to send image." -msgstr "" -"1. Telsizi kapatın.\n" -"2. Kabloyu ACC jakına bağlayın.\n" -"3. Telsizi açarken [MODE <] ve [MODE >] tuşlarını\n" -" basılı tutun (\"ekranda KLON MODU\" görünecektir).\n" -"4. TAMAM'ı tıkladıktan sonra, imajı göndermek için\n" -" [A] tuşuna basın." - -#: ../chirpdrivers/ft817.py:287 -msgid "" -"1. Turn radio off.\n" -"2. Connect cable to ACC jack.\n" -"3. Press and hold in the [MODE <] and [MODE >] keys while\n" -" turning the radio on (\"CLONE MODE\" will appear on the\n" -" display).\n" -"4. Press the [C] key (\"RX\" will appear on the LCD)." -msgstr "" -"1. Telsizi kapatın.\n" -"2. Kabloyu ACC jakına bağlayın.\n" -"3. Telsizi açarken [MODE <] ve [MODE >] tuşlarını basılı tutun (\"ekranda KLON MODU\" görünecektir).\n" -"4. [C] tuşuna basın (ekranda \"RX\" görünecektir)." - -#: ../chirpdrivers/ft857.py:441 -msgid "" -"1. Turn radio off.\n" -"2. Connect cable to CAT/LINEAR jack.\n" -"3. Press and hold in the [MODE <] and [MODE >] keys while\n" -" turning the radio on (\"CLONE MODE\" will appear on the\n" -" display).\n" -"4. After clicking OK,\n" -" press the [C](SEND) key to send image." -msgstr "" -"1. Telsizi kapatın.\n" -"2. Kabloyu CAT/LINEAR jakına bağlayın.\n" -"3. Telsizi açarken [MODE <] ve [MODE >] tuşlarını basılı tutun (ekranda \"KLON MODU\" görünecektir).\n" -"4. TAMAM'ı tıkladıktan sonra, imajı göndermek için [C](GÖNDER) tuşuna basın." - -#: ../chirpdrivers/ft857.py:449 -msgid "" -"1. Turn radio off.\n" -"2. Connect cable to ACC jack.\n" -"3. Press and hold in the [MODE <] and [MODE >] keys while\n" -" turning the radio on (\"CLONE MODE\" will appear on the\n" -" display).\n" -"4. Press the [A](RCV) key (\"receiving\" will appear on the LCD)." -msgstr "" -"1. Telsizi kapatın.\n" -"2. Kabloyu ACC jakına bağlayın.\n" -"3. Telsizi açarken [MODE <] ve [MODE >] tuşlarını basılı tutun (ekranda \"KLON MODU\" görünecektir).\n" -"4. [A](RCV) tuşuna basın (ekranda \"alıyor\" görünecektir)." - -#: ../chirpdrivers/ft1500m.py:96 -msgid "" -"1. Turn radio off.\n" -"2. Connect cable to mic jack.\n" -"3. Press and hold in the [MHz], [LOW], and [D/MR] keys\n" -" while turning the radio on.\n" -"4. After clicking OK, press the [MHz(SET)] key to send image." -msgstr "" -"1. Telsizi kapatın.\n" -"2. Kabloyu mikrofon jakına bağlayın.\n" -"3. Telsizi açarken [MHz], [LOW] ve [D/MR] tuşlarına basılı tutun\n" -"4. TAMAM'ı tıkladıktan sonra, imajı göndermek için [MHz(SET)] tuşuna basın." - -#: ../chirpdrivers/ft1500m.py:102 -msgid "" -"1. Turn radio off.\n" -"2. Connect cable to mic jack.\n" -"3. Press and hold in the [MHz], [LOW], and [D/MR] keys\n" -" while turning the radio on.\n" -"4. Press the [D/MR(MW)] key (\"--WAIT--\" will appear on the LCD)." -msgstr "" -"1. Telsizi kapatın.\n" -"2. Kabloyu mikrofon jakına bağlayın.\n" -"3. Telsizi açarken [MHz], [LOW] ve [D/MR] tuşlarını basılı tutun.\n" -"4. [D/MR(MW)] tuşuna basın (ekranda \"--WAIT--\" görünecektir)." - -#: ../chirpdrivers/ft1802.py:96 -msgid "" -"1. Turn radio off.\n" -"2. Connect cable to mic jack.\n" -"3. Press and hold in the [LOW(A/N)] key while turning the radio on.\n" -"4. After clicking OK, press the [MHz(SET)] key to send image." -msgstr "" -"1. Telsizi kapatın.\n" -"2. Kabloyu mikrofon jakına bağlayın.\n" -"3. Telsizi açarken [LOW(A/N)] tuşunu basılı tutun.\n" -"4. TAMAM'ı tıkladıktan sonra, imajı göndermek için [MHz(SET)] tuşuna basın." - -#: ../chirpdrivers/ft1802.py:101 -msgid "" -"1. Turn radio off.\n" -"2. Connect cable to mic jack.\n" -"3. Press and hold in the [LOW(A/N)] key while turning the radio on.\n" -"4. Press the [D/MR(MW)] key (\"--WAIT--\" will appear on the LCD)." -msgstr "" -"1. Telsizi kapatın.\n" -"2. Kabloyu mikrofon jakına bağlayın.\n" -"3. Telsizi açarken [LOW(A/N)] tuşunu basılı tutun.\n" -"4. [D/MR(MW)] tuşuna basın (ekranda \"--WAIT--\" görünecektir)." - -#: ../chirpdrivers/ft2900.py:1227 -msgid "" -"1. Turn Radio off.\n" -"2. Connect data cable.\n" -"3. While holding \"A/N LOW\" button, turn radio on.\n" -"4. After clicking OK, press \"SET MHz\" to send image." -msgstr "" -"1. Telsizi kapatın.\n" -"2. Veri kablosunu bağlayın.\n" -"3. \"A/N LOW\" tuşunu basılı tutarken telsizi açın.\n" -"4. TAMAM'ı tıkladıktan sonra, imajı göndermek için \"SET MHz\"e basın." - -#: ../chirpdrivers/ft2900.py:1232 -msgid "" -"1. Turn Radio off.\n" -"2. Connect data cable.\n" -"3. While holding \"A/N LOW\" button, turn radio on.\n" -"4. Press \"MW D/MR\" to receive image.\n" -"5. Make sure display says \"-WAIT-\" (see note below if not)\n" -"6. Click OK to dismiss this dialog and start transfer.\n" -"\n" -"Note: if you don't see \"-WAIT-\" at step 5, try cycling\n" -" power and pressing and holding red \"*L\" button to unlock\n" -" radio, then start back at step 1." -msgstr "" -"1. Telsizi kapatın.\n" -"2. Veri kablosunu bağlayın.\n" -"3. \"A/N LOW\" tuşunu basılı tutarken telsizi açın.\n" -"4. İmajı almak için \"MW D/MR\" tuşuna basın.\n" -"5. Ekranda \"-WAIT-\" yazdığından emin olun (değilse aşağıdaki nota bakın)\n" -"6. Bu iletişim kutusunu kapatmak ve aktarımı başlatmak için TAMAM'a tıklayın.\n" -"\n" -"Not: 5. adımda \"-WAIT-\" öğesini görmüyorsanız, gücü kapatıp açmayı\n" -" ve telsizin kilidini açmak için kırmızı \"*L\" tuşunu basılı tutmayı deneyin,\n" -" ardından 1. adımdan başlayın." - -#: ../chirpdrivers/ft7100.py:1122 -msgid "" -"1. Turn Radio off.\n" -"2. Connect data cable.\n" -"3. While holding \"TONE\" and \"REV\" buttons, turn radio on.\n" -"4. After clicking OK, press \"TONE\" to send image." -msgstr "" -"1. Telsizi kapatın.\n" -"2. Veri kablosunu bağlayın.\n" -"3. \"TONE\" ve \"REV\" tuşlarını basılı tutarken telsizi açın.\n" -"4. TAMAM'ı tıkladıktan sonra, imajı göndermek için \"TONE\" tuşuna basın." - -#: ../chirpdrivers/ft7100.py:1126 -msgid "" -"1. Turn Radio off.\n" -"2. Connect data cable.\n" -"3. While holding \"TON\" and \"REV\" buttons, turn radio on.\n" -"4. Press \"REV\" to receive image.\n" -"5. Make sure display says \"CLONE RX\" and green led is blinking\n" -"6. Click OK to start transfer." -msgstr "" -"1. Telsizi kapatın.\n" -"2. Veri kablosunu bağlayın.\n" -"3. \"TON\" ve \"REV\" tuşlarını basılı tutarken telsizi açın.\n" -"4. İmajı almak için \"REV\" tuşuna basın.\n" -"5. Ekranda \"CLONE RX\" yazdığından ve yeşil ledin yanıp söndüğünden emin olun.\n" -"6. Aktarımı başlatmak için TAMAM'a tıklayın." - -#: ../chirpdrivers/ft7800.py:275 -msgid "" -"1. Turn radio off.\n" -"2. Connect cable to DATA jack.\n" -"3. Press and hold in the [MHz(PRI)] key while turning the\n" -" radio on.\n" -"4. Rotate the DIAL job to select \"F-7 CLONE\".\n" -"5. Press and hold in the [BAND(SET)] key. The display\n" -" will disappear for a moment, then the \"CLONE\" notation\n" -" will appear.\n" -"6. After clicking OK, press the [V/M(MW)] key to send image." -msgstr "" -"1. Telsizi kapatın.\n" -"2. Kabloyu DATA jakına bağlayın.\n" -"3. Telsizi açarken [MHz(PRI)] tuşunu basılı tutun.\n" -"4. \"F-7 CLONE\" öğesini seçmek için KADRANI çevirin.\n" -"5. [BAND(SET)] tuşunu basılı tutun. Ekran bir an için kaybolacak, ardından \"CLONE\" yazısı belirecektir.\n" -"6. TAMAM'ı tıkladıktan sonra, imaj göndermek için [V/M(MW)] tuşuna basın." - -#: ../chirpdrivers/ft7800.py:285 -msgid "" -"1. Turn radio off.\n" -"2. Connect cable to DATA jack.\n" -"3. Press and hold in the [MHz(PRI)] key while turning the\n" -" radio on.\n" -"4. Rotate the DIAL job to select \"F-7 CLONE\".\n" -"5. Press and hold in the [BAND(SET)] key. The display\n" -" will disappear for a moment, then the \"CLONE\" notation\n" -" will appear.\n" -"6. Press the [LOW(ACC)] key (\"--RX--\" will appear on the display)." -msgstr "" -"1. Telsizi kapatın.\n" -"2. Kabloyu DATA jakına bağlayın.\n" -"3. Telsizi açarken [MHz(PRI)] tuşunu basılı tutun.\n" -"4. \"F-7 CLONE\" öğesini seçmek için KADRANI çevirin.\n" -"5. [BAND(SET)] tuşunu basılı tutun. Ekran bir an için kaybolacak, ardından \"CLONE\" yazısı belirecektir.\n" -"6. [LOW(ACC)] tuşuna basın (ekranda \"--RX--\" görünecektir)." - -#: ../chirpdrivers/ftlx011.py:306 -msgid "" -"Please follow this steps carefully:\n" -"\n" -"1 - Turn on your radio\n" -"2 - Connect the interface cable to your radio.\n" -"3 - Click the button on this window to start download\n" -" (Radio will beep and led will flash)\n" -"4 - Then press the \"A\" button in your radio to start cloning.\n" -" (At the end radio will beep)\n" -msgstr "" -"Lütfen bu adımları dikkatlice izleyin:\n" -"\n" -"1 - Telsizinizi açın\n" -"2 - Arayüz kablosunu telsizinize bağlayın.\n" -"3 - İndirmeyi başlatmak için bu penceredeki tuşa tıklayın\n" -" (Telsiz bip sesi çıkaracak ve led yanıp sönecektir)\n" -"4 - Ardından klonlamaya başlamak için telsizinizdeki \"A\" tuşuna basın.\n" -" (Sonunda telsiz bip sesi çıkaracaktır)\n" - -#: ../chirpdrivers/ftlx011.py:316 -msgid "" -"Please follow this steps carefully:\n" -"\n" -"1 - Turn on your radio\n" -"2 - Connect the interface cable to your radio\n" -"3 - Click the button on this window to start download\n" -" (you may see another dialog, click ok)\n" -"4 - Radio will beep and led will flash\n" -"5 - You will get a 10 seconds timeout to press \"MON\" before\n" -" data upload start\n" -"6 - If all goes right radio will beep at end.\n" -"\n" -"After cloning remove the cable and power cycle your radio to\n" -"get into normal mode.\n" -msgstr "" -"Lütfen bu adımları dikkatlice izleyin:\n" -"\n" -"1 - Telsizinizi açın\n" -"2 - Arayüz kablosunu telsizinize bağlayın\n" -"3 - İndirmeyi başlatmak için bu penceredeki tuşa tıklayın (başka bir iletişim kutusu görebilirsiniz, tamam'a tıklayın)\n" -"4 - Telsiz bip sesi çıkaracak ve led yanıp sönecektir\n" -"5 - Veri yükleme başlamadan önce \"MON\" tuşuna basmanız için 10 saniyelik bir zaman aşımı süresi alacaksınız.\n" -"6 - Her şey yolunda giderse sonunda telsiz bip sesi çıkaracaktır.\n" -"\n" -"Klonladıktan sonra kabloyu çıkarın ve normal moda geçmek için telsizinizi kapatıp açın.\n" - -#: ../chirpdrivers/ftm3200d.py:83 -msgid "" -"1. Turn radio off.\n" -"2. Connect cable to DATA terminal.\n" -"3. Press and hold in the [MHz(SETUP)] key while turning the radio\n" -" on (\"CLONE\" will appear on the display).\n" -"4. After clicking OK, press the [REV(DW)] key\n" -" to send image." -msgstr "" -"1. Telsizi kapatın.\n" -"2. Kabloyu DATA terminaline bağlayın.\n" -"3. Telsizi açarken [MHz(SETUP)] tuşunu basılı tutun (\"ekranda CLONE\" görünecektir).\n" -"4. TAMAM'ı tıkladıktan sonra, imajı göndermek için [GERİ(DW)] tuşuna basın." - -#: ../chirpdrivers/ftm3200d.py:90 -msgid "" -"1. Turn radio off.\n" -"2. Connect cable to DATA terminal.\n" -"3. Press and hold in the [MHz(SETUP)] key while turning the radio\n" -" on (\"CLONE\" will appear on the display).\n" -"4. Press the [MHz(SETUP)] key\n" -" (\"-WAIT-\" will appear on the LCD)." -msgstr "" -"1. Telsizi kapatın.\n" -"2. Kabloyu DATA terminaline bağlayın.\n" -"3. Telsizi açarken [MHz(SETUP)] tuşunu basılı tutun (\"ekranda CLONE\" görünecektir).\n" -"4. [MHz(SETUP)] tuşuna basın\n" -" (ekranda \"-WAIT-\" görünecektir)." - -#: ../chirpdrivers/ftm7250d.py:84 -msgid "" -"1. Turn radio off.\n" -"2. Connect cable to MIC Jack.\n" -"3. Press and hold in the [MHz(SETUP)] key while turning the radio\n" -" on (\"CLONE\" will appear on the display).\n" -"4. After clicking OK, press the [GM(AMS)] key\n" -" to send image." -msgstr "" -"1. Telsizi kapatın.\n" -"2. Kabloyu MIC Jakına bağlayın.\n" -"3. Telsizi açarken [MHz(SETUP)] tuşunu basılı tutun (\"ekranda CLONE\" görünecektir).\n" -"4. TAMAM'ı tıkladıktan sonra, imaj göndermek için [GM(AMS)] tuşuna basın." - -#: ../chirpdrivers/ftm7250d.py:91 -msgid "" -"1. Turn radio off.\n" -"2. Connect cable to MIC Jack.\n" -"3. Press and hold in the [MHz(SETUP)] key while turning the radio\n" -" on (\"CLONE\" will appear on the display).\n" -"4. Press the [MHz(SETUP)] key\n" -" (\"-WAIT-\" will appear on the LCD)." -msgstr "" -"1. Telsizi kapatın.\n" -"2. Kabloyu MIC Jakına bağlayın.\n" -"3. Telsizi açarken [MHz(SETUP)] tuşunu basılı tutun (\"ekranda CLONE\" görünecektir).\n" -"4. [MHz(SETUP)] tuşuna basın\n" -" (ekranda \"-WAIT-\" görünecektir)." - -#: ../chirpdrivers/ic2730.py:305 -msgid "" -"Follow these instructions to download your config:\n" -"\n" -"1 - Turn off your radio\n" -"2 - Connect your interface cable to the Speaker-2 jack\n" -"3 - Turn on your radio\n" -"4 - Radio > Download from radio\n" -"5 - Disconnect the interface cable! Otherwise there will be\n" -" no right-side audio!\n" -msgstr "" -"Yapılandırmanızı indirmek için şu talimatları izleyin:\n" -"\n" -"1 - Telsizinizi kapatın\n" -"2 - Arayüz kablonuzu Speaker-2 jakına bağlayın\n" -"3 - Telsizinizi açın\n" -"4 - Telsiz > Telsizden İndir\n" -"5 - Arayüz kablosunu çıkarın! Aksi takdirde, sağ taraf sesi olmayacaktır!\n" - -#: ../chirpdrivers/ic2730.py:315 -msgid "" -"Follow these instructions to upload your config:\n" -"\n" -"1 - Turn off your radio\n" -"2 - Connect your interface cable to the Speaker-2 jack\n" -"3 - Turn on your radio\n" -"4 - Radio > Upload to radio\n" -"5 - Disconnect the interface cable, otherwise there will be\n" -" no right-side audio!\n" -"6 - Cycle power on the radio to exit clone mode\n" -msgstr "" -"Yapılandırmanızı yüklemek için şu talimatları izleyin:\n" -"\n" -"1 - Telsizinizi kapatın\n" -"2 - Arayüz kablonuzu Speaker-2 jakına bağlayın\n" -"3 - Telsizinizi açın\n" -"4 - Telsiz > Telsize yükle\n" -"5 - Arayüz kablosunu çıkarın, aksi takdirde sağ tarafta ses olmayacaktır!\n" -"6 - Klon modundan çıkmak için telsizi kapatıp açın\n" - -#: ../chirpdrivers/lt725uv.py:511 ../chirpdrivers/vgc.py:584 -msgid "" -"Follow this instructions to download your info:\n" -"\n" -"1 - Turn off your radio\n" -"2 - Connect your interface cable\n" -"3 - Turn on your radio\n" -"4 - Do the download of your radio data\n" -msgstr "" -"Bilgilerinizi indirmek için şu talimatları izleyin:\n" -"\n" -"1 - Telsizinizi kapatın\n" -"2 - Arayüz kablonuzu bağlayın\n" -"3 - Telsizinizi açın\n" -"4 - Telsiz verilerinizin indirilmesini gerçekleştirin\n" - -#: ../chirpdrivers/tg_uv2p.py:221 ../chirpdrivers/uvb5.py:284 ../chirpdrivers/wouxun.py:214 -msgid "" -"1. Turn radio off.\n" -"2. Connect cable to mic/spkr connector.\n" -"3. Make sure connector is firmly connected.\n" -"4. Turn radio on.\n" -"5. Ensure that the radio is tuned to channel with no activity.\n" -"6. Click OK to download image from device." -msgstr "" -"1. Telsizi kapatın.\n" -"2. Kabloyu mik/hprlr konektörüne bağlayın.\n" -"3. Konektörün sıkıca bağlandığından emin olun.\n" -"4. Telsizi açın.\n" -"5. Telsizin etkin olmayan kanala ayarlandığından emin olun.\n" -"6. İmajı cihazdan indirmek için TAMAM'a tıklayın." - -#: ../chirpdrivers/tg_uv2p.py:228 ../chirpdrivers/uvb5.py:291 ../chirpdrivers/wouxun.py:221 -msgid "" -"1. Turn radio off.\n" -"2. Connect cable to mic/spkr connector.\n" -"3. Make sure connector is firmly connected.\n" -"4. Turn radio on.\n" -"5. Ensure that the radio is tuned to channel with no activity.\n" -"6. Click OK to upload image to device." -msgstr "" -"1. Telsizi kapatın.\n" -"2. Kabloyu mic/spkr konektörüne bağlayın.\n" -"3. Konektörün sıkıca bağlandığından emin olun.\n" -"4. Telsizi açın.\n" -"5. Telsizin etkin olmayan kanala ayarlandığından emin olun.\n" -"6. İmajı cihaza yüklemek için TAMAM'a tıklayın." - -#: ../chirpdrivers/th_uv88.py:478 -msgid "This is an early stage beta driver\n" -msgstr "Bu erken aşama beta sürücüsüdür\n" - -#: ../chirpdrivers/th_uv88.py:481 -msgid "This is an early stage beta driver - upload at your own risk\n" -msgstr "Bu, erken aşamadaki bir beta sürücüsüdür - yükleme riski size aittir\n" - -#: ../chirpdrivers/th_uv8000.py:534 -msgid "" -"Follow these instructions to download the radio memory:\n" -"\n" -"1 - Turn off your radio\n" -"2 - Connect your interface cable\n" -"3 - Turn on your radio, volume @ 50%\n" -"4 - Radio > Download from radio\n" -msgstr "" -"Telsiz hafızasını indirmek için şu talimatları izleyin:\n" -"\n" -"1 - Telsizinizi kapatın\n" -"2 - Arayüz kablonuzu bağlayın\n" -"3 - Telsizinizi açın, ses seviyesi @ %50\n" -"4 - Telsiz > Telsizden İndir\n" - -#: ../chirpdrivers/th_uv8000.py:542 -msgid "" -"Follow these instructions to upload the radio memory:\n" -"\n" -"1 - Turn off your radio\n" -"2 - Connect your interface cable\n" -"3 - Turn on your radio, volume @ 50%\n" -"4 - Radio > Upload to radio\n" -msgstr "" -"Telsiz hafızasını yüklemek için şu talimatları izleyin:\n" -"\n" -"1 - Telsizinizi kapatın\n" -"2 - Arayüz kablonuzu bağlayın\n" -"3 - Telsizinizi açın, ses seviyesi @ %50\n" -"4 - Telsiz > Telsize yükle\n" - -#: ../chirpdrivers/tk270.py:340 ../chirpdrivers/tk760.py:361 -msgid "" -"Follow this instructions to read your radio:\n" -"1 - Turn off your radio\n" -"2 - Connect your interface cable\n" -"3 - Turn on your radio\n" -"4 - Do the download of your radio data\n" -msgstr "" -"Telsizinizi okumak için bu talimatları izleyin:\n" -"1 - Telsizinizi kapatın\n" -"2 - Arayüz kablonuzu bağlayın\n" -"3 - Telsizinizi açın\n" -"4 - Telsiz verilerinizin indirmesini gerçekleştirin\n" - -#: ../chirpdrivers/tk270.py:347 ../chirpdrivers/tk760.py:368 -msgid "" -"Follow this instructions to write your radio:\n" -"1 - Turn off your radio\n" -"2 - Connect your interface cable\n" -"3 - Turn on your radio\n" -"4 - Do the upload of your radio data\n" -msgstr "" -"Telsizinizi yazmak için bu talimatları izleyin:\n" -"1 - Telsizinizi kapatın\n" -"2 - Arayüz kablonuzu bağlayın\n" -"3 - Telsizinizi açın\n" -"4 - Telsiz verilerinizin yüklemesini gerçekleştirin\n" - -#: ../chirpdrivers/tk760g.py:729 -msgid "" -"Follow this instructions to download your info:\n" -"1 - Turn off your radio\n" -"2 - Connect your interface cable\n" -"3 - Turn on your radio (unblock it if password protected)\n" -"4 - Do the download of your radio data\n" -msgstr "" -"Bilgilerinizi indirmek için bu talimatları izleyin:\n" -"1 - Telsizinizi kapatın\n" -"2 - Arayüz kablonuzu bağlayın\n" -"3 - Telsizinizi açın (şifre korumalıysa engelini kaldırın)\n" -"4 - Telsiz verilerinizin indirmesini gerçekleştirin\n" - -#: ../chirpdrivers/tk760g.py:736 -msgid "" -"Follow this instructions to upload your info:\n" -"1 - Turn off your radio\n" -"2 - Connect your interface cable\n" -"3 - Turn on your radio (unblock it if password protected)\n" -"4 - Do the upload of your radio data\n" -msgstr "" -"Bilgilerinizi yüklemek için bu talimatları izleyin:\n" -"1 - Telsizinizi kapatın\n" -"2 - Arayüz kablonuzu bağlayın\n" -"3 - Telsizinizi açın (şifre korumalıysa engelini kaldırın)\n" -"4 - Telsiz verilerinizin yüklemesini gerçekleştirin\n" - -#: ../chirpdrivers/tmd710.py:203 ../chirpdrivers/tmd710.py:207 -msgid "" -"Connect your interface cable to the PC Port on the\n" -"back of the 'TX/RX' unit. NOT the Com Port on the head.\n" -msgstr "" -"Arayüz kablonuzu 'TX/RX' ünitesinin arkasındaki\n" -"PC Bağlantı Noktasına bağlayın. Kafadaki Com Portu DEĞİL.\n" - -#: ../chirpdrivers/ts480.py:524 -msgid "" -"Follow these instructions to download the radio memory:\n" -"1 - Connect your interface cable\n" -"2 - Radio > Download from radio: Don't adjust any settings\n" -"on the radio head!\n" -"3 - Disconnect your interface cable\n" -msgstr "" -"Telsiz hafızasını indirmek için şu talimatları izleyin:\n" -"1 - Arayüz kablonuzu bağlayın\n" -"2 - Telsiz > Telsizden İndir: Telsiz kafasında herhangi bir ayar yapmayın!\n" -"3 - Arayüz kablonuzu çıkarın\n" - -#: ../chirpdrivers/ts480.py:531 -msgid "" -"Follow these instructions to upload the radio memory:\n" -"1 - Connect your interface cable\n" -"2 - Radio > Upload to radio: Don't adjust any settings\n" -"on the radio head!\n" -"3 - Disconnect your interface cable\n" -msgstr "" -"Telsiz hafızasını yüklemek için şu talimatları izleyin:\n" -"1 - Arayüz kablonuzu bağlayın\n" -"2 - Telsiz > Telsize yükle: Telsiz kafasında herhangi bir ayar yapmayın!\n" -"3 - Arayüz kablonuzu çıkarın\n" - -#: ../chirpdrivers/ts590.py:685 -msgid "" -"Follow these instructions to download the radio memory:\n" -"1 - Connect your interface cable\n" -"2 - Radio > Download from radio: DO NOT mess with the radio\n" -"during download!\n" -"3 - Disconnect your interface cable\n" -msgstr "" -"Telsiz hafızasını indirmek için şu talimatları izleyin:\n" -"1 - Arayüz kablonuzu bağlayın\n" -"2 - Telsiz > Telsizden İndir: İndirme sırasında telsiz ile uğraşmayın!\n" -"3 - Arayüz kablonuzu çıkarın\n" - -#: ../chirpdrivers/ts590.py:692 -msgid "" -"Follow these instructions to upload the radio memory:\n" -"1 - Connect your interface cable\n" -"2 - Radio > Upload to radio: DO NOT mess with the radio\n" -"during upload!\n" -"3 - Disconnect your interface cable\n" -msgstr "" -"Telsiz hafızasını yüklemek için şu talimatları izleyin:\n" -"1 - Arayüz kablonuzu bağlayın\n" -"2 - Telsiz > Telsize Yükle: Yükleme sırasında telsiz ile uğraşmayın!\n" -"3 - Arayüz kablonuzu çıkarın\n" - -#: ../chirpdrivers/uv5r.py:764 -msgid "" -"1. Turn radio off.\n" -"2. Connect cable to mic/spkr connector.\n" -"3. Make sure connector is firmly connected.\n" -"4. Turn radio on (volume may need to be set at 100%).\n" -"5. Ensure that the radio is tuned to channel with no activity.\n" -"6. Click OK to download image from device." -msgstr "" -"1. Telsizi kapatın.\n" -"2. Kabloyu mik/hprlr konektörüne bağlayın.\n" -"3. Konektörün sıkıca bağlandığından emin olun.\n" -"4. Telsizi açın (ses düzeyinin %100 olarak ayarlanması gerekebilir).\n" -"5. Telsizin etkin olmayan kanala ayarlandığından emin olun.\n" -"6. İmajı cihazdan indirmek için TAMAM'a tıklayın." - -#: ../chirpdrivers/uv5r.py:771 -msgid "" -"1. Turn radio off.\n" -"2. Connect cable to mic/spkr connector.\n" -"3. Make sure connector is firmly connected.\n" -"4. Turn radio on (volume may need to be set at 100%).\n" -"5. Ensure that the radio is tuned to channel with no activity.\n" -"6. Click OK to upload image to device." -msgstr "" -"1. Telsizi kapatın.\n" -"2. Kabloyu mic/spkr konektörüne bağlayın.\n" -"3. Konektörün sıkıca bağlandığından emin olun.\n" -"4. Telsizi açın (ses düzeyinin %100 olarak ayarlanması gerekebilir).\n" -"5. Telsizin etkin olmayan kanala ayarlandığından emin olun.\n" -"6. İmajı cihaza yüklemek için TAMAM'a tıklayın." - -#: ../chirpdrivers/vx3.py:375 ../chirpdrivers/vx6.py:363 -msgid "" -"1. Turn radio off.\n" -"2. Connect cable to MIC/SP jack.\n" -"3. Press and hold in the [F/W] key while turning the radio on\n" -" (\"CLONE\" will appear on the display).\n" -"4. After clicking OK, press the [BAND] key to send image." -msgstr "" -"1. Telsizi kapatın.\n" -"2. Kabloyu MIC/SP jakına bağlayın.\n" -"3. Telsizi açarken [F/W] tuşunu basılı tutun\n" -" (ekranda \"CLONE\" görünecektir).\n" -"4. TAMAM'ı tıkladıktan sonra, imajı göndermek için [BAND] tuşuna basın." - -#: ../chirpdrivers/vx3.py:381 ../chirpdrivers/vx6.py:369 -msgid "" -"1. Turn radio off.\n" -"2. Connect cable to MIC/SP jack.\n" -"3. Press and hold in the [F/W] key while turning the radio on\n" -" (\"CLONE\" will appear on the display).\n" -"4. Press the [V/M] key (\"-WAIT-\" will appear on the LCD)." -msgstr "" -"1. Telsizi kapatın.\n" -"2. Kabloyu MIC/SP jakına bağlayın.\n" -"3. Telsizi açarken [F/W] tuşunu basılı tutun\n" -" (ekranda \"CLONE\" görünecektir).\n" -"4. [V/M] tuşuna basın (ekranda \"-WAIT-\" görünecektir)." - -#: ../chirpdrivers/vx3.py:317 -msgid "" -"1. Turn radio off.\n" -"2. Connect cable to MIC/EAR jack.\n" -"3. Press and hold in the [F/W] key while turning the radio on\n" -" (\"CLONE\" will appear on the display).\n" -"4. After clicking OK, press the [VFO(DW)SC] key to receive\n" -" the image from the radio." -msgstr "" -"1. Telsizi kapatın.\n" -"2. Kabloyu MIC/EAR jakına bağlayın.\n" -"3. Telsizi açarken [F/W] tuşunu basılı tutun\n" -" (ekranda \"CLONE\" görünecektir).\n" -"4. TAMAM'ı tıkladıktan sonra, imajı telsizden almak için [VFO(DW)SC] tuşuna basın." - -#: ../chirpdrivers/vx3.py:324 -msgid "" -"1. Turn radio off.\n" -"2. Connect cable to MIC/EAR jack.\n" -"3. Press and hold in the [F/W] key while turning the radio on\n" -" (\"CLONE\" will appear on the display).\n" -"4. Press the [MR(SKP)SC] key (\"CLONE WAIT\" will appear\n" -" on the LCD).\n" -"5. Click OK to send image to radio." -msgstr "" -"1. Telsizi kapatın.\n" -"2. Kabloyu MIC/EAR jakına bağlayın.\n" -"3. Telsizi açarken [F/W] tuşunu basılı tutun\n" -" (ekranda \"CLONE\" görünecektir).\n" -"4. [MR(SKP)SC] tuşuna basın (ekranda \"CLONE WAIT\" görünecektir).\n" -"5. İmajı telsize göndermek için TAMAM'a tıklayın." - -#: ../chirpdrivers/vx7.py:193 -msgid "" -"1. Turn radio off.\n" -"2. Connect cable to MIC/SP jack.\n" -"3. Press and hold in the [MON-F] key while turning the radio on\n" -" (\"CLONE\" will appear on the display).\n" -"4. After clicking OK, press the [BAND] key to send image." -msgstr "" -"1. Telsizi kapatın.\n" -"2. Kabloyu MIC/SP jakına bağlayın.\n" -"3. Telsizi açarken [MON-F] tuşunu basılı tutun\n" -" (ekranda \"CLONE\" görünecektir).\n" -"4. TAMAM'ı tıkladıktan sonra, imajı göndermek için [BAND] tuşuna basın." - -#: ../chirpdrivers/vx7.py:199 -msgid "" -"1. Turn radio off.\n" -"2. Connect cable to MIC/SP jack.\n" -"3. Press and hold in the [MON-F] key while turning the radio on\n" -" (\"CLONE\" will appear on the display).\n" -"4. Press the [V/M] key (\"CLONE WAIT\" will appear on the LCD)." -msgstr "" -"1. Telsizi kapatın.\n" -"2. Kabloyu MIC/SP jakına bağlayın.\n" -"3. Telsizi açarken [MON-F] tuşunu basılı tutun\n" -" (ekranda \"CLONE\" görünecektir).\n" -"4. [V/M] tuşuna basın (ekranda \"CLONE WAIT\" görünecektir)." - -#: ../chirpdrivers/vx8.py:590 -msgid "" -"1. Turn radio off.\n" -"2. Connect cable to DATA jack.\n" -"3. Press and hold in the [FW] key while turning the radio on\n" -" (\"CLONE\" will appear on the display).\n" -"4. After clicking OK, press the [BAND] key to send image." -msgstr "" -"1. Telsizi kapatın.\n" -"2. Kabloyu DATA jakına bağlayın.\n" -"3. Telsizi açarken [FW] tuşunu basılı tutun\n" -" (ekranda \"CLONE\" görünecektir).\n" -"4. TAMAM'ı tıkladıktan sonra, imajı göndermek için [BAND] tuşuna basın." - -#: ../chirpdrivers/vx8.py:596 -msgid "" -"1. Turn radio off.\n" -"2. Connect cable to DATA jack.\n" -"3. Press and hold in the [FW] key while turning the radio on\n" -" (\"CLONE\" will appear on the display).\n" -"4. Press the [MODE] key (\"-WAIT-\" will appear on the LCD)." -msgstr "" -"1. Telsizi kapatın.\n" -"2. Kabloyu DATA jakına bağlayın.\n" -"3. Telsizi açarken [FW] tuşunu basılı tutun\n" -" (ekranda \"CLONE\" görünecektir).\n" -"4. [MODE] tuşuna basın (ekranda \"CLONE WAIT\" görünecektir)." - -#: ../chirpdrivers/vx170.py:103 -msgid "" -"1. Turn radio off.\n" -"2. Connect cable to MIC/SP jack.\n" -"3. Press and hold in the [moni] key while turning the radio on.\n" -"4. Select CLONE in menu, then press F. Radio restarts in clone mode.\n" -" (\"CLONE\" will appear on the display).\n" -"5. After clicking OK, briefly hold [PTT] key to send image.\n" -" (\"-TX-\" will appear on the LCD). " -msgstr "" -"1. Telsizi kapatın.\n" -"2. Kabloyu MIC/SP jakına bağlayın.\n" -"3. Telsizi açarken [moni] tuşunu basılı tutun.\n" -"4. Menüden KLON'u seçin, ardından F'ye basın. Telsiz klon modunda yeniden başlar.\n" -" (ekranda \"CLONE\" görünecektir).\n" -"5. TAMAM'ı tıkladıktan sonra, imajı göndermek için [PTT] tuşunu kısa bir süre basılı tutun.\n" -" (ekranda \"-TX-\" görünecektir). " - -#: ../chirpdrivers/vx170.py:111 -msgid "" -"1. Turn radio off.\n" -"3. Press and hold in the [moni] key while turning the radio on.\n" -"4. Select CLONE in menu, then press F. Radio restarts in clone mode.\n" -" (\"CLONE\" will appear on the display).\n" -"5. Press the [moni] key (\"-RX-\" will appear on the LCD)." -msgstr "" -"1. Telsizi kapatın.\n" -"3. Telsizi açarken [moni] tuşunu basılı tutun.\n" -"4. Menüden KLON'u seçin, ardından F'ye basın. Telsiz klon modunda yeniden başlar.\n" -" (ekranda \"CLONE\" görünecektir).\n" -"5. [moni] tuşuna basın (ekranda \"-RX-\" görünecektir)." - -#: ../chirpdrivers/yaesu_clone.py:215 -msgid "" -"1. Turn radio off.\n" -"2. Connect data cable.\n" -"3. Prepare radio for clone.\n" -"4. After clicking OK, press the key to send image." -msgstr "" -"1. Telsizi kapatın.\n" -"2. Veri kablosunu bağlayın.\n" -"3. Telsizi klon için hazırlayın.\n" -"4. TAMAM'ı tıkladıktan sonra, imaj göndermek için tuşuna basın." - -#: ../chirpdrivers/yaesu_clone.py:220 -msgid "" -"1. Turn radio off.\n" -"2. Connect data cable.\n" -"3. Prepare radio for clone.\n" -"4. Press the key to receive the image." -msgstr "" -"1. Telsizi kapatın.\n" -"2. Veri kablosunu bağlayın.\n" -"3. Telsizi klon için hazırlayın.\n" -"4. İmajı almak için tuşuna basın." diff --git a/locale/uk_UA.po b/locale/uk_UA.po deleted file mode 100644 index a57ce2d..0000000 --- a/locale/uk_UA.po +++ /dev/null @@ -1,917 +0,0 @@ -# Ukrainian translations for CHIRP package. -# Copyright (C) 2011 Dan Smith -# This file is distributed under the same license as the CHIRP package. -# Dan Smith , 2011. -# -msgid "" -msgstr "" -"Project-Id-Version: CHIRP\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2012-02-16 12:06-0800\n" -"PO-Revision-Date: 2015-11-30 10:36+0200\n" -"Last-Translator: laser \n" -"Language-Team: laser \n" -"Language: uk_UA\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" - -#: ../chirpui/common.py:204 -msgid "Completed" -msgstr "Завершено" - -#: ../chirpui/common.py:205 -msgid "idle" -msgstr "простоювання" - -#: ../chirpui/bankedit.py:52 -msgid "Retrieving bank information" -msgstr "Отримання інформації банку" - -#: ../chirpui/bankedit.py:75 -msgid "Setting name on bank" -msgstr "Настройка назви бана" - -#: ../chirpui/bankedit.py:85 -msgid "Bank" -msgstr "Банк" - -#: ../chirpui/bankedit.py:86 ../chirpui/bankedit.py:240 -#: ../chirpui/importdialog.py:536 ../chirpui/memedit.py:65 -#: ../chirpui/memedit.py:85 ../chirpui/memedit.py:247 -#: ../chirpui/memedit.py:872 ../chirpui/memedit.py:926 -#: ../chirpui/memedit.py:1063 ../chirpui/memedit.py:1065 -msgid "Name" -msgstr "Ім'я" - -#: ../chirpui/bankedit.py:185 -msgid "Updating bank index for memory {num}" -msgstr "Оновлення індексу банку пам'яті {num}" - -#: ../chirpui/bankedit.py:194 -msgid "Updating bank information for memory {num}" -msgstr "Оновлення інформації банку пам'яті {num}" - -#: ../chirpui/bankedit.py:200 ../chirpui/bankedit.py:229 -msgid "Getting memory {num}" -msgstr "Отримання пам'яті {num}" - -#: ../chirpui/bankedit.py:214 -msgid "Setting index for memory {num}" -msgstr "Установка індексу для пам'яті {num}" - -#: ../chirpui/bankedit.py:223 -msgid "Getting bank for memory {num}" -msgstr "Отримання банку пам'яті {num}" - -#: ../chirpui/bankedit.py:238 ../chirpui/memedit.py:63 -#: ../chirpui/memedit.py:172 ../chirpui/memedit.py:246 -#: ../chirpui/memedit.py:315 ../chirpui/memedit.py:335 -#: ../chirpui/memedit.py:349 ../chirpui/memedit.py:423 -#: ../chirpui/memedit.py:435 ../chirpui/memedit.py:459 -#: ../chirpui/memedit.py:461 ../chirpui/memedit.py:534 -#: ../chirpui/memedit.py:548 ../chirpui/memedit.py:550 -#: ../chirpui/memedit.py:591 ../chirpui/memedit.py:593 -#: ../chirpui/memedit.py:621 ../chirpui/memedit.py:822 -#: ../chirpui/memedit.py:870 ../chirpui/memedit.py:895 -#: ../chirpui/memedit.py:907 ../chirpui/memedit.py:924 -#: ../chirpui/memedit.py:1230 -msgid "Loc" -msgstr "Loc" - -#: ../chirpui/bankedit.py:239 ../chirpui/importdialog.py:537 -#: ../chirpui/memedit.py:64 ../chirpui/memedit.py:86 ../chirpui/memedit.py:187 -#: ../chirpui/memedit.py:248 ../chirpui/memedit.py:271 -#: ../chirpui/memedit.py:296 ../chirpui/memedit.py:304 -#: ../chirpui/memedit.py:873 ../chirpui/memedit.py:923 -msgid "Frequency" -msgstr "Частота" - -#: ../chirpui/bankedit.py:241 -msgid "Index" -msgstr "Зміст" - -#: ../chirpui/bankedit.py:302 -msgid "Getting bank information for memory {num}" -msgstr "Отримання інформації банку для пам'яті {num}" - -#: ../chirpui/bankedit.py:323 -msgid "Getting bank information" -msgstr "Отримання інформації банку" - -#: ../chirpui/inputdialog.py:81 -msgid "An error has occurred" -msgstr "Сталася помилка" - -#: ../chirpui/inputdialog.py:130 -msgid "Overwrite" -msgstr "Перезаписати" - -#: ../chirpui/inputdialog.py:133 -msgid "File Exists" -msgstr "Файл існує" - -#: ../chirpui/inputdialog.py:136 -msgid "The file {name} already exists. Do you want to overwrite it?" -msgstr "Файл {name} вже існує. Ви дійсно хочете перезаписати його?" - -#: ../chirpui/importdialog.py:90 -msgid "Location {number} is already being imported. Choose another value for 'New Location' before selection 'Import'" -msgstr "Розташування {number} вже імпортуються. Виберіть інше значення для 'Нове розташування' перед вибором 'Імпорт'" - -#: ../chirpui/importdialog.py:121 -msgid "Invalid value. Must be an integer." -msgstr "Неприпустиме значення. Повинно бути цілим числом." - -#: ../chirpui/importdialog.py:130 -msgid "Location {number} is already being imported" -msgstr "Розташування {number} вже імпортованого" - -#: ../chirpui/importdialog.py:182 -msgid "Updating URCALL list" -msgstr "Оновлення списку URCALL" - -#: ../chirpui/importdialog.py:187 -msgid "Updating RPTCALL list" -msgstr "Оновлення списку RPTCALL" - -#: ../chirpui/importdialog.py:256 -msgid "Setting memory {number}" -msgstr "Установка пам'яті {number}" - -#: ../chirpui/importdialog.py:260 -msgid "Importing bank information" -msgstr "Імпортування інформації банку" - -#: ../chirpui/importdialog.py:264 -#, fuzzy -msgid "Error importing memories:" -msgstr "Помилка імпорту пам'яті:" - -#: ../chirpui/importdialog.py:376 -msgid "All" -msgstr "Все" - -#: ../chirpui/importdialog.py:382 -msgid "None" -msgstr "Не вказано" - -#: ../chirpui/importdialog.py:388 -msgid "Inverse" -msgstr "Інверсія" - -#: ../chirpui/importdialog.py:394 -#, fuzzy -msgid "Select" -msgstr "Обрати" - -#: ../chirpui/importdialog.py:416 -msgid "Auto" -msgstr "Авто" - -#: ../chirpui/importdialog.py:422 -msgid "Reverse" -msgstr "Реверс" - -#: ../chirpui/importdialog.py:428 -msgid "Adjust New Location" -msgstr "Настроїти нове розташування" - -#: ../chirpui/importdialog.py:438 -msgid "Confirm overwrites" -msgstr "Підтвердіть заміну" - -#: ../chirpui/importdialog.py:444 -msgid "Options" -msgstr "Опції" - -#: ../chirpui/importdialog.py:495 -msgid "Cannot be imported because" -msgstr "Не можна імпортувати, оскільки" - -#: ../chirpui/importdialog.py:513 -#, fuzzy -msgid "Import From File" -msgstr "Імпортувати з файлу" - -#: ../chirpui/importdialog.py:514 ../chirpui/mainapp.py:1196 -msgid "Import" -msgstr "Імпорт" - -#: ../chirpui/importdialog.py:534 -msgid "To" -msgstr "До" - -#: ../chirpui/importdialog.py:535 -msgid "From" -msgstr "З" - -#: ../chirpui/importdialog.py:538 ../chirpui/memedit.py:78 -#: ../chirpui/memedit.py:99 ../chirpui/memedit.py:886 -#: ../chirpui/memedit.py:940 ../chirpui/memedit.py:1068 -msgid "Comment" -msgstr "Коментар" - -#: ../chirpui/importdialog.py:542 -msgid "Location memory will be imported into" -msgstr "Розташування пам'яті буде імпортовано до" - -#: ../chirpui/importdialog.py:543 -msgid "Location of memory in the file being imported" -msgstr "Розташування пам'яті у файлі, що імпортуються" - -#: ../chirpui/importdialog.py:566 -msgid "Preparing memory list..." -msgstr "Підготовка списку пам'яті..." - -#: ../chirpui/importdialog.py:575 -#, fuzzy -msgid "Export To File" -msgstr "Експорт до файлу" - -#: ../chirpui/importdialog.py:576 ../chirpui/mainapp.py:1197 -msgid "Export" -msgstr "Експорт" - -#: ../chirpui/mainapp.py:269 ../chirpui/mainapp.py:483 -msgid "Untitled" -msgstr "Без назви" - -#: ../chirpui/mainapp.py:316 ../chirpui/mainapp.py:715 -msgid "CHIRP Radio Images" -msgstr "Образи радіостанцій CHIRP" - -#: ../chirpui/mainapp.py:317 ../chirpui/mainapp.py:714 -#: ../chirpui/mainapp.py:880 -msgid "CHIRP Files" -msgstr "CHIRP файли" - -#: ../chirpui/mainapp.py:318 ../chirpui/mainapp.py:716 -#: ../chirpui/mainapp.py:879 -msgid "CSV Files" -msgstr "CSV-файли" - -#: ../chirpui/mainapp.py:319 ../chirpui/mainapp.py:717 -msgid "ICF Files" -msgstr "ICF файли" - -#: ../chirpui/mainapp.py:320 ../chirpui/mainapp.py:718 -msgid "VX7 Commander Files" -msgstr "Файли VX7 командира" - -#: ../chirpui/mainapp.py:330 -msgid "ICF files cannot be edited, only displayed or imported into another file. Open in read-only mode?" -msgstr "ICF файли не можна редагувати, тільки відобразити або імпортувати. Відкрити в режимі тільки для читання?" - -#: ../chirpui/mainapp.py:373 -msgid "There was an error opening {fname}: {error}" -msgstr "Сталася помилка при відкритті {fname}: {error}" - -#: ../chirpui/mainapp.py:388 -msgid "{num} errors during open:" -msgstr "{num} помилки під час відкриття:" - -#: ../chirpui/mainapp.py:394 -msgid "Note:" -msgstr "Примітка:" - -#: ../chirpui/mainapp.py:395 -msgid "The {vendor} {model} operates in live mode. This means that any changes you make are immediately sent to the radio. Because of this, you cannot perform the Save or Upload operations. If you wish to edit the contents offline, please Export to a CSV file, using the File menu." -msgstr "{vendor} {model} працює в режимі реального часу. Це означає, що будь-які зміни негайно відправляються на радіостанцію. Через це не вдалося виконати Збереження або Запис операцій. Якщо ви хочете редагувати вміст в автономному режимі, будь ласка, Експортуйте файл CSV, за допомогою Меню Файл." - -#: ../chirpui/mainapp.py:404 -msgid "Don't show this again" -msgstr "Не показувати наступного разу" - -#: ../chirpui/mainapp.py:448 -msgid "{vendor} {model} image file" -msgstr "файлу образу {vendor} {model}" - -#: ../chirpui/mainapp.py:456 -msgid "VX7 Commander" -msgstr "Командир VX7" - -#: ../chirpui/mainapp.py:518 -msgid "Open recent file {name}" -msgstr "Відкриті останній файл {name}" - -#: ../chirpui/mainapp.py:579 -msgid "Import stock configuration {name}" -msgstr "Імпорт заводської конфігурації {name}" - -#: ../chirpui/mainapp.py:595 -msgid "Open stock configuration {name}" -msgstr "Відкрите заводські конфігурації {name}" - -#: ../chirpui/mainapp.py:681 -msgid "Discard Changes?" -msgstr "Скасувати зміни?" - -#: ../chirpui/mainapp.py:686 -msgid "File is modified, save changes before closing?" -msgstr "Файл змінено, зберегти зміни перед закриттям?" - -#: ../chirpui/mainapp.py:923 -msgid "With significant contributions by:" -msgstr "Значні внески зробили:" - -#: ../chirpui/mainapp.py:940 -msgid "Select Columns" -msgstr "Виберіть Стовпці" - -#: ../chirpui/mainapp.py:955 -msgid "Visible columns for {radio}" -msgstr "Видимі стовпці для {radio}" - -#: ../chirpui/mainapp.py:1012 -msgid "Reporting is disabled" -msgstr "Звіти вимкнуто" - -#: ../chirpui/mainapp.py:1013 -msgid "The reporting feature of CHIRP is designed to help improve quality by allowing the authors to focus on the radio drivers used most often and errors experienced by the users. The reports contain no identifying information and are used only for statistical purposes by the authors. Your privacy is extremely important, but please consider leaving this feature enabled to help make CHIRP better!\n" -"\n" -"Are you sure you want to disable this feature?" -msgstr "Функцію звітування CHIRP розроблено, щоб допомогти поліпшити якість, дозволяючи авторам зосередитися на драйверах радіостанцій, що найчастіше використовується і помилках досвідчених користувачів. Звіти не містять ідентифікаційну інформацію і використовуються тільки для статистичних цілей авторів. Ваша конфіденційність є надзвичайно важлива, але будь ласка, залиште цю функцію включеною, щоб допомогти зробити CHIRP краще!\n" -"\n" -"ви впевнені, що хочете відключити цю функцію?" - -#: ../chirpui/mainapp.py:1045 -msgid "Choose a language or Auto to use the operating system default. You will need to restart the application before the change will take effect" -msgstr "Виберіть мову або авто для використання в операційній системі. Вам потрібно буде перезапустити додаток до того, як зміни вступлять в силу" - -#: ../chirpui/mainapp.py:1169 -msgid "_File" -msgstr "_Файл" - -#: ../chirpui/mainapp.py:1172 -msgid "Open stock config" -msgstr "Відкрити заводські конфігурації" - -#: ../chirpui/mainapp.py:1173 -msgid "_Recent" -msgstr "Ос_танні" - -#: ../chirpui/mainapp.py:1178 -msgid "_Edit" -msgstr "_Редагувати" - -#: ../chirpui/mainapp.py:1179 -msgid "_Cut" -msgstr "_Вирізати" - -#: ../chirpui/mainapp.py:1180 -msgid "_Copy" -msgstr "_Копіювати" - -#: ../chirpui/mainapp.py:1181 -msgid "_Paste" -msgstr "_Вставити" - -#: ../chirpui/mainapp.py:1182 -msgid "_Delete" -msgstr "_Видалити" - -#: ../chirpui/mainapp.py:1183 -msgid "Move _Up" -msgstr "Перемістити В_гору" - -#: ../chirpui/mainapp.py:1184 -#, fuzzy -msgid "Move Dow_n" -msgstr "Перемістити В_низ" - -#: ../chirpui/mainapp.py:1185 -msgid "E_xchange" -msgstr "_Обмін" - -#: ../chirpui/mainapp.py:1186 -msgid "_View" -msgstr "В_игляд" - -#: ../chirpui/mainapp.py:1187 -msgid "Columns" -msgstr "Стовпці" - -#: ../chirpui/mainapp.py:1188 -msgid "Developer" -msgstr "Розробник" - -#: ../chirpui/mainapp.py:1189 -msgid "Show raw memory" -msgstr "Показати raw пам'ять" - -#: ../chirpui/mainapp.py:1190 -msgid "Diff raw memories" -msgstr "Порівняти raw пам'ять" - -#: ../chirpui/mainapp.py:1191 -msgid "Diff tabs" -msgstr "Вкладки порівняння" - -#: ../chirpui/mainapp.py:1192 -msgid "Change language" -msgstr "Змінити мову" - -#: ../chirpui/mainapp.py:1193 -msgid "_Radio" -msgstr "_Радіостанція" - -#: ../chirpui/mainapp.py:1194 -msgid "Download From Radio" -msgstr "Скопіювати з радіостанції" - -#: ../chirpui/mainapp.py:1195 -msgid "Upload To Radio" -msgstr "Записати в радіостанцію" - -#: ../chirpui/mainapp.py:1198 -msgid "Import from RFinder" -msgstr "Імпорт з RFinder" - -#: ../chirpui/mainapp.py:1199 -msgid "CHIRP Native File" -msgstr "Файл CHIRP" - -#: ../chirpui/mainapp.py:1200 -msgid "CSV File" -msgstr "Файл CSV" - -#: ../chirpui/mainapp.py:1201 -msgid "Import from RepeaterBook" -msgstr "Імпорт з RepeaterBook" - -#: ../chirpui/mainapp.py:1202 -#, fuzzy -msgid "Import from stock config" -msgstr "Імпорт з сховища конфігурацій" - -#: ../chirpui/mainapp.py:1204 -msgid "Help" -msgstr "Довідка" - -#: ../chirpui/mainapp.py:1215 -msgid "Report statistics" -msgstr "Звіт статистики" - -#: ../chirpui/mainapp.py:1216 -msgid "Hide Unused Fields" -msgstr "Приховувати невикористовувані поля" - -#: ../chirpui/mainapp.py:1217 -msgid "Automatic Repeater Offset" -msgstr "Автоматичний рознос репітера" - -#: ../chirpui/mainapp.py:1218 -msgid "Enable Developer Functions" -msgstr "Увімкнення функції розробника" - -#: ../chirpui/mainapp.py:1352 -msgid "Error reporting is enabled" -msgstr "Звітування про критичні помилки ввімкнуто" - -#: ../chirpui/mainapp.py:1355 -msgid "If you wish to disable this feature you may do so in the Help menu" -msgstr "Якщо ви хочете вимкнути цю функцію, ви можете зробити це в меню Довідка" - -#: ../chirpui/cloneprog.py:43 -msgid "Clone Progress" -msgstr "Поступ клонування" - -#: ../chirpui/cloneprog.py:46 -msgid "Cloning" -msgstr "Клонування" - -#: ../chirpui/cloneprog.py:55 -msgid "Cancel" -msgstr "Скасувати" - -#: ../chirpui/shiftdialog.py:27 -msgid "Shift" -msgstr "Зміщення" - -#: ../chirpui/shiftdialog.py:63 -msgid "Moving {src} to {dst}" -msgstr "Переміщення {src} до {dst}" - -#: ../chirpui/shiftdialog.py:80 -msgid "Looking for a free spot ({number})" -msgstr "Пошук вільної точки ({number})" - -#: ../chirpui/shiftdialog.py:135 -msgid "Moved {count} memories" -msgstr "Перемещенно {count} записів пам'яті" - -#: ../chirpui/clone.py:35 -#, fuzzy -msgid "{vendor} {model} on {port}" -msgstr "{vendor} {model} на {port}" - -#: ../chirpui/clone.py:100 ../chirpui/clone.py:162 -msgid "Detect" -msgstr "Визначити" - -#: ../chirpui/clone.py:123 -msgid "Port" -msgstr "Порт" - -#: ../chirpui/clone.py:124 -msgid "Vendor" -msgstr "Виробник" - -#: ../chirpui/clone.py:125 -msgid "Model" -msgstr "Модель" - -#: ../chirpui/clone.py:138 -#, fuzzy -msgid "Radio" -msgstr "Радіостанція" - -#: ../chirpui/clone.py:166 -msgid "Unable to detect radio on {port}" -msgstr "Не вдалося виявити радіо на {port}" - -#: ../chirpui/clone.py:178 -msgid "Internal error: Unable to upload to {model}" -msgstr "Внутрішня помилка: не вдалося записати на {model}" - -#: ../chirpui/clone.py:226 -msgid "Clone failed: {error}" -msgstr "Помилка клонування: {error}" - -#: ../chirpui/dstaredit.py:40 -msgid "Callsign" -msgstr "Позивний" - -#: ../chirpui/dstaredit.py:124 -msgid "Your callsign" -msgstr "Ваш позивний" - -#: ../chirpui/dstaredit.py:132 -msgid "Repeater callsign" -msgstr "Позивний репітера" - -#: ../chirpui/dstaredit.py:140 -msgid "My callsign" -msgstr "Мій позивний" - -#: ../chirpui/dstaredit.py:170 ../chirpui/memedit.py:1365 -msgid "Downloading URCALL list" -msgstr "Завантаження списку URCALL" - -#: ../chirpui/dstaredit.py:174 ../chirpui/memedit.py:1377 -msgid "Downloading RPTCALL list" -msgstr "Завантаження списку RPTCALL" - -#: ../chirpui/dstaredit.py:178 -msgid "Downloading MYCALL list" -msgstr "Завантаження списку MYCALL" - -#: ../chirpui/editorset.py:87 -#, fuzzy -msgid "Memories" -msgstr "Пам'ять" - -#: ../chirpui/editorset.py:92 -msgid "D-STAR" -msgstr "D-STAR" - -#: ../chirpui/editorset.py:98 -msgid "Bank Names" -msgstr "Імена банків" - -#: ../chirpui/editorset.py:104 -msgid "Banks" -msgstr "Банки" - -#: ../chirpui/editorset.py:222 -msgid "The {vendor} {model} has multiple independent sub-devices" -msgstr "{vendor} {model} має кілька незалежних суб пристроїв" - -#: ../chirpui/editorset.py:225 -msgid "Choose one to import from:" -msgstr "Виберіть один для Імпорту з:" - -#: ../chirpui/editorset.py:230 -msgid "Cancelled" -msgstr "Скасовано" - -#: ../chirpui/editorset.py:235 -msgid "Internal Error" -msgstr "Внутрішня помилка" - -#: ../chirpui/editorset.py:248 -msgid "There were errors while opening {file}. The affected memories will not be importable!" -msgstr "Там були помилки при відкритті {file}. Порушена пам'ять не буде імпортована!" - -#: ../chirpui/editorset.py:260 -msgid "There was an error during import: {error}" -msgstr "Виникла помилка під час імпортування: {error}" - -#: ../chirpui/editorset.py:270 -msgid "Unsupported file type" -msgstr "Файл непідтримуваного типу" - -#: ../chirpui/editorset.py:286 ../chirpui/editorset.py:301 -#, fuzzy -msgid "There was an error during export: {error}" -msgstr "Виникла помилка під час експортування: {error}" - -#: ../chirpui/editorset.py:313 -msgid "Priming memory" -msgstr "Первинна пам'ять" - -#: ../chirpui/memedit.py:52 -msgid "Invalid value for this field" -msgstr "Неприпустиме значення для цього поля" - -#: ../chirpui/memedit.py:66 ../chirpui/memedit.py:97 ../chirpui/memedit.py:111 -#: ../chirpui/memedit.py:204 ../chirpui/memedit.py:312 -#: ../chirpui/memedit.py:874 ../chirpui/memedit.py:931 -#: ../chirpui/memedit.py:1069 ../chirpui/memedit.py:1133 -msgid "Tone Mode" -msgstr "Тоновий режим" - -#: ../chirpui/memedit.py:67 ../chirpui/memedit.py:87 ../chirpui/memedit.py:103 -#: ../chirpui/memedit.py:214 ../chirpui/memedit.py:218 -#: ../chirpui/memedit.py:220 ../chirpui/memedit.py:310 -#: ../chirpui/memedit.py:875 ../chirpui/memedit.py:928 -#: ../chirpui/memedit.py:1070 -msgid "Tone" -msgstr "Тон" - -#: ../chirpui/memedit.py:68 ../chirpui/memedit.py:88 ../chirpui/memedit.py:104 -#: ../chirpui/memedit.py:210 ../chirpui/memedit.py:218 -#: ../chirpui/memedit.py:221 ../chirpui/memedit.py:310 -#: ../chirpui/memedit.py:876 ../chirpui/memedit.py:929 -#: ../chirpui/memedit.py:1066 -msgid "ToneSql" -msgstr "ToneSql" - -#: ../chirpui/memedit.py:69 ../chirpui/memedit.py:89 ../chirpui/memedit.py:105 -#: ../chirpui/memedit.py:211 ../chirpui/memedit.py:215 -#: ../chirpui/memedit.py:222 ../chirpui/memedit.py:306 -#: ../chirpui/memedit.py:877 ../chirpui/memedit.py:930 -#: ../chirpui/memedit.py:1059 -msgid "DTCS Code" -msgstr "DTCS код" - -#: ../chirpui/memedit.py:70 ../chirpui/memedit.py:90 ../chirpui/memedit.py:106 -#: ../chirpui/memedit.py:212 ../chirpui/memedit.py:216 -#: ../chirpui/memedit.py:223 ../chirpui/memedit.py:878 -#: ../chirpui/memedit.py:933 ../chirpui/memedit.py:1060 -msgid "DTCS Pol" -msgstr "DTCS Pol" - -#: ../chirpui/memedit.py:71 ../chirpui/memedit.py:91 ../chirpui/memedit.py:112 -#: ../chirpui/memedit.py:879 ../chirpui/memedit.py:932 -#: ../chirpui/memedit.py:1067 ../chirpui/memedit.py:1134 -msgid "Cross Mode" -msgstr "Кросрежим" - -#: ../chirpui/memedit.py:72 ../chirpui/memedit.py:92 ../chirpui/memedit.py:109 -#: ../chirpui/memedit.py:137 ../chirpui/memedit.py:205 -#: ../chirpui/memedit.py:249 ../chirpui/memedit.py:312 -#: ../chirpui/memedit.py:880 ../chirpui/memedit.py:934 -#: ../chirpui/memedit.py:1071 ../chirpui/memedit.py:1144 -msgid "Duplex" -msgstr "Дуплекс" - -#: ../chirpui/memedit.py:73 ../chirpui/memedit.py:93 ../chirpui/memedit.py:135 -#: ../chirpui/memedit.py:198 ../chirpui/memedit.py:226 -#: ../chirpui/memedit.py:250 ../chirpui/memedit.py:308 -#: ../chirpui/memedit.py:881 ../chirpui/memedit.py:935 -#: ../chirpui/memedit.py:1062 -msgid "Offset" -msgstr "Зсув" - -#: ../chirpui/memedit.py:74 ../chirpui/memedit.py:94 ../chirpui/memedit.py:107 -#: ../chirpui/memedit.py:882 ../chirpui/memedit.py:936 -#: ../chirpui/memedit.py:1061 ../chirpui/memedit.py:1132 -#: ../chirpui/memedit.py:1289 ../chirpui/memedit.py:1307 -#: ../chirpui/memedit.py:1317 -msgid "Mode" -msgstr "Режим" - -#: ../chirpui/memedit.py:75 ../chirpui/memedit.py:95 ../chirpui/memedit.py:108 -#: ../chirpui/memedit.py:296 ../chirpui/memedit.py:883 -#: ../chirpui/memedit.py:937 ../chirpui/memedit.py:1073 -#: ../chirpui/memedit.py:1136 ../chirpui/memedit.py:1140 -msgid "Power" -msgstr "Потужність" - -#: ../chirpui/memedit.py:76 ../chirpui/memedit.py:96 ../chirpui/memedit.py:110 -#: ../chirpui/memedit.py:140 ../chirpui/memedit.py:143 -#: ../chirpui/memedit.py:884 ../chirpui/memedit.py:938 -#: ../chirpui/memedit.py:1064 -msgid "Tune Step" -msgstr "Крок настройки" - -#: ../chirpui/memedit.py:77 ../chirpui/memedit.py:98 ../chirpui/memedit.py:885 -#: ../chirpui/memedit.py:939 ../chirpui/memedit.py:1072 -#: ../chirpui/memedit.py:1135 -msgid "Skip" -msgstr "Пропустити" - -#: ../chirpui/memedit.py:175 -msgid "Erasing memory {loc}" -msgstr "Стирання пам'яті {loc}" - -#: ../chirpui/memedit.py:236 -msgid "Unable to make changes to this model" -msgstr "Не вдається внести зміни до цієї моделі" - -#: ../chirpui/memedit.py:241 -msgid "Editing new item, taking defaults" -msgstr "Редагування нового елемента, беручи за замовчуванням" - -#: ../chirpui/memedit.py:257 -msgid "Bad value for {col}: {val}" -msgstr "Погане значення для {col}: {val}" - -#: ../chirpui/memedit.py:281 -msgid "Error setting memory" -msgstr "Помилка настройки пам'яті" - -#: ../chirpui/memedit.py:289 ../chirpui/memedit.py:356 -#: ../chirpui/memedit.py:1272 -msgid "Writing memory {number}" -msgstr "Запис пам'яті {number}" - -#: ../chirpui/memedit.py:361 -msgid "This operation requires moving all subsequent channels by one spot until an empty location is reached. This can take a LONG time. Are you sure you want to do this?" -msgstr "Ця операція вимагає переміщення всіх наступних каналів на одне місце до тих пір, поки пусте місце не буде досягнуто. Це може зайняти багато часу. Ви впевнені, що хочете це зробити?" - -#: ../chirpui/memedit.py:387 -msgid "Adding memory {number}" -msgstr "Додавання пам'яті {number}" - -#: ../chirpui/memedit.py:400 ../chirpui/memedit.py:913 -msgid "Erasing memory {number}" -msgstr "Стирання пам'яті {number}" - -#: ../chirpui/memedit.py:409 ../chirpui/memedit.py:518 -#: ../chirpui/memedit.py:564 ../chirpui/memedit.py:569 -#: ../chirpui/memedit.py:856 ../chirpui/memedit.py:1166 -msgid "Getting memory {number}" -msgstr "Отримання пам'яті {number}" - -#: ../chirpui/memedit.py:497 ../chirpui/memedit.py:508 -#: ../chirpui/memedit.py:556 -msgid "Moving memory from {old} to {new}" -msgstr "Переміщення пам'яті з {old} до {new}" - -#: ../chirpui/memedit.py:578 -msgid "Raw memory {number}" -msgstr "RAW пам'ять {number}" - -#: ../chirpui/memedit.py:582 ../chirpui/memedit.py:610 -#: ../chirpui/memedit.py:615 -msgid "Getting raw memory {number}" -msgstr "Отримання RAW пам'яті {number}" - -#: ../chirpui/memedit.py:587 -msgid "You can only diff two memories!" -msgstr "Ви можете порівняти тільки дві пам'яті!" - -#: ../chirpui/memedit.py:598 -msgid "Memory {number}" -msgstr "Пам'ять {number}" - -#: ../chirpui/memedit.py:604 -msgid "Diff of {a} and {b}" -msgstr "Порівняння {a} та {b}" - -#: ../chirpui/memedit.py:628 -msgid "Memories must be contiguous" -msgstr "Пам'ять має бути безперервна" - -#: ../chirpui/memedit.py:700 -msgid "Insert row above" -msgstr "Додати рядок зверху" - -#: ../chirpui/memedit.py:701 -msgid "Insert row below" -msgstr "Додати рядок знизу" - -#: ../chirpui/memedit.py:702 -#, fuzzy -msgid "Delete" -msgstr "Видалити" - -#: ../chirpui/memedit.py:702 -#, fuzzy -msgid "Delete all" -msgstr "Видалити все" - -#: ../chirpui/memedit.py:703 -msgid "Delete (and shift up)" -msgstr "Видалити (та зсунути вгору)" - -#: ../chirpui/memedit.py:704 -#, fuzzy -msgid "Move up" -msgstr "Перемістити вгору" - -#: ../chirpui/memedit.py:705 -#, fuzzy -msgid "Move down" -msgstr "Перемістити вниз" - -#: ../chirpui/memedit.py:706 -#, fuzzy -msgid "Exchange memories" -msgstr "Обмін пам'яттю" - -#: ../chirpui/memedit.py:707 -#, fuzzy -msgid "Cut" -msgstr "Вирізати" - -#: ../chirpui/memedit.py:708 -#, fuzzy -msgid "Copy" -msgstr "Копіювати" - -#: ../chirpui/memedit.py:709 -#, fuzzy -msgid "Paste" -msgstr "Вставити" - -#: ../chirpui/memedit.py:710 -#, fuzzy -msgid "Show Raw Memory" -msgstr "Показати Raw пам'ять" - -#: ../chirpui/memedit.py:711 -#, fuzzy -msgid "Diff Raw Memories" -msgstr "Порівняти Raw пам'ять" - -#: ../chirpui/memedit.py:835 -msgid "Internal Error: Column {name} not found" -msgstr "Внутрішня помилка: не знайдено стовпець {name}" - -#: ../chirpui/memedit.py:863 -msgid "Getting channel {chan}" -msgstr "Отримання каналу {chan}" - -#: ../chirpui/memedit.py:952 -msgid "Internal Error: Invalid limit {number}" -msgstr "Внутрішня помилка: Неприпустиме обмеження {number}" - -#: ../chirpui/memedit.py:962 -msgid "Memory range:" -msgstr "Діапазон пам'яті:" - -#: ../chirpui/memedit.py:989 -msgid "Go" -msgstr "Іти" - -#: ../chirpui/memedit.py:1012 -msgid "Special Channels" -msgstr "Спеціальні канали" - -#: ../chirpui/memedit.py:1019 -msgid "Show Empty" -msgstr "Показувати порожні" - -#: ../chirpui/memedit.py:1198 -msgid "Cutting memory {number}" -msgstr "Отримання пам'яті {number}" - -#: ../chirpui/memedit.py:1232 -msgid "Overwrite?" -msgstr "Перезаписати?" - -#: ../chirpui/memedit.py:1237 -msgid "Overwrite location {number}?" -msgstr "Перезаписати місце {number}?" - -#: ../chirpui/memedit.py:1254 -msgid "Incompatible Memory" -msgstr "Несумісна пам'ять" - -#: ../chirpui/memedit.py:1257 -msgid "Pasted memory {number} is not compatible with this radio because:" -msgstr "Вставлена пам'ять {number} несумісна із цією радіостанцією тому що:" - -#: ../chirpui/memedit.py:1309 ../chirpui/memedit.py:1324 -msgid "URCALL" -msgstr "URCALL" - -#: ../chirpui/memedit.py:1309 ../chirpui/memedit.py:1325 -msgid "RPT1CALL" -msgstr "RPT1CALL" - -#: ../chirpui/memedit.py:1309 ../chirpui/memedit.py:1326 -msgid "RPT2CALL" -msgstr "RPT2CALL" - -#: ../chirpui/memedit.py:1310 ../chirpui/memedit.py:1327 -msgid "Digital Code" -msgstr "Цифровий код" - -#~ msgid "%i errors during open, check the debug log for details" -#~ msgstr "%i errors during open, check the debug log for details" diff --git a/locale/zh_CN.po b/locale/zh_CN.po deleted file mode 100644 index 5fa0ff1..0000000 --- a/locale/zh_CN.po +++ /dev/null @@ -1,1275 +0,0 @@ -# Copyright (C) 2022 Dan Smith -# This file is distributed under the same license as the CHIRP package. -# -# DuckSoft, BH2UEP , 2022. -msgid "" -msgstr "" -"Project-Id-Version: CHIRP\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-06-04 01:53+0800\n" -"PO-Revision-Date: 2022-06-04 02:01+0800\n" -"Last-Translator: DuckSoft, BH2UEP \n" -"Language: zh_CN\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=1; plural=0;\n" -"X-Generator: Lokalize 22.04.1\n" - -#: ../chirp/ui/cloneprog.py:44 -msgid "Clone Progress" -msgstr "复制进度" - -#: ../chirp/ui/cloneprog.py:47 -msgid "Cloning" -msgstr "正在复制" - -#: ../chirp/ui/cloneprog.py:56 -msgid "Cancel" -msgstr "取消" - -#: ../chirp/ui/editorset.py:85 -#, python-format -msgid "Memories (%(variant)s)" -msgstr "存储(%(variant)s)" - -#: ../chirp/ui/editorset.py:89 -msgid "Memories" -msgstr "存储" - -#: ../chirp/ui/editorset.py:100 -msgid "D-STAR" -msgstr "D-STAR" - -#: ../chirp/ui/editorset.py:149 -msgid "Settings" -msgstr "设置" - -#: ../chirp/ui/editorset.py:158 -msgid "Browser" -msgstr "浏览器" - -#: ../chirp/ui/editorset.py:279 -#, python-brace-format -msgid "The {vendor} {model} has multiple independent sub-devices" -msgstr "电台 {vendor} {model} 有多个独立的子设备" - -#: ../chirp/ui/editorset.py:281 -msgid "Choose one to import from:" -msgstr "选择一个来导入:" - -#: ../chirp/ui/editorset.py:286 -msgid "Cancelled" -msgstr "已取消" - -#: ../chirp/ui/editorset.py:291 -msgid "Internal Error" -msgstr "内部错误" - -#: ../chirp/ui/editorset.py:332 -#, python-brace-format -msgid "" -"There were errors while opening {file}. The affected memories will not be " -"importable!" -msgstr "打开 {file} 时出错。受影响的存储将不可导入!" - -#: ../chirp/ui/editorset.py:344 -#, python-brace-format -msgid "There was an error during import: {error}" -msgstr "导入时出错:{error}" - -#: ../chirp/ui/editorset.py:352 -msgid "Unsupported file type" -msgstr "不支持的文件类型" - -#: ../chirp/ui/editorset.py:368 ../chirp/ui/editorset.py:383 -#, python-brace-format -msgid "There was an error during export: {error}" -msgstr "导出时出错:{error}" - -#: ../chirp/ui/bandplans.py:96 -msgid "" -"Band plans define default channel settings for frequencies in a region. " -"Choose a band plan or None for completely manual channel settings." -msgstr "" -"频段计划定义了一个区域内频率的默认频道设置。请选择一个频段计划,或选择“无”以" -"完全手动设置频道。" - -#: ../chirp/ui/common.py:246 -msgid "Completed" -msgstr "已完成" - -#: ../chirp/ui/common.py:247 -msgid "idle" -msgstr "空闲" - -#: ../chirp/ui/common.py:354 -msgid "Details" -msgstr "详情" - -#: ../chirp/ui/common.py:357 -msgid "Proceed?" -msgstr "要继续吗?" - -#: ../chirp/ui/common.py:366 -msgid "Do not show this next time" -msgstr "下次不再出现" - -#: ../chirp/ui/mainapp.py:272 ../chirp/ui/mainapp.py:513 -msgid "Untitled" -msgstr "无标题" - -#: ../chirp/ui/mainapp.py:326 ../chirp/ui/mainapp.py:875 -msgid "All files" -msgstr "全部文件" - -#: ../chirp/ui/mainapp.py:327 ../chirp/ui/mainapp.py:876 -msgid "CHIRP Radio Images" -msgstr "CHIRP 电台镜像" - -#: ../chirp/ui/mainapp.py:328 ../chirp/ui/mainapp.py:877 -#: ../chirp/ui/mainapp.py:1557 -msgid "CSV Files" -msgstr "CSV 文件" - -#: ../chirp/ui/mainapp.py:329 ../chirp/ui/mainapp.py:878 -msgid "DAT Files" -msgstr "DAT 文件" - -#: ../chirp/ui/mainapp.py:330 ../chirp/ui/mainapp.py:879 -msgid "EVE Files (VX5)" -msgstr "EVE 文件 (VX5)" - -#: ../chirp/ui/mainapp.py:331 ../chirp/ui/mainapp.py:880 -msgid "ICF Files" -msgstr "ICF 文件" - -#: ../chirp/ui/mainapp.py:332 ../chirp/ui/mainapp.py:884 -msgid "VX5 Commander Files" -msgstr "VX5 Commander 文件" - -#: ../chirp/ui/mainapp.py:333 ../chirp/ui/mainapp.py:885 -msgid "VX6 Commander Files" -msgstr "VX6 Commander 文件" - -#: ../chirp/ui/mainapp.py:334 ../chirp/ui/mainapp.py:886 -msgid "VX7 Commander Files" -msgstr "VX7 Commander 文件" - -#: ../chirp/ui/mainapp.py:348 -msgid "" -"ICF files cannot be edited, only displayed or imported into another file. " -"Open in read-only mode?" -msgstr "不能编辑 ICF 文件,只能展示或导入到其他文件中。以只读模式打开吗?" - -#: ../chirp/ui/mainapp.py:371 -msgid "" -"Unable to open this image. It was generated with a newer version of CHIRP " -"and thus may be for a radio model that is not supported by this version. " -"Please update to the latest version of CHIRP and try again." -msgstr "" -"无法打开此镜像。此镜像由较新版本的 CHIRP 生成,当前版本可能还不支持对应的型" -"号。请更新 CHIRP 后再试。" - -#: ../chirp/ui/mainapp.py:380 -msgid "Unable to open this image: unsupported model" -msgstr "无法打开此镜像:型号不支持" - -#: ../chirp/ui/mainapp.py:400 -#, python-brace-format -msgid "There was an error opening {fname}: {error}" -msgstr "打开 {fname} 时出错:{error}" - -#: ../chirp/ui/mainapp.py:412 -#, python-brace-format -msgid "{num} errors during open:" -msgstr "打开文件时出现 {num} 个错误:" - -#: ../chirp/ui/mainapp.py:420 -msgid "Note:" -msgstr "注意:" - -#: ../chirp/ui/mainapp.py:421 -#, python-brace-format -msgid "" -"The {vendor} {model} operates in live mode. This means that any " -"changes you make are immediately sent to the radio. Because of this, you " -"cannot perform the Save or Upload operations. If you wish to " -"edit the contents offline, please Export to a CSV file, using the " -"File menu." -msgstr "" -"此电台 {vendor} {model} 工作在实时模式,也就是说变更会即时发送给电台。" -"因此,您不能进行保存或者上传 操作。如果您想离线编辑内容,请使用" -"文件菜单的导出到 CSV 功能。" - -#: ../chirp/ui/mainapp.py:430 -msgid "Don't show this again" -msgstr "不再显示" - -#: ../chirp/ui/mainapp.py:464 -#, python-brace-format -msgid "{vendor} {model} image file" -msgstr "{vendor} {model} 镜像文件" - -#: ../chirp/ui/mainapp.py:480 -msgid "VX7 Commander" -msgstr "VX7 Commander" - -#: ../chirp/ui/mainapp.py:482 -msgid "VX6 Commander" -msgstr "VX6 Commander" - -#: ../chirp/ui/mainapp.py:484 -msgid "EVE" -msgstr "EVE" - -#: ../chirp/ui/mainapp.py:485 -msgid "VX5 Commander" -msgstr "VX5 Commander" - -#: ../chirp/ui/mainapp.py:562 -msgid "Open recent file" -msgstr "打开最近的文件" - -#: ../chirp/ui/mainapp.py:631 -#, python-brace-format -msgid "Import stock configuration {name}" -msgstr "导入库存配置 {name}" - -#: ../chirp/ui/mainapp.py:647 -#, python-brace-format -msgid "Open stock configuration {name}" -msgstr "打开库存配置 {name}" - -#: ../chirp/ui/mainapp.py:668 -msgid "Proceed with experimental driver?" -msgstr "继续使用不稳定的驱动?" - -#: ../chirp/ui/mainapp.py:670 -msgid "This radio's driver is experimental. Do you want to proceed?" -msgstr "此电台的驱动程序尚不稳定。要继续吗?" - -#: ../chirp/ui/mainapp.py:689 -#, python-brace-format -msgid "{name} Information" -msgstr "{name} 信息" - -#: ../chirp/ui/mainapp.py:691 -#, python-brace-format -msgid "{information}" -msgstr "{information}" - -#: ../chirp/ui/mainapp.py:695 -msgid "Don't show information for any radio again" -msgstr "任何电台都不显示信息" - -#: ../chirp/ui/mainapp.py:719 -#, python-brace-format -msgid "{name} Instructions" -msgstr "{name} 指引" - -#: ../chirp/ui/mainapp.py:721 -#, python-brace-format -msgid "{instructions}" -msgstr "{instructions}" - -#: ../chirp/ui/mainapp.py:725 -msgid "Don't show instructions for any radio again" -msgstr "任何电台都不显示指引" - -#: ../chirp/ui/mainapp.py:840 -msgid "Save Changes?" -msgstr "保存变更?" - -#: ../chirp/ui/mainapp.py:846 -msgid "File is modified, save changes before closing?" -msgstr "文件已更改,关闭前要保存变更吗?" - -#: ../chirp/ui/mainapp.py:881 -msgid "Kenwood HMK Files" -msgstr "建伍(Kenwood)HMK 文件" - -#: ../chirp/ui/mainapp.py:882 -msgid "Kenwood ITM Files" -msgstr "建伍(Kenwood)ITM 文件" - -#: ../chirp/ui/mainapp.py:883 -msgid "Travel Plus Files" -msgstr "Travel Plus 文件" - -#: ../chirp/ui/mainapp.py:904 -msgid "DMR-MARC Repeater Database Dump" -msgstr "DMR-MARC Repeater 数据库转存" - -#: ../chirp/ui/mainapp.py:1014 ../chirp/ui/mainapp.py:1121 -msgid "RepeaterBook Query" -msgstr "RepeaterBook 查询" - -#: ../chirp/ui/mainapp.py:1075 ../chirp/ui/mainapp.py:1181 -msgid "RepeaterBook query failed" -msgstr "RepeaterBook 查询失败" - -#: ../chirp/ui/mainapp.py:1248 -#, python-format -msgid "Invalid value for %s" -msgstr "%s 值无效" - -#: ../chirp/ui/mainapp.py:1271 -msgid "Query failed" -msgstr "查询失败" - -#: ../chirp/ui/mainapp.py:1366 ../chirp/ui/mainapp.py:1431 -msgid "RadioReference.com Query" -msgstr "RadioReference.com 查询" - -#: ../chirp/ui/mainapp.py:1502 -msgid "RadioReference.com Province Query" -msgstr "RadioReference.com 省份查询" - -#: ../chirp/ui/mainapp.py:1603 -msgid "With significant contributions from:" -msgstr "鸣谢:" - -#: ../chirp/ui/mainapp.py:1637 -msgid "Select Columns" -msgstr "选择列" - -#: ../chirp/ui/mainapp.py:1654 -#, python-brace-format -msgid "Visible columns for {radio}" -msgstr "{radio} 的可见列" - -#: ../chirp/ui/mainapp.py:1717 -msgid "Reporting is disabled" -msgstr "报告已禁用" - -#: ../chirp/ui/mainapp.py:1719 -msgid "" -"The reporting feature of CHIRP is designed to help improve quality by " -"allowing the authors to focus on the radio drivers used most often and " -"errors experienced by the users. The reports contain no identifying " -"information and are used only for statistical purposes by the authors. Your " -"privacy is extremely important, but please consider leaving this feature " -"enabled to help make CHIRP better!\n" -"\n" -"Are you sure you want to disable this feature?" -msgstr "" -"CHIRP 的报告功能旨在帮助改善软件质量,让作者能关注最常使用的电台驱动程" -"序以及用户遇到的错误。这些报告不包含任何识别信息,仅用于作者的统计目的。您的" -"隐私非常重要,但请考虑启用这一功能,以帮助 CHIRP 变得更好!\n" -"\n" -"确定要禁用此功能吗?" - -#: ../chirp/ui/mainapp.py:1762 -msgid "" -"Choose a language or Auto to use the operating system default. You will need " -"to restart the application before the change will take effect" -msgstr "选择一种语言或自动使用操作系统的默认语言。你需要重新启动程序才能使改变生效。" - -#: ../chirp/ui/mainapp.py:1775 -msgid "Python Modules" -msgstr "Python 模块" - -#: ../chirp/ui/mainapp.py:1776 -msgid "Modules" -msgstr "模块" - -#: ../chirp/ui/mainapp.py:1980 -msgid "_File" -msgstr "文件 (_F)" - -#: ../chirp/ui/mainapp.py:1983 -msgid "Open Stock Config" -msgstr "打开库存配置" - -#: ../chirp/ui/mainapp.py:1984 -msgid "Open _Recent" -msgstr "打开最近 (_R)" - -#: ../chirp/ui/mainapp.py:1985 -msgid "Clear Recently Opened" -msgstr "清空最近项目" - -#: ../chirp/ui/mainapp.py:1989 -msgid "Load Module" -msgstr "加载模块" - -#: ../chirp/ui/mainapp.py:1992 -msgid "_Edit" -msgstr "编辑 (_E)" - -#: ../chirp/ui/mainapp.py:1993 -msgid "_Cut" -msgstr "剪切 (_C)" - -#: ../chirp/ui/mainapp.py:1994 -msgid "_Copy" -msgstr "复制 (_C)" - -#: ../chirp/ui/mainapp.py:1995 -msgid "_Paste" -msgstr "粘贴 (_P)" - -#: ../chirp/ui/mainapp.py:1997 -msgid "_Delete" -msgstr "删除 (_D)" - -#: ../chirp/ui/mainapp.py:1998 -msgid "Select _All" -msgstr "全选 (_A)" - -#: ../chirp/ui/mainapp.py:1999 -msgid "Move _Up" -msgstr "上移 (_U)" - -#: ../chirp/ui/mainapp.py:2001 -msgid "Move Dow_n" -msgstr "下移 (_N)" - -#: ../chirp/ui/mainapp.py:2003 -msgid "E_xchange" -msgstr "交换 (_X)" - -#: ../chirp/ui/mainapp.py:2005 ../chirp/ui/memedit.py:888 -msgid "P_roperties" -msgstr "属性 (_P)" - -#: ../chirp/ui/mainapp.py:2006 -msgid "_View" -msgstr "查看 (_V)" - -#: ../chirp/ui/mainapp.py:2007 -msgid "Columns" -msgstr "列" - -#: ../chirp/ui/mainapp.py:2008 -msgid "Developer" -msgstr "开发者" - -#: ../chirp/ui/mainapp.py:2009 ../chirp/ui/memedit.py:889 -msgid "Show Raw Memory" -msgstr "显示原始存储" - -#: ../chirp/ui/mainapp.py:2011 ../chirp/ui/memedit.py:890 -msgid "Diff Raw Memories" -msgstr "对比原始存储" - -#: ../chirp/ui/mainapp.py:2013 -msgid "Diff Tabs" -msgstr "对比面板" - -#: ../chirp/ui/mainapp.py:2015 -msgid "Change Language" -msgstr "更改语言 (Change Language)" - -#: ../chirp/ui/mainapp.py:2016 -msgid "_Radio" -msgstr "电台 (_R)" - -#: ../chirp/ui/mainapp.py:2017 -msgid "Download From Radio" -msgstr "从电台下载" - -#: ../chirp/ui/mainapp.py:2019 -msgid "Upload To Radio" -msgstr "上传到电台" - -#: ../chirp/ui/mainapp.py:2021 ../chirp/ui/importdialog.py:576 -msgid "Import" -msgstr "导入" - -#: ../chirp/ui/mainapp.py:2022 ../chirp/ui/importdialog.py:642 -msgid "Export" -msgstr "导出" - -#: ../chirp/ui/mainapp.py:2023 -msgid "Import From Data Source" -msgstr "从数据源导入" - -#: ../chirp/ui/mainapp.py:2025 ../chirp/ui/mainapp.py:2039 -msgid "DMR-MARC Repeaters" -msgstr "DMR-MARC 中继" - -#: ../chirp/ui/mainapp.py:2026 ../chirp/ui/mainapp.py:2040 -msgid "RadioReference" -msgstr "RadioReference" - -#: ../chirp/ui/mainapp.py:2027 ../chirp/ui/mainapp.py:2041 -msgid "RadioReference.com US" -msgstr "RadioReference.com 美国" - -#: ../chirp/ui/mainapp.py:2029 ../chirp/ui/mainapp.py:2043 -msgid "RadioReference.com Canada" -msgstr "RadioReference.com 加拿大" - -#: ../chirp/ui/mainapp.py:2031 ../chirp/ui/mainapp.py:2045 -msgid "RFinder" -msgstr "RFinder" - -#: ../chirp/ui/mainapp.py:2032 ../chirp/ui/mainapp.py:2047 -msgid "RepeaterBook" -msgstr "RepeaterBook" - -#: ../chirp/ui/mainapp.py:2033 ../chirp/ui/mainapp.py:2048 -msgid "RepeaterBook Political Query" -msgstr "RepeaterBook 政策查询" - -#: ../chirp/ui/mainapp.py:2035 ../chirp/ui/mainapp.py:2050 -msgid "RepeaterBook Proximity Query" -msgstr "RepeaterBook 近距离查询" - -#: ../chirp/ui/mainapp.py:2037 ../chirp/ui/mainapp.py:2046 -msgid "przemienniki.net" -msgstr "przemienniki.net" - -#: ../chirp/ui/mainapp.py:2038 -msgid "Query Data Source" -msgstr "查询数据源" - -#: ../chirp/ui/mainapp.py:2052 -msgid "CHIRP Native File" -msgstr "CHIRP 原生文件" - -#: ../chirp/ui/mainapp.py:2054 -msgid "CSV File" -msgstr "CSV 文件" - -#: ../chirp/ui/mainapp.py:2055 -msgid "Import From Stock Config" -msgstr "从库存配置中导入" - -#: ../chirp/ui/mainapp.py:2057 -msgid "Channel Defaults" -msgstr "频道默认值" - -#: ../chirp/ui/mainapp.py:2060 -msgid "Help" -msgstr "帮助" - -#: ../chirp/ui/mainapp.py:2062 -msgid "Get Help Online..." -msgstr "在线帮助..." - -#: ../chirp/ui/mainapp.py:2073 -msgid "Report Statistics" -msgstr "上报统计信息" - -#: ../chirp/ui/mainapp.py:2075 -msgid "Hide Unused Fields" -msgstr "隐藏未使用的字段" - -#: ../chirp/ui/mainapp.py:2077 -msgid "Smart Tone Modes" -msgstr "自动选择亚音频制式" - -#: ../chirp/ui/mainapp.py:2079 -msgid "Show Information" -msgstr "显示信息" - -#: ../chirp/ui/mainapp.py:2081 -msgid "Show Instructions" -msgstr "显示指引" - -#: ../chirp/ui/mainapp.py:2083 -msgid "Enable Developer Functions" -msgstr "启用开发者功能" - -#: ../chirp/ui/mainapp.py:2204 -#, python-brace-format -msgid "A new version of CHIRP is available: {ver}. " -msgstr "CHIRP 新版本可用:{ver}。" - -#: ../chirp/ui/mainapp.py:2326 -msgid "Error reporting is enabled" -msgstr "错误报告已启用" - -#: ../chirp/ui/mainapp.py:2329 -msgid "" -"If you wish to disable this feature you may do so in the Help menu" -msgstr "要禁用此功能,您可在 帮助 菜单中操作" - -#: ../chirp/ui/bankedit.py:58 -#, python-format -msgid "Retrieving %s information" -msgstr "正在获取 %s 信息" - -#: ../chirp/ui/bankedit.py:81 -#, python-format -msgid "Setting name on %s" -msgstr "关于 %s 的设置名称" - -#: ../chirp/ui/bankedit.py:93 ../chirp/ui/bankedit.py:283 -#: ../chirp/ui/importdialog.py:601 ../chirp/ui/memdetail.py:334 -#: ../chirp/ui/memedit.py:67 ../chirp/ui/memedit.py:88 -#: ../chirp/ui/memedit.py:343 ../chirp/ui/memedit.py:1093 -#: ../chirp/ui/memedit.py:1150 ../chirp/ui/memedit.py:1301 -#: ../chirp/ui/memedit.py:1303 -msgid "Name" -msgstr "名称" - -#: ../chirp/ui/bankedit.py:222 -#, python-brace-format -msgid "Updating {type} index for memory {num}" -msgstr "正在更新存储 {num} 的 {type} 索引" - -#: ../chirp/ui/bankedit.py:232 -#, python-brace-format -msgid "Updating mapping information for memory {num}" -msgstr "正在更新存储 {num} 的映射信息" - -#: ../chirp/ui/bankedit.py:238 ../chirp/ui/bankedit.py:269 -#, python-brace-format -msgid "Getting memory {num}" -msgstr "正在获取存储 {num}" - -#: ../chirp/ui/bankedit.py:253 -#, python-brace-format -msgid "Setting index for memory {num}" -msgstr "正在设置存储 {num} 的索引" - -#: ../chirp/ui/bankedit.py:262 -#, python-brace-format -msgid "Getting {type} for memory {num}" -msgstr "正在获取存储 {num} 的 {type}" - -#: ../chirp/ui/bankedit.py:281 ../chirp/ui/memedit.py:65 -#: ../chirp/ui/memedit.py:195 ../chirp/ui/memedit.py:342 -#: ../chirp/ui/memedit.py:426 ../chirp/ui/memedit.py:445 -#: ../chirp/ui/memedit.py:459 ../chirp/ui/memedit.py:482 -#: ../chirp/ui/memedit.py:504 ../chirp/ui/memedit.py:530 -#: ../chirp/ui/memedit.py:542 ../chirp/ui/memedit.py:566 -#: ../chirp/ui/memedit.py:568 ../chirp/ui/memedit.py:641 -#: ../chirp/ui/memedit.py:655 ../chirp/ui/memedit.py:657 -#: ../chirp/ui/memedit.py:699 ../chirp/ui/memedit.py:701 -#: ../chirp/ui/memedit.py:775 ../chirp/ui/memedit.py:909 -#: ../chirp/ui/memedit.py:983 ../chirp/ui/memedit.py:1036 -#: ../chirp/ui/memedit.py:1091 ../chirp/ui/memedit.py:1117 -#: ../chirp/ui/memedit.py:1130 ../chirp/ui/memedit.py:1148 -#: ../chirp/ui/memedit.py:1477 -msgid "Loc" -msgstr "位置" - -#: ../chirp/ui/bankedit.py:282 ../chirp/ui/importdialog.py:602 -#: ../chirp/ui/memdetail.py:332 ../chirp/ui/memedit.py:66 -#: ../chirp/ui/memedit.py:89 ../chirp/ui/memedit.py:210 -#: ../chirp/ui/memedit.py:334 ../chirp/ui/memedit.py:344 -#: ../chirp/ui/memedit.py:407 ../chirp/ui/memedit.py:415 -#: ../chirp/ui/memedit.py:1094 ../chirp/ui/memedit.py:1147 -msgid "Frequency" -msgstr "频率" - -#: ../chirp/ui/bankedit.py:284 -msgid "Index" -msgstr "索引" - -#: ../chirp/ui/bankedit.py:375 -#, python-brace-format -msgid "Getting {type} information for memory {num}" -msgstr "正在获取存储 {num} 的 {type} 信息" - -#: ../chirp/ui/bankedit.py:401 -#, python-format -msgid "Getting %s information" -msgstr "正在获取 %s 信息" - -#: ../chirp/ui/importdialog.py:96 -#, python-brace-format -msgid "" -"Location {number} is already being imported. Choose another value for 'New " -"Location' before selection 'Import'" -msgstr "位置 {number} 已被导入。请为“新位置”选择一个新的值,然后再选择“导入”。" - -#: ../chirp/ui/importdialog.py:128 -msgid "Invalid value. Must be an integer." -msgstr "无效值。必须为整数。" - -#: ../chirp/ui/importdialog.py:137 -#, python-brace-format -msgid "Location {number} is already being imported" -msgstr "位置 {number} 已被导入" - -#: ../chirp/ui/importdialog.py:194 -msgid "Updating URCALL list" -msgstr "正在更新 URCALL 列表" - -#: ../chirp/ui/importdialog.py:199 -msgid "Updating RPTCALL list" -msgstr "正在更新 RPTCALL 列表" - -#: ../chirp/ui/importdialog.py:272 -#, python-brace-format -msgid "Setting memory {number}" -msgstr "正在设置存储 {number}" - -#: ../chirp/ui/importdialog.py:277 -msgid "Importing bank information" -msgstr "正在导入记忆库信息" - -#: ../chirp/ui/importdialog.py:281 -msgid "Error importing memories:" -msgstr "导入存储时出错:" - -#: ../chirp/ui/importdialog.py:393 -msgid "All" -msgstr "全选" - -#: ../chirp/ui/importdialog.py:399 -msgid "None" -msgstr "全不选" - -#: ../chirp/ui/importdialog.py:405 -msgid "Inverse" -msgstr "反选" - -#: ../chirp/ui/importdialog.py:411 -msgid "Select" -msgstr "选择" - -#: ../chirp/ui/importdialog.py:457 -msgid "Auto" -msgstr "自动" - -#: ../chirp/ui/importdialog.py:463 -#, fuzzy -msgid "Reverse" -msgstr "倒频" - -#: ../chirp/ui/importdialog.py:469 -msgid "Adjust New Location" -msgstr "调整新的位置" - -#: ../chirp/ui/importdialog.py:479 -msgid "Confirm overwrites" -msgstr "确认覆盖" - -#: ../chirp/ui/importdialog.py:485 -msgid "Options" -msgstr "选项" - -#: ../chirp/ui/importdialog.py:558 -msgid "Cannot be imported because" -msgstr "无法导入:" - -#: ../chirp/ui/importdialog.py:575 -msgid "Import From File" -msgstr "导入自文件" - -#: ../chirp/ui/importdialog.py:599 -msgid "To" -msgstr "到" - -#: ../chirp/ui/importdialog.py:600 -msgid "From" -msgstr "从" - -#: ../chirp/ui/importdialog.py:603 ../chirp/ui/memdetail.py:362 -#: ../chirp/ui/memedit.py:81 ../chirp/ui/memedit.py:103 -#: ../chirp/ui/memedit.py:1108 ../chirp/ui/memedit.py:1165 -#: ../chirp/ui/memedit.py:1306 -msgid "Comment" -msgstr "备注" - -#: ../chirp/ui/importdialog.py:607 -msgid "Location memory will be imported into" -msgstr "位置存储将被导入到" - -#: ../chirp/ui/importdialog.py:608 -#, fuzzy -msgid "Location of memory in the file being imported" -msgstr "正在导入的文件中的存储的位置" - -#: ../chirp/ui/importdialog.py:631 -msgid "Preparing memory list..." -msgstr "正在准备存储清单..." - -#: ../chirp/ui/importdialog.py:641 -msgid "Export To File" -msgstr "导出到文件" - -#: ../chirp/ui/memdetail.py:237 -msgid "General" -msgstr "通用" - -#: ../chirp/ui/memdetail.py:279 -msgid "Other" -msgstr "其他" - -#: ../chirp/ui/memdetail.py:336 ../chirp/ui/memedit.py:68 -#: ../chirp/ui/memedit.py:101 ../chirp/ui/memedit.py:116 -#: ../chirp/ui/memedit.py:231 ../chirp/ui/memedit.py:237 -#: ../chirp/ui/memedit.py:271 ../chirp/ui/memedit.py:423 -#: ../chirp/ui/memedit.py:1095 ../chirp/ui/memedit.py:1156 -#: ../chirp/ui/memedit.py:1307 ../chirp/ui/memedit.py:1367 -msgid "Tone Mode" -msgstr "亚音频制式" - -#: ../chirp/ui/memdetail.py:338 ../chirp/ui/memedit.py:69 -#: ../chirp/ui/memedit.py:90 ../chirp/ui/memedit.py:107 -#: ../chirp/ui/memedit.py:166 ../chirp/ui/memedit.py:167 -#: ../chirp/ui/memedit.py:256 ../chirp/ui/memedit.py:286 -#: ../chirp/ui/memedit.py:293 ../chirp/ui/memedit.py:298 -#: ../chirp/ui/memedit.py:306 ../chirp/ui/memedit.py:347 -#: ../chirp/ui/memedit.py:421 ../chirp/ui/memedit.py:1096 -#: ../chirp/ui/memedit.py:1152 ../chirp/ui/memedit.py:1308 -msgid "Tone" -msgstr "亚音频" - -#: ../chirp/ui/memdetail.py:340 ../chirp/ui/memedit.py:70 -#: ../chirp/ui/memedit.py:91 ../chirp/ui/memedit.py:108 -#: ../chirp/ui/memedit.py:260 ../chirp/ui/memedit.py:279 -#: ../chirp/ui/memedit.py:294 ../chirp/ui/memedit.py:299 -#: ../chirp/ui/memedit.py:310 ../chirp/ui/memedit.py:348 -#: ../chirp/ui/memedit.py:421 ../chirp/ui/memedit.py:1097 -#: ../chirp/ui/memedit.py:1153 ../chirp/ui/memedit.py:1304 -msgid "ToneSql" -msgstr "接收亚音频" - -#: ../chirp/ui/memdetail.py:342 ../chirp/ui/memedit.py:71 -#: ../chirp/ui/memedit.py:92 ../chirp/ui/memedit.py:109 -#: ../chirp/ui/memedit.py:244 ../chirp/ui/memedit.py:280 -#: ../chirp/ui/memedit.py:288 ../chirp/ui/memedit.py:300 -#: ../chirp/ui/memedit.py:308 ../chirp/ui/memedit.py:349 -#: ../chirp/ui/memedit.py:417 ../chirp/ui/memedit.py:1098 -#: ../chirp/ui/memedit.py:1154 ../chirp/ui/memedit.py:1296 -#: ../chirp/ui/memedit.py:1373 -msgid "DTCS Code" -msgstr "DTCS 代码" - -#: ../chirp/ui/memdetail.py:344 -msgid "RX DTCS Code" -msgstr "DTCS 接收代码" - -#: ../chirp/ui/memdetail.py:346 ../chirp/ui/memedit.py:73 -#: ../chirp/ui/memedit.py:94 ../chirp/ui/memedit.py:111 -#: ../chirp/ui/memedit.py:252 ../chirp/ui/memedit.py:282 -#: ../chirp/ui/memedit.py:290 ../chirp/ui/memedit.py:302 -#: ../chirp/ui/memedit.py:314 ../chirp/ui/memedit.py:351 -#: ../chirp/ui/memedit.py:1100 ../chirp/ui/memedit.py:1158 -#: ../chirp/ui/memedit.py:1298 ../chirp/ui/memedit.py:1372 -msgid "DTCS Pol" -msgstr "DTCS 策略" - -#: ../chirp/ui/memdetail.py:348 -msgid "Cross mode" -msgstr "收发使用不同亚音频" - -#: ../chirp/ui/memdetail.py:350 ../chirp/ui/memedit.py:75 -#: ../chirp/ui/memedit.py:96 ../chirp/ui/memedit.py:114 -#: ../chirp/ui/memedit.py:140 ../chirp/ui/memedit.py:147 -#: ../chirp/ui/memedit.py:272 ../chirp/ui/memedit.py:345 -#: ../chirp/ui/memedit.py:423 ../chirp/ui/memedit.py:1102 -#: ../chirp/ui/memedit.py:1159 ../chirp/ui/memedit.py:1309 -#: ../chirp/ui/memedit.py:1381 -msgid "Duplex" -msgstr "差频方向" - -#: ../chirp/ui/memdetail.py:352 ../chirp/ui/memedit.py:76 -#: ../chirp/ui/memedit.py:97 ../chirp/ui/memedit.py:145 -#: ../chirp/ui/memedit.py:218 ../chirp/ui/memedit.py:317 -#: ../chirp/ui/memedit.py:346 ../chirp/ui/memedit.py:419 -#: ../chirp/ui/memedit.py:1103 ../chirp/ui/memedit.py:1160 -#: ../chirp/ui/memedit.py:1300 -msgid "Offset" -msgstr "频差" - -#: ../chirp/ui/memdetail.py:354 ../chirp/ui/memedit.py:77 -#: ../chirp/ui/memedit.py:98 ../chirp/ui/memedit.py:112 -#: ../chirp/ui/memedit.py:159 ../chirp/ui/memedit.py:160 -#: ../chirp/ui/memedit.py:163 ../chirp/ui/memedit.py:407 -#: ../chirp/ui/memedit.py:1104 ../chirp/ui/memedit.py:1161 -#: ../chirp/ui/memedit.py:1299 ../chirp/ui/memedit.py:1366 -#: ../chirp/ui/memedit.py:1383 ../chirp/ui/memedit.py:1384 -#: ../chirp/ui/memedit.py:1564 ../chirp/ui/memedit.py:1582 -#: ../chirp/ui/memedit.py:1592 -msgid "Mode" -msgstr "制式" - -#: ../chirp/ui/memdetail.py:356 ../chirp/ui/memedit.py:79 -#: ../chirp/ui/memedit.py:100 ../chirp/ui/memedit.py:115 -#: ../chirp/ui/memedit.py:150 ../chirp/ui/memedit.py:151 -#: ../chirp/ui/memedit.py:156 ../chirp/ui/memedit.py:1106 -#: ../chirp/ui/memedit.py:1163 ../chirp/ui/memedit.py:1302 -#: ../chirp/ui/memedit.py:1379 -msgid "Tune Step" -msgstr "调谐间隔" - -#: ../chirp/ui/memdetail.py:358 ../chirp/ui/memedit.py:80 -#: ../chirp/ui/memedit.py:102 ../chirp/ui/memedit.py:1107 -#: ../chirp/ui/memedit.py:1164 ../chirp/ui/memedit.py:1310 -#: ../chirp/ui/memedit.py:1369 -msgid "Skip" -msgstr "跳过" - -#: ../chirp/ui/memdetail.py:360 ../chirp/ui/memedit.py:78 -#: ../chirp/ui/memedit.py:99 ../chirp/ui/memedit.py:113 -#: ../chirp/ui/memedit.py:407 ../chirp/ui/memedit.py:1105 -#: ../chirp/ui/memedit.py:1162 ../chirp/ui/memedit.py:1311 -#: ../chirp/ui/memedit.py:1370 ../chirp/ui/memedit.py:1377 -msgid "Power" -msgstr "功率" - -#: ../chirp/ui/memdetail.py:408 -msgid "Memory validation failed:" -msgstr "存储验证失败:" - -#: ../chirp/ui/memedit.py:52 -msgid "Invalid value for this field" -msgstr "此字段的值无效" - -#: ../chirp/ui/memedit.py:72 ../chirp/ui/memedit.py:93 -#: ../chirp/ui/memedit.py:110 ../chirp/ui/memedit.py:248 -#: ../chirp/ui/memedit.py:281 ../chirp/ui/memedit.py:289 -#: ../chirp/ui/memedit.py:296 ../chirp/ui/memedit.py:301 -#: ../chirp/ui/memedit.py:312 ../chirp/ui/memedit.py:350 -#: ../chirp/ui/memedit.py:417 ../chirp/ui/memedit.py:1099 -#: ../chirp/ui/memedit.py:1155 ../chirp/ui/memedit.py:1297 -#: ../chirp/ui/memedit.py:1374 -msgid "DTCS Rx Code" -msgstr "DTCS 接收代码" - -#: ../chirp/ui/memedit.py:74 ../chirp/ui/memedit.py:95 -#: ../chirp/ui/memedit.py:117 ../chirp/ui/memedit.py:232 -#: ../chirp/ui/memedit.py:242 ../chirp/ui/memedit.py:264 -#: ../chirp/ui/memedit.py:273 ../chirp/ui/memedit.py:283 -#: ../chirp/ui/memedit.py:291 ../chirp/ui/memedit.py:295 -#: ../chirp/ui/memedit.py:303 ../chirp/ui/memedit.py:352 -#: ../chirp/ui/memedit.py:1101 ../chirp/ui/memedit.py:1157 -#: ../chirp/ui/memedit.py:1305 ../chirp/ui/memedit.py:1368 -msgid "Cross Mode" -msgstr "收发使用不同亚音频" - -#: ../chirp/ui/memedit.py:198 -#, python-brace-format -msgid "Erasing memory {loc}" -msgstr "正在擦除存储 {loc}" - -#: ../chirp/ui/memedit.py:327 -msgid "Unable to make changes to this model" -msgstr "无法变更此型号电台" - -#: ../chirp/ui/memedit.py:390 -msgid "Error setting memory" -msgstr "设置存储时出错" - -#: ../chirp/ui/memedit.py:400 ../chirp/ui/memedit.py:466 -#: ../chirp/ui/memedit.py:742 ../chirp/ui/memedit.py:765 -#: ../chirp/ui/memedit.py:1541 -#, python-brace-format -msgid "Writing memory {number}" -msgstr "正在写入存储 {number}" - -#: ../chirp/ui/memedit.py:471 -msgid "" -"This operation requires moving all subsequent channels by one spot until an " -"empty location is reached. This can take a LONG time. Are you sure you " -"want to do this?" -msgstr "" -"此操作需要移动所有相邻的频道直至出现空位。可能需要非常非常长的时间。确认要这" -"样做吗?" - -#: ../chirp/ui/memedit.py:495 -#, python-brace-format -msgid "Adding memory {number}" -msgstr "正在添加存储 {number}" - -#: ../chirp/ui/memedit.py:508 ../chirp/ui/memedit.py:1137 -#, python-brace-format -msgid "Erasing memory {number}" -msgstr "正在擦除存储 {number}" - -#: ../chirp/ui/memedit.py:517 ../chirp/ui/memedit.py:625 -#: ../chirp/ui/memedit.py:672 ../chirp/ui/memedit.py:677 -#: ../chirp/ui/memedit.py:1066 ../chirp/ui/memedit.py:1399 -#, python-brace-format -msgid "Getting memory {number}" -msgstr "正在获取存储 {number}" - -#: ../chirp/ui/memedit.py:604 ../chirp/ui/memedit.py:615 -#: ../chirp/ui/memedit.py:664 -#, python-brace-format -msgid "Moving memory from {old} to {new}" -msgstr "正在将存储从 {old} 移动到 {new}" - -#: ../chirp/ui/memedit.py:686 -#, python-brace-format -msgid "Raw memory {number}" -msgstr "原始存储 {number}" - -#: ../chirp/ui/memedit.py:690 ../chirp/ui/memedit.py:718 -#: ../chirp/ui/memedit.py:723 -#, python-brace-format -msgid "Getting raw memory {number}" -msgstr "正在获取存储 {number}" - -#: ../chirp/ui/memedit.py:695 -msgid "You can only diff two memories!" -msgstr "您只能将两个存储进行对比!" - -#: ../chirp/ui/memedit.py:706 -#, python-brace-format -msgid "Memory {number}" -msgstr "存储 {number}" - -#: ../chirp/ui/memedit.py:712 -#, python-brace-format -msgid "Diff of {a} and {b}" -msgstr "{a} 与 {b} 的对比" - -#: ../chirp/ui/memedit.py:746 -#, python-brace-format -msgid "Getting original memory {number}" -msgstr "正在获取原始存储 {number}" - -#: ../chirp/ui/memedit.py:784 -msgid "Memories must be contiguous" -msgstr "存储必须是连续的" - -#: ../chirp/ui/memedit.py:875 -msgid "Cut" -msgstr "剪切" - -#: ../chirp/ui/memedit.py:876 -msgid "Copy" -msgstr "复制" - -#: ../chirp/ui/memedit.py:877 -msgid "Paste" -msgstr "粘贴" - -#: ../chirp/ui/memedit.py:878 -msgid "Select All" -msgstr "全选" - -#: ../chirp/ui/memedit.py:879 -msgid "Insert row above" -msgstr "上方插入一行" - -#: ../chirp/ui/memedit.py:880 -msgid "Insert row below" -msgstr "下方插入一行" - -#: ../chirp/ui/memedit.py:881 -msgid "Delete" -msgstr "删除" - -#: ../chirp/ui/memedit.py:882 -msgid "this memory" -msgstr "该存储" - -#: ../chirp/ui/memedit.py:882 -msgid "these memories" -msgstr "这些存储" - -#: ../chirp/ui/memedit.py:883 -msgid "...and shift block up" -msgstr "...并将区块上移" - -#: ../chirp/ui/memedit.py:884 -msgid "...and shift all memories up" -msgstr "...并将所有存储上移" - -#: ../chirp/ui/memedit.py:885 -msgid "Move up" -msgstr "上移" - -#: ../chirp/ui/memedit.py:886 -msgid "Move down" -msgstr "下移" - -#: ../chirp/ui/memedit.py:887 -msgid "Exchange memories" -msgstr "交换存储" - -#: ../chirp/ui/memedit.py:1053 -#, python-brace-format -msgid "Internal Error: Column {name} not found" -msgstr "内部错误:找不到名为 {name} 的列" - -#: ../chirp/ui/memedit.py:1177 -#, python-brace-format -msgid "Internal Error: Invalid limit {number}" -msgstr "内部错误:无效的限制数值 {number}" - -#: ../chirp/ui/memedit.py:1188 -msgid "Memory Range:" -msgstr "存储范围:" - -#: ../chirp/ui/memedit.py:1215 -msgid "Refresh" -msgstr "刷新" - -#: ../chirp/ui/memedit.py:1238 -msgid "Special Channels" -msgstr "特殊频道" - -#: ../chirp/ui/memedit.py:1246 -msgid "Show Empty" -msgstr "显示空项" - -#: ../chirp/ui/memedit.py:1258 -msgid "Properties" -msgstr "属性" - -#: ../chirp/ui/memedit.py:1433 -#, python-brace-format -msgid "Cutting memory {number}" -msgstr "正在剪切存储 {number}" - -#: ../chirp/ui/memedit.py:1465 -#, python-brace-format -msgid "" -"Unable to paste {src} memories into {dst} rows. Increase the memory bounds " -"or show empty memories." -msgstr "无法将 {src} 个存储粘贴到 {dst} 行中。请增加存储上线或显示空存储。" - -#: ../chirp/ui/memedit.py:1481 -msgid "Yes to All" -msgstr "全是" - -#: ../chirp/ui/memedit.py:1483 -msgid "Overwrite?" -msgstr "要覆盖吗?" - -#: ../chirp/ui/memedit.py:1492 -#, python-brace-format -msgid "Overwrite location {number}?" -msgstr "要覆盖位置 {number} 吗?" - -#: ../chirp/ui/memedit.py:1519 -msgid "Incompatible Memory" -msgstr "存储不兼容" - -#: ../chirp/ui/memedit.py:1525 -#, python-brace-format -msgid "Pasted memory {number} is not compatible with this radio because:" -msgstr "粘贴的存储 {number} 与此电台不兼容,原因:" - -#: ../chirp/ui/memedit.py:1584 ../chirp/ui/memedit.py:1599 -msgid "URCALL" -msgstr "URCALL" - -#: ../chirp/ui/memedit.py:1584 ../chirp/ui/memedit.py:1600 -msgid "RPT1CALL" -msgstr "RPT1CALL" - -#: ../chirp/ui/memedit.py:1584 ../chirp/ui/memedit.py:1601 -msgid "RPT2CALL" -msgstr "RPT2CALL" - -#: ../chirp/ui/memedit.py:1585 ../chirp/ui/memedit.py:1602 -#, fuzzy -msgid "Digital Code" -msgstr "数字代码" - -#: ../chirp/ui/memedit.py:1640 ../chirp/ui/dstaredit.py:175 -msgid "Downloading URCALL list" -msgstr "正在下载 URCALL 列表" - -#: ../chirp/ui/memedit.py:1652 ../chirp/ui/dstaredit.py:179 -msgid "Downloading RPTCALL list" -msgstr "正在下载 RPTCALL 列表" - -#: ../chirp/ui/settingsedit.py:82 -#, python-format -msgid "Error in setting value: %s" -msgstr "设置值有误:%s" - -#: ../chirp/ui/settingsedit.py:114 -#, python-format -msgid "Invalid setting value: %s" -msgstr "设置值无效:%s" - -#: ../chirp/ui/settingsedit.py:175 -msgid "Enabled" -msgstr "已启用" - -#: ../chirp/ui/clone.py:40 -#, python-brace-format -msgid "{vendor} {model} on {port}" -msgstr "{port} 上的 {vendor} {model}" - -#: ../chirp/ui/clone.py:111 ../chirp/ui/clone.py:112 ../chirp/ui/clone.py:172 -msgid "Detect" -msgstr "探测" - -#: ../chirp/ui/clone.py:135 -msgid "Port" -msgstr "端口" - -#: ../chirp/ui/clone.py:136 -msgid "Vendor" -msgstr "厂商" - -#: ../chirp/ui/clone.py:137 -msgid "Model" -msgstr "型号" - -#: ../chirp/ui/clone.py:150 -msgid "Radio" -msgstr "电台" - -#: ../chirp/ui/clone.py:177 -#, python-brace-format -msgid "Unable to detect radio on {port}" -msgstr "无法在 {port} 上检测到电台" - -#: ../chirp/ui/clone.py:209 -#, python-brace-format -msgid "Internal error: Unable to upload to {model}" -msgstr "内部错误:无法上传至 {model}" - -#: ../chirp/ui/dstaredit.py:44 -msgid "Callsign" -msgstr "呼号" - -#: ../chirp/ui/dstaredit.py:129 -msgid "Your callsign" -msgstr "您的呼号" - -#: ../chirp/ui/dstaredit.py:137 -msgid "Repeater callsign" -msgstr "中继台的呼号" - -#: ../chirp/ui/dstaredit.py:145 -msgid "My callsign" -msgstr "我的呼号" - -#: ../chirp/ui/dstaredit.py:183 -msgid "Downloading MYCALL list" -msgstr "正在下载 MYCALL 列表" - -#: ../chirp/ui/inputdialog.py:94 -msgid "An error has occurred" -msgstr "发生错误" - -#: ../chirp/ui/inputdialog.py:154 -msgid "File Exists" -msgstr "文件已存在" - -#: ../chirp/ui/inputdialog.py:157 -#, python-brace-format -msgid "The file {name} already exists. Do you want to overwrite it?" -msgstr "文件 {name} 已存在。要覆盖吗?" - -#: ../chirp/ui/shiftdialog.py:31 -msgid "Shift" -msgstr "移动" - -#: ../chirp/ui/shiftdialog.py:65 -#, python-brace-format -msgid "Moving {src} to {dst}" -msgstr "正在移动 {src} 到 {dst}" - -#: ../chirp/ui/shiftdialog.py:85 -#, python-brace-format -msgid "Looking for a free spot ({number})" -msgstr "寻找空间中({number})" - -#: ../chirp/ui/shiftdialog.py:98 -msgid "No space to insert a row" -msgstr "无剩余空间" - -#: ../chirp/ui/shiftdialog.py:146 -#, python-brace-format -msgid "Moved {count} memories" -msgstr "已移动 {count} 条存储" diff --git a/pylintrc b/pylintrc deleted file mode 100644 index b622882..0000000 --- a/pylintrc +++ /dev/null @@ -1,249 +0,0 @@ -[MASTER] - -# Specify a configuration file. -#rcfile= - -# Python code to execute, usually for sys.path manipulation such as -# pygtk.require(). -#init-hook= - -# Profiled execution. -profile=no - -# Add files or directories to the blacklist. They should be base names, not -# paths. -ignore=CVS - -# Pickle collected data for later comparisons. -persistent=yes - -# List of plugins (as comma separated values of python modules names) to load, -# usually to register additional checkers. -load-plugins= - - -[MESSAGES CONTROL] - -# Enable the message, report, category or checker with the given id(s). You can -# either give multiple identifier separated by comma (,) or put this option -# multiple time. -#enable= - -# Disable the message, report, category or checker with the given id(s). You -# can either give multiple identifier separated by comma (,) or put this option -# multiple time (only on the command line, not in the configuration file where -# it should appear only once). -#disable= - - -[REPORTS] - -# Set the output format. Available formats are text, parseable, colorized, msvs -# (visual studio) and html -output-format=text - -# Include message's id in output -include-ids=no - -# Put messages in a separate file for each module / package specified on the -# command line instead of printing them on stdout. Reports (if any) will be -# written in a file name "pylint_global.[txt|html]". -files-output=no - -# Tells whether to display a full report or only the messages -reports=yes - -# Python expression which should return a note less than 10 (10 is the highest -# note). You have access to the variables errors warning, statement which -# respectively contain the number of errors / warnings messages and the total -# number of statements analyzed. This is used by the global evaluation report -# (RP0004). -evaluation=10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10) - -# Add a comment according to your evaluation note. This is used by the global -# evaluation report (RP0004). -comment=no - - -[SIMILARITIES] - -# Minimum lines number of a similarity. -min-similarity-lines=4 - -# Ignore comments when computing similarities. -ignore-comments=yes - -# Ignore docstrings when computing similarities. -ignore-docstrings=yes - - -[FORMAT] - -# Maximum number of characters on a single line. -max-line-length=80 - -# Maximum number of lines in a module -max-module-lines=1000 - -# String used as indentation unit. This is usually " " (4 spaces) or "\t" (1 -# tab). -indent-string=' ' - - -[MISCELLANEOUS] - -# List of note tags to take in consideration, separated by a comma. -notes=FIXME,XXX,TODO - - -[TYPECHECK] - -# Tells whether missing members accessed in mixin class should be ignored. A -# mixin class is detected if its name ends with "mixin" (case insensitive). -ignore-mixin-members=yes - -# List of classes names for which member attributes should not be checked -# (useful for classes with attributes dynamically set). -ignored-classes=SQLObject - -# When zope mode is activated, add a predefined set of Zope acquired attributes -# to generated-members. -zope=no - -# List of members which are set dynamically and missed by pylint inference -# system, and so shouldn't trigger E0201 when accessed. Python regular -# expressions are accepted. -generated-members=REQUEST,acl_users,aq_parent - - -[VARIABLES] - -# Tells whether we should check for unused import in __init__ files. -init-import=no - -# A regular expression matching the beginning of the name of dummy variables -# (i.e. not used). -dummy-variables-rgx=_|dummy|foo - -# List of additional names supposed to be defined in builtins. Remember that -# you should avoid to define new builtins when possible. -additional-builtins= - - -[BASIC] - -# Required attributes for module, separated by a comma -required-attributes= - -# List of builtins function names that should not be used, separated by a comma -bad-functions=map,filter,apply,input - -# Regular expression which should only match correct module names -module-rgx=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$ - -# Regular expression which should only match correct module level names -const-rgx=(([A-Z_][A-Z0-9_]*)|(__.*__))$ - -# Regular expression which should only match correct class names -class-rgx=[A-Z_][a-zA-Z0-9]+$ - -# Regular expression which should only match correct function names -function-rgx=[a-z_][a-z0-9_]{1,30}$ - -# Regular expression which should only match correct method names -method-rgx=[a-z_][a-z0-9_]{2,30}$ - -# Regular expression which should only match correct instance attribute names -attr-rgx=[a-z_][a-z0-9_]{2,30}$ - -# Regular expression which should only match correct argument names -argument-rgx=[a-z_][a-z0-9_]{1,30}$ - -# Regular expression which should only match correct variable names -variable-rgx=[a-z_][a-z0-9_]{1,30}$ - -# Regular expression which should only match correct list comprehension / -# generator expression variable names -inlinevar-rgx=[A-Za-z_][A-Za-z0-9_]*$ - -# Good variable names which should always be accepted, separated by a comma -good-names=i,j,k,v,f,e,ex,Run,_ - -# Bad variable names which should always be refused, separated by a comma -bad-names=bar,baz,toto,tutu,tata - -# Regular expression which should only match functions or classes name which do -# not require a docstring -no-docstring-rgx=__.*__|_.* - - -[DESIGN] - -# Maximum number of arguments for function / method -max-args=5 - -# Argument names that match this expression will be ignored. Default to name -# with leading underscore -ignored-argument-names=_.* - -# Maximum number of locals for function / method body -max-locals=15 - -# Maximum number of return / yield for function / method body -max-returns=6 - -# Maximum number of branch for function / method body -max-branchs=20 - -# Maximum number of statements in function / method body -max-statements=50 - -# Maximum number of parents for a class (see R0901). -max-parents=7 - -# Maximum number of attributes for a class (see R0902). -max-attributes=25 - -# Minimum number of public methods for a class (see R0903). -min-public-methods=0 - -# Maximum number of public methods for a class (see R0904). -max-public-methods=40 - - -[CLASSES] - -# List of interface methods to ignore, separated by a comma. This is used for -# instance to not check methods defines in Zope's Interface base class. -ignore-iface-methods=isImplementedBy,deferred,extends,names,namesAndDescriptions,queryDescriptionFor,getBases,getDescriptionFor,getDoc,getName,getTaggedValue,getTaggedValueTags,isEqualOrExtendedBy,setTaggedValue,isImplementedByInstancesOf,adaptWith,is_implemented_by - -# List of method names used to declare (i.e. assign) instance attributes. -defining-attr-methods=__init__,__new__,setUp - -# List of valid names for the first argument in a class method. -valid-classmethod-first-arg=cls - - -[IMPORTS] - -# Deprecated modules which should not be used, separated by a comma -deprecated-modules=regsub,string,TERMIOS,Bastion,rexec - -# Create a graph of every (i.e. internal and external) dependencies in the -# given file (report RP0402 must not be disabled) -import-graph= - -# Create a graph of external dependencies in the given file (report RP0402 must -# not be disabled) -ext-import-graph= - -# Create a graph of internal dependencies in the given file (report RP0402 must -# not be disabled) -int-import-graph= - - -[EXCEPTIONS] - -# Exceptions that will emit a warning when being caught. Defaults to -# "Exception" -overgeneral-exceptions=Exception diff --git a/requirements.txt b/requirements.txt index 514c19c..3578402 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,10 @@ six -wxPython>=4.0,<4.2.0 # See https://github.com/wxWidgets/Phoenix/issues/2225 +wxPython>=4.0,<4.2.0 ; platform_system=="Linux" # See https://github.com/wxWidgets/Phoenix/issues/2225 +wxPython==4.2.0 ; platform_system!="Linux" pyserial future requests +pywin32; platform_system=="Windows" +suds +importlib-resources;python_version<"3.10" +yattag diff --git a/rpttool b/rpttool deleted file mode 100755 index 60cc4c8..0000000 --- a/rpttool +++ /dev/null @@ -1,148 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2009 Dan Smith -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -import os -import sys -import serial -import commands - -from chirp import idrp, chirp_common - - -def open_device(): - try: - s = serial.Serial(port="/dev/icom", - baudrate=idrp.IDRPx000V.BAUD_RATE, - timeout=0.1) - except Exception, e: - print "Unable to open serial port %s: %s" % ("/dev/icom", e) - return None - - rp = idrp.IDRPx000V(s) - - return rp - - -def read_freq(): - rp = open_device() - if not rp: - return 0 - - try: - mem = rp.get_memory(0) - except Exception, e: - print "Unable to read memory from device: %s" % e - return 0 - - rp.pipe.close() - - return mem.freq - - -def _set_freq(rp): - try: - mem = rp.get_memory(0) - except Exception, e: - print "Unable to read memory from device: %s" % e - return False - - print "\nNew frequency [%s]: " % chirp_common.format_freq(mem.freq), - input = sys.stdin.readline().strip() - - if not input: - print "Frequency unchanged" - return False - - try: - mem.freq = chirp_common.parse_freq(input) - except Exception: - print "Invalid entry `%s'" % input - return False - - try: - rp.set_memory(mem) - except Exception, e: - print "Failed to set frequency to %s: %s" % \ - (chirp_common.format_freq(mem.freq), e) - return False - - print "Successfully set frequency to %s" % \ - chirp_common.format_freq(mem.freq) - return True - - -def set_freq(): - rp = open_device() - if not rp: - return - - try: - res = _set_freq(rp) - except Exception, e: - print "Unknown error while setting frequency: %s" % e - res = False - - rp.pipe.close() - return res - - -def main_menu(): - print "Looking for a repeater...", - sys.stdout.flush() - freq = read_freq() - if not freq: - return 1 - print "\r \r", - - cmd = "" - while cmd != "3": - print """ -KK7DS ID-RP* Frequency Tool -Current Setting: %s --------------------------------- -1. Set repeater frequency -2. Re-read current frequency -3. Quit --------------------------------- -> """ % chirp_common.format_freq(freq), - - cmd = sys.stdin.readline().strip() - - if cmd == "1": - if set_freq(): - freq = read_freq() - elif cmd == "2": - freq = read_freq() - elif cmd != "3": - print "Invalid entry" - - return 0 - - -if __name__ == "__main__": - if os.path.exists("tools/icomsio.sh"): - path = "tools/icomsio.sh" - else: - path = "icomsio.sh" - r = os.system(path) - if r: - sys.exit(r) - - if not os.geteuid() == 0: - print "Sorry, this must be run as root" - sys.exit(1) - sys.exit(main_menu()) diff --git a/run_all_tests.bat b/run_all_tests.bat deleted file mode 100644 index 399ed54..0000000 --- a/run_all_tests.bat +++ /dev/null @@ -1,3 +0,0 @@ -@echo off -python tests\run_tests.py -python tools\cpep8.py diff --git a/setup.cfg b/setup.cfg index ba216f1..1591ecf 100644 --- a/setup.cfg +++ b/setup.cfg @@ -3,3 +3,8 @@ requires = pyserial packager = Dan Smith description = A frequency tool for Icom D-STAR Repeaters vendor = KK7DS + +[egg_info] +tag_build = +tag_date = 0 + diff --git a/setup.py b/setup.py index e403d91..8aa99b5 100644 --- a/setup.py +++ b/setup.py @@ -1,163 +1,26 @@ -from __future__ import print_function - -import sys -import glob -import os - -from chirp import CHIRP_VERSION -import chirp -from chirp import directory - -directory.safe_import_drivers() - - -def staticify_chirp_module(): - import chirp - - with open("chirp/__init__.py", "w") as init: - print("CHIRP_VERSION = \"%s\"" % CHIRP_VERSION, file=init) - print("__all__ = %s\n" % str(chirp.__all__), file=init) - - print("Set chirp/__init__.py::__all__ = %s" % str(chirp.__all__)) - - -def staticify_drivers_module(): - import chirp.drivers - - with file("chirp/drivers/__init__.py", "w") as init: - print("__all__ = %s\n" % str(chirp.drivers.__all__), file=init) - - print("Set chirp/drivers/__init__.py::__all__ = %s" % str( - chirp.drivers.__all__)) - - -def win32_build(): - from distutils.core import setup - import py2exe - - try: - # if this doesn't work, try import modulefinder - import py2exe.mf as modulefinder - import win32com - for p in win32com.__path__[1:]: - modulefinder.AddPackagePath("win32com", p) - for extra in ["win32com.shell"]: # ,"win32com.mapi" - __import__(extra) - m = sys.modules[extra] - for p in m.__path__[1:]: - modulefinder.AddPackagePath(extra, p) - except ImportError: - # no build path setup, no worries. - pass - - staticify_chirp_module() - staticify_drivers_module() - - opts = { - "py2exe": { - "includes": "pango,atk,gobject,cairo,pangocairo," + - "win32gui,win32com,win32com.shell," + - "email.iterators,email.generator,gio", - - "compressed": 1, - "optimize": 2, - "bundle_files": 3, - # "packages": "" - } - } - - mods = [] - for mod in chirp.__all__: - mods.append("chirp.%s" % mod) - for mod in chirp.drivers.__all__: - mods.append("chirp.drivers.%s" % mod) - opts["py2exe"]["includes"] += ("," + ",".join(mods)) - - setup( - zipfile=None, - windows=[{'script': "chirpw", - 'icon_resources': [(0x0004, 'share/chirp.ico')], - }], - options=opts) - - -def macos_build(): - from setuptools import setup - import shutil - - APP = ['chirp-%s.py' % CHIRP_VERSION] - shutil.copy("chirpw", APP[0]) - DATA_FILES = [('../Frameworks', ['/opt/local/lib/libpangox-1.0.dylib']), - ('../Resources/', ['/opt/local/lib/pango']), - ] - OPTIONS = {'argv_emulation': True, "includes": "gtk,atk,pangocairo,cairo"} - - setup( - app=APP, - data_files=DATA_FILES, - options={'py2app': OPTIONS}, - setup_requires=['py2app'], - ) - - EXEC = 'bash ./build/macos/make_pango.sh ' + \ - '/opt/local dist/chirp-%s.app' % CHIRP_VERSION - # print "exec string: %s" % EXEC - os.system(EXEC) - - -def default_build(): - from distutils.core import setup - from glob import glob - - os.system("make -C locale clean all") - - desktop_files = glob("share/*.desktop") - # form_files = glob("forms/*.x?l") - image_files = glob("images/*") - _locale_files = glob("locale/*/LC_MESSAGES/CHIRP.mo") - stock_configs = glob("stock_configs/*") - - locale_files = [] - for f in _locale_files: - locale_files.append(("share/chirp/%s" % os.path.dirname(f), [f])) - - print("LOC: %s" % str(locale_files)) - - xsd_files = glob("chirp*.xsd") - - setup( - name="chirp", - packages=["chirp", "chirp.drivers", "chirp.ui", "tests", "tests.unit", - "chirp.wxui"], - version=CHIRP_VERSION, - scripts=["chirpw", "rpttool", "chirpwx.py"], - data_files=[('share/applications', desktop_files), - ('share/chirp/images', image_files), - ('share/chirp', xsd_files), - ('share/doc/chirp', ['COPYING']), - ('share/pixmaps', ['share/chirp.png']), - ('share/man/man1', ["share/chirpw.1"]), - ('share/chirp/stock_configs', stock_configs), - ] + locale_files) - - -def nuke_manifest(*files): - for i in ["MANIFEST", "MANIFEST.in"]: - if os.path.exists(i): - os.remove(i) - - if not files: - return - - f = file("MANIFEST.in", "w") - for fn in files: - print(fn, file=f) - f.close() - - -if sys.platform == "darwin": - macos_build() -elif sys.platform == "win32": - win32_build() -else: - default_build() +from distutils.core import setup +from setuptools import find_packages + +setup(name='chirp', + description='A cross-platform cross-radio programming tool', + packages=find_packages(include=["chirp*"]), + include_package_data=True, + version='20231016', + url='https://chirp.danplanet.com', + python_requires=">=3.7,<4", + install_requires=[ + 'pyserial', + 'requests', + 'six', + 'future', + 'importlib-resources;python_version<"3.10"', + 'yattag', + ], + extras_require={ + 'wx': ['wxPython'], + }, + entry_points={ + 'console_scripts': ["chirp=chirp.wxui:chirpmain", + "chirpc=chirp.cli.main:main"], + }, + ) diff --git a/share/chirp.desktop b/share/chirp.desktop deleted file mode 100644 index 966e2a0..0000000 --- a/share/chirp.desktop +++ /dev/null @@ -1,13 +0,0 @@ -[Desktop Entry] -Type=Application -Version=1.0 -Name=CHIRP -GenericName=Radio Programming Tool -Comment=Program amateur radios -Icon=chirp -Exec=chirpw %F -Terminal=false -MimeType=inode/directory -Categories=Utility;HamRadio -Keywords=Hamradio;Programming;Handheld;Radio;Amateur;Programmer -StartupNotify=true diff --git a/share/chirp.icns b/share/chirp.icns deleted file mode 100644 index 2ac96be..0000000 Binary files a/share/chirp.icns and /dev/null differ diff --git a/share/chirp.ico b/share/chirp.ico deleted file mode 100755 index 4006ff9..0000000 Binary files a/share/chirp.ico and /dev/null differ diff --git a/share/chirp.png b/share/chirp.png deleted file mode 100644 index fe57c1a..0000000 Binary files a/share/chirp.png and /dev/null differ diff --git a/share/chirp.svg b/share/chirp.svg deleted file mode 100644 index 38d0d05..0000000 --- a/share/chirp.svg +++ /dev/null @@ -1,224 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - c h i r p - - - - - - - - diff --git a/share/chirpw.1 b/share/chirpw.1 deleted file mode 100644 index ba9b9e8..0000000 --- a/share/chirpw.1 +++ /dev/null @@ -1,46 +0,0 @@ -.\" Hey, EMACS: -*- nroff -*- -.\" First parameter, NAME, should be all caps -.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection -.\" other parameters are allowed: see man(7), man(1) -.TH CHIRP 1 "February 12, 2011" -.\" Please adjust this date whenever revising the manpage. -.\" -.\" Some roff macros, for reference: -.\" .nh disable hyphenation -.\" .hy enable hyphenation -.\" .ad l left justify -.\" .ad b justify to both left and right margins -.\" .nf disable filling -.\" .fi enable filling -.\" .br insert line break -.\" .sp insert n+1 empty lines -.\" for manpage-specific macros, see man(7) -.SH NAME -chirpw \- A tool for programming two-way radio equipment -.SH SYNOPSIS -.B chirpw -.RI [ options ] -.br -.SH DESCRIPTION -This manual page documents briefly the -.B chirpw -command. -.PP -\fBchirpw\fP is a tool for programming two-way radio equipment -It provides a generic user interface to the programming data and -process that can drive many radio models under the hood. -.SH OPTIONS -This program follows the usual GNU command line syntax, with long -options starting with two dashes (`--'). -A summary of options is included below. -.TP -.B \-\-help -Show summary of options. -.TP -.B \-\-profile -Enable Profiling. -.SH AUTHOR -chirpw was written by Dan Smith. -.PP -This manual page was written by Dan Smith (with help from Steve Conklin), -for the Debian project (and may be used by others). diff --git a/share/contrib/chirp.rnc b/share/contrib/chirp.rnc deleted file mode 100644 index 6ea2715..0000000 --- a/share/contrib/chirp.rnc +++ /dev/null @@ -1,28 +0,0 @@ -# -# CHIRP XML Schema -# Copyright 2008 Dan Smith -# - -include "chirp_memory.rnc" -include "chirp_banks.rnc" - -start = radio - -radio = element radio { - attribute version { chirpSchemaVersionType }?, - comment?, - memories, - banks -} - -comment = element comment { xsd:string }? - -memories = element memories { - element memory { memoryType }* -} - -banks = element banks { - element bank { bankType }* -} - -chirpSchemaVersionType = xsd:string { pattern = "[0-9][0-9]*.[0-9][0-9]*.[0-9]{1,4}" } diff --git a/share/contrib/chirp.rng b/share/contrib/chirp.rng deleted file mode 100644 index d6020e5..0000000 --- a/share/contrib/chirp.rng +++ /dev/null @@ -1,58 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - [0-9][0-9]*.[0-9][0-9]*.[0-9]{1,4} - - - diff --git a/share/contrib/chirp_banks.rnc b/share/contrib/chirp_banks.rnc deleted file mode 100644 index d832539..0000000 --- a/share/contrib/chirp_banks.rnc +++ /dev/null @@ -1,3 +0,0 @@ -bankType = - attribute id { xsd:nonNegativeInteger }, - attribute label { xsd:string } diff --git a/share/contrib/chirp_banks.rng b/share/contrib/chirp_banks.rng deleted file mode 100644 index fa25081..0000000 --- a/share/contrib/chirp_banks.rng +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - diff --git a/share/contrib/chirp_memory.rnc b/share/contrib/chirp_memory.rnc deleted file mode 100644 index ad7ee2e..0000000 --- a/share/contrib/chirp_memory.rnc +++ /dev/null @@ -1,64 +0,0 @@ -memoryType = - attribute location { xsd:nonNegativeInteger }?, - shortName, - longName?, - frequency, - SquelchList, - squelchSetting?, - duplex, - offset, - mode, - tuningStep, - skip?, - bank?, - dv? - -shortName = element shortName { xsd:string { pattern = "[A-Z0-9/ >\-]{0,6}" } } - -frequencyType = - attribute units { "Hz" | "kHz" | "MHz" | "GHz" }, - xsd:decimal - -longName = element longName { xsd:string { pattern = "[.A-Za-z0-9/ >\-]{0,16}" } } - -frequency = element frequency { frequencyType } - -SquelchList = - element squelch { squelchType }?, - element squelch { squelchType }?, - element squelch { squelchType }? - -squelchType = - element tone { xsd:decimal { minInclusive = "67.0" maxInclusive = "254.1" } }?, # could also use enumeration - element code { xsd:positiveInteger }?, - element polarity { xsd:string { pattern = "[RN]{2}" } }?, - attribute id { text }?, - attribute type { text }? - -offset = element offset { frequencyType } - -tuningStep = element tuningStep { frequencyType } - -squelchSetting = element squelchSetting { xsd:string } - -duplex = element duplex { "positive" | "negative" | "none" } - -mode = element mode { "FM" | "NFM" | "WFM" | "AM" | "NAM" | "DV" } - -dv = element dv { - element urcall { callsignType }, - element rpt1call { callsignType }, - element rpt2call { callsignType }, - element digitalCode { digitalCodeType }? -} - -callsignType = xsd:string { pattern = "[A-Z0-9/ ]*" } - -digitalCodeType = xsd:integer { minInclusive = "0" } - -skip = element skip { "S" | "P" | "" } - -bank = element bank { - attribute bankId { xsd:nonNegativeInteger }, - attribute bankIndex { xsd:nonNegativeInteger }? -} diff --git a/share/contrib/chirp_memory.rng b/share/contrib/chirp_memory.rng deleted file mode 100644 index 0d88eac..0000000 --- a/share/contrib/chirp_memory.rng +++ /dev/null @@ -1,193 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - [A-Z0-9/ >\-]{0,6} - - - - - - - Hz - kHz - MHz - GHz - - - - - - - - [.A-Za-z0-9/ >\-]{0,16} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 67.0 - 254.1 - - - - - - - - - - - - - [RN]{2} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - positive - negative - none - - - - - - - FM - NFM - WFM - AM - NAM - DV - - - - - - - - - - - - - - - - - - - - - - - - [A-Z0-9/ ]* - - - - - 0 - - - - - - S - P - - - - - - - - - - - - - - - - - diff --git a/share/make_supported.py b/share/make_supported.py deleted file mode 100755 index 339f9fe..0000000 --- a/share/make_supported.py +++ /dev/null @@ -1,179 +0,0 @@ -#!/usr/bin/env python - -import sys -import serial - -sys.path.insert(0, ".") -sys.path.insert(0, "..") - -tmp = sys.stdout -sys.stdout = sys.stderr -from chirp import * -sys.stdout = tmp - -directory.safe_import_drivers() - -RF = chirp_common.RadioFeatures() -KEYS = [x for x in sorted(RF.__dict__.keys()) - if "_" in x and not x.startswith("_")] - -RADIO_TYPES = { - 'Clone': chirp_common.CloneModeRadio, - 'File': chirp_common.FileBackedRadio, - 'Live': chirp_common.LiveRadio, -} - - -counter = 0 - -def radio_type(radio): - for k, v in RADIO_TYPES.items(): - if isinstance(radio, v): - return k - return "" - - -def supported_row(radio): - global counter - counter += 1 - odd = counter % 2 - - row = '' % (odd and "odd" or "even", - radio.VENDOR, - radio.MODEL, - radio.VARIANT) - row += "%s %s %s\n" % ( - 'row%04i' % counter, - 'row%04i' % counter, - radio.VENDOR, radio.MODEL, radio.VARIANT) - rf = radio.get_features() - for key in KEYS: - value = rf.__dict__[key] - if key == "valid_bands": - value = ["%s-%s MHz" % (chirp_common.format_freq(x), - chirp_common.format_freq(y)) - for x, y in value] - - if key in ["valid_bands", "valid_modes", "valid_power_levels", - "valid_tuning_steps"]: - try: - value = ", ".join([str(x) for x in value - if not str(x).startswith("?")]) - except Exception as e: - raise - - if key == "memory_bounds": - value = "%i-%i" % value - - if key == "requires_call_lists": - if "DV" not in rf.valid_modes: - value = None - elif value: - value = "Required" - else: - value = "Optional" - - if value is None: - row += 'N/A' % key - elif isinstance(value, bool): - row += '%s' % \ - (key, - value, - value and "Yes" or "No") - else: - row += '%s' % (key, value) - row += '%s' % radio_type(radio) - row += "\n" - return row - - -def header_row(): - row = "" - row += "Radio\n" - for key in KEYS: - Key = key.split("_", 1)[1].title().replace("_", " ") - row += '%s' % (RF.get_doc(key), Key) - row += 'Type\n' - row += "\n" - return row - - -dest = sys.stdout -if len(sys.argv) > 1: - dest = open(sys.argv[1], 'w') - - -def output(string): - dest.write(string + '\n') - - -output(""" - - -""") - -models = {"Icom": [], - "Kenwood": [], - "Yaesu": [], - "Alinco": [], - "Baofeng": [], - "z_Other": [], - } - -models = [] - -exclude = [] - -for radio in directory.DRV_TO_RADIO.values(): - if radio in exclude: - continue - - models.append(radio) - for alias in radio.ALIASES: - class DynamicRadioAlias(radio): - VENDOR = alias.VENDOR - MODEL = alias.MODEL - VARIANT = alias.VARIANT - models.append(DynamicRadioAlias) - - -def get_key(rc): - return '%s %s %s' % (rc.VENDOR, rc.MODEL, rc.VARIANT) - -for radio in sorted(models, key=get_key): - if counter % 10 == 0: - output(header_row()) - _radio = radio(None) - if _radio.get_features().has_sub_devices: - for __radio in _radio.get_sub_devices(): - output(supported_row(__radio)) - else: - output(supported_row(_radio)) diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml deleted file mode 100644 index 4ff8d0e..0000000 --- a/snap/snapcraft.yaml +++ /dev/null @@ -1,118 +0,0 @@ -name: chirp-snap -summary: A free, open-source tool for programming your amateur radio -description: | - CHIRP is a free, open-source tool for programming your amateur radio. - It supports a large number of manufacturers and models, as well as - provides a way to interface with multiple data sources and formats. -adopt-info: chirp -grade: stable -confinement: strict -base: core18 - -# This is a python2 GTK2 Application: -# https://snapcraft.io/docs/gtk2-applications - -plugs: - gtk-2-engines: - interface: content - target: $SNAP/lib/gtk-2.0 - default-provider: gtk2-common-themes - gtk-2-themes: - interface: content - target: $SNAP/data-dir/themes - default-provider: gtk-common-themes - -hooks: - configure: - plugs: - - home - - network - - network-bind - - removable-media - pre-refresh: - plugs: - - home - - network - - network-bind - - removable-media - -apps: - chirp-snap: - command: bin/chirpw - desktop: share/applications/chirp.desktop - environment: - # Fallback to XWayland if running in a Wayland session. - DISABLE_WAYLAND: 1 - # Needed for fontconfig - XDG_DATA_HOME: ${SNAP}/usr/share - FONTCONFIG_PATH: ${SNAP}/etc/fonts/config.d - FONTCONFIG_FILE: ${SNAP}/etc/fonts/fonts.conf - plugs: - - home - - network - - network-bind - - removable-media - - desktop-legacy - - unity7 - - x11 - - raw-usb - - serial-port - -parts: - chirp: - plugin: python - python-version: python2 - #python-packages: [pycairo, pygobject, pygtk, libxml2, pyserial, python-future, python-suds] - source: https://github.com/kk7ds/chirp.git - override-pull: | - snapcraftctl pull - # Set timezone to America/Los_Angeles - sudo sudo ln -sf /usr/share/zoneinfo/America/Los_Angeles /etc/localtime - sed -i "s/CHIRP_VERSION = \".*\"/CHIRP_VERSION = \"daily-$(date +%Y%m%d)\"/" chirp/__init__.py - sed -i "s,^Icon=.*$,Icon=\$\{SNAP\}/share/chirp-snap.svg," share/chirp.desktop - # snap version cannot be longer than 32 characters - LATEST_COMMIT_SHORT=$(git rev-parse --short HEAD) - SNAP_VERSION="snap-$(date +%Y%m%d)+${LATEST_COMMIT_SHORT}" - snapcraftctl set-version "$SNAP_VERSION" - override-build: | - snapcraftctl build - cp ${SNAPCRAFT_PART_SRC}/share/chirp.svg ${SNAPCRAFT_PART_INSTALL}/share/chirp-snap.svg - rsync -av ${SNAPCRAFT_PART_INSTALL}/share/ ${SNAPCRAFT_PART_INSTALL}/usr/share/ - rm ${SNAPCRAFT_PART_INSTALL}/usr/share/pixmaps/chirp.png - build-packages: - - rsync - stage-packages: - - python-gtk2 - - python-serial - - python-libxml2 - - python-future - after: - - desktop-gtk2 - # https://github.com/ubuntu/snapcraft-desktop-helpers/blob/master/snapcraft.yaml - desktop-gtk2: - source: https://github.com/ubuntu/snapcraft-desktop-helpers.git - source-subdir: gtk - plugin: make - make-parameters: ["FLAVOR=gtk2"] - build-packages: - - build-essential - - libgtk2.0-dev - - gettext - stage-packages: - - libxkbcommon0 # XKB_CONFIG_ROOT - - ttf-ubuntu-font-family - - dmz-cursor-theme - - light-themes - - adwaita-icon-theme - - gnome-themes-standard - - shared-mime-info - - libgtk2.0-0 - - libgdk-pixbuf2.0-0 - - libglib2.0-bin - - libgtk2.0-bin - - unity-gtk2-module - - locales-all - - libappindicator1 - - xdg-user-dirs - - ibus-gtk - - libibus-1.0-5 diff --git a/stock_configs/DE Freenet Frequencies.csv b/stock_configs/DE Freenet Frequencies.csv deleted file mode 100644 index e9ec9bc..0000000 --- a/stock_configs/DE Freenet Frequencies.csv +++ /dev/null @@ -1,7 +0,0 @@ -Location,Name,Frequency,Duplex,Offset,Tone,rToneFreq,cToneFreq,DtcsCode,DtcsPolarity,Mode,TStep,Skip,Comment,URCALL,RPT1CALL,RPT2CALL -1,FRNET1,149.025000,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, -2,FRNET2,149.037500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, -3,FRNET3,149.050000,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, -4,FRNET4,149.087500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, -5,FRNET5,149.100000,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, -6,FRNET6,149.112500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, diff --git a/stock_configs/EU LPD and PMR Channels.csv b/stock_configs/EU LPD and PMR Channels.csv deleted file mode 100644 index 19d9e14..0000000 --- a/stock_configs/EU LPD and PMR Channels.csv +++ /dev/null @@ -1,86 +0,0 @@ -Location,Name,Frequency,Duplex,Offset,Tone,rToneFreq,cToneFreq,DtcsCode,DtcsPolarity,Mode,TStep,Skip,Comment,URCALL,RPT1CALL,RPT2CALL -1,LPD 01,433.075000,,0.600000,,88.5,88.5,023,NN,FM,5.00,,,,, -2,LPD 02,433.100000,,0.600000,,88.5,88.5,023,NN,FM,5.00,,,,, -3,LPD 03,433.125000,,0.600000,,88.5,88.5,023,NN,FM,5.00,,,,, -4,LPD 04,433.150000,,0.600000,,88.5,88.5,023,NN,FM,5.00,,,,, -5,LPD 05,433.175000,,0.600000,,88.5,88.5,023,NN,FM,5.00,,,,, -6,LPD 06,433.200000,,0.600000,,88.5,88.5,023,NN,FM,5.00,,,,, -7,LPD 07,433.225000,,0.600000,,88.5,88.5,023,NN,FM,5.00,,,,, -8,LPD 08,433.250000,,0.600000,,88.5,88.5,023,NN,FM,5.00,,,,, -9,LPD 09,433.275000,,0.600000,,88.5,88.5,023,NN,FM,5.00,,,,, -10,LPD 10,433.300000,,0.600000,,88.5,88.5,023,NN,FM,5.00,,,,, -11,LPD 11,433.325000,,0.600000,,88.5,88.5,023,NN,FM,5.00,,,,, -12,LPD 12,433.350000,,0.600000,,88.5,88.5,023,NN,FM,5.00,,,,, -13,LPD 13,433.375000,,0.600000,,88.5,88.5,023,NN,FM,5.00,,,,, -14,LPD 14,433.400000,,0.600000,,88.5,88.5,023,NN,FM,5.00,,,,, -15,LPD 15,433.425000,,0.600000,,88.5,88.5,023,NN,FM,5.00,,,,, -16,LPD 16,433.450000,,0.600000,,88.5,88.5,023,NN,FM,5.00,,,,, -17,LPD 17,433.475000,,0.600000,,88.5,88.5,023,NN,FM,5.00,,,,, -18,LPD 18,433.500000,,0.600000,,88.5,88.5,023,NN,FM,5.00,,,,, -19,LPD 19,433.525000,,0.600000,,88.5,88.5,023,NN,FM,5.00,,,,, -20,LPD 20,433.550000,,0.600000,,88.5,88.5,023,NN,FM,5.00,,,,, -21,LPD 21,433.575000,,0.600000,,88.5,88.5,023,NN,FM,5.00,,,,, -22,LPD 22,433.600000,,0.600000,,88.5,88.5,023,NN,FM,5.00,,,,, -23,LPD 23,433.625000,,0.600000,,88.5,88.5,023,NN,FM,5.00,,,,, -24,LPD 24,433.650000,,0.600000,,88.5,88.5,023,NN,FM,5.00,,,,, -25,LPD 25,433.675000,,0.600000,,88.5,88.5,023,NN,FM,5.00,,,,, -26,LPD 26,433.700000,,0.600000,,88.5,88.5,023,NN,FM,5.00,,,,, -27,LPD 27,433.725000,,0.600000,,88.5,88.5,023,NN,FM,5.00,,,,, -28,LPD 28,433.750000,,0.600000,,88.5,88.5,023,NN,FM,5.00,,,,, -29,LPD 29,433.775000,,0.600000,,88.5,88.5,023,NN,FM,5.00,,,,, -30,LPD 30,433.800000,,0.600000,,88.5,88.5,023,NN,FM,5.00,,,,, -31,LPD 31,433.825000,,0.600000,,88.5,88.5,023,NN,FM,5.00,,,,, -32,LPD 32,433.850000,,0.600000,,88.5,88.5,023,NN,FM,5.00,,,,, -33,LPD 33,433.875000,,0.600000,,88.5,88.5,023,NN,FM,5.00,,,,, -34,LPD 34,433.900000,,0.600000,,88.5,88.5,023,NN,FM,5.00,,,,, -35,LPD 35,433.925000,,0.600000,,88.5,88.5,023,NN,FM,5.00,,,,, -36,LPD 36,433.950000,,0.600000,,88.5,88.5,023,NN,FM,5.00,,,,, -37,LPD 37,433.975000,,0.600000,,88.5,88.5,023,NN,FM,5.00,,,,, -38,LPD 38,434.000000,,0.600000,,88.5,88.5,023,NN,FM,5.00,,,,, -39,LPD 39,434.025000,,0.600000,,88.5,88.5,023,NN,FM,5.00,,,,, -40,LPD 40,434.050000,,0.600000,,88.5,88.5,023,NN,FM,5.00,,,,, -41,LPD 41,434.075000,,0.600000,,88.5,88.5,023,NN,FM,5.00,,,,, -42,LPD 42,434.100000,,0.600000,,88.5,88.5,023,NN,FM,5.00,,,,, -43,LPD 43,434.125000,,0.600000,,88.5,88.5,023,NN,FM,5.00,,,,, -44,LPD 44,434.150000,,0.600000,,88.5,88.5,023,NN,FM,5.00,,,,, -45,LPD 45,434.175000,,0.600000,,88.5,88.5,023,NN,FM,5.00,,,,, -46,LPD 46,434.200000,,0.600000,,88.5,88.5,023,NN,FM,5.00,,,,, -47,LPD 47,434.225000,,0.600000,,88.5,88.5,023,NN,FM,5.00,,,,, -48,LPD 48,434.250000,,0.600000,,88.5,88.5,023,NN,FM,5.00,,,,, -49,LPD 49,434.275000,,0.600000,,88.5,88.5,023,NN,FM,5.00,,,,, -50,LPD 50,434.300000,,0.600000,,88.5,88.5,023,NN,FM,5.00,,,,, -51,LPD 51,434.325000,,0.600000,,88.5,88.5,023,NN,FM,5.00,,,,, -52,LPD 52,434.350000,,0.600000,,88.5,88.5,023,NN,FM,5.00,,,,, -53,LPD 53,434.375000,,0.600000,,88.5,88.5,023,NN,FM,5.00,,,,, -54,LPD 54,434.400000,,0.600000,,88.5,88.5,023,NN,FM,5.00,,,,, -55,LPD 55,434.425000,,0.600000,,88.5,88.5,023,NN,FM,5.00,,,,, -56,LPD 56,434.450000,,0.600000,,88.5,88.5,023,NN,FM,5.00,,,,, -57,LPD 57,434.475000,,0.600000,,88.5,88.5,023,NN,FM,5.00,,,,, -58,LPD 58,434.500000,,0.600000,,88.5,88.5,023,NN,FM,5.00,,,,, -59,LPD 59,434.525000,,0.600000,,88.5,88.5,023,NN,FM,5.00,,,,, -60,LPD 60,434.550000,,0.600000,,88.5,88.5,023,NN,FM,5.00,,,,, -61,LPD 61,434.575000,,0.600000,,88.5,88.5,023,NN,FM,5.00,,,,, -62,LPD 62,434.600000,,0.600000,,88.5,88.5,023,NN,FM,5.00,,,,, -63,LPD 63,434.625000,,0.600000,,88.5,88.5,023,NN,FM,5.00,,,,, -64,LPD 64,434.650000,,0.600000,,88.5,88.5,023,NN,FM,5.00,,,,, -65,LPD 65,434.675000,,0.600000,,88.5,88.5,023,NN,FM,5.00,,,,, -66,LPD 66,434.700000,,0.600000,,88.5,88.5,023,NN,FM,5.00,,,,, -67,LPD 67,434.725000,,0.600000,,88.5,88.5,023,NN,FM,5.00,,,,, -68,LPD 68,434.750000,,0.600000,,88.5,88.5,023,NN,FM,5.00,,,,, -69,LPD 69,434.775000,,0.600000,,88.5,88.5,023,NN,FM,5.00,,,,, -71,PMR 01,446.006250,,0.600000,,88.5,88.5,023,NN,NFM,6.25,,,,, -72,PMR 02,446.018750,,0.600000,,88.5,88.5,023,NN,NFM,6.25,,,,, -73,PMR 03,446.031250,,0.600000,,88.5,88.5,023,NN,NFM,6.25,,,,, -74,PMR 04,446.043750,,0.600000,,88.5,88.5,023,NN,NFM,6.25,,,,, -75,PMR 05,446.056250,,0.600000,,88.5,88.5,023,NN,NFM,6.25,,,,, -76,PMR 06,446.068750,,0.600000,,88.5,88.5,023,NN,NFM,6.25,,,,, -77,PMR 07,446.081250,,0.600000,,88.5,88.5,023,NN,NFM,6.25,,,,, -78,PMR 08,446.093750,,0.600000,,88.5,88.5,023,NN,NFM,6.25,,,,, -81,PMR 09,446.106250,,0.600000,,88.5,88.5,023,NN,NFM,6.25,,,,, -82,PMR 10,446.118750,,0.600000,,88.5,88.5,023,NN,NFM,6.25,,,,, -83,PMR 11,446.131250,,0.600000,,88.5,88.5,023,NN,NFM,6.25,,,,, -84,PMR 12,446.143750,,0.600000,,88.5,88.5,023,NN,NFM,6.25,,,,, -85,PMR 13,446.156250,,0.600000,,88.5,88.5,023,NN,NFM,6.25,,,,, -86,PMR 14,446.168750,,0.600000,,88.5,88.5,023,NN,NFM,6.25,,,,, -87,PMR 15,446.181250,,0.600000,,88.5,88.5,023,NN,NFM,6.25,,,,, -88,PMR 16,446.193750,,0.600000,,88.5,88.5,023,NN,NFM,6.25,,,,, diff --git a/stock_configs/FR Marine VHF Channels.csv b/stock_configs/FR Marine VHF Channels.csv deleted file mode 100644 index da8bac7..0000000 --- a/stock_configs/FR Marine VHF Channels.csv +++ /dev/null @@ -1,58 +0,0 @@ -Location,Name,Frequency,Duplex,Offset,Tone,rToneFreq,cToneFreq,DtcsCode,DtcsPolarity,Mode,TStep,Skip,Comment,URCALL,RPT1CALL,RPT2CALL -1,SEA 01,160.650000,-,4.600000,,88.5,88.5,023,NN,FM,5.00,,,,, -2,SEA 02,160.700000,-,4.600000,,88.5,88.5,023,NN,FM,5.00,,,,, -3,SEA 03,160.750000,-,4.600000,,88.5,88.5,023,NN,FM,5.00,,,,, -4,SEA 04,160.800000,-,4.600000,,88.5,88.5,023,NN,FM,5.00,,,,, -5,SEA 05,160.850000,-,4.600000,,88.5,88.5,023,NN,FM,5.00,,,,, -6,SEA 06,156.300000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, -7,SEA 07,160.950000,-,4.600000,,88.5,88.5,023,NN,FM,5.00,,,,, -8,SEA 08,156.400000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, -9,SEA 09,156.450000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, -10,SEA 10,156.500000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, -11,SEA 11,156.550000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, -12,SEA 12,156.600000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, -13,SEA 13,156.650000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, -14,SEA 14,156.700000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, -15,SEA 15,156.750000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, -16,SEA 16,156.800000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, -17,SEA 17,156.850000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, -18,SEA 18,161.500000,-,4.600000,,88.5,88.5,023,NN,FM,5.00,,,,, -19,SEA 19,161.550000,-,4.600000,,88.5,88.5,023,NN,FM,5.00,,,,, -20,SEA 20,161.600000,-,4.600000,,88.5,88.5,023,NN,FM,5.00,,,,, -21,SEA 21,161.650000,-,4.600000,,88.5,88.5,023,NN,FM,5.00,,,,, -22,SEA 22,161.700000,-,4.600000,,88.5,88.5,023,NN,FM,5.00,,,,, -23,SEA 23,161.750000,-,4.600000,,88.5,88.5,023,NN,FM,5.00,,,,, -24,SEA 24,161.800000,-,4.600000,,88.5,88.5,023,NN,FM,5.00,,,,, -25,SEA 25,161.850000,-,4.600000,,88.5,88.5,023,NN,FM,5.00,,,,, -26,SEA 26,161.900000,-,4.600000,,88.5,88.5,023,NN,FM,5.00,,,,, -27,SEA 27,161.950000,-,4.600000,,88.5,88.5,023,NN,FM,5.00,,,,, -28,SEA 28,162.000000,-,4.600000,,88.5,88.5,023,NN,FM,5.00,,,,, -29,SEA 60,160.625000,-,4.600000,,88.5,88.5,023,NN,FM,5.00,,,,, -30,SEA 61,160.675000,-,4.600000,,88.5,88.5,023,NN,FM,5.00,,,,, -31,SEA 62,160.725000,-,4.600000,,88.5,88.5,023,NN,FM,5.00,,,,, -32,SEA 63,160.775000,-,4.600000,,88.5,88.5,023,NN,FM,5.00,,,,, -33,SEA 64,160.825000,-,4.600000,,88.5,88.5,023,NN,FM,5.00,,,,, -34,SEA 65,160.875000,-,4.600000,,88.5,88.5,023,NN,FM,5.00,,,,, -35,SEA 66,160.925000,-,4.600000,,88.5,88.5,023,NN,FM,5.00,,,,, -36,SEA 67,156.375000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, -37,SEA 68,156.425000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, -38,SEA 69,156.475000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, -39,SEA 70,156.525000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, -40,SEA 71,156.575000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, -41,SEA 72,156.625000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, -42,SEA 73,156.675000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, -43,SEA 74,156.725000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, -44,SEA 75,156.775000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, -45,SEA 76,156.825000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, -46,SEA 77,156.875000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, -47,SEA 78,161.525000,-,4.600000,,88.5,88.5,023,NN,FM,5.00,,,,, -48,SEA 79,161.575000,-,4.600000,,88.5,88.5,023,NN,FM,5.00,,,,, -49,SEA 80,161.625000,-,4.600000,,88.5,88.5,023,NN,FM,5.00,,,,, -50,SEA 81,161.675000,-,4.600000,,88.5,88.5,023,NN,FM,5.00,,,,, -51,SEA 82,161.725000,-,4.600000,,88.5,88.5,023,NN,FM,5.00,,,,, -52,SEA 83,161.775000,-,4.600000,,88.5,88.5,023,NN,FM,5.00,,,,, -53,SEA 84,161.825000,-,4.600000,,88.5,88.5,023,NN,FM,5.00,,,,, -54,SEA 85,161.875000,-,4.600000,,88.5,88.5,023,NN,FM,5.00,,,,, -55,SEA 86,161.925000,-,4.600000,,88.5,88.5,023,NN,FM,5.00,,,,, -56,SEA 87,157.375000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, -57,SEA 88,157.425000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, diff --git a/stock_configs/KDR444.csv b/stock_configs/KDR444.csv deleted file mode 100644 index 7ab0e42..0000000 --- a/stock_configs/KDR444.csv +++ /dev/null @@ -1,9 +0,0 @@ -Location,Name,Frequency,Duplex,Offset,Tone,rToneFreq,cToneFreq,DtcsCode,DtcsPolarity,Mode,TStep,Skip,Comment,URCALL,RPT1CALL,RPT2CALL -1,KDR444 1,444.600,,0.600000,,88.5,88.5,023,NN,NFM,6.25,,,,, -2,KDR444 2,444.650,,0.600000,,88.5,88.5,023,NN,NFM,6.25,,,,, -3,KDR444 3,444.800,,0.600000,,88.5,88.5,023,NN,NFM,6.25,,,,, -4,KDR444 4,444.825,,0.600000,,88.5,88.5,023,NN,NFM,6.25,,,,, -5,KDR444 5,444.850,,0.600000,,88.5,88.5,023,NN,NFM,6.25,,,,, -6,KDR444 6,444.875,,0.600000,,88.5,88.5,023,NN,NFM,6.25,,,,, -7,KDR444 7,444.925,,0.600000,,88.5,88.5,023,NN,NFM,6.25,,,,, -8,KDR444 8,444.975,,0.600000,,88.5,88.5,023,NN,NFM,6.25,,,,, diff --git a/stock_configs/NOAA Weather Alert.csv b/stock_configs/NOAA Weather Alert.csv deleted file mode 100644 index 9e355b5..0000000 --- a/stock_configs/NOAA Weather Alert.csv +++ /dev/null @@ -1,11 +0,0 @@ -Location,Name,Frequency,Duplex,Offset,Tone,rToneFreq,cToneFreq,DtcsCode,DtcsPolarity,Mode,TStep,Skip,Comment,URCALL,RPT1CALL,RPT2CALL -1,WX1PA7,162.550000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, -2,WX2PA1,162.400000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, -3,WX3PA4,162.475000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, -4,WX4PA2,162.425000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, -5,WX5PA3,162.450000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, -6,WX6PA5,162.500000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, -7,WX7PA6,162.525000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, -8,WX8,161.650000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, -9,WX9,161.775000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, -10,WX10,163.275000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, diff --git a/stock_configs/SE Jaktradio 155MHz.csv b/stock_configs/SE Jaktradio 155MHz.csv deleted file mode 100644 index 34f47dc..0000000 --- a/stock_configs/SE Jaktradio 155MHz.csv +++ /dev/null @@ -1,8 +0,0 @@ -Location,Name,Frequency,Duplex,Offset,Tone,rToneFreq,cToneFreq,DtcsCode,DtcsPolarity,Mode,TStep,Skip,Comment,URCALL,RPT1CALL,RPT2CALL -1,JAKT 1,155.425,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, -2,JAKT 2,155.475,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, -3,JAKT 3,155.500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, -4,JAKT 4,155.525,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, -5,JAKT 5,156.000,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, -6,JAKT 6,156.400,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, -7,JAKT 7,156.450,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, diff --git a/stock_configs/UK Business Radio Simple Light Frequencies.csv b/stock_configs/UK Business Radio Simple Light Frequencies.csv deleted file mode 100644 index 803995b..0000000 --- a/stock_configs/UK Business Radio Simple Light Frequencies.csv +++ /dev/null @@ -1,16 +0,0 @@ -Location,Name,Frequency,Duplex,Offset,Tone,rToneFreq,cToneFreq,DtcsCode,DtcsPolarity,Mode,TStep,Skip,Comment,URCALL,RPT1CALL,RPT2CALL -1,BRSL1,77.687500,,0.000000,,88.5,88.5,023,NN,NFM,12.50,,,,, -2,BRSL2,86.337500,,0.000000,,88.5,88.5,023,NN,NFM,12.50,,,,, -3,BRSL3,86.350000,,0.000000,,88.5,88.5,023,NN,NFM,12.50,,,,, -4,BRSL4,86.362500,,0.000000,,88.5,88.5,023,NN,NFM,12.50,,,,, -5,BRSL5,86.375000,,0.000000,,88.5,88.5,023,NN,NFM,12.50,,,,, -6,BRSL6,164.050000,,0.000000,,88.5,88.5,023,NN,NFM,12.50,,,,, -7,BRSL7,164.062500,,0.000000,,88.5,88.5,023,NN,NFM,12.50,,,,, -8,BRSL8,169.087500,,0.000000,,88.5,88.5,023,NN,NFM,12.50,,,,, -9,BRSL9,169.312500,,0.000000,,88.5,88.5,023,NN,NFM,12.50,,,,, -10,BRSL10,173.050000,,0.000000,,88.5,88.5,023,NN,NFM,12.50,,,,, -11,BRSL11,173.062500,,0.000000,,88.5,88.5,023,NN,NFM,12.50,,,,, -12,BRSL12,173.087500,,0.000000,,88.5,88.5,023,NN,NFM,12.50,,,,, -13,BRSL13,449.312500,,0.000000,,88.5,88.5,023,NN,NFM,12.50,,,,, -14,BRSL14,449.400000,,0.000000,,88.5,88.5,023,NN,NFM,12.50,,,,, -15,BRSL15,449.475000,,0.000000,,88.5,88.5,023,NN,NFM,12.50,,,,, diff --git a/stock_configs/US 60 meter channels (Center).csv b/stock_configs/US 60 meter channels (Center).csv deleted file mode 100644 index df22f65..0000000 --- a/stock_configs/US 60 meter channels (Center).csv +++ /dev/null @@ -1,6 +0,0 @@ -Location,Name,Frequency,Duplex,Offset,Tone,rToneFreq,cToneFreq,DtcsCode,DtcsPolarity,Mode,TStep,Skip,Comment,URCALL,RPT1CALL,RPT2CALL -1,60m CH1,5.332000,,0.600000,,88.5,88.5,023,NN,USB,5.00,,,,, -2,60m CH2,5.348000,,0.600000,,88.5,88.5,023,NN,USB,5.00,,,,, -3,60m CH3,5.358500,,0.600000,,88.5,88.5,023,NN,USB,5.00,,,,, -4,60m CH4,5.373000,,0.600000,,88.5,88.5,023,NN,USB,5.00,,,,, -5,60m CH5,5.405000,,0.600000,,88.5,88.5,023,NN,USB,5.00,,,,, diff --git a/stock_configs/US 60 meter channels (Dial).csv b/stock_configs/US 60 meter channels (Dial).csv deleted file mode 100644 index ed016f3..0000000 --- a/stock_configs/US 60 meter channels (Dial).csv +++ /dev/null @@ -1,6 +0,0 @@ -Location,Name,Frequency,Duplex,Offset,Tone,rToneFreq,cToneFreq,DtcsCode,DtcsPolarity,Mode,TStep,Skip,Comment,URCALL,RPT1CALL,RPT2CALL -1,60m CH1,5.330500,,0.600000,,88.5,88.5,023,NN,USB,5.00,,,,, -2,60m CH2,5.346500,,0.600000,,88.5,88.5,023,NN,USB,5.00,,,,, -3,60m CH3,5.357000,,0.600000,,88.5,88.5,023,NN,USB,5.00,,,,, -4,60m CH4,5.371500,,0.600000,,88.5,88.5,023,NN,USB,5.00,,,,, -5,60m CH5,5.403500,,0.600000,,88.5,88.5,023,NN,USB,5.00,,,,, diff --git a/stock_configs/US CA Railroad Channels.csv b/stock_configs/US CA Railroad Channels.csv deleted file mode 100644 index fe5f4e6..0000000 --- a/stock_configs/US CA Railroad Channels.csv +++ /dev/null @@ -1,187 +0,0 @@ -Location,Name,Frequency,Duplex,Offset,Tone,rToneFreq,cToneFreq,DtcsCode,DtcsPolarity,Mode,Tstep,Skip,Comment,URCALL,RPT1CALL,RPT2CALL -1,AAR002,159.810000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, -2,AAR003,159.930000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, -3,AAR004,160.050000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, -4,AAR005,160.185000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, -5,AAR006,160.200000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, -6,AAR007,160.215000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, -7,AAR008,160.230000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, -8,AAR009,160.245000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, -9,AAR010,160.260000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, -10,AAR011,160.275000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, -11,AAR012,160.290000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, -12,AAR013,160.305000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, -13,AAR014,160.320000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, -14,AAR015,160.335000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, -15,AAR016,160.350000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, -16,AAR017,160.365000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, -17,AAR018,160.380000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, -18,AAR019,160.395000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, -19,AAR020,160.410000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, -20,AAR021,160.425000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, -21,AAR022,160.440000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, -22,AAR023,160.455000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, -23,AAR024,160.470000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, -24,AAR025,160.485000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, -25,AAR026,160.500000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, -26,AAR027,160.515000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, -27,AAR028,160.530000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, -28,AAR029,160.545000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, -29,AAR030,160.560000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, -30,AAR031,160.575000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, -31,AAR032,160.590000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, -32,AAR033,160.605000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, -33,AAR034,160.620000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, -34,AAR035,160.635000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, -35,AAR036,160.650000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, -36,AAR037,160.665000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, -37,AAR038,160.680000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, -38,AAR039,160.695000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, -39,AAR040,160.710000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, -40,AAR041,160.725000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, -41,AAR042,160.740000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, -42,AAR043,160.755000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, -43,AAR044,160.770000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, -44,AAR045,160.785000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, -45,AAR046,160.800000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, -46,AAR047,160.815000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, -47,AAR048,160.830000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, -48,AAR049,160.845000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, -49,AAR050,160.860000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, -50,AAR051,160.875000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, -51,AAR052,160.890000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, -52,AAR053,160.905000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, -53,AAR054,160.920000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, -54,AAR055,160.935000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, -55,AAR056,160.950000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, -56,AAR057,160.965000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, -57,AAR058,160.980000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, -58,AAR059,160.995000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, -59,AAR060,161.010000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, -60,AAR061,161.025000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, -61,AAR062,161.040000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, -62,AAR063,161.055000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, -63,AAR064,161.070000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, -64,AAR065,161.085000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, -65,AAR066,161.100000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, -66,AAR067,161.115000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, -67,AAR068,161.130000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, -68,AAR069,161.145000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, -69,AAR070,161.160000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, -70,AAR071,161.175000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, -71,AAR072,161.190000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, -72,AAR073,161.205000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, -73,AAR074,161.220000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, -74,AAR075,161.235000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, -75,AAR076,161.250000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, -76,AAR077,161.265000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, -77,AAR078,161.280000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, -78,AAR079,161.295000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, -79,AAR080,161.310000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, -80,AAR081,161.325000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, -81,AAR082,161.340000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, -82,AAR083,161.355000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, -83,AAR084,161.370000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, -84,AAR085,161.385000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, -85,AAR086,161.400000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, -86,AAR087,161.415000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, -87,AAR088,161.430000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, -88,AAR089,161.445000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, -89,AAR090,161.460000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, -90,AAR091,161.475000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, -91,AAR092,161.490000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, -92,AAR093,161.505000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, -93,AAR094,161.520000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, -94,AAR095,161.535000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, -95,AAR096,161.550000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, -96,AAR097,161.565000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, -97,AAR107,160.222500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, -98,AAR108,160.237500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, -99,AAR109,160.252500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, -100,AAR110,160.267500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, -101,AAR111,160.282500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, -102,AAR112,160.297500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, -103,AAR113,160.312500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, -104,AAR114,160.327500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, -105,AAR115,160.342500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, -106,AAR116,160.357500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, -107,AAR117,160.372500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, -108,AAR118,160.387500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, -109,AAR119,160.402500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, -110,AAR120,160.417500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, -111,AAR121,160.432500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, -112,AAR122,160.447500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, -113,AAR123,160.462500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, -114,AAR124,160.477500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, -115,AAR125,160.492500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, -116,AAR126,160.507500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, -117,AAR127,160.522500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, -118,AAR128,160.537500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, -119,AAR129,160.552500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, -120,AAR130,160.567500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, -121,AAR131,160.582500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, -122,AAR132,160.597500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, -123,AAR133,160.612500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, -124,AAR134,160.627500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, -125,AAR135,160.642500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, -126,AAR136,160.657500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, -127,AAR137,160.672500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, -128,AAR138,160.687500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, -129,AAR139,160.702500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, -130,AAR140,160.717500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, -131,AAR141,160.732500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, -132,AAR142,160.747500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, -133,AAR143,160.762500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, -134,AAR144,160.777500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, -135,AAR145,160.792500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, -136,AAR146,160.807500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, -137,AAR147,160.822500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, -138,AAR148,160.837500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, -139,AAR149,160.852500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, -140,AAR150,160.867500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, -141,AAR151,160.882500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, -142,AAR152,160.897500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, -143,AAR153,160.912500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, -144,AAR154,160.927500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, -145,AAR155,160.942500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, -146,AAR156,160.957500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, -147,AAR157,160.972500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, -148,AAR158,160.987500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, -149,AAR159,161.002500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, -150,AAR160,161.017500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, -151,AAR161,161.032500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, -152,AAR162,161.047500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, -153,AAR163,161.062500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, -154,AAR164,161.077500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, -155,AAR165,161.092500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, -156,AAR166,161.107500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, -157,AAR167,161.122500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, -158,AAR168,161.137500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, -159,AAR169,161.152500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, -160,AAR170,161.167500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, -161,AAR171,161.182500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, -162,AAR172,161.197500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, -163,AAR173,161.212500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, -164,AAR174,161.227500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, -165,AAR175,161.242500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, -166,AAR176,161.257500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, -167,AAR177,161.272500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, -168,AAR178,161.287500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, -169,AAR179,161.302500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, -170,AAR180,161.317500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, -171,AAR181,161.332500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, -172,AAR182,161.347500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, -173,AAR183,161.362500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, -174,AAR184,161.377500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, -175,AAR185,161.392500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, -176,AAR186,161.407500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, -177,AAR187,161.422500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, -178,AAR188,161.437500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, -179,AAR189,161.452500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, -180,AAR190,161.467500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, -181,AAR191,161.482500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, -182,AAR192,161.497500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, -183,AAR193,161.512500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, -184,AAR194,161.527500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, -185,AAR195,161.542500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, -186,AAR196,161.557500,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, diff --git a/stock_configs/US Calling Frequencies.csv b/stock_configs/US Calling Frequencies.csv deleted file mode 100644 index d597d86..0000000 --- a/stock_configs/US Calling Frequencies.csv +++ /dev/null @@ -1,5 +0,0 @@ -Location,Name,Frequency,Duplex,Offset,Tone,rToneFreq,cToneFreq,DtcsCode,DtcsPolarity,Mode,TStep,Skip,Comment,URCALL,RPT1CALL,RPT2CALL -1,6m Call,52.525000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, -2,2m Call,146.520000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, -3,220 Call,223.500000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, -4,70cm Call,446.000000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, diff --git a/stock_configs/US FRS and GMRS Channels.csv b/stock_configs/US FRS and GMRS Channels.csv deleted file mode 100644 index 76a58ac..0000000 --- a/stock_configs/US FRS and GMRS Channels.csv +++ /dev/null @@ -1,53 +0,0 @@ -Location,Name,Frequency,Duplex,Offset,Tone,rToneFreq,cToneFreq,DtcsCode,DtcsPolarity,Mode,TStep,Skip,Comment,URCALL,RPT1CALL,RPT2CALL -1,FRS 1,462.562500,,5.000000,,88.5,88.5,023,NN,NFM,12.50,,,,, -2,FRS 2,462.587500,,5.000000,,88.5,88.5,023,NN,NFM,12.50,,,,, -3,FRS 3,462.612500,,5.000000,,88.5,88.5,023,NN,NFM,12.50,,,,, -4,FRS 4,462.637500,,5.000000,,88.5,88.5,023,NN,NFM,12.50,,,,, -5,FRS 5,462.662500,,5.000000,,88.5,88.5,023,NN,NFM,12.50,,,,, -6,FRS 6,462.687500,,5.000000,,88.5,88.5,023,NN,NFM,12.50,,,,, -7,FRS 7,462.712500,,5.000000,,88.5,88.5,023,NN,NFM,12.50,,,,, -8,FRS 8,467.562500,,5.000000,,88.5,88.5,023,NN,NFM,12.50,,,,, -9,FRS 9,467.587500,,5.000000,,88.5,88.5,023,NN,NFM,12.50,,,,, -10,FRS 10,467.612500,,5.000000,,88.5,88.5,023,NN,NFM,12.50,,,,, -11,FRS 11,467.637500,,5.000000,,88.5,88.5,023,NN,NFM,12.50,,,,, -12,FRS 12,467.662500,,5.000000,,88.5,88.5,023,NN,NFM,12.50,,,,, -13,FRS 13,467.687500,,5.000000,,88.5,88.5,023,NN,NFM,12.50,,,,, -14,FRS 14,467.712500,,5.000000,,88.5,88.5,023,NN,NFM,12.50,,,,, -15,FRS 15,462.550000,,5.000000,,88.5,88.5,023,NN,NFM,12.50,,,,, -16,FRS 16,462.575000,,5.000000,,88.5,88.5,023,NN,NFM,12.50,,,,, -17,FRS 17,462.600000,,5.000000,,88.5,88.5,023,NN,NFM,12.50,,,,, -18,FRS 18,462.625000,,5.000000,,88.5,88.5,023,NN,NFM,12.50,,,,, -19,FRS 19,462.650000,,5.000000,,88.5,88.5,023,NN,NFM,12.50,,,,, -20,FRS 20,462.675000,,5.000000,,88.5,88.5,023,NN,NFM,12.50,,,,, -21,FRS 21,462.700000,,5.000000,,88.5,88.5,023,NN,NFM,12.50,,,,, -22,FRS 22,462.725000,,5.000000,,88.5,88.5,023,NN,NFM,12.50,,,,, -23,GMRS 1,462.562500,,5.000000,,88.5,88.5,023,NN,FM,12.50,,,,, -24,GMRS 2,462.587500,,5.000000,,88.5,88.5,023,NN,FM,12.50,,,,, -25,GMRS 3,462.612500,,5.000000,,88.5,88.5,023,NN,FM,12.50,,,,, -26,GMRS 4,462.637500,,5.000000,,88.5,88.5,023,NN,FM,12.50,,,,, -27,GMRS 5,462.662500,,5.000000,,88.5,88.5,023,NN,FM,12.50,,,,, -28,GMRS 6,462.687500,,5.000000,,88.5,88.5,023,NN,FM,12.50,,,,, -29,GMRS 7,462.712500,,5.000000,,88.5,88.5,023,NN,FM,12.50,,,,, -30,GMRS 8,467.562500,,5.000000,,88.5,88.5,023,NN,NFM,12.50,,,,, -31,GMRS 9,467.587500,,5.000000,,88.5,88.5,023,NN,NFM,12.50,,,,, -32,GMRS 10,467.612500,,5.000000,,88.5,88.5,023,NN,NFM,12.50,,,,, -33,GMRS 11,467.637500,,5.000000,,88.5,88.5,023,NN,NFM,12.50,,,,, -34,GMRS 12,467.662500,,5.000000,,88.5,88.5,023,NN,NFM,12.50,,,,, -35,GMRS 13,467.687500,,5.000000,,88.5,88.5,023,NN,NFM,12.50,,,,, -36,GMRS 14,467.712500,,5.000000,,88.5,88.5,023,NN,NFM,12.50,,,,, -37,GMRS 15,462.550000,,5.000000,,88.5,88.5,023,NN,FM,12.50,,,,, -38,GMRS 16,462.575000,,5.000000,,88.5,88.5,023,NN,FM,12.50,,,,, -39,GMRS 17,462.600000,,5.000000,,88.5,88.5,023,NN,FM,12.50,,,,, -40,GMRS 18,462.625000,,5.000000,,88.5,88.5,023,NN,FM,12.50,,,,, -41,GMRS 19,462.650000,,5.000000,,88.5,88.5,023,NN,FM,12.50,,,,, -42,GMRS 20,462.675000,,5.000000,,88.5,88.5,023,NN,FM,12.50,,,,, -43,GMRS 21,462.700000,,5.000000,,88.5,88.5,023,NN,FM,12.50,,,,, -44,GMRS 22,462.725000,,5.000000,,88.5,88.5,023,NN,FM,12.50,,,,, -45,GMRS 550/15R,462.550000,+,5.000000,,88.5,88.5,023,NN,FM,12.50,,,,, -46,GMRS 575/16R,462.575000,+,5.000000,,88.5,88.5,023,NN,FM,12.50,,,,, -47,GMRS 600/17R,462.600000,+,5.000000,,88.5,88.5,023,NN,FM,12.50,,,,, -48,GMRS 625/18R,462.625000,+,5.000000,,88.5,88.5,023,NN,FM,12.50,,,,, -49,GMRS 650/19R,462.650000,+,5.000000,,88.5,88.5,023,NN,FM,12.50,,,,, -50,GMRS 675/20R,462.675000,+,5.000000,,88.5,88.5,023,NN,FM,12.50,,,,, -51,GMRS 700/21R,462.700000,+,5.000000,,88.5,88.5,023,NN,FM,12.50,,,,, -52,GMRS 725/22R,462.725000,+,5.000000,,88.5,88.5,023,NN,FM,12.50,,,,, diff --git a/stock_configs/US MURS Channels.csv b/stock_configs/US MURS Channels.csv deleted file mode 100644 index e6fed17..0000000 --- a/stock_configs/US MURS Channels.csv +++ /dev/null @@ -1,6 +0,0 @@ -Location,Name,Frequency,Duplex,Offset,Tone,rToneFreq,cToneFreq,DtcsCode,DtcsPolarity,Mode,TStep,Skip,Comment,URCALL,RPT1CALL,RPT2CALL -1,MURS 1,151.820000,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, -2,MURS 2,151.880000,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, -3,MURS 3,151.940000,,0.000000,,88.5,88.5,023,NN,NFM,5.00,,,,, -4,Blue Dot,154.570000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, -5,Green Dot,154.600000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,, diff --git a/stock_configs/US Marine VHF Channels.csv b/stock_configs/US Marine VHF Channels.csv deleted file mode 100644 index 21a6f79..0000000 --- a/stock_configs/US Marine VHF Channels.csv +++ /dev/null @@ -1,61 +0,0 @@ -Location,Name,Frequency,Duplex,Offset,Tone,rToneFreq,cToneFreq,DtcsCode,DtcsPolarity,Mode,TStep,Skip,Comment,URCALL,RPT1CALL,RPT2CALL -1,SEA 01,160.650000,-,4.600000,,88.5,88.5,023,NN,FM,25.00,,,,, -2,SEA 02,160.700000,-,4.600000,,88.5,88.5,023,NN,FM,25.00,,,,, -3,SEA 03,160.750000,-,4.600000,,88.5,88.5,023,NN,FM,25.00,,,,, -4,SEA 04,160.800000,-,4.600000,,88.5,88.5,023,NN,FM,25.00,,,,, -5,SEA 05,160.850000,-,4.600000,,88.5,88.5,023,NN,FM,25.00,,,,, -6,SEA 06,156.300000,,0.000000,,88.5,88.5,023,NN,FM,25.00,,,,, -7,SEA 07,160.950000,-,4.600000,,88.5,88.5,023,NN,FM,25.00,,,,, -8,SEA 08,156.400000,,0.000000,,88.5,88.5,023,NN,FM,25.00,,,,, -9,SEA 09,156.450000,,0.000000,,88.5,88.5,023,NN,FM,25.00,,,,, -10,SEA 10,156.500000,,0.000000,,88.5,88.5,023,NN,FM,25.00,,,,, -11,SEA 11,156.550000,,0.000000,,88.5,88.5,023,NN,FM,25.00,,,,, -12,SEA 12,156.600000,,0.000000,,88.5,88.5,023,NN,FM,25.00,,,,, -13,SEA 13,156.650000,,0.000000,,88.5,88.5,023,NN,FM,25.00,,,,, -14,SEA 14,156.700000,,0.000000,,88.5,88.5,023,NN,FM,25.00,,,,, -15,SEA 15,156.750000,,0.000000,,88.5,88.5,023,NN,FM,25.00,,,,, -16,SEA 16,156.800000,,0.000000,,88.5,88.5,023,NN,FM,25.00,,,,, -17,SEA 17,156.850000,,0.000000,,88.5,88.5,023,NN,FM,25.00,,,,, -18,SEA 18,161.500000,-,4.600000,,88.5,88.5,023,NN,FM,25.00,,,,, -19,SEA 19,161.550000,-,4.600000,,88.5,88.5,023,NN,FM,25.00,,,,, -20,SEA 20,161.600000,-,4.600000,,88.5,88.5,023,NN,FM,25.00,,,,, -21,SEA 21,161.650000,-,4.600000,,88.5,88.5,023,NN,FM,25.00,,,,, -22,SEA 22,161.700000,-,4.600000,,88.5,88.5,023,NN,FM,25.00,,,,, -23,SEA 23,161.750000,-,4.600000,,88.5,88.5,023,NN,FM,25.00,,,,, -24,SEA 24,161.800000,-,4.600000,,88.5,88.5,023,NN,FM,25.00,,,,, -25,SEA 25,161.850000,-,4.600000,,88.5,88.5,023,NN,FM,25.00,,,,, -26,SEA 26,161.900000,-,4.600000,,88.5,88.5,023,NN,FM,25.00,,,,, -27,SEA 27,161.950000,-,4.600000,,88.5,88.5,023,NN,FM,25.00,,,,, -28,SEA 28,162.000000,-,4.600000,,88.5,88.5,023,NN,FM,25.00,,,,, -29,SEA 60,160.625000,-,4.600000,,88.5,88.5,023,NN,FM,25.00,,,,, -30,SEA 61,160.675000,-,4.600000,,88.5,88.5,023,NN,FM,25.00,,,,, -31,SEA 62,160.725000,-,4.600000,,88.5,88.5,023,NN,FM,25.00,,,,, -32,SEA 63,160.775000,-,4.600000,,88.5,88.5,023,NN,FM,25.00,,,,, -33,SEA 64,160.825000,-,4.600000,,88.5,88.5,023,NN,FM,25.00,,,,, -34,SEA 65,160.875000,-,4.600000,,88.5,88.5,023,NN,FM,25.00,,,,, -35,SEA 66,160.925000,-,4.600000,,88.5,88.5,023,NN,FM,25.00,,,,, -36,SEA 67,156.375000,,0.000000,,88.5,88.5,023,NN,FM,25.00,,,,, -37,SEA 68,156.425000,,0.000000,,88.5,88.5,023,NN,FM,25.00,,,,, -38,SEA 69,156.475000,,0.000000,,88.5,88.5,023,NN,FM,25.00,,,,, -39,DSC 70,156.525000,,0.000000,,88.5,88.5,023,NN,FM,25.00,,,,, -40,SEA 71,156.575000,,0.000000,,88.5,88.5,023,NN,FM,25.00,,,,, -41,SEA 72,156.625000,,0.000000,,88.5,88.5,023,NN,FM,25.00,,,,, -42,SEA 73,156.675000,,0.000000,,88.5,88.5,023,NN,FM,25.00,,,,, -43,SEA 74,156.725000,,0.000000,,88.5,88.5,023,NN,FM,25.00,,,,, -44,SEA 77,156.875000,,0.000000,,88.5,88.5,023,NN,FM,25.00,,,,, -45,SEA 78,161.525000,-,4.600000,,88.5,88.5,023,NN,FM,25.00,,,,, -46,SEA 79,161.575000,-,4.600000,,88.5,88.5,023,NN,FM,25.00,,,,, -47,SEA 80,161.625000,-,4.600000,,88.5,88.5,023,NN,FM,25.00,,,,, -48,SEA 81,161.675000,-,4.600000,,88.5,88.5,023,NN,FM,25.00,,,,, -49,SEA 82,161.725000,-,4.600000,,88.5,88.5,023,NN,FM,25.00,,,,, -50,SEA 83,161.775000,-,4.600000,,88.5,88.5,023,NN,FM,25.00,,,,, -51,SEA 84,161.825000,-,4.600000,,88.5,88.5,023,NN,FM,25.00,,,,, -52,SEA 85,161.875000,-,4.600000,,88.5,88.5,023,NN,FM,25.00,,,,, -53,SEA 86,161.925000,-,4.600000,,88.5,88.5,023,NN,FM,25.00,,,,, -54,AIS 87,161.975000,-,4.600000,,88.5,88.5,023,NN,FM,25.00,,,,, -55,AIS 88,162.025000,-,4.600000,,88.5,88.5,023,NN,FM,25.00,,,,, -56,SEA F1,155.625000,,0.000000,,88.5,88.5,023,NN,FM,25.00,,,,, -57,SEA F2,155.775000,,0.000000,,88.5,88.5,023,NN,FM,25.00,,,,, -58,SEA F3,155.825000,,0.000000,,88.5,88.5,023,NN,FM,25.00,,,,, -59,SEA L1,155.500000,,0.000000,,88.5,88.5,023,NN,FM,25.00,,,,, -60,SEA L2,155.525000,,0.000000,,88.5,88.5,023,NN,FM,25.00,,,,, diff --git a/test-requirements.txt b/test-requirements.txt index e5fbed1..9d34147 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1,9 +1,11 @@ -mock -mox3 -pytest +# https://github.com/pytest-dev/pytest/issues/10428 +pytest==7.1.3 pytest-xdist pytest-html six +pep8 pyserial future requests +pyyaml +pywin32; platform_system=="Windows" diff --git a/tests/Python3_Driver_Testing.md b/tests/Python3_Driver_Testing.md index ccb0d49..2e82670 100644 --- a/tests/Python3_Driver_Testing.md +++ b/tests/Python3_Driver_Testing.md @@ -1,339 +1,486 @@ ## Status -| Driver | Tester | Tested | Byte Clean | -| ------ | ------ | ------ | ---------- | -| ARRL_Travel_Plus | | | | -| Abbree_AR-518 | | | | -| Abbree_AR-63 | | | | -| Alinco_DJ-G7EG | | | | -| Alinco_DJ175 | | | | -| Alinco_DJ596 | | | | -| Alinco_DR03T | | | | -| Alinco_DR06T | | | | -| Alinco_DR135T | | | | -| Alinco_DR235T | | | | -| Alinco_DR435T | | | | -| AnyTone_5888UV | | | | -| AnyTone_5888UVIII | | | | -| AnyTone_778UV | | | Yes | -| AnyTone_778UV_VOX | | | Yes | -| AnyTone_OBLTR-8R | | | | -| AnyTone_TERMN-8R | | | | -| Anysecu_WP-9900 | | | Yes | -| BTECH_FRS-A1 | | | | -| BTECH_FRS-B1 | | | | -| BTECH_GMRS-20V2 | | | Yes | -| BTECH_GMRS-50X1 | | | Yes | -| BTECH_GMRS-V1 | | | | -| BTECH_GMRS-V2 | | | | -| BTECH_MURS-V1 | | | | -| BTECH_UV-2501 | | | Yes | -| BTECH_UV-2501+220 | | | Yes | -| BTECH_UV-25X2 | | | Yes | -| BTECH_UV-25X4 | | | Yes | -| BTECH_UV-5001 | | | Yes | -| BTECH_UV-50X2 | | | Yes | -| BTECH_UV-50X3 | | | | -| BTECH_UV-5X3 | | | | -| Baofeng_BF-888 | [@kk7ds](https://github.com/kk7ds) | 13-Feb-2019 | Yes | -| Baofeng_BF-A58 | | | | -| Baofeng_BF-A58S | | | | -| Baofeng_BF-F8HP | | | Yes | -| Baofeng_BF-T1 | | | | -| Baofeng_BF-T8 | | | | -| Baofeng_BF-V8A | | | | -| Baofeng_F-11 | | | Yes | -| Baofeng_GT-3WP | | | | -| Baofeng_GT-5R | | | Yes | -| Baofeng_UV-3R | [@yarda](https://github.com/yarda) | 26-Sep-2022 | | -| Baofeng_UV-5R | [@lekv](https://github.com/lekv) | 23-Oct-2022 | Yes | -| Baofeng_UV-6 | | | Yes | -| Baofeng_UV-6R | | | | -| Baofeng_UV-82 | | | Yes | -| Baofeng_UV-82HP | | | Yes | -| Baofeng_UV-82WP | | | | -| Baofeng_UV-9G | | | | -| Baofeng_UV-9R | | | | -| Baofeng_UV-B5 | | | Yes | -| Baojie_BJ-UV55 | | | Yes | -| Boblov_X3Plus | | | | -| CRT_Micron_UV | | | Yes | -| CRT_Micron_UV_V2 | | | Yes | -| Commander_KG-UV | | | | -| Explorer_QRZ-1 | | | | -| Feidaxin_FD-150A | | | | -| Feidaxin_FD-160A | | | | -| Feidaxin_FD-268A | | | | -| Feidaxin_FD-268B | | | | -| Feidaxin_FD-288A | | | | -| Feidaxin_FD-288B | | | | -| Feidaxin_FD-450A | | | | -| Feidaxin_FD-460A | | | | -| Feidaxin_FD-460UH | | | | -| Generic_CSV | | | | -| HobbyPCB_RS-UV3 | | | | -| Icom_746 | | | Yes | -| Icom_IC-208H | | | Yes | -| Icom_IC-2100H | | | Yes | -| Icom_IC-2200H | [@kk7ds](https://github.com/kk7ds) | 24-Oct-2022 | Yes | -| Icom_IC-2300H | | | Yes | -| Icom_IC-2720H | | | Yes | -| Icom_IC-2730A | | | Yes | -| Icom_IC-2820H | [@kk7ds](https://github.com/kk7ds) | 22-Oct-2022 | Yes | -| Icom_IC-7000 | | | Yes | -| Icom_IC-7100 | | | Yes | -| Icom_IC-7200 | [@kk7ds](https://github.com/kk7ds) | 22-Oct-2022 | Yes | -| Icom_IC-7300 | [@kk7ds](https://github.com/kk7ds) | 22-Oct-2022 | Yes | -| Icom_IC-7610 | [@kk7ds](https://github.com/kk7ds) | 24-Oct-2022 | Yes | -| Icom_IC-910 | [@mfncooper](https://github.com/mfncooper) | 1-Oct-2021 | Yes | -| Icom_IC-91_92AD | | | | -| Icom_IC-E90 | | | Yes | -| Icom_IC-P7 | | | Yes | -| Icom_IC-Q7A | | | Yes | -| Icom_IC-T70 | | | Yes | -| Icom_IC-T7H | | | Yes | -| Icom_IC-T8A | | | Yes | -| Icom_IC-V82_U82 | | | | -| Icom_IC-V86 | | | Yes | -| Icom_IC-W32A | | | Yes | -| Icom_IC-W32E | | | Yes | -| Icom_ID-31A | [@kk7ds](https://github.com/kk7ds) | 12-Feb-2019 | Yes | -| Icom_ID-51 | | | Yes | -| Icom_ID-51_Plus | | | Yes | -| Icom_ID-800H_v2 | [@kk7ds](https://github.com/kk7ds) | 22-Oct-2022 | Yes | -| Icom_ID-80H | | | Yes | -| Icom_ID-880H | [@kk7ds](https://github.com/kk7ds) | 22-Oct-2022 | Yes | -| Intek_HR-2040 | | | | -| Intek_KT-980HP | | | Yes | -| Jetstream_JT220M | | | | -| Jetstream_JT270M | | | | -| Jetstream_JT270MH | | | | -| KYD_IP-620 | | | | -| KYD_NC-630A | | | | -| Kenwood_HMK | | | | -| Kenwood_ITM | | | | -| Kenwood_TH-D7 | | | Yes | -| Kenwood_TH-D72_clone_mode | | | | -| Kenwood_TH-D72_live_mode | [@kk7ds](https://github.com/kk7ds) | 21-Oct-2022 | Yes | -| Kenwood_TH-D74_live_mode | [@kk7ds](https://github.com/kk7ds) | 20-Oct-2022 | Yes | -| Kenwood_TH-D7G | | | Yes | -| Kenwood_TH-F6 | | | Yes | -| Kenwood_TH-F7 | [@sv1](https://github.com/sv1) | 19-Oct-2022 | Yes | -| Kenwood_TH-G71 | | | Yes | -| Kenwood_TH-K2 | | | Yes | -| Kenwood_TK-2180 | | | Yes | -| Kenwood_TK-260 | | | | -| Kenwood_TK-260G | | | | -| Kenwood_TK-270 | | | | -| Kenwood_TK-270G | | | | -| Kenwood_TK-272 | | | | -| Kenwood_TK-272G | | | | -| Kenwood_TK-278 | | | | -| Kenwood_TK-278G | | | | -| Kenwood_TK-3180K | | | Yes | -| Kenwood_TK-3180K2 | | | Yes | -| Kenwood_TK-360 | | | | -| Kenwood_TK-360G | | | | -| Kenwood_TK-370 | | | | -| Kenwood_TK-370G | | | | -| Kenwood_TK-372 | | | | -| Kenwood_TK-372G | | | | -| Kenwood_TK-378 | | | | -| Kenwood_TK-378G | | | | -| Kenwood_TK-388G | | | | -| Kenwood_TK-7102 | [@kk7ds](https://github.com/kk7ds) | 15-Feb-2019 | Yes | -| Kenwood_TK-7108 | [@kk7ds](https://github.com/kk7ds) | 15-Feb-2019 | Yes | -| Kenwood_TK-7180 | [@kk7ds](https://github.com/kk7ds) | 18-Oct-2022 | Yes | -| Kenwood_TK-7180E | | | Yes | -| Kenwood_TK-760 | | | | -| Kenwood_TK-760G | | | | -| Kenwood_TK-762 | | | | -| Kenwood_TK-762G | | | | -| Kenwood_TK-768 | | | | -| Kenwood_TK-768G | | | | -| Kenwood_TK-8102 | [@kk7ds](https://github.com/kk7ds) | 15-Feb-2019 | Yes | -| Kenwood_TK-8108 | [@kk7ds](https://github.com/kk7ds) | 15-Feb-2019 | Yes | -| Kenwood_TK-8180 | [@kk7ds](https://github.com/kk7ds) | 18-Oct-2022 | Yes | -| Kenwood_TK-8180E | | | Yes | -| Kenwood_TK-860 | | | | -| Kenwood_TK-860G | | | | -| Kenwood_TK-862 | | | | -| Kenwood_TK-862G | | | | -| Kenwood_TK-868 | | | | -| Kenwood_TK-868G | | | | -| Kenwood_TM-271 | [Implied by Kenwood_TM-281](#user-content-Kenwood_TM-281) | 23-Oct-2022 | Yes | -| Kenwood_TM-281 | [@kk7ds](https://github.com/kk7ds) | 23-Oct-2022 | Yes | -| Kenwood_TM-471 | | | Yes | -| Kenwood_TM-D700 | [@kk7ds](https://github.com/kk7ds) | 20-Oct-2022 | Yes | -| Kenwood_TM-D710 | | | Yes | -| Kenwood_TM-D710G | [@kk7ds](https://github.com/kk7ds) | 22-Oct-2022 | Yes | -| Kenwood_TM-D710G_CloneMode | [@kk7ds](https://github.com/kk7ds) | 22-Oct-2022 | Yes | -| Kenwood_TM-D710_CloneMode | | | Yes | -| Kenwood_TM-G707 | | | Yes | -| Kenwood_TM-V7 | | | Yes | -| Kenwood_TM-V71 | [@kk7ds](https://github.com/kk7ds) | 21-Oct-2022 | Yes | -| Kenwood_TS-2000 | | | Yes | -| Kenwood_TS-480_CloneMode | | | | -| Kenwood_TS-480_LiveMode | | | Yes | -| Kenwood_TS-590SG_CloneMode | | | | -| Kenwood_TS-590S_CloneMode | | | | -| Kenwood_TS-590S_SG_LiveMode | | | Yes | -| Kenwood_TS-850 | | | Yes | -| LUITON_LT-316 | | | | -| LUITON_LT-580_UHF | | | | -| LUITON_LT-580_VHF | | | | -| LUITON_LT-588UV | | | Yes | -| Lanchonlh_HG-UV98 | | | Yes | -| Leixen_VV-898 | | | | -| Leixen_VV-898S | | | | -| MTC_UV-5R-3 | | | | -| Midland_DBR2500 | | | Yes | -| Polmar_DB-50M | | | | -| Powerwerx_DB-750X | | | | -| QYT_KT-8R | | | Yes | -| QYT_KT-UV980 | | | Yes | -| QYT_KT-WP12 | | | Yes | -| QYT_KT5800 | | | Yes | -| QYT_KT7900D | | | Yes | -| QYT_KT8900 | | | Yes | -| QYT_KT8900D | | | Yes | -| QYT_KT8900R | | | Yes | -| QYT_KT980PLUS | | | Yes | -| Quansheng_TG-UV2+ | | | | -| RT_Systems_CSV | | | | -| Radioddity_DB25-G | | | Yes | -| Radioddity_GA-2S | | | Yes | -| Radioddity_GA-510 | [@kk7ds](https://github.com/kk7ds) | 21-Oct-2022 | Yes | -| Radioddity_R2 | | | | -| Radioddity_UV-5G | | | Yes | -| Radioddity_UV-5RX3 | | | Yes | -| Radioddity_UV-82X3 | | | Yes | -| Radtel_T18 | | | | -| Retevis_H777_Plus | | | Yes | -| Retevis_RA685 | | | Yes | -| Retevis_RA85 | | | Yes | -| Retevis_RB15 | | | | -| Retevis_RB17 | | | | -| Retevis_RB17A | | | | -| Retevis_RB17P | | | | -| Retevis_RB17V | | | | -| Retevis_RB18 | | | | -| Retevis_RB19 | | | | -| Retevis_RB19P | | | | -| Retevis_RB23 | | | | -| Retevis_RB26 | | | | -| Retevis_RB27 | | | | -| Retevis_RB27B | | | | -| Retevis_RB27V | | | | -| Retevis_RB615 | | | | -| Retevis_RB617 | | | | -| Retevis_RB618 | | | | -| Retevis_RB619 | | | | -| Retevis_RB627B | | | | -| Retevis_RB75 | | | | -| Retevis_RB85 | | | | -| Retevis_RT1 | | | | -| Retevis_RT16 | | | | -| Retevis_RT19 | | | | -| Retevis_RT21 | | | | -| Retevis_RT22 | | | | -| Retevis_RT22FRS | | | | -| Retevis_RT22S | | | | -| Retevis_RT23 | | | | -| Retevis_RT26 | | | | -| Retevis_RT29_UHF | | | | -| Retevis_RT29_VHF | | | | -| Retevis_RT40B | | | | -| Retevis_RT47 | | | | -| Retevis_RT47V | | | | -| Retevis_RT6 | | | | -| Retevis_RT619 | | | | -| Retevis_RT622 | | | | -| Retevis_RT647 | | | | -| Retevis_RT668 | | | | -| Retevis_RT68 | | | | -| Retevis_RT76 | | | | -| Retevis_RT76P | | | | -| Retevis_RT85 | | | | -| Retevis_RT87 | | | | -| Retevis_RT9000D_136-174 | | | | -| Retevis_RT9000D_220-260 | | | | -| Retevis_RT9000D_400-490 | | | | -| Retevis_RT9000D_66-88 | | | | -| Retevis_RT95 | | | Yes | -| Retevis_RT95_VOX | | | Yes | -| Retevis_RT98 | | | | -| Rugged_RH5R-V2 | | | | -| TDXone_TD-Q8A | | | | -| TIDRADIO_TD-H6 | [@kk7ds](https://github.com/kk7ds) | 21-Oct-2022 | Yes | -| TID_TD-M8 | | | | -| TYT_TH-350 | | | Yes | -| TYT_TH-7800 | | | | -| TYT_TH-7800_File | | | | -| TYT_TH-9800 | | | | -| TYT_TH-9800_File | | | | -| TYT_TH-UV8000 | | | | -| TYT_TH-UV88 | | | | -| TYT_TH-UVF1 | | | | -| TYT_TH-UVF8D | | | | -| TYT_TH9000_144 | | | | -| TYT_TH9000_220 | | | | -| TYT_TH9000_440 | | | | -| Vertex_Standard_FTL-1011 | | | | -| Vertex_Standard_FTL-2011 | | | | -| Vertex_Standard_FTL-7011 | | | | -| Vertex_Standard_FTL-8011 | | | | -| Vertex_Standard_VXA-700 | | | | -| WACCOM_MINI-8900 | | | Yes | -| WLN_KD-C1 | | | | -| Wouxun_KG-935G | | | | -| Wouxun_KG-UV8D | | | | -| Wouxun_KG-UV8D_Plus | | | | -| Wouxun_KG-UV8E | | | | -| Wouxun_KG-UV920P-A | | | | -| Wouxun_KG-UV9D_Plus | | | | -| Yaesu_FT-1500M | | | Yes | -| Yaesu_FT-1802M | | | Yes | -| Yaesu_FT-25R | | | Yes | -| Yaesu_FT-2800M | | | Yes | -| Yaesu_FT-2900R_1900R | | | Yes | -| Yaesu_FT-2900R_1900RTXMod_Opened_Xmit | | | Yes | -| Yaesu_FT-4VR | | | Yes | -| Yaesu_FT-4XE | | | Yes | -| Yaesu_FT-4XR | | | Yes | -| Yaesu_FT-50 | | | Yes | -| Yaesu_FT-60 | | | Yes | -| Yaesu_FT-65E | | | Yes | -| Yaesu_FT-65R | | | Yes | -| Yaesu_FT-70D | | | Yes | -| Yaesu_FT-7100M | | | Yes | -| Yaesu_FT-7800_7900 | [@kk7ds](https://github.com/kk7ds) | 24-Oct-2022 | Yes | -| Yaesu_FT-8100 | | | Yes | -| Yaesu_FT-817 | [@kk7ds](https://github.com/kk7ds) | 14-Feb-2019 | Yes | -| Yaesu_FT-817ND | | | Yes | -| Yaesu_FT-817ND_US | | | Yes | -| Yaesu_FT-818 | | | Yes | -| Yaesu_FT-818ND_US | | | Yes | -| Yaesu_FT-857_897 | | | Yes | -| Yaesu_FT-857_897_US | | | Yes | -| Yaesu_FT-8800 | [@kk7ds](https://github.com/kk7ds) | 24-Oct-2022 | Yes | -| Yaesu_FT-8900 | | | Yes | -| Yaesu_FT-90 | | | Yes | -| Yaesu_FTM-350 | | | Yes | -| Yaesu_VX-170 | | | Yes | -| Yaesu_VX-2 | | | Yes | -| Yaesu_VX-3 | [@kk7ds](https://github.com/kk7ds) | 15-Feb-2019 | Yes | -| Yaesu_VX-5 | | | Yes | -| Yaesu_VX-6 | | | Yes | -| Yaesu_VX-7 | [@kk7ds](https://github.com/kk7ds) | 15-Feb-2019 | Yes | -| Yaesu_VX-8DR | [@kk7ds](https://github.com/kk7ds) | 15-Feb-2019 | Yes | -| Yaesu_VX-8GE | | | Yes | -| Yaesu_VX-8R | | | Yes | -| Yedro_YC-M04VUS | | | Yes | -| Zastone_ZT-X6 | | | | +| Driver | Tester | Tested | Byte Clean | "Market Share" | +| ------ | ------ | ------ | ---------- | -------------- | +| ARRL_Travel_Plus | | | | 0.00% | +| Abbree_AR-518 | [@KC9HI](https://github.com/KC9HI) | 16-Dec-2022 | Yes | 0.24% | +| Abbree_AR-63 | [@KC9HI](https://github.com/KC9HI) | 30-Nov-2022 | Yes | 0.03% | +| Abbree_AR-730 | [@KC9HI](https://github.com/KC9HI) | 17-Aug-2023 | Yes | | +| Abbree_AR-F5 | [@KC9HI](https://github.com/KC9HI) | 09-Aug-2023 | Yes | | +| Alinco_DJ-G7EG | [@HB9UF](https://github.com/HB9UF) | 09-Dec-2022 | Yes | 0.44% | +| Alinco_DJ-G7T | [Reported working](https://chirp.danplanet.com/issues/10567) | 09-May-2023 | Yes | | +| Alinco_DJ175 | [Implied by Alinco_DR235T](#user-content-Alinco_DR235T) | 12-Dec-2022 | Yes | 0.03% | +| Alinco_DJ596 | [Implied by Alinco_DR235T](#user-content-Alinco_DR235T) | 12-Dec-2022 | Yes | 0.02% | +| Alinco_DR03T | [Implied by Alinco_DR235T](#user-content-Alinco_DR235T) | 12-Dec-2022 | Yes | 0.01% | +| Alinco_DR06T | [Implied by Alinco_DR235T](#user-content-Alinco_DR235T) | 12-Dec-2022 | Yes | 0.01% | +| Alinco_DR135T | [Implied by Alinco_DR235T](#user-content-Alinco_DR235T) | 12-Dec-2022 | Yes | 0.04% | +| Alinco_DR235T | [@kk7ds](https://github.com/kk7ds) | 12-Dec-2022 | Yes | 0.02% | +| Alinco_DR435T | [Implied by Alinco_DR235T](#user-content-Alinco_DR235T) | 12-Dec-2022 | Yes | 0.02% | +| AnyTone_5888UV | [@kk7ds](https://github.com/kk7ds) | 9-Dec-2022 | Yes | 0.14% | +| AnyTone_5888UVIII | [@bschuler42](https://github.com/bschuler42) | 9-Jan-2023 | Yes | 0.04% | +| AnyTone_778UV | [Implied by Retevis_RT95](#user-content-Retevis_RT95) | 13-Nov-2022 | Yes | 0.17% | +| AnyTone_778UV_VOX | [Implied by Retevis_RT95](#user-content-Retevis_RT95) | 13-Nov-2022 | Yes | 0.23% | +| AnyTone_OBLTR-8R | [@KC9HI](https://github.com/KC9HI) | 17-Dec-2022 | Yes | 0.02% | +| AnyTone_TERMN-8R | [@KC9HI](https://github.com/KC9HI) | 17-Dec-2022 | Yes | 0.02% | +| Anysecu_AC-580 | [Implied by Radioddity_GS-5B](#user-content-Radioddity_GS-5B) | 17-Mar-2023 | Yes | | +| Anysecu_UV-A37 | [@KC9HI](https://github.com/KC9HI) | 5-Jun-2023 | Yes | | +| Anysecu_WP-9900 | [@KC9HI](https://github.com/KC9HI) | 11-Nov-2022 | Yes | 0.03% | +| BTECH_FRS-A1 | [@KC9HI](https://github.com/KC9HI) | 30-Nov-2022 | Yes | 0.01% | +| BTECH_FRS-B1 | [@KC9HI](https://github.com/KC9HI) | 28-Nov-2022 | Yes | 0.04% | +| BTECH_GMRS-20V2 | [@KC9HI](https://github.com/KC9HI) | 13-Nov-2022 | Yes | 0.03% | +| BTECH_GMRS-50V2 | [@KC9HI](https://github.com/KC9HI) | 15-Feb-2023 | Yes | 0.00% | +| BTECH_GMRS-50X1 | [@KC9HI](https://github.com/KC9HI) | 13-Nov-2022 | Yes | 0.13% | +| BTECH_GMRS-V1 | [@KC9HI](https://github.com/KC9HI) | 10-Dec-2022 | Yes | 0.16% | +| BTECH_GMRS-V2 | [@KC9HI](https://github.com/KC9HI) | 10-Dec-2022 | Yes | 0.16% | +| BTECH_MURS-V1 | [@KC9HI](https://github.com/KC9HI) | 10-Dec-2022 | Yes | 0.04% | +| BTECH_MURS-V2 | [@KC9HI](https://github.com/KC9HI) | 2-Mar-2023 | Yes | 0.00% | +| BTECH_UV-2501 | [@KC9HI](https://github.com/KC9HI) | 11-Nov-2022 | Yes | 0.02% | +| BTECH_UV-2501+220 | [@KC9HI](https://github.com/KC9HI) | 11-Nov-2022 | Yes | 0.02% | +| BTECH_UV-25X2 | [@KC9HI](https://github.com/KC9HI) | 11-Nov-2022 | Yes | 0.15% | +| BTECH_UV-25X2_G2 | [@KC9HI](https://github.com/KC9HI) | 23-Apr-2023 | Yes | | +| BTECH_UV-25X4 | [@KC9HI](https://github.com/KC9HI) | 10-Nov-2022 | Yes | 0.11% | +| BTECH_UV-25X4_G2 | [@KC9HI](https://github.com/KC9HI) | 23-Apr-2023 | Yes | | +| BTECH_UV-5001 | [@KC9HI](https://github.com/KC9HI) | 11-Nov-2022 | Yes | 0.03% | +| BTECH_UV-50X2 | [@KC9HI](https://github.com/KC9HI) | 11-Nov-2022 | Yes | 0.13% | +| BTECH_UV-50X2_G2 | [@KC9HI](https://github.com/KC9HI) | 30-Nov-2022 | Yes | 0.00% | +| BTECH_UV-50X3 | [@KC9HI](https://github.com/KC9HI) | 10-Dec-2022 | Yes | 0.06% | +| BTECH_UV-5X3 | [@KC9HI](https://github.com/KC9HI) | 9-Dec-2022 | Yes | 0.43% | +| Baofeng_BF-1901 | [@cetinajero](https://github.com/cetinajero) | 3-Jul-2023 | Yes | | +| Baofeng_BF-1904 | [@cetinajero](https://github.com/cetinajero) | 3-Jul-2023 | Yes | | +| Baofeng_BF-888 | [@kk7ds](https://github.com/kk7ds) | 13-Feb-2019 | Yes | **15.53%** | +| Baofeng_BF-A58 | [@KC9HI](https://github.com/KC9HI) | 3-Dec-2022 | Yes | **1.46%** | +| Baofeng_BF-A58S | [@KC9HI](https://github.com/KC9HI) | 3-Dec-2022 | Yes | 0.59% | +| Baofeng_BF-F8HP | [@KC9HI](https://github.com/KC9HI) | 18-Nov-2022 | Yes | **6.33%** | +| Baofeng_BF-M4 | [@cetinajero](https://github.com/cetinajero) | 8-May-2023 | Yes | | +| Baofeng_BF-T1 | [@KC9HI](https://github.com/KC9HI) | 10-Dec-2022 | Yes | 0.76% | +| Baofeng_BF-T8 | [@KC9HI](https://github.com/KC9HI) | 30-Nov-2022 | Yes | 0.42% | +| Baofeng_BF-V8A | [@KC9HI](https://github.com/KC9HI) | 28-Nov-2022 | Yes | 0.03% | +| Baofeng_F-11 | [Implied by Baofeng_UV-5R](#user-content-Baofeng_UV-5R) | 18-Nov-2022 | Yes | 0.12% | +| Baofeng_GT-3WP | [@KC9HI](https://github.com/KC9HI) | 3-Dec-2022 | Yes | 0.43% | +| Baofeng_GT-5R | [@KC9HI](https://github.com/KC9HI) | 18-Nov-2022 | Yes | 0.68% | +| Baofeng_UV-3R | [@yarda](https://github.com/yarda) | 26-Sep-2022 | Yes | 0.45% | +| Baofeng_UV-5R | [@lekv](https://github.com/lekv) | 23-Oct-2022 | Yes | **28.81%** | +| Baofeng_UV-6 | [Implied by Baofeng_UV-5R](#user-content-Baofeng_UV-5R) | 18-Nov-2022 | Yes | 0.46% | +| Baofeng_UV-6R | [@KC9HI](https://github.com/KC9HI) | 10-Dec-2022 | Yes | 0.71% | +| Baofeng_UV-82 | [@KC9HI](https://github.com/KC9HI) | 18-Nov-2022 | Yes | **8.78%** | +| Baofeng_UV-82HP | [@KC9HI](https://github.com/KC9HI) | 18-Nov-2022 | Yes | **2.38%** | +| Baofeng_UV-82WP | [@KC9HI](https://github.com/KC9HI) | 3-Dec-2022 | Yes | 0.32% | +| Baofeng_UV-9G | [@KC9HI](https://github.com/KC9HI) | 3-Dec-2022 | Yes | 0.65% | +| Baofeng_UV-9R | [@KC9HI](https://github.com/KC9HI) | 3-Dec-2022 | Yes | **2.52%** | +| Baofeng_UV-B5 | [@KC9HI](https://github.com/KC9HI) | 18-Nov-2022 | Yes | 0.35% | +| Baofeng_UV-S9X3 | [@KC9HI](https://github.com/KC9HI) | 22-Aug-2023 | Yes | | +| Baofeng_W31E | [@KC9HI](https://github.com/KC9HI) | 14-Aug-2023 | Yes | | +| Baojie_BJ-218 | [Implied by LUITON_LT-725UV](#user-content-LUITON_LT-725UV) | 16-Feb-2023 | Yes | 0.29% | +| Baojie_BJ-318 | [@KC9HI](https://github.com/KC9HI) | 2-Jan-2023 | Yes | 0.10% | +| Baojie_BJ-9900 | | | | 0.02% | +| Baojie_BJ-UV55 | | | Yes | 0.03% | +| Boblov_X3Plus | | | | 0.02% | +| CRT_Micron_UV | [Implied by Retevis_RT95](#user-content-Retevis_RT95) | 13-Nov-2022 | Yes | 0.08% | +| CRT_Micron_UV_V2 | [Implied by Retevis_RT95](#user-content-Retevis_RT95) | 13-Nov-2022 | Yes | 0.10% | +| Cignus_XTR-5 | [Implied by Radioddity_GS-5B](#user-content-Radioddity_GS-5B) | 17-Mar-2023 | Yes | | +| Commander_KG-UV | | | | 0.00% | +| Explorer_QRZ-1 | [Implied by TYT_TH-UV88](#user-content-TYT_TH-UV88) | 5-Dec-2022 | Yes | 0.04% | +| Feidaxin_FD-150A | | | | 0.02% | +| Feidaxin_FD-160A | | | | 0.01% | +| Feidaxin_FD-268A | | | | 0.01% | +| Feidaxin_FD-268B | | | | 0.01% | +| Feidaxin_FD-288A | | | | 0.01% | +| Feidaxin_FD-288B | | | | 0.01% | +| Feidaxin_FD-450A | | | | 0.01% | +| Feidaxin_FD-460A | | | | 0.01% | +| Feidaxin_FD-460UH | | | | 0.01% | +| Generic_CSV | [@kk7ds](https://github.com/kk7ds) | 4-Dec-2022 | | | +| Hiroyasu_HI-8811 | [@KC9HI](https://github.com/KC9HI) | 4-Jun-2023 | Yes | | +| HobbyPCB_RS-UV3 | [@kk7ds](https://github.com/kk7ds) | 9-Dec-2022 | Yes | 0.02% | +| Icom_IC-208H | [Probably works](https://github.com/kk7ds/chirp/blob/py3/chirp/drivers/icf.py) | 12-Dec-2022 | Yes | 0.05% | +| Icom_IC-2100H | [Probably works](https://github.com/kk7ds/chirp/blob/py3/chirp/drivers/icf.py) | 12-Dec-2022 | Yes | 0.04% | +| Icom_IC-2200H | [@kk7ds](https://github.com/kk7ds) | 24-Oct-2022 | Yes | 0.05% | +| Icom_IC-2300H | [Reported working](https://chirp.danplanet.com/issues/10264) | 13-Jan-2022 | Yes | 0.08% | +| Icom_IC-2720H | [Probably works](https://github.com/kk7ds/chirp/blob/py3/chirp/drivers/icf.py) | 12-Dec-2022 | Yes | 0.02% | +| Icom_IC-2730A | [Reported working](https://chirp.danplanet.com/issues/10261) | 17-Dec-2022 | Yes | 0.21% | +| Icom_IC-2820H | [@kk7ds](https://github.com/kk7ds) | 22-Oct-2022 | Yes | 0.04% | +| Icom_IC-7000 | [Reported working](https://chirp.danplanet.com/issues/10510) | 10-Apr-2023 | Yes | 0.03% | +| Icom_IC-7100 | Mike W | 16-Feb-2023 | Yes | 0.06% | +| Icom_IC-7200 | [@kk7ds](https://github.com/kk7ds) | 22-Oct-2022 | Yes | | +| Icom_IC-7300 | [@kk7ds](https://github.com/kk7ds) | 22-Oct-2022 | Yes | 0.03% | +| Icom_IC-746 | [Reported working](https://chirp.danplanet.com/issues/10346) | 3-Feb-2023 | Yes | | +| Icom_IC-7610 | [@kk7ds](https://github.com/kk7ds) | 24-Oct-2022 | Yes | 0.00% | +| Icom_IC-910 | [@mfncooper](https://github.com/mfncooper) | 1-Oct-2021 | Yes | 0.00% | +| Icom_IC-91_92AD | [@kk7ds](https://github.com/kk7ds) | 23-Nov-2022 | Yes | 0.03% | +| Icom_IC-E90 | [Probably works](https://github.com/kk7ds/chirp/blob/py3/chirp/drivers/icf.py) | 12-Dec-2022 | Yes | 0.04% | +| Icom_IC-P7 | [Probably works](https://github.com/kk7ds/chirp/blob/py3/chirp/drivers/icf.py) | 12-Dec-2022 | Yes | 0.01% | +| Icom_IC-Q7A | [@KC9HI](https://github.com/KC9HI) | 20-Nov-2022 | Yes | 0.01% | +| Icom_IC-T70 | [Probably works](https://github.com/kk7ds/chirp/blob/py3/chirp/drivers/icf.py) | 12-Dec-2022 | Yes | 0.03% | +| Icom_IC-T7H | [Reported working](https://chirp.danplanet.com/issues/10752) | 30-Jul-2023 | Yes | 0.02% | +| Icom_IC-T8A | [Probably works](https://github.com/kk7ds/chirp/blob/py3/chirp/drivers/icf.py) | 12-Dec-2022 | Yes | 0.01% | +| Icom_IC-U82 | [Implied by Icom_IC-V82](#user-content-Icom_IC-V82) | 25-Jan-2023 | Yes | | +| Icom_IC-V80 | [@kk7ds](https://github.com/kk7ds) | 16-Feb-2023 | Yes | 0.00% | +| Icom_IC-V82 | [@kk7ds](https://github.com/kk7ds) | 25-Jan-2023 | Yes | | +| Icom_IC-V86 | [Probably works](https://github.com/kk7ds/chirp/blob/py3/chirp/drivers/icf.py) | 12-Dec-2022 | Yes | 0.04% | +| Icom_IC-W32A | [Reported working](https://chirp.danplanet.com/issues/10238) | 12-Dec-2022 | Yes | 0.02% | +| Icom_IC-W32E | [Probably works](https://github.com/kk7ds/chirp/blob/py3/chirp/drivers/icf.py) | 12-Dec-2022 | Yes | 0.01% | +| Icom_ID-31A | [@kk7ds](https://github.com/kk7ds) | 1-Dec-2022 | Yes | 0.01% | +| Icom_ID-4100 | [@n8sqt](https://github.com/n8sqt) | 18-Dec-2022 | Yes | 0.00% | +| Icom_ID-51 | [Implied by Icom_ID-31A](#user-content-Icom_ID-31A) | 1-Dec-2022 | Yes | 0.02% | +| Icom_ID-5100 | [@kk7ds](https://github.com/kk7ds) | 17-Dec-2022 | Yes | 0.00% | +| Icom_ID-51_Plus | [Implied by Icom_ID-31A](#user-content-Icom_ID-31A) | 1-Dec-2022 | Yes | 0.02% | +| Icom_ID-51_Plus2 | [Implied by Icom_ID-31A](#user-content-Icom_ID-31A) | 17-Dec-2022 | Yes | 0.00% | +| Icom_ID-800H_v2 | [@kk7ds](https://github.com/kk7ds) | 22-Oct-2022 | Yes | 0.01% | +| Icom_ID-80H | [Probably works](https://github.com/kk7ds/chirp/blob/py3/chirp/drivers/icf.py) | 22-Oct-2022 | Yes | 0.01% | +| Icom_ID-880H | [@kk7ds](https://github.com/kk7ds) | 22-Oct-2022 | Yes | 0.02% | +| Intek_HR-2040 | [Implied by AnyTone_5888UV](#user-content-AnyTone_5888UV) | 9-Dec-2022 | Yes | 0.02% | +| Intek_KT-980HP | [Implied by Baofeng_BF-F8HP](#user-content-Baofeng_BF-F8HP) | 18-Nov-2022 | Yes | 0.04% | +| Jetstream_JT220M | [Implied by Alinco_DR235T](#user-content-Alinco_DR235T) | 12-Dec-2022 | Yes | 0.01% | +| Jetstream_JT270M | [Implied by Jetstream_JT270M](#user-content-Jetstream_JT270M) | 13-Dec-2022 | Yes | 0.01% | +| Jetstream_JT270MH | [@kk7ds](https://github.com/kk7ds) | 13-Dec-2022 | Yes | 0.01% | +| KYD_IP-620 | | | | 0.02% | +| KYD_NC-630A | | | | 0.02% | +| Kenwood_HMK | [Implied by Generic_CSV](#user-content-Generic_CSV) | 4-Dec-2022 | | 0.00% | +| Kenwood_ITM | | | | 0.00% | +| Kenwood_TH-D7 | [Probably works](https://github.com/kk7ds/chirp/blob/py3/chirp/drivers/kenwood_live.py) | 12-Dec-2022 | Yes | 0.00% | +| Kenwood_TH-D72_clone_mode | [@kk7ds](https://github.com/kk7ds) | 28-Nov-2022 | Yes | 0.02% | +| Kenwood_TH-D72_live_mode | [@kk7ds](https://github.com/kk7ds) | 21-Oct-2022 | Yes | 0.00% | +| Kenwood_TH-D74_clone_mode | [@kk7ds](https://github.com/kk7ds) | 30-Nov-2022 | Yes | 0.00% | +| Kenwood_TH-D74_live_mode | [@kk7ds](https://github.com/kk7ds) | 20-Oct-2022 | Yes | 0.00% | +| Kenwood_TH-D7G | [Probably works](https://github.com/kk7ds/chirp/blob/py3/chirp/drivers/kenwood_live.py) | 12-Dec-2022 | Yes | 0.00% | +| Kenwood_TH-F6 | [@KC9HI](https://github.com/KC9HI) | 30-Nov-2022 | Yes | 0.03% | +| Kenwood_TH-F7 | [@sv1](https://github.com/sv1) | 19-Oct-2022 | Yes | 0.03% | +| Kenwood_TH-G71 | [Probably works](https://github.com/kk7ds/chirp/blob/py3/chirp/drivers/kenwood_live.py) | 12-Dec-2022 | Yes | 0.01% | +| Kenwood_TH-K2 | [Probably works](https://github.com/kk7ds/chirp/blob/py3/chirp/drivers/kenwood_live.py) | 12-Dec-2022 | Yes | 0.00% | +| Kenwood_TK-2140K | [Implied by Kenwood_TK-3140K](#user-content-Kenwood_TK-3140K) | 2-Feb-2023 | Yes | | +| Kenwood_TK-2180 | [@kk7ds](https://github.com/kk7ds) | 4-Dec-2022 | Yes | 0.04% | +| Kenwood_TK-260 | | | | 0.02% | +| Kenwood_TK-260G | [Implied by Kenwood_TK-762G](#user-content-Kenwood_TK-762G) | 5-Dec-2022 | Yes | 0.02% | +| Kenwood_TK-270 | | | | 0.02% | +| Kenwood_TK-270G | [Implied by Kenwood_TK-762G](#user-content-Kenwood_TK-762G) | 5-Dec-2022 | Yes | 0.02% | +| Kenwood_TK-272 | | | | 0.01% | +| Kenwood_TK-272G | [Implied by Kenwood_TK-762G](#user-content-Kenwood_TK-762G) | 5-Dec-2022 | Yes | 0.02% | +| Kenwood_TK-278 | | | | 0.02% | +| Kenwood_TK-278G | [Implied by Kenwood_TK-762G](#user-content-Kenwood_TK-762G) | 5-Dec-2022 | Yes | 0.01% | +| Kenwood_TK-3140K | [@kk7ds](https://github.com/kk7ds) | 2-Feb-2023 | Yes | | +| Kenwood_TK-3140K2 | [Implied by Kenwood_TK-3140K](#user-content-Kenwood_TK-3140K) | 2-Feb-2023 | Yes | | +| Kenwood_TK-3140K3 | [Implied by Kenwood_TK-3140K](#user-content-Kenwood_TK-3140K) | 2-Feb-2023 | Yes | | +| Kenwood_TK-3180K | [@kk7ds](https://github.com/kk7ds) | 4-Dec-2022 | Yes | 0.03% | +| Kenwood_TK-3180K2 | [Implied by Kenwood_TK-3180K](#user-content-Kenwood_TK-3180K) | 4-Dec-2022 | Yes | 0.01% | +| Kenwood_TK-360 | | | | 0.02% | +| Kenwood_TK-360G | [Implied by Kenwood_TK-762G](#user-content-Kenwood_TK-762G) | 5-Dec-2022 | Yes | 0.01% | +| Kenwood_TK-370 | | | | 0.02% | +| Kenwood_TK-370G | [Implied by Kenwood_TK-762G](#user-content-Kenwood_TK-762G) | 5-Dec-2022 | Yes | 0.02% | +| Kenwood_TK-372 | | | | 0.01% | +| Kenwood_TK-372G | [Implied by Kenwood_TK-762G](#user-content-Kenwood_TK-762G) | 5-Dec-2022 | Yes | 0.01% | +| Kenwood_TK-378 | | | | 0.01% | +| Kenwood_TK-378G | [Implied by Kenwood_TK-762G](#user-content-Kenwood_TK-762G) | 5-Dec-2022 | Yes | 0.01% | +| Kenwood_TK-388G | [Implied by Kenwood_TK-762G](#user-content-Kenwood_TK-762G) | 5-Dec-2022 | Yes | 0.00% | +| Kenwood_TK-7102 | [@kk7ds](https://github.com/kk7ds) | 15-Feb-2019 | Yes | 0.02% | +| Kenwood_TK-7108 | [@kk7ds](https://github.com/kk7ds) | 15-Feb-2019 | Yes | 0.01% | +| Kenwood_TK-7160K | [@kk7ds](https://github.com/kk7ds) | 27-Jan-2023 | Yes | | +| Kenwood_TK-7160M | [Implied by Kenwood_TK-7160K](#user-content-Kenwood_TK-7160K) | 27-Jan-2023 | Yes | | +| Kenwood_TK-7180 | [@kk7ds](https://github.com/kk7ds) | 18-Oct-2022 | Yes | 0.01% | +| Kenwood_TK-7180E | [Implied by Kenwood_TK-7180](#user-content-Kenwood_TK-7180) | 18-Oct-2022 | Yes | 0.00% | +| Kenwood_TK-760 | [@kk7ds](https://github.com/kk7ds) | 5-Dec-2022 | Yes | 0.02% | +| Kenwood_TK-760G | [Implied by Kenwood_TK-762G](#user-content-Kenwood_TK-762G) | 5-Dec-2022 | Yes | 0.03% | +| Kenwood_TK-762 | [Implied by Kenwood_TK-760](#user-content-Kenwood_TK-760) | 5-Dec-2022 | Yes | 0.01% | +| Kenwood_TK-762G | [@kk7ds](https://github.com/kk7ds) | 5-Dec-2022 | Yes | 0.01% | +| Kenwood_TK-768 | [Implied by Kenwood_TK-760](#user-content-Kenwood_TK-760) | 5-Dec-2022 | Yes | 0.00% | +| Kenwood_TK-768G | [Implied by Kenwood_TK-762G](#user-content-Kenwood_TK-762G) | 5-Dec-2022 | Yes | 0.01% | +| Kenwood_TK-8102 | [@kk7ds](https://github.com/kk7ds) | 15-Feb-2019 | Yes | 0.02% | +| Kenwood_TK-8108 | [@kk7ds](https://github.com/kk7ds) | 15-Feb-2019 | Yes | 0.01% | +| Kenwood_TK-8160K | [Implied by Kenwood_TK-7160K](#user-content-Kenwood_TK-7160K) | 27-Jan-2023 | Yes | | +| Kenwood_TK-8160M | [Implied by Kenwood_TK-7160K](#user-content-Kenwood_TK-7160K) | 27-Jan-2023 | Yes | | +| Kenwood_TK-8180 | [@kk7ds](https://github.com/kk7ds) | 18-Oct-2022 | Yes | 0.02% | +| Kenwood_TK-8180E | [Implied by Kenwood_TK-8180](#user-content-Kenwood_TK-8180) | 18-Dec-2022 | Yes | 0.00% | +| Kenwood_TK-860 | [Implied by Kenwood_TK-760](#user-content-Kenwood_TK-760) | 5-Dec-2022 | Yes | 0.01% | +| Kenwood_TK-860G | [Implied by Kenwood_TK-762G](#user-content-Kenwood_TK-762G) | 5-Dec-2022 | Yes | 0.02% | +| Kenwood_TK-862 | [Implied by Kenwood_TK-760](#user-content-Kenwood_TK-760) | 5-Dec-2022 | Yes | 0.01% | +| Kenwood_TK-862G | [Implied by Kenwood_TK-762G](#user-content-Kenwood_TK-762G) | 5-Dec-2022 | Yes | 0.01% | +| Kenwood_TK-868 | [Implied by Kenwood_TK-760](#user-content-Kenwood_TK-760) | 5-Dec-2022 | Yes | 0.01% | +| Kenwood_TK-868G | [Implied by Kenwood_TK-762G](#user-content-Kenwood_TK-762G) | 5-Dec-2022 | Yes | 0.01% | +| Kenwood_TM-271 | [Implied by Kenwood_TM-281](#user-content-Kenwood_TM-281) | 23-Oct-2022 | Yes | 0.01% | +| Kenwood_TM-281 | [@kk7ds](https://github.com/kk7ds) | 23-Oct-2022 | Yes | 0.02% | +| Kenwood_TM-471 | [Probably works](https://github.com/kk7ds/chirp/blob/py3/chirp/drivers/kenwood_live.py) | 12-Dec-2022 | Yes | 0.00% | +| Kenwood_TM-D700 | [@kk7ds](https://github.com/kk7ds) | 20-Oct-2022 | Yes | 0.01% | +| Kenwood_TM-D710 | [Probably works](https://github.com/kk7ds/chirp/blob/py3/chirp/drivers/kenwood_live.py) | 22-Oct-2022 | Yes | 0.01% | +| Kenwood_TM-D710G | [@kk7ds](https://github.com/kk7ds) | 22-Oct-2022 | Yes | 0.01% | +| Kenwood_TM-D710G_CloneMode | [@kk7ds](https://github.com/kk7ds) | 22-Oct-2022 | Yes | 0.00% | +| Kenwood_TM-D710_CloneMode | | | Yes | 0.00% | +| Kenwood_TM-G707 | [Probably works](https://github.com/kk7ds/chirp/blob/py3/chirp/drivers/kenwood_live.py) | 12-Dec-2022 | Yes | 0.01% | +| Kenwood_TM-V7 | [Probably works](https://github.com/kk7ds/chirp/blob/py3/chirp/drivers/kenwood_live.py) | 12-Dec-2022 | Yes | 0.01% | +| Kenwood_TM-V71 | [@kk7ds](https://github.com/kk7ds) | 21-Oct-2022 | Yes | 0.04% | +| Kenwood_TS-2000 | ZS6CRW | 10-Jan-2022 | Yes | 0.03% | +| Kenwood_TS-480_CloneMode | | | | 0.00% | +| Kenwood_TS-480_LiveMode | | | Yes | 0.00% | +| Kenwood_TS-590SG_CloneMode | | | | 0.00% | +| Kenwood_TS-590S_CloneMode | | | | 0.00% | +| Kenwood_TS-590S_SG_LiveMode | | | Yes | 0.00% | +| Kenwood_TS-850 | | | Yes | 0.00% | +| LUITON_LT-316 | [Implied by Retevis_RT22](#user-content-Retevis_RT22) | 9-Dec-2022 | Yes | 0.04% | +| LUITON_LT-580_UHF | [@KC9HI](https://github.com/KC9HI) | 8-Dec-2022 | Yes | 0.01% | +| LUITON_LT-580_VHF | [@KC9HI](https://github.com/KC9HI) | 8-Dec-2022 | Yes | 0.01% | +| LUITON_LT-588UV | [@KC9HI](https://github.com/KC9HI) | 11-Nov-2022 | Yes | 0.01% | +| LUITON_LT-725UV | [@KC9HI](https://github.com/KC9HI) | 11-Dec-2022 | Yes | 0.02% | +| Lanchonlh_HG-UV98 | | | Yes | 0.00% | +| Leixen_VV-898 | [Implied by Jetstream_JT270MH](#user-content-Jetstream_JT270MH) | 13-Dec-2022 | Yes | 0.18% | +| Leixen_VV-898S | [@READ10](https://github.com/READ10) | 19-Dec-2022 | Yes | 0.10% | +| MTC_UV-5R-3 | [Implied by BTECH_UV-5X3](#user-content-BTECH_UV-5X3) | 9-Dec-2022 | Yes | 0.02% | +| Maverick_RA-100 | [@cetinajero](https://github.com/cetinajero) | 7-Jul-2023 | Yes | | +| Maverick_RA-425 | [@cetinajero](https://github.com/cetinajero) | 7-Jul-2023 | Yes | | +| Midland_DBR2500 | [Implied by Retevis_RT95](#user-content-Retevis_RT95) | 13-Nov-2022 | Yes | 0.05% | +| Polmar_DB-50M | [Implied by AnyTone_5888UV](#user-content-AnyTone_5888UV) | 9-Dec-2022 | Yes | 0.03% | +| Powerwerx_DB-750X | [Implied by AnyTone_5888UV](#user-content-AnyTone_5888UV) | 9-Dec-2022 | Yes | 0.01% | +| Puxing_PX-2R | | | | 0.05% | +| Puxing_PX-777 | | | Yes | 0.11% | +| Puxing_PX-888K | [Reported working](https://chirp.danplanet.com/issues/10544) | 09-May-2023 | Yes | 0.07% | +| Q-MAC_HF-90_v300_or_earlier | [@fthain](https://github.com/fthain) | 9-Mar-2023 | Yes | | +| Q-MAC_HF-90_v301_or_later | [@fthain](https://github.com/fthain) | 9-Mar-2023 | Yes | | +| QYT_KT-8R | [@KC9HI](https://github.com/KC9HI) | 11-Nov-2022 | Yes | 0.09% | +| QYT_KT-UV980 | [Implied by WACCOM_MINI-8900](#user-content-WACCOM_MINI-8900) | 11-Nov-2022 | Yes | 0.04% | +| QYT_KT-WP12 | [Implied by Anysecu_WP-9900](#user-content-Anysecu_WP-9900) | 11-Nov-2022 | Yes | 0.02% | +| QYT_KT5800 | [Implied by BTECH_UV-25X2](#user-content-BTECH_UV-25X2) | 11-Nov-2022 | Yes | 0.01% | +| QYT_KT7900D | [Implied by BTECH_UV-25X4](#user-content-BTECH_UV-25X4) | 11-Nov-2022 | Yes | 0.37% | +| QYT_KT8900 | [Implied by LUITON_LT-588UV](#user-content-LUITON_LT-588UV) | 11-Nov-2022 | Yes | 0.42% | +| QYT_KT8900D | [Implied by BTECH_UV-25X2](#user-content-BTECH_UV-25X2) | 11-Nov-2022 | Yes | 0.52% | +| QYT_KT8900R | [Implied by BTECH_UV-2501+220](#user-content-BTECH_UV-2501+220) | 11-Nov-2022 | Yes | 0.13% | +| QYT_KT980PLUS | [Implied by BTECH_UV-25X2](#user-content-BTECH_UV-25X2) | 11-Nov-2022 | Yes | 0.09% | +| Quansheng_TG-UV2+ | [Reported working](https://chirp.danplanet.com/issues/10398) | 26-Feb-2023 | Yes | 0.05% | +| Quansheng_UV-K5 | [@sq5bpf](https://github.com/sq5bpf) | 29-May-2023 | Yes | | +| RT_Systems_CSV | | | | | +| Radioddity_DB25-G | [@KC9HI](https://github.com/KC9HI) | 11-Nov-2022 | Yes | 0.17% | +| Radioddity_GA-2S | [@KC9HI](https://github.com/KC9HI) | 4-Dec-2022 | Yes | 0.19% | +| Radioddity_GA-510 | [@kk7ds](https://github.com/kk7ds) | 21-Oct-2022 | Yes | 0.42% | +| Radioddity_GS-5B | [@lunapiercook](https://github.com/lunapiercook) | 5-Mar-2023 | Yes | | +| Radioddity_R2 | [@KC9HI](https://github.com/KC9HI) | 17-Dec-2022 | Yes | 0.04% | +| Radioddity_UV-5G | [@KC9HI](https://github.com/KC9HI) | 18-Nov-2022 | Yes | 0.47% | +| Radioddity_UV-5RX3 | [@KC9HI](https://github.com/KC9HI) | 18-Nov-2022 | Yes | 0.90% | +| Radioddity_UV-82X3 | [@KC9HI](https://github.com/KC9HI) | 18-Nov-2022 | Yes | 0.05% | +| Radtel_RT-470 | [@KC9HI](https://github.com/KC9HI) | 2-Apr-2023 | Yes | 0.00% | +| Radtel_RT-470L | [@KC9HI](https://github.com/KC9HI) | 5-May-2023 | Yes | | +| Radtel_RT-470X | [@KC9HI](https://github.com/KC9HI) | 10-Aug-2023 | Yes | | +| Radtel_T18 | [@KC9HI](https://github.com/KC9HI) | 28-Nov-2022 | Yes | 0.07% | +| Retevis_H777S | [@KC9HI](https://github.com/KC9HI) | 22-Dec-2022 | Yes | | +| Retevis_H777_Plus | [@KC9HI](https://github.com/KC9HI) | 4-Dec-2022 | Yes | 0.06% | +| Retevis_RA685 | [@KC9HI](https://github.com/KC9HI) | 19-Nov-2022 | Yes | 0.25% | +| Retevis_RA85 | [@KC9HI](https://github.com/KC9HI) | 19-Nov-2022 | Yes | 0.05% | +| Retevis_RB15 | [@KC9HI](https://github.com/KC9HI) | 18-Dec-2022 | Yes | 0.01% | +| Retevis_RB17 | [@KC9HI](https://github.com/KC9HI) | 28-Nov-2022 | Yes | 0.02% | +| Retevis_RB17A | [@KC9HI](https://github.com/KC9HI) | 30-Nov-2022 | Yes | 0.01% | +| Retevis_RB17P | [@KC9HI](https://github.com/KC9HI) | 18-Dec-2022 | Yes | 0.02% | +| Retevis_RB17V | [@KC9HI](https://github.com/KC9HI) | 28-Nov-2022 | Yes | 0.01% | +| Retevis_RB18 | [@KC9HI](https://github.com/KC9HI) | 28-Nov-2022 | Yes | 0.04% | +| Retevis_RB19 | [@KC9HI](https://github.com/KC9HI) | 28-Nov-2022 | Yes | 0.00% | +| Retevis_RB19P | [@KC9HI](https://github.com/KC9HI) | 28-Nov-2022 | Yes | 0.01% | +| Retevis_RB23 | [@KC9HI](https://github.com/KC9HI) | 30-Nov-2022 | Yes | 0.00% | +| Retevis_RB26 | [@KC9HI](https://github.com/KC9HI) | 30-Nov-2022 | Yes | 0.04% | +| Retevis_RB27 | [@KC9HI](https://github.com/KC9HI) | 30-Nov-2022 | Yes | 0.09% | +| Retevis_RB27B | [@KC9HI](https://github.com/KC9HI) | 30-Nov-2022 | Yes | 0.02% | +| Retevis_RB27V | [@KC9HI](https://github.com/KC9HI) | 30-Nov-2022 | Yes | 0.01% | +| Retevis_RB28 | [@KC9HI](https://github.com/KC9HI) | 9-Feb-2023 | Yes | 0.00% | +| Retevis_RB28B | [@KC9HI](https://github.com/KC9HI) | 27-Jan-2023 | Yes | | +| Retevis_RB29 | [@KC9HI](https://github.com/KC9HI) | 24-Dec-2022 | Yes | 0.00% | +| Retevis_RB615 | [@KC9HI](https://github.com/KC9HI) | 18-Dec-2022 | Yes | 0.01% | +| Retevis_RB617 | [@KC9HI](https://github.com/KC9HI) | 28-Nov-2022 | Yes | 0.02% | +| Retevis_RB618 | [@KC9HI](https://github.com/KC9HI) | 28-Nov-2022 | Yes | 0.16% | +| Retevis_RB619 | [@KC9HI](https://github.com/KC9HI) | 28-Nov-2022 | Yes | 0.01% | +| Retevis_RB627B | [@KC9HI](https://github.com/KC9HI) | 30-Nov-2022 | Yes | 0.05% | +| Retevis_RB628 | [@KC9HI](https://github.com/KC9HI) | 10-Feb-2023 | Yes | | +| Retevis_RB628B | [@KC9HI](https://github.com/KC9HI) | 28-Jan-2023 | Yes | | +| Retevis_RB629 | [@KC9HI](https://github.com/KC9HI) | 24-Dec-2022 | Yes | 0.00% | +| Retevis_RB75 | [@KC9HI](https://github.com/KC9HI) | 28-Nov-2022 | Yes | 0.02% | +| Retevis_RB85 | [@KC9HI](https://github.com/KC9HI) | 28-Nov-2022 | Yes | 0.02% | +| Retevis_RB87 | [@KC9HI](https://github.com/KC9HI) | 10-Mar-2023 | Yes | | +| Retevis_RT1 | [@KC9HI](https://github.com/KC9HI) | 11-Dec-2022 | Yes | 0.08% | +| Retevis_RT15 | [@KC9HI](https://github.com/KC9HI) | 18-Feb-2023 | Yes | 0.00% | +| Retevis_RT16 | [@KC9HI](https://github.com/KC9HI) | 30-Nov-2022 | Yes | 0.02% | +| Retevis_RT19 | [@KC9HI](https://github.com/KC9HI) | 30-Nov-2022 | Yes | 0.00% | +| Retevis_RT20 | [@k9ps-paul](https://github.com/k9ps-paul) | 7-Sep-2023 | Yes | | +| Retevis_RT21 | [@KC9HI](https://github.com/KC9HI) | 30-Nov-2022 | Yes | 0.20% | +| Retevis_RT21V | [@KC9HI](https://github.com/KC9HI) | 24-Jul-2023 | Yes | 0.00% | +| Retevis_RT22 | [@KC9HI](https://github.com/KC9HI) | 9-Dec-2022 | Yes | 0.53% | +| Retevis_RT22FRS | [@KC9HI](https://github.com/KC9HI) | 9-Dec-2022 | Yes | 0.04% | +| Retevis_RT22S | [@KC9HI](https://github.com/KC9HI) | 28-Nov-2022 | Yes | 0.04% | +| Retevis_RT23 | [@KC9HI](https://github.com/KC9HI) | 17-Dec-2022 | Yes | 0.04% | +| Retevis_RT24 | [@KC9HI](https://github.com/KC9HI) | 22-Dec-2022 | Yes | 0.31% | +| Retevis_RT24V | [@KC9HI](https://github.com/KC9HI) | 27-Aug-2023 | Yes | | +| Retevis_RT26 | [@KC9HI](https://github.com/KC9HI) | 17-Dec-2022 | Yes | 0.03% | +| Retevis_RT29_UHF | [@KC9HI](https://github.com/KC9HI) | 30-Nov-2022 | Yes | 0.03% | +| Retevis_RT29_VHF | [@KC9HI](https://github.com/KC9HI) | 30-Nov-2022 | Yes | 0.02% | +| Retevis_RT40B | [@KC9HI](https://github.com/KC9HI) | 30-Nov-2022 | Yes | 0.00% | +| Retevis_RT47 | [@KC9HI](https://github.com/KC9HI) | 28-Nov-2022 | Yes | 0.00% | +| Retevis_RT47V | [@KC9HI](https://github.com/KC9HI) | 28-Nov-2022 | Yes | 0.00% | +| Retevis_RT6 | [@KC9HI](https://github.com/KC9HI) | 3-Dec-2022 | Yes | 0.04% | +| Retevis_RT619 | [@KC9HI](https://github.com/KC9HI) | 30-Nov-2022 | Yes | 0.00% | +| Retevis_RT622 | [@KC9HI](https://github.com/KC9HI) | 9-Dec-2022 | Yes | 0.09% | +| Retevis_RT647 | [@KC9HI](https://github.com/KC9HI) | 28-Nov-2022 | Yes | 0.00% | +| Retevis_RT668 | [@KC9HI](https://github.com/KC9HI) | 28-Nov-2022 | Yes | 0.03% | +| Retevis_RT68 | [@KC9HI](https://github.com/KC9HI) | 28-Nov-2022 | Yes | 0.03% | +| Retevis_RT76 | [@KC9HI](https://github.com/KC9HI) | 30-Nov-2022 | Yes | 0.02% | +| Retevis_RT76P | [@KC9HI](https://github.com/KC9HI) | 17-Dec-2022 | Yes | 0.04% | +| Retevis_RT85 | [@KC9HI](https://github.com/KC9HI) | 5-Dec-2022 | Yes | 0.22% | +| Retevis_RT86 | [@KC9HI](https://github.com/KC9HI) | 17-Feb-2023 | Yes | | +| Retevis_RT87 | [@KC9HI](https://github.com/KC9HI) | 17-Dec-2022 | Yes | 0.03% | +| Retevis_RT9000D_136-174 | [@KC9HI](https://github.com/KC9HI) | 8-Dec-2022 | Yes | 0.01% | +| Retevis_RT9000D_220-260 | [@KC9HI](https://github.com/KC9HI) | 8-Dec-2022 | Yes | 0.01% | +| Retevis_RT9000D_400-490 | [@KC9HI](https://github.com/KC9HI) | 8-Dec-2022 | Yes | 0.01% | +| Retevis_RT9000D_66-88 | [@KC9HI](https://github.com/KC9HI) | 8-Dec-2022 | Yes | 0.00% | +| Retevis_RT95 | [@KC9HI](https://github.com/KC9HI) | 13-Nov-2022 | Yes | 0.08% | +| Retevis_RT95_VOX | [Implied by Retevis_RT95](#user-content-Retevis_RT95) | 13-Nov-2022 | Yes | 0.15% | +| Retevis_RT98 | [@KC9HI](https://github.com/KC9HI) | 14-Dec-2022 | Yes | 0.05% | +| Rugged_RH5R-V2 | | | | 0.05% | +| Ruyage_UV58Plus | [@KC9HI](https://github.com/KC9HI) | 18-Mar-2023 | Yes | | +| Sainsonic_AP510 | | | | 0.00% | +| SenhaiX_8800 | [Implied by Radioddity_GS-5B](#user-content-Radioddity_GS-5B) | 17-Mar-2023 | Yes | | +| TDXone_TD-Q8A | [@KC9HI](https://github.com/KC9HI) | 18-Dec-2022 | | 0.02% | +| TIDRADIO_TD-H6 | [@kk7ds](https://github.com/kk7ds) | 21-Oct-2022 | Yes | 0.43% | +| TIDRADIO_TD-H8 | [@Sandmann34](https://github.com/Sandmann34) | 7-Feb-2023 | Yes | | +| TIDRADIO_TD-H8-GMRS | [@Sandmann34](https://github.com/Sandmann34) | 7-Feb-2023 | Yes | | +| TIDRADIO_TD-H8-HAM | [@Sandmann34](https://github.com/Sandmann34) | 7-Feb-2023 | Yes | | +| TID_TD-M8 | [Implied by Retevis_RT22](#user-content-Retevis_RT22) | 9-Dec-2022 | Yes | 0.04% | +| TID_TD-UV68 | [@Sandmann34](https://github.com/Sandmann34) | 7-Feb-2023 | Yes | | +| TYT_TH-350 | | | Yes | 0.07% | +| TYT_TH-7800 | [Reported working](https://chirp.danplanet.com/issues/10585) | 4-Jul-2023 | Yes | 0.13% | +| TYT_TH-7800_File | | | | 0.00% | +| TYT_TH-9800 | [Reported working](https://chirp.danplanet.com/issues/10755) | 30-Jul-2023 | Yes | 0.65% | +| TYT_TH-9800_File | | | Yes | 0.00% | +| TYT_TH-UV3R | | | Yes | 0.04% | +| TYT_TH-UV3R-25 | | | Yes | 0.02% | +| TYT_TH-UV8000 | [@KC9HI](https://github.com/KC9HI) | 6-Jan-2023 | Yes | 0.31% | +| TYT_TH-UV88 | [@KC9HI](https://github.com/KC9HI) | 5-Dec-2022 | Yes | 0.51% | +| TYT_TH-UVF1 | [@kk7ds](https://github.com/kk7ds) | 13-Dec-2022 | Yes | 0.06% | +| TYT_TH-UVF8D | [@MELERIX](https://github.com/MELERIX) | 2-Feb-2023 | Yes | 0.05% | +| TYT_TH9000_144 | [Implied by Retevis_RT9000D_136-174](#user-content-Retevis_RT9000D_136-174) | 8-Dec-2022 | Yes | 0.06% | +| TYT_TH9000_220 | [Implied by Retevis_RT9000D_220-260](#user-content-Retevis_RT9000D_220-260) | 8-Dec-2022 | Yes | 0.04% | +| TYT_TH9000_440 | [Implied by Retevis_RT9000D_400-490](#user-content-Retevis_RT9000D_400-490) | 8-Dec-2022 | Yes | 0.04% | +| Talkpod_A36plus | [@KC9HI](https://github.com/KC9HI) | 12-Jun-2023 | Yes | | +| Vertex_Standard_FTL-1011 | | | | 0.02% | +| Vertex_Standard_FTL-2011 | | | | 0.05% | +| Vertex_Standard_FTL-7011 | | | | 0.03% | +| Vertex_Standard_FTL-8011 | | | | 0.01% | +| Vertex_Standard_VXA-700 | | | | 0.02% | +| WACCOM_MINI-8900 | [@KC9HI](https://github.com/KC9HI) | 11-Nov-2022 | Yes | 0.12% | +| WLN_KD-C1 | [Implied by Retevis_RT22](#user-content-Retevis_RT22) | 9-Dec-2022 | Yes | **1.73%** | +| Wouxun_KG-1000G | [@mrtjr1](https://github.com/mrtjr1) | 23-jan-2023 | Yes | | +| Wouxun_KG-1000G_Plus | [@mrtjr1](https://github.com/mrtjr1) | 23-jan-2023 | Yes | 0.00% | +| Wouxun_KG-816 | [Implied by Wouxun_KG-UV6](#user-content-Wouxun_KG-UV6) | 11-Dec-2022 | Yes | 0.07% | +| Wouxun_KG-818 | [Implied by Wouxun_KG-UV6](#user-content-Wouxun_KG-UV6) | 11-Dec-2022 | Yes | 0.04% | +| Wouxun_KG-935G | [@mrtjr1](https://github.com/mrtjr1) | 4-Jan-2022 | Yes | 0.05% | +| Wouxun_KG-935G_Plus | [@mrtjr1](https://github.com/mrtjr1) | 7-Feb-2023 | Yes | | +| Wouxun_KG-UV6 | [@KC9HI](https://github.com/KC9HI) | 11-Dec-2022 | Yes | 0.19% | +| Wouxun_KG-UV8D | Unit tested; needs confirm | 24-Dec-2022 | Yes | 0.24% | +| Wouxun_KG-UV8D_Plus | Unit tested; needs confirm | 2-Jan-2022 | Yes | 0.08% | +| Wouxun_KG-UV8E | W5EGL | 2-Jan-2022 | Yes | 0.05% | +| Wouxun_KG-UV8H | [@mrtjr1](https://github.com/mrtjr1) | 27-Mar-2023 | Yes | 0.01% | +| Wouxun_KG-UV920P-A | [@KC9HI](https://github.com/KC9HI) | 22-Dec-2022 | Yes | 0.04% | +| Wouxun_KG-UV980P | [@mrtjr1](https://github.com/mrtjr1) | 23-jan-2023 | Yes | 0.01% | +| Wouxun_KG-UV9D_Plus | [@samwich](https://github.com/samwich) | 10-Jan-2023 | Yes | 0.39% | +| Wouxun_KG-UV9GX | [@mrtjr1](https://github.com/mrtjr1) | 27-Mar-2023 | Yes | | +| Wouxun_KG-UV9G_Pro | [@mrtjr1](https://github.com/mrtjr1) | 25-Apr-2023 | Yes | | +| Wouxun_KG-UV9K | [@mrtjr1](https://github.com/mrtjr1) | 14-Apr-2023 | Yes | | +| Wouxun_KG-UV9PX | [@mrtjr1](https://github.com/mrtjr1) | 20-Jan-2022 | Yes | | +| Wouxun_KG-UVD1P | [Implied by Wouxun_KG-UV6](#user-content-Wouxun_KG-UV6) | 11-Dec-2022 | Yes | 0.35% | +| Yaesu_FT-1500M | [@f3sty](https://github.com/f3sty) | 05-Dec-2022 | Yes | 0.02% | +| Yaesu_FT-1802M | | | Yes | 0.02% | +| Yaesu_FT-1D_R | [Implied by Yaesu_FT3D_R](#user-content-Yaesu_FT3D_R) | 30-Dec-2022 | Yes | 0.03% | +| Yaesu_FT-25R | [Implied by Yaesu_FT-4XE](#user-content-Yaesu_FT-4XE) | 24-Dec-2022 | Yes | 0.01% | +| Yaesu_FT-2800M | [Reported working](https://chirp.danplanet.com/issues/10616) | 05-Jun-2023 | Yes | 0.03% | +| Yaesu_FT-2900R_1900R | [Reported working](https://chirp.danplanet.com/issues/10274) | 14-Jan-2023 | Yes | 0.05% | +| Yaesu_FT-2900R_1900RTXMod_Opened_Xmit | [Implied by Yaesu_FT-2900R_1900R](#user-content-Yaesu_FT-2900R_1900R) | 14-Jan-2023 | Yes | | +| Yaesu_FT-450D | [@Old-Phart](https://github.com/Old-Phart) | 01-Jun-2023 | Yes | 0.01% | +| Yaesu_FT-4VR | [Implied by Yaesu_FT-4XE](#user-content-Yaesu_FT-4XE) | 24-Dec-2022 | Yes | 0.01% | +| Yaesu_FT-4XE | Unit tested; needs confirm | 24-Dec-2022 | Yes | 0.14% | +| Yaesu_FT-4XR | [Implied by Yaesu_FT-4XE](#user-content-Yaesu_FT-4XE) | 24-Dec-2022 | Yes | 0.11% | +| Yaesu_FT-50 | [Reported working](https://chirp.danplanet.com/issues/10824) | 5-Sep-2023 | Yes | 0.04% | +| Yaesu_FT-60 | N0EYE | 9-Jan-2023 | Yes | 0.49% | +| Yaesu_FT-65E | [@kwirk](https://github.com/kwirk) | 27-Jan-2023 | Yes | 0.08% | +| Yaesu_FT-65R | [Reported working](https://chirp.danplanet.com/issues/10266) | 13-Jan-2022 | Yes | 0.18% | +| Yaesu_FT-70D | [@n8sqt](https://github.com/n8sqt) | 05-Dec-2022 | Yes | 0.27% | +| Yaesu_FT-7100M | | | Yes | 0.03% | +| Yaesu_FT-7800_7900 | [@kk7ds](https://github.com/kk7ds) | 24-Oct-2022 | Yes | 0.14% | +| Yaesu_FT-8100 | | | Yes | 0.01% | +| Yaesu_FT-817 | [@kk7ds](https://github.com/kk7ds) | 14-Feb-2019 | Yes | 0.04% | +| Yaesu_FT-817ND | [Implied by Yaesu_FT-817](#user-content-Yaesu_FT-817) | 14-Feb-2019 | Yes | 0.07% | +| Yaesu_FT-817ND_US | [Implied by Yaesu_FT-817](#user-content-Yaesu_FT-817) | 14-Feb-2019 | Yes | 0.02% | +| Yaesu_FT-818 | [@thomasrussellmurphy](https://github.com/thomasrussellmurphy) | 4-Feb-2023 | Yes | 0.05% | +| Yaesu_FT-818ND_US | [Implied by Yaesu_FT-817](#user-content-Yaesu_FT-817) | 14-Feb-2019 | Yes | 0.02% | +| Yaesu_FT-857_897 | [Implied by Yaesu_FT-817](#user-content-Yaesu_FT-817) | 14-Feb-2019 | Yes | 0.25% | +| Yaesu_FT-857_897_US | [Implied by Yaesu_FT-817](#user-content-Yaesu_FT-817) | 14-Feb-2019 | Yes | 0.08% | +| Yaesu_FT-8800 | [@kk7ds](https://github.com/kk7ds) | 24-Oct-2022 | Yes | 0.08% | +| Yaesu_FT-8900 | [Reported working](https://chirp.danplanet.com/issues/10753) | 30-Jul-2023 | Yes | 0.11% | +| Yaesu_FT-90 | [Reported working](https://chirp.danplanet.com/issues/10386) | 22-Feb-2023 | Yes | 0.02% | +| Yaesu_FT2D_R | [Implied by Yaesu_FT3D_R](#user-content-Yaesu_FT3D_R) | 30-Dec-2022 | Yes | 0.02% | +| Yaesu_FT2D_Rv2 | [Implied by Yaesu_FT3D_R](#user-content-Yaesu_FT3D_R) | 30-Dec-2022 | Yes | | +| Yaesu_FT3D_R | [@kk7ds](https://github.com/kk7ds) | 30-Dec-2022 | Yes | 0.03% | +| Yaesu_FTM-3200D_R | | | Yes | 0.02% | +| Yaesu_FTM-350 | [@kk7ds](https://github.com/kk7ds) | 4-Dec-2022 | Yes | 0.02% | +| Yaesu_FTM-7250D_R | | | Yes | 0.04% | +| Yaesu_VX-170 | | | Yes | 0.03% | +| Yaesu_VX-2 | [@thomasrussellmurphy](https://github.com/thomasrussellmurphy) | 20-Jan-2023 | Yes | 0.04% | +| Yaesu_VX-3 | [@kk7ds](https://github.com/kk7ds) | 15-Feb-2019 | Yes | 0.08% | +| Yaesu_VX-5 | [Probably works](https://github.com/kk7ds/chirp/blob/py3/chirp/drivers/yaesu_clone.py) | 12-Dec-2022 | Yes | 0.07% | +| Yaesu_VX-6 | [@dominickpastore](https://github.com/dominickpastore) | 10-Dec-2022 | Yes | 0.16% | +| Yaesu_VX-7 | [@kk7ds](https://github.com/kk7ds) | 15-Feb-2019 | Yes | 0.09% | +| Yaesu_VX-8DR | [@kk7ds](https://github.com/kk7ds) | 15-Feb-2019 | Yes | 0.03% | +| Yaesu_VX-8GE | [Implied by Yaesu_VX-8DR](#user-content-Yaesu_VX-8DR) | 15-Feb-2019 | Yes | 0.01% | +| Yaesu_VX-8R | [Implied by Yaesu_VX-8DR](#user-content-Yaesu_VX-8DR) | 15-Feb-2019 | Yes | 0.03% | +| Yedro_YC-M04VUS | [Implied by Retevis_RT95](#user-content-Retevis_RT95) | 13-Nov-2022 | Yes | 0.02% | +| Zastone_ZT-X6 | [Implied by Retevis_RT22](#user-content-Retevis_RT22) | 9-Dec-2022 | Yes | 0.11% | ## Stats -**Drivers:** 329 +**Drivers:** 420 -**Tested:** 10% (35/294) +**Tested:** 87% (366/54) (93% of usage stats) -**Byte clean:** 45% (151/178) +**Byte clean:** 90% (380/40) + +## Meaning of this testing + +The goal here is not necessarily to test the drivers themselves in terms of +actual functionality, but rather to validate the Python 3 conversion +work required of nearly all drivers. Thus, we are not trying to +comprehensively test these models so much as make sure they work at least +as well as they do on the Python 2 branch. Uncovering and reporting new +bugs is definitely welcome, but for the purpoes of this effort, "no worse +than the legacy branch" is good enough. There are multiple levels of +confirmation in the matrix above: +* Tested with real hardware (i.e. a person listed in the "Tester" column) + using roughly the procedure below. +* An "implied by (model)" link means that another model was tested, and it + is so similar, that the model on that line can be considered tested as + well. +* A "probably works" link means that the driver has not been tested with + real hardware, nor is it substantially similar to another model, but + shares a common base that entirely provides the cloning routines with + other drivers that have been tested with real hardware, such that + confidence is high that it will work. Only drivers with test images in + the tree (or live drivers) should be marked with this class. +* A "unit tested" link means that the driver has not been tested with + real hardware, nor does it share common cloning routines with another + radio. However, synthetic simulation tests have been added to exercise + the parts of the cloning routines that are likely to fail under python3. + This is the lowest-confidence status and a real confirmation is needed. + +If you have a model listed in this matrix with either "implied" or +"probably works" status, an actual confirmation with real hardware is +welcome and can replace the weaker reference. + +## Minimal test procedure +For the purposes of the Python 3 effort, a "tested" radio means +at least the following procedure was followed: +1. Download from the radio +1. Make some change to a memory +1. If the radio has settings support, make sure settings load and tweak + one setting +1. Upload to the radio +1. Confirm that the changes stick and look correct, or at least are not a + regression from the master py2 branch. + +The drivers are all passing the automated tests, but tests with real +hardware and serial ports is important, especially around bytes-vs-string +safety. + +To update this document, add/edit entries in `tests/py3_driver_testers.txt` +and then run `tox -e makesupported`. Commit the result (including the +changes to this `.md` file) and submit a PR. + +The "Byte Clean" flag refers to whether or not the radio has set the +`NEEDS_COMPAT_SERIAL = False` flag on the radio class, and thus uses +`MemoryMapBytes` exclusively internally. Whenever possible, all radios +that are fixed for py3 should do so with this flag set to False and with +the byte-native memory map. diff --git a/tests/__init__.py b/tests/__init__.py index 7fc393e..7640296 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -1,40 +1,22 @@ -import functools import glob import logging import os -import re -import shutil -import sys -import tempfile import unittest import pytest -import six from chirp import directory -from tests import run_tests - +from tests import test_banks +from tests import test_brute_force +from tests import test_clone +from tests import test_copy_all +from tests import test_detect +from tests import test_edges +from tests import test_features +from tests import test_settings LOG = logging.getLogger('testadapter') -PY3_XFAIL = [] - - -def if_enabled(fn): - name = fn.__name__.replace('test_', '') - if 'CHIRP_TESTS' in os.environ: - tests_enabled = os.environ['CHIRP_TESTS'].split(',') - enabled = name in tests_enabled - else: - enabled = True - - def wrapper(*a, **k): - if enabled: - return fn(*a, **k) - else: - raise unittest.SkipTest('%s not enabled' % name) - - return wrapper class TestAdapterMeta(type): @@ -42,101 +24,10 @@ class TestAdapterMeta(type): return super(TestAdapterMeta, cls).__new__(cls, name, parents, dct) -class TestAdapter(unittest.TestCase): - RADIO_CLASS = None - SOURCE_IMAGE = None - RADIO_INST = None - testwrapper = None - XFAIL = False - - def shortDescription(self): - test = self.id().split('.')[-1].replace('test_', '').replace('_', ' ') - return 'Testing %s %s' % (self.RADIO_CLASS.get_name(), test) - - @classmethod - def setUpClass(cls): - if not cls.testwrapper: - # Initialize the radio once per class invocation to save - # bitwise parse time - # Do this for things like Generic_CSV, that demand it - _base, ext = os.path.splitext(cls.SOURCE_IMAGE) - cls.testimage = tempfile.mktemp(ext) - shutil.copy(cls.SOURCE_IMAGE, cls.testimage) - cls.testwrapper = run_tests.TestWrapper(cls.RADIO_CLASS, - cls.testimage) - - @classmethod - def tearDownClass(cls): - os.remove(cls.testimage) - - def setUp(self): - self._out = run_tests.TestOutputANSI() - rid = "%s_%s_" % (self.RADIO_CLASS.VENDOR, self.RADIO_CLASS.MODEL) - rid = rid.replace("/", "_") - basefn, ext = os.path.splitext(self.testimage) - self.testimage = tempfile.mktemp('.%s' % ext, rid) - shutil.copy(self.SOURCE_IMAGE, self.testimage) - - def tearDown(self): - os.remove(self.testimage) - - def _runtest(self, test): - tw = run_tests.TestWrapper(self.RADIO_CLASS, - self.testimage, - dst=self.RADIO_INST) - testcase = test(tw) - testcase.prepare() - try: - failures = testcase.run() - if failures: - raise failures[0] - except run_tests.TestCrashError as e: - raise e.get_original_exception() - except run_tests.TestSkippedError as e: - raise unittest.SkipTest(str(e)) - finally: - testcase.cleanup() - - @if_enabled - def test_copy_all(self): - self._runtest(run_tests.TestCaseCopyAll) - - @if_enabled - def test_brute_force(self): - self._runtest(run_tests.TestCaseBruteForce) - - @if_enabled - def test_edges(self): - self._runtest(run_tests.TestCaseEdges) - - @if_enabled - def test_settings(self): - self._runtest(run_tests.TestCaseSettings) - - @if_enabled - def test_banks(self): - self._runtest(run_tests.TestCaseBanks) - - @if_enabled - def test_detect(self): - self._runtest(run_tests.TestCaseDetect) - - @if_enabled - def test_clone(self): - self._runtest(run_tests.TestCaseClone) - - def test_py3_expected(self): - assert self.SOURCE_IMAGE not in PY3_XFAIL - - def _get_sub_devices(rclass, testimage): try: - tw = run_tests.TestWrapper(rclass, None) - except Exception as e: - tw = run_tests.TestWrapper(rclass, testimage) - - try: - rf = tw.do("get_features") + radio = rclass(None) + rf = radio.get_features() except Exception as e: print('Failed to get features for %s: %s' % (rclass, e)) # FIXME: If the driver fails to run get_features with no memobj @@ -145,23 +36,14 @@ def _get_sub_devices(rclass, testimage): # out, but until then, assume crash means "no sub devices". return [rclass] if rf.has_sub_devices: - return tw.do("get_sub_devices") + # Radios with sub-devices may need to look at the image to determine + # what those are. That's slow, so only do it for these. + radio = rclass(testimage) + return radio.get_sub_devices() else: return [rclass] -class TestAdapterXFAIL(TestAdapter): - @pytest.mark.xfail(reason=('Driver not expected to run in python3. ' - 'Remove from py3_remaining.txt'), strict=True) - def test_py3_expected(self): - pass - - -class RadioSkipper(unittest.TestCase): - def test_is_supported_by_environment(self): - raise unittest.SkipTest('Running in py3 and driver is not supported') - - def _load_tests(loader, tests, pattern, suite=None): if not suite: suite = unittest.TestSuite() @@ -181,57 +63,36 @@ def _load_tests(loader, tests, pattern, suite=None): # This default is meaningless for us pattern = None - py3_remaining = [x.strip() for x in open(os.path.join( - base, '..', 'py3_remaining.txt')).readlines() - if not x.startswith('#')] + driver_test_cases = (test_edges.TestCaseEdges, + test_brute_force.TestCaseBruteForce, + test_banks.TestCaseBanks, + test_detect.TestCaseDetect, + test_clone.TestCaseClone, + test_settings.TestCaseSettings, + test_features.TestCaseFeatures, + test_copy_all.TestCaseCopyAll) for image, test in tests.items(): - try: - rclass = directory.get_radio(test) - if os.path.basename(image) in py3_remaining: - PY3_XFAIL.append(image) - - except Exception: - if not six.PY3: - raise - - if 'CHIRP_DEBUG' in os.environ: - LOG.error('Failed to load %s' % test) - - if os.path.basename(image) in py3_remaining: - # We expect this to fail to import in py3, so do not - # abort the test run. - continue - print('%s not in py3 exclusion list %s...' % ( - os.path.basename(image), ','.join(py3_remaining))) - raise - for device in _get_sub_devices(rclass, image): - class_name = 'TestCase_%s' % ( - ''.join(filter(lambda c: c.isalnum(), - device.get_name()))) - if isinstance(device, type): - dst = None - else: - dst = device + rclass = directory.get_radio(test) + if hasattr(rclass, '_orig_rclass'): + rclass = rclass._orig_rclass + module = rclass.__module__.split('.')[-1] + subdevs = _get_sub_devices(rclass, image) + has_subdevs = subdevs != [rclass] + for index, device in enumerate(subdevs): + if not isinstance(device, type): device = device.__class__ - - if image in PY3_XFAIL: - cls = TestAdapterXFAIL - else: - cls = TestAdapter - - tc = TestAdapterMeta( - class_name, (cls,), dict(RADIO_CLASS=device, - SOURCE_IMAGE=image, - RADIO_INST=dst)) - tests = loader.loadTestsFromTestCase(tc) - - if pattern: - tests = [t for t in tests - if re.search(pattern, '%s.%s' % (class_name, - t._testMethodName))] - - suite.addTests(tests) + for case in driver_test_cases: + tc = TestAdapterMeta( + "%s_%s" % (case.__name__, + directory.radio_class_id(device)), + (case,), + {'RADIO_CLASS': rclass, + 'SUB_DEVICE': index if has_subdevs else None, + 'TEST_IMAGE': image}) + + tc = getattr(pytest.mark, module)(tc) + suite.addTests(loader.loadTestsFromTestCase(tc)) return suite diff --git a/tests/__pycache__/__init__.cpython-310.pyc b/tests/__pycache__/__init__.cpython-310.pyc new file mode 100644 index 0000000..81ff5ea Binary files /dev/null and b/tests/__pycache__/__init__.cpython-310.pyc differ diff --git a/tests/__pycache__/base.cpython-310.pyc b/tests/__pycache__/base.cpython-310.pyc new file mode 100644 index 0000000..2e34e7f Binary files /dev/null and b/tests/__pycache__/base.cpython-310.pyc differ diff --git a/tests/__pycache__/icom_clone_simulator.cpython-310.pyc b/tests/__pycache__/icom_clone_simulator.cpython-310.pyc new file mode 100644 index 0000000..576440d Binary files /dev/null and b/tests/__pycache__/icom_clone_simulator.cpython-310.pyc differ diff --git a/tests/__pycache__/test_banks.cpython-310-pytest-7.1.3.pyc b/tests/__pycache__/test_banks.cpython-310-pytest-7.1.3.pyc new file mode 100644 index 0000000..2128a35 Binary files /dev/null and b/tests/__pycache__/test_banks.cpython-310-pytest-7.1.3.pyc differ diff --git a/tests/__pycache__/test_brute_force.cpython-310-pytest-7.1.3.pyc b/tests/__pycache__/test_brute_force.cpython-310-pytest-7.1.3.pyc new file mode 100644 index 0000000..31b7705 Binary files /dev/null and b/tests/__pycache__/test_brute_force.cpython-310-pytest-7.1.3.pyc differ diff --git a/tests/__pycache__/test_clone.cpython-310-pytest-7.1.3.pyc b/tests/__pycache__/test_clone.cpython-310-pytest-7.1.3.pyc new file mode 100644 index 0000000..8e5e0bb Binary files /dev/null and b/tests/__pycache__/test_clone.cpython-310-pytest-7.1.3.pyc differ diff --git a/tests/__pycache__/test_copy_all.cpython-310-pytest-7.1.3.pyc b/tests/__pycache__/test_copy_all.cpython-310-pytest-7.1.3.pyc new file mode 100644 index 0000000..e02c608 Binary files /dev/null and b/tests/__pycache__/test_copy_all.cpython-310-pytest-7.1.3.pyc differ diff --git a/tests/__pycache__/test_detect.cpython-310-pytest-7.1.3.pyc b/tests/__pycache__/test_detect.cpython-310-pytest-7.1.3.pyc new file mode 100644 index 0000000..76b5d2a Binary files /dev/null and b/tests/__pycache__/test_detect.cpython-310-pytest-7.1.3.pyc differ diff --git a/tests/__pycache__/test_drivers.cpython-310-pytest-7.1.3.pyc b/tests/__pycache__/test_drivers.cpython-310-pytest-7.1.3.pyc new file mode 100644 index 0000000..e880477 Binary files /dev/null and b/tests/__pycache__/test_drivers.cpython-310-pytest-7.1.3.pyc differ diff --git a/tests/__pycache__/test_edges.cpython-310-pytest-7.1.3.pyc b/tests/__pycache__/test_edges.cpython-310-pytest-7.1.3.pyc new file mode 100644 index 0000000..e98e401 Binary files /dev/null and b/tests/__pycache__/test_edges.cpython-310-pytest-7.1.3.pyc differ diff --git a/tests/__pycache__/test_features.cpython-310-pytest-7.1.3.pyc b/tests/__pycache__/test_features.cpython-310-pytest-7.1.3.pyc new file mode 100644 index 0000000..27acc5e Binary files /dev/null and b/tests/__pycache__/test_features.cpython-310-pytest-7.1.3.pyc differ diff --git a/tests/__pycache__/test_settings.cpython-310-pytest-7.1.3.pyc b/tests/__pycache__/test_settings.cpython-310-pytest-7.1.3.pyc new file mode 100644 index 0000000..65c8050 Binary files /dev/null and b/tests/__pycache__/test_settings.cpython-310-pytest-7.1.3.pyc differ diff --git a/tests/base.py b/tests/base.py new file mode 100644 index 0000000..0f69e67 --- /dev/null +++ b/tests/base.py @@ -0,0 +1,193 @@ +import functools +import logging +import unittest + +from chirp import chirp_common +from chirp import bandplan_na + +LOG = logging.getLogger(__name__) + + +class DriverTest(unittest.TestCase): + RADIO_CLASS = None + SUB_DEVICE = None + TEST_IMAGE = None + + def setUp(self): + super().setUp() + + self.parent = self.RADIO_CLASS(self.TEST_IMAGE) + self.parent_rf = self.parent.get_features() + # If SUB_DEVICE is set to an index, then the actual radio we are + # to test is get_sub_devices()[SUB_DEVICE]. Otherwise, it's the + # actual class we were handed. + if self.SUB_DEVICE is not None: + self.radio = self.parent.get_sub_devices()[self.SUB_DEVICE] + self.rf = self.radio.get_features() + else: + self.radio = self.parent + self.rf = self.parent_rf + self.patches = [] + + def use_patch(self, patch): + self.patches.append(patch) + patch.start() + + def tearDown(self): + for patch in self.patches: + patch.stop() + + def get_mem(self): + """Attempt to build a suitable memory for testing""" + # Check to see if memory #1 has immutable fields, and if so, + # use that as our template instead of constructing a memory ourselves + try: + m = self.radio.get_memory(1) + # Don't return extra because it will never match properly + try: + del m.extra + except AttributeError: + pass + # Pre-filter the name so it will match what we expect back + if 'name' not in m.immutable: + m.name = self.radio.filter_name(m.name) + # Disable duplex in case it's set because this will cause some + # weirdness if we much with other values, like offset. + if 'duplex' not in m.immutable: + m.duplex = '' + if m.immutable: + return m + except Exception: + pass + + m = chirp_common.Memory() + + # Some of the exposed bands may not be transmit-enabled, so + # iterate them all + attempt = 0 + for band_lo, band_hi in self.rf.valid_bands: + m.freq = band_lo + if self.rf.valid_tuning_steps: + # If we have valid tuning steps, go one step above the + # bottom of the band. Select a different tuning_step each + # time, as some radios have various requirements for which + # steps work in each band, mode, etc. + steps = [x for x in self.rf.valid_tuning_steps + if x > 1] + step_index = attempt % len(steps) + m.tuning_step = steps[step_index] + m.freq += int(m.tuning_step * 1000) + elif m.freq + 1000000 < band_hi: + # Otherwise just pick 1MHz above the bottom, which has been + # our test basis for a long time, unless that extends past + # the end of the band. + m.freq += 1000000 + + if m.freq < 30000000 and "AM" in self.rf.valid_modes: + m.mode = "AM" + else: + try: + m.mode = self.rf.valid_modes[0] + except IndexError: + pass + + for i in range(*self.rf.memory_bounds)[:10]: + m.number = i + msgs = self.radio.validate_memory(m) + warnings, errors = chirp_common.split_validation_msgs(msgs) + if warnings and not errors: + # If we got some warnings and no errors, then we know the + # memory is almost good enough. Set it and pull it back + # to let the radio squash whatever was "almost correct" + # and then use that. + self.radio.set_memory(m) + m = self.radio.get_memory(m.number) + try: + del m.extra + except AttributeError: + pass + return m + # If we got no warnings, or we have only one band, then + # no errors means we found our candidate. + elif not errors: + return m + + attempt += 1 + + self.fail("No mutable memory locations found - unable to run this " + "test because I don't have a memory to test with") + + def assertEqualMem(self, a, b, ignore=None): + if a.tmode == "Cross": + tx_mode, rx_mode = a.cross_mode.split("->") + + a_vals = {} + b_vals = {} + + for k, v in list(a.__dict__.items()): + if ignore and k in ignore: + continue + if k == "power": + continue # FIXME + elif k == "immutable": + continue + elif k == "name": + if not self.rf.has_name: + continue # Don't complain about name, if not supported + else: + # Name mismatch fair if filter_name() is right + v = self.radio.filter_name(v).rstrip() + elif k == "tuning_step" and not self.rf.has_tuning_step: + continue + elif k == "rtone" and not ( + a.tmode == "Tone" or + (a.tmode == "TSQL" and not self.rf.has_ctone) or + (a.tmode == "Cross" and tx_mode == "Tone") or + (a.tmode == "Cross" and rx_mode == "Tone" and + not self.rf.has_ctone) + ): + continue + elif k == "ctone" and (not self.rf.has_ctone or + not (a.tmode == "TSQL" or + (a.tmode == "Cross" and + rx_mode == "Tone"))): + continue + elif k == "dtcs" and not ( + (a.tmode == "DTCS" and not self.rf.has_rx_dtcs) or + (a.tmode == "Cross" and tx_mode == "DTCS") or + (a.tmode == "Cross" and rx_mode == "DTCS" and + not self.rf.has_rx_dtcs)): + continue + elif k == "rx_dtcs" and (not self.rf.has_rx_dtcs or + not (a.tmode == "Cross" and + rx_mode == "DTCS")): + continue + elif k == "offset" and not a.duplex: + continue + elif k == "cross_mode" and a.tmode != "Cross": + continue + + if (a.freq in bandplan_na.ALL_GMRS_FREQS and + k in a.immutable or k in b.immutable): + # If the radio returned a field in immutable, it probably + # means that it's a mandatory setting (i.e. power or duplex + # in GMRS) + continue + + a_vals[k] = v + b_vals[k] = b.__dict__[k] + + self.assertEqual(a_vals, b_vals, + 'Memories have unexpected differences') + + +def requires_feature(flag): + def inner(fn): + @functools.wraps(fn) + def wraps(self, *a, **k): + if getattr(self.rf, flag): + fn(self, *a, **k) + else: + self.skipTest('Feature %s not supported' % flag) + return wraps + return inner diff --git a/tests/icom_clone_simulator.py b/tests/icom_clone_simulator.py index e13572a..603ea17 100644 --- a/tests/icom_clone_simulator.py +++ b/tests/icom_clone_simulator.py @@ -13,6 +13,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +import sys from builtins import bytes import struct @@ -24,10 +25,10 @@ import logging LOG = logging.getLogger(__name__) -import sys -l = logging.getLogger() -l.level = logging.ERROR -l.addHandler(logging.StreamHandler(sys.stdout)) +log = logging.getLogger() +log.level = logging.ERROR +log.addHandler(logging.StreamHandler(sys.stdout)) + class FakeIcomRadio(object): def __init__(self, radio, mapfile=None): @@ -82,24 +83,18 @@ class FakeIcomRadio(object): break header = bytes(struct.pack('>%sB' % self.address_fmt, addr, size)) - #LOG.debug('Header for %02x@%04x: %r' % ( - # size, addr, header)) chunk = [] cs = 0 for byte in header: chunk.extend(x for x in bytes(b'%02X' % byte)) cs += byte - #LOG.debug('Chunk so far: %r' % chunk) for byte in self._memory[addr:addr + size]: chunk.extend(x for x in bytes(b'%02X' % byte)) cs += byte - #LOG.debug('Chunk is %r' % chunk) vx = ((cs ^ 0xFFFF) + 1) & 0xFF chunk.extend(x for x in bytes(b'%02X' % vx)) self.queue(self.make_response(icf.CMD_CLONE_DAT, bytes(chunk))) - #LOG.debug('Stopping after first frame') - #break self.queue(self.make_response(icf.CMD_CLONE_END, bytes([]))) def do_clone_in(self): @@ -118,23 +113,10 @@ class FakeIcomRadio(object): payload_bytes = bytes([hex_to_byte(payload_hex[i:i+2]) for i in range(0, len(payload_hex), 2)]) - addr, size = struct.unpack('>%sB' % self.address_fmt, payload_bytes[:header_len]) + addr, size = struct.unpack( + '>%sB' % self.address_fmt, payload_bytes[:header_len]) data = payload_bytes[header_len:-1] - csum = payload_bytes[-1] - - #addr_hex = payload[0:size_offset] - #size_hex = payload[size_offset:size_offset + 2] - #data_hex = payload[size_offset + 2:-2] - #csum_hex = payload[-2:] - - - #addr = hex_to_byte(addr_hex[0:2]) << 8 | hex_to_byte(addr_hex[2:4]) - #size = hex_to_byte(size_hex) - #csum = hex_to_byte(csum_hex) - - #data = [] - #for i in range(0, len(data_hex), 2): - # data.append(hex_to_byte(data_hex[i:i+2])) + # csum = payload_bytes[-1] if len(data) != size: LOG.debug('Invalid frame size: expected %i, but got %i' % ( @@ -153,24 +135,25 @@ class FakeIcomRadio(object): self._memory += data + def do_clone_end(self): + self.queue(self.make_response(icf.CMD_CLONE_OK, bytes([0]))) + def write(self, data): """write() to radio, so here we process requests""" - assert isinstance(data, bytes), 'Bytes required, %s received' % data.__class__ + assert isinstance( + data, bytes), 'Bytes required, %s received' % data.__class__ - if data[:12] == (bytes(b'\xFE') * 12): - LOG.debug('Got hispeed kicker') - data = data[12:] - if data[2] == 0xFE: - return + while data.startswith(b'\xfe\xfe\xfe'): + data = data[1:] - src = data[2] - dst = data[3] + # src = data[2] + # dst = data[3] cmd = data[4] payload = data[5:-1] - end = data[-1] + # end = data[-1] - LOG.debug('Received command: %r' % cmd) + LOG.debug('Received command: %x' % cmd) LOG.debug(' Full frame: %r' % data) model = self._radio.get_model() + bytes(b'\x00' * 20) @@ -185,6 +168,10 @@ class FakeIcomRadio(object): self.do_clone_in() elif cmd == icf.CMD_CLONE_DAT: self.do_clone_data(payload) + elif cmd == icf.CMD_CLONE_END: + self.do_clone_end() + elif cmd == icf.CMD_CLONE_HISPEED: + LOG.info('Got hispeed kicker') else: LOG.debug('Unknown command %i' % cmd) self.queue(self.make_response(0x00, bytes([0x01]))) diff --git a/tests/images/Abbree_AR-730.img b/tests/images/Abbree_AR-730.img new file mode 100644 index 0000000..7480cd2 Binary files /dev/null and b/tests/images/Abbree_AR-730.img differ diff --git a/tests/images/Abbree_AR-F5.img b/tests/images/Abbree_AR-F5.img new file mode 100644 index 0000000..071244d Binary files /dev/null and b/tests/images/Abbree_AR-F5.img differ diff --git a/tests/images/Alinco_DJ-G7EG.img b/tests/images/Alinco_DJ-G7EG.img index 2286bc1..7884393 100644 Binary files a/tests/images/Alinco_DJ-G7EG.img and b/tests/images/Alinco_DJ-G7EG.img differ diff --git a/tests/images/Anysecu_UV-A37.img b/tests/images/Anysecu_UV-A37.img new file mode 100644 index 0000000..ecc4f5e Binary files /dev/null and b/tests/images/Anysecu_UV-A37.img differ diff --git a/tests/images/BTECH_GMRS-50V2.img b/tests/images/BTECH_GMRS-50V2.img new file mode 100644 index 0000000..691cca3 Binary files /dev/null and b/tests/images/BTECH_GMRS-50V2.img differ diff --git a/tests/images/BTECH_MURS-V2.img b/tests/images/BTECH_MURS-V2.img new file mode 100644 index 0000000..40db29b Binary files /dev/null and b/tests/images/BTECH_MURS-V2.img differ diff --git a/tests/images/BTECH_UV-25X2_G2.img b/tests/images/BTECH_UV-25X2_G2.img new file mode 100644 index 0000000..7e455d3 Binary files /dev/null and b/tests/images/BTECH_UV-25X2_G2.img differ diff --git a/tests/images/BTECH_UV-25X4_G2.img b/tests/images/BTECH_UV-25X4_G2.img new file mode 100644 index 0000000..7caaafd Binary files /dev/null and b/tests/images/BTECH_UV-25X4_G2.img differ diff --git a/tests/images/BTECH_UV-50X2_G2.img b/tests/images/BTECH_UV-50X2_G2.img new file mode 100644 index 0000000..a78cca4 Binary files /dev/null and b/tests/images/BTECH_UV-50X2_G2.img differ diff --git a/tests/images/Baofeng_BF-1904.img b/tests/images/Baofeng_BF-1904.img new file mode 100644 index 0000000..317efbb Binary files /dev/null and b/tests/images/Baofeng_BF-1904.img differ diff --git a/tests/images/Baofeng_UV-9G.img b/tests/images/Baofeng_UV-9G.img new file mode 100644 index 0000000..6aa0cc0 Binary files /dev/null and b/tests/images/Baofeng_UV-9G.img differ diff --git a/tests/images/Baofeng_UV-S9X3.img b/tests/images/Baofeng_UV-S9X3.img new file mode 100644 index 0000000..ab848d5 Binary files /dev/null and b/tests/images/Baofeng_UV-S9X3.img differ diff --git a/tests/images/Baofeng_W31E.img b/tests/images/Baofeng_W31E.img new file mode 100644 index 0000000..c2d8ef8 Binary files /dev/null and b/tests/images/Baofeng_W31E.img differ diff --git a/tests/images/CRT_Micron_UV.img b/tests/images/CRT_Micron_UV.img index e1f2f65..fa4dbc3 100644 Binary files a/tests/images/CRT_Micron_UV.img and b/tests/images/CRT_Micron_UV.img differ diff --git a/tests/images/Hiroyasu_HI-8811.img b/tests/images/Hiroyasu_HI-8811.img new file mode 100644 index 0000000..1e48095 Binary files /dev/null and b/tests/images/Hiroyasu_HI-8811.img differ diff --git a/tests/images/Icom_IC-2820H.img b/tests/images/Icom_IC-2820H.img index e845f9f..b9e9fc2 100644 Binary files a/tests/images/Icom_IC-2820H.img and b/tests/images/Icom_IC-2820H.img differ diff --git a/tests/images/Icom_IC-E90.img b/tests/images/Icom_IC-E90.img new file mode 100644 index 0000000..60c8526 Binary files /dev/null and b/tests/images/Icom_IC-E90.img differ diff --git a/tests/images/Icom_IC-U82.img b/tests/images/Icom_IC-U82.img new file mode 100644 index 0000000..5a1c0a4 Binary files /dev/null and b/tests/images/Icom_IC-U82.img differ diff --git a/tests/images/Icom_IC-V80.img b/tests/images/Icom_IC-V80.img new file mode 100755 index 0000000..49af6b5 Binary files /dev/null and b/tests/images/Icom_IC-V80.img differ diff --git a/tests/images/Icom_IC-V82.img b/tests/images/Icom_IC-V82.img new file mode 100644 index 0000000..1b767bb Binary files /dev/null and b/tests/images/Icom_IC-V82.img differ diff --git a/tests/images/Icom_IC-V82_U82.img b/tests/images/Icom_IC-V82_U82.img deleted file mode 100644 index 5a1c0a4..0000000 Binary files a/tests/images/Icom_IC-V82_U82.img and /dev/null differ diff --git a/tests/images/Icom_IC-V86.img b/tests/images/Icom_IC-V86.img new file mode 100644 index 0000000..bda6e08 Binary files /dev/null and b/tests/images/Icom_IC-V86.img differ diff --git a/tests/images/Icom_ID-4100.img b/tests/images/Icom_ID-4100.img new file mode 100644 index 0000000..1305f49 Binary files /dev/null and b/tests/images/Icom_ID-4100.img differ diff --git a/tests/images/Icom_ID-5100.img b/tests/images/Icom_ID-5100.img new file mode 100644 index 0000000..06ca124 Binary files /dev/null and b/tests/images/Icom_ID-5100.img differ diff --git a/tests/images/Icom_ID-51_Plus2.img b/tests/images/Icom_ID-51_Plus2.img new file mode 100644 index 0000000..f5e7c23 Binary files /dev/null and b/tests/images/Icom_ID-51_Plus2.img differ diff --git a/tests/images/Icom_ID-80H.img b/tests/images/Icom_ID-80H.img new file mode 100755 index 0000000..1c14d84 Binary files /dev/null and b/tests/images/Icom_ID-80H.img differ diff --git a/tests/images/Kenwood_TH-D74_clone_mode.img b/tests/images/Kenwood_TH-D74_clone_mode.img new file mode 100755 index 0000000..5b1e40a Binary files /dev/null and b/tests/images/Kenwood_TH-D74_clone_mode.img differ diff --git a/tests/images/Kenwood_TK-3140K.img b/tests/images/Kenwood_TK-3140K.img new file mode 100644 index 0000000..a2d838a Binary files /dev/null and b/tests/images/Kenwood_TK-3140K.img differ diff --git a/tests/images/Kenwood_TK-7160K.img b/tests/images/Kenwood_TK-7160K.img new file mode 100644 index 0000000..25d69dc Binary files /dev/null and b/tests/images/Kenwood_TK-7160K.img differ diff --git a/tests/images/Midland_DBR2500.img b/tests/images/Midland_DBR2500.img index e1f2f65..7358287 100644 Binary files a/tests/images/Midland_DBR2500.img and b/tests/images/Midland_DBR2500.img differ diff --git a/tests/images/Q-MAC_HF-90_v300_or_earlier.img b/tests/images/Q-MAC_HF-90_v300_or_earlier.img new file mode 100644 index 0000000..42678c7 Binary files /dev/null and b/tests/images/Q-MAC_HF-90_v300_or_earlier.img differ diff --git a/tests/images/Q-MAC_HF-90_v301_or_later.img b/tests/images/Q-MAC_HF-90_v301_or_later.img new file mode 100644 index 0000000..0d43445 Binary files /dev/null and b/tests/images/Q-MAC_HF-90_v301_or_later.img differ diff --git a/tests/images/Quansheng_UV-K5.img b/tests/images/Quansheng_UV-K5.img new file mode 100644 index 0000000..4bdae31 Binary files /dev/null and b/tests/images/Quansheng_UV-K5.img differ diff --git a/tests/images/Radioddity_GS-5B.img b/tests/images/Radioddity_GS-5B.img new file mode 100644 index 0000000..cdd51ad Binary files /dev/null and b/tests/images/Radioddity_GS-5B.img differ diff --git a/tests/images/Radtel_RT-470.img b/tests/images/Radtel_RT-470.img new file mode 100644 index 0000000..e670820 Binary files /dev/null and b/tests/images/Radtel_RT-470.img differ diff --git a/tests/images/Radtel_RT-470L.img b/tests/images/Radtel_RT-470L.img new file mode 100644 index 0000000..ffe6631 Binary files /dev/null and b/tests/images/Radtel_RT-470L.img differ diff --git a/tests/images/Radtel_RT-470X.img b/tests/images/Radtel_RT-470X.img new file mode 100644 index 0000000..7797a24 Binary files /dev/null and b/tests/images/Radtel_RT-470X.img differ diff --git a/tests/images/Retevis_H777S.img b/tests/images/Retevis_H777S.img new file mode 100644 index 0000000..b1ee0fa Binary files /dev/null and b/tests/images/Retevis_H777S.img differ diff --git a/tests/images/Retevis_RA685.img b/tests/images/Retevis_RA685.img new file mode 100644 index 0000000..ef700fa Binary files /dev/null and b/tests/images/Retevis_RA685.img differ diff --git a/tests/images/Retevis_RB17A.img b/tests/images/Retevis_RB17A.img index 36ed38e..14128be 100644 Binary files a/tests/images/Retevis_RB17A.img and b/tests/images/Retevis_RB17A.img differ diff --git a/tests/images/Retevis_RB26.img b/tests/images/Retevis_RB26.img index b39c873..e5e9a80 100644 Binary files a/tests/images/Retevis_RB26.img and b/tests/images/Retevis_RB26.img differ diff --git a/tests/images/Retevis_RB28.img b/tests/images/Retevis_RB28.img new file mode 100644 index 0000000..2b1a2ca Binary files /dev/null and b/tests/images/Retevis_RB28.img differ diff --git a/tests/images/Retevis_RB28B.img b/tests/images/Retevis_RB28B.img new file mode 100644 index 0000000..5e7cc40 Binary files /dev/null and b/tests/images/Retevis_RB28B.img differ diff --git a/tests/images/Retevis_RB29.img b/tests/images/Retevis_RB29.img new file mode 100644 index 0000000..bae9d08 Binary files /dev/null and b/tests/images/Retevis_RB29.img differ diff --git a/tests/images/Retevis_RB628.img b/tests/images/Retevis_RB628.img new file mode 100644 index 0000000..35c1121 Binary files /dev/null and b/tests/images/Retevis_RB628.img differ diff --git a/tests/images/Retevis_RB628B.img b/tests/images/Retevis_RB628B.img new file mode 100644 index 0000000..71fe107 Binary files /dev/null and b/tests/images/Retevis_RB628B.img differ diff --git a/tests/images/Retevis_RB629.img b/tests/images/Retevis_RB629.img new file mode 100644 index 0000000..5660522 Binary files /dev/null and b/tests/images/Retevis_RB629.img differ diff --git a/tests/images/Retevis_RB87.img b/tests/images/Retevis_RB87.img new file mode 100644 index 0000000..56300a0 Binary files /dev/null and b/tests/images/Retevis_RB87.img differ diff --git a/tests/images/Retevis_RT15.img b/tests/images/Retevis_RT15.img new file mode 100644 index 0000000..72dbfce Binary files /dev/null and b/tests/images/Retevis_RT15.img differ diff --git a/tests/images/Retevis_RT20.img b/tests/images/Retevis_RT20.img new file mode 100644 index 0000000..99b8b68 Binary files /dev/null and b/tests/images/Retevis_RT20.img differ diff --git a/tests/images/Retevis_RT24.img b/tests/images/Retevis_RT24.img new file mode 100644 index 0000000..4fafa5a Binary files /dev/null and b/tests/images/Retevis_RT24.img differ diff --git a/tests/images/Retevis_RT24V.img b/tests/images/Retevis_RT24V.img new file mode 100644 index 0000000..a0e7e23 Binary files /dev/null and b/tests/images/Retevis_RT24V.img differ diff --git a/tests/images/Retevis_RT76.img b/tests/images/Retevis_RT76.img index e716ae9..f56adf8 100644 Binary files a/tests/images/Retevis_RT76.img and b/tests/images/Retevis_RT76.img differ diff --git a/tests/images/Retevis_RT86.img b/tests/images/Retevis_RT86.img new file mode 100644 index 0000000..8de15dd Binary files /dev/null and b/tests/images/Retevis_RT86.img differ diff --git a/tests/images/Retevis_RT95.img b/tests/images/Retevis_RT95.img index e1f2f65..f48357f 100644 Binary files a/tests/images/Retevis_RT95.img and b/tests/images/Retevis_RT95.img differ diff --git a/tests/images/Ruyage_UV58Plus.img b/tests/images/Ruyage_UV58Plus.img new file mode 100644 index 0000000..66d466b Binary files /dev/null and b/tests/images/Ruyage_UV58Plus.img differ diff --git a/tests/images/SenhaiX_8800.img b/tests/images/SenhaiX_8800.img new file mode 100644 index 0000000..40fd389 Binary files /dev/null and b/tests/images/SenhaiX_8800.img differ diff --git a/tests/images/TIDRADIO_TD-H8-GMRS.img b/tests/images/TIDRADIO_TD-H8-GMRS.img new file mode 100644 index 0000000..2eb8ddb Binary files /dev/null and b/tests/images/TIDRADIO_TD-H8-GMRS.img differ diff --git a/tests/images/TIDRADIO_TD-H8-HAM.img b/tests/images/TIDRADIO_TD-H8-HAM.img new file mode 100644 index 0000000..8946d9b Binary files /dev/null and b/tests/images/TIDRADIO_TD-H8-HAM.img differ diff --git a/tests/images/TIDRADIO_TD-H8.img b/tests/images/TIDRADIO_TD-H8.img new file mode 100644 index 0000000..ae208c0 Binary files /dev/null and b/tests/images/TIDRADIO_TD-H8.img differ diff --git a/tests/images/TYT_TH-UVF8D.img b/tests/images/TYT_TH-UVF8D.img new file mode 100644 index 0000000..55a905a Binary files /dev/null and b/tests/images/TYT_TH-UVF8D.img differ diff --git a/tests/images/Talkpod_A36plus.img b/tests/images/Talkpod_A36plus.img new file mode 100644 index 0000000..971b2d9 Binary files /dev/null and b/tests/images/Talkpod_A36plus.img differ diff --git a/tests/images/Wouxun_KG-1000G.img b/tests/images/Wouxun_KG-1000G.img new file mode 100644 index 0000000..9eaf2ef Binary files /dev/null and b/tests/images/Wouxun_KG-1000G.img differ diff --git a/tests/images/Wouxun_KG-1000G_Plus.img b/tests/images/Wouxun_KG-1000G_Plus.img new file mode 100644 index 0000000..75618f3 Binary files /dev/null and b/tests/images/Wouxun_KG-1000G_Plus.img differ diff --git a/tests/images/Wouxun_KG-935G_Plus.img b/tests/images/Wouxun_KG-935G_Plus.img new file mode 100644 index 0000000..0d0a729 Binary files /dev/null and b/tests/images/Wouxun_KG-935G_Plus.img differ diff --git a/tests/images/Wouxun_KG-UV8E.img b/tests/images/Wouxun_KG-UV8E.img index 89e5e1f..09187f6 100644 Binary files a/tests/images/Wouxun_KG-UV8E.img and b/tests/images/Wouxun_KG-UV8E.img differ diff --git a/tests/images/Wouxun_KG-UV8H.img b/tests/images/Wouxun_KG-UV8H.img new file mode 100644 index 0000000..b2354f9 Binary files /dev/null and b/tests/images/Wouxun_KG-UV8H.img differ diff --git a/tests/images/Wouxun_KG-UV980P.img b/tests/images/Wouxun_KG-UV980P.img new file mode 100644 index 0000000..03c3a2f Binary files /dev/null and b/tests/images/Wouxun_KG-UV980P.img differ diff --git a/tests/images/Wouxun_KG-UV9GX.img b/tests/images/Wouxun_KG-UV9GX.img new file mode 100644 index 0000000..1fd1164 Binary files /dev/null and b/tests/images/Wouxun_KG-UV9GX.img differ diff --git a/tests/images/Wouxun_KG-UV9G_Pro.img b/tests/images/Wouxun_KG-UV9G_Pro.img new file mode 100644 index 0000000..cce05b5 Binary files /dev/null and b/tests/images/Wouxun_KG-UV9G_Pro.img differ diff --git a/tests/images/Wouxun_KG-UV9K.img b/tests/images/Wouxun_KG-UV9K.img new file mode 100644 index 0000000..dc7cf54 Binary files /dev/null and b/tests/images/Wouxun_KG-UV9K.img differ diff --git a/tests/images/Wouxun_KG-UV9PX.img b/tests/images/Wouxun_KG-UV9PX.img new file mode 100644 index 0000000..db965bd Binary files /dev/null and b/tests/images/Wouxun_KG-UV9PX.img differ diff --git a/tests/images/Yaesu_FT-4XE.img b/tests/images/Yaesu_FT-4XE.img index fb8087a..33a3c16 100644 Binary files a/tests/images/Yaesu_FT-4XE.img and b/tests/images/Yaesu_FT-4XE.img differ diff --git a/tests/images/Yaesu_FT-65E.img b/tests/images/Yaesu_FT-65E.img index 94cda1a..1bd2ca5 100644 Binary files a/tests/images/Yaesu_FT-65E.img and b/tests/images/Yaesu_FT-65E.img differ diff --git a/tests/images/Yaesu_FT-90.img b/tests/images/Yaesu_FT-90.img new file mode 100644 index 0000000..4bfd0dc Binary files /dev/null and b/tests/images/Yaesu_FT-90.img differ diff --git a/tests/model_stats.tsv b/tests/model_stats.tsv new file mode 100644 index 0000000..6967c2b --- /dev/null +++ b/tests/model_stats.tsv @@ -0,0 +1,515 @@ +model count +Baofeng_UV-5R 1700672 +Baofeng_UV-82 541174 +Baofeng_UV-82WP 19912 +Baofeng_BF-888 915735 +Generic_CSV 556432 +Baofeng_UV-9R 155694 +AnyTone_5888UV 8643 +RepeaterBook_ 297088 +Radioddity_UV-5G 28679 +BTECH_GMRS-20V2 1550 +TYT_TH-UV8000 19137 +Baofeng_BF-A58S 23694 +Baofeng_BF-F8HP 317609 +Baofeng_UV-5X 49662 +Icom_IC-7000 2122 +Yaesu_FT-60 30100 +TYT_TH-UV88 31727 +Radioddity_UV-5RX3 55501 +Puxing_PX-777 6549 +Baofeng_UV-82HP 145843 +Baofeng_UV-5XP 31311 +QYT_KT8900D 31240 +Retevis_RT22 32979 +Baofeng_UV-6R 44014 +Baofeng_GT-3WP 26303 +Wouxun_KG-UV9D Plus 24244 +Baofeng_UV-9G 40164 +Wouxun_KG-816 4537 +TYT_TH-9800 39903 +Baofeng_UV-82III 12429 +Wouxun_KG-UVD1P 21369 +Yaesu_FT-7800/7900 8326 +Retevis_RT95 VOX 9028 +Radioddity_GA-510 25695 +Baofeng_UV-3R 27672 +Baofeng_BF-T1 47089 +Yaesu_FT-70D 16467 +Radio Reference LLC_RadioReference.com 19825 +Icom_IC-E90 1372 +Baofeng_BF-U9 12688 +AnyTone_778UV 10285 +BTECH_UV-25X2 9206 +QYT_KT8900 21417 +Radioddity_UV-5R EX 6050 +BTECH_UV-5X3 26484 +TID_TD-M8 2241 +TIDRADIO_TD-UV5R TriPower 21391 +TIDRADIO_TD-H6 26254 +Radioddity_GA-2S 11555 +Wouxun_KG-UV8D Plus 5195 +Yaesu_FTM-350 972 +Kenwood_TK-8180 953 +AnyTone_778UV VOX 14394 +Kenwood_TK-7102 1494 +AnyTone_5888UVIII 2407 +Tenway_UV-5R Pro 12896 +Baofeng_UV-B5 21750 +Retevis_RT95 5162 +Kenwood_TK-7180 731 +Yaesu_FT-50 2292 +Zastone_ZT-X6 6562 +Baojie_BJ-218 17702 +Zastone_MP-300 1923 +Kenwood_TK-7108 690 +Yaesu_FT-817ND 4131 +KYD_IP-620 1226 +KYD_NC-630A 988 +QYT_KT7900D 14065 +Alinco_DJ-G7EG 27316 +Powerwerx_DB-750X 867 +Baofeng_BF-A58 36184 +Kenwood_TM-281 951 +Yaesu_FT-4XE 8817 +Retevis_RB26 2512 +Retevis_RT16 1195 +Retevis_RT5R 9343 +Rugged_RH5R-V2 2882 +Rugged_RH5R 2262 +Retevis_RT85 13450 +Yaesu_VX-170 2076 +Icom_IC-91/92AD 1614 +Retevis_RB17A 700 +Retevis_RT9000D_400-490 741 +Retevis_H777 23777 +Baofeng_GT-5R 41759 +Retevis_H777 Plus 3470 +Retevis_RT1 4651 +Retevis_RT21 12241 +Retevis_RT22FRS 2475 +Retevis_RT22S 2652 +Retevis_RT23 2461 +BTECH_UV-25X4 7089 +Retevis_RT24 19182 +Yaesu_FT-1802M 1310 +Retevis_RT26 1882 +QYT_KT8900R 7816 +Retevis_RT5 4622 +Retevis_RT5(tri-power) 1654 +Retevis_RT5RV 2644 +Retevis_RT6 2281 +QYT_KT-8R 5833 +Retevis_RT622 5317 +Wouxun_KG-UV6 11828 +BTECH_GMRS-50X1 8315 +BTECH_UV-5001 1544 +Wouxun_KG-UV8D 14808 +Retevis_RT76 1178 +Retevis_RT76P 2417 +Retevis_RT87 2131 +WACCOM_MINI-8900 6247 +TYT_TH-UVF8D 2830 +TYT_TH-UV3R 2662 +TYT_TH-7800 8003 +TYT_TH-UVF1 3560 +TYT_TH-UV3R-25 1238 +TYT_TH-350 4157 +TYT_TH9000_144 3402 +TYT_TH9000_220 2516 +TYT_TH9000_440 2450 +BTECH_GMRS-V1 9901 +Yaesu_VX-5 4009 +Baofeng_UV-6 28285 +Baofeng_BF-T8 12864 +AnyTone_OBLTR-8R 1437 +AnyTone_TERMN-8R 1475 +Icom_IC-T70 1669 +Yaesu_FT-65R 10824 +Retevis_RT98 3060 +CRT_Micron UV V2 6030 +Kenwood_TK-860 838 +Baofeng_F-11 7356 +Kenwood_TM-V7 597 +QYT_KT980PLUS 5417 +Kenwood_TK-3180K 1952 +Icom_IC-2720H 1508 +Yaesu_FT-857/897 15692 +BTECH_UV-50X2 8054 +Retevis_RT68 2077 +Baojie_BJ-9900 1430 +Retevis_RT668 1785 +Radioddity_DB25-G 10359 +Intek_KT-980HP 2762 +MTC_UV-5R-3 1103 +Kenwood_TS-480_LiveMode 86 +Yaesu_VX-6 9975 +Kenwood_TK-8108 456 +Kenwood_TM-D710G 529 +WLN_KD-C1 106730 +Icom_ID-800H 741 +Icom_IC-V82/U82 1974 +Arcshell_AR-5 7729 +Radioddity_R2 2741 +Icom_IC-V86 2752 +Icom_IC-7100 3601 +Kenwood_TK-360G 716 +Icom_746 927 +Midland_DBR2500 3278 +Yaesu_FT-4XR 6788 +Icom_IC-2300H 4889 +Icom_IC-T90 1095 +Alinco_DJ175 1940 +Alinco_DJ596 1445 +Alinco_DR03T 624 +Alinco_DR06T 639 +Retevis_RB18 2205 +Alinco_DR135T 2433 +Alinco_DR235T 1015 +Alinco_DR435T 1029 +Ansoko_A-5R 1361 +Ansoko_A-8S 2254 +Arcshell_AR-6 3011 +Arcshell_AR-8 531 +BTECH_MURS-V1 2441 +BTECH_UV-2501 1176 +BTECH_UV-2501+220 1474 +BTECH_UV-50X3 3527 +Yaesu_FT-857/897 (US) 4812 +Baojie_BJ-318 6130 +Baojie_BJ-UV55 1671 +Boblov_X3Plus 999 +CRT_Micron UV 5176 +Radtel_T18 4114 +Feidaxin_FD-150A 1285 +Retevis_RB85 1289 +Feidaxin_FD-160A 518 +Feidaxin_FD-268A 495 +Feidaxin_FD-268B 387 +Feidaxin_FD-288A 371 +Kenwood_TS-2000 1568 +Kenwood_TK-360 983 +Kenwood_TK-370 1000 +Yaesu_FT-90 1236 +QYT_KT-UV980 2068 +Puxing_PX-888K 4268 +Yaesu_VX-3 4754 +Puxing_PX-2R 2874 +Kenwood_TM-V71 2625 +Kenwood_TK-762G 854 +Icom_IC-2730A 13133 +Kenwood_TH-G71 312 +Yaesu_FT-2900R/1900R 2959 +Leixen_VV-898 9789 +Yaesu_FT-8800 5190 +Yaesu_FTM-7250D 2222 +Retevis_RB27 5705 +Radioddity_QB25 5820 +Yaesu_FT-65E 4793 +Tenway_TW-325 1864 +Kenwood_TH-D7G 161 +Kenwood_TK-2180 2361 +Kenwood_TK-260G 1135 +Yaesu_FT3D 2050 +Icom_IC-7300 2131 +Kenwood_TK-270 987 +Yaesu_VX-8DR 2069 +Surecom_S-KT8900D 2711 +ITWeRKS_RFinder 965 +Vertex Standard_VXA-700 1439 +Kenwood_TK-762 426 +QYT_KT5800 844 +Yedro_YC-M04VUS 1158 +Yaesu_FT-2800M 1957 +LUITON_LT-588UV 874 +Yaesu_VX-8R 1638 +Yaesu_VX-2 2551 +Radioddity_GA-5S 2159 +Kenwood_TM-D700 757 +Motorola_Waris Tuning 3331 +Yaesu_VX-7 5606 +Plant-Tours_MT-700 538 +LUITON_LT-898UV 1463 +Icom_IC-208H 3033 +Yaesu_FT-1500M 1476 +Kenwood_TH-F6 1766 +Wouxun_KG-818 2161 +Yaesu_FT-818ND (US) 1265 +Kenwood_TK-3180K2 870 +Jetstream_JT270MH 763 +Kenwood_TK-8102 1125 +Kenwood_TK-862G 833 +Kenwood_TK-862 315 +Icom_IC-W32A 1262 +Greaval_GV-8S 2412 +TechSide_TI-F8+ 1592 +TDXone_TD-Q8A 1235 +Kenwood_TK-760G 1713 +LUITON_LT-725UV 1408 +Radioddity_UV-82X3 3357 +Kenwood_TK-760 1365 +Kenwood_TK-270G 1222 +Vertex Standard_FTL-2011 2965 +HobbyPCB_RS-UV3 1463 +LUITON_LT-316 2509 +Kenwood_TK-370G 1090 +Yaesu_FT-817 2163 +Yaesu_FT-1D 1957 +Kenwood_TK-260 1495 +Yaesu_FT-450D 636 +LUITON_LT-580_UHF 605 +Kenwood_TK-278 977 +Kenwood_TS-480_CloneMode 248 +Icom_IC-P7 597 +Retevis_RB618 9747 +Retevis_RB617 1497 +Kenwood_TM-271 644 +Juentai_JT-6188 Mini 1618 +Sainsonic_GT-890 1183 +Yaesu_FT2D 954 +Retevis_RT-5R 499 +Retevis_RT-5RV 198 +Polmar_DB-50M 1616 +Juentai_JT-6188 Plus 878 +Icom_ID-51 Plus 1080 +Icom_ID-51 1080 +Kenwood_TH-F7 1749 +Yaesu_FT-8100 423 +Yaesu_VX-8GE 850 +Retevis_RT9000D_66-88 256 +Yaesu_FT-817ND (US) 1176 +Kenwood_TM-D710_CloneMode 172 +Kenwood_TH-D72 (clone mode) 1399 +Wouxun_KG-UV8E 3039 +Yaesu_FT-25R 664 +Yaesu_FT-2900R/1900R(TXMod) 1317 +Yaesu_FT-4VR 764 +Yaesu_FT-818 3080 +Vertex Standard_FTL-1011 1344 +Tenway_UV-82 Pro 733 +Rugged_RH5X 655 +Retevis_RB17 980 +Retevis_RB17V 841 +Retevis_RB27V 609 +Retevis_RB627B 3119 +Retevis_RB75 978 +Retevis_RT9000D_136-174 438 +Kenwood_TK-272 579 +Kenwood_TK-272G 1213 +OTGSTUFF_OTG Radio v1 667 +Kenwood_TK-278G 388 +Leixen_VV-898E 1526 +LUITON_LT-580_VHF 316 +Kenwood_TK-372 566 +Kenwood_TK-372G 496 +Yaesu_FT-8900 6781 +Kenwood_TK-378 585 +Kenwood_TK-388G 291 +Jetstream_JT220M 688 +Kenwood_TK-868G 526 +Intek_HR-2040 949 +Kenwood_TH-K2 119 +Vertex Standard_FTL-8011 369 +Vertex Standard_FTL-7011 1542 +Yaesu_FTM-3200D 1347 +Icom_ID-880H 1535 +Icom_IC-T8A 495 +Icom_IC-T7H 971 +Kenwood_TM-G707 415 +Icom_IC-Q7A 759 +Kenwood_TM-D710G_CloneMode 286 +Kenwood_TK-860G 987 +Jetstream_JT270M 613 +Leixen_VV-898S 4641 +Icom_IC-2100H 2419 +Icom_IC-2200H 3083 +Icom_ID-80H 363 +Icom_ID-31A 415 +Icom_IC-W32E 517 +Icom_IC-2820H 2349 +Icom_7200 716 +Kenwood_TK-868 635 +Kenwood_TK-378G 386 +Retevis_RT9000D_220-260 334 +TYT_TH-9800 File 112 +Feidaxin_FD-460UH 511 +Feidaxin_FD-460A 387 +Feidaxin_FD-288B 387 +Greaval_GV-9S 726 +Quansheng_UV-R50 39 +Kenwood_TH-D72 (live mode) 254 +Kenwood_TM-D710 560 +przemienniki.net_ 370 +Motorola_PR860 31 +TechSide_TS-T9+ 1742 +Jetstream_JT2705M 284 +Kenwood_TK-768G 345 +Yaesu_FT-2900E/1900E 11 +Yaesu_FT-2900/1900 (Modded) 30 +Retevis_RB27B 984 +Kenwood_TK-768 242 +Icom_IC-910 294 +Kenwood_TS-590S_CloneMode 99 +Wouxun_KG-UV8H 582 +Wouxun_KG-UV9K Plus 10 +Kenwood_TH-D7 181 +Yaesu_FT-7100M 1681 +Motorola_CDM1250 593 +Leixen_VV898SDualBank 809 +Feidaxin_FD-450A 460 +BTECH_FRS-B1 2546 +Kenwood_TS-850 24 +Motorola_HT1250 433 +Generic_XML 85 +RT Systems_CSV 82 +Kenwood_TS-590SG_CloneMode 102 +Yaesu_FT5D 1 +Icom_7000 23 +Wouxun_KG-UV920P 277 +ARRL_Travel Plus 35 +Kenwood_ITM 38 +Quansheng_TG-UV2+ 2982 +BTECH_FRS-A1 831 +Retevis_RT29 3 +Wouxun_KG816 9 +AnyTone_779UV 34 +Retevis_RT29_VHF_Test 2 +Radioddity_DB20-G 32 +Wouxun_KG-UV920P-A 2660 +Retevis_RT24v 23 +Retevis_RB17P 1033 +Yaesu_FTM-400 6 +BTECH_GMRS-V2 9964 +Retevis_RA685 15414 +Retevis_RA85 2780 +Yaesu_VX-8 41 +Kenwood_HMK 27 +Yaesu_FT-857 20 +Retevis_RB26x 3 +Sainsonic_AP510 10 +Leixen_VV-898S107 54 +Kenwood_TM-471 14 +Icom_ID-51A 3 +Kenwood_TS-590S/SG_LiveMode 98 +Anysecu_WP-9900 2041 +Wouxun_KG-819 138 +Acme_Template 6 +Retevis_RA685 LTX 8 +BTECH_UV-82X3 8 +Quansheng_TG-UV2+FIX 52 +CSV_Generic 22 +Baofeng_UV-8 77 +Pofung_F17 178 +Quansheng_TG-UV2+TEST 5 +Baofeng_UV-S9 Plus 100 +Baofeng_UV-82HP Triforce 80 +Yaesu_FT-857 (US Version) 31 +Baofeng_UV-9RPRO 3 +Baofeng_UV-9R Pro 53167 +Radtel_RT-490 4851 +Commander_KG-UV 8 +Jianpai_8800 Plus 558 +Socotran_FB-8629 172 +MMLradio_JC-8629 433 +Retevis_RT21V 13 +Wouxun_KG-935G 3240 +HYS_TC-8900 9 +Lanchonlh_HG-UV98 264 +Baofeng_P15UV 20 +Retevis_RB27A 5 +Icom_IC-F520 2 +Kenwood_TH-K20 4 +Boristone_8RS 94 +Abbree_AR-869 447 +Icom_ID-52 2 +Kenwood_TH-D700 11 +QYT_KT-WP12 1436 +Kenwood_TK-880 1 +Kenwood_TK-280 11 +SenHaiX_8800 206 +Retevis_RB619 429 +Retevis_RB19 289 +Retevis_RB19P 401 +Retevis_RT28 10 +Yaesu_FT-2900 EU 4 +Retevis_RT29 VHF 4 +Retevis_RT29_VHF 1137 +Retevis_RT29_UHF 1626 +Baofeng Hack_UV-5R 3 +HamGeek_HG-590 16 +Abbrree_AR-63 8 +Abbree_AR-63 1772 +Abbree_AR-518 14516 +Retevis_RB15 532 +Retevis_RB615 371 +Kenwood_TH-D74 (clone mode) 67 +Baofeng_GT-22 21 +Wouxun_KG-UV9D Plus2 3 +TYT_TH-7800 File 54 +Retevis_RT40B 192 +Baofeng_UV-8D 39 +United Star_MHR-148U 5 +TID_TD-777S 17 +TIDRADIO_TD-777S 730 +TIDRADIO_TD-710 18 +TID_TD-710 201 +TIDRADIO_TD-710s 47 +TID_TD-710S 30 +TID_TD-V710 485 +Retevis_RB23 202 +TIDRADIO_TD-777S1 10 +Retevis_RB28 3 +Retevis_RB29 9 +Retevis_RB629 1 +TIDRADIO_TD-V710s 2 +TIDRADIO_TD-V710 9 +Retevis_RT15 13 +Retevis_RT19 280 +TYT_TH-UV98 8 +BTECH_MURS-V2 29 +BTECH_GMRS-50V2 4 +TYT_MD-380 2 +BTECH_UV-50X2_2G 3 +Radioddity_UV-5X 4 +Retevis_RB618XXX 1 +Retevis_C50 3 +Baofeng_C50 6 +Retevis_RT619 306 +Retevis_RT47 298 +Retevis_RT47V 177 +Retevis_RT647 212 +Wouxun_KG-UV980P 456 +Explorer_QRZ-1 2714 +Wouxun_KG-UV8H-TEST-01 2 +Wouxun_KG-935Ga 2 +Wouxun_KG-UV9H 66 +Wouxun_KG-935Gb 2 +Radioddity_UV-5G-MOD 3 +Yaesu_FT-7900 6 +Retevis_RA685+ 15 +Baofeng_BF-V8A 1982 +TYT_TH-8600 21 +Wouxun_KG-935G-AV 3 +Kenwood_TK-8180E 134 +Kenwood_TK-7180E 59 +Kenwood_TH-D74 (live mode) 32 +TYT_TH9000 1 +Icom_IC-7610 56 +Retevis_RB627B-H 9 +Retevis_RB627B_Edd 4 +Retevis_RB627BX 17 +Wouxun_KG-1000G Plus 119 +Icom_ID-5100 97 +BTECH_UV-50X2_G2 40 +CRT_CRT-279UV 1 +Icom_ID-51 Plus2 46 +Wouxun_KG-UV8T 61 +Icom_IC-V80 35 +Icom_ID-4100 12 +Wouxun_KG-UV9Px 210 +Radtel_RT-470 2 +CHIRP_Fake Live Radio 3 +TID_TD-H8 194 +TID_TD-H8_GMRS 7 +TID_TD-H8_HAM 2 +Baofeng_BF-888_Custom 6 diff --git a/tests/py3_driver_testers.txt b/tests/py3_driver_testers.txt index ed5a37d..45424e1 100644 --- a/tests/py3_driver_testers.txt +++ b/tests/py3_driver_testers.txt @@ -3,39 +3,374 @@ # Tester is preferred as a github id, but obfuscated email or name is # acceptable. If a driver is literally identical to another, use # +DRIVER_KEY to mark it as implied-tested. -# Actually Arcshell AR-6 which is a direct clone +# If the driver is tested with an in-tree image (or is a live driver) and the +# clone routines are shared in common with other things that are tested, use +# *MODULE_NAME to mark it as "probably works because of common code in +# $module". If a user reported it as working in a chirp website issue, use +# the form #BUGNUMBER. +Abbree_AR-518,@KC9HI,16-Dec-2022 +Abbree_AR-63,@KC9HI,30-Nov-2022 +Abbree_AR-730,@KC9HI,17-Aug-2023 +Abbree_AR-F5,@KC9HI,09-Aug-2023 +Alinco_DJ175,+Alinco_DR235T,12-Dec-2022 +Alinco_DJ596,+Alinco_DR235T,12-Dec-2022 +Alinco_DJ-G7EG,@HB9UF,09-Dec-2022 +Alinco_DJ-G7T,#10567,09-May-2023 +Alinco_DR03T,+Alinco_DR235T,12-Dec-2022 +Alinco_DR06T,+Alinco_DR235T,12-Dec-2022 +Alinco_DR135T,+Alinco_DR235T,12-Dec-2022 +Alinco_DR235T,@kk7ds,12-Dec-2022 +Alinco_DR435T,+Alinco_DR235T,12-Dec-2022 +Anysecu_UV-A37,@KC9HI,5-Jun-2023 +Anysecu_WP-9900,@KC9HI,11-Nov-2022 +Anysecu_AC-580,+Radioddity_GS-5B,17-Mar-2023 +AnyTone_778UV,+Retevis_RT95,13-Nov-2022 +AnyTone_778UV_VOX,+Retevis_RT95,13-Nov-2022 +AnyTone_5888UV,@kk7ds,9-Dec-2022 +AnyTone_5888UVIII,@bschuler42,9-Jan-2023 +AnyTone_OBLTR-8R,@KC9HI,17-Dec-2022 +AnyTone_TERMN-8R,@KC9HI,17-Dec-2022 +BTECH_FRS-A1,@KC9HI,30-Nov-2022 +BTECH_FRS-B1,@KC9HI,28-Nov-2022 +BTECH_GMRS-20V2,@KC9HI,13-Nov-2022 +BTECH_GMRS-50V2,@KC9HI,15-Feb-2023 +BTECH_GMRS-50X1,@KC9HI,13-Nov-2022 +BTECH_GMRS-V1,@KC9HI,10-Dec-2022 +BTECH_GMRS-V2,@KC9HI,10-Dec-2022 +BTECH_MURS-V1,@KC9HI,10-Dec-2022 +BTECH_MURS-V2,@KC9HI,2-Mar-2023 +BTECH_UV-2501,@KC9HI,11-Nov-2022 +BTECH_UV-2501+220,@KC9HI,11-Nov-2022 +BTECH_UV-25X2,@KC9HI,11-Nov-2022 +BTECH_UV-25X2_G2,@KC9HI,23-Apr-2023 +BTECH_UV-25X4,@KC9HI,10-Nov-2022 +BTECH_UV-25X4_G2,@KC9HI,23-Apr-2023 +BTECH_UV-5001,@KC9HI,11-Nov-2022 +BTECH_UV-50X2,@KC9HI,11-Nov-2022 +BTECH_UV-50X2_G2,@KC9HI,30-Nov-2022 +BTECH_UV-50X3,@KC9HI,10-Dec-2022 +BTECH_UV-5X3,@KC9HI,9-Dec-2022 +Baofeng_BF-1901,@cetinajero,3-Jul-2023 +Baofeng_BF-1904,@cetinajero,3-Jul-2023 Baofeng_BF-888,@kk7ds,13-Feb-2019 +Baofeng_BF-A58,@KC9HI,3-Dec-2022 +Baofeng_BF-A58S,@KC9HI,3-Dec-2022 +Baofeng_BF-F8HP,@KC9HI,18-Nov-2022 +Baofeng_BF-M4,@cetinajero,8-May-2023 +Baofeng_BF-T1,@KC9HI,10-Dec-2022 +Baofeng_BF-T8,@KC9HI,30-Nov-2022 +Baofeng_BF-V8A,@KC9HI,28-Nov-2022 +Baofeng_F-11,+Baofeng_UV-5R,18-Nov-2022 +Baofeng_GT-3WP,@KC9HI,3-Dec-2022 +Baofeng_GT-5R,@KC9HI,18-Nov-2022 Baofeng_UV-3R,@yarda,26-Sep-2022 Baofeng_UV-5R,@lekv,23-Oct-2022 +Baofeng_UV-6,+Baofeng_UV-5R,18-Nov-2022 +Baofeng_UV-6R,@KC9HI,10-Dec-2022 +Baofeng_UV-82,@KC9HI,18-Nov-2022 +Baofeng_UV-82HP,@KC9HI,18-Nov-2022 +Baofeng_UV-82WP,@KC9HI,3-Dec-2022 +Baofeng_UV-9G,@KC9HI,3-Dec-2022 +Baofeng_UV-9R,@KC9HI,3-Dec-2022 +Baofeng_UV-B5,@KC9HI,18-Nov-2022 +Baofeng_UV-S9X3,@KC9HI,22-Aug-2023 +Baofeng_W31E,@KC9HI,14-Aug-2023 +Baojie_BJ-218,+LUITON_LT-725UV,16-Feb-2023 +Baojie_BJ-318,@KC9HI,2-Jan-2023 +Cignus_XTR-5,+Radioddity_GS-5B,17-Mar-2023 +CRT_Micron_UV,+Retevis_RT95,13-Nov-2022 +CRT_Micron_UV_V2,+Retevis_RT95,13-Nov-2022 +Explorer_QRZ-1,+TYT_TH-UV88,5-Dec-2022 +Generic_CSV,@kk7ds,4-Dec-2022 +Hiroyasu_HI-8811,@KC9HI,4-Jun-2023 +HobbyPCB_RS-UV3,@kk7ds,9-Dec-2022 +Icom_IC-208H,*icf,12-Dec-2022 +Icom_IC-2100H,*icf,12-Dec-2022 Icom_IC-2200H,@kk7ds,24-Oct-2022 +Icom_IC-2300H,#10264,13-Jan-2022 +Icom_IC-2720H,*icf,12-Dec-2022 +Icom_IC-2730A,#10261,17-Dec-2022 Icom_IC-2820H,@kk7ds,22-Oct-2022 +Icom_IC-7000,#10510,10-Apr-2023 +Icom_IC-7100,Mike W,16-Feb-2023 Icom_IC-7200,@kk7ds,22-Oct-2022 Icom_IC-7300,@kk7ds,22-Oct-2022 +Icom_IC-746,#10346,3-Feb-2023 Icom_IC-7610,@kk7ds,24-Oct-2022 +Icom_IC-91_92AD,@kk7ds,23-Nov-2022 Icom_IC-910,@mfncooper,1-Oct-2021 -Icom_ID-31A,@kk7ds,12-Feb-2019 +Icom_ID-31A,@kk7ds,1-Dec-2022 +Icom_ID-51,+Icom_ID-31A,1-Dec-2022 +Icom_ID-51_Plus,+Icom_ID-31A,1-Dec-2022 +Icom_ID-51_Plus2,+Icom_ID-31A,17-Dec-2022 +Icom_ID-4100,@n8sqt,18-Dec-2022 +Icom_ID-5100,@kk7ds,17-Dec-2022 Icom_ID-800H_v2,@kk7ds,22-Oct-2022 +Icom_ID-80H,*icf,22-Oct-2022 Icom_ID-880H,@kk7ds,22-Oct-2022 +Icom_IC-E90,*icf,12-Dec-2022 +Icom_IC-P7,*icf,12-Dec-2022 +Icom_IC-T70,*icf,12-Dec-2022 +Icom_IC-T7H,#10752,30-Jul-2023 +Icom_IC-T8A,*icf,12-Dec-2022 +Icom_IC-Q7A,@KC9HI,20-Nov-2022 +Icom_IC-U82,+Icom_IC-V82,25-Jan-2023 +Icom_IC-V80,@kk7ds,16-Feb-2023 +Icom_IC-V82,@kk7ds,25-Jan-2023 +Icom_IC-V86,*icf,12-Dec-2022 +Icom_IC-W32A,#10238,12-Dec-2022 +Icom_IC-W32E,*icf,12-Dec-2022 +Intek_KT-980HP,+Baofeng_BF-F8HP,18-Nov-2022 +Intek_HR-2040,+AnyTone_5888UV,9-Dec-2022 +Jetstream_JT220M,+Alinco_DR235T,12-Dec-2022 +Jetstream_JT270M,+Jetstream_JT270M,13-Dec-2022 +Jetstream_JT270MH,@kk7ds,13-Dec-2022 +Kenwood_HMK,+Generic_CSV,4-Dec-2022 +Kenwood_TH-D7,*kenwood_live,12-Dec-2022 +Kenwood_TH-D7G,*kenwood_live,12-Dec-2022 +Kenwood_TH-D72_clone_mode,@kk7ds,28-Nov-2022 Kenwood_TH-D72_live_mode,@kk7ds,21-Oct-2022 +Kenwood_TH-D74_clone_mode,@kk7ds,30-Nov-2022 Kenwood_TH-D74_live_mode,@kk7ds,20-Oct-2022 +Kenwood_TH-F6,@KC9HI,30-Nov-2022 Kenwood_TH-F7,@sv1,19-Oct-2022 +Kenwood_TH-G71,*kenwood_live,12-Dec-2022 +Kenwood_TH-K2,*kenwood_live,12-Dec-2022 Kenwood_TM-271,+Kenwood_TM-281,23-Oct-2022 Kenwood_TM-281,@kk7ds,23-Oct-2022 +Kenwood_TM-471,*kenwood_live,12-Dec-2022 Kenwood_TM-D700,@kk7ds,20-Oct-2022 +Kenwood_TM-D710,*kenwood_live,22-Oct-2022 Kenwood_TM-D710G,@kk7ds,22-Oct-2022 Kenwood_TM-D710G_CloneMode,@kk7ds,22-Oct-2022 +Kenwood_TM-G707,*kenwood_live,12-Dec-2022 +Kenwood_TM-V7,*kenwood_live,12-Dec-2022 Kenwood_TM-V71,@kk7ds,21-Oct-2022 +Kenwood_TK-2140K,+Kenwood_TK-3140K,2-Feb-2023 +Kenwood_TK-2180,@kk7ds,4-Dec-2022 +Kenwood_TK-3140K,@kk7ds,2-Feb-2023 +Kenwood_TK-3140K2,+Kenwood_TK-3140K,2-Feb-2023 +Kenwood_TK-3140K3,+Kenwood_TK-3140K,2-Feb-2023 +Kenwood_TK-3180K,@kk7ds,4-Dec-2022 +Kenwood_TK-3180K2,+Kenwood_TK-3180K,4-Dec-2022 Kenwood_TK-7102,@kk7ds,15-Feb-2019 Kenwood_TK-7108,@kk7ds,15-Feb-2019 Kenwood_TK-7180,@kk7ds,18-Oct-2022 +Kenwood_TK-7180E,+Kenwood_TK-7180,18-Oct-2022 Kenwood_TK-8102,@kk7ds,15-Feb-2019 Kenwood_TK-8108,@kk7ds,15-Feb-2019 +Kenwood_TK-7160K,@kk7ds,27-Jan-2023 +Kenwood_TK-7160M,+Kenwood_TK-7160K,27-Jan-2023 +Kenwood_TK-8160K,+Kenwood_TK-7160K,27-Jan-2023 +Kenwood_TK-8160M,+Kenwood_TK-7160K,27-Jan-2023 Kenwood_TK-8180,@kk7ds,18-Oct-2022 +Kenwood_TK-8180E,+Kenwood_TK-8180,18-Dec-2022 +Kenwood_TK-762G,@kk7ds,5-Dec-2022 +Kenwood_TK-868G,+Kenwood_TK-762G,5-Dec-2022 +Kenwood_TK-862G,+Kenwood_TK-762G,5-Dec-2022 +Kenwood_TK-860G,+Kenwood_TK-762G,5-Dec-2022 +Kenwood_TK-768G,+Kenwood_TK-762G,5-Dec-2022 +Kenwood_TK-760G,+Kenwood_TK-762G,5-Dec-2022 +Kenwood_TK-388G,+Kenwood_TK-762G,5-Dec-2022 +Kenwood_TK-378G,+Kenwood_TK-762G,5-Dec-2022 +Kenwood_TK-372G,+Kenwood_TK-762G,5-Dec-2022 +Kenwood_TK-370G,+Kenwood_TK-762G,5-Dec-2022 +Kenwood_TK-360G,+Kenwood_TK-762G,5-Dec-2022 +Kenwood_TK-278G,+Kenwood_TK-762G,5-Dec-2022 +Kenwood_TK-272G,+Kenwood_TK-762G,5-Dec-2022 +Kenwood_TK-270G,+Kenwood_TK-762G,5-Dec-2022 +Kenwood_TK-260G,+Kenwood_TK-762G,5-Dec-2022 +Kenwood_TK-760,@kk7ds,5-Dec-2022 +Kenwood_TK-762,+Kenwood_TK-760,5-Dec-2022 +Kenwood_TK-768,+Kenwood_TK-760,5-Dec-2022 +Kenwood_TK-860,+Kenwood_TK-760,5-Dec-2022 +Kenwood_TK-862,+Kenwood_TK-760,5-Dec-2022 +Kenwood_TK-868,+Kenwood_TK-760,5-Dec-2022 +Kenwood_TS-2000,ZS6CRW,10-Jan-2022 +Leixen_VV-898,+Jetstream_JT270MH,13-Dec-2022 +Leixen_VV-898S,@READ10,19-Dec-2022 +LUITON_LT-316,+Retevis_RT22,9-Dec-2022 +LUITON_LT-580_UHF,@KC9HI,8-Dec-2022 +LUITON_LT-580_VHF,@KC9HI,8-Dec-2022 +LUITON_LT-588UV,@KC9HI,11-Nov-2022 +LUITON_LT-725UV,@KC9HI,11-Dec-2022 +Maverick_RA-100,@cetinajero,7-Jul-2023 +Maverick_RA-425,@cetinajero,7-Jul-2023 +MTC_UV-5R-3,+BTECH_UV-5X3,9-Dec-2022 +Midland_DBR2500,+Retevis_RT95,13-Nov-2022 +Polmar_DB-50M,+AnyTone_5888UV,9-Dec-2022 +Powerwerx_DB-750X,+AnyTone_5888UV,9-Dec-2022 +Puxing_PX-888K,#10544,09-May-2023 +Q-MAC_HF-90_v300_or_earlier,@fthain,9-Mar-2023 +Q-MAC_HF-90_v301_or_later,@fthain,9-Mar-2023 +Quansheng_TG-UV2+,#10398,26-Feb-2023 +Quansheng_UV-K5,@sq5bpf,29-May-2023 +QYT_KT-8R,@KC9HI,11-Nov-2022 +QYT_KT-UV980,+WACCOM_MINI-8900,11-Nov-2022 +QYT_KT-WP12,+Anysecu_WP-9900,11-Nov-2022 +QYT_KT5800,+BTECH_UV-25X2,11-Nov-2022 +QYT_KT7900D,+BTECH_UV-25X4,11-Nov-2022 +QYT_KT8900,+LUITON_LT-588UV,11-Nov-2022 +QYT_KT8900D,+BTECH_UV-25X2,11-Nov-2022 +QYT_KT8900R,+BTECH_UV-2501+220,11-Nov-2022 +QYT_KT980PLUS,+BTECH_UV-25X2,11-Nov-2022 +Radioddity_DB25-G,@KC9HI,11-Nov-2022 +Radioddity_GA-2S,@KC9HI,4-Dec-2022 Radioddity_GA-510,@kk7ds,21-Oct-2022 +Radioddity_GS-5B,@lunapiercook,5-Mar-2023 +Radioddity_R2,@KC9HI,17-Dec-2022 +Radioddity_UV-5G,@KC9HI,18-Nov-2022 +Radioddity_UV-5RX3,@KC9HI,18-Nov-2022 +Radioddity_UV-82X3,@KC9HI,18-Nov-2022 +Radtel_RT-470,@KC9HI,2-Apr-2023 +Radtel_RT-470L,@KC9HI,5-May-2023 +Radtel_RT-470X,@KC9HI,10-Aug-2023 +Radtel_T18,@KC9HI,28-Nov-2022 +Retevis_H777S,@KC9HI,22-Dec-2022 +Retevis_H777_Plus,@KC9HI,4-Dec-2022 +Retevis_RA685,@KC9HI,19-Nov-2022 +Retevis_RA85,@KC9HI,19-Nov-2022 +Retevis_RB15,@KC9HI,18-Dec-2022 +Retevis_RB17,@KC9HI,28-Nov-2022 +Retevis_RB17A,@KC9HI,30-Nov-2022 +Retevis_RB17P,@KC9HI,18-Dec-2022 +Retevis_RB17V,@KC9HI,28-Nov-2022 +Retevis_RB18,@KC9HI,28-Nov-2022 +Retevis_RB19,@KC9HI,28-Nov-2022 +Retevis_RB19P,@KC9HI,28-Nov-2022 +Retevis_RB23,@KC9HI,30-Nov-2022 +Retevis_RB26,@KC9HI,30-Nov-2022 +Retevis_RB27,@KC9HI,30-Nov-2022 +Retevis_RB27B,@KC9HI,30-Nov-2022 +Retevis_RB28,@KC9HI,9-Feb-2023 +Retevis_RB28B,@KC9HI,27-Jan-2023 +Retevis_RB27V,@KC9HI,30-Nov-2022 +Retevis_RB29,@KC9HI,24-Dec-2022 +Retevis_RB615,@KC9HI,18-Dec-2022 +Retevis_RB617,@KC9HI,28-Nov-2022 +Retevis_RB618,@KC9HI,28-Nov-2022 +Retevis_RB619,@KC9HI,28-Nov-2022 +Retevis_RB627B,@KC9HI,30-Nov-2022 +Retevis_RB628,@KC9HI,10-Feb-2023 +Retevis_RB628B,@KC9HI,28-Jan-2023 +Retevis_RB629,@KC9HI,24-Dec-2022 +Retevis_RB75,@KC9HI,28-Nov-2022 +Retevis_RB85,@KC9HI,28-Nov-2022 +Retevis_RB87,@KC9HI,10-Mar-2023 +Retevis_RT15,@KC9HI,18-Feb-2023 +Retevis_RT16,@KC9HI,30-Nov-2022 +Retevis_RT19,@KC9HI,30-Nov-2022 +Retevis_RT20,@k9ps-paul,7-Sep-2023 +Retevis_RT21,@KC9HI,30-Nov-2022 +Retevis_RT21V,@KC9HI,24-Jul-2023 +Retevis_RT22,@KC9HI,9-Dec-2022 +Retevis_RT23,@KC9HI,17-Dec-2022 +Retevis_RT22FRS,@KC9HI,9-Dec-2022 +Retevis_RT22S,@KC9HI,28-Nov-2022 +Retevis_RT24,@KC9HI,22-Dec-2022 +Retevis_RT24V,@KC9HI,27-Aug-2023 +Retevis_RT26,@KC9HI,17-Dec-2022 +Retevis_RT29_UHF,@KC9HI,30-Nov-2022 +Retevis_RT29_VHF,@KC9HI,30-Nov-2022 +Retevis_RT40B,@KC9HI,30-Nov-2022 +Retevis_RT47,@KC9HI,28-Nov-2022 +Retevis_RT47V,@KC9HI,28-Nov-2022 +Retevis_RT1,@KC9HI,11-Dec-2022 +Retevis_RT6,@KC9HI,3-Dec-2022 +Retevis_RT619,@KC9HI,30-Nov-2022 +Retevis_RT622,@KC9HI,9-Dec-2022 +Retevis_RT647,@KC9HI,28-Nov-2022 +Retevis_RT668,@KC9HI,28-Nov-2022 +Retevis_RT68,@KC9HI,28-Nov-2022 +Retevis_RT76,@KC9HI,30-Nov-2022 +Retevis_RT76P,@KC9HI,17-Dec-2022 +Retevis_RT85,@KC9HI,5-Dec-2022 +Retevis_RT86,@KC9HI,17-Feb-2023 +Retevis_RT87,@KC9HI,17-Dec-2022 +Retevis_RT95,@KC9HI,13-Nov-2022 +Retevis_RT95_VOX,+Retevis_RT95,13-Nov-2022 +Retevis_RT98,@KC9HI,14-Dec-2022 +Retevis_RT9000D_136-174,@KC9HI,8-Dec-2022 +Retevis_RT9000D_220-260,@KC9HI,8-Dec-2022 +Retevis_RT9000D_400-490,@KC9HI,8-Dec-2022 +Retevis_RT9000D_66-88,@KC9HI,8-Dec-2022 +Ruyage_UV58Plus,@KC9HI,18-Mar-2023 +SenhaiX_8800,+Radioddity_GS-5B,17-Mar-2023 +Talkpod_A36plus,@KC9HI,12-Jun-2023 +TDXone_TD-Q8A,@KC9HI,18-Dec-2022 TIDRADIO_TD-H6,@kk7ds,21-Oct-2022 +TIDRADIO_TD-H8,@Sandmann34,7-Feb-2023 +TIDRADIO_TD-H8-GMRS,@Sandmann34,7-Feb-2023 +TIDRADIO_TD-H8-HAM,@Sandmann34,7-Feb-2023 +TID_TD-M8,+Retevis_RT22,9-Dec-2022 +TID_TD-UV68,@Sandmann34,7-Feb-2023 +TYT_TH-UVF1,@kk7ds,13-Dec-2022 +TYT_TH-UVF8D,@MELERIX,2-Feb-2023 +TYT_TH-UV8000,@KC9HI,6-Jan-2023 +TYT_TH-UV88,@KC9HI,5-Dec-2022 +TYT_TH-7800,#10585,4-Jul-2023 +TYT_TH9000_144,+Retevis_RT9000D_136-174,8-Dec-2022 +TYT_TH9000_220,+Retevis_RT9000D_220-260,8-Dec-2022 +TYT_TH9000_440,+Retevis_RT9000D_400-490,8-Dec-2022 +TYT_TH-9800,#10755,30-Jul-2023 +WACCOM_MINI-8900,@KC9HI,11-Nov-2022 +WLN_KD-C1,+Retevis_RT22,9-Dec-2022 +Wouxun_KG-1000G,@mrtjr1,23-jan-2023 +Wouxun_KG-1000G_Plus,@mrtjr1,23-jan-2023 +Wouxun_KG-816,+Wouxun_KG-UV6,11-Dec-2022 +Wouxun_KG-818,+Wouxun_KG-UV6,11-Dec-2022 +Wouxun_KG-UV6,@KC9HI,11-Dec-2022 +Wouxun_KG-UVD1P,+Wouxun_KG-UV6,11-Dec-2022 +Wouxun_KG-UV8D,Unit tested; needs confirm,24-Dec-2022 +Wouxun_KG-UV8D_Plus,Unit tested; needs confirm,2-Jan-2022 +Wouxun_KG-UV8H,@mrtjr1,27-Mar-2023 +Wouxun_KG-UV8E,W5EGL,2-Jan-2022 +Wouxun_KG-UV9D_Plus,@samwich,10-Jan-2023 +Wouxun_KG-UV920P-A,@KC9HI,22-Dec-2022 +Wouxun_KG-UV980P,@mrtjr1,23-jan-2023 +Wouxun_KG-UV9PX,@mrtjr1,20-Jan-2022 +Wouxun_KG-UV9GX,@mrtjr1,27-Mar-2023 +Wouxun_KG-UV9G_Pro,@mrtjr1,25-Apr-2023 +Wouxun_KG-UV9K,@mrtjr1,14-Apr-2023 +Wouxun_KG-935G,@mrtjr1,4-Jan-2022 +Wouxun_KG-935G_Plus,@mrtjr1,7-Feb-2023 +Yaesu_FT-1500M,@f3sty,05-Dec-2022 +Yaesu_FT-2800M,#10616,05-Jun-2023 +Yaesu_FT-2900R_1900R,#10274,14-Jan-2023 +Yaesu_FT-2900R_1900RTXMod_Opened_Xmit,+Yaesu_FT-2900R_1900R,14-Jan-2023 +Yaesu_FT-1D_R,+Yaesu_FT3D_R,30-Dec-2022 +Yaesu_FT2D_R,+Yaesu_FT3D_R,30-Dec-2022 +Yaesu_FT2D_Rv2,+Yaesu_FT3D_R,30-Dec-2022 +Yaesu_FT3D_R,@kk7ds,30-Dec-2022 +Yaesu_FT-450D,@Old-Phart,01-Jun-2023 +Yaesu_FT-4XE,Unit tested; needs confirm,24-Dec-2022 +Yaesu_FT-4XR,+Yaesu_FT-4XE,24-Dec-2022 +Yaesu_FT-4VR,+Yaesu_FT-4XE,24-Dec-2022 +Yaesu_FT-65R,#10266,13-Jan-2022 +Yaesu_FT-65E,@kwirk,27-Jan-2023 +Yaesu_FT-25R,+Yaesu_FT-4XE,24-Dec-2022 +Yaesu_FT-50,#10824,5-Sep-2023 +Yaesu_FT-60,N0EYE,9-Jan-2023 +Yaesu_FT-70D,@n8sqt,05-Dec-2022 Yaesu_FT-7800_7900,@kk7ds,24-Oct-2022 Yaesu_FT-8800,@kk7ds,24-Oct-2022 +Yaesu_FT-8900,#10753,30-Jul-2023 Yaesu_FT-817,@kk7ds,14-Feb-2019 +Yaesu_FT-817ND,+Yaesu_FT-817,14-Feb-2019 +Yaesu_FT-817ND_US,+Yaesu_FT-817,14-Feb-2019 +Yaesu_FT-818,@thomasrussellmurphy,4-Feb-2023 +Yaesu_FT-818ND_US,+Yaesu_FT-817,14-Feb-2019 +Yaesu_FT-857_897,+Yaesu_FT-817,14-Feb-2019 +Yaesu_FT-857_897_US,+Yaesu_FT-817,14-Feb-2019 +Yaesu_FT-90,#10386,22-Feb-2023 +Yaesu_FTM-350,@kk7ds,4-Dec-2022 +Yaesu_VX-2,@thomasrussellmurphy,20-Jan-2023 Yaesu_VX-3,@kk7ds,15-Feb-2019 -Yaesu_VX-8DR,@kk7ds,15-Feb-2019 +Yaesu_VX-5,*yaesu_clone,12-Dec-2022 +Yaesu_VX-6,@dominickpastore,10-Dec-2022 Yaesu_VX-7,@kk7ds,15-Feb-2019 +Yaesu_VX-8R,+Yaesu_VX-8DR,15-Feb-2019 +Yaesu_VX-8DR,@kk7ds,15-Feb-2019 +Yaesu_VX-8GE,+Yaesu_VX-8DR,15-Feb-2019 +Yedro_YC-M04VUS,+Retevis_RT95,13-Nov-2022 +Zastone_ZT-X6,+Retevis_RT22,9-Dec-2022 diff --git a/tests/py3_remaining.txt b/tests/py3_remaining.txt deleted file mode 100644 index 3f406d1..0000000 --- a/tests/py3_remaining.txt +++ /dev/null @@ -1,17 +0,0 @@ -Baojie_BJ-9900.img -LUITON_LT-725UV.img -Puxing_PX-2R.img -Puxing_PX-777.img -Puxing_PX-888K.img -TYT_TH-UV3R-25.img -TYT_TH-UV3R.img -Wouxun_KG-816.img -Wouxun_KG-818.img -Wouxun_KG-UV6.img -Wouxun_KG-UVD1P.img -Yaesu_FT-1D_R.img -Yaesu_FT2D_R.img -Yaesu_FT3D_R.img -Yaesu_FT-450D.img -Yaesu_FTM-3200D_R.img -Yaesu_FTM-7250D_R.img diff --git a/tests/run_tests b/tests/run_tests deleted file mode 100755 index 226de0c..0000000 --- a/tests/run_tests +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash - -exec python $(readlink -f $0).py $* diff --git a/tests/run_tests.py b/tests/run_tests.py deleted file mode 100644 index 671b3dc..0000000 --- a/tests/run_tests.py +++ /dev/null @@ -1,1377 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2011 Dan Smith -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -from __future__ import print_function -from builtins import bytes -import copy -import traceback -import sys -import os -import shutil -import glob -import tempfile -import time -from optparse import OptionParser -from serial import Serial - -# change to the tests directory -scriptdir = os.path.dirname(sys.argv[0]) -if scriptdir: - os.chdir(scriptdir) - -sys.path.insert(0, "../") - -os.environ['CHIRP_TESTENV'] = 'sigh' -import logging -from chirp import logger - -class LoggerOpts(object): - quiet = 2 - verbose = 0 - log_file = os.path.join('logs', 'debug.log') - log_level = logging.DEBUG - -if not os.path.exists("logs"): - os.mkdir("logs") -logger.handle_options(LoggerOpts()) - -from chirp import CHIRP_VERSION -# FIXME: Not all drivers are py3 compatible in syntax, so punt on this -# until that time, and defer to the safe import loop below. -# from chirp.drivers import * -from chirp import chirp_common, directory -from chirp import import_logic, memmap, settings, errors -from chirp import settings - -directory.safe_import_drivers() - -from chirp.drivers import generic_csv - -TESTS = {} - -time.sleep = lambda s: None - - -class TestError(Exception): - def get_detail(self): - return str(self) - - -class TestInternalError(TestError): - pass - - -class TestCrashError(TestError): - def __init__(self, tb, exc, args): - Exception.__init__(self, str(exc)) - self.__tb = tb - self.__exc = exc - self.__args = args - self.__mytb = "".join(traceback.format_stack()) - - def __str__(self): - return str(self.__exc) - - def get_detail(self): - return str(self.__exc) + os.linesep + \ - ("Args were: %s" % self.__args) + os.linesep + \ - self.__tb + os.linesep + \ - "Called from:" + os.linesep + self.__mytb - - def get_original_exception(self): - return self.__exc - - -class TestFailedError(TestError): - def __init__(self, msg, detail=""): - TestError.__init__(self, msg) - self._detail = detail - - def get_detail(self): - return self._detail - - -class TestSkippedError(TestError): - pass - - -def get_tb(): - return traceback.format_exc() - - -class TestWrapper: - def __init__(self, dstclass, filename, dst=None): - self._ignored_exceptions = [] - self._dstclass = dstclass - self._filename = filename - self._make_reload = False - self._dst = dst - self.open() - - def pass_exception_type(self, et): - self._ignored_exceptions.append(et) - - def nopass_exception_type(self, et): - self._ignored_exceptions.remove(et) - - def make_reload(self): - self._make_reload = True - - def open(self): - if self._dst: - self._dst.load_mmap(self._filename) - else: - self._dst = self._dstclass(self._filename) - - def close(self): - self._dst.save_mmap(self._filename) - - def do(self, function, *args, **kwargs): - if self._make_reload: - try: - self.open() - except Exception as e: - raise TestCrashError(get_tb(), e, "[Loading]") - - try: - fn = getattr(self._dst, function) - except KeyError: - raise TestInternalError("Model lacks function `%s'" % function) - - try: - ret = fn(*args, **kwargs) - except Exception as e: - if type(e) in self._ignored_exceptions: - raise e - details = str(args) + str(kwargs) - for arg in args: - if isinstance(arg, chirp_common.Memory): - details += os.linesep + \ - os.linesep.join(["%s:%s" % (k, v) for k, v - in list(arg.__dict__.items())]) - raise TestCrashError(get_tb(), e, details) - - if self._make_reload: - try: - self.close() - except Exception as e: - raise TestCrashError(get_tb(), e, "[Saving]") - - return ret - - def get_id(self): - return "%s %s %s" % (self._dst.VENDOR, - self._dst.MODEL, - self._dst.VARIANT) - - def get_radio(self): - return self._dst - - -class TestCase: - def __init__(self, wrapper): - self._wrapper = wrapper - - def prepare(self): - pass - - def run(self): - "Return True or False for Pass/Fail" - pass - - def cleanup(self): - pass - - def compare_mem(self, a, b, ignore=None): - rf = self._wrapper.do("get_features") - - if a.tmode == "Cross": - tx_mode, rx_mode = a.cross_mode.split("->") - - for k, v in list(a.__dict__.items()): - if ignore and k in ignore: - continue - if k == "power": - continue # FIXME - elif k == "immutable": - continue - elif k == "name": - if not rf.has_name: - continue # Don't complain about name, if not supported - else: - # Name mismatch fair if filter_name() is right - v = self._wrapper.do("filter_name", v).rstrip() - elif k == "tuning_step" and not rf.has_tuning_step: - continue - elif k == "rtone" and not ( - a.tmode == "Tone" or - (a.tmode == "TSQL" and not rf.has_ctone) or - (a.tmode == "Cross" and tx_mode == "Tone") or - (a.tmode == "Cross" and rx_mode == "Tone" and - not rf.has_ctone) - ): - continue - elif k == "ctone" and (not rf.has_ctone or - not (a.tmode == "TSQL" or - (a.tmode == "Cross" and - rx_mode == "Tone"))): - continue - elif k == "dtcs" and not ( - (a.tmode == "DTCS" and not rf.has_rx_dtcs) or - (a.tmode == "Cross" and tx_mode == "DTCS") or - (a.tmode == "Cross" and rx_mode == "DTCS" and - not rf.has_rx_dtcs)): - continue - elif k == "rx_dtcs" and (not rf.has_rx_dtcs or - not (a.tmode == "Cross" and - rx_mode == "DTCS")): - continue - elif k == "offset" and not a.duplex: - continue - elif k == "cross_mode" and a.tmode != "Cross": - continue - - try: - if b.__dict__[k] != v: - msg = "Field `%s' " % k + \ - "is `%s', " % b.__dict__[k] + \ - "expected `%s' " % v - # If we set a channel that came back with a duplex - # of 'off', we may have been outside the transmit range of - # the radio, so we should not fail. - if k == "duplex" and b.__dict__[k] == "off": - continue - details = msg - details += os.linesep + "### Wanted:" + os.linesep - details += os.linesep.join(["%s:%s" % (k, v) for k, v - in list(a.__dict__.items())]) - details += os.linesep + "### Got:" + os.linesep - details += os.linesep.join(["%s:%s" % (k, v) for k, v - in list(b.__dict__.items())]) - raise TestFailedError(msg, details) - except KeyError as e: - print(sorted(a.__dict__.keys())) - print(sorted(b.__dict__.keys())) - raise - - -class TestCaseCopyAll(TestCase): - "Copy Memories From CSV" - - def __str__(self): - return "CopyAll" - - def prepare(self): - testbase = os.path.dirname(os.path.abspath(__file__)) - source = os.path.join(testbase, 'images', 'Generic_CSV.csv') - self._src = generic_csv.CSVRadio(source) - - def run(self): - src_rf = self._src.get_features() - bounds = src_rf.memory_bounds - - dst_rf = self._wrapper.do("get_features") - dst_number = dst_rf.memory_bounds[0] - - failures = [] - - for number in range(bounds[0], bounds[1]): - src_mem = self._src.get_memory(number) - if src_mem.empty: - continue - - try: - dst_mem = import_logic.import_mem(self._wrapper.get_radio(), - src_rf, src_mem, - overrides={ - "number": dst_number}) - import_logic.import_bank(self._wrapper.get_radio(), - self._src, - dst_mem, - src_mem) - except import_logic.DestNotCompatible: - continue - except import_logic.ImportError as e: - failures.append(TestFailedError("<%i>: Import Failed: %s" % - (dst_number, e))) - continue - except Exception as e: - raise TestCrashError(get_tb(), e, "[Import]") - - self._wrapper.do("set_memory", dst_mem) - ret_mem = self._wrapper.do("get_memory", dst_number) - - try: - self.compare_mem(dst_mem, ret_mem) - except TestFailedError as e: - failures.append( - TestFailedError("<%i>: %s" % (number, e), e.get_detail())) - - return failures -TESTS["CopyAll"] = TestCaseCopyAll - - -class TestCaseBruteForce(TestCase): - def __str__(self): - return "BruteForce" - - def set_and_compare(self, m): - msgs = self._wrapper.do("validate_memory", m) - if msgs: - # If the radio correctly refuses memories it can't - # store, don't fail - return - - self._wrapper.do("set_memory", m) - ret_m = self._wrapper.do("get_memory", m.number) - - # Damned Baofeng radios don't seem to properly store - # shift and direction, so be gracious here - if m.duplex == "split" and ret_m.duplex in ["-", "+"]: - ret_m.offset = ret_m.freq + \ - (ret_m.offset * int(ret_m.duplex + "1")) - ret_m.duplex = "split" - - self.compare_mem(m, ret_m) - - def do_tone(self, m, rf): - self._wrapper.pass_exception_type(errors.UnsupportedToneError) - for tone in chirp_common.TONES: - for tmode in rf.valid_tmodes: - if tmode not in chirp_common.TONE_MODES: - continue - elif tmode in ["DTCS", "DTCS-R", "Cross"]: - continue # We'll test DCS and Cross tones separately - - m.tmode = tmode - if tmode == "": - pass - elif tmode == "Tone": - m.rtone = tone - elif tmode in ["TSQL", "TSQL-R"]: - if rf.has_ctone: - m.ctone = tone - else: - m.rtone = tone - else: - raise TestInternalError("Unknown tone mode `%s'" % tmode) - - try: - self.set_and_compare(m) - except errors.UnsupportedToneError as e: - # If a radio doesn't support a particular tone value, - # don't punish it - pass - self._wrapper.nopass_exception_type(errors.UnsupportedToneError) - - def do_dtcs(self, m, rf): - if not rf.has_dtcs: - return - - m.tmode = "DTCS" - for code in rf.valid_dtcs_codes: - m.dtcs = code - self.set_and_compare(m) - - if not rf.has_dtcs_polarity: - return - - for pol in rf.valid_dtcs_pols: - m.dtcs_polarity = pol - self.set_and_compare(m) - - def do_cross(self, m, rf): - if not rf.has_cross: - return - - m.tmode = "Cross" - # No fair asking a radio to detect two identical tones as Cross instead - # of TSQL - m.rtone = 100.0 - m.ctone = 107.2 - m.dtcs = 506 - m.rx_dtcs = 516 - for cross_mode in rf.valid_cross_modes: - m.cross_mode = cross_mode - self.set_and_compare(m) - - def do_duplex(self, m, rf): - for duplex in rf.valid_duplexes: - if duplex not in ["", "-", "+", "split"]: - continue - if duplex == "split" and not rf.can_odd_split: - raise TestFailedError("Forgot to set rf.can_odd_split!") - if duplex == "split": - m.offset = rf.valid_bands[0][1] - 100000 - m.duplex = duplex - self.set_and_compare(m) - - if rf.can_odd_split and "split" not in rf.valid_duplexes: - raise TestFailedError("Paste error: rf.can_odd_split defined, but " - "split duplex not supported.") - - def do_skip(self, m, rf): - for skip in rf.valid_skips: - m.skip = skip - self.set_and_compare(m) - - def do_mode(self, m, rf): - def ensure_urcall(call): - l = self._wrapper.do("get_urcall_list") - l[0] = call - self._wrapper.do("set_urcall_list", l) - - def ensure_rptcall(call): - l = self._wrapper.do("get_repeater_call_list") - l[0] = call - self._wrapper.do("set_repeater_call_list", l) - - def freq_is_ok(freq): - for lo, hi in rf.valid_bands: - if freq > lo and freq < hi: - return True - return False - - successes = 0 - for mode in rf.valid_modes: - tmp = copy.deepcopy(m) - if mode not in chirp_common.MODES: - continue - if mode == "DV" and \ - isinstance(self._wrapper._dst, - chirp_common.IcomDstarSupport): - tmp = chirp_common.DVMemory() - try: - ensure_urcall(tmp.dv_urcall) - ensure_rptcall(tmp.dv_rpt1call) - ensure_rptcall(tmp.dv_rpt2call) - except IndexError: - if rf.requires_call_lists: - raise - else: - # This radio may not do call lists at all, - # so let it slide - pass - if mode == "FM" and freq_is_ok(tmp.freq + 100000000): - # Some radios don't support FM below approximately 30MHz, - # so jump up by 100MHz, if they support that - tmp.freq += 100000000 - - tmp.mode = mode - - if rf.validate_memory(tmp): - # A result (of error messages) from validate means the radio - # thinks this is invalid, so don't fail the test - print('Failed to validate %s: %s' % (tmp, rf.validate_memory(tmp))) - continue - - self.set_and_compare(tmp) - successes += 1 - - if (not successes) and rf.valid_modes: - raise TestFailedError("All modes were skipped, " - "something went wrong") - - def run(self): - rf = self._wrapper.do("get_features") - - def clean_mem(): - m = chirp_common.Memory() - m.number = rf.memory_bounds[0] - try: - m.mode = rf.valid_modes[0] - except IndexError: - pass - if rf.valid_bands: - m.freq = rf.valid_bands[0][0] + 600000 - else: - m.freq = 146520000 - if m.freq < 30000000 and "AM" in rf.valid_modes: - m.mode = "AM" - return m - - tests = [ - self.do_tone, - self.do_dtcs, - self.do_cross, - self.do_duplex, - self.do_skip, - self.do_mode, - ] - for test in tests: - test(clean_mem(), rf) - - if 12.5 in rf.valid_tuning_steps and \ - "split" in rf.valid_duplexes: - m = clean_mem() - if rf.valid_bands: - m.offset = rf.valid_bands[0][1] - 12500 - else: - m.offset = 151137500 - m.duplex = "split" - self.set_and_compare(m) - - return [] -TESTS["BruteForce"] = TestCaseBruteForce - - -class TestCaseEdges(TestCase): - def __str__(self): - return "Edges" - - def _mem(self, rf): - m = chirp_common.Memory() - m.freq = rf.valid_bands[0][0] + 1000000 - if m.freq < 30000000 and "AM" in rf.valid_modes: - m.mode = "AM" - else: - try: - m.mode = rf.valid_modes[0] - except IndexError: - pass - - for i in range(*rf.memory_bounds): - m.number = i - if not self._wrapper.do("validate_memory", m): - return m - - raise TestSkippedError("No mutable memory locations found") - - def do_longname(self, rf): - m = self._mem(rf) - m.name = ("X" * 256) # Should be longer than any radio can handle - m.name = self._wrapper.do("filter_name", m.name) - - self._wrapper.do("set_memory", m) - n = self._wrapper.do("get_memory", m.number) - - self.compare_mem(m, n) - - def do_badname(self, rf): - m = self._mem(rf) - - ascii = "".join([chr(x) for x in range(ord(" "), ord("~")+1)]) - for i in range(0, len(ascii), 4): - m.name = self._wrapper.do("filter_name", ascii[i:i+4]) - self._wrapper.do("set_memory", m) - n = self._wrapper.do("get_memory", m.number) - self.compare_mem(m, n) - - def do_bandedges(self, rf): - m = self._mem(rf) - min_step = min(rf.has_tuning_step and rf.valid_tuning_steps or [10]) - - for low, high in rf.valid_bands: - for freq in (low, high - int(min_step * 1000)): - m.freq = freq - if self._wrapper.do("validate_memory", m): - # Radio doesn't like it, so skip - continue - - self._wrapper.do("set_memory", m) - n = self._wrapper.do("get_memory", m.number) - self.compare_mem(m, n) - - def do_oddsteps(self, rf): - odd_steps = { - 145000000: [145856250, 145862500], - 445000000: [445856250, 445862500], - 862000000: [862731250, 862737500], - } - - m = self._mem(rf) - - for low, high in rf.valid_bands: - for band, totest in list(odd_steps.items()): - if band < low or band > high: - continue - for testfreq in totest: - step = chirp_common.required_step(testfreq) - if step not in rf.valid_tuning_steps: - continue - - m.freq = testfreq - m.tuning_step = step - self._wrapper.do("set_memory", m) - n = self._wrapper.do("get_memory", m.number) - self.compare_mem(m, n, ignore=['tuning_step']) - - def do_empty_to_not(self, rf): - firstband = rf.valid_bands[0] - testfreq = firstband[0] - for loc in range(*rf.memory_bounds): - m = self._wrapper.do('get_memory', loc) - if m.empty: - m.empty = False - m.freq = testfreq - self._wrapper.do('set_memory', m) - m = self._wrapper.do('get_memory', loc) - if m.freq == testfreq: - return - else: - raise TestFailedError('Radio failed to set an empty ' - 'location (%i)' % loc) - - def do_delete_memory(self, rf): - firstband = rf.valid_bands[0] - testfreq = firstband[0] - for loc in range(*rf.memory_bounds): - if loc == rf.memory_bounds[0]: - # Some radios will not allow you to delete the first memory - # /me glares at yaesu - continue - m = self._wrapper.do('get_memory', loc) - if not m.empty: - m.empty = True - self._wrapper.do('set_memory', m) - m = self._wrapper.do('get_memory', loc) - if not m.empty: - raise TestFailedError('Radio refused to delete a memory ' - 'location (%i)' % loc) - else: - return - - def run(self): - rf = self._wrapper.do("get_features") - - if not rf.valid_bands: - raise TestFailedError("Radio does not provide valid bands!") - - self.do_longname(rf) - self.do_bandedges(rf) - self.do_oddsteps(rf) - self.do_badname(rf) - if rf.can_delete: - self.do_empty_to_not(rf) - self.do_delete_memory(rf) - - return [] - -TESTS["Edges"] = TestCaseEdges - - -class TestCaseSettings(TestCase): - def __str__(self): - return "Settings" - - def do_get_settings(self, rf): - lst = self._wrapper.do("get_settings") - if not isinstance(lst, list): - raise TestFailedError("Invalid Radio Settings") - - def do_same_settings(self, rf): - o = self._wrapper.do("get_settings") - self._wrapper.do("set_settings", o) - n = self._wrapper.do("get_settings") - list(map(self.compare_settings, o, n)) - - @staticmethod - def compare_settings(a, b): - try: - if isinstance(a, settings.RadioSettingValue): - raise TypeError('Hit bottom') - list(map(TestCaseSettings.compare_settings, a, b)) - except TypeError: - if a.get_value() != b.get_value(): - msg = "Field is `%s', " % b + \ - "expected `%s' " % a - details = msg - raise TestFailedError(msg, details) - - def run(self): - rf = self._wrapper.do("get_features") - - if not rf.has_settings: - raise TestSkippedError("Settings not supported") - - self.do_get_settings(rf) - self.do_same_settings(rf) - - return [] - -TESTS["Settings"] = TestCaseSettings - - -class TestCaseBanks(TestCase): - def __str__(self): - return "Banks" - - def _do_bank_names(self, rf, testname): - bm = self._wrapper.do("get_bank_model") - banks = bm.get_mappings() - - for bank in banks: - name = bank.get_name() - try: - bank.set_name(testname) - except AttributeError: - return [], [] - except Exception as e: - if str(e) == "Not implemented": - return [], [] - else: - raise e - - return banks, bm.get_mappings() - - def do_bank_names(self, rf): - banks, newbanks = self._do_bank_names(rf, "T") - - for i in range(0, len(banks)): - if banks[i].get_name() != newbanks[i].get_name(): - raise TestFailedError("Bank names not preserved", - "Tried %s on %i\nGot %s" % (banks[i], - i, - newbanks[i])) - - def do_bank_names_toolong(self, rf): - testname = "Not possibly this long" - banks, newbanks = self._do_bank_names(rf, testname) - - for i in range(0, len(newbanks)): - # Truncation is allowed, but not failure - if not testname.lower().startswith(str(newbanks[i]).lower()): - raise TestFailedError("Bank names not properly truncated", - "Tried: %s on %i\nGot: %s" % - (testname, i, newbanks[i])) - - def do_bank_names_no_trailing_whitespace(self, rf): - banks, newbanks = self._do_bank_names(rf, "foo ") - - for bank in newbanks: - if str(bank) != str(bank).rstrip(): - raise TestFailedError("Bank names stored with " + - "trailing whitespace") - - def do_bank_store(self, rf): - loc = rf.memory_bounds[0] - mem = chirp_common.Memory() - mem.number = loc - mem.freq = rf.valid_bands[0][0] + 100000 - - # Make sure the memory is empty and we create it from scratch - mem.empty = True - self._wrapper.do("set_memory", mem) - - mem.empty = False - self._wrapper.do("set_memory", mem) - - model = self._wrapper.do("get_bank_model") - - # If in your bank model every channel has to be tied to a bank, just - # add a variable named channelAlwaysHasBank to it and make it True - try: - channelAlwaysHasBank = model.channelAlwaysHasBank - except: - channelAlwaysHasBank = False - - mem_banks = model.get_memory_mappings(mem) - if channelAlwaysHasBank: - if len(mem_banks) == 0: - raise TestFailedError("Freshly-created memory has no banks " + - "and it should", "Bank: %s" % - str(mem_banks)) - else: - if len(mem_banks) != 0: - raise TestFailedError("Freshly-created memory has banks " + - "and should not", "Bank: %s" % - str(mem_banks)) - - banks = model.get_mappings() - - def verify(bank): - if bank not in model.get_memory_mappings(mem): - return "Memory does not claim bank" - - if loc not in [x.number for x in model.get_mapping_memories(bank)]: - return "Bank does not claim memory" - - return None - - model.add_memory_to_mapping(mem, banks[0]) - reason = verify(banks[0]) - if reason is not None: - raise TestFailedError("Setting memory bank does not persist", - "%s\nMemory banks:%s\nBank memories:%s" % - (reason, - model.get_memory_mappings(mem), - model.get_mapping_memories(banks[0]))) - - model.remove_memory_from_mapping(mem, banks[0]) - reason = verify(banks[0]) - if reason is None and not channelAlwaysHasBank: - raise TestFailedError("Memory remains in bank after remove", - reason) - - try: - model.remove_memory_from_mapping(mem, banks[0]) - did_error = False - except Exception: - did_error = True - - if not did_error and not channelAlwaysHasBank: - raise TestFailedError("Removing memory from non-member bank " + - "did not raise Exception") - - def do_bank_index(self, rf): - if not rf.has_bank_index: - return - - loc = rf.memory_bounds[0] - mem = chirp_common.Memory() - mem.number = loc - mem.freq = rf.valid_bands[0][0] + 100000 - - self._wrapper.do("set_memory", mem) - - model = self._wrapper.do("get_bank_model") - banks = model.get_mappings() - index_bounds = model.get_index_bounds() - - model.add_memory_to_mapping(mem, banks[0]) - for i in range(0, *index_bounds): - model.set_memory_index(mem, banks[0], i) - if model.get_memory_index(mem, banks[0]) != i: - raise TestFailedError("Bank index not persisted") - - suggested_index = model.get_next_mapping_index(banks[0]) - if suggested_index not in list(range(*index_bounds)): - raise TestFailedError("Suggested bank index not in valid range", - "Got %i, range is %s" % (suggested_index, - index_bounds)) - - def run(self): - rf = self._wrapper.do("get_features") - - if not rf.has_bank: - raise TestSkippedError("Banks not supported") - - self.do_bank_names(rf) - self.do_bank_names_toolong(rf) - self.do_bank_names_no_trailing_whitespace(rf) - self.do_bank_store(rf) - # Again to make sure we clear bank info on delete - self.do_bank_store(rf) - self.do_bank_index(rf) - - return [] - -TESTS["Banks"] = TestCaseBanks - - -class TestCaseDetect(TestCase): - def __str__(self): - return "Detect" - - def run(self): - if isinstance(self._wrapper._dst, chirp_common.LiveRadio): - raise TestSkippedError("This is a live radio") - - filename = self._wrapper._filename - - try: - radio = directory.get_radio_by_image(filename) - except Exception as e: - raise TestFailedError("Failed to detect", str(e)) - - if radio.__class__.__name__ == 'DynamicRadioAlias': - # This was detected via metadata and wrapped, which means - # we found the appropriate class. - pass - elif issubclass(self._wrapper._dstclass, radio.__class__): - pass - elif issubclass(radio.__class__, self._wrapper._dstclass): - pass - elif radio.__class__ != self._wrapper._dstclass: - raise TestFailedError("%s detected as %s for %s" % - (self._wrapper._dstclass, radio.__class__, - filename)) - return [] - -TESTS["Detect"] = TestCaseDetect - - -class TestCaseClone(TestCase): - class SerialNone: - def __init__(self, isbytes): - self.isbytes = isbytes - self.mismatch = False - self.mismatch_at = None - - def read(self, size): - if self.isbytes: - return b"" - else: - return "" - - def write(self, data): - expected = self.isbytes and bytes or str - if six.PY2: - # One driver uses bytearray() which will trigger this - # check even though it works fine on py2. So, only - # do this check for PY3 which is where it matters - # anyway. - pass - elif not self.mismatch and not isinstance(data, expected): - self.mismatch = True - self.mismatch_at = ''.join(traceback.format_stack()) - pass - - def setBaudrate(self, rate): - pass - - def setTimeout(self, timeout): - pass - - def setParity(self, parity): - pass - - def __str__(self): - return self.__class__.__name__.replace("Serial", "") - - class SerialError(SerialNone): - def read(self, size): - raise Exception("Foo") - - def write(self, data): - raise Exception("Bar") - - class SerialGarbage(SerialNone): - def read(self, size): - if self.isbytes: - buf = [] - for i in range(0, size): - buf += i % 256 - return bytes(buf) - else: - buf = "" - for i in range(0, size): - buf += chr(i % 256) - return buf - - class SerialShortGarbage(SerialNone): - def read(self, size): - if self.isbytes: - return b'\x00' * (size - 1) - else: - return "\x00" * (size - 1) - - def __str__(self): - return "Clone" - - def _run(self, serial): - error = None - live = isinstance(self._wrapper._dst, chirp_common.LiveRadio) - clone = isinstance(self._wrapper._dst, chirp_common.CloneModeRadio) - - if not clone and not live: - raise TestSkippedError('Does not support clone') - - try: - radio = self._wrapper._dst.__class__(serial) - radio.status_fn = lambda s: True - except Exception as e: - error = e - - if not live: - if error is not None: - raise TestFailedError("Clone radio tried to read from " + - "serial on init") - else: - if not isinstance(error, errors.RadioError): - raise TestFailedError("Live radio didn't notice serial " + - "was dead on init") - return [] # Nothing more to test on an error'd live radio - - error = None - try: - radio.sync_in() - except Exception as e: - error = e - - if error is None: - raise TestFailedError("Radio did not raise exception " + - "with %s data" % serial, - "On sync_in()") - elif not isinstance(error, errors.RadioError): - raise TestFailedError("Radio did not raise RadioError " + - "with %s data" % serial, - "sync_in() Got: %s (%s)\n%s" % - (error.__class__.__name__, - error, get_tb())) - - if radio.NEEDS_COMPAT_SERIAL: - radio._mmap = memmap.MemoryMap("\x00" * (1024 * 128)) - else: - radio._mmap = memmap.MemoryMapBytes(bytes(b"\x00") * (1024 * 128)) - - error = None - try: - radio.sync_out() - except Exception as e: - error = e - - if error is None: - raise TestFailedError("Radio did not raise exception " + - "with %s data" % serial, - "On sync_out()") - elif not isinstance(error, errors.RadioError): - raise TestFailedError("Radio did not raise RadioError " + - "with %s data" % serial, - "sync_out(): Got: %s (%s)" % - (error.__class__.__name__, error)) - - if serial.mismatch: - raise TestFailedError("Radio tried to write the wrong " - "type of data to the %s pipe." % ( - serial.__class__.__name__), - "TestClone:%s\n%s" % ( - serial.__class__.__name__, - serial.mismatch_at)) - - return [] - - def run(self): - isbytes = not self._wrapper._dst.NEEDS_COMPAT_SERIAL - self._run(self.SerialError(isbytes)) - self._run(self.SerialNone(isbytes)) - self._run(self.SerialGarbage(isbytes)) - self._run(self.SerialShortGarbage(isbytes)) - return [] - -TESTS["Clone"] = TestCaseClone - - -class TestOutput: - def __init__(self, output=None): - if not output: - output = sys.stdout - self._out = output - - def prepare(self): - pass - - def cleanup(self): - pass - - def _print(self, string): - print(string, file=self._out) - - def report(self, rclass, tc, msg, e): - name = ("%s %s" % (rclass.MODEL, rclass.VARIANT))[:13] - self._print("%9s %-13s %-10s %s %s" % (rclass.VENDOR.split(" ")[0], - name, - tc, - msg, e)) - - -class TestOutputANSI(TestOutput): - def __init__(self, output=None): - TestOutput.__init__(self, output) - self.__counts = { - "PASSED": 0, - "FAILED": 0, - "CRASHED": 0, - "SKIPPED": 0, - } - self.__total = 0 - - def report(self, rclass, tc, msg, e): - self.__total += 1 - self.__counts[msg] += 1 - msg += ":" - if os.isatty(1): - if msg == "PASSED:": - msg = "\033[1;32m%8s\033[0m" % msg - elif msg == "FAILED:": - msg = "\033[1;41m%8s\033[0m" % msg - elif msg == "CRASHED:": - msg = "\033[1;45m%8s\033[0m" % msg - elif msg == "SKIPPED:": - msg = "\033[1;32m%8s\033[0m" % msg - else: - msg = "%8s" % msg - - TestOutput.report(self, rclass, tc, msg, e) - - def cleanup(self): - self._print("-" * 70) - self._print("Results:") - self._print(" %-7s: %i" % ("TOTAL", self.__total)) - for t, c in list(self.__counts.items()): - self._print(" %-7s: %i" % (t, c)) - - -class TestOutputHTML(TestOutput): - def __init__(self, filename): - self._filename = filename - - def prepare(self): - print("Writing to %s" % self._filename, end=' ') - sys.stdout.flush() - self._out = open(self._filename, "w") - s = """ - - -Test report for CHIRP version %s - - - -

Test report for CHIRP version %s

-

Generated on %s (%s)

-
- - - - -""" % (CHIRP_VERSION, CHIRP_VERSION, time.strftime("%x at %X"), os.name) - print(s, file=self._out) - - def cleanup(self): - print("
VendorModelTest CaseStatusMessage
", file=self._out) - self._out.close() - print("Done") - - def report(self, rclass, tc, msg, e): - s = ("" % msg) + \ - ("%s" % rclass.VENDOR) + \ - ("%s %s" % - (rclass.MODEL, rclass.VARIANT)) + \ - ("%s" % tc) + \ - ("%s" % (msg, msg)) + \ - ("%s" % e) + \ - "" - print(s, file=self._out) - sys.stdout.write(".") - sys.stdout.flush() - - -class TestRunner: - def __init__(self, images_dir, test_list, test_out): - self._images_dir = images_dir - self._test_list = test_list - self._test_out = test_out - if not os.path.exists("tmp"): - os.mkdir("tmp") - - def _make_list(self): - run_list = [] - images = glob.glob(os.path.join(self._images_dir, "*.img")) - for image in sorted(images): - drv_name, _ = os.path.splitext(os.path.basename(image)) - run_list.append((directory.get_radio(drv_name), image)) - return run_list - - def report(self, rclass, tc, msg, e): - self._test_out.report(rclass, tc, msg, e) - - def log(self, rclass, tc, e): - fn = "logs/%s_%s.log" % (directory.radio_class_id(rclass), tc) - log = open(fn, "a") - print("---- Begin test %s ----" % tc, file=log) - log.write(e.get_detail()) - print(file=log) - print("---- End test %s ----" % tc, file=log) - log.close() - - def nuke_log(self, rclass, tc): - fn = "logs/%s_%s.log" % (directory.radio_class_id(rclass), tc) - if os.path.exists(fn): - os.remove(fn) - - def _run_one(self, rclass, parm, dst=None): - nfailed = 0 - for tcclass in self._test_list: - nprinted = 0 - tw = TestWrapper(rclass, parm, dst=dst) - tc = tcclass(tw) - - self.nuke_log(rclass, tc) - - tc.prepare() - - try: - failures = tc.run() - for e in failures: - self.report(rclass, tc, "FAILED", e) - if e.get_detail(): - self.log(rclass, tc, e) - nfailed += 1 - nprinted += 1 - except TestFailedError as e: - self.report(rclass, tc, "FAILED", e) - if e.get_detail(): - self.log(rclass, tc, e) - nfailed += 1 - nprinted += 1 - except TestCrashError as e: - self.report(rclass, tc, "CRASHED", e) - self.log(rclass, tc, e) - nfailed += 1 - nprinted += 1 - except TestSkippedError as e: - self.report(rclass, tc, "SKIPPED", e) - self.log(rclass, tc, e) - nprinted += 1 - - tc.cleanup() - - if not nprinted: - self.report(rclass, tc, "PASSED", "All tests") - - return nfailed - - def run_rclass_image(self, rclass, image, dst=None): - rid = "%s_%s_" % (rclass.VENDOR, rclass.MODEL) - rid = rid.replace("/", "_") - # Do this for things like Generic_CSV, that demand it - _base, ext = os.path.splitext(image) - testimage = tempfile.mktemp(ext, rid) - shutil.copy(image, testimage) - - try: - tw = TestWrapper(rclass, testimage, dst=dst) - rf = tw.do("get_features") - if rf.has_sub_devices: - devices = tw.do("get_sub_devices") - failed = 0 - for dev in devices: - failed += self.run_rclass_image(dev.__class__, image, dst=dev) - return failed - else: - return self._run_one(rclass, image, dst=dst) - finally: - os.remove(testimage) - - def run_list(self, run_list): - def _key(pair): - return pair[0].VENDOR + pair[0].MODEL + pair[0].VARIANT - failed = 0 - for rclass, image in sorted(run_list, key=_key): - failed += self.run_rclass_image(rclass, image) - return failed - - def run_all(self): - run_list = self._make_list() - return self.run_list(run_list) - - def run_one(self, drv_name): - return self.run_rclass_image(directory.get_radio(drv_name), - os.path.join("images", - "%s.img" % drv_name)) - - def run_one_live(self, drv_name, port): - rclass = directory.get_radio(drv_name) - pipe = Serial(port=port, baudrate=rclass.BAUD_RATE, timeout=0.5) - tw = TestWrapper(rclass, pipe) - rf = tw.do("get_features") - if rf.has_sub_devices: - devices = tw.do("get_sub_devices") - failed = 0 - for device in devices: - failed += self._run_one(device.__class__, pipe) - return failed - else: - return self._run_one(rclass, pipe) - -if __name__ == "__main__": - import sys - - images = glob.glob("images/*.img") - tests = [os.path.splitext(os.path.basename(img))[0] for img in images] - - op = OptionParser() - op.add_option("-d", "--driver", dest="driver", default=None, - help="Driver to test (omit for all)") - op.add_option("-t", "--test", dest="test", default=None, - help="Test to run (omit for all)") - op.add_option("-e", "--exclude", dest="exclude", default=None, - help="Test to exclude") - op.add_option("", "--html", dest="html", default=None, - help="Output to HTML file") - op.add_option("-l", "--live", dest="live", default=None, - help="Live radio on this port (requires -d)") - op.usage = """ -Available drivers: -%s -Available tests: -%s -""" % ("\n".join([" %s" % x for x in sorted(tests)]), - "\n".join([" %s" % x for x in sorted(TESTS.keys())])) - - (options, args) = op.parse_args() - - if options.html: - test_out = TestOutputHTML(options.html) - else: - stdout = sys.stdout - try: - os.mkdir("logs") - except FileExistsError: - pass - sys.stdout = open("logs/verbose", "w") - test_out = TestOutputANSI(stdout) - - test_out.prepare() - - if options.exclude: - del TESTS[options.exclude] - - if options.test: - tr = TestRunner("images", [TESTS[options.test]], test_out) - else: - tr = TestRunner("images", list(TESTS.values()), test_out) - - if options.live: - if not options.driver: - print("Live mode requires a driver to be specified") - sys.exit(1) - failed = tr.run_one_live(options.driver, options.live) - elif options.driver: - failed = tr.run_one(options.driver) - else: - failed = tr.run_all() - - test_out.cleanup() - - sys.exit(failed) diff --git a/tests/test_banks.py b/tests/test_banks.py new file mode 100644 index 0000000..bc57ef9 --- /dev/null +++ b/tests/test_banks.py @@ -0,0 +1,114 @@ +from chirp import chirp_common +from tests import base + + +class TestCaseBanks(base.DriverTest): + @base.requires_feature('has_bank_names') + def test_bank_names(self, testname='T'): + bm = self.radio.get_bank_model() + banks = bm.get_mappings() + + for bank in banks: + self.assertIsInstance(bank.get_name(), str, + 'Bank model returned non-string name') + bank.set_name(testname) + + for bank in bm.get_mappings(): + # We allow truncated storage of the name + self.assertTrue( + testname.lower().startswith(bank.get_name().lower()), + 'Bank name %r did not stick after set_name(%r)' % ( + bank.get_name(), testname)) + # Bank names should not contain trailing whitespace + self.assertEqual(bank.get_name(), bank.get_name().rstrip(), + 'Bank stored with trailing whitespace') + + @base.requires_feature('has_bank_names') + def test_bank_names_toolong(self): + testname = "Not possibly this long" + self.test_bank_names(testname) + + @base.requires_feature('has_bank_names') + def test_bank_names_no_trailing_whitespace(self): + self.test_bank_names('foo ') + + @base.requires_feature('has_bank') + def test_bank_store(self): + loc = self.rf.memory_bounds[0] + mem = chirp_common.Memory() + mem.number = loc + mem.freq = self.rf.valid_bands[0][0] + 100000 + + # Make sure the memory is empty and we create it from scratch + mem.empty = True + self.radio.set_memory(mem) + + mem.empty = False + self.radio.set_memory(mem) + + model = self.radio.get_bank_model() + + # If in your bank model every channel has to be tied to a bank, just + # add a variable named channelAlwaysHasBank to it and make it True + try: + channelAlwaysHasBank = model.channelAlwaysHasBank + except Exception: + channelAlwaysHasBank = False + + mem_banks = model.get_memory_mappings(mem) + if channelAlwaysHasBank: + self.assertNotEqual(0, len(mem_banks), + 'Freshly-created memory has no banks ' + 'but it should') + else: + self.assertEqual(0, len(mem_banks), + 'Freshly-created memory has banks ' + 'and should not') + + banks = model.get_mappings() + + model.add_memory_to_mapping(mem, banks[0]) + self.assertIn(banks[0], model.get_memory_mappings(mem), + 'Memory does not claim bank after add') + self.assertIn(loc, [x.number + for x in model.get_mapping_memories(banks[0])], + 'Bank does not claim memory after add') + + model.remove_memory_from_mapping(mem, banks[0]) + if not channelAlwaysHasBank: + self.assertNotIn(banks[0], model.get_memory_mappings(mem), + 'Memory claims bank after remove') + self.assertNotIn(loc, [x.number + for x in model.get_mapping_memories( + banks[0])], + 'Bank claims memory after remove') + + if not channelAlwaysHasBank: + # FIXME: We really need a standard exception for this, because + # catching Exception here papers over the likely failures from + # this going unchecked. + self.assertRaises(Exception, + model.remove_memory_from_mapping, mem, banks[0]) + + @base.requires_feature('has_bank_index') + def test_bank_index(self): + loc = self.rf.memory_bounds[0] + mem = chirp_common.Memory() + mem.number = loc + mem.freq = self.rf.valid_bands[0][0] + 100000 + + self.radio.set_memory(mem) + + model = self.radio.get_bank_model() + banks = model.get_mappings() + index_bounds = model.get_index_bounds() + + model.add_memory_to_mapping(mem, banks[0]) + for i in range(*index_bounds): + model.set_memory_index(mem, banks[0], i) + self.assertEqual(i, model.get_memory_index(mem, banks[0]), + 'Bank index not persisted') + + suggested_index = model.get_next_mapping_index(banks[0]) + self.assertIn(suggested_index, list(range(*index_bounds)), + 'Suggested bank index not in valid range') diff --git a/tests/test_brute_force.py b/tests/test_brute_force.py new file mode 100644 index 0000000..236e11a --- /dev/null +++ b/tests/test_brute_force.py @@ -0,0 +1,194 @@ +import copy +import logging + +from chirp import chirp_common +from chirp import errors +from tests import base + +LOG = logging.getLogger(__name__) + + +class TestCaseBruteForce(base.DriverTest): + def set_and_compare(self, m, **kwargs): + msgs = self.radio.validate_memory(m) + if msgs: + # If the radio correctly refuses memories it can't + # store, don't fail + return + + self.radio.set_memory(chirp_common.FrozenMemory(m)) + ret_m = self.radio.get_memory(m.number) + + # Damned Baofeng radios don't seem to properly store + # shift and direction, so be gracious here + if m.duplex == "split" and ret_m.duplex in ["-", "+"]: + ret_m.offset = ret_m.freq + \ + (ret_m.offset * int(ret_m.duplex + "1")) + ret_m.duplex = "split" + + self.assertEqualMem(m, ret_m, **kwargs) + + def test_tone(self): + m = self.get_mem() + for tone in chirp_common.TONES: + for tmode in self.rf.valid_tmodes: + if tmode not in chirp_common.TONE_MODES: + continue + elif tmode in ["DTCS", "DTCS-R", "Cross"]: + continue # We'll test DCS and Cross tones separately + + m.tmode = tmode + if tmode == "": + pass + elif tmode == "Tone": + m.rtone = tone + elif tmode in ["TSQL", "TSQL-R"]: + if self.rf.has_ctone: + m.ctone = tone + else: + m.rtone = tone + else: + self.fail("Unknown tone mode `%s'" % tmode) + + try: + self.set_and_compare(m) + except errors.UnsupportedToneError: + # If a radio doesn't support a particular tone value, + # don't punish it + pass + + @base.requires_feature('has_dtcs') + def test_dtcs(self): + m = self.get_mem() + m.tmode = "DTCS" + for code in self.rf.valid_dtcs_codes: + m.dtcs = code + self.set_and_compare(m) + + if not self.rf.has_dtcs_polarity: + return + + for pol in self.rf.valid_dtcs_pols: + m.dtcs_polarity = pol + self.set_and_compare(m) + + @base.requires_feature('has_cross') + def test_cross(self): + m = self.get_mem() + m.tmode = "Cross" + # No fair asking a radio to detect two identical tones as Cross instead + # of TSQL + m.rtone = 100.0 + m.ctone = 107.2 + m.dtcs = 506 + m.rx_dtcs = 516 + for cross_mode in self.rf.valid_cross_modes: + m.cross_mode = cross_mode + self.set_and_compare(m) + + @base.requires_feature('valid_duplexes') + def test_duplex(self): + m = self.get_mem() + if 'duplex' in m.immutable: + self.skipTest('Test memory has immutable duplex') + for duplex in self.rf.valid_duplexes: + if duplex not in ["", "-", "+", "split"]: + continue + if duplex == 'split': + self.assertTrue(self.rf.can_odd_split, + 'Radio supports split but does not set ' + 'can_odd_split=True in features') + m.offset = self.rf.valid_bands[0][1] - 100000 + else: + m.offset = chirp_common.to_kHz(int(m.tuning_step) * 2) + m.duplex = duplex + # Ignore the offset because we do some fudging on this and we + # don't necessarily know the best step to use. What we care about + # is duplex here. + self.set_and_compare(m, ignore=['offset']) + + if self.rf.can_odd_split: + self.assertIn('split', self.rf.valid_duplexes, + 'Radio claims can_odd_split but split not in ' + 'valid_duplexes') + + @base.requires_feature('valid_skips') + def test_skip(self): + mem = self.get_mem() + lo, hi = self.rf.memory_bounds + # Walk through several memories, specifically across 8 and 16, + # as many radio use bitfields for skip flags. + for i in range(max(5, lo), min(25, hi)): + # Walk through the skip flags twice each, to make sure we can + # toggle them on..off..on + for skip in self.rf.valid_skips * 2: + m = mem.dupe() + if 'empty' not in m.immutable: + m.empty = False + m.number = i + m.skip = skip + self.set_and_compare(m) + # Delete the memory each time because some radios are + # dynamically allocated and will run out of space here. + self.radio.erase_memory(m.number) + + @base.requires_feature('valid_modes') + def test_mode(self): + m = self.get_mem() + if 'mode' in m.immutable: + self.skipTest('Test memory has immutable duplex') + + def ensure_urcall(call): + lst = self.radio.get_urcall_list() + lst[0] = call + self.radio.set_urcall_list(lst) + + def ensure_rptcall(call): + lst = self.radio.get_repeater_call_list() + lst[0] = call + self.radio.set_repeater_call_list(lst) + + def freq_is_ok(freq): + for lo, hi in self.rf.valid_bands: + if freq > lo and freq < hi: + return True + return False + + successes = 0 + for mode in self.rf.valid_modes: + self.assertIn(mode, chirp_common.MODES, + 'Radio exposes non-standard mode') + tmp = copy.deepcopy(m) + if mode == "DV" and \ + isinstance(self.radio, + chirp_common.IcomDstarSupport): + tmp = chirp_common.DVMemory() + try: + ensure_urcall(tmp.dv_urcall) + ensure_rptcall(tmp.dv_rpt1call) + ensure_rptcall(tmp.dv_rpt2call) + except IndexError: + if self.rf.requires_call_lists: + raise + else: + # This radio may not do call lists at all, + # so let it slide + pass + if mode == "FM" and freq_is_ok(tmp.freq + 100000000): + # Some radios don't support FM below approximately 30MHz, + # so jump up by 100MHz, if they support that + tmp.freq += 100000000 + + tmp.mode = mode + + if self.rf.validate_memory(tmp): + # A result (of error messages) from validate means the radio + # thinks this is invalid, so don't fail the test + LOG.warning('Failed to validate %s: %s' % ( + tmp, self.rf.validate_memory(tmp))) + continue + + # Ignore tuning_step because changing modes may cause step changes + # in some radios + self.set_and_compare(tmp, ignore=['tuning_step']) + successes += 1 diff --git a/tests/test_clone.py b/tests/test_clone.py new file mode 100644 index 0000000..ef13805 --- /dev/null +++ b/tests/test_clone.py @@ -0,0 +1,103 @@ +import logging +import time +from unittest import mock + +from chirp import chirp_common +from chirp import errors +from tests import base + +LOG = logging.getLogger(__name__) + + +class SerialNone: + def read(self, size): + return b"" + + def write(self, data): + if not isinstance(data, bytes): + raise TypeError('Radio wrote non-bytes to serial') + + def setBaudrate(self, rate): + pass + + def setTimeout(self, timeout): + pass + + def setParity(self, parity): + pass + + def __str__(self): + return self.__class__.__name__.replace("Serial", "") + + +class SerialError(SerialNone): + def read(self, size): + raise Exception("Foo") + + def write(self, data): + raise Exception("Bar") + + +class SerialGarbage(SerialNone): + def read(self, size): + buf = [] + for i in range(0, size): + buf.append(i % 256) + return bytes(buf) + + +class SerialShortGarbage(SerialNone): + def read(self, size): + return b'\x00' * (size - 1) + + +class TestCaseClone(base.DriverTest): + def setUp(self): + super().setUp() + self.live = isinstance(self.radio, chirp_common.LiveRadio) + self.clone = isinstance(self.radio, chirp_common.CloneModeRadio) + + if not self.clone and not self.live: + self.skipTest('Does not support clone') + + real_time = time.time + + def fake_time(): + return real_time() * 1000 + + self.patches = [] + self.use_patch(mock.patch('time.sleep')) + self.use_patch(mock.patch('time.time', + side_effect=fake_time)) + + def _test_with_serial(self, serial): + # The base case sets us up with a file, so re-init with our serial. + # The radio must not read (or fail) with unexpected/error serial + # behavior on init. + LOG.info('Initializing radio with fake serial; Radio should not fail') + orig_mmap = self.parent._mmap + self.radio = self.RADIO_CLASS(serial) + self.radio._mmap = orig_mmap + self.radio.status_fn = lambda s: True + + msg = ('Clone should have failed and raised an exception ' + 'that inherits from RadioError') + with self.assertRaises(errors.RadioError, msg=msg): + self.radio.sync_in() + + msg = ('Clone should have failed and raised an exception ' + 'that inherits from RadioError') + with self.assertRaises(errors.RadioError, msg=msg): + self.radio.sync_out() + + def test_clone_serial_error(self): + self._test_with_serial(SerialError()) + + def test_clone_serial_none(self): + self._test_with_serial(SerialNone()) + + def test_clone_serial_garbage(self): + self._test_with_serial(SerialGarbage()) + + def test_clone_serial_short_garbage(self): + self._test_with_serial(SerialShortGarbage()) diff --git a/tests/test_copy_all.py b/tests/test_copy_all.py new file mode 100644 index 0000000..0888667 --- /dev/null +++ b/tests/test_copy_all.py @@ -0,0 +1,52 @@ +import os + +from chirp.drivers import generic_csv +from chirp import import_logic +from tests import base + + +class TestCaseCopyAll(base.DriverTest): + "Copy Memories From CSV" + + def setUp(self): + super().setUp() + csvfile = os.path.join(os.path.dirname(self.TEST_IMAGE), + 'Generic_CSV.csv') + self.src_radio = generic_csv.CSVRadio(csvfile) + + def test_copy(self): + src_rf = self.src_radio.get_features() + bounds = src_rf.memory_bounds + + for dst_number in range(self.rf.memory_bounds[0], + min(self.rf.memory_bounds[0] + 10, + self.rf.memory_bounds[1])): + cur_mem = self.radio.get_memory(dst_number) + if not cur_mem.empty and 'freq' in cur_mem.immutable: + # Keep looking + continue + else: + break + else: + self.skipTest('No channels with mutable freq found to use') + + for number in range(bounds[0], bounds[1]): + src_mem = self.src_radio.get_memory(number) + if src_mem.empty: + continue + + try: + dst_mem = import_logic.import_mem(self.radio, + src_rf, src_mem, + overrides={ + "number": dst_number}) + import_logic.import_bank(self.radio, + self.src_radio, + dst_mem, + src_mem) + except import_logic.DestNotCompatible: + continue + + self.radio.set_memory(dst_mem) + ret_mem = self.radio.get_memory(dst_number) + self.assertEqualMem(dst_mem, ret_mem) diff --git a/tests/test_detect.py b/tests/test_detect.py new file mode 100644 index 0000000..5a94cb9 --- /dev/null +++ b/tests/test_detect.py @@ -0,0 +1,42 @@ +import logging +import sys +from unittest import mock + +import pytest + +from chirp import directory +from tests import base + + +class TestCaseDetect(base.DriverTest): + def test_detect(self): + radio = directory.get_radio_by_image(self.TEST_IMAGE) + if hasattr(radio, '_orig_rclass'): + radio = radio._orig_rclass(self.TEST_IMAGE) + if isinstance(self.radio, radio.__class__): + # If we are a sub-device of the detected class then that's fine. + # There's no good way for us to know that other than checking, so + # the below assertion is just for show. + self.assertIsInstance(self.radio, radio.__class__) + else: + self.assertIsInstance(radio, self.RADIO_CLASS, + "Image %s detected as %s but expected %s" % ( + self.TEST_IMAGE, + radio.__class__, self.RADIO_CLASS)) + + @pytest.mark.skipif(sys.version_info < (3, 10), + reason="requires python3.10 or higher") + @mock.patch('builtins.print') + def test_match_model_is_quiet_no_match(self, mock_print): + with self.assertNoLogs(level=logging.DEBUG): + self.radio.match_model(b'', 'foo.img') + mock_print.assert_not_called() + + @pytest.mark.skipif(sys.version_info < (3, 10), + reason="requires python3.10 or higher") + @mock.patch('builtins.print') + def test_match_model_is_quiet_with_match(self, mock_print): + with self.assertNoLogs(level=logging.DEBUG): + with open(self.TEST_IMAGE, 'rb') as f: + self.radio.match_model(f.read(), self.TEST_IMAGE) + mock_print.assert_not_called() diff --git a/tests/test_drivers.py b/tests/test_drivers.py index ba8aaf9..2d7f4f4 100644 --- a/tests/test_drivers.py +++ b/tests/test_drivers.py @@ -1,9 +1,8 @@ -import sys -import unittest - from chirp import directory from tests import load_tests +__builtins__['_'] = lambda s: s + class TestSuiteAdapter(object): """Adapter for pytest since it doesn't support the loadTests() protocol""" @@ -19,6 +18,6 @@ class TestSuiteAdapter(object): pass -directory.safe_import_drivers() +directory.import_drivers() adapter = TestSuiteAdapter(locals()) load_tests(adapter, None, None, suite=adapter) diff --git a/tests/test_edges.py b/tests/test_edges.py new file mode 100644 index 0000000..e515330 --- /dev/null +++ b/tests/test_edges.py @@ -0,0 +1,156 @@ +from chirp import chirp_common +from chirp import errors +from tests import base + + +class TestCaseEdges(base.DriverTest): + def test_longname(self): + m = self.get_mem() + m.name = ("X" * 256) # Should be longer than any radio can handle + m.name = self.radio.filter_name(m.name) + + self.radio.set_memory(m) + n = self.radio.get_memory(m.number) + + self.assertEqualMem(m, n) + + def test_badname(self): + m = self.get_mem() + + ascii = "".join([chr(x) for x in range(ord(" "), ord("~")+1)]) + for i in range(0, len(ascii), 4): + m.name = self.radio.filter_name(ascii[i:i+4]) + self.radio.set_memory(m) + n = self.radio.get_memory(m.number) + self.assertEqualMem(m, n) + + def test_bandedges(self): + m = self.get_mem() + min_step = min(self.rf.has_tuning_step and + self.rf.valid_tuning_steps or [10]) + + for low, high in self.rf.valid_bands: + for freq in (low, high - int(min_step * 1000)): + try: + m.freq = freq + except chirp_common.ImmutableValueError: + self.skipTest('Test memory has immutable freq') + if self.radio.validate_memory(m): + # Radio doesn't like it, so skip + continue + + self.radio.set_memory(m) + n = self.radio.get_memory(m.number) + self.assertEqualMem(m, n) + + def test_oddsteps(self): + odd_steps = { + 145000000: [145856250, 145862500], + 445000000: [445856250, 445862500], + 862000000: [862731250, 862737500], + } + + m = self.get_mem() + + for low, high in self.rf.valid_bands: + for band, totest in list(odd_steps.items()): + if band < low or band > high: + continue + for testfreq in totest: + step = chirp_common.required_step(testfreq) + if step not in self.rf.valid_tuning_steps: + continue + + try: + m.freq = testfreq + except chirp_common.ImmutableValueError: + self.skipTest('Test channel has immutable freq') + m.tuning_step = step + self.radio.set_memory(m) + n = self.radio.get_memory(m.number) + self.assertEqualMem(m, n, ignore=['tuning_step']) + + def test_empty_to_not(self): + firstband = self.rf.valid_bands[0] + testfreq = firstband[0] + for loc in range(*self.rf.memory_bounds): + m = self.radio.get_memory(loc) + if m.empty: + m.empty = False + m.freq = testfreq + self.radio.set_memory(m) + m = self.radio.get_memory(loc) + self.assertEqual(testfreq, m.freq, + 'Radio returned an unexpected frequency when' + 'setting previously-empty location %i' % loc) + break + + def test_delete_memory(self): + for loc in range(*self.rf.memory_bounds): + m = self.radio.get_memory(loc) + if 'empty' in m.immutable: + # This memory is not deletable + continue + if not m.empty: + m.empty = True + self.radio.set_memory(m) + m = self.radio.get_memory(loc) + self.assertTrue(m.empty, + 'Radio returned non-empty memory when asked ' + 'to delete location %i' % loc) + break + + def test_get_set_specials(self): + if not self.rf.valid_special_chans: + self.skipTest('Radio has no specials') + lo, hi = self.rf.memory_bounds + for name in self.rf.valid_special_chans: + m1 = self.radio.get_memory(name) + try: + del m1.extra + except AttributeError: + pass + if m1.freq > 130000000 and m1.freq < 500000000: + m1.freq += 5000 + try: + self.radio.set_memory(m1) + except errors.RadioError: + # If the radio raises RadioError, assume we're editing a + # special channel that is not editable + continue + m2 = self.radio.get_memory(name) + self.assertEqualMem(m1, m2, ignore=['name']) + + self.assertFalse( + lo < m1.number < hi, + 'Special memory %s maps into memory bounds at %i' % ( + name, m1.number)) + + def test_check_regular_not_special(self): + lo, hi = self.rf.memory_bounds + for i in range(lo, hi + 1): + m = self.radio.get_memory(i) + self.assertEqual('', m.extd_number, + 'Non-special memory %i should not have ' + 'extd_number set to %r' % (i, m.extd_number)) + + def test_get_memory_name_trailing_whitespace(self): + if self.radio.MODEL == 'KG-UV8E': + self.skipTest('The UV8E driver is so broken it does not even ' + 'parse its own test image cleanly') + for i in range(*self.rf.memory_bounds): + m = self.radio.get_memory(i) + self.assertEqual(m.name.rstrip(), m.name, + 'Radio returned a memory with trailing ' + 'whitespace in the name') + + def test_memory_name_stripped(self): + if ' ' not in self.rf.valid_characters: + self.skipTest('Radio does not support space characters') + m1 = self.get_mem() + m1.name = 'FOO ' + self.radio.set_memory(m1) + m2 = self.radio.get_memory(m1.number) + self.assertEqual(m2.name.rstrip(), m2.name, + 'Radio set and returned a memory with trailing ' + 'whitespace in the name') diff --git a/tests/test_features.py b/tests/test_features.py new file mode 100644 index 0000000..a0aa3df --- /dev/null +++ b/tests/test_features.py @@ -0,0 +1,14 @@ +from unittest import mock + +from tests import base + + +class TestCaseFeatures(base.DriverTest): + def test_prompts(self): + self.use_patch(mock.patch('builtins._', create=True, + side_effect=lambda s: s)) + prompts = self.radio.get_prompts() + for p in ('info', 'experimental', 'pre_download', 'pre_upload'): + prompt = getattr(prompts, p) + if prompt is not None: + self.assertIsInstance(prompt, str) diff --git a/tests/test_settings.py b/tests/test_settings.py new file mode 100644 index 0000000..83b1db1 --- /dev/null +++ b/tests/test_settings.py @@ -0,0 +1,36 @@ +from chirp import settings +from tests import base + + +class TestCaseSettings(base.DriverTest): + def test_has_settings(self): + return + settings = self.radio.get_settings() + if settings: + self.assertFalse(self.rf.has_settings, + 'Radio returned settings but has_settings=False') + else: + self.assertTrue(self.rf.has_settings, + 'Radio returned no settings but has_settings=True') + + @base.requires_feature('has_settings') + def test_get_settings(self): + lst = self.radio.get_settings() + self.assertIsInstance(lst, list) + + @base.requires_feature('has_settings') + def test_same_settings(self): + o = self.radio.get_settings() + self.radio.set_settings(o) + n = self.radio.get_settings() + list(map(self.compare_settings, o, n)) + + def compare_settings(self, a, b): + try: + if isinstance(a, settings.RadioSettingValue): + raise StopIteration + list(map(self.compare_settings, a, b)) + except StopIteration: + self.assertEqual(a.get_value(), b.get_value(), + 'Setting value changed from %r to %r' % ( + a.get_value(), b.get_value())) diff --git a/tests/unit/__pycache__/__init__.cpython-310.pyc b/tests/unit/__pycache__/__init__.cpython-310.pyc new file mode 100644 index 0000000..da9e377 Binary files /dev/null and b/tests/unit/__pycache__/__init__.cpython-310.pyc differ diff --git a/tests/unit/__pycache__/base.cpython-310.pyc b/tests/unit/__pycache__/base.cpython-310.pyc new file mode 100644 index 0000000..a5f2379 Binary files /dev/null and b/tests/unit/__pycache__/base.cpython-310.pyc differ diff --git a/tests/unit/__pycache__/test_alinco_clone.cpython-310-pytest-7.1.3.pyc b/tests/unit/__pycache__/test_alinco_clone.cpython-310-pytest-7.1.3.pyc new file mode 100644 index 0000000..f9c396a Binary files /dev/null and b/tests/unit/__pycache__/test_alinco_clone.cpython-310-pytest-7.1.3.pyc differ diff --git a/tests/unit/__pycache__/test_bandplan.cpython-310-pytest-7.1.3.pyc b/tests/unit/__pycache__/test_bandplan.cpython-310-pytest-7.1.3.pyc new file mode 100644 index 0000000..90f6947 Binary files /dev/null and b/tests/unit/__pycache__/test_bandplan.cpython-310-pytest-7.1.3.pyc differ diff --git a/tests/unit/__pycache__/test_baofeng_fmradio.cpython-310-pytest-7.1.3.pyc b/tests/unit/__pycache__/test_baofeng_fmradio.cpython-310-pytest-7.1.3.pyc new file mode 100644 index 0000000..dab22da Binary files /dev/null and b/tests/unit/__pycache__/test_baofeng_fmradio.cpython-310-pytest-7.1.3.pyc differ diff --git a/tests/unit/__pycache__/test_bitwise.cpython-310-pytest-7.1.3.pyc b/tests/unit/__pycache__/test_bitwise.cpython-310-pytest-7.1.3.pyc new file mode 100644 index 0000000..5066d3a Binary files /dev/null and b/tests/unit/__pycache__/test_bitwise.cpython-310-pytest-7.1.3.pyc differ diff --git a/tests/unit/__pycache__/test_chirp_common.cpython-310-pytest-7.1.3.pyc b/tests/unit/__pycache__/test_chirp_common.cpython-310-pytest-7.1.3.pyc new file mode 100644 index 0000000..cd2beb0 Binary files /dev/null and b/tests/unit/__pycache__/test_chirp_common.cpython-310-pytest-7.1.3.pyc differ diff --git a/tests/unit/__pycache__/test_cli.cpython-310-pytest-7.1.3.pyc b/tests/unit/__pycache__/test_cli.cpython-310-pytest-7.1.3.pyc new file mode 100644 index 0000000..54b2b75 Binary files /dev/null and b/tests/unit/__pycache__/test_cli.cpython-310-pytest-7.1.3.pyc differ diff --git a/tests/unit/__pycache__/test_csv.cpython-310-pytest-7.1.3.pyc b/tests/unit/__pycache__/test_csv.cpython-310-pytest-7.1.3.pyc new file mode 100644 index 0000000..b086c48 Binary files /dev/null and b/tests/unit/__pycache__/test_csv.cpython-310-pytest-7.1.3.pyc differ diff --git a/tests/unit/__pycache__/test_directory.cpython-310-pytest-7.1.3.pyc b/tests/unit/__pycache__/test_directory.cpython-310-pytest-7.1.3.pyc new file mode 100644 index 0000000..9afe903 Binary files /dev/null and b/tests/unit/__pycache__/test_directory.cpython-310-pytest-7.1.3.pyc differ diff --git a/tests/unit/__pycache__/test_icf.cpython-310-pytest-7.1.3.pyc b/tests/unit/__pycache__/test_icf.cpython-310-pytest-7.1.3.pyc new file mode 100644 index 0000000..5062558 Binary files /dev/null and b/tests/unit/__pycache__/test_icf.cpython-310-pytest-7.1.3.pyc differ diff --git a/tests/unit/__pycache__/test_icom_clone.cpython-310-pytest-7.1.3.pyc b/tests/unit/__pycache__/test_icom_clone.cpython-310-pytest-7.1.3.pyc new file mode 100644 index 0000000..4424e62 Binary files /dev/null and b/tests/unit/__pycache__/test_icom_clone.cpython-310-pytest-7.1.3.pyc differ diff --git a/tests/unit/__pycache__/test_import_logic.cpython-310-pytest-7.1.3.pyc b/tests/unit/__pycache__/test_import_logic.cpython-310-pytest-7.1.3.pyc new file mode 100644 index 0000000..21d7cd4 Binary files /dev/null and b/tests/unit/__pycache__/test_import_logic.cpython-310-pytest-7.1.3.pyc differ diff --git a/tests/unit/__pycache__/test_kguv8d.cpython-310-pytest-7.1.3.pyc b/tests/unit/__pycache__/test_kguv8d.cpython-310-pytest-7.1.3.pyc new file mode 100644 index 0000000..95bbc13 Binary files /dev/null and b/tests/unit/__pycache__/test_kguv8d.cpython-310-pytest-7.1.3.pyc differ diff --git a/tests/unit/__pycache__/test_kguv920.cpython-310-pytest-7.1.3.pyc b/tests/unit/__pycache__/test_kguv920.cpython-310-pytest-7.1.3.pyc new file mode 100644 index 0000000..2ce1f3f Binary files /dev/null and b/tests/unit/__pycache__/test_kguv920.cpython-310-pytest-7.1.3.pyc differ diff --git a/tests/unit/__pycache__/test_mappingmodel.cpython-310-pytest-7.1.3.pyc b/tests/unit/__pycache__/test_mappingmodel.cpython-310-pytest-7.1.3.pyc new file mode 100644 index 0000000..61df6d5 Binary files /dev/null and b/tests/unit/__pycache__/test_mappingmodel.cpython-310-pytest-7.1.3.pyc differ diff --git a/tests/unit/__pycache__/test_network_sources.cpython-310-pytest-7.1.3.pyc b/tests/unit/__pycache__/test_network_sources.cpython-310-pytest-7.1.3.pyc new file mode 100644 index 0000000..1cb2ea9 Binary files /dev/null and b/tests/unit/__pycache__/test_network_sources.cpython-310-pytest-7.1.3.pyc differ diff --git a/tests/unit/__pycache__/test_repeaterbook.cpython-310-pytest-7.1.3.pyc b/tests/unit/__pycache__/test_repeaterbook.cpython-310-pytest-7.1.3.pyc new file mode 100644 index 0000000..48d419c Binary files /dev/null and b/tests/unit/__pycache__/test_repeaterbook.cpython-310-pytest-7.1.3.pyc differ diff --git a/tests/unit/__pycache__/test_settings.cpython-310-pytest-7.1.3.pyc b/tests/unit/__pycache__/test_settings.cpython-310-pytest-7.1.3.pyc new file mode 100644 index 0000000..fad2d83 Binary files /dev/null and b/tests/unit/__pycache__/test_settings.cpython-310-pytest-7.1.3.pyc differ diff --git a/tests/unit/__pycache__/test_th9800.cpython-310-pytest-7.1.3.pyc b/tests/unit/__pycache__/test_th9800.cpython-310-pytest-7.1.3.pyc new file mode 100644 index 0000000..2ca3282 Binary files /dev/null and b/tests/unit/__pycache__/test_th9800.cpython-310-pytest-7.1.3.pyc differ diff --git a/tests/unit/__pycache__/test_util.cpython-310-pytest-7.1.3.pyc b/tests/unit/__pycache__/test_util.cpython-310-pytest-7.1.3.pyc new file mode 100644 index 0000000..07096b2 Binary files /dev/null and b/tests/unit/__pycache__/test_util.cpython-310-pytest-7.1.3.pyc differ diff --git a/tests/unit/__pycache__/test_wxui_radiothread.cpython-310-pytest-7.1.3.pyc b/tests/unit/__pycache__/test_wxui_radiothread.cpython-310-pytest-7.1.3.pyc new file mode 100644 index 0000000..bee4b94 Binary files /dev/null and b/tests/unit/__pycache__/test_wxui_radiothread.cpython-310-pytest-7.1.3.pyc differ diff --git a/tests/unit/__pycache__/test_yaesu_clone.cpython-310-pytest-7.1.3.pyc b/tests/unit/__pycache__/test_yaesu_clone.cpython-310-pytest-7.1.3.pyc new file mode 100644 index 0000000..70a8d06 Binary files /dev/null and b/tests/unit/__pycache__/test_yaesu_clone.cpython-310-pytest-7.1.3.pyc differ diff --git a/tests/unit/base.py b/tests/unit/base.py index 8b90a44..72c554a 100644 --- a/tests/unit/base.py +++ b/tests/unit/base.py @@ -1,59 +1,17 @@ -import sys +import builtins import unittest -import mock - -try: - import mox -except ImportError: - from mox3 import mox - import warnings warnings.simplefilter('ignore', Warning) +builtins._ = lambda x: x + class BaseTest(unittest.TestCase): def setUp(self): __builtins__['_'] = lambda s: s - self.mox = mox.Mox() + self.mocks = [] def tearDown(self): - self.mox.UnsetStubs() - self.mox.VerifyAll() - - -pygtk_mocks = ('gtk', 'pango', 'gobject') -pygtk_base_classes = ('gobject.GObject', 'gtk.HBox', 'gtk.Dialog') - - -class DummyBase(object): - def __init__(self, *a, **k): - # gtk.Dialog - self.vbox = mock.MagicMock() - - # gtk.Dialog - def set_position(self, pos): - pass - - -def mock_gtk(): - for module in pygtk_mocks: - sys.modules[module] = mock.MagicMock() - - for path in pygtk_base_classes: - module, base_class = path.split('.') - setattr(sys.modules[module], base_class, DummyBase) - - -def unmock_gtk(): - for module in pygtk_mocks: - del sys.modules[module] - - -class BaseGTKTest(BaseTest): - def setUp(self): - super(BaseGTKTest, self).setUp() - try: - import gtk - except ImportError: - self.skipTest('pygtk not available') + for m in self.mocks: + m.stop() diff --git a/tests/unit/rb-united_states-oregon.json b/tests/unit/rb-united_states-oregon.json new file mode 100644 index 0000000..a2255f1 --- /dev/null +++ b/tests/unit/rb-united_states-oregon.json @@ -0,0 +1,20795 @@ +{ +"count": 462, +"results": [ +{ +"State ID": "41", +"Rptr ID": "2", +"Frequency": "145.17000", +"Input Freq": "144.57000", +"PL": "110.9", +"TSQ": "110.9", +"Nearest City": "Lime", +"Landmark": "Lime Hill", +"County": "Baker", +"State": "Oregon", +"Country": "United States", +"Lat": "44.43144989", +"Long": "-117.24941254", +"Precise": "1", +"Callsign": "W7NYW", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-11-18" +}, { +"State ID": "41", +"Rptr ID": "3", +"Frequency": "145.27000", +"Input Freq": "144.67000", +"PL": "110.9", +"TSQ": "110.9", +"Nearest City": "Baker City", +"Landmark": "Beaver Mountain", +"County": "Baker", +"State": "Oregon", +"Country": "United States", +"Lat": "44.58649826", +"Long": "-117.78700256", +"Precise": "1", +"Callsign": "W7NYW", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "414516", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-11-18" +}, { +"State ID": "41", +"Rptr ID": "18776", +"Frequency": "147.12000", +"Input Freq": "147.72000", +"PL": "100.0", +"TSQ": "", +"Nearest City": "Huntington", +"Landmark": "", +"County": "Baker", +"State": "Oregon", +"Country": "United States", +"Lat": "44.35127260", +"Long": "-117.26656860", +"Precise": "0", +"Callsign": "K7OJI", +"Use": "OPEN", +"Operational Status": "Unknown", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "0", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2021-10-09" +}, { +"State ID": "41", +"Rptr ID": "14", +"Frequency": "146.78000", +"Input Freq": "146.18000", +"PL": "156.7", +"TSQ": "107.2", +"Nearest City": "Corvallis", +"Landmark": "Marys Peak", +"County": "Benton", +"State": "Oregon", +"Country": "United States", +"Lat": "44.50469971", +"Long": "-123.55300140", +"Precise": "1", +"Callsign": "K7CVO", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "Yes", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "0", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2021-09-06" +}, { +"State ID": "41", +"Rptr ID": "16", +"Frequency": "147.16000", +"Input Freq": "147.76000", +"PL": "100.0", +"TSQ": "", +"Nearest City": "Corvallis", +"Landmark": "Vineyard Mountain", +"County": "Benton", +"State": "Oregon", +"Country": "United States", +"Lat": "44.64039993", +"Long": "-123.27500153", +"Precise": "1", +"Callsign": "W7OSU", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "Yes", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2020-09-07" +}, { +"State ID": "41", +"Rptr ID": "17", +"Frequency": "441.97500", +"Input Freq": "446.97500", +"PL": "100.0", +"TSQ": "", +"Nearest City": "Corvallis", +"Landmark": "West Marys Peak", +"County": "Benton", +"State": "Oregon", +"Country": "United States", +"Lat": "44.50469971", +"Long": "-123.55300140", +"Precise": "1", +"Callsign": "W7CQZ", +"Use": "OPEN", +"Operational Status": "Unknown", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "0", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2021-02-19" +}, { +"State ID": "41", +"Rptr ID": "19", +"Frequency": "442.30000", +"Input Freq": "447.30000", +"PL": "162.2", +"TSQ": "", +"Nearest City": "Corvallis", +"Landmark": "Good Sam Hospital", +"County": "Benton", +"State": "Oregon", +"Country": "United States", +"Lat": "44.60120010", +"Long": "-123.25299835", +"Precise": "1", +"Callsign": "N8GFO", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "Yes", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "0", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2021-02-19" +}, { +"State ID": "41", +"Rptr ID": "3089", +"Frequency": "440.42500", +"Input Freq": "445.42500", +"PL": "D125", +"TSQ": "D125", +"Nearest City": "Corvallis", +"Landmark": "Mary's Peak", +"County": "Benton", +"State": "Oregon", +"Country": "United States", +"Lat": "44.50469971", +"Long": "-123.55300140", +"Precise": "1", +"Callsign": "K7LNK", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "", +"IRLP Node": "", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "4,097 feet ASL.", +"Last Update": "2020-10-09" +}, { +"State ID": "41", +"Rptr ID": "6277", +"Frequency": "146.82000", +"Input Freq": "146.22000", +"PL": "100.0", +"TSQ": "100.0", +"Nearest City": "Corvallis", +"Landmark": "Marys Peak", +"County": "Benton", +"State": "Oregon", +"Country": "United States", +"Lat": "44.50759888", +"Long": "-123.57599640", +"Precise": "1", +"Callsign": "WA7TUV", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-11-18" +}, { +"State ID": "41", +"Rptr ID": "7445", +"Frequency": "443.05000", +"Input Freq": "448.05000", +"PL": "D032", +"TSQ": "D032", +"Nearest City": "Corvallis", +"Landmark": "Dearborn Hall", +"County": "Benton", +"State": "Oregon", +"Country": "United States", +"Lat": "44.56733720", +"Long": "-123.27552370", +"Precise": "1", +"Callsign": "W7OSU", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "Yes", +"YSF DG ID Uplink": "00", +"YSF DG IS Downlink": "00", +"YSF DSC": "Open", +"Notes": "On-campus repeater for club communications.", +"Last Update": "2022-02-24" +}, { +"State ID": "41", +"Rptr ID": "12350", +"Frequency": "440.80000", +"Input Freq": "445.80000", +"PL": "D125", +"TSQ": "", +"Nearest City": "Corvallis", +"Landmark": "", +"County": "Benton", +"State": "Oregon", +"Country": "United States", +"Lat": "44.56460190", +"Long": "-123.26200104", +"Precise": "0", +"Callsign": "AB7BS", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2021-06-24" +}, { +"State ID": "41", +"Rptr ID": "18785", +"Frequency": "441.72500", +"Input Freq": "446.72500", +"PL": "136.5", +"TSQ": "", +"Nearest City": "Corvallis", +"Landmark": "", +"County": "Benton", +"State": "Oregon", +"Country": "United States", +"Lat": "44.56456590", +"Long": "-123.26204350", +"Precise": "0", +"Callsign": "AB7BS", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "0", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2021-07-04" +}, { +"State ID": "41", +"Rptr ID": "19703", +"Frequency": "444.27500", +"Input Freq": "449.27500", +"PL": "67.0", +"TSQ": "", +"Nearest City": "Corvallis", +"Landmark": "Marys Peak", +"County": "Benton", +"State": "Oregon", +"Country": "United States", +"Lat": "44.50750000", +"Long": "-123.57528000", +"Precise": "1", +"Callsign": "K7WVD", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "0", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "Yes", +"DMR Color Code": "1", +"DMR ID": "312072", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "Please be sure to disconnect from reflectors & talkgroups when you are finished. Monitoring Talkgroups and reflectors occupy the repeater, preventing other modes from being used. Please be courteous! 67.0PL for analog operation.", +"Last Update": "2022-12-03" +}, { +"State ID": "41", +"Rptr ID": "26", +"Frequency": "146.94000", +"Input Freq": "146.34000", +"PL": "CSQ", +"TSQ": "", +"Nearest City": "Clackamas", +"Landmark": "Mt Scott", +"County": "Clackamas", +"State": "Oregon", +"Country": "United States", +"Lat": "45.45479965", +"Long": "-122.55100250", +"Precise": "1", +"Callsign": "W7LT", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "", +"IRLP Node": "", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": " ", +"Last Update": "2021-06-23" +}, { +"State ID": "41", +"Rptr ID": "27", +"Frequency": "146.96000", +"Input Freq": "146.36000", +"PL": "127.3", +"TSQ": "127.3", +"Nearest City": "Colton", +"Landmark": "Goat Mountain", +"County": "Clackamas", +"State": "Oregon", +"Country": "United States", +"Lat": "45.13150024", +"Long": "-122.29699707", +"Precise": "1", +"Callsign": "W7OTV", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "917904", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "CARES second alternate repeater.", +"Last Update": "2022-12-15" +}, { +"State ID": "41", +"Rptr ID": "28", +"Frequency": "147.12000", +"Input Freq": "147.72000", +"PL": "100.0", +"TSQ": "100.0", +"Nearest City": "Timberline", +"Landmark": "", +"County": "Clackamas", +"State": "Oregon", +"Country": "United States", +"Lat": "45.30300140", +"Long": "-121.74299622", +"Precise": "1", +"Callsign": "K7RPT", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "Yes", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "329379", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "CARES Primary repeater.", +"Last Update": "2022-11-18" +}, { +"State ID": "41", +"Rptr ID": "29", +"Frequency": "147.28000", +"Input Freq": "147.88000", +"PL": "167.9", +"TSQ": "167.9", +"Nearest City": "Clackamas", +"Landmark": "Mt Scott", +"County": "Clackamas", +"State": "Oregon", +"Country": "United States", +"Lat": "45.45479965", +"Long": "-122.55100250", +"Precise": "1", +"Callsign": "WB7QIW", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "Yes", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "", +"IRLP Node": "", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "MC-2 Multnomah County ARES", +"Last Update": "2022-05-28" +}, { +"State ID": "41", +"Rptr ID": "33", +"Frequency": "440.25000", +"Input Freq": "445.25000", +"PL": "127.3", +"TSQ": "", +"Nearest City": "Colton", +"Landmark": "Goat Mountain", +"County": "Clackamas", +"State": "Oregon", +"Country": "United States", +"Lat": "45.13150024", +"Long": "-122.29699707", +"Precise": "1", +"Callsign": "W7OTV", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "Yes", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "", +"IRLP Node": "", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "CARES third alternate repeater.", +"Last Update": "2021-06-23" +}, { +"State ID": "41", +"Rptr ID": "34", +"Frequency": "440.30000", +"Input Freq": "445.30000", +"PL": "167.9", +"TSQ": "", +"Nearest City": "Clackamas", +"Landmark": "Mt Scott", +"County": "Clackamas", +"State": "Oregon", +"Country": "United States", +"Lat": "45.45489883", +"Long": "-122.55100250", +"Precise": "1", +"Callsign": "KC7MZM", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "No", +"DMR": "Yes", +"DMR Color Code": "1", +"DMR ID": "311758", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-03-13" +}, { +"State ID": "41", +"Rptr ID": "38", +"Frequency": "442.07500", +"Input Freq": "447.07500", +"PL": "103.5", +"TSQ": "103.5", +"Nearest City": "Oregon City", +"Landmark": "Boynton Standpipe Water Tower", +"County": "Clackamas", +"State": "Oregon", +"Country": "United States", +"Lat": "45.35509872", +"Long": "-122.60700226", +"Precise": "0", +"Callsign": "W7ZRS", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "Yes", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "", +"IRLP Node": "", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2021-06-23" +}, { +"State ID": "41", +"Rptr ID": "42", +"Frequency": "443.47500", +"Input Freq": "448.47500", +"PL": "167.9", +"TSQ": "167.9", +"Nearest City": "Clackamas", +"Landmark": "Mt Scott", +"County": "Clackamas", +"State": "Oregon", +"Country": "United States", +"Lat": "45.45479965", +"Long": "-122.55100250", +"Precise": "1", +"Callsign": "WB7QIW", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "", +"IRLP Node": "", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-01-12" +}, { +"State ID": "41", +"Rptr ID": "45", +"Frequency": "444.22500", +"Input Freq": "449.22500", +"PL": "100.0", +"TSQ": "100.0", +"Nearest City": "Timberline", +"Landmark": "Magic Mile Chairlift", +"County": "Clackamas", +"State": "Oregon", +"Country": "United States", +"Lat": "45.30300140", +"Long": "-121.74299622", +"Precise": "1", +"Callsign": "K7RPT", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-11-18" +}, { +"State ID": "41", +"Rptr ID": "59", +"Frequency": "146.80000", +"Input Freq": "146.20000", +"PL": "107.2", +"TSQ": "107.2", +"Nearest City": "Clackamas", +"Landmark": "Timberline", +"County": "Clackamas", +"State": "Oregon", +"Country": "United States", +"Lat": "45.33323900", +"Long": "-121.71432100", +"Precise": "1", +"Callsign": "KJ7IY", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "82962", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2021-09-08" +}, { +"State ID": "41", +"Rptr ID": "78", +"Frequency": "440.70000", +"Input Freq": "445.70000", +"PL": "77.0", +"TSQ": "77.0", +"Nearest City": "Molalla", +"Landmark": "Molalla Fire District 73", +"County": "Clackamas", +"State": "Oregon", +"Country": "United States", +"Lat": "45.14730072", +"Long": "-122.57700348", +"Precise": "0", +"Callsign": "W7DTV", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "", +"IRLP Node": "", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-12-06" +}, { +"State ID": "41", +"Rptr ID": "92", +"Frequency": "443.70000", +"Input Freq": "448.70000", +"PL": "103.5", +"TSQ": "103.5", +"Nearest City": "Colton", +"Landmark": "Goat Mountain", +"County": "Clackamas", +"State": "Oregon", +"Country": "United States", +"Lat": "45.13119888", +"Long": "-122.29699707", +"Precise": "1", +"Callsign": "N7PIR", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "132225", +"IRLP Node": "3420", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-11-18" +}, { +"State ID": "41", +"Rptr ID": "93", +"Frequency": "443.87500", +"Input Freq": "448.87500", +"PL": "103.5", +"TSQ": "103.5", +"Nearest City": "Government Camp", +"Landmark": "", +"County": "Clackamas", +"State": "Oregon", +"Country": "United States", +"Lat": "45.28749847", +"Long": "-121.78199768", +"Precise": "1", +"Callsign": "N7PIR", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "132225", +"IRLP Node": "3420", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "5,070 feet ASL.", +"Last Update": "2021-06-23" +}, { +"State ID": "41", +"Rptr ID": "111", +"Frequency": "1291.00000", +"Input Freq": "1271.00000", +"PL": "107.2", +"TSQ": "", +"Nearest City": "Clackamas", +"Landmark": "", +"County": "Clackamas", +"State": "Oregon", +"Country": "United States", +"Lat": "45.40760040", +"Long": "-122.56999969", +"Precise": "0", +"Callsign": "KB7WUK", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "63 watts EIRP", +"Last Update": "2022-04-05" +}, { +"State ID": "41", +"Rptr ID": "113", +"Frequency": "53.35000", +"Input Freq": "51.65000", +"PL": "107.2", +"TSQ": "107.2", +"Nearest City": "Sandy", +"Landmark": "", +"County": "Clackamas", +"State": "Oregon", +"Country": "United States", +"Lat": "45.39730072", +"Long": "-122.26100159", +"Precise": "1", +"Callsign": "KJ7IY", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-04-05" +}, { +"State ID": "41", +"Rptr ID": "130", +"Frequency": "442.87500", +"Input Freq": "447.87500", +"PL": "107.2", +"TSQ": "107.2", +"Nearest City": "Sandy", +"Landmark": "", +"County": "Clackamas", +"State": "Oregon", +"Country": "United States", +"Lat": "45.39730072", +"Long": "-122.26100159", +"Precise": "0", +"Callsign": "KJ7IY", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "Yes", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "", +"IRLP Node": "", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-12-06" +}, { +"State ID": "41", +"Rptr ID": "133", +"Frequency": "443.15000", +"Input Freq": "448.15000", +"PL": "107.2", +"TSQ": "107.2", +"Nearest City": "Clackamas", +"Landmark": "Mt Scott", +"County": "Clackamas", +"State": "Oregon", +"Country": "United States", +"Lat": "45.45460129", +"Long": "-122.55100250", +"Precise": "0", +"Callsign": "KJ7IY", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "Yes", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "", +"IRLP Node": "", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-01-12" +}, { +"State ID": "41", +"Rptr ID": "254", +"Frequency": "444.45000", +"Input Freq": "449.45000", +"PL": "131.8", +"TSQ": "", +"Nearest City": "Canby", +"Landmark": "", +"County": "Clackamas", +"State": "Oregon", +"Country": "United States", +"Lat": "45.26309967", +"Long": "-122.69100189", +"Precise": "0", +"Callsign": "K7CFD", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "0", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "This repeater us not listed in the ORRC online database at: http://www.orrc.org/Coordinations/Published. Tried to add AC6SZ -- RICHARD V. MARTIN -- TRUSTEE as a Repeater Custodian, but AC6SZ must first obtain a Repeaterbook.com account before being added as a custodian. Please ask the AC6SZ to register for an account. There are currently no custodians for this repeater. ", +"Last Update": "2021-03-16" +}, { +"State ID": "41", +"Rptr ID": "281", +"Frequency": "442.92500", +"Input Freq": "447.92500", +"PL": "107.2", +"TSQ": "", +"Nearest City": "Colton", +"Landmark": "", +"County": "Clackamas", +"State": "Oregon", +"Country": "United States", +"Lat": "45.17219925", +"Long": "-122.43699646", +"Precise": "0", +"Callsign": "WB7DZG", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "", +"IRLP Node": "", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-12-06" +}, { +"State ID": "41", +"Rptr ID": "452", +"Frequency": "442.42500", +"Input Freq": "447.42500", +"PL": "100.0", +"TSQ": "", +"Nearest City": "Sandy", +"Landmark": "", +"County": "Clackamas", +"State": "Oregon", +"Country": "United States", +"Lat": "45.40499878", +"Long": "-122.27500153", +"Precise": "0", +"Callsign": "KE7AWR", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "0", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2021-02-23" +}, { +"State ID": "41", +"Rptr ID": "481", +"Frequency": "145.43000", +"Input Freq": "144.83000", +"PL": "107.2", +"TSQ": "107.2", +"Nearest City": "Colton", +"Landmark": "", +"County": "Clackamas", +"State": "Oregon", +"Country": "United States", +"Lat": "45.17211920", +"Long": "-122.43748030", +"Precise": "1", +"Callsign": "KJ7IY", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "Yes", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "82962", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2021-01-16" +}, { +"State ID": "41", +"Rptr ID": "496", +"Frequency": "223.94000", +"Input Freq": "222.34000", +"PL": "100.0", +"TSQ": "", +"Nearest City": "Colton", +"Landmark": "Goat Mountain", +"County": "Clackamas", +"State": "Oregon", +"Country": "United States", +"Lat": "45.13150024", +"Long": "-122.29699707", +"Precise": "1", +"Callsign": "W7OTV", +"Use": "OPEN", +"Operational Status": "Off-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "0", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2021-07-31" +}, { +"State ID": "41", +"Rptr ID": "498", +"Frequency": "224.46000", +"Input Freq": "222.86000", +"PL": "107.2", +"TSQ": "", +"Nearest City": "Estacada", +"Landmark": "", +"County": "Clackamas", +"State": "Oregon", +"Country": "United States", +"Lat": "45.28969955", +"Long": "-122.33200073", +"Precise": "0", +"Callsign": "KD7DEG", +"Use": "OPEN", +"Operational Status": "Off-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "0", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2021-02-19" +}, { +"State ID": "41", +"Rptr ID": "555", +"Frequency": "441.40000", +"Input Freq": "446.40000", +"PL": "88.5", +"TSQ": "88.5", +"Nearest City": "Colton", +"Landmark": "Goat Mountain", +"County": "Clackamas", +"State": "Oregon", +"Country": "United States", +"Lat": "45.13150024", +"Long": "-122.29699707", +"Precise": "1", +"Callsign": "WB6EGS", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2021-06-23" +}, { +"State ID": "41", +"Rptr ID": "3091", +"Frequency": "29.68000", +"Input Freq": "29.58000", +"PL": "162.2", +"TSQ": "162.2", +"Nearest City": "Clackamas", +"Landmark": "Mount Scott", +"County": "Clackamas", +"State": "Oregon", +"Country": "United States", +"Lat": "45.45460129", +"Long": "-122.55100250", +"Precise": "1", +"Callsign": "KR7IS", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "", +"IRLP Node": "", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2019-12-14" +}, { +"State ID": "41", +"Rptr ID": "6786", +"Frequency": "443.85000", +"Input Freq": "448.85000", +"PL": "107.2", +"TSQ": "", +"Nearest City": "Estacada", +"Landmark": "", +"County": "Clackamas", +"State": "Oregon", +"Country": "United States", +"Lat": "45.28771980", +"Long": "-122.33516380", +"Precise": "0", +"Callsign": "WB7DZG", +"Use": "OPEN", +"Operational Status": "Unknown", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-12-07" +}, { +"State ID": "41", +"Rptr ID": "6788", +"Frequency": "444.17500", +"Input Freq": "449.17500", +"PL": "123.0", +"TSQ": "", +"Nearest City": "West Linn", +"Landmark": "Stafford", +"County": "Clackamas", +"State": "Oregon", +"Country": "United States", +"Lat": "45.36569977", +"Long": "-122.61199951", +"Precise": "0", +"Callsign": "WA7BND", +"Use": "OPEN", +"Operational Status": "Off-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-12-06" +}, { +"State ID": "41", +"Rptr ID": "8309", +"Frequency": "224.78000", +"Input Freq": "223.18000", +"PL": "136.5", +"TSQ": "136.5", +"Nearest City": "Government Camp", +"Landmark": "Mount Hood", +"County": "Clackamas", +"State": "Oregon", +"Country": "United States", +"Lat": "45.28829956", +"Long": "-121.78299713", +"Precise": "1", +"Callsign": "KB7APU", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "0", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2021-02-19" +}, { +"State ID": "41", +"Rptr ID": "11141", +"Frequency": "441.65000", +"Input Freq": "446.65000", +"PL": "107.2", +"TSQ": "", +"Nearest City": "West Linn", +"Landmark": "West Linn Ridge", +"County": "Clackamas", +"State": "Oregon", +"Country": "United States", +"Lat": "45.36569977", +"Long": "-122.61199951", +"Precise": "0", +"Callsign": "WA7DRO", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-12-06" +}, { +"State ID": "41", +"Rptr ID": "13885", +"Frequency": "147.18000", +"Input Freq": "147.78000", +"PL": "103.5", +"TSQ": "103.5", +"Nearest City": "Clackamas", +"Landmark": "Mount Scott, Happy Valley", +"County": "Clackamas", +"State": "Oregon", +"Country": "United States", +"Lat": "45.45309830", +"Long": "-122.54799652", +"Precise": "0", +"Callsign": "W7LT", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "Yes", +"YSF DG ID Uplink": "00", +"YSF DG IS Downlink": "00", +"YSF DSC": "", +"Notes": "Per PARC website 26 April 2021: This repeater is located on Mt. Scott, OR; running a Yaesu System Fusion (YSF) repeater in Automatic Mode Select (AMS) mode to provide functionality to both FM analog (with a tone of 103.5) and digital users. Previously, this was a dedicated digital mode 1200 baud packet repeater. On 22 July 2020, this repeater was tested to verify both YSF Fusion and FM Analog operation. No YSF Fusion response was received at that time. This repeater's YSF capability needs to be confirmed by the Trustee.", +"Last Update": "2021-04-26" +}, { +"State ID": "41", +"Rptr ID": "15196", +"Frequency": "442.75000", +"Input Freq": "447.75000", +"PL": "Restricted", +"TSQ": "Restricted", +"Nearest City": "Colton", +"Landmark": "Goat Mtn", +"County": "Clackamas", +"State": "Oregon", +"Country": "United States", +"Lat": "45.13150024", +"Long": "-122.29699707", +"Precise": "0", +"Callsign": "KB7APU", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "0", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "No", +"DMR": "Yes", +"DMR Color Code": "1", +"DMR ID": "314107", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2021-06-23" +}, { +"State ID": "41", +"Rptr ID": "15201", +"Frequency": "442.98750", +"Input Freq": "447.98750", +"PL": "Restricted", +"TSQ": "Restricted", +"Nearest City": "Government Camp", +"Landmark": "", +"County": "Clackamas", +"State": "Oregon", +"Country": "United States", +"Lat": "45.36700058", +"Long": "-121.99099731", +"Precise": "0", +"Callsign": "KB7APU", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "0", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "No", +"DMR": "Yes", +"DMR Color Code": "1", +"DMR ID": "314104", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2021-06-23" +}, { +"State ID": "41", +"Rptr ID": "15792", +"Frequency": "52.97000", +"Input Freq": "51.27000", +"PL": "107.2", +"TSQ": "107.2", +"Nearest City": "Government Camp", +"Landmark": "Timberline Lodge", +"County": "Clackamas", +"State": "Oregon", +"Country": "United States", +"Lat": "45.33119965", +"Long": "-121.71099854", +"Precise": "0", +"Callsign": "WB7DZG", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "", +"IRLP Node": "", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2019-09-28" +}, { +"State ID": "41", +"Rptr ID": "15806", +"Frequency": "223.96000", +"Input Freq": "222.36000", +"PL": "107.2", +"TSQ": "", +"Nearest City": "Sandy", +"Landmark": "", +"County": "Clackamas", +"State": "Oregon", +"Country": "United States", +"Lat": "45.39730072", +"Long": "-122.26100159", +"Precise": "0", +"Callsign": "KJ7IY", +"Use": "OPEN", +"Operational Status": "Off-air", +"ARES": "Yes", +"RACES": "Yes", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "0", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2021-02-19" +}, { +"State ID": "41", +"Rptr ID": "16800", +"Frequency": "444.30000", +"Input Freq": "449.30000", +"PL": "82.5", +"TSQ": "82.5", +"Nearest City": "Lake Oswego", +"Landmark": "", +"County": "Clackamas", +"State": "Oregon", +"Country": "United States", +"Lat": "45.42070007", +"Long": "-122.67099762", +"Precise": "0", +"Callsign": "WA7LO", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "", +"IRLP Node": "", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-04-05" +}, { +"State ID": "41", +"Rptr ID": "17251", +"Frequency": "441.32500", +"Input Freq": "446.32500", +"PL": "", +"TSQ": "", +"Nearest City": "Clackamas", +"Landmark": "Mt Scott", +"County": "Clackamas", +"State": "Oregon", +"Country": "United States", +"Lat": "45.45472300", +"Long": "-122.55139200", +"Precise": "1", +"Callsign": "KA7AGH", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "Yes", +"RACES": "Yes", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "0", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "No", +"DMR": "Yes", +"DMR Color Code": "7", +"DMR ID": "314116", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "Connected to PNW Digital System. Visit PNWDigital.net for further info on supported TG.", +"Last Update": "2021-03-26" +}, { +"State ID": "41", +"Rptr ID": "18793", +"Frequency": "444.60000", +"Input Freq": "449.60000", +"PL": "100.0", +"TSQ": "", +"Nearest City": "Beavercreek", +"Landmark": "", +"County": "Clackamas", +"State": "Oregon", +"Country": "United States", +"Lat": "45.22968800", +"Long": "-122.44240900", +"Precise": "1", +"Callsign": "WA7ABU", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "0", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "Yes", +"YSF DG ID Uplink": "00", +"YSF DG IS Downlink": "00", +"YSF DSC": "", +"Notes": "Wires-X to be installed. No courtesy tone due to Yaesu defaults.", +"Last Update": "2020-10-10" +}, { +"State ID": "41", +"Rptr ID": "20134", +"Frequency": "440.63750", +"Input Freq": "445.63750", +"PL": "", +"TSQ": "", +"Nearest City": "Ripplebrook", +"Landmark": "", +"County": "Clackamas", +"State": "Oregon", +"Country": "United States", +"Lat": "45.08250000", +"Long": "-122.04222000", +"Precise": "0", +"Callsign": "KB7APU", +"Use": "OPEN", +"Operational Status": "Off-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "0", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "No", +"DMR": "Yes", +"DMR Color Code": "3", +"DMR ID": "312233", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2021-06-23" +}, { +"State ID": "41", +"Rptr ID": "20180", +"Frequency": "444.15000", +"Input Freq": "449.15000", +"PL": "", +"TSQ": "", +"Nearest City": "Government Camp", +"Landmark": "Mount Hood", +"County": "Clackamas", +"State": "Oregon", +"Country": "United States", +"Lat": "45.34501100", +"Long": "-121.71177200", +"Precise": "0", +"Callsign": "K7PN", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "0", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "No", +"DMR": "Yes", +"DMR Color Code": "1", +"DMR ID": "311190", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "Connected to PNW Digital System. Visit PNWDigital.net for further info on supported TG.", +"Last Update": "2021-09-06" +}, { +"State ID": "41", +"Rptr ID": "20374", +"Frequency": "224.30000", +"Input Freq": "222.70000", +"PL": "100.0", +"TSQ": "100.0", +"Nearest City": "Molalla", +"Landmark": "", +"County": "Clackamas", +"State": "Oregon", +"Country": "United States", +"Lat": "45.10333300", +"Long": "-122.62666700", +"Precise": "0", +"Callsign": "K7JCN", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "0", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-03-26" +}, { +"State ID": "41", +"Rptr ID": "20726", +"Frequency": "224.34000", +"Input Freq": "224.74000", +"PL": "100.0", +"TSQ": "", +"Nearest City": "Oregon City", +"Landmark": "", +"County": "Clackamas", +"State": "Oregon", +"Country": "United States", +"Lat": "45.35560990", +"Long": "-122.60585300", +"Precise": "0", +"Callsign": "K7JCN", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "0", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-10-05" +}, { +"State ID": "41", +"Rptr ID": "176", +"Frequency": "146.66000", +"Input Freq": "146.06000", +"PL": "118.8", +"TSQ": "118.8", +"Nearest City": "Astoria", +"Landmark": "Wickiup Mountain", +"County": "Clatsop", +"State": "Oregon", +"Country": "United States", +"Lat": "46.10609818", +"Long": "-123.58499908", +"Precise": "1", +"Callsign": "W7BU", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "", +"IRLP Node": "", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "March 12, 2020 The repeater was recently sold to the W7BU club. Operations and usage of the repeater may be subject to change.", +"Last Update": "2021-06-23" +}, { +"State ID": "41", +"Rptr ID": "177", +"Frequency": "146.74000", +"Input Freq": "146.14000", +"PL": "118.8", +"TSQ": "", +"Nearest City": "Cannon Beach", +"Landmark": "Arch Cape", +"County": "Clatsop", +"State": "Oregon", +"Country": "United States", +"Lat": "45.80220032", +"Long": "-123.96700287", +"Precise": "1", +"Callsign": "W7BU", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-04-05" +}, { +"State ID": "41", +"Rptr ID": "178", +"Frequency": "146.76000", +"Input Freq": "146.16000", +"PL": "118.8", +"TSQ": "", +"Nearest City": "Astoria", +"Landmark": "Nicolai Mountain", +"County": "Clatsop", +"State": "Oregon", +"Country": "United States", +"Lat": "46.08720016", +"Long": "-123.45800018", +"Precise": "0", +"Callsign": "W7BU", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "Yes", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-04-05" +}, { +"State ID": "41", +"Rptr ID": "183", +"Frequency": "444.50000", +"Input Freq": "449.50000", +"PL": "118.8", +"TSQ": "", +"Nearest City": "Astoria", +"Landmark": "Nicolai Mountain", +"County": "Clatsop", +"State": "Oregon", +"Country": "United States", +"Lat": "46.08720016", +"Long": "-123.45800018", +"Precise": "1", +"Callsign": "N7XAC", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2021-06-23" +}, { +"State ID": "41", +"Rptr ID": "184", +"Frequency": "444.77500", +"Input Freq": "449.77500", +"PL": "118.8", +"TSQ": "", +"Nearest City": "Astoria", +"Landmark": "Wickiup Mountain", +"County": "Clatsop", +"State": "Oregon", +"Country": "United States", +"Lat": "46.10589981", +"Long": "-123.58599854", +"Precise": "1", +"Callsign": "W7BU", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "Yes", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-03-21" +}, { +"State ID": "41", +"Rptr ID": "3004", +"Frequency": "145.49000", +"Input Freq": "144.89000", +"PL": "118.8", +"TSQ": "", +"Nearest City": "Seaside", +"Landmark": "reservoir", +"County": "Clatsop", +"State": "Oregon", +"Country": "United States", +"Lat": "45.95420074", +"Long": "-123.91899872", +"Precise": "1", +"Callsign": "WA7VE", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2021-01-03" +}, { +"State ID": "41", +"Rptr ID": "5827", +"Frequency": "443.87500", +"Input Freq": "448.87500", +"PL": "100.0", +"TSQ": "100.0", +"Nearest City": "Seaside", +"Landmark": "", +"County": "Clatsop", +"State": "Oregon", +"Country": "United States", +"Lat": "45.95399857", +"Long": "-123.91899872", +"Precise": "1", +"Callsign": "N7PIR", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "", +"IRLP Node": "3430", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2020-09-14" +}, { +"State ID": "41", +"Rptr ID": "5829", +"Frequency": "147.00000", +"Input Freq": "147.60000", +"PL": "118.8", +"TSQ": "", +"Nearest City": "Seaside", +"Landmark": "", +"County": "Clatsop", +"State": "Oregon", +"Country": "United States", +"Lat": "45.86420059", +"Long": "-123.55500031", +"Precise": "1", +"Callsign": "WA7PIX", +"Use": "OPEN", +"Operational Status": "Unknown", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-04-05" +}, { +"State ID": "41", +"Rptr ID": "6880", +"Frequency": "147.52000", +"Input Freq": "147.52000", +"PL": "118.8", +"TSQ": "", +"Nearest City": "Hammond", +"Landmark": "", +"County": "Clatsop", +"State": "Oregon", +"Country": "United States", +"Lat": "46.19931230", +"Long": "-123.95205880", +"Precise": "1", +"Callsign": "NA7Q", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "54166", +"EchoLink Node": "0", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "No", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "Open to all users.
Permanently linked to the Coastal Amateur Radio Network Hub 54189.", +"Last Update": "2022-11-28" +}, { +"State ID": "41", +"Rptr ID": "11325", +"Frequency": "146.72000", +"Input Freq": "146.12000", +"PL": "114.8", +"TSQ": "114.8", +"Nearest City": "Astoria", +"Landmark": "Wickiup Mountain", +"County": "Clatsop", +"State": "Oregon", +"Country": "United States", +"Lat": "46.10589981", +"Long": "-123.58599854", +"Precise": "0", +"Callsign": "K7RPT", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "0", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "Repeater is in testing mode.
Linked to 442.32500 (K7RPT) at Forest Grove, South Saddle Mountain, OR.

", +"Last Update": "2021-06-23" +}, { +"State ID": "41", +"Rptr ID": "14641", +"Frequency": "442.50000", +"Input Freq": "447.50000", +"PL": "118.8", +"TSQ": "118.8", +"Nearest City": "Astoria", +"Landmark": "Wickiup Mtn", +"County": "Clatsop", +"State": "Oregon", +"Country": "United States", +"Lat": "46.10589981", +"Long": "-123.58599854", +"Precise": "0", +"Callsign": "W7BU", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "Yes", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "", +"IRLP Node": "", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "Low activity repeater system. Receiver is currently experiencing signal loss. Users may have a difficult time accessing this repeater.", +"Last Update": "2021-06-23" +}, { +"State ID": "41", +"Rptr ID": "17427", +"Frequency": "444.85000", +"Input Freq": "449.85000", +"PL": "118.8", +"TSQ": "", +"Nearest City": "Astoria", +"Landmark": "", +"County": "Clatsop", +"State": "Oregon", +"Country": "United States", +"Lat": "46.13859940", +"Long": "-123.84799957", +"Precise": "1", +"Callsign": "W7BU", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "", +"IRLP Node": "", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2020-09-11" +}, { +"State ID": "41", +"Rptr ID": "17428", +"Frequency": "146.80000", +"Input Freq": "146.20000", +"PL": "118.8", +"TSQ": "", +"Nearest City": "Gearhart", +"Landmark": "", +"County": "Clatsop", +"State": "Oregon", +"Country": "United States", +"Lat": "46.03150177", +"Long": "-123.89299774", +"Precise": "1", +"Callsign": "W7BU", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-04-05" +}, { +"State ID": "41", +"Rptr ID": "17913", +"Frequency": "224.28000", +"Input Freq": "222.68000", +"PL": "103.5", +"TSQ": "", +"Nearest City": "Astoria", +"Landmark": "Nicolai Mountain", +"County": "Clatsop", +"State": "Oregon", +"Country": "United States", +"Lat": "46.08710098", +"Long": "-123.45899963", +"Precise": "0", +"Callsign": "", +"Use": "OPEN", +"Operational Status": "Off-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "0", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "Linked System", +"Last Update": "2021-02-19" +}, { +"State ID": "41", +"Rptr ID": "18108", +"Frequency": "52.81000", +"Input Freq": "51.11000", +"PL": "100.0", +"TSQ": "", +"Nearest City": "Astoria", +"Landmark": "Nicolai Mountain", +"County": "Clatsop", +"State": "Oregon", +"Country": "United States", +"Lat": "46.08710098", +"Long": "-123.45899963", +"Precise": "0", +"Callsign": "", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2021-06-23" +}, { +"State ID": "41", +"Rptr ID": "19856", +"Frequency": "147.16000", +"Input Freq": "147.76000", +"PL": "118.8", +"TSQ": "118.8", +"Nearest City": "Knappa", +"Landmark": "", +"County": "Clatsop", +"State": "Oregon", +"Country": "United States", +"Lat": "46.17139090", +"Long": "-123.57122100", +"Precise": "0", +"Callsign": "NA7Q", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "54094", +"EchoLink Node": "0", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "No", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "Open to all users. Permanently linked to the Coastal Amateur Radio Network Hub 54189.", +"Last Update": "2022-09-21" +}, { +"State ID": "41", +"Rptr ID": "142", +"Frequency": "146.88000", +"Input Freq": "146.28000", +"PL": "114.8", +"TSQ": "114.8", +"Nearest City": "Deer Island", +"Landmark": "Meissner Lookout", +"County": "Columbia", +"State": "Oregon", +"Country": "United States", +"Lat": "45.96030045", +"Long": "-122.99600220", +"Precise": "0", +"Callsign": "N7EI", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "Yes", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "Separate RX and TX antennas.", +"Last Update": "2022-12-06" +}, { +"State ID": "41", +"Rptr ID": "505", +"Frequency": "441.70000", +"Input Freq": "446.70000", +"PL": "", +"TSQ": "", +"Nearest City": "Rainier", +"Landmark": "Ranier Hill", +"County": "Columbia", +"State": "Oregon", +"Country": "United States", +"Lat": "46.04959869", +"Long": "-122.91999817", +"Precise": "1", +"Callsign": "N3EG", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "", +"IRLP Node": "", +"Wires Node": "", +"FM Analog": "No", +"DMR": "Yes", +"DMR Color Code": "1", +"DMR ID": "315328", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-04-05" +}, { +"State ID": "41", +"Rptr ID": "509", +"Frequency": "444.62500", +"Input Freq": "449.62500", +"PL": "107.2", +"TSQ": "107.2", +"Nearest City": "Warren", +"Landmark": "McNulty Water Tower", +"County": "Columbia", +"State": "Oregon", +"Country": "United States", +"Lat": "45.83900070", +"Long": "-122.87799835", +"Precise": "1", +"Callsign": "N7EI", +"Use": "OPEN", +"Operational Status": "Unknown", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "20 watts.", +"Last Update": "2022-04-05" +}, { +"State ID": "41", +"Rptr ID": "6366", +"Frequency": "146.68000", +"Input Freq": "146.08000", +"PL": "114.8", +"TSQ": "114.8", +"Nearest City": "Warren", +"Landmark": "McNulty Water Tower", +"County": "Columbia", +"State": "Oregon", +"Country": "United States", +"Lat": "45.83900070", +"Long": "-122.87799835", +"Precise": "1", +"Callsign": "N7EI", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "", +"IRLP Node": "", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2021-06-23" +}, { +"State ID": "41", +"Rptr ID": "10611", +"Frequency": "224.66000", +"Input Freq": "223.06000", +"PL": "114.8", +"TSQ": "114.8", +"Nearest City": "Rainier", +"Landmark": "Rainier Hill", +"County": "Columbia", +"State": "Oregon", +"Country": "United States", +"Lat": "46.08900070", +"Long": "-122.93599701", +"Precise": "0", +"Callsign": "N7DEM", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "0", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-07-18" +}, { +"State ID": "41", +"Rptr ID": "16128", +"Frequency": "441.86250", +"Input Freq": "446.86250", +"PL": "", +"TSQ": "", +"Nearest City": "Scappoose", +"Landmark": "", +"County": "Columbia", +"State": "Oregon", +"Country": "United States", +"Lat": "45.75429916", +"Long": "-122.87799835", +"Precise": "0", +"Callsign": "AA7BG", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "", +"IRLP Node": "", +"Wires Node": "", +"FM Analog": "No", +"DMR": "Yes", +"DMR Color Code": "1", +"DMR ID": "314111", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2019-11-27" +}, { +"State ID": "41", +"Rptr ID": "16277", +"Frequency": "145.25000", +"Input Freq": "144.65000", +"PL": "114.8", +"TSQ": "", +"Nearest City": "Vernonia", +"Landmark": "Corey Hill", +"County": "Columbia", +"State": "Oregon", +"Country": "United States", +"Lat": "45.86180115", +"Long": "-123.20600128", +"Precise": "0", +"Callsign": "W7VER", +"Use": "OPEN", +"Operational Status": "Unknown", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "0", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "Vernonia Emergency Radio Association V.E.R.A", +"Last Update": "2021-02-19" +}, { +"State ID": "41", +"Rptr ID": "17151", +"Frequency": "224.38000", +"Input Freq": "222.78000", +"PL": "114.8", +"TSQ": "", +"Nearest City": "Deer Island", +"Landmark": "", +"County": "Columbia", +"State": "Oregon", +"Country": "United States", +"Lat": "45.93220139", +"Long": "-122.84500122", +"Precise": "0", +"Callsign": "N7EI", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "", +"IRLP Node": "", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "No squelch tail.", +"Last Update": "2019-11-17" +}, { +"State ID": "41", +"Rptr ID": "149", +"Frequency": "145.19000", +"Input Freq": "144.59000", +"PL": "146.2", +"TSQ": "", +"Nearest City": "Myrtle Point", +"Landmark": "Bennett Butte", +"County": "Coos", +"State": "Oregon", +"Country": "United States", +"Lat": "42.95869827", +"Long": "-124.27300262", +"Precise": "1", +"Callsign": "W7OC", +"Use": "OPEN", +"Operational Status": "Unknown", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "0", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2021-02-19" +}, { +"State ID": "41", +"Rptr ID": "151", +"Frequency": "146.61000", +"Input Freq": "146.01000", +"PL": "110.9", +"TSQ": "110.9", +"Nearest City": "Coquille", +"Landmark": "Beaver Hill", +"County": "Coos", +"State": "Oregon", +"Country": "United States", +"Lat": "43.20500183", +"Long": "-124.30200195", +"Precise": "1", +"Callsign": "K7CCH", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "Yes", +"RACES": "Yes", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2020-07-12" +}, { +"State ID": "41", +"Rptr ID": "152", +"Frequency": "146.92000", +"Input Freq": "146.32000", +"PL": "136.5", +"TSQ": "91.5", +"Nearest City": "Camas Valley", +"Landmark": "Kenyon Mountain", +"County": "Coos", +"State": "Oregon", +"Country": "United States", +"Lat": "43.00149918", +"Long": "-123.77899933", +"Precise": "1", +"Callsign": "AB7BS", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "521741", +"IRLP Node": "", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "3,250 feet.", +"Last Update": "2020-09-25" +}, { +"State ID": "41", +"Rptr ID": "156", +"Frequency": "147.28000", +"Input Freq": "147.88000", +"PL": "146.2", +"TSQ": "146.2", +"Nearest City": "Coos Bay", +"Landmark": "Blossom Hill", +"County": "Coos", +"State": "Oregon", +"Country": "United States", +"Lat": "43.35419846", +"Long": "-124.24199677", +"Precise": "1", +"Callsign": "W7OC", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-04-05" +}, { +"State ID": "41", +"Rptr ID": "159", +"Frequency": "440.80000", +"Input Freq": "445.80000", +"PL": "103.5", +"TSQ": "", +"Nearest City": "Coos Bay", +"Landmark": "Blossom Hill", +"County": "Coos", +"State": "Oregon", +"Country": "United States", +"Lat": "43.35419846", +"Long": "-124.24199677", +"Precise": "1", +"Callsign": "WA7JAW", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "0", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "650 feet, 30 watts.", +"Last Update": "2021-02-19" +}, { +"State ID": "41", +"Rptr ID": "164", +"Frequency": "444.17500", +"Input Freq": "449.17500", +"PL": "146.2", +"TSQ": "", +"Nearest City": "Myrtle Point", +"Landmark": "Bennett Butte", +"County": "Coos", +"State": "Oregon", +"Country": "United States", +"Lat": "43.06499863", +"Long": "-124.13800049", +"Precise": "0", +"Callsign": "W7OC", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2021-08-25" +}, { +"State ID": "41", +"Rptr ID": "165", +"Frequency": "444.52500", +"Input Freq": "449.52500", +"PL": "123.0", +"TSQ": "", +"Nearest City": "Myrtle Point", +"Landmark": "Bennett Butte", +"County": "Coos", +"State": "Oregon", +"Country": "United States", +"Lat": "42.95869827", +"Long": "-124.27300262", +"Precise": "1", +"Callsign": "KD7IOP", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-12-06" +}, { +"State ID": "41", +"Rptr ID": "479", +"Frequency": "147.10000", +"Input Freq": "147.70000", +"PL": "88.5", +"TSQ": "88.5", +"Nearest City": "Coos Bay", +"Landmark": "", +"County": "Coos", +"State": "Oregon", +"Country": "United States", +"Lat": "43.36809921", +"Long": "-124.21600342", +"Precise": "0", +"Callsign": "W7OC", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "", +"IRLP Node": "", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2020-07-19" +}, { +"State ID": "41", +"Rptr ID": "13019", +"Frequency": "146.88000", +"Input Freq": "146.28000", +"PL": "D023", +"TSQ": "", +"Nearest City": "Coos Bay", +"Landmark": "Noah Butte", +"County": "Coos", +"State": "Oregon", +"Country": "United States", +"Lat": "43.36650085", +"Long": "-124.21800232", +"Precise": "0", +"Callsign": "AB7BS", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "521741", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-09-21" +}, { +"State ID": "41", +"Rptr ID": "15807", +"Frequency": "441.72500", +"Input Freq": "446.72500", +"PL": "131.8", +"TSQ": "", +"Nearest City": "Coos Bay", +"Landmark": "", +"County": "Coos", +"State": "Oregon", +"Country": "United States", +"Lat": "43.36650085", +"Long": "-124.21800232", +"Precise": "0", +"Callsign": "W7OC", +"Use": "OPEN", +"Operational Status": "Unknown", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-04-05" +}, { +"State ID": "41", +"Rptr ID": "18777", +"Frequency": "147.32000", +"Input Freq": "147.92000", +"PL": "", +"TSQ": "", +"Nearest City": "Coos Bay", +"Landmark": "", +"County": "Coos", +"State": "Oregon", +"Country": "United States", +"Lat": "43.36650070", +"Long": "-124.21789030", +"Precise": "0", +"Callsign": "K7REA", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "0", +"IRLP Node": "0", +"Wires Node": "64162", +"FM Analog": "No", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "Yes", +"YSF DG ID Uplink": "00", +"YSF DG IS Downlink": "00", +"YSF DSC": "", +"Notes": "Use DG-ID TX01 for Wires-X access. This repeater is digital mode only, no FM analog voice. See web page on info linking to other repeaters (http://www.k7rea.com/).", +"Last Update": "2021-04-21" +}, { +"State ID": "41", +"Rptr ID": "240", +"Frequency": "147.38000", +"Input Freq": "147.98000", +"PL": "162.2", +"TSQ": "", +"Nearest City": "Prineville", +"Landmark": "Grizzly Mountain", +"County": "Crook", +"State": "Oregon", +"Country": "United States", +"Lat": "44.43780136", +"Long": "-120.95500183", +"Precise": "1", +"Callsign": "N7CCO", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "Yes", +"RACES": "No", +"SKYWARN": "Yes", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-11-18" +}, { +"State ID": "41", +"Rptr ID": "10191", +"Frequency": "444.17500", +"Input Freq": "449.17500", +"PL": "103.5", +"TSQ": "103.5", +"Nearest City": "Prineville", +"Landmark": "Grizzly Mountain", +"County": "Crook", +"State": "Oregon", +"Country": "United States", +"Lat": "44.43780136", +"Long": "-120.95500183", +"Precise": "1", +"Callsign": "N7PIR", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "132225", +"IRLP Node": "3420", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-11-18" +}, { +"State ID": "41", +"Rptr ID": "15796", +"Frequency": "145.21000", +"Input Freq": "144.61000", +"PL": "141.3", +"TSQ": "", +"Nearest City": "Prineville", +"Landmark": "Round Mtn", +"County": "Crook", +"State": "Oregon", +"Country": "United States", +"Lat": "44.39220047", +"Long": "-120.34700012", +"Precise": "0", +"Callsign": "N7CCO", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "Yes", +"RACES": "Yes", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-05-09" +}, { +"State ID": "41", +"Rptr ID": "18784", +"Frequency": "441.25000", +"Input Freq": "446.25000", +"PL": "", +"TSQ": "", +"Nearest City": "Prineville", +"Landmark": "", +"County": "Crook", +"State": "Oregon", +"Country": "United States", +"Lat": "44.29984850", +"Long": "-120.83446640", +"Precise": "0", +"Callsign": "N7CCO", +"Use": "OPEN", +"Operational Status": "Unknown", +"ARES": "Yes", +"RACES": "Yes", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "0", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "No", +"DMR": "Yes", +"DMR Color Code": "1", +"DMR ID": "311455", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2020-05-12" +}, { +"State ID": "41", +"Rptr ID": "187", +"Frequency": "145.21000", +"Input Freq": "144.61000", +"PL": "88.5", +"TSQ": "", +"Nearest City": "Langlois", +"Landmark": "Stone Butte", +"County": "Curry", +"State": "Oregon", +"Country": "United States", +"Lat": "42.87189865", +"Long": "-124.43599701", +"Precise": "1", +"Callsign": "KA7GNK", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "A separate tone of 100.0 is listed.", +"Last Update": "2021-01-17" +}, { +"State ID": "41", +"Rptr ID": "188", +"Frequency": "146.74000", +"Input Freq": "146.14000", +"PL": "88.5", +"TSQ": "", +"Nearest City": "Gold Beach", +"Landmark": "Grizzly Mountain", +"County": "Curry", +"State": "Oregon", +"Country": "United States", +"Lat": "42.39749908", +"Long": "-124.36599731", +"Precise": "1", +"Callsign": "K7SEG", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "Yes", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2021-01-17" +}, { +"State ID": "41", +"Rptr ID": "190", +"Frequency": "146.96000", +"Input Freq": "146.36000", +"PL": "88.5", +"TSQ": "", +"Nearest City": "Brookings", +"Landmark": "Harbor Hill", +"County": "Curry", +"State": "Oregon", +"Country": "United States", +"Lat": "42.05260086", +"Long": "-124.28399658", +"Precise": "0", +"Callsign": "W7BKG", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "", +"IRLP Node": "", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "1200', 50 watts. ", +"Last Update": "2020-08-31" +}, { +"State ID": "41", +"Rptr ID": "192", +"Frequency": "147.25000", +"Input Freq": "147.85000", +"PL": "88.5", +"TSQ": "", +"Nearest City": "Brookings", +"Landmark": "Bosley Butte", +"County": "Curry", +"State": "Oregon", +"Country": "United States", +"Lat": "42.20920181", +"Long": "-124.22599792", +"Precise": "1", +"Callsign": "N7UBQ", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "Yes", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-04-05" +}, { +"State ID": "41", +"Rptr ID": "500", +"Frequency": "440.72500", +"Input Freq": "445.72500", +"PL": "114.8", +"TSQ": "", +"Nearest City": "Port Orford", +"Landmark": "Cape Blanco", +"County": "Curry", +"State": "Oregon", +"Country": "United States", +"Lat": "42.83729935", +"Long": "-124.56300354", +"Precise": "1", +"Callsign": "KD7IOP", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "215 feet, 50 watts.", +"Last Update": "2021-01-17" +}, { +"State ID": "41", +"Rptr ID": "2812", +"Frequency": "146.84000", +"Input Freq": "146.24000", +"PL": "88.5", +"TSQ": "", +"Nearest City": "Brookings", +"Landmark": "Fire Station", +"County": "Curry", +"State": "Oregon", +"Country": "United States", +"Lat": "42.12609863", +"Long": "-124.32099915", +"Precise": "1", +"Callsign": "W7BKG", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2021-01-17" +}, { +"State ID": "41", +"Rptr ID": "6759", +"Frequency": "147.04000", +"Input Freq": "147.64000", +"PL": "88.5", +"TSQ": "", +"Nearest City": "Agness", +"Landmark": "", +"County": "Curry", +"State": "Oregon", +"Country": "United States", +"Lat": "42.55649948", +"Long": "-124.06900024", +"Precise": "0", +"Callsign": "WA7JAW", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "", +"IRLP Node": "", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2020-07-18" +}, { +"State ID": "41", +"Rptr ID": "20214", +"Frequency": "443.80000", +"Input Freq": "448.80000", +"PL": "", +"TSQ": "", +"Nearest City": "Brookings", +"Landmark": "", +"County": "Curry", +"State": "Oregon", +"Country": "United States", +"Lat": "42.06830000", +"Long": "-124.27120000", +"Precise": "0", +"Callsign": "K6JR", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "0", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "No", +"DMR": "Yes", +"DMR Color Code": "1", +"DMR ID": "312550", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-04-02" +}, { +"State ID": "41", +"Rptr ID": "175", +"Frequency": "443.05000", +"Input Freq": "448.05000", +"PL": "162.2", +"TSQ": "", +"Nearest City": "Bend", +"Landmark": "Jack Pine Ridge", +"County": "Deschutes", +"State": "Oregon", +"Country": "United States", +"Lat": "44.05830002", +"Long": "-121.31400299", +"Precise": "0", +"Callsign": "KB7LNR", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-04-05" +}, { +"State ID": "41", +"Rptr ID": "195", +"Frequency": "145.45000", +"Input Freq": "144.85000", +"PL": "103.5", +"TSQ": "CSQ", +"Nearest City": "Bend", +"Landmark": "Mount Bachelor", +"County": "Deschutes", +"State": "Oregon", +"Country": "United States", +"Lat": "43.98139954", +"Long": "-121.68900299", +"Precise": "1", +"Callsign": "W7DCO", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "Yes", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "Per AI7NC, this repeater does not transmit a tone for tone squelch. ", +"Last Update": "2022-07-13" +}, { +"State ID": "41", +"Rptr ID": "197", +"Frequency": "145.49000", +"Input Freq": "144.89000", +"PL": "162.2", +"TSQ": "162.2", +"Nearest City": "Bend", +"Landmark": "Sand Shed", +"County": "Deschutes", +"State": "Oregon", +"Country": "United States", +"Lat": "43.98240000", +"Long": "-121.57890000", +"Precise": "1", +"Callsign": "W7HWY", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "Yes", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "Elevation = 6,032 feet ASL.", +"Last Update": "2022-01-01" +}, { +"State ID": "41", +"Rptr ID": "198", +"Frequency": "146.70000", +"Input Freq": "146.10000", +"PL": "162.2", +"TSQ": "", +"Nearest City": "Millican", +"Landmark": "Pine Mountain", +"County": "Deschutes", +"State": "Oregon", +"Country": "United States", +"Lat": "43.80289841", +"Long": "-120.91400146", +"Precise": "1", +"Callsign": "W7JVO", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2021-01-17" +}, { +"State ID": "41", +"Rptr ID": "199", +"Frequency": "444.75000", +"Input Freq": "449.75000", +"PL": "156.7", +"TSQ": "", +"Nearest City": "Millican", +"Landmark": "Pine Mtn", +"County": "Deschutes", +"State": "Oregon", +"Country": "United States", +"Lat": "43.80289841", +"Long": "-120.91400146", +"Precise": "1", +"Callsign": "W7JVO", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2021-01-17" +}, { +"State ID": "41", +"Rptr ID": "201", +"Frequency": "146.90000", +"Input Freq": "146.30000", +"PL": "123.0", +"TSQ": "", +"Nearest City": "Sisters", +"Landmark": "Fivemile Butte", +"County": "Deschutes", +"State": "Oregon", +"Country": "United States", +"Lat": "44.35219955", +"Long": "-121.69100189", +"Precise": "1", +"Callsign": "W7DUX", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "There is no Repeater Record Custodian (RRC) assigned to this repeater. Please ask W7DUX -- DANNY J. TUCKER -- TRUSTEE to register with RepeaterBook.com so that he (or others of his choosing) can be assigned as such. ", +"Last Update": "2021-07-12" +}, { +"State ID": "41", +"Rptr ID": "202", +"Frequency": "146.94000", +"Input Freq": "146.34000", +"PL": "162.2", +"TSQ": "", +"Nearest City": "Bend", +"Landmark": "Long Butte", +"County": "Deschutes", +"State": "Oregon", +"Country": "United States", +"Lat": "44.17369843", +"Long": "-121.27600098", +"Precise": "1", +"Callsign": "W7JVO", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2021-01-17" +}, { +"State ID": "41", +"Rptr ID": "204", +"Frequency": "147.04000", +"Input Freq": "147.64000", +"PL": "114.8", +"TSQ": "", +"Nearest City": "Redmond", +"Landmark": "Cinder Butte", +"County": "Deschutes", +"State": "Oregon", +"Country": "United States", +"Lat": "44.31740189", +"Long": "-121.17400360", +"Precise": "1", +"Callsign": "K7RPT", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "", +"IRLP Node": "", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "3,604 feet ASL, 300 watts ERP.", +"Last Update": "2020-10-09" +}, { +"State ID": "41", +"Rptr ID": "209", +"Frequency": "442.12500", +"Input Freq": "447.12500", +"PL": "D125", +"TSQ": "", +"Nearest City": "Bend", +"Landmark": "Cline Butte", +"County": "Deschutes", +"State": "Oregon", +"Country": "United States", +"Lat": "44.25279999", +"Long": "-121.30400085", +"Precise": "1", +"Callsign": "AB7BS", +"Use": "OPEN", +"Operational Status": "Off-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "Tone might also be 123.0. This repeater is not in the ORCC online database. Moved from UNKNOWN to OFF-AIR.", +"Last Update": "2021-06-24" +}, { +"State ID": "41", +"Rptr ID": "477", +"Frequency": "146.64000", +"Input Freq": "146.04000", +"PL": "123.0", +"TSQ": "", +"Nearest City": "Sunriver", +"Landmark": "Spring River Butte", +"County": "Deschutes", +"State": "Oregon", +"Country": "United States", +"Lat": "43.85029984", +"Long": "-121.45800018", +"Precise": "0", +"Callsign": "KA7QAV", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2021-05-22" +}, { +"State ID": "41", +"Rptr ID": "526", +"Frequency": "443.65000", +"Input Freq": "448.65000", +"PL": "162.2", +"TSQ": "", +"Nearest City": "Bend", +"Landmark": "", +"County": "Deschutes", +"State": "Oregon", +"Country": "United States", +"Lat": "44.05830002", +"Long": "-121.31400299", +"Precise": "0", +"Callsign": "KB7LNR", +"Use": "OPEN", +"Operational Status": "Unknown", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "211222", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2021-01-17" +}, { +"State ID": "41", +"Rptr ID": "10074", +"Frequency": "145.13000", +"Input Freq": "144.53000", +"PL": "D026", +"TSQ": "D026", +"Nearest City": "Redmond", +"Landmark": "Cline Butte", +"County": "Deschutes", +"State": "Oregon", +"Country": "United States", +"Lat": "44.27259827", +"Long": "-121.17400360", +"Precise": "0", +"Callsign": "W7PRA", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "521741", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2021-02-01" +}, { +"State ID": "41", +"Rptr ID": "10561", +"Frequency": "444.45000", +"Input Freq": "449.45000", +"PL": "162.2", +"TSQ": "100.0", +"Nearest City": "Redmond", +"Landmark": "Long Butte", +"County": "Deschutes", +"State": "Oregon", +"Country": "United States", +"Lat": "44.17499924", +"Long": "-121.25399780", +"Precise": "1", +"Callsign": "KC7DMF", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "27038", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "Yes", +"DMR Color Code": "1", +"DMR ID": "3141290", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "All talk groups are open/available.", +"Last Update": "2021-01-17" +}, { +"State ID": "41", +"Rptr ID": "11149", +"Frequency": "444.92500", +"Input Freq": "449.92500", +"PL": "100.0", +"TSQ": "", +"Nearest City": "La Pine", +"Landmark": "Finley Butte", +"County": "Deschutes", +"State": "Oregon", +"Country": "United States", +"Lat": "43.65017000", +"Long": "-121.42954500", +"Precise": "1", +"Callsign": "AA1JW", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2021-09-16" +}, { +"State ID": "41", +"Rptr ID": "15200", +"Frequency": "442.95000", +"Input Freq": "447.95000", +"PL": "Restricted", +"TSQ": "Restricted", +"Nearest City": "Redmond", +"Landmark": "Gray Butte", +"County": "Deschutes", +"State": "Oregon", +"Country": "United States", +"Lat": "44.27259827", +"Long": "-121.17400360", +"Precise": "0", +"Callsign": "KB7APU", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "0", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "No", +"DMR": "Yes", +"DMR Color Code": "1", +"DMR ID": "314105", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2021-06-23" +}, { +"State ID": "41", +"Rptr ID": "17050", +"Frequency": "442.55000", +"Input Freq": "447.55000", +"PL": "162.2", +"TSQ": "", +"Nearest City": "Bend", +"Landmark": "", +"County": "Deschutes", +"State": "Oregon", +"Country": "United States", +"Lat": "44.05820084", +"Long": "-121.31500244", +"Precise": "0", +"Callsign": "W7DCO", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "This repeater is not listed in the ORCC online database. ", +"Last Update": "2021-05-22" +}, { +"State ID": "41", +"Rptr ID": "19642", +"Frequency": "443.75000", +"Input Freq": "448.75000", +"PL": "156.7", +"TSQ": "", +"Nearest City": "Bend", +"Landmark": "Long Butte", +"County": "Deschutes", +"State": "Oregon", +"Country": "United States", +"Lat": "43.80413340", +"Long": "-120.55420120", +"Precise": "0", +"Callsign": "W7JVO", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "0", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "Yes", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-01-24" +}, { +"State ID": "41", +"Rptr ID": "157", +"Frequency": "147.38000", +"Input Freq": "147.98000", +"PL": "146.2", +"TSQ": "146.2", +"Nearest City": "Mapleton", +"Landmark": "Roman Nose", +"County": "Douglas", +"State": "Oregon", +"Country": "United States", +"Lat": "43.91199875", +"Long": "-123.73899841", +"Precise": "1", +"Callsign": "W7OC", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2021-10-18" +}, { +"State ID": "41", +"Rptr ID": "213", +"Frequency": "145.21000", +"Input Freq": "144.61000", +"PL": "136.5", +"TSQ": "91.5", +"Nearest City": "Glide", +"Landmark": "Chilcoot Mountain", +"County": "Douglas", +"State": "Oregon", +"Country": "United States", +"Lat": "43.43230057", +"Long": "-122.73000336", +"Precise": "1", +"Callsign": "AB7BS", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "This repeater is solar and link times out after 15 mins. Simply key up and the link will auto-connect. 15 mins after the last local key (signal) is herd, the link will auto shut down to save batteries.", +"Last Update": "2020-10-09" +}, { +"State ID": "41", +"Rptr ID": "215", +"Frequency": "145.43000", +"Input Freq": "144.83000", +"PL": "88.5", +"TSQ": "", +"Nearest City": "Glide", +"Landmark": "Scott Mountain", +"County": "Douglas", +"State": "Oregon", +"Country": "United States", +"Lat": "43.37210083", +"Long": "-123.06400299", +"Precise": "1", +"Callsign": "WA7BWT", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "Yes", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "", +"IRLP Node": "", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2020-08-05" +}, { +"State ID": "41", +"Rptr ID": "217", +"Frequency": "146.90000", +"Input Freq": "146.30000", +"PL": "100.0", +"TSQ": "", +"Nearest City": "Roseburg", +"Landmark": "Lane Mountain", +"County": "Douglas", +"State": "Oregon", +"Country": "United States", +"Lat": "43.19530106", +"Long": "-123.11900330", +"Precise": "1", +"Callsign": "KC7TLY", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-11-18" +}, { +"State ID": "41", +"Rptr ID": "219", +"Frequency": "147.12000", +"Input Freq": "147.72000", +"PL": "100.0", +"TSQ": "100.0", +"Nearest City": "Winston", +"Landmark": "", +"County": "Douglas", +"State": "Oregon", +"Country": "United States", +"Lat": "43.12233830", +"Long": "-123.41257230", +"Precise": "1", +"Callsign": "KC7UAV", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "83672", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-12-03" +}, { +"State ID": "41", +"Rptr ID": "221", +"Frequency": "147.24000", +"Input Freq": "147.84000", +"PL": "136.5", +"TSQ": "136.5", +"Nearest City": "Roseburg", +"Landmark": "Lane Mountain", +"County": "Douglas", +"State": "Oregon", +"Country": "United States", +"Lat": "43.19530106", +"Long": "-123.11900330", +"Precise": "1", +"Callsign": "WB7RKR", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "Permanently linked to the SWORA repeater system", +"Last Update": "2022-04-11" +}, { +"State ID": "41", +"Rptr ID": "223", +"Frequency": "224.10000", +"Input Freq": "222.50000", +"PL": "114.8", +"TSQ": "", +"Nearest City": "Glide", +"Landmark": "Scott Mountain", +"County": "Douglas", +"State": "Oregon", +"Country": "United States", +"Lat": "43.37210083", +"Long": "-123.06400299", +"Precise": "1", +"Callsign": "WB7RKR", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "There is no Repeater Record Custodian (RRC) assigned to this repeater. Please ask WB7RKR -- KEITH A. PETERSON -- TRUSTEE to registyer with RepeaterBool.com so that he (or others of his choosing) can be assigned as such. ", +"Last Update": "2021-06-24" +}, { +"State ID": "41", +"Rptr ID": "224", +"Frequency": "441.85000", +"Input Freq": "446.85000", +"PL": "D125", +"TSQ": "D125", +"Nearest City": "Roseburg", +"Landmark": "Mt Scott", +"County": "Douglas", +"State": "Oregon", +"Country": "United States", +"Lat": "43.37200165", +"Long": "-123.06500244", +"Precise": "1", +"Callsign": "AB7BS", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-11-18" +}, { +"State ID": "41", +"Rptr ID": "480", +"Frequency": "147.18000", +"Input Freq": "147.78000", +"PL": "146.2", +"TSQ": "", +"Nearest City": "Reedsport", +"Landmark": "Winchester Hill", +"County": "Douglas", +"State": "Oregon", +"Country": "United States", +"Lat": "43.65719986", +"Long": "-124.18599701", +"Precise": "1", +"Callsign": "W7OC", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-04-05" +}, { +"State ID": "41", +"Rptr ID": "680", +"Frequency": "441.87500", +"Input Freq": "446.87500", +"PL": "88.5", +"TSQ": "", +"Nearest City": "Roseburg", +"Landmark": "", +"County": "Douglas", +"State": "Oregon", +"Country": "United States", +"Lat": "43.21670151", +"Long": "-123.34100342", +"Precise": "0", +"Callsign": "WB6MFV", +"Use": "OPEN", +"Operational Status": "Unknown", +"ARES": "Yes", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "This is a solar site repeater and power can be limited on no sun days. Please keep transmissions as short as possible.", +"Last Update": "2020-05-12" +}, { +"State ID": "41", +"Rptr ID": "2814", +"Frequency": "444.62500", +"Input Freq": "449.62500", +"PL": "91.5", +"TSQ": "", +"Nearest City": "Glide", +"Landmark": "Scott Mountain", +"County": "Douglas", +"State": "Oregon", +"Country": "United States", +"Lat": "43.37210083", +"Long": "-123.06400299", +"Precise": "1", +"Callsign": "WB7RKR", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "There is no Repeater Record Custodian (RRC) assigned to this repeater. Please ask WB7RKR -- KEITH A. PETERSON -- TRUSTEE to register with RepeaterBool.com so that he (or others of his choosing) can be assigned as such. ", +"Last Update": "2021-06-24" +}, { +"State ID": "41", +"Rptr ID": "3092", +"Frequency": "440.62500", +"Input Freq": "445.62500", +"PL": "114.8", +"TSQ": "", +"Nearest City": "Roseburg", +"Landmark": "Mount Nebo", +"County": "Douglas", +"State": "Oregon", +"Country": "United States", +"Lat": "43.20619965", +"Long": "-123.36399841", +"Precise": "1", +"Callsign": "WA7JAW", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "1,168 feet ASL.", +"Last Update": "2022-04-05" +}, { +"State ID": "41", +"Rptr ID": "10031", +"Frequency": "146.70000", +"Input Freq": "146.10000", +"PL": "136.5", +"TSQ": "91.5", +"Nearest City": "Roseburg", +"Landmark": "Scott Mountain", +"County": "Douglas", +"State": "Oregon", +"Country": "United States", +"Lat": "43.30149841", +"Long": "-123.10099792", +"Precise": "0", +"Callsign": "W7PRA", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2020-05-12" +}, { +"State ID": "41", +"Rptr ID": "11148", +"Frequency": "444.87500", +"Input Freq": "449.87500", +"PL": "127.3", +"TSQ": "", +"Nearest City": "Glide", +"Landmark": "", +"County": "Douglas", +"State": "Oregon", +"Country": "United States", +"Lat": "43.30149841", +"Long": "-123.10099792", +"Precise": "0", +"Callsign": "WB7RKR", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "There is no Repeater Record Custodian (RRC) assigned to this repeater. Please ask WB7RKR -- KEITH A. PETERSON -- TRUSTEE to register with RepeaterBool.com so that he (or others of his choosing) can be assigned as such. ", +"Last Update": "2021-06-24" +}, { +"State ID": "41", +"Rptr ID": "11533", +"Frequency": "147.14000", +"Input Freq": "147.74000", +"PL": "136.5", +"TSQ": "91.5", +"Nearest City": "Lakeside", +"Landmark": "Roman Nose Mtn", +"County": "Douglas", +"State": "Oregon", +"Country": "United States", +"Lat": "43.91199875", +"Long": "-123.73899841", +"Precise": "1", +"Callsign": "AB7BS", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "", +"IRLP Node": "", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2020-10-09" +}, { +"State ID": "41", +"Rptr ID": "11660", +"Frequency": "147.22000", +"Input Freq": "147.82000", +"PL": "67.0", +"TSQ": "67.0", +"Nearest City": "Diamond Lake", +"Landmark": "Cinnamon Butte", +"County": "Douglas", +"State": "Oregon", +"Country": "United States", +"Lat": "43.24062200", +"Long": "-122.11011300", +"Precise": "1", +"Callsign": "K7RBG", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "Yes", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "", +"IRLP Node": "", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2020-06-28" +}, { +"State ID": "41", +"Rptr ID": "14280", +"Frequency": "444.40000", +"Input Freq": "449.40000", +"PL": "", +"TSQ": "123.0", +"Nearest City": "Reedsport", +"Landmark": "Winchester Hill", +"County": "Douglas", +"State": "Oregon", +"Country": "United States", +"Lat": "43.70230103", +"Long": "-124.09700012", +"Precise": "0", +"Callsign": "W7OC", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "0", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2021-08-10" +}, { +"State ID": "41", +"Rptr ID": "15429", +"Frequency": "444.90000", +"Input Freq": "449.90000", +"PL": "D125", +"TSQ": "", +"Nearest City": "Yoncalla", +"Landmark": "Harness Mtn", +"County": "Douglas", +"State": "Oregon", +"Country": "United States", +"Lat": "43.52550125", +"Long": "-123.09200287", +"Precise": "1", +"Callsign": "AB7BS", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "", +"IRLP Node": "", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "3,150 feet ASL.", +"Last Update": "2020-10-09" +}, { +"State ID": "41", +"Rptr ID": "18774", +"Frequency": "145.47000", +"Input Freq": "144.87000", +"PL": "", +"TSQ": "", +"Nearest City": "Tiller", +"Landmark": "", +"County": "Douglas", +"State": "Oregon", +"Country": "United States", +"Lat": "42.92845410", +"Long": "-122.95116510", +"Precise": "0", +"Callsign": "K7BRG", +"Use": "OPEN", +"Operational Status": "Unknown", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "0", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2020-05-12" +}, { +"State ID": "41", +"Rptr ID": "19705", +"Frequency": "449.25000", +"Input Freq": "444.25000", +"PL": "", +"TSQ": "", +"Nearest City": "Roseburg", +"Landmark": "", +"County": "Douglas", +"State": "Oregon", +"Country": "United States", +"Lat": "43.21650500", +"Long": "-123.34173810", +"Precise": "0", +"Callsign": "KG7YHY", +"Use": "OPEN", +"Operational Status": "Unknown", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "0", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "No", +"DMR": "Yes", +"DMR Color Code": "2", +"DMR ID": "314906", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2021-01-31" +}, { +"State ID": "41", +"Rptr ID": "20029", +"Frequency": "441.87500", +"Input Freq": "446.87500", +"PL": "162.2", +"TSQ": "", +"Nearest City": "Roseburg", +"Landmark": "Whitetail Ridge Winery", +"County": "Douglas", +"State": "Oregon", +"Country": "United States", +"Lat": "43.12220000", +"Long": "-123.41280000", +"Precise": "1", +"Callsign": "N7TZ", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "0", +"IRLP Node": "0", +"Wires Node": "72122", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "Whitetail Ridge UHF Repeater Wires-X #82122", +"Last Update": "2022-12-18" +}, { +"State ID": "41", +"Rptr ID": "21306", +"Frequency": "440.92500", +"Input Freq": "445.92500", +"PL": "77.0", +"TSQ": "77.0", +"Nearest City": "Winston", +"Landmark": "112 Weigh Station", +"County": "Douglas", +"State": "Oregon", +"Country": "United States", +"Lat": "43.00336740", +"Long": "-123.35875000", +"Precise": "0", +"Callsign": "KK7HEP", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "0", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "Yes", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-12-18" +}, { +"State ID": "41", +"Rptr ID": "210", +"Frequency": "145.24000", +"Input Freq": "144.64000", +"PL": "162.2", +"TSQ": "", +"Nearest City": "John Day", +"Landmark": "Airport", +"County": "Grant", +"State": "Oregon", +"Country": "United States", +"Lat": "44.40319824", +"Long": "-118.96199799", +"Precise": "1", +"Callsign": "W7JVO", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "3,576 feet ASL.", +"Last Update": "2021-01-17" +}, { +"State ID": "41", +"Rptr ID": "211", +"Frequency": "146.64000", +"Input Freq": "146.04000", +"PL": "", +"TSQ": "", +"Nearest City": "Canyon City", +"Landmark": "Eagle Peak", +"County": "Grant", +"State": "Oregon", +"Country": "United States", +"Lat": "44.37340164", +"Long": "-118.96499634", +"Precise": "1", +"Callsign": "N7LZM", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "4,833 feet. Covers about 40% of Grant County - this is well monitored.", +"Last Update": "2021-01-17" +}, { +"State ID": "41", +"Rptr ID": "212", +"Frequency": "147.22000", +"Input Freq": "147.82000", +"PL": "103.5", +"TSQ": "103.5", +"Nearest City": "John Day", +"Landmark": "Fall Mountain", +"County": "Grant", +"State": "Oregon", +"Country": "United States", +"Lat": "44.29370117", +"Long": "-119.04299927", +"Precise": "1", +"Callsign": "N7LZM", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "Yes", +"RACES": "No", +"SKYWARN": "Yes", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-11-18" +}, { +"State ID": "41", +"Rptr ID": "19070", +"Frequency": "145.43000", +"Input Freq": "144.83000", +"PL": "136.5", +"TSQ": "", +"Nearest City": "Prairie City", +"Landmark": "Sheep Mountain", +"County": "Grant", +"State": "Oregon", +"Country": "United States", +"Lat": "44.25052100", +"Long": "-118.48316500", +"Precise": "0", +"Callsign": "", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "0", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2023-01-01" +}, { +"State ID": "41", +"Rptr ID": "228", +"Frequency": "146.76000", +"Input Freq": "146.16000", +"PL": "103.5", +"TSQ": "", +"Nearest City": "Burns", +"Landmark": "Radar Hill", +"County": "Harney", +"State": "Oregon", +"Country": "United States", +"Lat": "43.56480026", +"Long": "-119.15299988", +"Precise": "1", +"Callsign": "KF7HPT", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "", +"IRLP Node": "", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2018-07-14" +}, { +"State ID": "41", +"Rptr ID": "229", +"Frequency": "147.30000", +"Input Freq": "147.90000", +"PL": "162.2", +"TSQ": "", +"Nearest City": "Burns", +"Landmark": "Sharps Ridge", +"County": "Harney", +"State": "Oregon", +"Country": "United States", +"Lat": "43.68109894", +"Long": "-118.92299652", +"Precise": "1", +"Callsign": "W7JVO", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "4,704 feet ASL.", +"Last Update": "2021-01-17" +}, { +"State ID": "41", +"Rptr ID": "18262", +"Frequency": "145.11000", +"Input Freq": "144.51000", +"PL": "136.5", +"TSQ": "67.0", +"Nearest City": "Burns", +"Landmark": "Steens Mountain", +"County": "Harney", +"State": "Oregon", +"Country": "United States", +"Lat": "43.58629990", +"Long": "-119.05400085", +"Precise": "0", +"Callsign": "AB7BS", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "485630", +"EchoLink Node": "", +"IRLP Node": "", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "10,000 feet asl. Solar site", +"Last Update": "2020-11-02" +}, { +"State ID": "41", +"Rptr ID": "232", +"Frequency": "145.15000", +"Input Freq": "144.55000", +"PL": "94.8", +"TSQ": "", +"Nearest City": "Hood River", +"Landmark": "Mount Defiance", +"County": "Hood River", +"State": "Oregon", +"Country": "United States", +"Lat": "45.64250183", +"Long": "-121.72200012", +"Precise": "1", +"Callsign": "WA7ROB", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "", +"IRLP Node": "", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "NW Emergency Radio System
4,959'.", +"Last Update": "2022-04-05" +}, { +"State ID": "41", +"Rptr ID": "233", +"Frequency": "147.10000", +"Input Freq": "147.70000", +"PL": "100.0", +"TSQ": "100.0", +"Nearest City": "Hood River", +"Landmark": "Mount Defiance", +"County": "Hood River", +"State": "Oregon", +"Country": "United States", +"Lat": "45.64849854", +"Long": "-121.72200012", +"Precise": "1", +"Callsign": "KF7LN", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "Yes", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "", +"IRLP Node": "", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "5,000'.", +"Last Update": "2021-01-22" +}, { +"State ID": "41", +"Rptr ID": "538", +"Frequency": "440.95000", +"Input Freq": "445.95000", +"PL": "100.0", +"TSQ": "", +"Nearest City": "Cascade Locks", +"Landmark": "", +"County": "Hood River", +"State": "Oregon", +"Country": "United States", +"Lat": "45.66983920", +"Long": "-121.89063540", +"Precise": "0", +"Callsign": "KF7LN", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "No", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "Yes", +"YSF DG ID Uplink": "00", +"YSF DG IS Downlink": "00", +"YSF DSC": "0", +"Notes": "", +"Last Update": "2022-04-05" +}, { +"State ID": "41", +"Rptr ID": "2782", +"Frequency": "927.16250", +"Input Freq": "902.16250", +"PL": "151.4", +"TSQ": "151.4", +"Nearest City": "Cascade Locks", +"Landmark": "Mt Defiance", +"County": "Hood River", +"State": "Oregon", +"Country": "United States", +"Lat": "45.64849854", +"Long": "-121.72200012", +"Precise": "1", +"Callsign": "KF7LN", +"Use": "OPEN", +"Operational Status": "Unknown", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "97040", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "5,000' AMSLE.", +"Last Update": "2022-03-10" +}, { +"State ID": "41", +"Rptr ID": "12345", +"Frequency": "444.90000", +"Input Freq": "449.90000", +"PL": "100.0", +"TSQ": "", +"Nearest City": "Hood River", +"Landmark": "Middle Mountain", +"County": "Hood River", +"State": "Oregon", +"Country": "United States", +"Lat": "45.70539856", +"Long": "-121.52100372", +"Precise": "0", +"Callsign": "KA7HRC", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "", +"IRLP Node": "", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2020-07-18" +}, { +"State ID": "41", +"Rptr ID": "17229", +"Frequency": "440.60000", +"Input Freq": "445.60000", +"PL": "100.0", +"TSQ": "100.0", +"Nearest City": "Hood River", +"Landmark": "Columbia River Gorge", +"County": "Hood River", +"State": "Oregon", +"Country": "United States", +"Lat": "45.64270020", +"Long": "-121.57599640", +"Precise": "0", +"Callsign": "AF7YV", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "43296", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-04-05" +}, { +"State ID": "41", +"Rptr ID": "18736", +"Frequency": "443.32500", +"Input Freq": "448.32500", +"PL": "", +"TSQ": "", +"Nearest City": "Cascade Locks", +"Landmark": "Cascade Locks Hill", +"County": "Hood River", +"State": "Oregon", +"Country": "United States", +"Lat": "45.66983920", +"Long": "-121.89063550", +"Precise": "0", +"Callsign": "N7LF", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "0", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "No", +"DMR": "Yes", +"DMR Color Code": "1", +"DMR ID": "311388", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "Open use. Connected to PNW Digital System. Visit PNWDigital.net for further info on supported TG's and other important info.", +"Last Update": "2021-03-26" +}, { +"State ID": "41", +"Rptr ID": "21", +"Frequency": "442.30000", +"Input Freq": "447.30000", +"PL": "D125", +"TSQ": "D125", +"Nearest City": "Ashland", +"Landmark": "Mount Ashland", +"County": "Jackson", +"State": "Oregon", +"Country": "United States", +"Lat": "42.08069992", +"Long": "-122.71700287", +"Precise": "1", +"Callsign": "AB7BS", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "Yes", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-11-18" +}, { +"State ID": "41", +"Rptr ID": "168", +"Frequency": "147.06000", +"Input Freq": "147.66000", +"PL": "CSQ", +"TSQ": "", +"Nearest City": "Medford", +"Landmark": "", +"County": "Jackson", +"State": "Oregon", +"Country": "United States", +"Lat": "42.32669830", +"Long": "-122.87400055", +"Precise": "0", +"Callsign": "W9PCI", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "No", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "Yes", +"YSF DG ID Uplink": "00", +"YSF DG IS Downlink": "00", +"YSF DSC": "", +"Notes": "", +"Last Update": "2021-01-17" +}, { +"State ID": "41", +"Rptr ID": "308", +"Frequency": "146.62000", +"Input Freq": "146.02000", +"PL": "123.0", +"TSQ": "", +"Nearest City": "Ashland", +"Landmark": "", +"County": "Jackson", +"State": "Oregon", +"Country": "United States", +"Lat": "42.19459915", +"Long": "-122.70899963", +"Precise": "0", +"Callsign": "W9PCI", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "Yes", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "3383", +"IRLP Node": "3383", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "1,305'", +"Last Update": "2021-01-17" +}, { +"State ID": "41", +"Rptr ID": "311", +"Frequency": "440.70000", +"Input Freq": "445.70000", +"PL": "162.2", +"TSQ": "", +"Nearest City": "Ashland", +"Landmark": "", +"County": "Jackson", +"State": "Oregon", +"Country": "United States", +"Lat": "42.19469833", +"Long": "-122.70800018", +"Precise": "0", +"Callsign": "WX7MFR", +"Use": "OPEN", +"Operational Status": "Unknown", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2020-05-12" +}, { +"State ID": "41", +"Rptr ID": "312", +"Frequency": "440.82500", +"Input Freq": "445.82500", +"PL": "136.5", +"TSQ": "", +"Nearest City": "Central Point", +"Landmark": "", +"County": "Jackson", +"State": "Oregon", +"Country": "United States", +"Lat": "42.37609863", +"Long": "-122.91500092", +"Precise": "0", +"Callsign": "WA6RHK", +"Use": "OPEN", +"Operational Status": "Unknown", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "Uplink tone may be DCS 125.", +"Last Update": "2021-01-17" +}, { +"State ID": "41", +"Rptr ID": "369", +"Frequency": "444.82500", +"Input Freq": "449.82500", +"PL": "100.0", +"TSQ": "", +"Nearest City": "Rogue River", +"Landmark": "Elk Mountain", +"County": "Jackson", +"State": "Oregon", +"Country": "United States", +"Lat": "42.54010010", +"Long": "-123.14499664", +"Precise": "0", +"Callsign": "AB7BS", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-11-18" +}, { +"State ID": "41", +"Rptr ID": "436", +"Frequency": "147.16000", +"Input Freq": "147.76000", +"PL": "136.5", +"TSQ": "91.5", +"Nearest City": "Ashland", +"Landmark": "Soda Mtn", +"County": "Jackson", +"State": "Oregon", +"Country": "United States", +"Lat": "42.06460190", +"Long": "-122.47899628", +"Precise": "1", +"Callsign": "AB7BS", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "521741", +"IRLP Node": "", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "6,280 feet ASL.", +"Last Update": "2020-09-25" +}, { +"State ID": "41", +"Rptr ID": "472", +"Frequency": "145.33000", +"Input Freq": "144.73000", +"PL": "123.0", +"TSQ": "", +"Nearest City": "Central Point", +"Landmark": "", +"County": "Jackson", +"State": "Oregon", +"Country": "United States", +"Lat": "42.37595860", +"Long": "-122.91643070", +"Precise": "0", +"Callsign": "W9PCI", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "2,665 feet.", +"Last Update": "2021-01-17" +}, { +"State ID": "41", +"Rptr ID": "491", +"Frequency": "147.10000", +"Input Freq": "147.70000", +"PL": "136.5", +"TSQ": "", +"Nearest City": "Central Point", +"Landmark": "Johns Peak", +"County": "Jackson", +"State": "Oregon", +"Country": "United States", +"Lat": "42.35689926", +"Long": "-122.97799683", +"Precise": "1", +"Callsign": "AK7SB", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "This repeater is not listed in the ORCC online database. As of 11 July 2021 this repeater (formerly KB7SKB) is owned by (and identifies as) AK7SB.", +"Last Update": "2021-07-11" +}, { +"State ID": "41", +"Rptr ID": "493", +"Frequency": "147.00000", +"Input Freq": "147.60000", +"PL": "123.0", +"TSQ": "", +"Nearest City": "Medford", +"Landmark": "Rogue Valley Manor", +"County": "Jackson", +"State": "Oregon", +"Country": "United States", +"Lat": "42.32669830", +"Long": "-122.87400055", +"Precise": "0", +"Callsign": "K7RVM", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-04-05" +}, { +"State ID": "41", +"Rptr ID": "494", +"Frequency": "147.02000", +"Input Freq": "147.62000", +"PL": "100.0", +"TSQ": "", +"Nearest City": "Medford", +"Landmark": "Downtown", +"County": "Jackson", +"State": "Oregon", +"Country": "United States", +"Lat": "42.32649994", +"Long": "-122.87599945", +"Precise": "0", +"Callsign": "K7RPT", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "0", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2021-02-09" +}, { +"State ID": "41", +"Rptr ID": "525", +"Frequency": "147.26000", +"Input Freq": "147.86000", +"PL": "123.0", +"TSQ": "", +"Nearest City": "Ashland", +"Landmark": "Mount Ashland", +"County": "Jackson", +"State": "Oregon", +"Country": "United States", +"Lat": "42.08069992", +"Long": "-122.71700287", +"Precise": "1", +"Callsign": "WX7MFR", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "", +"IRLP Node": "", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2020-08-05" +}, { +"State ID": "41", +"Rptr ID": "550", +"Frequency": "443.15000", +"Input Freq": "448.15000", +"PL": "136.5", +"TSQ": "", +"Nearest City": "Central Point", +"Landmark": "QTH", +"County": "Jackson", +"State": "Oregon", +"Country": "United States", +"Lat": "42.21500015", +"Long": "-121.70800018", +"Precise": "0", +"Callsign": "KL7VK", +"Use": "OPEN", +"Operational Status": "Unknown", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "1,405 feet.", +"Last Update": "2021-01-17" +}, { +"State ID": "41", +"Rptr ID": "551", +"Frequency": "443.77500", +"Input Freq": "448.77500", +"PL": "", +"TSQ": "", +"Nearest City": "Medford", +"Landmark": "Baldy", +"County": "Jackson", +"State": "Oregon", +"Country": "United States", +"Lat": "42.29859924", +"Long": "-122.75000000", +"Precise": "1", +"Callsign": "KE7MVI", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "", +"IRLP Node": "", +"Wires Node": "", +"FM Analog": "No", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "Yes", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2020-05-13" +}, { +"State ID": "41", +"Rptr ID": "661", +"Frequency": "145.41000", +"Input Freq": "144.81000", +"PL": "100.0", +"TSQ": "", +"Nearest City": "Central Point", +"Landmark": "", +"County": "Jackson", +"State": "Oregon", +"Country": "United States", +"Lat": "42.35421800", +"Long": "-122.96097300", +"Precise": "1", +"Callsign": "KB7QMV", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "The repeater reaches from north of Eagle Point south past Ashland and east up 140 toward Klamath Falls", +"Last Update": "2021-01-10" +}, { +"State ID": "41", +"Rptr ID": "673", +"Frequency": "444.10000", +"Input Freq": "449.10000", +"PL": "123.0", +"TSQ": "", +"Nearest City": "Central Point", +"Landmark": "", +"County": "Jackson", +"State": "Oregon", +"Country": "United States", +"Lat": "42.37609863", +"Long": "-122.91500092", +"Precise": "1", +"Callsign": "W9PCI", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "1,355 feet.", +"Last Update": "2021-01-17" +}, { +"State ID": "41", +"Rptr ID": "674", +"Frequency": "444.20000", +"Input Freq": "449.20000", +"PL": "100.0", +"TSQ": "", +"Nearest City": "Jacksonville", +"Landmark": "Roxy Ann QTH", +"County": "Jackson", +"State": "Oregon", +"Country": "United States", +"Lat": "42.31359863", +"Long": "-122.96600342", +"Precise": "0", +"Callsign": "W9PCI", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "385956", +"IRLP Node": "3414", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "3,075 feet.", +"Last Update": "2022-09-17" +}, { +"State ID": "41", +"Rptr ID": "675", +"Frequency": "444.30000", +"Input Freq": "449.30000", +"PL": "123.0", +"TSQ": "", +"Nearest City": "Jacksonville", +"Landmark": "", +"County": "Jackson", +"State": "Oregon", +"Country": "United States", +"Lat": "42.31359863", +"Long": "-122.96600342", +"Precise": "0", +"Callsign": "W9PCI", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "Yes", +"YSF DG ID Uplink": "00", +"YSF DG IS Downlink": "00", +"YSF DSC": "0", +"Notes": "2,685 feet.", +"Last Update": "2021-01-17" +}, { +"State ID": "41", +"Rptr ID": "2807", +"Frequency": "147.38000", +"Input Freq": "147.98000", +"PL": "131.8", +"TSQ": "", +"Nearest City": "Central Point", +"Landmark": "", +"County": "Jackson", +"State": "Oregon", +"Country": "United States", +"Lat": "42.37609863", +"Long": "-122.91500092", +"Precise": "0", +"Callsign": "KL7VK", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "1,405 feet ASL.", +"Last Update": "2022-04-05" +}, { +"State ID": "41", +"Rptr ID": "3577", +"Frequency": "146.84000", +"Input Freq": "146.24000", +"PL": "123.0", +"TSQ": "", +"Nearest City": "Medford", +"Landmark": "Baldy", +"County": "Jackson", +"State": "Oregon", +"Country": "United States", +"Lat": "42.29850006", +"Long": "-122.75099945", +"Precise": "1", +"Callsign": "K7JAX", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "Yes", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "3,797 feet ASL.", +"Last Update": "2022-04-05" +}, { +"State ID": "41", +"Rptr ID": "6736", +"Frequency": "146.72000", +"Input Freq": "146.12000", +"PL": "131.8", +"TSQ": "", +"Nearest City": "Ruch", +"Landmark": "", +"County": "Jackson", +"State": "Oregon", +"Country": "United States", +"Lat": "42.24489975", +"Long": "-123.03500366", +"Precise": "0", +"Callsign": "KL7VK", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2021-01-17" +}, { +"State ID": "41", +"Rptr ID": "11145", +"Frequency": "444.45000", +"Input Freq": "449.45000", +"PL": "100.0", +"TSQ": "", +"Nearest City": "Medford", +"Landmark": "Rogue Valley Manor", +"County": "Jackson", +"State": "Oregon", +"Country": "United States", +"Lat": "42.32649994", +"Long": "-122.87599945", +"Precise": "0", +"Callsign": "K7RVM", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-12-06" +}, { +"State ID": "41", +"Rptr ID": "11230", +"Frequency": "145.24000", +"Input Freq": "144.64000", +"PL": "", +"TSQ": "", +"Nearest City": "Medford", +"Landmark": "", +"County": "Jackson", +"State": "Oregon", +"Country": "United States", +"Lat": "42.30770111", +"Long": "-122.83899689", +"Precise": "1", +"Callsign": "KG7FOJ", +"Use": "OPEN", +"Operational Status": "Off-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "No", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "Yes", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "As of 06/25/2021 03:04:48 UTC -- Unique Stations Heard In The Last 14 Days on KG7FOJ: ***NO STATIONS HEARD ! *** There are no Repeater Record Custodians assigned to this repeater. Please ask WD6ESU -- ROBERT N. TANGEL -- TRUSTEE to register with RepeaterBook.com so that he (or others of his choosing) can be assigned as such. Confirmed that this repeater is listed in the ORCC online database. Accordingly, moved from UNKNOWN to ON-AIR. If you hear this repeater ON-AIR or know of a different status, please email KV4VT@RepeaterBook.com ASAP.", +"Last Update": "2021-06-24" +}, { +"State ID": "41", +"Rptr ID": "11231", +"Frequency": "444.65000", +"Input Freq": "449.65000", +"PL": "", +"TSQ": "", +"Nearest City": "Medford", +"Landmark": "", +"County": "Jackson", +"State": "Oregon", +"Country": "United States", +"Lat": "42.30770111", +"Long": "-122.83899689", +"Precise": "1", +"Callsign": "KG7FOJ", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "", +"IRLP Node": "", +"Wires Node": "", +"FM Analog": "No", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "Yes", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2020-05-13" +}, { +"State ID": "41", +"Rptr ID": "11232", +"Frequency": "1293.12500", +"Input Freq": "1313.12500", +"PL": "", +"TSQ": "", +"Nearest City": "Medford", +"Landmark": "", +"County": "Jackson", +"State": "Oregon", +"Country": "United States", +"Lat": "42.30770111", +"Long": "-122.83899689", +"Precise": "1", +"Callsign": "KG7FOJ", +"Use": "OPEN", +"Operational Status": "Off-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "No", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "Yes", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "As of 06/25/2021 03:00:04 UTC -- Unique Stations Heard In The Last 14 Days on KG7FOJ: ***NO STATIONS HEARD !*** If you hear this repeater ON-AIR or know of a different status, please email KV4VT@RepeaterBook.com ASAP.", +"Last Update": "2021-06-24" +}, { +"State ID": "41", +"Rptr ID": "12806", +"Frequency": "145.27000", +"Input Freq": "144.67000", +"PL": "136.5", +"TSQ": "136.5", +"Nearest City": "Rogue River", +"Landmark": "Elk Mtn", +"County": "Jackson", +"State": "Oregon", +"Country": "United States", +"Lat": "42.43600082", +"Long": "-123.17199707", +"Precise": "0", +"Callsign": "WA6HWW", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "0", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2021-02-19" +}, { +"State ID": "41", +"Rptr ID": "17153", +"Frequency": "1248.50000", +"Input Freq": "1228.50000", +"PL": "", +"TSQ": "", +"Nearest City": "Medford", +"Landmark": "", +"County": "Jackson", +"State": "Oregon", +"Country": "United States", +"Lat": "42.32649994", +"Long": "-122.87599945", +"Precise": "0", +"Callsign": "KG7FOJ", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "There are no Repeater Record Custodians assigned to this repeater. Please ask WD6ESU -- ROBERT N. TANGEL -- TRUSTEE to register with RepeaterBook.com so that he (or others of his choosing) can be assigned as such. Confirmed that this repeater is listed in the ORCC online database. Accordingly, moved from UNKNOWN to ON-AIR. If you hear this repeater ON-AIR or know of a different status, please email KV4VT@RepeaterBook.com ASAP.", +"Last Update": "2021-06-24" +}, { +"State ID": "41", +"Rptr ID": "18062", +"Frequency": "52.81000", +"Input Freq": "51.11000", +"PL": "103.5", +"TSQ": "", +"Nearest City": "Grants Pass", +"Landmark": "Elk Mountain", +"County": "Jackson", +"State": "Oregon", +"Country": "United States", +"Lat": "42.03089905", +"Long": "-124.12300110", +"Precise": "0", +"Callsign": "WD7RW", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "7366", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "Split site, receiver on Fielder and transmitter on Elk.", +"Last Update": "2022-04-05" +}, { +"State ID": "41", +"Rptr ID": "18573", +"Frequency": "444.25000", +"Input Freq": "449.25000", +"PL": "103.5", +"TSQ": "103.5", +"Nearest City": "Rogue River", +"Landmark": "Fielder Mtn", +"County": "Jackson", +"State": "Oregon", +"Country": "United States", +"Lat": "42.44567490", +"Long": "-123.21672058", +"Precise": "0", +"Callsign": "WD7FGX", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "", +"IRLP Node": "7366", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2020-03-10" +}, { +"State ID": "41", +"Rptr ID": "18782", +"Frequency": "440.22500", +"Input Freq": "445.22500", +"PL": "131.8", +"TSQ": "", +"Nearest City": "Medford", +"Landmark": "", +"County": "Jackson", +"State": "Oregon", +"Country": "United States", +"Lat": "42.32651520", +"Long": "-122.87559490", +"Precise": "0", +"Callsign": "K7RVM", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "0", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "Yes", +"YSF DG ID Uplink": "00", +"YSF DG IS Downlink": "00", +"YSF DSC": "", +"Notes": "There are no Repeater Record Custodians assigned to this repeater. Please ask N6WN -- DANIEL B. CURTIS -- TRUSTEE to register with RepeaterBook.com so that he (or others of his choosing) can be assigned as such. Confirmed that this repeater is listed in the ORCC online database. If you hear this repeater ON-AIR or know of a different status, please email KV4VT@RepeaterBook.com ASAP. ", +"Last Update": "2021-06-24" +}, { +"State ID": "41", +"Rptr ID": "19080", +"Frequency": "440.72500", +"Input Freq": "445.72500", +"PL": "D023", +"TSQ": "D023", +"Nearest City": "Medford", +"Landmark": "Roxy Ann Peak", +"County": "Jackson", +"State": "Oregon", +"Country": "United States", +"Lat": "42.35293200", +"Long": "-122.78685200", +"Precise": "0", +"Callsign": "", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "0", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "3,511 feet.", +"Last Update": "2020-08-25" +}, { +"State ID": "41", +"Rptr ID": "19641", +"Frequency": "147.24000", +"Input Freq": "147.84000", +"PL": "123.0", +"TSQ": "", +"Nearest City": "Medford", +"Landmark": "", +"County": "Jackson", +"State": "Oregon", +"Country": "United States", +"Lat": "43.80413340", +"Long": "-120.55420120", +"Precise": "0", +"Callsign": "W9PCI", +"Use": "OPEN", +"Operational Status": "Unknown", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "3414", +"IRLP Node": "3414", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "Currently bench testing.", +"Last Update": "2022-12-06" +}, { +"State ID": "41", +"Rptr ID": "19702", +"Frequency": "442.80000", +"Input Freq": "447.80000", +"PL": "", +"TSQ": "", +"Nearest City": "Medford", +"Landmark": "", +"County": "Jackson", +"State": "Oregon", +"Country": "United States", +"Lat": "42.32651520", +"Long": "-122.87559490", +"Precise": "0", +"Callsign": "KD7MPA", +"Use": "OPEN", +"Operational Status": "Unknown", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "0", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "No", +"DMR": "Yes", +"DMR Color Code": "1", +"DMR ID": "311499", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2021-01-31" +}, { +"State ID": "41", +"Rptr ID": "21166", +"Frequency": "145.00000", +"Input Freq": "145.00000", +"PL": "D503", +"TSQ": "", +"Nearest City": "Rogue River", +"Landmark": "", +"County": "Jackson", +"State": "Oregon", +"Country": "United States", +"Lat": "42.43000000", +"Long": "-123.16000000", +"Precise": "1", +"Callsign": "KL7XL", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "54016", +"EchoLink Node": "0", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "No", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "10 ft tower with 60 watts-o-power.", +"Last Update": "2022-12-31" +}, { +"State ID": "41", +"Rptr ID": "21206", +"Frequency": "439.00000", +"Input Freq": "439.00000", +"PL": "D503", +"TSQ": "", +"Nearest City": "Rogue River", +"Landmark": "", +"County": "Jackson", +"State": "Oregon", +"Country": "United States", +"Lat": "42.43595400", +"Long": "-123.17199760", +"Precise": "1", +"Callsign": "KL7XL", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "54016", +"EchoLink Node": "0", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "No", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "10 foot tower with 50 watts. ", +"Last Update": "2022-10-06" +}, { +"State ID": "41", +"Rptr ID": "423", +"Frequency": "147.18000", +"Input Freq": "147.78000", +"PL": "162.2", +"TSQ": "", +"Nearest City": "Mitchell", +"Landmark": "Stephenson Mountain", +"County": "Jefferson", +"State": "Oregon", +"Country": "United States", +"Lat": "44.58240128", +"Long": "-120.45200348", +"Precise": "1", +"Callsign": "W7JVO", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "6,312 feet ASL.", +"Last Update": "2021-01-17" +}, { +"State ID": "41", +"Rptr ID": "15786", +"Frequency": "442.22500", +"Input Freq": "447.22500", +"PL": "114.8", +"TSQ": "", +"Nearest City": "Madras", +"Landmark": "Eagle Butte", +"County": "Jefferson", +"State": "Oregon", +"Country": "United States", +"Lat": "44.83960000", +"Long": "-121.23530000", +"Precise": "1", +"Callsign": "K7RPT", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "", +"IRLP Node": "", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "3,800 feet ASL, 50 watts.", +"Last Update": "2020-10-09" +}, { +"State ID": "41", +"Rptr ID": "17783", +"Frequency": "444.42500", +"Input Freq": "449.42500", +"PL": "", +"TSQ": "", +"Nearest City": "Culver", +"Landmark": "", +"County": "Jefferson", +"State": "Oregon", +"Country": "United States", +"Lat": "44.52569962", +"Long": "-121.21299744", +"Precise": "0", +"Callsign": "KC7DMF", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "", +"IRLP Node": "", +"Wires Node": "", +"FM Analog": "No", +"DMR": "Yes", +"DMR Color Code": "1", +"DMR ID": "0", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-02-24" +}, { +"State ID": "41", +"Rptr ID": "242", +"Frequency": "145.49000", +"Input Freq": "144.89000", +"PL": "136.5", +"TSQ": "", +"Nearest City": "Cave Junction", +"Landmark": "Eight Dollar Mtn", +"County": "Josephine", +"State": "Oregon", +"Country": "United States", +"Lat": "42.25780106", +"Long": "-123.66200256", +"Precise": "1", +"Callsign": "WB6YQP", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2021-01-17" +}, { +"State ID": "41", +"Rptr ID": "244", +"Frequency": "146.94000", +"Input Freq": "146.34000", +"PL": "D023", +"TSQ": "D023", +"Nearest City": "Wolf Creek", +"Landmark": "King Mountain", +"County": "Josephine", +"State": "Oregon", +"Country": "United States", +"Lat": "42.69169998", +"Long": "-123.23100281", +"Precise": "1", +"Callsign": "W7PRA", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "521741", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "5,283', 75 watts.", +"Last Update": "2021-02-19" +}, { +"State ID": "41", +"Rptr ID": "246", +"Frequency": "147.22000", +"Input Freq": "147.82000", +"PL": "CSQ", +"TSQ": "", +"Nearest City": "Grants Pass", +"Landmark": "", +"County": "Josephine", +"State": "Oregon", +"Country": "United States", +"Lat": "42.40319824", +"Long": "-123.35800171", +"Precise": "1", +"Callsign": "WA6OTP", +"Use": "OPEN", +"Operational Status": "Unknown", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-04-05" +}, { +"State ID": "41", +"Rptr ID": "247", +"Frequency": "147.30000", +"Input Freq": "147.90000", +"PL": "136.5", +"TSQ": "", +"Nearest City": "Grants Pass", +"Landmark": "Gilbert Peak", +"County": "Josephine", +"State": "Oregon", +"Country": "United States", +"Lat": "42.47159958", +"Long": "-123.30599976", +"Precise": "1", +"Callsign": "K7LIX", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "Yes", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2021-06-17" +}, { +"State ID": "41", +"Rptr ID": "248", +"Frequency": "147.34000", +"Input Freq": "147.94000", +"PL": "136.5", +"TSQ": "", +"Nearest City": "Wolf Creek", +"Landmark": "King Mountain", +"County": "Josephine", +"State": "Oregon", +"Country": "United States", +"Lat": "42.69169998", +"Long": "-123.23100281", +"Precise": "1", +"Callsign": "WB6YQP", +"Use": "OPEN", +"Operational Status": "Unknown", +"ARES": "Yes", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2021-01-17" +}, { +"State ID": "41", +"Rptr ID": "258", +"Frequency": "444.50000", +"Input Freq": "449.50000", +"PL": "D125", +"TSQ": "D125", +"Nearest City": "Wolf Creek", +"Landmark": "King Mountain", +"County": "Josephine", +"State": "Oregon", +"Country": "United States", +"Lat": "42.69169998", +"Long": "-123.23100281", +"Precise": "1", +"Callsign": "AB7BS", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-11-18" +}, { +"State ID": "41", +"Rptr ID": "370", +"Frequency": "440.55000", +"Input Freq": "445.55000", +"PL": "173.8", +"TSQ": "", +"Nearest City": "Grants Pass", +"Landmark": "Onion Mountain", +"County": "Josephine", +"State": "Oregon", +"Country": "United States", +"Lat": "42.45439911", +"Long": "-123.61900330", +"Precise": "1", +"Callsign": "AB7BS", +"Use": "OPEN", +"Operational Status": "Off-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "Though this is a solar site, enough power is available to keep this repeater linked full time. This repeater is not listed in ORCC online database. Moved from UNKNOWN to OFF-AIR. ", +"Last Update": "2022-12-06" +}, { +"State ID": "41", +"Rptr ID": "8090", +"Frequency": "440.46250", +"Input Freq": "445.46250", +"PL": "", +"TSQ": "", +"Nearest City": "Grants Pass", +"Landmark": "Mt Fielder", +"County": "Josephine", +"State": "Oregon", +"Country": "United States", +"Lat": "42.42422450", +"Long": "-123.19380240", +"Precise": "0", +"Callsign": "KE7LKX", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "No", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "Yes", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-04-05" +}, { +"State ID": "41", +"Rptr ID": "8244", +"Frequency": "443.52500", +"Input Freq": "448.52500", +"PL": "173.8", +"TSQ": "", +"Nearest City": "Wolf Creek", +"Landmark": "King Mountain", +"County": "Josephine", +"State": "Oregon", +"Country": "United States", +"Lat": "42.69169998", +"Long": "-123.23100281", +"Precise": "1", +"Callsign": "W6PRN", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "", +"IRLP Node": "", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2019-07-28" +}, { +"State ID": "41", +"Rptr ID": "17726", +"Frequency": "52.81000", +"Input Freq": "52.31000", +"PL": "103.5", +"TSQ": "103.5", +"Nearest City": "Grants Pass", +"Landmark": "", +"County": "Josephine", +"State": "Oregon", +"Country": "United States", +"Lat": "42.41460037", +"Long": "-123.33899689", +"Precise": "1", +"Callsign": "WD7FGX", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "", +"IRLP Node": "7366", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2020-03-10" +}, { +"State ID": "41", +"Rptr ID": "17971", +"Frequency": "444.67500", +"Input Freq": "449.67500", +"PL": "100.0", +"TSQ": "", +"Nearest City": "Grants Pass", +"Landmark": "Gilbert Peak", +"County": "Josephine", +"State": "Oregon", +"Country": "United States", +"Lat": "42.48880005", +"Long": "-123.30699921", +"Precise": "0", +"Callsign": "W6PRN", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "", +"IRLP Node": "", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2019-07-28" +}, { +"State ID": "41", +"Rptr ID": "20194", +"Frequency": "449.97500", +"Input Freq": "449.97500", +"PL": "100.0", +"TSQ": "", +"Nearest City": "Grants Pass", +"Landmark": "", +"County": "Josephine", +"State": "Oregon", +"Country": "United States", +"Lat": "42.41458700", +"Long": "-123.33907500", +"Precise": "0", +"Callsign": "W2HR", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "47871", +"EchoLink Node": "0", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "Full time connected to the GRANTS PASS HUB FM only.", +"Last Update": "2022-10-16" +}, { +"State ID": "41", +"Rptr ID": "169", +"Frequency": "440.67500", +"Input Freq": "445.67500", +"PL": "136.5", +"TSQ": "", +"Nearest City": "Keno", +"Landmark": "Chase Mountain", +"County": "Klamath", +"State": "Oregon", +"Country": "United States", +"Lat": "42.09450150", +"Long": "-121.99400330", +"Precise": "1", +"Callsign": "WA6RHK", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "0", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "Links to the west via Soda Mtn.", +"Last Update": "2021-05-29" +}, { +"State ID": "41", +"Rptr ID": "196", +"Frequency": "145.47000", +"Input Freq": "144.87000", +"PL": "123.0", +"TSQ": "", +"Nearest City": "Chemult", +"Landmark": "Walker Mountain", +"County": "Klamath", +"State": "Oregon", +"Country": "United States", +"Lat": "43.26119995", +"Long": "-121.74600220", +"Precise": "0", +"Callsign": "AA1JW", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "Antenna elevation is 7,100 feet ASL. This repeater is now listed in the ORCC online database as AA1JW -- JAMES A. WILLIAMS -- TRUSTEE. Trustee has no email address posted in QRZ with which to help validate this listing. ", +"Last Update": "2022-10-24" +}, { +"State ID": "41", +"Rptr ID": "267", +"Frequency": "146.61000", +"Input Freq": "146.01000", +"PL": "118.8", +"TSQ": "118.8", +"Nearest City": "Klamath Falls", +"Landmark": "Hogback Mtn", +"County": "Klamath", +"State": "Oregon", +"Country": "United States", +"Lat": "42.24269867", +"Long": "-121.70600128", +"Precise": "1", +"Callsign": "W7VW", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "Yes", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "0", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2021-02-19" +}, { +"State ID": "41", +"Rptr ID": "270", +"Frequency": "146.85000", +"Input Freq": "146.25000", +"PL": "118.8", +"TSQ": "118.8", +"Nearest City": "Klamath Falls", +"Landmark": "Hamaker Mountain", +"County": "Klamath", +"State": "Oregon", +"Country": "United States", +"Lat": "42.06840134", +"Long": "-121.97299957", +"Precise": "1", +"Callsign": "W7VW", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "Yes", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2020-05-12" +}, { +"State ID": "41", +"Rptr ID": "272", +"Frequency": "443.90000", +"Input Freq": "448.90000", +"PL": "118.8", +"TSQ": "", +"Nearest City": "Klamath Falls", +"Landmark": "Hogsback Mtn", +"County": "Klamath", +"State": "Oregon", +"Country": "United States", +"Lat": "42.24269867", +"Long": "-121.70600128", +"Precise": "1", +"Callsign": "W7VW", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-12-06" +}, { +"State ID": "41", +"Rptr ID": "273", +"Frequency": "443.20000", +"Input Freq": "448.20000", +"PL": "100.0", +"TSQ": "", +"Nearest City": "Keno", +"Landmark": "Hamaker Mountain", +"County": "Klamath", +"State": "Oregon", +"Country": "United States", +"Lat": "42.06850052", +"Long": "-121.97299957", +"Precise": "1", +"Callsign": "K6PRN", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "", +"IRLP Node": "", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2019-06-23" +}, { +"State ID": "41", +"Rptr ID": "275", +"Frequency": "147.20000", +"Input Freq": "147.80000", +"PL": "136.5", +"TSQ": "91.5", +"Nearest City": "Klamath Falls", +"Landmark": "Chase Mountain", +"County": "Klamath", +"State": "Oregon", +"Country": "United States", +"Lat": "42.09469986", +"Long": "-121.99400330", +"Precise": "1", +"Callsign": "AB7BS", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "", +"IRLP Node": "", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2020-10-09" +}, { +"State ID": "41", +"Rptr ID": "482", +"Frequency": "147.18000", +"Input Freq": "147.78000", +"PL": "100.0", +"TSQ": "", +"Nearest City": "Keno", +"Landmark": "Hamaker Mountain", +"County": "Klamath", +"State": "Oregon", +"Country": "United States", +"Lat": "42.06850052", +"Long": "-121.97299957", +"Precise": "1", +"Callsign": "", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "5,918 feet.", +"Last Update": "2020-05-12" +}, { +"State ID": "41", +"Rptr ID": "11142", +"Frequency": "442.52500", +"Input Freq": "447.52500", +"PL": "118.8", +"TSQ": "", +"Nearest City": "Keno", +"Landmark": "", +"County": "Klamath", +"State": "Oregon", +"Country": "United States", +"Lat": "42.12649918", +"Long": "-121.93000031", +"Precise": "0", +"Callsign": "KD7TNG", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "Yes", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-12-06" +}, { +"State ID": "41", +"Rptr ID": "17133", +"Frequency": "444.95000", +"Input Freq": "449.95000", +"PL": "136.5", +"TSQ": "82.5", +"Nearest City": "Chiloquin", +"Landmark": "Train Mtn", +"County": "Klamath", +"State": "Oregon", +"Country": "United States", +"Lat": "42.55680084", +"Long": "-121.88600159", +"Precise": "0", +"Callsign": "K7LNK", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "", +"IRLP Node": "", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2021-11-25" +}, { +"State ID": "41", +"Rptr ID": "19135", +"Frequency": "147.14000", +"Input Freq": "147.74000", +"PL": "141.3", +"TSQ": "91.5", +"Nearest City": "Chemult", +"Landmark": "Walker Mtn", +"County": "Klamath", +"State": "Oregon", +"Country": "United States", +"Lat": "43.67039950", +"Long": "-121.50363600", +"Precise": "0", +"Callsign": "AB7BS", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "0", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2020-10-09" +}, { +"State ID": "41", +"Rptr ID": "206", +"Frequency": "147.20000", +"Input Freq": "147.80000", +"PL": "162.2", +"TSQ": "", +"Nearest City": "Hampton", +"Landmark": "Glass Butte", +"County": "Lake", +"State": "Oregon", +"Country": "United States", +"Lat": "43.80410004", +"Long": "-120.55400085", +"Precise": "0", +"Callsign": "W7JVO", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "6,312 feet ASL.", +"Last Update": "2021-01-17" +}, { +"State ID": "41", +"Rptr ID": "295", +"Frequency": "145.31000", +"Input Freq": "144.71000", +"PL": "173.8", +"TSQ": "", +"Nearest City": "Lakeview", +"Landmark": "Drake Peak", +"County": "Lake", +"State": "Oregon", +"Country": "United States", +"Lat": "42.30039978", +"Long": "-120.12300110", +"Precise": "1", +"Callsign": "KE7QP", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "", +"IRLP Node": "", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "8,222 feet. We have ran out of propane fuel that helps when the solar system has no sun. This site is unlinked until we get some sunshine in the coming months. ", +"Last Update": "2020-10-09" +}, { +"State ID": "41", +"Rptr ID": "296", +"Frequency": "146.80000", +"Input Freq": "146.20000", +"PL": "173.8", +"TSQ": "", +"Nearest City": "Summer Lake", +"Landmark": "Dead Indian Mountain", +"County": "Lake", +"State": "Oregon", +"Country": "United States", +"Lat": "42.98339844", +"Long": "-120.82800293", +"Precise": "1", +"Callsign": "KE7QP", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "7,022 feet ASL", +"Last Update": "2022-04-05" +}, { +"State ID": "41", +"Rptr ID": "297", +"Frequency": "147.34000", +"Input Freq": "147.94000", +"PL": "173.8", +"TSQ": "", +"Nearest City": "Lakeview", +"Landmark": "Grizzly Peak", +"County": "Lake", +"State": "Oregon", +"Country": "United States", +"Lat": "42.25270081", +"Long": "-120.63899994", +"Precise": "1", +"Callsign": "KE7QP", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-11-18" +}, { +"State ID": "41", +"Rptr ID": "3796", +"Frequency": "145.15000", +"Input Freq": "144.55000", +"PL": "173.8", +"TSQ": "", +"Nearest City": "Fort Rock", +"Landmark": "Washtina Butte", +"County": "Lake", +"State": "Oregon", +"Country": "United States", +"Lat": "43.33915000", +"Long": "-121.27118000", +"Precise": "1", +"Callsign": "AA1JW", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2021-10-11" +}, { +"State ID": "41", +"Rptr ID": "11", +"Frequency": "53.03000", +"Input Freq": "51.33000", +"PL": "100.0", +"TSQ": "", +"Nearest City": "Monroe", +"Landmark": "Prairie Peak", +"County": "Lane", +"State": "Oregon", +"Country": "United States", +"Lat": "44.27700043", +"Long": "-123.60800171", +"Precise": "1", +"Callsign": "W7ARD", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-11-18" +}, { +"State ID": "41", +"Rptr ID": "12", +"Frequency": "146.68000", +"Input Freq": "146.08000", +"PL": "100.0", +"TSQ": "100.0", +"Nearest City": "Horton", +"Landmark": "Prairie Mtn", +"County": "Lane", +"State": "Oregon", +"Country": "United States", +"Lat": "44.27957000", +"Long": "-123.59071200", +"Precise": "1", +"Callsign": "W7EUG", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "Yes", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "0", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-11-18" +}, { +"State ID": "41", +"Rptr ID": "13", +"Frequency": "146.72000", +"Input Freq": "146.12000", +"PL": "100.0", +"TSQ": "100.0", +"Nearest City": "Junction City", +"Landmark": "Prairie Peak", +"County": "Lane", +"State": "Oregon", +"Country": "United States", +"Lat": "44.28002800", +"Long": "-123.58297100", +"Precise": "1", +"Callsign": "W7PXL", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "538022", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "Access to the Echolink system is granted only to members of the Valley Radio Club, Eugene OR.", +"Last Update": "2023-01-11" +}, { +"State ID": "41", +"Rptr ID": "55", +"Frequency": "441.62500", +"Input Freq": "446.62500", +"PL": "100.0", +"TSQ": "", +"Nearest City": "Sisters", +"Landmark": "Hoodoo Butte", +"County": "Lane", +"State": "Oregon", +"Country": "United States", +"Lat": "44.40190125", +"Long": "-121.88300323", +"Precise": "1", +"Callsign": "W7PRA", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "521741", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-11-18" +}, { +"State ID": "41", +"Rptr ID": "300", +"Frequency": "53.07000", +"Input Freq": "51.37000", +"PL": "100.0", +"TSQ": "", +"Nearest City": "Oakridge", +"Landmark": "Wolf Mountain", +"County": "Lane", +"State": "Oregon", +"Country": "United States", +"Lat": "43.61619949", +"Long": "-122.23000336", +"Precise": "1", +"Callsign": "W7ARD", +"Use": "OPEN", +"Operational Status": "Unknown", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2021-01-17" +}, { +"State ID": "41", +"Rptr ID": "305", +"Frequency": "145.37000", +"Input Freq": "144.77000", +"PL": "100.0", +"TSQ": "100.0", +"Nearest City": "Blue River", +"Landmark": "Indian Ridge", +"County": "Lane", +"State": "Oregon", +"Country": "United States", +"Lat": "44.00529861", +"Long": "-122.25599670", +"Precise": "1", +"Callsign": "W7EUG", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "Yes", +"RACES": "Yes", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "0", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-03-22" +}, { +"State ID": "41", +"Rptr ID": "309", +"Frequency": "146.66000", +"Input Freq": "146.06000", +"PL": "100.0", +"TSQ": "", +"Nearest City": "Cottage Grove", +"Landmark": "Harness Mountain", +"County": "Lane", +"State": "Oregon", +"Country": "United States", +"Lat": "43.52550125", +"Long": "-123.09200287", +"Precise": "1", +"Callsign": "W7ZQE", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "Yes", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-04-05" +}, { +"State ID": "41", +"Rptr ID": "310", +"Frequency": "443.02500", +"Input Freq": "448.02500", +"PL": "156.7", +"TSQ": "", +"Nearest City": "Cottage Grove", +"Landmark": "", +"County": "Lane", +"State": "Oregon", +"Country": "United States", +"Lat": "43.79779816", +"Long": "-123.05799866", +"Precise": "0", +"Callsign": "K7SLA", +"Use": "OPEN", +"Operational Status": "Unknown", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2021-01-17" +}, { +"State ID": "41", +"Rptr ID": "314", +"Frequency": "146.74000", +"Input Freq": "146.14000", +"PL": "100.0", +"TSQ": "", +"Nearest City": "Springfield", +"Landmark": "Willamette Heights Park", +"County": "Lane", +"State": "Oregon", +"Country": "United States", +"Lat": "44.03979874", +"Long": "-123.01799774", +"Precise": "1", +"Callsign": "WA7FQD", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-04-05" +}, { +"State ID": "41", +"Rptr ID": "315", +"Frequency": "146.76000", +"Input Freq": "146.16000", +"PL": "123.0", +"TSQ": "", +"Nearest City": "Cottage Grove", +"Landmark": "Bear Mountain", +"County": "Lane", +"State": "Oregon", +"Country": "United States", +"Lat": "43.84260178", +"Long": "-122.89199829", +"Precise": "1", +"Callsign": "W7NK", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "3,680", +"Last Update": "2022-05-06" +}, { +"State ID": "41", +"Rptr ID": "316", +"Frequency": "146.80000", +"Input Freq": "146.20000", +"PL": "100.0", +"TSQ": "100.0", +"Nearest City": "Florence", +"Landmark": "Herman Peak", +"County": "Lane", +"State": "Oregon", +"Country": "United States", +"Lat": "44.12419891", +"Long": "-124.01300049", +"Precise": "1", +"Callsign": "W7FLO", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "Yes", +"RACES": "Yes", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "612184", +"IRLP Node": "", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2020-08-13" +}, { +"State ID": "41", +"Rptr ID": "317", +"Frequency": "146.88000", +"Input Freq": "146.28000", +"PL": "100.0", +"TSQ": "100.0", +"Nearest City": "Eugene", +"Landmark": "Blanton Heights", +"County": "Lane", +"State": "Oregon", +"Country": "United States", +"Lat": "44.00260162", +"Long": "-123.11299896", +"Precise": "1", +"Callsign": "K7TBL", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "1,270 feet ASL.", +"Last Update": "2022-04-05" +}, { +"State ID": "41", +"Rptr ID": "318", +"Frequency": "146.98000", +"Input Freq": "146.38000", +"PL": "88.5", +"TSQ": "", +"Nearest City": "Oakridge", +"Landmark": "Wolf Mountain", +"County": "Lane", +"State": "Oregon", +"Country": "United States", +"Lat": "43.61669922", +"Long": "-122.23000336", +"Precise": "1", +"Callsign": "N7NPA", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "Yes", +"RACES": "Yes", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "0", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "Used as an ARES/RACES tactical channel.", +"Last Update": "2022-12-14" +}, { +"State ID": "41", +"Rptr ID": "319", +"Frequency": "147.08000", +"Input Freq": "147.68000", +"PL": "100.0", +"TSQ": "91.5", +"Nearest City": "Eugene", +"Landmark": "Coburg Ridge", +"County": "Lane", +"State": "Oregon", +"Country": "United States", +"Lat": "44.13660049", +"Long": "-123.01499939", +"Precise": "0", +"Callsign": "W7CQZ", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "521741", +"IRLP Node": "", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2020-10-09" +}, { +"State ID": "41", +"Rptr ID": "321", +"Frequency": "147.26000", +"Input Freq": "147.86000", +"PL": "100.0", +"TSQ": "100.0", +"Nearest City": "Eugene", +"Landmark": "Blanton Heights", +"County": "Lane", +"State": "Oregon", +"Country": "United States", +"Lat": "44.00260162", +"Long": "-123.11299896", +"Precise": "1", +"Callsign": "W7NK", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "Yes", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "", +"IRLP Node": "", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "1,270'", +"Last Update": "2021-02-24" +}, { +"State ID": "41", +"Rptr ID": "322", +"Frequency": "147.36000", +"Input Freq": "147.96000", +"PL": "123.0", +"TSQ": "123.0", +"Nearest City": "Eugene", +"Landmark": "Blanton Heights", +"County": "Lane", +"State": "Oregon", +"Country": "United States", +"Lat": "44.00260162", +"Long": "-123.11299896", +"Precise": "1", +"Callsign": "W7NK", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "1,270 feet ASL.", +"Last Update": "2022-04-05" +}, { +"State ID": "41", +"Rptr ID": "327", +"Frequency": "441.12500", +"Input Freq": "446.12500", +"PL": "141.3", +"TSQ": "141.3", +"Nearest City": "Coburg", +"Landmark": "Coburg Ridge", +"County": "Lane", +"State": "Oregon", +"Country": "United States", +"Lat": "44.11510086", +"Long": "-123.00099945", +"Precise": "1", +"Callsign": "K7QT", +"Use": "OPEN", +"Operational Status": "Off-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "119178", +"IRLP Node": "", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-04-08" +}, { +"State ID": "41", +"Rptr ID": "329", +"Frequency": "441.67500", +"Input Freq": "446.67500", +"PL": "D023", +"TSQ": "D023", +"Nearest City": "Oakridge", +"Landmark": "Wolf Mountain", +"County": "Lane", +"State": "Oregon", +"Country": "United States", +"Lat": "43.61619949", +"Long": "-122.23000336", +"Precise": "1", +"Callsign": "W7PRA", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "521741", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2021-11-09" +}, { +"State ID": "41", +"Rptr ID": "331", +"Frequency": "442.12500", +"Input Freq": "447.12500", +"PL": "D125", +"TSQ": "D125", +"Nearest City": "Eugene", +"Landmark": "Coburg Ridge", +"County": "Lane", +"State": "Oregon", +"Country": "United States", +"Lat": "44.13660049", +"Long": "-123.01499939", +"Precise": "1", +"Callsign": "K7THO", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-11-18" +}, { +"State ID": "41", +"Rptr ID": "333", +"Frequency": "442.57500", +"Input Freq": "447.57500", +"PL": "D125", +"TSQ": "D125", +"Nearest City": "Florence", +"Landmark": "Herman Peak", +"County": "Lane", +"State": "Oregon", +"Country": "United States", +"Lat": "44.12419891", +"Long": "-124.01300049", +"Precise": "1", +"Callsign": "W7FLO", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "Yes", +"RACES": "Yes", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "Yes", +"YSF DG ID Uplink": "00", +"YSF DG IS Downlink": "00", +"YSF DSC": "Open", +"Notes": "Not connected to Wires-X.", +"Last Update": "2020-04-23" +}, { +"State ID": "41", +"Rptr ID": "335", +"Frequency": "443.50000", +"Input Freq": "448.50000", +"PL": "103.5", +"TSQ": "103.5", +"Nearest City": "Horton", +"Landmark": "Prairie Mountain", +"County": "Lane", +"State": "Oregon", +"Country": "United States", +"Lat": "44.27999878", +"Long": "-123.58300018", +"Precise": "1", +"Callsign": "W7NK", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "", +"IRLP Node": "", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "3,360 feet ASL.", +"Last Update": "2020-10-09" +}, { +"State ID": "41", +"Rptr ID": "336", +"Frequency": "443.80000", +"Input Freq": "448.82500", +"PL": "100.0", +"TSQ": "", +"Nearest City": "Eugene", +"Landmark": "Blanton Heights", +"County": "Lane", +"State": "Oregon", +"Country": "United States", +"Lat": "44.00149918", +"Long": "-123.11399841", +"Precise": "1", +"Callsign": "K7RPT", +"Use": "OPEN", +"Operational Status": "Off-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "", +"IRLP Node": "", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-04-08" +}, { +"State ID": "41", +"Rptr ID": "352", +"Frequency": "145.13000", +"Input Freq": "144.53000", +"PL": "D023", +"TSQ": "D023", +"Nearest City": "Junction City", +"Landmark": "Prairie Peak", +"County": "Lane", +"State": "Oregon", +"Country": "United States", +"Lat": "44.29100037", +"Long": "-123.54100037", +"Precise": "1", +"Callsign": "AB7BS", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "Yes", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "521741", +"IRLP Node": "", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "3,510 feet ASL.", +"Last Update": "2020-10-09" +}, { +"State ID": "41", +"Rptr ID": "438", +"Frequency": "145.17000", +"Input Freq": "144.57000", +"PL": "123.0", +"TSQ": "123.0", +"Nearest City": "Eugene", +"Landmark": "Buck Mountain", +"County": "Lane", +"State": "Oregon", +"Country": "United States", +"Lat": "44.19789886", +"Long": "-122.98600006", +"Precise": "1", +"Callsign": "W7NK", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "0", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "3,130 feet elevation", +"Last Update": "2021-04-13" +}, { +"State ID": "41", +"Rptr ID": "471", +"Frequency": "441.32500", +"Input Freq": "446.32500", +"PL": "D023", +"TSQ": "D023", +"Nearest City": "Eugene", +"Landmark": "Coburg Ridge", +"County": "Lane", +"State": "Oregon", +"Country": "United States", +"Lat": "44.11569977", +"Long": "-123.00000000", +"Precise": "1", +"Callsign": "K7UND", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-03-22" +}, { +"State ID": "41", +"Rptr ID": "485", +"Frequency": "145.23000", +"Input Freq": "144.63000", +"PL": "110.9", +"TSQ": "110.9", +"Nearest City": "Cottage Grove", +"Landmark": "Fairview Peak", +"County": "Lane", +"State": "Oregon", +"Country": "United States", +"Lat": "43.58570099", +"Long": "-122.65299988", +"Precise": "1", +"Callsign": "W7SLA", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2021-09-06" +}, { +"State ID": "41", +"Rptr ID": "486", +"Frequency": "145.31000", +"Input Freq": "144.71000", +"PL": "100.0", +"TSQ": "100.0", +"Nearest City": "Walton", +"Landmark": "Walker Point", +"County": "Lane", +"State": "Oregon", +"Country": "United States", +"Lat": "44.06610107", +"Long": "-123.62799835", +"Precise": "1", +"Callsign": "W7SLA", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "2,325 feet.", +"Last Update": "2021-10-16" +}, { +"State ID": "41", +"Rptr ID": "528", +"Frequency": "442.80000", +"Input Freq": "447.80000", +"PL": "77.0", +"TSQ": "77.0", +"Nearest City": "Eugene", +"Landmark": "Blanton Heights", +"County": "Lane", +"State": "Oregon", +"Country": "United States", +"Lat": "44.00260162", +"Long": "-123.11299896", +"Precise": "1", +"Callsign": "W7DTV", +"Use": "OPEN", +"Operational Status": "Off-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "0", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "1,270 feet elevation", +"Last Update": "2022-04-08" +}, { +"State ID": "41", +"Rptr ID": "669", +"Frequency": "442.90000", +"Input Freq": "447.90000", +"PL": "110.9", +"TSQ": "110.9", +"Nearest City": "Eugene", +"Landmark": "Blanton Heights", +"County": "Lane", +"State": "Oregon", +"Country": "United States", +"Lat": "44.00260162", +"Long": "-123.11299896", +"Precise": "1", +"Callsign": "W7NK", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "", +"IRLP Node": "", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "Standalone repeater. 1,270'.", +"Last Update": "2022-04-08" +}, { +"State ID": "41", +"Rptr ID": "681", +"Frequency": "145.45000", +"Input Freq": "144.85000", +"PL": "123.0", +"TSQ": "123.0", +"Nearest City": "Eugene", +"Landmark": "Blanton Heights", +"County": "Lane", +"State": "Oregon", +"Country": "United States", +"Lat": "44.00260162", +"Long": "-123.11299896", +"Precise": "1", +"Callsign": "W7ARD", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-11-18" +}, { +"State ID": "41", +"Rptr ID": "3088", +"Frequency": "147.34000", +"Input Freq": "147.94000", +"PL": "D023", +"TSQ": "D023", +"Nearest City": "Blue River", +"Landmark": "Mount Hagan", +"County": "Lane", +"State": "Oregon", +"Country": "United States", +"Lat": "44.13890076", +"Long": "-122.41100311", +"Precise": "1", +"Callsign": "W7PRA", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-04-08" +}, { +"State ID": "41", +"Rptr ID": "3713", +"Frequency": "443.05000", +"Input Freq": "448.05000", +"PL": "100.0", +"TSQ": "", +"Nearest City": "Walton", +"Landmark": "Walker Point", +"County": "Lane", +"State": "Oregon", +"Country": "United States", +"Lat": "44.06650162", +"Long": "-123.62899780", +"Precise": "1", +"Callsign": "W7ZQD", +"Use": "OPEN", +"Operational Status": "Off-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "PL could be 162.2.", +"Last Update": "2022-12-06" +}, { +"State ID": "41", +"Rptr ID": "6369", +"Frequency": "224.70000", +"Input Freq": "223.10000", +"PL": "100.0", +"TSQ": "100.0", +"Nearest City": "Coburg", +"Landmark": "Buck Mountain", +"County": "Lane", +"State": "Oregon", +"Country": "United States", +"Lat": "44.19765000", +"Long": "-122.98650000", +"Precise": "1", +"Callsign": "W7EXH", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "3,150 feet.", +"Last Update": "2020-12-19" +}, { +"State ID": "41", +"Rptr ID": "6780", +"Frequency": "443.10000", +"Input Freq": "448.10000", +"PL": "100.0", +"TSQ": "100.0", +"Nearest City": "Blue River", +"Landmark": "Mount Hagan", +"County": "Lane", +"State": "Oregon", +"Country": "United States", +"Lat": "44.13890076", +"Long": "-122.41100311", +"Precise": "1", +"Callsign": "K7SLA", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "0", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2021-02-19" +}, { +"State ID": "41", +"Rptr ID": "8243", +"Frequency": "444.35000", +"Input Freq": "449.35000", +"PL": "173.8", +"TSQ": "", +"Nearest City": "Alsea", +"Landmark": "Prairie Mountain", +"County": "Lane", +"State": "Oregon", +"Country": "United States", +"Lat": "44.27999878", +"Long": "-123.58100128", +"Precise": "1", +"Callsign": "W6PRN", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "", +"IRLP Node": "", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2019-07-28" +}, { +"State ID": "41", +"Rptr ID": "11144", +"Frequency": "443.27500", +"Input Freq": "448.27500", +"PL": "100.0", +"TSQ": "", +"Nearest City": "Eugene", +"Landmark": "", +"County": "Lane", +"State": "Oregon", +"Country": "United States", +"Lat": "44.05210114", +"Long": "-123.08699799", +"Precise": "0", +"Callsign": "W7EXH", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "", +"IRLP Node": "", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2021-09-29" +}, { +"State ID": "41", +"Rptr ID": "15421", +"Frequency": "145.39000", +"Input Freq": "144.79000", +"PL": "D025", +"TSQ": "D025", +"Nearest City": "Cottage Grove", +"Landmark": "Bear Mtn", +"County": "Lane", +"State": "Oregon", +"Country": "United States", +"Lat": "43.84299850", +"Long": "-122.89199829", +"Precise": "0", +"Callsign": "AB7BS", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "521741", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "3,699'.", +"Last Update": "2020-10-09" +}, { +"State ID": "41", +"Rptr ID": "15427", +"Frequency": "444.80000", +"Input Freq": "449.80000", +"PL": "D125", +"TSQ": "", +"Nearest City": "Blue River", +"Landmark": "Mt Hagan", +"County": "Lane", +"State": "Oregon", +"Country": "United States", +"Lat": "44.16159821", +"Long": "-122.33599854", +"Precise": "0", +"Callsign": "AB7BS", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "", +"IRLP Node": "", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2020-10-09" +}, { +"State ID": "41", +"Rptr ID": "15428", +"Frequency": "444.92500", +"Input Freq": "449.92500", +"PL": "D125", +"TSQ": "", +"Nearest City": "Walton", +"Landmark": "Walker Point", +"County": "Lane", +"State": "Oregon", +"Country": "United States", +"Lat": "44.10290146", +"Long": "-123.59600067", +"Precise": "0", +"Callsign": "K7LNK", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-11-18" +}, { +"State ID": "41", +"Rptr ID": "15803", +"Frequency": "147.14000", +"Input Freq": "147.74000", +"PL": "136.5", +"TSQ": "91.5", +"Nearest City": "Mapleton", +"Landmark": "Roman Nose Mountain", +"County": "Lane", +"State": "Oregon", +"Country": "United States", +"Lat": "43.91189957", +"Long": "-123.73899841", +"Precise": "1", +"Callsign": "AB7BS", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2020-05-12" +}, { +"State ID": "41", +"Rptr ID": "15811", +"Frequency": "443.57500", +"Input Freq": "448.57500", +"PL": "D125", +"TSQ": "D125", +"Nearest City": "Junction City", +"Landmark": "Prairie Mountain", +"County": "Lane", +"State": "Oregon", +"Country": "United States", +"Lat": "44.27999878", +"Long": "-123.58300018", +"Precise": "1", +"Callsign": "AB7BS", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-11-18" +}, { +"State ID": "41", +"Rptr ID": "16997", +"Frequency": "441.10000", +"Input Freq": "446.10000", +"PL": "D125", +"TSQ": "D125", +"Nearest City": "Florence", +"Landmark": "Glenada Hill", +"County": "Lane", +"State": "Oregon", +"Country": "United States", +"Lat": "43.95579910", +"Long": "-124.07499695", +"Precise": "0", +"Callsign": "W7FLO", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "30225", +"FM Analog": "No", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "Yes", +"YSF DG ID Uplink": "70", +"YSF DG IS Downlink": "00", +"YSF DSC": "", +"Notes": "", +"Last Update": "2020-04-23" +}, { +"State ID": "41", +"Rptr ID": "17131", +"Frequency": "440.10000", +"Input Freq": "445.10000", +"PL": "110.9", +"TSQ": "", +"Nearest City": "Creswell", +"Landmark": "", +"County": "Lane", +"State": "Oregon", +"Country": "United States", +"Lat": "43.91790009", +"Long": "-123.02500153", +"Precise": "0", +"Callsign": "N7NPA", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "", +"IRLP Node": "", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2020-03-23" +}, { +"State ID": "41", +"Rptr ID": "17134", +"Frequency": "444.55000", +"Input Freq": "449.55000", +"PL": "100.0", +"TSQ": "91.5", +"Nearest City": "Cottage Grove", +"Landmark": "Bear Mtn", +"County": "Lane", +"State": "Oregon", +"Country": "United States", +"Lat": "43.98139954", +"Long": "-123.00800323", +"Precise": "0", +"Callsign": "K7LNK", +"Use": "OPEN", +"Operational Status": "Unknown", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "", +"IRLP Node": "", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2020-10-09" +}, { +"State ID": "41", +"Rptr ID": "17136", +"Frequency": "440.80000", +"Input Freq": "445.80000", +"PL": "103.5", +"TSQ": "100.0", +"Nearest City": "Blue River", +"Landmark": "Mt Hagan", +"County": "Lane", +"State": "Oregon", +"Country": "United States", +"Lat": "44.14229965", +"Long": "-122.41200256", +"Precise": "0", +"Callsign": "", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "", +"IRLP Node": "", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2020-10-09" +}, { +"State ID": "41", +"Rptr ID": "18574", +"Frequency": "442.42500", +"Input Freq": "447.42500", +"PL": "67.0", +"TSQ": "", +"Nearest City": "Eugene", +"Landmark": "", +"County": "Lane", +"State": "Oregon", +"Country": "United States", +"Lat": "44.00260162", +"Long": "-123.11329651", +"Precise": "0", +"Callsign": "W7OEC", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "Yes", +"DMR Color Code": "1", +"DMR ID": "311427", +"D-Star": "Yes", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "Yes", +"YSF DG ID Uplink": "00", +"YSF DG IS Downlink": "00", +"YSF DSC": "", +"Notes": "Please be sure to disconnect from reflectors and talkgroups when you are done using them. Monitoring reflectors and talkgroups occupy the repeater, and lock it into one mode, preventing other modes from being activated by other users. Please be courteous.", +"Last Update": "2022-07-05" +}, { +"State ID": "41", +"Rptr ID": "19302", +"Frequency": "442.70000", +"Input Freq": "447.70000", +"PL": "123.0", +"TSQ": "", +"Nearest City": "Eugene", +"Landmark": "", +"County": "Lane", +"State": "Oregon", +"Country": "United States", +"Lat": "43.98772300", +"Long": "-123.06566400", +"Precise": "0", +"Callsign": "K7REA", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "0", +"IRLP Node": "0", +"Wires Node": "80142", +"FM Analog": "No", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "Yes", +"YSF DG ID Uplink": "00", +"YSF DG IS Downlink": "00", +"YSF DSC": "", +"Notes": "Use DG-ID TX01 for Wires-X access. This repeater is digital only, no FM analog voice. See web page on info linking to other repeaters (http://www.k7rea.com/).", +"Last Update": "2021-04-21" +}, { +"State ID": "41", +"Rptr ID": "19451", +"Frequency": "444.45000", +"Input Freq": "449.45000", +"PL": "100.0", +"TSQ": "100.0", +"Nearest City": "Eugene", +"Landmark": "", +"County": "Lane", +"State": "Oregon", +"Country": "United States", +"Lat": "44.10770000", +"Long": "-123.14920000", +"Precise": "0", +"Callsign": "KC7RJK", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "0", +"IRLP Node": "3543", +"Wires Node": "", +"FM Analog": "No", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "*Pause, pause first to see if others are using the machine or links. Then ID and make your call or link. *Use DTMF command *70 to see if the repeater is already linked to a node or reflector.
*DO identify before sending DTMF command tones.
", +"Last Update": "2021-09-06" +}, { +"State ID": "41", +"Rptr ID": "19472", +"Frequency": "444.42500", +"Input Freq": "449.42500", +"PL": "", +"TSQ": "", +"Nearest City": "Eugene", +"Landmark": "Santa Clara", +"County": "Lane", +"State": "Oregon", +"Country": "United States", +"Lat": "44.10770000", +"Long": "-123.14920000", +"Precise": "0", +"Callsign": "KC7RJK", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "0", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "No", +"DMR": "Yes", +"DMR Color Code": "1", +"DMR ID": "314117", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2021-09-06" +}, { +"State ID": "41", +"Rptr ID": "19650", +"Frequency": "145.55000", +"Input Freq": "145.55000", +"PL": "", +"TSQ": "", +"Nearest City": "Eugene", +"Landmark": "", +"County": "Lane", +"State": "Oregon", +"Country": "United States", +"Lat": "44.03173840", +"Long": "-123.10594360", +"Precise": "1", +"Callsign": "K7EZR", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "0", +"IRLP Node": "0", +"Wires Node": "55490", +"FM Analog": "No", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-12-16" +}, { +"State ID": "41", +"Rptr ID": "20395", +"Frequency": "145.15000", +"Input Freq": "144.55000", +"PL": "146.2", +"TSQ": "146.2", +"Nearest City": "Cottage Grove", +"Landmark": "Bear Mountain", +"County": "Lane", +"State": "Oregon", +"Country": "United States", +"Lat": "43.84279500", +"Long": "-122.89175900", +"Precise": "0", +"Callsign": "W7OC", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "0", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2021-10-19" +}, { +"State ID": "41", +"Rptr ID": "21259", +"Frequency": "441.22500", +"Input Freq": "446.22500", +"PL": "127.3", +"TSQ": "127.3", +"Nearest City": "Blue River", +"Landmark": "North Deathball Mt.", +"County": "Lane", +"State": "Oregon", +"Country": "United States", +"Lat": "44.13487500", +"Long": "-122.27627600", +"Precise": "0", +"Callsign": "AI7NC", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "0", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-12-17" +}, { +"State ID": "41", +"Rptr ID": "342", +"Frequency": "145.37000", +"Input Freq": "144.77000", +"PL": "167.9", +"TSQ": "", +"Nearest City": "Newport", +"Landmark": "Cape Foulweather", +"County": "Lincoln", +"State": "Oregon", +"Country": "United States", +"Lat": "44.77230072", +"Long": "-124.07599640", +"Precise": "1", +"Callsign": "W7VTW", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "Yes", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "", +"IRLP Node": "", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "Telemetry Status: ", +"Last Update": "2021-08-03" +}, { +"State ID": "41", +"Rptr ID": "344", +"Frequency": "147.00000", +"Input Freq": "147.60000", +"PL": "136.5", +"TSQ": "", +"Nearest City": "Waldport", +"Landmark": "Table Mountain", +"County": "Lincoln", +"State": "Oregon", +"Country": "United States", +"Lat": "44.46920013", +"Long": "-123.84200287", +"Precise": "1", +"Callsign": "W7VTW", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "", +"IRLP Node": "", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "2,800'.", +"Last Update": "2020-08-05" +}, { +"State ID": "41", +"Rptr ID": "345", +"Frequency": "147.04000", +"Input Freq": "147.64000", +"PL": "100.0", +"TSQ": "", +"Nearest City": "Lincoln City", +"Landmark": "", +"County": "Lincoln", +"State": "Oregon", +"Country": "United States", +"Lat": "44.95830154", +"Long": "-124.01699829", +"Precise": "0", +"Callsign": "W7VTW", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "85 feet. ", +"Last Update": "2022-04-05" +}, { +"State ID": "41", +"Rptr ID": "347", +"Frequency": "147.30000", +"Input Freq": "147.90000", +"PL": "156.7", +"TSQ": "156.7", +"Nearest City": "Newport", +"Landmark": "Otter Crest", +"County": "Lincoln", +"State": "Oregon", +"Country": "United States", +"Lat": "44.76119995", +"Long": "-124.06500244", +"Precise": "0", +"Callsign": "W7VTW", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "Yes", +"YSF DG ID Uplink": "00", +"YSF DG IS Downlink": "00", +"YSF DSC": "Open", +"Notes": "", +"Last Update": "2022-04-05" +}, { +"State ID": "41", +"Rptr ID": "350", +"Frequency": "444.47500", +"Input Freq": "449.47500", +"PL": "103.5", +"TSQ": "", +"Nearest City": "Waldport", +"Landmark": "Table Mountain", +"County": "Lincoln", +"State": "Oregon", +"Country": "United States", +"Lat": "44.46920013", +"Long": "-123.84200287", +"Precise": "1", +"Callsign": "W7VTW", +"Use": "OPEN", +"Operational Status": "Off-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "", +"IRLP Node": "", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2020-09-25" +}, { +"State ID": "41", +"Rptr ID": "351", +"Frequency": "444.75000", +"Input Freq": "449.75000", +"PL": "118.8", +"TSQ": "", +"Nearest City": "Newport", +"Landmark": "Otter Crest", +"County": "Lincoln", +"State": "Oregon", +"Country": "United States", +"Lat": "44.76119995", +"Long": "-124.06500244", +"Precise": "1", +"Callsign": "W7GC", +"Use": "OPEN", +"Operational Status": "Off-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "", +"IRLP Node": "", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "Telemetry Status: ", +"Last Update": "2020-09-25" +}, { +"State ID": "41", +"Rptr ID": "13018", +"Frequency": "145.39000", +"Input Freq": "144.79000", +"PL": "D023", +"TSQ": "D023", +"Nearest City": "Newport", +"Landmark": "Otter Crest", +"County": "Lincoln", +"State": "Oregon", +"Country": "United States", +"Lat": "44.63679886", +"Long": "-124.05300140", +"Precise": "0", +"Callsign": "W7PRA", +"Use": "OPEN", +"Operational Status": "Off-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "521741", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-09-24" +}, { +"State ID": "41", +"Rptr ID": "21340", +"Frequency": "147.06000", +"Input Freq": "147.66000", +"PL": "156.7", +"TSQ": "CSQ", +"Nearest City": "Yachats", +"Landmark": "Cape Perpetua", +"County": "Lincoln", +"State": "Oregon", +"Country": "United States", +"Lat": "44.29359700", +"Long": "-124.08066700", +"Precise": "0", +"Callsign": "N7HQR", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "0", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-12-18" +}, { +"State ID": "41", +"Rptr ID": "353", +"Frequency": "146.61000", +"Input Freq": "146.01000", +"PL": "167.9", +"TSQ": "", +"Nearest City": "Scio", +"Landmark": "Rodgers Mountain", +"County": "Linn", +"State": "Oregon", +"Country": "United States", +"Lat": "44.68330002", +"Long": "-122.77899933", +"Precise": "1", +"Callsign": "KA7ENW", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-04-05" +}, { +"State ID": "41", +"Rptr ID": "355", +"Frequency": "147.20000", +"Input Freq": "147.80000", +"PL": "167.9", +"TSQ": "167.9", +"Nearest City": "Sweet Home", +"Landmark": "Marks Ridge", +"County": "Linn", +"State": "Oregon", +"Country": "United States", +"Lat": "44.44139862", +"Long": "-122.73799896", +"Precise": "1", +"Callsign": "K7ENW", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "Yes", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "", +"IRLP Node": "", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2019-01-08" +}, { +"State ID": "41", +"Rptr ID": "357", +"Frequency": "444.97500", +"Input Freq": "449.97500", +"PL": "100.0", +"TSQ": "", +"Nearest City": "Albany", +"Landmark": "", +"County": "Linn", +"State": "Oregon", +"Country": "United States", +"Lat": "44.61529922", +"Long": "-123.15799713", +"Precise": "1", +"Callsign": "KD6VLR", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "75954", +"IRLP Node": "", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "220 feet ASL.", +"Last Update": "2020-10-09" +}, { +"State ID": "41", +"Rptr ID": "541", +"Frequency": "442.85000", +"Input Freq": "447.85000", +"PL": "167.9", +"TSQ": "", +"Nearest City": "Scio", +"Landmark": "Rodgers Mountain", +"County": "Linn", +"State": "Oregon", +"Country": "United States", +"Lat": "44.68330002", +"Long": "-122.77899933", +"Precise": "1", +"Callsign": "KA7ENW", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "1,124 feet ASL.", +"Last Update": "2022-04-05" +}, { +"State ID": "41", +"Rptr ID": "5910", +"Frequency": "147.06000", +"Input Freq": "147.66000", +"PL": "100.0", +"TSQ": "", +"Nearest City": "Lyons", +"Landmark": "McCully Mountain", +"County": "Linn", +"State": "Oregon", +"Country": "United States", +"Lat": "44.75730133", +"Long": "-122.62400055", +"Precise": "0", +"Callsign": "W1ARK", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "Repeater elevation is 1,130 feet ASL.", +"Last Update": "2021-09-12" +}, { +"State ID": "41", +"Rptr ID": "6368", +"Frequency": "440.60000", +"Input Freq": "445.60000", +"PL": "103.5", +"TSQ": "103.5", +"Nearest City": "Lyons", +"Landmark": "McCulley Mountain", +"County": "Linn", +"State": "Oregon", +"Country": "United States", +"Lat": "44.75730133", +"Long": "-122.62400055", +"Precise": "1", +"Callsign": "KG7MKW", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2021-09-12" +}, { +"State ID": "41", +"Rptr ID": "10032", +"Frequency": "444.82500", +"Input Freq": "449.82500", +"PL": "D023", +"TSQ": "D023", +"Nearest City": "Harrisburg", +"Landmark": "Buck Mountain", +"County": "Linn", +"State": "Oregon", +"Country": "United States", +"Lat": "44.27399826", +"Long": "-123.17099762", +"Precise": "0", +"Callsign": "W7PRA", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "521741", +"IRLP Node": "", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2020-10-09" +}, { +"State ID": "41", +"Rptr ID": "13261", +"Frequency": "147.26000", +"Input Freq": "147.86000", +"PL": "D026", +"TSQ": "D026", +"Nearest City": "Brownsville", +"Landmark": "Scott Mountain", +"County": "Linn", +"State": "Oregon", +"Country": "United States", +"Lat": "44.39870071", +"Long": "-122.86399841", +"Precise": "0", +"Callsign": "W7NK", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "", +"IRLP Node": "", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "2,130'.", +"Last Update": "2021-02-24" +}, { +"State ID": "41", +"Rptr ID": "15216", +"Frequency": "52.91000", +"Input Freq": "51.21000", +"PL": "100.0", +"TSQ": "100.0", +"Nearest City": "Sweet Home", +"Landmark": "Marks Ridge", +"County": "Linn", +"State": "Oregon", +"Country": "United States", +"Lat": "44.39759827", +"Long": "-122.73600006", +"Precise": "0", +"Callsign": "KG7BZ", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "Yes", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "", +"IRLP Node": "", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2021-01-15" +}, { +"State ID": "41", +"Rptr ID": "15217", +"Frequency": "443.12500", +"Input Freq": "448.12500", +"PL": "77.0", +"TSQ": "77.0", +"Nearest City": "Sweet Home", +"Landmark": "Marks Ridge", +"County": "Linn", +"State": "Oregon", +"Country": "United States", +"Lat": "44.39759827", +"Long": "-122.73600006", +"Precise": "0", +"Callsign": "KG7BZ", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "", +"IRLP Node": "", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2021-01-15" +}, { +"State ID": "41", +"Rptr ID": "15218", +"Frequency": "442.60000", +"Input Freq": "447.60000", +"PL": "D023", +"TSQ": "D023", +"Nearest City": "Brownsville", +"Landmark": "Washburn Heights", +"County": "Linn", +"State": "Oregon", +"Country": "United States", +"Lat": "44.39350128", +"Long": "-122.98500061", +"Precise": "0", +"Callsign": "KB7KUB", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "Yes", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "Yes", +"YSF DG ID Uplink": "23", +"YSF DG IS Downlink": "23", +"YSF DSC": "023", +"Notes": "", +"Last Update": "2022-12-06" +}, { +"State ID": "41", +"Rptr ID": "15451", +"Frequency": "224.00000", +"Input Freq": "222.40000", +"PL": "100.0", +"TSQ": "100.0", +"Nearest City": "Brownsville", +"Landmark": "Washburn Heights", +"County": "Linn", +"State": "Oregon", +"Country": "United States", +"Lat": "44.43840027", +"Long": "-122.98400116", +"Precise": "1", +"Callsign": "K7VFO", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "1,280 feet.", +"Last Update": "2021-06-09" +}, { +"State ID": "41", +"Rptr ID": "17150", +"Frequency": "147.30000", +"Input Freq": "147.90000", +"PL": "77.0", +"TSQ": "", +"Nearest City": "Brownsville", +"Landmark": "", +"County": "Linn", +"State": "Oregon", +"Country": "United States", +"Lat": "44.39350128", +"Long": "-122.98500061", +"Precise": "0", +"Callsign": "W7WZA", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "As Seen on Tiktok!!! https://www.tiktok.com/@trailertravis", +"Last Update": "2021-01-27" +}, { +"State ID": "41", +"Rptr ID": "18789", +"Frequency": "443.25000", +"Input Freq": "448.25000", +"PL": "", +"TSQ": "", +"Nearest City": "Sweet Home", +"Landmark": "", +"County": "Linn", +"State": "Oregon", +"Country": "United States", +"Lat": "44.39762470", +"Long": "-122.73619580", +"Precise": "0", +"Callsign": "W7NK", +"Use": "OPEN", +"Operational Status": "Unknown", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "0", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2020-05-13" +}, { +"State ID": "41", +"Rptr ID": "10", +"Frequency": "444.15000", +"Input Freq": "449.15000", +"PL": "100.0", +"TSQ": "", +"Nearest City": "Vale", +"Landmark": "Malheur Butte", +"County": "Malhuer", +"State": "Oregon", +"Country": "United States", +"Lat": "44.00579834", +"Long": "-117.05000305", +"Precise": "1", +"Callsign": "K7OJI", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-11-18" +}, { +"State ID": "41", +"Rptr ID": "360", +"Frequency": "147.10000", +"Input Freq": "147.70000", +"PL": "100.0", +"TSQ": "", +"Nearest City": "Ontario", +"Landmark": "Malheur Butte", +"County": "Malhuer", +"State": "Oregon", +"Country": "United States", +"Lat": "44.01110077", +"Long": "-117.08399963", +"Precise": "1", +"Callsign": "K7OJI", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "2,201 feet. ", +"Last Update": "2021-09-19" +}, { +"State ID": "41", +"Rptr ID": "549", +"Frequency": "443.15000", +"Input Freq": "448.15000", +"PL": "100.0", +"TSQ": "", +"Nearest City": "Ontario", +"Landmark": "", +"County": "Malhuer", +"State": "Oregon", +"Country": "United States", +"Lat": "44.02389908", +"Long": "-116.96700287", +"Precise": "1", +"Callsign": "K7RHB", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "224189", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "Incoming EchoLink connections restricted.", +"Last Update": "2022-12-06" +}, { +"State ID": "41", +"Rptr ID": "139", +"Frequency": "441.37500", +"Input Freq": "446.37500", +"PL": "123.0", +"TSQ": "", +"Nearest City": "Salem", +"Landmark": "", +"County": "Marion", +"State": "Oregon", +"Country": "United States", +"Lat": "44.94309998", +"Long": "-123.03399658", +"Precise": "0", +"Callsign": "AB7F", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-11-18" +}, { +"State ID": "41", +"Rptr ID": "365", +"Frequency": "145.29000", +"Input Freq": "144.69000", +"PL": "", +"TSQ": "", +"Nearest City": "Salem", +"Landmark": "", +"County": "Marion", +"State": "Oregon", +"Country": "United States", +"Lat": "44.94879913", +"Long": "-122.93299866", +"Precise": "1", +"Callsign": "WA7ABU", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "Yes", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "592473", +"IRLP Node": "7638", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2020-10-10" +}, { +"State ID": "41", +"Rptr ID": "367", +"Frequency": "145.35000", +"Input Freq": "144.75000", +"PL": "CSQ", +"TSQ": "CSQ", +"Nearest City": "Salem", +"Landmark": "Popcorn Hill", +"County": "Marion", +"State": "Oregon", +"Country": "United States", +"Lat": "44.94309998", +"Long": "-123.03399658", +"Precise": "0", +"Callsign": "K7LWV", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "0", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "No", +"DMR": "Yes", +"DMR Color Code": "1", +"DMR ID": "312893", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-02-07" +}, { +"State ID": "41", +"Rptr ID": "372", +"Frequency": "441.27500", +"Input Freq": "446.27500", +"PL": "", +"TSQ": "", +"Nearest City": "Salem", +"Landmark": "Prospect Hill", +"County": "Marion", +"State": "Oregon", +"Country": "United States", +"Lat": "44.85459900", +"Long": "-123.12200165", +"Precise": "1", +"Callsign": "W7SRA", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "0", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "No", +"DMR": "Yes", +"DMR Color Code": "1", +"DMR ID": "311450", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "Yes", +"YSF DG ID Uplink": "00", +"YSF DG IS Downlink": "00", +"YSF DSC": "Open", +"Notes": "", +"Last Update": "2022-11-18" +}, { +"State ID": "41", +"Rptr ID": "375", +"Frequency": "443.72500", +"Input Freq": "448.72500", +"PL": "186.2", +"TSQ": "186.2", +"Nearest City": "Salem", +"Landmark": "Prospect Hill", +"County": "Marion", +"State": "Oregon", +"Country": "United States", +"Lat": "44.85449982", +"Long": "-123.12200165", +"Precise": "1", +"Callsign": "W7SRA", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-11-18" +}, { +"State ID": "41", +"Rptr ID": "376", +"Frequency": "444.25000", +"Input Freq": "449.25000", +"PL": "100.0", +"TSQ": "100.0", +"Nearest City": "Silverton", +"Landmark": "Silver Falls", +"County": "Marion", +"State": "Oregon", +"Country": "United States", +"Lat": "44.95080185", +"Long": "-122.68699646", +"Precise": "1", +"Callsign": "W7SAA", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "", +"IRLP Node": "3292", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-12-06" +}, { +"State ID": "41", +"Rptr ID": "377", +"Frequency": "444.95000", +"Input Freq": "449.95000", +"PL": "100.0", +"TSQ": "", +"Nearest City": "Salem", +"Landmark": "Silver Creek Falls", +"County": "Marion", +"State": "Oregon", +"Country": "United States", +"Lat": "45.00529861", +"Long": "-122.78199768", +"Precise": "0", +"Callsign": "WA7ABU", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "Yes", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "592473", +"IRLP Node": "7638", +"Wires Node": "11977", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "Yes", +"YSF DG ID Uplink": "00", +"YSF DG IS Downlink": "00", +"YSF DSC": "", +"Notes": "MCARES emergency repeater.", +"Last Update": "2022-12-06" +}, { +"State ID": "41", +"Rptr ID": "382", +"Frequency": "146.86000", +"Input Freq": "146.26000", +"PL": "186.2", +"TSQ": "", +"Nearest City": "Salem", +"Landmark": "Prospect Hill", +"County": "Marion", +"State": "Oregon", +"Country": "United States", +"Lat": "44.85459900", +"Long": "-123.12200165", +"Precise": "1", +"Callsign": "W7SRA", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "Yes", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "0", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2021-02-21" +}, { +"State ID": "41", +"Rptr ID": "427", +"Frequency": "145.49000", +"Input Freq": "144.89000", +"PL": "136.5", +"TSQ": "91.5", +"Nearest City": "Salem", +"Landmark": "Prospect Hill", +"County": "Marion", +"State": "Oregon", +"Country": "United States", +"Lat": "44.84730148", +"Long": "-123.11100006", +"Precise": "1", +"Callsign": "AB7BS", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "521741", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2021-07-09" +}, { +"State ID": "41", +"Rptr ID": "447", +"Frequency": "441.70000", +"Input Freq": "446.70000", +"PL": "186.2", +"TSQ": "", +"Nearest City": "Salem", +"Landmark": "Popcorn Hill", +"County": "Marion", +"State": "Oregon", +"Country": "United States", +"Lat": "44.94290161", +"Long": "-123.03500366", +"Precise": "0", +"Callsign": "K7UN", +"Use": "OPEN", +"Operational Status": "Unknown", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-12-06" +}, { +"State ID": "41", +"Rptr ID": "503", +"Frequency": "224.16000", +"Input Freq": "222.56000", +"PL": "100.0", +"TSQ": "", +"Nearest City": "Silverton", +"Landmark": "Silver Falls", +"County": "Marion", +"State": "Oregon", +"Country": "United States", +"Lat": "44.85120010", +"Long": "-122.64600372", +"Precise": "0", +"Callsign": "W7BJH", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-06-13" +}, { +"State ID": "41", +"Rptr ID": "670", +"Frequency": "443.17500", +"Input Freq": "448.17500", +"PL": "88.5", +"TSQ": "88.5", +"Nearest City": "Salem", +"Landmark": "CCC", +"County": "Marion", +"State": "Oregon", +"Country": "United States", +"Lat": "44.94309998", +"Long": "-123.03399658", +"Precise": "0", +"Callsign": "AD7ET", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "", +"IRLP Node": "", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2020-09-21" +}, { +"State ID": "41", +"Rptr ID": "6019", +"Frequency": "145.19000", +"Input Freq": "144.59000", +"PL": "100.0", +"TSQ": "", +"Nearest City": "Gates", +"Landmark": "", +"County": "Marion", +"State": "Oregon", +"Country": "United States", +"Lat": "45.00299835", +"Long": "-122.78199768", +"Precise": "1", +"Callsign": "WA7ABU", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "Yes", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-11-18" +}, { +"State ID": "41", +"Rptr ID": "8240", +"Frequency": "441.17500", +"Input Freq": "446.17500", +"PL": "77.0", +"TSQ": "77.0", +"Nearest City": "Salem", +"Landmark": "Prospect Hill", +"County": "Marion", +"State": "Oregon", +"Country": "United States", +"Lat": "44.84700012", +"Long": "-123.11100006", +"Precise": "1", +"Callsign": "W7DTV", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-04-05" +}, { +"State ID": "41", +"Rptr ID": "11139", +"Frequency": "440.27500", +"Input Freq": "445.27500", +"PL": "107.2", +"TSQ": "107.2", +"Nearest City": "Salem", +"Landmark": "", +"County": "Marion", +"State": "Oregon", +"Country": "United States", +"Lat": "44.94290161", +"Long": "-123.03500366", +"Precise": "0", +"Callsign": "AC7RF", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "", +"IRLP Node": "", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-12-06" +}, { +"State ID": "41", +"Rptr ID": "11753", +"Frequency": "147.34000", +"Input Freq": "147.94000", +"PL": "77.0", +"TSQ": "", +"Nearest City": "Silverton", +"Landmark": "Silver Falls", +"County": "Marion", +"State": "Oregon", +"Country": "United States", +"Lat": "44.89989853", +"Long": "-122.64399719", +"Precise": "0", +"Callsign": "W7SAA", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "0", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-08-01" +}, { +"State ID": "41", +"Rptr ID": "13350", +"Frequency": "440.72500", +"Input Freq": "445.72500", +"PL": "", +"TSQ": "", +"Nearest City": "Salem", +"Landmark": "", +"County": "Marion", +"State": "Oregon", +"Country": "United States", +"Lat": "44.93460083", +"Long": "-122.97299957", +"Precise": "1", +"Callsign": "KB7PPM", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "", +"IRLP Node": "", +"Wires Node": "40143", +"FM Analog": "No", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "Yes", +"YSF DG ID Uplink": "00", +"YSF DG IS Downlink": "00", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-03-05" +}, { +"State ID": "41", +"Rptr ID": "18780", +"Frequency": "440.05000", +"Input Freq": "445.05000", +"PL": "100.0", +"TSQ": "", +"Nearest City": "Salem", +"Landmark": "", +"County": "Marion", +"State": "Oregon", +"Country": "United States", +"Lat": "44.94289750", +"Long": "-123.03509630", +"Precise": "0", +"Callsign": "K7RTL", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "0", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2020-09-21" +}, { +"State ID": "41", +"Rptr ID": "18783", +"Frequency": "440.86250", +"Input Freq": "445.86250", +"PL": "", +"TSQ": "", +"Nearest City": "Salem", +"Landmark": "", +"County": "Marion", +"State": "Oregon", +"Country": "United States", +"Lat": "44.94289750", +"Long": "-123.03509630", +"Precise": "0", +"Callsign": "KB7PPM", +"Use": "OPEN", +"Operational Status": "Off-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "0", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "No", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "Yes", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "Yes", +"YSF DG ID Uplink": "00", +"YSF DG IS Downlink": "00", +"YSF DSC": "", +"Notes": "Per Trustee: XLX 289 - This repeater will be ON-AIR for approximately one(1) month (from 06 September 2021 to 06 October 2021). It will be bridged to YSF 32398.", +"Last Update": "2021-09-06" +}, { +"State ID": "41", +"Rptr ID": "19700", +"Frequency": "442.97500", +"Input Freq": "447.97500", +"PL": "", +"TSQ": "", +"Nearest City": "Mill City", +"Landmark": "House Mountain", +"County": "Marion", +"State": "Oregon", +"Country": "United States", +"Lat": "44.75583330", +"Long": "-122.46944440", +"Precise": "0", +"Callsign": "KB7APU", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "0", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "No", +"DMR": "Yes", +"DMR Color Code": "1", +"DMR ID": "310151", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2021-01-31" +}, { +"State ID": "41", +"Rptr ID": "378", +"Frequency": "146.62000", +"Input Freq": "146.02000", +"PL": "88.5", +"TSQ": "", +"Nearest City": "Heppner", +"Landmark": "Black Mtn", +"County": "Morrow", +"State": "Oregon", +"Country": "United States", +"Lat": "45.21319962", +"Long": "-119.29499817", +"Precise": "1", +"Callsign": "W7URG", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "0", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "Limit talk time in winter months due to solar power.", +"Last Update": "2021-02-19" +}, { +"State ID": "41", +"Rptr ID": "379", +"Frequency": "146.78000", +"Input Freq": "146.18000", +"PL": "67.0", +"TSQ": "", +"Nearest City": "Heppner", +"Landmark": "Black Mountain", +"County": "Morrow", +"State": "Oregon", +"Country": "United States", +"Lat": "45.21319962", +"Long": "-119.29499817", +"Precise": "1", +"Callsign": "KC7SOY", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "Yes", +"RACES": "Yes", +"SKYWARN": "Yes", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-11-18" +}, { +"State ID": "41", +"Rptr ID": "12904", +"Frequency": "147.16000", +"Input Freq": "147.76000", +"PL": "", +"TSQ": "", +"Nearest City": "Boardman", +"Landmark": "Coalfire plant", +"County": "Morrow", +"State": "Oregon", +"Country": "United States", +"Lat": "45.83990097", +"Long": "-119.70099640", +"Precise": "0", +"Callsign": "AI7HO", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "", +"IRLP Node": "", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2020-04-22" +}, { +"State ID": "41", +"Rptr ID": "14694", +"Frequency": "145.23000", +"Input Freq": "144.63000", +"PL": "67.0", +"TSQ": "CSQ", +"Nearest City": "Heppner", +"Landmark": "Black Mountain", +"County": "Morrow", +"State": "Oregon", +"Country": "United States", +"Lat": "45.21319962", +"Long": "-119.29499810", +"Precise": "1", +"Callsign": "KC7SOY", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "Yes", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "Primarily used for packet traffic.", +"Last Update": "2022-03-20" +}, { +"State ID": "41", +"Rptr ID": "18138", +"Frequency": "444.85000", +"Input Freq": "449.85000", +"PL": "118.8", +"TSQ": "118.8", +"Nearest City": "Heppner", +"Landmark": "", +"County": "Morrow", +"State": "Oregon", +"Country": "United States", +"Lat": "45.35319901", +"Long": "-119.55799866", +"Precise": "1", +"Callsign": "WB7ILL", +"Use": "OPEN", +"Operational Status": "Off-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "40289", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "Yes", +"YSF DG ID Uplink": "00", +"YSF DG IS Downlink": "00", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-12-06" +}, { +"State ID": "41", +"Rptr ID": "20362", +"Frequency": "145.37000", +"Input Freq": "144.77000", +"PL": "D073", +"TSQ": "D073", +"Nearest City": "Heppner", +"Landmark": "", +"County": "Morrow", +"State": "Oregon", +"Country": "United States", +"Lat": "45.21304588", +"Long": "-119.29673700", +"Precise": "1", +"Callsign": "W7NEO", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "0", +"IRLP Node": "0", +"Wires Node": "40289", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2021-10-18" +}, { +"State ID": "41", +"Rptr ID": "43", +"Frequency": "443.55000", +"Input Freq": "448.55000", +"PL": "100.0", +"TSQ": "", +"Nearest City": "Portland", +"Landmark": "Garden Home", +"County": "Multnomah", +"State": "Oregon", +"Country": "United States", +"Lat": "45.45989990", +"Long": "-122.73400116", +"Precise": "1", +"Callsign": "K7GDS", +"Use": "OPEN", +"Operational Status": "Off-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "", +"IRLP Node": "", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-01-12" +}, { +"State ID": "41", +"Rptr ID": "52", +"Frequency": "145.23000", +"Input Freq": "144.63000", +"PL": "CSQ", +"TSQ": "123.0", +"Nearest City": "Portland", +"Landmark": "Council Crest", +"County": "Multnomah", +"State": "Oregon", +"Country": "United States", +"Lat": "45.49829865", +"Long": "-122.70800018", +"Precise": "1", +"Callsign": "K7LJ", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "", +"IRLP Node": "", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-11-27" +}, { +"State ID": "41", +"Rptr ID": "57", +"Frequency": "145.39000", +"Input Freq": "144.79000", +"PL": "100.0", +"TSQ": "100.0", +"Nearest City": "Portland", +"Landmark": "Mt Tabor", +"County": "Multnomah", +"State": "Oregon", +"Country": "United States", +"Lat": "45.51219940", +"Long": "-122.59400177", +"Precise": "1", +"Callsign": "K7LJ", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "", +"IRLP Node": "", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-12-24" +}, { +"State ID": "41", +"Rptr ID": "58", +"Frequency": "146.70000", +"Input Freq": "146.10000", +"PL": "100.0", +"TSQ": "100.0", +"Nearest City": "Portland", +"Landmark": "Stonehenge Tower", +"County": "Multnomah", +"State": "Oregon", +"Country": "United States", +"Lat": "45.48920059", +"Long": "-122.69599915", +"Precise": "1", +"Callsign": "KE7AWR", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "574925", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "Yes", +"YSF DG ID Uplink": "00", +"YSF DG IS Downlink": "00", +"YSF DSC": "Open", +"Notes": "1,485', 80 watts.", +"Last Update": "2022-11-18" +}, { +"State ID": "41", +"Rptr ID": "62", +"Frequency": "146.98000", +"Input Freq": "146.38000", +"PL": "D023", +"TSQ": "D023", +"Nearest City": "Portland", +"Landmark": "KGW Tower", +"County": "Multnomah", +"State": "Oregon", +"Country": "United States", +"Lat": "45.52230072", +"Long": "-122.74700165", +"Precise": "1", +"Callsign": "N7EXH", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "47178", +"EchoLink Node": "256957", +"IRLP Node": "", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "Allstar requires admin approval.", +"Last Update": "2022-11-27" +}, { +"State ID": "41", +"Rptr ID": "63", +"Frequency": "147.04000", +"Input Freq": "147.64000", +"PL": "100.0", +"TSQ": "100.0", +"Nearest City": "Portland", +"Landmark": "Sylvan TV Tower", +"County": "Multnomah", +"State": "Oregon", +"Country": "United States", +"Lat": "45.51589966", +"Long": "-122.73400116", +"Precise": "1", +"Callsign": "K7RPT", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "", +"IRLP Node": "7959", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "850', 500 watts ERP.", +"Last Update": "2021-01-16" +}, { +"State ID": "41", +"Rptr ID": "72", +"Frequency": "440.35000", +"Input Freq": "445.35000", +"PL": "127.3", +"TSQ": "127.3", +"Nearest City": "Portland", +"Landmark": "Stonehenge Tower", +"County": "Multnomah", +"State": "Oregon", +"Country": "United States", +"Lat": "45.48920059", +"Long": "-122.69599915", +"Precise": "1", +"Callsign": "KB7OYI", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "Yes", +"RACES": "Yes", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "", +"IRLP Node": "", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-12-23" +}, { +"State ID": "41", +"Rptr ID": "73", +"Frequency": "440.40000", +"Input Freq": "445.40000", +"PL": "123.0", +"TSQ": "123.0", +"Nearest City": "Portland", +"Landmark": "KOIN Tower", +"County": "Multnomah", +"State": "Oregon", +"Country": "United States", +"Lat": "45.51557939", +"Long": "-122.73307750", +"Precise": "1", +"Callsign": "W7RAT", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "0", +"IRLP Node": "3039", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-11-18" +}, { +"State ID": "41", +"Rptr ID": "75", +"Frequency": "440.45000", +"Input Freq": "445.45000", +"PL": "103.5", +"TSQ": "103.5", +"Nearest City": "Portland", +"Landmark": "Skyline", +"County": "Multnomah", +"State": "Oregon", +"Country": "United States", +"Lat": "45.52220154", +"Long": "-122.74700165", +"Precise": "1", +"Callsign": "N7PIR", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "132225", +"IRLP Node": "3420", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-12-23" +}, { +"State ID": "41", +"Rptr ID": "81", +"Frequency": "441.35000", +"Input Freq": "446.35000", +"PL": "100.0", +"TSQ": "100.0", +"Nearest City": "Portland", +"Landmark": "Skyline", +"County": "Multnomah", +"State": "Oregon", +"Country": "United States", +"Lat": "45.52239990", +"Long": "-122.74700165", +"Precise": "1", +"Callsign": "W7EXH", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-11-18" +}, { +"State ID": "41", +"Rptr ID": "82", +"Frequency": "442.02500", +"Input Freq": "447.02500", +"PL": "100.0", +"TSQ": "100.0", +"Nearest City": "Portland", +"Landmark": "West Hills", +"County": "Multnomah", +"State": "Oregon", +"Country": "United States", +"Lat": "45.52379990", +"Long": "-122.75299835", +"Precise": "0", +"Callsign": "N7NLL", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-12-06" +}, { +"State ID": "41", +"Rptr ID": "83", +"Frequency": "442.22500", +"Input Freq": "447.22500", +"PL": "103.5", +"TSQ": "103.5", +"Nearest City": "Portland", +"Landmark": "Sylvan KOIN Tower", +"County": "Multnomah", +"State": "Oregon", +"Country": "United States", +"Lat": "45.51589966", +"Long": "-122.73400116", +"Precise": "1", +"Callsign": "K7RPT", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "758452", +"IRLP Node": "", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "Yes", +"YSF DG ID Uplink": "00", +"YSF DG IS Downlink": "00", +"YSF DSC": "Open", +"Notes": "", +"Last Update": "2022-01-12" +}, { +"State ID": "41", +"Rptr ID": "88", +"Frequency": "443.22500", +"Input Freq": "448.22500", +"PL": "107.2", +"TSQ": "107.2", +"Nearest City": "Portland", +"Landmark": "", +"County": "Multnomah", +"State": "Oregon", +"Country": "United States", +"Lat": "45.52360153", +"Long": "-122.67500305", +"Precise": "0", +"Callsign": "W7PMC", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "", +"IRLP Node": "", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-01-12" +}, { +"State ID": "41", +"Rptr ID": "91", +"Frequency": "443.62500", +"Input Freq": "448.62500", +"PL": "77.0", +"TSQ": "77.0", +"Nearest City": "Portland", +"Landmark": "Skyline", +"County": "Multnomah", +"State": "Oregon", +"Country": "United States", +"Lat": "45.52239990", +"Long": "-122.74700165", +"Precise": "1", +"Callsign": "W7DTV", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "", +"IRLP Node": "", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-01-12" +}, { +"State ID": "41", +"Rptr ID": "96", +"Frequency": "440.47500", +"Input Freq": "445.47500", +"PL": "123.0", +"TSQ": "123.0", +"Nearest City": "Portland", +"Landmark": "OHSU", +"County": "Multnomah", +"State": "Oregon", +"Country": "United States", +"Lat": "45.50079953", +"Long": "-122.68613440", +"Precise": "1", +"Callsign": "K0HSU", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "Yes", +"YSF DG ID Uplink": "42", +"YSF DG IS Downlink": "00", +"YSF DSC": "", +"Notes": "Linked full time to K0HSU repeater at OHSU West Campus in Beaverton/Hillsboro. Both analog FM and YSF Digital.", +"Last Update": "2022-12-23" +}, { +"State ID": "41", +"Rptr ID": "426", +"Frequency": "145.41000", +"Input Freq": "144.81000", +"PL": "100.0", +"TSQ": "100.0", +"Nearest City": "Corbett", +"Landmark": "Lookout Point", +"County": "Multnomah", +"State": "Oregon", +"Country": "United States", +"Lat": "45.48379898", +"Long": "-122.12799835", +"Precise": "1", +"Callsign": "N7LF", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "Yes", +"RACES": "Yes", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-11-27" +}, { +"State ID": "41", +"Rptr ID": "455", +"Frequency": "442.70000", +"Input Freq": "447.70000", +"PL": "100.0", +"TSQ": "", +"Nearest City": "Portland", +"Landmark": "OHSU", +"County": "Multnomah", +"State": "Oregon", +"Country": "United States", +"Lat": "45.49919891", +"Long": "-122.68499756", +"Precise": "1", +"Callsign": "K7LTA", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "", +"IRLP Node": "", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-12-23" +}, { +"State ID": "41", +"Rptr ID": "459", +"Frequency": "442.65000", +"Input Freq": "447.65000", +"PL": "100.0", +"TSQ": "100.0", +"Nearest City": "Portland", +"Landmark": "Council Crest", +"County": "Multnomah", +"State": "Oregon", +"Country": "United States", +"Lat": "45.48889923", +"Long": "-122.70099640", +"Precise": "1", +"Callsign": "K7LJ", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-12-23" +}, { +"State ID": "41", +"Rptr ID": "507", +"Frequency": "440.82500", +"Input Freq": "445.82500", +"PL": "110.9", +"TSQ": "110.9", +"Nearest City": "Portland", +"Landmark": "Emanuel Hospital", +"County": "Multnomah", +"State": "Oregon", +"Country": "United States", +"Lat": "45.52999878", +"Long": "-122.69799805", +"Precise": "1", +"Callsign": "K7LHS", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "", +"IRLP Node": "", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "40 watts.", +"Last Update": "2022-01-12" +}, { +"State ID": "41", +"Rptr ID": "524", +"Frequency": "927.12500", +"Input Freq": "902.12500", +"PL": "103.5", +"TSQ": "103.5", +"Nearest City": "Portland", +"Landmark": "KGW Tower", +"County": "Multnomah", +"State": "Oregon", +"Country": "United States", +"Lat": "45.52230072", +"Long": "-122.74700165", +"Precise": "1", +"Callsign": "K7QDX", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "42215", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "Repeater is linked full-time to the 927-Tech reflector", +"Last Update": "2022-11-18" +}, { +"State ID": "41", +"Rptr ID": "655", +"Frequency": "443.30000", +"Input Freq": "448.30000", +"PL": "100.0", +"TSQ": "100.0", +"Nearest City": "Portland", +"Landmark": "Council Crest", +"County": "Multnomah", +"State": "Oregon", +"Country": "United States", +"Lat": "45.51589966", +"Long": "-122.73400116", +"Precise": "1", +"Callsign": "K7LJ", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "599934", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2023-01-13" +}, { +"State ID": "41", +"Rptr ID": "660", +"Frequency": "145.31000", +"Input Freq": "144.71000", +"PL": "123.0", +"TSQ": "123.0", +"Nearest City": "Portland", +"Landmark": "Skyline", +"County": "Multnomah", +"State": "Oregon", +"Country": "United States", +"Lat": "45.52239990", +"Long": "-122.74700165", +"Precise": "1", +"Callsign": "N7EXH", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-11-27" +}, { +"State ID": "41", +"Rptr ID": "671", +"Frequency": "440.20000", +"Input Freq": "445.20000", +"PL": "100.0", +"TSQ": "", +"Nearest City": "Portland", +"Landmark": "Skyline", +"County": "Multnomah", +"State": "Oregon", +"Country": "United States", +"Lat": "45.52239990", +"Long": "-122.74700165", +"Precise": "1", +"Callsign": "N7BAR", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "5464", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-01-12" +}, { +"State ID": "41", +"Rptr ID": "686", +"Frequency": "147.14000", +"Input Freq": "147.74000", +"PL": "107.2", +"TSQ": "", +"Nearest City": "Portland", +"Landmark": "Skyline", +"County": "Multnomah", +"State": "Oregon", +"Country": "United States", +"Lat": "45.52230072", +"Long": "-122.74700165", +"Precise": "1", +"Callsign": "W7AC", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "Yes", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "", +"IRLP Node": "", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "CARES 1st Alternate Repeater.", +"Last Update": "2021-01-16" +}, { +"State ID": "41", +"Rptr ID": "3505", +"Frequency": "444.80000", +"Input Freq": "449.80000", +"PL": "107.2", +"TSQ": "", +"Nearest City": "Portland", +"Landmark": "", +"County": "Multnomah", +"State": "Oregon", +"Country": "United States", +"Lat": "45.52349854", +"Long": "-122.67600250", +"Precise": "0", +"Callsign": "N7PRM", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-04-05" +}, { +"State ID": "41", +"Rptr ID": "6628", +"Frequency": "443.05000", +"Input Freq": "448.05000", +"PL": "", +"TSQ": "", +"Nearest City": "Portland", +"Landmark": "Stonehenge Tower", +"County": "Multnomah", +"State": "Oregon", +"Country": "United States", +"Lat": "45.48920059", +"Long": "-122.69599915", +"Precise": "1", +"Callsign": "WA7BND", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "", +"IRLP Node": "", +"Wires Node": "11998", +"FM Analog": "No", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "Yes", +"YSF DG ID Uplink": "00", +"YSF DG IS Downlink": "00", +"YSF DSC": "", +"Notes": "Yaesu WIRES-X is linked to this repeater. Tune in and learn about C4FM digital. Enjoy", +"Last Update": "2022-11-27" +}, { +"State ID": "41", +"Rptr ID": "8239", +"Frequency": "443.20000", +"Input Freq": "448.20000", +"PL": "173.8", +"TSQ": "", +"Nearest City": "Portland", +"Landmark": "Skyline", +"County": "Multnomah", +"State": "Oregon", +"Country": "United States", +"Lat": "45.60570145", +"Long": "-122.83300018", +"Precise": "1", +"Callsign": "K6PRN", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "Receive antenna issues", +"Last Update": "2022-12-06" +}, { +"State ID": "41", +"Rptr ID": "14723", +"Frequency": "442.25000", +"Input Freq": "447.25000", +"PL": "100.0", +"TSQ": "100.0", +"Nearest City": "Portland", +"Landmark": "Skyline Tower", +"County": "Multnomah", +"State": "Oregon", +"Country": "United States", +"Lat": "45.52289963", +"Long": "-122.75299835", +"Precise": "1", +"Callsign": "WB1ARB", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "Yes", +"YSF DG ID Uplink": "00", +"YSF DG IS Downlink": "00", +"YSF DSC": "Open", +"Notes": "", +"Last Update": "2022-11-13" +}, { +"State ID": "41", +"Rptr ID": "14941", +"Frequency": "444.67500", +"Input Freq": "449.67500", +"PL": "100.0", +"TSQ": "", +"Nearest City": "Portland", +"Landmark": "Council Crest", +"County": "Multnomah", +"State": "Oregon", +"Country": "United States", +"Lat": "45.49900055", +"Long": "-122.70800018", +"Precise": "0", +"Callsign": "W7PGE", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "Yes", +"RACES": "Yes", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2021-06-23" +}, { +"State ID": "41", +"Rptr ID": "15199", +"Frequency": "440.62500", +"Input Freq": "445.62500", +"PL": "Restricted", +"TSQ": "Restricted", +"Nearest City": "Portland", +"Landmark": "West Hills", +"County": "Multnomah", +"State": "Oregon", +"Country": "United States", +"Lat": "45.50519943", +"Long": "-122.70600128", +"Precise": "0", +"Callsign": "KB7APU", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "0", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "No", +"DMR": "Yes", +"DMR Color Code": "1", +"DMR ID": "314102", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2021-02-18" +}, { +"State ID": "41", +"Rptr ID": "15431", +"Frequency": "440.50000", +"Input Freq": "445.50000", +"PL": "D125", +"TSQ": "D125", +"Nearest City": "Portland", +"Landmark": "KGW Tower", +"County": "Multnomah", +"State": "Oregon", +"Country": "United States", +"Lat": "45.52230072", +"Long": "-122.74700165", +"Precise": "0", +"Callsign": "AB7BS", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "", +"IRLP Node": "", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-01-12" +}, { +"State ID": "41", +"Rptr ID": "15504", +"Frequency": "443.10000", +"Input Freq": "448.10000", +"PL": "", +"TSQ": "", +"Nearest City": "Corbett", +"Landmark": "Lookout Point", +"County": "Multnomah", +"State": "Oregon", +"Country": "United States", +"Lat": "45.53179932", +"Long": "-122.29100037", +"Precise": "1", +"Callsign": "N7LF", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "Yes", +"RACES": "Yes", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "0", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "No", +"DMR": "Yes", +"DMR Color Code": "1", +"DMR ID": "312435", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "Connected to PNW Digital System. Visit PNWDigital.net for further info on supported TG.", +"Last Update": "2021-04-13" +}, { +"State ID": "41", +"Rptr ID": "17145", +"Frequency": "443.27500", +"Input Freq": "448.27500", +"PL": "167.9", +"TSQ": "167.9", +"Nearest City": "Portland", +"Landmark": "Healy Heights", +"County": "Multnomah", +"State": "Oregon", +"Country": "United States", +"Lat": "45.48929977", +"Long": "-122.69699860", +"Precise": "1", +"Callsign": "KA7AGH", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-12-12" +}, { +"State ID": "41", +"Rptr ID": "17154", +"Frequency": "1249.75000", +"Input Freq": "1229.75000", +"PL": "", +"TSQ": "", +"Nearest City": "Portland", +"Landmark": "", +"County": "Multnomah", +"State": "Oregon", +"Country": "United States", +"Lat": "45.51219940", +"Long": "-122.65899658", +"Precise": "0", +"Callsign": "KG7KOU", +"Use": "OPEN", +"Operational Status": "Unknown", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-04-05" +}, { +"State ID": "41", +"Rptr ID": "18063", +"Frequency": "444.83750", +"Input Freq": "449.83750", +"PL": "", +"TSQ": "", +"Nearest City": "Portland", +"Landmark": "Providence Portland Medical Center", +"County": "Multnomah", +"State": "Oregon", +"Country": "United States", +"Lat": "45.52861111", +"Long": "-122.61333330", +"Precise": "1", +"Callsign": "WA7HAA", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "0", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "No", +"DMR": "Yes", +"DMR Color Code": "7", +"DMR ID": "310395", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "Open use. Connected to PNW Digital System. Visit PNWDigital.net for further info on supported TG's and other important info.", +"Last Update": "2021-03-26" +}, { +"State ID": "41", +"Rptr ID": "18665", +"Frequency": "443.07500", +"Input Freq": "448.07500", +"PL": "", +"TSQ": "", +"Nearest City": "Gresham", +"Landmark": "Hospital", +"County": "Multnomah", +"State": "Oregon", +"Country": "United States", +"Lat": "45.51682050", +"Long": "-122.40688330", +"Precise": "1", +"Callsign": "N7LF", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "Yes", +"RACES": "Yes", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "0", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "No", +"DMR": "Yes", +"DMR Color Code": "1", +"DMR ID": "314103", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "Connected to PNW Digital System. Visit PNWDigital.net for further info on supported TG.", +"Last Update": "2021-03-26" +}, { +"State ID": "41", +"Rptr ID": "18737", +"Frequency": "440.51250", +"Input Freq": "445.51250", +"PL": "", +"TSQ": "", +"Nearest City": "Portland", +"Landmark": "Sylvan KOIN tower", +"County": "Multnomah", +"State": "Oregon", +"Country": "United States", +"Lat": "45.50510640", +"Long": "-122.67502610", +"Precise": "1", +"Callsign": "K7RPT", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "0", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "No", +"DMR": "Yes", +"DMR Color Code": "1", +"DMR ID": "311391", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "Open use. Connected to PNW Digital System. Visit PNWDigital.net for further info on supported TG.", +"Last Update": "2021-03-04" +}, { +"State ID": "41", +"Rptr ID": "19825", +"Frequency": "443.25000", +"Input Freq": "448.25000", +"PL": "100.0", +"TSQ": "100.0", +"Nearest City": "Gresham", +"Landmark": "Legacy Mount Hood Medical Cntr", +"County": "Multnomah", +"State": "Oregon", +"Country": "United States", +"Lat": "45.51663900", +"Long": "-122.40736100", +"Precise": "1", +"Callsign": "N7KOJ", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "0", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "Everyone is welcome to use this open repeater. This repeater is not yet listed in the ORRC online database.", +"Last Update": "2021-02-28" +}, { +"State ID": "41", +"Rptr ID": "20396", +"Frequency": "440.15000", +"Input Freq": "445.15000", +"PL": "", +"TSQ": "", +"Nearest City": "Portland", +"Landmark": "Skyline", +"County": "Multnomah", +"State": "Oregon", +"Country": "United States", +"Lat": "45.52220154", +"Long": "-122.74700165", +"Precise": "1", +"Callsign": "K7KSN", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "0", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "No", +"DMR": "Yes", +"DMR Color Code": "5", +"DMR ID": "315338", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2021-10-18" +}, { +"State ID": "41", +"Rptr ID": "20709", +"Frequency": "927.15000", +"Input Freq": "902.15000", +"PL": "", +"TSQ": "", +"Nearest City": "Portland", +"Landmark": "downtown", +"County": "Multnomah", +"State": "Oregon", +"Country": "United States", +"Lat": "45.49687050", +"Long": "-122.68376800", +"Precise": "0", +"Callsign": "KB7APU", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "0", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "No", +"DMR": "Yes", +"DMR Color Code": "1", +"DMR ID": "310392", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-03-10" +}, { +"State ID": "41", +"Rptr ID": "20710", +"Frequency": "440.01250", +"Input Freq": "445.01250", +"PL": "", +"TSQ": "", +"Nearest City": "Portland", +"Landmark": "OHSU", +"County": "Multnomah", +"State": "Oregon", +"Country": "United States", +"Lat": "45.49836790", +"Long": "-122.68534590", +"Precise": "1", +"Callsign": "K7CLL", +"Use": "OPEN", +"Operational Status": "Off-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "0", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "No", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "Yes", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-03-10" +}, { +"State ID": "41", +"Rptr ID": "20711", +"Frequency": "440.77500", +"Input Freq": "445.77500", +"PL": "Restricted", +"TSQ": "Restricted", +"Nearest City": "Portland", +"Landmark": "", +"County": "Multnomah", +"State": "Oregon", +"Country": "United States", +"Lat": "45.51523200", +"Long": "-122.67838530", +"Precise": "0", +"Callsign": "KB7APU", +"Use": "CLOSED", +"Operational Status": "On-air", +"ARES": "Yes", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "0", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "ARES and SAR repeater traffic only.", +"Last Update": "2022-03-10" +}, { +"State ID": "41", +"Rptr ID": "366", +"Frequency": "145.33000", +"Input Freq": "144.73000", +"PL": "186.2", +"TSQ": "186.2", +"Nearest City": "Salem", +"Landmark": "Eagle Crest", +"County": "Polk", +"State": "Oregon", +"Country": "United States", +"Lat": "44.98640060", +"Long": "-123.13300323", +"Precise": "1", +"Callsign": "W7SRA", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "Yes", +"RACES": "Yes", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "Swaptoberfest Talk-in Frequency", +"Last Update": "2022-11-18" +}, { +"State ID": "41", +"Rptr ID": "383", +"Frequency": "147.02000", +"Input Freq": "147.62000", +"PL": "186.2", +"TSQ": "186.2", +"Nearest City": "Falls City", +"Landmark": "Laurel Mountain", +"County": "Polk", +"State": "Oregon", +"Country": "United States", +"Lat": "44.92340088", +"Long": "-123.57299805", +"Precise": "1", +"Callsign": "W7SRA", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-11-18" +}, { +"State ID": "41", +"Rptr ID": "520", +"Frequency": "442.50000", +"Input Freq": "447.50000", +"PL": "100.0", +"TSQ": "", +"Nearest City": "Salem", +"Landmark": "", +"County": "Polk", +"State": "Oregon", +"Country": "United States", +"Lat": "44.94290161", +"Long": "-123.03500366", +"Precise": "0", +"Callsign": "W7BJH", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "100 watts.", +"Last Update": "2022-06-13" +}, { +"State ID": "41", +"Rptr ID": "2783", +"Frequency": "927.70000", +"Input Freq": "902.70000", +"PL": "162.2", +"TSQ": "", +"Nearest City": "Monmouth", +"Landmark": "", +"County": "Polk", +"State": "Oregon", +"Country": "United States", +"Lat": "44.84859848", +"Long": "-123.23300171", +"Precise": "0", +"Callsign": "KE7AAJ", +"Use": "OPEN", +"Operational Status": "Unknown", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "", +"IRLP Node": "", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "0000-00-00" +}, { +"State ID": "41", +"Rptr ID": "6773", +"Frequency": "224.60000", +"Input Freq": "223.00000", +"PL": "100.0", +"TSQ": "", +"Nearest City": "Salem", +"Landmark": "", +"County": "Polk", +"State": "Oregon", +"Country": "United States", +"Lat": "44.94290161", +"Long": "-123.03500366", +"Precise": "0", +"Callsign": "W7BJH", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "0", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-06-13" +}, { +"State ID": "41", +"Rptr ID": "8071", +"Frequency": "440.07500", +"Input Freq": "445.07500", +"PL": "103.5", +"TSQ": "103.5", +"Nearest City": "Salem", +"Landmark": "Bald Hill (Eagle Crest)", +"County": "Polk", +"State": "Oregon", +"Country": "United States", +"Lat": "44.98389816", +"Long": "-123.14399719", +"Precise": "1", +"Callsign": "N7PIR", +"Use": "OPEN", +"Operational Status": "Off-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "132225", +"IRLP Node": "3420", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-11-18" +}, { +"State ID": "41", +"Rptr ID": "11905", +"Frequency": "224.92000", +"Input Freq": "223.32000", +"PL": "136.5", +"TSQ": "", +"Nearest City": "Salem", +"Landmark": "Salem Hills", +"County": "Polk", +"State": "Oregon", +"Country": "United States", +"Lat": "44.94290161", +"Long": "-123.03500366", +"Precise": "0", +"Callsign": "W6WHD", +"Use": "OPEN", +"Operational Status": "Off-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "40676", +"EchoLink Node": "", +"IRLP Node": "", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "Usually connected via Allstar to node 45830.", +"Last Update": "2022-12-07" +}, { +"State ID": "41", +"Rptr ID": "14576", +"Frequency": "442.45000", +"Input Freq": "447.45000", +"PL": "D125", +"TSQ": "D125", +"Nearest City": "Salem", +"Landmark": "Eagle Crest", +"County": "Polk", +"State": "Oregon", +"Country": "United States", +"Lat": "44.98450089", +"Long": "-123.14299774", +"Precise": "0", +"Callsign": "AB7BS", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-12-06" +}, { +"State ID": "41", +"Rptr ID": "17725", +"Frequency": "146.66000", +"Input Freq": "146.06000", +"PL": "136.5", +"TSQ": "91.5", +"Nearest City": "Grande Ronde", +"Landmark": "", +"County": "Polk", +"State": "Oregon", +"Country": "United States", +"Lat": "45.07870102", +"Long": "-123.48600006", +"Precise": "0", +"Callsign": "W7GRT", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "", +"IRLP Node": "", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2020-09-25" +}, { +"State ID": "41", +"Rptr ID": "17795", +"Frequency": "442.82500", +"Input Freq": "447.82500", +"PL": "123.0", +"TSQ": "", +"Nearest City": "Grande Ronde", +"Landmark": "Spirit Mtn Casino", +"County": "Polk", +"State": "Oregon", +"Country": "United States", +"Lat": "45.05824470", +"Long": "-123.58170040", +"Precise": "1", +"Callsign": "W7GRT", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "0", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2021-02-19" +}, { +"State ID": "41", +"Rptr ID": "114", +"Frequency": "145.27000", +"Input Freq": "144.67000", +"PL": "107.2", +"TSQ": "107.2", +"Nearest City": "Timber", +"Landmark": "", +"County": "Tillamook", +"State": "Oregon", +"Country": "United States", +"Lat": "45.72000122", +"Long": "-123.29299927", +"Precise": "0", +"Callsign": "KJ7IY", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "Yes", +"RACES": "Yes", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "", +"IRLP Node": "", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2021-08-14" +}, { +"State ID": "41", +"Rptr ID": "230", +"Frequency": "440.17500", +"Input Freq": "445.17500", +"PL": "100.0", +"TSQ": "", +"Nearest City": "Manzanita", +"Landmark": "Angora Peak", +"County": "Tillamook", +"State": "Oregon", +"Country": "United States", +"Lat": "45.78779984", +"Long": "-123.91899872", +"Precise": "1", +"Callsign": "W7EM", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2020-09-21" +}, { +"State ID": "41", +"Rptr ID": "386", +"Frequency": "147.22000", +"Input Freq": "147.82000", +"PL": "100.0", +"TSQ": "", +"Nearest City": "Hebo", +"Landmark": "Mt Hebo", +"County": "Tillamook", +"State": "Oregon", +"Country": "United States", +"Lat": "45.21480179", +"Long": "-123.75499725", +"Precise": "0", +"Callsign": "W7LI", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "Yes", +"RACES": "Yes", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-11-18" +}, { +"State ID": "41", +"Rptr ID": "389", +"Frequency": "440.90000", +"Input Freq": "445.90000", +"PL": "118.8", +"TSQ": "118.8", +"Nearest City": "Hebo", +"Landmark": "Mt Hebo", +"County": "Tillamook", +"State": "Oregon", +"Country": "United States", +"Lat": "45.21480179", +"Long": "-123.75499725", +"Precise": "1", +"Callsign": "W7GC", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": " Telemetry Status: ", +"Last Update": "2022-11-18" +}, { +"State ID": "41", +"Rptr ID": "390", +"Frequency": "441.25000", +"Input Freq": "446.25000", +"PL": "118.8", +"TSQ": "", +"Nearest City": "Hebo", +"Landmark": "Mt Hebo", +"County": "Tillamook", +"State": "Oregon", +"Country": "United States", +"Lat": "45.21799850", +"Long": "-123.75499725", +"Precise": "0", +"Callsign": "W7LI", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-11-18" +}, { +"State ID": "41", +"Rptr ID": "391", +"Frequency": "441.30000", +"Input Freq": "446.30000", +"PL": "100.0", +"TSQ": "", +"Nearest City": "Hebo", +"Landmark": "Mt Hebo", +"County": "Tillamook", +"State": "Oregon", +"Country": "United States", +"Lat": "45.21480179", +"Long": "-123.75499725", +"Precise": "1", +"Callsign": "W7EM", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "266640", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-11-18" +}, { +"State ID": "41", +"Rptr ID": "393", +"Frequency": "442.75000", +"Input Freq": "447.75000", +"PL": "118.8", +"TSQ": "", +"Nearest City": "Rockaway Beach", +"Landmark": "", +"County": "Tillamook", +"State": "Oregon", +"Country": "United States", +"Lat": "45.61360168", +"Long": "-123.94200134", +"Precise": "1", +"Callsign": "W7GC", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "", +"IRLP Node": "", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "Telemetry Status: ", +"Last Update": "2020-09-25" +}, { +"State ID": "41", +"Rptr ID": "518", +"Frequency": "443.07500", +"Input Freq": "448.07500", +"PL": "167.9", +"TSQ": "", +"Nearest City": "Hebo", +"Landmark": "Mt Hebo", +"County": "Tillamook", +"State": "Oregon", +"Country": "United States", +"Lat": "45.21480179", +"Long": "-123.75499725", +"Precise": "1", +"Callsign": "WB7QIW", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-11-18" +}, { +"State ID": "41", +"Rptr ID": "665", +"Frequency": "440.52500", +"Input Freq": "445.52500", +"PL": "77.0", +"TSQ": "", +"Nearest City": "Tillamook", +"Landmark": "Triangulation Point", +"County": "Tillamook", +"State": "Oregon", +"Country": "United States", +"Lat": "45.63150024", +"Long": "-123.64399719", +"Precise": "1", +"Callsign": "W7EM", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "", +"IRLP Node": "", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2020-09-21" +}, { +"State ID": "41", +"Rptr ID": "5174", +"Frequency": "147.39000", +"Input Freq": "147.99000", +"PL": "", +"TSQ": "", +"Nearest City": "Hebo", +"Landmark": "Mt Hebo", +"County": "Tillamook", +"State": "Oregon", +"Country": "United States", +"Lat": "45.21480179", +"Long": "-123.75499725", +"Precise": "1", +"Callsign": "W7GC", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "No", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "Yes", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-12-06" +}, { +"State ID": "41", +"Rptr ID": "15198", +"Frequency": "442.81250", +"Input Freq": "447.81250", +"PL": "Restricted", +"TSQ": "Restricted", +"Nearest City": "Hebo", +"Landmark": "Mt Hebo", +"County": "Tillamook", +"State": "Oregon", +"Country": "United States", +"Lat": "45.22669983", +"Long": "-123.84799957", +"Precise": "0", +"Callsign": "KB7APU", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "0", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "No", +"DMR": "Yes", +"DMR Color Code": "1", +"DMR ID": "314106", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2021-02-18" +}, { +"State ID": "41", +"Rptr ID": "18791", +"Frequency": "444.42500", +"Input Freq": "449.42500", +"PL": "107.2", +"TSQ": "", +"Nearest City": "Manzanita", +"Landmark": "", +"County": "Tillamook", +"State": "Oregon", +"Country": "United States", +"Lat": "45.72398400", +"Long": "-123.93282700", +"Precise": "1", +"Callsign": "W7MOC", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "0", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2020-09-25" +}, { +"State ID": "41", +"Rptr ID": "21214", +"Frequency": "442.12500", +"Input Freq": "447.12500", +"PL": "123.0", +"TSQ": "", +"Nearest City": "Manzanita", +"Landmark": "Neahkahnie Mtn", +"County": "Tillamook", +"State": "Oregon", +"Country": "United States", +"Lat": "45.74399570", +"Long": "-123.94096950", +"Precise": "1", +"Callsign": "W7MOC", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "0", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-12-12" +}, { +"State ID": "41", +"Rptr ID": "397", +"Frequency": "146.80000", +"Input Freq": "146.20000", +"PL": "123.0", +"TSQ": "123.0", +"Nearest City": "Elgin", +"Landmark": "Spout Springs Ski Resort", +"County": "Umatilla", +"State": "Oregon", +"Country": "United States", +"Lat": "45.74670029", +"Long": "-118.03700256", +"Precise": "1", +"Callsign": "WF7S", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "Yes", +"YSF DG ID Uplink": "00", +"YSF DG IS Downlink": "00", +"YSF DSC": "Open", +"Notes": "", +"Last Update": "2022-11-18" +}, { +"State ID": "41", +"Rptr ID": "398", +"Frequency": "145.33000", +"Input Freq": "144.73000", +"PL": "103.5", +"TSQ": "", +"Nearest City": "Pendleton", +"Landmark": "Deadman Pass", +"County": "Umatilla", +"State": "Oregon", +"Country": "United States", +"Lat": "45.60100174", +"Long": "-118.50399780", +"Precise": "0", +"Callsign": "K7RPT", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "0", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "108 watts ERP, 3,606'.", +"Last Update": "2021-02-21" +}, { +"State ID": "41", +"Rptr ID": "399", +"Frequency": "146.88000", +"Input Freq": "146.28000", +"PL": "D073", +"TSQ": "D073", +"Nearest City": "Pendleton", +"Landmark": "Cabbage Hill", +"County": "Umatilla", +"State": "Oregon", +"Country": "United States", +"Lat": "45.55459976", +"Long": "-118.61100006", +"Precise": "1", +"Callsign": "W7NEO", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-11-18" +}, { +"State ID": "41", +"Rptr ID": "405", +"Frequency": "147.28000", +"Input Freq": "147.88000", +"PL": "", +"TSQ": "", +"Nearest City": "Milton-Freewater", +"Landmark": "Pikes Peak", +"County": "Umatilla", +"State": "Oregon", +"Country": "United States", +"Lat": "45.98429871", +"Long": "-118.16899872", +"Precise": "1", +"Callsign": "KD7DDQ", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "0", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "RF Linked to the AK2O 223.9 mhz hub repeater on Stensgar Mt. using yagi antenna.", +"Last Update": "2021-02-19" +}, { +"State ID": "41", +"Rptr ID": "406", +"Frequency": "224.56000", +"Input Freq": "222.96000", +"PL": "CSQ", +"TSQ": "", +"Nearest City": "Pendleton", +"Landmark": "Cabbage Hill", +"County": "Umatilla", +"State": "Oregon", +"Country": "United States", +"Lat": "45.55459976", +"Long": "-118.61100006", +"Precise": "1", +"Callsign": "N7NKT", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-11-18" +}, { +"State ID": "41", +"Rptr ID": "408", +"Frequency": "444.65000", +"Input Freq": "449.65000", +"PL": "CSQ", +"TSQ": "", +"Nearest City": "Weston", +"Landmark": "Waldo Mountain", +"County": "Umatilla", +"State": "Oregon", +"Country": "United States", +"Lat": "45.80640030", +"Long": "-118.33499908", +"Precise": "1", +"Callsign": "N7DWC", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "", +"IRLP Node": "", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2020-05-13" +}, { +"State ID": "41", +"Rptr ID": "410", +"Frequency": "444.95000", +"Input Freq": "449.95000", +"PL": "136.5", +"TSQ": "", +"Nearest City": "Ukiah", +"Landmark": "Carney Butte", +"County": "Umatilla", +"State": "Oregon", +"Country": "United States", +"Lat": "45.28099823", +"Long": "-118.94899750", +"Precise": "1", +"Callsign": "W7URG", +"Use": "OPEN", +"Operational Status": "Off-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "", +"IRLP Node": "", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "900 Watts ERP. Blue Mountains Outback areas for Deer and Elk hunters.", +"Last Update": "2021-09-27" +}, { +"State ID": "41", +"Rptr ID": "411", +"Frequency": "444.97500", +"Input Freq": "449.97500", +"PL": "", +"TSQ": "", +"Nearest City": "Pendleton", +"Landmark": "Cabbage Hill", +"County": "Umatilla", +"State": "Oregon", +"Country": "United States", +"Lat": "45.58549881", +"Long": "-118.58200073", +"Precise": "1", +"Callsign": "W7NEO", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "40289", +"FM Analog": "No", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "Yes", +"YSF DG ID Uplink": "00", +"YSF DG IS Downlink": "00", +"YSF DSC": "0", +"Notes": "", +"Last Update": "2022-11-18" +}, { +"State ID": "41", +"Rptr ID": "413", +"Frequency": "927.50000", +"Input Freq": "902.50000", +"PL": "", +"TSQ": "", +"Nearest City": "Pendleton", +"Landmark": "Cabbage Hill", +"County": "Umatilla", +"State": "Oregon", +"Country": "United States", +"Lat": "45.58549881", +"Long": "-118.58200073", +"Precise": "1", +"Callsign": "N7ERT", +"Use": "CLOSED", +"Operational Status": "Unknown", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "", +"IRLP Node": "", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "Closed repeater. PL withheld by request.", +"Last Update": "0000-00-00" +}, { +"State ID": "41", +"Rptr ID": "5176", +"Frequency": "441.95000", +"Input Freq": "446.95000", +"PL": "", +"TSQ": "", +"Nearest City": "Hermiston", +"Landmark": "", +"County": "Umatilla", +"State": "Oregon", +"Country": "United States", +"Lat": "45.84040070", +"Long": "-119.28900146", +"Precise": "0", +"Callsign": "W7URG", +"Use": "OPEN", +"Operational Status": "Off-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "No", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "Yes", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2020-05-01" +}, { +"State ID": "41", +"Rptr ID": "15461", +"Frequency": "147.04000", +"Input Freq": "147.64000", +"PL": "", +"TSQ": "", +"Nearest City": "Athena", +"Landmark": "Weston Mountain", +"County": "Umatilla", +"State": "Oregon", +"Country": "United States", +"Lat": "45.80049896", +"Long": "-118.37799835", +"Precise": "0", +"Callsign": "W7NEO", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "40289", +"FM Analog": "No", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "Yes", +"YSF DG ID Uplink": "00", +"YSF DG IS Downlink": "00", +"YSF DSC": "none", +"Notes": "", +"Last Update": "2022-08-17" +}, { +"State ID": "41", +"Rptr ID": "16922", +"Frequency": "441.70000", +"Input Freq": "446.70000", +"PL": "131.8", +"TSQ": "131.8", +"Nearest City": "Athena", +"Landmark": "Weston Mtn", +"County": "Umatilla", +"State": "Oregon", +"Country": "United States", +"Lat": "45.80049896", +"Long": "-118.37799835", +"Precise": "1", +"Callsign": "W7NEO", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "", +"IRLP Node": "", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2019-02-22" +}, { +"State ID": "41", +"Rptr ID": "17814", +"Frequency": "443.80000", +"Input Freq": "448.80000", +"PL": "118.8", +"TSQ": "118.8", +"Nearest City": "Hermiston", +"Landmark": "", +"County": "Umatilla", +"State": "Oregon", +"Country": "United States", +"Lat": "45.85459900", +"Long": "-119.27999878", +"Precise": "1", +"Callsign": "WB7ILL", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "40289", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "Yes", +"YSF DG ID Uplink": "00", +"YSF DG IS Downlink": "00", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-04-06" +}, { +"State ID": "41", +"Rptr ID": "414", +"Frequency": "145.15000", +"Input Freq": "144.55000", +"PL": "110.9", +"TSQ": "110.9", +"Nearest City": "La Grande", +"Landmark": "Mount Emily", +"County": "Union", +"State": "Oregon", +"Country": "United States", +"Lat": "45.43739025", +"Long": "-118.09203014", +"Precise": "1", +"Callsign": "K7UNI", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "Yes", +"RACES": "No", +"SKYWARN": "Yes", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "Yes", +"YSF DG ID Uplink": "00", +"YSF DG IS Downlink": "00", +"YSF DSC": "", +"Notes": "", +"Last Update": "2023-01-03" +}, { +"State ID": "41", +"Rptr ID": "417", +"Frequency": "147.26000", +"Input Freq": "147.86000", +"PL": "103.5", +"TSQ": "", +"Nearest City": "La Grande", +"Landmark": "Mount Fanny", +"County": "Union", +"State": "Oregon", +"Country": "United States", +"Lat": "45.30789948", +"Long": "-117.73000336", +"Precise": "1", +"Callsign": "K7RPT", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "Yes", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "0", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2021-02-19" +}, { +"State ID": "41", +"Rptr ID": "420", +"Frequency": "444.92500", +"Input Freq": "449.92500", +"PL": "146.2", +"TSQ": "146.2", +"Nearest City": "La Grande", +"Landmark": "Mount Harris", +"County": "Union", +"State": "Oregon", +"Country": "United States", +"Lat": "45.44039917", +"Long": "-117.89299774", +"Precise": "1", +"Callsign": "KF7GOR", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "727358", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "This system has a remote base on 147.500 MHz Simplex Tone 146.2. Remote base works on Echolink and is always on. ", +"Last Update": "2021-11-22" +}, { +"State ID": "41", +"Rptr ID": "13817", +"Frequency": "146.98000", +"Input Freq": "146.38000", +"PL": "100.0", +"TSQ": "100.0", +"Nearest City": "La Grande", +"Landmark": "Grande Ronde Hospital", +"County": "Union", +"State": "Oregon", +"Country": "United States", +"Lat": "45.31969833", +"Long": "-118.10600281", +"Precise": "0", +"Callsign": "W7GRA", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "", +"IRLP Node": "", +"Wires Node": "30274", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "Yes", +"YSF DG ID Uplink": "00", +"YSF DG IS Downlink": "00", +"YSF DSC": "", +"Notes": "**NEWS***12/20/19: Wires-X is back online.", +"Last Update": "2019-12-30" +}, { +"State ID": "41", +"Rptr ID": "19450", +"Frequency": "145.29000", +"Input Freq": "144.69000", +"PL": "", +"TSQ": "", +"Nearest City": "Ukiah", +"Landmark": "Tower Mt", +"County": "Union", +"State": "Oregon", +"Country": "United States", +"Lat": "45.03048100", +"Long": "-118.34054000", +"Precise": "0", +"Callsign": "W7NEO", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "0", +"IRLP Node": "0", +"Wires Node": "40289", +"FM Analog": "No", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "Yes", +"YSF DG ID Uplink": "00", +"YSF DG IS Downlink": "00", +"YSF DSC": "", +"Notes": "", +"Last Update": "2021-09-24" +}, { +"State ID": "41", +"Rptr ID": "2990", +"Frequency": "147.00000", +"Input Freq": "147.60000", +"PL": "103.5", +"TSQ": "103.5", +"Nearest City": "Joseph", +"Landmark": "", +"County": "Wallowa", +"State": "Oregon", +"Country": "United States", +"Lat": "45.38859940", +"Long": "-117.23300171", +"Precise": "1", +"Callsign": "KB7DZR", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "323569", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "Open for any use and everyone is welcome on this system.", +"Last Update": "2022-11-13" +}, { +"State ID": "41", +"Rptr ID": "11147", +"Frequency": "444.78750", +"Input Freq": "449.78750", +"PL": "", +"TSQ": "", +"Nearest City": "Joseph", +"Landmark": "", +"County": "Wallowa", +"State": "Oregon", +"Country": "United States", +"Lat": "45.38859940", +"Long": "-117.23300171", +"Precise": "1", +"Callsign": "KB7DZR", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "No", +"DMR": "Yes", +"DMR Color Code": "1", +"DMR ID": "312685", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "This system is open and can be linked to any talk group or private call. Please use talk group 312685 WC on time slot 1 for local communications. Remote users can link to this talk group also.", +"Last Update": "2022-08-15" +}, { +"State ID": "41", +"Rptr ID": "421", +"Frequency": "146.74000", +"Input Freq": "146.14000", +"PL": "100.0", +"TSQ": "100.0", +"Nearest City": "The Dalles", +"Landmark": "", +"County": "Wasco", +"State": "Oregon", +"Country": "United States", +"Lat": "45.59469986", +"Long": "-121.17700195", +"Precise": "0", +"Callsign": "KC7LDD", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2021-08-14" +}, { +"State ID": "41", +"Rptr ID": "3090", +"Frequency": "147.26000", +"Input Freq": "147.86000", +"PL": "82.5", +"TSQ": "", +"Nearest City": "Dufur", +"Landmark": "Tygh Ridge", +"County": "Wasco", +"State": "Oregon", +"Country": "United States", +"Lat": "45.30559921", +"Long": "-121.06600189", +"Precise": "0", +"Callsign": "WC7EC", +"Use": "OPEN", +"Operational Status": "Unknown", +"ARES": "No", +"RACES": "Yes", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-11-18" +}, { +"State ID": "41", +"Rptr ID": "5538", +"Frequency": "444.70000", +"Input Freq": "449.70000", +"PL": "100.0", +"TSQ": "100.0", +"Nearest City": "The Dalles", +"Landmark": "Stacker Butte", +"County": "Wasco", +"State": "Oregon", +"Country": "United States", +"Lat": "45.59460068", +"Long": "-121.17900085", +"Precise": "0", +"Callsign": "KF7LN", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2021-08-14" +}, { +"State ID": "41", +"Rptr ID": "101", +"Frequency": "444.85000", +"Input Freq": "449.85000", +"PL": "123.0", +"TSQ": "", +"Nearest City": "Beaverton", +"Landmark": "St Vincent Hosp", +"County": "Washington", +"State": "Oregon", +"Country": "United States", +"Lat": "45.51050186", +"Long": "-122.77200317", +"Precise": "1", +"Callsign": "W7PSV", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "500 feet, 50 watts.", +"Last Update": "2022-01-12" +}, { +"State ID": "41", +"Rptr ID": "115", +"Frequency": "147.36000", +"Input Freq": "147.96000", +"PL": "107.2", +"TSQ": "107.2", +"Nearest City": "Aloha", +"Landmark": "Cooper Mountain", +"County": "Washington", +"State": "Oregon", +"Country": "United States", +"Lat": "45.45529938", +"Long": "-122.87100220", +"Precise": "1", +"Callsign": "N7QQU", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "Yes", +"RACES": "Yes", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "", +"IRLP Node": "", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2021-06-23" +}, { +"State ID": "41", +"Rptr ID": "118", +"Frequency": "147.32000", +"Input Freq": "147.92000", +"PL": "100.0", +"TSQ": "100.0", +"Nearest City": "Forest Grove", +"Landmark": "South Saddle Mountain", +"County": "Washington", +"State": "Oregon", +"Country": "United States", +"Lat": "45.54980087", +"Long": "-123.37400055", +"Precise": "1", +"Callsign": "K7RPT", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "Yes", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-11-18" +}, { +"State ID": "41", +"Rptr ID": "121", +"Frequency": "147.38000", +"Input Freq": "147.98000", +"PL": "100.0", +"TSQ": "", +"Nearest City": "Cedar Mill", +"Landmark": "", +"County": "Washington", +"State": "Oregon", +"Country": "United States", +"Lat": "45.52479935", +"Long": "-122.81099701", +"Precise": "1", +"Callsign": "K7RPT", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "", +"IRLP Node": "", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "218 watts ERP, 250'.", +"Last Update": "2021-01-16" +}, { +"State ID": "41", +"Rptr ID": "125", +"Frequency": "442.05000", +"Input Freq": "447.05000", +"PL": "", +"TSQ": "", +"Nearest City": "Aloha", +"Landmark": "", +"County": "Washington", +"State": "Oregon", +"Country": "United States", +"Lat": "45.51499939", +"Long": "-122.84899902", +"Precise": "1", +"Callsign": "K7WWG", +"Use": "CLOSED", +"Operational Status": "Off-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2021-01-21" +}, { +"State ID": "41", +"Rptr ID": "127", +"Frequency": "442.32500", +"Input Freq": "447.32500", +"PL": "100.0", +"TSQ": "", +"Nearest City": "Forest Grove", +"Landmark": "South Saddle Mountain", +"County": "Washington", +"State": "Oregon", +"Country": "United States", +"Lat": "45.54980087", +"Long": "-123.37400055", +"Precise": "1", +"Callsign": "K7RPT", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "Yes", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "", +"IRLP Node": "", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "125 watts and 3,600 feet.", +"Last Update": "2022-01-12" +}, { +"State ID": "41", +"Rptr ID": "128", +"Frequency": "442.52500", +"Input Freq": "447.52500", +"PL": "107.2", +"TSQ": "107.2", +"Nearest City": "Aloha", +"Landmark": "Cooper Mountain", +"County": "Washington", +"State": "Oregon", +"Country": "United States", +"Lat": "45.45539856", +"Long": "-122.87100220", +"Precise": "0", +"Callsign": "KA7OSM", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "", +"IRLP Node": "", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-01-12" +}, { +"State ID": "41", +"Rptr ID": "134", +"Frequency": "443.35000", +"Input Freq": "448.35000", +"PL": "156.7", +"TSQ": "", +"Nearest City": "Aloha", +"Landmark": "", +"County": "Washington", +"State": "Oregon", +"Country": "United States", +"Lat": "45.49449921", +"Long": "-122.86599731", +"Precise": "0", +"Callsign": "NM7B", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "", +"IRLP Node": "", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-01-12" +}, { +"State ID": "41", +"Rptr ID": "467", +"Frequency": "444.97500", +"Input Freq": "449.97500", +"PL": "107.2", +"TSQ": "107.2", +"Nearest City": "Hillsboro", +"Landmark": "Intel's Jones Farm Campus", +"County": "Washington", +"State": "Oregon", +"Country": "United States", +"Lat": "45.54240036", +"Long": "-122.95999908", +"Precise": "1", +"Callsign": "K7CPU", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "", +"IRLP Node": "", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-01-12" +}, { +"State ID": "41", +"Rptr ID": "469", +"Frequency": "145.45000", +"Input Freq": "144.85000", +"PL": "136.5", +"TSQ": "", +"Nearest City": "North Plains", +"Landmark": "", +"County": "Washington", +"State": "Oregon", +"Country": "United States", +"Lat": "45.59719849", +"Long": "-122.99199677", +"Precise": "0", +"Callsign": "KE7DC", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "", +"IRLP Node": "", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2021-01-16" +}, { +"State ID": "41", +"Rptr ID": "523", +"Frequency": "1292.00000", +"Input Freq": "1272.00000", +"PL": "", +"TSQ": "", +"Nearest City": "Sherwood", +"Landmark": "", +"County": "Washington", +"State": "Oregon", +"Country": "United States", +"Lat": "45.35649872", +"Long": "-122.83999634", +"Precise": "1", +"Callsign": "WB7DZG", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "No", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "Yes", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2021-01-17" +}, { +"State ID": "41", +"Rptr ID": "659", +"Frequency": "441.82500", +"Input Freq": "446.82500", +"PL": "107.2", +"TSQ": "107.2", +"Nearest City": "Timber", +"Landmark": "Hoffman Hill", +"County": "Washington", +"State": "Oregon", +"Country": "United States", +"Lat": "45.75830078", +"Long": "-123.16999817", +"Precise": "1", +"Callsign": "KJ7IY", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "82962", +"IRLP Node": "3881", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-01-12" +}, { +"State ID": "41", +"Rptr ID": "2808", +"Frequency": "440.10000", +"Input Freq": "445.10000", +"PL": "162.2", +"TSQ": "", +"Nearest City": "Tigard", +"Landmark": "QTH", +"County": "Washington", +"State": "Oregon", +"Country": "United States", +"Lat": "45.43140030", +"Long": "-122.76999664", +"Precise": "0", +"Callsign": "K7ICY", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "", +"IRLP Node": "", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "159 feet asl, 40 watts ERP.", +"Last Update": "2022-01-12" +}, { +"State ID": "41", +"Rptr ID": "3503", +"Frequency": "440.55000", +"Input Freq": "445.55000", +"PL": "", +"TSQ": "", +"Nearest City": "Hillsboro", +"Landmark": "Synopsys", +"County": "Washington", +"State": "Oregon", +"Country": "United States", +"Lat": "45.53340149", +"Long": "-122.90299988", +"Precise": "1", +"Callsign": "N7QQU", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "Yes", +"RACES": "Yes", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "", +"IRLP Node": "", +"Wires Node": "", +"FM Analog": "No", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "Yes", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "Repeater is located on the top of the Synopsys building at the intersection of Cornelius Pass Road and Cornell Road in Hillsboro and provides general coverage in Washington County.", +"Last Update": "2020-12-04" +}, { +"State ID": "41", +"Rptr ID": "5172", +"Frequency": "444.31250", +"Input Freq": "449.31250", +"PL": "", +"TSQ": "", +"Nearest City": "Sherwood", +"Landmark": "", +"County": "Washington", +"State": "Oregon", +"Country": "United States", +"Lat": "45.35649872", +"Long": "-122.83999634", +"Precise": "1", +"Callsign": "WB7DZG", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "", +"IRLP Node": "", +"Wires Node": "", +"FM Analog": "No", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "Yes", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-04-04" +}, { +"State ID": "41", +"Rptr ID": "5173", +"Frequency": "146.62000", +"Input Freq": "146.02000", +"PL": "", +"TSQ": "", +"Nearest City": "Sherwood", +"Landmark": "", +"County": "Washington", +"State": "Oregon", +"Country": "United States", +"Lat": "45.35649872", +"Long": "-122.83999634", +"Precise": "1", +"Callsign": "WB7DZG", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "0", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "No", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "Yes", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2021-02-19" +}, { +"State ID": "41", +"Rptr ID": "7441", +"Frequency": "927.11250", +"Input Freq": "902.11250", +"PL": "107.2", +"TSQ": "107.2", +"Nearest City": "Gales Creek", +"Landmark": "", +"County": "Washington", +"State": "Oregon", +"Country": "United States", +"Lat": "45.58649826", +"Long": "-123.21499634", +"Precise": "0", +"Callsign": "KJ7IY", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-03-10" +}, { +"State ID": "41", +"Rptr ID": "8620", +"Frequency": "443.75000", +"Input Freq": "448.75000", +"PL": "100.0", +"TSQ": "", +"Nearest City": "Newberg", +"Landmark": "Chehalem Ridge", +"County": "Washington", +"State": "Oregon", +"Country": "United States", +"Lat": "45.34999847", +"Long": "-122.97000122", +"Precise": "1", +"Callsign": "K7RPT", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "", +"IRLP Node": "", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-01-12" +}, { +"State ID": "41", +"Rptr ID": "8896", +"Frequency": "52.85000", +"Input Freq": "51.15000", +"PL": "107.2", +"TSQ": "", +"Nearest City": "Timber", +"Landmark": "", +"County": "Washington", +"State": "Oregon", +"Country": "United States", +"Lat": "45.71979904", +"Long": "-123.29599762", +"Precise": "0", +"Callsign": "KR7IS", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-04-05" +}, { +"State ID": "41", +"Rptr ID": "9660", +"Frequency": "444.80000", +"Input Freq": "449.80000", +"PL": "107.2", +"TSQ": "", +"Nearest City": "Cedar Mill", +"Landmark": "", +"County": "Washington", +"State": "Oregon", +"Country": "United States", +"Lat": "45.52709961", +"Long": "-122.79299927", +"Precise": "0", +"Callsign": "N7PRM", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "", +"IRLP Node": "", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-01-12" +}, { +"State ID": "41", +"Rptr ID": "11138", +"Frequency": "440.17500", +"Input Freq": "445.17500", +"PL": "110.9", +"TSQ": "110.9", +"Nearest City": "Tigard", +"Landmark": "Bull Mountain", +"County": "Washington", +"State": "Oregon", +"Country": "United States", +"Lat": "45.41559982", +"Long": "-122.81300354", +"Precise": "1", +"Callsign": "KF7TTS", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "0", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "Normally open to all hams - Preparedness topics encouraged - Closed during emergency: Tigard CERT only", +"Last Update": "2022-01-12" +}, { +"State ID": "41", +"Rptr ID": "11146", +"Frequency": "444.75000", +"Input Freq": "449.75000", +"PL": "123.0", +"TSQ": "", +"Nearest City": "Beaverton", +"Landmark": "", +"County": "Washington", +"State": "Oregon", +"Country": "United States", +"Lat": "45.48709869", +"Long": "-122.80400085", +"Precise": "0", +"Callsign": "WB7CRT", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "", +"IRLP Node": "", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-01-12" +}, { +"State ID": "41", +"Rptr ID": "15227", +"Frequency": "444.02500", +"Input Freq": "449.02500", +"PL": "Restricted", +"TSQ": "Restricted", +"Nearest City": "Buxton", +"Landmark": "Green Mountain/Buxton Lookout", +"County": "Washington", +"State": "Oregon", +"Country": "United States", +"Lat": "45.68870163", +"Long": "-123.19100189", +"Precise": "0", +"Callsign": "KB7APU", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "0", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "No", +"DMR": "Yes", +"DMR Color Code": "9", +"DMR ID": "314108", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2021-06-23" +}, { +"State ID": "41", +"Rptr ID": "15808", +"Frequency": "442.27500", +"Input Freq": "447.27500", +"PL": "107.2", +"TSQ": "", +"Nearest City": "Sherwood", +"Landmark": "", +"County": "Washington", +"State": "Oregon", +"Country": "United States", +"Lat": "45.35649872", +"Long": "-122.83999634", +"Precise": "0", +"Callsign": "KJ7IY", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "", +"IRLP Node": "", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-01-12" +}, { +"State ID": "41", +"Rptr ID": "15810", +"Frequency": "442.57500", +"Input Freq": "447.57500", +"PL": "123.0", +"TSQ": "", +"Nearest City": "Sherwood", +"Landmark": "", +"County": "Washington", +"State": "Oregon", +"Country": "United States", +"Lat": "45.35632610", +"Long": "-122.84027490", +"Precise": "0", +"Callsign": "K7REA", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "80041", +"FM Analog": "No", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "Yes", +"YSF DG ID Uplink": "00", +"YSF DG IS Downlink": "00", +"YSF DSC": "OPEN", +"Notes": "Use DG-ID TX01 for Wires-X access. This repeater is digital only, no FM analog voice. See web page on info linking to other repeaters (http://www.k7rea.com/).", +"Last Update": "2021-06-23" +}, { +"State ID": "41", +"Rptr ID": "18792", +"Frequency": "444.52500", +"Input Freq": "449.52500", +"PL": "136.5", +"TSQ": "", +"Nearest City": "Tualatin", +"Landmark": "", +"County": "Washington", +"State": "Oregon", +"Country": "United States", +"Lat": "45.37799880", +"Long": "-122.78218170", +"Precise": "0", +"Callsign": "KJ7ECQ", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "Yes", +"RACES": "Yes", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "0", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-01-12" +}, { +"State ID": "41", +"Rptr ID": "19704", +"Frequency": "441.47500", +"Input Freq": "446.47500", +"PL": "", +"TSQ": "", +"Nearest City": "Beaverton", +"Landmark": "", +"County": "Washington", +"State": "Oregon", +"Country": "United States", +"Lat": "45.48887610", +"Long": "-122.80137710", +"Precise": "0", +"Callsign": "KG7RFM", +"Use": "OPEN", +"Operational Status": "Unknown", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "0", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "No", +"DMR": "Yes", +"DMR Color Code": "2", +"DMR ID": "314118", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2021-06-23" +}, { +"State ID": "41", +"Rptr ID": "20133", +"Frequency": "440.81250", +"Input Freq": "445.81250", +"PL": "", +"TSQ": "", +"Nearest City": "Hillsboro", +"Landmark": "South Saddle Mountain", +"County": "Washington", +"State": "Oregon", +"Country": "United States", +"Lat": "45.54508300", +"Long": "-123.38236100", +"Precise": "1", +"Callsign": "K7RPT", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "Yes", +"RACES": "Yes", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "0", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "No", +"DMR": "Yes", +"DMR Color Code": "1", +"DMR ID": "311191", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2021-07-04" +}, { +"State ID": "41", +"Rptr ID": "20684", +"Frequency": "440.07500", +"Input Freq": "445.07500", +"PL": "123.0", +"TSQ": "123.0", +"Nearest City": "Hillsboro", +"Landmark": "", +"County": "Washington", +"State": "Oregon", +"Country": "United States", +"Lat": "45.52346412", +"Long": "-122.87331893", +"Precise": "0", +"Callsign": "K0HSU", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "0", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "Yes", +"YSF DG ID Uplink": "13", +"YSF DG IS Downlink": "00", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-05-17" +}, { +"State ID": "41", +"Rptr ID": "21346", +"Frequency": "440.75000", +"Input Freq": "445.75000", +"PL": "97.4", +"TSQ": "", +"Nearest City": "Tualatin", +"Landmark": "Pony Ridge", +"County": "Washington", +"State": "Oregon", +"Country": "United States", +"Lat": "45.38654000", +"Long": "-122.81416400", +"Precise": "1", +"Callsign": "NA7A", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "0", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "Yes", +"YSF DG ID Uplink": "00", +"YSF DG IS Downlink": "00", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-12-19" +}, { +"State ID": "41", +"Rptr ID": "21347", +"Frequency": "145.25000", +"Input Freq": "144.65000", +"PL": "97.4", +"TSQ": "", +"Nearest City": "Tualatin", +"Landmark": "Pony Ridge", +"County": "Washington", +"State": "Oregon", +"Country": "United States", +"Lat": "45.38654000", +"Long": "-122.81416400", +"Precise": "1", +"Callsign": "NA7A", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "0", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "Yes", +"YSF DG ID Uplink": "00", +"YSF DG IS Downlink": "00", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-12-19" +}, { +"State ID": "41", +"Rptr ID": "16116", +"Frequency": "146.68000", +"Input Freq": "146.08000", +"PL": "162.2", +"TSQ": "", +"Nearest City": "Fossil", +"Landmark": "Snowboard Ridge", +"County": "Wheeler", +"State": "Oregon", +"Country": "United States", +"Lat": "44.99819946", +"Long": "-120.21600342", +"Precise": "0", +"Callsign": "KG7CXO", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2021-01-17" +}, { +"State ID": "41", +"Rptr ID": "23", +"Frequency": "145.47000", +"Input Freq": "144.87000", +"PL": "107.2", +"TSQ": "107.2", +"Nearest City": "Sherwood", +"Landmark": "", +"County": "Yamhill", +"State": "Oregon", +"Country": "United States", +"Lat": "45.35649872", +"Long": "-122.83999634", +"Precise": "0", +"Callsign": "KR7IS", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "Yes", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "", +"IRLP Node": "", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2021-06-23" +}, { +"State ID": "41", +"Rptr ID": "25", +"Frequency": "146.92000", +"Input Freq": "146.32000", +"PL": "100.0", +"TSQ": "100.0", +"Nearest City": "Sherwood", +"Landmark": "Parrett Mountain", +"County": "Yamhill", +"State": "Oregon", +"Country": "United States", +"Lat": "45.30914900", +"Long": "-122.88458600", +"Precise": "1", +"Callsign": "AH6LE", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "Yes", +"RACES": "Yes", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "303161", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "Node is accessible via the entire AH6LE Repeater System.", +"Last Update": "2022-11-18" +}, { +"State ID": "41", +"Rptr ID": "37", +"Frequency": "442.67500", +"Input Freq": "447.67500", +"PL": "100.0", +"TSQ": "100.0", +"Nearest City": "Newberg", +"Landmark": "Chehelam Ridge", +"County": "Yamhill", +"State": "Oregon", +"Country": "United States", +"Lat": "45.33926100", +"Long": "-122.91595300", +"Precise": "1", +"Callsign": "AH6LE", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "Yes", +"RACES": "Yes", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "303161", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "Node is accessible via the entire AH6LE Repeater System.", +"Last Update": "2022-07-09" +}, { +"State ID": "41", +"Rptr ID": "40", +"Frequency": "443.42500", +"Input Freq": "448.42500", +"PL": "107.2", +"TSQ": "", +"Nearest City": "Sherwood", +"Landmark": "", +"County": "Yamhill", +"State": "Oregon", +"Country": "United States", +"Lat": "45.35649872", +"Long": "-122.83999634", +"Precise": "0", +"Callsign": "KR7IS", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "", +"IRLP Node": "", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "839'.", +"Last Update": "2022-01-12" +}, { +"State ID": "41", +"Rptr ID": "84", +"Frequency": "442.55000", +"Input Freq": "447.55000", +"PL": "114.8", +"TSQ": "", +"Nearest City": "Newberg", +"Landmark": "Bald Peak", +"County": "Yamhill", +"State": "Oregon", +"Country": "United States", +"Lat": "45.29999924", +"Long": "-122.98000336", +"Precise": "0", +"Callsign": "WA7RGO", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "", +"IRLP Node": "", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-01-12" +}, { +"State ID": "41", +"Rptr ID": "112", +"Frequency": "1291.50000", +"Input Freq": "1271.50000", +"PL": "", +"TSQ": "", +"Nearest City": "Laurelwood", +"Landmark": "Bald Peak", +"County": "Yamhill", +"State": "Oregon", +"Country": "United States", +"Lat": "45.39599991", +"Long": "-123.05599976", +"Precise": "1", +"Callsign": "K7AUO", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "There is not Repeater Record Custodian (RRC) assigned to this repeater. Please ask WA3RMX -- THOMAS C. HILL, III -- TRUSTEE to Register with RepeaterBook.com so that he (and others of his choice) can be assigned as such. ", +"Last Update": "2021-06-24" +}, { +"State ID": "41", +"Rptr ID": "117", +"Frequency": "146.90000", +"Input Freq": "146.30000", +"PL": "127.3", +"TSQ": "127.3", +"Nearest City": "Newberg", +"Landmark": "Chehalem Mountain", +"County": "Yamhill", +"State": "Oregon", +"Country": "United States", +"Lat": "45.37620163", +"Long": "-123.03700256", +"Precise": "1", +"Callsign": "K7WWG", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "Yes", +"RACES": "Yes", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "", +"IRLP Node": "", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2021-06-23" +}, { +"State ID": "41", +"Rptr ID": "122", +"Frequency": "224.06000", +"Input Freq": "222.46000", +"PL": "107.2", +"TSQ": "", +"Nearest City": "Newberg", +"Landmark": "", +"County": "Yamhill", +"State": "Oregon", +"Country": "United States", +"Lat": "45.35670090", +"Long": "-122.83899689", +"Precise": "0", +"Callsign": "KR7IS", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "0", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2021-02-19" +}, { +"State ID": "41", +"Rptr ID": "135", +"Frequency": "443.65000", +"Input Freq": "448.65000", +"PL": "100.0", +"TSQ": "", +"Nearest City": "Laurelwood", +"Landmark": "Bald Peak", +"County": "Yamhill", +"State": "Oregon", +"Country": "United States", +"Lat": "45.39599991", +"Long": "-123.05599976", +"Precise": "1", +"Callsign": "K7AUO", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "There is no Repeater Record Custodian (RRC) assigned to this repeater. Please ask WA3RMX -- THOMAS C. HILL, III -- TRUSTEE to register with RepeaterBoook.com so that he (and others he so chooses) can be assigned as such. ", +"Last Update": "2022-01-12" +}, { +"State ID": "41", +"Rptr ID": "425", +"Frequency": "145.11000", +"Input Freq": "144.51000", +"PL": "103.5", +"TSQ": "", +"Nearest City": "Newberg", +"Landmark": "Chehalem Mountain", +"County": "Yamhill", +"State": "Oregon", +"Country": "United States", +"Lat": "45.37620163", +"Long": "-123.03700256", +"Precise": "1", +"Callsign": "KB7PSM", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "PL not required.", +"Last Update": "2022-11-18" +}, { +"State ID": "41", +"Rptr ID": "428", +"Frequency": "146.64000", +"Input Freq": "146.04000", +"PL": "100.0", +"TSQ": "", +"Nearest City": "McMinnville", +"Landmark": "Eola Hills", +"County": "Yamhill", +"State": "Oregon", +"Country": "United States", +"Lat": "45.07540131", +"Long": "-123.12400055", +"Precise": "1", +"Callsign": "W7RXJ", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "Yes", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "576557", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-12-06" +}, { +"State ID": "41", +"Rptr ID": "431", +"Frequency": "441.80000", +"Input Freq": "446.80000", +"PL": "114.8", +"TSQ": "", +"Nearest City": "McMinnville", +"Landmark": "Eola Hill", +"County": "Yamhill", +"State": "Oregon", +"Country": "United States", +"Lat": "45.09960175", +"Long": "-123.14700317", +"Precise": "1", +"Callsign": "W7YAM", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "Yes", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "", +"IRLP Node": "", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-04-05" +}, { +"State ID": "41", +"Rptr ID": "474", +"Frequency": "52.83000", +"Input Freq": "51.13000", +"PL": "107.2", +"TSQ": "107.2", +"Nearest City": "Newberg", +"Landmark": "", +"County": "Yamhill", +"State": "Oregon", +"Country": "United States", +"Lat": "45.30009842", +"Long": "-122.97299957", +"Precise": "0", +"Callsign": "KR7IS", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "", +"IRLP Node": "", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2021-06-22" +}, { +"State ID": "41", +"Rptr ID": "664", +"Frequency": "224.56000", +"Input Freq": "222.96000", +"PL": "100.0", +"TSQ": "", +"Nearest City": "Sheridan", +"Landmark": "", +"County": "Yamhill", +"State": "Oregon", +"Country": "United States", +"Lat": "45.09700012", +"Long": "-123.39499664", +"Precise": "0", +"Callsign": "AC7ZQ", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "", +"IRLP Node": "", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2019-05-05" +}, { +"State ID": "41", +"Rptr ID": "15506", +"Frequency": "444.48750", +"Input Freq": "449.48750", +"PL": "", +"TSQ": "", +"Nearest City": "Newberg", +"Landmark": "", +"County": "Yamhill", +"State": "Oregon", +"Country": "United States", +"Lat": "45.30009842", +"Long": "-122.97299957", +"Precise": "0", +"Callsign": "N7MAQ", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "", +"IRLP Node": "", +"Wires Node": "", +"FM Analog": "No", +"DMR": "Yes", +"DMR Color Code": "1", +"DMR ID": "314110", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "On air, but not on network at this time.", +"Last Update": "2020-04-11" +}, { +"State ID": "41", +"Rptr ID": "18772", +"Frequency": "52.89000", +"Input Freq": "51.19000", +"PL": "156.7", +"TSQ": "", +"Nearest City": "Newberg", +"Landmark": "", +"County": "Yamhill", +"State": "Oregon", +"Country": "United States", +"Lat": "45.30642580", +"Long": "-122.94694630", +"Precise": "0", +"Callsign": "N7MAQ", +"Use": "OPEN", +"Operational Status": "Unknown", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "0", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2020-05-12" +}, { +"State ID": "41", +"Rptr ID": "18794", +"Frequency": "926.26250", +"Input Freq": "916.26250", +"PL": "", +"TSQ": "", +"Nearest City": "Newberg", +"Landmark": "", +"County": "Yamhill", +"State": "Oregon", +"Country": "United States", +"Lat": "45.30642580", +"Long": "-122.94694630", +"Precise": "0", +"Callsign": "WA7SUP", +"Use": "OPEN", +"Operational Status": "Unknown", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "", +"EchoLink Node": "0", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2020-05-13" +}, { +"State ID": "41", +"Rptr ID": "18994", +"Frequency": "145.21000", +"Input Freq": "144.61000", +"PL": "110.9", +"TSQ": "", +"Nearest City": "Amity", +"Landmark": "Eola Hill", +"County": "Yamhill", +"State": "Oregon", +"Country": "United States", +"Lat": "45.09766580", +"Long": "-123.14510480", +"Precise": "0", +"Callsign": "W1ARK", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "0", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2021-09-12" +}, { +"State ID": "41", +"Rptr ID": "20969", +"Frequency": "224.20000", +"Input Freq": "222.60000", +"PL": "100.0", +"TSQ": "", +"Nearest City": "Carlton", +"Landmark": "", +"County": "Yamhill", +"State": "Oregon", +"Country": "United States", +"Lat": "45.29419730", +"Long": "-123.17701830", +"Precise": "0", +"Callsign": "K7JCN", +"Use": "OPEN", +"Operational Status": "On-air", +"ARES": "No", +"RACES": "No", +"SKYWARN": "No", +"CANWARN": "No", +"AllStar Node": "0", +"EchoLink Node": "0", +"IRLP Node": "0", +"Wires Node": "", +"FM Analog": "Yes", +"DMR": "No", +"DMR Color Code": "", +"DMR ID": "", +"D-Star": "No", +"NXDN": "No", +"APCO P-25": "No", +"P-25 NAC": "", +"M17": "No", +"M17 CAN": "", +"Tetra": "No", +"Tetra MCC": "", +"Tetra MNC": "", +"System Fusion": "No", +"YSF DG ID Uplink": "", +"YSF DG IS Downlink": "", +"YSF DSC": "", +"Notes": "", +"Last Update": "2022-07-18" +}, { +}]} diff --git a/tests/unit/test_alinco_clone.py b/tests/unit/test_alinco_clone.py new file mode 100644 index 0000000..5df6bcc --- /dev/null +++ b/tests/unit/test_alinco_clone.py @@ -0,0 +1,152 @@ +# Copyright 2022 Dan Smith +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +import binascii +import os +import unittest +from unittest import mock + +from chirp import directory +from chirp.drivers import alinco +from chirp import memmap + + +class FakeAlincoSerial: + """Behaves like a Serial with an Alinco radio connected""" + + def __init__(self, image): + self.image = memmap.MemoryMapBytes(open(image, 'rb').read()) + self.readbuf = [] + self.ident = b'' + + def zero(self): + """Zero the mmap before an upload""" + self.image = memmap.MemoryMapBytes(b'\x00' * len(self.image)) + + def _handle_rw(self, data): + if b'R' in data: + cmdindex = data.index(b'R') + elif b'W' in data: + cmdindex = data.index(b'W') + else: + raise Exception('Unable to handle RW command %r' % data) + if cmdindex - 4 == 4: + block_size = 16 + else: + block_size = 64 + addr = int(data[4:cmdindex], 16) + cmd = data[cmdindex:cmdindex + 1] + if cmd == b'R': + chunk = binascii.hexlify(self.image[addr:addr + block_size]) + if b'DJ175' in self.ident: + # The DJ175 uses 16-byte blocks, but without the colon + # separator + self.readbuf.append(b'%s\r\n' % chunk) + elif block_size == 64: + self.readbuf.append(b'\r\n%s\r\n' % chunk) + else: + self.readbuf.append(b'\r\n%04X:%s\r\n' % (addr, chunk)) + elif cmd == b'W': + chunk = binascii.unhexlify(data[cmdindex + 1:].rstrip()) + if len(chunk) != block_size: + raise Exception('Expected %i, got %i' % (block_size, + len(chunk))) + self.image[addr] = chunk + if block_size == 64: + self.readbuf.append(b'OK\r\n\r\n') + else: + raise Exception('Unable to handle command %s: %r' % (cmd, data)) + + def write(self, data): + """Write to the radio (i.e. buffer some response for read)""" + # Serial port echo + self.readbuf.append(data) + + ident_ack = b'OK\r\n\r\n' + + if data.startswith(b'DR'): + self.ident = data.strip() + self.readbuf.append(ident_ack) + elif data.startswith(b'AL~DJ-G7'): + self.ident = data.strip() + self.readbuf.append(ident_ack) + elif data.startswith(b'DJ'): + self.ident = data.strip() + self.readbuf.append(ident_ack) + elif data.startswith(b'AL~F'): + self._handle_rw(data) + elif data.startswith(b'AL~E'): + self.readbuf.append(b'OK' * 10) + else: + raise Exception('Unable to handle %r' % data) + + def read(self, length): + """Read from the radio (i.e. generate a radio's response)""" + if len(self.readbuf[0]) == length: + return self.readbuf.pop(0) + else: + raise Exception('Read of %i not match %i %r' % ( + length, len(self.readbuf[0]), self.readbuf[0])) + + +class AlincoCloneTest(unittest.TestCase): + def _test_alinco_download(self, rclass, image): + pipe = FakeAlincoSerial(image) + radio = rclass(pipe) + radio.sync_in() + if not radio.NEEDS_COMPAT_SERIAL: + self.assertIsInstance(radio._mmap, memmap.MemoryMapBytes) + + def _test_alinco_upload(self, rclass, image): + pipe = FakeAlincoSerial(image) + pipe.zero() + radio = rclass(image) + radio.pipe = pipe + radio.sync_out() + ref_image = open(image, 'rb').read() + self.assertEqual(ref_image[0x200:rclass._memsize], + pipe.image.get_packed()[0x200:rclass._memsize]) + + def _test_alinco(self, rclass): + ident = directory.radio_class_id(rclass) + image = os.path.join(os.path.dirname(__file__), + '..', 'images', + '%s.img' % ident) + with mock.patch('time.sleep'): + self._test_alinco_upload(rclass, image) + self._test_alinco_download(rclass, image) + + def test_djg7(self): + self._test_alinco(alinco.AlincoDJG7EG) + + def test_dr235(self): + self._test_alinco(alinco.DR235Radio) + + def test_dj175(self): + # The 175 has a slightly different download string, so test it + # specifically + self._test_alinco(alinco.DJ175Radio) + + def test_all_alinco_identify(self): + # Make sure all the alinco models have bytes for their _model + # and can identify properly + alincos = [x for x in directory.DRV_TO_RADIO.values() + if x.VENDOR == 'Alinco'] + for rclass in alincos: + pipe = FakeAlincoSerial(__file__) + radio = rclass(None) + radio.pipe = pipe + radio._identify() + self.assertEqual(pipe.ident, radio._model) diff --git a/tests/unit/test_bandplan.py b/tests/unit/test_bandplan.py new file mode 100644 index 0000000..c6fd920 --- /dev/null +++ b/tests/unit/test_bandplan.py @@ -0,0 +1,33 @@ +import unittest + +from chirp import bandplan + + +class FakeConfig: + def __init__(self, bandplan): + self.bandplan = bandplan + + def is_defined(self, opt, sec): + return True + + def get(self, opt, sec): + return None + + def get_bool(self, opt, sec): + return opt == self.bandplan + + +class BandPlanTest(unittest.TestCase): + def test_get_repeater_bands(self): + plans = bandplan.BandPlans(FakeConfig('north_america')) + expected = ['10 Meter Band', + '6 Meter Band', + '2 Meter Band', + '1.25 Meter Band', + '70 Centimeter Band', + '33 Centimeter Band', + '23 Centimeter Band', + '13 Centimeter Band'] + + self.assertEqual(expected, + [b.name for b in plans.get_repeater_bands()]) diff --git a/tests/unit/test_baofeng_fmradio.py b/tests/unit/test_baofeng_fmradio.py new file mode 100644 index 0000000..bea3ccf --- /dev/null +++ b/tests/unit/test_baofeng_fmradio.py @@ -0,0 +1,165 @@ +import os +import struct + +import pytest + +from tests.unit import base +from chirp.drivers import bf_t1 +from chirp.drivers import uv5r +from chirp import settings + + +class FMRadioTest(base.BaseTest): + IMAGE = None + RADIO_CLASS = None + MEMOBJ = 'element' + SETTINGS_INDEX = (0, 'element') + + def setUp(self): + if self.IMAGE is None: + self.skipTest('Base test') + + img = os.path.join(os.path.dirname(__file__), + '..', 'images', self.IMAGE) + self.radio = self.RADIO_CLASS(img) + + return super().setUp() + + def set_fmvfo_raw(self, value): + """Set FM VFO as integer directly in memory""" + val_bytes = struct.pack('>H', value) + obj = self.radio._memobj + for element in self.MEMOBJ.split('.'): + obj = getattr(obj, element) + obj.set_raw(val_bytes) + + def get_fmvfo_raw(self): + """Get FM VFO as integer directly from memory""" + obj = self.radio._memobj + for element in self.MEMOBJ.split('.'): + obj = getattr(obj, element) + return int(obj) + + def check_fmvfo(self, expected): + """Check FM VFO from settings + + expected should be something like 106.1 + """ + settings = self.radio.get_settings() + index, name = self.SETTINGS_INDEX + vfo = settings[index][name] + self.assertEqual(expected, float(vfo.value)) + + def set_fmvfo(self, value): + """Set FM VFO via settings + + value is a float like 106.1 + """ + index, name = self.SETTINGS_INDEX + settings = self.radio.get_settings() + vfo = settings[index][name] + vfo.value = value + self.radio.set_settings(settings) + + def test_get_original(self): + # 100.0 in original form would be: + # 100.0 - 65 = 35.0 * 10 = 350 = 0x015E + + # Set it directly in our memory in old format + self.set_fmvfo_raw(0x015E) + + # Make sure we get the expected value from settings + self.check_fmvfo(100.0) + + def test_set_original(self): + # Set it via settings + self.set_fmvfo(106.1) + + # Make sure it's the expected value in memory, old format, since our + # test image was in old format + self.assertEqual(0x019B, self.get_fmvfo_raw()) + + # Make sure we still get it back from settings as expected + self.check_fmvfo(106.1) + + def test_get_2022(self): + # 100.0 in original form would be: + # 100.0 - 65 = 35.0 * 10 = 350 = 0x015E + # New form is byte-swapped: 0x5E01 + + # Set it directly in our memory in new format + self.set_fmvfo_raw(0x5E01) + + # Make sure we get the expected value from settings + self.check_fmvfo(100.0) + + def test_set_2022(self): + # First set it in new format directly to 100.0 + self.set_fmvfo_raw(0x5E01) + + # Make sure we see it via settings as expected + self.check_fmvfo(100.0) + + # Now set it via settings to a new value + self.set_fmvfo(106.1) + + # Make sure it is in new form in the memory + self.assertEqual(0x9B01, self.get_fmvfo_raw()) + + # Make sure it is returned properly in settings + self.check_fmvfo(106.1) + + def _test_edges(self, new=True): + """Test the edges around the supported range. + + Make sure that we don't confuse old and new values on either side of + the supported range as the wrong format. + """ + if new: + default = 0x5E01 + else: + default = 0x015E + for dial in range(50, 500, 10): + if 65 <= dial <= 108: + self.set_fmvfo(dial) + self.check_fmvfo(dial) + else: + # Set this to a good default value so that we can set via + # settings below. + self.set_fmvfo_raw(default) + + # We should not be able to set this out-of-range value + self.assertRaises(settings.InvalidValueError, + self.set_fmvfo, dial) + + # Can't physically set this in memory + if dial <= 65: + continue + + # Set it anyway in memory directly + self.set_fmvfo_raw(int((dial - 65) * 10)) + + # Make sure we do not interpret it incorrectly + self.assertRaises(KeyError, + self.check_fmvfo, dial) + + def test_edges_original(self): + self._test_edges(False) + + def test_edges_2022(self): + self._test_edges(True) + + +class TestBFT1(FMRadioTest): + IMAGE = 'Baofeng_BF-T1.img' + RADIO_CLASS = bf_t1.BFT1 + SETTINGS_INDEX = (1, 'fm_vfo') + MEMOBJ = 'settings.fm_vfo' + + +@pytest.mark.skip('This radio needs fixing') +class TestUV5R(FMRadioTest): + IMAGE = 'Baofeng_UV-5R.img' + RADIO_CLASS = uv5r.BaofengUV5R + SETTINGS_INDEX = (3, 'fm_presets') + MEMOBJ = 'fm_presets' diff --git a/tests/unit/test_bitwise.py b/tests/unit/test_bitwise.py index 2b674e8..969622f 100644 --- a/tests/unit/test_bitwise.py +++ b/tests/unit/test_bitwise.py @@ -15,7 +15,6 @@ from builtins import bytes -import struct import unittest import six @@ -98,14 +97,6 @@ class TestBitwiseBaseIntTypes(BaseTest): obj.foo[i] = i * 2 self.assertEqual(b'\x00\x02\x04\x06', data.get_packed()) - def test_int_array(self): - data = memmap.MemoryMapBytes(bytes(b'\x00\x01\x02\x03')) - obj = bitwise.parse('u8 foo[4];', data) - for i in range(4): - self.assertEqual(i, obj.foo[i]) - obj.foo[i] = i * 2 - self.assertEqual(b'\x00\x02\x04\x06', data.get_packed()) - class TestBitfieldTypes(BaseTest): def test_bitfield_u8(self): diff --git a/tests/unit/test_chirp_common.py b/tests/unit/test_chirp_common.py index 400c469..30da2c7 100644 --- a/tests/unit/test_chirp_common.py +++ b/tests/unit/test_chirp_common.py @@ -1,14 +1,18 @@ import base64 +import copy import json import os +import pickle import tempfile -import mock +from unittest import mock from tests.unit import base from chirp import CHIRP_VERSION from chirp import chirp_common +from chirp import directory from chirp import errors +from chirp import settings class TestUtilityFunctions(base.BaseTest): @@ -74,6 +78,215 @@ class TestUtilityFunctions(base.BaseTest): self.assertEqual(140, chirp_common.from_MHz(14000001)) self.assertEqual(140, chirp_common.from_kHz(14001)) + def test_mem_from_text_rb1(self): + text = '145.2500 -0.6 MHz 97.4 OPEN' + mem = chirp_common.mem_from_text(text) + self.assertIsNotNone(mem) + self.assertEqual(145250000, mem.freq) + self.assertEqual(600000, mem.offset) + self.assertEqual('-', mem.duplex) + self.assertEqual('Tone', mem.tmode) + self.assertEqual(97.4, mem.rtone) + + def test_mem_from_text_rb2(self): + text = '147.3000 +0.6 MHz 156.7 / 156.7 OPEN' + mem = chirp_common.mem_from_text(text) + self.assertIsNotNone(mem) + self.assertEqual(147300000, mem.freq) + self.assertEqual(600000, mem.offset) + self.assertEqual('+', mem.duplex) + self.assertEqual('TSQL', mem.tmode) + self.assertEqual(156.7, mem.ctone) + + def test_mem_from_text_rb3(self): + text = '441.1000 +5 MHz D125 / D125 OPEN' + mem = chirp_common.mem_from_text(text) + self.assertIsNotNone(mem) + self.assertEqual(441100000, mem.freq) + self.assertEqual(5000000, mem.offset) + self.assertEqual('+', mem.duplex) + self.assertEqual('DTCS', mem.tmode) + self.assertEqual(125, mem.dtcs) + + def test_mem_from_text_rb4(self): + text = '441.1000 +5 MHz 88.5 / D125 OPEN' + mem = chirp_common.mem_from_text(text) + self.assertIsNotNone(mem) + self.assertEqual(441100000, mem.freq) + self.assertEqual(5000000, mem.offset) + self.assertEqual('+', mem.duplex) + self.assertEqual('Cross', mem.tmode) + self.assertEqual(88.5, mem.rtone) + self.assertEqual(125, mem.rx_dtcs) + self.assertEqual('Tone->DTCS', mem.cross_mode) + + def test_mem_from_text_random1(self): + text = 'Glass Butte 147.200 + 162.2' + mem = chirp_common.mem_from_text(text) + self.assertIsNotNone(mem) + self.assertEqual(147200000, mem.freq) + # This is a default + self.assertEqual(600000, mem.offset) + # Just a random + or - on the line isn't enough to trigger offset + # pattern + self.assertEqual('+', mem.duplex) + self.assertEqual('Tone', mem.tmode) + self.assertEqual(162.2, mem.rtone) + + def test_mem_from_text_random2(self): + text = 'Glass - Butte 147.200 + 162.2' + mem = chirp_common.mem_from_text(text) + self.assertIsNotNone(mem) + self.assertEqual(147200000, mem.freq) + # This is a default + self.assertEqual(600000, mem.offset) + # Just a random + or - on the line isn't enough to trigger offset + # pattern + self.assertEqual('+', mem.duplex) + self.assertEqual('Tone', mem.tmode) + self.assertEqual(162.2, mem.rtone) + + def test_mem_from_text_random3(self): + text = 'Glass - Butte 147.200 + 88.5' + mem = chirp_common.mem_from_text(text) + self.assertIsNotNone(mem) + self.assertEqual(147200000, mem.freq) + # This is a default + self.assertEqual(600000, mem.offset) + # Just a random + or - on the line isn't enough to trigger offset + # pattern + self.assertEqual('+', mem.duplex) + self.assertEqual('Tone', mem.tmode) + self.assertEqual(88.5, mem.rtone) + + def test_mem_from_text_random4(self): + text = '146.640 | 146.040 | 136.5' + mem = chirp_common.mem_from_text(text) + self.assertIsNotNone(mem) + self.assertEqual(146640000, mem.freq) + self.assertEqual(600000, mem.offset) + self.assertEqual('-', mem.duplex) + self.assertEqual('Tone', mem.tmode) + self.assertEqual(136.5, mem.rtone) + + def test_mem_from_text_chirp1(self): + text = '[400.625000/136.000000]' + chirp_common.mem_from_text(text) + + def test_mem_from_text_chirp2(self): + text = '[462.675000/+5.000/136.5/136.5]' + mem = chirp_common.mem_from_text(text) + self.assertEqual(462675000, mem.freq) + self.assertEqual('+', mem.duplex) + self.assertEqual(5000000, mem.offset) + + def test_mem_from_text_chirp3(self): + text = '[1.675000/1.685/136.5/136.5]' + mem = chirp_common.mem_from_text(text) + self.assertEqual(1675000, mem.freq) + self.assertEqual('+', mem.duplex) + self.assertEqual(10000, mem.offset) + + def test_mem_from_text_chirp4(self): + text = '[450.000000/150.000000]' + mem = chirp_common.mem_from_text(text) + self.assertEqual(450000000, mem.freq) + self.assertEqual(150000000, mem.offset) + self.assertEqual('split', mem.duplex) + + def test_mem_from_text_chirp5(self): + text = '[500.000000/-9.900]' + mem = chirp_common.mem_from_text(text) + self.assertEqual(500000000, mem.freq) + self.assertEqual(9900000, mem.offset) + self.assertEqual('-', mem.duplex) + self.assertEqual(text, chirp_common.mem_to_text(mem)) + + def test_mem_from_text_chirp6(self): + text = '[450.000000/150.000]' + mem = chirp_common.mem_from_text(text) + self.assertEqual(450000000, mem.freq) + self.assertEqual(150000000, mem.offset) + self.assertEqual('split', mem.duplex) + + def test_mem_from_text_chirp7(self): + # Offsets >= 10MHz are not allowed, so this will get + # parsed as a tx frequency of 15MHz + text = '[450.000000/+15.000]' + mem = chirp_common.mem_from_text(text) + self.assertEqual(450000000, mem.freq) + self.assertEqual(15000000, mem.offset) + self.assertEqual('split', mem.duplex) + + def test_mem_from_text_chirp8(self): + # Offsets >= 10MHz are not allowed, so this will get + # parsed as a tx frequency of 15MHz + text = '[450.000000/+150.000]' + mem = chirp_common.mem_from_text(text) + self.assertEqual(450000000, mem.freq) + self.assertEqual(150000000, mem.offset) + self.assertEqual('split', mem.duplex) + + def test_mem_to_text1(self): + mem = chirp_common.Memory() + mem.freq = 146900000 + mem.duplex = '-' + mem.offset = 600000 + mem.tmode = 'TSQL' + mem.ctone = 100.0 + txt = chirp_common.mem_to_text(mem) + self.assertEqual('[146.900000/-0.600/100.0/100.0]', txt) + chirp_common.mem_from_text(txt) + self.assertEqual(600000, mem.offset) + self.assertEqual('-', mem.duplex) + + def test_mem_to_text2(self): + mem = chirp_common.Memory() + mem.freq = 146900000 + mem.duplex = 'split' + mem.offset = 446000000 + mem.tmode = 'Cross' + mem.cross_mode = 'Tone->DTCS' + mem.rtone = 100.0 + mem.rx_dtcs = 25 + txt = chirp_common.mem_to_text(mem) + self.assertEqual('[146.900000/446.000000/100.0/D025]', txt) + chirp_common.mem_from_text(txt) + + def test_mem_to_text3(self): + mem = chirp_common.Memory() + mem.freq = 146520000 + mem.duplex = '' + mem.offset = 600000 + mem.tmode = 'DTCS' + mem.dtcs = 25 + txt = chirp_common.mem_to_text(mem) + self.assertEqual('[146.520000/D025/D025]', txt) + chirp_common.mem_from_text(txt) + + def test_parse_power(self): + valid = [ + ('0.1', 0.1), + ('0.1W', 0.1), + ('0.25', 0.2), + ('0.25W', 0.2), + ('11.0', 11), + ('11', 11), + ('11.0W', 11), + ('11w', 11), + ('1500', 1500), + ('2500', 2500), + ('2500W', 2500), + ('2500.0W', 2500)] + for s, v in valid: + power = chirp_common.parse_power(s) + self.assertEqual(v, chirp_common.dBm_to_watts(float(power))) + + def test_parse_power_invalid(self): + invalid = ['2500d', '2d1', 'aaa', 'a', ''] + for s in invalid: + self.assertRaises(ValueError, chirp_common.parse_power, s) + class TestSplitTone(base.BaseTest): def _test_split_tone_decode(self, tx, rx, **vals): @@ -263,6 +476,33 @@ class TestStepFunctions(base.BaseTest): for freq in freqs: self.assertEqual(step, chirp_common.required_step(freq)) + def test_required_step_with_list(self): + steps = {5.0: self._005, + 6.25: self._625, + 12.5: self._125, + } + allowed = [6.25, 12.5] + for step, freqs in list(steps.items()): + for freq in freqs: + # We don't support 5.0, so any of the frequencies in that + # list should raise an error + if step == 5.0: + self.assertRaises(errors.InvalidDataError, + chirp_common.required_step, + freq, allowed) + else: + self.assertEqual(step, chirp_common.required_step( + freq, allowed)) + + def test_required_step_finds_suitable(self): + # If we support 5.0, we should get it as the step for those + self.assertEqual(5.0, chirp_common.required_step(self._005[0], + allowed=[2.5, 5.0])) + # If we support 2.5 and not 5.0, then we should find 2.5 as a suitable + # alternative + self.assertEqual(2.5, chirp_common.required_step(self._005[0], + allowed=[2.5])) + def test_required_step_fail(self): self.assertRaises(errors.InvalidDataError, chirp_common.required_step, @@ -283,12 +523,17 @@ class TestStepFunctions(base.BaseTest): class TestImageMetadata(base.BaseTest): def test_make_metadata(self): - class TestRadio(chirp_common.FileBackedRadio): + class TestRadio(chirp_common.CloneModeRadio): VENDOR = 'Dan' MODEL = 'Foomaster 9000' VARIANT = 'R' - raw_metadata = TestRadio._make_metadata() + r = TestRadio(None) + r._metadata['someextra'] = 'foo' + # We should always take the base properties from the class, so this + # should not show up in the result. + r._metadata['vendor'] = 'oops' + raw_metadata = r._make_metadata() metadata = json.loads(base64.b64decode(raw_metadata).decode()) expected = { 'vendor': 'Dan', @@ -296,58 +541,65 @@ class TestImageMetadata(base.BaseTest): 'variant': 'R', 'rclass': 'TestRadio', 'chirp_version': CHIRP_VERSION, + 'someextra': 'foo', } self.assertEqual(expected, metadata) def test_strip_metadata(self): - class TestRadio(chirp_common.FileBackedRadio): + class TestRadio(chirp_common.CloneModeRadio): VENDOR = 'Dan' MODEL = 'Foomaster 9000' VARIANT = 'R' - raw_metadata = TestRadio._make_metadata() + r = TestRadio(None) + r._metadata['someextra'] = 'foo' + raw_metadata = r._make_metadata() raw_data = (b'foooooooooooooooooooooo' + TestRadio.MAGIC + - TestRadio._make_metadata()) - data, metadata = chirp_common.FileBackedRadio._strip_metadata(raw_data) + raw_metadata) + data, metadata = chirp_common.CloneModeRadio._strip_metadata(raw_data) self.assertEqual(b'foooooooooooooooooooooo', data) expected = { 'vendor': 'Dan', 'model': 'Foomaster 9000', 'variant': 'R', 'rclass': 'TestRadio', + 'someextra': 'foo', 'chirp_version': CHIRP_VERSION, } self.assertEqual(expected, metadata) def test_load_mmap_no_metadata(self): - f = tempfile.NamedTemporaryFile() - f.write(b'thisisrawdata') - f.flush() + fn = os.path.join(tempfile.gettempdir(), 'testfile') + with open(fn, 'wb') as f: + f.write(b'thisisrawdata') + f.flush() with mock.patch('chirp.memmap.MemoryMap') as mock_mmap: - chirp_common.FileBackedRadio(None).load_mmap(f.name) + chirp_common.CloneModeRadio(None).load_mmap(fn) mock_mmap.assert_called_once_with(b'thisisrawdata') + os.remove(fn) def test_load_mmap_bad_metadata(self): - f = tempfile.NamedTemporaryFile() - f.write(b'thisisrawdata') - f.write(chirp_common.FileBackedRadio.MAGIC + b'bad') - f.flush() + fn = os.path.join(tempfile.gettempdir(), 'testfile') + with open(fn, 'wb') as f: + f.write(b'thisisrawdata') + f.write(chirp_common.CloneModeRadio.MAGIC + b'bad') + f.flush() with mock.patch('chirp.memmap.MemoryMap') as mock_mmap: - chirp_common.FileBackedRadio(None).load_mmap(f.name) + chirp_common.CloneModeRadio(None).load_mmap(fn) mock_mmap.assert_called_once_with(b'thisisrawdata') + os.remove(fn) def test_save_mmap_includes_metadata(self): # Make sure that a file saved with a .img extension includes # the metadata blob - class TestRadio(chirp_common.FileBackedRadio): + class TestRadio(chirp_common.CloneModeRadio): VENDOR = 'Dan' MODEL = 'Foomaster 9000' VARIANT = 'R' - with tempfile.NamedTemporaryFile(suffix='.Img') as f: - fn = f.name + fn = os.path.join(tempfile.gettempdir(), 'test.img') r = TestRadio(None) r._mmap = mock.Mock() r._mmap.get_byte_compatible.return_value.get_packed.return_value = ( @@ -356,7 +608,7 @@ class TestImageMetadata(base.BaseTest): with open(fn, 'rb') as f: filedata = f.read() os.remove(fn) - data, metadata = chirp_common.FileBackedRadio._strip_metadata(filedata) + data, metadata = chirp_common.CloneModeRadio._strip_metadata(filedata) self.assertEqual(b'thisisrawdata', data) expected = { 'vendor': 'Dan', @@ -370,7 +622,7 @@ class TestImageMetadata(base.BaseTest): def test_save_mmap_no_metadata_not_img_file(self): # Make sure that if we save without a .img extension we do # not include the metadata blob - class TestRadio(chirp_common.FileBackedRadio): + class TestRadio(chirp_common.CloneModeRadio): VENDOR = 'Dan' MODEL = 'Foomaster 9000' VARIANT = 'R' @@ -385,12 +637,12 @@ class TestImageMetadata(base.BaseTest): with open(fn, 'rb') as f: filedata = f.read() os.remove(fn) - data, metadata = chirp_common.FileBackedRadio._strip_metadata(filedata) + data, metadata = chirp_common.CloneModeRadio._strip_metadata(filedata) self.assertEqual(b'thisisrawdata', data) self.assertEqual({}, metadata) def test_load_mmap_saves_metadata_on_radio(self): - class TestRadio(chirp_common.FileBackedRadio): + class TestRadio(chirp_common.CloneModeRadio): VENDOR = 'Dan' MODEL = 'Foomaster 9000' VARIANT = 'R' @@ -413,3 +665,195 @@ class TestImageMetadata(base.BaseTest): 'chirp_version': CHIRP_VERSION, } self.assertEqual(expected, newr.metadata) + + def test_sub_devices_linked_metadata(self): + class FakeRadio(chirp_common.CloneModeRadio): + def get_sub_devices(self): + return [FakeRadioSub('a'), FakeRadioSub('b')] + + class FakeRadioSub(FakeRadio): + def __init__(self, name): + self.VARIANT = name + + r = FakeRadio(None) + subs = r.get_sub_devices() + r.link_device_metadata(subs) + subs[1]._metadata['foo'] = 'bar' + self.assertEqual({'a': {}, 'b': {'foo': 'bar'}}, r._metadata) + + +class FakeRadio(chirp_common.CloneModeRadio): + def __init__(self, *a, **k): + super().__init__(*a, **k) + self._mems = {} + + def get_memory(self, number): + return self._mems[number] + + def set_memory(self, mem): + # Simulate not storing the comment in our memory + mem = copy.deepcopy(mem) + mem.comment = '' + self._mems[mem.number] = mem + + +class TestCloneModeExtras(base.BaseTest): + def test_extra_comment(self): + r = FakeRadio(None) + m = chirp_common.Memory() + m.number = 0 + m.freq = 146520000 + m.comment = 'a comment' + r.set_memory(m) + # Make sure our fake driver didn't modify our copy + self.assertEqual('a comment', m.comment) + + m = r.get_memory(0) + self.assertEqual(146520000, m.freq) + # Before we call extra, we have no comment + self.assertEqual('', m.comment) + m = r.get_memory_extra(m) + # We haven't called set_extra, so still nothing + self.assertEqual('', m.comment) + + # Do a normal set, set_extra + m.comment = 'a comment' + r.set_memory(m) + r.set_memory_extra(m) + + # Do a get, get_extra + m = r.get_memory(0) + m = r.get_memory_extra(m) + self.assertEqual(146520000, m.freq) + # Now we should have the comment + self.assertEqual('a comment', m.comment) + + # Make sure it is in the metadata + self.assertIn('0000_comment', r.metadata['mem_extra']) + + # Erase the memory (only extra) and make sure we get no comment + r.erase_memory_extra(0) + + # Make sure it's gone from metadata + self.assertNotIn('0000_comment', r.metadata['mem_extra']) + + # Do a get, get_extra + m = r.get_memory(0) + m = r.get_memory_extra(m) + self.assertEqual(146520000, m.freq) + # Now we should have no comment because we erased + self.assertEqual('', m.comment) + + r.set_memory_extra(m) + + # Make sure we don't keep empty comments + self.assertNotIn('0000_comment', r.metadata['mem_extra']) + + +class TestOverrideRules(base.BaseTest): + # You should not need to add your radio to this list. If you think you do, + # please ask permission first. + IMMUTABLE_WHITELIST = [ + # Uncomment me when the time comes + 'Baofeng_GT-5R', + 'BTECH_GMRS-20V2', + 'BTECH_GMRS-50V2', + 'BTECH_GMRS-50X1', + 'BTECH_GMRS-V2', + 'BTECH_MURS-V2', + 'Radioddity_DB25-G', + 'Retevis_RB17P' + ] + + def _test_radio_override_immutable_policy(self, rclass): + self.assertEqual( + chirp_common.Radio.check_set_memory_immutable_policy, + rclass.check_set_memory_immutable_policy, + 'Radio %s should not override ' + 'check_set_memory_immutable_policy' % ( + directory.radio_class_id(rclass))) + + def _test_radio_override_calls_super(self, rclass): + r = rclass(None) + method = r.check_set_memory_immutable_policy + + # Make sure the radio actually overrides it + self.assertNotEqual( + chirp_common.Radio.check_set_memory_immutable_policy, + method, + ('Radio %s in whitelist does not override ' + 'check_set_memory_immutable_policy') % ( + directory.radio_class_id(rclass))) + + # Make sure super() is called in the child class + self.assertIn('__class__', method.__code__.co_freevars, + '%s.%s must call super() but does not' % ( + rclass.__name__, method.__name__)) + + def test_radio_overrides(self): + for rclass in directory.DRV_TO_RADIO.values(): + if directory.radio_class_id(rclass) in self.IMMUTABLE_WHITELIST: + self._test_radio_override_calls_super(rclass) + else: + self._test_radio_override_immutable_policy(rclass) + + +class TestMemory(base.BaseTest): + def test_pickle_with_extra(self): + m = chirp_common.Memory() + m.extra = settings.RadioSettingGroup('extra', 'extra') + m.extra.append(settings.RadioSetting( + 'test', 'test', + settings.RadioSettingValueString(1, 32, current='foo'))) + n = pickle.loads(pickle.dumps(m)) + self.assertEqual(str(n.extra['test'].value), + str(m.extra['test'].value)) + + def test_frozen_from_frozen(self): + m = chirp_common.FrozenMemory(chirp_common.Memory(123)) + n = chirp_common.FrozenMemory(m) + self.assertEqual(123, n.number) + + def test_frozen_dupe_unfrozen(self): + FrozenMemory = chirp_common.FrozenMemory( + chirp_common.Memory()).__class__ + m = chirp_common.FrozenMemory(chirp_common.Memory(123)).dupe() + self.assertNotIsInstance(m, FrozenMemory) + self.assertFalse(hasattr(m, '_frozen')) + + def test_tone_validator(self): + m = chirp_common.Memory() + # 100.0 is a valid tone + m.rtone = 100.0 + m.ctone = 100.0 + + # 100 is not (must be a float) + with self.assertRaises(ValueError): + m.rtone = 100 + with self.assertRaises(ValueError): + m.ctone = 100 + + # 30.0 and 300.0 are out of range + with self.assertRaises(ValueError): + m.rtone = 30.0 + with self.assertRaises(ValueError): + m.rtone = 300.0 + with self.assertRaises(ValueError): + m.ctone = 30.0 + with self.assertRaises(ValueError): + m.ctone = 300.0 + + +class TestRadioFeatures(base.BaseTest): + def test_valid_tones(self): + rf = chirp_common.RadioFeatures() + # These are valid tones + rf.valid_tones = [100.0, 107.2] + + # These contain invalid tones + with self.assertRaises(ValueError): + rf.valid_tones = [100.0, 30.0] + with self.assertRaises(ValueError): + rf.valid_tones = [100.0, 300.0] + with self.assertRaises(ValueError): + rf.valid_tones = [100, 107.2] diff --git a/tests/unit/test_cli.py b/tests/unit/test_cli.py new file mode 100644 index 0000000..f08845b --- /dev/null +++ b/tests/unit/test_cli.py @@ -0,0 +1,42 @@ +import os +import unittest +from unittest import mock + +from chirp.cli import main + + +class TestCLI(unittest.TestCase): + def setUp(self): + self.stdout_lines = [] + self.patches = [] + self.patches.append(mock.patch('sys.exit')) + self.patches.append(mock.patch.object(main, 'print', + new=self.fake_print)) + for patch in self.patches: + patch.start() + + # A path to an image file we can pass to the CLI for testing + self.testfile = os.path.join( + os.path.abspath( + os.path.join( + os.path.dirname(__file__), '..', 'images', + 'Icom_IC-2820H.img'))) + + def tearDown(self): + for patch in self.patches: + patch.stop() + + def fake_print(self, *a): + for i in a: + self.stdout_lines.append(str(i)) + + @property + def stdout(self): + return '\n'.join(self.stdout_lines) + + def test_cli_simple(self): + # Super simple, just print the first memory and make sure it + # works + args = ['--mmap', self.testfile, '--get-mem', 0] + main.main(args=args) + self.assertIn('147.56', self.stdout) diff --git a/tests/unit/test_csv.py b/tests/unit/test_csv.py new file mode 100644 index 0000000..68bbcb9 --- /dev/null +++ b/tests/unit/test_csv.py @@ -0,0 +1,170 @@ +import os +import tempfile +import unittest + +from chirp import chirp_common +from chirp.drivers import generic_csv + +CHIRP_CSV_LEGACY = ( + """Location,Name,Frequency,Duplex,Offset,Tone,rToneFreq,cToneFreq,DtcsCode,DtcsPolarity,Mode,TStep,Skip,Comment,URCALL,RPT1CALL,RPT2CALL +1,FRS 1,462.562500,,5.000000,,88.5,88.5,023,NN,NFM,12.50,,,,, +2,FRS 2,462.587500,,5.000000,,88.5,88.5,023,NN,NFM,12.50,,,,, +""") +CHIRP_CSV_MINIMAL = ( + """Location,Frequency +1,146.520 +2,446.000 +""") +CHIRP_CSV_MODERN = ( + """Location,Name,Frequency,Duplex,Offset,Tone,rToneFreq,cToneFreq,DtcsCode,DtcsPolarity,RxDtcsCode,CrossMode,Mode,TStep,Skip,Power,Comment,URCALL,RPT1CALL,RPT2CALL,DVCODE +0,Nat Simplex,146.520000,,0.600000,TSQL,88.5,88.5,023,NN,023,Tone->Tone,FM,5.00,,50W,This is the national calling frequency on 2m,,,, +1,National Simp,446.000000,-,5.000000,DTCS,88.5,88.5,023,NN,023,Tone->Tone,FM,5.00,,5.0W,This is NOT the UHF calling frequency,,,, +""") # noqa + + +class TestCSV(unittest.TestCase): + def setUp(self): + super().setUp() + self.testfn = tempfile.mktemp('.csv', 'chirp-test') + + def tearDown(self): + super().tearDown() + try: + os.remove(self.testfn) + except FileNotFoundError: + pass + + def test_parse_legacy(self): + with open(self.testfn, 'w', encoding='utf-8') as f: + f.write(CHIRP_CSV_LEGACY) + csv = generic_csv.CSVRadio(self.testfn) + mem = csv.get_memory(1) + self.assertEqual(1, mem.number) + self.assertEqual('FRS 1', mem.name) + self.assertEqual(462562500, mem.freq) + self.assertEqual('', mem.duplex) + self.assertEqual(5000000, mem.offset) + self.assertEqual('', mem.tmode) + self.assertEqual(88.5, mem.rtone) + self.assertEqual(88.5, mem.ctone) + self.assertEqual(23, mem.dtcs) + self.assertEqual('NN', mem.dtcs_polarity) + self.assertEqual('NFM', mem.mode) + self.assertEqual(12.5, mem.tuning_step) + + def test_parse_modern(self, output_encoding='utf-8'): + with open(self.testfn, 'w', encoding=output_encoding) as f: + f.write(CHIRP_CSV_MODERN) + csv = generic_csv.CSVRadio(self.testfn) + mem = csv.get_memory(1) + self.assertEqual(1, mem.number) + self.assertEqual('National Simp', mem.name) + self.assertEqual(446000000, mem.freq) + self.assertEqual('-', mem.duplex) + self.assertEqual(5000000, mem.offset) + self.assertEqual('DTCS', mem.tmode) + self.assertEqual(88.5, mem.rtone) + self.assertEqual(88.5, mem.ctone) + self.assertEqual(23, mem.dtcs) + self.assertEqual('NN', mem.dtcs_polarity) + self.assertEqual('FM', mem.mode) + self.assertEqual(5.0, mem.tuning_step) + self.assertEqual('5.0W', str(mem.power)) + self.assertIn('UHF calling', mem.comment) + + def test_parse_modern_bom(self): + self.test_parse_modern(output_encoding='utf-8-sig') + + def test_parse_minimal(self): + with open(self.testfn, 'w', encoding='utf-8') as f: + f.write(CHIRP_CSV_MINIMAL) + csv = generic_csv.CSVRadio(self.testfn) + mem = csv.get_memory(1) + self.assertEqual(1, mem.number) + self.assertEqual(146520000, mem.freq) + + def test_parse_unknown_field(self): + with open(self.testfn, 'w', encoding='utf-8') as f: + f.write('Location,Frequency,Color\n') + f.write('1,146.520,Red\n') + csv = generic_csv.CSVRadio(self.testfn) + mem = csv.get_memory(1) + self.assertEqual(1, mem.number) + self.assertEqual(146520000, mem.freq) + + def test_parse_unknown_power(self): + with open(self.testfn, 'w', encoding='utf-8') as f: + f.write('Location,Frequency,Power\n') + f.write('0,146.520,L1\n') + f.write('1,146.520,5W\n') + csv = generic_csv.CSVRadio(self.testfn) + mem = csv.get_memory(1) + self.assertEqual(1, mem.number) + self.assertEqual(146520000, mem.freq) + + def test_foreign_power(self): + csv = generic_csv.CSVRadio(None) + m = chirp_common.Memory() + m.number = 1 + m.freq = 146520000 + m.power = chirp_common.PowerLevel('Low', watts=17) + csv.set_memory(m) + m = csv.get_memory(1) + self.assertEqual('17W', str(m.power)) + self.assertEqual(int(chirp_common.watts_to_dBm(17)), int(m.power)) + + def test_default_power(self): + m = chirp_common.Memory() + m.number = 1 + m.freq = 146520000 + r = generic_csv.CSVRadio(None) + r.set_memory(m) + m2 = r.get_memory(1) + self.assertEqual(generic_csv.DEFAULT_POWER_LEVEL, m2.power) + + def _write_and_read(self, mem): + radio = generic_csv.CSVRadio(None) + radio.set_memory(mem) + radio.save(self.testfn) + radio = generic_csv.CSVRadio(self.testfn) + return radio.get_memory(mem.number) + + def test_escaped_string_chars(self): + m = chirp_common.Memory() + m.number = 1 + m.name = 'This is "The one"' + m.comment = 'Wow, a \nMulti-line comment!' + m2 = self._write_and_read(m) + self.assertEqual(m.name, m2.name) + self.assertEqual(m.comment, m2.comment) + + def test_unicode_comment_chars(self): + m = chirp_common.Memory() + m.number = 1 + m.name = 'This is "The one"' + m.comment = b'This is b\xc9\x90d news'.decode() + m2 = self._write_and_read(m) + self.assertEqual(m.name, m2.name) + self.assertEqual(m.comment, m2.comment) + + def test_cross_dtcs(self): + m = chirp_common.Memory() + m.number = 1 + m.tmode = 'Cross' + m.cross_mode = 'DTCS->DTCS' + m.dtcs = 25 + m.rx_dtcs = 73 + m2 = self._write_and_read(m) + self.assertEqual('Cross', m2.tmode) + self.assertEqual('DTCS->DTCS', m2.cross_mode) + self.assertEqual(25, m2.dtcs) + self.assertEqual(73, m2.rx_dtcs) + + def test_csv_memories_are_private(self): + m = chirp_common.Memory(name='foo') + radio = generic_csv.CSVRadio(None) + radio.set_memory(m) + # If CSVRadio maintains a reference to m, then this will modify + # its internal state and the following assertion will fail. + m.name = 'bar' + self.assertEqual('foo', radio.get_memory(0).name) diff --git a/tests/unit/test_directory.py b/tests/unit/test_directory.py index c447173..e60cb35 100644 --- a/tests/unit/test_directory.py +++ b/tests/unit/test_directory.py @@ -2,17 +2,23 @@ import base64 import glob import json import os +import shutil import tempfile +import yaml + from tests.unit import base from chirp import chirp_common from chirp import directory class TestDirectory(base.BaseTest): + def cleanUp(self): + shutil.rmtree(self.tempdir) + def setUp(self): super(TestDirectory, self).setUp() - + self.tempdir = tempfile.mkdtemp() directory.enable_reregistrations() class FakeAlias(chirp_common.Alias): @@ -21,7 +27,7 @@ class TestDirectory(base.BaseTest): VARIANT = 'A' @directory.register - class FakeRadio(chirp_common.FileBackedRadio): + class FakeRadio(chirp_common.CloneModeRadio): VENDOR = 'Dan' MODEL = 'Foomaster 9000' VARIANT = 'R' @@ -39,21 +45,24 @@ class TestDirectory(base.BaseTest): return radio def test_detect_with_no_metadata(self): - with tempfile.NamedTemporaryFile() as f: + fn = os.path.join(self.tempdir, 'testfile') + with open(fn, 'wb') as f: f.write(b'thisisrawdata') f.flush() - self._test_detect_finds_our_class(f.name) + self._test_detect_finds_our_class(fn) def test_detect_with_metadata_base_class(self): - with tempfile.NamedTemporaryFile() as f: + fn = os.path.join(self.tempdir, 'testfile') + with open(fn, 'wb') as f: f.write(b'thisisrawdata') f.write(self.test_class.MAGIC + b'-') - f.write(self.test_class._make_metadata()) + f.write(self.test_class(None)._make_metadata()) f.flush() - self._test_detect_finds_our_class(f.name) + self._test_detect_finds_our_class(fn) def test_detect_with_metadata_alias_class(self): - with tempfile.NamedTemporaryFile() as f: + fn = os.path.join(self.tempdir, 'testfile') + with open(fn, 'wb') as f: f.write(b'thisisrawdata') f.write(self.test_class.MAGIC + b'-') FakeAlias = self.test_class.ALIASES[0] @@ -61,13 +70,13 @@ class TestDirectory(base.BaseTest): {'vendor': FakeAlias.VENDOR, 'model': FakeAlias.MODEL, 'variant': FakeAlias.VARIANT, - }).encode()) + }).encode()) f.write(fake_metadata) f.flush() - radio = self._test_detect_finds_our_class(f.name) - self.assertEqual('Taylor', radio.VENDOR) - self.assertEqual('Barmaster 2000', radio.MODEL) - self.assertEqual('A', radio.VARIANT) + radio = self._test_detect_finds_our_class(fn) + self.assertEqual('Taylor', radio.VENDOR) + self.assertEqual('Barmaster 2000', radio.MODEL) + self.assertEqual('A', radio.VARIANT) class TestDetectBruteForce(base.BaseTest): @@ -92,3 +101,45 @@ class TestDetectBruteForce(base.BaseTest): if len(detections) > 1: raise Exception('Detection of %s failed: %s' % (image, detections)) + + +class TestAliasMap(base.BaseTest): + def test_uniqueness(self): + directory_models = {} + for rclass in directory.DRV_TO_RADIO.values(): + for cls in [rclass] + rclass.ALIASES: + # Make sure there are no duplicates + directory_models.setdefault(cls.VENDOR, set()) + fullmodel = '%s%s' % (cls.MODEL, cls.VARIANT) + self.assertNotIn(fullmodel, + directory_models[cls.VENDOR]) + directory_models[cls.VENDOR].add(fullmodel) + + aliases = yaml.load(open(os.path.join(os.path.dirname(__file__), + '..', '..', 'chirp', 'share', + 'model_alias_map.yaml')).read(), + Loader=yaml.FullLoader) + for vendor, models in sorted(aliases.items()): + directory_models.setdefault(vendor, set()) + my_aliases = set([x['model'] for x in models]) + vendor = vendor.split('/')[0] + for model in models: + # Make sure the thing we tell users to use is in the + # directory + try: + alt_vendor, alt_model = model['alt'].split(' ', 1) + except ValueError: + alt_vendor = vendor + alt_model = model['alt'] + + # Aliases may reference other aliases? + self.assertIn(alt_model, + directory_models[alt_vendor] | my_aliases, + '%s %s not found for %s %s' % ( + alt_vendor, alt_model, + vendor, model['model'])) + + # Make sure the alias model is NOT in the directory + # before we add it to ensure there are no duplicates + self.assertNotIn(model['model'], directory_models[vendor]) + directory_models[vendor].add(model['model']) diff --git a/tests/unit/test_icf.py b/tests/unit/test_icf.py new file mode 100644 index 0000000..08bd74d --- /dev/null +++ b/tests/unit/test_icf.py @@ -0,0 +1,161 @@ +# Copyright 2022 Dan Smith +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +import os +import shutil +import tempfile +import unittest + +from chirp import directory +from chirp.drivers import ic2820, icf, id31 + + +class TestFileICF(unittest.TestCase): + def setUp(self): + self.tempdir = tempfile.mkdtemp() + + def cleanUp(self): + shutil.rmtree(self.tempdir) + + def test_read_icf_data_modern(self): + fn = os.path.join(self.tempdir, 'test.icf') + with open(fn, 'w', newline='\r\n') as f: + f.write('12345678\n#Foo=somefoovalue\n#Bar=123\n') + f.write('0000000020015C70000020800000E4002020202020' + '20202020202020202020200040810204\n') + f.write('000000202008102040810204081020408102040810' + '20015B9903E821700000E4284C614772\n') + f.write('#CD=fakehash\n') + f.flush() + + icfdata, mmap = icf.read_file(fn) + + self.assertEqual({'model': b'\x12\x34\x56\x78', + 'Foo': 'somefoovalue', + 'Bar': 123, + 'recordsize': 32, + 'CD': 'fakehash'}, icfdata) + + try: + directory.get_radio_by_image(fn) + except Exception as e: + self.assertIn('Unknown file format', str(e)) + else: + self.fail('Directory failed to reject unknown model') + + def test_read_icf_data_old(self): + fn = os.path.join(self.tempdir, 'test.icf') + with open(fn, 'w', newline='\r\n') as f: + f.write('29700001\n#\n') + f.write('00001008BBB7C0000927C04351435143512020\n') + f.write('00101020202020202020202020202020202020\n') + f.flush() + + icfdata, mmap = icf.read_file(fn) + + self.assertEqual({'model': b'\x29\x70\x00\x01', + 'recordsize': 16}, icfdata) + + def test_read_write_icf(self): + fn1 = os.path.join(self.tempdir, 'test1.icf') + with open(fn1, 'w', newline='\r\n') as f: + # These are different values than the default, so make + # sure we persist them to the output ICF file. + f.write('33220001\n#MapRev=2\n#EtcData=000006\n') + f.write('0000000020015C70000020800000E4002020202020' + '20202020202020202020200040810204\n') + f.write('000000202008102040810204081020408102040810' + '20015B9903E821700000E4284C614772\n') + f.write('#CD=fakehash\n') + f.flush() + + r = id31.ID31Radio(fn1) + + fn2 = os.path.join(self.tempdir, 'test2.icf') + with open(fn2, 'w', newline='\r\n') as f: + r.save(fn2) + icfdata, mmap = icf.read_file(fn2) + self.assertEqual({'MapRev': 2, + 'EtcData': 6, + 'Comment': '', + 'model': r.get_model(), + 'CD': '9674E1C86BA17D36DB9D3D8A144F1081', + 'recordsize': 32}, icfdata) + + def test_read_img_write_icf_modern(self): + img_file = os.path.join(os.path.dirname(__file__), + '..', 'images', 'Icom_ID-31A.img') + + r = id31.ID31Radio(img_file) + fn = os.path.join(self.tempdir, 'test.icf') + with open(fn, 'w', newline='\r\n'): + r.save(fn) + + icfdata, mmap = icf.read_file(fn) + # If we sourced from an image, we use our defaults in + # generating the ICF metadata + self.assertEqual({'MapRev': 1, + 'EtcData': 5, + 'Comment': '', + 'model': r.get_model(), + 'CD': '9F240F598EF20683726ED252278C61D0', + 'recordsize': 32}, icfdata) + + self.assertIsInstance(directory.get_radio_by_image(fn), + id31.ID31Radio) + + def test_read_img_write_icf_old(self): + img_file = os.path.join(os.path.dirname(__file__), + '..', 'images', 'Icom_IC-2820H.img') + + r = ic2820.IC2820Radio(img_file) + fn = os.path.join(self.tempdir, 'test.icf') + with open(fn, 'w', newline='\r\n'): + r.save(fn) + + icfdata, mmap = icf.read_file(fn) + self.assertEqual({'MapRev': 1, + 'EtcData': 0, + 'Comment': '', + 'model': r.get_model(), + 'recordsize': 16}, icfdata) + + self.assertIsInstance(directory.get_radio_by_image(fn), + ic2820.IC2820Radio) + + +class TestCloneICF(unittest.TestCase): + def test_frame_parse(self): + f = icf.IcfFrame.parse(b'\xfe\xfe\xee\xef\xe0\x00\01\xfd') + self.assertEqual(0xEE, f.src) + self.assertEqual(0xEF, f.dst) + self.assertEqual(0xE0, f.cmd) + self.assertEqual(b'\x00\x01', f.payload) + + def test_frame_parse_no_end(self): + f = icf.IcfFrame.parse(b'\xfe\xfe\xee\xef\xe0\x00\01') + self.assertIsNone(f) + + def test_frame_parse_trailing_garbage(self): + f = icf.IcfFrame.parse(b'\xfe\xfe\xee\xef\xe0\x00\01\xfd\x01') + self.assertEqual(0xEE, f.src) + self.assertEqual(0xEF, f.dst) + self.assertEqual(0xE0, f.cmd) + self.assertEqual(b'\x00\x01', f.payload) + + def test_pack(self): + f = icf.IcfFrame(icf.ADDR_PC, icf.ADDR_RADIO, icf.CMD_CLONE_ID) + f.payload = b'\x01\x02' + self.assertEqual(b'\xfe\xfe\xee\xef\xe0\x01\x02\xfd', f.pack()) diff --git a/tests/unit/test_icom_clone.py b/tests/unit/test_icom_clone.py index 9ade954..49720d9 100644 --- a/tests/unit/test_icom_clone.py +++ b/tests/unit/test_icom_clone.py @@ -13,18 +13,18 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +import sys +from tests import icom_clone_simulator +from chirp import memmap +from chirp.drivers import icw32 from builtins import bytes import glob import os -import logging import unittest from chirp import directory -directory.safe_import_drivers() -from chirp.drivers import icf -from chirp import memmap -from tests import icom_clone_simulator +directory.import_drivers() class BaseIcomCloneTest(): @@ -50,7 +50,6 @@ class BaseIcomCloneTest(): elif data[end-16:end] == b'IcomCloneFormat3': return 3 - def test_sync_in(self): test_file = self.IMAGE_FILE self.load_from_test_image(test_file) @@ -64,6 +63,11 @@ class BaseIcomCloneTest(): elif img_ver == 3: self.assertEqual(b'IcomCloneFormat3', self.radio._mmap[-16:]) elif img_ver is None: + if isinstance(self.radio, icw32.ICW32ERadio): + # The IC-W32E does some unclean things with the image size to + # pass pre-metadata detection. It will fail here, so just + # skip it. + return self.assertEqual(self.radio.get_memsize(), len(self.radio._mmap)) def test_sync_out(self): @@ -97,7 +101,6 @@ class TestAdapterMeta(type): test_file_glob = os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', 'images', 'Icom_*.img') -import sys for image_file in glob.glob(test_file_glob): base, _ext = os.path.splitext(os.path.basename(image_file)) @@ -106,7 +109,7 @@ for image_file in glob.glob(test_file_glob): except Exception: continue - if issubclass(radio, icf.IcomRawCloneModeRadio): + if radio._raw_frames: # The simulator does not behave like a raw radio continue diff --git a/tests/unit/test_import_logic.py b/tests/unit/test_import_logic.py index ecd9aa9..30c2263 100644 --- a/tests/unit/test_import_logic.py +++ b/tests/unit/test_import_logic.py @@ -1,3 +1,5 @@ +from unittest import mock + from tests.unit import base from chirp import import_logic from chirp import chirp_common @@ -17,6 +19,9 @@ class FakeRadio(chirp_common.Radio): def filter_name(self, name): return 'filtered-name' + def get_memory(self, number): + return chirp_common.Memory(number, empty=True) + def get_features(self): rf = chirp_common.RadioFeatures() rf.valid_power_levels = self.POWER_LEVELS @@ -29,7 +34,12 @@ class FakeRadio(chirp_common.Radio): class FakeDstarRadio(FakeRadio, chirp_common.IcomDstarSupport): - pass + REQUIRES_CALL_LISTS = False + + def get_features(self): + rf = super().get_features() + rf.requires_call_lists = self.REQUIRES_CALL_LISTS + return rf class DstarTests(base.BaseTest): @@ -37,14 +47,15 @@ class DstarTests(base.BaseTest): ini_urcalls, ini_rptcalls, exp_urcalls, exp_rptcalls): radio = FakeDstarRadio(None) - self.mox.StubOutWithMock(radio, 'get_urcall_list') - self.mox.StubOutWithMock(radio, 'get_repeater_call_list') - radio.get_urcall_list().AndReturn(ini_urcalls) - radio.get_repeater_call_list().AndReturn(ini_rptcalls) - self.mox.ReplayAll() - import_logic.ensure_has_calls(radio, mem) - self.assertEqual(sorted(ini_urcalls), sorted(exp_urcalls)) - self.assertEqual(sorted(ini_rptcalls), sorted(exp_rptcalls)) + with mock.patch.multiple( + radio, + get_urcall_list=mock.DEFAULT, + get_repeater_call_list=mock.DEFAULT) as mocks: + mocks['get_urcall_list'].return_value = ini_urcalls + mocks['get_repeater_call_list'].return_value = ini_rptcalls + import_logic.ensure_has_calls(radio, mem) + self.assertEqual(sorted(ini_urcalls), sorted(exp_urcalls)) + self.assertEqual(sorted(ini_rptcalls), sorted(exp_rptcalls)) def test_ensure_has_calls_empty(self): mem = chirp_common.DVMemory() @@ -164,17 +175,31 @@ class ImportFieldTests(base.BaseTest): mem = chirp_common.Memory() mem.power = None import_logic._import_power(radio, src_rf, mem) - self.assertEqual(mem.power, radio.POWER_LEVELS[0]) + self.assertEqual(mem.power, radio.POWER_LEVELS[1]) + + def test_import_power_no_src_variable(self): + radio = FakeRadio(None) + src_rf = chirp_common.RadioFeatures() + mem = chirp_common.Memory() + mem.power = None + with mock.patch.object(radio, 'get_features') as mock_gf: + mock_gf.return_value = chirp_common.RadioFeatures() + mock_gf.return_value.has_variable_power = True + mock_gf.return_value.valid_power_levels = [ + chirp_common.AutoNamedPowerLevel(1), + chirp_common.AutoNamedPowerLevel(50), + chirp_common.AutoNamedPowerLevel(1500)] + import_logic._import_power(radio, src_rf, mem) + self.assertEqual('50W', str(mem.power)) def test_import_power_no_dst(self): radio = FakeRadio(None) src_rf = radio.get_features() # Steal a copy before we stub out - self.mox.StubOutWithMock(radio, 'get_features') - radio.get_features().AndReturn(chirp_common.RadioFeatures()) - self.mox.ReplayAll() mem = chirp_common.Memory() mem.power = src_rf.valid_power_levels[0] - import_logic._import_power(radio, src_rf, mem) + with mock.patch.object(radio, 'get_features') as mock_gf: + mock_gf.return_value = chirp_common.RadioFeatures() + import_logic._import_power(radio, src_rf, mem) self.assertEqual(mem.power, None) def test_import_power_closest(self): @@ -184,7 +209,20 @@ class ImportFieldTests(base.BaseTest): chirp_common.PowerLevel('foo', watts=7), chirp_common.PowerLevel('bar', watts=51), chirp_common.PowerLevel('baz', watts=1), - ] + ] + mem = chirp_common.Memory() + mem.power = src_rf.valid_power_levels[0] + import_logic._import_power(radio, src_rf, mem) + self.assertEqual(mem.power, radio.POWER_LEVELS[0]) + + def test_import_power_closest_watts(self): + radio = FakeRadio(None) + src_rf = chirp_common.RadioFeatures() + src_rf.valid_power_levels = [ + chirp_common.PowerLevel('foo', watts=20), + chirp_common.PowerLevel('bar', watts=51), + chirp_common.PowerLevel('baz', watts=1), + ] mem = chirp_common.Memory() mem.power = src_rf.valid_power_levels[0] import_logic._import_power(radio, src_rf, mem) @@ -296,39 +334,96 @@ class ImportFieldTests(base.BaseTest): self.assertRaises(import_logic.DestNotCompatible, import_logic._import_duplex, radio, None, mem) - def test_import_mem(self, errors=[]): + def test_import_duplex_off_not_supported(self): + radio = FakeRadio(None) + mem = chirp_common.Memory() + mem.freq = 146000000 + mem.duplex = 'off' + import_logic._import_duplex(radio, None, mem) + self.assertEqual('', mem.duplex) + + @mock.patch('chirp.import_logic._import_name') + @mock.patch('chirp.import_logic._import_power') + @mock.patch('chirp.import_logic._import_tone') + @mock.patch('chirp.import_logic._import_dtcs') + @mock.patch('chirp.import_logic._import_mode') + @mock.patch('chirp.import_logic._import_duplex') + def _test_import_mem(self, errors, + mock_duplex, mock_mode, mock_dtcs, mock_tone, + mock_power, mock_name): radio = FakeRadio(None) src_rf = chirp_common.RadioFeatures() mem = chirp_common.Memory() - self.mox.StubOutWithMock(mem, 'dupe') - self.mox.StubOutWithMock(import_logic, '_import_name') - self.mox.StubOutWithMock(import_logic, '_import_power') - self.mox.StubOutWithMock(import_logic, '_import_tone') - self.mox.StubOutWithMock(import_logic, '_import_dtcs') - self.mox.StubOutWithMock(import_logic, '_import_mode') - self.mox.StubOutWithMock(import_logic, '_import_duplex') - self.mox.StubOutWithMock(radio, 'validate_memory') - - mem.dupe().AndReturn(mem) - import_logic._import_name(radio, src_rf, mem) - import_logic._import_power(radio, src_rf, mem) - import_logic._import_tone(radio, src_rf, mem) - import_logic._import_dtcs(radio, src_rf, mem) - import_logic._import_mode(radio, src_rf, mem) - import_logic._import_duplex(radio, src_rf, mem) - radio.validate_memory(mem).AndReturn(errors) + with mock.patch.object(mem, 'dupe') as mock_dupe: + mock_dupe.return_value = mem + with mock.patch.object(radio, 'validate_memory') as mock_val: + mock_val.return_value = errors + import_logic.import_mem(radio, src_rf, mem) + mock_val.assert_called_once_with(mem) + mock_dupe.assert_called_once_with() + + mock_duplex.assert_called_once_with(radio, src_rf, mem) - self.mox.ReplayAll() + def test_import_mem(self): + self._test_import_mem([]) + + @mock.patch.object(FakeRadio, 'get_memory') + @mock.patch.object(FakeRadio, 'check_set_memory_immutable_policy') + def test_import_mem_checks_immutable(self, mock_check, mock_get): + radio = FakeRadio(None) + src_rf = chirp_common.RadioFeatures() + mem = chirp_common.Memory() + with mock.patch.object(mem, 'dupe') as mock_dupe: + mock_dupe.return_value = mem + import_logic.import_mem(radio, src_rf, mem) + mock_check.assert_called_once_with(mock_get.return_value, mem) + mock_get.assert_called_once_with(mem.number) + + def test_import_mem_with_class(self): + radio = FakeRadio(None) + src_rf = chirp_common.RadioFeatures() + mem = chirp_common.Memory() + mem2 = import_logic.import_mem(radio, src_rf, mem, + mem_cls=chirp_common.DVMemory) + self.assertIsInstance(mem2, chirp_common.DVMemory) + + def test_import_mem_dstar_logic(self): + radio = FakeRadio(None) + src_rf = chirp_common.RadioFeatures() + mem = chirp_common.DVMemory() + mem.mode = 'DV' + + # non-DSTAR radio exposes only FM, so DV is not compatible + radio.MODES = ['FM'] + self.assertRaises(import_logic.DestNotCompatible, + import_logic.import_mem, radio, src_rf, mem) + + # non-DSTAR radio exposes DV, so it is compatible, but obviously + # no call list manipulation needed. + radio.MODES = ['FM', 'DV'] + with mock.patch('chirp.import_logic.ensure_has_calls') as mock_e: + import_logic.import_mem(radio, src_rf, mem) + mock_e.assert_not_called() + + # A real D-STAR radio gets the full treatment, depending on the + # required call lists flag + radio = FakeDstarRadio(None) + with mock.patch('chirp.import_logic.ensure_has_calls') as mock_e: + radio.REQUIRES_CALL_LISTS = False + import_logic.import_mem(radio, src_rf, mem) + mock_e.assert_not_called() - import_logic.import_mem(radio, src_rf, mem) + radio.REQUIRES_CALL_LISTS = True + import_logic.import_mem(radio, src_rf, mem) + mock_e.assert_called() def test_import_mem_with_warnings(self): - self.test_import_mem([chirp_common.ValidationWarning('Test')]) + self._test_import_mem([chirp_common.ValidationWarning('Test')]) def test_import_mem_with_errors(self): self.assertRaises(import_logic.DestNotCompatible, - self.test_import_mem, + self._test_import_mem, [chirp_common.ValidationError('Test')]) def test_import_bank(self): @@ -350,24 +445,23 @@ class ImportFieldTests(base.BaseTest): chirp_common.Bank(src_bm, 3, '3'), ] - self.mox.StubOutWithMock(dst_radio, 'get_mapping_models') - self.mox.StubOutWithMock(src_radio, 'get_mapping_models') - self.mox.StubOutWithMock(dst_bm, 'get_mappings') - self.mox.StubOutWithMock(src_bm, 'get_mappings') - self.mox.StubOutWithMock(dst_bm, 'get_memory_mappings') - self.mox.StubOutWithMock(src_bm, 'get_memory_mappings') - self.mox.StubOutWithMock(dst_bm, 'remove_memory_from_mapping') - self.mox.StubOutWithMock(dst_bm, 'add_memory_to_mapping') - - dst_radio.get_mapping_models().AndReturn([dst_bm]) - dst_bm.get_mappings().AndReturn(dst_banks) - src_radio.get_mapping_models().AndReturn([src_bm]) - src_bm.get_mappings().AndReturn(src_banks) - src_bm.get_memory_mappings(src_mem).AndReturn([src_banks[0]]) - dst_bm.get_memory_mappings(dst_mem).AndReturn([dst_banks[1]]) - dst_bm.remove_memory_from_mapping(dst_mem, dst_banks[1]) - dst_bm.add_memory_to_mapping(dst_mem, dst_banks[0]) - - self.mox.ReplayAll() - - import_logic.import_bank(dst_radio, src_radio, dst_mem, src_mem) + @mock.patch.object(dst_radio, 'get_mapping_models', + return_value=[dst_bm]) + @mock.patch.object(src_radio, 'get_mapping_models', + return_value=[src_bm]) + @mock.patch.object(dst_bm, 'get_mappings', + return_value=dst_banks) + @mock.patch.object(src_bm, 'get_mappings', + return_value=src_banks) + @mock.patch.object(src_bm, 'get_memory_mappings', + return_value=[src_banks[0]]) + @mock.patch.object(dst_bm, 'get_memory_mappings', + return_value=[dst_banks[1]]) + @mock.patch.object(dst_bm, 'remove_memory_from_mapping') + @mock.patch.object(dst_bm, 'add_memory_to_mapping') + def _test(mock_add, mock_remove, *rest): + import_logic.import_bank(dst_radio, src_radio, dst_mem, src_mem) + mock_remove.assert_called_once_with(dst_mem, dst_banks[1]) + mock_add.assert_called_once_with(dst_mem, dst_banks[0]) + + _test() diff --git a/tests/unit/test_kguv8d.py b/tests/unit/test_kguv8d.py new file mode 100644 index 0000000..97b67d7 --- /dev/null +++ b/tests/unit/test_kguv8d.py @@ -0,0 +1,82 @@ +import os +import struct +import unittest + +from chirp.drivers import kguv8e +from chirp.drivers import kguv8d +from chirp.drivers import kguv8dplus +from chirp.drivers import kg935g +from chirp import directory + + +class FakeUV8D: + def __init__(self, rclass): + self.writebuf = b'' + self.readbuf = b'' + self.rclass = rclass + self._model = rclass._model + + def write(self, data): + assert isinstance(data, bytes) + cmd = data[1] + response = b'' + if cmd == kguv8d.CMD_ID: + response = self._model + b'\x00' * 10 + elif cmd == kguv8d.CMD_RD: + response = b'\x00' * 64 + elif cmd == kguv8d.CMD_WR: + response = data[4:6] + if hasattr(self.rclass, 'decrypt'): + response = self.rclass(None).decrypt(response) + elif cmd == kguv8d.CMD_END: + return + else: + raise Exception('Unhandled command') + packet = struct.pack('xxxB', len(response)) + response + cs = sum(x for x in packet) % 256 + packet += struct.pack('B', cs) + if hasattr(self.rclass, 'encrypt'): + payload = self.rclass(None).encrypt(packet[4:]) + packet = packet[:4] + payload + + self.readbuf += packet + + def read(self, n): + buf = self.readbuf[:n] + self.readbuf = self.readbuf[n:] + return buf + + +class TestKGUV8D(unittest.TestCase): + RCLASS = kguv8d.KGUV8DRadio + + def test_identify(self): + f = FakeUV8D(self.RCLASS) + r = self.RCLASS(f) + r._identify() + + def test_download(self): + f = FakeUV8D(self.RCLASS) + r = self.RCLASS(f) + r.sync_in() + + def test_upload(self): + f = FakeUV8D(self.RCLASS) + img = os.path.join(os.path.dirname(__file__), + '..', 'images', + '%s.img' % directory.radio_class_id(self.RCLASS)) + r = self.RCLASS(img) + r.set_pipe(f) + r.sync_out() + + +class TestKGUV8DPlus(TestKGUV8D): + RCLASS = kguv8dplus.KGUV8DPlusRadio + + +class TestKGUV8ER(TestKGUV8D): + RCLASS = kguv8e.KGUV8ERadio + + +class TestKG935(TestKGUV8D): + RCLASS = kg935g.KG935GRadio diff --git a/tests/unit/test_kguv920.py b/tests/unit/test_kguv920.py new file mode 100644 index 0000000..585c9dd --- /dev/null +++ b/tests/unit/test_kguv920.py @@ -0,0 +1,65 @@ +# Copyright 2022 Dan Smith +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + + +import struct + +import unittest + +from chirp.drivers import kguv920pa +from chirp import memmap + + +class FakeSerial: + def __init__(self): + self.ibuf = b'' + self.obuf = b'' + + def write(self, b): + assert isinstance(b, bytes) + self.obuf += b + + def read(self, n): + print('read %i (rem %i)' % (n, len(self.ibuf))) + r = self.ibuf[:n] + self.ibuf = self.ibuf[n:] + return r + + +class TestClone(unittest.TestCase): + def test_identify(self): + s = FakeSerial() + s.ibuf = struct.pack( + 'BBBB10sB', 0, 0, 0, + len(kguv920pa.KGUV920PARadio._model), + kguv920pa._str_encode(kguv920pa.KGUV920PARadio._model), 3) + print(s.ibuf) + d = kguv920pa.KGUV920PARadio(s) + d._identify() + + def test_download(self): + s = FakeSerial() + oneresp = struct.pack('xxxB16sB', 0x10, b'\x01' * 16, 0) + s.ibuf = oneresp * 2 + d = kguv920pa.KGUV920PARadio(s) + d._do_download(0, 0x20, 0x10) + + def test_upload(self): + s = FakeSerial() + s.ibuf = (struct.pack('>xxxBHB', 0x02, 0, 2) + + struct.pack('>xxxBHB', 0x02, 0x10, 2)) + d = kguv920pa.KGUV920PARadio(s) + d._mmap = memmap.MemoryMapBytes(b'\x00' * 0x20) + d._do_upload(0, 0x20, 0x10) diff --git a/tests/unit/test_mappingmodel.py b/tests/unit/test_mappingmodel.py index 2f263d7..ecdec6d 100644 --- a/tests/unit/test_mappingmodel.py +++ b/tests/unit/test_mappingmodel.py @@ -13,6 +13,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from unittest import mock + from tests.unit import base from chirp import chirp_common from chirp.drivers import icf @@ -137,11 +139,11 @@ class TestIcomBankModel(base.BaseTest): self._radio = FakeRadio(None) self._model = self.CLS(self._radio) - self.mox.StubOutWithMock(self._radio, '_set_bank') - self.mox.StubOutWithMock(self._radio, '_get_bank') - self.mox.StubOutWithMock(self._radio, '_set_bank_index') - self.mox.StubOutWithMock(self._radio, '_get_bank_index') - self.mox.StubOutWithMock(self._radio, 'get_memory') + for a in ('_set_bank', '_get_bank', '_set_bank_index', + '_get_bank_index', 'get_memory'): + m = mock.patch.object(self._radio, a) + m.start() + self.mocks.append(m) def test_get_num_mappings(self): self.assertEqual(self._model.get_num_mappings(), 10) @@ -162,24 +164,22 @@ class TestIcomBankModel(base.BaseTest): mem.number = 5 banks = self._model.get_mappings() bank = banks[2] - self._radio._set_bank(5, 2) - self.mox.ReplayAll() self._model.add_memory_to_mapping(mem, bank) + self._radio._set_bank.assert_called_once_with(5, 2) def _setup_test_remove_memory_from_mapping(self, curbank): mem = chirp_common.Memory() mem.number = 5 banks = self._model.get_mappings() bank = banks[2] - self._radio._get_bank(5).AndReturn(curbank) - if curbank == 2: - self._radio._set_bank(5, None) - self.mox.ReplayAll() + self._radio._get_bank.return_value = curbank return mem, bank def test_remove_memory_from_mapping(self): mem, bank = self._setup_test_remove_memory_from_mapping(2) self._model.remove_memory_from_mapping(mem, bank) + self._radio._get_bank.assert_called_once_with(5) + self._radio._set_bank.assert_called_once_with(5, None) def test_remove_memory_from_mapping_wrong_bank(self): mem, bank = self._setup_test_remove_memory_from_mapping(3) @@ -194,16 +194,21 @@ class TestIcomBankModel(base.BaseTest): def test_get_mapping_memories(self): banks = self._model.get_mappings() expected = [] + _get_bank = [] for i in range(1, 10): should_include = bool(i % 2) - self._radio._get_bank(i).AndReturn( + _get_bank.append( should_include and banks[1].index or None) if should_include: - self._radio.get_memory(i).AndReturn(i) expected.append(i) - self.mox.ReplayAll() + self._radio._get_bank.side_effect = _get_bank + self._radio.get_memory.side_effect = expected members = self._model.get_mapping_memories(banks[1]) self.assertEqual(members, expected) + self._radio.get_memory.assert_has_calls([ + mock.call(i) for i in range(1, 10) if i % 2]) + self._radio._get_bank.assert_has_calls([ + mock.call(i) for i in range(1, 10)]) def test_get_memory_mappings(self): banks = self._model.get_mappings() @@ -211,11 +216,11 @@ class TestIcomBankModel(base.BaseTest): mem1.number = 5 mem2 = chirp_common.Memory() mem2.number = 6 - self._radio._get_bank(mem1.number).AndReturn(2) - self._radio._get_bank(mem2.number).AndReturn(None) - self.mox.ReplayAll() + self._radio._get_bank.side_effect = [2, None] self.assertEqual(self._model.get_memory_mappings(mem1)[0], banks[2]) self.assertEqual(self._model.get_memory_mappings(mem2), []) + self._radio._get_bank.assert_has_calls([ + mock.call(mem1.number), mock.call(mem2.number)]) class TestIcomIndexedBankModel(TestIcomBankModel): @@ -232,52 +237,64 @@ class TestIcomIndexedBankModel(TestIcomBankModel): def test_get_memory_index(self): mem = chirp_common.Memory() mem.number = 5 - self._radio._get_bank_index(mem.number).AndReturn(1) - self.mox.ReplayAll() + self._radio._get_bank_index.return_value = 1 self.assertEqual(self._model.get_memory_index(mem, None), 1) + self._radio._get_bank_index.assert_called_once_with(mem.number) def test_set_memory_index(self): mem = chirp_common.Memory() mem.number = 5 banks = self._model.get_mappings() - self.mox.StubOutWithMock(self._model, 'get_memory_mappings') - self._model.get_memory_mappings(mem).AndReturn([banks[3]]) - self._radio._set_bank_index(mem.number, 1) - self.mox.ReplayAll() - self._model.set_memory_index(mem, banks[3], 1) + with mock.patch.object(self._model, 'get_memory_mappings') as m: + m.return_value = [banks[3]] + self._model.set_memory_index(mem, banks[3], 1) + m.assert_called_once_with(mem) + self._radio._set_bank_index.assert_called_once_with(mem.number, 1) def test_set_memory_index_bad_bank(self): mem = chirp_common.Memory() mem.number = 5 banks = self._model.get_mappings() - self.mox.StubOutWithMock(self._model, 'get_memory_mappings') - self._model.get_memory_mappings(mem).AndReturn([banks[4]]) - self.mox.ReplayAll() - self.assertRaises(Exception, - self._model.set_memory_index, mem, banks[3], 1) + with mock.patch.object(self._model, 'get_memory_mappings') as m: + m.return_value = [banks[4]] + self.assertRaises(Exception, + self._model.set_memory_index, mem, banks[3], 1) + m.assert_called_once_with(mem) def test_set_memory_index_bad_index(self): mem = chirp_common.Memory() mem.number = 5 banks = self._model.get_mappings() - self.mox.StubOutWithMock(self._model, 'get_memory_mappings') - self._model.get_memory_mappings(mem).AndReturn([banks[3]]) - self.mox.ReplayAll() - self.assertRaises(Exception, - self._model.set_memory_index, mem, banks[3], 99) + with mock.patch.object(self._model, 'get_memory_mappings') as m: + m.return_value = [banks[3]] + self.assertRaises(Exception, + self._model.set_memory_index, mem, banks[3], 99) + m.assert_called_once_with(mem) def test_get_next_mapping_index(self): banks = self._model.get_mappings() + bank_exp_calls = [] + index_exp_calls = [] + bank_returns = [] + index_returns = [] for i in range(*self._radio.get_features().memory_bounds): - self._radio._get_bank(i).AndReturn((i % 2) and banks[1].index) + bank_returns.append((i % 2) and banks[1].index) + bank_exp_calls.append(mock.call(i)) if bool(i % 2): - self._radio._get_bank_index(i).AndReturn(i) + index_returns.append(i) + index_exp_calls.append(mock.call(i)) idx = 0 for i in range(*self._radio.get_features().memory_bounds): - self._radio._get_bank(i).AndReturn((i % 2) and banks[2].index) + bank_exp_calls.append(mock.call(i)) + bank_returns.append((i % 2) and banks[2].index) if i % 2: - self._radio._get_bank_index(i).AndReturn(idx) + index_exp_calls.append(mock.call(i)) + index_returns.append(idx) idx += 1 - self.mox.ReplayAll() + + self._radio._get_bank.side_effect = bank_returns + self._radio._get_bank_index.side_effect = index_returns self.assertEqual(self._model.get_next_mapping_index(banks[1]), 0) self.assertEqual(self._model.get_next_mapping_index(banks[2]), 5) + self._radio._get_bank.assert_has_calls(bank_exp_calls) + self._radio._get_bank_index.assert_has_calls(index_exp_calls) diff --git a/tests/unit/test_memedit_edits.py b/tests/unit/test_memedit_edits.py deleted file mode 100644 index b024353..0000000 --- a/tests/unit/test_memedit_edits.py +++ /dev/null @@ -1,74 +0,0 @@ -try: - import mox -except ImportError: - from mox3 import mox -from tests.unit import base - -__builtins__["_"] = lambda s: s - -try: - from chirp.ui import memedit -except ImportError: - memedit = None - - -class TestEdits(base.BaseGTKTest): - def _test_tone_column_change(self, col, - ini_tmode='', ini_cmode='', - exp_tmode=None, exp_cmode=None): - editor = self.mox.CreateMock(memedit.MemoryEditor) - editor._config = self.mox.CreateMockAnything() - editor._config.get_bool("no_smart_tmode").AndReturn(False) - editor.col = lambda x: x - editor.store = self.mox.CreateMockAnything() - editor.store.get_iter('path').AndReturn('iter') - editor.store.get('iter', 'Tone Mode', 'Cross Mode').AndReturn( - (ini_tmode, ini_cmode)) - if exp_tmode: - editor.store.set('iter', 'Tone Mode', exp_tmode) - if exp_cmode and col != 'Cross Mode': - editor.store.set('iter', 'Cross Mode', exp_cmode) - self.mox.ReplayAll() - memedit.MemoryEditor.ed_tone_field(editor, None, 'path', None, col) - - def _test_auto_tone_mode(self, col, exp_tmode, exp_cmode): - cross_exp_cmode = (exp_tmode == "Cross" and exp_cmode or None) - - # No tmode -> expected tmode, maybe requires cross mode change - self._test_tone_column_change(col, exp_tmode=exp_tmode, - exp_cmode=cross_exp_cmode) - - # Expected tmode does not re-set tmode, may change cmode - self._test_tone_column_change(col, ini_tmode=exp_tmode, - exp_cmode=cross_exp_cmode) - - # Invalid tmode -> expected, may change cmode - self._test_tone_column_change(col, ini_tmode="foo", - exp_tmode=exp_tmode, - exp_cmode=cross_exp_cmode) - - # Expected cmode does not re-set cmode - self._test_tone_column_change(col, ini_tmode="Cross", - ini_cmode=exp_cmode) - - # Invalid cmode -> expected - self._test_tone_column_change(col, ini_tmode="Cross", - ini_cmode="foo", exp_cmode=exp_cmode) - - def test_auto_tone_mode_tone(self): - self._test_auto_tone_mode('Tone', 'Tone', 'Tone->Tone') - - def test_auto_tone_mode_tsql(self): - self._test_auto_tone_mode('ToneSql', 'TSQL', 'Tone->Tone') - - def test_auto_tone_mode_dtcs(self): - self._test_auto_tone_mode('DTCS Code', 'DTCS', 'DTCS->') - - def test_auto_tone_mode_dtcs_rx(self): - self._test_auto_tone_mode('DTCS Rx Code', 'Cross', '->DTCS') - - def test_auto_tone_mode_dtcs_pol(self): - self._test_auto_tone_mode('DTCS Pol', 'DTCS', 'DTCS->') - - def test_auto_tone_mode_cross(self): - self._test_auto_tone_mode('Cross Mode', 'Cross', 'Tone->Tone') diff --git a/tests/unit/test_network_sources.py b/tests/unit/test_network_sources.py new file mode 100644 index 0000000..eb82c42 --- /dev/null +++ b/tests/unit/test_network_sources.py @@ -0,0 +1,28 @@ +import unittest +from unittest import mock + +from chirp.sources import dmrmarc + +# Hopefully this will provide a sentinel and forcing function for +# network sources when APIs stop working. Unfortunately, live queries +# are more likely to add spurious failures into the tests, but time +# will tell if it's worth it. + + +class TestDMRMARC(unittest.TestCase): + def test_marc_works(self): + r = dmrmarc.DMRMARCRadio() + r.do_fetch(mock.MagicMock(), {'city': 'portland', + 'state': 'oregon', + 'country': ''}) + f = r.get_features() + + # Assert that we found some repeaters. If they all go away in + # Portland, this will break and we will need another target + self.assertGreater(f.memory_bounds[1], 2) + + for i in range(*f.memory_bounds): + m = r.get_memory(i) + self.assertEqual('DMR', m.mode) + # Assume all DMR repeaters are above 100MHz + self.assertGreater(m.freq, 100000000) diff --git a/tests/unit/test_platform.py b/tests/unit/test_platform.py deleted file mode 100644 index 394f894..0000000 --- a/tests/unit/test_platform.py +++ /dev/null @@ -1,62 +0,0 @@ -# Copyright 2013 Dan Smith -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -import unittest -try: - import mox -except ImportError: - from mox3 import mox -import os - -from tests.unit import base -from chirp import platform - - -class Win32PlatformTest(base.BaseTest): - def _test_init(self): - self.mox.StubOutWithMock(platform, 'comports') - self.mox.StubOutWithMock(os, 'mkdir') - self.mox.StubOutWithMock(os, 'getenv') - os.mkdir(mox.IgnoreArg()) - os.getenv("APPDATA").AndReturn("foo") - os.getenv("USERPROFILE").AndReturn("foo") - - def test_init(self): - self._test_init() - self.mox.ReplayAll() - platform.Win32Platform() - - def test_serial_ports_sorted(self): - self._test_init() - - fake_comports = [] - numbers = [1, 11, 2, 12, 7, 3, 123] - for i in numbers: - fake_comports.append(("COM%i" % i, None, None)) - - platform.comports().AndReturn(fake_comports) - self.mox.ReplayAll() - ports = platform.Win32Platform().list_serial_ports() - - correct_order = ["COM%i" % i for i in sorted(numbers)] - self.assertEqual(ports, correct_order) - - def test_serial_ports_bad_portnames(self): - self._test_init() - - platform.comports().AndReturn([('foo', None, None)]) - self.mox.ReplayAll() - ports = platform.Win32Platform().list_serial_ports() - self.assertEqual(ports, ['foo']) diff --git a/tests/unit/test_repeaterbook.py b/tests/unit/test_repeaterbook.py index 2563b3f..dc8b2e2 100644 --- a/tests/unit/test_repeaterbook.py +++ b/tests/unit/test_repeaterbook.py @@ -1,28 +1,251 @@ +import datetime +import json +import os +import shutil import tempfile import unittest +from unittest import mock + +import pytest from chirp import chirp_common -from chirp.drivers import repeaterbook - - -class TestRepeaterBook(unittest.TestCase): - def _fetch_and_load(self, query): - fn = tempfile.mktemp('.csv') - chirp_common.urlretrieve(query, fn) - radio = repeaterbook.RBRadio(fn) - return fn, radio - - def test_political(self): - query = "http://www.repeaterbook.com/repeaters/downloads/chirp.php" + \ - "?func=default&state_id=%s&band=%s&freq=%%&band6=%%&loc=%%" + \ - "&county_id=%s&status_id=%%&features=%%&coverage=%%&use=%%" - query = query % ('41', '%%', '005') - self._fetch_and_load(query) - - def test_proximity(self): - loc = '97124' - band = '%%' - dist = '20' - query = "https://www.repeaterbook.com/repeaters/downloads/CHIRP/" \ - "app_direct.php?loc=%s&band=%s&dist=%s" % (loc, band, dist) - self._fetch_and_load(query) +from chirp.sources import repeaterbook + + +class TestRepeaterbook(unittest.TestCase): + def fake_config(self, fn): + return os.path.join(self.tempdir, fn) + + def setUp(self): + self.tempdir = tempfile.mkdtemp() + self.patches = [] + self.patches.append(mock.patch('chirp.platform.Platform.config_file', + self.fake_config)) + for p in self.patches: + p.start() + + self.testfile = os.path.join(os.path.dirname(__file__), + 'rb-united_states-oregon.json') + + def tearDown(self): + for p in self.patches: + p.stop() + shutil.rmtree(self.tempdir) + + @pytest.mark.network + def test_get_oregon(self): + rb = repeaterbook.RepeaterBook() + self.assertRaises(IndexError, rb.get_memory, 0) + rb.do_fetch(mock.MagicMock(), { + 'country': 'United States', + 'state': 'Oregon', + 'lat': 45, + 'lon': -122, + 'dist': 100, + }) + m = rb.get_memory(0) + self.assertIsInstance(m, chirp_common.Memory) + f = rb.get_features() + self.assertGreater(sum(f.memory_bounds), 20) + + for i in range(*f.memory_bounds): + m = rb.get_memory(i) + if m.mode == 'DV': + self.assertIsInstance(m, chirp_common.DVMemory) + self.assertEqual('CQCQCQ ', m.dv_urcall) + self.assertEqual(8, len(m.dv_rpt1call)) + self.assertEqual(8, len(m.dv_rpt2call)) + self.assertEqual(m.dv_rpt1call, m.dv_rpt2call) + self.assertNotEqual('', m.dv_rpt1call) + break + else: + raise Exception('Did not find any DV results') + + @pytest.mark.network + def test_get_wyoming(self): + rb = repeaterbook.RepeaterBook() + self.assertRaises(IndexError, rb.get_memory, 0) + rb.do_fetch(mock.MagicMock(), { + 'country': 'United States', + 'state': 'Wyoming', + 'lat': 45, + 'lon': -122, + 'dist': 0, + }) + m = rb.get_memory(0) + self.assertIsInstance(m, chirp_common.Memory) + f = rb.get_features() + self.assertGreater(sum(f.memory_bounds), 20) + + @pytest.mark.network + def test_get_oregon_gmrs(self): + rb = repeaterbook.RepeaterBook() + self.assertRaises(IndexError, rb.get_memory, 0) + rb.do_fetch(mock.MagicMock(), { + 'country': 'United States', + 'state': 'Oregon', + 'lat': 45, + 'lon': -122, + 'dist': 100, + 'service': 'gmrs', + }) + m = rb.get_memory(0) + self.assertIsInstance(m, chirp_common.Memory) + f = rb.get_features() + self.assertGreater(sum(f.memory_bounds), 1) + + @pytest.mark.network + def test_get_australia(self): + rb = repeaterbook.RepeaterBook() + self.assertRaises(IndexError, rb.get_memory, 0) + rb.do_fetch(mock.MagicMock(), { + 'country': 'Australia', + 'state': 'ALL', + 'lat': -26, + 'lon': 133, + 'dist': 20000, + }) + m = rb.get_memory(0) + self.assertIsInstance(m, chirp_common.Memory) + f = rb.get_features() + self.assertGreater(sum(f.memory_bounds), 20) + + def _test_with_mocked(self, params): + rb = repeaterbook.RepeaterBook() + with mock.patch.object(rb, 'get_data') as gd: + gd.return_value = self.testfile + rb.do_fetch(mock.MagicMock(), params) + return rb + + def test_filter(self): + params = {'country': 'United States', + 'state': 'Oregon', + 'lat': 45, + 'lon': -122, + 'dist': 0, + 'filter': 'tower'} + rb = self._test_with_mocked(params) + self.assertGreater(sum(rb.get_features().memory_bounds), 5) + + def test_distance(self): + params = {'country': 'United States', + 'state': 'Oregon', + 'lat': 45, + 'lon': -122, + 'dist': 0, + 'filter': 'tower'} + rb1 = self._test_with_mocked(dict(params)) + self.assertGreater(sum(rb1.get_features().memory_bounds), 5) + + # Make sure we got fewer than everything in Oregon + params['dist'] = 100 + rb2 = self._test_with_mocked(dict(params)) + self.assertLess(sum(rb2.get_features().memory_bounds), + sum(rb1.get_features().memory_bounds)) + + # There is nothing 1km away from this spot in the ocean + params['dist'] = 1 + params['lat'] = 45 + params['lon'] = -140 + rb3 = self._test_with_mocked(dict(params)) + self.assertEqual(sum(rb3.get_features().memory_bounds), -1) + + def test_get_data_500(self): + rb = repeaterbook.RepeaterBook() + with mock.patch('requests.get') as mock_get: + mock_get.return_value.status_code = 500 + status = mock.MagicMock() + r = rb.get_data(status, 'US', 'OR', '') + self.assertIsNone(r) + status.send_fail.assert_called() + # Make sure we wrote no files + self.assertEqual([], os.listdir(os.path.join(self.tempdir, + 'repeaterbook'))) + + def test_get_data_json_fail(self): + rb = repeaterbook.RepeaterBook() + with mock.patch('requests.get') as mock_get: + mock_get.return_value.status_code = 200 + mock_get.return_value.iter_content.return_value = [b'foo'] + status = mock.MagicMock() + r = rb.get_data(status, 'US', 'OR', '') + self.assertIsNone(r) + files = os.listdir(os.path.join(self.tempdir, + 'repeaterbook')) + # Make sure we only wrote one file and that it is a tempfile + # not one we will find as a data file later + self.assertEqual(1, len(files)) + self.assertTrue(files[0].endswith('tmp')) + status.send_fail.assert_called() + + def test_get_data_no_results(self): + rb = repeaterbook.RepeaterBook() + with mock.patch('requests.get') as mock_get: + mock_get.return_value.status_code = 200 + mock_get.return_value.iter_content.return_value = [json.dumps( + {'count': 0}).encode()] + status = mock.MagicMock() + r = rb.get_data(status, 'US', 'OR', '') + self.assertIsNone(r) + files = os.listdir(os.path.join(self.tempdir, + 'repeaterbook')) + # Make sure we cleaned up and signaled failure + self.assertEqual(0, len(files)) + status.send_fail.assert_called() + + def test_get_data_got_results(self): + files = os.listdir(self.tempdir) + # Make sure we started with no data files + self.assertEqual(0, len(files)) + rb = repeaterbook.RepeaterBook() + with mock.patch('requests.get') as mock_get: + mock_get.return_value.status_code = 200 + mock_get.return_value.iter_content.return_value = [json.dumps( + {'count': 1}).encode()] + status = mock.MagicMock() + r = rb.get_data(status, 'US', 'OR', '') + self.assertIsNotNone(r) + files = os.listdir(os.path.join(self.tempdir, + 'repeaterbook')) + # Make sure we left only a data file and did not signal failure + self.assertEqual(1, len(files)) + self.assertFalse(files[0].endswith('tmp')) + self.assertEqual(os.path.basename(r), files[0]) + status.send_fail.assert_not_called() + + def test_get_data_honors_cache_rules(self): + os.mkdir(os.path.join(self.tempdir, 'repeaterbook')) + cache_file = os.path.join(self.tempdir, + 'repeaterbook', + os.path.basename(self.testfile)) + with open(cache_file, 'w') as f: + f.write('foo') + rb = repeaterbook.RepeaterBook() + with mock.patch('requests.get') as mock_get: + r = rb.get_data(mock.MagicMock(), 'United States', 'Oregon', '') + self.assertEqual(cache_file, r) + # Make sure we returned the cached file + mock_get.assert_not_called() + + real_timedelta = datetime.timedelta + real_datetime = datetime.datetime + + future = datetime.datetime.now() + datetime.timedelta(days=4) + with mock.patch.object(repeaterbook, 'datetime') as mock_dt: + mock_dt.datetime.fromtimestamp = real_datetime.fromtimestamp + mock_dt.timedelta = real_timedelta + mock_dt.datetime.now.return_value = future + r = rb.get_data(mock.MagicMock(), + 'United States', 'Oregon', '') + # Cache file is 4 days old, we should use it + mock_get.assert_not_called() + + future = datetime.datetime.now() + datetime.timedelta(days=45) + with mock.patch.object(repeaterbook, 'datetime') as mock_dt: + mock_dt.datetime.fromtimestamp = real_datetime.fromtimestamp + mock_dt.timedelta = real_timedelta + mock_dt.datetime.now.return_value = future + r = rb.get_data(mock.MagicMock(), + 'United States', 'Oregon', '') + # Cache file is 45 days old, we should re-fetch + mock_get.assert_called() diff --git a/tests/unit/test_settings.py b/tests/unit/test_settings.py index 3fb84f0..108fb16 100644 --- a/tests/unit/test_settings.py +++ b/tests/unit/test_settings.py @@ -162,3 +162,12 @@ class TestSettingContainers(base.BaseTest): rs.set_apply_callback(test_cb, "foo", "bar") self.assertTrue(rs.has_apply_callback()) self.assertRaises(TestException, rs.run_apply_callback) + + def test_setting_banned_name(self): + self.assertRaises(settings.InvalidNameError, + settings.RadioSetting, "foo%bar", "Foo") + + def test_setting_banned_name_characters(self): + for c in settings.BANNED_NAME_CHARACTERS: + self.assertRaises(settings.InvalidNameError, + settings.RadioSetting, "foo%sbar" % c, "Foo") diff --git a/tests/unit/test_shiftdialog.py b/tests/unit/test_shiftdialog.py deleted file mode 100644 index 227c1af..0000000 --- a/tests/unit/test_shiftdialog.py +++ /dev/null @@ -1,105 +0,0 @@ -import unittest -try: - import mox -except ImportError: - from mox3 import mox - -from tests.unit import base -try: - from chirp.ui import shiftdialog -except ImportError: - shiftdialog = None -from chirp import chirp_common -from chirp import errors - -shiftdialog = None - - -class FakeRadio(object): - def __init__(self, *memories): - self._mems = {} - for location in memories: - mem = chirp_common.Memory() - mem.number = location - self._mems[location] = mem - self._features = chirp_common.RadioFeatures() - - def get_features(self): - return self._features - - def get_memory(self, location): - try: - return self._mems[location] - except KeyError: - mem = chirp_common.Memory() - mem.number = location - mem.empty = True - return mem - - def set_memory(self, memory): - self._mems[memory.number] = memory - - def erase_memory(self, location): - del self._mems[location] - - -class FakeRadioThread(object): - def __init__(self, radio): - self.radio = radio - - def lock(self): - pass - - def unlock(self): - pass - - -class ShiftDialogTest(base.BaseGTKTest): - def _test_hole(self, fn, starting, arg, expected): - radio = FakeRadio(*tuple(starting)) - radio.get_features().memory_bounds = (0, 5) - sd = shiftdialog.ShiftDialog(FakeRadioThread(radio)) - - if isinstance(arg, tuple): - getattr(sd, fn)(*arg) - else: - getattr(sd, fn)(arg) - - self.assertEqual(expected, sorted(radio._mems.keys())) - self.assertEqual(expected, - sorted([mem.number for mem in radio._mems.values()])) - - def _test_delete_hole(self, starting, arg, expected): - self._test_hole('_delete_hole', starting, arg, expected) - - def _test_insert_hole(self, starting, pos, expected): - self._test_hole('_insert_hole', starting, pos, expected) - - def test_delete_hole_with_hole(self): - self._test_delete_hole([1, 2, 3, 5], - 2, - [1, 2, 5]) - - def test_delete_hole_without_hole(self): - self._test_delete_hole([1, 2, 3, 4, 5], - 2, - [1, 2, 3, 4]) - - def test_delete_hole_with_all(self): - self._test_delete_hole([1, 2, 3, 5], - (2, True), - [1, 2, 4]) - - def test_delete_hole_with_all_full(self): - self._test_delete_hole([1, 2, 3, 4, 5], - (2, True), - [1, 2, 3, 4]) - - def test_insert_hole_with_space(self): - self._test_insert_hole([1, 2, 3, 5], - 2, - [1, 3, 4, 5]) - - def test_insert_hole_without_space(self): - self.assertRaises(errors.InvalidMemoryLocation, - self._test_insert_hole, [1, 2, 3, 4, 5], 2, []) diff --git a/tests/unit/test_th9800.py b/tests/unit/test_th9800.py new file mode 100644 index 0000000..095c4a7 --- /dev/null +++ b/tests/unit/test_th9800.py @@ -0,0 +1,55 @@ +import os +import unittest + +from chirp.drivers import th9800 + + +class Fake9800: + ident = (b'\x54\x48\x39\x38\x30\x30\xff\xff' + b'\x56\x31\x34\x78\xff\xff\xff\xff') + + def __init__(self): + self.writebuf = b'' + # Pre-load the identify dance + self.readbuf = b'A' + self.ident + + def write(self, data): + assert isinstance(data, bytes) + self.writebuf += data + if data.startswith(b'R'): + self.readbuf += b'W\x00\x00\x00' + (b'\x00' * 0x80) + elif data.startswith(b'W'): + self.writebuf += data + self.readbuf += b'A' + elif data == b'A': + assert len(self.readbuf) == 0 + self.readbuf += b'A' + elif data == b'ENDW': + self.readbuf += b'123' + + def read(self, n): + buf = self.readbuf[:n] + self.readbuf = self.readbuf[n:] + return buf + + +class TestTH9800(unittest.TestCase): + def test_identify(self): + f = Fake9800() + r = th9800.TYTTH9800Radio(f) + ident = th9800._identify(r) + self.assertEqual(f.ident, ident) + self.assertEqual(b'\x02PROGRAM\x02A', f.writebuf) + + def test_download(self): + f = Fake9800() + r = th9800.TYTTH9800Radio(f) + r.sync_in() + + def test_upload(self): + f = Fake9800() + img = os.path.join(os.path.dirname(__file__), + '..', 'images', 'TYT_TH-9800.img') + r = th9800.TYTTH9800Radio(img) + r.set_pipe(f) + r.sync_out() diff --git a/tests/unit/test_util.py b/tests/unit/test_util.py new file mode 100644 index 0000000..461f3d2 --- /dev/null +++ b/tests/unit/test_util.py @@ -0,0 +1,19 @@ +from chirp import util +from tests.unit import base + + +class TestUtils(base.BaseTest): + def test_hexprint_with_string(self): + util.hexprint('00000000000000') + + def test_hexprint_with_bytes(self): + util.hexprint(b'00000000000000') + + def test_hexprint_short(self): + expected = ('000: 00 00 00 00 00 00 00 00 ........\n' + '008: 00 ........\n') + self.assertEqual(expected, util.hexprint(b'\x00' * 9)) + + def test_hexprint_even(self): + expected = '000: 00 00 00 00 00 00 00 00 ........\n' + self.assertEqual(expected, util.hexprint(b'\x00' * 8)) diff --git a/tests/unit/test_utils.py b/tests/unit/test_utils.py deleted file mode 100644 index 575f3e3..0000000 --- a/tests/unit/test_utils.py +++ /dev/null @@ -1,21 +0,0 @@ -from chirp import util -from tests.unit import base - - -class TestUtils(base.BaseTest): - def test_hexprint_with_string(self): - util.hexprint('00000000000000') - - def test_hexprint_with_bytes(self): - util.hexprint(b'00000000000000') - - def test_struct_pack(self): - struct = util.StringStruct - - self.assertEqual('\x00c', - struct.pack('bc', 0, 'c')) - - def test_struct_unpack(self): - struct = util.StringStruct - - self.assertEqual((1, 'c'), struct.unpack('bc', '\x01c')) diff --git a/tests/unit/test_wxui_radiothread.py b/tests/unit/test_wxui_radiothread.py index c60da8c..99f9438 100644 --- a/tests/unit/test_wxui_radiothread.py +++ b/tests/unit/test_wxui_radiothread.py @@ -4,8 +4,10 @@ from unittest import mock sys.modules['wx'] = wx = mock.MagicMock() -from tests.unit import base -from chirp.wxui import radiothread +# These need to be imported after the above mock so that we don't require +# wx to be present for these tests +from tests.unit import base # noqa +from chirp.wxui import radiothread # noqa class TestRadioThread(base.BaseTest): @@ -85,9 +87,9 @@ class TestRadioThread(base.BaseTest): editor = mock.MagicMock() thread = radiothread.RadioThread(radio) mem = mock.MagicMock() - job1id = thread.submit(editor, 'get_memory', 12) - job2id = thread.submit(editor, 'set_memory', mem) - job3id = thread.submit(editor, 'get_features') + thread.submit(editor, 'get_memory', 12) + thread.submit(editor, 'set_memory', mem) + thread.submit(editor, 'get_features') thread.end() # We have to start the thread after we submit the main jobs so # the order is stable for comparison. diff --git a/tests/unit/test_yaesu_clone.py b/tests/unit/test_yaesu_clone.py index 869c3b5..f850ff1 100644 --- a/tests/unit/test_yaesu_clone.py +++ b/tests/unit/test_yaesu_clone.py @@ -1,6 +1,11 @@ from builtins import bytes +import os +import tempfile import unittest +from chirp import directory +from chirp.drivers import ft60 +from chirp.drivers import ft4 from chirp.drivers import yaesu_clone from chirp import memmap @@ -39,3 +44,139 @@ class TestYaesuChecksum(unittest.TestCase): def test_with_str(self): self._test_checksum('...\x2A') + + +class FakeFT60: + def __init__(self): + self.readbuf = b'' + self.writebuf = b'' + + def start_download(self): + self.readbuf += b'\x00' * 8 + for i in range(448): + self.readbuf += b'\x00' * 64 + + def write(self, data): + assert isinstance(data, bytes) + # Prepend echo so it is read first next + self.readbuf = data + self.readbuf + + self.writebuf += data + if len(data) == 1: + # If we're doing an upload, we need to ack this + # last short block + if self.writebuf.startswith(b'AH017'): + self.readbuf += b'\x06' + elif len(data) in (8, 64): + self.readbuf += b'\x06' + else: + raise Exception('Unhandled') + + def read(self, n): + buf = self.readbuf[:n] + self.readbuf = self.readbuf[n:] + return buf + + +class TestFT60(unittest.TestCase): + def test_download(self): + f = FakeFT60() + f.start_download() + r = ft60.FT60Radio(f) + r.sync_in() + # Make sure the ACKs are there + self.assertEqual(449, len(f.writebuf)) + self.assertEqual(f.writebuf, b'\x06' * 449) + + def test_upload(self): + f = FakeFT60() + img = os.path.join(os.path.dirname(__file__), + '..', 'images', 'Yaesu_FT-60.img') + r = ft60.FT60Radio(img) + r.set_pipe(f) + r.sync_out() + + +class FakeFTX4: + ID = ft4.YaesuFT4XERadio.id_str + + def __init__(self): + self.readbuf = b'' + self.writebuf = b'' + + def write(self, buf): + assert isinstance(buf, bytes) + # Echo + self.readbuf = buf + self.readbuf + if buf.startswith(b'PROGRAM'): + self.readbuf += b'QX' + elif buf == b'\x02': + # Ident + self.readbuf += self.ID + elif buf.startswith(b'R'): + resp = b'W' + buf[1:] + b'\x00' * 16 + self.readbuf += resp + bytes([ft4.checkSum8(resp[1:])]) + elif buf.startswith(b'W'): + pass + elif buf == b'END': + pass + else: + raise Exception('Unhandled %r' % buf) + self.readbuf += b'\x06' + + def read(self, n): + buf = self.readbuf[:n] + self.readbuf = self.readbuf[n:] + return buf + + +class FakeFT25R(FakeFTX4): + ID = ft4.YaesuFT25RRadio.id_str + + +class FakeFT25R_Asian(FakeFTX4): + ID = ft4.YaesuFT25RRadio.id_str[:-1] + b'\x03' + + +class TestFTX4(unittest.TestCase): + RCLASS = ft4.YaesuFT4XERadio + FAKE = FakeFTX4 + + def test_download(self): + f = self.FAKE() + r = self.RCLASS(f) + r.sync_in() + self.assertEqual(f.ID[-1], r.subtype) + + def test_upload(self): + f = self.FAKE() + fn = directory.radio_class_id(self.RCLASS) + img = os.path.join(os.path.dirname(__file__), + '..', 'images', '%s.img' % fn) + r = self.RCLASS(img) + r.set_pipe(f) + r.sync_out() + + def test_download_open(self): + f = self.FAKE() + r = self.RCLASS(f) + r.sync_in() + # Make sure we got subtype set as expected after download + self.assertEqual(f.ID[-1], r.subtype) + + # Save it out to a file + fn = tempfile.mktemp('.img', 'ft4') + r.save(fn) + + # Make sure if we re-load our image, we keep the same subtype + r = self.RCLASS(fn) + self.assertEqual(f.ID[-1], r.subtype) + + +class TestFT25(TestFTX4): + RCLASS = ft4.YaesuFT25RRadio + FAKE = FakeFT25R + + +class TestFT25_Asian(TestFT25): + FAKE = FakeFT25R_Asian diff --git a/tools/Makefile b/tools/Makefile index a9f08af..df750f3 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -32,4 +32,3 @@ serialsniff: serialsniff.c clean: $(REMOVE) serialsniff *~ *.o *.bak core tags shar a.out - diff --git a/tools/bitdiff.py b/tools/bitdiff.py deleted file mode 100644 index d06bdb2..0000000 --- a/tools/bitdiff.py +++ /dev/null @@ -1,166 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2013 Jens Jensen AF5MI - -import sys -import os -import argparse -import time - - -def printDiff(pos, byte1, byte2, args): - bits1 = '{0:08b}'.format(byte1) - bits2 = '{0:08b}'.format(byte2) - print "@%04Xh" % pos - print "1:%02Xh, %sb" % (byte1, bits1) - print "2:%02Xh, %sb" % (byte2, bits2) - if args.csv: - writeDiffCSV(pos, byte1, byte2, args) - - -def writeDiffCSV(pos, byte1, byte2, args): - bits1 = '{0:08b}'.format(byte1) - bits2 = '{0:08b}'.format(byte2) - csvline = '%s, %s, %04X, %02X, %s, %02X, %s, %s, %s' % \ - (args.file1, args.file2, pos, byte1, bits1, - byte2, bits2, args.setting, args.value) - if not os.path.isfile(args.csv): - fh = open(args.csv, "w") - header = "filename1, filename2, byte_offset, byte1, " \ - "bits1, byte2, bits2, item_msg, value_msg" - fh.write(header + os.linesep) - else: - fh = open(args.csv, "a") - fh.write(csvline + os.linesep) - fh.close() - - -def compareFiles(args): - f1 = open(args.file1, "rb") - f1.seek(args.offset) - f2 = open(args.file2, "rb") - f2.seek(args.offset) - - while True: - pos = f1.tell() - args.offset - c1 = f1.read(1) - c2 = f2.read(1) - if not (c1 and c2): - break - b1 = ord(c1) - b2 = ord(c2) - if b1 != b2: - printDiff(pos, b1, b2, args) - - pos = f1.tell() - args.offset - print "bytes read: %02d" % pos - f1.close() - f2.close() - - -def compareFilesDat(args): - f1 = open(args.file1, "r") - f1contents = f1.read() - f1.close() - f2 = open(args.file2, "r") - f2contents = f2.read() - f2.close() - - f1strlist = f1contents.split() - f1intlist = map(int, f1strlist) - f2strlist = f2contents.split() - f2intlist = map(int, f2strlist) - f1bytes = bytearray(f1intlist) - f2bytes = bytearray(f2intlist) - - length = len(f1intlist) - for i in range(length): - b1 = f1bytes[i] - b2 = f2bytes[i] - pos = i - if b1 != b2: - printDiff(pos, b1, b2, args) - - pos = length - print "bytes read: %02d" % pos - - -def convertFileToBin(args): - f1 = open(args.file1, "r") - f1contents = f1.read() - f1.close() - f1strlist = f1contents.split() - f1intlist = map(int, f1strlist) - f1bytes = bytearray(f1intlist) - f2 = open(args.file2, "wb") - f2.write(f1bytes) - f2.close - - -def convertFileToDat(args): - f1 = open(args.file1, "rb") - f1contents = f1.read() - f1.close() - f2 = open(args.file2, "w") - for i in range(0, len(f1contents)): - f2.write(" %d " % (ord(f1contents[i]), )) - if i % 16 == 15: - f2.write("\r\n") - f2.close - - -# main - -ap = argparse.ArgumentParser(description="byte-/bit- comparison of two files") -ap.add_argument("file1", help="first (reference) file to parse") -ap.add_argument("file2", help="second file to parse") - -mutexgrp1 = ap.add_mutually_exclusive_group() -mutexgrp1.add_argument("-o", "--offset", default=0, - help="offset (hex) to start comparison") -mutexgrp1.add_argument("-d", "--dat", action="store_true", - help="process input files from .DAT/.ADJ format " - "(from 'jujumao' oem programming software " - "for chinese radios)") -mutexgrp1.add_argument("--convert2bin", action="store_true", - help="convert file1 from .dat/.adj to " - "binary image file2") -mutexgrp1.add_argument("--convert2dat", action="store_true", - help="convert file1 from bin to .dat/.adj file2") - -ap.add_argument("-w", "--watch", action="store_true", - help="'watch' changes. runs in a loop") - -csvgrp = ap.add_argument_group("csv output") -csvgrp.add_argument("-c", "--csv", - help="file to append csv results. format: filename1, " - "filename2, byte_offset, byte1, bits1, byte2, " - "bits2, item_msg, value_msg") -csvgrp.add_argument("-s", "--setting", - help="user-meaningful field indicating setting/item " - "modified, e.g. 'beep' or 'txtone'") -csvgrp.add_argument("-v", "--value", - help="user-meaningful field indicating values " - "changed, e.g. 'true->false' or '110.9->100.0'") - -args = ap.parse_args() -if args.offset: - args.offset = int(args.offset, 16) - -print "f1:", args.file1, " f2:", args.file2 -if args.setting or args.value: - print "setting:", args.setting, "- value:", args.value - -while True: - if (args.dat): - compareFilesDat(args) - elif (args.convert2bin): - convertFileToBin(args) - elif (args.convert2dat): - convertFileToDat(args) - else: - compareFiles(args) - if not args.watch: - break - print "------" - time.sleep(delay) diff --git a/tools/check_commit.sh b/tools/check_commit.sh new file mode 100755 index 0000000..c92c2b0 --- /dev/null +++ b/tools/check_commit.sh @@ -0,0 +1,93 @@ +#!/bin/bash + +BASE=${1:-origin/master} +RETCODE=0 + +RED='\033[1;31m' +GREEN='\033[1;32m' +NC='\033[0m' + +function fail() { + echo -e "${RED}$*${NC}" + RETCODE=1 +} + +echo -e "${GREEN}Checking from $(git rev-parse --short ${BASE}):${NC}" +git log --pretty=oneline --no-merges --abbrev-commit ${BASE}.. +echo + +git diff ${BASE}.. '*.py' | grep '^+' > added_lines + +if grep -E '(from|import).*six' added_lines; then + fail No new uses of future +fi + +if grep -E '\wsix\w' added_lines; then + fail No new uses of six +fi + +if grep -E '(from|import).*builtins' added_lines; then + fail No new uses of future +fi + +if grep -E '\wfuture\w' added_lines; then + fail No new uses of future +fi + +if grep -E '(from|import).*past' added_lines; then + fail Use of past library not allowed +fi + +if grep -E 'MemoryMap\(' added_lines; then + fail New uses of MemoryMap should be MemoryMapBytes +fi + +if grep -E "[^_]_\([^\"']" added_lines; then + fail 'Translated strings must be literals!' +fi + +if grep '/cpep8.manifest' added_lines; then + fail 'Do not add new files to cpep8.manifest; no longer needed' +fi + +if grep '/cpep8.blacklist' added_lines; then + fail 'Do not add new files to cpep8.blacklist' +fi + +grep -i 'license' added_lines > license_lines +if grep -ivE '(GNU General Public License|Free Software Foundation|gnu.org.licenses)' license_lines; then + fail 'Files must be GPLv3 licensed (or not contain any license language)' +fi + +for file in $(git diff --name-only ${BASE}..); do + if file $file | grep -q CRLF; then + fail "$file : Files should be LF (Unix) format, not CR (Mac) or CRLF (Windows)" + fi +done + +if git log ${BASE}.. --merges | grep .; then + fail Please do not include merge commits in your PR +fi + +make -C chirp/locale clean all >/dev/null 2>&1 +if git diff chirp/locale | grep '^\+[^#+]' | grep -v POT-Creation; then + fail Locale files need updating +fi + +added_files=$(git diff --name-only --diff-filter=A ${BASE}.. 2>&1) +if echo $added_files | grep -q chirp.drivers && ! echo $added_files | grep -q tests.images; then + fail All new drivers should include a test image +fi + +existing_drivers=$(git ls-tree --name-only $BASE chirp/drivers/) +limit=20 +for nf in $added_files; do + for of in $existing_drivers; do + change=$(wdiff -s $of $nf | grep $of | sed -r 's/.* ([0-9]+)% changed/\1/') + if [ "$change" -lt "$limit" ]; then + fail "New file $nf shares at least $((100 - $change))% with $of!" + fi + done +done + +exit $RETCODE diff --git a/tools/cpep8.blacklist b/tools/cpep8.blacklist index 6a98e72..7011690 100644 --- a/tools/cpep8.blacklist +++ b/tools/cpep8.blacklist @@ -1,3 +1,21 @@ # cpep8.blacklist: The list of files that do not meet PEP8 standards. # DO NOT ADD NEW FILES!! Instead, fix the code to be compliant. # Over time, this list should shrink and (eventually) be eliminated. +./chirp/drivers/kyd_IP620.py +./chirp/drivers/kguv8dplus.py +./chirp/drivers/ft450d.py +./chirp/drivers/ft70.py +./chirp/drivers/hg_uv98.py +./chirp/drivers/hobbypcb.py +./chirp/drivers/retevis_rb28.py +./chirp/drivers/bj9900.py +./chirp/drivers/th7800.py +./chirp/drivers/icx90.py +./chirp/drivers/kguv8e.py +./chirp/drivers/rh5r_v2.py +./chirp/drivers/puxing_px888k.py +./chirp/drivers/ftlx011.py +./chirp/drivers/icv86.py +./chirp/drivers/fd268.py +./chirp/drivers/tk270.py +./chirp/drivers/bf_t1.py diff --git a/tools/cpep8.manifest b/tools/cpep8.manifest index 57a6982..4722d1f 100644 --- a/tools/cpep8.manifest +++ b/tools/cpep8.manifest @@ -1,85 +1,39 @@ -./chirp/__init__.py -./chirp/bandplan.py -./chirp/bandplan_au.py -./chirp/bandplan_iaru_r1.py -./chirp/bandplan_iaru_r2.py -./chirp/bandplan_iaru_r3.py -./chirp/bandplan_na.py -./chirp/bitwise.py -./chirp/bitwise_grammar.py -./chirp/chirp_common.py -./chirp/detect.py -./chirp/directory.py -./chirp/drivers/__init__.py +# +# +# NOTE: Do not add files to this manifest anymore. New files will be run +# under flake8 automatically if they are in the tree. Files in this manifest +# will continue to run under cpep8's less-strict rules until they can be +# fixed. +# +# ./chirp/drivers/alinco.py -./chirp/drivers/anytone.py -./chirp/drivers/anytone_ht.py ./chirp/drivers/anytone778uv.py -./chirp/drivers/ap510.py +./chirp/drivers/anytone_ht.py +./chirp/drivers/anytone_iii.py ./chirp/drivers/baofeng_common.py ./chirp/drivers/baofeng_uv3r.py -./chirp/drivers/baofeng_wp970i.py -./chirp/drivers/bf-t8.py -./chirp/drivers/bjuv55.py +./chirp/drivers/bf_t8.py ./chirp/drivers/btech.py -./chirp/drivers/ft1500m.py -./chirp/drivers/ft1802.py ./chirp/drivers/ft1d.py -./chirp/drivers/ft2800.py ./chirp/drivers/ft2900.py -./chirp/drivers/ft4.py -./chirp/drivers/ft50.py ./chirp/drivers/ft60.py -./chirp/drivers/ft7100.py ./chirp/drivers/ft7800.py -./chirp/drivers/ft817.py -./chirp/drivers/ft818.py -./chirp/drivers/ft857.py ./chirp/drivers/ft90.py -./chirp/drivers/ftm350.py ./chirp/drivers/ga510.py ./chirp/drivers/generic_csv.py -./chirp/drivers/generic_tpe.py -./chirp/drivers/gmrsuv1.py ./chirp/drivers/gmrsv2.py ./chirp/drivers/h777.py -./chirp/drivers/ic208.py -./chirp/drivers/ic2100.py -./chirp/drivers/ic2200.py -./chirp/drivers/ic2720.py ./chirp/drivers/ic2730.py -./chirp/drivers/ic2820.py -./chirp/drivers/ic9x.py -./chirp/drivers/ic9x_icf.py -./chirp/drivers/ic9x_icf_ll.py -./chirp/drivers/ic9x_ll.py ./chirp/drivers/icf.py ./chirp/drivers/icomciv.py -./chirp/drivers/icq7.py -./chirp/drivers/ict70.py -./chirp/drivers/ict7h.py -./chirp/drivers/ict8.py -./chirp/drivers/icw32.py -./chirp/drivers/icx8x.py -./chirp/drivers/icx8x_ll.py -./chirp/drivers/id31.py -./chirp/drivers/id51.py -./chirp/drivers/id800.py -./chirp/drivers/id880.py -./chirp/drivers/idrp.py -./chirp/drivers/iradio_uv-5118.py -./chirp/drivers/kenwood_hmk.py -./chirp/drivers/kenwood_itm.py +./chirp/drivers/iradio_uv_5118.py ./chirp/drivers/kenwood_live.py ./chirp/drivers/kg935g.py -./chirp/drivers/kguv8d.py ./chirp/drivers/kguv920pa.py ./chirp/drivers/kguv9dplus.py ./chirp/drivers/kyd.py ./chirp/drivers/leixen.py ./chirp/drivers/lt725uv.py -./chirp/drivers/mursv1.py -./chirp/drivers/puxing.py ./chirp/drivers/radioddity_r2.py ./chirp/drivers/radtel_t18.py ./chirp/drivers/retevis_rb15.py @@ -92,94 +46,24 @@ ./chirp/drivers/retevis_rt76p.py ./chirp/drivers/retevis_rt87.py ./chirp/drivers/retevis_rt98.py -./chirp/drivers/rfinder.py ./chirp/drivers/tdxone_tdq8a.py -./chirp/drivers/template.py -./chirp/drivers/tg_uv2p.py -./chirp/drivers/th350.py +./chirp/drivers/th9000.py ./chirp/drivers/th9800.py ./chirp/drivers/th_uv3r.py ./chirp/drivers/th_uv3r25.py ./chirp/drivers/th_uv8000.py ./chirp/drivers/th_uv88.py -./chirp/drivers/th_uvf8d.py -./chirp/drivers/th9000.py -./chirp/drivers/th9800.py ./chirp/drivers/thd72.py -./chirp/drivers/thuv1f.py ./chirp/drivers/tk760.py -./chirp/drivers/tk8102.py +./chirp/drivers/tk760g.py ./chirp/drivers/tk8180.py ./chirp/drivers/tmd710.py -./chirp/drivers/tmv71.py -./chirp/drivers/tmv71_ll.py ./chirp/drivers/ts480.py ./chirp/drivers/ts590.py ./chirp/drivers/uv5r.py ./chirp/drivers/uv5x3.py -./chirp/drivers/uv6r.py -./chirp/drivers/uvb5.py ./chirp/drivers/vgc.py -./chirp/drivers/vx170.py -./chirp/drivers/vx2.py -./chirp/drivers/vx3.py -./chirp/drivers/vx5.py -./chirp/drivers/vx510.py ./chirp/drivers/vx6.py ./chirp/drivers/vx7.py ./chirp/drivers/vx8.py -./chirp/drivers/vxa700.py ./chirp/drivers/wouxun.py -./chirp/drivers/wouxun_common.py -./chirp/drivers/yaesu_clone.py -./chirp/elib_intl.py -./chirp/errors.py -./chirp/import_logic.py -./chirp/logger.py -./chirp/memmap.py -./chirp/platform.py -./chirp/pyPEG.py -./chirp/radioreference.py -./chirp/settings.py -./chirp/ui/__init__.py -./chirp/ui/bandplans.py -./chirp/ui/bankedit.py -./chirp/ui/clone.py -./chirp/ui/cloneprog.py -./chirp/ui/common.py -./chirp/ui/config.py -./chirp/ui/dstaredit.py -./chirp/ui/editorset.py -./chirp/ui/fips.py -./chirp/ui/importdialog.py -./chirp/ui/inputdialog.py -./chirp/ui/mainapp.py -./chirp/ui/memdetail.py -./chirp/ui/memedit.py -./chirp/ui/miscwidgets.py -./chirp/ui/radiobrowser.py -./chirp/ui/reporting.py -./chirp/ui/settingsedit.py -./chirp/ui/shiftdialog.py -./chirp/util.py -./chirpc -./chirpw -./locale/check_parameters.py -./rpttool -./setup.py -./share/make_supported.py -./tests/__init__.py -./tests/run_tests -./tests/unit/__init__.py -./tests/unit/base.py -./tests/unit/test_bitwise.py -./tests/unit/test_chirp_common.py -./tests/unit/test_import_logic.py -./tests/unit/test_mappingmodel.py -./tests/unit/test_memedit_edits.py -./tests/unit/test_platform.py -./tests/unit/test_settings.py -./tests/unit/test_shiftdialog.py -./tools/bitdiff.py -./tools/cpep8.py -./tools/img2thd72.py diff --git a/tools/cpep8.py b/tools/cpep8.py index b073f48..678281f 100755 --- a/tools/cpep8.py +++ b/tools/cpep8.py @@ -17,16 +17,24 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +import warnings + import os import sys -import logging import argparse -import pep8 +import subprocess + +# pep8 has a FutureWarning about nested sets. This isn't our problem, so +# squelch it here during import. +with warnings.catch_warnings(): + warnings.simplefilter('ignore') + import pep8 + parser = argparse.ArgumentParser() parser.add_argument("-a", "--all", action="store_true", help="Check all files, ignoring blacklist") -parser.add_argument("-d", "--dir", action="store", default=".", +parser.add_argument("-d", "--dir", action="append", default=['chirp', 'tests'], help="Root directory of source tree") parser.add_argument("-s", "--stats", action="store_true", help="Only show statistics") @@ -48,7 +56,7 @@ def file_to_lines(name): lines = fh.read().split("\n") lines.pop() fh.close() - return lines + return [x for x in lines if not x.startswith('#')] scriptdir = os.path.dirname(sys.argv[0]) @@ -56,20 +64,21 @@ manifest_filename = os.path.join(scriptdir, "cpep8.manifest") blacklist_filename = os.path.join(scriptdir, "cpep8.blacklist") exceptions_filename = os.path.join(scriptdir, "cpep8.exceptions") -manifest = [] -if args.scan: - for root, dirs, files in os.walk(args.dir): +cpep8_manifest = set(file_to_lines(manifest_filename)) +flake8_manifest = set() +for src_dir in [os.path.join('.', d) for d in args.dir]: + for root, dirs, files in os.walk(src_dir): for f in files: filename = os.path.join(root, f) + if filename.replace('\\', '/') in cpep8_manifest: + continue if f.endswith('.py'): - manifest.append(filename) + flake8_manifest.add(filename) continue - with open(filename, "r") as fh: + with open(filename, "rb") as fh: shebang = fh.readline() - if shebang.startswith("#!/usr/bin/env python"): - manifest.append(filename) -else: - manifest += file_to_lines(manifest_filename) + if shebang.startswith(b"#!/usr/bin/env python"): + flake8_manifest.add(filename) # unless we are being --strict, load per-file style exceptions @@ -89,37 +98,25 @@ def get_exceptions(f): ignore = None return ignore -if args.update: - print("Starting update of %d files" % len(manifest)) - bad = [] - for f in manifest: - checker = pep8.StyleGuide(quiet=True, ignore=get_exceptions(f)) - results = checker.check_files([f]) - if results.total_errors: - bad.append(f) - print("%s: %s" % (results.total_errors and "FAIL" or "PASS", f)) - - with open(blacklist_filename, "w") as fh: - fh.write("""\ -# cpep8.blacklist: The list of files that do not meet PEP8 standards. -# DO NOT ADD NEW FILES!! Instead, fix the code to be compliant. -# Over time, this list should shrink and (eventually) be eliminated.""") - fh.write("\n".join(sorted(bad))) - - if args.scan: - with open(manifest_filename, "w") as fh: - fh.write("\n".join(sorted(manifest))) - sys.exit(0) if args.files: - manifest = args.files + old_files = cpep8_manifest + cpep8_manifest = [] + flake8_manifest = [] + for fn in args.files: + if not fn.startswith('./'): + fn = './' + fn + if fn in old_files: + cpep8_manifest.append(fn) + else: + flake8_manifest.append(fn) # read the blacklisted source files blacklist = file_to_lines(blacklist_filename) check_list = [] -for f in manifest: - if args.all or f not in blacklist: +for f in cpep8_manifest: + if args.all or f.replace('\\', '/') not in blacklist: check_list.append(f) check_list = sorted(check_list) @@ -134,4 +131,15 @@ for f in check_list: checker.report.print_statistics() total_errors += results +flake8_manifest = [f for f in flake8_manifest + if f.replace('\\', '/') not in blacklist] + +for i in range(0, len(flake8_manifest), 10): + files = flake8_manifest[i:i + 10] + if args.verbose: + print('Checking %s' % files) + r = subprocess.call(['flake8', '--builtins=_'] + files) + if r != 0: + total_errors += r + sys.exit(total_errors and 1 or 0) diff --git a/tools/fast-driver.py b/tools/fast-driver.py new file mode 100755 index 0000000..669a5e1 --- /dev/null +++ b/tools/fast-driver.py @@ -0,0 +1,104 @@ +#!/usr/bin/env Python3 + +import glob +import os +import subprocess +import sys + + +def parse_import_line(line): + pieces = line.split() + if line.startswith('from'): + base = pieces[1] + if 'drivers.' in base: + imports = [base.split('.')[-1]] + return imports + else: + imports = pieces[3:] + if pieces[-1].endswith(','): + raise Exception('Failed to parse multi-line import') + return [x.strip().strip(',') for x in imports] + elif 'drivers' in line: + raise Exception('Unhandled bare import driver line: %s' % line) + else: + return [] + + +def find_imports(of_modules): + driver_imports = [] + for fn in glob.glob('chirp/drivers/*.py'): + with open(fn) as f: + lines = [ln for ln in f.readlines() + if 'import ' in ln and 'drivers' in ln] + imports = [] + for line in lines: + imports.extend(parse_import_line(line)) + if set(imports) & of_modules: + driver_imports.append(os.path.splitext(os.path.basename(fn))[0]) + return driver_imports + + +files = subprocess.check_output( + ['git', 'diff', 'origin/master', '--name-only', '.']).decode().split() + +# A list of modules and their parent [(chirp/drivers, tk8180)] +files_by_module = [x.rsplit('/', 1) for x in files if '/' in x and '.py' in x] + +# Grab just the drivers +driver_modules = set([os.path.splitext(os.path.basename(mod))[0] + for parent, mod in files_by_module + if parent == 'chirp/drivers']) + +# Determine which are live drivers that we don't test with these tests +live_drivers = set() +for driver in driver_modules: + try: + with open(os.path.join('chirp', 'drivers', '%s.py' % driver)) as f: + content = f.read() + except FileNotFoundError: + # File must have been removed + continue + if 'LiveRadio' in content: + live_drivers.add(driver) + +print('Touched drivers: %s' % ','.join(driver_modules)) +# Find deps before we remove live modules in case there are any changed +# modules that depend on the bases that have live drivers in them (i.e. icf or +# kenwood_live) +deps = find_imports(driver_modules) +print('Found deps of touched modules: %s' % ','.join(deps)) +# Remove live drivers from driver_modules before we add in the deps of changed +# modules, as they may imply some shared code (like icf) +driver_modules -= live_drivers +driver_modules.update(set(deps)) + +# Determine if any base modules have been changed that would necessitate +# running all the driver tests +exclude_mods = ('chirp/wxui', 'chirp/cli', 'chirp/sources', 'chirp/drivers', + 'chirp/locale', 'chirp/share', 'chirp/stock_configs', + 'tools') +base_modules = [mod for parent, mod in files_by_module + if parent not in exclude_mods] + +if base_modules: + print('Base modules touched; running all drivers: %s' % base_modules) + driver_exp = [] +elif driver_modules: + driver_exp = ' or '.join(f for f in driver_modules) +else: + print('No driver tests necessary for changes in %s' % ','.join( + files)) + sys.exit(0) + +args = ['pytest'] +if driver_exp: + args += ['-k', driver_exp] +args += sys.argv[1:] +print(args) +rc = subprocess.call(args) +if rc == 5: + # This means no tests were found likely because we generated a bad + # tag, so just run the full set + print('Running full driver set') + rc = subprocess.call(['pytest'] + sys.argv[1:]) +sys.exit(rc) diff --git a/tools/icomsio.sh b/tools/icomsio.sh index f5f126d..8b11107 100755 --- a/tools/icomsio.sh +++ b/tools/icomsio.sh @@ -92,4 +92,3 @@ for usbserial in /sys/class/tty/ttyUSB*; do break fi done - diff --git a/tools/img2thd72.py b/tools/img2thd72.py deleted file mode 100644 index 2ed1082..0000000 --- a/tools/img2thd72.py +++ /dev/null @@ -1,127 +0,0 @@ -#!/usr/bin/env python -# coding=utf-8 -# ex: set tabstop=4 expandtab shiftwidth=4 softtabstop=4: -# -# © Copyright Vernon Mauery , 2010. All Rights Reserved -# -# This is free software: you can redistribute it and/or modify it -# under the terms of the GNU Lesser General Public License as published -# by the Free Software Foundation, either version 3 of the License, or (at -# your option) any later version. -# -# This software is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public -# License for more details. -# -# You should have received a copy of the GNU Lesser General Public License -# along with this software. If not, see . - - -import sys -import getopt -from PIL import Image as im - - -def die(msg): - print msg - sys.exit(1) - - -def thd72bitmap(fname, invert): - img = im.open(ifname) - if img.size != (120, 48): - die("Image has wrong dimensions: must be 120x48") - - colors = img.getcolors() - if len(colors) != 2: - die("Image must be 1 bits per pixel (black and white)") - - if ('-i', '') in opts: - c, black = colors[0] - c, white = colors[1] - else: - c, white = colors[0] - c, black = colors[1] - - colors = {black: 1, white: 0} - data = img.getdata() - buf = '' - for y in range(6): - for x in range(120): - b = 0 - for i in range(8): - b |= colors[data[x + 120 * (y * 8 + i)]] << i - buf += chr(b) - return buf - - -def display_thd72(buf): - dots = {0: '*', 1: ' '} - lines = [] - for y in range(48): - line = '' - for x in range(120): - byte = y/8*120 + x - line += dots[(ord(buf[byte]) >> (y % 8)) & 0x01] - lines.append(line) - for l in lines: - print l - - -def usage(): - print "\nUsage: %s <-s|-g> [-i] [-d] " \ - " " % sys.argv[0] - print "\nThis program will modify whatever nvram file provided or will" - print "create a new one if the file does not exist. After using this to" - print "modify the image, you can use that file to upload all or part of" - print "it to your radio" - print "\nOption explanations:" - print " -s Save as the startup image" - print " -g Save as the GPS logger image" - print " -i Invert colors (black for white)" - print " Depending on the file format the bits may be inverted." - print " If your bitmap file turns out to be inverted, use -i." - print " -d Display the bitmap as dots (for confirmation)" - print " Each black pixel is '*' and each white pixel is ' '" - print " This will print up to 120 dots wide, so beware your" - print " terminal size." - sys.exit(1) - -if __name__ == "__main__": - opts, args = getopt.getopt(sys.argv[1:], "idgs") - if len(args) != 2: - usage() - ifname = args[0] - ofname = args[1] - invert = ('-i', '') in opts - gps = ('-g', '') in opts - startup = ('-s', '') in opts - if (gps and startup) or not (gps or startup): - usage() - if gps: - imgpos = 0xe800 - tagpos = 18 - else: - imgpos = 0xe500 - tagpos = 17 - - buf = thd72bitmap(ifname, invert) - imgfname = ifname + '\xff' * (48-len(ifname)) - of = file(ofname, "rb+") - of.seek(tagpos) - of.write('\x01') - of.seek(imgpos) - of.write(buf) - of.write(imgfname) - of.seek(65536) - of.close() - - if ('-d', '') in opts: - display_thd72(buf) - - blocks = [0, ] - blocks.append(imgpos/256) - blocks.append(1+imgpos/256) - blocks.append(2+imgpos/256) - print "Modified block list:", blocks diff --git a/tools/py3_driver_progress.py b/tools/py3_driver_progress.py index 52a9e2f..bd0f22a 100644 --- a/tools/py3_driver_progress.py +++ b/tools/py3_driver_progress.py @@ -2,11 +2,13 @@ import argparse import csv +import os import sys +import textwrap from chirp import directory -directory.safe_import_drivers() +directory.import_drivers() def tester_link(text): @@ -16,26 +18,47 @@ def tester_link(text): assert text[1:] in directory.DRV_TO_RADIO, \ '%s is not in the driver directory' % text[1:] return '[Implied by %s](#user-content-%s)' % (text[1:], text[1:]) + elif text.startswith('*'): + assert os.path.exists(os.path.join('chirp', 'drivers', + text[1:] + '.py')) + return ('[Probably works](' + 'https://github.com/kk7ds/chirp' + '/blob/py3/chirp/drivers/%s.py)' % ( + text[1:])) + elif text.startswith('#') and text[1:].isdigit(): + return ('[Reported working]' + '(https://chirp.danplanet.com/issues/%i)' % int(text[1:])) else: return text -def main(): - p = argparse.ArgumentParser() - p.add_argument('testers') - p.add_argument('-o', '--output', default='-') - args = p.parse_args() +def read_stats(statsfile): + with open(statsfile) as f: + lines = f.readlines() + + models = {} + total = 0 + skip = ['Repeaterbook', 'Radio Reference', 'CHIRP', 'CSV'] + for line in lines[1:]: + model, count = line.strip().split('\t') + model = model.replace(' ', '_').\ + replace('(', '').\ + replace(')', '').\ + replace('/', '_') + if any(s in model for s in skip): + continue + count = int(count) + models[model] = count + total += count - headers = ['Driver', 'Tester', 'Tested'] - testers = {} + return total, models - if args.output == '-': - output = sys.stdout - else: - output = open(args.output, 'w') +def read_testers(testersfile): + headers = ['Driver', 'Tester', 'Tested'] line = 0 - for fields in csv.reader(open(args.testers)): + testers = {} + for fields in csv.reader(open(testersfile)): line += 1 if fields[0][0] == '#': continue @@ -53,31 +76,76 @@ def main(): testers[fields[0]] = fields[1:] + return testers + + +def get_share_for_radio(stats, stats_total, parent_cls): + count = 0 + for cls in [parent_cls] + parent_cls.ALIASES: + driver = directory.radio_class_id(cls) + simple_driver = '%s_%s' % (cls.VENDOR, cls.MODEL) + if driver in stats: + count += stats.pop(driver, 0) + elif simple_driver in stats: + count += stats.pop(simple_driver, 0) + + if count == 0: + share = '' + else: + pct = (count * 100 / stats_total) + share = '%.2f%%' % pct + if pct > 1: + share = '**%s**' % share + return count, share + + +def main(): + p = argparse.ArgumentParser() + p.add_argument('testers') + p.add_argument('stats') + p.add_argument('-o', '--output', default='-') + args = p.parse_args() + + testers = read_testers(args.testers) + stats_total, stats = read_stats(args.stats) + + if args.output == '-': + output = sys.stdout + else: + output = open(args.output, 'w') + print('## Status', file=output) - print('| Driver | Tester | Tested | Byte Clean |', file=output) - print('| ------ | ------ | ------ | ---------- |', file=output) + print('| Driver | Tester | Tested | Byte Clean | "Market Share" |', + file=output) + print('| ------ | ------ | ------ | ---------- | -------------- |', + file=output) drivers = sorted([ident for ident in directory.DRV_TO_RADIO]) drvstested = 0 byteclean = 0 + tested_stats = 0 for driver in drivers: cls = directory.get_radio(driver) tester, tested = testers.pop(driver, ('', '')) if tester: drvstested += 1 + count, share = get_share_for_radio(stats, stats_total, cls) + if tester: + tested_stats += count if not cls.NEEDS_COMPAT_SERIAL: byteclean += 1 - print('| %s | %s | %s | %s |' % ( + print('| %s | %s | %s | %s | %s |' % ( driver, driver, tester_link(tester), tested, - '' if cls.NEEDS_COMPAT_SERIAL else 'Yes'), + '' if cls.NEEDS_COMPAT_SERIAL else 'Yes', share), file=output) print('## Stats', file=output) print('\n**Drivers:** %i' % (len(drivers)), file=output) - print('\n**Tested:** %i%% (%i/%i)' % ( + print('\n**Tested:** %i%% (%i/%i) (%i%% of usage stats)' % ( drvstested / len(drivers) * 100, - drvstested, len(drivers) - drvstested), + drvstested, len(drivers) - drvstested, + tested_stats * 100 / stats_total), file=output) print('\n**Byte clean:** %i%% (%i/%i)' % ( byteclean / len(drivers) * 100, @@ -85,6 +153,64 @@ def main(): len(drivers) - byteclean), file=output) + print(textwrap.dedent(""" + ## Meaning of this testing + + The goal here is not necessarily to test the drivers themselves in terms of + actual functionality, but rather to validate the Python 3 conversion + work required of nearly all drivers. Thus, we are not trying to + comprehensively test these models so much as make sure they work at least + as well as they do on the Python 2 branch. Uncovering and reporting new + bugs is definitely welcome, but for the purpoes of this effort, "no worse + than the legacy branch" is good enough. There are multiple levels of + confirmation in the matrix above: + * Tested with real hardware (i.e. a person listed in the "Tester" column) + using roughly the procedure below. + * An "implied by (model)" link means that another model was tested, and it + is so similar, that the model on that line can be considered tested as + well. + * A "probably works" link means that the driver has not been tested with + real hardware, nor is it substantially similar to another model, but + shares a common base that entirely provides the cloning routines with + other drivers that have been tested with real hardware, such that + confidence is high that it will work. Only drivers with test images in + the tree (or live drivers) should be marked with this class. + * A "unit tested" link means that the driver has not been tested with + real hardware, nor does it share common cloning routines with another + radio. However, synthetic simulation tests have been added to exercise + the parts of the cloning routines that are likely to fail under python3. + This is the lowest-confidence status and a real confirmation is needed. + + If you have a model listed in this matrix with either "implied" or + "probably works" status, an actual confirmation with real hardware is + welcome and can replace the weaker reference. + + ## Minimal test procedure + For the purposes of the Python 3 effort, a "tested" radio means + at least the following procedure was followed: + 1. Download from the radio + 1. Make some change to a memory + 1. If the radio has settings support, make sure settings load and tweak + one setting + 1. Upload to the radio + 1. Confirm that the changes stick and look correct, or at least are not a + regression from the master py2 branch. + + The drivers are all passing the automated tests, but tests with real + hardware and serial ports is important, especially around bytes-vs-string + safety. + + To update this document, add/edit entries in `tests/py3_driver_testers.txt` + and then run `tox -e makesupported`. Commit the result (including the + changes to this `.md` file) and submit a PR. + + The "Byte Clean" flag refers to whether or not the radio has set the + `NEEDS_COMPAT_SERIAL = False` flag on the radio class, and thus uses + `MemoryMapBytes` exclusively internally. Whenever possible, all radios + that are fixed for py3 should do so with this flag set to False and with + the byte-native memory map."""), + file=output) + for driver, (tester, tested) in testers.items(): print('Error in testers file; driver %s by %s on %s unknown' % ( driver, tester, tested), file=sys.stderr) diff --git a/tools/serialsniff.c b/tools/serialsniff.c index 02037d7..2454484 100644 --- a/tools/serialsniff.c +++ b/tools/serialsniff.c @@ -146,7 +146,7 @@ int saferead(int fd, char *buf, int len) if ((val.it_value.tv_sec == 0) && (val.it_value.tv_usec == 0)) { if (!quiescent) - printf("Timeout\n"); + printf("Timeout\n"); break; } diff --git a/tox.ini b/tox.ini deleted file mode 100644 index dc44ec8..0000000 --- a/tox.ini +++ /dev/null @@ -1,81 +0,0 @@ -[tox] -envlist = unit,driver,style,py3clean,py3unit,py3driver -skipsdist = True - -[testenv] -basepython = python2.7 -sitepackages = True -passenv = HOME CHIRP_TESTS CHIRP_TESTIMG -whitelist_externals = bash -deps = future - -[testenv:unit] -deps = - pytest - mox - mock - future - pytest-xdist -commands = - pytest --disable-warnings -v tests/unit {posargs} - python ./share/make_supported.py /dev/null - -[testenv:driver] -deps = - future - pytest - pytest-xdist -commands = - pytest --disable-warnings -v tests/test_drivers.py {posargs} - -[testenv:style] -basepython = python3 -sitepackages = False -deps = - pep8 - future - flake8 -commands = - python3 ./tools/cpep8.py - flake8 --builtins="_" chirp/wxui - -[textenv:py3clean] -commands = - py3clean chirp tests - -[testenv:py3unit] -basepython = python3 -sitepackages = False -setenv = - PYTHONPATH=../.. -deps = - -rtest-requirements.txt -commands = - pytest --disable-warnings --html=unit_report.html -v tests/unit {posargs} - -[testenv:py3driver] -basepython = python3 -sitepackages = False -setenv = - PYTHONPATH=../.. - CHIRP_DEBUG=y -deps = - {[testenv:py3unit]deps} - pytest-xdist -commands = - pytest --disable-warnings --html=driver_report.html -v tests/test_drivers.py -n auto {posargs} - -[pytest] -xfail_strict = true - -[testenv:makesupported] -basepython = python3 -sitepackages = False -whitelist_externals = git -deps = - -rtest-requirements.txt -commands = - python3 share/make_supported.py model_support.html - python3 setup.py develop - python3 tools/py3_driver_progress.py -o tests/Python3_Driver_Testing.md tests/py3_driver_testers.txt - git diff --exit-code tests/Python3_Driver_Testing.md -- cgit v1.2.3