Add getting global ipaddr function
[platform/core/api/thread.git] / tests / thread-test / thread-network.c
index a0f1228..014844e 100644 (file)
@@ -324,6 +324,26 @@ OUT:
        return RET_SUCCESS;
 }
 
+static int run_thread_get_global_ipaddr(MManager *mm, struct menu_data *menu)
+{
+       FUNC_ENTRY;
+       thread_instance_h g_instance = mm->t_instance;
+       const char *ipaddr;
+       if (g_instance == NULL)
+               goto OUT;
+
+       int ret = thread_get_global_ipaddr(g_instance, &ipaddr);
+       if (ret == THREAD_ERROR_NONE) {
+               msg("thread_get_ipaddr_global success");
+               msg("ipaddr: %s", ipaddr);
+       } else {
+               msg("thread_get_ipaddr_global failed");
+       }
+OUT:
+       FUNC_EXIT;
+       return RET_SUCCESS;
+}
+
 static struct menu_data menu_thread_network_set_active_dataset_tlvs[] = {
        { "1", "Tlvs_buffer len", NULL, NULL, g_str_buf_length},
        { "2", "Tlvs_buffer", NULL, NULL, g_str_tlvs_buffer},
@@ -380,6 +400,8 @@ struct menu_data menu_thread_network[] = {
                menu_thread_add_ipaddr, NULL, NULL},
        { "9", "thread_remove_ipaddr",
                menu_thread_remove_ipaddr, NULL, NULL},
+       { "10", "thread_get_global_ipaddr",
+               NULL, run_thread_get_global_ipaddr, NULL},
        { NULL, NULL, },
 };