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 3 ways to send set commands
#1. using the explicit methods
#2. using the semi-generic set method, passing a 2-Letter identifier and a value
#3. using the generic setCustomCommand method, passing the command string
#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 semi-generic set method
OmniClient.set("FB07130000")
#set frequency of VFO A to 18.110MHz using the generic set method
OmniClient.setCustomCommand("FA018110000;", 0, 0)
#put the radio in TX mode
#OmniClient.setTx()
#put the radio in RX mode
#OmniClient.setRx()
#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()
setTx()
setRx()
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
tx/rx identifier
- TX_OFF = 0x00200000
- TX_ON 0x00400000
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()
- setTx()
- setRx()
- setActiveRig(index)
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file omnipyrig-0.1.1.tar.gz.
File metadata
- Download URL: omnipyrig-0.1.1.tar.gz
- Upload date:
- Size: 5.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8e5aaa0aa5c5340f409cf11ff490af6eb839fc9b42ec899549b9e3fa3b85df25
|
|
| MD5 |
2578019afb2bfb2b684b44987d05c025
|
|
| BLAKE2b-256 |
d859d0197d94ffd40c52663682bdab075af94d1831d5dd7a69fac1c2ee7a99d5
|
File details
Details for the file omnipyrig-0.1.1-py3-none-any.whl.
File metadata
- Download URL: omnipyrig-0.1.1-py3-none-any.whl
- Upload date:
- Size: 5.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8efcd01bfbde3e15e882e456e3d6fa9475d404e98d425e6b0608c56b66ab89a0
|
|
| MD5 |
4897c1bf42452bc62d547a04f605c132
|
|
| BLAKE2b-256 |
38001c2adbd5847bfb6b536067c48e95c7253498980dcfd9501fa8847c4c4e1f
|