beautypg.com

Philips Bluetooth QuickStart Kit User Manual

Page 40

background image

Bluetooth QuickStart Kit Version 1.0 - User’s Guide

Page 40

Copyright 2004-2005 © Embedded Artists AB

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 function.

[in] len - length of data in bytes.

[in] err - TCP_OK, TCP_REMOTE_CLOSE, TCP_ERROR.

B.2.7 tcpBufProcessed

void tcpBufProcessed( tTcpTcb* pTcb, tBuf* pBuf )

This function must be called when received data has been processed. If this function is
not called the received buffer will not be de-allocated and the TCP receive window will
never increase (sliding window protocol), i.e. in the end no more data will be sent to the
receiving host.

NOTE: It is assumed that the data is processed in the same order as it is received.

Parameters:

[in] pTcb - control block for an established connection

[in] pBuf - processed buffer

B.2.8 tcpConnect

void tcpConnect( tTcpTcb* pTcb, tU8* pDestIP, tU16 destPort,
void (*pConn)(tTcpTcb* pTcb, tS8 err) )

This function tries to connect to a remote host. A callback function is register with this
call. When the connect attempt succeeds the callback function will be called.

Parameters:

[in] pTcb - an allocated and bound control block.

[in] pDestIP - destination IP address, e.g. {192, 168, 0, 45}.

[in] destPort - destination port number.

[in] pConn - function pointer to the connect callback. This function will be called
when the connect attempt succeeds. Supplied with this call is a control block for the
established connection and an error code.

Parameters to (*pConn):

[in] pTcb - control block for the connection.

[in] err - error code (TCP_OK or TCP_CONN_REFUSED)

B.2.9 tcpSend

tS8 tcpSend( tTcpTcb* pTcb, tU8* pData, tU32 len )

This function sends data through an established connection. A callback function has to
be registered if the application needs to know when the data has been sent and
acknowledged, i.e. when the sent data can be de-allocated. This callback is registered via
a call to tcpRegSentCallb.