• 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 
16 #include "hdf_remote_service.h"
17 #include "hdf_remote_adapter_if.h"
18 
HdfRemoteServiceAddDeathRecipient(struct HdfRemoteService * service,struct HdfDeathRecipient * recipient)19 void HdfRemoteServiceAddDeathRecipient(
20     struct HdfRemoteService *service, struct HdfDeathRecipient *recipient)
21 {
22     HdfRemoteAdapterAddDeathRecipient(service, recipient);
23 }
24 
HdfRemoteServiceRemoveDeathRecipient(struct HdfRemoteService * service,struct HdfDeathRecipient * recipient)25 void HdfRemoteServiceRemoveDeathRecipient(
26     struct HdfRemoteService *service, struct HdfDeathRecipient *recipient)
27 {
28     HdfRemoteAdapterRemoveDeathRecipient(service, recipient);
29 }
30 
HdfRemoteServiceObtain(struct HdfObject * object,struct HdfRemoteDispatcher * dispatcher)31 struct HdfRemoteService *HdfRemoteServiceObtain(struct HdfObject *object, struct HdfRemoteDispatcher *dispatcher)
32 {
33     struct HdfRemoteService *service = HdfRemoteAdapterObtain();
34     if ((service != NULL) && (service->dispatcher == NULL)) {
35         service->dispatcher = dispatcher;
36         service->target = object;
37     }
38     return service;
39 }
40 
HdfRemoteServiceRecycle(struct HdfRemoteService * service)41 void HdfRemoteServiceRecycle(struct HdfRemoteService *service)
42 {
43     HdfRemoteAdapterRecycle(service);
44 }
45 
HdfRemoteServiceGet(int32_t serviceId)46 struct HdfRemoteService *HdfRemoteServiceGet(int32_t serviceId)
47 {
48     return HdfRemoteAdapterGetSa(serviceId);
49 }
50 
HdfRemoteServiceRegister(int32_t serviceId,struct HdfRemoteService * service)51 int HdfRemoteServiceRegister(int32_t serviceId, struct HdfRemoteService *service)
52 {
53     return HdfRemoteAdapterAddSa(serviceId, service);
54 }
55 
HdfRemoteServiceSetInterfaceDesc(struct HdfRemoteService * service,const char * descriptor)56 bool HdfRemoteServiceSetInterfaceDesc(struct HdfRemoteService *service, const char *descriptor)
57 {
58     return HdfRemoteAdapterSetInterfaceDesc(service, descriptor);
59 }
60 
HdfRemoteServiceWriteInterfaceToken(struct HdfRemoteService * service,struct HdfSBuf * data)61 bool HdfRemoteServiceWriteInterfaceToken(struct HdfRemoteService *service, struct HdfSBuf *data)
62 {
63     return HdfRemoteAdapterWriteInterfaceToken(service, data);
64 }
65 
HdfRemoteServiceCheckInterfaceToken(struct HdfRemoteService * service,struct HdfSBuf * data)66 bool HdfRemoteServiceCheckInterfaceToken(struct HdfRemoteService *service, struct HdfSBuf *data)
67 {
68     return HdfRemoteAdapterCheckInterfaceToken(service, data);
69 }
70 
HdfRemoteServiceDefaultDispatch(struct HdfRemoteService * service,int code,struct HdfSBuf * data,struct HdfSBuf * reply)71 int HdfRemoteServiceDefaultDispatch(
72     struct HdfRemoteService *service, int code, struct HdfSBuf *data, struct HdfSBuf *reply)
73 {
74     return HdfRemoteAdapterDefaultDispatch(service, code, data, reply);
75 }
76