/**************************************************************************** NAME avrcpHandleInternalConnectRes DESCRIPTION This function handles an internally generated connect response message. */ void avrcpHandleInternalL2capConnectRes(AVRCP *avrcp, const AVRCP_INTERNAL_CONNECT_RES_T *res) { /* Send the response to the connection lib */ ConnectionL2capConnectResponse(&avrcp->task, res->accept, AVCTP_PSM, res->connection_id, 0); /* If the connection has been rejected reset the local state to ready */ if (!res->accept) { if (avrcp->lazy) MessageSend(&avrcp->task, AVRCP_INTERNAL_TASK_DELETE_REQ, 0); else avrcpSetState(avrcp, avrcpReady); } }
void ConnectionL2capConnectResponseTestExtraConftab( Task theAppTask, uint16 task, bool response, uint16 psm, uint16 cid, uint8 identifier, uint16 size_conftab, uint8 *conftab ) { if (size_conftab) { /* copy the conftab data to a slot */ uint16* dyn_conftab = malloc(sizeof(uint16)* (size_conftab/2)); uint16 it; for(it=0; it<size_conftab/2; it++) { dyn_conftab[it] = *conftab++ << 8; dyn_conftab[it] |= *conftab++; } ConnectionL2capConnectResponse( (Task)task, response, psm, cid, identifier, (size_conftab/2), dyn_conftab); } else { ConnectionL2capConnectResponse( (Task)task, response, psm, cid, identifier, 0, 0); } }
void a2dpHandleL2capConnectInd(A2DP *a2dp, const CL_L2CAP_CONNECT_IND_T *ind) { bool accept = FALSE; if(ind->psm == AVDTP_PSM) { if (a2dp->signal_conn.connection_state == avdtp_connection_connected) { /* Must be the media channel, always accept this immediately as long as not already in the process of connecting it */ if (!a2dp->media_conn.media_connecting) { a2dp->media_conn.media_connecting = 1; accept = TRUE; } else { accept = FALSE; } } else { if ((a2dp->signal_conn.connection_state != avdtp_connection_idle) && (a2dp->signal_conn.connection_state != avdtp_connection_connecting)) { accept = FALSE; } else { if (a2dp->signal_conn.connection_state == avdtp_connection_connecting) a2dpSetSignallingConnectionState(a2dp, avdtp_connection_connecting_crossover); else a2dpSetSignallingConnectionState(a2dp, avdtp_connection_connecting); a2dp->signal_conn.waiting_response++; /* This must be the signalling channel, so the app must decide if to accept this connection */ a2dpSendSignallingConnectInd(a2dp, ind->connection_id, ind->bd_addr); return; } } } /* Send the connect response to the connection lib */ ConnectionL2capConnectResponse(&a2dp->task, accept, ind->psm, ind->connection_id, NULL); }
void ConnectionL2capConnectResponseTestExtraDefault( Task theAppTask, uint16 task, bool response, uint16 psm, uint16 cid, uint8 identifier ) { ConnectionL2capConnectResponse( (Task) task, response, psm, cid, identifier, 0, 0 ); }