• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2020 HiHope Community.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions are met:
6  *
7  * 1. Redistributions of source code must retain the above copyright notice, this
8  *    list of conditions and the following disclaimer.
9  *
10  * 2. Redistributions in binary form must reproduce the above copyright notice,
11  *    this list of conditions and the following disclaimer in the documentation
12  *    and/or other materials provided with the distribution.
13  *
14  * 3. Neither the name of the copyright holder nor the names of its
15  *    contributors may be used to endorse or promote products derived from
16  *    this software without specific prior written permission.
17  *
18  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
22  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28  */
29 
30 #ifndef WIFI_DEVICE_UTIL_H
31 #define WIFI_DEVICE_UTIL_H
32 
33 #include "wifi_device.h"
34 #include "wifi_device_config.h"
35 #include "wifi_error_code.h"
36 
37 #include  "wm_wifi_api.h"
38 
39 /**
40  * @brief lock wifi global lock
41  *
42  * @return WifiErrorCode.
43  */
44 WifiErrorCode LockWifiGlobalLock(void);
45 
46 /**
47  * @brief unlock wifi global lock
48  *
49  * @return WifiErrorCode.
50  */
51 WifiErrorCode UnlockWifiGlobalLock(void);
52 
53 /**
54  * @brief lock wifi event lock
55  *
56  * @return WifiErrorCode.
57  */
58 WifiErrorCode LockWifiEventLock(void);
59 
60 /**
61  * @brief unlock wifi event lock
62  *
63  * @return WifiErrorCode.
64  */
65 WifiErrorCode UnlockWifiEventLock(void);
66 
67 /**
68  * @brief convert Harmony OS security type to WinnerMicro security type
69  *
70  * @param type [in] Harmony OS security type.
71  *
72  * @return WinnerMicro security type.
73  */
74 int HoSec2WmSec(WifiSecurityType type);
75 
76 /**
77  * @brief convert WinnerMicro security type to Harmony OS security type
78  *
79  * @param type [in] WinnerMicro security type.
80  *
81  * @return Harmony OS security type.
82  */
83 WifiSecurityType WmSec2HoSec(int mode);
84 
85 /**
86  * @brief convert WinnerMicro enum tls_wifi_auth_mode to Harmony OS WifiSecurityType
87  *
88  * @param mode in WinnerMicro enum tls_wifi_auth_mode type.
89  *
90  * @return Harmony OS WifiSecurityType
91  */
92 WifiSecurityType WmAuth2HoSec(int mode);
93 
94 #endif  // WIFI_DEVICE_UTIL_H
95