Skip to content

Commit

Permalink
Improved seat massager sample
Browse files Browse the repository at this point in the history
  • Loading branch information
ashbeitz committed Feb 22, 2024
1 parent da3b109 commit 2989cf9
Show file tree
Hide file tree
Showing 30 changed files with 697 additions and 148 deletions.
14 changes: 7 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,17 @@ members = [
"samples/managed_subscribe",
"samples/mixed",
"samples/property",
"samples/seat_massager",
# "samples/seat_massager",
"samples/streaming",
"samples/tutorial"
]

[workspace.dependencies]
async-std = "^1.5"
bytes = "1.4.0"
config = "0.13.3"
config = "0.14.0"
dyn-clone = "1.0.14"
env_logger= "0.10.0"
env_logger= "0.11.2"
futures = "0.3.28"
futures-core = "0.3.4"
futures-util = "0.3.28"
Expand All @@ -56,13 +56,13 @@ paho-mqtt = "0.12"
parking_lot = "0.12.1"
prost = "0.12"
prost-types = "0.12"
regex = " 1.9.3"
sdl2 = "0.35.2"
regex = " 1.10.3"
sdl2 = "0.34.0"
serde = "1.0.160"
serde_derive = "1.0.163"
serde_json = "^1.0"
strum = "0.25"
strum_macros = "0.25.1"
strum = "0.26.1"
strum_macros = "0.26.1"
tokio = "1.29.1"
tokio-console-subscriber = { version = "0.2.0", package = "console-subscriber" }
tokio-stream = "0.1.14"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ sudo apt install -y libsdl2-dev
You will need to install dotnet-sdk for the dtdl-tools crate. This can be done by executing:

```shell
sudo apt install -y dotnet-sdk-7.0
sudo apt install -y dotnet-sdk-8.0
```

### <a name="install-mqtt-broker">Install MQTT Broker</a>
Expand Down
116 changes: 116 additions & 0 deletions digital-twin-model/dtdl/dtmi/sdv/airbag_seat_massager-1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
{
"@context": ["dtmi:dtdl:context;3"],
"@type": "Interface",
"@id": "dtmi:sdv:airbag_seat_massager;1",
"description": "Airbag Seat Massager Interface",
"extends": "dtmi:sdv:seat_massager;1",
"contents": [
{
"@type": "Command",
"@id": "dtmi:sdv:airbag_seat_massager:store_sequence;1",
"name": "store_sequence",
"request": {
"name": "request",
"schema": {
"@type": "Object",
"fields": [
{
"name": "sequence",
"schema": "dtmi:sdv:massage_sequence;1"
}
]
}
},
"response": {
"name": "response",
"schema": {
"@type": "Object",
"fields": [
{
"name": "status",
"schema": "dtmi:sdv:airbag_seat_massager:status;1"
}
]
}
}
},
{
"@type": "Command",
"@id": "dtmi:sdv:airbag_seat_massager:perform_step;1",
"name": "perfom_step",
"request": {
"name": "request",
"schema": {
"@type": "Object",
"fields": [
{
"name": "sequence",
"schema": "dtmi:sdv:massage_sequence;1"
}
]
}
},
"response": {
"name": "response",
"schema": {
"@type": "Object",
"fields": [
{
"name": "status",
"schema": "dtmi:sdv:airbag_seat_massager:status;1"
}
]
}
}
}
],
"schemas": [
{
"@id": "dtmi:sdv:airbag_seat_massager:status;1",
"@type": "Object",
"fields": [
{
"name": "code",
"schema": "integer"
},
{
"name": "message",
"schema": "string"
}
]
},
{
"@id": "dtmi:sdv:massage_sequence;1",
"@type": "Array",
"elementSchema": "dtmi:sdv:massage_step;1"
},
{
"@id": "dtmi:sdv:massage_step;1",
"@type": "Array",
"elementSchema": "dtmi:sdv:airbag_adjustments;1"
},
{
"@id": "dtmi:sdv:airbag_adjustments;1",
"@type": "Array",
"elementSchema": "dtmi:sdv:airbag_adjustment;1"
},
{
"@id": "dtmi:sdv:airbag_adjustment;1",
"@type": "Object",
"fields": [
{
"name": "airbag_identifier",
"schema": "integer"
},
{
"name": "inflation_level",
"schema": "integer"
},
{
"name": "duration",
"schema": "duration"
}
]
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"@context": ["dtmi:dtdl:context;3"],
"@type": "Interface",
"@id": "dtmi:sdv:basic_airbag_seat_massager;1",
"description": "Basic Airbag Seat Massager Interface",
"extends": "dtmi:sdv:airbag_seat_massager;1"
}
62 changes: 62 additions & 0 deletions digital-twin-model/dtdl/dtmi/sdv/cabin-1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{
"@context": ["dtmi:dtdl:context;3"],
"@type": "Interface",
"@id": "dtmi:sdv:cabin;1",
"description": "Cabin Interface",
"contents": [
{
"@type": "Relationship",
"@id": "dtmi:sdv:cabin:has_infotainment;1",
"target": "dtmi:sdv:infotainment;1",
"name": "has_infotainment",
"maxMultiplicity": 1
},
{
"@type": "Relationship",
"@id": "dtmi:sdv:cabin:has_hvac;1",
"target": "dtmi:sdv:hvac;1",
"name": "has_hvac",
"maxMultiplicity": 1
},
{
"@type": "Relationship",
"@id": "dtmi:sdv:cabin:has_seat;1",
"name": "has_seat",
"target": "dtmi:sdv:seat;1",
"properties": [
{
"@type": "Property",
"@id": "dtmi:sdv:seat:seat_row;1",
"name": "seat_row",
"schema": "integer"
},
{
"@type": "Property",
"@id": "dtmi:sdv:Seat:seat_position;1",
"name": "seat_position",
"schema": {
"@type": "Enum",
"valueSchema": "string",
"enumValues": [
{
"name": "left",
"displayName": "left",
"enumValue": "left"
},
{
"name": "center",
"displayName": "center",
"enumValue": "center"
},
{
"name": "right",
"displayName": "right",
"enumValue": "right"
}
]
}
}
]
}
]
}
31 changes: 31 additions & 0 deletions digital-twin-model/dtdl/dtmi/sdv/camera-1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"@context": "dtmi:dtdl:context;3",
"@type": "Interface",
"@id": "dtmi:sdv:camera;1",
"description": "Cabin camera.",
"contents": [
{
"@type": "Property",
"@id": "dtmi:sdv:camera:feed;1",
"name": "Feed",
"description": "The camera feed inside of the cabin.",
"schema": {
"@type": "Object",
"fields": [
{
"name": "media_type",
"schema": "string"
},
{
"name": "media_content",
"description": "An array of bytes (represented by integers here).",
"schema": {
"@type": "Array",
"elementSchema": "integer"
}
}
]
}
}
]
}
21 changes: 21 additions & 0 deletions digital-twin-model/dtdl/dtmi/sdv/hmi-1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"@context": ["dtmi:dtdl:context;3"],
"@type": "Interface",
"@id": "dtmi:sdv:hmi;1",
"description": "The Human Machine Interface.",
"contents": [
{
"@type": "Command",
"@id": "dtmi:sdv:hmi:show_notification;1",
"name": "show_notification",
"description": "Show a notification on the HMI.",
"request": {
"@id": "dtmi:sdv:hmi:show_notification:request;1",
"name": "notification",
"displayName": "Notification",
"description": "The notification to show on the HMI.",
"schema": "string"
}
}
]
}
22 changes: 22 additions & 0 deletions digital-twin-model/dtdl/dtmi/sdv/hvac-1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"@context": ["dtmi:dtdl:context;3"],
"@type": "Interface",
"@id": "dtmi:sdv:hvac;1",
"description": "Heat, Ventilation and Air Conditioning",
"contents": [
{
"@type": "Property",
"@id": "dtmi:sdv:hvac:ambient_air_temperature;1",
"name": "ambient_air_temperature",
"description": "The immediate surroundings' air temperature (in Fahrenheit).",
"schema": "integer"
},
{
"@type": "Property",
"@id": "dtmi:sdv:hvac:is_air_conditioning_active;1",
"name": "is_air_conditioning_active",
"description": "Is air conditioning active?",
"schema": "boolean"
}
]
}
15 changes: 15 additions & 0 deletions digital-twin-model/dtdl/dtmi/sdv/infotainment-1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"@context": ["dtmi:dtdl:context;3"],
"@type": "Interface",
"@id": "dtmi:sdv:infotainment;1",
"description": "Infotainment Interface",
"contents": [
{
"@type": "Relationship",
"@id": "dtmi:sdv:infotainment:has_hmi;1",
"target": "dtmi:sdv:hmi;1",
"name": "has_hmi",
"maxMultiplicity": 1
}
]
}
15 changes: 15 additions & 0 deletions digital-twin-model/dtdl/dtmi/sdv/obd-1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"@context": "dtmi:dtdl:context;3",
"@type": "Interface",
"@id": "dtmi:sdv:obd;1",
"description": "On-board Diagnostics Interface",
"contents": [
{
"@type": "Property",
"@id": "dtmi:sdv:obd:hybri_bBattery_remaining;1",
"name": "hybrid_battery_remaining",
"description": "The remaining hybrid battery life.",
"schema": "integer"
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"@context": ["dtmi:dtdl:context;3"],
"@type": "Interface",
"@id": "dtmi:sdv:premium_airbag_seat_massager;1",
"description": "Premium Airbag Seat Massager Interface",
"extends": "dtmi:sdv:airbag_seat_massager;1"
}
6 changes: 6 additions & 0 deletions digital-twin-model/dtdl/dtmi/sdv/seat-1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"@context": ["dtmi:dtdl:context;3"],
"@type": "Interface",
"@id": "dtmi:sdv:seat;1",
"description": "Seat Interface"
}
Loading

0 comments on commit 2989cf9

Please sign in to comment.