1#ifndef BLUETOE_CUSTOM_ADVERTISING_HPP
2#define BLUETOE_CUSTOM_ADVERTISING_HPP
4#include <bluetoe/meta_types.hpp>
15 template < std::
size_t Size, const std::u
int8_t (&Data)[ Size ] >
19 constexpr bool advertising_data_dirty()
const
24 std::size_t advertising_data( std::uint8_t* begin, std::size_t buffer_size )
const
26 const std::size_t copy_size = std::min( Size, buffer_size );
27 std::copy( &Data[ 0 ], &Data[ copy_size ], begin );
33 details::advertising_data_meta_type,
34 details::valid_server_option_meta_type {};
41 constexpr bool advertising_data_dirty()
const
47 details::advertising_data_meta_type,
48 details::valid_server_option_meta_type {};
68 advertising_data_size_ = std::min( std::size_t{ advertising_data_max_size }, buffer_size );
69 std::copy( &begin[ 0 ], &begin[ advertising_data_size_ ], &advertising_data_[ 0 ] );
76 : advertising_data_size_( 0 )
81 bool advertising_data_dirty()
83 const bool result = dirty_;
89 std::size_t advertising_data( std::uint8_t* begin, std::size_t buffer_size )
const
91 const std::size_t copy_size = std::min( advertising_data_size_, buffer_size );
92 std::copy( &advertising_data_[ 0 ], &advertising_data_[ copy_size ], begin );
98 details::advertising_data_meta_type,
99 details::valid_server_option_meta_type {};
102 static constexpr std::size_t advertising_data_max_size = 31;
103 std::uint8_t advertising_data_[ advertising_data_max_size ];
104 std::size_t advertising_data_size_;
115 template < std::
size_t Size, const std::u
int8_t (&Data)[ Size ] >
119 constexpr bool scan_response_data_dirty()
const
124 std::size_t scan_response_data( std::uint8_t* begin, std::size_t buffer_size )
const
126 const std::size_t copy_size = std::min( Size, buffer_size );
127 std::copy( &Data[ 0 ], &Data[ copy_size ], begin );
133 details::scan_response_data_meta_type,
134 details::valid_server_option_meta_type {};
150 constexpr bool scan_response_data_dirty()
const
156 details::scan_response_data_meta_type,
157 details::valid_server_option_meta_type {};
177 scan_response_data_size_ = std::min( std::size_t{ scan_response_data_max_size }, buffer_size );
178 std::copy( &begin[ 0 ], &begin[ scan_response_data_size_ ], &scan_response_data_[ 0 ] );
185 : scan_response_data_size_( 0 )
190 std::size_t scan_response_data( std::uint8_t* begin, std::size_t buffer_size )
const
192 const std::size_t copy_size = std::min( scan_response_data_size_, buffer_size );
193 std::copy( &scan_response_data_[ 0 ], &scan_response_data_[ copy_size ], begin );
198 bool scan_response_data_dirty()
200 const bool result = dirty_;
207 details::scan_response_data_meta_type,
208 details::valid_server_option_meta_type {};
211 static constexpr std::size_t scan_response_data_max_size = 31;
212 std::uint8_t scan_response_data_[ scan_response_data_max_size ];
213 std::size_t scan_response_data_size_;
Definition: custom_advertising.hpp:39
options, that allows Bluetoe to create the scan response data
Definition: custom_advertising.hpp:148
provides data to be advertised
Definition: custom_advertising.hpp:17
provides data to be use in response to a scan request
Definition: custom_advertising.hpp:117
provides data to be advertised at runtime
Definition: custom_advertising.hpp:59
void set_runtime_custom_advertising_data(const std::uint8_t *begin, std::size_t buffer_size)
set the advertising data to be used.
Definition: custom_advertising.hpp:66
option, that allows to define the scan response data at runtime
Definition: custom_advertising.hpp:168
void set_runtime_custom_scan_response_data(const std::uint8_t *begin, std::size_t buffer_size)
set the scan response data to be used.
Definition: custom_advertising.hpp:175