Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/python-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 8 additions & 0 deletions openxc/controllers/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
7 changes: 6 additions & 1 deletion openxc/tools/control.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)))
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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":
Expand Down