1 /* 2 * Copyright (C) 2022 - 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 TAG_SESSION_STUB_H 16 #define TAG_SESSION_STUB_H 17 18 #include "foreground_callback_proxy.h" 19 20 #include "access_token.h" 21 #include "iforeground_callback.h" 22 #include "iremote_stub.h" 23 #include "itag_session.h" 24 #include "message_parcel.h" 25 26 namespace OHOS { 27 namespace NFC { 28 namespace TAG { 29 class TagSessionStub : public OHOS::IRemoteStub<OHOS::NFC::TAG::ITagSession> { 30 public: 31 int OnRemoteRequest(uint32_t code, /* [in] */ 32 OHOS::MessageParcel& data, /* [in] */ 33 OHOS::MessageParcel& reply, /* [out] */ 34 OHOS::MessageOption& option) override; /* [in] */ TagSessionStub()35 TagSessionStub() {} ~TagSessionStub()36 virtual ~TagSessionStub() {} 37 void RemoveForegroundDeathRcpt(const wptr<IRemoteObject> &remote); 38 39 private: 40 int HandleConnect(OHOS::MessageParcel& data, OHOS::MessageParcel& reply); 41 int HandleReconnect(OHOS::MessageParcel& data, OHOS::MessageParcel& reply); 42 int HandleDisconnect(OHOS::MessageParcel& data, OHOS::MessageParcel& reply); 43 int HandleSetTimeout(OHOS::MessageParcel& data, OHOS::MessageParcel& reply); 44 int HandleGetTimeout(OHOS::MessageParcel& data, OHOS::MessageParcel& reply); 45 int HandleGetTechList(OHOS::MessageParcel& data, OHOS::MessageParcel& reply); 46 int HandleIsTagFieldOn(OHOS::MessageParcel& data, OHOS::MessageParcel& reply); 47 int HandleIsNdef(OHOS::MessageParcel& data, OHOS::MessageParcel& reply); 48 int HandleSendRawFrame(OHOS::MessageParcel& data, OHOS::MessageParcel& reply); 49 int HandleNdefRead(OHOS::MessageParcel& data, OHOS::MessageParcel& reply); 50 int HandleNdefWrite(OHOS::MessageParcel& data, OHOS::MessageParcel& reply); 51 int HandleNdefMakeReadOnly(OHOS::MessageParcel& data, OHOS::MessageParcel& reply); 52 int HandleFormatNdef(OHOS::MessageParcel& data, OHOS::MessageParcel& reply); 53 int HandleCanMakeReadOnly(OHOS::MessageParcel& data, OHOS::MessageParcel& reply); 54 int HandleGetMaxTransceiveLength(OHOS::MessageParcel& data, OHOS::MessageParcel& reply); 55 int HandleIsSupportedApdusExtended(OHOS::MessageParcel& data, OHOS::MessageParcel& reply); 56 int HandleRegForegroundDispatch(MessageParcel& data, MessageParcel& reply); 57 int HandleUnregForegroundDispatch(MessageParcel& data, MessageParcel& reply); 58 59 private: 60 std::mutex mutex_ {}; 61 sptr<KITS::IForegroundCallback> foregroundCallback_; 62 sptr<IRemoteObject::DeathRecipient> deathRecipient_ {nullptr}; 63 }; 64 } // namespace TAG 65 } // namespace NFC 66 } // namespace OHOS 67 #endif // TAG_SESSION_STUB_H 68