You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
618 B
Go
28 lines
618 B
Go
package reactor
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
|
|
//"FRMS/internal/pkg/logging"
|
|
//"google.golang.org/grpc"
|
|
pb "FRMS/internal/pkg/grpc"
|
|
)
|
|
|
|
// implements grpc handler and device data aggregater handler
|
|
// grpc status update handler
|
|
func (c *ReactorCoordinator) Ping() {
|
|
// sends all device status to central coordinator
|
|
fmt.Printf("Pinging coordinator\n")
|
|
// get devices
|
|
devices, err := c.GetDevices()
|
|
if err != nil {
|
|
c.Err <- err
|
|
}
|
|
|
|
req := &pb.ReactorStatusPing{Id: int32(c.ID), Devices: devices}
|
|
if _, err := c.MonitoringClient.ReactorStatusHandler(context.Background(), req); err != nil {
|
|
c.Err <- err
|
|
}
|
|
}
|