From 37fff929429df3ef1e2e128b6ecb5fdbf5dd539a Mon Sep 17 00:00:00 2001 From: Michael Zanetti Date: Fri, 15 Feb 2019 16:40:58 +0100 Subject: [PATCH] Simulation: Update ev charger to new interface spec --- simulation/devicepluginsimulation.cpp | 10 +++++----- simulation/devicepluginsimulation.json | 17 +++++++++-------- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/simulation/devicepluginsimulation.cpp b/simulation/devicepluginsimulation.cpp index bd20447b..179cdc97 100644 --- a/simulation/devicepluginsimulation.cpp +++ b/simulation/devicepluginsimulation.cpp @@ -155,12 +155,12 @@ DeviceManager::DeviceError DevicePluginSimulation::executeAction(Device *device, device->setStateValue(evChargerPowerStateTypeId, power); return DeviceManager::DeviceErrorNoError; - } else if(action.actionTypeId() == evChargerPercentageActionTypeId){ + } else if(action.actionTypeId() == evChargerMaxChargingCurrentActionTypeId){ // get the param value - Param currentParam = action.param(evChargerPercentageActionPercentageParamTypeId); - int percentage = currentParam.value().toInt(); - qCDebug(dcSimulation()) << "Set percentage" << percentage << "for EV Charger device" << device->name(); - device->setStateValue(evChargerPercentageStateTypeId, percentage); + Param maxChargeParam = action.param(evChargerMaxChargingCurrentActionMaxChargingCurrentParamTypeId); + uint maxCharge = maxChargeParam.value().toInt(); + qCDebug(dcSimulation()) << "Set maximum charging current to" << maxCharge << "for EV Charger device" << device->name(); + device->setStateValue(evChargerMaxChargingCurrentStateTypeId, maxCharge); return DeviceManager::DeviceErrorNoError; } return DeviceManager::DeviceErrorActionTypeNotFound; diff --git a/simulation/devicepluginsimulation.json b/simulation/devicepluginsimulation.json index 8c5fe53d..343d883e 100644 --- a/simulation/devicepluginsimulation.json +++ b/simulation/devicepluginsimulation.json @@ -231,14 +231,15 @@ }, { "id": "87600986-da37-4032-af37-015995910368", - "name": "percentage", - "displayName": "Percentage", - "displayNameEvent": "Percentage changed", - "displayNameAction": "Set percentage", - "type": "int", - "minValue": 0, - "maxValue": 100, - "defaultValue": 100, + "name": "maxChargingCurrent", + "displayName": "Maximum charging current", + "displayNameEvent": "MAximum charging current changed", + "displayNameAction": "Set maximum charging current", + "type": "uint", + "unit": "MilliAmpere", + "defaultValue": 0, + "minValue": 6000, + "maxValue": 80000, "writable": true } ]