beautypg.com

Philips Bluetooth QuickStart Kit User Manual

Page 42

background image

Bluetooth QuickStart Kit Version 1.0 - User’s Guide

Page 42

Copyright 2004-2005 © Embedded Artists AB

This function allocates a new control block. Returns NULL if there are no more control
blocks available.

Returns:

An allocated TCB or NULL if none available.

B.2.13 udpBind

tS8 udpBind( tUdpTcb* pTcb, tIPAddr* pIPAddr, tU16 port )

Bind a TCB to a port.

Parameters:

[in] pTcb - an allocated TCB that will be bound to a specific port.

[in] pIPAddr – the IP address to bind to. This parameter may be set to NULL if the
TCB should be bound to all interfaces.

[in] port - the port number to use or 0 (zero) if the stack should choose a port
number.

Returns:

One of the following error codes:

Possible error situations (what can be identified in an error code):

UDP_OK - no errors

UDP_NULL_POINTER - parameter pTcb was NULL.

UDP_PORT_IN_USE - port number is already assigned to a connection.

B.2.14 udpReceive

void udpReceive( tUdpTcb* pTcb, void (*pRecv)(tUdpTcb* pTcb,
tBuf* pBuf, tU16 len) )

This function registers a receive callback. The callback will be called whenever there is
data to receive on the connection. Parameters to the callback function are the control
block for the connection, a pointer to the buffer containing the data and length of the
data.

Parameters:

[in] pTcb - a bound control block

[in] pRecv - function pointer to the receive callback.

Parameters to (*pRecv):

[in] pTcb - control block for the connection.

[in] pBuf - pointer to the buffer containing data. A pointer to the actual data can be
retrieved by using the m_buf_get_data macro.

[in] len - length of data in bytes.

B.2.15 udpBufProcessed

void udpBufProcessed( tUdpTcb* pTcb, tBuf* pBuf )