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 "daudio_sink_ipc_callback_proxy.h"
17
18 #include "daudio_errorcode.h"
19
20 #undef DH_LOG_TAG
21 #define DH_LOG_TAG "DAudioSinkIpcCallbackProxy"
22
23 namespace OHOS {
24 namespace DistributedHardware {
OnNotifyResourceInfo(const ResourceEventType & type,const std::string & subType,const std::string & networkId,bool & isSensitive,bool & isSameAccount)25 int32_t DAudioSinkIpcCallbackProxy::OnNotifyResourceInfo(const ResourceEventType &type, const std::string &subType,
26 const std::string &networkId, bool &isSensitive, bool &isSameAccount)
27 {
28 MessageParcel data;
29 MessageParcel reply;
30 MessageOption option;
31 if (!data.WriteInterfaceToken(GetDescriptor())) {
32 return ERR_DH_AUDIO_SA_WRITE_INTERFACE_TOKEN_FAILED;
33 }
34
35 int32_t resType = static_cast<int32_t>(type);
36 if (!data.WriteInt32(resType) || !data.WriteString(subType) || !data.WriteString(networkId)) {
37 return ERR_DH_AUDIO_SA_WRITE_PARAM_FAIED;
38 }
39
40 Remote()->SendRequest(NOTIFY_RESOURCEINFO, data, reply, option);
41 int32_t ret = reply.ReadInt32();
42 isSensitive = reply.ReadBool();
43 isSameAccount = reply.ReadBool();
44 return ret;
45 }
46 } // namespace DistributedHardware
47 } // namespace OHOS