chenshijun
2020-12-07 e3d8ac1ce502e5a5f9dc762da301b0060b641811
bhomebus.go
@@ -360,14 +360,14 @@
   return int(ret)
}
// StartBus socket
func (s *Socket) StartBus() int {
   if libbhomebus == nil || s.socket == nil {
      return -1
   }
   return int(C.wrap_fn_socket_start_bus(libbhomebus, s.socket))
}
//// StartBus socket
//func (s *Socket) StartBus() int {
//   if libbhomebus == nil || s.socket == nil {
//      return -1
//   }
//
//   return int(C.wrap_fn_socket_start_bus(libbhomebus, s.socket))
//}
// Pub socket
func (s *Socket) Pub(nodes []NetNode, topic string, data []byte) int {
@@ -455,7 +455,7 @@
}
// Sub socket
func (s *Socket) Sub(topic string, key int) int {
func (s *Socket) Sub(topic string) int {
   if libbhomebus == nil || s.socket == nil {
      return -1
   }
@@ -463,46 +463,46 @@
   ctopic := C.CString(topic)
   defer C.free(unsafe.Pointer(ctopic))
   return int(C.wrap_fn_socket_sub(libbhomebus, s.socket, unsafe.Pointer(ctopic), C.int(len(topic)), C.int(key)))
   return int(C.wrap_fn_socket_sub(libbhomebus, s.socket, unsafe.Pointer(ctopic), C.int(len(topic))))
}
// SubTimeout socket
func (s *Socket) SubTimeout(topic string, key int, milliseconds int) int {
func (s *Socket) SubTimeout(topic string, milliseconds int) int {
   if libbhomebus == nil || s.socket == nil {
      return -1
   }
   ctopic := C.CString(topic)
   defer C.free(unsafe.Pointer(ctopic))
   return int(C.wrap_fn_socket_sub_timeout(libbhomebus, s.socket, unsafe.Pointer(ctopic), C.int(len(topic)), C.int(key), 0, C.int(milliseconds*1000000)))
   return int(C.wrap_fn_socket_sub_timeout(libbhomebus, s.socket, unsafe.Pointer(ctopic), C.int(len(topic)), 0, C.int(milliseconds*1000000)))
}
// SubNowait socket
func (s *Socket) SubNowait(topic string, key int) int {
func (s *Socket) SubNowait(topic string) int {
   if libbhomebus == nil || s.socket == nil {
      return -1
   }
   ctopic := C.CString(topic)
   defer C.free(unsafe.Pointer(ctopic))
   return int(C.wrap_fn_socket_sub_nowait(libbhomebus, s.socket, unsafe.Pointer(ctopic), C.int(len(topic)), C.int(key)))
   return int(C.wrap_fn_socket_sub_nowait(libbhomebus, s.socket, unsafe.Pointer(ctopic), C.int(len(topic))))
}
// Desub socket
func (s *Socket) Desub(topic string, key int) int {
func (s *Socket) Desub(topic string) int {
   if libbhomebus == nil || s.socket == nil {
      return -1
   }
   ctopic := C.CString(topic)
   defer C.free(unsafe.Pointer(ctopic))
   return int(C.wrap_fn_socket_desub(libbhomebus, s.socket, unsafe.Pointer(&ctopic), C.int(len(topic)), C.int(key)))
   return int(C.wrap_fn_socket_desub(libbhomebus, s.socket, unsafe.Pointer(&ctopic), C.int(len(topic))))
}
// DesubTimeout socket
func (s *Socket) DesubTimeout(topic string, key int, milliseconds int) int {
func (s *Socket) DesubTimeout(topic string, milliseconds int) int {
   if libbhomebus == nil || s.socket == nil {
      return -1
   }
@@ -510,18 +510,18 @@
   ctopic := C.CString(topic)
   defer C.free(unsafe.Pointer(ctopic))
   return int(C.wrap_fn_socket_desub_timeout(libbhomebus, s.socket, unsafe.Pointer(&ctopic), C.int(len(topic)), C.int(key), 0, C.int(milliseconds*1000000)))
   return int(C.wrap_fn_socket_desub_timeout(libbhomebus, s.socket, unsafe.Pointer(&ctopic), C.int(len(topic)), 0, C.int(milliseconds*1000000)))
}
// DesubNowait socket
func (s *Socket) DesubNowait(topic string, key int) int {
func (s *Socket) DesubNowait(topic string) int {
   if libbhomebus == nil || s.socket == nil {
      return -1
   }
   ctopic := C.CString(topic)
   defer C.free(unsafe.Pointer(ctopic))
   return int(C.wrap_fn_socket_desub_nowait(libbhomebus, s.socket, unsafe.Pointer(&ctopic), C.int(len(topic)), C.int(key)))
   return int(C.wrap_fn_socket_desub_nowait(libbhomebus, s.socket, unsafe.Pointer(&ctopic), C.int(len(topic))))
}
// Getkey socket
@@ -610,3 +610,31 @@
   return int(C.wrap_fn_server_socket_start(libbhomebus, s.socket))
}
// ServerOpen bus server
func BusServerOpen() *Socket {
   if libbhomebus == nil {
      return nil
   }
   sock := C.wrap_fn_bus_server_socket_open(libbhomebus)
   return &Socket{sock}
}
// Close close
func (s *Socket) BusClose() {
   if libbhomebus == nil {
      return
   }
   C.wrap_fn_bus_server_socket_close(libbhomebus, s.socket)
}
// Start start
func (s *Socket) BusStart() int {
   if libbhomebus == nil {
      return -1
   }
   return int(C.wrap_fn_bus_server_socket_start(libbhomebus, s.socket))
}