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


Java DPT类代码示例

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


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

示例1: testTypeMapping8BitUnsigned_5_001

import tuwien.auto.calimero.dptxlator.DPT; //导入依赖的package包/类
/**
 * KNXCoreTypeMapper tests method typeMapper.toType() for type “8-Bit Unsigned Value" KNX ID: 5.001 DPT_SCALING
 * 
 * This data type is a “Multi-state” type, according KNX spec. No exact linear conversion from value to byte(s) and reverse is required, since rounding is
 * involved.
 * 
 * @throws KNXFormatException
 */
@Test
public void testTypeMapping8BitUnsigned_5_001() throws KNXFormatException {
	DPT dpt = DPTXlator8BitUnsigned.DPT_SCALING;

	testToTypeClass(dpt, PercentType.class);

	// Use a too short byte array
	assertNull("KNXCoreTypeMapper.toType() should return null (required data length too short)",
			testToType(dpt, new byte[] { }, PercentType.class));

	Type type=testToType(dpt, new byte[] { 0x0 }, PercentType.class);
	testToDPTValue(dpt, type, "0");

	type=testToType(dpt, new byte[] { (byte) 0x80 }, PercentType.class);
	testToDPTValue(dpt, type, "50");

	type=testToType(dpt, new byte[] { (byte) 0xFF }, PercentType.class);
	testToDPTValue(dpt, type, "100");

	// Use a too long byte array expecting that additional bytes will be ignored
	type=testToType(dpt, new byte[] { (byte) 0xFF, 0 }, PercentType.class);
	testToDPTValue(dpt, type, "100");
}
 
开发者ID:andrey-desman,项目名称:openhab-hdl,代码行数:32,代码来源:KNXCoreTypeMapperTest.java

示例2: testTypeMapping8BitUnsigned_5_005

import tuwien.auto.calimero.dptxlator.DPT; //导入依赖的package包/类
/**
 * KNXCoreTypeMapper tests method typeMapper.toType() for type “8-Bit Unsigned Value" KNX ID: 5.005 DPT_DECIMALFACTOR
 * 
 * @throws KNXFormatException
 */
@Test
public void testTypeMapping8BitUnsigned_5_005() throws KNXFormatException {
	DPT dpt =DPTXlator8BitUnsigned.DPT_DECIMALFACTOR;

	testToTypeClass(dpt, DecimalType.class);

	// Use a too short byte array
	assertNull("KNXCoreTypeMapper.toType() should return null (required data length too short)",
			testToType(dpt, new byte[] {  }, DecimalType.class));

	Type type=testToType(dpt, new byte[] { 0 }, DecimalType.class);
	testToDPTValue(dpt, type, "0");

	type=testToType(dpt, new byte[] { (byte) 0xFF }, DecimalType.class);
	testToDPTValue(dpt, type, "255");

	// Use a too long byte array expecting that additional bytes will be ignored
	type=testToType(dpt, new byte[] { (byte) 0xFF, 0 }, DecimalType.class);
	testToDPTValue(dpt, type, "255");
}
 
开发者ID:andrey-desman,项目名称:openhab-hdl,代码行数:26,代码来源:KNXCoreTypeMapperTest.java

示例3: testTypeMapping8BitUnsigned_5_006

import tuwien.auto.calimero.dptxlator.DPT; //导入依赖的package包/类
/**
 * KNXCoreTypeMapper tests method typeMapper.toType() for type “8-Bit Unsigned Value" KNX ID: 5.006 DPT_TARRIF
 * 
 * @throws KNXFormatException
 */
@Test
public void testTypeMapping8BitUnsigned_5_006() throws KNXFormatException {
	DPT dpt =DPTXlator8BitUnsigned.DPT_TARIFF;

	testToTypeClass(dpt, DecimalType.class);

	// Use a too short byte array
	assertNull("KNXCoreTypeMapper.toType() should return null (required data length too short)",
			testToType(dpt, new byte[] {  }, DecimalType.class));

	Type type=testToType(dpt, new byte[] { 0 }, DecimalType.class);
	testToDPTValue(dpt, type, "0");

	type=testToType(dpt, new byte[] { (byte) 0xFF }, DecimalType.class);
	testToDPTValue(dpt, type, "255");

	// Use a too long byte array expecting that additional bytes will be ignored
	type=testToType(dpt, new byte[] { (byte) 0xFF, 0 }, DecimalType.class);
	testToDPTValue(dpt, type, "255");
}
 
开发者ID:andrey-desman,项目名称:openhab-hdl,代码行数:26,代码来源:KNXCoreTypeMapperTest.java

示例4: testTypeMapping8BitUnsigned_5_010

import tuwien.auto.calimero.dptxlator.DPT; //导入依赖的package包/类
/**
 * KNXCoreTypeMapper tests method typeMapper.toType() for type “8-Bit Unsigned Value" KNX ID: 5.010 DPT_VALUE_1_UCOUNT
 * 
 * @throws KNXFormatException
 */
@Test
public void testTypeMapping8BitUnsigned_5_010() throws KNXFormatException {
	DPT dpt =DPTXlator8BitUnsigned.DPT_VALUE_1_UCOUNT;

	testToTypeClass(dpt, DecimalType.class);

	// Use a too short byte array
	assertNull("KNXCoreTypeMapper.toType() should return null (required data length too short)",
			testToType(dpt, new byte[] { }, DecimalType.class));

	Type type=testToType(dpt, new byte[] { 0 }, DecimalType.class);
	testToDPTValue(dpt, type, "0");

	type=testToType(dpt, new byte[] { (byte) 0xFF }, DecimalType.class);
	testToDPTValue(dpt, type, "255");

	// Use a too long byte array expecting that additional bytes will be ignored
	type=testToType(dpt, new byte[] { (byte) 0xFF, 0 }, DecimalType.class);
	testToDPTValue(dpt, type, "255");
}
 
开发者ID:andrey-desman,项目名称:openhab-hdl,代码行数:26,代码来源:KNXCoreTypeMapperTest.java

示例5: testTypeMapping2ByteUnsigned_7_003

import tuwien.auto.calimero.dptxlator.DPT; //导入依赖的package包/类
/**
 * KNXCoreTypeMapper tests method typeMapper.toType() for type “2-Octet Unsigned Value" KNX ID: 7.003 DPT_TIMEPERIOD_10
 * 
 * @throws KNXFormatException
 */
@Test
public void testTypeMapping2ByteUnsigned_7_003() throws KNXFormatException {
	DPT dpt =DPTXlator2ByteUnsigned.DPT_TIMEPERIOD_10;

	testToTypeClass(dpt, DecimalType.class);

	// Use a too short byte array
	assertNull("KNXCoreTypeMapper.toType() should return null (required data length too short)",
			testToType(dpt, new byte[] { }, DecimalType.class));

	Type type=testToType(dpt, new byte[] { 0x00, 0x00 }, DecimalType.class);
	testToDPTValue(dpt, type, "0");

	type=testToType(dpt, new byte[] { (byte) 0xFF, 0x00 }, DecimalType.class);
	testToDPTValue(dpt, type, "652800");

	type=testToType(dpt, new byte[] { (byte) 0xFF, (byte) 0xFF }, DecimalType.class);
	testToDPTValue(dpt, type, "655350");

	// Use a too long byte array expecting that additional bytes will be ignored
	type=testToType(dpt, new byte[] { (byte) 0xFF, (byte) 0xFF, (byte) 0xFF  }, DecimalType.class);
	testToDPTValue(dpt, type, "655350");
}
 
开发者ID:andrey-desman,项目名称:openhab-hdl,代码行数:29,代码来源:KNXCoreTypeMapperTest.java

示例6: testTypeMapping2ByteUnsigned_7_004

import tuwien.auto.calimero.dptxlator.DPT; //导入依赖的package包/类
/**
 * KNXCoreTypeMapper tests for method typeMapper.toType() type “2-Octet Unsigned Value" KNX ID: 7.004 DPT_TIMEPERIOD_100
 * 
 * @throws KNXFormatException
 */
@Test
public void testTypeMapping2ByteUnsigned_7_004() throws KNXFormatException {
	DPT dpt =DPTXlator2ByteUnsigned.DPT_TIMEPERIOD_100;

	testToTypeClass(dpt, DecimalType.class);

	// Use a too short byte array
	assertNull("KNXCoreTypeMapper.toType() should return null (required data length too short)",
			testToType(dpt, new byte[] { }, DecimalType.class));

	Type type=testToType(dpt, new byte[] { 0x00, 0x00 }, DecimalType.class);
	testToDPTValue(dpt, type, "0");

	type=testToType(dpt, new byte[] { (byte) 0xFF, 0x00 }, DecimalType.class);
	testToDPTValue(dpt, type, "6528000");

	type=testToType(dpt, new byte[] { (byte) 0xFF, (byte) 0xFF }, DecimalType.class);
	testToDPTValue(dpt, type, "6553500");

	// Use a too long byte array expecting that additional bytes will be ignored
	type=testToType(dpt, new byte[] { (byte) 0xFF, (byte) 0xFF, (byte) 0xFF  }, DecimalType.class);
	testToDPTValue(dpt, type, "6553500");
}
 
开发者ID:andrey-desman,项目名称:openhab-hdl,代码行数:29,代码来源:KNXCoreTypeMapperTest.java

示例7: testTypeMapping4ByteUnsigned_12_001

import tuwien.auto.calimero.dptxlator.DPT; //导入依赖的package包/类
/**
 * KNXCoreTypeMapper tests method typeMapper.toType() for type “4-Octet Unsigned Value" KNX ID: 12.001 DPT_VALUE_4_UCOUNT
 * 
 * @throws KNXFormatException
 */
@Test
public void testTypeMapping4ByteUnsigned_12_001() throws KNXFormatException {
	DPT dpt =DPTXlator4ByteUnsigned.DPT_VALUE_4_UCOUNT;

	testToTypeClass(dpt, DecimalType.class);

	// Use a too short byte array
	assertNull("KNXCoreTypeMapper.toType() should return null (required data length too short)",
			testToType(dpt, new byte[] { }, DecimalType.class));

	// Use a too long byte array expecting that additional bytes will be ignored
	Type type=testToType(dpt, new byte[] {  (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF , (byte) 0xFF }, DecimalType.class);
	testToDPTValue(dpt, type, "4294967295");

	type=testToType(dpt, new byte[] { 0x00, 0x00, 0x00, 0x00 }, DecimalType.class);
	testToDPTValue(dpt, type, "0");

	type=testToType(dpt, new byte[] { (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF }, DecimalType.class);
	testToDPTValue(dpt, type, "4294967295");
}
 
开发者ID:andrey-desman,项目名称:openhab-hdl,代码行数:26,代码来源:KNXCoreTypeMapperTest.java

示例8: testTypeMapping2ByteUnsigned

import tuwien.auto.calimero.dptxlator.DPT; //导入依赖的package包/类
/**
 * Convenience method: testing KNXCoretypeMapper for type “Datapoint Types 2-Byte Float"
 * 
 * @throws KNXFormatException
 */
private void testTypeMapping2ByteUnsigned(DPT dpt) throws KNXFormatException {
	testToTypeClass(dpt, DecimalType.class);

	// Use a too short byte array
	assertNull("KNXCoreTypeMapper.toType() should return null (required data length too short)",
			testToType(dpt, new byte[] { }, DecimalType.class));

	Type type=testToType(dpt, new byte[] { 0x00, 0x00 }, DecimalType.class);
	testToDPTValue(dpt, type, "0");

	type=testToType(dpt, new byte[] { (byte) 0xFF, 0x00 }, DecimalType.class);
	testToDPTValue(dpt, type, "65280");

	type=testToType(dpt, new byte[] { (byte) 0xFF, (byte) 0xFF }, DecimalType.class);
	testToDPTValue(dpt, type, "65535");

	// Use a too long byte array expecting that additional bytes will be ignored
	type=testToType(dpt, new byte[] { (byte) 0xFF, (byte) 0xFF, (byte) 0xFF  }, DecimalType.class);
	testToDPTValue(dpt, type, "65535");
}
 
开发者ID:andrey-desman,项目名称:openhab-hdl,代码行数:26,代码来源:KNXCoreTypeMapperTest.java

示例9: testTypeMapping4ByteSigned

import tuwien.auto.calimero.dptxlator.DPT; //导入依赖的package包/类
/**
 * Convenience method: testing KNXCoretypeMapper for type “Datapoint Types 4-Byte Signed"
 * 
 * @throws KNXFormatException
 */
private void testTypeMapping4ByteSigned(DPT dpt) throws KNXFormatException {
	testToTypeClass(dpt, DecimalType.class);

	// Use a too short byte array
	assertNull("KNXCoreTypeMapper.toType() should return null (required data length too short)",
			testToType(dpt, new byte[] { }, DecimalType.class));

	// Use a too long byte array expecting that additional bytes will be ignored
	Type type=testToType(dpt, new byte[] {  (byte) 0x7F, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF , (byte) 0xFF }, DecimalType.class);
	testToDPTValue(dpt, type, "2147483647");

	type=testToType(dpt, new byte[] { 0x00, 0x00, 0x00, 0x00 }, DecimalType.class);
	testToDPTValue(dpt, type, "0");

	type=testToType(dpt, new byte[] { (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF }, DecimalType.class);
	testToDPTValue(dpt, type, "-1");

	type=testToType(dpt, new byte[] { (byte) 0x80, 0x00, 0x00, 0x00 }, DecimalType.class);
	testToDPTValue(dpt, type, "-2147483648");

	type=testToType(dpt, new byte[] { (byte) 0x7F, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF }, DecimalType.class);
	testToDPTValue(dpt, type, "2147483647");
}
 
开发者ID:andrey-desman,项目名称:openhab-hdl,代码行数:29,代码来源:KNXCoreTypeMapperTest.java

示例10: testTypeMapping8BitUnsigned_5_001

import tuwien.auto.calimero.dptxlator.DPT; //导入依赖的package包/类
/**
 * KNXCoreTypeMapper tests method typeMapper.toType() for type “8-Bit Unsigned Value" KNX ID: 5.001 DPT_SCALING
 *
 * This data type is a “Multi-state” type, according KNX spec. No exact linear conversion from value to byte(s) and
 * reverse is required, since rounding is
 * involved.
 *
 * @throws KNXFormatException
 */
@Test
public void testTypeMapping8BitUnsigned_5_001() throws KNXFormatException {
    DPT dpt = DPTXlator8BitUnsigned.DPT_SCALING;

    testToTypeClass(dpt, PercentType.class);

    // Use a too short byte array
    assertNull("KNXCoreTypeMapper.toType() should return null (required data length too short)",
            testToType(dpt, new byte[] {}, PercentType.class));

    Type type = testToType(dpt, new byte[] { 0x0 }, PercentType.class);
    testToDPTValue(dpt, type, "0");

    type = testToType(dpt, new byte[] { (byte) 0x80 }, PercentType.class);
    testToDPTValue(dpt, type, "50");

    type = testToType(dpt, new byte[] { (byte) 0xFF }, PercentType.class);
    testToDPTValue(dpt, type, "100");

    // Use a too long byte array expecting that additional bytes will be ignored
    type = testToType(dpt, new byte[] { (byte) 0xFF, 0 }, PercentType.class);
    testToDPTValue(dpt, type, "100");
}
 
开发者ID:openhab,项目名称:openhab1-addons,代码行数:33,代码来源:KNXCoreTypeMapperTest.java

示例11: testTypeMapping8BitUnsigned_5_005

import tuwien.auto.calimero.dptxlator.DPT; //导入依赖的package包/类
/**
 * KNXCoreTypeMapper tests method typeMapper.toType() for type “8-Bit Unsigned Value" KNX ID: 5.005
 * DPT_DECIMALFACTOR
 *
 * @throws KNXFormatException
 */
@Test
public void testTypeMapping8BitUnsigned_5_005() throws KNXFormatException {
    DPT dpt = DPTXlator8BitUnsigned.DPT_DECIMALFACTOR;

    testToTypeClass(dpt, DecimalType.class);

    // Use a too short byte array
    assertNull("KNXCoreTypeMapper.toType() should return null (required data length too short)",
            testToType(dpt, new byte[] {}, DecimalType.class));

    Type type = testToType(dpt, new byte[] { 0 }, DecimalType.class);
    testToDPTValue(dpt, type, "0");

    type = testToType(dpt, new byte[] { (byte) 0xFF }, DecimalType.class);
    testToDPTValue(dpt, type, "255");

    // Use a too long byte array expecting that additional bytes will be ignored
    type = testToType(dpt, new byte[] { (byte) 0xFF, 0 }, DecimalType.class);
    testToDPTValue(dpt, type, "255");
}
 
开发者ID:openhab,项目名称:openhab1-addons,代码行数:27,代码来源:KNXCoreTypeMapperTest.java

示例12: testTypeMapping8BitUnsigned_5_006

import tuwien.auto.calimero.dptxlator.DPT; //导入依赖的package包/类
/**
 * KNXCoreTypeMapper tests method typeMapper.toType() for type “8-Bit Unsigned Value" KNX ID: 5.006 DPT_TARRIF
 *
 * @throws KNXFormatException
 */
@Test
public void testTypeMapping8BitUnsigned_5_006() throws KNXFormatException {
    DPT dpt = DPTXlator8BitUnsigned.DPT_TARIFF;

    testToTypeClass(dpt, DecimalType.class);

    // Use a too short byte array
    assertNull("KNXCoreTypeMapper.toType() should return null (required data length too short)",
            testToType(dpt, new byte[] {}, DecimalType.class));

    Type type = testToType(dpt, new byte[] { 0 }, DecimalType.class);
    testToDPTValue(dpt, type, "0");

    type = testToType(dpt, new byte[] { (byte) 0xFF }, DecimalType.class);
    testToDPTValue(dpt, type, "255");

    // Use a too long byte array expecting that additional bytes will be ignored
    type = testToType(dpt, new byte[] { (byte) 0xFF, 0 }, DecimalType.class);
    testToDPTValue(dpt, type, "255");
}
 
开发者ID:openhab,项目名称:openhab1-addons,代码行数:26,代码来源:KNXCoreTypeMapperTest.java

示例13: testTypeMapping8BitUnsigned_5_010

import tuwien.auto.calimero.dptxlator.DPT; //导入依赖的package包/类
/**
 * KNXCoreTypeMapper tests method typeMapper.toType() for type “8-Bit Unsigned Value" KNX ID: 5.010
 * DPT_VALUE_1_UCOUNT
 *
 * @throws KNXFormatException
 */
@Test
public void testTypeMapping8BitUnsigned_5_010() throws KNXFormatException {
    DPT dpt = DPTXlator8BitUnsigned.DPT_VALUE_1_UCOUNT;

    testToTypeClass(dpt, DecimalType.class);

    // Use a too short byte array
    assertNull("KNXCoreTypeMapper.toType() should return null (required data length too short)",
            testToType(dpt, new byte[] {}, DecimalType.class));

    Type type = testToType(dpt, new byte[] { 0 }, DecimalType.class);
    testToDPTValue(dpt, type, "0");

    type = testToType(dpt, new byte[] { (byte) 0xFF }, DecimalType.class);
    testToDPTValue(dpt, type, "255");

    // Use a too long byte array expecting that additional bytes will be ignored
    type = testToType(dpt, new byte[] { (byte) 0xFF, 0 }, DecimalType.class);
    testToDPTValue(dpt, type, "255");
}
 
开发者ID:openhab,项目名称:openhab1-addons,代码行数:27,代码来源:KNXCoreTypeMapperTest.java

示例14: testTypeMapping2ByteUnsigned_7_003

import tuwien.auto.calimero.dptxlator.DPT; //导入依赖的package包/类
/**
 * KNXCoreTypeMapper tests method typeMapper.toType() for type “2-Octet Unsigned Value" KNX ID: 7.003
 * DPT_TIMEPERIOD_10
 *
 * @throws KNXFormatException
 */
@Test
public void testTypeMapping2ByteUnsigned_7_003() throws KNXFormatException {
    DPT dpt = DPTXlator2ByteUnsigned.DPT_TIMEPERIOD_10;

    testToTypeClass(dpt, DecimalType.class);

    // Use a too short byte array
    assertNull("KNXCoreTypeMapper.toType() should return null (required data length too short)",
            testToType(dpt, new byte[] {}, DecimalType.class));

    Type type = testToType(dpt, new byte[] { 0x00, 0x00 }, DecimalType.class);
    testToDPTValue(dpt, type, "0");

    type = testToType(dpt, new byte[] { (byte) 0xFF, 0x00 }, DecimalType.class);
    testToDPTValue(dpt, type, "652800");

    type = testToType(dpt, new byte[] { (byte) 0xFF, (byte) 0xFF }, DecimalType.class);
    testToDPTValue(dpt, type, "655350");

    // Use a too long byte array expecting that additional bytes will be ignored
    type = testToType(dpt, new byte[] { (byte) 0xFF, (byte) 0xFF, (byte) 0xFF }, DecimalType.class);
    testToDPTValue(dpt, type, "655350");
}
 
开发者ID:openhab,项目名称:openhab1-addons,代码行数:30,代码来源:KNXCoreTypeMapperTest.java

示例15: testTypeMapping2ByteUnsigned_7_004

import tuwien.auto.calimero.dptxlator.DPT; //导入依赖的package包/类
/**
 * KNXCoreTypeMapper tests for method typeMapper.toType() type “2-Octet Unsigned Value" KNX ID: 7.004
 * DPT_TIMEPERIOD_100
 *
 * @throws KNXFormatException
 */
@Test
public void testTypeMapping2ByteUnsigned_7_004() throws KNXFormatException {
    DPT dpt = DPTXlator2ByteUnsigned.DPT_TIMEPERIOD_100;

    testToTypeClass(dpt, DecimalType.class);

    // Use a too short byte array
    assertNull("KNXCoreTypeMapper.toType() should return null (required data length too short)",
            testToType(dpt, new byte[] {}, DecimalType.class));

    Type type = testToType(dpt, new byte[] { 0x00, 0x00 }, DecimalType.class);
    testToDPTValue(dpt, type, "0");

    type = testToType(dpt, new byte[] { (byte) 0xFF, 0x00 }, DecimalType.class);
    testToDPTValue(dpt, type, "6528000");

    type = testToType(dpt, new byte[] { (byte) 0xFF, (byte) 0xFF }, DecimalType.class);
    testToDPTValue(dpt, type, "6553500");

    // Use a too long byte array expecting that additional bytes will be ignored
    type = testToType(dpt, new byte[] { (byte) 0xFF, (byte) 0xFF, (byte) 0xFF }, DecimalType.class);
    testToDPTValue(dpt, type, "6553500");
}
 
开发者ID:openhab,项目名称:openhab1-addons,代码行数:30,代码来源:KNXCoreTypeMapperTest.java


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