Package org.housecream.restmcu.api.domain.line

Examples of org.housecream.restmcu.api.domain.line.RestMcuLineSettings


        line.getDescription().setDirection(RestMcuLineDirection.INPUT);
        line.getDescription().setType(RestMcuLineType.ANALOG);
        line.getDescription().setValueMax(1024f);
        line.getDescription().setValueMin(0f);

        line.setSettings(new RestMcuLineSettings());
        line.getSettings().setName("name of pin");
        List<RestMcuLineNotify> notifies = new ArrayList<RestMcuLineNotify>();
        notifies.add(new RestMcuLineNotify(SUP_OR_EQUAL, 42));
        notifies.add(new RestMcuLineNotify(INF_OR_EQUAL, 42));
View Full Code Here


    }

    public LineInfo build() {
        LineInfo pinInfo = new LineInfo(id);
        pinInfo.setDescription(new RestMcuLine());
        pinInfo.setSettings(new RestMcuLineSettings());
        pinInfo.setValue(value);
        pinInfo.getSettings().setName(name);
        pinInfo.getDescription().setDirection(direction);
        return pinInfo;
    }
View Full Code Here

        restmcu.getLineResource().getLineValue(-1);
    }

    @Test(expected = NotFoundException.class)
    public void should_throw_exception_on_unknown_line13() throws Exception {
        restmcu.getLineResource().setLineSettings(42, new RestMcuLineSettings());
    }
View Full Code Here

        restmcu.getLineResource().setLineSettings(42, new RestMcuLineSettings());
    }

    @Test(expected = NotFoundException.class)
    public void should_throw_exception_on_unknown_line14() throws Exception {
        restmcu.getLineResource().setLineSettings(-1, new RestMcuLineSettings());
    }
View Full Code Here

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

    @Rule
    public RestmcuTestRule restmcu = new RestmcuTestRule();

    @Test
    public void should_change_name() throws Exception {
        RestMcuLineSettings value = new RestMcuLineSettings();
        value.setName("myname");

        restmcu.getLineResource().setLineSettings(6, value);

        assertEquals("myname", restmcu.getLineResource().getLineSettings(6).getName());
    }
View Full Code Here

        assertEquals("myname", restmcu.getLineResource().getLineSettings(6).getName());
    }

    @Test
    public void should_update_notify() throws Exception {
        RestMcuLineSettings value = new RestMcuLineSettings();
        List<RestMcuLineNotify> asList = Arrays.asList(
                new RestMcuLineNotify(RestMcuLineNotifyCondition.INF_OR_EQUAL, 1f), new RestMcuLineNotify(
                        RestMcuLineNotifyCondition.SUP_OR_EQUAL, 1f));
        value.setNotifies(asList);

        restmcu.getLineResource().setLineSettings(8, value);

        List<RestMcuLineNotify> notifies = restmcu.getLineResource().getLineSettings(8).getNotifies();
        assertEquals(2, notifies.size());
View Full Code Here

        assertEquals(asList.get(1), notifies.get(1));
    }

    @Test
    public void should_update_notify2() throws Exception {
        RestMcuLineSettings value = new RestMcuLineSettings();
        List<RestMcuLineNotify> asList = Arrays.asList(
                new RestMcuLineNotify(RestMcuLineNotifyCondition.INF_OR_EQUAL, 0f), new RestMcuLineNotify(
                        RestMcuLineNotifyCondition.SUP_OR_EQUAL, 0f));
        value.setNotifies(asList);

        restmcu.getLineResource().setLineSettings(8, value);

        List<RestMcuLineNotify> notifies = restmcu.getLineResource().getLineSettings(8).getNotifies();
        assertEquals(2, notifies.size());
View Full Code Here

        assertEquals(asList.get(1), notifies.get(1));
    }

    @Test
    public void should_update_notify3() throws Exception {
        RestMcuLineSettings value = new RestMcuLineSettings();
        // its duplicated but should not be a problem for the controller as it will notify only once
        List<RestMcuLineNotify> asList = Arrays.asList(
                new RestMcuLineNotify(RestMcuLineNotifyCondition.INF_OR_EQUAL, 0f), //
                new RestMcuLineNotify(RestMcuLineNotifyCondition.SUP_OR_EQUAL, 0f), //
                new RestMcuLineNotify(RestMcuLineNotifyCondition.INF_OR_EQUAL, 0f), //
                new RestMcuLineNotify(RestMcuLineNotifyCondition.SUP_OR_EQUAL, 0f));
        value.setNotifies(asList);

        restmcu.getLineResource().setLineSettings(8, value);

        List<RestMcuLineNotify> notifies = restmcu.getLineResource().getLineSettings(8).getNotifies();
        assertEquals(4, notifies.size());
View Full Code Here

        assertEquals(asList.get(3), notifies.get(3));
    }

    @Test
    public void should_flush_notifies() throws Exception {
        RestMcuLineSettings value = new RestMcuLineSettings();
        value.setNotifies(new ArrayList<RestMcuLineNotify>());

        restmcu.getLineResource().setLineSettings(8, value);

        List<RestMcuLineNotify> notifies = restmcu.getLineResource().getLineSettings(8).getNotifies();
        assertEquals(0, notifies.size());
View Full Code Here

TOP

Related Classes of org.housecream.restmcu.api.domain.line.RestMcuLineSettings

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.