etri-smartfarm-poc-controll.../main.go

28 lines
463 B
Go

package manager
import (
"context"
"fmt"
"time"
"git.godopu.net/lab/etri-smartfarm-poc-controller-serial/puserial"
"github.com/rjeczalik/notify"
)
func Run() {
fmt.Println("Hello world")
ctx, _ := context.WithTimeout(context.Background(), time.Second*10)
ch_discover := make(chan notify.EventInfo)
go puserial.WatchNewDevice(ctx, ch_discover)
for {
e, ok := <-ch_discover
if !ok {
fmt.Println("byebye~!")
return
}
fmt.Println(e)
}
}