1 /* 2 * Copyright (C) 2021 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 OHOS_DBINDER_TEST_SERVICE_H 17 #define OHOS_DBINDER_TEST_SERVICE_H 18 19 #include "dbinder_test_service_skeleton.h" 20 #include "hilog/log.h" 21 22 namespace OHOS { 23 class DBinderTestService : public DBinderTestServiceStub { 24 public: 25 DBinderTestService() = default; 26 virtual ~DBinderTestService(); 27 static int Instantiate(); 28 int ReverseInt(int data, int &rep) override; 29 int ReverseIntDelay(int data, int &rep) override; 30 int Delay(int data, int &rep) override; 31 int PingService(std::u16string &serviceName) override; 32 int TransProxyObject(int data, sptr<IRemoteObject> &transObject, int operation, int &rep, 33 int &withdrawRes) override; 34 int TransProxyObjectRefCount(sptr<IRemoteObject> &transObject, int operation) override; 35 int TransProxyObjectAgain(int data, sptr<IRemoteObject> &transObject, int operation, int &rep, 36 int &withdrawRes) override; 37 int TransStubObject(int data, sptr<IRemoteObject> &transObject, int &rep, int &stubRep) override; 38 int TransStubObjectRefCount(sptr<IRemoteObject> &transObject, int operation) override; 39 int TransOversizedPkt(const std::string &dataStr, std::string &repStr) override; 40 int ProxyTransRawData(int length) override; 41 int StubTransRawData(int length) override; 42 int GetChildId(uint64_t &rep) override; 43 sptr<IRemoteObject> GetRemoteObject(int type) override; 44 int FlushAsyncCommands(int count, int length) override; 45 int GetRemoteDecTimes() override; 46 void ClearRemoteDecTimes() override; 47 48 public: 49 static std::mutex destructTimesMutex_; 50 static int destructTimes_; 51 sptr<IRemoteObject> object_; 52 }; 53 } // namespace OHOS 54 55 #endif // OHOS_DBINDER_TEST_SERVICE_H 56