Package org.openhab.core.types

Examples of org.openhab.core.types.Type


    // 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");
View Full Code Here


    // 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");
View Full Code Here

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

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

    /*
     * Set day to no day, 0 hours, 0 minutes and 0 seconds
     *
 
View Full Code Here

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

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

    type=testToType(dpt, new byte[] { 0x01, 0x01, 0x00 }, DateTimeType.class);
    testToDPTValue(dpt, type, "2000-01-01");
View Full Code Here

    // 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");
View Full Code Here

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

        try {
          // Use a too long byte array expecting that additional bytes will be ignored
          Type type=testToType(dpt, new byte[] {   (byte) 0x7F, (byte) 0x7F, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF }, DecimalType.class);
          testToDPTValue(dpt, type, "340282000000000000000000000000000000000");
        }
        catch (NumberFormatException nfe) {
          fail("DptId: "+dpt.getID()+", locale: "+locale+", NumberFormatException. Expecting 0.0");
        }

        try {
          Type type=testToType(dpt, new byte[] { 0x00, 0x00, 0x00, 0x00 }, DecimalType.class);
          testToDPTValue(dpt, type, "0.0");
        }
        catch (NumberFormatException nfe) {
          fail("DptId: "+dpt.getID()+", locale: "+locale+", NumberFormatException. Expecting 0.0");
        }

        try {
          // Test the smallest positive value
          Type type=testToType(dpt, new byte[] { 0x00, 0x00, 0x00, 0x01 }, DecimalType.class);
          testToDPTValue(dpt, type, "0.0000000000000000000000000000000000000000000014");
        }
        catch (NumberFormatException nfe) {
          fail("DptId: "+dpt.getID()+", locale: "+locale+", NumberFormatException. Expecting 0.0000000000000000000000000000000000000000000014");
        }

        try {
          // Test the smallest negative value
          Type type=testToType(dpt, new byte[] { (byte)0x80, 0x00, 0x00, 0x01 }, DecimalType.class);
          testToDPTValue(dpt, type, "-0.0000000000000000000000000000000000000000000014");
        }
        catch (NumberFormatException nfe) {
          fail("DptId: "+dpt.getID()+", locale: "+locale+", NumberFormatException. Expecting -0.0000000000000000000000000000000000000000000014");
        }

        try {
          // Test the maximum positive value
          Type type=testToType(dpt, new byte[] { (byte) 0x7F, (byte) 0x7F, (byte) 0xFF, (byte) 0xFF }, DecimalType.class);
          testToDPTValue(dpt, type, "340282000000000000000000000000000000000");
        }
        catch (NumberFormatException nfe) {
          fail("DptId: "+dpt.getID()+", locale: "+locale+", NumberFormatException. Expecting 340282000000000000000000000000000000000");
        }

        try {
          // Test the maximum negative value
          Type type=testToType(dpt, new byte[] { (byte) 0xFF, (byte) 0x7F, (byte) 0xFF, (byte) 0xFF }, DecimalType.class);
          testToDPTValue(dpt, type, "-340282000000000000000000000000000000000");
        }
        catch (NumberFormatException nfe) {
          fail("DptId: "+dpt.getID()+", locale: "+locale+", NumberFormatException. Expecting -340282000000000000000000000000000000000");
        }
View Full Code Here

    /*
     * According to spec the length of this DPT is fixed to 14 bytes.
     *
     * Test the that a too short array results in an <null> string. There should be an error logged by calimero lib (V2.2.0).
     */
    Type type=testToType(dpt, new byte[] { 0x61, 0x62 }, StringType.class);
    testToDPTValue(dpt, type, null);

    /*
     * FIXME: According to spec the length of this DPT is fixed to 14 bytes. Calimero lib (V 2.2.0) isn't checking this correctly and has a bug in
     * tuwien.auto.calimero.dptxlator.DPTXlatorString.toDPT(final byte[] buf, final int offset). Calimero accepts any byte array larger or equal to 14 bytes
View Full Code Here

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

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

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

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

         * Reference testcase
         * Monday, January 1st, 1900 00:00:00, Fault: Normal (no fault), Working Day: Bank day (No working day), Working Day Field: valid,
         * Year Field valid, Months and Day fields valid, Day of week field valid, Hour of day, Minutes and Seconds fields valid,
         * Standard Summer Time: Time = UT+X, Quality of Clock: clock without ext. sync signal
         */
        Type type=testToType(dpt, new byte[] { 0x00, 0x01, 0x01, 0x20, 0x00, 0x00, 0x00, 0x00 }, DateTimeType.class);
        testToDPTValue(dpt, type, "1900-01-01 00:00:00");

        /*
         * Reference testcase + Fault: Fault => not supported
         */
 
View Full Code Here

TOP

Related Classes of org.openhab.core.types.Type

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.