smartconfig_ack.h 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. // Copyright 2010-2017 Espressif Systems (Shanghai) PTE LTD
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. #ifndef SMARTCONFIG_ACK_H
  15. #define SMARTCONFIG_ACK_H
  16. #ifdef __cplusplus
  17. extern "C" {
  18. #endif
  19. #define SC_ACK_TASK_PRIORITY 2 /*!< Priority of sending smartconfig ACK task */
  20. #define SC_ACK_TASK_STACK_SIZE 2048 /*!< Stack size of sending smartconfig ACK task */
  21. #define SC_ACK_TOUCH_SERVER_PORT 18266 /*!< ESP touch UDP port of server on cellphone */
  22. #define SC_ACK_AIRKISS_SERVER_PORT 10000 /*!< Airkiss UDP port of server on cellphone */
  23. #define SC_ACK_AIRKISS_DEVICE_PORT 10001 /*!< Airkiss UDP port of server on device */
  24. #define SC_ACK_AIRKISS_TIMEOUT 1500 /*!< Airkiss read data timeout millisecond */
  25. #define SC_ACK_TOUCH_LEN 11 /*!< Length of ESP touch ACK context */
  26. #define SC_ACK_AIRKISS_LEN 7 /*!< Length of Airkiss ACK context */
  27. #define SC_ACK_MAX_COUNT 30 /*!< Maximum count of sending smartconfig ACK */
  28. /**
  29. * @brief Smartconfig ACK type.
  30. */
  31. typedef enum {
  32. SC_ACK_TYPE_ESPTOUCH = 0, /*!< ESP touch ACK type */
  33. SC_ACK_TYPE_AIRKISS, /*!< Airkiss ACK type */
  34. } sc_ack_type_t;
  35. /**
  36. * @brief Smartconfig parameters passed to sc_ack_send call.
  37. */
  38. typedef struct sc_ack {
  39. sc_ack_type_t type; /*!< Smartconfig ACK type */
  40. uint8_t *link_flag; /*!< Smartconfig link flag */
  41. sc_callback_t cb; /*!< Smartconfig callback function */
  42. struct {
  43. uint8_t token; /*!< Smartconfig token to be sent */
  44. uint8_t mac[6]; /*!< MAC address of station */
  45. uint8_t ip[4]; /*!< IP address of cellphone */
  46. } ctx;
  47. } sc_ack_t;
  48. /**
  49. * @brief Send smartconfig ACK to cellphone.
  50. *
  51. * @attention The API is only used in libsmartconfig.a.
  52. *
  53. * @param param: smartconfig parameters;
  54. */
  55. void sc_ack_send(sc_ack_t *param);
  56. /**
  57. * @brief Stop sending smartconfig ACK to cellphone.
  58. *
  59. * @attention The API is only used in libsmartconfig.a.
  60. */
  61. void sc_ack_send_stop(void);
  62. #ifdef __cplusplus
  63. }
  64. #endif
  65. #endif