System information

Appendix D. JAVA Example Code
D-13
static void ParsePublicTbl()
{
try
{
int logger_resp = in_packet.read_byte();
if(logger_resp == 0)
{
System.out.print("Values from table public: ");
while(in_packet.whats_left() >= 4)
{
System.out.print(in_packet.read_float());
if(in_packet.whats_left() >= 4)
System.out.print(" ");
}
System.out.println("");
}
else
System.out.println("ParsePublicTbl logger error: " +
logger_resp);
}
catch(Exception e)
{ System.out.println("ParsePublicTbl error: " + e.toString()); }
} // ParsePublicTbl
static void ParseDataCollectResp()
{
try
{
int logger_resp = in_packet.read_byte();
if(logger_resp == 0)
{
int last_record_no = 0xffffffff;
TableDef table = null;
while(in_packet.whats_left() > 2)
{
// read and search for the table number
int table_no = in_packet.read_short();
for(int i = 0; table == null && i < table_defs.size(); ++i)
{
table = (TableDef)table_defs.elementAt(i);
if(table.table_no == table_no)
break;
else
table = null;
}
if(table != null)
last_record_no = table.print_records(in_packet);
else
{
System.out.println("ParseDataCollectResp table not
found");
break;
}
}
// we need to look at the expect more flag in the message
// to determine if there are more
// records that need to be collected.
if(in_packet.whats_left() >= 1 &&
in_packet.read_byte() != 0 &&
last_record_no != 0xffffffff &&