Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
andig committed Sep 6, 2024
1 parent 6c5d9cc commit 85d939d
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 12 deletions.
2 changes: 1 addition & 1 deletion charger/ocpp/connector.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ func (conn *Connector) remoteStartTransactionRequest() {
request.ConnectorId = &connector
})

if err := Wait(err, rc); err != nil {
if err := wait(err, rc); err != nil {
conn.log.ERROR.Printf("failed to start remote transaction: %v", err)
}
}
Expand Down
4 changes: 2 additions & 2 deletions charger/ocpp/cp_setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ func (cp *CP) GetConfiguration() (*core.GetConfigurationConfirmation, error) {
rc <- err
}, nil)

return res, Wait(err, rc)
return res, wait(err, rc)
}

// HasMeasurement checks if meterValuesSample contains given measurement
Expand Down Expand Up @@ -187,5 +187,5 @@ func (cp *CP) configure(key, val string) error {
rc <- err
}, key, val)

return Wait(err, rc)
return wait(err, rc)
}
12 changes: 5 additions & 7 deletions charger/ocpp/cs_core.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func (cs *CS) TriggerResetRequest(id string, resetType core.ResetType) error {
rc <- err
}, resetType)

return Wait(err, rc)
return wait(err, rc)
}

func (cs *CS) TriggerMessageRequest(id string, requestedMessage remotetrigger.MessageTrigger, props ...func(request *remotetrigger.TriggerMessageRequest)) error {
Expand All @@ -37,7 +37,7 @@ func (cs *CS) TriggerMessageRequest(id string, requestedMessage remotetrigger.Me
rc <- err
}, requestedMessage, props...)

return Wait(err, rc)
return wait(err, rc)
}

func (cs *CS) ChangeAvailabilityRequest(id string, connector int, availabilityType core.AvailabilityType) error {
Expand All @@ -51,7 +51,7 @@ func (cs *CS) ChangeAvailabilityRequest(id string, connector int, availabilityTy
rc <- err
}, connector, availabilityType)

return Wait(err, rc)
return wait(err, rc)
}

func (cs *CS) SetChargingProfileRequest(id string, connector int, profile *types.ChargingProfile) error {
Expand All @@ -65,7 +65,7 @@ func (cs *CS) SetChargingProfileRequest(id string, connector int, profile *types
rc <- err
}, connector, profile)

return Wait(err, rc)
return wait(err, rc)
}

func (cs *CS) GetCompositeScheduleRequest(id string, connector int, duration int) (*types.ChargingSchedule, error) {
Expand All @@ -82,9 +82,7 @@ func (cs *CS) GetCompositeScheduleRequest(id string, connector int, duration int
rc <- err
}, connector, duration)

err = Wait(err, rc)

return schedule, err
return schedule, wait(err, rc)
}

// cp actions
Expand Down
4 changes: 2 additions & 2 deletions charger/ocpp/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import (
"github.com/lorenzodonini/ocpp-go/ocpp1.6/types"
)

// Wait waits for a CP roundtrip with timeout
func Wait(err error, rc chan error) error {
// wait waits for a CP roundtrip with timeout
func wait(err error, rc chan error) error {
if err == nil {
select {
case err = <-rc:
Expand Down

0 comments on commit 85d939d

Please sign in to comment.