static void sendInternalSppConnectMsg(SPP *spp, const bdaddr *bd_addr, const spp_connect_params *config) { if (config) { /* If frame size is invalid */ if((config->max_frame_size < RFCOMM_MIN_REQ_FRAME_SIZE || config->max_frame_size > RFCOMM_MAX_REQ_FRAME_SIZE) && config->max_frame_size != 0) { /* Message app about connect failure */ sppSendConnectCfmToApp(spp_connect_invalid_frame_size,spp); } else { /* Send connect request using specified params */ MAKE_SPP_MESSAGE(SPP_INTERNAL_CONNECT_REQ); message->addr = *bd_addr; message->rfcomm_channel_number = config->rfcomm_channel_number; if(config->max_frame_size != 0) { message->max_frame_size = config->max_frame_size; } else { message->max_frame_size = RFCOMM_DEFAULT_FRAME_SIZE; } if (config->size_search_pattern) { message->length_service_search_pattern = config->size_search_pattern; message->service_search_pattern = config->search_pattern; } else { message->length_service_search_pattern = 0; message->service_search_pattern = 0; } MessageSend(&spp->task, SPP_INTERNAL_CONNECT_REQ, message); } } else { /* Send connect request using default params */ MAKE_SPP_MESSAGE(SPP_INTERNAL_CONNECT_REQ); message->addr = *bd_addr; message->rfcomm_channel_number = 0; message->length_service_search_pattern = 0; message->service_search_pattern = 0; message->max_frame_size = RFCOMM_DEFAULT_FRAME_SIZE; MessageSend(&spp->task, SPP_INTERNAL_CONNECT_REQ, message); } }
static void sendSppStartServiceCfm(spp_start_status status) { if (sppsClientTask) { MAKE_SPP_MESSAGE(SPP_START_SERVICE_CFM); message->status = status; MessageSend(sppsClientTask, SPP_START_SERVICE_CFM, message); } #if SPP_DEBUG_LIB else SPP_DEBUG(("sppsClientTask is NULL!\n")); #endif }
static void sendSppStopServiceCfm(Task theClientTask, spp_stop_status status) { if (theClientTask) { MAKE_SPP_MESSAGE(SPP_STOP_SERVICE_CFM); message->status = status; MessageSend(theClientTask, SPP_STOP_SERVICE_CFM, message); } #if SPP_DEBUG_LIB else SPP_DEBUG(("theClientTask is NULL!\n")); #endif }
static void sppHandleRfcommConnectInd( CL_RFCOMM_CONNECT_IND_T *ind ) { MAKE_SPP_MESSAGE(SPP_CONNECT_IND); #if SPP_DEBUG_LIB if (!sppsClientTask) SPP_DEBUG(("sppsClientTask is NULL!\n")); #endif message->addr = ind->bd_addr; message->server_channel = ind->server_channel; message->sink = ind->sink; MessageSend(sppsClientTask, SPP_CONNECT_IND, message); }
static void sendInternalSppConnectResponse(SPP *spp, const bdaddr *bd_addr, bool resp, uint16 max_frame_size) { MAKE_SPP_MESSAGE(SPP_INTERNAL_CONNECT_RES); message->addr = *bd_addr; /* If max frame size is invalid */ if((max_frame_size < RFCOMM_MIN_RES_FRAME_SIZE || max_frame_size > RFCOMM_MAX_RES_FRAME_SIZE) && max_frame_size != 0) { /* Reject Request */ message->max_frame_size = 0; message->response = 0; MessageSend(&spp->task, SPP_INTERNAL_CONNECT_RES, message); /* Message app about failure */ { MAKE_SPP_MESSAGE(SPP_INTERNAL_SEND_CFM_TO_APP); message->status = spp_connect_invalid_frame_size; message->spp = spp; MessageSend(&spp->task, SPP_INTERNAL_SEND_CFM_TO_APP, message); } } else { /* Respond to request */ message->response = resp; if(max_frame_size != 0) { message->max_frame_size = max_frame_size; } else { message->max_frame_size = RFCOMM_DEFAULT_FRAME_SIZE; } MessageSend(&spp->task, SPP_INTERNAL_CONNECT_RES, message); } }