27 lines
464 B
Go
27 lines
464 B
Go
package robot
|
|
|
|
import (
|
|
"fmt"
|
|
"go_dreamfactory/comm"
|
|
"go_dreamfactory/pb"
|
|
)
|
|
|
|
//统一通知处理
|
|
func (r *Robot) handleNotifyMsg(msg *pb.UserMessage) {
|
|
switch msg.SubType {
|
|
case comm.SubType_ErrorNotify:
|
|
r.handleError(msg)
|
|
default:
|
|
fmt.Printf("subType: %s not define", msg.SubType)
|
|
}
|
|
}
|
|
|
|
//处理错误
|
|
func (r *Robot) handleError(msg *pb.UserMessage) {
|
|
rsp := &pb.ErrorNotify{}
|
|
if !comm.ProtoUnmarshal(msg, rsp) {
|
|
return
|
|
}
|
|
printReply(msg, rsp)
|
|
}
|