• 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 USBD_LOAD_USB_SERVICE_H
17 #define USBD_LOAD_USB_SERVICE_H
18 #include <atomic>
19 #include <csignal>
20 #include <cstdlib>
21 #include <hdf_base.h>
22 #include <hdf_log.h>
23 #include <sys/time.h>
24 
25 #include "system_ability_definition.h"
26 #include "system_ability_load_callback_stub.h"
27 
28 namespace OHOS {
29 namespace HDI {
30 namespace Usb {
31 namespace V1_0 {
32 class OnDemandLoadCallback : public SystemAbilityLoadCallbackStub {
33 public:
34     std::atomic_bool loading_ {false};
35     explicit OnDemandLoadCallback();
36 
37     void OnLoadSystemAbilitySuccess(int32_t systemAbilityId, const sptr<IRemoteObject> &remoteObject);
38     void OnLoadSystemAbilityFail(int32_t systemAbilityId);
39 
40 private:
41 };
42 
43 class UsbdLoadService {
44 public:
UsbdLoadService(int32_t saId)45     UsbdLoadService(int32_t saId) : saId_(saId) {};
46     ~UsbdLoadService() = default;
47     int32_t LoadService();
48 
49 private:
50     sptr<OnDemandLoadCallback> loadCallback_ {nullptr};
51     int32_t saId_ {0};
52 };
53 } // namespace V1_0
54 } // namespace Usb
55 } // namespace HDI
56 } // namespace OHOS
57 
58 #endif
59