return false;
}
- buf[buf_size - 1] = '\0';
+ buf[strlen(buf) - 1] = '\0';
return true;
}
printf("Connection close Failed, err : %d\n", result);
}
+static void test_connection_set_default_callback(connection_error_e result, void* user_data)
+{
+ if (result == CONNECTION_ERROR_NONE)
+ printf("Default profile setting Succeeded\n");
+ else
+ printf("Default profile setting Failed, err : %d\n", result);
+}
+
static bool test_get_user_selected_profile(connection_profile_h *profile, bool select)
{
int rv = 0;
{
connection_profile_h profile;
connection_cellular_service_type_e type;
+ int input, rv;
+
+ rv = test_get_user_int("Input API type (1:sync, 2:async)", &input);
+
+ if (rv == false || (input != 1 && input != 2)) {
+ printf("Invalid input!!\n");
+ return -1;
+ }
printf("\n** Choose a profile to set default service(internet or prepaid internet type only). **\n");
+
if (test_get_user_selected_profile(&profile, true) == false)
return -1;
return -1;
}
- if (connection_set_default_cellular_service_profile(connection, type, profile) != CONNECTION_ERROR_NONE)
- return -1;
+ if (input == 1) {
+ if (connection_set_default_cellular_service_profile(connection, type, profile) != CONNECTION_ERROR_NONE)
+ return -1;
+ } else {
+ if (connection_set_default_cellular_service_profile_async(connection,
+ type, profile, test_connection_set_default_callback, NULL) != CONNECTION_ERROR_NONE)
+ return -1;
+ }
return 1;
}