Skip to content

Commit 0ecd7ee

Browse files
committed
control the output of the HCI packets with a flag PRINT_HCI_DATA
Signed-off-by: Francois Ramu <[email protected]>
1 parent 1d9442b commit 0ecd7ee

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/utility/HCI.cpp

+9
Original file line numberDiff line numberDiff line change
@@ -114,9 +114,11 @@ void HCIClass::poll(unsigned long timeout)
114114

115115
if (_recvBuffer[0] == HCI_ACLDATA_PKT) {
116116
if (_recvIndex > 5 && _recvIndex >= (5 + (_recvBuffer[3] + (_recvBuffer[4] << 8)))) {
117+
#if defined(PRINT_HCI_DATA)
117118
if (_debug) {
118119
dumpPkt("HCI ACLDATA RX <- ", _recvIndex, _recvBuffer);
119120
}
121+
#endif /* PRINT_HCI_DATA */
120122

121123
int pktLen = _recvIndex - 1;
122124
_recvIndex = 0;
@@ -125,9 +127,11 @@ void HCIClass::poll(unsigned long timeout)
125127
}
126128
} else if (_recvBuffer[0] == HCI_EVENT_PKT) {
127129
if (_recvIndex > 3 && _recvIndex >= (3 + _recvBuffer[2])) {
130+
#if defined(PRINT_HCI_DATA)
128131
if (_debug) {
129132
dumpPkt("HCI EVENT RX <- ", _recvIndex, _recvBuffer);
130133
}
134+
#endif /* PRINT_HCI_DATA */
131135

132136
// received full event
133137
int pktLen = _recvIndex - 1;
@@ -410,9 +414,11 @@ int HCIClass::sendAclPkt(uint16_t handle, uint8_t cid, uint8_t plen, void* data)
410414
memcpy(txBuffer, &aclHdr, sizeof(aclHdr));
411415
memcpy(&txBuffer[sizeof(aclHdr)], data, plen);
412416

417+
#if defined(PRINT_HCI_DATA)
413418
if (_debug) {
414419
dumpPkt("HCI ACLDATA TX -> ", sizeof(aclHdr) + plen, txBuffer);
415420
}
421+
#endif /* PRINT_HCI_DATA */
416422

417423
_pendingPkt++;
418424
_HCITransport->write(txBuffer, sizeof(aclHdr) + plen);
@@ -452,9 +458,11 @@ int HCIClass::sendCommand(uint16_t opcode, uint8_t plen, void* parameters)
452458
memcpy(txBuffer, &pktHdr, sizeof(pktHdr));
453459
memcpy(&txBuffer[sizeof(pktHdr)], parameters, plen);
454460

461+
#if defined(PRINT_HCI_DATA)
455462
if (_debug) {
456463
dumpPkt("HCI COMMAND TX -> ", sizeof(pktHdr) + plen, txBuffer);
457464
}
465+
#endif /* PRINT_HCI_DATA */
458466

459467
_HCITransport->write(txBuffer, sizeof(pktHdr) + plen);
460468

@@ -647,6 +655,7 @@ void HCIClass::handleEventPkt(uint8_t /*plen*/, uint8_t pdata[])
647655
}
648656
}
649657

658+
650659
void HCIClass::dumpPkt(const char* prefix, uint8_t plen, uint8_t pdata[])
651660
{
652661
if (_debug) {

0 commit comments

Comments
 (0)