A python wrapper for Omni-Rig
Project description
omnipyrig
A package that allows the deveplopment of amateur radio applications using the amazing Omni-Rig library
prerequisite
- OmniRig (http://dxatlas.com/omnirig/)
- python (https://www.python.org/downloads/)
installation
PyPi:
https://pypi.org/project/omnipyrig/
pip install omnipyrig
if you need to update:
pip install omnipyrig -U
source code
github:
https://github.com/4Z1KD/omnipyrig
usage
import omnipyrig
#create a new instance
OmniClient = omnipyrig.OmniRigWrapper()
#set the active rig to 1 (as defined in OmniRig GUI)
OmniClient.setActiveRig(1)
RigType = OmniClient.getParam("RigType")
print(f'Rig 1: {RigType}')
#set the active rig to 2 (as defined in OmniRig GUI)
OmniClient.setActiveRig(2)
RigType = OmniClient.getParam("RigType")
print(f'Rig 2: {RigType}')
#there are 2 ways to send set commands
#1. using the explicit methods
#2. using the generic set method, passing a 2-Letters identifier and a value
#set the frequency of VFO A to 14.255MHz using the explicit setFrequency(...) method
OmniClient.setFrequency("A",14255000)
#set the mode to USB using the explicit setMode(...) method
OmniClient.setMode(OmniClient.MODE_SSB_U)
#set frequency of VFO B to 7.130MHz using the generic set method
OmniClient.set("FB07130000")
#here is the full list of explicit set methods:
'''
setFrequency(vfo_selector, frequency)
setMode(mode)
setRit(state)
setXit(state)
setRitOffset(offset)
setSplit(state)
setPitch(pitch)
setVfoA()
setVfoB()
setVfoAB()
setVfoBA()
setActiveRig(index)
'''
#here is the full list of 2-Letters command identifiers for the generic set command:
'''
'FA########' - sets frequency to VFO A (# is the frequency in Hz)
'FB########' - sets frequency to VFO B (# is the frequency in Hz)
'MD##' - sets the mode (# is value of the mode identifier [not to confuse with the mode enum])
'RT##' - sets the Rit (# is value of the rit enum)
'XT##' - sets the Xit (# is value of the xit enum)
'RU####' - set the Rit Offset (# is frequency offset in Hz)
'KP####' - set the Pitch (# is frequency offset in Hz)
'AA' - set the VFO to A
'BB' - set the VFO to B
'AB' - set the Reciever to VFOA and transmitter to VFOB
'BA' - set the Reciever to VFOB and transmitter to VFOA
'''
#get and print some parameters from the radio
StatusStr = OmniClient.getParam("StatusStr")
print(StatusStr)
ClearRit = OmniClient.getParam("ClearRit")
print(ClearRit)
Freq = OmniClient.getParam("Freq")
print(Freq)
FreqA = OmniClient.getParam("FreqA")
print(FreqA)
FreqB = OmniClient.getParam("FreqB")
print(FreqB)
FrequencyOfTone = OmniClient.getParam("FrequencyOfTone")
print(FrequencyOfTone)
GetRxFrequency = OmniClient.getParam("GetRxFrequency")
print(GetRxFrequency)
GetTxFrequency = OmniClient.getParam("GetTxFrequency")
print(GetTxFrequency)
IsParamReadable = OmniClient.getParam("IsParamReadable")
print(IsParamReadable)
Mode = OmniClient.getParam("Mode")
print(Mode)
Pitch = OmniClient.getParam("Pitch")
print(Pitch)
cts,dsr,dtr,rts = OmniClient.getParam("PortBits")
print(f'{cts},{dsr},{dtr},{rts}')
ReadableParams = OmniClient.getParam("ReadableParams")
print(ReadableParams)
RigType = OmniClient.getParam("RigType")
print(RigType)
Rit = OmniClient.getParam("Rit")
print(Rit)
RitOffset = OmniClient.getParam("RitOffset")
print(RitOffset)
Split = OmniClient.getParam("Split")
print(Split)
Status = OmniClient.getParam("Status")
print(Status)
Tx = OmniClient.getParam("Tx")
print(Tx)
Vfo = OmniClient.getParam("Vfo")
print(Vfo)
WriteableParams = OmniClient.getParam("WriteableParams")
print(WriteableParams)
Xit = OmniClient.getParam("Xit")
print(Xit)
how it works?
the package uses win32com to dispatch an omnirig object
it then wraps it's properties and methods
constants & methods
constants:
mode enumeration
- MODE_SSB_L = 1
- MODE_SSB_U = 2
- MODE_CW_U = 3
- MODE_FM = 4
- MODE_AM = 5
- MODE_RTTY_L = 6
- MODE_CW_L = 7
- MODE_DATA_L = 8
- MODE_RTTY_U = 9
- MODE_DATA_FM = 10
- MODE_FM_N = 11
- MODE_DATA_U = 12
- MODE_AM_N = 13
- MODE_PSK = 14
- MODE_DATA_FM_N = 15
mode identifier
- SSB_L = 0x04000000
- SSB_U = 0x02000000
- CW_U = 0x00800000
- FM = 0x40000000
- AM = 0x20000000
- CW_L = 0x01000000
- DATA_L = 0x10000000
- DATA_U = 0x08000000
rit/xit enumeration
- RIT_ON
- RIT_OFF
- XIT_ON
- XIT_OFF
split enumeration
- SPLIT_ON
- SPLIT_OFF
vfo enumeration
- VFO_AA
- VFO_AB
- VFO_BB
- VFO_BA
methods:
- showParams()
- setFrequency(vfo_selector, frequency)
- setMode(mode)
- setRit(state)
- setXit(state)
- setRitOffset(offset)
- setSplit(state)
- setPitch(pitch)
- setVfoA()
- setVfoB()
- setVfoAB()
- setVfoBA()
73,
Gil 4Z1KD
4z1kd@iarc.org
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
omnipyrig-0.0.15.tar.gz
(5.2 kB
view details)
File details
Details for the file omnipyrig-0.0.15.tar.gz
.
File metadata
- Download URL: omnipyrig-0.0.15.tar.gz
- Upload date:
- Size: 5.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8e6bd9624a88d422f9e2c5722c3bc28bc34113a2066bb15490aaa0460cb1122f |
|
MD5 | 55fda474531ae331386cbf7a4d5ba3ed |
|
BLAKE2b-256 | d8bd080f525fd44bf9d651217cda602366c261de26d1b33a9c9ee8f35acc09bc |