|
@@ -1,26 +1,29 @@
|
|
|
package main
|
|
|
|
|
|
-import "sparrow/pkg/protocol"
|
|
|
+import (
|
|
|
+ "fmt"
|
|
|
+ "sparrow/pkg/protocol"
|
|
|
+)
|
|
|
|
|
|
type Agent struct {
|
|
|
}
|
|
|
|
|
|
// Message 收到设备上报消息处理
|
|
|
func (a *Agent) Message(topic string, payload []byte) error {
|
|
|
- //TODO implement me
|
|
|
- panic("implement me")
|
|
|
+ fmt.Printf("%s, %s\r\n", topic, payload)
|
|
|
+ return nil
|
|
|
}
|
|
|
|
|
|
// Connected 设备接入时
|
|
|
func (a *Agent) Connected(status *protocol.DevConnectStatus) error {
|
|
|
- //TODO implement me
|
|
|
- panic("implement me")
|
|
|
+ fmt.Printf("%v\r\n", status)
|
|
|
+ return nil
|
|
|
}
|
|
|
|
|
|
// Disconnected 设备断开连接时
|
|
|
func (a *Agent) Disconnected(status *protocol.DevConnectStatus) error {
|
|
|
- //TODO implement me
|
|
|
- panic("implement me")
|
|
|
+ fmt.Printf("%v\r\n", status)
|
|
|
+ return nil
|
|
|
}
|
|
|
|
|
|
func NewAgent() *Agent {
|