Stack applications – Echelon LonTal Stack User Manual

Page 222

Advertising
background image

210

Appendix G: Appendix G


Example LonTalk

Stack Applications

"\n"

" <ipAddress> is the IPv4 dotted-decimal address to use

for the IP-852\n"

" interface\n"

" <port> is a decimal port number to use for the

IP852 interface\n"

"\n"

);

return

1;

}

#else

if

(argc < 2)

{
printf(

"Run a simple LonTalk Device using a standard LonTalk

network interface\n\n"

"Syntax:\n"

" SimpleLtDevice <niName>"

"\n"

" <niName> is the name of the native LonTalk

network interface\n"

"\n"

);

return

1;

}

else

{
SetMyNetworkInterface(argv[1]);
}

#endif

if

(OsalCreateEvent(&eventReadyHandle) == OSALSTS_SUCCESS)

{
OsalHandle taskHandle;
OsalTaskId taskId;
appTaskRunning = TRUE;

if

(OsalCreateTask(appTask, 0

/* Not used */

, 64*1024, 11,

&taskHandle, &taskId) == OSALSTS_SUCCESS)
{

printHelp();
printf(

"> "

);

while

(appTaskRunning)

{

char

c = toupper(getchar());

if

(c ==

'S'

)

{
sendServicPin = TRUE;
printf(

"Sending service pin...\n"

);

OsalSetEvent(eventReadyHandle);
}

else

if

(c ==

'Q'

|| c ==

'E'

)

{
shutdownApp = TRUE;
printf(

"Exiting...\n"

);

OsalSetEvent(eventReadyHandle);

break

;

}

else

if

(c == 0x0a)

{
printf(

"> "

);

;
}

else

{

if

(c !=

'?'

)

{
printf(

"Unrecognized command\n"

);

}
printHelp();
}
}

while

(appTaskRunning)

{

Advertising