1 /*
2  * Copyright (c) 2024 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 P2P_AVAILABLE_STATE_H
17 #define P2P_AVAILABLE_STATE_H
18 
19 #include "p2p_entity_state.h"
20 #include "p2p_operation.h"
21 
22 namespace OHOS::SoftBus {
23 class P2pAvailableState : public P2pEntityState {
24 public:
25     static P2pAvailableState *Instance();
GetName()26     std::string GetName() override { return "P2pAvailableState"; }
27     void Enter(const std::shared_ptr<P2pOperation> &operation) override;
28     void Exit() override;
29 
30     int CreateGroup(const std::shared_ptr<P2pOperationWrapper<P2pCreateGroupParam>> &operation) override;
31     int Connect(const std::shared_ptr<P2pOperationWrapper<P2pConnectParam>> &operation) override;
32     int DestroyGroup(const std::shared_ptr<P2pOperationWrapper<P2pDestroyGroupParam>> &operation) override;
33 
34     int RemoveLink(const std::shared_ptr<P2pOperationWrapper<P2pDestroyGroupParam>> &operation) override;
35     void OnP2pStateChangeEvent(P2pState state) override;
36     void OnP2pConnectionChangeEvent(
37         const WifiP2pLinkedInfo &info, const std::shared_ptr<P2pAdapter::WifiDirectP2pGroupInfo> &groupInfo) override;
38 
39 private:
40     std::shared_ptr<P2pOperation> operation_;
41 };
42 } // namespace OHOS::SoftBus
43 #endif