iot_netcfg_nan.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. /*
  2. * Copyright (c) 2021 Huawei Device Co., Ltd.
  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. */
  15. #ifndef __IOT_NETCFG_NAN_H__
  16. #define __IOT_NETCFG_NAN_H__
  17. #define NETCFG_TASK_STACK_SIZE (1024*4)
  18. #define NETCFG_TASK_PRIO 30
  19. #define NETCFG_LED_INTERVAL_TIME_US 300000
  20. #define NETCFG_BIZ_SLEEP_TIME_US 1000000
  21. #define NETCFG_TIME_COUNT 5
  22. #define DEVICE_INFO_NUM 2
  23. #define POWER_NUM (-52)
  24. #define MAX_DATA_LEN 4096
  25. #define FAST_CONNECT_RETRY_NUM 3
  26. #define CHANNEL_80211B_ONLY 14
  27. #define FREQ_OF_CHANNEL_1 2412
  28. #define FREQ_OF_CHANNEL_80211B_ONLY 2484
  29. #define WIFI_MIN_CHANNEL 1
  30. #define WIFI_FREQ_INTERVAL 5
  31. #define TEST_CONNECT_RETRY_COUNT 5
  32. typedef enum {
  33. NET_EVENT_NULL,
  34. NET_EVENT_CONFIG,
  35. NET_EVENT_CONFIG_FAIL, // Connected wifi failed
  36. NET_EVENT_CONFIG_SUCC, // Connected wifi success
  37. NET_EVENT_CONNECTTED, // Wifi connected
  38. NET_EVENT_DISTCONNECT, // Wifi disconnected
  39. NET_EVENT_RECV_DATA, // Recv message from FA
  40. NET_EVENT_SEND_DATA, // Send the message to FA
  41. NET_EVENT_TYPE_NBR
  42. }NET_EVENT_TYPE;
  43. /**
  44. * @brief: the network config service callback
  45. *
  46. * @param event reference {@link NET_EVENT_TYPE}
  47. * @param data The data of the event: NET_EVENT_RECV_DATA or NET_EVENT_SEND_DATA
  48. * @since 1.0
  49. * @version 1.0
  50. */
  51. typedef int (*NetCfgEventCallback)(NET_EVENT_TYPE event, void *data);
  52. /**
  53. * @brief Register the network config task
  54. *
  55. * @since 1.0
  56. * @version 1.0
  57. */
  58. void NetCfgRegister(void);
  59. /**
  60. * @brief start net config.
  61. *
  62. * @param ssid: the buff to store the wifi ssid
  63. * @param sLen: the ssid buff size
  64. * @param pwd: the buff to store the wifi password
  65. * @param pLen: the pwd buff size
  66. *
  67. * @since 1.0
  68. * @version 1.0
  69. *
  70. * @return 0 success, -1 failed
  71. */
  72. int BOARD_NAN_NetCfgStartConfig(const char *apName, char *ssid, int sLen, char *pwd, int pLen);
  73. #endif // __IOT_NETCFG_NAN_H__