1 /* 2 * Copyright (c) 2024 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 #ifndef COLLABORATION_MANAGER_UTILS_H 16 #define COLLABORATION_MANAGER_UTILS_H 17 18 #include <stdint.h> 19 #include <stdio.h> 20 #include <string.h> 21 22 #ifdef __cplusplus 23 extern "C" { 24 #endif 25 26 typedef enum ServiceCollaborationManagerHardwareType { 27 SCM_UNKNOWN_TYPE = 0, 28 SCM_DISPLAY = 1, 29 SCM_MIC = 2, 30 SCM_SPEAKER = 3, 31 SCM_CAMERA = 4, 32 } ServiceCollaborationManagerHardwareType; 33 34 typedef enum ServiceCollaborationManagerBussinessStatus { 35 SCM_IDLE = 1, 36 SCM_PREPARE = 2, 37 SCM_CONNECTING = 3, 38 SCM_CONNECTED = 4 39 } ServiceCollaborationManagerBussinessStatus; 40 41 typedef enum ServiceCollaborationManagerResultCode { 42 ONSTOP = 1004720000, 43 PASS = 1004720001, 44 REJECT = 1004720002, 45 USERTIP = 1004720003, 46 USERAGREE = 1004720004 47 } ServiceCollaborationManagerResultCode; 48 49 typedef struct ServiceCollaborationManager_HardwareRequestInfo { 50 ServiceCollaborationManagerHardwareType hardWareType; 51 bool canShare; 52 } ServiceCollaborationManager_HardwareRequestInfo; 53 54 typedef struct ServiceCollaborationManager_CommunicationRequestInfo { 55 int32_t minBandwidth; 56 int32_t maxLatency; 57 int32_t minLatency; 58 int32_t maxWaitTime; 59 const char* dataType; 60 } ServiceCollaborationManager_CommunicationRequestInfo; 61 62 typedef struct ServiceCollaborationManager_ResourceRequestInfoSets { 63 uint32_t remoteHardwareListSize; 64 ServiceCollaborationManager_HardwareRequestInfo *remoteHardwareList; 65 uint32_t localHardwareListSize; 66 ServiceCollaborationManager_HardwareRequestInfo *localHardwareList; 67 ServiceCollaborationManager_CommunicationRequestInfo *communicationRequest; 68 } ServiceCollaborationManager_ResourceRequestInfoSets; 69 70 typedef struct ServiceCollaborationManager_Callback { 71 int32_t (*OnStop)(const char* peerNetworkId); 72 int32_t (*ApplyResult)(int32_t errorcode, int32_t result, const char* reason); 73 } ServiceCollaborationManager_Callback; 74 75 typedef struct ServiceCollaborationManager_API { 76 int32_t (*ServiceCollaborationManager_PublishServiceState)(const char* peerNetworkId, const char* serviceName, 77 const char* extraInfo, ServiceCollaborationManagerBussinessStatus state); 78 int32_t (*ServiceCollaborationManager_ApplyAdvancedResource)(const char* peerNetworkId, const char* serviceName, 79 ServiceCollaborationManager_ResourceRequestInfoSets* resourceRequest, 80 ServiceCollaborationManager_Callback* callback); 81 int32_t (*ServiceCollaborationManager_RegisterLifecycleCallback)(const char* serviceName, 82 ServiceCollaborationManager_Callback* callback); 83 int32_t (*ServiceCollaborationManager_UnRegisterLifecycleCallback)(const char* serviceName); 84 } ServiceCollaborationManager_API; 85 86 int32_t ServiceCollaborationManager_Export(ServiceCollaborationManager_API *exportapi); 87 88 #ifdef __cplusplus 89 } 90 #endif 91 92 #endif //COLLABORATION_MANAGER_H