From e28c3f398b04bfe7b58b5e5621615b249d48287b Mon Sep 17 00:00:00 2001 From: Jiwan Kim Date: Thu, 9 Feb 2017 17:01:29 +0900 Subject: [PATCH] Fix issues on zb_get_endpoint_list / zb_get_cluster_list - Related below patchset, API parameter order and size of structure was not matched. http://165.213.149.170/gerrit/#/c/151713/ Change-Id: I480ca7de8f66501261d35e3a4cefddc2bc17a119 Signed-off-by: Jiwan Kim --- include/zigbee.h | 2 +- lib/zbl-dbus.c | 8 ++++---- lib/zbl-dbus.h | 6 +++--- lib/zbl-zdo.c | 4 ++-- test/main.c | 12 ++++++------ 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/include/zigbee.h b/include/zigbee.h index 14753d4..39992ac 100644 --- a/include/zigbee.h +++ b/include/zigbee.h @@ -412,7 +412,7 @@ int zb_get_all_device_list(zigbee_h handle, int *count, zb_end_device_info_h **l * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter * @retval #ZIGBEE_ERROR_IO_ERROR Unexpected d-bus error */ -int zb_get_endpoint_list(zigbee_h handle, ieee_addr addr64, int *count, +int zb_get_endpoint_list(zigbee_h handle, ieee_addr addr64, unsigned char *count, unsigned char *ep_list); /** diff --git a/lib/zbl-dbus.c b/lib/zbl-dbus.c index c8e3b94..97677b3 100644 --- a/lib/zbl-dbus.c +++ b/lib/zbl-dbus.c @@ -3122,8 +3122,8 @@ int zbl_get_controller_mac_address(ieee_addr addr64) } int zbl_get_cluster_list(ieee_addr eui64, unsigned char endpoint, - unsigned char *in_cluster_count, unsigned char *out_cluster_count, - unsigned short in_cluster_list[], unsigned short out_cluster_list[]) + unsigned char *in_cluster_count, unsigned short in_cluster_list[], + unsigned char *out_cluster_count, unsigned short out_cluster_list[]) { GVariant *variant = NULL; GVariantBuilder *mac_builder = NULL; @@ -3131,7 +3131,7 @@ int zbl_get_cluster_list(ieee_addr eui64, unsigned char endpoint, GVariantIter *in_cluster_iter = NULL; GVariantIter *out_cluster_iter = NULL; GError *dbus_err = NULL; - unsigned short cluster; + unsigned short cluster = 0; int i = 0; int result = 0; @@ -3192,7 +3192,7 @@ int zbl_get_cluster_list(ieee_addr eui64, unsigned char endpoint, return ZIGBEE_ERROR_NONE; } -int zbl_get_endpoint_list(ieee_addr eui64, unsigned char list[], unsigned char *count) +int zbl_get_endpoint_list(ieee_addr eui64, unsigned char *count, unsigned char list[]) { GVariant *variant = NULL; GVariantBuilder *mac_builder = NULL; diff --git a/lib/zbl-dbus.h b/lib/zbl-dbus.h index 44ba027..ea8d8d9 100644 --- a/lib/zbl-dbus.h +++ b/lib/zbl-dbus.h @@ -35,9 +35,9 @@ int zbl_get_network_info(ieee_addr addr64, nwk_addr *nodeid, nwk_addr *panid, unsigned char *channel, unsigned char *tx_power); int zbl_get_controller_mac_address(ieee_addr addr64); int zbl_get_cluster_list(ieee_addr eui64, unsigned char endpoint, - unsigned char *in_cluster_count, unsigned char *out_cluster_count, - unsigned short in_cluster_list[], unsigned short out_cluster_list[]); -int zbl_get_endpoint_list(ieee_addr eui64, unsigned char list[], unsigned char *count); + unsigned char *in_cluster_count, unsigned short in_cluster_list[], + unsigned char *out_cluster_count, unsigned short out_cluster_list[]); +int zbl_get_endpoint_list(ieee_addr eui64, unsigned char *count, unsigned char list[]); int zbl_get_all_device_info(zb_end_device_info_h **dev_list, unsigned char* num); int zbl_form_network(zigbee_h handle, zb_form_network_cb cb, void *user_data); int zbl_disable_network(zigbee_h handle, zb_disable_network_cb cb, void *user_data); diff --git a/lib/zbl-zdo.c b/lib/zbl-zdo.c index a58614b..5ed4301 100644 --- a/lib/zbl-zdo.c +++ b/lib/zbl-zdo.c @@ -201,7 +201,7 @@ API int zb_get_all_device_list(zigbee_h handle, int *count, zb_end_device_info_h return ret; } -API int zb_get_endpoint_list(zigbee_h handle, ieee_addr addr64, int *count, +API int zb_get_endpoint_list(zigbee_h handle, ieee_addr addr64, unsigned char *count, unsigned char *ep_list) { int ret; @@ -211,7 +211,7 @@ API int zb_get_endpoint_list(zigbee_h handle, ieee_addr addr64, int *count, RETV_IF(NULL == count, ZIGBEE_ERROR_INVALID_PARAMETER); RETV_IF(NULL == ep_list, ZIGBEE_ERROR_INVALID_PARAMETER); - ret = zbl_get_endpoint_list(addr64, ep_list, &cnt); + ret = zbl_get_endpoint_list(addr64, &cnt, ep_list); *count = cnt; return ret; } diff --git a/test/main.c b/test/main.c index 7098a2b..25db276 100644 --- a/test/main.c +++ b/test/main.c @@ -39,7 +39,7 @@ extern struct menu_data menu_zcl_cluster[]; extern struct menu_data menu_custom[]; static char data_remove_children[MENU_DATA_SIZE + 1] = "1"; -static char data_endpoint[MENU_DATA_SIZE + 1] = "0"; +static char data_endpoint[MENU_DATA_SIZE + 1] = "1"; static char data_rejoin[MENU_DATA_SIZE + 1] = "0"; static char data_pj_timeout[MENU_DATA_SIZE + 1] = "90"; static char data_choose_target[MENU_DATA_SIZE + 1] = "0"; @@ -679,11 +679,11 @@ static int run_get_cluster_list(MManager *mm, struct menu_data *menu) { int ret = ZIGBEE_ERROR_NONE; int i = 0; - unsigned char ep = 0; + unsigned char ep = 1; unsigned char in_count = 0; unsigned char out_count = 0; - unsigned short in_cluster_list[MAX_ENDPOINT_CLUSTERS]; - unsigned short out_cluster_list[MAX_ENDPOINT_CLUSTERS]; + unsigned short in_cluster_list[MAX_ENDPOINT_CLUSTERS] = { 0 }; + unsigned short out_cluster_list[MAX_ENDPOINT_CLUSTERS] = { 0 }; if (strlen(data_endpoint) > 0) { ep = (unsigned char)strtol(data_endpoint, NULL, 10); @@ -700,12 +700,12 @@ static int run_get_cluster_list(MManager *mm, struct menu_data *menu) msg(" - zb_get_cluster_list() ret: [0x%X]", ret); msgb("In Clusters count [%d] : ", in_count); for(i = 0; i < in_count; i++) { - msgn(" %04d", in_cluster_list[i]); + msgn(" %04X", in_cluster_list[i]); } msg("\n"); msgb("Out Clusters count [%d] : ", out_count); for(i = 0; i < out_count; i++) { - msgn(" %04d", out_cluster_list[i]); + msgn(" %04X", out_cluster_list[i]); } msg("\n"); -- 2.34.1