• 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 SOFTBUS_CONN_BLE_TRANS_STRUCT_H
17 #define SOFTBUS_CONN_BLE_TRANS_STRUCT_H
18 
19 #include <stdint.h>
20 
21 #include "common_list.h"
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
27 #define CTRL_MSG_KEY_METHOD            "KEY_METHOD"
28 #define CTRL_MSG_KEY_DELTA             "KEY_DELTA"
29 #define CTRL_MSG_KEY_REF_NUM           "KEY_REF_NUM"
30 #define CTRL_MSG_KEY_CHALLENGE         "KEY_CHALLENGE"
31 #define CTRL_MSG_METHOD_NOTIFY_REQUEST 1
32 
33 typedef struct {
34     SoftBusMutex lock;
35     bool messagePosted;
36     bool sendTaskRunning;
37 } StartBleSendLPInfo;
38 
39 typedef struct {
40     uint32_t seq;
41     uint32_t size;
42     uint32_t offset;
43     uint32_t total;
44 } BleTransHeader;
45 
46 typedef struct {
47     ListNode node;
48     BleTransHeader header;
49     uint8_t *data;
50 } ConnBlePacket;
51 
52 typedef struct {
53     uint32_t seq;
54     uint32_t received;
55     uint32_t total;
56     ListNode packets;
57 } ConnBleReadBuffer;
58 
59 enum BleCtlMessageMethod {
60     METHOD_NOTIFY_REQUEST = 1,
61 };
62 
63 typedef struct {
64     uint32_t connectionId;
65     int32_t flag;
66     enum BleCtlMessageMethod method;
67     union {
68         struct {
69             int32_t delta;
70             int32_t referenceNumber;
71         } referenceRequest;
72     };
73     uint16_t challengeCode;
74 } BleCtlMessageSerializationContext;
75 
76 typedef struct {
77     void (*onPostBytesFinished)(
78         uint32_t connectionId, uint32_t len, int32_t pid, int32_t flag, int32_t module, int64_t seq, int32_t error);
79 } ConnBleTransEventListener;
80 
81 typedef void (*PostBytesFinishAction)(uint32_t connectionId, int32_t error);
82 
83 #ifdef __cplusplus
84 }
85 #endif /* __cplusplus */
86 #endif /* SOFTBUS_CONN_BLE_TRANS_STRUCT_H */