Echelon i.LON SmartServer 2.0 User Manual
Page 432

i.LON SmartServer 2.0 Programmer’s Reference
22-27
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 discovering and installing to the
root/LonWorks/import folder on the SmartServer flash disk, or create device templates (XML files) for
the devices.
For more information on discovering uncommissioned L
ON
W
ORKS
devices, see section 14.1.3.2,
Issuing Network Scan Commands to Discover Devices.
package com.echelon.sample.client.ilon;
import javax.xml.ws.Holder;
import com.echelon.wsdl.web_services_ns.ilon100.v4_0.message.ELonString;
import com.echelon.wsdl.web_services_ns.ilon100.v4_0.message.EXSelect;
import com.echelon.wsdl.web_services_ns.ilon100.v4_0.message.InvokeCmdResponse;
import com.echelon.wsdl.web_services_ns.ilon100.v4_0.message.Item;
import com.echelon.wsdl.web_services_ns.ilon100.v4_0.message.ItemCfg;
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.ItemDataColl;
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.message.LONDeviceIlonNiECommand;
import com.echelon.wsdl.web_services_ns.ilon100.v4_0.message.LONNetworkEScanCommand;
import com.echelon.wsdl.web_services_ns.ilon100.v4_0.message.LONNetworkScanCommandInvoke;
import com.echelon.wsdl.web_services_ns.ilon100.v4_0.message.TemplateManagerSurrogateCfg;
import com.echelon.wsdl.web_services_ns.ilon100.v4_0.message.UFPTdataLoggerData;
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_LonNetwork {
/**
* @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
{
//create LONNetworkScanCommandInvoke item and ScanCommand attribute
LONNetworkScanCommandInvoke
networkScan
=
new
LONNetworkScanCommandInvoke();
networkScan.setScanCommand(LONNetworkEScanCommand.SET_SCAN);
//***set
LONNetworkScanCommandInvoke
properties***
//1.
Set
network
UCPTname
networkScan.setUCPTname("Net");
//2.
Set
Scan
Command
//a. set scan frequency (once or continuously)
LONNetworkScanCommandInvoke.Command
scanFrequency
=