24 #define SDP_SERVICE_SEARCH_ATTRIBUTE_REQUEST_PDU 0x06 // See the RFCOMM specs
25 #define SDP_SERVICE_SEARCH_ATTRIBUTE_RESPONSE_PDU 0x07 // See the RFCOMM specs
26 #define SERIALPORT_UUID 0x1101 // See http://www.bluetooth.org/Technical/AssignedNumbers/service_discovery.htm
27 #define L2CAP_UUID 0x0100
30 #define RFCOMM_SABM 0x2F
31 #define RFCOMM_UA 0x63
32 #define RFCOMM_UIH 0xEF
34 #define RFCOMM_DISC 0x43
36 #define extendAddress 0x01 // Always 1
39 #define BT_RFCOMM_PN_CMD 0x83
40 #define BT_RFCOMM_PN_RSP 0x81
41 #define BT_RFCOMM_MSC_CMD 0xE3
42 #define BT_RFCOMM_MSC_RSP 0xE1
43 #define BT_RFCOMM_RPN_CMD 0x93
44 #define BT_RFCOMM_RPN_RSP 0x91
69 SPP(
BTD *p,
const char *name =
"Arduino",
const char *pin =
"0000");
110 virtual int peek(
void);
115 virtual int read(
void);
117 #if defined(ARDUINO) && ARDUINO >=100
123 virtual size_t write(uint8_t data);
130 virtual size_t write(
const uint8_t* data,
size_t size);
138 virtual void write(uint8_t data);
144 virtual void write(
const uint8_t* data,
size_t size);
163 bool RFCOMMConnected;
168 uint8_t l2cap_sdp_state;
169 uint8_t l2cap_rfcomm_state;
170 uint32_t l2cap_event_flag;
173 uint8_t rfcommbuf[10];
178 uint8_t rfcomm_scid[2];
179 uint8_t rfcomm_dcid[2];
183 uint8_t rfcommChannel;
184 uint8_t rfcommChannelConnection;
185 uint8_t rfcommDirection;
186 uint8_t rfcommCommandResponse;
187 uint8_t rfcommChannelType;
191 bool waitForLastCommand;
194 uint8_t rfcommDataBuffer[100];
195 uint8_t sppOutputBuffer[100];
197 uint8_t rfcommAvailable;
207 void SDP_Command(uint8_t *data, uint8_t nbytes);
208 void serviceNotSupported(uint8_t transactionIDHigh, uint8_t transactionIDLow);
209 void serialPortResponse1(uint8_t transactionIDHigh, uint8_t transactionIDLow);
210 void serialPortResponse2(uint8_t transactionIDHigh, uint8_t transactionIDLow);
211 void l2capResponse1(uint8_t transactionIDHigh, uint8_t transactionIDLow);
212 void l2capResponse2(uint8_t transactionIDHigh, uint8_t transactionIDLow);
215 void RFCOMM_Command(uint8_t *data, uint8_t nbytes);
216 void sendRfcomm(uint8_t channel, uint8_t direction, uint8_t CR, uint8_t channelType, uint8_t pfBit, uint8_t *data, uint8_t length);
217 void sendRfcommCredit(uint8_t channel, uint8_t direction, uint8_t CR, uint8_t channelType, uint8_t pfBit, uint8_t credit);
218 uint8_t calcFcs(uint8_t *data);
219 bool checkFcs(uint8_t *data, uint8_t fcs);
220 uint8_t crc(uint8_t *data);
virtual size_t write(uint8_t data)
SPP(BTD *p, const char *name="Arduino", const char *pin="0000")
virtual int available(void)
virtual void disconnect()
virtual void ACLData(uint8_t *ACLData)