mirror of
https://github.com/DVSwitch/USRP_Client.git
synced 2026-08-26 14:28:19 -04:00
Add MACROS to ini file and support them in the TG menu combo box
This commit is contained in:
parent
ab6014d3a5
commit
924f0c83da
2 changed files with 44 additions and 15 deletions
18
pyUC.ini
18
pyUC.ini
|
|
@ -110,11 +110,11 @@ Ontario Crosslink = 3023
|
|||
Disconnect = disconnect ;Must be first entry in list
|
||||
Parrot = "register.ysfreflector.de:42020"
|
||||
America Link = "americalink.hamfm.com:42000"
|
||||
America-RC = "65.101.7.49:42000"
|
||||
America-RC = "arcysf.duckdns.org:42001"
|
||||
Alabama-Link = "96.47.95.121:42000"
|
||||
US Texas-Nexus = "ysf.texas-nexus.dyndns.org:42000"
|
||||
Ohio-Link = "ysf.glorb.com:42000"
|
||||
US Triangle NC = "192.223.28.198:42000"
|
||||
US Triangle NC = "ysfnet.trianglenc.net:42000"
|
||||
EA C4FM = "212.237.3.141:42000"
|
||||
GB CQ-UK = "81.150.10.62:42200"
|
||||
|
||||
|
|
@ -173,3 +173,17 @@ REF078B = REF078BL
|
|||
REF078C = REF078CL
|
||||
DCS006F = DCS006FL ; US DCS reflector Alabama
|
||||
DCS059A = DCS059AL
|
||||
|
||||
# This section defines a set of macros that can be uased on the TG popup. Each macro
|
||||
# is defined by a display value and the string to "execute". The execute string
|
||||
# can be any valid dialer string Analog_Bridge understands, including TG numbers,
|
||||
# YSF addresses and macros. The TG/Macro popup can also be redefined by the receipt
|
||||
# of a MACRO command from dvswitch.sh
|
||||
[MACROS]
|
||||
;Display Value = Tune Value
|
||||
Kill Gateways = *666
|
||||
TGIF = *TGIF
|
||||
BM = *BM
|
||||
INFO = *INFO
|
||||
TIME = *TIME
|
||||
TG = *TG
|
||||
41
pyUC.py
41
pyUC.py
|
|
@ -99,7 +99,7 @@ transmit_enable = True # Make sure that UC is half duplex
|
|||
listbox = None # tk object (talkgroup)
|
||||
transmitButton = None # tk object
|
||||
logList = None # tk object
|
||||
macros = []
|
||||
macros = {}
|
||||
|
||||
uc_background_color = "gray25"
|
||||
uc_text_color = "white"
|
||||
|
|
@ -263,7 +263,7 @@ class MyDialog:
|
|||
if len(macros) == 0:
|
||||
self.e = Entry(top, fg=uc_text_color, bg=uc_background_color)
|
||||
else:
|
||||
self.e = ttk.Combobox(top, values=macros)
|
||||
self.e = ttk.Combobox(top, values=list(macros.values()))
|
||||
self.e.pack(padx=5)
|
||||
|
||||
b = ttk.Button(top, text=STRING_OK, command=self.ok)
|
||||
|
|
@ -275,16 +275,25 @@ class MyDialog:
|
|||
if len(item):
|
||||
logging.info( "value is %s", item )
|
||||
mode = master.get()
|
||||
tg_name = tg = item
|
||||
lst = item.split(',')
|
||||
if len(lst) == 1:
|
||||
connect((item, item))
|
||||
if item.startswith('*') == False:
|
||||
talk_groups[mode].append((item, item))
|
||||
if item in macros.values():
|
||||
i = list(macros.values()).index(item)
|
||||
tg = list(macros.keys())[i]
|
||||
else:
|
||||
connect((lst[0].strip(), lst[1].strip()))
|
||||
if item.startswith('*') == False:
|
||||
talk_groups[mode].append((lst[1].strip(), lst[0].strip()))
|
||||
fillTalkgroupList(master.get())
|
||||
tg_name = lst[0]
|
||||
tg = lst[1]
|
||||
connect((tg, tg_name))
|
||||
if tg.startswith('*') == False:
|
||||
i = None
|
||||
for x in talk_groups[mode]:
|
||||
if x[1] == tg:
|
||||
i = x
|
||||
if i == None: # tg not found?
|
||||
talk_groups[mode].append((tg_name, tg))
|
||||
fillTalkgroupList(master.get())
|
||||
selectTGByValue(tg)
|
||||
self.top.destroy()
|
||||
|
||||
###################################################################################
|
||||
|
|
@ -450,7 +459,8 @@ def rxAudioStream():
|
|||
elif (_json[0:6] == "MACRO:"): # An ad-hoc macro menu
|
||||
logging.info("Macro: " + _json[6:])
|
||||
macs = _json[6:]
|
||||
macros = macs.split('|')
|
||||
macrosx = dict(x.split(",") for x in macs.split("|"))
|
||||
macros = { k:v.strip() for k, v in macrosx.items()}
|
||||
ipc_queue.put(("macro", "")) # popup the menu
|
||||
else:
|
||||
obj=json.loads(audio[5:audio.find(b'\x00')].decode('ASCII'))
|
||||
|
|
@ -464,6 +474,7 @@ def rxAudioStream():
|
|||
connected_msg.set( STRING_CONNECTED_TO + " " + obj["last_tune"] )
|
||||
selectTGByValue(obj["last_tune"])
|
||||
else:
|
||||
# Tunnel a TLV inside of a USRP packet
|
||||
if audio[0] == TLV_TAG_SET_INFO:
|
||||
if transmit_enable == False: #EOT missed?
|
||||
log_end_of_transmission(call, rxslot, tg, loss, start_time)
|
||||
|
|
@ -1447,9 +1458,13 @@ try:
|
|||
|
||||
talk_groups = {}
|
||||
for sect in config.sections():
|
||||
if (sect != "DEFAULTS"):
|
||||
if (sect != "DEFAULTS") and (sect != "MACROS"):
|
||||
talk_groups[sect] = config.items(sect)
|
||||
|
||||
if "MACROS" in config.sections():
|
||||
for x in config.items("MACROS"):
|
||||
macros[x[1]] = x[0]
|
||||
|
||||
if validateConfigInfo() == False:
|
||||
logging.error(STRING_CONFIG_NOT_EDITED)
|
||||
os._exit(1)
|
||||
|
|
@ -1462,8 +1477,8 @@ servers = sorted(talk_groups.keys())
|
|||
master = makeTkVar(StringVar, defaultServer, masterChanged)
|
||||
connected_msg = makeTkVar(StringVar, STRING_CONNECTED_TO)
|
||||
current_tx_value = makeTkVar(StringVar, my_call)
|
||||
current_call = makeTkVar(StringVar, "Call")
|
||||
current_name = makeTkVar(StringVar, "Name")
|
||||
current_call = makeTkVar(StringVar, "")
|
||||
current_name = makeTkVar(StringVar, "")
|
||||
|
||||
setStyles()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue