Examples of DeviceGroup


Examples of com.day.cq.wcm.mobile.api.device.DeviceGroup

  @Override
  public int doStartTag() throws JspTagException {
    if (isRender()) {
      try {
        final DeviceGroup deviceGroup = getRequest().adaptTo(DeviceGroup.class);
        if (null != deviceGroup) {
          deviceGroup.drawHead(pageContext);
        }
      } catch (Exception e) {
        // fail safe
        logger.error("Unexpected exception occured", e);
      }
View Full Code Here

Examples of de.mnl.srcpd4cu.srcp.DeviceGroup

    @Override
    public Response execute(SessionDevice session, String arguments) {
        try {
            List<String> args
                = new ArrayList<String>(Arrays.asList(arguments.split(" ")));
            DeviceGroup deviceGroup
                = CommandUtil.findDeviceGroup(session, args);
            if (!deviceGroup.getSupportedDeviceTypes()
                .contains(GettableDevice.class)) {
                throw new CommandExecutionException(ERROR_FORBIDDEN);
            }
            Device device;
            if (deviceGroup instanceof SingleDeviceGroup) {
                device = ((SingleDeviceGroup)deviceGroup).getDevice();
            } else {
                long address = CommandUtil.consumeNumber(args);
                device = deviceGroup.getDevice(address);
                if (device == null) {
                    if (!deviceGroup.allowImplicitCreation()) {
                        throw new CommandExecutionException
                            (Command.ERROR_UNSUPPORTED_DEVICE);
                    }
                    device = deviceGroup.createDevice(address);
                    if (!(device instanceof InitializableDevice)
                        || !(device instanceof GettableDevice)) {
                        throw new CommandExecutionException
                            (Command.ERROR_UNSUPPORTED_DEVICE);
                    }
View Full Code Here

Examples of de.mnl.srcpd4cu.srcp.DeviceGroup

    @Override
    public Response execute(SessionDevice session, String arguments) {
        try {
            List<String> args
                = new ArrayList<String>(Arrays.asList(arguments.split(" ")));
            DeviceGroup deviceGroup
                = CommandUtil.findDeviceGroup(session, args);
            if (!deviceGroup.getSupportedDeviceTypes()
                .contains(SettableDevice.class)) {
                throw new CommandExecutionException(ERROR_FORBIDDEN);
            }
            Device device;
            if (deviceGroup instanceof SingleDeviceGroup) {
                device = ((SingleDeviceGroup)deviceGroup).getDevice();
            } else {
                long address = CommandUtil.consumeNumber(args);
                device = deviceGroup.getDevice(address);
                if (device == null) {
                    if (!deviceGroup.allowImplicitCreation()) {
                        throw new CommandExecutionException
                            (Command.ERROR_UNSUPPORTED_DEVICE);
                    }
                    device = deviceGroup.createDevice(address);
                    if (!(device instanceof InitializableDevice)
                        || !(device instanceof SettableDevice)) {
                        throw new CommandExecutionException
                            (Command.ERROR_UNSUPPORTED_DEVICE);
                    }
View Full Code Here

Examples of de.mnl.srcpd4cu.srcp.DeviceGroup

    @Override
    public Response execute(SessionDevice session, String arguments) {
        try {
            List<String> args
                = new ArrayList<String>(Arrays.asList(arguments.split(" ")));
            DeviceGroup deviceGroup
                = CommandUtil.findDeviceGroup(session, args);
            if (!deviceGroup.getSupportedDeviceTypes()
                .contains(InitializableDevice.class)) {
                throw new CommandExecutionException(ERROR_FORBIDDEN);
            }
            Device device;
            if (deviceGroup instanceof SingleDeviceGroup) {
                device = ((SingleDeviceGroup)deviceGroup).getDevice();
            } else {
                long address = CommandUtil.consumeNumber(args);
                device = deviceGroup.getDevice(address);
                if (device == null) {
                    device = deviceGroup.createDevice(address);
                    device.addStateChangeListener(session.getServer());
                }
            }
            if (!(device instanceof InitializableDevice)) {
                return ERROR_NOT_SUPPORTED;
View Full Code Here

Examples of de.mnl.srcpd4cu.srcp.DeviceGroup

        try {
            if (bus == null) {
                bus = findBus(session, ids.get(0));
                ids.remove(0);
            }
            DeviceGroup deviceGroup = bus.getDeviceGroup(ids.get(0));
            if (deviceGroup == null) {
                throw new CommandExecutionException
                    (Command.ERROR_UNSUPPORTED_DEVICE_GROUP);
            }
            ids.remove(0);
View Full Code Here

Examples of de.mnl.srcpd4cu.srcp.DeviceGroup

        (SessionDevice session, Bus bus, List<String> ids,
         boolean sessionMayBeDefault)
        throws CommandExecutionException {
        List<String> idsCopy = new ArrayList<String>(ids);
        try {
            DeviceGroup deviceGroup
                = CommandUtil.findDeviceGroup(session, bus, ids);
            Device device = null;
            if (deviceGroup instanceof SingleDeviceGroup) {
                return ((SingleDeviceGroup) deviceGroup).getDevice();
            }
            // Special case: although devices have addresses and therefore
            // an address must be specified, the address may be omitted
            // if session can be used as default.
            if (ids.size() == 0) {
                if (sessionMayBeDefault
                    && deviceGroup.getName().equals("SESSION")) {
                    device = session;
                } else {
                    throw new CommandExecutionException
                        (Command.ERROR_LIST_TOO_SHORT);
                }
            }
            // Device may be known already if default session was addressed.
            if (device == null) {
                device = deviceGroup.getDevice(consumeNumber(ids));
            }
            if (device == null) {
                throw new CommandExecutionException
                    (Command.ERROR_UNSUPPORTED_DEVICE);
            }
View Full Code Here

Examples of de.mnl.srcpd4cu.srcp.DeviceGroup

        // create device group SERVER and bus 0 on construction
        super(DefaultDeviceGroup.newServerGroup(new DefaultBus(0)));
        buses.add(getDeviceGroup().getBus());
        addStateChangeListener(this);
        // device group DESCRIPTION
        DeviceGroup dg = DefaultDeviceGroup
            .newDescriptionDeviceGroup(buses.get(0));
        new DescriptionDevice(dg);
        // device group SESSION
        sessionDevGroup = DefaultDeviceGroup.newSessionGroup(buses.get(0));
View Full Code Here

Examples of de.mnl.srcpd4cu.srcp.DeviceGroup

        }

        private void pollState() throws InterruptedException {
            ((EcPowerDevice)((SingleDeviceGroup)buses[0]
                .getDeviceGroup("POWER")).getDevice()).pollState();
            DeviceGroup locos = buses[0].getDeviceGroup("GL");
            for (Device loco : locos.getDevices()) {
                ((EcGenericLocoDevice)loco).pollState();
            }
        }
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.