From ad4f3dcedab29a690c5eedbb08ba1b393917db0b Mon Sep 17 00:00:00 2001 From: lichao <lichao@aiotlink.com> Date: 星期三, 21 四月 2021 17:39:34 +0800 Subject: [PATCH] update go api. --- api/bhsgo/bhome_node_test.go | 15 +++++++++++++++ 1 files changed, 15 insertions(+), 0 deletions(-) diff --git a/api/bhsgo/bhome_node_test.go b/api/bhsgo/bhome_node_test.go index d4f4278..3629d89 100644 --- a/api/bhsgo/bhome_node_test.go +++ b/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 } -- Gitblit v1.8.0