From 7b1f2df2126defff61e33e833e7452c402680874 Mon Sep 17 00:00:00 2001 From: Kristian Lauszus Date: Thu, 26 Jul 2012 21:03:06 +0200 Subject: [PATCH] Now working with Windows --- RFCOMM.cpp | 31 +++++++++++++------------------ examples/RFCOMM/RFCOMM.ino | 4 ++-- 2 files changed, 15 insertions(+), 20 deletions(-) diff --git a/RFCOMM.cpp b/RFCOMM.cpp index 95423105..2fc9aa02 100644 --- a/RFCOMM.cpp +++ b/RFCOMM.cpp @@ -739,7 +739,7 @@ void RFCOMM::ACL_event_task() Serial.print(l2capinbuf[16],HEX); Serial.print(" "); Serial.print(l2capinbuf[17],HEX); - */ + */ if ((l2capinbuf[16] << 8 | l2capinbuf[17]) == SERIALPORT_UUID) { if(firstMessage) { serialPortResponse1(l2capinbuf[9],l2capinbuf[10]); @@ -1371,9 +1371,9 @@ void RFCOMM::serialPortResponse2(uint8_t transactionIDHigh, uint8_t transactionI l2capoutbuf[1] = transactionIDHigh; l2capoutbuf[2] = transactionIDLow; l2capoutbuf[3] = 0x00; // Parameter Length - l2capoutbuf[4] = 0x21; // Parameter Length + l2capoutbuf[4] = 0x1C; // Parameter Length l2capoutbuf[5] = 0x00; // AttributeListsByteCount - l2capoutbuf[6] = 0x1E; // AttributeListsByteCount + l2capoutbuf[6] = 0x19; // AttributeListsByteCount /* Attribute ID/Value Sequence: */ l2capoutbuf[7] = 0x01; @@ -1396,21 +1396,16 @@ void RFCOMM::serialPortResponse2(uint8_t transactionIDHigh, uint8_t transactionI l2capoutbuf[23] = 0x01; l2capoutbuf[24] = 0x00; l2capoutbuf[25] = 0x25; - - l2capoutbuf[26] = 0x0A; // Name length - l2capoutbuf[27] = 'S'; - l2capoutbuf[28] = 'e'; - l2capoutbuf[29] = 'r'; - l2capoutbuf[30] = 'i'; - l2capoutbuf[31] = 'a'; - l2capoutbuf[32] = 'l'; - l2capoutbuf[33] = 'P'; - l2capoutbuf[34] = 'o'; - l2capoutbuf[35] = 'r'; - l2capoutbuf[36] = 't'; - l2capoutbuf[37] = 0x00; - - SDP_Command(l2capoutbuf,38); + + l2capoutbuf[26] = 0x05; // Name length + l2capoutbuf[27] = 'T'; + l2capoutbuf[28] = 'K'; + l2capoutbuf[29] = 'J'; + l2capoutbuf[30] = 'S'; + l2capoutbuf[31] = 'P'; + l2capoutbuf[32] = 0x00; + + SDP_Command(l2capoutbuf,33); } void RFCOMM::l2capResponse1(uint8_t transactionIDHigh, uint8_t transactionIDLow) { serialPortResponse1(transactionIDHigh,transactionIDLow); // These has to send include all the supported functions, since it only support virtual serialport it just sends the message again diff --git a/examples/RFCOMM/RFCOMM.ino b/examples/RFCOMM/RFCOMM.ino index 6a9394d3..1fd72fda 100644 --- a/examples/RFCOMM/RFCOMM.ino +++ b/examples/RFCOMM/RFCOMM.ino @@ -7,8 +7,8 @@ #include USB Usb; /* You can create the instance of the class in two ways */ -RFCOMM SerialBT(&Usb); // This will set the name to the defaults: "Arduino" and the passcode to "1234" -//RFCOMM SerialBT(&Usb, "Lauszus' Arduino","0000"); // You can also set the name and passcode like so +RFCOMM SerialBT(&Usb); // This will set the name to the defaults: "Arduino" and the pin to "1234" +//RFCOMM SerialBT(&Usb, "Lauszus' Arduino","0000"); // You can also set the name and pin like so boolean firstMessage = true;