• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021 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 #include "dump_callback_broker_stub.h"
16 #include <message_parcel.h>
17 #include "dump_errors.h"
18 #include "hilog_wrapper.h"
19 namespace OHOS {
20 namespace HiviewDFX {
OnRemoteRequest(uint32_t code,MessageParcel & data,MessageParcel & reply,MessageOption & option)21 int DumpCallbackBrokerStub::OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply,
22     MessageOption &option)
23 {
24     std::u16string descripter = DumpCallbackBrokerStub::GetDescriptor();
25     std::u16string remoteDescripter = data.ReadInterfaceToken();
26     if (descripter != remoteDescripter) {
27         return ERROR_GET_DUMPER_SERVICE;
28     }
29     int ret = ERR_OK;
30     switch (code) {
31         case static_cast<int>(IDumpCallbackBroker::ON_STATUS_CHANGED): {
32             DUMPER_HILOGD(MODULE_ZIDL, "debug|OnStatusChangedStub");
33             ret = OnStatusChangedStub(data);
34             break;
35         }
36         default: {
37             ret = IPCObjectStub::OnRemoteRequest(code, data, reply, option);
38             break;
39         }
40     }
41     return ret;
42 }
43 
OnStatusChanged(uint32_t status)44 void DumpCallbackBrokerStub::OnStatusChanged(uint32_t status)
45 {
46 }
47 
OnStatusChangedStub(MessageParcel & data)48 int32_t DumpCallbackBrokerStub::OnStatusChangedStub(MessageParcel& data)
49 {
50     int32_t ret = ERR_OK;
51     uint32_t status;
52     if (!data.ReadUint32(status)) {
53         return ERROR_READ_PARCEL;
54     }
55     OnStatusChanged(status);
56     return ret;
57 }
58 } // namespace HiviewDFX
59 } // namespace OHOS
60