1 /* ****************************************************************
3 * Copyright 2015 Intel Corporation All Rights Reserved.
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
9 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 ******************************************************************/
19 #ifndef CA_BLE_LINUX_CHARACTERISTIC_H
20 #define CA_BLE_LINUX_CHARACTERISTIC_H
22 #include "bluez-glue.h"
23 #include "descriptor.h"
29 * OIC GATT Characteristic Information
31 * OIC GATT characteristics contain one user description descriptor.
33 * @note The response characteristic should also have a client
34 * characteristic configuration descriptor. However, BlueZ
35 * implicitly adds that descriptor to the characteristic when
36 * the characteristic "notify" property is set. There is no
37 * need to explicitly add that descriptor.
39 typedef struct CAGattCharacteristic
43 * Object containing the D-Bus connection list of connected
46 CALEContext * context;
49 * IoTivity OIC GATT service information.
51 * @note This is currently only used by the response
52 * characteristic to gain access to the request
53 * characteristic @c client endpoint field.
55 * @todo It seems somewhat wasteful have a field available to both
56 * response and request characteristics, but used by only
59 struct CAGattService * service;
61 /// D-Bus object path for the GattCharacteristic1 object.
64 /// OIC GATT service D-Bus interface skeleton object.
65 GattCharacteristic1 * characteristic;
67 /// OIC GATT user description descriptor information.
68 CAGattDescriptor descriptor;
71 * Information used to keep track of received data fragments.
73 * @note This is only used by the OIC GATT request characteristic
74 * skeleton implementation. It is not needed by the
75 * response characteristic skeleton.
77 * @todo It seems somewhat wasteful have a field available to both
78 * response and request characteristics, but used by only
81 CAGattRecvInfo recv_info;
83 } CAGattCharacteristic;
86 * Initialize GATT request characteristic fields.
88 * This function initializes the request @c CAGattCharacteristic
91 * @param[in,out] s Information about GATT service to which the
92 * characteristic belongs.
93 * @param[in] context Object containing the D-Bus connection to
94 * the bus on which the characteristic will be
95 * exported, as well as the list of connected
98 * @return @c true on success, @c false otherwise.
100 bool CAGattRequestCharacteristicInitialize(struct CAGattService * s,
101 CALEContext * context);
104 * Initialize GATT response characteristic fields.
106 * This function initializes the response @c CAGattCharacteristic
109 * @param[in,out] s Information about GATT service to which the
110 * characteristic belongs.
111 * @param[in] context Object containing the D-Bus connection to
112 * the bus on which the characteristic will be
113 * exported, as well as the list of connected
116 * @return @c true on success, @c false otherwise.
118 bool CAGattResponseCharacteristicInitialize(struct CAGattService * s,
119 CALEContext * context);
122 * Destroy GATT characteristic fields.
124 * This function finalizes the @c CAGattCharacteristic object fields.
126 * @param[in] characteristic GATT characteristic information to be
129 void CAGattCharacteristicDestroy(CAGattCharacteristic * characteristic);
132 * Get all characteristic properties.
134 * @param[in] characteristic The D-Bus skeleton object from which the
135 * characteristic properties will be extracted.
136 * @return A variant of the form a{sa{sv}}, suitable for use in the
138 * @c org.freedesktop.DBus.ObjectManager.GetManagedObjects()
139 * method provided by the IoTivity the
140 * @c org.bluez.GattService1 implementation.
142 GVariant * CAGattCharacteristicGetProperties(
143 GattCharacteristic1 * characteristic);
146 #endif // CA_BLE_LINUX_CHARACTERISTIC_H