aboutsummaryrefslogtreecommitdiff
path: root/src/GattService.h
blob: b9e15bad702abf12d02c071973dfee463da63d78 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
// Copyright 2017 Paul Nettle. 
// 
// This file is part of Gobbledegook. 
// 
// Gobbledegook is free software: you can redistribute it and/or modify 
// it under the terms of the GNU General Public License as published by 
// the Free Software Foundation, either version 3 of the License, or 
// (at your option) any later version. 
// 
// Gobbledegook is distributed in the hope that it will be useful, 
// but WITHOUT ANY WARRANTY; without even the implied warranty of 
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
// GNU General Public License for more details. 
// 
// You should have received a copy of the GNU General Public License 
// along with Gobbledegook.  If not, see <http://www.gnu.org/licenses/>. 
 
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
// 
// >> 
// >>>  INSIDE THIS FILE 
// >> 
// 
// A GATT Service, used to add services to a Bluetooth server 
// 
// >> 
// >>>  DISCUSSION 
// >> 
// 
// A GATT Service is really a collection of  
// 
// This class is intended to be used within the server description. For an explanation of how this class is used, see the detailed 
// description in Server.cpp. 
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
 
#pragma once
 
#include <gio/gio.h>
#include <string>
#include <list>
 
#include "TickEvent.h"
#include "GattInterface.h"
 
// --------------------------------------------------------------------------------------------------------------------------------- 
// Forward declarations 
// --------------------------------------------------------------------------------------------------------------------------------- 
 
struct GattService;
struct GattCharacteristic;
struct GattProperty;
struct DBusObject;
 
// --------------------------------------------------------------------------------------------------------------------------------- 
// Representation of a Bluetooth GATT Service 
// --------------------------------------------------------------------------------------------------------------------------------- 
 
struct GattService : GattInterface
{
// Our interface type 
static constexpr const char *kInterfaceType = "GattService";
 
// Standard constructor 
GattService(DBusObject &owner, const std::string &name);
 
virtual ~GattService() {}
 
// Returning the parent pops us one level up the hierarchy 
DBusObject &gattServiceEnd();
 
// Convenience functions to add a GATT characteristic to the hierarchy 
// 
// We simply add a new child at the given path and add an interface configured as a GATT characteristic to it. The 
// new characteristic is declared with a UUID and a variable argument list of flags (in string form.) For a complete and 
// up-to-date list of flag values, see: https://git.kernel.org/pub/scm/bluetooth/bluez.git/plain/doc/gatt-api.txt 
// 
// At the time of this writing, the list of flags is as follows: 
// 
//     "broadcast" 
//     "read" 
//     "write-without-response" 
//     "write" 
//     "notify" 
//     "indicate" 
//     "authenticated-signed-writes" 
//     "reliable-write" 
//     "writable-auxiliaries" 
//     "encrypt-read" 
//     "encrypt-write" 
//     "encrypt-authenticated-read" 
//     "encrypt-authenticated-write" 
//     "secure-read" (Server only) 
//     "secure-write" (Server only) 
// 
GattCharacteristic &gattCharacteristicBegin(const std::string &pathElement, const GattUuid &uuid, const std::vector<const char *> &flags);
 
// Returns a string identifying the type of interface 
virtual const std::string getInterfaceType() const { return GattService::kInterfaceType}
};