Clear flags after reading them

This commit is contained in:
Kristian Lauszus 2012-10-03 20:14:01 +02:00
parent eceea5e404
commit 155c06b83f

12
SPP.cpp
View file

@ -379,6 +379,7 @@ void SPP::SDP_task() {
{ {
case L2CAP_SDP_WAIT: case L2CAP_SDP_WAIT:
if (l2cap_connection_request_sdp_flag) { if (l2cap_connection_request_sdp_flag) {
l2cap_event_flag &= ~L2CAP_FLAG_CONNECTION_SDP_REQUEST; // Clear flag
#ifdef DEBUG #ifdef DEBUG
Notify(PSTR("\r\nSDP Incoming Connection Request")); Notify(PSTR("\r\nSDP Incoming Connection Request"));
#endif #endif
@ -393,6 +394,7 @@ void SPP::SDP_task() {
break; break;
case L2CAP_SDP_REQUEST: case L2CAP_SDP_REQUEST:
if (l2cap_config_request_sdp_flag) { if (l2cap_config_request_sdp_flag) {
l2cap_event_flag &= ~L2CAP_FLAG_CONFIG_SDP_REQUEST; // Clear flag
#ifdef DEBUG #ifdef DEBUG
Notify(PSTR("\r\nSDP Configuration Request")); Notify(PSTR("\r\nSDP Configuration Request"));
#endif #endif
@ -402,6 +404,7 @@ void SPP::SDP_task() {
break; break;
case L2CAP_SDP_SUCCESS: case L2CAP_SDP_SUCCESS:
if (l2cap_config_success_sdp_flag) { if (l2cap_config_success_sdp_flag) {
l2cap_event_flag &= ~L2CAP_FLAG_CONFIG_SDP_SUCCESS; // Clear flag
#ifdef DEBUG #ifdef DEBUG
Notify(PSTR("\r\nSDP Successfully Configured")); Notify(PSTR("\r\nSDP Successfully Configured"));
#endif #endif
@ -412,12 +415,12 @@ void SPP::SDP_task() {
break; break;
case L2CAP_SDP_DONE: case L2CAP_SDP_DONE:
if(l2cap_disconnect_request_sdp_flag) { if(l2cap_disconnect_request_sdp_flag) {
l2cap_event_flag &= ~L2CAP_FLAG_DISCONNECT_SDP_REQUEST; // Clear flag
SDPConnected = false; SDPConnected = false;
#ifdef DEBUG #ifdef DEBUG
Notify(PSTR("\r\nDisconnected SDP Channel")); Notify(PSTR("\r\nDisconnected SDP Channel"));
#endif #endif
pBtd->l2cap_disconnection_response(hci_handle,identifier,sdp_dcid,sdp_scid); pBtd->l2cap_disconnection_response(hci_handle,identifier,sdp_dcid,sdp_scid);
l2cap_event_flag = 0; // Reset flags
l2cap_sdp_state = L2CAP_SDP_WAIT; l2cap_sdp_state = L2CAP_SDP_WAIT;
} }
break; break;
@ -442,6 +445,7 @@ void SPP::RFCOMM_task()
{ {
case L2CAP_RFCOMM_WAIT: case L2CAP_RFCOMM_WAIT:
if(l2cap_connection_request_rfcomm_flag) { if(l2cap_connection_request_rfcomm_flag) {
l2cap_event_flag &= ~L2CAP_FLAG_CONNECTION_RFCOMM_REQUEST; // Clear flag
#ifdef DEBUG #ifdef DEBUG
Notify(PSTR("\r\nRFCOMM Incoming Connection Request")); Notify(PSTR("\r\nRFCOMM Incoming Connection Request"));
#endif #endif
@ -456,6 +460,7 @@ void SPP::RFCOMM_task()
break; break;
case L2CAP_RFCOMM_REQUEST: case L2CAP_RFCOMM_REQUEST:
if (l2cap_config_request_rfcomm_flag) { if (l2cap_config_request_rfcomm_flag) {
l2cap_event_flag &= ~L2CAP_FLAG_CONFIG_RFCOMM_REQUEST; // Clear flag
#ifdef DEBUG #ifdef DEBUG
Notify(PSTR("\r\nRFCOMM Configuration Request")); Notify(PSTR("\r\nRFCOMM Configuration Request"));
#endif #endif
@ -465,6 +470,7 @@ void SPP::RFCOMM_task()
break; break;
case L2CAP_RFCOMM_SUCCESS: case L2CAP_RFCOMM_SUCCESS:
if (l2cap_config_success_rfcomm_flag) { if (l2cap_config_success_rfcomm_flag) {
l2cap_event_flag &= ~L2CAP_FLAG_CONFIG_RFCOMM_SUCCESS; // Clear flag
#ifdef DEBUG #ifdef DEBUG
Notify(PSTR("\r\nRFCOMM Successfully Configured")); Notify(PSTR("\r\nRFCOMM Successfully Configured"));
#endif #endif
@ -476,13 +482,13 @@ void SPP::RFCOMM_task()
break; break;
case L2CAP_RFCOMM_DONE: case L2CAP_RFCOMM_DONE:
if(l2cap_disconnect_request_rfcomm_flag) { if(l2cap_disconnect_request_rfcomm_flag) {
l2cap_event_flag &= ~L2CAP_FLAG_DISCONNECT_RFCOMM_REQUEST; // Clear flag
RFCOMMConnected = false; RFCOMMConnected = false;
connected = false; connected = false;
#ifdef DEBUG #ifdef DEBUG
Notify(PSTR("\r\nDisconnected RFCOMM Channel")); Notify(PSTR("\r\nDisconnected RFCOMM Channel"));
#endif #endif
pBtd->l2cap_disconnection_response(hci_handle,identifier,rfcomm_dcid,rfcomm_scid); pBtd->l2cap_disconnection_response(hci_handle,identifier,rfcomm_dcid,rfcomm_scid);
l2cap_event_flag = 0; // Reset flags
l2cap_rfcomm_state = L2CAP_RFCOMM_WAIT; l2cap_rfcomm_state = L2CAP_RFCOMM_WAIT;
} }
break; break;