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 FORCE_DISCONNECT_COMMAND_H 17 #define FORCE_DISCONNECT_COMMAND_H 18 19 #include "wifi_direct_types.h" 20 #include "command/wifi_direct_command.h" 21 #include "channel/negotiate_channel.h" 22 23 namespace OHOS::SoftBus { 24 struct ForceDisconnectInfo { 25 WifiDirectForceDisconnectInfo info_; 26 std::shared_ptr<NegotiateChannel> channel_; 27 }; 28 29 class ForceDisconnectCommand : public WifiDirectCommand { 30 public: 31 ForceDisconnectCommand(const WifiDirectForceDisconnectInfo &info, const WifiDirectDisconnectCallback &callback); 32 33 std::string GetRemoteDeviceId() const override; 34 std::shared_ptr<WifiDirectProcessor> GetProcessor() override; GetType()35 CommandType GetType() const override 36 { 37 return CommandType::FORCE_DISCONNECT_COMMAND; 38 } 39 40 ForceDisconnectInfo GetDisconnectInfo() const; 41 std::shared_ptr<NegotiateChannel> GetNegotiateChannel() const; 42 43 void OnSuccess() const; 44 void OnFailure(int32_t reason) const; 45 46 protected: 47 ForceDisconnectInfo info_; 48 WifiDirectDisconnectCallback callback_; 49 mutable std::string remoteDeviceId_; 50 }; 51 } // namespace OHOS::SoftBus 52 #endif