El 14/04/16 a las 11:30, Dan Smith via chirp_devel escribió:
The model ID string for the FT2900 seems to be defined by the state of three
solder bridges, which gives us a number of 8 possible states. We need to make sure, that a image is working for one version only, that is why we want the user to decide on which version is working upfront. I would propose to make use of the generator pattern and to generate the needed classes with their properties on the fly.
CHIRP already has this functionality built in, you just need to make those classes implement the matching mechanism:
http://chirp.danplanet.com/projects/chirp/repository/entry/chirp/drivers/ft2...
Right now it's just comparing file size, which is identical between all of them.
I will suggest to read the tk760g driver in chirp, I have a trick for a single driver to support every radio model and variant in the market for that radio family (yet left the handheld UHF segment, I have not time nor radio to test it now)
A little explanation:
http://chirp.danplanet.com/projects/chirp/repository/entry/chirp/drivers/tk7... From this line and forward there is a comment and a definition for each radio model that has his own variants and this complexity is hidden from the user that choose just TK-760G from the list not knowing that that particular radio has a few variants with different options, ranges, etc.
I declare a dict var (radio.VARIANTS) that holds the partial id as passed by the radio as key (the last bytes are used as a flag for trunking board and password protected ones), and the data for that key is a tuple with channel count, freq ranges and commercial designation for that radio variant.
in http://chirp.danplanet.com/projects/chirp/repository/entry/chirp/drivers/tk7... I make a general match model procedure checking first for the size and then the model match that is handled here http://chirp.danplanet.com/projects/chirp/repository/entry/chirp/drivers/tk7...
I extract the ID segment from the img file (or just downloaded data from radio) and check for it's presence in the VARIANT dict for the current radio model.
All this from the file, in the download process I just check for a partial string inside the id string (the radio.TYPE var) and deal later for the specific model, just here after the download is complete in the self.process_mmap() that get executed for both cases (download and file opened) http://chirp.danplanet.com/projects/chirp/repository/entry/chirp/drivers/tk7...
Once there (_set_variant() ) I check for the specific model and complain if not, if success then set the freq ranges, amount of channels and banks if it has it. Late I build a string to identify (to show to the user) just like the OEM does for compatibility.
I hope this example helps you to understand and build a solution for this.
73 CO7WT.