Getting Started with ADSP-BF537 EZ-KIT Lite
3-19
Controlling a real-time application via TCP/IP
Listing 3-1.
Caesar_Cipher_ThreadType::Run() New
Implementation
void
Caesar_Cipher_ThreadType::Run()
{
static char *pszWelcome = "Welcome to Blackfin. Press \"+\" and
\"-\" to change volume level.\xa\xd";
if ( 0 >= send ( m_iSocket, pszWelcome, strlen ( pszWelcome ),
0 ))
return;
float volume = 48.0;
VDK::MessageID msg = VDK::CreateMessage ( VOL_CHANGE, volume,
NULL );
while (1)
{
int iCount;
if ( ( iCount = recv ( m_iSocket, m_vInBuf, sizeof (
m_vInBuf ) / sizeof ( char ), 0 ) ) >= 1 )
{
int iCharNum;
char c;
for ( iCharNum = 0; iCharNum < iCount; ++iCharNum )
{
c = m_vInBuf [ iCharNum ];
if ( c == '+' || c == '-' )
{
if ( c == '+' )
= 1.0;
else
volume -= 1.0;
/* Volume must in a range from 0.0 to 48.0 */
www.BDTIC.com/ADI