Echelon i.LON SmartServer Technical Information Page 429

  • Download
  • Add to my manuals
  • Print
  • Page
    / 443
  • Table of contents
  • BOOKMARKS
  • Rated. / 5. Based on customer reviews
Page view 428
i.LON SmartServer 2.0 Programmer’s Reference
22-24
/**
* @param args
*/
public static byte[] hexStringToByteArray(String s) {
int len = s.length();
byte[] data = new byte[len / 2];
for (int i = 0; i < len; i += 2) {
data[i / 2] = (byte) ((Character.digit(s.charAt(i), 16) << 4)
+ Character.digit(s.charAt(i+1), 16));
}
return data;
}
public static void main(String[] args) {
ILON100 iLon100 = null;
ILON100PortType SmartServer = null;
try {
iLon100 = new ILON100();
SmartServer = iLon100.getILON100HttpPort();
try {
// -------------- CREATING LONWORKS DEVICES --------------
//Create a new LON_Device_Cfg Item
LONDeviceCfg my_LON_Device1 = new LONDeviceCfg();
LONDeviceCfg my_LON_Device2 = new LONDeviceCfg();
//Create an ItemCfgColl to store the LON Devices we just created
ItemCfgColl itemCfgColl = new ItemCfgColl();
itemCfgColl.getItem().add(0, my_LON_Device1);
itemCfgColl.getItem().add(1, my_LON_Device2);
//=====CREATING AND INSTALLING LON DEVICE #1==================
// ++++++ specify properties of new LON Device #1++++++
my_LON_Device1.setUCPTname("Net/LON/DIO-1");
my_LON_Device1.setUCPThidden((short)0);
my_LON_Device1.setUCPTurlTemplate ("/root/lonWorks/Import/Echelon/LonPoint/Version3/dio-10v3.XIF");
//set Neuron ID, which is a byte[]
my_LON_Device1.setUCPTuniqueId(hexStringToByteArray("00a145791500"));
//set Program ID, which is a byte[]
my_LON_Device1.setUCPTprogramId(hexStringToByteArray("80000105288a0403"));
//set Commission status
ELonString commissionStatus_LonString = new ELonString();
commissionStatus_LonString.setValue("COMMISSIONED");
my_LON_Device1.setUCPTcommissionStatus(commissionStatus_LonString);
//set Application status
ELonString applicationStatus_LonString = new ELonString();
applicationStatus_LonString.setValue("APP_RUNNING");
my_LON_Device1.setUCPTapplicationStatus(applicationStatus_LonString);
//++++send device commands++++++
//commission device
LONDeviceCfg.Command commission_my_LON_Device1 = new LONDeviceCfg.Command();
commission_my_LON_Device1.setUCPTcommand(LONDeviceECommand.CHANGE_COMMISSION_STATUS);
ELonString my_LON_Device1_commissionStatus = new ELonString();
my_LON_Device1_commissionStatus.setLonFormat("UCPTstatus");
my_LON_Device1_commissionStatus.setValue("STATUS_REQUEST");
commission_my_LON_Device1.setUCPTstatus(my_LON_Device1_commissionStatus);
my_LON_Device1.getCommand().add(commission_my_LON_Device1);
Page view 428
1 2 ... 424 425 426 427 428 429 430 431 432 433 434 ... 442 443

Comments to this Manuals

No comments