Add error handling for not supported functions 94/257794/1 accepted/tizen/unified/20210505.141526 submit/tizen/20210503.211553
authorJihoon Jung <jh8801.jung@samsung.com>
Mon, 3 May 2021 04:27:11 +0000 (13:27 +0900)
committerJihoon Jung <jh8801.jung@samsung.com>
Mon, 3 May 2021 04:28:10 +0000 (13:28 +0900)
Change-Id: I57f5e15e2bf53ec1d92902dcb3f7d42568af5f0f
Signed-off-by: Jihoon Jung <jh8801.jung@samsung.com>
src/hal-api-uwb.c

index 03fe5a4..b2c3b06 100755 (executable)
@@ -75,6 +75,10 @@ int hal_uwb_start(uwb_hal_event_cbs_s *event_cbs)
 {
        if (!g_uwb_funcs)
                return -ENOTSUP;
+
+       if (!g_uwb_funcs->start)
+               return -ENOTSUP;
+
        return g_uwb_funcs->start(event_cbs);
 }
 
@@ -83,6 +87,10 @@ int hal_uwb_stop(void)
 {
        if (!g_uwb_funcs)
                return -ENOTSUP;
+
+       if (!g_uwb_funcs->stop)
+               return -ENOTSUP;
+
        return g_uwb_funcs->stop();
 }
 
@@ -91,6 +99,10 @@ int hal_uwb_test(void)
 {
        if (!g_uwb_funcs)
                return -ENOTSUP;
+
+       if (!g_uwb_funcs->test)
+               return -ENOTSUP;
+
        return g_uwb_funcs->test();
 }
 
@@ -99,6 +111,10 @@ int hal_uwb_reset(void)
 {
        if (!g_uwb_funcs)
                return -ENOTSUP;
+
+       if (!g_uwb_funcs->reset)
+               return -ENOTSUP;
+
        return g_uwb_funcs->reset();
 }
 
@@ -107,6 +123,10 @@ int hal_uwb_factory_reset(void)
 {
        if (!g_uwb_funcs)
                return -ENOTSUP;
+
+       if (!g_uwb_funcs->factory_reset)
+               return -ENOTSUP;
+
        return g_uwb_funcs->factory_reset();
 }
 
@@ -115,6 +135,10 @@ int hal_uwb_enable_network(void)
 {
        if (!g_uwb_funcs)
                return -ENOTSUP;
+
+       if (!g_uwb_funcs->enable_network)
+               return -ENOTSUP;
+
        return g_uwb_funcs->enable_network();
 }
 
@@ -123,6 +147,10 @@ int hal_uwb_disable_network(void)
 {
        if (!g_uwb_funcs)
                return -ENOTSUP;
+
+       if (!g_uwb_funcs->disable_network)
+               return -ENOTSUP;
+
        return g_uwb_funcs->disable_network();
 }
 
@@ -131,6 +159,10 @@ int hal_uwb_get_network_info(uwb_hal_network_s **network_info)
 {
        if (!g_uwb_funcs)
                return -ENOTSUP;
+
+       if (!g_uwb_funcs->get_network_info)
+               return -ENOTSUP;
+
        return g_uwb_funcs->get_network_info(network_info);
 }
 
@@ -139,6 +171,10 @@ int hal_uwb_set_configurations(uint16_t node_id, const GVariant *configurations)
 {
        if (!g_uwb_funcs)
                return -ENOTSUP;
+
+       if (!g_uwb_funcs->set_configurations)
+               return -ENOTSUP;
+
        return g_uwb_funcs->set_configurations(node_id, configurations);
 }
 
@@ -147,6 +183,10 @@ int hal_uwb_get_configurations(uint16_t node_id, GVariant **configurations)
 {
        if (!g_uwb_funcs)
                return -ENOTSUP;
+
+       if (!g_uwb_funcs->get_configurations)
+               return -ENOTSUP;
+
        return g_uwb_funcs->get_configurations(node_id, configurations);
 }
 
@@ -155,6 +195,10 @@ int hal_uwb_set_position(uint64_t node_id, int x, int y, int z)
 {
        if (!g_uwb_funcs)
                return -ENOTSUP;
+
+       if (!g_uwb_funcs->set_position)
+               return -ENOTSUP;
+
        return g_uwb_funcs->set_position(node_id, x, y, z);
 }
 
@@ -163,6 +207,10 @@ int hal_uwb_get_own_node(uwb_hal_node_s **own_node)
 {
        if (!g_uwb_funcs)
                return -ENOTSUP;
+
+       if (!g_uwb_funcs->get_own_node)
+               return -ENOTSUP;
+
        return g_uwb_funcs->get_own_node(own_node);
 }
 
@@ -171,6 +219,10 @@ int hal_uwb_send_message(const unsigned char *message, int message_length)
 {
        if (!g_uwb_funcs)
                return -ENOTSUP;
+
+       if (!g_uwb_funcs->send_message)
+               return -ENOTSUP;
+
        return g_uwb_funcs->send_message(message, message_length);
 }
 
@@ -179,5 +231,9 @@ int hal_uwb_send_message_to(uint16_t node_id, const unsigned char *message, int
 {
        if (!g_uwb_funcs)
                return -ENOTSUP;
+
+       if (!g_uwb_funcs->send_message_to)
+               return -ENOTSUP;
+
        return g_uwb_funcs->send_message_to(node_id, message, message_length);
 }