PXP: Modify APIs and Signal handle implementation 67/100967/2
authorh.sandeep <h.sandeep@samsung.com>
Thu, 24 Nov 2016 11:12:56 +0000 (16:42 +0530)
committerPyun DoHyun <dh79.pyun@samsung.com>
Wed, 30 Nov 2016 04:45:06 +0000 (20:45 -0800)
1. Add Seperate APIs for Monitor and reporter role.
2. Add implementation to moinotr the PID for reporter service.
3. Remove the property changed handler for monitor role.

Change-Id: I033bc604d7fc2971eecaa65647cec50af7f29840
Signed-off-by: h.sandeep <h.sandeep@samsung.com>
bt-api/bt-proximity.c
bt-service/bt-request-handler.c
bt-service/bt-service-event-receiver.c
bt-service/bt-service-proximity.c
bt-service/include/bt-service-proximity.h
include/bluetooth-api.h
include/bt-internal-types.h

index 6832e3f..8e63487 100644 (file)
@@ -22,7 +22,7 @@
 #include "bt-request-sender.h"
 #include "bt-event-handler.h"
 
-BT_EXPORT_API int bluetooth_set_proximity_property(const bluetooth_device_address_t *device_address,
+BT_EXPORT_API int bluetooth_proximity_monitor_set_property(const bluetooth_device_address_t *device_address,
                                                        bluetooth_pxp_poperty_t property, int value)
 {
        int result = BLUETOOTH_ERROR_INTERNAL;
@@ -38,7 +38,7 @@ BT_EXPORT_API int bluetooth_set_proximity_property(const bluetooth_device_addres
        g_array_append_vals(in_param2, &property, sizeof(int));
        g_array_append_vals(in_param3, &value, sizeof(int));
 
-       result = _bt_send_request(BT_BLUEZ_SERVICE, BT_PXP_SET_PROPERTY,
+       result = _bt_send_request(BT_BLUEZ_SERVICE, BT_PXP_MONITOR_SET_PROPERTY,
                in_param1, in_param2, in_param3, in_param4, &out_param);
 
        BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
@@ -46,7 +46,7 @@ BT_EXPORT_API int bluetooth_set_proximity_property(const bluetooth_device_addres
        return result;
 }
 
-BT_EXPORT_API int bluetooth_get_proximity_property(const bluetooth_device_address_t *device_address,
+BT_EXPORT_API int bluetooth_proximity_monitor_get_property(const bluetooth_device_address_t *device_address,
                                                        bluetooth_pxp_poperty_t property, int *value)
 {
        int result = BLUETOOTH_ERROR_INTERNAL;
@@ -61,7 +61,7 @@ BT_EXPORT_API int bluetooth_get_proximity_property(const bluetooth_device_addres
        g_array_append_vals(in_param1, device_address, sizeof(bluetooth_device_address_t));
        g_array_append_vals(in_param2, &property, sizeof(int));
 
-       result = _bt_send_request(BT_BLUEZ_SERVICE, BT_PXP_GET_PROPERTY,
+       result = _bt_send_request(BT_BLUEZ_SERVICE, BT_PXP_MONITOR_GET_PROPERTY,
                in_param1, in_param2, in_param3, in_param4, &out_param);
 
        if (result == BLUETOOTH_ERROR_NONE) {
@@ -78,7 +78,7 @@ BT_EXPORT_API int bluetooth_get_proximity_property(const bluetooth_device_addres
        return result;
 }
 
-BT_EXPORT_API int bluetooth_get_proximity_supported_services(const bluetooth_device_address_t *device_address,
+BT_EXPORT_API int bluetooth_proximity_monitor_get_supported_services(const bluetooth_device_address_t *device_address,
                                                        int *services_supported)
 {
        int result = BLUETOOTH_ERROR_INTERNAL;
@@ -92,7 +92,7 @@ BT_EXPORT_API int bluetooth_get_proximity_supported_services(const bluetooth_dev
 
        g_array_append_vals(in_param1, device_address, sizeof(bluetooth_device_address_t));
 
-       result = _bt_send_request(BT_BLUEZ_SERVICE, BT_PXP_GET_SUPPORTED_SERIVCES,
+       result = _bt_send_request(BT_BLUEZ_SERVICE, BT_PXP_MONITOR_GET_SUPPORTED_SERIVCES,
                in_param1, in_param2, in_param3, in_param4, &out_param);
 
        if (result == BLUETOOTH_ERROR_NONE) {
@@ -109,7 +109,7 @@ BT_EXPORT_API int bluetooth_get_proximity_supported_services(const bluetooth_dev
        return result;
 }
 
-BT_EXPORT_API int bluetooth_register_proximity_reporter()
+BT_EXPORT_API int bluetooth_proximity_reporter_register()
 {
        int result = BLUETOOTH_ERROR_INTERNAL;
 
@@ -119,7 +119,7 @@ BT_EXPORT_API int bluetooth_register_proximity_reporter()
        BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
        BT_DBG("");
 
-       result = _bt_send_request(BT_BLUEZ_SERVICE, BT_PXP_REGISTER_REPORTER,
+       result = _bt_send_request(BT_BLUEZ_SERVICE, BT_PXP_REPORTER_REGISTER,
                in_param1, in_param2, in_param3, in_param4, &out_param);
 
        BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
@@ -127,7 +127,7 @@ BT_EXPORT_API int bluetooth_register_proximity_reporter()
        return result;
 }
 
-BT_EXPORT_API int bluetooth_unregister_proximity_reporter()
+BT_EXPORT_API int bluetooth_proximity_reporter_unregister()
 {
        int result = BLUETOOTH_ERROR_INTERNAL;
 
@@ -137,10 +137,42 @@ BT_EXPORT_API int bluetooth_unregister_proximity_reporter()
        BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
        BT_DBG("");
 
-       result = _bt_send_request(BT_BLUEZ_SERVICE, BT_PXP_UNREGISTER_REPORTER,
+       result = _bt_send_request(BT_BLUEZ_SERVICE, BT_PXP_REPORTER_UNREGISTER,
                in_param1, in_param2, in_param3, in_param4, &out_param);
 
        BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
 
        return result;
 }
+
+BT_EXPORT_API int bluetooth_proximity_reporter_get_property(const bluetooth_device_address_t *device_address,
+                                                       bluetooth_pxp_poperty_t property, int *value)
+{
+       int result = BLUETOOTH_ERROR_INTERNAL;
+
+       BT_CHECK_PARAMETER(device_address, return);
+       BT_CHECK_ENABLED(return);
+
+       BT_INIT_PARAMS();
+       BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+       BT_DBG("");
+
+       g_array_append_vals(in_param1, device_address, sizeof(bluetooth_device_address_t));
+       g_array_append_vals(in_param2, &property, sizeof(int));
+
+       result = _bt_send_request(BT_BLUEZ_SERVICE, BT_PXP_REPORTER_GET_PROPERTY,
+               in_param1, in_param2, in_param3, in_param4, &out_param);
+
+       if (result == BLUETOOTH_ERROR_NONE) {
+               if (out_param->len > 0) {
+                       *value = g_array_index(out_param,
+                                       int, 0);
+               } else {
+                       BT_ERR("out_param length is 0!!");
+               }
+       }
+
+       BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+
+       return result;
+}
index ea03d59..9f9122f 100644 (file)
@@ -2108,7 +2108,7 @@ int __bt_bluez_request(int function_name,
 
                break;
        }
-       case BT_PXP_SET_PROPERTY: {
+       case BT_PXP_MONITOR_SET_PROPERTY: {
                bluetooth_device_address_t address = { {0} };
                unsigned int property = 0;
                unsigned int value = 0;
@@ -2120,10 +2120,10 @@ int __bt_bluez_request(int function_name,
                __bt_service_get_parameters(in_param3,
                                &value, sizeof(int));
 
-               result = bt_set_proximity_property(&address, property, value);
+               result = _bt_proximity_monitor_set_property(&address, property, value);
                break;
        }
-       case BT_PXP_GET_PROPERTY: {
+       case BT_PXP_MONITOR_GET_PROPERTY: {
                bluetooth_device_address_t address = { {0} };
                unsigned int property = 0;
                int value = 0;
@@ -2133,33 +2133,54 @@ int __bt_bluez_request(int function_name,
                __bt_service_get_parameters(in_param2,
                                &property, sizeof(unsigned int));
 
-               result = bt_get_proximity_property(&address, property, &value);
+               result = _bt_proximity_monitor_get_property(&address, property, &value);
                if (result == BLUETOOTH_ERROR_NONE) {
                        g_array_append_vals(*out_param1, &value,
                                                sizeof(int));
                }
                break;
        }
-       case BT_PXP_GET_SUPPORTED_SERIVCES: {
+       case BT_PXP_MONITOR_GET_SUPPORTED_SERIVCES: {
                bluetooth_device_address_t address = { {0} };
                unsigned int property = 0;
 
                __bt_service_get_parameters(in_param1,
                                &address, sizeof(bluetooth_device_address_t));
 
-               result = bt_get_proximity_supported_services(&address, &property);
+               result = _bt_proximity_monitor_get_supported_services(&address, &property);
                if (result == BLUETOOTH_ERROR_NONE) {
                        g_array_append_vals(*out_param1, &property,
                                                sizeof(int));
                }
                break;
        }
-       case BT_PXP_REGISTER_REPORTER: {
-               result = bt_register_proximity_reporter();
+       case BT_PXP_REPORTER_REGISTER: {
+               char *sender = NULL;
+               sender = (char *)g_dbus_method_invocation_get_sender(context);
+               result = _bt_proximity_reporter_register(sender);
+               break;
+       }
+       case BT_PXP_REPORTER_UNREGISTER: {
+               char *sender = NULL;
+               sender = (char *)g_dbus_method_invocation_get_sender(context);
+               result = _bt_proximity_reporter_unregister(sender);
                break;
        }
-       case BT_PXP_UNREGISTER_REPORTER: {
-               result = bt_unregister_proximity_reporter();
+       case BT_PXP_REPORTER_GET_PROPERTY: {
+               bluetooth_device_address_t address = { {0} };
+               unsigned int property = 0;
+               int value = 0;
+
+               __bt_service_get_parameters(in_param1,
+                               &address, sizeof(bluetooth_device_address_t));
+               __bt_service_get_parameters(in_param2,
+                               &property, sizeof(unsigned int));
+
+               result = _bt_proximity_reporter_get_property(&address, property, &value);
+               if (result == BLUETOOTH_ERROR_NONE) {
+                       g_array_append_vals(*out_param1, &value,
+                                               sizeof(int));
+               }
                break;
        }
        default:
@@ -2868,11 +2889,12 @@ gboolean __bt_service_check_privilege(int function_name,
        case BT_LE_IPSP_DEINIT:
        case BT_LE_IPSP_CONNECT:
        case BT_LE_IPSP_DISCONNECT:
-       case BT_PXP_SET_PROPERTY:
-       case BT_PXP_GET_PROPERTY:
-       case BT_PXP_GET_SUPPORTED_SERIVCES:
-       case BT_PXP_REGISTER_REPORTER:
-       case BT_PXP_UNREGISTER_REPORTER:
+       case BT_PXP_MONITOR_SET_PROPERTY:
+       case BT_PXP_MONITOR_GET_PROPERTY:
+       case BT_PXP_MONITOR_GET_SUPPORTED_SERIVCES:
+       case BT_PXP_REPORTER_REGISTER:
+       case BT_PXP_REPORTER_UNREGISTER:
+       case BT_PXP_REPORTER_GET_PROPERTY:
        ret_val = cynara_check(p_cynara, client_creds, client_session, user_creds,
                                BT_PRIVILEGE_PLATFORM);
 
index 616d446..89754be 100644 (file)
@@ -1399,10 +1399,6 @@ void _bt_handle_property_changed_event(GVariant *msg, const char *object_path)
                BT_DBG("BT_PROXIMITY_REPORTER_INTERFACE");
                _bt_handle_pxp_property_changed_event(val,
                                        object_path, BT_PXP_REPORTER_ROLE);
-       } else if (strcasecmp(interface_name, BT_PROXIMITY_MONITOR_INTERFACE) == 0) {
-               BT_DBG("BT_PROXIMITY_MONITOR_INTERFACE");
-               _bt_handle_pxp_property_changed_event(val,
-                                       object_path, BT_PXP_MONITOR_ROLE);
        }
        g_variant_unref(val);
 }
@@ -2822,6 +2818,10 @@ static  void __bt_manager_event_filter(GDBusConnection *connection,
                _bt_stop_advertising_by_terminated_process(name);
                /* Stop LE Scan */
                _bt_stop_le_scan(name);
+
+               /* Stop the Proximity reporter service */
+               _bt_proximity_reporter_stop_by_terminated_process(name);
+
                g_free(name);
                g_free(previous);
                g_free(current);
index ad1cf28..f78e301 100644 (file)
@@ -30,7 +30,9 @@
 #include "bt-service-device.h"
 #include "bt-service-proximity.h"
 
-char *_bt_convert_alert_level_to_string(int value)
+GSList *reporter_list = NULL;
+
+static char *_bt_convert_alert_level_to_string(int value)
 {
        if (value == BT_PXP_ALERT_MILD)
                return g_strdup("mild");
@@ -40,7 +42,7 @@ char *_bt_convert_alert_level_to_string(int value)
                return g_strdup("none");
 }
 
-int _bt_convert_string_to_alert_level(const char *str)
+static int _bt_convert_string_to_alert_level(const char *str)
 {
        if (g_strcmp0("high", str) == 0)
                return BT_PXP_ALERT_HIGH;
@@ -50,7 +52,19 @@ int _bt_convert_string_to_alert_level(const char *str)
        return BT_PXP_ALERT_NONE;
 }
 
-char *_bt_convert_property_to_string(int value)
+static int _bt_convert_string_to_signal_level(const char *str)
+{
+       if (g_strcmp0("good", str) == 0)
+               return BT_PXP_SIGNAL_GOOD;
+       else if (g_strcmp0("regular", str) == 0)
+               return BT_PXP_SIGNAL_REGULAR;
+       else if (g_strcmp0("weak", str) == 0)
+               return BT_PXP_SIGNAL_WEAK;
+
+       return BT_PXP_SIGNAL_NONE;
+}
+
+static char *_bt_convert_property_to_string(int value)
 {
        if (value == BT_PXP_PROPERTY_LLS)
                return g_strdup("LinkLossAlertLevel");
@@ -62,7 +76,20 @@ char *_bt_convert_property_to_string(int value)
        return NULL;
 }
 
-int bt_set_proximity_property(bluetooth_device_address_t *device_address,
+static char *_bt_proximity_reporter_find_from_list(const char *reporter_name)
+{
+       GSList *l;
+       char *reporter = NULL;
+
+       for (l = reporter_list; l != NULL; l = g_slist_next(l)) {
+               reporter = l->data;
+               if (reporter && g_strcmp0(reporter, reporter_name) == 0)
+                       return reporter;
+       }
+       return NULL;
+}
+
+int _bt_proximity_monitor_set_property(bluetooth_device_address_t *device_address,
                unsigned int property, int alert_level)
 {
        GDBusProxy *proxy;
@@ -129,8 +156,8 @@ int bt_set_proximity_property(bluetooth_device_address_t *device_address,
        return BLUETOOTH_ERROR_NONE;
 }
 
-int bt_get_proximity_property(bluetooth_device_address_t *device_address,
-               unsigned int property, int *alert_level)
+int _bt_proximity_monitor_get_property(bluetooth_device_address_t *device_address,
+               unsigned int property, int *level)
 {
        GDBusProxy *proxy;
        char address[BT_ADDRESS_STRING_SIZE] = { 0 };
@@ -192,19 +219,96 @@ int bt_get_proximity_property(bluetooth_device_address_t *device_address,
        }
 
        value_str = (char *)g_variant_get_string(tmp_value, NULL);
+       if (value_str) {
+               if (property != BT_PXP_PROPERTY_TX_POWER)
+                       *level = _bt_convert_string_to_alert_level(value_str);
+               else
+                       *level = _bt_convert_string_to_signal_level(value_str);
+       }
+
+       g_variant_unref(tmp_value);
+       g_variant_unref(value);
+       g_object_unref(proxy);
+       g_free(property_str);
+
+       return BLUETOOTH_ERROR_NONE;
+}
+
+int _bt_proximity_reporter_get_property(bluetooth_device_address_t *device_address,
+               unsigned int property, int *level)
+{
+       GDBusProxy *proxy;
+       char address[BT_ADDRESS_STRING_SIZE] = { 0 };
+       GDBusConnection *conn;
+       char *device_path = NULL;
+       GError *error = NULL;
+       GVariant *result = NULL;
+       GVariant *tmp_value;
+       GVariant *value;
+       char *value_str = NULL;
+       char *property_str = NULL;
+
+       BT_CHECK_PARAMETER(device_address, return);
+
+       conn = _bt_gdbus_get_system_gconn();
+       retv_if(conn == NULL, BLUETOOTH_ERROR_INTERNAL);
+
+       _bt_convert_addr_type_to_string(address, device_address->addr);
+
+       device_path = _bt_get_device_object_path(address);
+       retv_if(device_path == NULL, BLUETOOTH_ERROR_NOT_CONNECTED);
+
+       BT_INFO("device_path is created[%s]", device_path);
+
+       property_str = _bt_convert_property_to_string(property);
+
+       if (property_str == NULL)
+               return BLUETOOTH_ERROR_INTERNAL;
+
+       proxy = g_dbus_proxy_new_sync(conn, G_DBUS_PROXY_FLAGS_NONE,
+                                                       NULL, BT_BLUEZ_NAME,
+                                                       device_path, BT_PROPERTIES_INTERFACE,  NULL, NULL);
+
+       g_free(device_path);
+       retv_if(proxy == NULL, BLUETOOTH_ERROR_INTERNAL);
+
+       result = g_dbus_proxy_call_sync(proxy, "GetAll",
+                       g_variant_new("(s)", BT_PROXIMITY_REPORTER_INTERFACE),
+                       G_DBUS_CALL_FLAGS_NONE,
+                       -1,
+                       NULL,
+                       &error);
+       if (result == NULL) {
+               if (error != NULL) {
+                       BT_ERR("Error occured in Proxy call [%s]\n", error->message);
+                       g_error_free(error);
+               }
+               g_object_unref(proxy);
+               return BLUETOOTH_ERROR_INTERNAL;
+       }
+       g_variant_get(result , "(@a{sv})", &value);
+       g_variant_unref(result);
+
+       tmp_value = g_variant_lookup_value(value, property_str, G_VARIANT_TYPE_STRING);
+       if (tmp_value == NULL) {
+               g_object_unref(proxy);
+               g_variant_unref(value);
+               return BLUETOOTH_ERROR_INTERNAL;
+       }
+
+       value_str = (char *)g_variant_get_string(tmp_value, NULL);
        if (value_str)
-               *alert_level = _bt_convert_string_to_alert_level(value_str);
+               *level = _bt_convert_string_to_alert_level(value_str);
 
        g_variant_unref(tmp_value);
        g_variant_unref(value);
        g_object_unref(proxy);
        g_free(property_str);
-       g_free(value_str);
 
        return BLUETOOTH_ERROR_NONE;
 }
 
-int bt_get_proximity_supported_services(bluetooth_device_address_t *device_address,
+int _bt_proximity_monitor_get_supported_services(bluetooth_device_address_t *device_address,
                unsigned int *supported_services)
 {
        GDBusProxy *proxy;
@@ -294,18 +398,22 @@ int bt_get_proximity_supported_services(bluetooth_device_address_t *device_addre
        return BLUETOOTH_ERROR_NONE;
 }
 
-int bt_register_proximity_reporter()
+int _bt_proximity_reporter_register(const char *sender)
 {
        GDBusProxy *proxy;
 
        GDBusConnection *conn;
        char *adapter_path = NULL;
+       char *reporter = NULL;
        GError *error = NULL;
        GVariant *result = NULL;
 
        conn = _bt_gdbus_get_system_gconn();
        retv_if(conn == NULL, BLUETOOTH_ERROR_INTERNAL);
 
+       if (_bt_proximity_reporter_find_from_list(sender))
+               return BLUETOOTH_ERROR_ALREADY_INITIALIZED;
+
        adapter_path = _bt_get_adapter_path();
        if (adapter_path == NULL) {
                BT_ERR("Could not get adapter path\n");
@@ -332,12 +440,15 @@ int bt_register_proximity_reporter()
                g_object_unref(proxy);
                return BLUETOOTH_ERROR_INTERNAL;
        }
+       reporter = g_strdup(sender);
+       reporter_list = g_slist_append(reporter_list, reporter);
+
        g_object_unref(proxy);
 
        return BLUETOOTH_ERROR_NONE;
 }
 
-int bt_unregister_proximity_reporter()
+int _bt_proximity_reporter_unregister(const char *sender)
 {
        GDBusProxy *proxy;
 
@@ -345,10 +456,15 @@ int bt_unregister_proximity_reporter()
        char *adapter_path = NULL;
        GError *error = NULL;
        GVariant *result = NULL;
+       char *reporter = NULL;
 
        conn = _bt_gdbus_get_system_gconn();
        retv_if(conn == NULL, BLUETOOTH_ERROR_INTERNAL);
 
+       reporter = _bt_proximity_reporter_find_from_list(sender);
+       if (!reporter)
+               return BLUETOOTH_ERROR_NOT_INITIALIZED;
+
        adapter_path = _bt_get_adapter_path();
        if (adapter_path == NULL) {
                BT_ERR("Could not get adapter path\n");
@@ -375,7 +491,18 @@ int bt_unregister_proximity_reporter()
                g_object_unref(proxy);
                return BLUETOOTH_ERROR_INTERNAL;
        }
+       reporter_list = g_slist_remove(reporter_list, reporter);
+       g_free(reporter);
+
        g_object_unref(proxy);
 
        return BLUETOOTH_ERROR_NONE;
 }
+
+void _bt_proximity_reporter_stop_by_terminated_process(const char *terminated_name)
+{
+       if (!_bt_proximity_reporter_find_from_list(terminated_name))
+               return;
+       BT_ERR("Stop Proximity Reporter by terminated process(%s).", terminated_name);
+       _bt_proximity_reporter_unregister(terminated_name);
+}
index a4d81c9..eab0bb2 100644 (file)
@@ -35,6 +35,13 @@ typedef enum {
 } bt_proximity_alert_value_t;
 
 typedef enum {
+       BT_PXP_SIGNAL_NONE = 0,
+       BT_PXP_SIGNAL_GOOD,
+       BT_PXP_SIGNAL_REGULAR,
+       BT_PXP_SIGNAL_WEAK
+} bt_proximity_signal_level_t;
+
+typedef enum {
        BT_PXP_PROPERTY_LLS = 0x01,
        BT_PXP_PROPERTY_IAS = 0x02,
        BT_PXP_PROPERTY_TX_POWER = 0x04
@@ -45,18 +52,23 @@ typedef enum {
        BT_PXP_MONITOR_ROLE = 0x01,
 } bt_proximity_role_t;
 
-int bt_set_proximity_property(bluetooth_device_address_t *device_address,
-               unsigned int property, int value);
+int _bt_proximity_monitor_set_property(bluetooth_device_address_t *device_address,
+               unsigned int property, int alert_level);
 
-int bt_get_proximity_property(bluetooth_device_address_t *device_address,
-               unsigned int property, int *value);
+int _bt_proximity_monitor_get_property(bluetooth_device_address_t *device_address,
+               unsigned int property, int *level);
 
-int bt_get_proximity_supported_services(bluetooth_device_address_t *device_address,
+int _bt_proximity_monitor_get_supported_services(bluetooth_device_address_t *device_address,
                unsigned int *supported_services);
 
-int bt_register_proximity_reporter();
+int _bt_proximity_reporter_get_property(bluetooth_device_address_t *device_address,
+               unsigned int property, int *level);
+
+int _bt_proximity_reporter_register(const char *sender);
+
+int _bt_proximity_reporter_unregister(const char *sender);
 
-int bt_unregister_proximity_reporter();
+void _bt_proximity_reporter_stop_by_terminated_process(const char *terminated_name);
 
 #ifdef __cplusplus
 }
index cccd59f..c06531a 100644 (file)
@@ -6899,10 +6899,10 @@ int bluetooth_dpm_set_data_transfer_state(bt_dpm_status_t value);
 int bluetooth_dpm_get_data_transfer_state(bt_dpm_status_t *value);
 
 /**
- * @fn int bluetooth_set_proximity_property(const bluetooth_device_address_t *device_address,
+ * @fn int bluetooth_proximity_monitor_set_property(const bluetooth_device_address_t *device_address,
  *                                             bluetooth_pxp_poperty_t property, int value);
  *
- * @brief Sets the Proximity alert level/properties.
+ * @brief Sets the Proximity alert level/properties for monitor role.
  *
  * This function is a synchronous call.
  *
@@ -6919,14 +6919,14 @@ int bluetooth_dpm_get_data_transfer_state(bt_dpm_status_t *value);
  *
  * @remark     None
  */
-int bluetooth_set_proximity_property(const bluetooth_device_address_t *device_address,
+int bluetooth_proximity_monitor_set_property(const bluetooth_device_address_t *device_address,
                                                        bluetooth_pxp_poperty_t property, int value);
 
 /**
- * @fn int bluetooth_get_proximity_property(const bluetooth_device_address_t *device_address,
+ * @fn int bluetooth_proximity_monitor_get_property(const bluetooth_device_address_t *device_address,
  *                                             bluetooth_pxp_poperty_t property, int *value);
  *
- * @brief Reads the Proximity alert level/properties.
+ * @brief Reads the Proximity alert level/properties for monitor role.
  *
  * This function is a synchronous call.
  *
@@ -6942,21 +6942,21 @@ int bluetooth_set_proximity_property(const bluetooth_device_address_t *device_ad
  *
  * @remark     None
  */
-int bluetooth_get_proximity_property(const bluetooth_device_address_t *device_address,
+int bluetooth_proximity_monitor_get_property(const bluetooth_device_address_t *device_address,
                                                        bluetooth_pxp_poperty_t property, int *value);
 
 /**
- * @fn int bluetooth_get_proximity_supported_services(const bluetooth_device_address_t *device_address,
+ * @fn int bluetooth_proximity_monitor_get_supported_services(const bluetooth_device_address_t *device_address,
  *                                             int *services_supported);
  *
- * @brief Reads the Proximity profile supported properties/services.
+ * @brief Reads the Proximity Monitor profile supported properties/services.
  *
  * This function is a synchronous call.
  *
- * @return   BLUETOOTH_ERROR_NONE - Success \n
- *               BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
- *               BLUETOOTH_ERROR_NOT_FOUND - Cannot find the proxy\n
- *               BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
+ * @return      BLUETOOTH_ERROR_NONE - Success \n
+ *                              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
+ *                              BLUETOOTH_ERROR_NOT_FOUND - Cannot find the proxy\n
+ *                              BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
  *
  * @exception  None
  * @param[in] device_address remote device address
@@ -6964,40 +6964,63 @@ int bluetooth_get_proximity_property(const bluetooth_device_address_t *device_ad
  *
  * @remark     None
  */
-int bluetooth_get_proximity_supported_services(const bluetooth_device_address_t *device_address,
+int bluetooth_proximity_monitor_get_supported_services(const bluetooth_device_address_t *device_address,
                                                        int *services_supported);
 
 /**
- * @fn int bluetooth_register__proximity_reporter();
+ * @fn int bluetooth_proximity_reporter_register();
  *
  * @brief Register all proximity related services in BlueZ.
  *
  * This function is a synchronous call.
  *
- * @return   BLUETOOTH_ERROR_NONE - Success \n
- *           BLUETOOTH_ERROR_NOT_FOUND - Cannot find the proxy\n
+ * @return      BLUETOOTH_ERROR_NONE - Success \n
+ *                      BLUETOOTH_ERROR_NOT_FOUND - Cannot find the proxy\n
  *
  * @exception  None
  *
  * @remark     None
  */
-int bluetooth_register_proximity_reporter();
+int bluetooth_proximity_reporter_register(void);
 
 /**
- * @fn int bluetooth_unregister__proximity_reporter();
+ * @fn int bluetooth_proximity_reporter_unregister();
  *
  * @brief Unregister all proximity related services in BlueZ.
  *
  * This function is a synchronous call.
  *
- * @return   BLUETOOTH_ERROR_NONE - Success \n
- *           BLUETOOTH_ERROR_NOT_FOUND - Cannot find the proxy\n
+ * @return      BLUETOOTH_ERROR_NONE - Success \n
+ *                      BLUETOOTH_ERROR_NOT_FOUND - Cannot find the proxy\n
+ *
+ * @exception  None
+ *
+ * @remark     None
+ */
+int bluetooth_proximity_reporter_unregister(void);
+
+/**
+ * @fn int bluetooth_proximity_reporter_get_property(const bluetooth_device_address_t *device_address,
+ *                                             bluetooth_pxp_poperty_t property, int *value);
+ *
+ * @brief Reads the Proximity alert level/properties for reporter role.
+ *
+ * This function is a synchronous call.
+ *
+ * @return      BLUETOOTH_ERROR_NONE - Success \n
+ *                              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
+ *                              BLUETOOTH_ERROR_NOT_FOUND - Cannot find the proxy\n
+ *                              BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
  *
  * @exception  None
+ * @param[in] device_address remote device address
+ * @param[in] property proximity profile property
+ * @param[out] value alert level/property value
  *
  * @remark     None
  */
-int bluetooth_unregister_proximity_reporter();
+int bluetooth_proximity_reporter_get_property(const bluetooth_device_address_t *device_address,
+                                                       bluetooth_pxp_poperty_t property, int *value);
 
 /**
  * @}
index 18a762b..8ff4c66 100644 (file)
@@ -354,11 +354,12 @@ typedef enum {
        BT_DPM_GET_LIMITED_DISCOVERABLE_STATE,
        BT_DPM_SET_DATA_TRANSFER_STATE,
        BT_DPM_GET_DATA_TRANSFER_STATE,
-       BT_PXP_SET_PROPERTY = BT_FUNC_PXP_BASE,
-       BT_PXP_GET_PROPERTY,
-       BT_PXP_GET_SUPPORTED_SERIVCES,
-       BT_PXP_REGISTER_REPORTER,
-       BT_PXP_UNREGISTER_REPORTER,
+       BT_PXP_MONITOR_SET_PROPERTY = BT_FUNC_PXP_BASE,
+       BT_PXP_MONITOR_GET_PROPERTY,
+       BT_PXP_MONITOR_GET_SUPPORTED_SERIVCES,
+       BT_PXP_REPORTER_REGISTER,
+       BT_PXP_REPORTER_UNREGISTER,
+       BT_PXP_REPORTER_GET_PROPERTY,
 } bt_function_t;
 
 typedef struct {