Dynamic driver registration

This patch gets rid of the big silly static definition of the driver
directory and replaces it with one that is populated dynamically. When
multiple people are working on a driver, it's often the case that patches
will conflict because they both made edits to the directory listing.
Further, it makes it harder to add/remove a module during development because
you have to edit the directory.

This patch introduces a "register" decorator in the directory module. Any
driver claiming to implement a radio driver can decorate that class and
have it automatically included in the directory. Thus, simply placing
mydriver.py in the chirp module folder will cause it to be included.
This commit is contained in:
Dan Smith 2012-02-17 16:08:23 -08:00
parent b9d2e3709c
commit ceea319554
34 changed files with 126 additions and 115 deletions

View File

@ -14,3 +14,14 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
CHIRP_VERSION="0.1.13dev"
import os
import sys
from glob import glob
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)

View File

@ -13,7 +13,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from chirp import chirp_common, bitwise, memmap, errors
from chirp import chirp_common, bitwise, memmap, errors, directory
import time
@ -288,6 +288,7 @@ class DRx35Radio(AlincoStyleRadio):
_mem.name = self._set_name(mem, _mem)
@directory.register
class DR03Radio(DRx35Radio):
VENDOR = "Alinco"
MODEL = "DR03T"
@ -301,6 +302,7 @@ class DR03Radio(DRx35Radio):
return len(filedata) == cls._memsize and \
filedata[0x64] == chr(0x00) and filedata[0x65] == chr(0x28)
@directory.register
class DR06Radio(DRx35Radio):
VENDOR = "Alinco"
MODEL = "DR06T"
@ -314,6 +316,7 @@ class DR06Radio(DRx35Radio):
return len(filedata) == cls._memsize and \
filedata[0x64] == chr(0x00) and filedata[0x65] == chr(0x50)
@directory.register
class DR135Radio(DRx35Radio):
VENDOR = "Alinco"
MODEL = "DR135T"
@ -327,6 +330,7 @@ class DR135Radio(DRx35Radio):
return len(filedata) == cls._memsize and \
filedata[0x64] == chr(0x01) and filedata[0x65] == chr(0x44)
@directory.register
class DR235Radio(DRx35Radio):
VENDOR = "Alinco"
MODEL = "DR235T"
@ -340,6 +344,7 @@ class DR235Radio(DRx35Radio):
return len(filedata) == cls._memsize and \
filedata[0x64] == chr(0x02) and filedata[0x65] == chr(0x22)
@directory.register
class DR435Radio(DRx35Radio):
VENDOR = "Alinco"
MODEL = "DR435T"
@ -366,6 +371,7 @@ DJ596_TONES.remove(206.5)
DJ596_TONES.remove(229.1)
DJ596_TONES.remove(254.1)
@directory.register
class DJ596Radio(DRx35Radio):
VENDOR = "Alinco"
MODEL = "DJ596"
@ -382,6 +388,7 @@ class DJ596Radio(DRx35Radio):
return len(filedata) == cls._memsize and \
filedata[0x64] == chr(0x45) and filedata[0x65] == chr(0x01)
@directory.register
class JT220MRadio(DRx35Radio):
VENDOR = "Jetstream"
MODEL = "JT220M"

View File

@ -16,92 +16,32 @@
import os
import tempfile
from chirp import id800, id880, ic2820, ic2200, ic9x, icx8x, ic2100, ic2720
from chirp import icq7, icomciv, idrp, icf, ic9x_icf, icw32, ict70
from chirp import vx3, vx5, vx6, vx7, vx8, ft2800, ft7800, ft50, ft60, ft817, ft857
from chirp import kenwood_live, tmv71, thd72
from chirp import alinco
from chirp import wouxun
from chirp import xml, chirp_common, generic_csv, util, rfinder, errors
from chirp import icf
from chirp import chirp_common, util, rfinder, errors
DRV_TO_RADIO = {
# Virtual/Generic
"csv" : generic_csv.CSVRadio,
"xml" : xml.XMLRadio,
def radio_class_id(cls):
ident = "%s_%s" % (cls.VENDOR, cls.MODEL)
if cls.VARIANT:
ident += "_%s" % cls.VARIANT
ident = ident.replace("/", "_")
ident = ident.replace(" ", "_")
ident = ident.replace("(", "")
ident = ident.replace(")", "")
return ident
# Icom
"ic2720" : ic2720.IC2720Radio,
"ic2820" : ic2820.IC2820Radio,
"ic2200" : ic2200.IC2200Radio,
"ic2100" : ic2100.IC2100Radio,
"ic9x" : ic9x.IC9xRadio,
"id800" : id800.ID800v2Radio,
"id880" : id880.ID880Radio,
"icx8x" : icx8x.ICx8xRadio,
"idrpx000v" : idrp.IDRPx000V,
"icq7" : icq7.ICQ7Radio,
"icw32" : icw32.ICW32ARadio,
"ict70" : ict70.ICT70Radio,
"icom7200" : icomciv.Icom7200Radio,
"ic9xicf" : ic9x_icf.IC9xICFRadio,
def register(cls):
global DRV_TO_RADIO
ident = radio_class_id(cls)
if ident in DRV_TO_RADIO.keys():
raise Exception("Duplicate radio driver id `%s'" % ident)
DRV_TO_RADIO[ident] = cls
RADIO_TO_DRV[cls] = ident
print "Registered %s = %s" % (ident, cls.__name__)
# Yaesu
"vx3" : vx3.VX3Radio,
"vx5" : vx5.VX5Radio,
"vx6" : vx6.VX6Radio,
"vx7" : vx7.VX7Radio,
"vx8" : vx8.VX8Radio,
"vx8d" : vx8.VX8DRadio,
"ft2800" : ft2800.FT2800Radio,
"ft7800" : ft7800.FT7800Radio,
"ft8800" : ft7800.FT8800Radio,
"ft8900" : ft7800.FT8900Radio,
#"ft50" : ft50.FT50Radio,
"ft60" : ft60.FT60Radio,
"ft817" : ft817.FT817Radio,
"ft817nd" : ft817.FT817NDRadio,
"ft817nd-us" : ft817.FT817ND_US_Radio,
"ft857" : ft857.FT857Radio,
"ft857-us" : ft857.FT857_US_Radio,
# Kenwood
"thd7" : kenwood_live.THD7Radio,
"thd7g" : kenwood_live.THD7GRadio,
"thd72" : thd72.THD72Radio,
"tm271" : kenwood_live.TM271Radio,
"tmd700" : kenwood_live.TMD700Radio,
"tmd710" : kenwood_live.TMD710Radio,
"tmv7" : kenwood_live.TMV7RadioSub,
"thk2" : kenwood_live.THK2Radio,
"thf6" : kenwood_live.THF6ARadio,
"thf7" : kenwood_live.THF7ERadio,
"v71a" : kenwood_live.TMV71Radio,
# Jetstream
"jt220m" : alinco.JT220MRadio,
# Alinco
"dr03" : alinco.DR03Radio,
"dr06" : alinco.DR06Radio,
"dr135" : alinco.DR135Radio,
"dr235" : alinco.DR235Radio,
"dr435" : alinco.DR435Radio,
"dj596" : alinco.DJ596Radio,
# Wouxun
"kguvd1p" : wouxun.KGUVD1PRadio,
# Puxing
"px777" : wouxun.Puxing777Radio,
"px2r" : wouxun.Puxing2RRadio,
# Baofeng
"uv3r" : wouxun.UV3RRadio,
}
return cls
DRV_TO_RADIO = {}
RADIO_TO_DRV = {}
for __key, __val in DRV_TO_RADIO.items():
RADIO_TO_DRV[__val] = __key
def get_radio(driver):
if DRV_TO_RADIO.has_key(driver):
@ -146,13 +86,13 @@ def get_radio_by_image(image_file):
return rf
if image_file.lower().endswith(".chirp"):
return xml.XMLRadio(image_file)
return get_radio("Generic_XML")(image_file)
if image_file.lower().endswith(".csv"):
return generic_csv.CSVRadio(image_file)
return get_radio("Generic_CSV")(image_file)
if icf.is_9x_icf(image_file):
return ic9x_icf.IC9xICFRadio(image_file)
return get_radio("Icom_IC91_92AD_ICF")(image_file)
if icf.is_icf_file(image_file):
tempf = tempfile.mktemp()

View File

@ -17,7 +17,7 @@ import time
import struct
import os
from chirp import util, memmap, chirp_common, bitwise
from chirp import util, memmap, chirp_common, bitwise, directory
from chirp.yaesu_clone import YaesuCloneModeRadio
DEBUG = os.getenv("CHIRP_DEBUG") and True or False
@ -162,6 +162,7 @@ POWER_LEVELS = [chirp_common.PowerLevel("Hi", watts=65),
]
CHARSET = chirp_common.CHARSET_UPPER_NUMERIC + "()+-=*/???|_"
@directory.register
class FT2800Radio(YaesuCloneModeRadio):
VENDOR = "Yaesu"
MODEL = "FT-2800M"

View File

@ -13,8 +13,10 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from chirp import chirp_common, yaesu_clone, ft50_ll
from chirp import chirp_common, yaesu_clone, ft50_ll, directory
# Not working, don't register
#@directory.register
class FT50Radio(yaesu_clone.YaesuCloneModeRadio):
BAUD_RATE = 9600
VENDOR = "Yaesu"

View File

@ -14,7 +14,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import time
from chirp import chirp_common, yaesu_clone, memmap, bitwise
from chirp import chirp_common, yaesu_clone, memmap, bitwise, directory
ACK = "\x06"
@ -131,6 +131,7 @@ STEPS = [5.0, 10.0, 12.5, 15.0, 20.0, 25.0, 50.0, 100.0]
SKIPS = ["", "P", "S"]
CHARSET = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ [?]^__|`?$%&-()*+,-,/|;/=>?@"
@directory.register
class FT60Radio(yaesu_clone.YaesuCloneModeRadio):
BAUD_RATE = 9600
VENDOR = "Yaesu"

View File

@ -14,7 +14,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import time
from chirp import chirp_common, yaesu_clone, memmap
from chirp import chirp_common, yaesu_clone, memmap, directory
from chirp import bitwise, util, errors
ACK = chr(0x06)
@ -370,6 +370,7 @@ class FT7800BankModel(chirp_common.BankModel):
banks.append(bank)
return banks
@directory.register
class FT7800Radio(FTx800Radio):
MODEL = "FT-7800"
@ -428,6 +429,7 @@ struct {
u8 checksum;
"""
@directory.register
class FT8800Radio(FTx800Radio):
MODEL = "FT-8800"
@ -539,6 +541,7 @@ struct {
u8 checksum;
"""
@directory.register
class FT8900Radio(FT8800Radio):
MODEL = "FT-8900"

View File

@ -14,7 +14,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from chirp import chirp_common, yaesu_clone, util, memmap, errors
from chirp import chirp_common, yaesu_clone, util, memmap, errors, directory
from chirp import bitwise
import time, os
@ -186,6 +186,7 @@ struct {
} sixtymeterchannels[5];
"""
@directory.register
class FT817Radio(yaesu_clone.YaesuCloneModeRadio):
BAUD_RATE = 9600
MODEL = "FT-817"
@ -387,6 +388,7 @@ class FT817Radio(yaesu_clone.YaesuCloneModeRadio):
def match_model(cls, filedata):
return len(filedata) == cls._memsize
@directory.register
class FT817NDRadio(FT817Radio):
MODEL = "FT-817ND (Intl versions)"
@ -403,6 +405,7 @@ SPECIAL_60M = {
"M-605" : -5,
}
@directory.register
class FT817ND_US_Radio(FT817Radio):
# seems that radios configured for 5MHz operations send one paket more than others
# so we have to distinguish sub models

View File

@ -14,7 +14,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from chirp import ft817, chirp_common, errors
from chirp import ft817, chirp_common, errors, directory
from chirp import bitwise
mem_format = """
@ -102,6 +102,7 @@ struct {
@directory.register
class FT857Radio(ft817.FT817Radio):
MODEL = "FT-857"
@ -181,6 +182,7 @@ SPECIAL_60M = {
"M-605" : -5,
}
@directory.register
class FT857_US_Radio(FT857Radio):
# seems that radios configured for 5MHz operations send one paket more than others
# so we have to distinguish sub models

View File

@ -16,11 +16,12 @@
import os
import csv
from chirp import chirp_common, errors
from chirp import chirp_common, errors, directory
class OmittedHeaderError(Exception):
pass
@directory.register
class CSVRadio(chirp_common.CloneModeRadio, chirp_common.IcomDstarSupport):
VENDOR = "Generic"
MODEL = "CSV"

View File

@ -13,7 +13,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from chirp import chirp_common, icf, util
from chirp import chirp_common, icf, util, directory
from chirp import bitwise, memmap
mem_format = """
@ -82,6 +82,7 @@ TMODES = ["", "Tone", "", "TSQL"]
DUPLEX = ["", "", "+", "-"]
STEPS = [5.0, 10.0, 12.5, 15.0, 20.0, 25.0, 30.0, 50.0]
@directory.register
class IC2100Radio(icf.IcomCloneModeRadio):
VENDOR = "Icom"
MODEL = "IC-2100H"

View File

@ -13,7 +13,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from chirp import chirp_common, icf, util
from chirp import chirp_common, icf, util, directory
from chirp import bitwise
mem_format = """
@ -83,6 +83,7 @@ POWER_LEVELS = [chirp_common.PowerLevel("High", watts=65),
chirp_common.PowerLevel("MidLow", watts=10),
chirp_common.PowerLevel("Low", watts=5)]
@directory.register
class IC2200Radio(icf.IcomCloneModeRadio, chirp_common.IcomDstarSupport):
VENDOR = "Icom"
MODEL = "IC-2200H"

View File

@ -13,7 +13,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from chirp import chirp_common, icf, util
from chirp import chirp_common, icf, util, directory
from chirp import bitwise
mem_format = """
@ -67,6 +67,7 @@ POWER_LEVELS_UHF = [chirp_common.PowerLevel("High", watts=35),
chirp_common.PowerLevel("Low", watts=5),
chirp_common.PowerLevel("Mid", watts=15)]
@directory.register
class IC2720Radio(icf.IcomCloneModeRadio):
VENDOR = "Icom"
MODEL = "IC-2720H"

View File

@ -13,7 +13,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from chirp import chirp_common, icf, errors, util
from chirp import chirp_common, icf, errors, util, directory
from chirp import bitwise;
mem_format = """
@ -93,6 +93,7 @@ class IC2820Bank(icf.IcomBank):
_banks = self._model._radio._memobj.bank_names
_banks[self.index].name = str(name).ljust(8)[:8]
@directory.register
class IC2820Radio(icf.IcomCloneModeRadio, chirp_common.IcomDstarSupport):
VENDOR = "Icom"
MODEL = "IC-2820H"

View File

@ -16,7 +16,7 @@
import time
import threading
from chirp import chirp_common, errors, memmap, ic9x_ll, util, icf
from chirp import chirp_common, errors, memmap, ic9x_ll, util, icf, directory
IC9xA_SPECIAL = {}
IC9xA_SPECIAL_REV = {}
@ -70,6 +70,7 @@ class IC9xBank(icf.IcomBank):
banks[self.index] = name
self._model._radio._ic9x_set_banks(banks)
@directory.register
class IC9xRadio(icf.IcomLiveRadio):
MODEL = "IC-91/92AD"

View File

@ -13,8 +13,9 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from chirp import chirp_common, icf, ic9x_icf_ll, util
from chirp import chirp_common, icf, ic9x_icf_ll, util, directory
@directory.register
class IC9xICFRadio(chirp_common.CloneModeRadio):
VENDOR = "Icom"
MODEL = "IC-91/92AD"

View File

@ -1,6 +1,6 @@
import struct
from chirp import chirp_common, icf, util, errors, bitwise, ic9x_ll
from chirp import chirp_common, icf, util, errors, bitwise, ic9x_ll, directory
from chirp.memmap import MemoryMap
DEBUG = True
@ -164,6 +164,7 @@ class IcomCIVRadio(icf.IcomLiveRadio):
f = self._recv_frame()
print "Result:\n%s" % util.hexprint(f.get_data())
@directory.register
class Icom7200Radio(IcomCIVRadio):
MODEL = "7200"
_model = "\x76"

View File

@ -13,7 +13,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from chirp import chirp_common, icf, errors, util
from chirp import chirp_common, icf, errors, util, directory
from chirp import bitwise
from chirp.memmap import MemoryMap
from chirp.chirp_common import to_GHz, from_GHz
@ -47,6 +47,7 @@ DUPLEX = ["", "", "-", "+"]
MODES = ["FM", "WFM", "AM"]
STEPS = [5.0, 6.25, 10.0, 12.5, 15.0, 20.0, 25.0, 30.0, 50.0, 100.0]
@directory.register
class ICQ7Radio(icf.IcomCloneModeRadio):
VENDOR = "Icom"
MODEL = "IC-Q7A"

View File

@ -13,7 +13,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from chirp import chirp_common, icf, errors, util
from chirp import chirp_common, icf, errors, util, directory
from chirp import bitwise
from chirp.memmap import MemoryMap
@ -79,6 +79,7 @@ class ICT70Bank(icf.IcomBank):
_bank = self._model._radio._memobj.bank_names[self.index]
_bank.name = name.ljust(8)[:8]
@directory.register
class ICT70Radio(icf.IcomCloneModeRadio):
VENDOR = "Icom"
MODEL = "IC-T70"

View File

@ -13,7 +13,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from chirp import chirp_common, icf, errors, util
from chirp import chirp_common, icf, errors, util, directory
from chirp import bitwise
mem_format = """
@ -61,6 +61,7 @@ struct {
DUPLEX = ["", "", "-", "+"]
TONE = ["", "", "Tone", "TSQL"]
@directory.register
class ICW32ARadio(icf.IcomCloneModeRadio):
VENDOR = "Icom"
MODEL = "IC-W32A"

View File

@ -13,7 +13,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from chirp import chirp_common, icf, icx8x_ll, errors
from chirp import chirp_common, icf, icx8x_ll, errors, directory
def isUHF(pipe):
md = icf.get_model_data(pipe)
@ -24,6 +24,7 @@ def isUHF(pipe):
return uhf
@directory.register
class ICx8xRadio(icf.IcomCloneModeRadio, chirp_common.IcomDstarSupport):
VENDOR = "Icom"
MODEL = "IC-V82/U82"

View File

@ -13,7 +13,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from chirp import chirp_common, icf, errors
from chirp import chirp_common, icf, errors, directory
from chirp import bitwise
mem_format = """
@ -104,6 +104,7 @@ for i in range(0, 5):
ALPHA_CHARSET = " ABCDEFGHIJKLMNOPQRSTUVWXYZ"
NUMERIC_CHARSET = "0123456789+-=*/()|"
@directory.register
class ID800v2Radio(icf.IcomCloneModeRadio, chirp_common.IcomDstarSupport):
VENDOR = "Icom"
MODEL = "ID-800H"

View File

@ -13,7 +13,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from chirp import chirp_common, icf
from chirp import chirp_common, icf, directory
from chirp import bitwise
mem_format = """
@ -141,6 +141,7 @@ class ID880Bank(icf.IcomBank):
_bank = self._model._radio._memobj.bank_names[self.index]
_bank.name = name.ljust(6)[:6]
@directory.register
class ID880Radio(icf.IcomCloneModeRadio, chirp_common.IcomDstarSupport):
VENDOR = "Icom"
MODEL = "ID-880H"
@ -364,8 +365,11 @@ class ID880Radio(icf.IcomCloneModeRadio, chirp_common.IcomDstarSupport):
return calls
# This radio isn't really supported yet and detects as a conflict with
# the ID-880. So, don't register right now
#@directory.register
class ID80Radio(ID880Radio):
MODEL = "ID-880H"
MODEL = "ID-80H"
_model = "\x31\x55\x00\x01"

View File

@ -19,7 +19,7 @@ import time
NOCACHE = os.environ.has_key("CHIRP_NOCACHE")
from chirp import chirp_common, errors
from chirp import chirp_common, errors, directory
DEBUG = True
@ -203,6 +203,7 @@ class KenwoodLiveRadio(chirp_common.LiveRadio):
raise errors.RadioError("Radio refused delete of %i" % number)
del self.__memcache[number]
@directory.register
class THD7Radio(KenwoodLiveRadio):
MODEL = "TH-D7"
@ -260,9 +261,11 @@ class THD7Radio(KenwoodLiveRadio):
return mem
@directory.register
class THD7GRadio(THD7Radio):
MODEL = "TH-D7G"
@directory.register
class TMD700Radio(KenwoodLiveRadio):
MODEL = "TM-D700"
@ -320,6 +323,7 @@ class TMD700Radio(KenwoodLiveRadio):
return mem
@directory.register
class TMV7Radio(KenwoodLiveRadio):
MODEL = "TM-V7"
@ -431,6 +435,7 @@ THF6A_STEPS = [5.0, 6.25, 8.33, 9.0, 10.0, 12.5, 15.0, 20.0, 25.0, 30.0, 50.0, 1
THF6A_DUPLEX = dict(DUPLEX)
THF6A_DUPLEX[3] = "split"
@directory.register
class THF6ARadio(KenwoodLiveRadio):
MODEL = "TH-F6"
@ -508,6 +513,7 @@ class THF6ARadio(KenwoodLiveRadio):
return spec
@directory.register
class THF7ERadio(THF6ARadio):
MODEL = "TH-F7"
@ -516,6 +522,7 @@ D710_MODES = ["FM", "NFM", "AM"]
D710_SKIP = ["", "S"]
D710_STEPS = [5.0, 6.25, 8.33, 10.0, 12.5, 15.0, 20.0, 25.0, 30.0, 50.0, 100.0]
@directory.register
class TMD710Radio(KenwoodLiveRadio):
MODEL = "TM-D710"
@ -597,6 +604,7 @@ class TMD710Radio(KenwoodLiveRadio):
return spec
@directory.register
class TMV71Radio(TMD710Radio):
MODEL = "TM-V71"
@ -614,6 +622,7 @@ THK2_TONES.remove(199.5) # ??
THK2_CHARS = chirp_common.CHARSET_UPPER_NUMERIC + "-/"
@directory.register
class THK2Radio(KenwoodLiveRadio):
MODEL = "TH-K2"
@ -695,6 +704,7 @@ class THK2Radio(KenwoodLiveRadio):
return spec
@directory.register
class TM271Radio(THK2Radio):
MODEL = "TM-271"

View File

@ -13,7 +13,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from chirp import chirp_common, errors, util
from chirp import chirp_common, errors, util, directory
from chirp import bitwise, memmap
import time, struct
@ -160,6 +160,7 @@ EXCH_R = "R\x00\x00\x00\x00"
EXCH_W = "W\x00\x00\x00\x00"
@directory.register
class THD72Radio(chirp_common.CloneModeRadio):
BAUD_RATE = 9600
VENDOR = "Kenwood"

View File

@ -14,7 +14,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from chirp import chirp_common, yaesu_clone, util
from chirp import chirp_common, yaesu_clone, util, directory
from chirp import bitwise
#interesting offsets which may be checksums needed later
@ -121,6 +121,7 @@ class VX3BankModel(chirp_common.BankModel):
banks.append(bank)
return banks
@directory.register
class VX3Radio(yaesu_clone.YaesuCloneModeRadio):
BAUD_RATE = 19200
VENDOR = "Yaesu"

View File

@ -13,7 +13,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from chirp import chirp_common, yaesu_clone, util
from chirp import chirp_common, yaesu_clone, util, directory
from chirp import bitwise
mem_format = """
@ -60,6 +60,7 @@ STEPS.remove(30.0)
STEPS.append(100.0)
STEPS.append(9.0)
@directory.register
class VX5Radio(yaesu_clone.YaesuCloneModeRadio):
BAUD_RATE = 9600
VENDOR = "Yaesu"

View File

@ -13,7 +13,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from chirp import chirp_common, yaesu_clone
from chirp import chirp_common, yaesu_clone, directory
from chirp import bitwise
# flags.{even|odd}_pskip: These are actually "preferential *scan* channels".
@ -108,6 +108,7 @@ POWER_LEVELS_220 = [chirp_common.PowerLevel("Hi", watts=1.50),
chirp_common.PowerLevel("L2", watts=0.50),
chirp_common.PowerLevel("L1", watts=0.20)]
@directory.register
class VX6Radio(yaesu_clone.YaesuCloneModeRadio):
BAUD_RATE = 19200
VENDOR = "Yaesu"

View File

@ -13,7 +13,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from chirp import chirp_common, yaesu_clone, util
from chirp import chirp_common, yaesu_clone, util, directory
from chirp import bitwise
mem_format = """
@ -158,6 +158,7 @@ class VX7BankModel(chirp_common.BankModel):
banks.append(bank)
return banks
@directory.register
class VX7Radio(yaesu_clone.YaesuCloneModeRadio):
BAUD_RATE = 19200
VENDOR = "Yaesu"

View File

@ -13,7 +13,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from chirp import chirp_common, yaesu_clone
from chirp import chirp_common, yaesu_clone, directory
from chirp import bitwise
mem_format = """
@ -167,6 +167,7 @@ class VX8BankModel(chirp_common.BankModel):
return banks
@directory.register
class VX8Radio(yaesu_clone.YaesuCloneModeRadio):
BAUD_RATE = 38400
VENDOR = "Yaesu"
@ -279,6 +280,7 @@ class VX8Radio(yaesu_clone.YaesuCloneModeRadio):
def get_bank_model(self):
return VX8BankModel(self)
@directory.register
class VX8DRadio(VX8Radio):
_model = "AH29D"
VARIANT = "DR"

View File

@ -16,7 +16,7 @@
import struct
import time
import os
from chirp import util, chirp_common, bitwise, memmap, errors
from chirp import util, chirp_common, bitwise, memmap, errors, directory
if os.getenv("CHIRP_DEBUG"):
DEBUG = True
@ -137,6 +137,7 @@ CHARSET = list("0123456789") + [chr(x + ord("A")) for x in range(0, 26)] + \
POWER_LEVELS = [chirp_common.PowerLevel("High", watts=5.00),
chirp_common.PowerLevel("Low", watts=1.00)]
@directory.register
class KGUVD1PRadio(chirp_common.CloneModeRadio):
VENDOR = "Wouxun"
MODEL = "KG-UVD1P"
@ -404,6 +405,7 @@ PUXING_777_BANDS = [
(460000000, 520000000),
]
@directory.register
class Puxing777Radio(KGUVD1PRadio):
VENDOR = "Puxing"
MODEL = "PX-777"
@ -635,6 +637,7 @@ PX2R_POWER_LEVELS = [chirp_common.PowerLevel("Low", watts=1.0),
chirp_common.PowerLevel("High", watts=2.0)]
PX2R_CHARSET = "0123456789- ABCDEFGHIJKLMNOPQRSTUVWXYZ +"
@directory.register
class Puxing2RRadio(KGUVD1PRadio):
VENDOR = "Puxing"
MODEL = "PX-2R"
@ -824,6 +827,7 @@ UV3R_POWER_LEVELS = [chirp_common.PowerLevel("High", watts=2.00),
chirp_common.PowerLevel("Low", watts=0.50)]
UV3R_DTCS_POL = ["NN", "NR", "RN", "RR"]
@directory.register
class UV3RRadio(KGUVD1PRadio):
VENDOR = "Baofeng"
MODEL = "UV-3R"

View File

@ -16,7 +16,7 @@
import os
import libxml2
from chirp import chirp_common, errors, xml_ll, platform
from chirp import chirp_common, errors, xml_ll, platform, directory
def validate_doc(doc):
basepath = platform.get_platform().executable_path()
@ -61,6 +61,7 @@ def default_banks():
return banks
@directory.register
class XMLRadio(chirp_common.CloneModeRadio, chirp_common.IcomDstarSupport):
VENDOR = "Generic"
MODEL = "XML"

1
chirpw
View File

@ -98,6 +98,7 @@ else:
# Python >=2.6, use normal gettext behavior
lang.install()
from chirp import *
from chirpui import mainapp, config
a = mainapp.ChirpMain()

View File

@ -23,6 +23,7 @@ from serial import Serial
sys.path.insert(0, "../")
from chirp import CHIRP_VERSION
from chirp import *
from chirp import chirp_common, directory, generic_csv, import_logic
from chirp import errors