Simulation: Update ev charger to new interface spec

master
Michael Zanetti 2019-02-15 16:40:58 +01:00
parent 65e9d98510
commit 37fff92942
2 changed files with 14 additions and 13 deletions

View File

@ -155,12 +155,12 @@ DeviceManager::DeviceError DevicePluginSimulation::executeAction(Device *device,
device->setStateValue(evChargerPowerStateTypeId, power); device->setStateValue(evChargerPowerStateTypeId, power);
return DeviceManager::DeviceErrorNoError; return DeviceManager::DeviceErrorNoError;
} else if(action.actionTypeId() == evChargerPercentageActionTypeId){ } else if(action.actionTypeId() == evChargerMaxChargingCurrentActionTypeId){
// get the param value // get the param value
Param currentParam = action.param(evChargerPercentageActionPercentageParamTypeId); Param maxChargeParam = action.param(evChargerMaxChargingCurrentActionMaxChargingCurrentParamTypeId);
int percentage = currentParam.value().toInt(); uint maxCharge = maxChargeParam.value().toInt();
qCDebug(dcSimulation()) << "Set percentage" << percentage << "for EV Charger device" << device->name(); qCDebug(dcSimulation()) << "Set maximum charging current to" << maxCharge << "for EV Charger device" << device->name();
device->setStateValue(evChargerPercentageStateTypeId, percentage); device->setStateValue(evChargerMaxChargingCurrentStateTypeId, maxCharge);
return DeviceManager::DeviceErrorNoError; return DeviceManager::DeviceErrorNoError;
} }
return DeviceManager::DeviceErrorActionTypeNotFound; return DeviceManager::DeviceErrorActionTypeNotFound;

View File

@ -231,14 +231,15 @@
}, },
{ {
"id": "87600986-da37-4032-af37-015995910368", "id": "87600986-da37-4032-af37-015995910368",
"name": "percentage", "name": "maxChargingCurrent",
"displayName": "Percentage", "displayName": "Maximum charging current",
"displayNameEvent": "Percentage changed", "displayNameEvent": "MAximum charging current changed",
"displayNameAction": "Set percentage", "displayNameAction": "Set maximum charging current",
"type": "int", "type": "uint",
"minValue": 0, "unit": "MilliAmpere",
"maxValue": 100, "defaultValue": 0,
"defaultValue": 100, "minValue": 6000,
"maxValue": 80000,
"writable": true "writable": true
} }
] ]