lorenzodonini / ocpp-go

Open Charge Point Protocol implementation in Go
MIT License
262 stars 125 forks source link

How do I specify ConnectId in RemoteStartTransaction? #137

Closed MingShyanWei closed 2 years ago

MingShyanWei commented 2 years ago

Thank you for the source code. In our case, the charge point has four connectors. In OPCC 1.6J specification 「6.33. RemoteStartTransaction.req」 connectorId: Optional. Number of the connector on which to start the transaction. connectorId SHALL be > 0 And how to use in ocpp-go

utsavanand2 commented 2 years ago

Hi @MingShyanWei Have you tried out the examples in the repository yet? The RemoteStartTransactionRequest has a ConnectorId filed that you can specify when sending a RemoteStartTransactionRequest

https://github.com/lorenzodonini/ocpp-go/blob/632d3cb3eeb9c63687a307002878cafeadea9470/ocpp1.6/core/remote_start_transaction.go#L13

lorenzodonini commented 2 years ago

The ConnectorId is an optional field. Optional fields are not in the default signature of the API but may be passed optionally with the following syntax:

centralSystem.RemoteStartTransaction(clientId, myCallback, idTag, func(request *core.RemoteStartTransactionRequest) {
    request.ConnectorId = yourPtrValue
        // you can set any optional value you want in here
})
MingShyanWei commented 2 years ago

@utsavanand2 @lorenzodonini ok!! thanks a lot