beautypg.com

Creating and installing a l, Orks, Device in java -23 – Echelon i.LON SmartServer 2.0 User Manual

Page 428: Creating and installing a lonworks device in java, Device in java

background image

i.LON SmartServer 2.0 Programmer’s Reference

22-23

// print out error and exit

System.out.println("An error occurred:");

for (int j = 0; j

{

System.out.println("Item: " + itemColl.getItem().get(j).getUCPTname() + ",

fault code: " + itemColl.getItem().get(j).getFault().getFaultcode() + ",

fault

string:

"

+

itemColl.getItem().get(j).getFault().getFaultstring());

}

}


else

{

// success

System.out.println("\r\n" + "Write is successful");

for (int j = 0; j

{

System.out.print(((DpData)(itemDataColl.getItem().get(j))).getUCPTname()+ " = ");

System.out.print(((DpData)(itemDataColl.getItem().get(j))).

getUCPTvalue().get(0).getValue()+ "(Value Written)" + "\r\n");

}

}

}

}

catch

(Exception

e)

{

System.out.println(e.getMessage());

}

}

catch (Exception e) {

System.out.println(e.getMessage());

}

finally

{

iLon100

=

null;

SmartServer

=

null;

}

}
}

22.3.3

Creating and Installing a L

ON

W

ORKS

Device in Java

This Java example creates two L

ON

W

ORKS

devices, and then it commissions the devices, starts the

devices’ applications, and gets the devices’ templates (to display the devices’ functional blocks and
data points in the SmartServer Web interface). The example then prints out the names and statuses of
the devices that have been installed. Note that you need to replace the values of the ,
, , and properties provided in this example
with those of the devices you are creating and installing.

You can execute this code after you have setup the Java programming environment as described in
section 22.1, and created the Web service client as described in section 22.2. You must also upload the
device interface (XIF) files of the devices you are creating to the root/LonWorks/import folder on the
SmartServer flash disk.

For more information on the L

ON

W

ORKS

device properties set in this example, see section 14.3.2,

Using the Get Function on a LonWorks Device. For more information on the network management
commands issues in this example, see section 14.3.3.1, Issuing Network Management Commands.

package com.echelon.sample.client.ilon;

import com.echelon.wsdl.web_services_ns.ilon100.v4_0.message.ELonString;
import com.echelon.wsdl.web_services_ns.ilon100.v4_0.message.ItemCfgColl;
import com.echelon.wsdl.web_services_ns.ilon100.v4_0.message.ItemColl;
import com.echelon.wsdl.web_services_ns.ilon100.v4_0.message.LONDeviceCfg;
import com.echelon.wsdl.web_services_ns.ilon100.v4_0.message.LONDeviceECommand;
import com.echelon.wsdl.web_services_ns.ilon100.v4_0.wsdl.ILON100;
import com.echelon.wsdl.web_services_ns.ilon100.v4_0.wsdl.ILON100PortType;

public class Client_LonDevice {