lichao
2021-04-21 ad4f3dcedab29a690c5eedbb08ba1b393917db0b
api/bhsgo/bhome_node_test.go
@@ -5,8 +5,22 @@
   "fmt"
   "testing"
   "time"
   "unsafe"
)
func ServerCallback(src unsafe.Pointer, proc_id *string, req *bh.MsgRequestTopic) {
   fmt.Println("user server cb called, request topic: " + string(req.Topic) + ", data:" + string(req.Data))
   reply := bh.MsgRequestTopicReply{}
   reply.Data = []byte("reply 1234")
   SendReply(src, &reply)
}
func SubDataCallback(proc_id *string, pub *bh.MsgPublish) {
   fmt.Println("user sub data cb called")
}
func ClientCallback(proc_id *string, msg_id *[]byte, reply *bh.MsgRequestTopicReply) {
   fmt.Println("user client cb reply: " + string(reply.Data))
}
func TestRegister(t *testing.T) {
   proc_id := "test_proc"
   proc := bh.ProcInfo{}
@@ -20,6 +34,7 @@
      fmt.Println("register ok")
   } else {
      fmt.Println("register failed")
      t.Log("register error")
      return
   }