• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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     PASS = 1004720001,
43     REJECT = 1004720002,
44     USERTIP = 1004720003,
45     USERAGREE = 1004720004
46 } ServiceCollaborationManagerResultCode;
47 
48 typedef struct ServiceCollaborationManager_HardwareRequestInfo {
49     ServiceCollaborationManagerHardwareType hardWareType;
50     bool canShare;
51 } ServiceCollaborationManager_HardwareRequestInfo;
52 
53 typedef struct ServiceCollaborationManager_CommunicationRequestInfo {
54     int32_t minBandwidth;
55     int32_t maxLatency;
56     int32_t minLatency;
57     int32_t maxWaitTime;
58     const char* dataType;
59 } ServiceCollaborationManager_CommunicationRequestInfo;
60 
61 typedef struct ServiceCollaborationManager_ResourceRequestInfoSets {
62     uint32_t remoteHardwareListSize;
63     ServiceCollaborationManager_HardwareRequestInfo *remoteHardwareList;
64     uint32_t localHardwareListSize;
65     ServiceCollaborationManager_HardwareRequestInfo *localHardwareList;
66     ServiceCollaborationManager_CommunicationRequestInfo *communicationRequest;
67 } ServiceCollaborationManager_ResourceRequestInfoSets;
68 
69 typedef struct ServiceCollaborationManager_Callback {
70     int32_t (*OnStop)(const char* peerNetworkId);
71     int32_t (*ApplyResult)(int32_t errorcode, int32_t result, const char* reason);
72 } ServiceCollaborationManager_Callback;
73 
74 typedef struct ServiceCollaborationManager_API {
75     int32_t (*ServiceCollaborationManager_PublishServiceState)(const char* peerNetworkId, const char* serviceName,
76         const char* extraInfo, ServiceCollaborationManagerBussinessStatus state);
77     int32_t (*ServiceCollaborationManager_ApplyAdvancedResource)(const char* peerNetworkId, const char* serviceName,
78         ServiceCollaborationManager_ResourceRequestInfoSets* resourceRequest,
79         ServiceCollaborationManager_Callback* callback);
80     int32_t (*ServiceCollaborationManager_RegisterLifecycleCallback)(const char* serviceName,
81         ServiceCollaborationManager_Callback* callback);
82     int32_t (*ServiceCollaborationManager_UnRegisterLifecycleCallback)(const char* serviceName);
83 } ServiceCollaborationManager_API;
84 
85 int32_t ServiceCollaborationManager_Export(ServiceCollaborationManager_API *exportapi);
86 
87 #ifdef __cplusplus
88 }
89 #endif
90 
91 #endif //COLLABORATION_MANAGER_H