at_device_esp32.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /*
  2. * Copyright (c) 2006-2023, RT-Thread Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. * 2019-05-16 chenyong first version
  9. */
  10. #ifndef __AT_DEVICE_ESP32_H__
  11. #define __AT_DEVICE_ESP32_H__
  12. #ifdef __cplusplus
  13. extern "C" {
  14. #endif
  15. #include <stdlib.h>
  16. #include <at_device.h>
  17. #define ESP32_DEFAULT_AT_VERSION "1.4.0.0"
  18. #define ESP32_DEFAULT_AT_VERSION_NUM 0x1040000
  19. /* The maximum number of sockets supported by the esp32 device */
  20. #define AT_DEVICE_ESP32_SOCKETS_NUM 5
  21. struct at_device_esp32
  22. {
  23. char *device_name;
  24. char *client_name;
  25. char *wifi_ssid;
  26. char *wifi_password;
  27. size_t recv_line_num;
  28. struct at_device device;
  29. uint16_t urc_socket;
  30. void *user_data;
  31. };
  32. typedef struct at_AP_INFO
  33. {
  34. uint8_t ecn; /* 加密方式 */
  35. char ssid[32]; /* 无线网络名称,最多31字节 + 终止符 */
  36. int8_t rssi; /* 信号强度 */
  37. uint8_t mac[6]; /* MAC地址 */
  38. uint8_t channel; /* 频道 */
  39. } at_ap_info_t;
  40. #ifdef AT_USING_SOCKET
  41. /* esp32 device socket initialize */
  42. int esp32_socket_init(struct at_device *device);
  43. /* esp32 device class socket register */
  44. int esp32_socket_class_register(struct at_device_class *class);
  45. /* convert the esp32 AT version string to hexadecimal */
  46. unsigned int esp32_at_version_to_hex(const char *str);
  47. /* obtain the esp32 AT version number */
  48. unsigned int esp32_get_at_version(void);
  49. #endif /* AT_USING_SOCKET */
  50. /* scan the AP information */
  51. int esp32_scan_ap(struct at_device *device, at_ap_info_t *ap_info, uint8_t num);
  52. #ifdef __cplusplus
  53. }
  54. #endif
  55. #endif /* __AT_DEVICE_ESP32_H__ */