esp-nimble-cpp 2.0.2
Loading...
Searching...
No Matches
NimBLEAttribute.h
1/*
2 * Copyright 2020-2024 Ryan Powell <ryan@nable-embedded.io> and
3 * esp-nimble-cpp, NimBLE-Arduino contributors.
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#ifndef NIMBLE_CPP_ATTRIBUTE_H_
19#define NIMBLE_CPP_ATTRIBUTE_H_
20
21#include "nimconfig.h"
22#if defined(CONFIG_BT_ENABLED) && (defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL) || defined(CONFIG_BT_NIMBLE_ROLE_CENTRAL))
23
24# include "NimBLEUUID.h"
25
30 public:
35 const NimBLEUUID& getUUID() const { return m_uuid; }
36
40 uint16_t getHandle() const { return m_handle; };
41
42 protected:
48 NimBLEAttribute(const NimBLEUUID& uuid, uint16_t handle) : m_uuid{uuid}, m_handle{handle} {}
49
53 ~NimBLEAttribute() = default;
54
55 const NimBLEUUID m_uuid{};
56 uint16_t m_handle{0};
57};
58
59#endif // CONFIG_BT_ENABLED && (CONFIG_BT_NIMBLE_ROLE_PERIPHERAL || CONFIG_BT_NIMBLE_ROLE_CENTRAL)
60#endif // NIMBLE_CPP_ATTRIBUTE_H_
A base class for BLE attributes.
Definition NimBLEAttribute.h:29
NimBLEAttribute(const NimBLEUUID &uuid, uint16_t handle)
Construct a new NimBLEAttribute object.
Definition NimBLEAttribute.h:48
uint16_t getHandle() const
Get the handle of the attribute.
Definition NimBLEAttribute.h:40
~NimBLEAttribute()=default
Destroy the NimBLEAttribute object.
const NimBLEUUID & getUUID() const
Get the UUID of the attribute.
Definition NimBLEAttribute.h:35
A model of a BLE UUID.
Definition NimBLEUUID.h:41