<commit_before>#include "JsonMessageBuilder.h"
#include "JsonForwarder/JsonDefines.h"
#include "DataLayer/KeyMotorData/I_KeyMotorData.h"
#include "DataLayer/MotorDetailsData/I_MotorDetailsData.h"
#include "DataLayer/MotorDetailsData/I_MotorDetailsUnit.h"
#include "DataLayer/DriverControlsData/I_DriverControlsData.h"
#include "DataLayer/MotorFaultsData/I_MotorFaultsData.h"
#include "DataLayer/BatteryFaultsData/I_BatteryFaultsData.h"
#include "DataLayer/BatteryData/I_BatteryData.h"
#include "DataLayer/MpptData/I_MpptData.h"
#include "DataLayer/LightsData/I_LightsData.h"
#include "DataLayer/AuxBmsData/I_AuxBmsData.h"

JsonMessageBuilder::JsonMessageBuilder()
{
}

QJsonObject JsonMessageBuilder::buildAuxBmsMessage(const I_AuxBmsData& data)
{
    QJsonObject auxBmsJson = QJsonObject();

    switch (data.getPrechargeState())
    {
        case I_AuxBmsData::PrechargeState::OFF:
            auxBmsJson[JsonFormat::PRECHARGE_STATE] = "OFF";
            break;

        case I_AuxBmsData::PrechargeState::COMMON_ENGAGED:
            auxBmsJson[JsonFormat::PRECHARGE_STATE] = "COMMON_ENGAGED";
            break;

        case I_AuxBmsData::PrechargeState::CHARGE_ENGAGED:
            auxBmsJson[JsonFormat::PRECHARGE_STATE] = "CHARGE_ENGAGED";
            break;

        case I_AuxBmsData::PrechargeState::DISCHARGE_ENGAGED:
            auxBmsJson[JsonFormat::PRECHARGE_STATE] = "DISCHARGE_ENGAGED";
            break;

        case I_AuxBmsData::PrechargeState::ALL_ENGAGED:
            auxBmsJson[JsonFormat::PRECHARGE_STATE] = "ALL_ENGAGED";
            break;

        default:
            auxBmsJson[JsonFormat::PRECHARGE_STATE] = "INVALID_STATE";
            break;
    }

    auxBmsJson[JsonFormat::AUX_VOLTAGE] = data.getAuxVoltage();
    auxBmsJson[JsonFormat::AUX_BMS_ALIVE] = data.getAuxBmsAlive();
    auxBmsJson[JsonFormat::STROBE_BMS_LIGHT] = data.getStrobeBmsLight();
    auxBmsJson[JsonFormat::ALLOW_CHARGE] = data.getAllowCharge();
    auxBmsJson[JsonFormat::CONTACTOR_ERROR] = data.getContactorError();
    return auxBmsJson;
}

QJsonObject JsonMessageBuilder::buildBatteryMessage(const I_BatteryData& data)
{
    QJsonObject batteryJson = QJsonObject();

    QJsonObject bmsRelayStatusFlagsJson = QJsonObject();
    bmsRelayStatusFlagsJson[JsonFormat::BMS_DISCHARGE_RELAY_ENABLED] = data.bmsDischargeRelayEnabled();
    bmsRelayStatusFlagsJson[JsonFormat::BMS_CHARGE_RELAY_ENABLED] = data.bmsChargeRelayEnabled();
    bmsRelayStatusFlagsJson[JsonFormat::BMS_CHARGER_SAFETY_ENABLED] = data.bmsChargerSafetyEnabled();
    bmsRelayStatusFlagsJson[JsonFormat::BMS_MALFUNCTION_INDICATOR_ACTIVE] = data.bmsMalfunctionIndicatorActive();
    bmsRelayStatusFlagsJson[JsonFormat::BMS_GET_MULTI_PURPOSE_INPUT_SIGNAL_STATUS] = data.bmsGetMultiPurposeInputSignalStatus();
    bmsRelayStatusFlagsJson[JsonFormat::BMS_GET_ALWAYS_ON_SIGNAL_STATUS] = data.bmsGetAlwaysOnSignalStatus();
    bmsRelayStatusFlagsJson[JsonFormat::BMS_GET_IS_READY_SIGNAL_STATUS] = data.bmsGetIsReadySignalStatus();
    bmsRelayStatusFlagsJson[JsonFormat::BMS_GET_IS_CHARGING_SIGNAL_STATUS] = data.bmsGetIsChargingSignalStatus();

    batteryJson[JsonFormat::ALIVE] = data.getAlive();
    batteryJson[JsonFormat::POPULATED_CELLS] = data.getPopulatedCells();
    batteryJson[JsonFormat::INPUT_VOLTAGE_12V] = data.get12VInputVoltage();
    batteryJson[JsonFormat::FAN_VOLTAGE] = data.getFanVoltage();
    batteryJson[JsonFormat::PACK_CURRENT] = data.getPackCurrent();
    batteryJson[JsonFormat::PACK_VOLTAGE] = data.getPackVoltage();
    batteryJson[JsonFormat::PACK_STATE_OF_CHARGE] = data.getPackStateOfCharge();
    batteryJson[JsonFormat::PACK_AMPHOURS] = data.getPackAmphours();
    batteryJson[JsonFormat::PACK_DEPTH_OF_DISCHARGE] = data.getPackDepthOfDischarge();
    batteryJson[JsonFormat::HIGH_TEMPERATURE] = data.getHighTemperature();
    batteryJson[JsonFormat::HIGH_THERMISTOR_ID] = data.getHighThermistorId();
    batteryJson[JsonFormat::LOW_TEMPERATURE] = data.getLowTemperature();
    batteryJson[JsonFormat::LOW_THERMISTOR_ID] = data.getLowThermistorId();
    batteryJson[JsonFormat::AVERAGE_TEMPERATURE] = data.getAverageTemperature();
    batteryJson[JsonFormat::INTERNAL_TEMPERATURE] = data.getInternalTemperature();
    batteryJson[JsonFormat::FAN_SPEED] = data.getFanSpeed();
    batteryJson[JsonFormat::REQUESTED_FAN_SPEED] = data.getRequestedFanSpeed();
    batteryJson[JsonFormat::LOW_CELL_VOLTAGE] = data.getLowCellVoltage();
    batteryJson[JsonFormat::LOW_CELL_VOLTAGE_ID] = data.getLowCellVoltageId();
    batteryJson[JsonFormat::HIGH_CELL_VOLTAGE] = data.getHighCellVoltage();
    batteryJson[JsonFormat::HIGH_CELL_VOLTAGE_ID] = data.getHighCellVoltageId();
    batteryJson[JsonFormat::AVERAGE_CELL_VOLTAGE] = data.getAverageCellVoltage();
    batteryJson[JsonFormat::BMS_RELAY_STATUS_FLAGS] = bmsRelayStatusFlagsJson;
    return batteryJson;
}

QJsonObject JsonMessageBuilder::buildBatteryFaultsMessage(const I_BatteryFaultsData& data)
{
    QJsonObject batteryFaultsJson = QJsonObject();

    QJsonObject errorFlagsJson = QJsonObject();
    errorFlagsJson[JsonFormat::INTERNAL_COMMUNICATION_FAULT] = data.internalCommunicationFault();
    errorFlagsJson[JsonFormat::INTERNAL_CONVERSION_FAULT] = data.internalConversionFault();
    errorFlagsJson[JsonFormat::WEAK_CELL_FAULT] = data.weakCellFault();
    errorFlagsJson[JsonFormat::LOW_CELL_VOLTAGE_FAULT] = data.lowCellVoltageFault();
    errorFlagsJson[JsonFormat::OPEN_WIRING_FAULT] = data.openWiringFault();
    errorFlagsJson[JsonFormat::CURRENT_SENSOR_FAULT] = data.currentSensorFault();
    errorFlagsJson[JsonFormat::PACK_VOLTAGE_SENSOR_FAULT] = data.packVoltageSensorFault();
    errorFlagsJson[JsonFormat::WEAK_PACK_FAULT] = data.weakPackFault();
    errorFlagsJson[JsonFormat::VOLTAGE_REDUNDANCY_FAULT] = data.voltageRedundancyFault();
    errorFlagsJson[JsonFormat::FAN_MONITOR_FAULT] = data.fanMonitorFault();
    errorFlagsJson[JsonFormat::THERMISTOR_FAULT_] = data.thermistorFault();
    errorFlagsJson[JsonFormat::CANBUS_COMMUNICATIONS_FAULT] = data.canbusCommunicationsFault();
    errorFlagsJson[JsonFormat::ALWAYS_ON_SUPPLYFAULT] = data.alwaysOnSupplyFault();
    errorFlagsJson[JsonFormat::HIGH_VOLTAGE_ISOLATION_FAULT] = data.highVoltageIsolationFault();
    errorFlagsJson[JsonFormat::POWER_SUPPLY_12V_FAULT] = data.powerSupply12VFault();
    errorFlagsJson[JsonFormat::CHARGE_LIMIT_ENFORCEMENT_FAULT] = data.chargeLimitEnforcementFault();
    errorFlagsJson[JsonFormat::DISCHARGE_LIMIT_ENFORCEMENT_FAULT] = data.dischargeLimitEnforcementFault();
    errorFlagsJson[JsonFormat::CHARGER_SAFETY_RELAY_FAULT] = data.chargerSafetyRelayFault();
    errorFlagsJson[JsonFormat::INTERNAL_MEMORY_FAULT] = data.internalMemoryFault();
    errorFlagsJson[JsonFormat::INTERNAL_THERMISTOR_FAULT] = data.internalThermistorFault();
    errorFlagsJson[JsonFormat::INTERNAL_LOGIC_FAULT] = data.internalLogicFault();

    QJsonObject limitFlagsJson = QJsonObject();
    limitFlagsJson[JsonFormat::DCL_REDUCED_DUE_TO_LOW_SOC] = data.dclReducedDueToLowSoc();
    limitFlagsJson[JsonFormat::DCL_REDUCED_DUE_TO_HIGH_CELL_RESISTANCE] = data.dclReducedDueToHighCellResistence();
    limitFlagsJson[JsonFormat::DCL_REDUCED_DUE_TO_TEMPERATURE_] = data.dclReducedDueToTemperature();
    limitFlagsJson[JsonFormat::DCL_REDUCED_DUE_TO_LOW_CELL_VOLTAGE] = data.dclReducedDueToLowCellVoltage();
    limitFlagsJson[JsonFormat::DCL_REDUCED_DUE_TO_LOW_PACK_VOLTAGE] = data.dclReducedDueToLowPackVoltage();
    limitFlagsJson[JsonFormat::DCL_AND_CCL_REDUCED_DUE_TO_VOLTAGE_FAILSAFE] = data.dclAndCclReducedDueToVoltageFailsafe();
    limitFlagsJson[JsonFormat::DCL_AND_CCL_REDUCED_DUE_TO_COMMUNICATION_FAILSAFE] = data.dclAndCclReducedDueToCommunicationFailsafe();
    limitFlagsJson[JsonFormat::CCL_REDUCED_DUE_TO_HIGH_SOC] = data.cclReducedDueToHighSoc();
    limitFlagsJson[JsonFormat::CCL_REDUCED_DUE_TO_HIGH_CELL_RESISTANCE] = data.cclReducedDueToHighCellResistence();
    limitFlagsJson[JsonFormat::CCL_REDUCED_DUE_TO_TEMPERATURE] = data.cclReducedDueToTemperature();
    limitFlagsJson[JsonFormat::CCL_REDUCED_DUE_TO_HIGH_CELL_VOLTAGE] = data.cclReducedDueToHighCellVoltage();
    limitFlagsJson[JsonFormat::CCL_REDUCED_DUE_TO_HIGH_PACK_VOLTAGE] = data.cclReducedDueToHighPackVoltage();
    limitFlagsJson[JsonFormat::CCL_REDUCED_DUE_TO_CHARGER_LATCH] = data.cclReducedDueToChargerLatch();
    limitFlagsJson[JsonFormat::CCL_REDUCED_DUE_TO_ALTERNATE_CURRENT_LIMIT] = data.cclReducedDueToAlternateCurrentLimit();

    batteryFaultsJson[JsonFormat::ERROR_FLAGS] = errorFlagsJson;
    batteryFaultsJson[JsonFormat::LIMITS_FLAGS] = limitFlagsJson;
    return batteryFaultsJson;
}

QJsonObject JsonMessageBuilder::buildDriverControlsMessage(const I_DriverControlsData& data)
{
    QJsonObject driverControlsJson = QJsonObject();
    driverControlsJson[JsonFormat::ALIVE] = data.getDriverControlsBoardAlive();
    driverControlsJson[JsonFormat::HEADLIGHTS_OFF] = data.getHeadlightsOff();
    driverControlsJson[JsonFormat::HEADLIGHTS_LOW] = data.getHeadlightsLow();
    driverControlsJson[JsonFormat::HEADLIGHTS_HIGH] = data.getHeadlightsHigh();
    driverControlsJson[JsonFormat::SIGNAL_RIGHT] = data.getSignalRight();
    driverControlsJson[JsonFormat::SIGNAL_LEFT] = data.getSignalLeft();
    driverControlsJson[JsonFormat::HAZARD] = data.getHazard();
    driverControlsJson[JsonFormat::INTERIOR] = data.getInterior();
    driverControlsJson[JsonFormat::VOLUME_UP] = data.getVolumeUp();
    driverControlsJson[JsonFormat::VOLUME_DOWN] = data.getVolumeDown();
    driverControlsJson[JsonFormat::NEXT_SONG] = data.getNextSong();
    driverControlsJson[JsonFormat::PREV_SONG] = data.getPreviousSong();
    driverControlsJson[JsonFormat::BRAKES] = data.getBrakes();
    driverControlsJson[JsonFormat::FORWARD] = data.getForward();
    driverControlsJson[JsonFormat::REVERSE] = data.getReverse();
    driverControlsJson[JsonFormat::PUSH_TO_TALK] = data.getPushToTalk();
    driverControlsJson[JsonFormat::HORN] = data.getHorn();
    driverControlsJson[JsonFormat::RESET] = data.getReset();
    driverControlsJson[JsonFormat::AUX] = data.getAux();
    driverControlsJson[JsonFormat::ACCELERATION] = float(data.getAcceleration()) / 10000;
    driverControlsJson[JsonFormat::REGEN_BRAKING] = float(data.getRegenBraking()) / 10000;

    return driverControlsJson;<commit_msg>Removed the division from message builder<commit_after>#include "JsonMessageBuilder.h"
#include "JsonForwarder/JsonDefines.h"
#include "DataLayer/KeyMotorData/I_KeyMotorData.h"
#include "DataLayer/MotorDetailsData/I_MotorDetailsData.h"
#include "DataLayer/MotorDetailsData/I_MotorDetailsUnit.h"
#include "DataLayer/DriverControlsData/I_DriverControlsData.h"
#include "DataLayer/MotorFaultsData/I_MotorFaultsData.h"
#include "DataLayer/BatteryFaultsData/I_BatteryFaultsData.h"
#include "DataLayer/BatteryData/I_BatteryData.h"
#include "DataLayer/MpptData/I_MpptData.h"
#include "DataLayer/LightsData/I_LightsData.h"
#include "DataLayer/AuxBmsData/I_AuxBmsData.h"

JsonMessageBuilder::JsonMessageBuilder()
{
}

QJsonObject JsonMessageBuilder::buildAuxBmsMessage(const I_AuxBmsData& data)
{
    QJsonObject auxBmsJson = QJsonObject();

    switch (data.getPrechargeState())
    {
        case I_AuxBmsData::PrechargeState::OFF:
            auxBmsJson[JsonFormat::PRECHARGE_STATE] = "OFF";
            break;

        case I_AuxBmsData::PrechargeState::COMMON_ENGAGED:
            auxBmsJson[JsonFormat::PRECHARGE_STATE] = "COMMON_ENGAGED";
            break;

        case I_AuxBmsData::PrechargeState::CHARGE_ENGAGED:
            auxBmsJson[JsonFormat::PRECHARGE_STATE] = "CHARGE_ENGAGED";
            break;

        case I_AuxBmsData::PrechargeState::DISCHARGE_ENGAGED:
            auxBmsJson[JsonFormat::PRECHARGE_STATE] = "DISCHARGE_ENGAGED";
            break;

        case I_AuxBmsData::PrechargeState::ALL_ENGAGED:
            auxBmsJson[JsonFormat::PRECHARGE_STATE] = "ALL_ENGAGED";
            break;

        default:
            auxBmsJson[JsonFormat::PRECHARGE_STATE] = "INVALID_STATE";
            break;
    }

    auxBmsJson[JsonFormat::AUX_VOLTAGE] = data.getAuxVoltage();
    auxBmsJson[JsonFormat::AUX_BMS_ALIVE] = data.getAuxBmsAlive();
    auxBmsJson[JsonFormat::STROBE_BMS_LIGHT] = data.getStrobeBmsLight();
    auxBmsJson[JsonFormat::ALLOW_CHARGE] = data.getAllowCharge();
    auxBmsJson[JsonFormat::CONTACTOR_ERROR] = data.getContactorError();
    return auxBmsJson;
}

QJsonObject JsonMessageBuilder::buildBatteryMessage(const I_BatteryData& data)
{
    QJsonObject batteryJson = QJsonObject();

    QJsonObject bmsRelayStatusFlagsJson = QJsonObject();
    bmsRelayStatusFlagsJson[JsonFormat::BMS_DISCHARGE_RELAY_ENABLED] = data.bmsDischargeRelayEnabled();
    bmsRelayStatusFlagsJson[JsonFormat::BMS_CHARGE_RELAY_ENABLED] = data.bmsChargeRelayEnabled();
    bmsRelayStatusFlagsJson[JsonFormat::BMS_CHARGER_SAFETY_ENABLED] = data.bmsChargerSafetyEnabled();
    bmsRelayStatusFlagsJson[JsonFormat::BMS_MALFUNCTION_INDICATOR_ACTIVE] = data.bmsMalfunctionIndicatorActive();
    bmsRelayStatusFlagsJson[JsonFormat::BMS_GET_MULTI_PURPOSE_INPUT_SIGNAL_STATUS] = data.bmsGetMultiPurposeInputSignalStatus();
    bmsRelayStatusFlagsJson[JsonFormat::BMS_GET_ALWAYS_ON_SIGNAL_STATUS] = data.bmsGetAlwaysOnSignalStatus();
    bmsRelayStatusFlagsJson[JsonFormat::BMS_GET_IS_READY_SIGNAL_STATUS] = data.bmsGetIsReadySignalStatus();
    bmsRelayStatusFlagsJson[JsonFormat::BMS_GET_IS_CHARGING_SIGNAL_STATUS] = data.bmsGetIsChargingSignalStatus();

    batteryJson[JsonFormat::ALIVE] = data.getAlive();
    batteryJson[JsonFormat::POPULATED_CELLS] = data.getPopulatedCells();
    batteryJson[JsonFormat::INPUT_VOLTAGE_12V] = data.get12VInputVoltage();
    batteryJson[JsonFormat::FAN_VOLTAGE] = data.getFanVoltage();
    batteryJson[JsonFormat::PACK_CURRENT] = data.getPackCurrent();
    batteryJson[JsonFormat::PACK_VOLTAGE] = data.getPackVoltage();
    batteryJson[JsonFormat::PACK_STATE_OF_CHARGE] = data.getPackStateOfCharge();
    batteryJson[JsonFormat::PACK_AMPHOURS] = data.getPackAmphours();
    batteryJson[JsonFormat::PACK_DEPTH_OF_DISCHARGE] = data.getPackDepthOfDischarge();
    batteryJson[JsonFormat::HIGH_TEMPERATURE] = data.getHighTemperature();
    batteryJson[JsonFormat::HIGH_THERMISTOR_ID] = data.getHighThermistorId();
    batteryJson[JsonFormat::LOW_TEMPERATURE] = data.getLowTemperature();
    batteryJson[JsonFormat::LOW_THERMISTOR_ID] = data.getLowThermistorId();
    batteryJson[JsonFormat::AVERAGE_TEMPERATURE] = data.getAverageTemperature();
    batteryJson[JsonFormat::INTERNAL_TEMPERATURE] = data.getInternalTemperature();
    batteryJson[JsonFormat::FAN_SPEED] = data.getFanSpeed();
    batteryJson[JsonFormat::REQUESTED_FAN_SPEED] = data.getRequestedFanSpeed();
    batteryJson[JsonFormat::LOW_CELL_VOLTAGE] = data.getLowCellVoltage();
    batteryJson[JsonFormat::LOW_CELL_VOLTAGE_ID] = data.getLowCellVoltageId();
    batteryJson[JsonFormat::HIGH_CELL_VOLTAGE] = data.getHighCellVoltage();
    batteryJson[JsonFormat::HIGH_CELL_VOLTAGE_ID] = data.getHighCellVoltageId();
    batteryJson[JsonFormat::AVERAGE_CELL_VOLTAGE] = data.getAverageCellVoltage();
    batteryJson[JsonFormat::BMS_RELAY_STATUS_FLAGS] = bmsRelayStatusFlagsJson;
    return batteryJson;
}

QJsonObject JsonMessageBuilder::buildBatteryFaultsMessage(const I_BatteryFaultsData& data)
{
    QJsonObject batteryFaultsJson = QJsonObject();

    QJsonObject errorFlagsJson = QJsonObject();
    errorFlagsJson[JsonFormat::INTERNAL_COMMUNICATION_FAULT] = data.internalCommunicationFault();
    errorFlagsJson[JsonFormat::INTERNAL_CONVERSION_FAULT] = data.internalConversionFault();
    errorFlagsJson[JsonFormat::WEAK_CELL_FAULT] = data.weakCellFault();
    errorFlagsJson[JsonFormat::LOW_CELL_VOLTAGE_FAULT] = data.lowCellVoltageFault();
    errorFlagsJson[JsonFormat::OPEN_WIRING_FAULT] = data.openWiringFault();
    errorFlagsJson[JsonFormat::CURRENT_SENSOR_FAULT] = data.currentSensorFault();
    errorFlagsJson[JsonFormat::PACK_VOLTAGE_SENSOR_FAULT] = data.packVoltageSensorFault();
    errorFlagsJson[JsonFormat::WEAK_PACK_FAULT] = data.weakPackFault();
    errorFlagsJson[JsonFormat::VOLTAGE_REDUNDANCY_FAULT] = data.voltageRedundancyFault();
    errorFlagsJson[JsonFormat::FAN_MONITOR_FAULT] = data.fanMonitorFault();
    errorFlagsJson[JsonFormat::THERMISTOR_FAULT_] = data.thermistorFault();
    errorFlagsJson[JsonFormat::CANBUS_COMMUNICATIONS_FAULT] = data.canbusCommunicationsFault();
    errorFlagsJson[JsonFormat::ALWAYS_ON_SUPPLYFAULT] = data.alwaysOnSupplyFault();
    errorFlagsJson[JsonFormat::HIGH_VOLTAGE_ISOLATION_FAULT] = data.highVoltageIsolationFault();
    errorFlagsJson[JsonFormat::POWER_SUPPLY_12V_FAULT] = data.powerSupply12VFault();
    errorFlagsJson[JsonFormat::CHARGE_LIMIT_ENFORCEMENT_FAULT] = data.chargeLimitEnforcementFault();
    errorFlagsJson[JsonFormat::DISCHARGE_LIMIT_ENFORCEMENT_FAULT] = data.dischargeLimitEnforcementFault();
    errorFlagsJson[JsonFormat::CHARGER_SAFETY_RELAY_FAULT] = data.chargerSafetyRelayFault();
    errorFlagsJson[JsonFormat::INTERNAL_MEMORY_FAULT] = data.internalMemoryFault();
    errorFlagsJson[JsonFormat::INTERNAL_THERMISTOR_FAULT] = data.internalThermistorFault();
    errorFlagsJson[JsonFormat::INTERNAL_LOGIC_FAULT] = data.internalLogicFault();

    QJsonObject limitFlagsJson = QJsonObject();
    limitFlagsJson[JsonFormat::DCL_REDUCED_DUE_TO_LOW_SOC] = data.dclReducedDueToLowSoc();
    limitFlagsJson[JsonFormat::DCL_REDUCED_DUE_TO_HIGH_CELL_RESISTANCE] = data.dclReducedDueToHighCellResistence();
    limitFlagsJson[JsonFormat::DCL_REDUCED_DUE_TO_TEMPERATURE_] = data.dclReducedDueToTemperature();
    limitFlagsJson[JsonFormat::DCL_REDUCED_DUE_TO_LOW_CELL_VOLTAGE] = data.dclReducedDueToLowCellVoltage();
    limitFlagsJson[JsonFormat::DCL_REDUCED_DUE_TO_LOW_PACK_VOLTAGE] = data.dclReducedDueToLowPackVoltage();
    limitFlagsJson[JsonFormat::DCL_AND_CCL_REDUCED_DUE_TO_VOLTAGE_FAILSAFE] = data.dclAndCclReducedDueToVoltageFailsafe();
    limitFlagsJson[JsonFormat::DCL_AND_CCL_REDUCED_DUE_TO_COMMUNICATION_FAILSAFE] = data.dclAndCclReducedDueToCommunicationFailsafe();
    limitFlagsJson[JsonFormat::CCL_REDUCED_DUE_TO_HIGH_SOC] = data.cclReducedDueToHighSoc();
    limitFlagsJson[JsonFormat::CCL_REDUCED_DUE_TO_HIGH_CELL_RESISTANCE] = data.cclReducedDueToHighCellResistence();
    limitFlagsJson[JsonFormat::CCL_REDUCED_DUE_TO_TEMPERATURE] = data.cclReducedDueToTemperature();
    limitFlagsJson[JsonFormat::CCL_REDUCED_DUE_TO_HIGH_CELL_VOLTAGE] = data.cclReducedDueToHighCellVoltage();
    limitFlagsJson[JsonFormat::CCL_REDUCED_DUE_TO_HIGH_PACK_VOLTAGE] = data.cclReducedDueToHighPackVoltage();
    limitFlagsJson[JsonFormat::CCL_REDUCED_DUE_TO_CHARGER_LATCH] = data.cclReducedDueToChargerLatch();
    limitFlagsJson[JsonFormat::CCL_REDUCED_DUE_TO_ALTERNATE_CURRENT_LIMIT] = data.cclReducedDueToAlternateCurrentLimit();

    batteryFaultsJson[JsonFormat::ERROR_FLAGS] = errorFlagsJson;
    batteryFaultsJson[JsonFormat::LIMITS_FLAGS] = limitFlagsJson;
    return batteryFaultsJson;
}

QJsonObject JsonMessageBuilder::buildDriverControlsMessage(const I_DriverControlsData& data)
{
    QJsonObject driverControlsJson = QJsonObject();
    driverControlsJson[JsonFormat::ALIVE] = data.getDriverControlsBoardAlive();
    driverControlsJson[JsonFormat::HEADLIGHTS_OFF] = data.getHeadlightsOff();
    driverControlsJson[JsonFormat::HEADLIGHTS_LOW] = data.getHeadlightsLow();
    driverControlsJson[JsonFormat::HEADLIGHTS_HIGH] = data.getHeadlightsHigh();
    driverControlsJson[JsonFormat::SIGNAL_RIGHT] = data.getSignalRight();
    driverControlsJson[JsonFormat::SIGNAL_LEFT] = data.getSignalLeft();
    driverControlsJson[JsonFormat::HAZARD] = data.getHazard();
    driverControlsJson[JsonFormat::INTERIOR] = data.getInterior();
    driverControlsJson[JsonFormat::VOLUME_UP] = data.getVolumeUp();
    driverControlsJson[JsonFormat::VOLUME_DOWN] = data.getVolumeDown();
    driverControlsJson[JsonFormat::NEXT_SONG] = data.getNextSong();
    driverControlsJson[JsonFormat::PREV_SONG] = data.getPreviousSong();
    driverControlsJson[JsonFormat::BRAKES] = data.getBrakes();
    driverControlsJson[JsonFormat::FORWARD] = data.getForward();
    driverControlsJson[JsonFormat::REVERSE] = data.getReverse();
    driverControlsJson[JsonFormat::PUSH_TO_TALK] = data.getPushToTalk();
    driverControlsJson[JsonFormat::HORN] = data.getHorn();
    driverControlsJson[JsonFormat::RESET] = data.getReset();
    driverControlsJson[JsonFormat::AUX] = data.getAux();
    driverControlsJson[JsonFormat::ACCELERATION] = float(data.getAcceleration());
    driverControlsJson[JsonFormat::REGEN_BRAKING] = float(data.getRegenBraking());
    return driverControlsJson;
{'fraction_non_alphanumeric': 0.10323955256404048, 'fraction_numerical': 0.0012590189337078107, 'mean_word_length': 7.761985574883326, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2556226', 'n_tokens_mistral': 7264, 'n_tokens_neox': 7125, 'n_words': 584}