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 #include "enterprise_admin_connection.h"
17 #include "enterprise_conn_manager.h"
18 #include "hilog_wrapper.h"
19
20 namespace OHOS {
21 namespace EDM {
~EnterpriseAdminConnection()22 EnterpriseAdminConnection::~EnterpriseAdminConnection() {}
23
OnAbilityConnectDone(const AppExecFwk::ElementName & element,const sptr<IRemoteObject> & remoteObject,int32_t resultCode)24 void EnterpriseAdminConnection::OnAbilityConnectDone(
25 const AppExecFwk::ElementName& element, const sptr<IRemoteObject>& remoteObject, int32_t resultCode)
26 {
27 HILOG_INFO("EnterpriseAdminConnection OnAbilityConnectDone");
28 proxy_ = (new (std::nothrow) EnterpriseAdminProxy(remoteObject));
29 if (proxy_ == nullptr) {
30 HILOG_INFO("EnterpriseAdminConnection get enterpriseAdminProxy failed.");
31 return;
32 }
33 switch (code_) {
34 case IEnterpriseAdmin::COMMAND_ON_ADMIN_ENABLED:
35 proxy_->OnAdminEnabled();
36 break;
37 case IEnterpriseAdmin::COMMAND_ON_ADMIN_DISABLED:
38 proxy_->OnAdminDisabled();
39 break;
40 default:
41 return;
42 }
43 HILOG_INFO("EnterpriseAdminConnection OnAbilityConnectDone over");
44 }
45
OnAbilityDisconnectDone(const AppExecFwk::ElementName & element,int32_t resultCode)46 void EnterpriseAdminConnection::OnAbilityDisconnectDone(const AppExecFwk::ElementName& element, int32_t resultCode)
47 {
48 HILOG_INFO("EnterpriseAdminConnection OnAbilityDisconnectDone");
49 }
50 } // namespace EDM
51 } // namespace OHOS
52