2 * Network Configuration Module
4 * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
26 #define NETCONFIG_ERROR_INTERFACE NETCONFIG_SERVICE ".Error"
27 #define CONNMAN_AGENT_ERROR_INTERFACE "net.connman.Agent.Error"
29 GQuark netconfig_error_quark(void)
31 static GQuark quark = 0;
34 quark = g_quark_from_static_string("netconfig_error");
39 GQuark netconfig_connman_agent_error_quark(void)
41 static GQuark quark = 0;
44 quark = g_quark_from_static_string("netconfig_connman_agent_error");
49 void netconfig_error_no_profile(GDBusMethodInvocation *context)
51 ERR("dbus method return error");
52 g_dbus_method_invocation_return_error(context, netconfig_error_quark(),
53 NETCONFIG_ERROR_NO_PROFILE,
54 NETCONFIG_ERROR_INTERFACE ".NoProfile");
57 void netconfig_error_inprogress(GDBusMethodInvocation *context)
59 ERR("dbus method return error");
60 g_dbus_method_invocation_return_error(context, netconfig_error_quark(),
61 NETCONFIG_ERROR_INPROGRESS,
62 NETCONFIG_ERROR_INTERFACE ".InProgress");
65 void netconfig_error_already_exists(GDBusMethodInvocation *context)
67 ERR("dbus method return error");
68 g_dbus_method_invocation_return_error(context, netconfig_error_quark(),
69 NETCONFIG_ERROR_ALREADYEXISTS,
70 NETCONFIG_ERROR_INTERFACE ".AlreadyExists");
73 void netconfig_error_invalid_parameter(GDBusMethodInvocation *context)
75 ERR("dbus method return error");
76 g_dbus_method_invocation_return_error(context, netconfig_error_quark(),
77 NETCONFIG_ERROR_INVALID_PARAMETER,
78 NETCONFIG_ERROR_INTERFACE ".InvalidParameter");
81 void netconfig_error_permission_denied(GDBusMethodInvocation *context)
83 ERR("dbus method return error");
84 g_dbus_method_invocation_return_error(context, netconfig_error_quark(),
85 NETCONFIG_ERROR_PERMISSION_DENIED,
86 NETCONFIG_ERROR_INTERFACE ".PermissionDenied");
89 void netconfig_error_wifi_driver_failed(GDBusMethodInvocation *context)
91 ERR("dbus method return error");
92 g_dbus_method_invocation_return_error(context, netconfig_error_quark(),
93 NETCONFIG_ERROR_WIFI_DRIVER_FAILURE,
94 NETCONFIG_ERROR_INTERFACE ".WifiDriverFailed");
97 void netconfig_error_wifi_direct_failed(GDBusMethodInvocation *context)
99 ERR("dbus method return error");
100 g_dbus_method_invocation_return_error(context, netconfig_error_quark(),
101 NETCONFIG_ERROR_WIFI_DRIVER_FAILURE,
102 NETCONFIG_ERROR_INTERFACE ".WifiDirectFailed");
105 EXPORT_SYM void netconfig_error_fail_get_imsi(GDBusMethodInvocation *context)
107 ERR("dbus method return error");
108 g_dbus_method_invocation_return_error(context, netconfig_error_quark(),
109 NETCONFIG_ERROR_FAILED_GET_IMSI,
110 NETCONFIG_ERROR_INTERFACE".FailGetSimImsi");
113 EXPORT_SYM void netconfig_error_fail_req_sim_auth(GDBusMethodInvocation *context)
115 ERR("dbus method return error");
116 g_dbus_method_invocation_return_error(context, netconfig_error_quark(),
117 NETCONFIG_ERROR_FAILED_REQ_SIM_AUTH,
118 NETCONFIG_ERROR_INTERFACE".FailReqSimAuth");
121 EXPORT_SYM void netconfig_error_fail_req_sim_auth_wrong_param(GDBusMethodInvocation *context)
123 ERR("dbus method return error");
124 g_dbus_method_invocation_return_error(context, netconfig_error_quark(),
125 NETCONFIG_ERROR_FAILED_REQ_SIM_AUTH_WRONG_PARAM,
126 NETCONFIG_ERROR_INTERFACE".FailReqSimAuthWrongParam");
129 EXPORT_SYM void netconfig_error_fail_get_sim_auth_wrong_data(GDBusMethodInvocation *context)
131 ERR("dbus method return error");
132 g_dbus_method_invocation_return_error(context, netconfig_error_quark(),
133 NETCONFIG_ERROR_FAILED_GET_SIM_AUTH_WRONG_DATA,
134 NETCONFIG_ERROR_INTERFACE".FailGetSimAuthWrongData");
137 EXPORT_SYM void netconfig_error_fail_get_sim_auth_delay(GDBusMethodInvocation *context)
139 ERR("dbus method return error");
140 g_dbus_method_invocation_return_error(context, netconfig_error_quark(),
141 NETCONFIG_ERROR_FAILED_GET_SIM_AUTH_DELAY,
142 NETCONFIG_ERROR_INTERFACE".FailGetSimAuthDelay");
145 void netconfig_error_fail_save_congifuration(GDBusMethodInvocation *context)
147 ERR("dbus method return error");
148 g_dbus_method_invocation_return_error(context, netconfig_error_quark(),
149 NETCONFIG_ERROR_INTERNAL,
150 NETCONFIG_ERROR_INTERFACE".FailSaveConfiguration");
153 void netconfig_error_fail_ethernet_cable_state(GDBusMethodInvocation *context)
155 g_dbus_method_invocation_return_error(context, netconfig_error_quark(),
156 NETCONFIG_ERROR_INTERNAL,
157 NETCONFIG_ERROR_INTERFACE".FailGetEthernetCableState");
160 #include <glib/gprintf.h>
161 void netconfig_error_dbus_method_return(GDBusMethodInvocation *context, netconfig_error_e error, const gchar *message)
165 ERR("dbus method return error");
167 msg = g_strdup_printf("%s.%s", NETCONFIG_ERROR_INTERFACE, message);
168 g_dbus_method_invocation_return_error(context, netconfig_error_quark(), error, "%s", msg);
173 void netconfig_error_init(void)
175 /* TODO: register GError domain to make error_name */
177 dbus_g_error_domain_register(NETCONFIG_ERROR_QUARK,
178 NETCONFIG_ERROR_INTERFACE,
181 dbus_g_error_domain_register(NETCONFIG_CONNMAN_AGENT_ERROR_QUARK,
182 CONNMAN_AGENT_ERROR_INTERFACE,