Examples of RestMcuLineResource


Examples of org.housecream.restmcu.api.resource.client.RestMcuLineResource

    @Rule
    public RestmcuTestRule restmcu = new RestmcuTestRule();

    @Test
    public void should_dim_green_led_up_and_down() throws Exception {
        RestMcuLineResource lineResource = restmcu.getLineResource();

        for (int i = 0; i <= 255; i++) {
            lineResource.setLineValue(6, (float) i);
            assertEquals(i, lineResource.getLineValue(6), 0);
        }
        for (int i = 255; i >= 0; i--) {
            lineResource.setLineValue(6, (float) i);
            assertEquals(i, lineResource.getLineValue(6), 0);
        }
    }
View Full Code Here

Examples of org.housecream.restmcu.api.resource.client.RestMcuLineResource

        }

        @Override
        public void run() {
            RestMcuLineResource lineResource = restmcu.getLineResource();
            for (int i = 0; i < 100; i++) {
                try {
                    lineResource.setLineValue(line, highValue);
                    if (lineResource.getLineValue(line) != highValue) {
                        failure = true;
                        break;
                    }
                    lineResource.setLineValue(line, lowValue);
                    if (lineResource.getLineValue(line) != lowValue) {
                        failure = true;
                        break;
                    }
                } catch (Exception e) {
                    throw new RuntimeException(e);
View Full Code Here

Examples of org.housecream.restmcu.api.resource.client.RestMcuLineResource

    @Rule
    public RestmcuTestRule restmcu = new RestmcuTestRule();

    @Test
    public void should_toggle_red_led_fastest() throws Exception {
        RestMcuLineResource lineResource = restmcu.getLineResource();
        for (int i = 0; i < 100; i++) {
            lineResource.setLineValue(7, 1f);
            lineResource.setLineValue(7, 0f);
        }
    }
View Full Code Here

Examples of org.housecream.restmcu.api.resource.client.RestMcuLineResource

        }
    }

    @Test
    public void should_toggle_red_led() throws Exception {
        RestMcuLineResource lineResource = restmcu.getLineResource();
        for (int i = 0; i < 100; i++) {
            lineResource.setLineValue(7, 1f);
            assertEquals(1f, lineResource.getLineValue(7), 0);
            lineResource.setLineValue(7, 0f);
            assertEquals(0f, lineResource.getLineValue(7), 0);
        }
    }
View Full Code Here

Examples of org.housecream.restmcu.api.resource.client.RestMcuLineResource

    // sha1        : 18s
    // sha1 both   : 24s
    // no security : 10s
    @Test
    public void should_toggle_red_led_fastest() throws Exception {
        RestMcuLineResource lineResource = restmcu.getLineResource();
        for (int i = 0; i < 100; i++) {
            lineResource.setLineValue(7, 1f);
            assertEquals(1f, lineResource.getLineValue(7), 0);
            lineResource.setLineValue(7, 0f);
            assertEquals(0f, lineResource.getLineValue(7), 0);
        }
    }
View Full Code Here

Examples of org.housecream.restmcu.api.resource.client.RestMcuLineResource

        }
    }

    @Test
    public void should_toggle_red_led_fastest2() throws Exception {
        RestMcuLineResource lineResource = restmcu.getLineResource();
        //        lineResource.getLineSettings(7);
        lineResource.setLineValue(7, 1f);
        //            assertEquals(1f, lineResource.getLineValue(7), 0);
        //        lineResource.setLineValue(7, 0f);
        //            assertEquals(0f, lineResource.getLineValue(7), 0);
    }
View Full Code Here

Examples of org.housecream.restmcu.api.resource.client.RestMcuLineResource

    public void should_notify_on_state_change() throws Exception {

        RestMcuBoardSettings boardSettings = new RestMcuBoardSettings();
        boardSettings.setNotifyUrl("http://" + NetworkUtils.getFirstNonWifiIp() + ":5879/");
        restmcu.getBoardResource().setBoardSettings(boardSettings);
        RestMcuLineResource lineResource = restmcu.getLineResource();
        RestMcuLineSettings settings = new RestMcuLineSettings();
        settings.setNotifies(Arrays.asList(new RestMcuLineNotify(RestMcuLineNotifyCondition.SUP_OR_EQUAL, 1f)));
        lineResource.setLineSettings(54, settings);
        lineResource.setLineValue(9, 0f);

        lineResource.setLineValue(9, 1f);

        RestMcuLineNotification restMcuLineNotification = notifyResource.awaitLine().get(0);
        assertEquals(54, restMcuLineNotification.getLineId());
        assertEquals(new RestMcuLineNotify(RestMcuLineNotifyCondition.SUP_OR_EQUAL, 1f),
                restMcuLineNotification.getNotify());
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.