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 16 #ifndef HDI_SAMPLE_SERVICE_STUB_CPP_INF_H 17 #define HDI_SAMPLE_SERVICE_STUB_CPP_INF_H 18 19 #include <ipc_object_stub.h> 20 #include <message_option.h> 21 #include <message_parcel.h> 22 #include <object_collector.h> 23 #include <refbase.h> 24 25 #include "sample_service.h" 26 27 namespace OHOS { 28 namespace HDI { 29 namespace Sample { 30 namespace V1_0 { 31 class SampleServiceStub : public OHOS::IPCObjectStub { 32 public: 33 explicit SampleServiceStub(const sptr<ISample> &serviceImpl); 34 virtual ~SampleServiceStub(); 35 36 int32_t SampleStubGetInterface(MessageParcel &data, MessageParcel &reply, MessageOption &option) const; 37 38 int32_t OnRemoteRequest( 39 uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override; 40 41 private: 42 static inline ObjectDelegator<SampleServiceStub, ISample> objDelegator_; 43 sptr<ISample> impl_; 44 }; 45 } // namespace V1_0 46 } // namespace Sample 47 } // namespace HDI 48 } // namespace OHOS 49 50 #endif // HDI_SAMPLE_SERVICE_STUB_CPP_INF_H