4000405e8cad266d40fd96bea46ce4abc573202e
[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  * Information needed to when sending a request through a GATT
27  * client.
28  */
29 typedef struct _CAGattRequestInfo
30 {
31     /**
32      * Proxy or list of proxies to @c org.bluez.GattCharacteristic1
33      * object(s) through which request data will be sent to the GATT
34      * server.
35      *
36      * In the case of a unicast-style send, @c info will be a
37      * @c GDBusProxy* to an @c org.bluez.GattCharacteristic1 object.
38      * For a multicast-style send, @c info will be a * @c GList* of
39      * @c GDBusProxy* to @c GattCharacterstic1 objects on all GATT
40      * servers to which a connection exists.
41      */
42     void * const characteristic_info;
43
44     /**
45      * Context containing additional information that may be needed
46      * when sending a request.
47      */
48     CALEContext * const context;
49
50 } CAGattRequestInfo;
51
52 /**
53  * Send request data through a single user-specified BLE connection.
54  *
55  * @param[in] method_info Information necessary to send request.
56  * @param[in] data        Octet array of request data to be sent.
57  * @param[in] length      Length of the @a data octet array.
58  *
59  * @see @c CAGattSendMethod() for further details.
60  */
61 bool CAGattSendRequest(void const * method_info,
62                        uint8_t const * data,
63                        size_t length);
64
65 // ---------------------------------------------------------------
66 //                   Multicast-style Request Send
67 // ---------------------------------------------------------------
68 /**
69  * Send request data through all BLE connections.
70  *
71  * Send the @a data to the GATT server found in all discovered LE
72  * peripherals.
73  *
74  * @param[in] method_info Information necessary to send request.
75  * @param[in] data        Octet array of request data to be sent.
76  * @param[in] length      Length of the @a data octet array.
77
78  * @note Since a multicast-like operation is being performed, an
79  *       assumption is made that a GATT client is sending data to a
80  *       server.  It makes no sense to multicast a response from a
81  *       single GATT server to multiple GATT clients in IoTivity's
82  *       case.
83  *
84  * @return @c CA_STATUS_OK on success, @c CA_STATUS_FAILED otherwise.
85  */
86 CAResult_t CAGattClientSendDataToAll(void const * method_info,
87                                      uint8_t const * data,
88                                      size_t length);
89
90
91 #endif  /* CA_BLE_LINUX_CLIENT_H */