c-jimenez/open-ocpp

How to trigger a RemoteStartTransaction at csms app side?

shengxiang200788 opened this issue · 1 comments

     How to trigger a RemoteStartTransaction  

Hi,
When implementing the event handler interface (ICentralSystemEventsHandler) at CSMS side, you will have to implement the following method:

/**
 * @brief Called when a charge point is connected
 * @param chargepoint Charge point connection
 */
virtual void chargePointConnected(std::shared_ptr<ICentralSystem::IChargePoint> chargepoint) = 0;

So you will obtain an instance of a ICentralSystem::IChargePoint object for each connected charging station.
This object will allow you to send to a particular charging station all the CSMS side requests.
You can find the interface definition in the following file : ICentralSystem.h.

The method for the RemoteStartTransactionRequest is :

/**
 * @brief Send a remote start transaction request
 * @param connector_id Connector on which to start the transaction
 * @param id_tag Identifier that charge point must use to start a transaction
 * @param profile Profile to be used for the requested transaction
 * @return true if the request has been accepted, false otherwise
 */
virtual bool remoteStartTransaction(const ocpp::types::Optional<unsigned int>&                          connector_id,
							  const std::string&                                                                     id_tag,
							  const ocpp::types::Optional<ocpp::types::ChargingProfile>& profile) = 0;

An example of the use of this object to send requests to the charging station can be found in the quick start central system example (https://github.com/c-jimenez/open-ocpp/blob/develop/examples/quick_start_centralsystem/main.cpp).