System information

Appendix D. JAVA Example Code
D-11
/**
* This procedure allows the clock to receive the clock from the logger
* and then make the calculations for the difference of the setting time
and the
* dl time.
*/
static void SetClkCnts()
{
switch(setclockcnt)
{
case (1):
sendseconds = (int)((PCtime.getTimeInMillis() -
DLtime.getTimeInMillis()) / msecPerSec);
System.out.println("Sendseconds = " + sendseconds);
GetClock(); // sets clock to new time
SendPb();
setclockcnt = 2;
break;
case (2):
sendseconds = 0;
GetClock(); // checks time
SendPb();
setclockcnt = 0;
break;
}
}
static void ParseCommand()
{
try
{
StringTokenizer settings = new
StringTokenizer(in_packet.read_string(),";");
dest_address = in_packet.src_address;
System.out.println("PakBusAddress = " + dest_address);
while(settings.hasMoreTokens())
{
StringTokenizer setting = new
StringTokenizer(settings.nextToken(),"=");
String name = setting.nextToken();
String value = setting.nextToken();
if(name.equalsIgnoreCase("Model"))
{
Model = value;
System.out.println("Model = " + value);
}
else if(name.equalsIgnoreCase("Version"))
{
Version = value;
System.out.println("version = " + value);
}
}
}
catch(Exception e)
{ System.out.println("ParseCommand error: " + e.toString()); }
}
private static Packet table_defs_buffer;