请选择 进入手机版 | 继续访问电脑版
  • 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java DPT类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: 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:openhab,项目名称:openhab1-addons,代码行数:28,代码来源:KNXCoreTypeMapperTest.java


示例17: 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:openhab,项目名称:openhab1-addons,代码行数:26,代码来源:KNXCoreTypeMapperTest.java


示例18: 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:openhab,项目名称:openhab1-addons,代码行数:30,代码来源:KNXCoreTypeMapperTest.java


示例19: testTypeMapping8BitUnsigned_5_003

import tuwien.auto.calimero.dptxlator.DPT; //导入依赖的package包/类
/**
 * KNXCoreTypeMapper tests method typeMapper.toType() for type “8-Bit Unsigned Value" KNX ID: 5.003 DPT_ANGLE
 * 
 * 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_003() throws KNXFormatException {
	DPT dpt = DPTXlator8BitUnsigned.DPT_ANGLE;

	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) 0x7F }, DecimalType.class);
	testToDPTValue(dpt, type, "179");

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

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

	// 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, "360");
}
 
开发者ID:andrey-desman,项目名称:openhab-hdl,代码行数:35,代码来源:KNXCoreTypeMapperTest.java


示例20: testTypeMapping8BitUnsigned_5_004

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

	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[] { 50 }, DecimalType.class);
	testToDPTValue(dpt, type, "50");

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

	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,代码行数:32,代码来源:KNXCoreTypeMapperTest.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java WebImageCache类代码示例发布时间:2022-05-16
下一篇:
Java RichIterable类代码示例发布时间:2022-05-16
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap