本文整理汇总了Java中org.dsa.iot.dslink.node.actions.Action类的典型用法代码示例。如果您正苦于以下问题:Java Action类的具体用法?Java Action怎么用?Java Action使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Action类属于org.dsa.iot.dslink.node.actions包,在下文中一共展示了Action类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: makeDiscoverAction
import org.dsa.iot.dslink.node.actions.Action; //导入依赖的package包/类
private void makeDiscoverAction() {
Action act = new Action(Permission.READ, new Handler<ActionResult>() {
public void handle(ActionResult event) {
discover();
}
});
Node anode = node.getChild("discover");
if (anode == null) node.createChild("discover").setAction(act).build().setSerializable(false);
else anode.setAction(act);
// act = new Action(Permission.READ, new Handler<ActionResult>() {
// public void handle(ActionResult event) {
// update();
// }
// });
// anode = node.getChild("update");
// if (anode == null) node.createChild("update").setAction(act).build().setSerializable(false);
// else anode.setAction(act);
}
示例2: getEditAction
import org.dsa.iot.dslink.node.actions.Action; //导入依赖的package包/类
@Override
Action getEditAction() {
Action act = new Action(Permission.READ, new EditHandler());
act.addParameter(new Parameter(ATTR_NAME, ValueType.STRING, new Value(node.getName())));
act.addParameter(new Parameter(ATTR_TRANSPORT_TYPE, ValueType.makeEnum(Util.enumNames(IpTransportType.class))));
act.addParameter(new Parameter(ATTR_HOST, ValueType.STRING, node.getAttribute(ATTR_HOST)));
act.addParameter(new Parameter(ATTR_PORT, ValueType.NUMBER, node.getAttribute(ATTR_PORT)));
act.addParameter(new Parameter(ATTR_TIMEOUT, ValueType.NUMBER, node.getAttribute(ATTR_TIMEOUT)));
act.addParameter(new Parameter(ATTR_RETRIES, ValueType.NUMBER, node.getAttribute(ATTR_RETRIES)));
act.addParameter(
new Parameter(ATTR_MAX_READ_BIT_COUNT, ValueType.NUMBER, node.getAttribute(ATTR_MAX_READ_BIT_COUNT)));
act.addParameter(new Parameter(ATTR_MAX_READ_REGISTER_COUNT, ValueType.NUMBER,
node.getAttribute(ATTR_MAX_READ_REGISTER_COUNT)));
act.addParameter(new Parameter(ATTR_MAX_WRITE_REGISTER_COUNT, ValueType.NUMBER,
node.getAttribute(ATTR_MAX_WRITE_REGISTER_COUNT)));
act.addParameter(
new Parameter(ATTR_DISCARD_DATA_DELAY, ValueType.NUMBER, node.getAttribute(ATTR_DISCARD_DATA_DELAY)));
act.addParameter(new Parameter(ATTR_USE_MULTIPLE_WRITE_COMMAND, ValueType.makeEnum(MULTIPLE_WRITE_COMMAND_OPTIONS),
node.getAttribute(ATTR_USE_MULTIPLE_WRITE_COMMAND)));
return act;
}
示例3: makeImportAction
import org.dsa.iot.dslink.node.actions.Action; //导入依赖的package包/类
private void makeImportAction(final Node fnode) {
Action act = new Action(Permission.READ, new Handler<ActionResult>(){
@Override
public void handle(ActionResult event) {
handleImport(fnode, event);
}
});
act.addParameter(new Parameter("Name", ValueType.STRING));
act.addParameter(new Parameter("JSON", ValueType.STRING).setEditorType(EditorType.TEXT_AREA));
Node anode = fnode.getChild(ACTION_IMPORT, true);
if (anode == null) {
fnode.createChild(ACTION_IMPORT, true).setAction(act).build().setSerializable(false);
} else {
anode.setAction(act);
}
}
示例4: setEditAction
import org.dsa.iot.dslink.node.actions.Action; //导入依赖的package包/类
public void setEditAction() {
Action act = new Action(Permission.READ, new EditHandler());
act.addParameter(new Parameter(ATTRIBUTE_NAME, ValueType.STRING, new Value(node.getName())));
act.addParameter(
new Parameter(ATTRIBUTE_TRANSPORT_TYPE, ValueType.makeEnum(Util.enumNames(IpTransportType.class)),
node.getAttribute(ATTRIBUTE_TRANSPORT_TYPE)));
act.addParameter(new Parameter(ATTRIBUTE_PORT, ValueType.NUMBER, node.getAttribute(ATTRIBUTE_PORT)));
act.addParameter(new Parameter(ATTRIBUTE_SLAVE_ID, ValueType.NUMBER, node.getAttribute(ATTRIBUTE_SLAVE_ID)));
Node editNode = node.getChild(ACTION_EDIT, true);
if (editNode == null)
node.createChild(ACTION_EDIT, true).setAction(act).build().setSerializable(false);
else
editNode.setAction(act);
}
示例5: makeStopAction
import org.dsa.iot.dslink.node.actions.Action; //导入依赖的package包/类
private void makeStopAction() {
Action act = new Action(Permission.READ, new Handler<ActionResult>() {
public void handle(ActionResult event) {
if (reconnectFuture != null) {
reconnectFuture.cancel(false);
}
stop();
}
});
Node anode = node.getChild("stop", true);
if (anode == null)
node.createChild("stop", true).setAction(act).build().setSerializable(false);
else
anode.setAction(act);
}
示例6: makeImportAction
import org.dsa.iot.dslink.node.actions.Action; //导入依赖的package包/类
private void makeImportAction() {
Action act = new Action(Permission.READ, new Handler<ActionResult>(){
@Override
public void handle(ActionResult event) {
handleImport(event);
}
});
act.addParameter(new Parameter("Name", ValueType.STRING));
act.addParameter(new Parameter("JSON", ValueType.STRING).setEditorType(EditorType.TEXT_AREA));
Node anode = node.getChild(ACTION_IMPORT, true);
if (anode == null) {
node.createChild(ACTION_IMPORT, true).setAction(act).build().setSerializable(false);
} else {
anode.setAction(act);
}
}
示例7: handle
import org.dsa.iot.dslink.node.actions.Action; //导入依赖的package包/类
public void handle(ActionResult event) {
Action act = getAddSerialConnectionAction();
Node anode = node.getChild(ACTION_ADD_SERIAL_CONNECTION, true);
if (anode == null) {
anode = node.createChild(ACTION_ADD_SERIAL_CONNECTION, true).setAction(act).build();
anode.setSerializable(false);
} else {
anode.setAction(act);
}
for (ModbusConnection conn : connections) {
anode = conn.node.getChild(ACTION_EDIT, true);
if (anode != null) {
act = conn.getEditAction();
anode.setAction(act);
}
}
}
示例8: getAddIpConnectionAction
import org.dsa.iot.dslink.node.actions.Action; //导入依赖的package包/类
private Action getAddIpConnectionAction() {
Action act = new Action(Permission.READ, new AddIpConnectionHandler());
act.addParameter(new Parameter(ModbusConnection.ATTR_CONNECTION_NAME, ValueType.STRING));
act.addParameter(new Parameter(ModbusConnection.ATTR_TRANSPORT_TYPE, ValueType.makeEnum("TCP", "UDP")));
act.addParameter(new Parameter(IpConnection.ATTR_HOST, ValueType.STRING, new Value("")));
act.addParameter(new Parameter(IpConnection.ATTR_PORT, ValueType.NUMBER, new Value(502)));
act.addParameter(new Parameter(ModbusConnection.ATTR_TIMEOUT, ValueType.NUMBER, new Value(500)));
act.addParameter(new Parameter(ModbusConnection.ATTR_RETRIES, ValueType.NUMBER, new Value(2)));
act.addParameter(new Parameter(ModbusConnection.ATTR_MAX_READ_BIT_COUNT, ValueType.NUMBER, new Value(2000)));
act.addParameter(
new Parameter(ModbusConnection.ATTR_MAX_READ_REGISTER_COUNT, ValueType.NUMBER, new Value(125)));
act.addParameter(
new Parameter(ModbusConnection.ATTR_MAX_WRITE_REGISTER_COUNT, ValueType.NUMBER, new Value(120)));
act.addParameter(new Parameter(ModbusConnection.ATTR_DISCARD_DATA_DELAY, ValueType.NUMBER, new Value(0)));
act.addParameter(
new Parameter(ModbusConnection.ATTR_USE_MULTIPLE_WRITE_COMMAND, ValueType.makeEnum(ModbusConnection.MULTIPLE_WRITE_COMMAND_OPTIONS), new Value(ModbusConnection.MULTIPLE_WRITE_COMMAND_DEFAULT)));
return act;
}
示例9: makeEditAction
import org.dsa.iot.dslink.node.actions.Action; //导入依赖的package包/类
void makeEditAction() {
Action act = new Action(Permission.READ, new EditHandler());
act.addParameter(new Parameter(ModbusConnection.ATTR_SLAVE_NAME, ValueType.STRING, new Value(node.getName())));
act.addParameter(new Parameter(ModbusConnection.ATTR_SLAVE_ID, ValueType.NUMBER,
node.getAttribute(ModbusConnection.ATTR_SLAVE_ID)));
double defint = node.getAttribute(ModbusConnection.ATTR_POLLING_INTERVAL).getNumber().doubleValue() / 1000;
act.addParameter(new Parameter(ModbusConnection.ATTR_POLLING_INTERVAL, ValueType.NUMBER, new Value(defint)));
act.addParameter(new Parameter(ModbusConnection.ATTR_ZERO_ON_FAILED_POLL, ValueType.BOOL,
node.getAttribute(ModbusConnection.ATTR_ZERO_ON_FAILED_POLL)));
act.addParameter(new Parameter(ModbusConnection.ATTR_USE_BATCH_POLLING, ValueType.BOOL,
node.getAttribute(ModbusConnection.ATTR_USE_BATCH_POLLING)));
act.addParameter(new Parameter(ModbusConnection.ATTR_CONTIGUOUS_BATCH_REQUEST_ONLY, ValueType.BOOL,
node.getAttribute(ModbusConnection.ATTR_CONTIGUOUS_BATCH_REQUEST_ONLY)));
Node anode = node.getChild(ACTION_EDIT, true);
if (anode == null)
node.createChild(ACTION_EDIT, true).setAction(act).build().setSerializable(false);
else
anode.setAction(act);
}
示例10: makeRemoveAction
import org.dsa.iot.dslink.node.actions.Action; //导入依赖的package包/类
private void makeRemoveAction() {
Action act = new Action(Permission.READ, new Handler<ActionResult>() {
public void handle(ActionResult event) {
remove();
}
});
Node anode = node.getChild("remove");
if (anode == null) node.createChild("remove").setAction(act).build().setSerializable(false);
else anode.setAction(act);
}
示例11: makeEditAction
import org.dsa.iot.dslink.node.actions.Action; //导入依赖的package包/类
void makeEditAction() {
Action act = new Action(Permission.READ, new Handler<ActionResult>() {
public void handle(ActionResult event) {
edit(event);
}
});
act.addParameter(new Parameter("Name", ValueType.STRING, new Value(node.getName())));
if (isSerial) {
Set<String> portids = link.getCOMPorts();
if (portids.size() > 0) {
if (portids.contains(node.getAttribute("COM Port").getString())) {
act.addParameter(new Parameter("COM Port", ValueType.makeEnum(portids), node.getAttribute("COM Port")));
act.addParameter(new Parameter("COM Port (manual entry)", ValueType.STRING));
} else {
act.addParameter(new Parameter("COM Port", ValueType.makeEnum(portids)));
act.addParameter(new Parameter("COM Port (manual entry)", ValueType.STRING, node.getAttribute("COM Port")));
}
} else {
act.addParameter(new Parameter("COM Port", ValueType.STRING, node.getAttribute("COM Port")));
}
act.addParameter(new Parameter("Baud Rate", ValueType.NUMBER, node.getAttribute("Baud Rate")));
act.addParameter(new Parameter("Data Bits", ValueType.NUMBER, node.getAttribute("Data Bits")));
act.addParameter(new Parameter("Stop Bits", ValueType.NUMBER, node.getAttribute("Stop Bits")));
act.addParameter(new Parameter("Parity", ValueType.NUMBER, node.getAttribute("Parity")));
} else {
act.addParameter(new Parameter("Host", ValueType.STRING, node.getAttribute("Host")));
act.addParameter(new Parameter("Port", ValueType.NUMBER, node.getAttribute("Port")));
}
act.addParameter(new Parameter("Master Address", ValueType.NUMBER, node.getAttribute("Master Address")));
act.addParameter(new Parameter("Outstation Address", ValueType.NUMBER, node.getAttribute("Outstation Address")));
double defint = node.getAttribute("Event Polling Interval").getNumber().doubleValue() / 1000;
act.addParameter(new Parameter("Event Polling Interval", ValueType.NUMBER, new Value(defint)));
double defsint = node.getAttribute("Static Polling Interval").getNumber().doubleValue() / 1000;
act.addParameter(new Parameter("Static Polling Interval", ValueType.NUMBER, new Value(defsint)));
Node anode = node.getChild("edit");
if (anode == null) node.createChild("edit").setAction(act).build().setSerializable(false);
else anode.setAction(act);
}
示例12: makePortScanAction
import org.dsa.iot.dslink.node.actions.Action; //导入依赖的package包/类
private void makePortScanAction() {
Action act = new Action(Permission.READ, new Handler<ActionResult>() {
public void handle(ActionResult event) {
doPortScan();
}
});
node.createChild("scan for serial ports").setAction(act).build().setSerializable(false);
}
示例13: setAddPointAction
import org.dsa.iot.dslink.node.actions.Action; //导入依赖的package包/类
@Override
public void setAddPointAction() {
Action act = new Action(Permission.READ, new AddPointHandler());
act.addParameter(new Parameter(ATTRIBUTE_NAME, ValueType.STRING));
act.addParameter(new Parameter(ATTRIBUTE_POINT_TYPE, ValueType.makeEnum(Util.enumNames(PointType.class))));
act.addParameter(new Parameter(ATTRIBUTE_OFFSET, ValueType.NUMBER));
act.addParameter(new Parameter(ATTRIBUTE_DATA_TYPE, ValueType.makeEnum(Util.enumNames(DataType.class))));
act.addParameter(new Parameter(ATTRIBUTE_REGISTER_COUNT, ValueType.NUMBER));
node.createChild(ACTION_ADD_POINT, true).setAction(act).build().setSerializable(false);
}
示例14: setEditAction
import org.dsa.iot.dslink.node.actions.Action; //导入依赖的package包/类
public void setEditAction() {
Action act = new Action(Permission.READ, new EditHandler());
act.addParameter(new Parameter(ATTRIBUTE_NAME, ValueType.STRING, new Value(node.getName())));
Node editNode = node.getChild(ACTION_EDIT, true);
if (editNode == null)
node.createChild(ACTION_EDIT, true).setAction(act).build().setSerializable(false);
else
editNode.setAction(act);
}
示例15: getAddPointAction
import org.dsa.iot.dslink.node.actions.Action; //导入依赖的package包/类
Action getAddPointAction() {
Action act = new Action(Permission.READ, new AddPointHandler());
act.addParameter(new Parameter(ATTR_NAME, ValueType.STRING));
act.addParameter(new Parameter(ATTR_POINT_TYPE, ValueType.makeEnum(Util.enumNames(PointType.class))));
act.addParameter(new Parameter(ATTR_OFFSET, ValueType.NUMBER));
act.addParameter(new Parameter(ATTR_NUMBER_OF_REGISTERS, ValueType.NUMBER, new Value(1)));
act.addParameter(new Parameter(ATTR_DATA_TYPE, ValueType.makeEnum(Util.enumNames(DataType.class))));
act.addParameter(new Parameter(ATTR_BIT, ValueType.NUMBER));
act.addParameter(new Parameter(ATTR_SCALING, ValueType.NUMBER, new Value(1)));
act.addParameter(new Parameter(ATTR_SCALING_OFFSET, ValueType.NUMBER, new Value(0)));
act.addParameter(new Parameter(ATTR_WRITBLE, ValueType.BOOL, new Value(false)));
return act;
}