Imported Upstream version 1.1.0
[platform/upstream/iotivity.git] / resource / csdk / connectivity / src / bt_le_adapter / linux / client.h
1 /******************************************************************
2  *
3  * Copyright 2015 Intel Corporation All Rights Reserved.
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 #ifndef CA_BLE_LINUX_CLIENT_H
20 #define CA_BLE_LINUX_CLIENT_H
21
22 #include "context.h"
23
24
25 /**
26  * Initialize the GATT client.
27  *
28  * @param[in] context
29  *
30  * @return @c CA_STATUS_OK on success, @c CA_STATUS_FAILED otherwise.
31  */
32 CAResult_t CAGattClientInitialize(CALEContext * context);
33
34 /**
35  * Destroy the GATT client.
36  */
37 void CAGattClientDestroy();
38
39 /**
40  * Send request data through a single user-specified BLE connection.
41  *
42  * @param[in] address  MAC address of the BLE peripheral running the
43  *                     OIC Transport Profile GATT server to which the
44  *                     data will be sent.
45  * @param[in] data     Octet array of request data to be sent.
46  * @param[in] length   Length of the @a data octet array.
47  * @param[in] context  Object containing mutexes and error reporting
48  *                     callback used on failure to send.
49  *
50  * @return @c CA_STATUS_OK on success, @c CA_STATUS_FAILED otherwise.
51  */
52 CAResult_t CAGattClientSendData(char const * address,
53                                 uint8_t const * data,
54                                 size_t length,
55                                 CALEContext * context);
56
57 /**
58  * Send request data through all BLE connections.
59  *
60  * Send the @a data to the GATT server found in all discovered LE
61  * peripherals.
62  *
63  * @param[in] data    Octet array of request data to be sent.
64  * @param[in] length  Length of the @a data octet array.
65  * @param[in] context Object GATT request characteristic map.
66  *
67  * @return @c CA_STATUS_OK on success, @c CA_STATUS_FAILED otherwise.
68  */
69 CAResult_t CAGattClientSendDataToAll(uint8_t const * data,
70                                      size_t length,
71                                      CALEContext * context);
72
73
74 #endif  /* CA_BLE_LINUX_CLIENT_H */