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_OPERATION_H 17 #define GROUP_OPERATION_H 18 19 #include "device_auth.h" 20 #include "json_utils.h" 21 22 #ifdef __cplusplus 23 extern "C" { 24 #endif 25 26 typedef struct { 27 int32_t (*createGroup)(int32_t osAccountId, int64_t requestId, const char *appId, const char *createParams); 28 int32_t (*deleteGroup)(int32_t osAccountId, int64_t requestId, const char *appId, const char *disbandParams); 29 int32_t (*deleteMember)(int32_t osAccountId, int64_t requestId, const char *appId, const char *deleteParams); 30 int32_t (*addMultiMembers)(int32_t osAccountId, const char *appId, const char *addParams); 31 int32_t (*delMultiMembers)(int32_t osAccountId, const char *appId, const char *deleteParams); 32 int32_t (*regListener)(const char *appId, const DataChangeListener *listener); 33 int32_t (*unRegListener)(const char *appId); 34 int32_t (*getRegisterInfo)(const char *reqJsonStr, char **returnRegisterInfo); 35 int32_t (*checkAccessToGroup)(int32_t osAccountId, const char *appId, const char *groupId); 36 int32_t (*getAccessibleGroupInfoById)(int32_t osAccountId, const char *appId, const char *groupId, 37 char **returnGroupInfo); 38 int32_t (*getAccessibleGroupInfo)(int32_t osAccountId, const char *appId, const char *queryParams, 39 char **returnGroupVec, uint32_t *groupNum); 40 int32_t (*getAccessibleJoinedGroups)(int32_t osAccountId, const char *appId, int groupType, 41 char **returnGroupVec, uint32_t *groupNum); 42 int32_t (*getAccessibleRelatedGroups)(int32_t osAccountId, const char *appId, const char *peerDeviceId, bool isUdid, 43 char **returnGroupVec, uint32_t *groupNum); 44 int32_t (*getAccessibleDeviceInfoById)(int32_t osAccountId, const char *appId, const char *deviceId, bool isUdid, 45 const char *groupId, char **returnDeviceInfo); 46 int32_t (*getAccessibleTrustedDevices)(int32_t osAccountId, const char *appId, const char *groupId, 47 char **returnDevInfoVec, uint32_t *deviceNum); 48 bool (*isDeviceInAccessibleGroup)(int32_t osAccountId, const char *appId, const char *groupId, 49 const char *deviceId, bool isUdid); 50 int32_t (*getPkInfoList)(int32_t osAccountId, const char *appId, const char *queryParams, char **returnInfoList, 51 uint32_t *returnInfoNum); 52 void (*destroyInfo)(char **returnInfo); 53 } GroupImpl; 54 55 int32_t InitGroupRelatedModule(void); 56 void DestroyGroupRelatedModule(void); 57 const GroupImpl *GetGroupImplInstance(void); 58 bool IsGroupSupport(void); 59 60 #ifdef __cplusplus 61 } 62 #endif 63 #endif 64