本文整理汇总了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");
}
示例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");
}
示例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");
}
示例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");
}
示例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");
}
示例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");
}
示例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");
}
示例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");
}
示例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");
}
示例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");
}
示例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");
}
示例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");
}
示例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");
}
示例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");
}
示例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");
}