Fix for x86_64 build fail
[platform/upstream/connectedhomeip.git] / src / platform / Linux / bluez / Helper.h
1 /*
2  *
3  *    Copyright (c) 2020 Project CHIP Authors
4  *
5  *    Licensed under the Apache License, Version 2.0 (the "License");
6  *    you may not use this file except in compliance with the License.
7  *    You may obtain a copy of the License at
8  *
9  *        http://www.apache.org/licenses/LICENSE-2.0
10  *
11  *    Unless required by applicable law or agreed to in writing, software
12  *    distributed under the License is distributed on an "AS IS" BASIS,
13  *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  *    See the License for the specific language governing permissions and
15  *    limitations under the License.
16  */
17
18 /*
19  *  Copyright (c) 2016-2019, The OpenThread Authors.
20  *  All rights reserved.
21  *
22  *  Redistribution and use in source and binary forms, with or without
23  *  modification, are permitted provided that the following conditions are met:
24  *  1. Redistributions of source code must retain the above copyright
25  *     notice, this list of conditions and the following disclaimer.
26  *  2. Redistributions in binary form must reproduce the above copyright
27  *     notice, this list of conditions and the following disclaimer in the
28  *     documentation and/or other materials provided with the distribution.
29  *  3. Neither the name of the copyright holder nor the
30  *     names of its contributors may be used to endorse or promote products
31  *     derived from this software without specific prior written permission.
32  *
33  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
34  *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
35  *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
36  *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
37  *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
38  *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
39  *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
40  *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
41  *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
42  *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
43  *  POSSIBILITY OF SUCH DAMAGE.
44  */
45
46 /**
47  *    @file
48  *          Provides Bluez dbus implementation for BLE
49  */
50
51 #pragma once
52
53 #include "Types.h"
54
55 #if CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE
56
57 namespace chip {
58 namespace DeviceLayer {
59 namespace Internal {
60
61 CHIP_ERROR InitBluezBleLayer(bool aIsCentral, char * apBleAddr, BLEAdvConfig & aBleAdvConfig, BluezEndpoint *& apEndpoint);
62 bool BluezRunOnBluezThread(int (*aCallback)(void *), void * apClosure);
63 bool SendBluezIndication(BLE_CONNECTION_OBJECT apConn, chip::System::PacketBufferHandle apBuf);
64 bool CloseBluezConnection(BLE_CONNECTION_OBJECT apConn);
65 CHIP_ERROR StartBluezAdv(BluezEndpoint * apEndpoint);
66 CHIP_ERROR StopBluezAdv(BluezEndpoint * apEndpoint);
67 CHIP_ERROR BluezGattsAppRegister(BluezEndpoint * apEndpoint);
68 CHIP_ERROR BluezAdvertisementSetup(BluezEndpoint * apEndpoint);
69
70 /// Write to the CHIP RX characteristic on the remote peripheral device
71 bool BluezSendWriteRequest(BLE_CONNECTION_OBJECT apConn, chip::System::PacketBufferHandle apBuf);
72 /// Subscribe to the CHIP TX characteristic on the remote peripheral device
73 bool BluezSubscribeCharacteristic(BLE_CONNECTION_OBJECT apConn);
74 /// Unsubscribe from the CHIP TX characteristic on the remote peripheral device
75 bool BluezUnsubscribeCharacteristic(BLE_CONNECTION_OBJECT apConn);
76
77 CHIP_ERROR ConnectDevice(BluezDevice1 * apDevice, BluezEndpoint * apEndpoint);
78 void CancelConnect(BluezEndpoint * apEndpoint);
79
80 } // namespace Internal
81 } // namespace DeviceLayer
82 } // namespace chip
83
84 #endif // CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE