Ocpp: initial StatusNotification trigger request (#15734)
This commit is contained in:
parent
bc61905176
commit
e6d3ad3f9f
2 changed files with 10 additions and 0 deletions
|
|
@ -273,6 +273,10 @@ func NewOCPP(id string, connector int, idtag string,
|
|||
|
||||
// see who's there
|
||||
if c.hasRemoteTriggerFeature {
|
||||
if err := conn.TriggerMessageRequest(core.StatusNotificationFeatureName); err != nil {
|
||||
c.log.DEBUG.Printf("failed triggering StatusNotification: %v", err)
|
||||
}
|
||||
|
||||
if err := ocpp.Instance().TriggerMessageRequest(cp.ID(), core.BootNotificationFeatureName); err == nil {
|
||||
select {
|
||||
case <-time.After(timeout):
|
||||
|
|
@ -282,6 +286,8 @@ func NewOCPP(id string, connector int, idtag string,
|
|||
c.bootNotification = res
|
||||
}
|
||||
}
|
||||
} else {
|
||||
c.log.DEBUG.Printf("failed triggering BootNotification: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -100,12 +100,16 @@ func (conn *Connector) WatchDog(timeout time.Duration) {
|
|||
|
||||
// Initialized waits for initial charge point status notification
|
||||
func (conn *Connector) Initialized() error {
|
||||
trigger := time.After(conn.timeout / 2)
|
||||
timeout := time.After(conn.timeout)
|
||||
for {
|
||||
select {
|
||||
case <-conn.statusC:
|
||||
return nil
|
||||
|
||||
case <-trigger: // try to trigger StatusNotification again as last resort
|
||||
conn.TriggerMessageRequest(core.StatusNotificationFeatureName)
|
||||
|
||||
case <-timeout:
|
||||
return api.ErrTimeout
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue