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_SERVICE_H
20 #define CA_BLE_LINUX_SERVICE_H
22 #include "bluez-glue.h"
23 #include "object_manager-glue.h"
24 #include "characteristic.h"
28 * GATT Service Information
30 typedef struct CAGattService
32 /// D-Bus object path for the GattService1 object.
36 * OIC GATT service object_manager D-Bus interface skeleton
39 ObjectManager * object_manager;
41 /// OIC GATT service D-Bus interface skeleton object.
42 GattService1 * service;
44 /// OIC GATT request characteristic information.
45 CAGattCharacteristic request_characteristic;
47 /// OIC GATT response characteristic information.
48 CAGattCharacteristic response_characteristic;
51 * org.bluez.GattManager1 object with which the service is
54 GDBusProxy * gatt_manager;
59 * Initialize GATT service fields.
61 * This function initializes the @c CAGattService object fields.
63 * @param[out] service GATT service information to be initialized.
64 * @param[in] context Object containing the D-Bus connection to the
65 * bus on which the service will be exported.
66 * @param[in] hci_name Name of the bluetooth adapter installed on the
67 * system, e.g. @c "hci0".
69 * @return @c true on success, @c false otherwise.
71 * @note This function does not allocate the @a service object
72 * itself. The caller is responsible for allocating that
75 bool CAGattServiceInitialize(CAGattService * service,
76 CALEContext * context,
77 char const * hci_name);
80 * Destroy GATT service fields.
82 * This function finalizes the @c CAGattService object fields.
84 * @param[in] service GATT service information to be finalized.
86 * @note This function does not deallocate the @a service object
87 * itself. The caller is responsible for deallocating that
90 void CAGattServiceDestroy(CAGattService * service);
93 #endif // CA_BLE_LINUX_SERVICE_H