Python library for communicating with iCOM radios using CI-V.
Theorically speaking, all ICOM devices implementing the CI-V protocol should be compatible, in particular, the following devices were tested:
- IC-7300 (fw: 1.42)
- IC-706 MKII
- Install the package using
pip install iu2frl-civ
- Import the module using
from iu2frl_civ.device_factory import DeviceFactory
- Initialize the target device using
radio = DeviceFactory.get_repository(radio_address="0x94", device_type=DeviceType.Generic, port="COM10", debug=True)
Tip
Usage of named arguments (like radio_address="0x94"
) over positional arguments is highly recommended as it provides better support for future releases or library code reviews
Where:
device_type = DeviceType.Generic
is the type of device you want to controlradio_address = 0x94
is the transceiver address
Then, additional arguments can be passed:
port = "/dev/ttyUSB0"
: communication port of the transceiverbaudrate: int = 19200
: baudrate of the devicedebug = False
: useful to troubleshoot communication issuescontroller_address = "0xE0"
: address of the controller (this library)timeout = 1
: serial port communication timeout in secondsattempts = 3
: how many attempts to perform in case of timeout or errorsfake = False
: if set to True, the library will use a fake connection to the transceiver (serial commands will be printed to the console and not sent to any port)
Once the device object is created, any supported method can be used, for example:
- Power on the transceiver:
device.power_on()
- Get the current frequency:
device.read_operating_frequency()
Some commands have an expected value to be returned (like the device.read_operating_frequency()
), most returns a boolean value, while other returns nothing (void
). If the device does not support a command (or it was not yet implemented), or if some error occurred, an exception is thrown:
NotImplementedError
: the current device does not implement this feature yetCivCommandException
: something went wrong in the data exchange between the transceiver and the library (probably due to device misconfiguration, faulty cables, etc)CivTimeoutException
: the communication timed out (something wrong with wiring or connection parameters like port or baudrate)
Important
Do not rename the tests
folder or the fake_generic.py
file, as those are used for testing the library.
Some sample commands are available in the tests
folder.
ic7300.py
: A simple test script that demonstrates how to use the library to communicate with the IC-7300 transceiver.ic7300_clock.py
: A simple script to set the clock of the IC-7300 transceiver by syncing to the PC.ic706_mkii.py
: A simple test script that demonstrates how to use the library to communicate with the IC-706 MKII transceiver.fake_generic.py
: A simple test script that fakes a connection to transceiver, used to validate builds.
Any help is welcome to either add more devices or improve existing ones, please see the developers section, accessible via relative link or GitHub Link
This project was forked and then improved from: siyka-au/pycom