A python library for communication with GQ Geiger Counters.
https://www.gqelectronicsllc.com/download/GQ-RFC1201.txt
There are 2 ways of using the library. Either by using the provided wrapper class GQGCM1201 or by directly invoking the commands on a serial connection.
import datettime
from time import sleep
with GQGCM1201("/dev/ttyUSB0", 57600) as gq:
gq.set_datetime(datetime.datetime.now())
gq.reboot()
sleep(5)
gq.send_key(0)
gq.power_off()
import serial
import struct
import datetime
from threading import Thread
serial = serial.Serial("/dev/ttyUSB0", 57600)
Commands.SETDATETIME.execute(serial, datetime.datetime.now())
COMMANDS.REBOOT.execute(serial)
sleep(5)
COMMANDS.SENDKEY.execute(serial, 0)
COMMANDS.POWEROFF.execute(serial)
-
If no baudrate is supplied to the GQGCM1201 class, it will try to guess the right one, by querying the version string over and over again. This may take a while but is better than nothing.
-
The datetime api is as good as it can be, with some validation built in. As far as I can tell the units and devices themselves to not validate date settings (0 month is valid and displayed, but makes no sense). So the commands themselves do some validation.
-
The architecture is modular. Commands are just objects that unify some behaviour, with specifics delegated to callbacks.