BlueToe
an alternative GATT/BLE implementation
Loading...
Searching...
No Matches
oob_authentication.hpp
1#ifndef BLUETOE_SM_INCLUDE_OOB_AUTHENTICATION_HPP
2#define BLUETOE_SM_INCLUDE_OOB_AUTHENTICATION_HPP
3
4#include <bluetoe/ll_meta_types.hpp>
5
6#include <cstdint>
7#include <array>
8#include <utility>
9#include <tuple>
10
11namespace bluetoe {
12
13 namespace details {
14 struct oob_authentication_callback_meta_type {};
15 }
16
20 using oob_authentication_data_t = std::array< std::uint8_t, 16 >;
21
38 template < typename T, T& Obj >
40 {
42 public:
44 : oob_data_present_( false )
45 {
46 }
47
48 void request_oob_data_presents_for_remote_device( const bluetoe::link_layer::device_address& address )
49 {
50 std::tie( oob_data_present_, oob_data_ ) = Obj.sm_oob_authentication_data( address );
51 }
52
53 bool has_oob_data_for_remote_device() const
54 {
55 return oob_data_present_;
56 }
57
58 oob_authentication_data_t get_oob_data_for_last_remote_device() const
59 {
60 return oob_data_;
61 };
62
63 struct meta_type :
64 details::oob_authentication_callback_meta_type,
65 link_layer::details::valid_link_layer_option_meta_type {};
66
67 private:
68 bool oob_data_present_;
69 std::array< std::uint8_t, 16 > oob_data_;
71 };
72
73 namespace details {
74 class no_oob_authentication
75 {
76 public:
77 void request_oob_data_presents_for_remote_device( const bluetoe::link_layer::device_address& )
78 {
79 }
80
81 bool has_oob_data_for_remote_device() const
82 {
83 return false;
84 }
85
86 std::array< std::uint8_t, 16 > get_oob_data_for_last_remote_device() const
87 {
88 return std::array< std::uint8_t, 16 >{{ 0 }};
89 };
90
91 struct meta_type :
92 details::oob_authentication_callback_meta_type,
93 link_layer::details::valid_link_layer_option_meta_type {};
94
95 };
96 }
97}
98
99#endif // include guard
interface to provide OOB data to the pairing process
Definition: oob_authentication.hpp:40