当前位置: 首页>>代码示例>>Java>>正文


Java ActionResult.getParameter方法代码示例

本文整理汇总了Java中org.dsa.iot.dslink.node.actions.ActionResult.getParameter方法的典型用法代码示例。如果您正苦于以下问题:Java ActionResult.getParameter方法的具体用法?Java ActionResult.getParameter怎么用?Java ActionResult.getParameter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.dsa.iot.dslink.node.actions.ActionResult的用法示例。


在下文中一共展示了ActionResult.getParameter方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: readSerialParameters

import org.dsa.iot.dslink.node.actions.ActionResult; //导入方法依赖的package包/类
void readSerialParameters(ActionResult event) {
	transType = SerialTransportType
			.valueOf(event.getParameter(ATTR_TRANSPORT_TYPE, ValueType.STRING).getString().toUpperCase());

	Value customPort = event.getParameter(ATTR_COMM_PORT_ID_MANUAL);
	if (customPort != null && customPort.getString() != null && customPort.getString().trim().length() > 0) {
		commPortId = customPort.getString();
	} else {
		commPortId = event.getParameter(ATTR_COMM_PORT_ID).getString();
	}
	baudRate = event.getParameter(ATTR_BAUD_RATE, ValueType.NUMBER).getNumber().intValue();
	dataBits = event.getParameter(ATTR_DATA_BITS, ValueType.NUMBER).getNumber().intValue();
	stopBits = event.getParameter(ATTR_STOP_BITS, ValueType.NUMBER).getNumber().intValue();
	parityString = event.getParameter(ATTR_PARITY).getString();
}
 
开发者ID:IOT-DSA,项目名称:dslink-java-modbus,代码行数:16,代码来源:SerialConn.java

示例2: edit

import org.dsa.iot.dslink.node.actions.ActionResult; //导入方法依赖的package包/类
private void edit(ActionResult event) {
	String name = event.getParameter("Name", ValueType.STRING).getString();
	
	if (isSerial) {
		String com;
		Value customPort = event.getParameter("COM Port (manual entry)");
		if (customPort != null && customPort.getString() != null && customPort.getString().trim().length() > 0) {
			com = customPort.getString();
		} else {
			com = event.getParameter("COM Port").getString();
		}
		int baud = event.getParameter("Baud Rate", ValueType.NUMBER).getNumber().intValue();
		int dbits = event.getParameter("Data Bits", ValueType.NUMBER).getNumber().intValue();
		int sbits = event.getParameter("Stop Bits", ValueType.NUMBER).getNumber().intValue();
		int parity = event.getParameter("Parity", ValueType.NUMBER).getNumber().intValue();
	
		node.setAttribute("COM Port", new Value(com));
		node.setAttribute("Baud Rate", new Value(baud));
		node.setAttribute("Data Bits", new Value(dbits));
		node.setAttribute("Stop Bits", new Value(sbits));
		node.setAttribute("Parity", new Value(parity));
	} else {
		String host = event.getParameter("Host", ValueType.STRING).getString();
		int port = event.getParameter("Port", ValueType.NUMBER).getNumber().intValue();
	
		node.setAttribute("Host", new Value(host));
		node.setAttribute("Port", new Value(port));
	}
	
	int maddr = event.getParameter("Master Address", ValueType.NUMBER).getNumber().intValue();
	int oaddr = event.getParameter("Outstation Address", ValueType.NUMBER).getNumber().intValue();
	long interval = (long) (event.getParameter("Event Polling Interval", ValueType.NUMBER).getNumber().doubleValue() * 1000);
	long sinterval = (long) (event.getParameter("Static Polling Interval", ValueType.NUMBER).getNumber().doubleValue() * 1000);
	
	node.setAttribute("Master Address", new Value(maddr));
	node.setAttribute("Outstation Address", new Value(oaddr));
	node.setAttribute("Event Polling Interval", new Value(interval));
	node.setAttribute("Static Polling Interval", new Value(sinterval));
	
	if (!node.getName().equals(name)) {
		rename(name);
	} else {
		stop();
		init();
	}
}
 
开发者ID:IOT-DSA,项目名称:dslink-java-dnp3,代码行数:47,代码来源:DnpOutstation.java

示例3: addOutstation

import org.dsa.iot.dslink.node.actions.ActionResult; //导入方法依赖的package包/类
private void addOutstation(ActionResult event) {
	String name = event.getParameter("Name", ValueType.STRING).getString();
	boolean isSer = (event.getParameter("Host") == null);
	
	Node onode = node.createChild(name).build();
	onode.setAttribute("Is Serial", new Value(isSer));
	
	if (isSer) {
		String com;
		Value customPort = event.getParameter("COM Port (manual entry)");
		if (customPort != null && customPort.getString() != null && customPort.getString().trim().length() > 0) {
			com = customPort.getString();
		} else {
			com = event.getParameter("COM Port").getString();
		}
		int baud = event.getParameter("Baud Rate", ValueType.NUMBER).getNumber().intValue();
		int dbits = event.getParameter("Data Bits", ValueType.NUMBER).getNumber().intValue();
		int sbits = event.getParameter("Stop Bits", ValueType.NUMBER).getNumber().intValue();
		int parity = event.getParameter("Parity", ValueType.NUMBER).getNumber().intValue();
	
		onode.setAttribute("COM Port", new Value(com));
		onode.setAttribute("Baud Rate", new Value(baud));
		onode.setAttribute("Data Bits", new Value(dbits));
		onode.setAttribute("Stop Bits", new Value(sbits));
		onode.setAttribute("Parity", new Value(parity));
	} else {
		String host = event.getParameter("Host", ValueType.STRING).getString();
		int port = event.getParameter("Port", ValueType.NUMBER).getNumber().intValue();
		
		onode.setAttribute("Host", new Value(host));
		onode.setAttribute("Port", new Value(port));
	}
	
	int maddr = event.getParameter("Master Address", ValueType.NUMBER).getNumber().intValue();
	int oaddr = event.getParameter("Outstation Address", ValueType.NUMBER).getNumber().intValue();
	long interval = (long) (event.getParameter("Event Polling Interval", ValueType.NUMBER).getNumber().doubleValue() * 1000);
	long sinterval = (long) (event.getParameter("Static Polling Interval", ValueType.NUMBER).getNumber().doubleValue() * 1000);
	
	onode.setAttribute("Master Address", new Value(maddr));
	onode.setAttribute("Outstation Address", new Value(oaddr));
	onode.setAttribute("Event Polling Interval", new Value(interval));
	onode.setAttribute("Static Polling Interval", new Value(sinterval));
	DnpOutstation os = new DnpOutstation(this, onode);
	os.init();
}
 
开发者ID:IOT-DSA,项目名称:dslink-java-dnp3,代码行数:46,代码来源:DnpLink.java

示例4: handle

import org.dsa.iot.dslink.node.actions.ActionResult; //导入方法依赖的package包/类
public void handle(ActionResult event) {
	String commPortId;
	Value customPort = event.getParameter(SerialConn.ATTR_COMM_PORT_ID_MANUAL);
	if (customPort != null && customPort.getString() != null && customPort.getString().trim().length() > 0) {
		commPortId = customPort.getString();
	} else {
		commPortId = event.getParameter(SerialConn.ATTR_COMM_PORT_ID).getString();
	}
	int baudRate = event.getParameter(SerialConn.ATTR_BAUD_RATE, ValueType.NUMBER).getNumber().intValue();
	int dataBits = event.getParameter(SerialConn.ATTR_DATA_BITS, ValueType.NUMBER).getNumber().intValue();
	int stopBits = event.getParameter(SerialConn.ATTR_STOP_BITS, ValueType.NUMBER).getNumber().intValue();
	String parityString = event.getParameter(SerialConn.ATTR_PARITY).getString();

	String name = event.getParameter(ModbusConnection.ATTR_CONNECTION_NAME, ValueType.STRING).getString();
	String transtype = event.getParameter(ModbusConnection.ATTR_TRANSPORT_TYPE).getString();

	int timeout = event.getParameter(ModbusConnection.ATTR_TIMEOUT, ValueType.NUMBER).getNumber().intValue();
	int retries = event.getParameter(ModbusConnection.ATTR_RETRIES, ValueType.NUMBER).getNumber().intValue();
	int maxrbc = event.getParameter(ModbusConnection.ATTR_MAX_READ_BIT_COUNT, ValueType.NUMBER).getNumber()
			.intValue();
	int maxrrc = event.getParameter(ModbusConnection.ATTR_MAX_READ_REGISTER_COUNT, ValueType.NUMBER).getNumber()
			.intValue();
	int maxwrc = event.getParameter(ModbusConnection.ATTR_MAX_WRITE_REGISTER_COUNT, ValueType.NUMBER)
			.getNumber().intValue();
	int ddd = event.getParameter(ModbusConnection.ATTR_DISCARD_DATA_DELAY, ValueType.NUMBER).getNumber()
			.intValue();
	String mw = event.getParameter(ModbusConnection.ATTR_USE_MULTIPLE_WRITE_COMMAND).getString();

	Node snode = node.createChild(name, true).build();
	snode.setAttribute(ModbusConnection.ATTR_TRANSPORT_TYPE, new Value(transtype));
	snode.setAttribute(SerialConn.ATTR_COMM_PORT_ID, new Value(commPortId));
	snode.setAttribute(SerialConn.ATTR_BAUD_RATE, new Value(baudRate));
	snode.setAttribute(SerialConn.ATTR_DATA_BITS, new Value(dataBits));
	snode.setAttribute(SerialConn.ATTR_STOP_BITS, new Value(stopBits));
	snode.setAttribute(SerialConn.ATTR_PARITY, new Value(parityString));

	snode.setAttribute(ModbusConnection.ATTR_TIMEOUT, new Value(timeout));
	snode.setAttribute(ModbusConnection.ATTR_RETRIES, new Value(retries));
	snode.setAttribute(ModbusConnection.ATTR_MAX_READ_BIT_COUNT, new Value(maxrbc));
	snode.setAttribute(ModbusConnection.ATTR_MAX_READ_REGISTER_COUNT, new Value(maxrrc));
	snode.setAttribute(ModbusConnection.ATTR_MAX_WRITE_REGISTER_COUNT, new Value(maxwrc));
	snode.setAttribute(ModbusConnection.ATTR_DISCARD_DATA_DELAY, new Value(ddd));
	snode.setAttribute(ModbusConnection.ATTR_USE_MULTIPLE_WRITE_COMMAND, new Value(mw));

	SerialConn conn = new SerialConn(getLink(), snode);
	conn.init();
}
 
开发者ID:IOT-DSA,项目名称:dslink-java-modbus,代码行数:48,代码来源:ModbusLink.java


注:本文中的org.dsa.iot.dslink.node.actions.ActionResult.getParameter方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。