Skip to content

Commit b907068

Browse files
authored
Merge pull request #249 from thomas-brunel/feat/chargepoint_protected
[ChargePoint] Add protected getters
2 parents 45c211b + 38e08eb commit b907068

File tree

2 files changed

+260
-0
lines changed

2 files changed

+260
-0
lines changed

src/chargepoint/ChargePoint.cpp

Lines changed: 155 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1224,5 +1224,160 @@ bool ChargePoint::doConnect()
12241224
m_ocpp_config.webSocketPingInterval());
12251225
}
12261226

1227+
/**
1228+
* @brief Get the configuration manager of the charge point
1229+
* @return The configuration manager of the charge point
1230+
* @throw std::runtime_error if stack is not started
1231+
*/
1232+
ConfigManager& ChargePoint::getConfigManager(void) const
1233+
{
1234+
if (!m_config_manager) {
1235+
throw std::runtime_error("Stack is not started!");
1236+
}
1237+
return *m_config_manager.get();
1238+
}
1239+
1240+
/**
1241+
* @brief Get the status manager of the charge point
1242+
* @return The status manager of the charge point
1243+
* @throw std::runtime_error if stack is not started
1244+
*/
1245+
StatusManager& ChargePoint::getStatusManager(void) const
1246+
{
1247+
if (!m_status_manager) {
1248+
throw std::runtime_error("Stack is not started!");
1249+
}
1250+
return *m_status_manager.get();
1251+
}
1252+
1253+
/**
1254+
* @brief Get the authentication manager of the charge point
1255+
* @return The authentication manager of the charge point
1256+
* @throw std::runtime_error if stack is not started
1257+
*/
1258+
AuthentManager& ChargePoint::getAuthentManager(void) const
1259+
{
1260+
if (!m_authent_manager) {
1261+
throw std::runtime_error("Stack is not started!");
1262+
}
1263+
return *m_authent_manager.get();
1264+
}
1265+
1266+
/**
1267+
* @brief Get the transaction manager of the charge point
1268+
* @return The transaction manager of the charge point
1269+
* @throw std::runtime_error if stack is not started
1270+
*/
1271+
TransactionManager& ChargePoint::getTransactionManager(void) const
1272+
{
1273+
if (!m_transaction_manager) {
1274+
throw std::runtime_error("Stack is not started!");
1275+
}
1276+
return *m_transaction_manager.get();
1277+
}
1278+
1279+
/**
1280+
* @brief Get the trigger manager of the charge point
1281+
* @return The trigger manager of the charge point
1282+
* @throw std::runtime_error if stack is not started
1283+
*/
1284+
TriggerMessageManager& ChargePoint::getTriggerManager(void) const
1285+
{
1286+
if (!m_trigger_manager) {
1287+
throw std::runtime_error("Stack is not started!");
1288+
}
1289+
return *m_trigger_manager.get();
1290+
}
1291+
1292+
/**
1293+
* @brief Get the reservation manager of the charge point
1294+
* @return The reservation manager of the charge point
1295+
* @throw std::runtime_error if stack is not started
1296+
*/
1297+
ReservationManager& ChargePoint::getReservationManager(void) const
1298+
{
1299+
if (!m_reservation_manager) {
1300+
throw std::runtime_error("Stack is not started!");
1301+
}
1302+
return *m_reservation_manager.get();
1303+
}
1304+
1305+
/**
1306+
* @brief Get the data transfer manager of the charge point
1307+
* @return The data transfer manager of the charge point
1308+
* @throw std::runtime_error if stack is not started
1309+
*/
1310+
DataTransferManager& ChargePoint::getDataTransferManager(void) const
1311+
{
1312+
if (!m_data_transfer_manager) {
1313+
throw std::runtime_error("Stack is not started!");
1314+
}
1315+
return *m_data_transfer_manager.get();
1316+
}
1317+
1318+
/**
1319+
* @brief Get the meter values manager of the charge point
1320+
* @return The meter values manager of the charge point
1321+
* @throw std::runtime_error if stack is not started
1322+
*/
1323+
MeterValuesManager& ChargePoint::getMeterValuesManager(void) const
1324+
{
1325+
if (!m_meter_values_manager) {
1326+
throw std::runtime_error("Stack is not started!");
1327+
}
1328+
return *m_meter_values_manager.get();
1329+
}
1330+
1331+
/**
1332+
* @brief Get the smart charging manager of the charge point
1333+
* @return The smart charging manager of the charge point
1334+
* @throw std::runtime_error if stack is not started
1335+
*/
1336+
SmartChargingManager& ChargePoint::getSmartChargingManager(void) const
1337+
{
1338+
if (!m_smart_charging_manager) {
1339+
throw std::runtime_error("Stack is not started!");
1340+
}
1341+
return *m_smart_charging_manager.get();
1342+
}
1343+
1344+
/**
1345+
* @brief Get the maintenance manager of the charge point
1346+
* @return The maintenance manager of the charge point
1347+
* @throw std::runtime_error if stack is not started
1348+
*/
1349+
MaintenanceManager& ChargePoint::getMaintenanceManager(void) const
1350+
{
1351+
if (!m_maintenance_manager) {
1352+
throw std::runtime_error("Stack is not started!");
1353+
}
1354+
return *m_maintenance_manager.get();
1355+
}
1356+
1357+
/**
1358+
* @brief Get the requests fifo manager of the charge point
1359+
* @return The requests fifo manager of the charge point
1360+
* @throw std::runtime_error if stack is not started
1361+
*/
1362+
RequestFifoManager& ChargePoint::getRequestsFifoManager(void) const
1363+
{
1364+
if (!m_requests_fifo_manager) {
1365+
throw std::runtime_error("Stack is not started!");
1366+
}
1367+
return *m_requests_fifo_manager.get();
1368+
}
1369+
1370+
/**
1371+
* @brief Get the iso15118 manager of the charge point
1372+
* @return The iso15118 manager of the charge point
1373+
* @throw std::runtime_error if stack is not started
1374+
*/
1375+
Iso15118Manager& ChargePoint::getIso15118Manager(void) const
1376+
{
1377+
if (!m_iso15118_manager) {
1378+
throw std::runtime_error("Stack is not started!");
1379+
}
1380+
return *m_iso15118_manager.get();
1381+
}
12271382
} // namespace chargepoint
12281383
} // namespace ocpp

src/chargepoint/ChargePoint.h

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,111 @@ class ChargePoint : public IChargePoint,
331331
void scheduleReconnect();
332332
/** @brief Start the connection process to the Central System */
333333
bool doConnect();
334+
335+
protected:
336+
/**
337+
* @brief Get the standard ocpp config associated to the charge point
338+
* @return The standard ocpp config associated to the charge point
339+
*/
340+
ocpp::config::IOcppConfig& getOcppConfig(void) const { return m_ocpp_config; }
341+
342+
/**
343+
* @brief Get the events handler associated to the charge point
344+
* @return The events handler associated to the charge point
345+
*/
346+
IChargePointEventsHandler& getEventsHandler(void) const { return m_events_handler; }
347+
348+
349+
/**
350+
* @brief Get connectors of the charge point
351+
* @return Connectors of the charge point
352+
*/
353+
Connectors& getConnectors(void) { return m_connectors; }
354+
355+
356+
/**
357+
* @brief Get the configuration manager of the charge point
358+
* @return The configuration manager of the charge point
359+
* @throw std::runtime_error if stack is not started
360+
*/
361+
ConfigManager& getConfigManager(void) const;
362+
363+
/**
364+
* @brief Get the status manager of the charge point
365+
* @return The status manager of the charge point
366+
* @throw std::runtime_error if stack is not started
367+
*/
368+
StatusManager& getStatusManager(void) const;
369+
370+
/**
371+
* @brief Get the authentication manager of the charge point
372+
* @return The authentication manager of the charge point
373+
* @throw std::runtime_error if stack is not started
374+
*/
375+
AuthentManager& getAuthentManager(void) const;
376+
377+
/**
378+
* @brief Get the transaction manager of the charge point
379+
* @return The transaction manager of the charge point
380+
* @throw std::runtime_error if stack is not started
381+
*/
382+
TransactionManager& getTransactionManager(void) const;
383+
384+
/**
385+
* @brief Get the trigger manager of the charge point
386+
* @return The trigger manager of the charge point
387+
* @throw std::runtime_error if stack is not started
388+
*/
389+
TriggerMessageManager& getTriggerManager(void) const;
390+
391+
/**
392+
* @brief Get the reservation manager of the charge point
393+
* @return The reservation manager of the charge point
394+
* @throw std::runtime_error if stack is not started
395+
*/
396+
ReservationManager& getReservationManager(void) const;
397+
398+
/**
399+
* @brief Get the data transfer manager of the charge point
400+
* @return The data transfer manager of the charge point
401+
* @throw std::runtime_error if stack is not started
402+
*/
403+
DataTransferManager& getDataTransferManager(void) const;
404+
405+
/**
406+
* @brief Get the meter values manager of the charge point
407+
* @return The meter values manager of the charge point
408+
* @throw std::runtime_error if stack is not started
409+
*/
410+
MeterValuesManager& getMeterValuesManager(void) const;
411+
412+
/**
413+
* @brief Get the smart charging manager of the charge point
414+
* @return The smart charging manager of the charge point
415+
* @throw std::runtime_error if stack is not started
416+
*/
417+
SmartChargingManager& getSmartChargingManager(void) const;
418+
419+
/**
420+
* @brief Get the maintenance manager of the charge point
421+
* @return The maintenance manager of the charge point
422+
* @throw std::runtime_error if stack is not started
423+
*/
424+
MaintenanceManager& getMaintenanceManager(void) const;
425+
426+
/**
427+
* @brief Get the requests fifo manager of the charge point
428+
* @return The requests fifo manager of the charge point
429+
* @throw std::runtime_error if stack is not started
430+
*/
431+
RequestFifoManager& getRequestsFifoManager(void) const;
432+
433+
/**
434+
* @brief Get the iso15118 manager of the charge point
435+
* @return The iso15118 manager of the charge point
436+
* @throw std::runtime_error if stack is not started
437+
*/
438+
Iso15118Manager& getIso15118Manager(void) const;
334439
};
335440

336441
} // namespace chargepoint

0 commit comments

Comments
 (0)