added settings manipulation functions

doublebuf
Ondřej Hruška 7 years ago
parent 94c2e409da
commit a59955000d
Signed by: MightyPork
GPG Key ID: 2C5FD5035250423D
  1. 12
      gex/Client.py
  2. 4
      main.py

@ -38,6 +38,18 @@ class Client:
'type': type, 'type': type,
} }
def ini_read(self):
""" Read the settings INI file """
buffer = self.bulk_read(cs=None, cmd=gex.MSG_INI_READ)
return buffer.decode('utf-8')
def ini_write(self, buffer):
""" Read the settings INI file """
if type(buffer) == str:
buffer = buffer.encode('utf-8')
self.bulk_write(cs=None, cmd=gex.MSG_INI_WRITE, bulk=buffer)
def get_callsign(self, name, type = None): def get_callsign(self, name, type = None):
""" Find unit by name and type """ """ Find unit by name and type """
u = self.unit_lu[name] u = self.unit_lu[name]

@ -5,6 +5,10 @@ import gex
client = gex.Client() client = gex.Client()
s = client.ini_read()
client.ini_write(s)
if False:
buf = client.bulk_read(None, gex.MSG_INI_READ) buf = client.bulk_read(None, gex.MSG_INI_READ)
print(buf.decode('utf-8')) print(buf.decode('utf-8'))

Loading…
Cancel
Save