1 /*
2  * Copyright (c) 2022 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 #ifndef ABILITY_RUNTIME_SERVICE_PROXY_ADAPTER_H
17 #define ABILITY_RUNTIME_SERVICE_PROXY_ADAPTER_H
18 
19 #ifdef WITH_DLP
20 #include "dlp_connection_info.h"
21 #endif // WITH_DLP
22 
23 #include "iconnection_observer.h"
24 
25 namespace OHOS {
26 namespace AbilityRuntime {
27 /**
28  * @class ServiceProxyAdapter
29  * ServiceProxyAdapter is used to send request to ability manager service.
30  */
31 class ServiceProxyAdapter : public std::enable_shared_from_this<ServiceProxyAdapter> {
32 public:
ServiceProxyAdapter(const sptr<IRemoteObject> remoteObj)33     explicit ServiceProxyAdapter(const sptr<IRemoteObject> remoteObj) : remoteObj_(remoteObj) {}
34     virtual ~ServiceProxyAdapter() = default;
35 
36     ServiceProxyAdapter(const ServiceProxyAdapter&) = default;
37     ServiceProxyAdapter(ServiceProxyAdapter&&) = default;
38     ServiceProxyAdapter& operator=(const ServiceProxyAdapter&) = default;
39     ServiceProxyAdapter& operator=(ServiceProxyAdapter&&) = default;
40 
41     int32_t RegisterObserver(const sptr<IConnectionObserver> &observer);
42 
43     int32_t UnregisterObserver(const sptr<IConnectionObserver> &observer);
44 
45 #ifdef WITH_DLP
46     int32_t GetDlpConnectionInfos(std::vector<DlpConnectionInfo> &infos);
47 #endif // WITH_DLP
48 
49     int32_t GetConnectionData(std::vector<ConnectionData> &infos);
50 
51     sptr<IRemoteObject> GetProxyObject() const;
52 
53 private:
54     sptr<IRemoteObject> remoteObj_;
55 };
56 } // namespace AbilityRuntime
57 } // namespace OHOS
58 #endif // ABILITY_RUNTIME_CONNECTION_OBSERVER_CLIENT_IMPL_H
59