gchar profile_name[INM_PROFILE_NAME_LEN_MAX + 1];
} inm_profile_name_s;
-static method_param_s tel_method_params[] = {
- {
- .bus_name = TELEPHONY_SERVICE,
- .object_path = TELEPHONY_MASTER_PATH,
- .interface_name = TELEPHONY_MASTER_INTERFACE,
- .method_name = "GetModems",
- .parameters = NULL,
- },
- {
- .bus_name = TELEPHONY_SERVICE,
- .object_path = NULL,
- .interface_name = TELEPHONY_MODEM_INTERFACE,
- .method_name = "GetProfileList",
- .parameters = NULL,
- },
- {
- .bus_name = TELEPHONY_SERVICE,
- .object_path = NULL,
- .interface_name = TELEPHONY_PROFILE_INTERFACE,
- .method_name = "GetProfile",
- .parameters = NULL,
- },
-};
-
static void __get_modem_properties(GVariant *reply, gpointer user_data)
{
GVariantIter *iter = NULL;
int ret = 0;
__INM_FUNC_ENTER__;
+ method_param_s tel_method_params = {
+ .bus_name = TELEPHONY_SERVICE,
+ .object_path = TELEPHONY_MASTER_PATH,
+ .interface_name = TELEPHONY_MASTER_INTERFACE,
+ .method_name = "GetModems",
+ .parameters = NULL,
+ };
ret = inm_gdbus_method_call(
- &(tel_method_params[TELEPHONY_CMD_GET_MODEMS]),
+ &tel_method_params,
__get_modem_properties,
(gpointer)modem_path_list);
if (ret != INM_GDBUS_ERROR_NONE) {
int ret = 0;
__INM_FUNC_ENTER__;
+ method_param_s tel_method_params = {
+ .bus_name = TELEPHONY_SERVICE,
+ .object_path = NULL,
+ .interface_name = TELEPHONY_MODEM_INTERFACE,
+ .method_name = "GetProfileList",
+ .parameters = NULL,
+ };
ret = __get_modem_object_path(&modem_path_list);
if (ret < 0) {
path = (const char *)list->data;
INM_LOGI("path: %s", path);
- tel_method_params[TELEPHONY_CMD_GET_PROFILE_LIST].object_path = path;
+ tel_method_params.object_path = path;
ret = inm_gdbus_method_call(
- &(tel_method_params[TELEPHONY_CMD_GET_PROFILE_LIST]),
+ &tel_method_params,
__get_profiles,
(gpointer)&profile_list);
if (ret != INM_GDBUS_ERROR_NONE)
if (idx >= profile_cnt) {
INM_LOGW("There is no matching PDP profiles");
ret = -1;;
- } else {
- g_strlcpy(profile_info->profile_name,
- profile_list[idx].profile_name, INM_PROFILE_NAME_LEN_MAX);
- }
+ } else
+ CHECK_STRING_AND_COPY(profile_list[idx].profile_name,
+ profile_info->profile_name);
g_free(profile_list);
static inline void __get_path(const gchar *value, inm_telephony_profile_s *profile_info)
{
if (value != NULL)
- g_strlcpy(profile_info->profile_name, value, INM_PROFILE_NAME_LEN_MAX);
+ CHECK_STRING_AND_COPY(value,
+ profile_info->profile_name);
}
static inline void __get_svc_ctg_id(const gchar *value, inm_telephony_profile_s *profile_info)
static inline void __get_apn(const gchar *value, inm_telephony_profile_s *profile_info)
{
if (value != NULL)
- g_strlcpy(profile_info->apn, value, INM_PDP_APN_LEN_MAX);
+ CHECK_STRING_AND_COPY(value,
+ profile_info->apn);
}
static inline void __get_pdp_protocol(const gchar *value, inm_telephony_profile_s *profile_info)
static inline void __get_user_name(const gchar *value, inm_telephony_profile_s *profile_info)
{
if (value != NULL)
- g_strlcpy(profile_info->auth_info.user_name, value, INM_PDP_AUTH_USERNAME_LEN_MAX);
-
+ CHECK_STRING_AND_COPY(value,
+ profile_info->auth_info.user_name);
}
static inline void __get_password(const gchar *value, inm_telephony_profile_s *profile_info)
{
if (value != NULL)
- g_strlcpy(profile_info->auth_info.password, value, INM_PDP_AUTH_PASSWORD_LEN_MAX);
+ CHECK_STRING_AND_COPY(value,
+ profile_info->auth_info.password);
}
static inline void __get_proxy_addr(const gchar *value, inm_telephony_profile_s *profile_info)
{
if (value != NULL)
- g_strlcpy(profile_info->proxy_addr, value, NET_PROXY_LEN_MAX);
+ CHECK_STRING_AND_COPY(value,
+ profile_info->proxy_addr);
}
static inline void __get_home_url(const gchar *value, inm_telephony_profile_s *profile_info)
{
if (value != NULL)
- g_strlcpy(profile_info->home_url, value, INM_HOME_URL_LEN_MAX);
+ CHECK_STRING_AND_COPY(value,
+ profile_info->home_url);
}
static inline void __get_default_conn(const gchar *value, inm_telephony_profile_s *profile_info)
static inline void __get_keyword(const gchar *value, inm_telephony_profile_s *profile_info)
{
if (value != NULL)
- g_strlcpy(profile_info->keyword, value, INM_PDP_APN_LEN_MAX);
+ CHECK_STRING_AND_COPY(value,
+ profile_info->keyword);
}
static inline void __get_editable(const gchar *value, inm_telephony_profile_s *profile_info)
return -1;
}
- tel_method_params[TELEPHONY_CMD_GET_PROFILE].object_path = profile_info->profile_name;
+ method_param_s tel_method_params = {
+
+ .bus_name = TELEPHONY_SERVICE,
+ .object_path = NULL,
+ .interface_name = TELEPHONY_PROFILE_INTERFACE,
+ .method_name = "GetProfile",
+ .parameters = NULL,
+ };
+
+ tel_method_params.object_path = profile_info->profile_name;
ret = inm_gdbus_method_call(
- &(tel_method_params[TELEPHONY_CMD_GET_PROFILE]),
+ &tel_method_params,
__get_profile_properties,
(gpointer)profile_info);
if (ret != INM_GDBUS_ERROR_NONE) {
__INM_FUNC_EXIT__;
return 0;
}
+void inm_telephony_destroy_pdp_profile(inm_telephony_profile_s *profile_info)
+{
+ __INM_FUNC_ENTER__;
+ if (!profile_info)
+ return;
+
+ g_free(profile_info->profile_name);
+ profile_info->profile_name = NULL;
+ g_free(profile_info->apn);
+ profile_info->apn = NULL;
+ g_free(profile_info->auth_info.password);
+ profile_info->auth_info.password = NULL;
+ g_free(profile_info->auth_info.user_name);
+ profile_info->auth_info.user_name = NULL;
+ g_free(profile_info->proxy_addr);
+ profile_info->proxy_addr = NULL;
+ g_free(profile_info->home_url);
+ profile_info->home_url = NULL;
+ g_free(profile_info->keyword);
+ profile_info->keyword = NULL;
+
+ __INM_FUNC_EXIT__;
+}