System information
Appendix D. JAVA Example Code
D-7
send_byte((byte)0xBD); // first synch byte
for(int i = 0; i < frame.length; ++i)
{
if(frame[i] == 0xBC || frame[i] == 0xBD)
{
send_byte((byte)0xBC);
send_byte((byte)(frame[i] + 0x20));
}
else
send_byte(frame[i]);
}
send_byte((byte)0xBD);
out_stream.flush();
}
catch(IOException e)
{
System.out.println("SendPb(): " + e);
}
}
/**
* GetPublicValues will create the packet to get the Public table,
* it will use the get value command and just get a swath.
*/
public static void GetPublicValue()
{
CreateHeader();
out_packet.message_type = 0x1a;
out_packet.tran_no = 0x1a;
out_packet.add_short((short)0); //security code
out_packet.add_string("Public");
out_packet.add_byte(TableDef.type_ieee4); // type code
out_packet.add_string("SaveSite");
out_packet.add_short((short)16);
}
public static void GetTableDef()
{
table_defs_buffer = null;
file_offset = 0;
CreateTableDef();
SendPb();
}
/**
* CreateTableDef will create the packet to get the TableDef,
* assuming that it is the first table in the DL.
*/
public static void CreateTableDef()
{
CreateHeader();
out_packet.message_type = 0x1d;
out_packet.tran_no = 0x1d;
out_packet.add_short((short)0); // security code
out_packet.add_string("CPU:Def.tdf");
out_packet.add_byte((byte)0);
out_packet.add_int(file_offset);
out_packet.add_short((short)128);
}