• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2025 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 DISC_BLE_UTILS_STRUCT_H
17 #define DISC_BLE_UTILS_STRUCT_H
18 
19 #include <stdbool.h>
20 #include <stdint.h>
21 
22 #include "broadcast_protocol_constant_struct.h"
23 #include "disc_action_common.h"
24 #include "disc_ble_constant_struct.h"
25 #include "softbus_common.h"
26 
27 #ifdef __cplusplus
28 #if __cplusplus
29 extern "C" {
30 #endif
31 #endif
32 
33 #define ADV_DATA_MAX_LEN                   24
34 #define RESP_DATA_MAX_LEN                  26
35 #define REAL_RESP_DATA_MAX_LEN             27
36 #define CUST_CAPABILITY_LEN                2
37 #define CUST_CAPABILITY_TYPE_LEN           1
38 #define BROADCAST_MAX_LEN                  (ADV_DATA_MAX_LEN + RESP_DATA_MAX_LEN)
39 #define ACTION_CHANNEL_SIZE                1
40 
41 #define DIST_ACTION_DEV_NAME_LEN           64
42 #define DIST_ACTION_CUST_LEN               2
43 #define DIST_ACTION_EXT_CUST_MAX_LEN       127
44 #define LEN_UDID                           8
45 
46 typedef struct {
47     union {
48         unsigned char data[BROADCAST_MAX_LEN];
49         struct {
50             unsigned char advData[ADV_DATA_MAX_LEN];
51             unsigned char rspData[RESP_DATA_MAX_LEN];
52         };
53     } data;
54     // for total mode
55     unsigned short dataLen;
56 
57     // for separate mode
58     unsigned short advDataLen;
59     unsigned short rspDataLen;
60 } BroadcastData;
61 
62 typedef struct {
63     DeviceInfo *info;
64     int8_t power;
65     char devName[DISC_MAX_DEVICE_NAME_LEN];
66     uint32_t devNameLen;
67     char nickname[DISC_MAX_NICKNAME_LEN];
68     uint32_t nicknameLen;
69     uint8_t channelId;
70     uint8_t mac[ACTION_MAC_SIZE];
71 } DeviceWrapper;
72 
73 typedef enum {
74     HEART_BEAT = 0,
75     CAST_PLUS,
76     DV_KIT,
77     PC_COLLABORATION,
78     OSD
79 } CustDataCapability;
80 
81 typedef struct {
82     uint8_t cust[DIST_ACTION_CUST_LEN];
83     uint8_t extCust[DIST_ACTION_EXT_CUST_MAX_LEN];
84     uint8_t extCustLen;
85 } DistInputContext;
86 
87 typedef struct {
88     uint8_t uidHash[SHORT_USER_ID_HASH_LEN];
89     uint8_t devId[SHORT_DEVICE_ID_HASH_LENGTH];
90     char devName[DIST_ACTION_DEV_NAME_LEN];
91     uint8_t devNameLen;
92     uint16_t deviceType;
93     DiscActionParam localAction;
94     DiscActionParam remoteAction;
95     DistInputContext inputCtx;
96 } DistActionContext;
97 
98 #ifdef __cplusplus
99 #if __cplusplus
100 }
101 #endif /* __cplusplus */
102 #endif /* __cplusplus */
103 #endif