herald  2.0.0
ble_advert_parser.h
1 // Copyright 2020-2021 Herald Project Contributors
2 // SPDX-License-Identifier: Apache-2.0
3 //
4 
5 #ifndef HERALD_BLE_ADVERT_PARSER_H
6 #define HERALD_BLE_ADVERT_PARSER_H
7 
8 #include "ble_advert_types.h"
9 
10 #include <vector>
11 
12 namespace herald {
13 namespace ble {
14 namespace filter {
15 
16 namespace BLEAdvertParser {
17 
18 // Note the below should NOT be declared static, as they are PUBLIC API methods
19 
20 // High level parsing functions
21 
22 std::vector<BLEAdvertSegment> extractSegments(const Data& raw, std::size_t offset) noexcept;
23 
24 
25 // Parse result extraction functions
26 
27 bool extractTxPower(const std::vector<BLEAdvertSegment>& segments, std::uint8_t& into) noexcept;
28 std::vector<Data> extractHeraldManufacturerData(const std::vector<BLEAdvertManufacturerData>& manuData) noexcept;
29 std::vector<BLEAdvertManufacturerData> extractManufacturerData(const std::vector<BLEAdvertSegment>& segments) noexcept;
30 std::vector<BLEAdvertAppleManufacturerSegment> extractAppleManufacturerSegments(const std::vector<BLEAdvertManufacturerData>& manuData) noexcept;
31 
32 // std::vector<BLEAdvertServiceData> extractServiceUUID128Data(std::vector<BLEAdvertSegment> segments) noexcept;
33 
34 // Low level utility functions
35 // Exposed in API to allow others to use them
36 
37 Data subDataBigEndian(const Data& data, std::size_t offset, std::size_t length) noexcept;
38 Data subDataLittleEndian(const Data& data, std::size_t offset, std::size_t length) noexcept;
39 
40 }
41 
42 }
43 }
44 }
45 
46 #endif
DataRef<> Data
Defaults references to Data to equal the DataRef with the default Memory Arena dimensions,...
Definition: data.h:506
Acts as a non-global memory arena for arbitrary classes.
Definition: aggregates.h:15