Пример #1
0
void CAFreeBLEServiceInfo(BLEServiceInfo *bleServiceInfo)
{
    OIC_LOG(DEBUG, TZ_BLE_CLIENT_UTIL_TAG, "IN");
    if (bleServiceInfo)
    {
        if (bleServiceInfo->bdAddress)
        {
            bt_device_destroy_bond(bleServiceInfo->bdAddress);
            bt_gatt_disconnect(bleServiceInfo->bdAddress);
            OICFree(bleServiceInfo->bdAddress);
            bt_gatt_destroy_attribute_handle(bleServiceInfo->service_clone);
            bt_gatt_destroy_attribute_handle(bleServiceInfo->read_char);
            bt_gatt_destroy_attribute_handle(bleServiceInfo->write_char);
        }
        OICFree(bleServiceInfo);
    }
    OIC_LOG(DEBUG, TZ_BLE_CLIENT_UTIL_TAG, "OUT");
}
Пример #2
0
CAResult_t CABleGattDisConnect(const char *remoteAddress)
{
    OIC_LOG(DEBUG, TZ_BLE_CLIENT_TAG, "IN");

    VERIFY_NON_NULL_RET(remoteAddress, TZ_BLE_CLIENT_TAG,
                        "remote address is NULL", CA_STATUS_FAILED);

    int32_t ret = bt_gatt_disconnect(remoteAddress);

    if (BT_ERROR_NONE != ret)
    {
        OIC_LOG_V(ERROR, TZ_BLE_CLIENT_TAG, "bt_gatt_disconnect Failed with ret value [%d] ",
                  ret);
        return CA_STATUS_FAILED;
    }

    OIC_LOG(DEBUG, TZ_BLE_CLIENT_TAG, "OUT");
    return CA_STATUS_OK;
}