1 /* 2 * Copyright (C) 2015-2018 Alibaba Group Holding Limited 3 */ 4 5 #ifndef __AWSS_H__ 6 #define __AWSS_H__ 7 8 #include <stdint.h> 9 10 #include "linkkit/infra/infra_defs.h" 11 12 #if defined(__cplusplus) /* If this is a C++ compiler, use C linkage */ 13 extern "C" { 14 #endif 15 16 int awss_start(void); 17 18 /** 19 * @brief stop wifi setup service 20 * 21 * @retval -1 : failure 22 * @retval 0 : sucess 23 * @note 24 * if awss_stop is called before exit of awss_start, awss and notify will 25 * stop. 26 */ 27 int awss_stop(void); 28 29 /** 30 * @brief make sure user touches device belong to themselves 31 * 32 * @retval -1 : failure 33 * @retval 0 : sucess 34 * @note: AWSS doesn't parse awss packet until user touches deivce use this api. 35 */ 36 int awss_config_press(void); 37 38 /** 39 * @brief get the awss config press status in realtime. 40 * 41 * @retval 1 : user has touched device 42 * @retval 0 : user don't touch device 43 */ 44 uint8_t awss_get_config_press(void); 45 46 /** 47 * @brief check reset flag in perisistent storage. 48 * 49 * @retval -1 : failure 50 * @retval 0 : sucess 51 * @note 52 * check reset flag in perisistent storage, if device failed to report 53 * reset message last time, retry it. 54 */ 55 int awss_check_reset(void); 56 57 /** 58 * @brief report reset to cloud. 59 * 60 * @retval -1 : failure 61 * @retval 0 : sucess 62 * @note 63 * device will save reset flag if device dosen't connect cloud, device will 64 * fails to send reset to cloud. when connection between device and cloud is 65 * ready, device will retry to report reset to cloud. 66 */ 67 int awss_report_reset(void); 68 69 /** 70 * @brief stop to report reset to cloud. 71 * 72 * @retval -1 : failure 73 * @retval 0 : sucess 74 * @note 75 * just stop report reset to cloud without any touch reset flag in flash. 76 */ 77 int awss_stop_report_reset(void); 78 79 /** 80 * @brief start to connect to the router with the specified parameters. 81 * 82 * @param ssid: Router ssid 83 * @param passwd: Router password 84 * @param bssid: Router bssid(hex array) 85 * @param bssid_len: the length of bssid,0-6 byte 86 * @param token: bind token(hex array) 87 * @param token_len: the length of token,0-16 byte 88 * 89 * @retval -1 : failure 90 * @retval 0 : sucess 91 * @note 92 * token is used for device bind,optional. 93 */ 94 int awss_connect(char ssid[HAL_MAX_SSID_LEN], char passwd[HAL_MAX_PASSWD_LEN], 95 uint8_t *bssid, uint8_t bssid_len, uint8_t *token, 96 uint8_t token_len); 97 98 #if defined(__cplusplus) /* If this is a C++ compiler, use C linkage */ 99 } 100 #endif 101 102 #endif 103