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
28namespace OHOS {
29namespace HDI {
30namespace Usb {
31namespace V1_1 {
32class OnDemandLoadCallback : public SystemAbilityLoadCallbackStub {
33public:
34    std::atomic_bool loading_ {false};
35    explicit OnDemandLoadCallback();
36    ~OnDemandLoadCallback();
37    void OnLoadSystemAbilitySuccess(int32_t systemAbilityId, const sptr<IRemoteObject> &remoteObject);
38    void OnLoadSystemAbilityFail(int32_t systemAbilityId);
39
40private:
41};
42
43class UsbdLoadService {
44public:
45    UsbdLoadService(int32_t saId);
46    ~UsbdLoadService();
47    int32_t LoadService();
48
49private:
50    sptr<OnDemandLoadCallback> loadCallback_ {nullptr};
51    int32_t saId_ {0};
52};
53} // namespace V1_1
54} // namespace Usb
55} // namespace HDI
56} // namespace OHOS
57
58#endif
59