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.
25 #define NETCONFIG_ERROR_INTERFACE NETCONFIG_SERVICE ".Error"
26 #define CONNMAN_AGENT_ERROR_INTERFACE "net.connman.Agent.Error"
28 GQuark netconfig_error_quark(void)
30 static GQuark quark = 0;
33 quark = g_quark_from_static_string("netconfig_error");
38 GQuark netconfig_connman_agent_error_quark(void)
40 static GQuark quark = 0;
43 quark = g_quark_from_static_string("netconfig_connman_agent_error");
48 void netconfig_error_no_profile(GDBusMethodInvocation *context)
50 g_dbus_method_invocation_return_error(context, netconfig_error_quark(),
51 NETCONFIG_ERROR_NO_PROFILE,
52 NETCONFIG_ERROR_INTERFACE ".NoProfile");
55 void netconfig_error_inprogress(GDBusMethodInvocation *context)
57 g_dbus_method_invocation_return_error(context, netconfig_error_quark(),
58 NETCONFIG_ERROR_INPROGRESS,
59 NETCONFIG_ERROR_INTERFACE ".InProgress");
62 void netconfig_error_already_exists(GDBusMethodInvocation *context)
64 g_dbus_method_invocation_return_error(context, netconfig_error_quark(),
65 NETCONFIG_ERROR_ALREADYEXISTS,
66 NETCONFIG_ERROR_INTERFACE ".AlreadyExists");
69 void netconfig_error_invalid_parameter(GDBusMethodInvocation *context)
71 g_dbus_method_invocation_return_error(context, netconfig_error_quark(),
72 NETCONFIG_ERROR_INVALID_PARAMETER,
73 NETCONFIG_ERROR_INTERFACE ".InvalidParameter");
76 void netconfig_error_permission_denied(GDBusMethodInvocation *context)
78 g_dbus_method_invocation_return_error(context, netconfig_error_quark(),
79 NETCONFIG_ERROR_PERMISSION_DENIED,
80 NETCONFIG_ERROR_INTERFACE ".PermissionDenied");
83 void netconfig_error_wifi_driver_failed(GDBusMethodInvocation *context)
85 g_dbus_method_invocation_return_error(context, netconfig_error_quark(),
86 NETCONFIG_ERROR_WIFI_DRIVER_FAILURE,
87 NETCONFIG_ERROR_INTERFACE ".WifiDriverFailed");
90 void netconfig_error_wifi_direct_failed(GDBusMethodInvocation *context)
92 g_dbus_method_invocation_return_error(context, netconfig_error_quark(),
93 NETCONFIG_ERROR_WIFI_DRIVER_FAILURE,
94 NETCONFIG_ERROR_INTERFACE ".WifiDirectFailed");
97 void netconfig_error_fail_get_imsi(GDBusMethodInvocation *context)
99 g_dbus_method_invocation_return_error(context, netconfig_error_quark(),
100 NETCONFIG_ERROR_FAILED_GET_IMSI,
101 NETCONFIG_ERROR_INTERFACE".FailGetSimImsi");
104 void netconfig_error_fail_req_sim_auth(GDBusMethodInvocation *context)
106 g_dbus_method_invocation_return_error(context, netconfig_error_quark(),
107 NETCONFIG_ERROR_FAILED_REQ_SIM_AUTH,
108 NETCONFIG_ERROR_INTERFACE".FailReqSimAuth");
111 void netconfig_error_fail_req_sim_auth_wrong_param(GDBusMethodInvocation *context)
113 g_dbus_method_invocation_return_error(context, netconfig_error_quark(),
114 NETCONFIG_ERROR_FAILED_REQ_SIM_AUTH_WRONG_PARAM,
115 NETCONFIG_ERROR_INTERFACE".FailReqSimAuthWrongParam");
118 void netconfig_error_fail_get_sim_auth_wrong_data(GDBusMethodInvocation *context)
120 g_dbus_method_invocation_return_error(context, netconfig_error_quark(),
121 NETCONFIG_ERROR_FAILED_GET_SIM_AUTH_WRONG_DATA,
122 NETCONFIG_ERROR_INTERFACE".FailGetSimAuthWrongData");
125 void netconfig_error_fail_get_sim_auth_delay(GDBusMethodInvocation *context)
127 g_dbus_method_invocation_return_error(context, netconfig_error_quark(),
128 NETCONFIG_ERROR_FAILED_GET_SIM_AUTH_DELAY,
129 NETCONFIG_ERROR_INTERFACE".FailGetSimAuthDelay");
132 void netconfig_error_fail_save_congifuration(GDBusMethodInvocation *context)
134 g_dbus_method_invocation_return_error(context, netconfig_error_quark(),
135 NETCONFIG_ERROR_INTERNAL,
136 NETCONFIG_ERROR_INTERFACE".FailSaveConfiguration");
139 void netconfig_error_fail_ethernet_cable_state(GDBusMethodInvocation *context)
141 g_dbus_method_invocation_return_error(context, netconfig_error_quark(),
142 NETCONFIG_ERROR_INTERNAL,
143 NETCONFIG_ERROR_INTERFACE".FailGetEthernetCableState");
146 void netconfig_error_dbus_method_return(GDBusMethodInvocation *context, netconfig_error_e error, const gchar *message)
150 msg = g_strdup_printf("%s.%s", NETCONFIG_ERROR_INTERFACE, message);
151 g_dbus_method_invocation_return_error_literal(context, netconfig_error_quark(), error, msg);
156 void netconfig_error_init(void)
158 /* TODO: register GError domain to make error_name */
160 dbus_g_error_domain_register(NETCONFIG_ERROR_QUARK,
161 NETCONFIG_ERROR_INTERFACE,
164 dbus_g_error_domain_register(NETCONFIG_CONNMAN_AGENT_ERROR_QUARK,
165 CONNMAN_AGENT_ERROR_INTERFACE,