diff --git a/.github/workflows/python-test.yml b/.github/workflows/python-test.yml index 92b0fd2..39757fe 100644 --- a/.github/workflows/python-test.yml +++ b/.github/workflows/python-test.yml @@ -21,6 +21,7 @@ jobs: python-version: ${{ matrix.python-version }} - name: Install dependencies run: | + sudo apt-get update sudo apt-get install python-bluetooth -qq -y python -m pip install --upgrade pip python -m pip install pytest pyserial==3.1.1 coveralls diff --git a/openxc/controllers/base.py b/openxc/controllers/base.py index f284f72..d09a766 100644 --- a/openxc/controllers/base.py +++ b/openxc/controllers/base.py @@ -430,6 +430,14 @@ def device_id(self): } return self._check_command_response_message(request) + def get_vin(self): + """Request vehicle VIN + """ + request = { + "command": "get_vin" + } + return self._check_command_response_message(request) + def write(self, **kwargs): """Serialize a raw or translated write request and send it to the VI, following the OpenXC message format. diff --git a/openxc/tools/control.py b/openxc/tools/control.py index 98e5202..5a8fe77 100644 --- a/openxc/tools/control.py +++ b/openxc/tools/control.py @@ -31,6 +31,9 @@ def sd_mount_status(interface): def device_id(interface): print(("Device ID is %s" % interface.device_id())) +def get_vin(interface): + print(("Vehicle VIN is %s" % interface.get_vin())) + def passthrough(interface, bus, passthrough_enabled): if interface.set_passthrough(bus, passthrough_enabled): print(("Bus %u passthrough set to %s" % (bus, passthrough_enabled))) @@ -93,7 +96,7 @@ def parse_options(): parser = argparse.ArgumentParser(description="Send control messages to an " "attached OpenXC vehicle interface", parents=[device_options()]) parser.add_argument("command", type=str, - choices=['version', 'platform', 'write', 'id', 'set', 'sd_mount_status']) + choices=['version', 'platform', 'write', 'id', 'set', 'sd_mount_status', 'get_vin']) write_group = parser.add_mutually_exclusive_group() write_group.add_argument("--name", action="store", dest="write_name", help="name for message write request") @@ -184,6 +187,8 @@ def main(): sd_mount_status(interface) elif arguments.command == "id": device_id(interface) + elif arguments.command == "get_vin": + get_vin(interface) elif arguments.command == "set": handle_set_command(arguments, interface) elif arguments.command == "write":