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