1 /* 2 * Copyright (C) 2023 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 NFC_ABILITY_CONNECTION_CALLBACK_H 16 #define NFC_ABILITY_CONNECTION_CALLBACK_H 17 18 #include "ability_connect_callback_interface.h" 19 #include "ability_connect_callback_stub.h" 20 #include "host_card_emulation_manager.h" 21 22 namespace OHOS { 23 namespace NFC { 24 class HostCardEmulationManager; 25 class NfcAbilityConnectionCallback : public AAFwk::AbilityConnectionStub { 26 public: 27 NfcAbilityConnectionCallback(); 28 virtual ~NfcAbilityConnectionCallback(); 29 30 void OnAbilityConnectDone(const AppExecFwk::ElementName &element, 31 const sptr<IRemoteObject> &remoteObject, 32 int resultCode) override; 33 void OnAbilityDisconnectDone(const AppExecFwk::ElementName &element, 34 int resultCode) override; 35 bool ServiceConnected(); 36 void SetHceManager(std::weak_ptr<HostCardEmulationManager> hceManager); 37 AppExecFwk::ElementName GetConnectedElement(); 38 39 private: 40 bool serviceConnected_; 41 std::weak_ptr<HostCardEmulationManager> hceManager_{}; 42 AppExecFwk::ElementName connectedElement_; 43 }; 44 } // namespace NFC 45 } // namespace OHOS 46 #endif 47