Open digzaw opened 3 months ago
According to the documentation, we can send request command to the charger station using the simplified API: https://github.com/lorenzodonini/ocpp-go?tab=readme-ov-file#sending-requests
how to run the command outside the SetNewChargePointHandler , because when trying to send command like the example
`func TestSendCommand(t testing.T) { cb := func(request core.ResetConfirmation, e error) { if e != nil { log.Printf("operation failed: %v", e) log.Printf("status: %v", request.GetFeatureName()) } else { log.Printf("status: %v", request.GetFeatureName()) // ... your own custom logic } }
err := utils.CentralSystem.Reset("2", cb, core.ResetTypeSoft) if err != nil { log.Println("error") println(err.Error()) } fmt.Println("ok")
}`
get the panic error: `--- FAIL: TestSendCommand (0.00s) panic: runtime error: invalid memory address or nil pointer dereference [recovered] panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x88 pc=0x665568]
goroutine 19 [running]: testing.tRunner.func1.2({0x69eae0, 0x9180b0}) /usr/local/go/src/testing/testing.go:1545 +0x238 testing.tRunner.func1() /usr/local/go/src/testing/testing.go:1548 +0x397 panic({0x69eae0?, 0x9180b0?})`
Thanks Before
According to the documentation, we can send request command to the charger station using the simplified API: https://github.com/lorenzodonini/ocpp-go?tab=readme-ov-file#sending-requests
how to run the command outside the SetNewChargePointHandler , because when trying to send command like the example
`func TestSendCommand(t testing.T) { cb := func(request core.ResetConfirmation, e error) { if e != nil { log.Printf("operation failed: %v", e) log.Printf("status: %v", request.GetFeatureName()) } else { log.Printf("status: %v", request.GetFeatureName()) // ... your own custom logic } }
}`
get the panic error: `--- FAIL: TestSendCommand (0.00s) panic: runtime error: invalid memory address or nil pointer dereference [recovered] panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x88 pc=0x665568]
goroutine 19 [running]: testing.tRunner.func1.2({0x69eae0, 0x9180b0}) /usr/local/go/src/testing/testing.go:1545 +0x238 testing.tRunner.func1() /usr/local/go/src/testing/testing.go:1548 +0x397 panic({0x69eae0?, 0x9180b0?})`
Thanks Before