• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java DigitalIn类的典型用法和代码示例

java 2次浏览

本文整理汇总了Java中net.wimpi.modbus.procimg.DigitalIn的典型用法代码示例。如果您正苦于以下问题:Java DigitalIn类的具体用法?Java DigitalIn怎么用?Java DigitalIn使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

DigitalIn类属于net.wimpi.modbus.procimg包,在下文中一共展示了DigitalIn类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: parameters

点赞 3

import net.wimpi.modbus.procimg.DigitalIn; //导入依赖的package包/类
@Parameters
public static Collection<Object[]> parameters() {
    List<Object[]> allParameters = new ArrayList<>();
    List<Object[]> baseParameters = Arrays.asList(new Object[][] {
            { false, ModbusBindingProvider.TYPE_COIL, SimpleDigitalOut.class, "addDigitalOut", DigitalOut.class },
            { true, ModbusBindingProvider.TYPE_COIL, SimpleDigitalOut.class, "addDigitalOut", DigitalOut.class },
            { false, ModbusBindingProvider.TYPE_DISCRETE, SimpleDigitalIn.class, "addDigitalIn", DigitalIn.class },
            { true, ModbusBindingProvider.TYPE_DISCRETE, SimpleDigitalIn.class, "addDigitalIn",
                    DigitalIn.class } });
    for (ServerType serverType : TEST_SERVERS) {
        for (Object[] params : baseParameters) {
            ArrayList<Object> paramsWithServer = new ArrayList<>();
            paramsWithServer.add(serverType);
            paramsWithServer.addAll(Arrays.asList(params));
            allParameters.add(paramsWithServer.toArray());
        }
    }

    return allParameters;
}
 

开发者ID:openhab,
项目名称:openhab1-addons,
代码行数:21,
代码来源:ReadCoilsAndDiscreteTestCase.java

示例2: createResponse

点赞 2

import net.wimpi.modbus.procimg.DigitalIn; //导入依赖的package包/类
public ModbusResponse createResponse() {
  ReadInputDiscretesResponse response = null;
  DigitalIn[] dins = null;

  //1. get process image
  ProcessImage procimg = ModbusCoupler.getReference().getProcessImage();
  //2. get inputdiscretes range
  try {
    dins = procimg.getDigitalInRange(this.getReference(), this.getBitCount());
  } catch (IllegalAddressException iaex) {
    return createExceptionResponse(Modbus.ILLEGAL_ADDRESS_EXCEPTION);
  }
  response = new ReadInputDiscretesResponse(dins.length);
  //transfer header data
  if (!isHeadless()) {
    response.setTransactionID(this.getTransactionID());
    response.setProtocolID(this.getProtocolID());
  } else {
    response.setHeadless();
  }
  response.setUnitID(this.getUnitID());
  response.setFunctionCode(this.getFunctionCode());

  for (int i = 0; i < dins.length; i++) {
    response.setDiscreteStatus(i, dins[i].isSet());
  }
  return response;
}
 

开发者ID:andrey-desman,
项目名称:openhab-hdl,
代码行数:29,
代码来源:ReadInputDiscretesRequest.java

示例3: createResponse

点赞 2

import net.wimpi.modbus.procimg.DigitalIn; //导入依赖的package包/类
public UnityModbusResponse createResponse() {
	UnityReadInputDiscretesResponse response = null;
	DigitalIn[] dins = null;

	// 1. get process image
	ProcessImage procimg = m_umc.getProcessImage();
	// 2. get inputdiscretes range
	try {
		dins = procimg.getDigitalInRange(this.getReference(),
				this.getBitCount());
	} catch (IllegalAddressException iaex) {
		return createExceptionResponse(Modbus.ILLEGAL_ADDRESS_EXCEPTION);
	}
	response = new UnityReadInputDiscretesResponse(dins.length, m_umc);
	// transfer header data
	if (!isHeadless()) {
		response.setTransactionID(this.getTransactionID());
		response.setProtocolID(this.getProtocolID());
	} else {
		response.setHeadless();
	}
	response.setUnitID(this.getUnitID());
	response.setFunctionCode(this.getFunctionCode());

	for (int i = 0; i < dins.length; i++) {
		response.setDiscreteStatus(i, dins[i].isSet());
	}
	return response;
}
 

开发者ID:Dn9x,
项目名称:dn-modbus,
代码行数:30,
代码来源:UnityReadInputDiscretesRequest.java

示例4: createResponse

点赞 2

import net.wimpi.modbus.procimg.DigitalIn; //导入依赖的package包/类
public ModbusResponse createResponse() {
	ReadInputDiscretesResponse response = null;
	DigitalIn[] dins = null;

	// 1. get process image
	ProcessImage procimg = ModbusCoupler.getReference().getProcessImage();
	// 2. get inputdiscretes range
	try {
		dins = procimg.getDigitalInRange(this.getReference(),
				this.getBitCount());
	} catch (IllegalAddressException iaex) {
		return createExceptionResponse(Modbus.ILLEGAL_ADDRESS_EXCEPTION);
	}
	response = new ReadInputDiscretesResponse(dins.length);
	// transfer header data
	if (!isHeadless()) {
		response.setTransactionID(this.getTransactionID());
		response.setProtocolID(this.getProtocolID());
	} else {
		response.setHeadless();
	}
	response.setUnitID(this.getUnitID());
	response.setFunctionCode(this.getFunctionCode());
	response.setReference(m_Reference);

	for (int i = 0; i < dins.length; i++) {
		response.setDiscreteStatus(i, dins[i].isSet());
	}
	return response;
}
 

开发者ID:jeick,
项目名称:jamod,
代码行数:31,
代码来源:ReadInputDiscretesRequest.java

示例5: createResponse

点赞 2

import net.wimpi.modbus.procimg.DigitalIn; //导入依赖的package包/类
@Override
public ModbusResponse createResponse() {
    ReadInputDiscretesResponse response = null;
    DigitalIn[] dins = null;

    // 1. get process image
    ProcessImage procimg = ModbusCoupler.getReference().getProcessImage();
    // 2. get inputdiscretes range
    try {
        dins = procimg.getDigitalInRange(this.getReference(), this.getBitCount());
    } catch (IllegalAddressException iaex) {
        return createExceptionResponse(Modbus.ILLEGAL_ADDRESS_EXCEPTION);
    }
    response = new ReadInputDiscretesResponse(dins.length);
    // transfer header data
    if (!isHeadless()) {
        response.setTransactionID(this.getTransactionID());
        response.setProtocolID(this.getProtocolID());
    } else {
        response.setHeadless();
    }
    response.setUnitID(this.getUnitID());
    response.setFunctionCode(this.getFunctionCode());

    for (int i = 0; i < dins.length; i++) {
        response.setDiscreteStatus(i, dins[i].isSet());
    }
    return response;
}
 

开发者ID:openhab,
项目名称:openhab1-addons,
代码行数:30,
代码来源:ReadInputDiscretesRequest.java

示例6: initSpi

点赞 2

import net.wimpi.modbus.procimg.DigitalIn; //导入依赖的package包/类
private void initSpi() {
    dins = new DigitalIn[] { new SimpleDigitalIn(discreteInitialValue), new SimpleDigitalIn(discreteInitialValue),
            new SimpleDigitalIn(discreteInitialValue), new SimpleDigitalIn(discreteInitialValue) };
    for (DigitalIn din : dins) {
        spi.addDigitalIn(din);
    }
    douts = new DigitalOut[] { new SimpleDigitalOut(coilInitialValue), new SimpleDigitalOut(coilInitialValue),
            new SimpleDigitalOut(coilInitialValue), new SimpleDigitalOut(coilInitialValue) };
    for (DigitalOut dout : douts) {
        spi.addDigitalOut(dout);
    }
}
 

开发者ID:openhab,
项目名称:openhab1-addons,
代码行数:13,
代码来源:WriteCoilsAndDiscreteTestCase.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)