ST Things SDK
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator
st_things.h
Go to the documentation of this file.
1 /* ****************************************************************
2  *
3  * Copyright 2017 Samsung Electronics All Rights Reserved.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  ******************************************************************/
18 
19 #ifndef __ST_THINGS_H__
20 #define __ST_THINGS_H__
21 
22 #include <stdint.h>
23 #include <stdbool.h>
24 
25 #ifdef __ST_THINGS_RTOS__
26 #include <st_things/st_things_types.h>
27 #else
28 #include "st_things_types.h"
29 #endif // __ST_THINGS_RTOS__
30 
31 #ifdef __cplusplus
32 extern "C" {
33 #endif /* __cplusplus */
34 
60 int st_things_initialize(const char *json_path, bool *easysetup_complete);
61 
73 int st_things_deinitialize(void);
74 
82 
90 
106 
123 int st_things_start(void);
124 
137 int st_things_stop(void);
138 
143 typedef bool (*st_things_reset_confirm_cb)(void);
144 
149 typedef void (*st_things_reset_result_cb)(bool is_success);
150 
166 
178 int st_things_reset(void);
179 
186 typedef void (*st_things_pin_generated_cb)(const char *pin_data, const size_t pin_size);
187 
191 typedef void (*st_things_pin_display_close_cb)(void);
192 
208 
213 typedef bool (*st_things_user_confirm_cb)(void);
214 
228 
233 typedef void (*st_things_status_change_cb)(st_things_status_e things_status);
234 
248 
262 int st_things_notify_observers(const char *resource_uri);
263 
270 
276 
277 #ifdef __cplusplus
278 }
279 #endif /* __cplusplus */
280 
281 #endif /* __ST_THINGS_H__ */
int st_things_deinitialize(void)
Deinitializes things stack. Stack should have been initialized before calling this API...
st_things_representation_s * st_things_create_representation_inst(void)
Create an instance of representation.
int st_things_initialize(const char *json_path, bool *easysetup_complete)
Initializes things stack and returns whether easy-setup is completed or not. Easy-setup enable users ...
int st_things_register_user_confirm_cb(st_things_user_confirm_cb confirm_cb)
Callback registration function for getting user confirmation for MUTUAL VERIFICATION BASED JUST WORK ...
void(* st_things_reset_result_cb)(bool is_success)
Callback for carrying the result of reset.
Definition: st_things.h:149
bool(* st_things_get_request_cb)(st_things_get_request_message_s *req_msg, st_things_representation_s *resp_rep)
Callback for handling GET request.
Definition: st_things.h:81
void(* st_things_status_change_cb)(st_things_status_e things_status)
Callback for getting the current state of ST Things.
Definition: st_things.h:233
int st_things_register_pin_handling_cb(st_things_pin_generated_cb generated_cb, st_things_pin_display_close_cb close_cb)
Callback registration function for getting randomly generated PIN for the PIN-Based Ownership Transfe...
void(* st_things_pin_display_close_cb)(void)
Callback for informing the application to close the PIN display.
Definition: st_things.h:191
int st_things_register_reset_cb(st_things_reset_confirm_cb confirm_cb, st_things_reset_result_cb result_cb)
Callback registration function for Reset-Confirmation and Reset-Result functions. ...
void st_things_destroy_representation_inst(st_things_representation_s *rep)
Destroy an instance of representation.
int st_things_stop(void)
Stops things stack. Removes all the data being used internally and releases all the memory allocated ...
Structure for Representation.
Definition: st_things_types.h:61
Structure for representing the Set Request Message.
Definition: st_things_types.h:304
bool(* st_things_set_request_cb)(st_things_set_request_message_s *req_msg, st_things_representation_s *resp_rep)
Callback for handling SET(POST) request.
Definition: st_things.h:89
int st_things_start(void)
Starts things stack. Parses the thing definition(whose path is passed to st_things_initialize(), configures the thing, creates the resources and prepares it for easy-setup. If easy-setup is not done yet, onboarding will be started using either SoftAP or BLE connection. Onboarding creates an ad-hoc network between the thing and the client for performing easy-setup. If easy-setup is already done, thing will be connected with the cloud. Application can know whether easy-setup is done or not through st_things_initialize API. Stack should have been initialized before calling this API.
bool(* st_things_user_confirm_cb)(void)
Callback for getting user's input regarding mutual verification.
Definition: st_things.h:213
Structure for representing the Get Request Message.
Definition: st_things_types.h:276
st_things_status_e
Enumeration for ST Things status.
Definition: st_things_types.h:44
int st_things_register_things_status_change_cb(st_things_status_change_cb status_cb)
Callback registration function for getting notified when ST Things state changes. ...
void(* st_things_pin_generated_cb)(const char *pin_data, const size_t pin_size)
Callback for carrying the randomly generated PIN info.
Definition: st_things.h:186
int st_things_reset(void)
Reset all the data related to security and cloud being used in the stack. Stack should have been init...
bool(* st_things_reset_confirm_cb)(void)
Callback for getting user's opinion regarding device reset.
Definition: st_things.h:143
int st_things_register_request_cb(st_things_get_request_cb get_cb, st_things_set_request_cb set_cb)
Callback registration function for handling request messages.
int st_things_notify_observers(const char *resource_uri)
Notify the observers of a specific resource. Stack should have been initialized and started before ca...