• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one
3  * or more contributor license agreements.  See the NOTICE file
4  * distributed with this work for additional information
5  * regarding copyright ownership.  The ASF licenses this file
6  * to you under the Apache License, Version 2.0 (the
7  * "License"); you may not use this file except in compliance
8  * with the License.  You may obtain a copy of the License at
9  *
10  *  http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing,
13  * software distributed under the License is distributed on an
14  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15  * KIND, either express or implied.  See the License for the
16  * specific language governing permissions and limitations
17  * under the License.
18  */
19 
20 #ifndef H_BLE_MONITOR_PRIV_
21 #define H_BLE_MONITOR_PRIV_
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
27 #define BLE_MONITOR_OPCODE_NEW_INDEX    0
28 #define BLE_MONITOR_OPCODE_DEL_INDEX    1
29 #define BLE_MONITOR_OPCODE_COMMAND_PKT  2
30 #define BLE_MONITOR_OPCODE_EVENT_PKT    3
31 #define BLE_MONITOR_OPCODE_ACL_TX_PKT   4
32 #define BLE_MONITOR_OPCODE_ACL_RX_PKT   5
33 #define BLE_MONITOR_OPCODE_SCO_TX_PKT   6
34 #define BLE_MONITOR_OPCODE_SCO_RX_PKT   7
35 #define BLE_MONITOR_OPCODE_OPEN_INDEX   8
36 #define BLE_MONITOR_OPCODE_CLOSE_INDEX  9
37 #define BLE_MONITOR_OPCODE_INDEX_INFO   10
38 #define BLE_MONITOR_OPCODE_VENDOR_DIAG  11
39 #define BLE_MONITOR_OPCODE_SYSTEM_NOTE  12
40 #define BLE_MONITOR_OPCODE_USER_LOGGING 13
41 
42 #define BLE_MONITOR_EXTHDR_COMMAND_DROPS    1
43 #define BLE_MONITOR_EXTHDR_EVENT_DROPS      2
44 #define BLE_MONITOR_EXTHDR_ACL_RX_DROPS     3
45 #define BLE_MONITOR_EXTHDR_ACL_TX_DROPS     4
46 #define BLE_MONITOR_EXTHDR_SCO_RX_DROPS     5
47 #define BLE_MONITOR_EXTHDR_SCO_TX_DROPS     6
48 #define BLE_MONITOR_EXTHDR_OTHER_DROPS      7
49 #define BLE_MONITOR_EXTHDR_TS32             8
50 
51 struct ble_monitor_hdr {
52     uint16_t  data_len;
53     uint16_t  opcode;
54     uint8_t   flags;
55     uint8_t   hdr_len;
56 } __attribute__((packed));
57 
58 struct ble_monitor_drops_hdr {
59     uint8_t type_cmd;
60     uint8_t cmd;
61     uint8_t type_evt;
62     uint8_t evt;
63     uint8_t type_acl_tx;
64     uint8_t acl_tx;
65     uint8_t type_acl_rx;
66     uint8_t acl_rx;
67     uint8_t type_other;
68     uint8_t other;
69 } __attribute__((packed));
70 
71 struct ble_monitor_ts_hdr {
72     uint8_t   type;
73     uint32_t  ts32;
74 } __attribute__((packed));
75 
76 struct ble_monitor_new_index {
77     uint8_t  type;
78     uint8_t  bus;
79     uint8_t  bdaddr[6];
80     char     name[8];
81 } __attribute__((packed));
82 
83 struct ble_monitor_user_logging {
84     uint8_t  priority;
85     uint8_t  ident_len;
86 } __attribute__((packed));
87 
88 int ble_monitor_init(void);
89 
90 int ble_monitor_send(uint16_t opcode, const void *data, size_t len);
91 
92 int ble_monitor_send_om(uint16_t opcode, const struct os_mbuf *om);
93 
94 int ble_monitor_new_index(uint8_t bus, uint8_t *addr, const char *name);
95 
96 #ifdef __cplusplus
97 }
98 #endif
99 
100 #endif
101