Files
miscservices_inputmethod/frameworks/inputmethod_controller/src/input_client_proxy.cpp
T
zhouyongfei dc5c87702a 框架jnapi从7切到8
Signed-off-by: zhouyongfei <zhouyongfei@huawei.com>
2022-01-28 20:24:37 +08:00

68 lines
2.1 KiB
C++

/*
* Copyright (C) 2021 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 "input_client_proxy.h"
namespace OHOS {
namespace MiscServices {
using namespace ErrorCode;
InputClientProxy::InputClientProxy(const sptr<IRemoteObject> &object) : IRemoteProxy<IInputClient>(object)
{
}
int32_t InputClientProxy::onInputReady(const sptr<IInputMethodAgent>& agent)
{
IMSA_HILOGI("InputClientProxy::onInputReady");
MessageParcel data, reply;
MessageOption option;
if (!data.WriteInterfaceToken(GetDescriptor())) {
return ERROR_EX_PARCELABLE;
}
data.WriteRemoteObject(agent->AsObject().GetRefPtr());
auto ret = Remote()->SendRequest(ON_INPUT_READY, data, reply, option);
if (ret != NO_ERROR) {
IMSA_HILOGI("InputClientProxy::onInputReady SendRequest failed");
return ERROR_STATUS_FAILED_TRANSACTION;
}
return NO_ERROR;
}
int32_t InputClientProxy::onInputReleased(int32_t retValue)
{
MessageParcel data, reply;
MessageOption option;
data.WriteInterfaceToken(GetDescriptor());
data.WriteInt32(retValue);
auto status = Remote()->SendRequest(ON_INPUT_RELEASED, data, reply, option);
return status;
}
int32_t InputClientProxy::setDisplayMode(int32_t mode)
{
MessageParcel data, reply;
MessageOption option;
data.WriteInterfaceToken(GetDescriptor());
data.WriteInt32(mode);
auto status = Remote()->SendRequest(SET_DISPLAY_MODE, data, reply, option);
return status;
}
}
}