1 /* 2 * Copyright (C) 2022 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_CONTROLLER_IMPL_H 16 #define NFC_CONTROLLER_IMPL_H 17 18 #include "infc_controller_callback.h" 19 #include "nfc_controller_stub.h" 20 #include "nfc_sdk_common.h" 21 #include "nfc_service.h" 22 23 namespace OHOS { 24 namespace NFC { 25 class NfcService; 26 class NfcControllerImpl final : public NfcControllerStub { 27 public: 28 explicit NfcControllerImpl(std::weak_ptr<NfcService> nfcService); 29 ~NfcControllerImpl() override; 30 31 int GetState() override; 32 int TurnOn() override; 33 int TurnOff() override; 34 int IsNfcOpen(bool &isOpen) override; 35 KITS::ErrorCode RegisterCallBack(const sptr<INfcControllerCallback> &callback, 36 const std::string& type, Security::AccessToken::AccessTokenID callerToken) override; 37 KITS::ErrorCode UnRegisterCallBack(const std::string& type, 38 Security::AccessToken::AccessTokenID callerToken) override; 39 KITS::ErrorCode UnRegisterAllCallBack(Security::AccessToken::AccessTokenID callerToken) override; 40 OHOS::sptr<IRemoteObject> GetTagServiceIface() override; 41 int32_t Dump(int32_t fd, const std::vector<std::u16string>& args) override; 42 private: 43 std::string GetDumpInfo(); 44 std::weak_ptr<NfcService> nfcService_; 45 std::mutex mutex_ {}; 46 }; 47 } // namespace NFC 48 } // namespace OHOS 49 #endif // NFC_CONTROLLER_IMPL_H 50