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 
16 #ifndef OHOS_SCAN_MONITOR_H
17 #define OHOS_SCAN_MONITOR_H
18 
19 #include "wifi_log.h"
20 #include "wifi_error_no.h"
21 #include "wifi_native_define.h"
22 #include "scan_common.h"
23 #include "scan_state_machine.h"
24 
25 namespace OHOS {
26 namespace Wifi {
27 class ScanMonitor {
28     FRIEND_GTEST(ScanMonitor);
29 public:
30     explicit ScanMonitor(int instId = 0);
31     ~ScanMonitor();
32     /**
33      * @Description  Scan monitor initialization function.
34      *
35      * @return success: true, failed: false
36      */
37     bool InitScanMonitor();
38     /**
39      * @Description  Scan monitor uninitialization function.
40      */
41     void UnInitScanMonitor();
42     /**
43      * @Description  scanMonitor needs to send messages to the scan state machine.
44      *
45      * @param paraScanStateMachine - scan state machine[in]
46      */
47     void SetScanStateMachine(ScanStateMachine *paraScanStateMachine);
48     /**
49      * @Description  Receive an event notification.
50      *
51      * @param result - Received events[in]
52      */
53     void ReceiveScanEventFromIdl(int result);
54 
55 private:
56     ScanStateMachine *pScanStateMachine;
57 
58     /**
59      * @Description  Send Scan Info.
60      *
61      */
62     void SendScanInfoEvent();
63     /**
64      * @Description  Send Pno scanning results.
65      *
66      */
67     void SendPnoScanInfoEvent();
68     /**
69      * @Description  Sending Scan Failure Events.
70      *
71      */
72     void SendScanFailedEvent();
73     /**
74      * @Description  Processing Event Notifications.
75      *
76      * @param result - Received events[in]
77      */
78     void ProcessReceiveScanEvent(int result);
79 
80 private:
81     int m_instId;
82 };
83 }  // namespace Wifi
84 }  // namespace OHOS
85 #endif
86