Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change vehicle member variable for consistency in digital auto and cpp #81

Merged
merged 1 commit into from
Dec 14, 2022
Merged
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
8 changes: 4 additions & 4 deletions app/src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,22 +56,22 @@ class SampleApp(VehicleApp):
def __init__(self, vehicle_client: Vehicle):
# SampleApp inherits from VehicleApp.
super().__init__()
self.vehicle = vehicle_client
self.Vehicle = vehicle_client

async def on_start(self):
"""Run when the vehicle app starts"""
# This method will be called by the SDK when the connection to the
# Vehicle DataBroker is ready.
# Here you can subscribe for the Vehicle Signals update (e.g. Vehicle Speed).
await self.vehicle.Speed.subscribe(self.on_speed_change)
await self.Vehicle.Speed.subscribe(self.on_speed_change)

async def on_speed_change(self, data: DataPointReply):
"""The on_speed_change callback, this will be executed when receiving a new
vehicle signal updates."""
# Get the current vehicle speed value from the received DatapointReply.
# The DatapointReply containes the values of all subscribed DataPoints of
# the same callback.
vehicle_speed = data.get(self.vehicle.Speed).value
vehicle_speed = data.get(self.Vehicle.Speed).value

# Do anything with the received value.
# Example:
Expand All @@ -95,7 +95,7 @@ async def on_get_speed_request_received(self, data: str) -> None:
)

# Getting current speed from VehicleDataBroker using the DataPoint getter.
vehicle_speed = (await self.vehicle.Speed.get()).value
vehicle_speed = (await self.Vehicle.Speed.get()).value

# Do anything with the speed value.
# Example:
Expand Down