1 /* 2 * Copyright (c) 2025 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 REMOTE_OBJECT_IMPL_H 17 #define REMOTE_OBJECT_IMPL_H 18 19 #include "cj_common_ffi.h" 20 #include "ffi_remote_data.h" 21 #include "message_sequence_impl.h" 22 #include "remote_object_holder_impl.h" 23 #include "iremote_object_impl.h" 24 25 namespace OHOS { 26 class CjRemoteObjectImpl : public CjIRemoteObjectImpl { 27 DECL_TYPE(CjRemoteObjectImpl, OHOS::FFI::FFIData) 28 public: 29 explicit CjRemoteObjectImpl(RemoteObjectHolderImpl* holder); 30 ~CjRemoteObjectImpl(); 31 char* GetDescriptor(int32_t* errCode); 32 int32_t ModifyLocalInterface(char* stringValue); 33 int32_t SendMessageRequest(uint32_t code, int64_t dataId, int64_t replyId, MessageOption option, int64_t funcId); 34 RemoteObjectHolderImpl* GetHolder(); 35 bool IsProxyObject() override; 36 sptr<IRemoteObject> GetRemoteObject() override; 37 38 private: 39 RemoteObjectHolderImpl* holder_; 40 }; 41 42 int64_t CreateStubRemoteObject(const sptr<IRemoteObject> target); 43 int64_t CreateProxyRemoteObject(const sptr<IRemoteObject> target); 44 int64_t CJ_rpc_CreateRemoteObject(const sptr<IRemoteObject> target); 45 sptr<IRemoteObject> CJ_rpc_getNativeRemoteObject(int64_t object); 46 } // namespace OHOS 47 #endif // REMOTE_OBJECT_IMPL_H