• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022-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 #ifndef OHOS_ABILITYRUNTIME_CONNECTION_OBSERVER_PROXY_H
17 #define OHOS_ABILITYRUNTIME_CONNECTION_OBSERVER_PROXY_H
18 
19 #include <string>
20 
21 #include "iconnection_observer.h"
22 #include "iremote_proxy.h"
23 
24 namespace OHOS {
25 namespace AbilityRuntime {
26 /**
27  * interface for connection observer.
28  */
29 class ConnectionObserverProxy : public IRemoteProxy<IConnectionObserver> {
30 public:
ConnectionObserverProxy(const sptr<IRemoteObject> & impl)31     explicit ConnectionObserverProxy(const sptr<IRemoteObject> &impl) : IRemoteProxy<IConnectionObserver>(impl) {}
32 
33     virtual ~ConnectionObserverProxy() = default;
34 
35     virtual void OnExtensionConnected(const ConnectionData &connectionData) override;
36 
37     virtual void OnExtensionDisconnected(const ConnectionData &connectionData) override;
38 
39     virtual void OnExtensionSuspended(const ConnectionData &connectionData) override;
40 
41     virtual void OnExtensionResumed(const ConnectionData &connectionData) override;
42 
43 #ifdef WITH_DLP
44     virtual void OnDlpAbilityOpened(const DlpStateData &dlpData) override;
45 
46     virtual void OnDlpAbilityClosed(const DlpStateData &dlpData) override;
47 #endif // WITH_DLP
48 
49 private:
50     static inline BrokerDelegator<ConnectionObserverProxy> delegator_;
51     int SendTransactCmd(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option);
52 };
53 }  // namespace AbilityRuntime
54 }  // namespace OHOS
55 #endif  // OHOS_ABILITYRUNTIME_CONNECTION_OBSERVER_PROXY_H
56