1 /*
2  * Copyright (C) 2021-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 #ifndef GROUP_MANAGER_H
17 #define GROUP_MANAGER_H
18 
19 #include "device_auth.h"
20 #include "json_utils.h"
21 
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25 
26 int32_t InitGroupManager(void);
27 void DestroyGroupManager(void);
28 
29 int32_t CreateGroupImpl(int32_t osAccountId, int64_t requestId, const char *appId, const char *createParams);
30 int32_t DeleteGroupImpl(int32_t osAccountId, int64_t requestId, const char *appId, const char *disbandParams);
31 int32_t DeleteMemberFromGroupImpl(int32_t osAccountId, int64_t requestId, const char *appId, const char *deleteParams);
32 int32_t AddMultiMembersToGroupImpl(int32_t osAccountId, const char *appId, const char *addParams);
33 int32_t DelMultiMembersFromGroupImpl(int32_t osAccountId, const char *appId, const char *deleteParams);
34 
35 int32_t RegListenerImpl(const char *appId, const DataChangeListener *listener);
36 int32_t UnRegListenerImpl(const char *appId);
37 
38 int32_t GetRegisterInfoImpl(const char *reqJsonStr, char **returnRegisterInfo);
39 int32_t CheckAccessToGroupImpl(int32_t osAccountId, const char *appId, const char *groupId);
40 int32_t GetGroupInfoByIdImpl(int32_t osAccountId, const char *appId, const char *groupId, char **returnGroupInfo);
41 int32_t GetGroupInfoImpl(int32_t osAccountId, const char *appId, const char *queryParams,
42     char **returnGroupVec, uint32_t *groupNum);
43 int32_t GetJoinedGroupsImpl(int32_t osAccountId, const char *appId, int groupType,
44     char **returnGroupVec, uint32_t *groupNum);
45 int32_t GetRelatedGroupsImpl(int32_t osAccountId, const char *appId, const char *peerDeviceId,
46     char **returnGroupVec, uint32_t *groupNum);
47 int32_t GetDeviceInfoByIdImpl(int32_t osAccountId, const char *appId, const char *deviceId, const char *groupId,
48     char **returnDeviceInfo);
49 int32_t GetTrustedDevicesImpl(int32_t osAccountId, const char *appId, const char *groupId,
50     char **returnDevInfoVec, uint32_t *deviceNum);
51 bool IsDeviceInGroupImpl(int32_t osAccountId, const char *appId, const char *groupId, const char *deviceId);
52 int32_t GetPkInfoListImpl(int32_t osAccountId, const char *appId, const char *queryParams,
53     char **returnInfoList, uint32_t *returnInfoNum);
54 void DestroyInfoImpl(char **returnInfo);
55 
56 #ifdef __cplusplus
57 }
58 #endif
59 #endif
60