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_P2P_GROUP_JOIN_STATE_H
16 #define OHOS_P2P_GROUP_JOIN_STATE_H
17 
18 #include "state.h"
19 #include "wifi_p2p_group_manager.h"
20 #include "wifi_p2p_device_manager.h"
21 
22 namespace OHOS {
23 namespace Wifi {
24 class P2pStateMachine;
25 class P2pGroupJoinState : public State {
26     FRIEND_GTEST(P2pGroupJoinState);
27 
28 public:
29     /**
30      * @Description Construct a new P2pGroupJoinState object
31      * @param None
32      * @return None
33      */
34     P2pGroupJoinState(P2pStateMachine &stateMachine, WifiP2pGroupManager &groupMgr, WifiP2pDeviceManager &deviceMgr);
35 
36     /**
37      * @Description Destroy the P2pGroupJoinState object
38      * @param None
39      * @return None
40      */
41     ~P2pGroupJoinState() = default;
42 
43     /**
44      * @Description - Called when entering state
45      * @param None
46      * @return None
47      */
48     virtual void GoInState() override;
49 
50     /**
51      * @Description - Called when exiting state
52      * @param None
53      * @return None
54      */
55     virtual void GoOutState() override;
56 
57     /**
58      * @Description - Message Processing Function
59      * @param msg - Message object pointer
60      * @return - bool true:success   false:fail
61      */
62     virtual bool ExecuteStateMsg(InternalMessagePtr msg) override;
63 
64     void StartPbc(const WpsInfo &wps);
65 
66 private:
67     P2pStateMachine &p2pStateMachine;
68     WifiP2pGroupManager &groupManager;
69     WifiP2pDeviceManager &deviceManager;
70 };
71 } // namespace Wifi
72 } // namespace OHOS
73 
74 #endif /* OHOS_P2P_GROUP_JOIN_STATE_H */
75