* @brief API to add the geofence. This will call the server API.
* @param[in] geofence_client - Client dbus handle
* @param[in] app_id - Caller's application ID
+* @param[in] place_id - place id for add geofence
* @param[in] latitude - latitude value if is a geopoint geofence
* @param[in] longitude - longitude value if it is a geopint geofence
* @param[in] radius - radius value if it is a geopoint geofence
* @param[in] bssid - bssid value if it is a wifi/BT geofence
+* @param[out] error_code - Error that has occured on the server side
* @return int
* @retval returns the fence-id of the geofence added
* @see geo_client_delete_geofence
*/
-int geo_client_add_geofence(geofence_client_dbus_h geofence_client, gchar *app_id, gint place_id, gint geofence_type, gdouble latitude, gdouble longitude, gint radius, const gchar *address, const gchar *bssid, const gchar *ssid);
+int geo_client_add_geofence(geofence_client_dbus_h geofence_client, gchar *app_id, gint place_id, gint geofence_type, gdouble latitude, gdouble longitude, gint radius, const gchar *address, const gchar *bssid, const gchar *ssid, gint *error_code);
/**
* @brief API to add the place. This will call the server API
* @param[in] geofence_client - Client dbus handle
* @param[in] app_id - Caller's application ID
* @param[in] place_name - Name of the place
+* @param[out] error_code - Error that has occured on the server side
* retval returns the place_id of the place added
* @see geo_client_delete_place
*/
-int geo_client_add_place(geofence_client_dbus_h geofence_client, gchar *appid, const gchar *place_name);
+int geo_client_add_place(geofence_client_dbus_h geofence_client, gchar *app_id, const gchar *place_name, gint *error_code);
/**
* @brief API to update the place. This will call the server API
handle->user_cb(sig, param, handle->user_data);
}
-EXPORT_API int geo_client_add_geofence(geofence_client_dbus_h geofence_client, gchar *app_id, gint place_id, gint geofence_type, gdouble latitude, gdouble longitude, gint radius, const gchar *address, const gchar *bssid, const gchar *ssid)
+EXPORT_API int geo_client_add_geofence(geofence_client_dbus_h geofence_client, gchar *app_id, gint place_id, gint geofence_type, gdouble latitude, gdouble longitude, gint radius, const gchar *address, const gchar *bssid, const gchar *ssid, gint *error_code)
{
GEOFENCE_CLIENT_LOGD("ENTER >>>");
g_return_val_if_fail(geofence_client, GEOFENCE_CLIENT_ERROR_PARAMETER);
GEOFENCE_CLIENT_LOGE("Fail to add geofence Error[%s]", error->message);
g_error_free(error);
}
+ if (error_code != NULL)
+ *error_code = GEOFENCE_CLIENT_ACCESS_DENIED;
}
g_object_unref(proxy);
} else {
if (error) {
GEOFENCE_CLIENT_LOGE("Fail to get proxy Error[%s]", error->message);
g_error_free(error);
- ret = GEOFENCE_CLIENT_ERROR_DBUS_CALL;
}
+ ret = GEOFENCE_CLIENT_ACCESS_DENIED;
}
return ret;
reg = g_dbus_proxy_call_sync(proxy, "GetGeofences", g_variant_new("(is)", place_id, app_id), G_DBUS_CALL_FLAGS_NONE, -1, NULL, &error);
if (reg) {
g_variant_get(reg, "(iiaa{sv})", &new_fence_cnt, &new_error_code, &iterator);
- *error_code = new_error_code;
+ if (error_code != NULL)
+ *error_code = new_error_code;
*fence_cnt = new_fence_cnt;
if (iterator == NULL)
GEOFENCE_CLIENT_LOGE("Iterator is null");
if (error) {
GEOFENCE_CLIENT_LOGE("Fail to get the list Error[%s]", error->message);
g_error_free(error);
- ret = GEOFENCE_CLIENT_ERROR_DBUS_CALL;
}
+ ret = GEOFENCE_CLIENT_ACCESS_DENIED;
}
g_object_unref(proxy);
} else {
if (error) {
GEOFENCE_CLIENT_LOGE("Fail to get proxy Error[%s]", error->message);
g_error_free(error);
- ret = GEOFENCE_CLIENT_ERROR_DBUS_CALL;
}
+ ret = GEOFENCE_CLIENT_ACCESS_DENIED;
}
return ret;
if (error) {
GEOFENCE_CLIENT_LOGE("Fail to get proxy Error[%s]", error->message);
g_error_free(error);
- ret = GEOFENCE_CLIENT_ERROR_DBUS_CALL;
}
+ ret = GEOFENCE_CLIENT_ACCESS_DENIED;
}
return ret;
}
if (error) {
GEOFENCE_CLIENT_LOGE("Fail to get proxy Error[%s]", error->message);
g_error_free(error);
- ret = GEOFENCE_CLIENT_ERROR_DBUS_CALL;
}
+ ret = GEOFENCE_CLIENT_ACCESS_DENIED;
}
return ret;
}
-EXPORT_API int geo_client_add_place(geofence_client_dbus_h geofence_client, gchar *app_id, const gchar *place_name)
+EXPORT_API int geo_client_add_place(geofence_client_dbus_h geofence_client, gchar *app_id, const gchar *place_name, gint *error_code)
{
/* add fence interface between App & geofence-server */
GEOFENCE_CLIENT_LOGD("ENTER >>>");
GEOFENCE_CLIENT_LOGE("Fail to add place Error[%s]", error->message);
g_error_free(error);
}
+ if (error_code != NULL)
+ *error_code = GEOFENCE_CLIENT_ACCESS_DENIED;
}
g_object_unref(proxy);
} else {
if (error) {
GEOFENCE_CLIENT_LOGE("Fail to get proxy Error[%s]", error->message);
g_error_free(error);
- ret = GEOFENCE_CLIENT_ERROR_DBUS_CALL;
}
+ ret = GEOFENCE_CLIENT_ACCESS_DENIED;
}
return ret;
if (error) {
GEOFENCE_CLIENT_LOGE("Fail to get proxy Error[%s]", error->message);
g_error_free(error);
- ret = GEOFENCE_CLIENT_ERROR_DBUS_CALL;
}
+ ret = GEOFENCE_CLIENT_ACCESS_DENIED;
}
return ret;
reg = g_dbus_proxy_call_sync(proxy, "GetPlaceName", g_variant_new("(is)", place_id, app_id), G_DBUS_CALL_FLAGS_NONE, -1, NULL, &error);
if (reg) {
g_variant_get(reg, "(is)", &new_error_code, &new_place_name);
- *error_code = new_error_code;
+ if (error_code != NULL)
+ *error_code = new_error_code;
*place_name = g_strdup(new_place_name);
g_free(new_place_name);
g_variant_unref(reg);
if (error) {
GEOFENCE_CLIENT_LOGE("Fail to get the place name Error[%s]", error->message);
g_error_free(error);
- ret = GEOFENCE_CLIENT_ERROR_DBUS_CALL;
}
+ ret = GEOFENCE_CLIENT_ACCESS_DENIED;
}
g_object_unref(proxy);
} else {
if (reg) {
g_variant_get(reg, "(iiaa{sv})", &new_place_cnt, &new_error_code, &iterator);
*place_cnt = new_place_cnt;
- *error_code = new_error_code;
+ if (error_code != NULL)
+ *error_code = new_error_code;
if (iterator == NULL)
GEOFENCE_CLIENT_LOGE("Iterator is null");
*iter = iterator;
if (error) {
GEOFENCE_CLIENT_LOGE("Fail to get the place list Error[%s]", error->message);
g_error_free(error);
- ret = GEOFENCE_CLIENT_ERROR_DBUS_CALL;
}
+ ret = GEOFENCE_CLIENT_ACCESS_DENIED;
}
g_object_unref(proxy);
} else {
if (error) {
GEOFENCE_CLIENT_LOGE("Fail to get proxy Error[%s]", error->message);
g_error_free(error);
- ret = GEOFENCE_CLIENT_ERROR_DBUS_CALL;
}
+ ret = GEOFENCE_CLIENT_ERROR_DBUS_CALL;
}
return ret;