Removed return

This commit is contained in:
Kristian Lauszus 2012-08-08 20:08:09 +02:00
parent 7a867e68ed
commit 55ba0911fb
2 changed files with 21 additions and 24 deletions

View file

@ -273,7 +273,6 @@ void BTD::EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint8_t proto
if(pollInterval < pep->bInterval) // Set the polling interval as the largest polling interval obtained from endpoints if(pollInterval < pep->bInterval) // Set the polling interval as the largest polling interval obtained from endpoints
pollInterval = pep->bInterval; pollInterval = pep->bInterval;
bNumEP++; bNumEP++;
return;
} }
void BTD::PrintEndpointDescriptor(const USB_ENDPOINT_DESCRIPTOR* ep_ptr) { void BTD::PrintEndpointDescriptor(const USB_ENDPOINT_DESCRIPTOR* ep_ptr) {
Notify(PSTR("\r\nEndpoint descriptor:")); Notify(PSTR("\r\nEndpoint descriptor:"));
@ -914,7 +913,6 @@ void BTD::setBdaddr(uint8_t* BDADDR) {
} }
PrintHex<uint8_t>(my_bdaddr[0]); PrintHex<uint8_t>(my_bdaddr[0]);
#endif #endif
return;
} }
void BTD::setMoveBdaddr(uint8_t* BDADDR) { void BTD::setMoveBdaddr(uint8_t* BDADDR) {
/* Set the internal bluetooth address */ /* Set the internal bluetooth address */
@ -939,5 +937,4 @@ void BTD::setMoveBdaddr(uint8_t* BDADDR) {
} }
PrintHex<uint8_t>(my_bdaddr[0]); PrintHex<uint8_t>(my_bdaddr[0]);
#endif #endif
return;
} }

12
SPP.cpp
View file

@ -243,15 +243,14 @@ void SPP::ACLData(uint8_t* l2capinbuf) {
} }
if(connected) { if(connected) {
/* Read the incoming message */ /* Read the incoming message */
if(rfcommChannelType != RFCOMM_UIH || rfcommChannel != rfcommChannelConnection) if(rfcommChannelType == RFCOMM_UIH && rfcommChannel == rfcommChannelConnection) {
return;
uint8_t length = l2capinbuf[10] >> 1; // Get length uint8_t length = l2capinbuf[10] >> 1; // Get length
if(rfcommAvailable + length > 256) if(rfcommAvailable + length <= 256) { // Don't add data to buffer if it would be full
return; // Return if the buffer would be full
uint8_t offset = l2capinbuf[4]-length-4; // See if there is credit 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++)
rfcommDataBuffer[rfcommAvailable+i] = l2capinbuf[11+i+offset]; rfcommDataBuffer[rfcommAvailable+i] = l2capinbuf[11+i+offset];
rfcommAvailable += length; rfcommAvailable += length;
}
#ifdef EXTRADEBUG #ifdef EXTRADEBUG
Notify(PSTR("\r\nRFCOMM Data Available: ")); Notify(PSTR("\r\nRFCOMM Data Available: "));
Serial.print(rfcommAvailable); Serial.print(rfcommAvailable);
@ -260,13 +259,14 @@ 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) if(rfcommChannelType == RFCOMM_UIH && rfcommChannel == rfcommChannelConnection) {
return;
uint8_t length = l2capinbuf[10] >> 1; // Get length uint8_t length = l2capinbuf[10] >> 1; // Get length
uint8_t offset = l2capinbuf[4]-length-4; // See if there is credit 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