• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2023 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #include "intell_voice_update_callback_proxy.h"
17 #include "intell_voice_log.h"
18 
19 #define LOG_TAG "IntellVoiceUpdateCallbackProxy"
20 
21 using namespace OHOS::HDI::IntelligentVoice::Engine::V1_0;
22 
23 namespace OHOS {
24 namespace IntellVoice {
OnUpdateComplete(const int32_t result)25 void IntellVoiceUpdateCallbackProxy::OnUpdateComplete(const int32_t result)
26 {
27     MessageParcel data;
28     MessageParcel reply;
29     MessageOption option;
30     INTELL_VOICE_LOG_INFO("enter");
31 
32     if (!data.WriteInterfaceToken(IIntelligentVoiceUpdateCallback::GetDescriptor())) {
33         INTELL_VOICE_LOG_ERROR("WriteInterfaceToken failed");
34         return;
35     }
36 
37     if (!data.WriteInt32(result)) {
38         INTELL_VOICE_LOG_ERROR("write msgid failed");
39         return;
40     }
41 
42     int32_t error = Remote()->SendRequest(IIntelligentVoiceUpdateCallback::Code::ON_INTELL_VOICE_UPDATE_EVENT,
43         data, reply, option);
44     if (error != 0) {
45         INTELL_VOICE_LOG_ERROR("send request error: %{public}d", error);
46         return;
47     }
48     reply.ReadInt32();
49 }
50 }
51 }