Fixed printReport()

This commit is contained in:
Kristian Lauszus 2012-07-27 00:21:26 +02:00
parent 2d4548e310
commit 2dc6583f06

View file

@ -1030,9 +1030,8 @@ void RFCOMM::readReport() {
return; // Return if the buffer would be full return; // Return if the buffer would be full
uint8_t offset; uint8_t offset;
if(l2capinbuf[4] == length+4) { if(l2capinbuf[4] == length+4)
offset = 0; offset = 0;
}
else else
offset = 1; // There must be credit offset = 1; // There must be credit
@ -1047,10 +1046,15 @@ void RFCOMM::readReport() {
void RFCOMM::printReport() { //Uncomment "#define PRINTREPORT" to print the report send to the Arduino void RFCOMM::printReport() { //Uncomment "#define PRINTREPORT" to print the report send to the Arduino
if(rfcommChannelType == RFCOMM_UIH) { if(rfcommChannelType == RFCOMM_UIH) {
uint8_t length = l2capinbuf[10] >> 1; // Get length uint8_t length = l2capinbuf[10] >> 1; // Get length
uint8_t message[length]; // Create buffer
uint8_t offset;
if(l2capinbuf[4] == length+4)
offset = 0;
else
offset = 1; // There must be credit
for(uint8_t i = 0; i < length; i++) for(uint8_t i = 0; i < length; i++)
message[i] = l2capinbuf[i+11]; Serial.write(l2capinbuf[i+11+offset]);
Serial.write(message,length); // Print text
} }
} }