1 /*
2  * Copyright (c) 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 
17 #ifndef UPDATE_SERVICE_MODULE_H
18 #define UPDATE_SERVICE_MODULE_H
19 
20 #include <string>
21 
22 #include "message_option.h"
23 #include "message_parcel.h"
24 #include "parcel.h"
25 #include "refbase.h"
26 #include "system_ability_ondemand_reason.h"
27 
28 #ifdef __cplusplus
29 #if __cplusplus
30 extern "C" {
31 #endif
32 #endif
33 
34 namespace OHOS::UpdateEngine {
35 using RequestFuncType = int32_t (*)(uint32_t code,
36     OHOS::MessageParcel &data, OHOS::MessageParcel &reply, OHOS::MessageOption &option);
37 
38 using LifeCycleFuncType = void (*)(const OHOS::SystemAbilityOnDemandReason &reason);
39 using LifeCycleFuncReturnType = int32_t (*)(const OHOS::SystemAbilityOnDemandReason &reason);
40 
41 void RegisterFunc(std::vector<uint32_t> codes, RequestFuncType handleRemoteRequest);
42 
43 void RegisterOnStartOnStopFunc(std::string phase, LifeCycleFuncType handlePhase);
44 void RegisterOnIdleFunc(std::string phase, LifeCycleFuncReturnType handlePhase);
45 
46 #ifdef __cplusplus
47 #if __cplusplus
48 }
49 #endif
50 #endif
51 } // OHOS::UpdateEngine
52 #endif // UPDATE_SERVICE_MODULE_H
53