コード例 #1
0
/****************************************************************************
NAME	
    connectionHandleReadRemoteSupportedFeaturesRequest

DESCRIPTION
    Request to read the supported features of a remote device.

RETURNS
    void
*/
void connectionHandleReadRemoteSupportedFeaturesRequest(connectionReadInfoState *state, const CL_INTERNAL_DM_READ_REMOTE_SUPP_FEAT_REQ_T *req)
{
	/* Check the resource lock */
	if (!state->stateInfoLock)
	{
		bdaddr addr;

		/* Check we got a valid addr */
		if (!SinkGetBdAddr(req->sink, &addr))
		{
			/* Send an error to the app as it didn't pass in a valid sink */
			sendRemoteSupportedFeaturesCfm(req->theAppTask, hci_error_no_connection, 0, req->sink);		
		}
		else
		{
			/* Response not outstanding so issue request */
			MAKE_PRIM_C(DM_HCI_READ_REMOTE_FEATURES);
			connectionConvertBdaddr_t(&prim->bd_addr, &addr);
			VmSendDmPrim(prim);

			/* Set the lock */
			state->stateInfoLock = req->theAppTask;
			state->sink = req->sink;
		}		
	}
	else
	{
		/* Lock set so queue up the request */
		MAKE_CL_MESSAGE(CL_INTERNAL_DM_READ_REMOTE_SUPP_FEAT_REQ);
		COPY_CL_MESSAGE(req, message);
		MessageSendConditionallyOnTask(connectionGetCmTask(), CL_INTERNAL_DM_READ_REMOTE_SUPP_FEAT_REQ, message, &state->stateInfoLock);
	}
}
コード例 #2
0
/****************************************************************************
NAME	
    connectionHandleDmHciModeChangeEvent

DESCRIPTION
    An indication from BlueStack that an ACL has been opened. Some clients
	may need this information so pass the indication up to the task 
	registered as the "app task" (we don't know who else to pass this to!).

RETURNS
    void
*/
void connectionHandleDmHciModeChangeEvent(Task task, const DM_HCI_MODE_CHANGE_EVENT_T *ev)
{
    const msg_filter *msgFilter = connectionGetMsgFilter();
	if (task && (msgFilter[0] & msg_group_mode_change)) 
    {
		/* Check mode change was successful */
		if ((ev->status == HCI_SUCCESS) && ((ev->mode == HCI_BT_MODE_ACTIVE) || (ev->mode == HCI_BT_MODE_SNIFF)))
		{
			MAKE_CL_MESSAGE(CL_DM_MODE_CHANGE_EVENT);
			connectionConvertBdaddr(&message->bd_addr, &ev->bd_addr);

			/* Convert HCI mode into connection library power mode */
			switch (ev->mode)
			{
				case HCI_BT_MODE_ACTIVE:
					message->mode = lp_active;
					break;
				case HCI_BT_MODE_SNIFF:
					message->mode = lp_sniff;
					break;
				default:
					Panic();
					break;
			}
			message->interval = ev->length;
			MessageSend(task, CL_DM_MODE_CHANGE_EVENT, message);
		}
    }
}
コード例 #3
0
void ConnectionReadClassOfDevice(Task theAppTask)
{
    /* Create internal message and sent to the CL */
    MAKE_CL_MESSAGE(CL_INTERNAL_DM_READ_CLASS_OF_DEVICE_REQ);
    message->theAppTask = theAppTask;
    MessageSend(connectionGetCmTask(), CL_INTERNAL_DM_READ_CLASS_OF_DEVICE_REQ, message);
}
void ConnectionSmSendKeypressNotificationRequest(const bdaddr* bd_addr, cl_sm_keypress_type type)
{
	MAKE_CL_MESSAGE(CL_INTERNAL_SM_SEND_KEYPRESS_NOTIFICATION_REQ);
	message->bd_addr = *bd_addr;
	message->type = type;
	MessageSend(connectionGetCmTask(), CL_INTERNAL_SM_SEND_KEYPRESS_NOTIFICATION_REQ, message);
}
コード例 #5
0
void ConnectionWriteClassOfDevice(uint32 cod)
{
    /* All requests are sent through the internal state handler */
    MAKE_CL_MESSAGE(CL_INTERNAL_DM_WRITE_CLASS_OF_DEVICE_REQ);
    message->class_of_device = cod;
    MessageSend(connectionGetCmTask(), CL_INTERNAL_DM_WRITE_CLASS_OF_DEVICE_REQ, message);
}
コード例 #6
0
void ConnectionSmUnRegisterOutgoingService(const bdaddr* bd_addr, dm_protocol_id protocol_id, uint32 channel)
{
#ifdef CONNECTION_DEBUG_LIB
    if ((protocol_id != protocol_l2cap) && (protocol_id != protocol_rfcomm))
    {
        CL_DEBUG(("Out of range protocol id 0x%x\n", protocol_id));
    }

    /* TODO: Check if we should check channel range for outgoing service channel */
    if((protocol_id == protocol_rfcomm) &&
            ((channel < RFCOMM_SERVER_CHANNEL_MIN) ||
                    (channel > RFCOMM_SERVER_CHANNEL_MAX))
        )
    {
        CL_DEBUG(("Out of range RFCOMM server channel 0x%lx\n", channel));
    }

    if(bd_addr == NULL)
    {
       CL_DEBUG(("Out of range Bluetooth Address 0x%p\n", (void*)bd_addr)); 
    }
#endif

    {
        MAKE_CL_MESSAGE(CL_INTERNAL_SM_UNREGISTER_OUTGOING_REQ);
        message->bd_addr = *bd_addr;
        message->protocol_id = protocol_id;
        message->channel = channel;
        MessageSend(connectionGetCmTask(), CL_INTERNAL_SM_UNREGISTER_OUTGOING_REQ, message);
    }
}
コード例 #7
0
ファイル: rfc.c プロジェクト: stephen-kun/koovox_adk4.0
void ConnectionRfcommDeallocateChannel(Task theAppTask, uint8 local_server_channel)
{
    MAKE_CL_MESSAGE(CL_INTERNAL_RFCOMM_UNREGISTER_REQ);
    message->theAppTask = theAppTask;
    message->local_server_channel = local_server_channel;
    MessageSend(connectionGetCmTask(), CL_INTERNAL_RFCOMM_UNREGISTER_REQ, message);
}
コード例 #8
0
ファイル: rfc.c プロジェクト: stephen-kun/koovox_adk4.0
void ConnectionRfcommDisconnectResponse(Sink sink)
{
	/* Send an internal message */
	MAKE_CL_MESSAGE(CL_INTERNAL_RFCOMM_DISCONNECT_RSP);
    message->sink = sink;
	MessageSend(connectionGetCmTask(), CL_INTERNAL_RFCOMM_DISCONNECT_RSP, message);
}
コード例 #9
0
void ConnectionClearParameterCache(const bdaddr *addr)
{
    /* Send an internal message requesting this action */
    MAKE_CL_MESSAGE(CL_INTERNAL_DM_CLEAR_PARAM_CACHE_REQ);
    message->bd_addr = *addr;
    MessageSend(connectionGetCmTask(), CL_INTERNAL_DM_CLEAR_PARAM_CACHE_REQ, message);
}
コード例 #10
0
void ConnectionSmRegisterIncomingService(dm_protocol_id protocol_id, uint32 channel, dm_security_in security)
{
    /* Check params are within allowed values - debug build only */
#ifdef CONNECTION_DEBUG_LIB
    if ((protocol_id != protocol_l2cap) && (protocol_id != protocol_rfcomm))
    {
        CL_DEBUG(("Out of range protocol id 0x%x\n", protocol_id));
    }

    if((protocol_id == protocol_rfcomm) && ((channel < RFCOMM_SERVER_CHANNEL_MIN) || (channel > RFCOMM_SERVER_CHANNEL_MAX)))
    {
        CL_DEBUG(("Out of range RFCOMM server channel 0x%lx\n", channel));
    }

    /* Are any bits other then valid dm_security_in bits are set. */
    if (security & ~sec_in_bitmask)
    {
        CL_DEBUG(("Invalid dm_security_in bits set 0x%x\n", (security & ~sec_in_bitmask)));
    }
    
#endif

    {
    MAKE_CL_MESSAGE(CL_INTERNAL_SM_REGISTER_REQ);
    message->protocol_id = protocol_id;
    message->channel = channel;
    message->outgoing_ok = FALSE;   
    message->security_level = security;
    message->psm = 0;
    MessageSend(connectionGetCmTask(), CL_INTERNAL_SM_REGISTER_REQ, message);
    }
}
コード例 #11
0
void ConnectionSyncRegister(Task theAppTask)
{
	/* Send an internal register request message */
	MAKE_CL_MESSAGE(CL_INTERNAL_SYNC_REGISTER_REQ);
	message->theAppTask = theAppTask;
	MessageSend(connectionGetCmTask(), CL_INTERNAL_SYNC_REGISTER_REQ, message);
}
コード例 #12
0
void ConnectionReadRemoteSuppFeatures(Task theAppTask, Sink sink)
{
	/* All requests are sent through the internal state handler */    
	MAKE_CL_MESSAGE(CL_INTERNAL_DM_READ_REMOTE_SUPP_FEAT_REQ);
	message->theAppTask = theAppTask;
	message->sink = sink;
	MessageSend(connectionGetCmTask(), CL_INTERNAL_DM_READ_REMOTE_SUPP_FEAT_REQ, message);
}
コード例 #13
0
void ConnectionReadRemoteVersion(Task theAppTask, Sink sink)
{
    /* All requests are sent through the internal state handler */
    MAKE_CL_MESSAGE(CL_INTERNAL_DM_READ_REMOTE_VERSION_REQ);
    message->theAppTask = theAppTask;
    message->sink = sink;
    MessageSendConditionallyOnTask(connectionGetCmTask(), CL_INTERNAL_DM_READ_REMOTE_VERSION_REQ, message, &theCm.infoState.stateInfoLock);
}
コード例 #14
0
ファイル: l2cap.c プロジェクト: stephen-kun/csr8670
void ConnectionL2capDisconnectResponse(uint8 identifier, Sink sink)
{
	/* Send an internal message */
	MAKE_CL_MESSAGE(CL_INTERNAL_L2CAP_DISCONNECT_RSP);
    message->identifier = identifier;
	message->sink = sink;
	MessageSend(connectionGetCmTask(), CL_INTERNAL_L2CAP_DISCONNECT_RSP, message);
}
コード例 #15
0
void ConnectionL2capUnregisterRequest(Task appTask, uint16 psm)
{
    /* Send an internal message */
    MAKE_CL_MESSAGE(CL_INTERNAL_L2CAP_UNREGISTER_REQ);
    message->theAppTask = appTask;
    message->app_psm = psm;
    MessageSend(connectionGetCmTask(), CL_INTERNAL_L2CAP_UNREGISTER_REQ, message);
}
コード例 #16
0
ファイル: l2cap.c プロジェクト: stephen-kun/csr8670
void ConnectionL2capDisconnectRequest(Task appTask, Sink sink)
{
	/* Send an internal message */
	MAKE_CL_MESSAGE(CL_INTERNAL_L2CAP_DISCONNECT_REQ);
	message->theAppTask = appTask;	
	message->sink = sink;
	MessageSend(connectionGetCmTask(), CL_INTERNAL_L2CAP_DISCONNECT_REQ, message);
}
コード例 #17
0
ファイル: dm_link_policy.c プロジェクト: stephen-kun/csr8670
void ConnectionSetLinkPolicy(Sink sink, uint16 size_power_table, lp_power_table const *power_table)
{
    MAKE_CL_MESSAGE(CL_INTERNAL_DM_SET_LINK_POLICY_REQ);
    message->sink = sink;
    message->size_power_table = size_power_table;
    message->power_table = power_table;
    MessageSend(connectionGetCmTask(), CL_INTERNAL_DM_SET_LINK_POLICY_REQ, message);
}
コード例 #18
0
void ConnectionSmSetTrustLevel(const bdaddr* bd_addr, uint16 trusted)
{
    /* Update the Trusted Device List */
    MAKE_CL_MESSAGE(CL_INTERNAL_SM_SET_TRUST_LEVEL_REQ)
	message->bd_addr = *bd_addr;
	message->trusted = trusted;
	MessageSend(connectionGetCmTask(), CL_INTERNAL_SM_SET_TRUST_LEVEL_REQ, message);
}
コード例 #19
0
void ConnectionUnregisterServiceRecord(Task appTask, uint32 service_record_hdl)
{
	/* Create an internal message and send it to the state machine */
	MAKE_CL_MESSAGE(CL_INTERNAL_SDP_UNREGISTER_RECORD_REQ);
	message->theAppTask = appTask;
	message->service_handle = service_record_hdl;
	MessageSend(connectionGetCmTask(), CL_INTERNAL_SDP_UNREGISTER_RECORD_REQ, message);
}
コード例 #20
0
void ConnectionWriteCachedClockOffset(const bdaddr *addr, uint16 clk_offset)
{
    /* Send an internal message requesting this action */
    MAKE_CL_MESSAGE(CL_INTERNAL_DM_WRITE_CACHED_CLK_OFFSET_REQ);
    message->bd_addr = *addr;
    message->clock_offset = clk_offset;
    MessageSend(connectionGetCmTask(), CL_INTERNAL_DM_WRITE_CACHED_CLK_OFFSET_REQ, message);
}
コード例 #21
0
void ConnectionReadBtVersion(Task theAppTask)
{
     /* All requests are sent through the internal state handler */    
	MAKE_CL_MESSAGE(CL_INTERNAL_DM_SET_BT_VERSION_REQ);
	message->theAppTask = theAppTask;
	message->version = BT_VERSION_CURRENT;
	MessageSendConditionallyOnTask(connectionGetCmTask(), CL_INTERNAL_DM_SET_BT_VERSION_REQ, message, &theCm.infoState.stateInfoLock);
}
コード例 #22
0
void ConnectionSyncDisconnect(Sink sink, hci_status reason)
{
    /* Send an internal Synchronous disconnect request */
    MAKE_CL_MESSAGE(CL_INTERNAL_SYNC_DISCONNECT_REQ);
    message->audio_sink = sink;
    message->reason = reason;
    MessageSend(connectionGetCmTask(), CL_INTERNAL_SYNC_DISCONNECT_REQ, message);
}
コード例 #23
0
void ConnectionSmUserPasskeyResponse(const bdaddr* bd_addr, bool cancelled, uint32 passkey)
{
	MAKE_CL_MESSAGE(CL_INTERNAL_SM_USER_PASSKEY_REQUEST_RES);
	message->bd_addr = *bd_addr;
	message->cancelled = cancelled;
	message->numeric_value = passkey;
	MessageSend(connectionGetCmTask(), CL_INTERNAL_SM_USER_PASSKEY_REQUEST_RES, message);
}
コード例 #24
0
void ConnectionGetLinkQuality(Task theAppTask, Sink sink)
{
	/* All requests are sent through the internal state handler */    
	MAKE_CL_MESSAGE(CL_INTERNAL_DM_READ_LINK_QUALITY_REQ);
	message->theAppTask = theAppTask;
	message->sink = sink;
	MessageSend(connectionGetCmTask(), CL_INTERNAL_DM_READ_LINK_QUALITY_REQ, message);
}
コード例 #25
0
static void sendRfcommConnectInd(Task dest, const bdaddr *bd_addr, uint8 channel, uint16 frame_size)
{
    MAKE_CL_MESSAGE(CL_RFCOMM_CONNECT_IND);
    message->bd_addr = *bd_addr;
    message->server_channel = channel;
    message->frame_size = frame_size;
    MessageSend(dest, CL_RFCOMM_CONNECT_IND, message);
}
コード例 #26
0
/****************************************************************************
NAME	
	sendSdpCloseSearchCfm

DESCRIPTION
	Issue a confirm message to the task that requested the search be closed

RETURNS
	void	
*/
static void sendSdpCloseSearchCfm(Task appTask, sdp_close_status cfm_result)
{
    if (appTask)
    {
        MAKE_CL_MESSAGE(CL_SDP_CLOSE_SEARCH_CFM);
        message->status = cfm_result;
        MessageSend(appTask, CL_SDP_CLOSE_SEARCH_CFM, message);
    }
}
コード例 #27
0
void ConnectionGetRssiBdaddr(Task theAppTask, const tp_bdaddr *tpaddr)
{
    /* All requests are sent through the internal state handler */
    MAKE_CL_MESSAGE(CL_INTERNAL_DM_READ_RSSI_REQ);
    message->theAppTask = theAppTask;
    message->sink = NULL; /* make sink to null to use tpaddr instead */
    message->tpaddr = *tpaddr;
    MessageSend(connectionGetCmTask(), CL_INTERNAL_DM_READ_RSSI_REQ, message);
}
コード例 #28
0
void ConnectionGetRssi(Task theAppTask, Sink sink)
{
    /* All requests are sent through the internal state handler */
    MAKE_CL_MESSAGE(CL_INTERNAL_DM_READ_RSSI_REQ);
    message->theAppTask = theAppTask;
    message->sink = sink;
    /* message->tpaddr does not need to be set. */
    MessageSend(connectionGetCmTask(), CL_INTERNAL_DM_READ_RSSI_REQ, message);
}
コード例 #29
0
void ConnectionWriteCachedPageMode(const bdaddr *addr, page_scan_mode ps_mode, page_scan_rep_mode ps_rep_mode)
{
    /* Send an internal message requesting this action */
    MAKE_CL_MESSAGE(CL_INTERNAL_DM_WRITE_CACHED_PAGE_MODE_REQ);
    message->bd_addr = *addr;
    message->ps_mode = ps_mode;
    message->ps_rep_mode = ps_rep_mode;
    MessageSend(connectionGetCmTask(), CL_INTERNAL_DM_WRITE_CACHED_PAGE_MODE_REQ, message);
}
コード例 #30
0
ファイル: l2cap.c プロジェクト: stephen-kun/csr8670
void ConnectionL2capRegisterRequest(Task clientTask, uint16 psm, uint16 flags)
{
    MAKE_CL_MESSAGE(CL_INTERNAL_L2CAP_REGISTER_REQ);
    message->clientTask = clientTask;
	message->app_psm = psm;
    message->flags = flags;
    MessageSend(connectionGetCmTask(), CL_INTERNAL_L2CAP_REGISTER_REQ, message);

}