From e3d8ac1ce502e5a5f9dc762da301b0060b641811 Mon Sep 17 00:00:00 2001
From: chenshijun <csj_sky@126.com>
Date: 星期一, 07 十二月 2020 15:56:42 +0800
Subject: [PATCH] 修改适配新的版本接口

---
 libcbhomebus.c |   64 ++++++++++++++++++++++----------
 1 files changed, 44 insertions(+), 20 deletions(-)

diff --git a/libcbhomebus.c b/libcbhomebus.c
index 9046a11..da3750b 100644
--- a/libcbhomebus.c
+++ b/libcbhomebus.c
@@ -197,14 +197,14 @@
     return fn_socket_sendandrecv_nowait(_socket, (net_node_t*)node_arr, arrlen, send_buf, send_size, (net_mod_recv_msg_t**)recv_arr, recv_arr_size);
 }
 
-int  wrap_fn_socket_start_bus(hbhomebus lib, void * _socket)
-{
-    if(!fn_socket_start_bus){
-        fn_socket_start_bus = (tfn_net_mod_socket_start_bus)dlsym(lib,l_net_mod_socket_start_bus);
-        check_with_ret(fn_socket_start_bus, lib, -1);
-    }
-    return fn_socket_start_bus(_socket);
-}
+//int  wrap_fn_socket_start_bus(hbhomebus lib, void * _socket)
+//{
+//    if(!fn_socket_start_bus){
+//        fn_socket_start_bus = (tfn_net_mod_socket_start_bus)dlsym(lib,l_net_mod_socket_start_bus);
+//        check_with_ret(fn_socket_start_bus, lib, -1);
+//    }
+//    return fn_socket_start_bus(_socket);
+//}
 
 int wrap_fn_socket_pub(hbhomebus lib, void *_socket, void *node_arr, int node_arr_len, char *topic, int topic_size, void *content, int content_size)
 {
@@ -233,58 +233,58 @@
     return fn_socket_pub_nowait(_socket, (net_node_t*)node_arr, node_arr_len, topic, topic_size, content, content_size);
 }
 
-int  wrap_fn_socket_sub(hbhomebus lib, void * _socket, void *topic, int size, int key)
+int  wrap_fn_socket_sub(hbhomebus lib, void * _socket, void *topic, int size)
 {
     if(!fn_socket_sub){
         fn_socket_sub = (tfn_net_mod_socket_sub)dlsym(lib,l_net_mod_socket_sub);
         check_with_ret(fn_socket_sub, lib, -1);
     }
-    return fn_socket_sub(_socket, topic, size, key);
+    return fn_socket_sub(_socket, topic, size);
 }
 
-int  wrap_fn_socket_sub_timeout(hbhomebus lib, void * _socket, void *topic, int size, int key, int sec, int nsec)
+int  wrap_fn_socket_sub_timeout(hbhomebus lib, void * _socket, void *topic, int size, int sec, int nsec)
 {
     if(!fn_socket_sub_timeout){
         fn_socket_sub_timeout = (tfn_net_mod_socket_sub_timeout)dlsym(lib,l_net_mod_socket_sub_timeout);
         check_with_ret(fn_socket_sub_timeout, lib, -1);
     }
-    return fn_socket_sub_timeout(_socket, topic, size, key, sec, nsec);
+    return fn_socket_sub_timeout(_socket, topic, size, sec, nsec);
 }
 
-int  wrap_fn_socket_sub_nowait(hbhomebus lib, void * _socket, void *topic, int size, int key)
+int  wrap_fn_socket_sub_nowait(hbhomebus lib, void * _socket, void *topic, int size)
 {
     if(!fn_socket_sub_nowait){
         fn_socket_sub_nowait = (tfn_net_mod_socket_sub_nowait)dlsym(lib,l_net_mod_socket_sub_nowait);
         check_with_ret(fn_socket_sub_nowait, lib, -1);
     }
-    return fn_socket_sub_nowait(_socket, topic, size, key);
+    return fn_socket_sub_nowait(_socket, topic, size);
 }
 
-int  wrap_fn_socket_desub(hbhomebus lib, void * _socket, void *topic, int size, int key)
+int  wrap_fn_socket_desub(hbhomebus lib, void * _socket, void *topic, int size)
 {
     if(!fn_socket_desub){
         fn_socket_desub = (tfn_net_mod_socket_desub)dlsym(lib,l_net_mod_socket_desub);
         check_with_ret(fn_socket_desub, lib, -1);
     }
-    return fn_socket_desub(_socket, topic, size, key);
+    return fn_socket_desub(_socket, topic, size);
 }
 
-int  wrap_fn_socket_desub_timeout(hbhomebus lib, void * _socket, void *topic, int size, int key, int sec, int nsec)
+int  wrap_fn_socket_desub_timeout(hbhomebus lib, void * _socket, void *topic, int size, int sec, int nsec)
 {
     if(!fn_socket_desub_timeout){
         fn_socket_desub_timeout = (tfn_net_mod_socket_desub_timeout)dlsym(lib,l_net_mod_socket_desub_timeout);
         check_with_ret(fn_socket_desub_timeout, lib, -1);
     }
-    return fn_socket_desub_timeout(_socket, topic, size, key, sec, nsec);
+    return fn_socket_desub_timeout(_socket, topic, size, sec, nsec);
 }
 
-int  wrap_fn_socket_desub_nowait(hbhomebus lib, void * _socket, void *topic, int size, int key)
+int  wrap_fn_socket_desub_nowait(hbhomebus lib, void * _socket, void *topic, int size)
 {
     if(!fn_socket_desub_nowait){
         fn_socket_desub_nowait = (tfn_net_mod_socket_sub_nowait)dlsym(lib,l_net_mod_socket_sub_nowait);
         check_with_ret(fn_socket_desub_nowait, lib, -1);
     }
-    return fn_socket_desub_nowait(_socket, topic, size, key);
+    return fn_socket_desub_nowait(_socket, topic, size);
 }
 
 int wrap_fn_socket_get_key(hbhomebus lib, void * _socket)
@@ -353,3 +353,27 @@
     }
     return fn_server_socket_start(_socket);
 }
+
+void *wrap_fn_bus_server_socket_open(hbhomebus lib){
+    if (!fn_bus_server_socket_open){
+        fn_bus_server_socket_open = (tfn_bus_server_socket_wrapper_open)dlsym(lib, l_bus_server_socket_wrapper_open);
+        check_with_ret(fn_bus_server_socket_open, lib, NULL);
+    }
+    return fn_bus_server_socket_open();
+}
+
+void wrap_fn_bus_server_socket_close(hbhomebus lib, void* _socket){
+    if (!fn_bus_server_socket_close){
+        fn_bus_server_socket_close = (tfn_bus_server_socket_wrapper_close)dlsym(lib, l_bus_server_socket_wrapper_close);
+        check_only(fn_bus_server_socket_close, lib);
+    }
+    fn_bus_server_socket_close(_socket);
+}
+
+int wrap_fn_bus_server_socket_start(hbhomebus lib, void* _socket){
+    if (!fn_bus_server_socket_start){
+        fn_bus_server_socket_start = (tfn_bus_server_socket_wrapper_start_bus)dlsym(lib, l_bus_server_socket_wrapper_start_bus);
+        check_with_ret(fn_bus_server_socket_start, lib, -1);
+    }
+    return fn_bus_server_socket_start(_socket);
+}

--
Gitblit v1.8.0