68 yInfo() <<
"embObjBattery::open(): preparing ETH resource";
69 if (!
device_->prerareEthService(config,
this))
72 yInfo() <<
device_->getBoardInfo() <<
" embObjBattery::open(): browsing xml files which describe the service";
74 if (!parser.
parse(config))
76 yError() <<
device_->getBoardInfo() <<
"open() fails to parse xml... cannot continue ";
80 yInfo() <<
device_->getBoardInfo() <<
" embObjBattery::open(): verify the presence of the board and if its protocol version is correct";
81 if (!
device_->res->verifyEPprotocol(eoprot_endpoint_analogsensors))
83 yError() <<
device_->getBoardInfo() <<
" open() fails to verifyEPprotocol... cannot continue ";
88 yInfo() <<
device_->getBoardInfo() <<
" embObjBattery::open(): verify and activate the FT service";
89 eOmn_serv_parameter_t canBatteryData;
90 canBatteryData.configuration.type = eomn_serv_AS_battery;
91 canBatteryData.configuration.diagnosticsmode = eomn_serv_diagn_mode_NONE;
92 canBatteryData.configuration.diagnosticsparam = 0;
93 parser.
toEomn(canBatteryData.configuration.data.as.battery);
94 if (!
device_->res->serviceVerifyActivate(eomn_serv_category_battery, &canBatteryData, 5.0))
96 yError() <<
device_->getBoardInfo() <<
" open() fails to serviceVerifyActivate... cannot continue ";
101 yInfo() <<
device_->getBoardInfo() <<
" embObjBattery::open(): configure the FT service";
104 yError() <<
device_->getBoardInfo() <<
" open() fails to sendConfig2boards... cannot continue";
109 yInfo() <<
device_->getBoardInfo() <<
" embObjBattery::open(): impose the network variable which the ETH bord must stream up";
112 yError() <<
device_->getBoardInfo() <<
" open() fails to initRegulars... cannot continue";
117 yInfo() <<
device_->getBoardInfo() <<
" embObjBattery::open(): start the FT service";
118 if (!
device_->res->serviceStart(eomn_serv_category_battery))
120 yError() <<
device_->getBoardInfo() <<
" open() fails to serviceStart... cannot continue";
128 yDebug() <<
device_->getBoardInfo() <<
" open() correctly starts service";
132 yInfo() <<
device_->getBoardInfo() <<
" embObjBattery::open(): start streaming of FT data";
135 yError() <<
device_->getBoardInfo() <<
" open() fails to sendStart2boards... cannot continue";
195 vector<eOprotID32_t> id32v;
196 eOprotID32_t id32 = eo_prot_ID32dummy;
199 id32 = eoprot_ID_get(eoprot_endpoint_analogsensors, eoprot_entity_as_battery, 0, eoprot_tag_as_battery_status_timedvalue);
200 id32v.push_back(id32);
204 yError() <<
device_->getBoardInfo() <<
" initRegulars() fails to add its variables to regulars: cannot proceed any further";
210 yDebug() <<
device_->getBoardInfo() <<
" initRegulars() added" << id32v.size() <<
"regular rops ";
212 for (
size_t r = 0; r < id32v.size(); r++)
214 uint32_t item = id32v.at(r);
215 eoprot_ID2information(item, nvinfo,
sizeof(nvinfo));
216 yDebug() <<
device_->getBoardInfo() <<
"\t it added regular rop for" << nvinfo;
317 static const std::array<std::pair<eOas_battery_alarm_status_t, std::string_view>, eoas_battery_alarm_status_numberof> s_boards_map_of_battery_alarm_status =
319 {{eoas_bms_general_alarm_lowvoltage,
"eoas_bms_general_alarm_lowvoltage"},
320 {eoas_bms_general_alarm_highvoltage,
"eoas_bms_general_alarm_highvoltage"},
321 {eoas_bms_general_alarm_overcurrent_discharge,
"eoas_bms_general_alarm_overcurrent_discharge"},
322 {eoas_bms_general_alarm_overcurrent_charge,
"eoas_bms_general_alarm_overcurrent_charge"},
323 {eoas_bms_general_alarm_lowSOC,
"eoas_bms_general_alarm_lowSOC"},
324 {eoas_bms_general_alarm_lowtemperature,
"eoas_bms_general_alarm_lowtemperature"},
325 {eoas_bms_general_alarm_hightemperature,
"eoas_bms_general_alarm_hightemperature"},
326 {eoas_bat_status_hsm_mosfet_broken,
"eoas_bat_status_hsm_mosfet_broken"},
327 {eoas_bat_status_hsm_mosfet_normal,
"eoas_bat_status_hsm_mosfet_normal"},
328 {eoas_bat_status_hsm_overcurrent_overvoltage,
"eoas_bat_status_hsm_overcurrent_overvoltage"},
329 {eoas_bat_status_hsm_normal,
"eoas_bat_status_hsm_normal"},
330 {eoas_bat_status_hsm_voltage_power_good,
"eoas_bat_status_hsm_voltage_power_good"},
331 {eoas_bat_status_hsm_voltage_not_guaranteed,
"eoas_bat_status_hsm_voltage_not_guaranteed"},
332 {eoas_bat_status_hsm_status_on,
"eoas_bat_status_hsm_status_on"},
333 {eoas_bat_status_hsm_status_off,
"eoas_bat_status_hsm_status_off"},
334 {eoas_bat_status_motor_regulator_overcurrent,
"eoas_bat_status_motor_regulator_overcurrent"},
335 {eoas_bat_status_motor_regulator_normal,
"eoas_bat_status_motor_regulator_normal"},
336 {eoas_bat_status_motor_on,
"eoas_bat_status_motor_on"},
337 {eoas_bat_status_motor_off,
"eoas_bat_status_motor_off"},
338 {eoas_bat_status_board_regulator_overcurrent,
"eoas_bat_status_board_regulator_overcurrent"},
339 {eoas_bat_status_board_regulator_normal,
"eoas_bat_status_board_regulator_normal"},
340 {eoas_bat_status_board_on,
"eoas_bat_status_board_on"},
341 {eoas_bat_status_board_off,
"eoas_bat_status_board_off"},
342 {eoas_bat_status_btn_2_start_up_phase,
"eoas_bat_status_btn_2_start_up_phase"},
343 {eoas_bat_status_btn_2_stable_op,
"eoas_bat_status_btn_2_stable_op"},
344 {eoas_bat_status_btn_1_start_up_phase,
"eoas_bat_status_btn_1_start_up_phase"},
345 {eoas_bat_status_btn_1_stable_op,
"eoas_bat_status_btn_1_stable_op"}}
349 std::string statusstring = {};
350 statusstring.reserve(512);
354 for (uint8_t i = 0; i < eoas_bms_alarm_numberof; i++)
356 if((embot::core::binary::bit::check(currStatus, i)))
358 statusstring.append(
"\t");
359 statusstring.append(s_boards_map_of_battery_alarm_status.at(i).second);
360 statusstring.append(
"\n");
367 for (uint8_t i = eoas_bms_alarm_numberof; i < eoas_battery_alarm_status_numberof; i = i+2)
369 if ((embot::core::binary::bit::check(currStatus, bit_pos) != embot::core::binary::bit::check(prevStatus, bit_pos)) || isFirstLoop)
371 statusstring.append(
"\t");
372 if((embot::core::binary::bit::check(currStatus, bit_pos)))
374 statusstring.append(s_boards_map_of_battery_alarm_status.at(i).second);
378 statusstring.append(s_boards_map_of_battery_alarm_status.at(i+1).second);
380 statusstring.append(
"\n");
387 if(statusstring.empty())
389 statusstring.append(
"\tNo Faults Detected. All Alarms Bit Down\n");