diff --git a/flash.py b/flash.py new file mode 100644 index 0000000..c8fa12f --- /dev/null +++ b/flash.py @@ -0,0 +1,49 @@ +import argparse +import struct + + +def get_argparser(): + parser = argparse.ArgumentParser(description="MQTT-controlled 4-channel DDS signal generator") + + parser.add_argument("cidr", nargs=1, + metavar=("Client_CIDR"), + help="IPv4 Address of Humpback-DDS in CIDR notation") + parser.add_argument("mac_addr", nargs=1, + metavar=("Client_MAC"), + help="MAC Address of Humpback-DDS") + parser.add_argument("broker_ip", nargs=1, + metavar=("Broker_IP"), + help="IP address of MQTT broker") + parser.add_argument("name", nargs=1, + metavar=("Name"), + help="Device name of Humpback-DDS") + + return parser + + +def write_record(f, key, value): + key_size = len(key) + 1 + value_size = len(value) + record_size = key_size + value_size + 4 + f.write(struct.pack("