Fix the memory leak in app battery info
[platform/core/connectivity/bluetooth-frwk.git] / bt-service-adaptation / services / gatt / bt-service-gatt.c
index 3067535..737740d 100644 (file)
@@ -5145,5 +5145,70 @@ static void __bt_update_mtu_gatt_device(char *address, int mtu)
        }
 }
 
+int _bt_gatt_get_data_batching_available_packets(
+               guint *available_packets)
+{
+       int ret = OAL_STATUS_SUCCESS;
+
+       BT_CHECK_PARAMETER(available_packets, return);
+
+       ret = gatt_get_data_batching_available_packets(available_packets);
+       if (ret != OAL_STATUS_SUCCESS) {
+               BT_ERR("ret: %d", ret);
+               if (ret == OAL_STATUS_NOT_SUPPORT)
+                       return BLUETOOTH_ERROR_NOT_SUPPORT;
+               return BLUETOOTH_ERROR_INTERNAL;
+       }
+
+       return BLUETOOTH_ERROR_NONE;
+}
+
+int _bt_gatt_enable_data_batching(bluetooth_device_address_t *address,
+               int packet_threshold, int timeout)
+{
+       int ret = OAL_STATUS_SUCCESS;
+       char remote_address[BT_ADDRESS_STRING_SIZE] = { 0 };
+
+       BT_CHECK_PARAMETER(address, return);
+
+       _bt_convert_addr_type_to_string(remote_address, address->addr);
+       BT_INFO("Enable GATT data batching. address[%s] packet_threshold[%d] timeout[%d]",
+                       remote_address, packet_threshold, timeout);
+
+       ret = gatt_enable_data_batching((bt_address_t*)(address), packet_threshold, timeout);
+
+       if (ret != OAL_STATUS_SUCCESS) {
+               BT_ERR("ret: %d", ret);
+               if (ret == OAL_STATUS_INVALID_PARAM)
+                       return BLUETOOTH_ERROR_INVALID_PARAM;
+               else if (ret == OAL_STATUS_NOT_SUPPORT)
+                       return BLUETOOTH_ERROR_NOT_SUPPORT;
+               return BLUETOOTH_ERROR_INTERNAL;
+       }
+
+       return BLUETOOTH_ERROR_NONE;
+}
+
+int _bt_gatt_disable_data_batching(bluetooth_device_address_t *address)
+{
+       int ret = OAL_STATUS_SUCCESS;
+       char remote_address[BT_ADDRESS_STRING_SIZE] = { 0 };
+
+       BT_CHECK_PARAMETER(address, return);
+
+       _bt_convert_addr_type_to_string(remote_address, address->addr);
+       BT_INFO("Disable GATT data batching. address[%s]", remote_address);
+
+       ret = gatt_disable_data_batching((bt_address_t*)(address));
+
+       if (ret != OAL_STATUS_SUCCESS) {
+               BT_ERR("ret: %d", ret);
+               if (ret == OAL_STATUS_NOT_SUPPORT)
+                       return BLUETOOTH_ERROR_NOT_SUPPORT;
+               return BLUETOOTH_ERROR_INTERNAL;
+       }
+
+       return BLUETOOTH_ERROR_NONE;
+}
 
 #endif