Skip to content

Commit 00838f8

Browse files
Update used examples to be vss 4 compatible (#124)
Signed-off-by: Dennis Meister <[email protected]>
1 parent ffc8b95 commit 00838f8

File tree

6 files changed

+24
-12
lines changed

6 files changed

+24
-12
lines changed
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
velocitas-sdk==0.14.0
1+
velocitas-sdk==0.14.1

examples/seat-adjuster/AppManifest.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
{
66
"type": "vehicle-signal-interface",
77
"config": {
8-
"src": "https://github.com/COVESA/vehicle_signal_specification/releases/download/v3.0/vss_rel_3.0.json",
8+
"src": "https://github.com/COVESA/vehicle_signal_specification/releases/download/v4.0/vss_rel_4.0.json",
99
"datapoints": {
1010
"required": [
1111
{
12-
"path": "Vehicle.Cabin.Seat.Row1.Pos1.Position",
12+
"path": "Vehicle.Cabin.Seat.Row1.DriverSide.Position",
1313
"access": "write"
1414
},
1515
{
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
velocitas-sdk==0.14.0
1+
velocitas-sdk==0.14.1

examples/seat-adjuster/src/vapp.py

+9-4
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import logging
1919

2020
from vehicle import Vehicle # type: ignore
21+
2122
from velocitas_sdk.util.log import ( # type: ignore
2223
get_opentelemetry_log_factory,
2324
get_opentelemetry_log_format,
@@ -40,7 +41,7 @@ class SeatAdjusterApp(VehicleApp):
4041
upon such a request, but only if Vehicle.Speed equals 0.
4142
4243
It also subcribes to the VehicleDataBroker for updates of the
43-
Vehicle.Cabin.Seat.Row1.Pos1.Position signal and publishes this
44+
Vehicle.Cabin.Seat.Row1.DriverSide.Position signal and publishes this
4445
information via another specific MQTT topic
4546
"""
4647

@@ -50,7 +51,7 @@ def __init__(self, vehicle_client: Vehicle):
5051

5152
async def on_start(self):
5253
"""Run when the vehicle app starts"""
53-
await self.Vehicle.Cabin.Seat.Row1.Pos1.Position.subscribe(
54+
await self.Vehicle.Cabin.Seat.Row1.DriverSide.Position.subscribe(
5455
self.on_seat_position_changed
5556
)
5657

@@ -59,7 +60,11 @@ async def on_seat_position_changed(self, data: DataPointReply):
5960
await self.publish_event(
6061
response_topic,
6162
json.dumps(
62-
{"position": data.get(self.Vehicle.Cabin.Seat.Row1.Pos1.Position).value}
63+
{
64+
"position": data.get(
65+
self.Vehicle.Cabin.Seat.Row1.DriverSide.Position
66+
).value
67+
}
6368
),
6469
)
6570

@@ -75,7 +80,7 @@ async def on_set_position_request_received(self, data_str: str) -> None:
7580
position = data["position"]
7681
if vehicle_speed == 0:
7782
try:
78-
await self.Vehicle.Cabin.Seat.Row1.Pos1.Position.set(position)
83+
await self.Vehicle.Cabin.Seat.Row1.DriverSide.Position.set(position)
7984
response_data["result"] = {
8085
"status": 0,
8186
"message": f"Set Seat position to: {position}",

examples/seat-adjuster/tests/unit/test_run.py

+10-3
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import pytest
2222
from google.protobuf.timestamp_pb2 import Timestamp
2323
from vehicle import vehicle # type: ignore
24+
2425
from velocitas_sdk.vdb.reply import DataPointReply
2526
from velocitas_sdk.vdb.types import TypedDataPointResult
2627

@@ -88,7 +89,9 @@ async def test_on_set_position_request_received_vehicle_not_moving():
8889
new_callable=mock.AsyncMock,
8990
return_value=vehicle_speed_data_point,
9091
):
91-
called_data_point = seat_adjuster_app.Vehicle.Cabin.Seat.Row1.Pos1.Position
92+
called_data_point = (
93+
seat_adjuster_app.Vehicle.Cabin.Seat.Row1.DriverSide.Position
94+
)
9295
called_data_point.set = AsyncMock()
9396
seat_adjuster_app.publish_event = AsyncMock()
9497

@@ -162,7 +165,9 @@ async def test_on_set_position_request_received_error_path():
162165
new_callable=mock.AsyncMock,
163166
return_value=vehicle_speed_data_point,
164167
):
165-
called_data_point = seat_adjuster_app.Vehicle.Cabin.Seat.Row1.Pos1.Position
168+
called_data_point = (
169+
seat_adjuster_app.Vehicle.Cabin.Seat.Row1.DriverSide.Position
170+
)
166171
called_data_point.set = AsyncMock(side_effect=async_raise_exception)
167172
seat_adjuster_app.publish_event = AsyncMock()
168173

@@ -203,7 +208,9 @@ async def test_on_set_position_request_received_high_position():
203208
new_callable=mock.AsyncMock,
204209
return_value=vehicle_speed_data_point,
205210
):
206-
called_data_point = seat_adjuster_app.Vehicle.Cabin.Seat.Row1.Pos1.Position
211+
called_data_point = (
212+
seat_adjuster_app.Vehicle.Cabin.Seat.Row1.DriverSide.Position
213+
)
207214
called_data_point.set = AsyncMock(side_effect=async_raise_value_error)
208215
seat_adjuster_app.publish_event = AsyncMock()
209216

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161

6262
setup(
6363
name="velocitas_sdk",
64-
version="0.14.0",
64+
version="0.14.1",
6565
description="A Python SDK for Vehicle app",
6666
long_description=long_description,
6767
long_description_content_type="text/markdown",

0 commit comments

Comments
 (0)