smartconfig_ack.h 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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_TOUCH_LEN 11 /*!< Length of ESP touch ACK context */
  24. #define SC_ACK_AIRKISS_LEN 7 /*!< Length of Airkiss ACK context */
  25. #define SC_ACK_MAX_COUNT 30 /*!< Maximum count of sending smartconfig ACK */
  26. /**
  27. * @brief Smartconfig ACK type.
  28. */
  29. typedef enum {
  30. SC_ACK_TYPE_ESPTOUCH = 0, /*!< ESP touch ACK type */
  31. SC_ACK_TYPE_AIRKISS, /*!< Airkiss ACK type */
  32. } sc_ack_type_t;
  33. /**
  34. * @brief Smartconfig parameters passed to sc_ack_send call.
  35. */
  36. typedef struct sc_ack {
  37. sc_ack_type_t type; /*!< Smartconfig ACK type */
  38. uint8_t *link_flag; /*!< Smartconfig link flag */
  39. sc_callback_t cb; /*!< Smartconfig callback function */
  40. struct {
  41. uint8_t token; /*!< Smartconfig token to be sent */
  42. uint8_t mac[6]; /*!< MAC address of station */
  43. uint8_t ip[4]; /*!< IP address of cellphone */
  44. } ctx;
  45. } sc_ack_t;
  46. /**
  47. * @brief Send smartconfig ACK to cellphone.
  48. *
  49. * @attention The API is only used in libsmartconfig.a.
  50. *
  51. * @param param: smartconfig parameters;
  52. */
  53. void sc_ack_send(sc_ack_t *param);
  54. /**
  55. * @brief Stop sending smartconfig ACK to cellphone.
  56. *
  57. * @attention The API is only used in libsmartconfig.a.
  58. */
  59. void sc_ack_send_stop(void);
  60. #ifdef __cplusplus
  61. }
  62. #endif
  63. #endif