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 const char* deviceId; 28 bool isUdid; 29 } DeviceQueryParams; 30 31 typedef struct { 32 int32_t (*createGroup)(int32_t osAccountId, int64_t requestId, const char *appId, const char *createParams); 33 int32_t (*deleteGroup)(int32_t osAccountId, int64_t requestId, const char *appId, const char *disbandParams); 34 int32_t (*deleteMember)(int32_t osAccountId, int64_t requestId, const char *appId, const char *deleteParams); 35 int32_t (*addMultiMembers)(int32_t osAccountId, const char *appId, const char *addParams); 36 int32_t (*delMultiMembers)(int32_t osAccountId, const char *appId, const char *deleteParams); 37 int32_t (*regListener)(const char *appId, const DataChangeListener *listener); 38 int32_t (*unRegListener)(const char *appId); 39 int32_t (*getRegisterInfo)(const char *reqJsonStr, char **returnRegisterInfo); 40 int32_t (*checkAccessToGroup)(int32_t osAccountId, const char *appId, const char *groupId); 41 int32_t (*getAccessibleGroupInfoById)(int32_t osAccountId, const char *appId, const char *groupId, 42 char **returnGroupInfo); 43 int32_t (*getAccessibleGroupInfo)(int32_t osAccountId, const char *appId, const char *queryParams, 44 char **returnGroupVec, uint32_t *groupNum); 45 int32_t (*getAccessibleJoinedGroups)(int32_t osAccountId, const char *appId, int groupType, 46 char **returnGroupVec, uint32_t *groupNum); 47 int32_t (*getAccessibleRelatedGroups)(int32_t osAccountId, const char *appId, const char *peerDeviceId, bool isUdid, 48 char **returnGroupVec, uint32_t *groupNum); 49 int32_t (*getAccessibleDeviceInfoById)(int32_t osAccountId, const char *appId, 50 const DeviceQueryParams *devQueryParams, const char *groupId, char **returnDeviceInfo); 51 int32_t (*getAccessibleTrustedDevices)(int32_t osAccountId, const char *appId, const char *groupId, 52 char **returnDevInfoVec, uint32_t *deviceNum); 53 bool (*isDeviceInAccessibleGroup)(int32_t osAccountId, const char *appId, const char *groupId, 54 const char *deviceId, bool isUdid); 55 int32_t (*getPkInfoList)(int32_t osAccountId, const char *appId, const char *queryParams, char **returnInfoList, 56 uint32_t *returnInfoNum); 57 void (*destroyInfo)(char **returnInfo); 58 } GroupImpl; 59 60 int32_t InitGroupRelatedModule(void); 61 void DestroyGroupRelatedModule(void); 62 const GroupImpl *GetGroupImplInstance(void); 63 bool IsGroupSupport(void); 64 65 #ifdef __cplusplus 66 } 67 #endif 68 #endif 69