ThingsBoard Client SDK 0.16.0
Client SDK to connect with ThingsBoard IoT Platform from IoT devices (Arduino, Espressif, etc.)
Loading...
Searching...
No Matches
Provision_Callback.h
Go to the documentation of this file.
1#ifndef Provision_Callback_h
2#define Provision_Callback_h
3
4// Local includes.
6
7
10struct Access_Token{};
11
15
19
23
24
28class Provision_Callback : public Callback<void, JsonDocument const &> {
29 public:
31 Provision_Callback() = default;
32
66 Provision_Callback(Access_Token, function callback, char const * provision_device_key, char const * provision_device_secret, char const * device_name = nullptr, uint64_t const & timeout_microseconds = 0U, Callback_Watchdog::function timeout_callback = nullptr);
67
69 Provision_Callback(Device_Access_Token, function callback, char const * provision_device_key, char const * provision_device_secret, char const * access_token, char const * device_name = nullptr, uint64_t const & timeout_microseconds = 0U, Callback_Watchdog::function timeout_callback = nullptr);
70
72 Provision_Callback(Basic_MQTT_Credentials, function callback, char const * provision_device_key, char const * provision_device_secret, char const * username, char const * password, char const * client_id, char const * device_name = nullptr, uint64_t const & timeout_microseconds = 0U, Callback_Watchdog::function timeout_callback = nullptr);
73
75 Provision_Callback(X509_Certificate, function callback, char const * provision_device_key, char const * provision_device_secret, char const * hash, char const * device_name = nullptr, uint64_t const & timeout_microseconds = 0U, Callback_Watchdog::function timeout_callback = nullptr);
76
77 ~Provision_Callback() override = default;
78
82 char const * Get_Device_Key() const;
83
87 void Set_Device_Key(char const * provision_device_key);
88
92 char const * Get_Device_Secret() const;
93
97 void Set_Device_Secret(char const * provision_device_secret);
98
103 char const * Get_Device_Name() const;
104
109 void Set_Device_Name(char const * device_name) ;
110
115 char const * Get_Device_Access_Token() const;
116
121 void Set_Device_Access_Token(char const * access_token);
122
126 char const * Get_Credentials_Username() const;
127
131 void Set_Credentials_Username(char const * username);
132
136 char const * Get_Credentials_Password() const;
137
141 void Set_Credentials_Password(char const * password);
142
146 char const * Get_Credentials_Client_ID() const;
147
151 void Set_Credentials_Client_ID(char const * client_id);
152
156 char const * Get_Certificate_Hash() const;
157
161 void Set_Certificate_Hash(char const * hash);
162
167 char const * Get_Credentials_Type() const;
168
174
175 private:
176 char const *m_device_key = {}; // Device Profile provisioning key
177 char const *m_device_secret = {}; // Device Profile provisioning secret
178 char const *m_device_name = {}; // Device name the provisioned device should have
179 char const *m_access_token = {}; // Access token supplied by the device, if it should not be generated by the server instead
180 char const *m_cred_username = {}; // MQTT credential username, if the MQTT basic credentials method is used
181 char const *m_cred_password = {}; // MQTT credential password, if the MQTT basic credentials method is used
182 char const *m_cred_client_id = {}; // MQTT credential client_id, if Mthe QTT basic credentials method is used
183 char const *m_hash = {}; // X.509 certificate hash, if the X.509 certificate authentication method is used
184 char const *m_credentials_type = {}; // Credentials type we are requesting from the server, nullptr for the default option (Credentials generated by the ThingsBoard server)
185 Timeoutable_Request m_request_timeout = {}; // Handles callback that will be called if request times out
186};
187
188#endif // Provision_Callback_h
General purpose safe callback wrapper. Expects either c-style or c++ style function pointer,...
Definition: Callback.h:30
std::function< void(argument_types... arguments)> function
Callback signature.
Definition: Callback.h:34
Provisioning callback wrapper.
Definition: Provision_Callback.h:28
char const * Get_Credentials_Type() const
Gets the string containing the used credentials type that decides which provisioning method is actual...
Definition: Provision_Callback.cpp:136
char const * Get_Credentials_Client_ID() const
Gets the basic MQTT credentials client ID, that will be used by the provisioned device.
Definition: Provision_Callback.cpp:120
Timeoutable_Request & Get_Request_Timeout()
Gets the request timeout callback.
Definition: Provision_Callback.cpp:140
void Set_Credentials_Username(char const *username)
Sets the basic MQTT credentials username, that will be used by the provisioned device.
Definition: Provision_Callback.cpp:108
char const * Get_Credentials_Username() const
Gets the basic MQTT credentials username, that will be used by the provisioned device.
Definition: Provision_Callback.cpp:104
char const * Get_Certificate_Hash() const
Gets the public X.509 certificate hash, that will be used by the provisioned device.
Definition: Provision_Callback.cpp:128
void Set_Device_Key(char const *provision_device_key)
Sets the provisioning key of the Device Profile, that should be used to create the device under.
Definition: Provision_Callback.cpp:76
char const * Get_Device_Name() const
Gets the name the created device should have on the cloud.
Definition: Provision_Callback.cpp:88
char const * Get_Credentials_Password() const
Gets the basic MQTT credentials password, that will be used by the provisioned device.
Definition: Provision_Callback.cpp:112
void Set_Credentials_Client_ID(char const *client_id)
Sets the basic MQTT credentials client ID, that will be used by the provisioned device.
Definition: Provision_Callback.cpp:124
void Set_Device_Access_Token(char const *access_token)
Sets the access token generated by the device, that will be used by the provisioned device.
Definition: Provision_Callback.cpp:100
void Set_Device_Secret(char const *provision_device_secret)
Sets the provisioning secret of the Device Profile that should be used to create the device under.
Definition: Provision_Callback.cpp:84
~Provision_Callback() override=default
char const * Get_Device_Access_Token() const
Gets the access token generated by the device, that will be used by the provisioned device.
Definition: Provision_Callback.cpp:96
void Set_Certificate_Hash(char const *hash)
Sets the public X.509 certificate hash, that will be used by the provisioned device.
Definition: Provision_Callback.cpp:132
char const * Get_Device_Secret() const
Gets the provisioning secret of the Device Profile that should be used to create the device under.
Definition: Provision_Callback.cpp:80
Provision_Callback()=default
Constructs empty callback, will result in never being called. Internals are simply default constructe...
void Set_Device_Name(char const *device_name)
Sets the name the created device should have on the cloud, pass nullptr or an empty string if a rando...
Definition: Provision_Callback.cpp:92
void Set_Credentials_Password(char const *password)
Sets the basic MQTT credentials password, that will be used by the provisioned device.
Definition: Provision_Callback.cpp:116
char const * Get_Device_Key() const
Gets the provisioning key of the Device Profile, that should be used to create the device under.
Definition: Provision_Callback.cpp:72
General purpose request callback that can timeout if the response to the request is not received in t...
Definition: Timeoutable_Request.h:10
Struct dispatch tag used to differentiate between the differnt possible provisioning strategies and t...
Definition: Provision_Callback.h:10
Struct dispatch tag used to differentiate between the differnt possible provisioning strategies and t...
Definition: Provision_Callback.h:18
Struct dispatch tag used to differentiate between the differnt possible provisioning strategies and t...
Definition: Provision_Callback.h:14
Struct dispatch tag used to differentiate between the differnt possible provisioning strategies and t...
Definition: Provision_Callback.h:22