Minor edit

This commit is contained in:
Kristian Lauszus 2012-08-09 21:22:55 +02:00
parent e55e78450b
commit cfbf693384
2 changed files with 11 additions and 14 deletions

14
BTD.cpp
View file

@ -417,24 +417,23 @@ void BTD::HCI_event_task() {
case EV_ENCRYPTION_CHANGE: case EV_ENCRYPTION_CHANGE:
case EV_READ_REMOTE_VERSION_INFORMATION_COMPLETE: case EV_READ_REMOTE_VERSION_INFORMATION_COMPLETE:
break; break;
default:
#ifdef EXTRADEBUG #ifdef EXTRADEBUG
default:
if(hcibuf[0] != 0x00) { if(hcibuf[0] != 0x00) {
Notify(PSTR("\r\nUnmanaged HCI Event: ")); Notify(PSTR("\r\nUnmanaged HCI Event: "));
PrintHex<uint8_t>(hcibuf[0]); PrintHex<uint8_t>(hcibuf[0]);
} }
#endif
break; break;
#endif
} // switch } // switch
HCI_task(); HCI_task();
} }
else {
#ifdef EXTRADEBUG #ifdef EXTRADEBUG
else {
Notify(PSTR("\r\nHCI event error: ")); Notify(PSTR("\r\nHCI event error: "));
PrintHex<uint8_t>(rcode); PrintHex<uint8_t>(rcode);
#endif
} }
#endif
} }
/* Poll Bluetooth and print result */ /* Poll Bluetooth and print result */
@ -604,12 +603,13 @@ void BTD::ACL_event_task() {
for (uint8_t i=0; i<BTD_NUMDEVICES; i++) for (uint8_t i=0; i<BTD_NUMDEVICES; i++)
if (btService[i]) if (btService[i])
btService[i]->ACLData(l2capinbuf); btService[i]->ACLData(l2capinbuf);
} else if (rcode != hrNAK) { }
#ifdef EXTRADEBUG #ifdef EXTRADEBUG
else if (rcode != hrNAK) {
Notify(PSTR("\r\nACL data in error: ")); Notify(PSTR("\r\nACL data in error: "));
PrintHex<uint8_t>(rcode); PrintHex<uint8_t>(rcode);
#endif
} }
#endif
for (uint8_t i=0; i<BTD_NUMDEVICES; i++) for (uint8_t i=0; i<BTD_NUMDEVICES; i++)
if (btService[i]) if (btService[i])
btService[i]->Run(); btService[i]->Run();

11
SPP.cpp
View file

@ -261,15 +261,11 @@ void SPP::ACLData(uint8_t* l2capinbuf) {
Serial.print(l2capinbuf[11],HEX); Serial.print(l2capinbuf[11],HEX);
} }
#endif #endif
}
#ifdef PRINTREPORT // Uncomment "#define PRINTREPORT" to print the report send to the Arduino via Bluetooth #ifdef PRINTREPORT // Uncomment "#define PRINTREPORT" to print the report send to the Arduino via Bluetooth
if(rfcommChannelType == RFCOMM_UIH && rfcommChannel == rfcommChannelConnection) {
uint8_t length = l2capinbuf[10] >> 1; // Get length
uint8_t offset = l2capinbuf[4]-length-4; // See if there is credit
for(uint8_t i = 0; i < length; i++) for(uint8_t i = 0; i < length; i++)
Serial.write(l2capinbuf[i+11+offset]); Serial.write(l2capinbuf[i+11+offset]);
}
#endif #endif
}
} else { } else {
if(rfcommChannelType == RFCOMM_SABM) { // SABM Command - this is sent twice: once for channel 0 and then for the channel to establish if(rfcommChannelType == RFCOMM_SABM) { // SABM Command - this is sent twice: once for channel 0 and then for the channel to establish
#ifdef DEBUG #ifdef DEBUG
@ -355,14 +351,15 @@ void SPP::ACLData(uint8_t* l2capinbuf) {
#endif #endif
} }
} }
} else { }
#ifdef EXTRADEBUG #ifdef EXTRADEBUG
else {
Notify(PSTR("\r\nUnsupported L2CAP Data - Channel ID: ")); Notify(PSTR("\r\nUnsupported L2CAP Data - Channel ID: "));
PrintHex<uint8_t>(l2capinbuf[7]); PrintHex<uint8_t>(l2capinbuf[7]);
Notify(PSTR(" ")); Notify(PSTR(" "));
PrintHex<uint8_t>(l2capinbuf[6]); PrintHex<uint8_t>(l2capinbuf[6]);
#endif
} }
#endif
SDP_task(); SDP_task();
RFCOMM_task(); RFCOMM_task();
} }