Skip to content

Commit

Permalink
Set multiple DataPoints atomically (#28)
Browse files Browse the repository at this point in the history
Co-authored-by: Dominic Sudy <[email protected]>
Co-authored-by: BjoernAtBosch <[email protected]>
  • Loading branch information
3 people authored Jan 9, 2023
1 parent dcc988d commit c9ddabc
Show file tree
Hide file tree
Showing 48 changed files with 1,938 additions and 980 deletions.
5 changes: 2 additions & 3 deletions .vscode/c_cpp_properties.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,12 @@
{
"name": "Linux",
"includePath": [
"${workspaceFolder}/**"
"${workspaceFolder}/sdk/include"
],
"defines": [],
"defines": [ ],
"compilerPath": "/usr/bin/gcc",
"cStandard": "c17",
"cppStandard": "c++11",
"intelliSenseMode": "linux-clang-x64",
"configurationProvider": "ms-vscode.cmake-tools"
}
],
Expand Down
35 changes: 23 additions & 12 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,33 +9,44 @@
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/build/bin/sdk_utests",
"args": [],
"args": [ ],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"externalConsole": false,
"MIMode": "gdb",
"setupCommands": [],
"setupCommands": [ ],
"preLaunchTask": "CMake: build",
},
{
"name": "VehicleApp - Unit Tests",
"name": "Example - SeatAdjuster",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/build/bin/App_utests",
"args": [],
"program": "${workspaceFolder}/build/bin/example-seatadjusterapp",
"args": [ ],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [
{
"name": "DAPR_GRPC_PORT",
"value": "50001"
},
{
"name": "DAPR_HTTP_PORT",
"value": "3500"
}
],
"externalConsole": false,
"MIMode": "gdb",
"setupCommands": [],
"preLaunchTask": "CMake: build",
"setupCommands": [ ],
"preLaunchTask": "dapr-VehicleApp-run",
"postDebugTask": "dapr-VehicleApp-stop",
},
{
"name": "VehicleApp - Debug (dapr run)",
"name": "Example - SetDataPointsExample",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/build/bin/App",
"args": [],
"program": "${workspaceFolder}/build/bin/example-set-data-points",
"args": [ ],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [
Expand All @@ -50,8 +61,8 @@
],
"externalConsole": false,
"MIMode": "gdb",
"setupCommands": [],
"preLaunchTask": "CPP - Build and Run daprized App",
"setupCommands": [ ],
"preLaunchTask": "dapr-VehicleApp-run",
"postDebugTask": "dapr-VehicleApp-stop",
}
]
Expand Down
22 changes: 10 additions & 12 deletions .vscode/scripts/runtime/local/run-vehicledatabroker-cli.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,29 +25,27 @@ source $UTILS_DIRECTORY/get-appmanifest-data.sh

sudo chown $(whoami) $HOME

DATABROKER_REPO="https://github.com/boschglobal/kuksa.val"
# Needed because of how the databroker release is tagged
DATABROKER_VERSION="databroker-$DATABROKER_TAG"
DATABROKER_VERSION=$DATABROKER_TAG

#Detect host environment (distinguish for Mac M1 processor)
if [[ `uname -m` == 'aarch64' || `uname -m` == 'arm64' ]]; then
echo "Detected ARM architecture"
PROCESSOR="aarch64"
DATABROKER_BINARY_NAME="databroker_aarch64.tar.gz"
DATABROKER_EXEC_PATH="$ROOT_DIRECTORY/.vscode/scripts/assets/databroker/$DATABROKER_VERSION/$PROCESSOR/target/aarch64-unknown-linux-gnu/release"
else
echo "Detected x86_64 architecture"
PROCESSOR="x86_64"
DATABROKER_BINARY_NAME='databroker_x86_64.tar.gz'
DATABROKER_EXEC_PATH="$ROOT_DIRECTORY/.vscode/scripts/assets/databroker/$DATABROKER_VERSION/$PROCESSOR/target/release"
fi
echo "Detected ${PROCESSOR} architecture"
DATABROKER_BINARY_NAME="databroker_${PROCESSOR}.tar.gz"
DATABROKER_INSTALL_PATH="$ROOT_DIRECTORY/.vscode/scripts/assets/databroker/$DATABROKER_VERSION/$PROCESSOR"
DATABROKER_EXEC_PATH="$DATABROKER_INSTALL_PATH/target/release"

if [[ ! -f "$DATABROKER_EXEC_PATH/databroker" ]]
then
API_URL=https://api.github.com/repos/eclipse/kuksa.val
echo "Downloading databroker:$DATABROKER_VERSION"
DATABROKER_ASSET_ID=$(curl $API_URL/releases/tags/$DATABROKER_VERSION | jq -r ".assets[] | select(.name == \"$DATABROKER_BINARY_NAME\") | .id")
curl -o $ROOT_DIRECTORY/.vscode/scripts/assets/databroker/$DATABROKER_VERSION/$PROCESSOR/$DATABROKER_BINARY_NAME --create-dirs -L -H "Accept: application/octet-stream" "$API_URL/releases/assets/$DATABROKER_ASSET_ID"
tar -xf $ROOT_DIRECTORY/.vscode/scripts/assets/databroker/$DATABROKER_VERSION/$PROCESSOR/$DATABROKER_BINARY_NAME -C $ROOT_DIRECTORY/.vscode/scripts/assets/databroker/$DATABROKER_VERSION/$PROCESSOR
DL_URL="${DATABROKER_REPO}/releases/download/${DATABROKER_VERSION}/${DATABROKER_BINARY_NAME}"
echo "Downloading ${DATABROKER_BINARY_NAME} v$DATABROKER_VERSION"
curl -o $DATABROKER_INSTALL_PATH/$DATABROKER_BINARY_NAME --create-dirs -L -H "Accept: application/octet-stream" "$DL_URL"
tar -xf $DATABROKER_INSTALL_PATH/$DATABROKER_BINARY_NAME -C $DATABROKER_INSTALL_PATH
fi

$DATABROKER_EXEC_PATH/databroker-cli
75 changes: 75 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
{
"files.associations": {
"any": "cpp",
"array": "cpp",
"atomic": "cpp",
"bit": "cpp",
"*.tcc": "cpp",
"bitset": "cpp",
"cctype": "cpp",
"chrono": "cpp",
"cinttypes": "cpp",
"clocale": "cpp",
"cmath": "cpp",
"codecvt": "cpp",
"compare": "cpp",
"concepts": "cpp",
"condition_variable": "cpp",
"cstdarg": "cpp",
"cstddef": "cpp",
"cstdint": "cpp",
"cstdio": "cpp",
"cstdlib": "cpp",
"cstring": "cpp",
"ctime": "cpp",
"cwchar": "cpp",
"cwctype": "cpp",
"deque": "cpp",
"forward_list": "cpp",
"list": "cpp",
"map": "cpp",
"set": "cpp",
"string": "cpp",
"unordered_map": "cpp",
"unordered_set": "cpp",
"vector": "cpp",
"exception": "cpp",
"algorithm": "cpp",
"functional": "cpp",
"iterator": "cpp",
"memory": "cpp",
"memory_resource": "cpp",
"numeric": "cpp",
"optional": "cpp",
"random": "cpp",
"ratio": "cpp",
"string_view": "cpp",
"system_error": "cpp",
"tuple": "cpp",
"type_traits": "cpp",
"utility": "cpp",
"fstream": "cpp",
"future": "cpp",
"initializer_list": "cpp",
"iomanip": "cpp",
"iosfwd": "cpp",
"iostream": "cpp",
"istream": "cpp",
"limits": "cpp",
"mutex": "cpp",
"new": "cpp",
"numbers": "cpp",
"ostream": "cpp",
"ranges": "cpp",
"semaphore": "cpp",
"sstream": "cpp",
"stdexcept": "cpp",
"stop_token": "cpp",
"streambuf": "cpp",
"thread": "cpp",
"typeinfo": "cpp",
"valarray": "cpp",
"variant": "cpp",
"*.inc": "cpp"
}
}
20 changes: 9 additions & 11 deletions AppManifest.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
[
{
"Name": "seatadjuster",
"Port": 50008,
"Name": "sampleapp",
"Port": -1,
"DAPR_GRPC_PORT": 50001,
"Dockerfile": "./app/Dockerfile",
"dependencies": {
"services": [
{
"name": "seatservice",
"image": "ghcr.io/eclipse/kuksa.val.services/seat_service",
"version": "v0.1.0"
"image": "ghcr.io/boschglobal/kuksa.val.services/seat_service",
"version": "v0.2.0"
}
],
"runtime": [
Expand All @@ -19,18 +20,15 @@
},
{
"name": "databroker",
"image": "ghcr.io/eclipse/kuksa.val/databroker",
"version": "v0.17.0"
"image": "ghcr.io/boschglobal/kuksa.val/databroker",
"version": "0.0.2"
},
{
"name": "feedercan",
"image": "ghcr.io/eclipse/kuksa.val.feeders/dbc2val",
"version": "v0.1.0"
"version": "v0.1.1"
}
],
"python": {
"version": "3.9"
},
"dapr": {
"cli": {
"version": "1.9.1"
Expand All @@ -41,4 +39,4 @@
}
}
}
]
]
8 changes: 4 additions & 4 deletions NOTICE-3RD-PARTY-CONTENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,20 @@
|distlib|0.3.6|Python Software Foundation License|
|distro|1.7.0|Apache 2.0|
|fasteners|0.18|Apache 2.0|
|filelock|3.8.2|The Unlicense (Unlicense)|
|filelock|3.9.0|The Unlicense (Unlicense)|
|gcovr|5.2|BSD|
|identify|2.5.11|MIT|
|identify|2.5.12|MIT|
|idna|3.4|BSD|
|Jinja2|3.1.2|New BSD|
|lxml|4.9.2|New BSD|
|MarkupSafe|2.1.1|New BSD|
|node-semver|0.6.1|MIT|
|nodeenv|1.7.0|BSD|
|patch-ng|1.17.4|MIT|
|platformdirs|2.6.0|MIT|
|platformdirs|2.6.2|MIT|
|pluginbase|1.0.1|BSD|
|pre-commit|2.20.0|MIT|
|Pygments|2.13.0|BSD|
|Pygments|2.14.0|Simplified BSD|
|PyJWT|2.6.0|MIT|
|python-dateutil|2.8.2|Apache 2.0<br/>BSD|
|PyYAML|6.0|MIT|
Expand Down
3 changes: 2 additions & 1 deletion examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@

add_subdirectory(vehicle_model)

add_subdirectory(seat-adjuster)
add_subdirectory(seat-adjuster)
add_subdirectory(set-data-points)
13 changes: 5 additions & 8 deletions examples/seat-adjuster/AppManifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
"services": [
{
"name": "seatservice",
"image": "ghcr.io/eclipse/kuksa.val.services/seat_service",
"version": "v0.1.0"
"image": "ghcr.io/boschglobal/kuksa.val.services/seat_service",
"version": "v0.2.0"
}
],
"runtime": [
Expand All @@ -20,18 +20,15 @@
},
{
"name": "databroker",
"image": "ghcr.io/eclipse/kuksa.val/databroker",
"version": "v0.17.0"
"image": "ghcr.io/boschglobal/kuksa.val/databroker",
"version": "0.0.2"
},
{
"name": "feedercan",
"image": "ghcr.io/eclipse/kuksa.val.feeders/dbc2val",
"version": "v0.1.0"
"version": "v0.1.1"
}
],
"python": {
"version": "3.9"
},
"dapr": {
"cli": {
"version": "1.9.1"
Expand Down
6 changes: 3 additions & 3 deletions examples/seat-adjuster/src/SeatAdjusterApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@

#include "SeatAdjusterApp.h"
#include "sdk/IPubSubClient.h"
#include "sdk/IVehicleDataBrokerClient.h"
#include "sdk/Logger.h"
#include "sdk/QueryBuilder.h"
#include "sdk/vdb/IVehicleDataBrokerClient.h"

#include <fmt/core.h>
#include <nlohmann/json.hpp>
Expand Down Expand Up @@ -70,7 +70,7 @@ void SeatAdjusterApp::onStart() {
->onError([this](auto&& status) { onErrorTopic(std::forward<decltype(status)>(status)); });
}

void SeatAdjusterApp::onSpeedChanged(const velocitas::DataPointsResult& dataPoints) {
void SeatAdjusterApp::onSpeedChanged(const velocitas::DataPointReply& dataPoints) {
velocitas::logger().info("Speed has changed: {}",
dataPoints.get(m_vehicleModel->getSpeed())->value());
}
Expand Down Expand Up @@ -131,7 +131,7 @@ void SeatAdjusterApp::onSetPositionRequestReceived(const std::string& data) {
}
}

void SeatAdjusterApp::onSeatPositionChanged(const velocitas::DataPointsResult& dataPoints) {
void SeatAdjusterApp::onSeatPositionChanged(const velocitas::DataPointReply& dataPoints) {
const auto& seatPositionDataPoint =
m_vehicleModel->getCabin()
.getSeat()
Expand Down
5 changes: 2 additions & 3 deletions examples/seat-adjuster/src/SeatAdjusterApp.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
#ifndef VEHICLE_APP_SDK_SEATADJUSTER_EXAMPLE_H
#define VEHICLE_APP_SDK_SEATADJUSTER_EXAMPLE_H

#include "sdk/Logger.h"
#include "sdk/Status.h"
#include "sdk/VehicleApp.h"
#include "vehicle_model/Vehicle.h"
Expand Down Expand Up @@ -45,7 +44,7 @@ class SeatAdjusterApp : public velocitas::VehicleApp {
*
* @param dataPoints The affected data points.
*/
void onSpeedChanged(const velocitas::DataPointsResult& dataPoints);
void onSpeedChanged(const velocitas::DataPointReply& dataPoints);

/**
* @brief Handle successful seat movement requests.
Expand All @@ -68,7 +67,7 @@ class SeatAdjusterApp : public velocitas::VehicleApp {
*
* @param dataPoints The affected data points.
*/
void onSeatPositionChanged(const velocitas::DataPointsResult& dataPoints);
void onSeatPositionChanged(const velocitas::DataPointReply& dataPoints);

/**
* @brief Handle errors which occurred during async invocation.
Expand Down
Loading

0 comments on commit c9ddabc

Please sign in to comment.