mirror of
https://github.com/felis/USB_Host_Shield_2.0.git
synced 2024-03-22 11:31:26 +01:00
Use pointer instead of buffer
This commit is contained in:
parent
9fe088f39d
commit
7a867e68ed
2 changed files with 7 additions and 10 deletions
10
SPP.cpp
10
SPP.cpp
|
@ -77,18 +77,16 @@ void SPP::disconnect(){
|
||||||
l2cap_event_flag = 0; // Reset flags
|
l2cap_event_flag = 0; // Reset flags
|
||||||
l2cap_sdp_state = L2CAP_DISCONNECT_RESPONSE;
|
l2cap_sdp_state = L2CAP_DISCONNECT_RESPONSE;
|
||||||
}
|
}
|
||||||
void SPP::ACLData(uint8_t* ACLData) {
|
void SPP::ACLData(uint8_t* l2capinbuf) {
|
||||||
if(!pBtd->l2capConnectionClaimed && !connected && !RFCOMMConnected && !SDPConnected) {
|
if(!pBtd->l2capConnectionClaimed && !connected && !RFCOMMConnected && !SDPConnected) {
|
||||||
if (ACLData[8] == L2CAP_CMD_CONNECTION_REQUEST) {
|
if (l2capinbuf[8] == L2CAP_CMD_CONNECTION_REQUEST) {
|
||||||
if(((ACLData[12] | (ACLData[13] << 8)) == SDP_PSM) || ((ACLData[12] | (ACLData[13] << 8)) == RFCOMM_PSM)) {
|
if(((l2capinbuf[12] | (l2capinbuf[13] << 8)) == SDP_PSM) || ((l2capinbuf[12] | (l2capinbuf[13] << 8)) == RFCOMM_PSM)) {
|
||||||
pBtd->claimConnection(); // Claim that the incoming connection belongs to this service
|
pBtd->claimConnection(); // Claim that the incoming connection belongs to this service
|
||||||
hci_handle = pBtd->hci_handle; // Store the HCI Handle for the connection
|
hci_handle = pBtd->hci_handle; // Store the HCI Handle for the connection
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (((ACLData[0] | (ACLData[1] << 8)) == (hci_handle | 0x2000))) { // acl_handle_ok
|
if (((l2capinbuf[0] | (l2capinbuf[1] << 8)) == (hci_handle | 0x2000))) { // acl_handle_ok
|
||||||
for(uint8_t i = 0; i < BULK_MAXPKTSIZE; i++)
|
|
||||||
l2capinbuf[i] = ACLData[i];
|
|
||||||
if ((l2capinbuf[6] | (l2capinbuf[7] << 8)) == 0x0001) { //l2cap_control - Channel ID for ACL-U
|
if ((l2capinbuf[6] | (l2capinbuf[7] << 8)) == 0x0001) { //l2cap_control - Channel ID for ACL-U
|
||||||
if (l2capinbuf[8] == L2CAP_CMD_COMMAND_REJECT) {
|
if (l2capinbuf[8] == L2CAP_CMD_COMMAND_REJECT) {
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
|
|
7
SPP.h
7
SPP.h
|
@ -117,10 +117,10 @@ public:
|
||||||
void println(uint8_t data); // Include newline and carriage return
|
void println(uint8_t data); // Include newline and carriage return
|
||||||
void println(uint8_t* array, uint8_t length); // Include newline and carriage return
|
void println(uint8_t* array, uint8_t length); // Include newline and carriage return
|
||||||
void println(const __FlashStringHelper *); // Include newline and carriage return
|
void println(const __FlashStringHelper *); // Include newline and carriage return
|
||||||
void println(void);
|
void println(void); // Use this to print newline and carriage return
|
||||||
|
|
||||||
void printNumber(uint16_t n);
|
void printNumber(uint16_t n); // These must be used to print numbers
|
||||||
void printNumberln(uint16_t n);
|
void printNumberln(uint16_t n); // This will include newline and carriage return
|
||||||
|
|
||||||
uint8_t available() { return rfcommAvailable; }; // Get the bytes waiting to be read
|
uint8_t available() { return rfcommAvailable; }; // Get the bytes waiting to be read
|
||||||
uint8_t read(); // Used to read the buffer
|
uint8_t read(); // Used to read the buffer
|
||||||
|
@ -141,7 +141,6 @@ private:
|
||||||
uint16_t l2cap_event_flag; // l2cap flags of received bluetooth events
|
uint16_t l2cap_event_flag; // l2cap flags of received bluetooth events
|
||||||
|
|
||||||
uint8_t l2capoutbuf[BULK_MAXPKTSIZE]; // General purpose buffer for l2cap out data
|
uint8_t l2capoutbuf[BULK_MAXPKTSIZE]; // General purpose buffer for l2cap out data
|
||||||
uint8_t l2capinbuf[BULK_MAXPKTSIZE]; // General purpose buffer for l2cap in data
|
|
||||||
uint8_t rfcommbuf[10]; // Buffer for RFCOMM Commands
|
uint8_t rfcommbuf[10]; // Buffer for RFCOMM Commands
|
||||||
|
|
||||||
/* L2CAP Channels */
|
/* L2CAP Channels */
|
||||||
|
|
Loading…
Reference in a new issue