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 #ifndef WIFI_DIRECT_DISCONNECT_COMMAND_H 16 #define WIFI_DIRECT_DISCONNECT_COMMAND_H 17 18 #include "channel/auth_negotiate_channel.h" 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 DisconnectInfo { 25 WifiDirectDisconnectInfo info_; 26 std::shared_ptr<NegotiateChannel> channel_; 27 }; 28 29 class DisconnectCommand : public WifiDirectCommand { 30 public: 31 DisconnectCommand(const WifiDirectDisconnectInfo &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::DISCONNECT_COMMAND; 38 } 39 40 DisconnectInfo 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 DisconnectInfo info_; 48 WifiDirectDisconnectCallback callback_; 49 mutable std::string remoteDeviceId_; 50 }; 51 } 52 #endif 53