beautypg.com

Echelon i.LON SmartServer 2.0 User Manual

Page 430

background image

i.LON SmartServer 2.0 Programmer’s Reference

22-25


//run device application
LONDeviceCfg.Command setOnline_my_LON_Device1 = new LONDeviceCfg.Command();
setOnline_my_LON_Device1.setUCPTcommand(LONDeviceECommand.CHANGE_APPLICATION_STATUS);

ELonString my_LON_Device1_applicationStatus = new ELonString();
my_LON_Device1_applicationStatus.setLonFormat("UCPTstatus");
my_LON_Device1_applicationStatus.setValue("STATUS_REQUEST");
setOnline_my_LON_Device1.setUCPTstatus(my_LON_Device1_applicationStatus);

my_LON_Device1.getCommand().add(setOnline_my_LON_Device1);

//get the device template to show FBs and DPs in Web UI
LONDeviceCfg.Command getTemplate_my_LON_Device1 = new LONDeviceCfg.Command();
getTemplate_my_LON_Device1.setUCPTcommand(LONDeviceECommand.GET_TEMPLATE);

ELonString my_LON_Device1_templateStatus = new ELonString();
my_LON_Device1_templateStatus.setLonFormat("UCPTstatus");
my_LON_Device1_templateStatus.setValue("STATUS_REQUEST");
getTemplate_my_LON_Device1.setUCPTstatus(my_LON_Device1_templateStatus);

my_LON_Device1.getCommand().add(getTemplate_my_LON_Device1);

//=====CREATING AND INSTALLING LON DEVICE #2==================

// ++++++ specify properties of new LON Device #2++++++
my_LON_Device2.setUCPTname("Net/LON/DIO-2");
my_LON_Device2.setUCPThidden((short)0);
my_LON_Device2.setUCPTurlTemplate ("/root/lonWorks/Import/Echelon/LonPoint/Version3/dio-10v3.XIF");

//set Neuron ID, which is a byte[]
my_LON_Device2.setUCPTuniqueId(hexStringToByteArray("00a145784600"));

//set Program ID, which is a byte[]
my_LON_Device2.setUCPTprogramId(hexStringToByteArray("80000105288a0403"));

//set Commission status
ELonString commissionStatus_LonString_device2 = new ELonString();
commissionStatus_LonString_device2.setValue("COMMISSIONED");
my_LON_Device2.setUCPTcommissionStatus(commissionStatus_LonString);

//set Application status
ELonString applicationStatus_LonString_device2 = new ELonString();
applicationStatus_LonString_device2.setValue("APP_RUNNING");
my_LON_Device2.setUCPTapplicationStatus(applicationStatus_LonString);

//++++send device commands++++++

//commission device
LONDeviceCfg.Command commission_my_LON_Device2 = new LONDeviceCfg.Command();
commission_my_LON_Device2.setUCPTcommand(LONDeviceECommand.CHANGE_COMMISSION_STATUS);

ELonString my_LON_Device2_commissionStatus = new ELonString();
my_LON_Device2_commissionStatus.setLonFormat("UCPTstatus");
my_LON_Device2_commissionStatus.setValue("STATUS_REQUEST");
commission_my_LON_Device2.setUCPTstatus(my_LON_Device2_commissionStatus);

my_LON_Device2.getCommand().add(commission_my_LON_Device2);

//run device application
LONDeviceCfg.Command setOnline_my_LON_Device2 = new LONDeviceCfg.Command();
setOnline_my_LON_Device2.setUCPTcommand(LONDeviceECommand.CHANGE_APPLICATION_STATUS);

ELonString my_LON_Device2_applicationStatus = new ELonString();
my_LON_Device2_applicationStatus.setLonFormat("UCPTstatus");
my_LON_Device2_applicationStatus.setValue("STATUS_REQUEST");
setOnline_my_LON_Device2.setUCPTstatus(my_LON_Device2_applicationStatus);

my_LON_Device2.getCommand().add(setOnline_my_LON_Device2);

//get the device template to show FBs and DPs in Web UI