2 * Copyright (c) 2011-2013 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
24 #include "net_connection.h"
25 #include <tizen_error.h>
27 #define RETURN_FAIL_DESTROY(x) {connection_profile_destroy(x); return -1;}
29 gboolean test_thread(GIOChannel *source, GIOCondition condition, gpointer data);
31 connection_h connection = NULL;
32 static GSList *state_cb_list = NULL;
35 static bool test_get_user_string(const char *msg, char *buf, int buf_size)
37 if (msg == NULL || buf == NULL || buf_size < 2)
42 memset(buf, 0, buf_size);
43 rv = read(0, buf, buf_size - 1);
45 if (rv < 0 || buf[0] == '\0' || buf[0] == '\n' || buf[0] == '\r') {
55 static bool test_get_user_int(const char *msg, int *num)
57 if (msg == NULL || num == NULL)
63 rv = read(0, buf, 32);
65 if (rv < 0 || *buf == 0 || *buf == '\n' || *buf == '\r')
72 static const char *test_print_state(connection_profile_state_e state)
75 case CONNECTION_PROFILE_STATE_DISCONNECTED:
76 return "Disconnected";
77 case CONNECTION_PROFILE_STATE_ASSOCIATION:
79 case CONNECTION_PROFILE_STATE_CONFIGURATION:
80 return "Configuration";
81 case CONNECTION_PROFILE_STATE_CONNECTED:
88 static const char *test_print_error(connection_error_e error)
91 case CONNECTION_ERROR_NONE:
92 return "CONNECTION_ERROR_NONE";
93 case CONNECTION_ERROR_INVALID_PARAMETER:
94 return "CONNECTION_ERROR_INVALID_PARAMETER";
95 case CONNECTION_ERROR_OUT_OF_MEMORY:
96 return "CONNECTION_ERROR_OUT_OF_MEMORY";
97 case CONNECTION_ERROR_INVALID_OPERATION:
98 return "CONNECTION_ERROR_INVALID_OPERATION";
99 case CONNECTION_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED:
100 return "CONNECTION_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED";
101 case CONNECTION_ERROR_OPERATION_FAILED:
102 return "CONNECTION_ERROR_OPERATION_FAILED";
103 case CONNECTION_ERROR_ITERATOR_END:
104 return "CONNECTION_ERROR_ITERATOR_END";
105 case CONNECTION_ERROR_NO_CONNECTION:
106 return "CONNECTION_ERROR_NO_CONNECTION";
107 case CONNECTION_ERROR_NOW_IN_PROGRESS:
108 return "CONNECTION_ERROR_NOW_IN_PROGRESS";
109 case CONNECTION_ERROR_ALREADY_EXISTS:
110 return "CONNECTION_ERROR_ALREADY_EXISTS";
111 case CONNECTION_ERROR_OPERATION_ABORTED:
112 return "CONNECTION_ERROR_OPERATION_ABORTED";
113 case CONNECTION_ERROR_DHCP_FAILED:
114 return "CONNECTION_ERROR_DHCP_FAILED";
115 case CONNECTION_ERROR_INVALID_KEY:
116 return "CONNECTION_ERROR_INVALID_KEY";
117 case CONNECTION_ERROR_NO_REPLY:
118 return "CONNECTION_ERROR_NO_REPLY";
119 case CONNECTION_ERROR_PERMISSION_DENIED:
120 return "CONNECTION_ERROR_PERMISSION_DENIED";
121 case CONNECTION_ERROR_NOT_SUPPORTED:
122 return "CONNECTION_ERROR_NOT_SUPPORTED";
124 return "CONNECTION_ERROR_UNKNOWN";
128 static void test_type_changed_callback(connection_type_e type, void* user_data)
130 printf("Type changed callback, connection type : %d\n", type);
133 static void test_ip_changed_callback(const char* ipv4_address, const char* ipv6_address, void* user_data)
135 printf("IP changed callback, IPv4 address : %s, IPv6 address : %s\n",
136 ipv4_address, (ipv6_address ? ipv6_address : "NULL"));
139 static void test_proxy_changed_callback(const char* ipv4_address, const char* ipv6_address, void* user_data)
141 printf("Proxy changed callback, IPv4 address : %s, IPv6 address : %s\n",
142 ipv4_address, (ipv6_address ? ipv6_address : "NULL"));
145 static void test_profile_state_callback(connection_profile_state_e state, void* user_data)
148 connection_profile_h profile = user_data;
153 if (connection_profile_get_name(profile, &profile_name) != CONNECTION_ERROR_NONE)
156 printf("[%s] : %s\n", test_print_state(state), profile_name);
157 g_free(profile_name);
160 static void test_connection_opened_callback(connection_error_e result, void* user_data)
162 if (result == CONNECTION_ERROR_NONE)
163 printf("Connection open Succeeded\n");
165 printf("Connection open Failed, err : %d\n", result);
168 static void test_connection_closed_callback(connection_error_e result, void* user_data)
170 if (result == CONNECTION_ERROR_NONE)
171 printf("Connection close Succeeded\n");
173 printf("Connection close Failed, err : %d\n", result);
176 static void test_connection_reset_profile_callback(connection_error_e result, void* user_data)
178 if (result == CONNECTION_ERROR_NONE)
179 printf("Reset profile Succeeded\n");
181 printf("Reset profile Failed, err : [%s]\n", test_print_error(result));
184 static void test_connection_set_default_callback(connection_error_e result, void* user_data)
186 if (result == CONNECTION_ERROR_NONE)
187 printf("Default profile setting Succeeded\n");
189 printf("Default profile setting Failed, err : %d\n", result);
192 void test_get_ethernet_cable_state_callback(connection_ethernet_cable_state_e state,
195 if(state == CONNECTION_ETHERNET_CABLE_ATTACHED)
196 printf("Ethernet Cable Connected\n");
197 else if(state == CONNECTION_ETHERNET_CABLE_DETACHED)
198 printf("Ethernet Cable Disconnected\n");
201 static bool test_get_user_selected_profile(connection_profile_h *profile, bool select)
206 connection_profile_type_e profile_type;
207 connection_profile_state_e profile_state;
208 connection_profile_iterator_h profile_iter;
209 connection_profile_h profile_h;
211 connection_profile_h profile_list[100] = {0,};
212 int profile_count = 0;
214 rv = connection_get_profile_iterator(connection, CONNECTION_ITERATOR_TYPE_REGISTERED, &profile_iter);
215 if (rv != CONNECTION_ERROR_NONE) {
216 printf("Fail to get profile iterator [%d]\n", rv);
220 while (connection_profile_iterator_has_next(profile_iter)) {
221 if (connection_profile_iterator_next(profile_iter, &profile_h) != CONNECTION_ERROR_NONE) {
222 printf("Fail to get profile handle\n");
226 if (connection_profile_get_name(profile_h, &profile_name) != CONNECTION_ERROR_NONE) {
227 printf("Fail to get profile name\n");
231 if (connection_profile_get_type(profile_h, &profile_type) != CONNECTION_ERROR_NONE) {
232 printf("Fail to get profile type\n");
233 g_free(profile_name);
237 if (connection_profile_get_state(profile_h, &profile_state) != CONNECTION_ERROR_NONE) {
238 printf("Fail to get profile state\n");
239 g_free(profile_name);
243 if (profile_type == CONNECTION_PROFILE_TYPE_WIFI) {
245 connection_profile_get_wifi_essid(profile_h, &essid);
246 printf("%d. state:[%s], profile name:%s, essid:%s\n",
247 profile_count, test_print_state(profile_state),
248 profile_name, (essid)? essid : "");
251 profile_list[profile_count] = profile_h;
254 printf("%d. state:[%s], profile name : %s\n",
255 profile_count, test_print_state(profile_state), profile_name);
257 profile_list[profile_count] = profile_h;
261 g_free(profile_name);
262 if (profile_count >= 100)
269 if (test_get_user_int("Input profile number(Enter for cancel) :", &input) == false ||
270 input >= profile_count ||
272 printf("Wrong number!!\n");
277 *profile = profile_list[input];
282 static int test_update_cellular_info(connection_profile_h profile)
285 char input_str1[100] = {0,};
286 char input_str2[100] = {0,};
290 if (test_get_user_int("Input Network Type (internet:1, MMS:2, Prepaid internet:3, "
291 "Prepaid MMS:4, Tethering:5, Application:6)"
292 " - (Enter for skip) :", &input_int)) {
295 rv = connection_profile_set_cellular_service_type(profile,
296 CONNECTION_CELLULAR_SERVICE_TYPE_INTERNET);
299 rv = connection_profile_set_cellular_service_type(profile,
300 CONNECTION_CELLULAR_SERVICE_TYPE_MMS);
303 rv = connection_profile_set_cellular_service_type(profile,
304 CONNECTION_CELLULAR_SERVICE_TYPE_PREPAID_INTERNET);
307 rv = connection_profile_set_cellular_service_type(profile,
308 CONNECTION_CELLULAR_SERVICE_TYPE_PREPAID_MMS);
311 rv = connection_profile_set_cellular_service_type(profile,
312 CONNECTION_CELLULAR_SERVICE_TYPE_TETHERING);
315 rv = connection_profile_set_cellular_service_type(profile,
316 CONNECTION_CELLULAR_SERVICE_TYPE_APPLICATION);
322 if (rv != CONNECTION_ERROR_NONE)
327 if (test_get_user_string("Input Apn - (Enter for skip) :", input_str1, 100)) {
328 rv = connection_profile_set_cellular_apn(profile, input_str1);
329 if (rv != CONNECTION_ERROR_NONE)
333 if (test_get_user_string("Input Proxy - (Enter for skip) :", input_str1, 100)) {
334 rv = connection_profile_set_proxy_address(profile, CONNECTION_ADDRESS_FAMILY_IPV4, input_str1);
335 if (rv != CONNECTION_ERROR_NONE)
339 if (test_get_user_string("Input HomeURL - (Enter for skip) :", input_str1, 100)) {
340 rv = connection_profile_set_cellular_home_url(profile, input_str1);
341 if (rv != CONNECTION_ERROR_NONE)
345 if (test_get_user_int("Input AuthType(0:NONE 1:PAP 2:CHAP) - (Enter for skip) :", &input_int)) {
348 rv = connection_profile_set_cellular_auth_info(profile,
349 CONNECTION_CELLULAR_AUTH_TYPE_NONE, "", "");
350 if (rv != CONNECTION_ERROR_NONE)
355 type_val = CONNECTION_CELLULAR_AUTH_TYPE_PAP;
358 if (input_int == 2) type_val = CONNECTION_CELLULAR_AUTH_TYPE_CHAP;
360 if (test_get_user_string("Input AuthId(Enter for skip) :", input_str1, 100) == false)
362 if (test_get_user_string("Input AuthPwd(Enter for skip) :", input_str2, 100) == false)
365 rv = connection_profile_set_cellular_auth_info(profile, type_val, input_str1, input_str2);
366 if (rv != CONNECTION_ERROR_NONE)
374 static int test_update_wifi_info(connection_profile_h profile)
377 char input_str[100] = {0,};
379 if (test_get_user_string("Input Passphrase - (Enter for skip) :", input_str, 100)) {
380 rv = connection_profile_set_wifi_passphrase(profile, input_str);
381 if (rv != CONNECTION_ERROR_NONE)
388 static int test_update_ip_info(connection_profile_h profile)
391 char input_str[100] = {0,};
393 if (test_get_user_string("Input IP Address - (Enter for skip) :", input_str, 100)) {
394 rv = connection_profile_set_ip_address(profile,
395 CONNECTION_ADDRESS_FAMILY_IPV4,
397 if (rv != CONNECTION_ERROR_NONE)
401 if (test_get_user_string("Input Netmask - (Enter for skip) :", input_str, 100)) {
402 rv = connection_profile_set_subnet_mask(profile,
403 CONNECTION_ADDRESS_FAMILY_IPV4,
405 if (rv != CONNECTION_ERROR_NONE)
409 if (test_get_user_string("Input Gateway - (Enter for skip) :", input_str, 100)) {
410 rv = connection_profile_set_gateway_address(profile,
411 CONNECTION_ADDRESS_FAMILY_IPV4,
413 if (rv != CONNECTION_ERROR_NONE)
417 if (test_get_user_string("Input DNS 1 Address - (Enter for skip) :", input_str, 100)) {
418 rv = connection_profile_set_dns_address(profile,
420 CONNECTION_ADDRESS_FAMILY_IPV4,
422 if (rv != CONNECTION_ERROR_NONE)
425 if (test_get_user_string("Input DNS 2 Address - (Enter for skip) :", input_str, 100)) {
426 rv = connection_profile_set_dns_address(profile,
428 CONNECTION_ADDRESS_FAMILY_IPV4,
430 if (rv != CONNECTION_ERROR_NONE)
438 static int test_update_proxy_info(connection_profile_h profile)
442 char input_str[100] = {0,};
444 if (test_get_user_int("Input Proxy Type (1:direct, 2:auto, 3:manual)"
445 " - (Enter for skip) :", &input_int)) {
448 rv = connection_profile_set_proxy_type(profile,
449 CONNECTION_PROXY_TYPE_DIRECT);
451 if (rv != CONNECTION_ERROR_NONE)
456 rv = connection_profile_set_proxy_type(profile,
457 CONNECTION_PROXY_TYPE_AUTO);
460 rv = connection_profile_set_proxy_type(profile,
461 CONNECTION_PROXY_TYPE_MANUAL);
467 if (rv != CONNECTION_ERROR_NONE)
470 if (test_get_user_string("Input auto Proxy URL or Proxy address"
471 " - (Enter for skip) :", input_str, 100)) {
472 rv = connection_profile_set_proxy_address(profile,
473 CONNECTION_ADDRESS_FAMILY_IPV4,
475 if (rv != CONNECTION_ERROR_NONE)
485 static int test_update_network_info(connection_profile_h profile)
490 if (test_get_user_int("Input IPv4 Address Type (DHCP:1, Static:2)"
491 " - (Enter for skip) :", &input_int)) {
494 rv = connection_profile_set_ip_config_type(profile,
495 CONNECTION_ADDRESS_FAMILY_IPV4,
496 CONNECTION_IP_CONFIG_TYPE_DYNAMIC);
499 rv = connection_profile_set_ip_config_type(profile,
500 CONNECTION_ADDRESS_FAMILY_IPV4,
501 CONNECTION_IP_CONFIG_TYPE_STATIC);
502 if (rv != CONNECTION_ERROR_NONE)
505 if (test_update_ip_info(profile) == -1)
508 if (test_update_proxy_info(profile) == -1)
515 if (rv != CONNECTION_ERROR_NONE)
523 static void test_print_cellular_info(connection_profile_h profile)
525 connection_cellular_network_type_e network_type;
526 connection_cellular_service_type_e service_type;
528 connection_cellular_auth_type_e auth_type;
529 char *user_name = NULL;
530 char *password = NULL;
531 char *home_url = NULL;
532 bool roaming = false;
534 bool editable = false;
536 if (connection_profile_get_cellular_network_type(profile, &network_type) != CONNECTION_ERROR_NONE)
537 printf("Fail to get cellular network type!\n");
539 printf("Cellular network type : %d\n", network_type);
541 if (connection_profile_get_cellular_service_type(profile, &service_type) != CONNECTION_ERROR_NONE)
542 printf("Fail to get cellular service type!\n");
544 printf("Cellular service type : %d\n", service_type);
546 if (connection_profile_get_cellular_apn(profile, &apn) != CONNECTION_ERROR_NONE)
547 printf("Fail to get cellular APN!\n");
549 printf("Cellular APN : %s\n", apn);
553 if (connection_profile_get_cellular_auth_info(profile, &auth_type, &user_name, &password) != CONNECTION_ERROR_NONE)
554 printf("Fail to get auth info!\n");
556 printf("Cellular auth type : %d\n", auth_type);
557 printf("Cellular user_name : %s\n", user_name);
558 printf("Cellular password : %s\n", password);
563 if (connection_profile_get_cellular_home_url(profile, &home_url) != CONNECTION_ERROR_NONE)
564 printf("Fail to get cellular home url!\n");
566 printf("Cellular home url : %s\n", home_url);
570 if (connection_profile_is_cellular_roaming(profile, &roaming) != CONNECTION_ERROR_NONE)
571 printf("Fail to get cellular is roaming!\n");
573 printf("Cellular roaming : %s\n", roaming ? "true" : "false");
575 if (connection_profile_is_cellular_hidden(profile, &hidden) != CONNECTION_ERROR_NONE)
576 printf("Fail to get cellular hidden state!\n");
578 printf("Cellular hidden : %s\n", hidden ? "true" : "false");
580 if (connection_profile_is_cellular_editable(profile, &editable) != CONNECTION_ERROR_NONE)
581 printf("Fail to get cellular editing state!\n");
583 printf("Cellular editable : %s\n", editable ? "true" : "false");
586 static void test_print_wifi_info(connection_profile_h profile)
593 connection_wifi_security_type_e security_type;
594 connection_wifi_encryption_type_e encryption_type;
595 bool pass_required = false;
596 bool wps_supported = false;
598 if (connection_profile_get_wifi_essid(profile, &essid) != CONNECTION_ERROR_NONE)
599 printf("Fail to get Wi-Fi essid!\n");
601 printf("Wi-Fi essid : %s\n", essid);
605 if (connection_profile_get_wifi_bssid(profile, &bssid) != CONNECTION_ERROR_NONE)
606 printf("Fail to get Wi-Fi bssid!\n");
608 printf("Wi-Fi bssid : %s\n", bssid);
612 if (connection_profile_get_wifi_rssi(profile, &rssi) != CONNECTION_ERROR_NONE)
613 printf("Fail to get Wi-Fi rssi!\n");
615 printf("Wi-Fi rssi : %d\n", rssi);
617 if (connection_profile_get_wifi_frequency(profile, &frequency) != CONNECTION_ERROR_NONE)
618 printf("Fail to get Wi-Fi frequency!\n");
620 printf("Wi-Fi frequency : %d\n", frequency);
622 if (connection_profile_get_wifi_max_speed(profile, &max_speed) != CONNECTION_ERROR_NONE)
623 printf("Fail to get Wi-Fi max speed!\n");
625 printf("Wi-Fi max speed : %d\n", max_speed);
627 if (connection_profile_get_wifi_security_type(profile, &security_type) != CONNECTION_ERROR_NONE)
628 printf("Fail to get Wi-Fi security type!\n");
630 printf("Wi-Fi security type : %d\n", security_type);
632 if (connection_profile_get_wifi_encryption_type(profile, &encryption_type) != CONNECTION_ERROR_NONE)
633 printf("Fail to get Wi-Fi encryption type!\n");
635 printf("Wi-Fi encryption type : %d\n", encryption_type);
637 if (connection_profile_is_wifi_passphrase_required(profile, &pass_required) != CONNECTION_ERROR_NONE)
638 printf("Fail to get Wi-Fi passphrase required!\n");
640 printf("Wi-Fi passphrase required : %s\n", pass_required ? "true" : "false");
642 if (connection_profile_is_wifi_wps_supported(profile, &wps_supported) != CONNECTION_ERROR_NONE)
643 printf("Fail to get Wi-Fi wps info\n");
645 printf("Wi-Fi wps supported : %s\n", wps_supported ? "true" : "false");
648 static void test_print_network_info(connection_profile_h profile)
650 char *interface_name = NULL;
651 connection_ip_config_type_e ip_type;
654 char *gateway = NULL;
657 connection_proxy_type_e proxy_type;
660 if (connection_profile_get_network_interface_name(profile, &interface_name) != CONNECTION_ERROR_NONE)
661 printf("Fail to get interface name!\n");
663 printf("Interface name : %s\n", interface_name);
664 g_free(interface_name);
667 if (connection_profile_get_ip_config_type(profile, CONNECTION_ADDRESS_FAMILY_IPV4, &ip_type) != CONNECTION_ERROR_NONE)
668 printf("Fail to get ipconfig type!\n");
670 printf("Ipconfig type : %d\n", ip_type);
672 if (connection_profile_get_ip_address(profile, CONNECTION_ADDRESS_FAMILY_IPV4, &ip) != CONNECTION_ERROR_NONE)
673 printf("Fail to get IP address!\n");
675 printf("IP address : %s\n", ip);
679 if (connection_profile_get_subnet_mask(profile, CONNECTION_ADDRESS_FAMILY_IPV4, &subnet) != CONNECTION_ERROR_NONE)
680 printf("Fail to get subnet mask!\n");
682 printf("Subnet mask : %s\n", subnet);
686 if (connection_profile_get_gateway_address(profile, CONNECTION_ADDRESS_FAMILY_IPV4, &gateway) != CONNECTION_ERROR_NONE)
687 printf("Fail to get gateway!\n");
689 printf("Gateway : %s\n", gateway);
693 if (connection_profile_get_dns_address(profile, 1, CONNECTION_ADDRESS_FAMILY_IPV4, &dns1) != CONNECTION_ERROR_NONE)
694 printf("Fail to get DNS1!\n");
696 printf("DNS1 : %s\n", dns1);
700 if (connection_profile_get_dns_address(profile, 2, CONNECTION_ADDRESS_FAMILY_IPV4, &dns2) != CONNECTION_ERROR_NONE)
701 printf("Fail to get DNS2!\n");
703 printf("DNS2 : %s\n", dns2);
707 if (connection_profile_get_proxy_type(profile, &proxy_type) != CONNECTION_ERROR_NONE)
708 printf("Fail to get proxy type!\n");
710 printf("Proxy type : %d\n", proxy_type);
712 if (connection_profile_get_proxy_address(profile, CONNECTION_ADDRESS_FAMILY_IPV4, &proxy) != CONNECTION_ERROR_NONE)
713 printf("Fail to get proxy!\n");
715 printf("Proxy : %s\n", proxy);
720 int test_register_client(void)
723 int err = connection_create(&connection);
725 if (CONNECTION_ERROR_NONE == err) {
726 connection_set_type_changed_cb(connection, test_type_changed_callback, NULL);
727 connection_set_ip_address_changed_cb(connection, test_ip_changed_callback, NULL);
728 connection_set_proxy_address_changed_cb(connection, test_proxy_changed_callback, NULL);
729 connection_set_ethernet_cable_state_chaged_cb(connection,
730 test_get_ethernet_cable_state_callback, NULL);
732 printf("Client registration failed %d\n", err);
736 printf("Client registration success\n");
740 int test_deregister_client(void)
744 connection_profile_h profile;
746 if (connection != NULL)
747 rv = connection_destroy(connection);
749 printf("Cannot deregister : Handle is NULL\n");
750 rv = CONNECTION_ERROR_INVALID_OPERATION;
753 if (rv != CONNECTION_ERROR_NONE){
754 printf("Client deregistration fail [%d]\n", rv);
759 for (list = state_cb_list; list; list = list->next) {
760 profile = list->data;
761 connection_profile_destroy(profile);
764 g_slist_free(state_cb_list);
765 state_cb_list = NULL;
769 printf("Client deregistration success\n");
774 int test_get_network_state(void)
777 connection_type_e net_state;
779 rv = connection_get_type(connection, &net_state);
781 if (rv != CONNECTION_ERROR_NONE) {
782 printf("Fail to get network state [%d]\n", rv);
786 printf("Retval = %d network connection state [%d]\n", rv, net_state);
791 int test_get_cellular_state(void)
794 connection_cellular_state_e cellular_state;
796 rv = connection_get_cellular_state(connection, &cellular_state);
798 if (rv != CONNECTION_ERROR_NONE) {
799 printf("Fail to get Cellular state [%d]\n", rv);
803 printf("Retval = %d Cellular state [%d]\n", rv, cellular_state);
808 int test_get_wifi_state(void)
811 connection_wifi_state_e wifi_state;
813 rv = connection_get_wifi_state(connection, &wifi_state);
815 if (rv != CONNECTION_ERROR_NONE) {
816 printf("Fail to get WiFi state [%d]\n", rv);
820 printf("Retval = %d WiFi state [%d]\n", rv, wifi_state);
825 int test_get_current_proxy(void)
827 char *proxy_addr = NULL;
829 connection_get_proxy(connection, CONNECTION_ADDRESS_FAMILY_IPV4, &proxy_addr);
831 if (proxy_addr == NULL) {
832 printf("Proxy address does not exist\n");
836 printf("Current Proxy [%s]\n", proxy_addr);
842 int test_get_current_ip(void)
844 char *ip_addr = NULL;
846 connection_get_ip_address(connection, CONNECTION_ADDRESS_FAMILY_IPV4, &ip_addr);
848 if (ip_addr == NULL) {
849 printf("IP address does not exist\n");
853 printf("IPv4 address : %s\n", ip_addr);
859 int test_get_call_statistics_info(void)
863 connection_get_statistics(connection, CONNECTION_TYPE_CELLULAR, CONNECTION_STATISTICS_TYPE_LAST_RECEIVED_DATA, &rv);
864 printf("last recv data size [%lld]\n", rv);
865 connection_get_statistics(connection, CONNECTION_TYPE_CELLULAR, CONNECTION_STATISTICS_TYPE_LAST_SENT_DATA, &rv);
866 printf("last sent data size [%lld]\n",rv );
867 connection_get_statistics(connection, CONNECTION_TYPE_CELLULAR, CONNECTION_STATISTICS_TYPE_TOTAL_RECEIVED_DATA, &rv);
868 printf("total received data size [%lld]\n",rv );
869 connection_get_statistics(connection, CONNECTION_TYPE_CELLULAR, CONNECTION_STATISTICS_TYPE_TOTAL_SENT_DATA, &rv);
870 printf("total sent data size [%lld]\n", rv);
875 int test_get_wifi_call_statistics_info(void)
879 connection_get_statistics(connection, CONNECTION_TYPE_WIFI, CONNECTION_STATISTICS_TYPE_LAST_RECEIVED_DATA, &rv);
880 printf("WiFi last recv data size [%lld]\n", rv);
881 connection_get_statistics(connection, CONNECTION_TYPE_WIFI, CONNECTION_STATISTICS_TYPE_LAST_SENT_DATA, &rv);
882 printf("WiFi last sent data size [%lld]\n",rv );
883 connection_get_statistics(connection, CONNECTION_TYPE_WIFI, CONNECTION_STATISTICS_TYPE_TOTAL_RECEIVED_DATA, &rv);
884 printf("WiFi total received data size [%lld]\n",rv );
885 connection_get_statistics(connection, CONNECTION_TYPE_WIFI, CONNECTION_STATISTICS_TYPE_TOTAL_SENT_DATA, &rv);
886 printf("WiFi total sent data size [%lld]\n", rv);
891 int test_get_profile_list(void)
893 if (test_get_user_selected_profile(NULL, false) == false)
899 int test_get_default_profile_list(void)
902 char *profile_name = NULL;
903 connection_profile_iterator_h profile_iter;
904 connection_profile_h profile_h;
905 connection_cellular_service_type_e service_type;
906 bool is_default = false;
908 rv = connection_get_profile_iterator(connection, CONNECTION_ITERATOR_TYPE_DEFAULT, &profile_iter);
909 if (rv != CONNECTION_ERROR_NONE) {
910 printf("Fail to get profile iterator [%s]\n", test_print_error(rv));
914 while (connection_profile_iterator_has_next(profile_iter)) {
915 if (connection_profile_iterator_next(profile_iter, &profile_h) != CONNECTION_ERROR_NONE) {
916 printf("Fail to get profile handle\n");
920 if (connection_profile_get_name(profile_h, &profile_name) != CONNECTION_ERROR_NONE) {
921 printf("Fail to get profile name\n");
924 printf("profile name : %s\n", profile_name);
925 g_free(profile_name);
927 if (connection_profile_get_cellular_service_type(profile_h, &service_type) != CONNECTION_ERROR_NONE) {
928 printf("Fail to get profile service type\n");
931 printf("service type : %d\n", service_type);
933 if (connection_profile_is_cellular_default(profile_h, &is_default) != CONNECTION_ERROR_NONE) {
934 printf("Fail to get profile subscriber id\n");
937 printf("Default : %d\n", is_default);
943 int test_get_connected_profile_list(void)
946 char *profile_name = NULL;
947 connection_profile_iterator_h profile_iter;
948 connection_profile_h profile_h;
949 bool is_default = false;
950 connection_profile_type_e type;
952 rv = connection_get_profile_iterator(connection, CONNECTION_ITERATOR_TYPE_CONNECTED, &profile_iter);
953 if (rv != CONNECTION_ERROR_NONE) {
954 printf("Fail to get profile iterator [%d]\n", rv);
958 while (connection_profile_iterator_has_next(profile_iter)) {
959 if (connection_profile_iterator_next(profile_iter, &profile_h) != CONNECTION_ERROR_NONE) {
960 printf("Fail to get profile handle\n");
964 if (connection_profile_get_name(profile_h, &profile_name) != CONNECTION_ERROR_NONE) {
965 printf("Fail to get profile name\n");
968 printf("profile name : %s\n", profile_name);
969 g_free(profile_name);
971 if (connection_profile_get_type(profile_h, &type) != CONNECTION_ERROR_NONE) {
972 printf("Fail to get profile type\n");
975 printf("profile type is %d\n", type);
977 if (type == CONNECTION_PROFILE_TYPE_CELLULAR) {
978 if (connection_profile_is_cellular_default(profile_h, &is_default) != CONNECTION_ERROR_NONE) {
979 printf("Fail to get profile is default\n");
982 printf("[%s]\n", is_default ? "default" : "not default");
989 int test_get_current_profile(void)
992 char *profile_name = NULL;
993 connection_profile_h profile_h;
995 rv = connection_get_current_profile(connection, &profile_h);
996 if (rv != CONNECTION_ERROR_NONE) {
997 printf("Fail to get profile iterator [%d]\n", rv);
1001 if (connection_profile_get_name(profile_h, &profile_name) != CONNECTION_ERROR_NONE) {
1002 printf("Fail to get profile name\n");
1005 printf("profile name : %s\n", profile_name);
1006 g_free(profile_name);
1008 connection_profile_destroy(profile_h);
1013 int test_open_profile(void)
1015 connection_profile_h profile;
1017 printf("\n** Choose a profile to open. **\n");
1019 if (test_get_user_selected_profile(&profile, true) == false)
1022 if (connection_open_profile(connection, profile, test_connection_opened_callback, NULL) != CONNECTION_ERROR_NONE) {
1023 printf("Connection open Failed!!\n");
1030 int test_get_default_cellular_service_type(void)
1035 connection_profile_h profile;
1036 char *profile_name = NULL;
1038 rv = test_get_user_int("Input profile type to get"
1039 "(1:Internet, 2:MMS, 3:Prepaid internet, 4:Prepaid MMS, 5:Tethering):", &input);
1042 printf("Invalid input!!\n");
1048 service_type = CONNECTION_CELLULAR_SERVICE_TYPE_INTERNET;
1051 service_type = CONNECTION_CELLULAR_SERVICE_TYPE_MMS;
1054 service_type = CONNECTION_CELLULAR_SERVICE_TYPE_PREPAID_INTERNET;
1057 service_type = CONNECTION_CELLULAR_SERVICE_TYPE_PREPAID_MMS;
1060 service_type = CONNECTION_CELLULAR_SERVICE_TYPE_TETHERING;
1063 printf("Wrong number!!\n");
1067 if (connection_get_default_cellular_service_profile(connection, service_type, &profile) != CONNECTION_ERROR_NONE)
1070 if (connection_profile_get_name(profile, &profile_name) != CONNECTION_ERROR_NONE) {
1071 printf("Fail to get profile name\n");
1072 connection_profile_destroy(profile);
1075 printf("Default profile name : %s\n", profile_name);
1076 g_free(profile_name);
1078 connection_profile_destroy(profile);
1083 int test_set_default_cellular_service_type(void)
1085 connection_profile_h profile;
1086 connection_cellular_service_type_e type;
1089 rv = test_get_user_int("Input API type (1:sync, 2:async)", &input);
1091 if (rv == false || (input != 1 && input != 2)) {
1092 printf("Invalid input!!\n");
1096 printf("\n** Choose a profile to set default service(internet or prepaid internet type only). **\n");
1098 if (test_get_user_selected_profile(&profile, true) == false)
1101 if (connection_profile_get_cellular_service_type(profile, &type) != CONNECTION_ERROR_NONE) {
1102 printf("Fail to get cellular service type\n");
1107 if (connection_set_default_cellular_service_profile(connection, type, profile) != CONNECTION_ERROR_NONE)
1110 if (connection_set_default_cellular_service_profile_async(connection,
1111 type, profile, test_connection_set_default_callback, NULL) != CONNECTION_ERROR_NONE)
1118 int test_close_profile(void)
1120 connection_profile_h profile;
1122 printf("\n** Choose a profile to close. **\n");
1124 if (test_get_user_selected_profile(&profile, true) == false)
1127 if (connection_close_profile(connection, profile, test_connection_closed_callback, NULL) != CONNECTION_ERROR_NONE) {
1128 printf("Connection close Failed!!\n");
1135 int test_add_profile(void)
1138 connection_profile_h profile;
1139 char input_str[100] = {0,};
1141 if (test_get_user_string("Input Keyword - (Enter for skip) :", input_str, 100) == false)
1144 rv = connection_profile_create(CONNECTION_PROFILE_TYPE_CELLULAR, input_str, &profile);
1145 if (rv != CONNECTION_ERROR_NONE)
1146 RETURN_FAIL_DESTROY(profile);
1148 if (test_update_cellular_info(profile) == -1)
1149 RETURN_FAIL_DESTROY(profile);
1151 rv = connection_add_profile(connection, profile);
1152 if (rv != CONNECTION_ERROR_NONE)
1153 RETURN_FAIL_DESTROY(profile);
1155 connection_profile_destroy(profile);
1159 int test_remove_profile(void)
1161 connection_profile_h profile;
1163 printf("\n** Choose a profile to remove. **\n");
1164 if (test_get_user_selected_profile(&profile, true) == false)
1167 if (connection_remove_profile(connection, profile) != CONNECTION_ERROR_NONE) {
1168 printf("Remove profile Failed!!\n");
1175 int test_update_profile(void)
1179 connection_profile_type_e prof_type;
1180 connection_profile_h profile;
1182 printf("\n** Choose a profile to update. **\n");
1183 if (test_get_user_selected_profile(&profile, true) == false)
1186 if (connection_profile_get_type(profile, &prof_type) != CONNECTION_ERROR_NONE)
1189 switch (prof_type) {
1190 case CONNECTION_PROFILE_TYPE_CELLULAR:
1191 if (test_update_cellular_info(profile) == -1)
1195 case CONNECTION_PROFILE_TYPE_WIFI:
1196 if (test_update_wifi_info(profile) == -1)
1199 if (test_update_network_info(profile) == -1)
1203 case CONNECTION_PROFILE_TYPE_ETHERNET:
1204 case CONNECTION_PROFILE_TYPE_BT:
1205 printf("Not supported!\n");
1211 rv = connection_update_profile(connection, profile);
1212 if (rv != CONNECTION_ERROR_NONE)
1218 int test_get_profile_info(void)
1220 connection_profile_type_e prof_type;
1221 connection_profile_state_e profile_state;
1222 connection_profile_h profile;
1223 char *profile_name = NULL;
1225 printf("\n** Choose a profile to print. **\n");
1226 if (test_get_user_selected_profile(&profile, true) == false)
1229 if (connection_profile_get_name(profile, &profile_name) != CONNECTION_ERROR_NONE) {
1230 printf("Fail to get profile name\n");
1233 printf("Profile Name : %s\n", profile_name);
1234 g_free(profile_name);
1237 if (connection_profile_get_state(profile, &profile_state) != CONNECTION_ERROR_NONE) {
1238 printf("Fail to get profile state\n");
1241 printf("Profile State : %s\n", test_print_state(profile_state));
1244 if (connection_profile_get_type(profile, &prof_type) != CONNECTION_ERROR_NONE)
1247 switch (prof_type) {
1248 case CONNECTION_PROFILE_TYPE_CELLULAR:
1249 printf("Profile Type : Cellular\n");
1250 test_print_cellular_info(profile);
1252 case CONNECTION_PROFILE_TYPE_WIFI:
1253 printf("Profile Type : Wi-Fi\n");
1254 test_print_wifi_info(profile);
1256 case CONNECTION_PROFILE_TYPE_ETHERNET:
1257 printf("Profile Type : Ethernet\n");
1259 case CONNECTION_PROFILE_TYPE_BT:
1260 printf("Profile Type : Bluetooth\n");
1266 test_print_network_info(profile);
1271 int test_refresh_profile_info(void)
1273 connection_profile_type_e prof_type;
1274 connection_profile_state_e profile_state;
1275 connection_profile_h profile;
1276 char *profile_name = NULL;
1278 printf("\n** Choose a profile to refresh. **\n");
1279 if (test_get_user_selected_profile(&profile, true) == false)
1282 if (connection_profile_refresh(profile) != CONNECTION_ERROR_NONE)
1285 if (connection_profile_get_name(profile, &profile_name) != CONNECTION_ERROR_NONE) {
1286 printf("Fail to get profile name\n");
1289 printf("Profile Name : %s\n", profile_name);
1290 g_free(profile_name);
1293 if (connection_profile_get_state(profile, &profile_state) != CONNECTION_ERROR_NONE) {
1294 printf("Fail to get profile state\n");
1297 printf("Profile State : %s\n", test_print_state(profile_state));
1300 if (connection_profile_get_type(profile, &prof_type) != CONNECTION_ERROR_NONE)
1303 switch (prof_type) {
1304 case CONNECTION_PROFILE_TYPE_CELLULAR:
1305 printf("Profile Type : Cellular\n");
1306 test_print_cellular_info(profile);
1308 case CONNECTION_PROFILE_TYPE_WIFI:
1309 printf("Profile Type : Wi-Fi\n");
1310 test_print_wifi_info(profile);
1312 case CONNECTION_PROFILE_TYPE_ETHERNET:
1313 printf("Profile Type : Ethernet\n");
1315 case CONNECTION_PROFILE_TYPE_BT:
1316 printf("Profile Type : Bluetooth\n");
1322 test_print_network_info(profile);
1327 int test_set_state_changed_callback()
1329 connection_profile_h profile;
1330 connection_profile_h profile_clone;
1332 printf("\n** Choose a profile to set callback. **\n");
1333 if (test_get_user_selected_profile(&profile, true) == false)
1336 if (connection_profile_clone(&profile_clone, profile) != CONNECTION_ERROR_NONE)
1339 if (connection_profile_set_state_changed_cb(profile,
1340 test_profile_state_callback, profile_clone) != CONNECTION_ERROR_NONE) {
1341 connection_profile_destroy(profile_clone);
1345 state_cb_list = g_slist_append(state_cb_list, profile_clone);
1350 int test_unset_state_changed_callback()
1352 connection_profile_h profile;
1354 char *profile_name = NULL;
1358 printf("\n** Choose a profile to unset callback. **\n");
1359 for (list = state_cb_list; list; list = list->next) {
1360 profile = list->data;
1361 if (connection_profile_get_name(profile, &profile_name) != CONNECTION_ERROR_NONE) {
1362 printf("Fail to get profile name!\n");
1365 printf("%d. %s\n", count, profile_name);
1366 g_free(profile_name);
1372 if (test_get_user_int("Input profile number(Enter for cancel) :", &input) == false ||
1375 printf("Wrong number!!\n");
1380 for (list = state_cb_list; list; list = list->next) {
1381 if (count == input) {
1382 profile = list->data;
1392 if (connection_profile_unset_state_changed_cb(profile) != CONNECTION_ERROR_NONE)
1395 state_cb_list = g_slist_remove(state_cb_list, profile);
1396 connection_profile_destroy(profile);
1401 int test_reset_call_statistics_info(void)
1403 int ret = CONNECTION_ERROR_NONE;
1405 ret = connection_reset_statistics(connection, CONNECTION_TYPE_CELLULAR, CONNECTION_STATISTICS_TYPE_LAST_RECEIVED_DATA);
1406 printf("reset last recv data size [%d]\n", ret);
1407 ret = connection_reset_statistics(connection, CONNECTION_TYPE_CELLULAR, CONNECTION_STATISTICS_TYPE_LAST_SENT_DATA);
1408 printf("last sent data size [%d]\n", ret);
1409 ret = connection_reset_statistics(connection, CONNECTION_TYPE_CELLULAR, CONNECTION_STATISTICS_TYPE_TOTAL_RECEIVED_DATA);
1410 printf("total received data size [%d]\n", ret);
1411 ret = connection_reset_statistics(connection, CONNECTION_TYPE_CELLULAR, CONNECTION_STATISTICS_TYPE_TOTAL_SENT_DATA);
1412 printf("total sent data size [%d]\n", ret);
1417 int test_reset_wifi_call_statistics_info(void)
1419 int ret = CONNECTION_ERROR_NONE;
1421 ret = connection_reset_statistics(connection, CONNECTION_TYPE_WIFI, CONNECTION_STATISTICS_TYPE_LAST_SENT_DATA);
1422 printf("WiFi last sent data size [%d]\n", ret);
1423 ret = connection_reset_statistics(connection, CONNECTION_TYPE_WIFI, CONNECTION_STATISTICS_TYPE_LAST_RECEIVED_DATA);
1424 printf("WiFi last recv data size [%d]\n", ret);
1425 ret = connection_reset_statistics(connection, CONNECTION_TYPE_WIFI, CONNECTION_STATISTICS_TYPE_TOTAL_SENT_DATA);
1426 printf("WiFi total sent data size [%d]\n", ret);
1427 ret = connection_reset_statistics(connection, CONNECTION_TYPE_WIFI, CONNECTION_STATISTICS_TYPE_TOTAL_RECEIVED_DATA);
1428 printf("WiFi total received data size [%d]\n", ret);
1433 int test_add_route(void)
1439 if (test_get_user_string("Input IP - (Enter for skip) :", ip_addr, 30) == false)
1442 if (test_get_user_string("Input Interface name - (Enter for skip) :", if_name, 40) == false)
1445 rv = connection_add_route(connection, if_name, ip_addr);
1446 if (rv != CONNECTION_ERROR_NONE) {
1447 printf("Fail to get add new route [%d]\n", rv);
1454 int test_remove_route(void)
1460 if (test_get_user_string("Input IP - (Enter for skip) :", ip_addr, 30) == false)
1463 if (test_get_user_string("Input Interface name - (Enter for skip) :", if_name, 40) == false)
1466 rv = connection_remove_route(connection, if_name, ip_addr);
1467 if (rv != CONNECTION_ERROR_NONE) {
1468 printf("Fail to remove the route [%s]\n", test_print_error(rv));
1475 int test_get_bt_state(void)
1478 connection_bt_state_e bt_state;
1480 rv = connection_get_bt_state(connection, &bt_state);
1482 if (rv != CONNECTION_ERROR_NONE) {
1483 printf("Fail to get Bluetooth state [%d]\n", rv);
1487 printf("Retval = %d, Bluetooth state [%d]\n", rv, bt_state);
1492 int test_get_profile_id(void)
1494 connection_profile_h profile;
1497 printf("\n** Choose a profile to see profile id. **\n");
1498 if (test_get_user_selected_profile(&profile, true) == false)
1501 if (connection_profile_get_id(profile, &profile_id) != CONNECTION_ERROR_NONE) {
1502 printf("Fail to get profile name\n");
1505 printf("Profile id : %s\n", profile_id);
1512 int test_get_mac_address(void)
1514 int rv = 0, type = 0;
1515 connection_type_e conn_type;
1516 char *mac_addr = NULL;
1518 test_get_user_int("Input connection type (1:wifi, 2:ethernet)", &type);
1522 conn_type = CONNECTION_TYPE_WIFI;
1525 conn_type = CONNECTION_TYPE_ETHERNET;
1528 printf("Wrong number!!\n");
1532 rv = connection_get_mac_address(connection, conn_type, &mac_addr);
1534 if (rv != CONNECTION_ERROR_NONE) {
1535 printf("Fail to get MAC address [%s]\n", test_print_error(rv));
1539 printf("mac address is %s\n", mac_addr);
1546 int test_get_ethernet_cable_state(void)
1549 connection_ethernet_cable_state_e cable_state;
1551 rv = connection_get_ethernet_cable_state(connection, &cable_state);
1553 if (rv != CONNECTION_ERROR_NONE) {
1554 printf("Fail to get ethernet cable state [%s]\n", test_print_error(rv));
1558 printf("Retval = [%s], Ethernet cable state [%d]\n", test_print_error(rv), cable_state);
1563 int test_reset_profile(void)
1565 int type, sim_id, rv;
1567 rv = test_get_user_int("Input reset type (0:default profile reset, 1:delete profile reset)", &type);
1569 if (rv == false || (type != 0 && type != 1)) {
1570 printf("Invalid input!!\n");
1574 rv = test_get_user_int("Input SIM id to reset (0:SIM1, 1:SIM2)", &sim_id);
1576 if (rv == false || (sim_id != 0 && sim_id != 1)) {
1577 printf("Invalid input!!\n");
1581 if (connection_reset_profile(connection, type, sim_id, test_connection_reset_profile_callback, NULL) != CONNECTION_ERROR_NONE) {
1588 int main(int argc, char **argv)
1590 GMainLoop *mainloop;
1591 mainloop = g_main_loop_new (NULL, FALSE);
1593 GIOChannel *channel = g_io_channel_unix_new(0);
1594 g_io_add_watch(channel, (G_IO_IN|G_IO_ERR|G_IO_HUP|G_IO_NVAL), test_thread,NULL );
1596 printf("Test Thread created...\n");
1598 g_main_loop_run (mainloop);
1603 gboolean test_thread(GIOChannel *source, GIOCondition condition, gpointer data)
1608 memset(a, '\0', 100);
1609 printf("Event received from stdin\n");
1611 rv = read(0, a, 100);
1613 if (rv < 0 || a[0] == '0') {
1614 if (connection != NULL)
1615 test_deregister_client();
1620 if (*a == '\n' || *a == '\r'){
1621 printf("\n\n Network Connection API Test App\n\n");
1622 printf("Options..\n");
1623 printf("1 - Create Handle and set callbacks\n");
1624 printf("2 - Destroy Handle(unset callbacks automatically)\n");
1625 printf("3 - Get network state\n");
1626 printf("4 - Get cellular state (please insert SIM Card)\n");
1627 printf("5 - Get wifi state (please turn on WiFi)\n");
1628 printf("6 - Get current proxy address \n");
1629 printf("7 - Get current Ip address\n");
1630 printf("8 - Get cellular data call statistics\n");
1631 printf("9 - Get WiFi data call statistics\n");
1632 printf("a - Get Profile list\n");
1633 printf("b - Get Connected Profile list\n");
1634 printf("c - Get Current profile\n");
1635 printf("d - Open connection with profile\n");
1636 printf("e - Get default cellular service by type\n");
1637 printf("f - Set default cellular service by type\n");
1638 printf("g - Close connection with profile\n");
1639 printf("h - Add profile(Cellular only)\n");
1640 printf("i - Remove profile(Cellular:delete, WiFi:forgot)\n");
1641 printf("j - Update profile\n");
1642 printf("k - Get profile info\n");
1643 printf("l - Refresh profile info\n");
1644 printf("m - Set state changed callback\n");
1645 printf("n - Unset state changed callback\n");
1646 printf("o - Reset cellular data call statistics\n");
1647 printf("p - Reset WiFi data call statistics\n");
1648 printf("q - Add new route\n");
1649 printf("r - Remove a route\n");
1650 printf("s - Get Bluetooth state\n");
1651 printf("t - Get profile id\n");
1652 printf("u - Reset profile\n");
1653 printf("v - Get all cellular default profiles\n");
1654 printf("w - Get mac address\n");
1655 printf("x - Get ethernet cable state\n");
1656 printf("0 - Exit \n");
1657 printf("ENTER - Show options menu.......\n");
1662 rv = test_register_client();
1665 rv = test_deregister_client();
1668 rv = test_get_network_state();
1671 rv = test_get_cellular_state();
1674 rv = test_get_wifi_state();
1677 rv = test_get_current_proxy();
1680 rv = test_get_current_ip();
1683 rv = test_get_call_statistics_info();
1686 rv = test_get_wifi_call_statistics_info();
1689 rv = test_get_profile_list();
1692 rv = test_get_connected_profile_list();
1695 rv = test_get_current_profile();
1698 rv = test_open_profile();
1701 rv = test_get_default_cellular_service_type();
1704 rv = test_set_default_cellular_service_type();
1707 rv = test_close_profile();
1710 rv = test_add_profile();
1713 rv = test_remove_profile();
1716 rv = test_update_profile();
1719 rv = test_get_profile_info();
1722 rv = test_refresh_profile_info();
1725 rv = test_set_state_changed_callback();
1728 rv = test_unset_state_changed_callback();
1731 rv = test_reset_call_statistics_info();
1734 rv = test_reset_wifi_call_statistics_info();
1737 rv = test_add_route();
1740 rv = test_remove_route();
1743 rv = test_get_bt_state();
1746 rv = test_get_profile_id();
1749 rv = test_reset_profile();
1752 rv = test_get_default_profile_list();
1755 rv = test_get_mac_address();
1758 rv = test_get_ethernet_cable_state();
1763 printf("Operation succeeded!\n");
1765 printf("Operation failed!\n");