• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #include "dlp_connection_info.h"
20 #include "iconnection_observer.h"
21 
22 namespace OHOS {
23 namespace AbilityRuntime {
24 /**
25  * @class ServiceProxyAdapter
26  * ServiceProxyAdapter is used to send request to ability manager service.
27  */
28 class ServiceProxyAdapter : public std::enable_shared_from_this<ServiceProxyAdapter> {
29 public:
ServiceProxyAdapter(const sptr<IRemoteObject> remoteObj)30     explicit ServiceProxyAdapter(const sptr<IRemoteObject> remoteObj) : remoteObj_(remoteObj) {}
31     virtual ~ServiceProxyAdapter() = default;
32 
33     ServiceProxyAdapter(const ServiceProxyAdapter&) = default;
34     ServiceProxyAdapter(ServiceProxyAdapter&&) = default;
35     ServiceProxyAdapter& operator=(const ServiceProxyAdapter&) = default;
36     ServiceProxyAdapter& operator=(ServiceProxyAdapter&&) = default;
37 
38     int32_t RegisterObserver(const sptr<IConnectionObserver> &observer);
39 
40     int32_t UnregisterObserver(const sptr<IConnectionObserver> &observer);
41 
42     int32_t GetDlpConnectionInfos(std::vector<DlpConnectionInfo> &infos);
43 
44     sptr<IRemoteObject> GetProxyObject() const;
45 
46 private:
47     sptr<IRemoteObject> remoteObj_;
48 };
49 } // namespace AbilityRuntime
50 } // namespace OHOS
51 #endif // ABILITY_RUNTIME_CONNECTION_OBSERVER_CLIENT_IMPL_H
52