1 /*
2  * Copyright (c) 2020 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_ABILITYKIT_H
17 #define OHOS_ABILITYKIT_H
18 
19 #include "stdint.h"
20 
21 typedef int32_t (*SuccessCallback)(const void *data);
22 typedef int32_t (*FailCallback)(const void *data, uint16_t dataLength, uint16_t errorCode);
23 
24 namespace OHOS {
25 struct FeatureAbilityDataInfo {
26     char *bundleName { nullptr };
27     void *message { nullptr };
28     uint32_t messageLength { 0 };
29     char *abilityName { nullptr };
30     char *deviceID { nullptr };
31 };
32 
33 class AbilityKit {
34 public:
35     AbilityKit();
36     ~AbilityKit();
37 
38     static int32_t RegisterReceiver(const char *bundleName, SuccessCallback success, FailCallback fail,
39                                     uint32_t successCallbackFunc, uint32_t failCallbackFunc, uint32_t context);
40     static int32_t UnregisterReceiver(const char *bundleName);
41     static int32_t SendMsgToPeerApp(bool isLocalMsg, const char *callingPkgName, const char *calledPkgName,
42                                     const uint8_t *msgBody, uint32_t length, uint32_t successCallbackFunc,
43                                     uint32_t failCallbackFunc, uint32_t context);
44     static int32_t DetectPhoneApp(const char *callingPkgName, const char *calledPkgName, uint32_t successCallbackFunc,
45                                   uint32_t failCallbackFunc, uint32_t context);
46     static int32_t DetectResourceRelease();
47     static int32_t SendMsgResourceRelease();
48 };
49 } // namespace OHOS
50 #endif // OHOS_ABILITYKIT_H