mirror of
https://gitee.com/openharmony/ability_idl_tool
synced 2024-11-26 17:10:26 +00:00
!170 增加对 IRemoteObject 数据类型的支持,补充已上线业务 IDL 文件测试
Merge pull request !170 from 温裕/remote_object
This commit is contained in:
commit
3ce75d54a7
@ -108,6 +108,9 @@ void SaCppInterfaceCodeEmitter::EmitInterfaceSelfDefinedTypeInclusions(HeaderFil
|
||||
int sequenceableNumber = static_cast<int>(ast_->GetSequenceableDefNumber());
|
||||
for (int i = 0; i < sequenceableNumber; i++) {
|
||||
AutoPtr<ASTSequenceableType> seqType = ast_->GetSequenceableDef(i);
|
||||
if (seqType->GetName() == "IRemoteObject") {
|
||||
continue;
|
||||
}
|
||||
filePath = GetFilePathNoPoint(seqType->GetNamespace()->ToString());
|
||||
fileName = filePath.empty() ? FileName(seqType->GetName()) : FileName(filePath);
|
||||
headerFiles.emplace(HeaderFileType::OWN_MODULE_HEADER_FILE, fileName);
|
||||
@ -133,6 +136,9 @@ bool SaCppInterfaceCodeEmitter::EmitInterfaceUsings(StringBuilder &sb) const
|
||||
int sequenceableNumber = static_cast<int>(ast_->GetSequenceableDefNumber());
|
||||
for (int i = 0; i < sequenceableNumber; i++) {
|
||||
AutoPtr<ASTSequenceableType> seqType = ast_->GetSequenceableDef(i);
|
||||
if (seqType->GetName() == "IRemoteObject") {
|
||||
continue;
|
||||
}
|
||||
np = GetNamespace(seqType->GetNamespace()->ToString());
|
||||
if (np.empty()) {
|
||||
continue;
|
||||
|
@ -189,7 +189,12 @@ void SaCppServiceStubCodeEmitter::EmitInterfaceStubMethodCall(AutoPtr<ASTMethod>
|
||||
const std::string name = param->GetName();
|
||||
AutoPtr<ASTType> type = param->GetType();
|
||||
if ((type->GetTypeKind() == TypeKind::TYPE_SEQUENCEABLE) && (param->GetAttribute() & ASTParamAttr::PARAM_IN)) {
|
||||
const std::string parameterName = "*" + name;
|
||||
std::string parameterName = "*" + name;
|
||||
if (type->GetName() == "IRemoteObject") {
|
||||
parameterName = name;
|
||||
} else {
|
||||
parameterName = "*" + name;
|
||||
}
|
||||
sb.Append(parameterName.c_str());
|
||||
} else {
|
||||
sb.Append(name.c_str());
|
||||
|
@ -24,18 +24,34 @@ TypeKind SaSeqTypeEmitter::GetTypeKind()
|
||||
|
||||
std::string SaSeqTypeEmitter::EmitCppType(TypeMode mode) const
|
||||
{
|
||||
switch (mode) {
|
||||
case TypeMode::NO_MODE:
|
||||
case TypeMode::PARAM_IN:
|
||||
return StringHelper::Format("const %s&", typeName_.c_str());
|
||||
case TypeMode::PARAM_INOUT:
|
||||
return StringHelper::Format("%s*", typeName_.c_str());
|
||||
case TypeMode::PARAM_OUT:
|
||||
return StringHelper::Format("%s&", typeName_.c_str());
|
||||
case TypeMode::LOCAL_VAR:
|
||||
return StringHelper::Format("%s", typeName_.c_str());
|
||||
default:
|
||||
return "unknown type";
|
||||
if (typeName_ == "IRemoteObject") {
|
||||
switch (mode) {
|
||||
case TypeMode::PARAM_IN:
|
||||
return StringHelper::Format("const sptr<%s>&", typeName_.c_str());
|
||||
case TypeMode::PARAM_INOUT:
|
||||
return StringHelper::Format("sptr<%s>&", typeName_.c_str());
|
||||
case TypeMode::PARAM_OUT:
|
||||
return StringHelper::Format("sptr<%s>&", typeName_.c_str());
|
||||
case TypeMode::NO_MODE:
|
||||
case TypeMode::LOCAL_VAR:
|
||||
return StringHelper::Format("sptr<%s>", typeName_.c_str());
|
||||
default:
|
||||
return "unknown type";
|
||||
}
|
||||
} else {
|
||||
switch (mode) {
|
||||
case TypeMode::NO_MODE:
|
||||
case TypeMode::PARAM_IN:
|
||||
return StringHelper::Format("const %s&", typeName_.c_str());
|
||||
case TypeMode::PARAM_INOUT:
|
||||
return StringHelper::Format("%s*", typeName_.c_str());
|
||||
case TypeMode::PARAM_OUT:
|
||||
return StringHelper::Format("%s&", typeName_.c_str());
|
||||
case TypeMode::LOCAL_VAR:
|
||||
return StringHelper::Format("%s", typeName_.c_str());
|
||||
default:
|
||||
return "unknown type";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -52,7 +68,11 @@ std::string SaSeqTypeEmitter::EmitTsType(TypeMode mode) const
|
||||
void SaSeqTypeEmitter::EmitCppWriteVar(const std::string &parcelName, const std::string &name, StringBuilder &sb,
|
||||
const std::string &prefix) const
|
||||
{
|
||||
sb.Append(prefix).AppendFormat("if (!%sWriteParcelable(&%s)) {\n", parcelName.c_str(), name.c_str());
|
||||
if (typeName_ == "IRemoteObject") {
|
||||
sb.Append(prefix).AppendFormat("if (!%sWriteRemoteObject(%s)) {\n", parcelName.c_str(), name.c_str());
|
||||
} else {
|
||||
sb.Append(prefix).AppendFormat("if (!%sWriteParcelable(&%s)) {\n", parcelName.c_str(), name.c_str());
|
||||
}
|
||||
if (logOn_) {
|
||||
sb.Append(prefix).Append(TAB).AppendFormat("HiLog::Error(LABEL, \"Write [%s] failed!\");\n", name.c_str());
|
||||
}
|
||||
@ -63,22 +83,39 @@ void SaSeqTypeEmitter::EmitCppWriteVar(const std::string &parcelName, const std:
|
||||
void SaSeqTypeEmitter::EmitCppReadVar(const std::string &parcelName, const std::string &name, StringBuilder &sb,
|
||||
const std::string &prefix, bool emitType) const
|
||||
{
|
||||
if (emitType) {
|
||||
sb.Append(prefix).AppendFormat("std::unique_ptr<%s> %s(%sReadParcelable<%s>());\n\n",
|
||||
typeName_.c_str(), name.c_str(), parcelName.c_str(), typeName_.c_str());
|
||||
sb.Append(prefix).AppendFormat("if (!%s) {\n", name.c_str());
|
||||
if (logOn_) {
|
||||
sb.Append(prefix).Append(TAB).AppendFormat(
|
||||
"HiLog::Error(LABEL, \"Read [%s] failed!\");\n", typeName_.c_str());
|
||||
if (typeName_ == "IRemoteObject") {
|
||||
if (emitType) {
|
||||
sb.Append(prefix).AppendFormat("sptr<%s> %s = %sReadRemoteObject();\n",
|
||||
typeName_.c_str(), name.c_str(), parcelName.c_str(), typeName_.c_str());
|
||||
sb.Append(prefix).AppendFormat("if (!%s) {\n", name.c_str());
|
||||
if (logOn_) {
|
||||
sb.Append(prefix).Append(TAB).AppendFormat(
|
||||
"HiLog::Error(LABEL, \"Read [%s] failed!\");\n", typeName_.c_str());
|
||||
}
|
||||
sb.Append(prefix).Append(TAB).Append("return ERR_INVALID_DATA;\n");
|
||||
sb.Append(prefix).Append("}\n\n");
|
||||
} else {
|
||||
sb.Append(prefix).AppendFormat("%s = %sReadRemoteObject();\n\n",
|
||||
name.c_str(), parcelName.c_str());
|
||||
}
|
||||
sb.Append(prefix).Append(TAB).Append("return ERR_INVALID_DATA;\n");
|
||||
sb.Append(prefix).Append("}\n");
|
||||
} else {
|
||||
sb.Append(prefix).AppendFormat("std::unique_ptr<%s> %sInfo(%sReadParcelable<%s>());\n", typeName_.c_str(),
|
||||
name.c_str(), parcelName.c_str(), typeName_.c_str());
|
||||
sb.Append(prefix).AppendFormat("if (%sInfo != nullptr) {\n", name.c_str());
|
||||
sb.Append(prefix).Append(TAB).AppendFormat("%s = *%sInfo;\n", name.c_str(), name.c_str());
|
||||
sb.Append(prefix).Append("}\n\n");
|
||||
if (emitType) {
|
||||
sb.Append(prefix).AppendFormat("std::unique_ptr<%s> %s(%sReadParcelable<%s>());\n",
|
||||
typeName_.c_str(), name.c_str(), parcelName.c_str(), typeName_.c_str());
|
||||
sb.Append(prefix).AppendFormat("if (!%s) {\n", name.c_str());
|
||||
if (logOn_) {
|
||||
sb.Append(prefix).Append(TAB).AppendFormat(
|
||||
"HiLog::Error(LABEL, \"Read [%s] failed!\");\n", typeName_.c_str());
|
||||
}
|
||||
sb.Append(prefix).Append(TAB).Append("return ERR_INVALID_DATA;\n");
|
||||
sb.Append(prefix).Append("}\n\n");
|
||||
} else {
|
||||
sb.Append(prefix).AppendFormat("std::unique_ptr<%s> %sInfo(%sReadParcelable<%s>());\n",
|
||||
typeName_.c_str(), name.c_str(), parcelName.c_str(), typeName_.c_str());
|
||||
sb.Append(prefix).AppendFormat("if (%sInfo != nullptr) {\n", name.c_str());
|
||||
sb.Append(prefix).Append(TAB).AppendFormat("%s = *%sInfo;\n", name.c_str(), name.c_str());
|
||||
sb.Append(prefix).Append("}\n\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -235,16 +235,16 @@ int32_t FooStub::OnRemoteRequest(
|
||||
}
|
||||
case COMMAND_SEQ_TEST_FUNC: {
|
||||
std::unique_ptr<myseq> inParam(data.ReadParcelable<myseq>());
|
||||
|
||||
if (!inParam) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
|
||||
myseq outParam;
|
||||
std::unique_ptr<myseq> inoutParam(data.ReadParcelable<myseq>());
|
||||
|
||||
if (!inoutParam) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
|
||||
const myseq& result = nullptr;
|
||||
ErrCode errCode = seq_test_func(*inParam, outParam, *inoutParam, result);
|
||||
if (!reply.WriteInt32(errCode)) {
|
||||
|
@ -275,18 +275,18 @@ int32_t FooStub::OnRemoteRequest(
|
||||
}
|
||||
case COMMAND_SEQ_TEST_FUNC: {
|
||||
std::unique_ptr<myseq> inParam(data.ReadParcelable<myseq>());
|
||||
|
||||
if (!inParam) {
|
||||
HiLog::Error(LABEL, "Read [myseq] failed!");
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
|
||||
myseq outParam;
|
||||
std::unique_ptr<myseq> inoutParam(data.ReadParcelable<myseq>());
|
||||
|
||||
if (!inoutParam) {
|
||||
HiLog::Error(LABEL, "Read [myseq] failed!");
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
|
||||
const myseq& result = nullptr;
|
||||
ErrCode errCode = seq_test_func(*inParam, outParam, *inoutParam, result);
|
||||
if (!reply.WriteInt32(errCode)) {
|
||||
|
@ -235,16 +235,16 @@ int32_t FooStub::OnRemoteRequest(
|
||||
}
|
||||
case COMMAND_SEQ_TEST_FUNC: {
|
||||
std::unique_ptr<myseq> inParam(data.ReadParcelable<myseq>());
|
||||
|
||||
if (!inParam) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
|
||||
myseq outParam;
|
||||
std::unique_ptr<myseq> inoutParam(data.ReadParcelable<myseq>());
|
||||
|
||||
if (!inoutParam) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
|
||||
const myseq& result = nullptr;
|
||||
ErrCode errCode = seq_test_func(*inParam, outParam, *inoutParam, result);
|
||||
if (!reply.WriteInt32(errCode)) {
|
||||
|
44
test/sa_test/in_use_idl.py
Normal file
44
test/sa_test/in_use_idl.py
Normal file
@ -0,0 +1,44 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
#
|
||||
# Copyright (c) 2024 Huawei Device Co., Ltd.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
import os
|
||||
|
||||
from test_base import Test
|
||||
|
||||
|
||||
class InUseIdl(Test):
|
||||
def get_file_name(self):
|
||||
return __file__
|
||||
|
||||
def update_command(self):
|
||||
files = os.listdir(f'{self.working_dir}/foo')
|
||||
idl_files = []
|
||||
for file in files:
|
||||
idl_files.append(os.path.realpath(f'{self.working_dir}/foo/{file}'))
|
||||
self.command = self._command_format.format(self._idl, self._gen_langauge, ' '.join(idl_files), self.output_dir)
|
||||
|
||||
def run_cpp(self):
|
||||
self.set_gen_cpp_env()
|
||||
return self.run_choose(True)
|
||||
|
||||
def run(self):
|
||||
return self.run_cpp()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
InUseIdl().test()
|
18
test/sa_test/in_use_idl/foo/IAppFwkUpdateService.idl
Normal file
18
test/sa_test/in_use_idl/foo/IAppFwkUpdateService.idl
Normal file
@ -0,0 +1,18 @@
|
||||
/*
|
||||
* Copyright (c) 2024 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
interface OHOS.NWeb.IAppFwkUpdateService {
|
||||
void VerifyPackageInstall([in] String bundleName, [in] String hapPath, [out] int success);
|
||||
}
|
69
test/sa_test/in_use_idl/foo/IEsimService.idl
Normal file
69
test/sa_test/in_use_idl/foo/IEsimService.idl
Normal file
@ -0,0 +1,69 @@
|
||||
/*
|
||||
* Copyright (c) 2024 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
sequenceable download_profile_config_info_parcel..OHOS.Telephony.DownloadProfileConfigInfo;
|
||||
sequenceable download_profile_result_parcel..OHOS.Telephony.DownloadableProfile;
|
||||
sequenceable downloadable_profile_parcel..OHOS.Telephony.DownloadProfileResult;
|
||||
sequenceable euicc_info_parcel..OHOS.Telephony.EuiccInfo;
|
||||
sequenceable get_downloadable_profiles_result_parcel..OHOS.Telephony.GetDownloadableProfileMetadataResult;
|
||||
sequenceable profile_info_list_parcel..OHOS.Telephony.GetDownloadableProfilesResult;
|
||||
sequenceable profile_metadata_result_parcel..OHOS.Telephony.GetEuiccProfileInfoListResult;
|
||||
sequenceable response_esim_result..OHOS.Telephony.ResponseEsimResult;
|
||||
|
||||
interface OHOS.Telephony.IEsimService {
|
||||
void GetEid([in] int slotId, [out] String eId);
|
||||
void GetOsuStatus([in] int slotId, [out] int osuStatus);
|
||||
void StartOsu([in] int slotId, [out] int startOsuResult);
|
||||
void GetDownloadableProfileMetadata(
|
||||
[in] int slotId,
|
||||
[in] int portIndex,
|
||||
[in] DownloadableProfile profile,
|
||||
[in] boolean forceDisableProfile,
|
||||
[out] GetDownloadableProfileMetadataResult profileMetadataResult);
|
||||
void GetDownloadableProfiles(
|
||||
[in] int slotId,
|
||||
[in] int portIndex,
|
||||
[in] boolean forceDisableProfile,
|
||||
[out] GetDownloadableProfilesResult profileListResult);
|
||||
void DownloadProfile(
|
||||
[in] int slotId,
|
||||
[in] DownloadProfileConfigInfo configInfo,
|
||||
[in] DownloadableProfile profile,
|
||||
[out] DownloadProfileResult downloadProfileResult);
|
||||
void GetEuiccProfileInfoList([in] int slotId, [out] GetEuiccProfileInfoListResult euiccProfileInfoList);
|
||||
void GetEuiccInfo([in] int slotId, [out] EuiccInfo eUiccInfo);
|
||||
void DeleteProfile([in] int slotId, [in] String iccId, [out] int deleteProfileResult);
|
||||
void SwitchToProfile(
|
||||
[in] int slotId,
|
||||
[in] int portIndex,
|
||||
[in] String iccId,
|
||||
[in] boolean forceDisableProfile,
|
||||
[out] int switchToProfileResult);
|
||||
void SetProfileNickname(
|
||||
[in] int slotId,
|
||||
[in] String iccId,
|
||||
[in] String nickname,
|
||||
[out] int setProfileNicknameResult);
|
||||
void ResetMemory([in] int slotId, [in] int resetOption, [out] int resetMemoryResult);
|
||||
void ReserveProfilesForFactoryRestore([in] int slotId, [out] int restoreResult);
|
||||
void SetDefaultSmdpAddress(
|
||||
[in] int slotId,
|
||||
[in] String defaultSmdpAddress,
|
||||
[out] int setDefaultSmdpAddressResult);
|
||||
void GetDefaultSmdpAddress([in] int slotId, [out] String defaultSmdpAddress);
|
||||
void CancelSession([in] int slotId, [in] String transactionId, [in] int cancelReason,
|
||||
[out] ResponseEsimResult responseResult);
|
||||
void IsEsimSupported([in] int slotId);
|
||||
}
|
19
test/sa_test/in_use_idl/foo/IIdlTestService.idl
Normal file
19
test/sa_test/in_use_idl/foo/IIdlTestService.idl
Normal file
@ -0,0 +1,19 @@
|
||||
/*
|
||||
* Copyright (c) 2024 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
interface OHOS.IIdlTestService {
|
||||
void TestIntTransaction([in] int val);
|
||||
void TestStringTransaction([in] String val);
|
||||
}
|
22
test/sa_test/in_use_idl/foo/IQuickFixManager.idl
Normal file
22
test/sa_test/in_use_idl/foo/IQuickFixManager.idl
Normal file
@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Copyright (c) 2024 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
sequenceable QuickFixInfo..OHOS.AAFwk.ApplicationQuickFixInfo;
|
||||
|
||||
interface OHOS.AAFwk.IQuickFixManager {
|
||||
void ApplyQuickFix([in] String[] quickFixFiles, [in] boolean isDebug);
|
||||
void GetApplyedQuickFixInfo([in] String bundleName, [out] ApplicationQuickFixInfo quickFixInfo);
|
||||
void RevokeQuickFix([in] String bundleName);
|
||||
}
|
23
test/sa_test/in_use_idl/foo/ITestServerInterface.idl
Normal file
23
test/sa_test/in_use_idl/foo/ITestServerInterface.idl
Normal file
@ -0,0 +1,23 @@
|
||||
/*
|
||||
* Copyright (c) 2024 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
sequenceable SessionToken..OHOS.testserver.SessionToken;
|
||||
sequenceable CommonEventData..OHOS.EventFwk.CommonEventData;
|
||||
|
||||
interface OHOS.testserver.ITestServerInterface {
|
||||
void CreateSession([in] SessionToken sessionToken);
|
||||
void SetPasteData([in] String text);
|
||||
void PublishCommonEvent([in] CommonEventData event, [out] boolean re);
|
||||
}
|
@ -0,0 +1,58 @@
|
||||
/*
|
||||
* Copyright (c) 2024 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "app_fwk_update_service_proxy.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace NWeb {
|
||||
ErrCode AppFwkUpdateServiceProxy::VerifyPackageInstall(
|
||||
const std::string& bundleName,
|
||||
const std::string& hapPath,
|
||||
int32_t& success)
|
||||
{
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
MessageOption option(MessageOption::TF_SYNC);
|
||||
|
||||
if (!data.WriteInterfaceToken(GetDescriptor())) {
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
|
||||
if (!data.WriteString16(Str8ToStr16(bundleName))) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
if (!data.WriteString16(Str8ToStr16(hapPath))) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
|
||||
sptr<IRemoteObject> remote = Remote();
|
||||
if (remote == nullptr) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
int32_t result = remote->SendRequest(COMMAND_VERIFY_PACKAGE_INSTALL, data, reply, option);
|
||||
if (FAILED(result)) {
|
||||
return result;
|
||||
}
|
||||
|
||||
ErrCode errCode = reply.ReadInt32();
|
||||
if (FAILED(errCode)) {
|
||||
return errCode;
|
||||
}
|
||||
|
||||
success = reply.ReadInt32();
|
||||
return ERR_OK;
|
||||
}
|
||||
} // namespace NWeb
|
||||
} // namespace OHOS
|
@ -0,0 +1,47 @@
|
||||
/*
|
||||
* Copyright (c) 2024 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef OHOS_NWEB_APPFWKUPDATESERVICEPROXY_H
|
||||
#define OHOS_NWEB_APPFWKUPDATESERVICEPROXY_H
|
||||
|
||||
#include "iapp_fwk_update_service.h"
|
||||
#include <iremote_proxy.h>
|
||||
|
||||
namespace OHOS {
|
||||
namespace NWeb {
|
||||
class AppFwkUpdateServiceProxy : public IRemoteProxy<IAppFwkUpdateService> {
|
||||
public:
|
||||
explicit AppFwkUpdateServiceProxy(
|
||||
const sptr<IRemoteObject>& remote)
|
||||
: IRemoteProxy<IAppFwkUpdateService>(remote)
|
||||
{}
|
||||
|
||||
virtual ~AppFwkUpdateServiceProxy()
|
||||
{}
|
||||
|
||||
ErrCode VerifyPackageInstall(
|
||||
const std::string& bundleName,
|
||||
const std::string& hapPath,
|
||||
int32_t& success) override;
|
||||
|
||||
private:
|
||||
static constexpr int32_t COMMAND_VERIFY_PACKAGE_INSTALL = MIN_TRANSACTION_ID + 0;
|
||||
|
||||
static inline BrokerDelegator<AppFwkUpdateServiceProxy> delegator_;
|
||||
};
|
||||
} // namespace NWeb
|
||||
} // namespace OHOS
|
||||
#endif // OHOS_NWEB_APPFWKUPDATESERVICEPROXY_H
|
||||
|
@ -0,0 +1,54 @@
|
||||
/*
|
||||
* Copyright (c) 2024 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "app_fwk_update_service_stub.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace NWeb {
|
||||
int32_t AppFwkUpdateServiceStub::OnRemoteRequest(
|
||||
uint32_t code,
|
||||
MessageParcel& data,
|
||||
MessageParcel& reply,
|
||||
MessageOption& option)
|
||||
{
|
||||
std::u16string localDescriptor = GetDescriptor();
|
||||
std::u16string remoteDescriptor = data.ReadInterfaceToken();
|
||||
if (localDescriptor != remoteDescriptor) {
|
||||
return ERR_TRANSACTION_FAILED;
|
||||
}
|
||||
switch (code) {
|
||||
case COMMAND_VERIFY_PACKAGE_INSTALL: {
|
||||
std::string bundleName = Str16ToStr8(data.ReadString16());
|
||||
std::string hapPath = Str16ToStr8(data.ReadString16());
|
||||
int32_t success;
|
||||
ErrCode errCode = VerifyPackageInstall(bundleName, hapPath, success);
|
||||
if (!reply.WriteInt32(errCode)) {
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
if (SUCCEEDED(errCode)) {
|
||||
if (!reply.WriteInt32(success)) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
}
|
||||
return ERR_NONE;
|
||||
}
|
||||
default:
|
||||
return IPCObjectStub::OnRemoteRequest(code, data, reply, option);
|
||||
}
|
||||
|
||||
return ERR_TRANSACTION_FAILED;
|
||||
}
|
||||
} // namespace NWeb
|
||||
} // namespace OHOS
|
@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright (c) 2024 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef OHOS_NWEB_APPFWKUPDATESERVICESTUB_H
|
||||
#define OHOS_NWEB_APPFWKUPDATESERVICESTUB_H
|
||||
|
||||
#include "iapp_fwk_update_service.h"
|
||||
#include <iremote_stub.h>
|
||||
|
||||
namespace OHOS {
|
||||
namespace NWeb {
|
||||
class AppFwkUpdateServiceStub : public IRemoteStub<IAppFwkUpdateService> {
|
||||
public:
|
||||
int32_t OnRemoteRequest(
|
||||
uint32_t code,
|
||||
MessageParcel& data,
|
||||
MessageParcel& reply,
|
||||
MessageOption& option) override;
|
||||
|
||||
private:
|
||||
static constexpr int32_t COMMAND_VERIFY_PACKAGE_INSTALL = MIN_TRANSACTION_ID + 0;
|
||||
};
|
||||
} // namespace NWeb
|
||||
} // namespace OHOS
|
||||
#endif // OHOS_NWEB_APPFWKUPDATESERVICESTUB_H
|
||||
|
688
test/sa_test/in_use_idl/target_cpp/esim_service_proxy.cpp.txt
Normal file
688
test/sa_test/in_use_idl/target_cpp/esim_service_proxy.cpp.txt
Normal file
@ -0,0 +1,688 @@
|
||||
/*
|
||||
* Copyright (c) 2024 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "esim_service_proxy.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace Telephony {
|
||||
ErrCode EsimServiceProxy::GetEid(
|
||||
int32_t slotId,
|
||||
std::string& eId)
|
||||
{
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
MessageOption option(MessageOption::TF_SYNC);
|
||||
|
||||
if (!data.WriteInterfaceToken(GetDescriptor())) {
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
|
||||
if (!data.WriteInt32(slotId)) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
|
||||
sptr<IRemoteObject> remote = Remote();
|
||||
if (remote == nullptr) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
int32_t result = remote->SendRequest(COMMAND_GET_EID, data, reply, option);
|
||||
if (FAILED(result)) {
|
||||
return result;
|
||||
}
|
||||
|
||||
ErrCode errCode = reply.ReadInt32();
|
||||
if (FAILED(errCode)) {
|
||||
return errCode;
|
||||
}
|
||||
|
||||
eId = Str16ToStr8(reply.ReadString16());
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
ErrCode EsimServiceProxy::GetOsuStatus(
|
||||
int32_t slotId,
|
||||
int32_t& osuStatus)
|
||||
{
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
MessageOption option(MessageOption::TF_SYNC);
|
||||
|
||||
if (!data.WriteInterfaceToken(GetDescriptor())) {
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
|
||||
if (!data.WriteInt32(slotId)) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
|
||||
sptr<IRemoteObject> remote = Remote();
|
||||
if (remote == nullptr) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
int32_t result = remote->SendRequest(COMMAND_GET_OSU_STATUS, data, reply, option);
|
||||
if (FAILED(result)) {
|
||||
return result;
|
||||
}
|
||||
|
||||
ErrCode errCode = reply.ReadInt32();
|
||||
if (FAILED(errCode)) {
|
||||
return errCode;
|
||||
}
|
||||
|
||||
osuStatus = reply.ReadInt32();
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
ErrCode EsimServiceProxy::StartOsu(
|
||||
int32_t slotId,
|
||||
int32_t& startOsuResult)
|
||||
{
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
MessageOption option(MessageOption::TF_SYNC);
|
||||
|
||||
if (!data.WriteInterfaceToken(GetDescriptor())) {
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
|
||||
if (!data.WriteInt32(slotId)) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
|
||||
sptr<IRemoteObject> remote = Remote();
|
||||
if (remote == nullptr) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
int32_t result = remote->SendRequest(COMMAND_START_OSU, data, reply, option);
|
||||
if (FAILED(result)) {
|
||||
return result;
|
||||
}
|
||||
|
||||
ErrCode errCode = reply.ReadInt32();
|
||||
if (FAILED(errCode)) {
|
||||
return errCode;
|
||||
}
|
||||
|
||||
startOsuResult = reply.ReadInt32();
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
ErrCode EsimServiceProxy::GetDownloadableProfileMetadata(
|
||||
int32_t slotId,
|
||||
int32_t portIndex,
|
||||
const DownloadableProfile& profile,
|
||||
bool forceDisableProfile,
|
||||
GetDownloadableProfileMetadataResult& profileMetadataResult)
|
||||
{
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
MessageOption option(MessageOption::TF_SYNC);
|
||||
|
||||
if (!data.WriteInterfaceToken(GetDescriptor())) {
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
|
||||
if (!data.WriteInt32(slotId)) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
if (!data.WriteInt32(portIndex)) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
if (!data.WriteParcelable(&profile)) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
if (!data.WriteInt32(forceDisableProfile ? 1 : 0)) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
|
||||
sptr<IRemoteObject> remote = Remote();
|
||||
if (remote == nullptr) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
int32_t result = remote->SendRequest(COMMAND_GET_DOWNLOADABLE_PROFILE_METADATA, data, reply, option);
|
||||
if (FAILED(result)) {
|
||||
return result;
|
||||
}
|
||||
|
||||
ErrCode errCode = reply.ReadInt32();
|
||||
if (FAILED(errCode)) {
|
||||
return errCode;
|
||||
}
|
||||
|
||||
std::unique_ptr<GetDownloadableProfileMetadataResult> profileMetadataResultInfo(reply.ReadParcelable<GetDownloadableProfileMetadataResult>());
|
||||
if (profileMetadataResultInfo != nullptr) {
|
||||
profileMetadataResult = *profileMetadataResultInfo;
|
||||
}
|
||||
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
ErrCode EsimServiceProxy::GetDownloadableProfiles(
|
||||
int32_t slotId,
|
||||
int32_t portIndex,
|
||||
bool forceDisableProfile,
|
||||
GetDownloadableProfilesResult& profileListResult)
|
||||
{
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
MessageOption option(MessageOption::TF_SYNC);
|
||||
|
||||
if (!data.WriteInterfaceToken(GetDescriptor())) {
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
|
||||
if (!data.WriteInt32(slotId)) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
if (!data.WriteInt32(portIndex)) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
if (!data.WriteInt32(forceDisableProfile ? 1 : 0)) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
|
||||
sptr<IRemoteObject> remote = Remote();
|
||||
if (remote == nullptr) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
int32_t result = remote->SendRequest(COMMAND_GET_DOWNLOADABLE_PROFILES, data, reply, option);
|
||||
if (FAILED(result)) {
|
||||
return result;
|
||||
}
|
||||
|
||||
ErrCode errCode = reply.ReadInt32();
|
||||
if (FAILED(errCode)) {
|
||||
return errCode;
|
||||
}
|
||||
|
||||
std::unique_ptr<GetDownloadableProfilesResult> profileListResultInfo(reply.ReadParcelable<GetDownloadableProfilesResult>());
|
||||
if (profileListResultInfo != nullptr) {
|
||||
profileListResult = *profileListResultInfo;
|
||||
}
|
||||
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
ErrCode EsimServiceProxy::DownloadProfile(
|
||||
int32_t slotId,
|
||||
const DownloadProfileConfigInfo& configInfo,
|
||||
const DownloadableProfile& profile,
|
||||
DownloadProfileResult& downloadProfileResult)
|
||||
{
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
MessageOption option(MessageOption::TF_SYNC);
|
||||
|
||||
if (!data.WriteInterfaceToken(GetDescriptor())) {
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
|
||||
if (!data.WriteInt32(slotId)) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
if (!data.WriteParcelable(&configInfo)) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
if (!data.WriteParcelable(&profile)) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
|
||||
sptr<IRemoteObject> remote = Remote();
|
||||
if (remote == nullptr) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
int32_t result = remote->SendRequest(COMMAND_DOWNLOAD_PROFILE, data, reply, option);
|
||||
if (FAILED(result)) {
|
||||
return result;
|
||||
}
|
||||
|
||||
ErrCode errCode = reply.ReadInt32();
|
||||
if (FAILED(errCode)) {
|
||||
return errCode;
|
||||
}
|
||||
|
||||
std::unique_ptr<DownloadProfileResult> downloadProfileResultInfo(reply.ReadParcelable<DownloadProfileResult>());
|
||||
if (downloadProfileResultInfo != nullptr) {
|
||||
downloadProfileResult = *downloadProfileResultInfo;
|
||||
}
|
||||
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
ErrCode EsimServiceProxy::GetEuiccProfileInfoList(
|
||||
int32_t slotId,
|
||||
GetEuiccProfileInfoListResult& euiccProfileInfoList)
|
||||
{
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
MessageOption option(MessageOption::TF_SYNC);
|
||||
|
||||
if (!data.WriteInterfaceToken(GetDescriptor())) {
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
|
||||
if (!data.WriteInt32(slotId)) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
|
||||
sptr<IRemoteObject> remote = Remote();
|
||||
if (remote == nullptr) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
int32_t result = remote->SendRequest(COMMAND_GET_EUICC_PROFILE_INFO_LIST, data, reply, option);
|
||||
if (FAILED(result)) {
|
||||
return result;
|
||||
}
|
||||
|
||||
ErrCode errCode = reply.ReadInt32();
|
||||
if (FAILED(errCode)) {
|
||||
return errCode;
|
||||
}
|
||||
|
||||
std::unique_ptr<GetEuiccProfileInfoListResult> euiccProfileInfoListInfo(reply.ReadParcelable<GetEuiccProfileInfoListResult>());
|
||||
if (euiccProfileInfoListInfo != nullptr) {
|
||||
euiccProfileInfoList = *euiccProfileInfoListInfo;
|
||||
}
|
||||
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
ErrCode EsimServiceProxy::GetEuiccInfo(
|
||||
int32_t slotId,
|
||||
EuiccInfo& eUiccInfo)
|
||||
{
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
MessageOption option(MessageOption::TF_SYNC);
|
||||
|
||||
if (!data.WriteInterfaceToken(GetDescriptor())) {
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
|
||||
if (!data.WriteInt32(slotId)) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
|
||||
sptr<IRemoteObject> remote = Remote();
|
||||
if (remote == nullptr) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
int32_t result = remote->SendRequest(COMMAND_GET_EUICC_INFO, data, reply, option);
|
||||
if (FAILED(result)) {
|
||||
return result;
|
||||
}
|
||||
|
||||
ErrCode errCode = reply.ReadInt32();
|
||||
if (FAILED(errCode)) {
|
||||
return errCode;
|
||||
}
|
||||
|
||||
std::unique_ptr<EuiccInfo> eUiccInfoInfo(reply.ReadParcelable<EuiccInfo>());
|
||||
if (eUiccInfoInfo != nullptr) {
|
||||
eUiccInfo = *eUiccInfoInfo;
|
||||
}
|
||||
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
ErrCode EsimServiceProxy::DeleteProfile(
|
||||
int32_t slotId,
|
||||
const std::string& iccId,
|
||||
int32_t& deleteProfileResult)
|
||||
{
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
MessageOption option(MessageOption::TF_SYNC);
|
||||
|
||||
if (!data.WriteInterfaceToken(GetDescriptor())) {
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
|
||||
if (!data.WriteInt32(slotId)) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
if (!data.WriteString16(Str8ToStr16(iccId))) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
|
||||
sptr<IRemoteObject> remote = Remote();
|
||||
if (remote == nullptr) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
int32_t result = remote->SendRequest(COMMAND_DELETE_PROFILE, data, reply, option);
|
||||
if (FAILED(result)) {
|
||||
return result;
|
||||
}
|
||||
|
||||
ErrCode errCode = reply.ReadInt32();
|
||||
if (FAILED(errCode)) {
|
||||
return errCode;
|
||||
}
|
||||
|
||||
deleteProfileResult = reply.ReadInt32();
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
ErrCode EsimServiceProxy::SwitchToProfile(
|
||||
int32_t slotId,
|
||||
int32_t portIndex,
|
||||
const std::string& iccId,
|
||||
bool forceDisableProfile,
|
||||
int32_t& switchToProfileResult)
|
||||
{
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
MessageOption option(MessageOption::TF_SYNC);
|
||||
|
||||
if (!data.WriteInterfaceToken(GetDescriptor())) {
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
|
||||
if (!data.WriteInt32(slotId)) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
if (!data.WriteInt32(portIndex)) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
if (!data.WriteString16(Str8ToStr16(iccId))) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
if (!data.WriteInt32(forceDisableProfile ? 1 : 0)) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
|
||||
sptr<IRemoteObject> remote = Remote();
|
||||
if (remote == nullptr) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
int32_t result = remote->SendRequest(COMMAND_SWITCH_TO_PROFILE, data, reply, option);
|
||||
if (FAILED(result)) {
|
||||
return result;
|
||||
}
|
||||
|
||||
ErrCode errCode = reply.ReadInt32();
|
||||
if (FAILED(errCode)) {
|
||||
return errCode;
|
||||
}
|
||||
|
||||
switchToProfileResult = reply.ReadInt32();
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
ErrCode EsimServiceProxy::SetProfileNickname(
|
||||
int32_t slotId,
|
||||
const std::string& iccId,
|
||||
const std::string& nickname,
|
||||
int32_t& setProfileNicknameResult)
|
||||
{
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
MessageOption option(MessageOption::TF_SYNC);
|
||||
|
||||
if (!data.WriteInterfaceToken(GetDescriptor())) {
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
|
||||
if (!data.WriteInt32(slotId)) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
if (!data.WriteString16(Str8ToStr16(iccId))) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
if (!data.WriteString16(Str8ToStr16(nickname))) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
|
||||
sptr<IRemoteObject> remote = Remote();
|
||||
if (remote == nullptr) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
int32_t result = remote->SendRequest(COMMAND_SET_PROFILE_NICKNAME, data, reply, option);
|
||||
if (FAILED(result)) {
|
||||
return result;
|
||||
}
|
||||
|
||||
ErrCode errCode = reply.ReadInt32();
|
||||
if (FAILED(errCode)) {
|
||||
return errCode;
|
||||
}
|
||||
|
||||
setProfileNicknameResult = reply.ReadInt32();
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
ErrCode EsimServiceProxy::ResetMemory(
|
||||
int32_t slotId,
|
||||
int32_t resetOption,
|
||||
int32_t& resetMemoryResult)
|
||||
{
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
MessageOption option(MessageOption::TF_SYNC);
|
||||
|
||||
if (!data.WriteInterfaceToken(GetDescriptor())) {
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
|
||||
if (!data.WriteInt32(slotId)) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
if (!data.WriteInt32(resetOption)) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
|
||||
sptr<IRemoteObject> remote = Remote();
|
||||
if (remote == nullptr) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
int32_t result = remote->SendRequest(COMMAND_RESET_MEMORY, data, reply, option);
|
||||
if (FAILED(result)) {
|
||||
return result;
|
||||
}
|
||||
|
||||
ErrCode errCode = reply.ReadInt32();
|
||||
if (FAILED(errCode)) {
|
||||
return errCode;
|
||||
}
|
||||
|
||||
resetMemoryResult = reply.ReadInt32();
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
ErrCode EsimServiceProxy::ReserveProfilesForFactoryRestore(
|
||||
int32_t slotId,
|
||||
int32_t& restoreResult)
|
||||
{
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
MessageOption option(MessageOption::TF_SYNC);
|
||||
|
||||
if (!data.WriteInterfaceToken(GetDescriptor())) {
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
|
||||
if (!data.WriteInt32(slotId)) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
|
||||
sptr<IRemoteObject> remote = Remote();
|
||||
if (remote == nullptr) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
int32_t result = remote->SendRequest(COMMAND_RESERVE_PROFILES_FOR_FACTORY_RESTORE, data, reply, option);
|
||||
if (FAILED(result)) {
|
||||
return result;
|
||||
}
|
||||
|
||||
ErrCode errCode = reply.ReadInt32();
|
||||
if (FAILED(errCode)) {
|
||||
return errCode;
|
||||
}
|
||||
|
||||
restoreResult = reply.ReadInt32();
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
ErrCode EsimServiceProxy::SetDefaultSmdpAddress(
|
||||
int32_t slotId,
|
||||
const std::string& defaultSmdpAddress,
|
||||
int32_t& setDefaultSmdpAddressResult)
|
||||
{
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
MessageOption option(MessageOption::TF_SYNC);
|
||||
|
||||
if (!data.WriteInterfaceToken(GetDescriptor())) {
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
|
||||
if (!data.WriteInt32(slotId)) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
if (!data.WriteString16(Str8ToStr16(defaultSmdpAddress))) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
|
||||
sptr<IRemoteObject> remote = Remote();
|
||||
if (remote == nullptr) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
int32_t result = remote->SendRequest(COMMAND_SET_DEFAULT_SMDP_ADDRESS, data, reply, option);
|
||||
if (FAILED(result)) {
|
||||
return result;
|
||||
}
|
||||
|
||||
ErrCode errCode = reply.ReadInt32();
|
||||
if (FAILED(errCode)) {
|
||||
return errCode;
|
||||
}
|
||||
|
||||
setDefaultSmdpAddressResult = reply.ReadInt32();
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
ErrCode EsimServiceProxy::GetDefaultSmdpAddress(
|
||||
int32_t slotId,
|
||||
std::string& defaultSmdpAddress)
|
||||
{
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
MessageOption option(MessageOption::TF_SYNC);
|
||||
|
||||
if (!data.WriteInterfaceToken(GetDescriptor())) {
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
|
||||
if (!data.WriteInt32(slotId)) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
|
||||
sptr<IRemoteObject> remote = Remote();
|
||||
if (remote == nullptr) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
int32_t result = remote->SendRequest(COMMAND_GET_DEFAULT_SMDP_ADDRESS, data, reply, option);
|
||||
if (FAILED(result)) {
|
||||
return result;
|
||||
}
|
||||
|
||||
ErrCode errCode = reply.ReadInt32();
|
||||
if (FAILED(errCode)) {
|
||||
return errCode;
|
||||
}
|
||||
|
||||
defaultSmdpAddress = Str16ToStr8(reply.ReadString16());
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
ErrCode EsimServiceProxy::CancelSession(
|
||||
int32_t slotId,
|
||||
const std::string& transactionId,
|
||||
int32_t cancelReason,
|
||||
ResponseEsimResult& responseResult)
|
||||
{
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
MessageOption option(MessageOption::TF_SYNC);
|
||||
|
||||
if (!data.WriteInterfaceToken(GetDescriptor())) {
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
|
||||
if (!data.WriteInt32(slotId)) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
if (!data.WriteString16(Str8ToStr16(transactionId))) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
if (!data.WriteInt32(cancelReason)) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
|
||||
sptr<IRemoteObject> remote = Remote();
|
||||
if (remote == nullptr) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
int32_t result = remote->SendRequest(COMMAND_CANCEL_SESSION, data, reply, option);
|
||||
if (FAILED(result)) {
|
||||
return result;
|
||||
}
|
||||
|
||||
ErrCode errCode = reply.ReadInt32();
|
||||
if (FAILED(errCode)) {
|
||||
return errCode;
|
||||
}
|
||||
|
||||
std::unique_ptr<ResponseEsimResult> responseResultInfo(reply.ReadParcelable<ResponseEsimResult>());
|
||||
if (responseResultInfo != nullptr) {
|
||||
responseResult = *responseResultInfo;
|
||||
}
|
||||
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
ErrCode EsimServiceProxy::IsEsimSupported(
|
||||
int32_t slotId)
|
||||
{
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
MessageOption option(MessageOption::TF_SYNC);
|
||||
|
||||
if (!data.WriteInterfaceToken(GetDescriptor())) {
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
|
||||
if (!data.WriteInt32(slotId)) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
|
||||
sptr<IRemoteObject> remote = Remote();
|
||||
if (remote == nullptr) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
int32_t result = remote->SendRequest(COMMAND_IS_ESIM_SUPPORTED, data, reply, option);
|
||||
if (FAILED(result)) {
|
||||
return result;
|
||||
}
|
||||
|
||||
ErrCode errCode = reply.ReadInt32();
|
||||
if (FAILED(errCode)) {
|
||||
return errCode;
|
||||
}
|
||||
|
||||
return ERR_OK;
|
||||
}
|
||||
} // namespace Telephony
|
||||
} // namespace OHOS
|
142
test/sa_test/in_use_idl/target_cpp/esim_service_proxy.h.txt
Normal file
142
test/sa_test/in_use_idl/target_cpp/esim_service_proxy.h.txt
Normal file
@ -0,0 +1,142 @@
|
||||
/*
|
||||
* Copyright (c) 2024 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef OHOS_TELEPHONY_ESIMSERVICEPROXY_H
|
||||
#define OHOS_TELEPHONY_ESIMSERVICEPROXY_H
|
||||
|
||||
#include "iesim_service.h"
|
||||
#include <iremote_proxy.h>
|
||||
|
||||
namespace OHOS {
|
||||
namespace Telephony {
|
||||
class EsimServiceProxy : public IRemoteProxy<IEsimService> {
|
||||
public:
|
||||
explicit EsimServiceProxy(
|
||||
const sptr<IRemoteObject>& remote)
|
||||
: IRemoteProxy<IEsimService>(remote)
|
||||
{}
|
||||
|
||||
virtual ~EsimServiceProxy()
|
||||
{}
|
||||
|
||||
ErrCode GetEid(
|
||||
int32_t slotId,
|
||||
std::string& eId) override;
|
||||
|
||||
ErrCode GetOsuStatus(
|
||||
int32_t slotId,
|
||||
int32_t& osuStatus) override;
|
||||
|
||||
ErrCode StartOsu(
|
||||
int32_t slotId,
|
||||
int32_t& startOsuResult) override;
|
||||
|
||||
ErrCode GetDownloadableProfileMetadata(
|
||||
int32_t slotId,
|
||||
int32_t portIndex,
|
||||
const DownloadableProfile& profile,
|
||||
bool forceDisableProfile,
|
||||
GetDownloadableProfileMetadataResult& profileMetadataResult) override;
|
||||
|
||||
ErrCode GetDownloadableProfiles(
|
||||
int32_t slotId,
|
||||
int32_t portIndex,
|
||||
bool forceDisableProfile,
|
||||
GetDownloadableProfilesResult& profileListResult) override;
|
||||
|
||||
ErrCode DownloadProfile(
|
||||
int32_t slotId,
|
||||
const DownloadProfileConfigInfo& configInfo,
|
||||
const DownloadableProfile& profile,
|
||||
DownloadProfileResult& downloadProfileResult) override;
|
||||
|
||||
ErrCode GetEuiccProfileInfoList(
|
||||
int32_t slotId,
|
||||
GetEuiccProfileInfoListResult& euiccProfileInfoList) override;
|
||||
|
||||
ErrCode GetEuiccInfo(
|
||||
int32_t slotId,
|
||||
EuiccInfo& eUiccInfo) override;
|
||||
|
||||
ErrCode DeleteProfile(
|
||||
int32_t slotId,
|
||||
const std::string& iccId,
|
||||
int32_t& deleteProfileResult) override;
|
||||
|
||||
ErrCode SwitchToProfile(
|
||||
int32_t slotId,
|
||||
int32_t portIndex,
|
||||
const std::string& iccId,
|
||||
bool forceDisableProfile,
|
||||
int32_t& switchToProfileResult) override;
|
||||
|
||||
ErrCode SetProfileNickname(
|
||||
int32_t slotId,
|
||||
const std::string& iccId,
|
||||
const std::string& nickname,
|
||||
int32_t& setProfileNicknameResult) override;
|
||||
|
||||
ErrCode ResetMemory(
|
||||
int32_t slotId,
|
||||
int32_t resetOption,
|
||||
int32_t& resetMemoryResult) override;
|
||||
|
||||
ErrCode ReserveProfilesForFactoryRestore(
|
||||
int32_t slotId,
|
||||
int32_t& restoreResult) override;
|
||||
|
||||
ErrCode SetDefaultSmdpAddress(
|
||||
int32_t slotId,
|
||||
const std::string& defaultSmdpAddress,
|
||||
int32_t& setDefaultSmdpAddressResult) override;
|
||||
|
||||
ErrCode GetDefaultSmdpAddress(
|
||||
int32_t slotId,
|
||||
std::string& defaultSmdpAddress) override;
|
||||
|
||||
ErrCode CancelSession(
|
||||
int32_t slotId,
|
||||
const std::string& transactionId,
|
||||
int32_t cancelReason,
|
||||
ResponseEsimResult& responseResult) override;
|
||||
|
||||
ErrCode IsEsimSupported(
|
||||
int32_t slotId) override;
|
||||
|
||||
private:
|
||||
static constexpr int32_t COMMAND_GET_EID = MIN_TRANSACTION_ID + 0;
|
||||
static constexpr int32_t COMMAND_GET_OSU_STATUS = MIN_TRANSACTION_ID + 1;
|
||||
static constexpr int32_t COMMAND_START_OSU = MIN_TRANSACTION_ID + 2;
|
||||
static constexpr int32_t COMMAND_GET_DOWNLOADABLE_PROFILE_METADATA = MIN_TRANSACTION_ID + 3;
|
||||
static constexpr int32_t COMMAND_GET_DOWNLOADABLE_PROFILES = MIN_TRANSACTION_ID + 4;
|
||||
static constexpr int32_t COMMAND_DOWNLOAD_PROFILE = MIN_TRANSACTION_ID + 5;
|
||||
static constexpr int32_t COMMAND_GET_EUICC_PROFILE_INFO_LIST = MIN_TRANSACTION_ID + 6;
|
||||
static constexpr int32_t COMMAND_GET_EUICC_INFO = MIN_TRANSACTION_ID + 7;
|
||||
static constexpr int32_t COMMAND_DELETE_PROFILE = MIN_TRANSACTION_ID + 8;
|
||||
static constexpr int32_t COMMAND_SWITCH_TO_PROFILE = MIN_TRANSACTION_ID + 9;
|
||||
static constexpr int32_t COMMAND_SET_PROFILE_NICKNAME = MIN_TRANSACTION_ID + 10;
|
||||
static constexpr int32_t COMMAND_RESET_MEMORY = MIN_TRANSACTION_ID + 11;
|
||||
static constexpr int32_t COMMAND_RESERVE_PROFILES_FOR_FACTORY_RESTORE = MIN_TRANSACTION_ID + 12;
|
||||
static constexpr int32_t COMMAND_SET_DEFAULT_SMDP_ADDRESS = MIN_TRANSACTION_ID + 13;
|
||||
static constexpr int32_t COMMAND_GET_DEFAULT_SMDP_ADDRESS = MIN_TRANSACTION_ID + 14;
|
||||
static constexpr int32_t COMMAND_CANCEL_SESSION = MIN_TRANSACTION_ID + 15;
|
||||
static constexpr int32_t COMMAND_IS_ESIM_SUPPORTED = MIN_TRANSACTION_ID + 16;
|
||||
|
||||
static inline BrokerDelegator<EsimServiceProxy> delegator_;
|
||||
};
|
||||
} // namespace Telephony
|
||||
} // namespace OHOS
|
||||
#endif // OHOS_TELEPHONY_ESIMSERVICEPROXY_H
|
||||
|
300
test/sa_test/in_use_idl/target_cpp/esim_service_stub.cpp.txt
Normal file
300
test/sa_test/in_use_idl/target_cpp/esim_service_stub.cpp.txt
Normal file
@ -0,0 +1,300 @@
|
||||
/*
|
||||
* Copyright (c) 2024 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "esim_service_stub.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace Telephony {
|
||||
int32_t EsimServiceStub::OnRemoteRequest(
|
||||
uint32_t code,
|
||||
MessageParcel& data,
|
||||
MessageParcel& reply,
|
||||
MessageOption& option)
|
||||
{
|
||||
std::u16string localDescriptor = GetDescriptor();
|
||||
std::u16string remoteDescriptor = data.ReadInterfaceToken();
|
||||
if (localDescriptor != remoteDescriptor) {
|
||||
return ERR_TRANSACTION_FAILED;
|
||||
}
|
||||
switch (code) {
|
||||
case COMMAND_GET_EID: {
|
||||
int32_t slotId = data.ReadInt32();
|
||||
std::string eId;
|
||||
ErrCode errCode = GetEid(slotId, eId);
|
||||
if (!reply.WriteInt32(errCode)) {
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
if (SUCCEEDED(errCode)) {
|
||||
if (!reply.WriteString16(Str8ToStr16(eId))) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
}
|
||||
return ERR_NONE;
|
||||
}
|
||||
case COMMAND_GET_OSU_STATUS: {
|
||||
int32_t slotId = data.ReadInt32();
|
||||
int32_t osuStatus;
|
||||
ErrCode errCode = GetOsuStatus(slotId, osuStatus);
|
||||
if (!reply.WriteInt32(errCode)) {
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
if (SUCCEEDED(errCode)) {
|
||||
if (!reply.WriteInt32(osuStatus)) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
}
|
||||
return ERR_NONE;
|
||||
}
|
||||
case COMMAND_START_OSU: {
|
||||
int32_t slotId = data.ReadInt32();
|
||||
int32_t startOsuResult;
|
||||
ErrCode errCode = StartOsu(slotId, startOsuResult);
|
||||
if (!reply.WriteInt32(errCode)) {
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
if (SUCCEEDED(errCode)) {
|
||||
if (!reply.WriteInt32(startOsuResult)) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
}
|
||||
return ERR_NONE;
|
||||
}
|
||||
case COMMAND_GET_DOWNLOADABLE_PROFILE_METADATA: {
|
||||
int32_t slotId = data.ReadInt32();
|
||||
int32_t portIndex = data.ReadInt32();
|
||||
std::unique_ptr<DownloadableProfile> profile(data.ReadParcelable<DownloadableProfile>());
|
||||
if (!profile) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
|
||||
bool forceDisableProfile = data.ReadInt32() == 1 ? true : false;
|
||||
GetDownloadableProfileMetadataResult profileMetadataResult;
|
||||
ErrCode errCode = GetDownloadableProfileMetadata(slotId, portIndex, *profile, forceDisableProfile, profileMetadataResult);
|
||||
if (!reply.WriteInt32(errCode)) {
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
if (SUCCEEDED(errCode)) {
|
||||
if (!reply.WriteParcelable(&profileMetadataResult)) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
}
|
||||
return ERR_NONE;
|
||||
}
|
||||
case COMMAND_GET_DOWNLOADABLE_PROFILES: {
|
||||
int32_t slotId = data.ReadInt32();
|
||||
int32_t portIndex = data.ReadInt32();
|
||||
bool forceDisableProfile = data.ReadInt32() == 1 ? true : false;
|
||||
GetDownloadableProfilesResult profileListResult;
|
||||
ErrCode errCode = GetDownloadableProfiles(slotId, portIndex, forceDisableProfile, profileListResult);
|
||||
if (!reply.WriteInt32(errCode)) {
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
if (SUCCEEDED(errCode)) {
|
||||
if (!reply.WriteParcelable(&profileListResult)) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
}
|
||||
return ERR_NONE;
|
||||
}
|
||||
case COMMAND_DOWNLOAD_PROFILE: {
|
||||
int32_t slotId = data.ReadInt32();
|
||||
std::unique_ptr<DownloadProfileConfigInfo> configInfo(data.ReadParcelable<DownloadProfileConfigInfo>());
|
||||
if (!configInfo) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
|
||||
std::unique_ptr<DownloadableProfile> profile(data.ReadParcelable<DownloadableProfile>());
|
||||
if (!profile) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
|
||||
DownloadProfileResult downloadProfileResult;
|
||||
ErrCode errCode = DownloadProfile(slotId, *configInfo, *profile, downloadProfileResult);
|
||||
if (!reply.WriteInt32(errCode)) {
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
if (SUCCEEDED(errCode)) {
|
||||
if (!reply.WriteParcelable(&downloadProfileResult)) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
}
|
||||
return ERR_NONE;
|
||||
}
|
||||
case COMMAND_GET_EUICC_PROFILE_INFO_LIST: {
|
||||
int32_t slotId = data.ReadInt32();
|
||||
GetEuiccProfileInfoListResult euiccProfileInfoList;
|
||||
ErrCode errCode = GetEuiccProfileInfoList(slotId, euiccProfileInfoList);
|
||||
if (!reply.WriteInt32(errCode)) {
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
if (SUCCEEDED(errCode)) {
|
||||
if (!reply.WriteParcelable(&euiccProfileInfoList)) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
}
|
||||
return ERR_NONE;
|
||||
}
|
||||
case COMMAND_GET_EUICC_INFO: {
|
||||
int32_t slotId = data.ReadInt32();
|
||||
EuiccInfo eUiccInfo;
|
||||
ErrCode errCode = GetEuiccInfo(slotId, eUiccInfo);
|
||||
if (!reply.WriteInt32(errCode)) {
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
if (SUCCEEDED(errCode)) {
|
||||
if (!reply.WriteParcelable(&eUiccInfo)) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
}
|
||||
return ERR_NONE;
|
||||
}
|
||||
case COMMAND_DELETE_PROFILE: {
|
||||
int32_t slotId = data.ReadInt32();
|
||||
std::string iccId = Str16ToStr8(data.ReadString16());
|
||||
int32_t deleteProfileResult;
|
||||
ErrCode errCode = DeleteProfile(slotId, iccId, deleteProfileResult);
|
||||
if (!reply.WriteInt32(errCode)) {
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
if (SUCCEEDED(errCode)) {
|
||||
if (!reply.WriteInt32(deleteProfileResult)) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
}
|
||||
return ERR_NONE;
|
||||
}
|
||||
case COMMAND_SWITCH_TO_PROFILE: {
|
||||
int32_t slotId = data.ReadInt32();
|
||||
int32_t portIndex = data.ReadInt32();
|
||||
std::string iccId = Str16ToStr8(data.ReadString16());
|
||||
bool forceDisableProfile = data.ReadInt32() == 1 ? true : false;
|
||||
int32_t switchToProfileResult;
|
||||
ErrCode errCode = SwitchToProfile(slotId, portIndex, iccId, forceDisableProfile, switchToProfileResult);
|
||||
if (!reply.WriteInt32(errCode)) {
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
if (SUCCEEDED(errCode)) {
|
||||
if (!reply.WriteInt32(switchToProfileResult)) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
}
|
||||
return ERR_NONE;
|
||||
}
|
||||
case COMMAND_SET_PROFILE_NICKNAME: {
|
||||
int32_t slotId = data.ReadInt32();
|
||||
std::string iccId = Str16ToStr8(data.ReadString16());
|
||||
std::string nickname = Str16ToStr8(data.ReadString16());
|
||||
int32_t setProfileNicknameResult;
|
||||
ErrCode errCode = SetProfileNickname(slotId, iccId, nickname, setProfileNicknameResult);
|
||||
if (!reply.WriteInt32(errCode)) {
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
if (SUCCEEDED(errCode)) {
|
||||
if (!reply.WriteInt32(setProfileNicknameResult)) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
}
|
||||
return ERR_NONE;
|
||||
}
|
||||
case COMMAND_RESET_MEMORY: {
|
||||
int32_t slotId = data.ReadInt32();
|
||||
int32_t resetOption = data.ReadInt32();
|
||||
int32_t resetMemoryResult;
|
||||
ErrCode errCode = ResetMemory(slotId, resetOption, resetMemoryResult);
|
||||
if (!reply.WriteInt32(errCode)) {
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
if (SUCCEEDED(errCode)) {
|
||||
if (!reply.WriteInt32(resetMemoryResult)) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
}
|
||||
return ERR_NONE;
|
||||
}
|
||||
case COMMAND_RESERVE_PROFILES_FOR_FACTORY_RESTORE: {
|
||||
int32_t slotId = data.ReadInt32();
|
||||
int32_t restoreResult;
|
||||
ErrCode errCode = ReserveProfilesForFactoryRestore(slotId, restoreResult);
|
||||
if (!reply.WriteInt32(errCode)) {
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
if (SUCCEEDED(errCode)) {
|
||||
if (!reply.WriteInt32(restoreResult)) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
}
|
||||
return ERR_NONE;
|
||||
}
|
||||
case COMMAND_SET_DEFAULT_SMDP_ADDRESS: {
|
||||
int32_t slotId = data.ReadInt32();
|
||||
std::string defaultSmdpAddress = Str16ToStr8(data.ReadString16());
|
||||
int32_t setDefaultSmdpAddressResult;
|
||||
ErrCode errCode = SetDefaultSmdpAddress(slotId, defaultSmdpAddress, setDefaultSmdpAddressResult);
|
||||
if (!reply.WriteInt32(errCode)) {
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
if (SUCCEEDED(errCode)) {
|
||||
if (!reply.WriteInt32(setDefaultSmdpAddressResult)) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
}
|
||||
return ERR_NONE;
|
||||
}
|
||||
case COMMAND_GET_DEFAULT_SMDP_ADDRESS: {
|
||||
int32_t slotId = data.ReadInt32();
|
||||
std::string defaultSmdpAddress;
|
||||
ErrCode errCode = GetDefaultSmdpAddress(slotId, defaultSmdpAddress);
|
||||
if (!reply.WriteInt32(errCode)) {
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
if (SUCCEEDED(errCode)) {
|
||||
if (!reply.WriteString16(Str8ToStr16(defaultSmdpAddress))) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
}
|
||||
return ERR_NONE;
|
||||
}
|
||||
case COMMAND_CANCEL_SESSION: {
|
||||
int32_t slotId = data.ReadInt32();
|
||||
std::string transactionId = Str16ToStr8(data.ReadString16());
|
||||
int32_t cancelReason = data.ReadInt32();
|
||||
ResponseEsimResult responseResult;
|
||||
ErrCode errCode = CancelSession(slotId, transactionId, cancelReason, responseResult);
|
||||
if (!reply.WriteInt32(errCode)) {
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
if (SUCCEEDED(errCode)) {
|
||||
if (!reply.WriteParcelable(&responseResult)) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
}
|
||||
return ERR_NONE;
|
||||
}
|
||||
case COMMAND_IS_ESIM_SUPPORTED: {
|
||||
int32_t slotId = data.ReadInt32();
|
||||
ErrCode errCode = IsEsimSupported(slotId);
|
||||
if (!reply.WriteInt32(errCode)) {
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
return ERR_NONE;
|
||||
}
|
||||
default:
|
||||
return IPCObjectStub::OnRemoteRequest(code, data, reply, option);
|
||||
}
|
||||
|
||||
return ERR_TRANSACTION_FAILED;
|
||||
}
|
||||
} // namespace Telephony
|
||||
} // namespace OHOS
|
54
test/sa_test/in_use_idl/target_cpp/esim_service_stub.h.txt
Normal file
54
test/sa_test/in_use_idl/target_cpp/esim_service_stub.h.txt
Normal file
@ -0,0 +1,54 @@
|
||||
/*
|
||||
* Copyright (c) 2024 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef OHOS_TELEPHONY_ESIMSERVICESTUB_H
|
||||
#define OHOS_TELEPHONY_ESIMSERVICESTUB_H
|
||||
|
||||
#include "iesim_service.h"
|
||||
#include <iremote_stub.h>
|
||||
|
||||
namespace OHOS {
|
||||
namespace Telephony {
|
||||
class EsimServiceStub : public IRemoteStub<IEsimService> {
|
||||
public:
|
||||
int32_t OnRemoteRequest(
|
||||
uint32_t code,
|
||||
MessageParcel& data,
|
||||
MessageParcel& reply,
|
||||
MessageOption& option) override;
|
||||
|
||||
private:
|
||||
static constexpr int32_t COMMAND_GET_EID = MIN_TRANSACTION_ID + 0;
|
||||
static constexpr int32_t COMMAND_GET_OSU_STATUS = MIN_TRANSACTION_ID + 1;
|
||||
static constexpr int32_t COMMAND_START_OSU = MIN_TRANSACTION_ID + 2;
|
||||
static constexpr int32_t COMMAND_GET_DOWNLOADABLE_PROFILE_METADATA = MIN_TRANSACTION_ID + 3;
|
||||
static constexpr int32_t COMMAND_GET_DOWNLOADABLE_PROFILES = MIN_TRANSACTION_ID + 4;
|
||||
static constexpr int32_t COMMAND_DOWNLOAD_PROFILE = MIN_TRANSACTION_ID + 5;
|
||||
static constexpr int32_t COMMAND_GET_EUICC_PROFILE_INFO_LIST = MIN_TRANSACTION_ID + 6;
|
||||
static constexpr int32_t COMMAND_GET_EUICC_INFO = MIN_TRANSACTION_ID + 7;
|
||||
static constexpr int32_t COMMAND_DELETE_PROFILE = MIN_TRANSACTION_ID + 8;
|
||||
static constexpr int32_t COMMAND_SWITCH_TO_PROFILE = MIN_TRANSACTION_ID + 9;
|
||||
static constexpr int32_t COMMAND_SET_PROFILE_NICKNAME = MIN_TRANSACTION_ID + 10;
|
||||
static constexpr int32_t COMMAND_RESET_MEMORY = MIN_TRANSACTION_ID + 11;
|
||||
static constexpr int32_t COMMAND_RESERVE_PROFILES_FOR_FACTORY_RESTORE = MIN_TRANSACTION_ID + 12;
|
||||
static constexpr int32_t COMMAND_SET_DEFAULT_SMDP_ADDRESS = MIN_TRANSACTION_ID + 13;
|
||||
static constexpr int32_t COMMAND_GET_DEFAULT_SMDP_ADDRESS = MIN_TRANSACTION_ID + 14;
|
||||
static constexpr int32_t COMMAND_CANCEL_SESSION = MIN_TRANSACTION_ID + 15;
|
||||
static constexpr int32_t COMMAND_IS_ESIM_SUPPORTED = MIN_TRANSACTION_ID + 16;
|
||||
};
|
||||
} // namespace Telephony
|
||||
} // namespace OHOS
|
||||
#endif // OHOS_TELEPHONY_ESIMSERVICESTUB_H
|
||||
|
@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Copyright (c) 2024 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef OHOS_NWEB_IAPPFWKUPDATESERVICE_H
|
||||
#define OHOS_NWEB_IAPPFWKUPDATESERVICE_H
|
||||
|
||||
#include <cstdint>
|
||||
#include <iremote_broker.h>
|
||||
#include <string_ex.h>
|
||||
|
||||
namespace OHOS {
|
||||
namespace NWeb {
|
||||
class IAppFwkUpdateService : public IRemoteBroker {
|
||||
public:
|
||||
DECLARE_INTERFACE_DESCRIPTOR(u"OHOS.NWeb.IAppFwkUpdateService");
|
||||
|
||||
virtual ErrCode VerifyPackageInstall(
|
||||
const std::string& bundleName,
|
||||
const std::string& hapPath,
|
||||
int32_t& success) = 0;
|
||||
protected:
|
||||
const int VECTOR_MAX_SIZE = 102400;
|
||||
const int LIST_MAX_SIZE = 102400;
|
||||
const int MAP_MAX_SIZE = 102400;
|
||||
};
|
||||
} // namespace NWeb
|
||||
} // namespace OHOS
|
||||
#endif // OHOS_NWEB_IAPPFWKUPDATESERVICE_H
|
||||
|
@ -0,0 +1,82 @@
|
||||
/*
|
||||
* Copyright (c) 2024 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "idl_test_service_proxy.h"
|
||||
|
||||
namespace OHOS {
|
||||
ErrCode IdlTestServiceProxy::TestIntTransaction(
|
||||
int32_t val)
|
||||
{
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
MessageOption option(MessageOption::TF_SYNC);
|
||||
|
||||
if (!data.WriteInterfaceToken(GetDescriptor())) {
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
|
||||
if (!data.WriteInt32(val)) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
|
||||
sptr<IRemoteObject> remote = Remote();
|
||||
if (remote == nullptr) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
int32_t result = remote->SendRequest(COMMAND_TEST_INT_TRANSACTION, data, reply, option);
|
||||
if (FAILED(result)) {
|
||||
return result;
|
||||
}
|
||||
|
||||
ErrCode errCode = reply.ReadInt32();
|
||||
if (FAILED(errCode)) {
|
||||
return errCode;
|
||||
}
|
||||
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
ErrCode IdlTestServiceProxy::TestStringTransaction(
|
||||
const std::string& val)
|
||||
{
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
MessageOption option(MessageOption::TF_SYNC);
|
||||
|
||||
if (!data.WriteInterfaceToken(GetDescriptor())) {
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
|
||||
if (!data.WriteString16(Str8ToStr16(val))) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
|
||||
sptr<IRemoteObject> remote = Remote();
|
||||
if (remote == nullptr) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
int32_t result = remote->SendRequest(COMMAND_TEST_STRING_TRANSACTION, data, reply, option);
|
||||
if (FAILED(result)) {
|
||||
return result;
|
||||
}
|
||||
|
||||
ErrCode errCode = reply.ReadInt32();
|
||||
if (FAILED(errCode)) {
|
||||
return errCode;
|
||||
}
|
||||
|
||||
return ERR_OK;
|
||||
}
|
||||
} // namespace OHOS
|
@ -0,0 +1,47 @@
|
||||
/*
|
||||
* Copyright (c) 2024 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef OHOS_IDLTESTSERVICEPROXY_H
|
||||
#define OHOS_IDLTESTSERVICEPROXY_H
|
||||
|
||||
#include "iidl_test_service.h"
|
||||
#include <iremote_proxy.h>
|
||||
|
||||
namespace OHOS {
|
||||
class IdlTestServiceProxy : public IRemoteProxy<IIdlTestService> {
|
||||
public:
|
||||
explicit IdlTestServiceProxy(
|
||||
const sptr<IRemoteObject>& remote)
|
||||
: IRemoteProxy<IIdlTestService>(remote)
|
||||
{}
|
||||
|
||||
virtual ~IdlTestServiceProxy()
|
||||
{}
|
||||
|
||||
ErrCode TestIntTransaction(
|
||||
int32_t val) override;
|
||||
|
||||
ErrCode TestStringTransaction(
|
||||
const std::string& val) override;
|
||||
|
||||
private:
|
||||
static constexpr int32_t COMMAND_TEST_INT_TRANSACTION = MIN_TRANSACTION_ID + 0;
|
||||
static constexpr int32_t COMMAND_TEST_STRING_TRANSACTION = MIN_TRANSACTION_ID + 1;
|
||||
|
||||
static inline BrokerDelegator<IdlTestServiceProxy> delegator_;
|
||||
};
|
||||
} // namespace OHOS
|
||||
#endif // OHOS_IDLTESTSERVICEPROXY_H
|
||||
|
@ -0,0 +1,53 @@
|
||||
/*
|
||||
* Copyright (c) 2024 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "idl_test_service_stub.h"
|
||||
|
||||
namespace OHOS {
|
||||
int32_t IdlTestServiceStub::OnRemoteRequest(
|
||||
uint32_t code,
|
||||
MessageParcel& data,
|
||||
MessageParcel& reply,
|
||||
MessageOption& option)
|
||||
{
|
||||
std::u16string localDescriptor = GetDescriptor();
|
||||
std::u16string remoteDescriptor = data.ReadInterfaceToken();
|
||||
if (localDescriptor != remoteDescriptor) {
|
||||
return ERR_TRANSACTION_FAILED;
|
||||
}
|
||||
switch (code) {
|
||||
case COMMAND_TEST_INT_TRANSACTION: {
|
||||
int32_t val = data.ReadInt32();
|
||||
ErrCode errCode = TestIntTransaction(val);
|
||||
if (!reply.WriteInt32(errCode)) {
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
return ERR_NONE;
|
||||
}
|
||||
case COMMAND_TEST_STRING_TRANSACTION: {
|
||||
std::string val = Str16ToStr8(data.ReadString16());
|
||||
ErrCode errCode = TestStringTransaction(val);
|
||||
if (!reply.WriteInt32(errCode)) {
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
return ERR_NONE;
|
||||
}
|
||||
default:
|
||||
return IPCObjectStub::OnRemoteRequest(code, data, reply, option);
|
||||
}
|
||||
|
||||
return ERR_TRANSACTION_FAILED;
|
||||
}
|
||||
} // namespace OHOS
|
@ -0,0 +1,37 @@
|
||||
/*
|
||||
* Copyright (c) 2024 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef OHOS_IDLTESTSERVICESTUB_H
|
||||
#define OHOS_IDLTESTSERVICESTUB_H
|
||||
|
||||
#include "iidl_test_service.h"
|
||||
#include <iremote_stub.h>
|
||||
|
||||
namespace OHOS {
|
||||
class IdlTestServiceStub : public IRemoteStub<IIdlTestService> {
|
||||
public:
|
||||
int32_t OnRemoteRequest(
|
||||
uint32_t code,
|
||||
MessageParcel& data,
|
||||
MessageParcel& reply,
|
||||
MessageOption& option) override;
|
||||
|
||||
private:
|
||||
static constexpr int32_t COMMAND_TEST_INT_TRANSACTION = MIN_TRANSACTION_ID + 0;
|
||||
static constexpr int32_t COMMAND_TEST_STRING_TRANSACTION = MIN_TRANSACTION_ID + 1;
|
||||
};
|
||||
} // namespace OHOS
|
||||
#endif // OHOS_IDLTESTSERVICESTUB_H
|
||||
|
137
test/sa_test/in_use_idl/target_cpp/iesim_service.h.txt
Normal file
137
test/sa_test/in_use_idl/target_cpp/iesim_service.h.txt
Normal file
@ -0,0 +1,137 @@
|
||||
/*
|
||||
* Copyright (c) 2024 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef OHOS_TELEPHONY_IESIMSERVICE_H
|
||||
#define OHOS_TELEPHONY_IESIMSERVICE_H
|
||||
|
||||
#include <cstdint>
|
||||
#include <iremote_broker.h>
|
||||
#include <string_ex.h>
|
||||
#include "download_profile_config_info_parcel.h"
|
||||
#include "download_profile_result_parcel.h"
|
||||
#include "downloadable_profile_parcel.h"
|
||||
#include "euicc_info_parcel.h"
|
||||
#include "get_downloadable_profiles_result_parcel.h"
|
||||
#include "profile_info_list_parcel.h"
|
||||
#include "profile_metadata_result_parcel.h"
|
||||
#include "response_esim_result.h"
|
||||
|
||||
using OHOS::Telephony::DownloadProfileConfigInfo;
|
||||
using OHOS::Telephony::DownloadableProfile;
|
||||
using OHOS::Telephony::DownloadProfileResult;
|
||||
using OHOS::Telephony::EuiccInfo;
|
||||
using OHOS::Telephony::GetDownloadableProfileMetadataResult;
|
||||
using OHOS::Telephony::GetDownloadableProfilesResult;
|
||||
using OHOS::Telephony::GetEuiccProfileInfoListResult;
|
||||
using OHOS::Telephony::ResponseEsimResult;
|
||||
|
||||
namespace OHOS {
|
||||
namespace Telephony {
|
||||
class IEsimService : public IRemoteBroker {
|
||||
public:
|
||||
DECLARE_INTERFACE_DESCRIPTOR(u"OHOS.Telephony.IEsimService");
|
||||
|
||||
virtual ErrCode GetEid(
|
||||
int32_t slotId,
|
||||
std::string& eId) = 0;
|
||||
|
||||
virtual ErrCode GetOsuStatus(
|
||||
int32_t slotId,
|
||||
int32_t& osuStatus) = 0;
|
||||
|
||||
virtual ErrCode StartOsu(
|
||||
int32_t slotId,
|
||||
int32_t& startOsuResult) = 0;
|
||||
|
||||
virtual ErrCode GetDownloadableProfileMetadata(
|
||||
int32_t slotId,
|
||||
int32_t portIndex,
|
||||
const DownloadableProfile& profile,
|
||||
bool forceDisableProfile,
|
||||
GetDownloadableProfileMetadataResult& profileMetadataResult) = 0;
|
||||
|
||||
virtual ErrCode GetDownloadableProfiles(
|
||||
int32_t slotId,
|
||||
int32_t portIndex,
|
||||
bool forceDisableProfile,
|
||||
GetDownloadableProfilesResult& profileListResult) = 0;
|
||||
|
||||
virtual ErrCode DownloadProfile(
|
||||
int32_t slotId,
|
||||
const DownloadProfileConfigInfo& configInfo,
|
||||
const DownloadableProfile& profile,
|
||||
DownloadProfileResult& downloadProfileResult) = 0;
|
||||
|
||||
virtual ErrCode GetEuiccProfileInfoList(
|
||||
int32_t slotId,
|
||||
GetEuiccProfileInfoListResult& euiccProfileInfoList) = 0;
|
||||
|
||||
virtual ErrCode GetEuiccInfo(
|
||||
int32_t slotId,
|
||||
EuiccInfo& eUiccInfo) = 0;
|
||||
|
||||
virtual ErrCode DeleteProfile(
|
||||
int32_t slotId,
|
||||
const std::string& iccId,
|
||||
int32_t& deleteProfileResult) = 0;
|
||||
|
||||
virtual ErrCode SwitchToProfile(
|
||||
int32_t slotId,
|
||||
int32_t portIndex,
|
||||
const std::string& iccId,
|
||||
bool forceDisableProfile,
|
||||
int32_t& switchToProfileResult) = 0;
|
||||
|
||||
virtual ErrCode SetProfileNickname(
|
||||
int32_t slotId,
|
||||
const std::string& iccId,
|
||||
const std::string& nickname,
|
||||
int32_t& setProfileNicknameResult) = 0;
|
||||
|
||||
virtual ErrCode ResetMemory(
|
||||
int32_t slotId,
|
||||
int32_t resetOption,
|
||||
int32_t& resetMemoryResult) = 0;
|
||||
|
||||
virtual ErrCode ReserveProfilesForFactoryRestore(
|
||||
int32_t slotId,
|
||||
int32_t& restoreResult) = 0;
|
||||
|
||||
virtual ErrCode SetDefaultSmdpAddress(
|
||||
int32_t slotId,
|
||||
const std::string& defaultSmdpAddress,
|
||||
int32_t& setDefaultSmdpAddressResult) = 0;
|
||||
|
||||
virtual ErrCode GetDefaultSmdpAddress(
|
||||
int32_t slotId,
|
||||
std::string& defaultSmdpAddress) = 0;
|
||||
|
||||
virtual ErrCode CancelSession(
|
||||
int32_t slotId,
|
||||
const std::string& transactionId,
|
||||
int32_t cancelReason,
|
||||
ResponseEsimResult& responseResult) = 0;
|
||||
|
||||
virtual ErrCode IsEsimSupported(
|
||||
int32_t slotId) = 0;
|
||||
protected:
|
||||
const int VECTOR_MAX_SIZE = 102400;
|
||||
const int LIST_MAX_SIZE = 102400;
|
||||
const int MAP_MAX_SIZE = 102400;
|
||||
};
|
||||
} // namespace Telephony
|
||||
} // namespace OHOS
|
||||
#endif // OHOS_TELEPHONY_IESIMSERVICE_H
|
||||
|
40
test/sa_test/in_use_idl/target_cpp/iidl_test_service.h.txt
Normal file
40
test/sa_test/in_use_idl/target_cpp/iidl_test_service.h.txt
Normal file
@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Copyright (c) 2024 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef OHOS_IIDLTESTSERVICE_H
|
||||
#define OHOS_IIDLTESTSERVICE_H
|
||||
|
||||
#include <cstdint>
|
||||
#include <iremote_broker.h>
|
||||
#include <string_ex.h>
|
||||
|
||||
namespace OHOS {
|
||||
class IIdlTestService : public IRemoteBroker {
|
||||
public:
|
||||
DECLARE_INTERFACE_DESCRIPTOR(u"OHOS.IIdlTestService");
|
||||
|
||||
virtual ErrCode TestIntTransaction(
|
||||
int32_t val) = 0;
|
||||
|
||||
virtual ErrCode TestStringTransaction(
|
||||
const std::string& val) = 0;
|
||||
protected:
|
||||
const int VECTOR_MAX_SIZE = 102400;
|
||||
const int LIST_MAX_SIZE = 102400;
|
||||
const int MAP_MAX_SIZE = 102400;
|
||||
};
|
||||
} // namespace OHOS
|
||||
#endif // OHOS_IIDLTESTSERVICE_H
|
||||
|
51
test/sa_test/in_use_idl/target_cpp/iquick_fix_manager.h.txt
Normal file
51
test/sa_test/in_use_idl/target_cpp/iquick_fix_manager.h.txt
Normal file
@ -0,0 +1,51 @@
|
||||
/*
|
||||
* Copyright (c) 2024 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef OHOS_AAFWK_IQUICKFIXMANAGER_H
|
||||
#define OHOS_AAFWK_IQUICKFIXMANAGER_H
|
||||
|
||||
#include <cstdint>
|
||||
#include <vector>
|
||||
#include <iremote_broker.h>
|
||||
#include <string_ex.h>
|
||||
#include "quick_fix_info.h"
|
||||
|
||||
using OHOS::AAFwk::ApplicationQuickFixInfo;
|
||||
|
||||
namespace OHOS {
|
||||
namespace AAFwk {
|
||||
class IQuickFixManager : public IRemoteBroker {
|
||||
public:
|
||||
DECLARE_INTERFACE_DESCRIPTOR(u"OHOS.AAFwk.IQuickFixManager");
|
||||
|
||||
virtual ErrCode ApplyQuickFix(
|
||||
const std::vector<std::string>& quickFixFiles,
|
||||
bool isDebug) = 0;
|
||||
|
||||
virtual ErrCode GetApplyedQuickFixInfo(
|
||||
const std::string& bundleName,
|
||||
ApplicationQuickFixInfo& quickFixInfo) = 0;
|
||||
|
||||
virtual ErrCode RevokeQuickFix(
|
||||
const std::string& bundleName) = 0;
|
||||
protected:
|
||||
const int VECTOR_MAX_SIZE = 102400;
|
||||
const int LIST_MAX_SIZE = 102400;
|
||||
const int MAP_MAX_SIZE = 102400;
|
||||
};
|
||||
} // namespace AAFwk
|
||||
} // namespace OHOS
|
||||
#endif // OHOS_AAFWK_IQUICKFIXMANAGER_H
|
||||
|
@ -0,0 +1,51 @@
|
||||
/*
|
||||
* Copyright (c) 2024 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef OHOS_TESTSERVER_ITESTSERVERINTERFACE_H
|
||||
#define OHOS_TESTSERVER_ITESTSERVERINTERFACE_H
|
||||
|
||||
#include <cstdint>
|
||||
#include <iremote_broker.h>
|
||||
#include <string_ex.h>
|
||||
#include "common_event_data.h"
|
||||
#include "session_token.h"
|
||||
|
||||
using OHOS::testserver::SessionToken;
|
||||
using OHOS::EventFwk::CommonEventData;
|
||||
|
||||
namespace OHOS {
|
||||
namespace testserver {
|
||||
class ITestServerInterface : public IRemoteBroker {
|
||||
public:
|
||||
DECLARE_INTERFACE_DESCRIPTOR(u"OHOS.testserver.ITestServerInterface");
|
||||
|
||||
virtual ErrCode CreateSession(
|
||||
const SessionToken& sessionToken) = 0;
|
||||
|
||||
virtual ErrCode SetPasteData(
|
||||
const std::string& text) = 0;
|
||||
|
||||
virtual ErrCode PublishCommonEvent(
|
||||
const CommonEventData& event,
|
||||
bool& re) = 0;
|
||||
protected:
|
||||
const int VECTOR_MAX_SIZE = 102400;
|
||||
const int LIST_MAX_SIZE = 102400;
|
||||
const int MAP_MAX_SIZE = 102400;
|
||||
};
|
||||
} // namespace testserver
|
||||
} // namespace OHOS
|
||||
#endif // OHOS_TESTSERVER_ITESTSERVERINTERFACE_H
|
||||
|
@ -0,0 +1,132 @@
|
||||
/*
|
||||
* Copyright (c) 2024 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "quick_fix_manager_proxy.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace AAFwk {
|
||||
ErrCode QuickFixManagerProxy::ApplyQuickFix(
|
||||
const std::vector<std::string>& quickFixFiles,
|
||||
bool isDebug)
|
||||
{
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
MessageOption option(MessageOption::TF_SYNC);
|
||||
|
||||
if (!data.WriteInterfaceToken(GetDescriptor())) {
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
|
||||
if (quickFixFiles.size() > static_cast<size_t>(VECTOR_MAX_SIZE)) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
data.WriteInt32(quickFixFiles.size());
|
||||
for (auto it = quickFixFiles.begin(); it != quickFixFiles.end(); ++it) {
|
||||
if (!data.WriteString16(Str8ToStr16((*it)))) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
}
|
||||
if (!data.WriteInt32(isDebug ? 1 : 0)) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
|
||||
sptr<IRemoteObject> remote = Remote();
|
||||
if (remote == nullptr) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
int32_t result = remote->SendRequest(COMMAND_APPLY_QUICK_FIX, data, reply, option);
|
||||
if (FAILED(result)) {
|
||||
return result;
|
||||
}
|
||||
|
||||
ErrCode errCode = reply.ReadInt32();
|
||||
if (FAILED(errCode)) {
|
||||
return errCode;
|
||||
}
|
||||
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
ErrCode QuickFixManagerProxy::GetApplyedQuickFixInfo(
|
||||
const std::string& bundleName,
|
||||
ApplicationQuickFixInfo& quickFixInfo)
|
||||
{
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
MessageOption option(MessageOption::TF_SYNC);
|
||||
|
||||
if (!data.WriteInterfaceToken(GetDescriptor())) {
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
|
||||
if (!data.WriteString16(Str8ToStr16(bundleName))) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
|
||||
sptr<IRemoteObject> remote = Remote();
|
||||
if (remote == nullptr) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
int32_t result = remote->SendRequest(COMMAND_GET_APPLYED_QUICK_FIX_INFO, data, reply, option);
|
||||
if (FAILED(result)) {
|
||||
return result;
|
||||
}
|
||||
|
||||
ErrCode errCode = reply.ReadInt32();
|
||||
if (FAILED(errCode)) {
|
||||
return errCode;
|
||||
}
|
||||
|
||||
std::unique_ptr<ApplicationQuickFixInfo> quickFixInfoInfo(reply.ReadParcelable<ApplicationQuickFixInfo>());
|
||||
if (quickFixInfoInfo != nullptr) {
|
||||
quickFixInfo = *quickFixInfoInfo;
|
||||
}
|
||||
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
ErrCode QuickFixManagerProxy::RevokeQuickFix(
|
||||
const std::string& bundleName)
|
||||
{
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
MessageOption option(MessageOption::TF_SYNC);
|
||||
|
||||
if (!data.WriteInterfaceToken(GetDescriptor())) {
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
|
||||
if (!data.WriteString16(Str8ToStr16(bundleName))) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
|
||||
sptr<IRemoteObject> remote = Remote();
|
||||
if (remote == nullptr) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
int32_t result = remote->SendRequest(COMMAND_REVOKE_QUICK_FIX, data, reply, option);
|
||||
if (FAILED(result)) {
|
||||
return result;
|
||||
}
|
||||
|
||||
ErrCode errCode = reply.ReadInt32();
|
||||
if (FAILED(errCode)) {
|
||||
return errCode;
|
||||
}
|
||||
|
||||
return ERR_OK;
|
||||
}
|
||||
} // namespace AAFwk
|
||||
} // namespace OHOS
|
@ -0,0 +1,55 @@
|
||||
/*
|
||||
* Copyright (c) 2024 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef OHOS_AAFWK_QUICKFIXMANAGERPROXY_H
|
||||
#define OHOS_AAFWK_QUICKFIXMANAGERPROXY_H
|
||||
|
||||
#include "iquick_fix_manager.h"
|
||||
#include <iremote_proxy.h>
|
||||
|
||||
namespace OHOS {
|
||||
namespace AAFwk {
|
||||
class QuickFixManagerProxy : public IRemoteProxy<IQuickFixManager> {
|
||||
public:
|
||||
explicit QuickFixManagerProxy(
|
||||
const sptr<IRemoteObject>& remote)
|
||||
: IRemoteProxy<IQuickFixManager>(remote)
|
||||
{}
|
||||
|
||||
virtual ~QuickFixManagerProxy()
|
||||
{}
|
||||
|
||||
ErrCode ApplyQuickFix(
|
||||
const std::vector<std::string>& quickFixFiles,
|
||||
bool isDebug) override;
|
||||
|
||||
ErrCode GetApplyedQuickFixInfo(
|
||||
const std::string& bundleName,
|
||||
ApplicationQuickFixInfo& quickFixInfo) override;
|
||||
|
||||
ErrCode RevokeQuickFix(
|
||||
const std::string& bundleName) override;
|
||||
|
||||
private:
|
||||
static constexpr int32_t COMMAND_APPLY_QUICK_FIX = MIN_TRANSACTION_ID + 0;
|
||||
static constexpr int32_t COMMAND_GET_APPLYED_QUICK_FIX_INFO = MIN_TRANSACTION_ID + 1;
|
||||
static constexpr int32_t COMMAND_REVOKE_QUICK_FIX = MIN_TRANSACTION_ID + 2;
|
||||
|
||||
static inline BrokerDelegator<QuickFixManagerProxy> delegator_;
|
||||
};
|
||||
} // namespace AAFwk
|
||||
} // namespace OHOS
|
||||
#endif // OHOS_AAFWK_QUICKFIXMANAGERPROXY_H
|
||||
|
@ -0,0 +1,78 @@
|
||||
/*
|
||||
* Copyright (c) 2024 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "quick_fix_manager_stub.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace AAFwk {
|
||||
int32_t QuickFixManagerStub::OnRemoteRequest(
|
||||
uint32_t code,
|
||||
MessageParcel& data,
|
||||
MessageParcel& reply,
|
||||
MessageOption& option)
|
||||
{
|
||||
std::u16string localDescriptor = GetDescriptor();
|
||||
std::u16string remoteDescriptor = data.ReadInterfaceToken();
|
||||
if (localDescriptor != remoteDescriptor) {
|
||||
return ERR_TRANSACTION_FAILED;
|
||||
}
|
||||
switch (code) {
|
||||
case COMMAND_APPLY_QUICK_FIX: {
|
||||
std::vector<std::string> quickFixFiles;
|
||||
int32_t quickFixFilesSize = data.ReadInt32();
|
||||
if (quickFixFilesSize > static_cast<int32_t>(VECTOR_MAX_SIZE)) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
for (int32_t i1 = 0; i1 < quickFixFilesSize; ++i1) {
|
||||
std::string value1 = Str16ToStr8(data.ReadString16());
|
||||
quickFixFiles.push_back(value1);
|
||||
}
|
||||
bool isDebug = data.ReadInt32() == 1 ? true : false;
|
||||
ErrCode errCode = ApplyQuickFix(quickFixFiles, isDebug);
|
||||
if (!reply.WriteInt32(errCode)) {
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
return ERR_NONE;
|
||||
}
|
||||
case COMMAND_GET_APPLYED_QUICK_FIX_INFO: {
|
||||
std::string bundleName = Str16ToStr8(data.ReadString16());
|
||||
ApplicationQuickFixInfo quickFixInfo;
|
||||
ErrCode errCode = GetApplyedQuickFixInfo(bundleName, quickFixInfo);
|
||||
if (!reply.WriteInt32(errCode)) {
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
if (SUCCEEDED(errCode)) {
|
||||
if (!reply.WriteParcelable(&quickFixInfo)) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
}
|
||||
return ERR_NONE;
|
||||
}
|
||||
case COMMAND_REVOKE_QUICK_FIX: {
|
||||
std::string bundleName = Str16ToStr8(data.ReadString16());
|
||||
ErrCode errCode = RevokeQuickFix(bundleName);
|
||||
if (!reply.WriteInt32(errCode)) {
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
return ERR_NONE;
|
||||
}
|
||||
default:
|
||||
return IPCObjectStub::OnRemoteRequest(code, data, reply, option);
|
||||
}
|
||||
|
||||
return ERR_TRANSACTION_FAILED;
|
||||
}
|
||||
} // namespace AAFwk
|
||||
} // namespace OHOS
|
@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Copyright (c) 2024 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef OHOS_AAFWK_QUICKFIXMANAGERSTUB_H
|
||||
#define OHOS_AAFWK_QUICKFIXMANAGERSTUB_H
|
||||
|
||||
#include "iquick_fix_manager.h"
|
||||
#include <iremote_stub.h>
|
||||
|
||||
namespace OHOS {
|
||||
namespace AAFwk {
|
||||
class QuickFixManagerStub : public IRemoteStub<IQuickFixManager> {
|
||||
public:
|
||||
int32_t OnRemoteRequest(
|
||||
uint32_t code,
|
||||
MessageParcel& data,
|
||||
MessageParcel& reply,
|
||||
MessageOption& option) override;
|
||||
|
||||
private:
|
||||
static constexpr int32_t COMMAND_APPLY_QUICK_FIX = MIN_TRANSACTION_ID + 0;
|
||||
static constexpr int32_t COMMAND_GET_APPLYED_QUICK_FIX_INFO = MIN_TRANSACTION_ID + 1;
|
||||
static constexpr int32_t COMMAND_REVOKE_QUICK_FIX = MIN_TRANSACTION_ID + 2;
|
||||
};
|
||||
} // namespace AAFwk
|
||||
} // namespace OHOS
|
||||
#endif // OHOS_AAFWK_QUICKFIXMANAGERSTUB_H
|
||||
|
@ -0,0 +1,118 @@
|
||||
/*
|
||||
* Copyright (c) 2024 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "test_server_interface_proxy.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace testserver {
|
||||
ErrCode TestServerInterfaceProxy::CreateSession(
|
||||
const SessionToken& sessionToken)
|
||||
{
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
MessageOption option(MessageOption::TF_SYNC);
|
||||
|
||||
if (!data.WriteInterfaceToken(GetDescriptor())) {
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
|
||||
if (!data.WriteParcelable(&sessionToken)) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
|
||||
sptr<IRemoteObject> remote = Remote();
|
||||
if (remote == nullptr) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
int32_t result = remote->SendRequest(COMMAND_CREATE_SESSION, data, reply, option);
|
||||
if (FAILED(result)) {
|
||||
return result;
|
||||
}
|
||||
|
||||
ErrCode errCode = reply.ReadInt32();
|
||||
if (FAILED(errCode)) {
|
||||
return errCode;
|
||||
}
|
||||
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
ErrCode TestServerInterfaceProxy::SetPasteData(
|
||||
const std::string& text)
|
||||
{
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
MessageOption option(MessageOption::TF_SYNC);
|
||||
|
||||
if (!data.WriteInterfaceToken(GetDescriptor())) {
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
|
||||
if (!data.WriteString16(Str8ToStr16(text))) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
|
||||
sptr<IRemoteObject> remote = Remote();
|
||||
if (remote == nullptr) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
int32_t result = remote->SendRequest(COMMAND_SET_PASTE_DATA, data, reply, option);
|
||||
if (FAILED(result)) {
|
||||
return result;
|
||||
}
|
||||
|
||||
ErrCode errCode = reply.ReadInt32();
|
||||
if (FAILED(errCode)) {
|
||||
return errCode;
|
||||
}
|
||||
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
ErrCode TestServerInterfaceProxy::PublishCommonEvent(
|
||||
const CommonEventData& event,
|
||||
bool& re)
|
||||
{
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
MessageOption option(MessageOption::TF_SYNC);
|
||||
|
||||
if (!data.WriteInterfaceToken(GetDescriptor())) {
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
|
||||
if (!data.WriteParcelable(&event)) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
|
||||
sptr<IRemoteObject> remote = Remote();
|
||||
if (remote == nullptr) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
int32_t result = remote->SendRequest(COMMAND_PUBLISH_COMMON_EVENT, data, reply, option);
|
||||
if (FAILED(result)) {
|
||||
return result;
|
||||
}
|
||||
|
||||
ErrCode errCode = reply.ReadInt32();
|
||||
if (FAILED(errCode)) {
|
||||
return errCode;
|
||||
}
|
||||
|
||||
re = reply.ReadInt32() == 1 ? true : false;
|
||||
return ERR_OK;
|
||||
}
|
||||
} // namespace testserver
|
||||
} // namespace OHOS
|
@ -0,0 +1,54 @@
|
||||
/*
|
||||
* Copyright (c) 2024 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef OHOS_TESTSERVER_TESTSERVERINTERFACEPROXY_H
|
||||
#define OHOS_TESTSERVER_TESTSERVERINTERFACEPROXY_H
|
||||
|
||||
#include "itest_server_interface.h"
|
||||
#include <iremote_proxy.h>
|
||||
|
||||
namespace OHOS {
|
||||
namespace testserver {
|
||||
class TestServerInterfaceProxy : public IRemoteProxy<ITestServerInterface> {
|
||||
public:
|
||||
explicit TestServerInterfaceProxy(
|
||||
const sptr<IRemoteObject>& remote)
|
||||
: IRemoteProxy<ITestServerInterface>(remote)
|
||||
{}
|
||||
|
||||
virtual ~TestServerInterfaceProxy()
|
||||
{}
|
||||
|
||||
ErrCode CreateSession(
|
||||
const SessionToken& sessionToken) override;
|
||||
|
||||
ErrCode SetPasteData(
|
||||
const std::string& text) override;
|
||||
|
||||
ErrCode PublishCommonEvent(
|
||||
const CommonEventData& event,
|
||||
bool& re) override;
|
||||
|
||||
private:
|
||||
static constexpr int32_t COMMAND_CREATE_SESSION = MIN_TRANSACTION_ID + 0;
|
||||
static constexpr int32_t COMMAND_SET_PASTE_DATA = MIN_TRANSACTION_ID + 1;
|
||||
static constexpr int32_t COMMAND_PUBLISH_COMMON_EVENT = MIN_TRANSACTION_ID + 2;
|
||||
|
||||
static inline BrokerDelegator<TestServerInterfaceProxy> delegator_;
|
||||
};
|
||||
} // namespace testserver
|
||||
} // namespace OHOS
|
||||
#endif // OHOS_TESTSERVER_TESTSERVERINTERFACEPROXY_H
|
||||
|
@ -0,0 +1,77 @@
|
||||
/*
|
||||
* Copyright (c) 2024 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "test_server_interface_stub.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace testserver {
|
||||
int32_t TestServerInterfaceStub::OnRemoteRequest(
|
||||
uint32_t code,
|
||||
MessageParcel& data,
|
||||
MessageParcel& reply,
|
||||
MessageOption& option)
|
||||
{
|
||||
std::u16string localDescriptor = GetDescriptor();
|
||||
std::u16string remoteDescriptor = data.ReadInterfaceToken();
|
||||
if (localDescriptor != remoteDescriptor) {
|
||||
return ERR_TRANSACTION_FAILED;
|
||||
}
|
||||
switch (code) {
|
||||
case COMMAND_CREATE_SESSION: {
|
||||
std::unique_ptr<SessionToken> sessionToken(data.ReadParcelable<SessionToken>());
|
||||
if (!sessionToken) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
|
||||
ErrCode errCode = CreateSession(*sessionToken);
|
||||
if (!reply.WriteInt32(errCode)) {
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
return ERR_NONE;
|
||||
}
|
||||
case COMMAND_SET_PASTE_DATA: {
|
||||
std::string text = Str16ToStr8(data.ReadString16());
|
||||
ErrCode errCode = SetPasteData(text);
|
||||
if (!reply.WriteInt32(errCode)) {
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
return ERR_NONE;
|
||||
}
|
||||
case COMMAND_PUBLISH_COMMON_EVENT: {
|
||||
std::unique_ptr<CommonEventData> event(data.ReadParcelable<CommonEventData>());
|
||||
if (!event) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
|
||||
bool re;
|
||||
ErrCode errCode = PublishCommonEvent(*event, re);
|
||||
if (!reply.WriteInt32(errCode)) {
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
if (SUCCEEDED(errCode)) {
|
||||
if (!reply.WriteInt32(re ? 1 : 0)) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
}
|
||||
return ERR_NONE;
|
||||
}
|
||||
default:
|
||||
return IPCObjectStub::OnRemoteRequest(code, data, reply, option);
|
||||
}
|
||||
|
||||
return ERR_TRANSACTION_FAILED;
|
||||
}
|
||||
} // namespace testserver
|
||||
} // namespace OHOS
|
@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Copyright (c) 2024 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef OHOS_TESTSERVER_TESTSERVERINTERFACESTUB_H
|
||||
#define OHOS_TESTSERVER_TESTSERVERINTERFACESTUB_H
|
||||
|
||||
#include "itest_server_interface.h"
|
||||
#include <iremote_stub.h>
|
||||
|
||||
namespace OHOS {
|
||||
namespace testserver {
|
||||
class TestServerInterfaceStub : public IRemoteStub<ITestServerInterface> {
|
||||
public:
|
||||
int32_t OnRemoteRequest(
|
||||
uint32_t code,
|
||||
MessageParcel& data,
|
||||
MessageParcel& reply,
|
||||
MessageOption& option) override;
|
||||
|
||||
private:
|
||||
static constexpr int32_t COMMAND_CREATE_SESSION = MIN_TRANSACTION_ID + 0;
|
||||
static constexpr int32_t COMMAND_SET_PASTE_DATA = MIN_TRANSACTION_ID + 1;
|
||||
static constexpr int32_t COMMAND_PUBLISH_COMMON_EVENT = MIN_TRANSACTION_ID + 2;
|
||||
};
|
||||
} // namespace testserver
|
||||
} // namespace OHOS
|
||||
#endif // OHOS_TESTSERVER_TESTSERVERINTERFACESTUB_H
|
||||
|
@ -30,16 +30,16 @@ int32_t FooStub::OnRemoteRequest(
|
||||
switch (code) {
|
||||
case COMMAND_SEQ_TEST_FUNC: {
|
||||
std::unique_ptr<myseq> inParam(data.ReadParcelable<myseq>());
|
||||
|
||||
if (!inParam) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
|
||||
myseq outParam;
|
||||
std::unique_ptr<myseq> inoutParam(data.ReadParcelable<myseq>());
|
||||
|
||||
if (!inoutParam) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
|
||||
ErrCode errCode = seq_test_func(*inParam, outParam, *inoutParam);
|
||||
if (!reply.WriteInt32(errCode)) {
|
||||
return ERR_INVALID_VALUE;
|
||||
@ -56,16 +56,16 @@ int32_t FooStub::OnRemoteRequest(
|
||||
}
|
||||
case COMMAND_SEQ_TEST_FUNC2: {
|
||||
std::unique_ptr<myseq2> inParam(data.ReadParcelable<myseq2>());
|
||||
|
||||
if (!inParam) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
|
||||
myseq2 outParam;
|
||||
std::unique_ptr<myseq2> inoutParam(data.ReadParcelable<myseq2>());
|
||||
|
||||
if (!inoutParam) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
|
||||
ErrCode errCode = seq_test_func2(*inParam, outParam, *inoutParam);
|
||||
if (!reply.WriteInt32(errCode)) {
|
||||
return ERR_INVALID_VALUE;
|
||||
|
@ -763,10 +763,10 @@ ErrCode FooProxy::seq_test_func(
|
||||
}
|
||||
for (int32_t i28 = 0; i28 < outParamSize; ++i28) {
|
||||
std::unique_ptr<myseq> value28(reply.ReadParcelable<myseq>());
|
||||
|
||||
if (!value28) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
|
||||
outParam.push_back(*value28);
|
||||
}
|
||||
int32_t inoutParamSize = reply.ReadInt32();
|
||||
@ -775,10 +775,10 @@ ErrCode FooProxy::seq_test_func(
|
||||
}
|
||||
for (int32_t i29 = 0; i29 < inoutParamSize; ++i29) {
|
||||
std::unique_ptr<myseq> value29(reply.ReadParcelable<myseq>());
|
||||
|
||||
if (!value29) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
|
||||
inoutParam.push_back(*value29);
|
||||
}
|
||||
int32_t funcResultSize = reply.ReadInt32();
|
||||
@ -787,10 +787,10 @@ ErrCode FooProxy::seq_test_func(
|
||||
}
|
||||
for (int32_t i30 = 0; i30 < funcResultSize; ++i30) {
|
||||
std::unique_ptr<myseq> value30(reply.ReadParcelable<myseq>());
|
||||
|
||||
if (!value30) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
|
||||
funcResult.push_back(*value30);
|
||||
}
|
||||
return ERR_OK;
|
||||
|
@ -547,10 +547,10 @@ int32_t FooStub::OnRemoteRequest(
|
||||
}
|
||||
for (int32_t i52 = 0; i52 < inParamSize; ++i52) {
|
||||
std::unique_ptr<myseq> value52(data.ReadParcelable<myseq>());
|
||||
|
||||
if (!value52) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
|
||||
inParam.push_back(*value52);
|
||||
}
|
||||
std::vector<myseq> outParam;
|
||||
@ -561,10 +561,10 @@ int32_t FooStub::OnRemoteRequest(
|
||||
}
|
||||
for (int32_t i53 = 0; i53 < inoutParamSize; ++i53) {
|
||||
std::unique_ptr<myseq> value53(data.ReadParcelable<myseq>());
|
||||
|
||||
if (!value53) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
|
||||
inoutParam.push_back(*value53);
|
||||
}
|
||||
std::vector<myseq> result;
|
||||
|
@ -735,10 +735,10 @@ ErrCode FooProxy::seq_test_func(
|
||||
}
|
||||
for (int32_t i28 = 0; i28 < outParamSize; ++i28) {
|
||||
std::unique_ptr<myseq> value28(reply.ReadParcelable<myseq>());
|
||||
|
||||
if (!value28) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
|
||||
outParam.push_back(*value28);
|
||||
}
|
||||
int32_t inoutParamSize = reply.ReadInt32();
|
||||
@ -747,10 +747,10 @@ ErrCode FooProxy::seq_test_func(
|
||||
}
|
||||
for (int32_t i29 = 0; i29 < inoutParamSize; ++i29) {
|
||||
std::unique_ptr<myseq> value29(reply.ReadParcelable<myseq>());
|
||||
|
||||
if (!value29) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
|
||||
inoutParam.push_back(*value29);
|
||||
}
|
||||
int32_t funcResultSize = reply.ReadInt32();
|
||||
@ -759,10 +759,10 @@ ErrCode FooProxy::seq_test_func(
|
||||
}
|
||||
for (int32_t i30 = 0; i30 < funcResultSize; ++i30) {
|
||||
std::unique_ptr<myseq> value30(reply.ReadParcelable<myseq>());
|
||||
|
||||
if (!value30) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
|
||||
funcResult.push_back(*value30);
|
||||
}
|
||||
return ERR_OK;
|
||||
|
@ -540,10 +540,10 @@ int32_t FooStub::OnRemoteRequest(
|
||||
}
|
||||
for (int32_t i52 = 0; i52 < inParamSize; ++i52) {
|
||||
std::unique_ptr<myseq> value52(data.ReadParcelable<myseq>());
|
||||
|
||||
if (!value52) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
|
||||
inParam.push_back(*value52);
|
||||
}
|
||||
std::vector<myseq> outParam;
|
||||
@ -554,10 +554,10 @@ int32_t FooStub::OnRemoteRequest(
|
||||
}
|
||||
for (int32_t i53 = 0; i53 < inoutParamSize; ++i53) {
|
||||
std::unique_ptr<myseq> value53(data.ReadParcelable<myseq>());
|
||||
|
||||
if (!value53) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
|
||||
inoutParam.push_back(*value53);
|
||||
}
|
||||
std::vector<myseq> result;
|
||||
|
@ -786,43 +786,43 @@ ErrCode FooProxy::seq_test_func(
|
||||
int32_t outParamSize = reply.ReadInt32();
|
||||
for (int32_t i = 0; i < outParamSize; ++i) {
|
||||
std::unique_ptr<myseq> key(reply.ReadParcelable<myseq>());
|
||||
|
||||
if (!key) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
std::unique_ptr<myseq> value(reply.ReadParcelable<myseq>());
|
||||
|
||||
std::unique_ptr<myseq> value(reply.ReadParcelable<myseq>());
|
||||
if (!value) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
|
||||
outParam[key] = value;
|
||||
}
|
||||
int32_t inoutParamSize = reply.ReadInt32();
|
||||
for (int32_t i = 0; i < inoutParamSize; ++i) {
|
||||
std::unique_ptr<myseq> key(reply.ReadParcelable<myseq>());
|
||||
|
||||
if (!key) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
std::unique_ptr<myseq> value(reply.ReadParcelable<myseq>());
|
||||
|
||||
std::unique_ptr<myseq> value(reply.ReadParcelable<myseq>());
|
||||
if (!value) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
|
||||
inoutParam[key] = value;
|
||||
}
|
||||
int32_t funcResultSize = reply.ReadInt32();
|
||||
for (int32_t i = 0; i < funcResultSize; ++i) {
|
||||
std::unique_ptr<myseq> key(reply.ReadParcelable<myseq>());
|
||||
|
||||
if (!key) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
std::unique_ptr<myseq> value(reply.ReadParcelable<myseq>());
|
||||
|
||||
std::unique_ptr<myseq> value(reply.ReadParcelable<myseq>());
|
||||
if (!value) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
|
||||
funcResult[key] = value;
|
||||
}
|
||||
return ERR_OK;
|
||||
|
@ -616,15 +616,15 @@ int32_t FooStub::OnRemoteRequest(
|
||||
int32_t inParamSize = data.ReadInt32();
|
||||
for (int32_t i = 0; i < inParamSize; ++i) {
|
||||
std::unique_ptr<myseq> key(data.ReadParcelable<myseq>());
|
||||
|
||||
if (!key) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
std::unique_ptr<myseq> value(data.ReadParcelable<myseq>());
|
||||
|
||||
std::unique_ptr<myseq> value(data.ReadParcelable<myseq>());
|
||||
if (!value) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
|
||||
inParam[key] = value;
|
||||
}
|
||||
std::unordered_map<const myseq&, const myseq&> outParam;
|
||||
@ -632,15 +632,15 @@ int32_t FooStub::OnRemoteRequest(
|
||||
int32_t inoutParamSize = data.ReadInt32();
|
||||
for (int32_t i = 0; i < inoutParamSize; ++i) {
|
||||
std::unique_ptr<myseq> key(data.ReadParcelable<myseq>());
|
||||
|
||||
if (!key) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
std::unique_ptr<myseq> value(data.ReadParcelable<myseq>());
|
||||
|
||||
std::unique_ptr<myseq> value(data.ReadParcelable<myseq>());
|
||||
if (!value) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
|
||||
inoutParam[key] = value;
|
||||
}
|
||||
std::unordered_map<const myseq&, const myseq&> result;
|
||||
|
@ -235,16 +235,16 @@ int32_t FooStub::OnRemoteRequest(
|
||||
}
|
||||
case COMMAND_SEQ_TEST_FUNC: {
|
||||
std::unique_ptr<myseq> inParam(data.ReadParcelable<myseq>());
|
||||
|
||||
if (!inParam) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
|
||||
myseq outParam;
|
||||
std::unique_ptr<myseq> inoutParam(data.ReadParcelable<myseq>());
|
||||
|
||||
if (!inoutParam) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
|
||||
const myseq& result = nullptr;
|
||||
ErrCode errCode = seq_test_func(*inParam, outParam, *inoutParam, result);
|
||||
if (!reply.WriteInt32(errCode)) {
|
||||
|
@ -13,10 +13,13 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
sequenceable OHOS.IRemoteObject;
|
||||
|
||||
interface test.IFoo {
|
||||
unsigned char uchar_test_func([in] unsigned char inParam, [out] unsigned char outParam, [inout] unsigned char inoutParam);
|
||||
unsigned short ushort_test_func([in] unsigned short inParam, [out] unsigned short outParam, [inout] unsigned short inoutParam);
|
||||
unsigned int uint_test_func([in] unsigned int inParam, [out] unsigned int outParam, [inout] unsigned int inoutParam);
|
||||
unsigned long ulong_test_func([in] unsigned long inParam, [out] unsigned long outParam, [inout] unsigned long inoutParam);
|
||||
FileDescriptor fd_test_func([in] FileDescriptor inParam, [out] FileDescriptor outParam, [inout] FileDescriptor inoutParam);
|
||||
IRemoteObject remote_object_test_func([in] IRemoteObject inParam, [out] IRemoteObject outParam, [inout] IRemoteObject inoutParam);
|
||||
}
|
||||
|
@ -220,4 +220,48 @@ ErrCode FooProxy::fd_test_func(
|
||||
funcResult = reply.ReadFileDescriptor();
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
ErrCode FooProxy::remote_object_test_func(
|
||||
const sptr<IRemoteObject>& inParam,
|
||||
sptr<IRemoteObject>& outParam,
|
||||
sptr<IRemoteObject>& inoutParam,
|
||||
sptr<IRemoteObject>& funcResult)
|
||||
{
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
MessageOption option(MessageOption::TF_SYNC);
|
||||
|
||||
if (!data.WriteInterfaceToken(GetDescriptor())) {
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
|
||||
if (!data.WriteRemoteObject(inParam)) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
if (!data.WriteRemoteObject(inoutParam)) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
|
||||
sptr<IRemoteObject> remote = Remote();
|
||||
if (remote == nullptr) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
int32_t result = remote->SendRequest(COMMAND_REMOTE_OBJECT_TEST_FUNC, data, reply, option);
|
||||
if (FAILED(result)) {
|
||||
return result;
|
||||
}
|
||||
|
||||
ErrCode errCode = reply.ReadInt32();
|
||||
if (FAILED(errCode)) {
|
||||
return errCode;
|
||||
}
|
||||
|
||||
outParam = reply.ReadRemoteObject();
|
||||
|
||||
inoutParam = reply.ReadRemoteObject();
|
||||
|
||||
funcResult = reply.ReadRemoteObject();
|
||||
|
||||
return ERR_OK;
|
||||
}
|
||||
} // namespace test
|
||||
|
@ -60,12 +60,19 @@ public:
|
||||
int inoutParam,
|
||||
int& funcResult) override;
|
||||
|
||||
ErrCode remote_object_test_func(
|
||||
const sptr<IRemoteObject>& inParam,
|
||||
sptr<IRemoteObject>& outParam,
|
||||
sptr<IRemoteObject>& inoutParam,
|
||||
sptr<IRemoteObject>& funcResult) override;
|
||||
|
||||
private:
|
||||
static constexpr int32_t COMMAND_UCHAR_TEST_FUNC = MIN_TRANSACTION_ID + 0;
|
||||
static constexpr int32_t COMMAND_USHORT_TEST_FUNC = MIN_TRANSACTION_ID + 1;
|
||||
static constexpr int32_t COMMAND_UINT_TEST_FUNC = MIN_TRANSACTION_ID + 2;
|
||||
static constexpr int32_t COMMAND_ULONG_TEST_FUNC = MIN_TRANSACTION_ID + 3;
|
||||
static constexpr int32_t COMMAND_FD_TEST_FUNC = MIN_TRANSACTION_ID + 4;
|
||||
static constexpr int32_t COMMAND_REMOTE_OBJECT_TEST_FUNC = MIN_TRANSACTION_ID + 5;
|
||||
|
||||
static inline BrokerDelegator<FooProxy> delegator_;
|
||||
};
|
||||
|
@ -138,6 +138,36 @@ int32_t FooStub::OnRemoteRequest(
|
||||
}
|
||||
return ERR_NONE;
|
||||
}
|
||||
case COMMAND_REMOTE_OBJECT_TEST_FUNC: {
|
||||
sptr<IRemoteObject> inParam = data.ReadRemoteObject();
|
||||
if (!inParam) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
|
||||
sptr<IRemoteObject> outParam;
|
||||
sptr<IRemoteObject> inoutParam = data.ReadRemoteObject();
|
||||
if (!inoutParam) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
|
||||
sptr<IRemoteObject> result = nullptr;
|
||||
ErrCode errCode = remote_object_test_func(inParam, outParam, inoutParam, result);
|
||||
if (!reply.WriteInt32(errCode)) {
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
if (SUCCEEDED(errCode)) {
|
||||
if (!reply.WriteRemoteObject(outParam)) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
if (!reply.WriteRemoteObject(inoutParam)) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
if (!reply.WriteRemoteObject(result)) {
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
}
|
||||
return ERR_NONE;
|
||||
}
|
||||
default:
|
||||
return IPCObjectStub::OnRemoteRequest(code, data, reply, option);
|
||||
}
|
||||
|
@ -34,6 +34,7 @@ private:
|
||||
static constexpr int32_t COMMAND_UINT_TEST_FUNC = MIN_TRANSACTION_ID + 2;
|
||||
static constexpr int32_t COMMAND_ULONG_TEST_FUNC = MIN_TRANSACTION_ID + 3;
|
||||
static constexpr int32_t COMMAND_FD_TEST_FUNC = MIN_TRANSACTION_ID + 4;
|
||||
static constexpr int32_t COMMAND_REMOTE_OBJECT_TEST_FUNC = MIN_TRANSACTION_ID + 5;
|
||||
};
|
||||
} // namespace test
|
||||
#endif // TEST_FOOSTUB_H
|
||||
|
@ -54,6 +54,12 @@ public:
|
||||
int& outParam,
|
||||
int inoutParam,
|
||||
int& funcResult) = 0;
|
||||
|
||||
virtual ErrCode remote_object_test_func(
|
||||
const sptr<IRemoteObject>& inParam,
|
||||
sptr<IRemoteObject>& outParam,
|
||||
sptr<IRemoteObject>& inoutParam,
|
||||
sptr<IRemoteObject>& funcResult) = 0;
|
||||
protected:
|
||||
const int VECTOR_MAX_SIZE = 102400;
|
||||
const int LIST_MAX_SIZE = 102400;
|
||||
|
Loading…
Reference in New Issue
Block a user