All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
30 lines
470 B
Go
30 lines
470 B
Go
package iot
|
|
|
|
import "log"
|
|
import "fmt"
|
|
import "udi/handlers/handler"
|
|
|
|
var idSeq int = 0
|
|
|
|
type IoTHandler struct {
|
|
id int
|
|
}
|
|
|
|
func NewIoTHandler() handler.Handler {
|
|
t := &IoTHandler {
|
|
id: idSeq,
|
|
}
|
|
idSeq += 1
|
|
return t
|
|
}
|
|
|
|
func (self *IoTHandler) GetId() string {
|
|
return fmt.Sprintf("IoT%d", self.id)
|
|
}
|
|
|
|
func (self *IoTHandler) Handle(message handler.MessageT) {
|
|
log.Printf("Handler IoT %d processing %s -> %s", self.id, message.Topic, message.Payload)
|
|
}
|
|
|
|
|