BT 5.0: Add APIs to support set/read PHYs
[platform/core/connectivity/bluetooth-frwk.git] / bt-service / services / bt-request-handler.c
index 4370d50..bbbf3da 100644 (file)
@@ -2755,6 +2755,68 @@ int __bt_bluez_request(int function_name,
                result = _bt_gatt_server_update_attribute_value(app, instance_id, &param);
                break;
        }
+       case BT_GATT_SERVER_READ_PHY: {
+               bluetooth_device_address_t address = { {0} };
+
+               sender = (char*)g_dbus_method_invocation_get_sender(context);
+
+               __bt_service_get_parameters(in_param1,
+                               &address, sizeof(bluetooth_device_address_t));
+
+               result = _bt_gatt_server_read_phy(&address);
+               break;
+       }
+       case BT_GATT_SERVER_SET_PHY: {
+               bluetooth_device_address_t address = { {0} };
+               int tx_phy;
+               int rx_phy;
+               int phy_options;
+
+               sender = (char*)g_dbus_method_invocation_get_sender(context);
+
+               __bt_service_get_parameters(in_param1,
+                               &address, sizeof(bluetooth_device_address_t));
+               __bt_service_get_parameters(in_param2,
+                               &tx_phy, sizeof(int));
+               __bt_service_get_parameters(in_param3,
+                               &rx_phy, sizeof(int));
+               __bt_service_get_parameters(in_param4,
+                               &phy_options, sizeof(int));
+
+               result = _bt_gatt_server_set_phy(&address, tx_phy, rx_phy, phy_options);
+               break;
+       }
+       case BT_GATT_CLIENT_READ_PHY: {
+               bluetooth_device_address_t address = { {0} };
+
+               sender = (char*)g_dbus_method_invocation_get_sender(context);
+
+               __bt_service_get_parameters(in_param1,
+                               &address, sizeof(bluetooth_device_address_t));
+
+               result = _bt_gatt_client_read_phy(&address);
+               break;
+       }
+       case BT_GATT_CLIENT_SET_PHY: {
+               bluetooth_device_address_t address = { {0} };
+               int tx_phy;
+               int rx_phy;
+               int phy_options;
+
+               sender = (char*)g_dbus_method_invocation_get_sender(context);
+
+               __bt_service_get_parameters(in_param1,
+                               &address, sizeof(bluetooth_device_address_t));
+               __bt_service_get_parameters(in_param2,
+                               &tx_phy, sizeof(int));
+               __bt_service_get_parameters(in_param3,
+                               &rx_phy, sizeof(int));
+               __bt_service_get_parameters(in_param4,
+                               &phy_options, sizeof(int));
+
+               result = _bt_gatt_client_set_phy(&address, tx_phy, rx_phy, phy_options);
+               break;
+       }
        case BT_GET_ATT_MTU: {
                bluetooth_device_address_t address = { {0} };
                unsigned int mtu = 0;
@@ -5589,6 +5651,10 @@ gboolean __bt_service_check_privilege(int function_name,
        case BT_GATT_SERVER_UPDATE_VALUE:
        case BT_GATT_SERVER_DEREGISTER:
 #endif
+       case BT_GATT_SERVER_READ_PHY:
+       case BT_GATT_SERVER_SET_PHY:
+       case BT_GATT_CLIENT_READ_PHY:
+       case BT_GATT_CLIENT_SET_PHY:
        case BT_REQ_ATT_MTU:
        case BT_PBAP_CONNECT:
        case BT_PBAP_DISCONNECT: