1 /* 2 * Copyright (C) 2021-2022 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 (*addMember)(int32_t osAccountId, int64_t requestId, const char *appId, const char *addParams); 30 int32_t (*deleteMember)(int32_t osAccountId, int64_t requestId, const char *appId, const char *deleteParams); 31 int32_t (*addMultiMembers)(int32_t osAccountId, const char *appId, const char *addParams); 32 int32_t (*delMultiMembers)(int32_t osAccountId, const char *appId, const char *deleteParams); 33 int32_t (*processBindData)(int64_t requestId, const uint8_t *data, uint32_t dataLen); 34 int32_t (*regListener)(const char *appId, const DataChangeListener *listener); 35 int32_t (*unRegListener)(const char *appId); 36 int32_t (*checkAccessToGroup)(int32_t osAccountId, const char *appId, const char *groupId); 37 int32_t (*getAccessibleGroupInfoById)(int32_t osAccountId, const char *appId, const char *groupId, 38 char **returnGroupInfo); 39 int32_t (*getAccessibleGroupInfo)(int32_t osAccountId, const char *appId, const char *queryParams, 40 char **returnGroupVec, uint32_t *groupNum); 41 int32_t (*getAccessibleJoinedGroups)(int32_t osAccountId, const char *appId, int groupType, 42 char **returnGroupVec, uint32_t *groupNum); 43 int32_t (*getAccessibleRelatedGroups)(int32_t osAccountId, const char *appId, const char *peerDeviceId, bool isUdid, 44 char **returnGroupVec, uint32_t *groupNum); 45 int32_t (*getAccessibleDeviceInfoById)(int32_t osAccountId, const char *appId, const char *deviceId, bool isUdid, 46 const char *groupId, char **returnDeviceInfo); 47 int32_t (*getAccessibleTrustedDevices)(int32_t osAccountId, const char *appId, const char *groupId, 48 char **returnDevInfoVec, uint32_t *deviceNum); 49 bool (*isDeviceInAccessibleGroup)(int32_t osAccountId, const char *appId, const char *groupId, 50 const char *deviceId, bool isUdid); 51 int32_t (*getPkInfoList)(int32_t osAccountId, const char *appId, const char *queryParams, char **returnInfoList, 52 uint32_t *returnInfoNum); 53 void (*cancelGroupRequest)(int64_t requestId, const char *appId); 54 void (*destroyInfo)(char **returnInfo); 55 } GroupImpl; 56 57 int32_t InitGroupRelatedModule(void); 58 void DestroyGroupRelatedModule(void); 59 const GroupImpl *GetGroupImplInstance(void); 60 bool IsGroupSupport(void); 61 62 #ifdef __cplusplus 63 } 64 #endif 65 #endif 66