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 OHOS_STA_MONITOR_H 16 #define OHOS_STA_MONITOR_H 17 18 #include "sta_state_machine.h" 19 20 namespace OHOS { 21 namespace Wifi { 22 class StaMonitor { 23 FRIEND_GTEST(StaMonitor); 24 public: 25 /** 26 * @Description : Construct a new Sta Monitor object. 27 * 28 */ 29 explicit StaMonitor(int instId = 0); 30 31 /** 32 * @Description Destroy the Sta Monitor object. 33 * 34 */ 35 virtual ~StaMonitor(); 36 37 /** 38 * @Description : Initialize the sta monitor. 39 * 40 */ 41 ErrCode InitStaMonitor(); 42 43 /** 44 * @Description : Uninitialize the sta monitor. 45 * 46 */ 47 ErrCode UnInitStaMonitor() const; 48 49 /** 50 * @Description : Generating a Sta State Machine Instance. 51 * 52 * @param paraStaStateMachine - a Sta State Machine Instance [in] 53 */ 54 void SetStateMachine(StaStateMachine *paraStaStateMachine); 55 56 /** 57 * @Description : Callback of the connection state change event. 58 * 59 * @param status : status codes [in] 60 * @param networkId - network id [in] 61 * @param bssid - bssid of the network [in] 62 */ 63 void OnConnectChangedCallBack(int status, int networkId,const std::string &bssid); 64 65 /** 66 * @Description : Callback of the connection state change event. 67 * 68 * @param reason - reason id [in] 69 * @param bssid - bssid of the network [in] 70 */ 71 void OnReportDisConnectReasonCallBack(int reason, const std::string &bssid); 72 73 /** 74 * @Description : Callback of the hilink trigger boardcast and wps. 75 * 76 * @param bssid - bssid of the network [in] 77 */ 78 void OnWpaHilinkCallBack(const std::string &bssid); 79 80 /** 81 * @Description : Callback of the connection state change event. 82 * 83 * @param reason : reason for bssid change [in] 84 * @param bssid: bssid of the network [in] 85 */ 86 void OnBssidChangedCallBack(const std::string &reason, const std::string &bssid); 87 88 /** 89 * @Description : Callback of the wpa state change event. 90 * 91 * @param status - status codes [in] 92 */ 93 void OnWpaStateChangedCallBack(int status); 94 95 /** 96 * @Description : Callback of the Wpa ssid wrong key event. 97 */ 98 void OnWpaSsidWrongKeyCallBack(); 99 100 /** 101 * @Description : Callback of the Connection Full event. 102 * 103 * @param status - status codes [in] 104 */ 105 void OnWpaConnectionFullCallBack(int status); 106 107 /** 108 * @Description : Callback of the Connection Refused event. 109 * 110 * @param status - status codes [in] 111 */ 112 void OnWpaConnectionRejectCallBack(int status); 113 114 /** 115 * @Description : Callback of the WPS_OVERLAP event. 116 * 117 * @param status - status codes [in] 118 */ 119 void OnWpsPbcOverlapCallBack(int status); 120 121 /** 122 * @Description : Callback of the WPS_TIMEOUT event. 123 * 124 * @param status - status codes [in] 125 */ 126 void OnWpsTimeOutCallBack(int status); 127 128 /** 129 * @Description : Callback of the AUTH TIMEOUT event. 130 */ 131 void OnWpaAuthTimeOutCallBack(); 132 133 /** 134 * @Description : Callback of the SIM/AKA/AKA' authentication event. 135 * 136 * @param notifyParam - authentication information [in] 137 */ 138 void OnWpaEapSimAuthCallBack(const std::string ¬ifyParam); 139 140 /** 141 * @Description : Callback of the STA event. 142 * 143 * @param notifyParam - authentication information [in] 144 */ 145 void OnWpaStaNotifyCallBack(const std::string ¬ifyParam); 146 147 private: 148 StaStateMachine *pStaStateMachine; 149 int m_instId; 150 }; 151 } // namespace Wifi 152 } // namespace OHOS 153 #endif