Verified Commit 41bf8481 authored by Clayton Craft's avatar Clayton Craft
Browse files

config: add support for setting baud for device

parent cb1de771
......@@ -13,5 +13,8 @@ device_driver=stm
# Supported values: stm
device_path=/dev/gnss0
# Baud rate for GPS serial device
device_baud_rate=9600
# Directory to load/store almanac and ephemeris data
agps_directory=/var/cache/gnss_share
......@@ -46,6 +46,7 @@ class GnssShare:
self._socket_path = config['gnss_share'].get('socket')
self._socket_owner_group = config['gnss_share'].get('group')
self._device_path = config['gnss_share'].get('device_path')
self._device_baud = config['gnss_share'].get('device_baud_rate')
self._agps_dir = config['gnss_share'].get('agps_directory')
driver = config['gnss_share'].get('device_driver')
......@@ -135,7 +136,8 @@ class GnssShare:
while True:
if len(self._open_connections) > 0:
if self._active_driver is None:
self._active_driver = self._driver(self._device_path)
self._active_driver = self._driver(self._device_path,
self._device_baud)
await self._active_driver.open()
line = await self._active_driver.readline()
prefix = line.split(b',')[0]
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment