PXP: Add base code for Proximity Profile Monitor Role. 83/93583/8
authorh.sandeep <h.sandeep@samsung.com>
Tue, 25 Oct 2016 04:03:59 +0000 (09:33 +0530)
committerh.sandeep <h.sandeep@samsung.com>
Tue, 8 Nov 2016 09:43:10 +0000 (15:13 +0530)
Change-Id: Ic82000a4a752bb05a52864ac4ad6cb6fe51a5526
Signed-off-by: h.sandeep <h.sandeep@samsung.com>
bt-api/CMakeLists.txt
bt-api/bt-proximity.c [new file with mode: 0644]
bt-service/CMakeLists.txt
bt-service/bt-request-handler.c
bt-service/bt-service-proximity.c [new file with mode: 0644]
bt-service/include/bt-service-common.h
bt-service/include/bt-service-proximity.h [new file with mode: 0644]
include/bluetooth-api.h
include/bt-internal-types.h

index 0aa3b80..abb47be 100644 (file)
@@ -25,7 +25,8 @@ bt-pbap.c
 bt-hid-device.c
 bt-gatt-client.c
 bt-ipsp.c
-bt-dpm.c)
+bt-dpm.c
+bt-proximity.c)
 
 SET(HEADERS
 bluetooth-api.h
diff --git a/bt-api/bt-proximity.c b/bt-api/bt-proximity.c
new file mode 100644 (file)
index 0000000..5e1f71e
--- /dev/null
@@ -0,0 +1,110 @@
+/*
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *             http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include "bluetooth-api.h"
+#include "bt-internal-types.h"
+
+#include "bt-common.h"
+#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,
+                                                       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));
+       g_array_append_vals(in_param3, &value, sizeof(int));
+
+       result = _bt_send_request(BT_BLUEZ_SERVICE, BT_PXP_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);
+
+       return result;
+}
+
+BT_EXPORT_API int bluetooth_get_proximity_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_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;
+}
+
+BT_EXPORT_API int bluetooth_get_proximity_supported_services(const bluetooth_device_address_t *device_address,
+                                                       int *services_supported)
+{
+       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));
+
+       result = _bt_send_request(BT_BLUEZ_SERVICE, BT_PXP_GET_SUPPORTED_SERIVCES,
+               in_param1, in_param2, in_param3, in_param4, &out_param);
+
+       if (result == BLUETOOTH_ERROR_NONE) {
+               if (out_param->len > 0) {
+                       *services_supported = 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 ef4b69d..2fb2d45 100644 (file)
@@ -28,6 +28,7 @@ bt-service-agent.c
 bt-service-gap-agent.c
 bt-service-pbap.c
 bt-service-dpm.c
+bt-service-proximity.c
 )
 
 IF(LIBNOTIFY_SUPPORT)
index 5c88efb..35f2ad6 100644 (file)
@@ -43,6 +43,7 @@
 #include "bt-service-pbap.h"
 #include "bt-service-dpm.h"
 #include "bt-service-agent.h"
+#include "bt-service-proximity.h"
 
 static GDBusConnection *bt_service_conn;
 static guint owner_id = 0;
@@ -2107,6 +2108,52 @@ int __bt_bluez_request(int function_name,
 
                break;
        }
+       case BT_PXP_SET_PROPERTY: {
+               bluetooth_device_address_t address = { {0} };
+               unsigned int property = 0;
+               unsigned int value = 0;
+
+               __bt_service_get_parameters(in_param1,
+                               &address, sizeof(bluetooth_device_address_t));
+               __bt_service_get_parameters(in_param2,
+                               &property, sizeof(int));
+               __bt_service_get_parameters(in_param3,
+                               &value, sizeof(int));
+
+               result = bt_set_proximity_property(&address, property, value);
+               break;
+       }
+       case BT_PXP_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_get_proximity_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: {
+               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);
+               if (result == BLUETOOTH_ERROR_NONE) {
+                       g_array_append_vals(*out_param1, &property,
+                                               sizeof(int));
+               }
+               break;
+       }
        default:
                result = BLUETOOTH_ERROR_INTERNAL;
                break;
@@ -2813,6 +2860,9 @@ 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:
        ret_val = cynara_check(p_cynara, client_creds, client_session, user_creds,
                                BT_PRIVILEGE_PLATFORM);
 
diff --git a/bt-service/bt-service-proximity.c b/bt-service/bt-service-proximity.c
new file mode 100644 (file)
index 0000000..8ab7689
--- /dev/null
@@ -0,0 +1,296 @@
+/*
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *             http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include <glib.h>
+#include <gio/gio.h>
+#include <dlog.h>
+#include <string.h>
+#include <syspopup_caller.h>
+#include <vconf.h>
+#include <bundle_internal.h>
+
+#include "bluetooth-api.h"
+#include "bt-internal-types.h"
+
+#include "bt-service-common.h"
+#include "bt-service-device.h"
+#include "bt-service-proximity.h"
+
+char *_bt_convert_alert_level_to_string(int value)
+{
+       if (value == BT_PXP_ALERT_MILD)
+               return g_strdup("mild");
+       else if (value == BT_PXP_ALERT_HIGH)
+               return g_strdup("high");
+       else
+               return g_strdup("none");
+}
+
+int _bt_convert_string_to_alert_level(const char *str)
+{
+       if (g_strcmp0("high", str) == 0)
+               return BT_PXP_ALERT_HIGH;
+       else if (g_strcmp0("mild", str) == 0)
+               return BT_PXP_ALERT_MILD;
+
+       return BT_PXP_ALERT_NONE;
+}
+
+char *_bt_convert_property_to_string(int value)
+{
+       if (value == BT_PXP_PROPERTY_LLS)
+               return g_strdup("LinkLossAlertLevel");
+       else if (value == BT_PXP_PROPERTY_IAS)
+               return g_strdup("ImmediateAlertLevel");
+       else if (value == BT_PXP_PROPERTY_TX_POWER)
+               return g_strdup("SignalLevel");
+
+       return NULL;
+}
+
+int bt_set_proximity_property(bluetooth_device_address_t *device_address,
+               unsigned int property, int alert_level)
+{
+       GDBusProxy *proxy;
+       char address[BT_ADDRESS_STRING_SIZE] = { 0 };
+
+       GDBusConnection *conn;
+       char *device_path = NULL;
+       GError *error = NULL;
+       GVariant *ret = NULL;
+       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);
+
+       if (device_path == NULL) {
+               return BLUETOOTH_ERROR_NOT_CONNECTED;
+       } else {
+               BT_INFO("device_path is created[%s]", device_path);
+       }
+
+       value_str = _bt_convert_alert_level_to_string(alert_level);
+       property_str =_bt_convert_property_to_string(property);
+
+       if (value_str == NULL || 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);
+
+       ret = g_dbus_proxy_call_sync(proxy, "Set",
+                               g_variant_new("(ssv)", BT_PROXIMITY_MONITOR_INTERFACE,  property_str, g_variant_new("s", value_str)),
+                               G_DBUS_CALL_FLAGS_NONE,
+                               -1,
+                               NULL,
+                               &error);
+       if (ret)
+               g_variant_unref(ret);
+       g_object_unref(proxy);
+       g_free(property_str);
+       g_free(value_str);
+
+       if (error) {
+                BT_ERR("SetProperty error: [%s]", error->message);
+                g_error_free(error);
+                return BLUETOOTH_ERROR_INTERNAL;
+       }
+
+       return BLUETOOTH_ERROR_NONE;
+}
+
+int bt_get_proximity_property(bluetooth_device_address_t *device_address,
+               unsigned int property, int *alert_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);
+
+       if (device_path == NULL) {
+               return BLUETOOTH_ERROR_NOT_CONNECTED;
+       } else {
+               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_MONITOR_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);
+
+       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,
+               unsigned int *supported_services)
+{
+       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;
+
+       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);
+
+       if (device_path == NULL) {
+               return BLUETOOTH_ERROR_NOT_CONNECTED;
+       } else {
+               BT_INFO("device_path is created[%s]", device_path);
+       }
+
+       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_MONITOR_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);
+
+       *supported_services = 0;
+       tmp_value = g_variant_lookup_value(value, "LinkLossAlertLevel", G_VARIANT_TYPE_STRING);
+       if (tmp_value == NULL) {
+               g_object_unref(proxy);
+               g_variant_unref(value);
+               return BLUETOOTH_ERROR_INTERNAL;
+       } else {
+               *supported_services |= BT_PXP_PROPERTY_LLS;
+               g_variant_unref(tmp_value);
+       }
+
+       tmp_value = g_variant_lookup_value(value, "ImmediateAlertLevel", G_VARIANT_TYPE_STRING);
+       if (tmp_value == NULL) {
+               if (*supported_services == 0) {
+                       g_object_unref(proxy);
+                       g_variant_unref(value);
+                       return BLUETOOTH_ERROR_INTERNAL;
+               }
+       } else {
+               *supported_services |= BT_PXP_PROPERTY_IAS;
+               g_variant_unref(tmp_value);
+       }
+
+       tmp_value = g_variant_lookup_value(value, "SignalLevel", G_VARIANT_TYPE_STRING);
+       if (tmp_value == NULL) {
+               if (*supported_services == 0) {
+                       g_object_unref(proxy);
+                       g_variant_unref(value);
+                       return BLUETOOTH_ERROR_INTERNAL;
+               }
+       } else {
+               *supported_services |= BT_PXP_PROPERTY_TX_POWER;
+               g_variant_unref(tmp_value);
+       }
+
+       g_variant_unref(value);
+       g_object_unref(proxy);
+
+       return BLUETOOTH_ERROR_NONE;
+}
index 4df5dae..27bd7e3 100644 (file)
@@ -175,10 +175,10 @@ extern "C" {
 #define BT_OBEXD_MANAGER_INTERFACE "org.openobex.Manager"
 #define BT_OBEXD_TRANSFER_INTERFACE "org.openobex.Transfer"
 #define BT_A2DP_SOURCE_INTERFACE "org.bluez.AudioSource"
+#define BT_PROXIMITY_MONITOR_INTERFACE "org.bluez.ProximityMonitor1"
 
 #define BT_PROPERTIES_INTERFACE "org.freedesktop.DBus.Properties"
 
-
 #define BT_OBEX_SERVICE_NAME "org.bluez.obex"
 #define BT_OBEX_CLIENT_PATH "/org/bluez/obex"
 #define BT_OBEX_CLIENT_INTERFACE "org.bluez.obex.Client1"
diff --git a/bt-service/include/bt-service-proximity.h b/bt-service/include/bt-service-proximity.h
new file mode 100644 (file)
index 0000000..50e123a
--- /dev/null
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *             http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+
+#ifndef _BT_SERVICE_PROXIMITY_H_
+#define _BT_SERVICE_PROXIMITY_H_
+
+#include <glib.h>
+#include <sys/types.h>
+#include "bluetooth-api.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+typedef enum {
+       BT_PXP_ALERT_NONE = 0,
+       BT_PXP_ALERT_MILD,
+       BT_PXP_ALERT_HIGH
+} bt_proximity_alert_value_t;
+
+typedef enum {
+       BT_PXP_PROPERTY_LLS = 0x01,
+       BT_PXP_PROPERTY_IAS = 0x02,
+       BT_PXP_PROPERTY_TX_POWER = 0x04
+} bt_proximity_alert_property_t;
+
+int bt_set_proximity_property(bluetooth_device_address_t *device_address,
+               unsigned int property, int value);
+
+int bt_get_proximity_property(bluetooth_device_address_t *device_address,
+               unsigned int property, int *value);
+
+int bt_get_proximity_supported_services(bluetooth_device_address_t *device_address,
+               unsigned int *supported_services);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+#endif /*_BT_SERVICE_PROXIMITY_H_*/
+
index 6c60836..80e38d3 100644 (file)
@@ -403,6 +403,15 @@ typedef enum {
 } bluetooth_gatt_att_request_tyep_t;
 
 /**
+ * Proximity Property Type
+ */
+typedef enum {
+               BLUETOOTH_PXP_PROPERTY_LLS = 0x01,      /* Link Loss Alert Proeprty */
+               BLUETOOTH_PXP_PROPERTY_IAS = 0x02,      /* Immediate Alert Proeprty */
+               BLUETOOTH_PXP_PROPERTY_TX_POWER = 0x04, /* TX Power */
+} bluetooth_pxp_poperty_t;
+
+/**
 * Advertising parameters
 */
 typedef struct {
@@ -6897,6 +6906,74 @@ 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,
+ *                                             bluetooth_pxp_poperty_t property, int value);
+ *
+ * @brief Sets the Proximity alert level/properties.
+ *
+ * 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[in] value alert level/property value to be set
+ * @param[out] None
+ *
+ * @remark     None
+ */
+int bluetooth_set_proximity_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,
+ *                                             bluetooth_pxp_poperty_t property, int *value);
+ *
+ * @brief Reads the Proximity alert level/properties.
+ *
+ * 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_get_proximity_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,
+ *                                             int *services_supported);
+ *
+ * @brief Reads the Proximity 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
+ *
+ * @exception  None
+ * @param[in] device_address remote device address
+ * @param[out] services_supported proximity profile property/service
+ *
+ * @remark     None
+ */
+int bluetooth_get_proximity_supported_services(const bluetooth_device_address_t *device_address,
+                                                       int *services_supported);
+/**
  * @}
  */
 
index 8990ef0..d01eb3e 100644 (file)
@@ -130,6 +130,7 @@ typedef enum {
 #define BT_FUNC_GATT_BASE ((int)(BT_FUNC_HDP_BASE + 0x0020))
 #define BT_FUNC_IPSP_BASE ((int)(BT_FUNC_GATT_BASE + 0x0020))
 #define BT_FUNC_DPM_BASE ((int)(BT_FUNC_IPSP_BASE + 0x0020))
+#define BT_FUNC_PXP_BASE ((int)(BT_FUNC_DPM_BASE + 0x0030)) /* Adding 0x0030 to base, as DPM has more use case */
 
 typedef enum {
        BT_CHECK_ADAPTER = BT_FUNC_BASE,
@@ -353,6 +354,9 @@ 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_function_t;
 
 typedef struct {