aboutsummaryrefslogtreecommitdiff
path: root/include/ble/att.h
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2018-11-23 09:40:48 +0100
committerTrygve Laugstøl <trygvis@inamo.no>2018-11-23 09:40:48 +0100
commit2034b1bb10720a2f0e6cc97427346f2320c115bc (patch)
treec382c6e404d48078aac71e2fd3f7f34587b99e7b /include/ble/att.h
parent0e2228fae626ec617a6a1f042ceb6dbdbd774558 (diff)
downloadble-toys-2034b1bb10720a2f0e6cc97427346f2320c115bc.tar.gz
ble-toys-2034b1bb10720a2f0e6cc97427346f2320c115bc.tar.bz2
ble-toys-2034b1bb10720a2f0e6cc97427346f2320c115bc.tar.xz
ble-toys-2034b1bb10720a2f0e6cc97427346f2320c115bc.zip
o Starting to handle notifications and indications
Cleaning up: o Using more of the shared_ptr typedefs. o Adding code styles used by CLion.
Diffstat (limited to 'include/ble/att.h')
-rw-r--r--include/ble/att.h21
1 files changed, 20 insertions, 1 deletions
diff --git a/include/ble/att.h b/include/ble/att.h
index db21d2e..152a779 100644
--- a/include/ble/att.h
+++ b/include/ble/att.h
@@ -130,11 +130,26 @@ struct ReadByTypeRes {
std::vector<AttributeData> attributes;
};
+struct HandleValueNotification {
+ static constexpr auto att_pdu_type = AttPduType::HANDLE_VALUE_NOTIFICATION;
+
+ uint16_t handle;
+ ByteBuffer data;
+};
+
+struct HandleValueIndication {
+ static constexpr auto att_pdu_type = AttPduType::HANDLE_VALUE_INDICATION;
+
+ uint16_t handle;
+ ByteBuffer data;
+};
+
using AttVariant = std::variant<std::monostate,
ErrorRes,
ExchangeMtuReq, ExchangeMtuRes,
FindInformationRes,
- ReadByGroupTypeRes, ReadByTypeRes>;
+ ReadByGroupTypeRes, ReadByTypeRes,
+ HandleValueNotification, HandleValueIndication>;
o<AttPduType> attPduType(const AttVariant &v);
@@ -154,6 +169,10 @@ public:
static FindInformationRes parseFindInformationRes(ByteBuffer &bytes);
+ static HandleValueNotification parseHandleValueNotification(ByteBuffer &bytes);
+
+ static HandleValueIndication parseHandleValueIndication(ByteBuffer &bytes);
+
static void parseRead(ByteBuffer &bytes);
static void parseWrite(ByteBuffer &bytes);