mirror of
https://github.com/felis/USB_Host_Shield_2.0.git
synced 2024-03-22 11:31:26 +01:00
Added activeConnection, so multiple controller can connect fast without any issues
This commit is contained in:
parent
47ab932c0f
commit
c4563ec7c8
2 changed files with 5 additions and 2 deletions
|
@ -227,6 +227,7 @@ void PS3BT::Reset() {
|
||||||
PS3Connected = false;
|
PS3Connected = false;
|
||||||
PS3MoveConnected = false;
|
PS3MoveConnected = false;
|
||||||
PS3NavigationConnected = false;
|
PS3NavigationConnected = false;
|
||||||
|
activeConnection = false;
|
||||||
l2cap_event_flag = 0; // Reset flags
|
l2cap_event_flag = 0; // Reset flags
|
||||||
l2cap_state = L2CAP_WAIT;
|
l2cap_state = L2CAP_WAIT;
|
||||||
|
|
||||||
|
@ -243,10 +244,11 @@ void PS3BT::disconnect() { // Use this void to disconnect any of the controllers
|
||||||
}
|
}
|
||||||
|
|
||||||
void PS3BT::ACLData(uint8_t* ACLData) {
|
void PS3BT::ACLData(uint8_t* ACLData) {
|
||||||
if(!pBtd->l2capConnectionClaimed && !PS3Connected && !PS3MoveConnected && !PS3NavigationConnected) {
|
if(!pBtd->l2capConnectionClaimed && !PS3Connected && !PS3MoveConnected && !PS3NavigationConnected && !activeConnection && !pBtd->connectToWii && !pBtd->incomingWii && !pBtd->pairWithWii) {
|
||||||
if (ACLData[8] == L2CAP_CMD_CONNECTION_REQUEST) {
|
if (ACLData[8] == L2CAP_CMD_CONNECTION_REQUEST) {
|
||||||
if((ACLData[12] | (ACLData[13] << 8)) == HID_CTRL_PSM) {
|
if((ACLData[12] | (ACLData[13] << 8)) == HID_CTRL_PSM) {
|
||||||
pBtd->l2capConnectionClaimed = true; // Claim that the incoming connection belongs to this service
|
pBtd->l2capConnectionClaimed = true; // Claim that the incoming connection belongs to this service
|
||||||
|
activeConnection = true;
|
||||||
hci_handle = pBtd->hci_handle; // Store the HCI Handle for the connection
|
hci_handle = pBtd->hci_handle; // Store the HCI Handle for the connection
|
||||||
l2cap_state = L2CAP_WAIT;
|
l2cap_state = L2CAP_WAIT;
|
||||||
for(uint8_t i = 0; i < 30; i++)
|
for(uint8_t i = 0; i < 30; i++)
|
||||||
|
|
1
PS3BT.h
1
PS3BT.h
|
@ -113,6 +113,7 @@ private:
|
||||||
/* Variables filled from HCI event management */
|
/* Variables filled from HCI event management */
|
||||||
int16_t hci_handle;
|
int16_t hci_handle;
|
||||||
uint8_t remote_name[30]; // first 30 chars of remote name
|
uint8_t remote_name[30]; // first 30 chars of remote name
|
||||||
|
bool activeConnection; // Used to indicate if it's already has established a connection
|
||||||
|
|
||||||
/* variables used by high level L2CAP task */
|
/* variables used by high level L2CAP task */
|
||||||
uint8_t l2cap_state;
|
uint8_t l2cap_state;
|
||||||
|
|
Loading…
Reference in a new issue