Search in sources :

Example 21 with ActionInvocation

use of org.teleal.cling.model.action.ActionInvocation in project openhab1-addons by openhab.

the class SonosZonePlayer method next.

public boolean next() {
    if (isConfigured()) {
        Service service = device.findService(new UDAServiceId("AVTransport"));
        Action action = service.getAction("Next");
        ActionInvocation invocation = new ActionInvocation(action);
        executeActionInvocation(invocation);
        return true;
    } else {
        return false;
    }
}
Also used : Action(org.teleal.cling.model.meta.Action) ActionInvocation(org.teleal.cling.model.action.ActionInvocation) Service(org.teleal.cling.model.meta.Service) UpnpService(org.teleal.cling.UpnpService) UDAServiceId(org.teleal.cling.model.types.UDAServiceId)

Example 22 with ActionInvocation

use of org.teleal.cling.model.action.ActionInvocation in project openhab1-addons by openhab.

the class SonosZonePlayer method updateCurrentZoneName.

public boolean updateCurrentZoneName() {
    if (isConfigured()) {
        Service service = device.findService(new UDAServiceId("DeviceProperties"));
        Action action = service.getAction("GetZoneAttributes");
        ActionInvocation invocation = new ActionInvocation(action);
        executeActionInvocation(invocation);
        return true;
    } else {
        return false;
    }
}
Also used : Action(org.teleal.cling.model.meta.Action) ActionInvocation(org.teleal.cling.model.action.ActionInvocation) Service(org.teleal.cling.model.meta.Service) UpnpService(org.teleal.cling.UpnpService) UDAServiceId(org.teleal.cling.model.types.UDAServiceId)

Example 23 with ActionInvocation

use of org.teleal.cling.model.action.ActionInvocation in project openhab1-addons by openhab.

the class SonosZonePlayer method becomeStandAlonePlayer.

public boolean becomeStandAlonePlayer() {
    if (isConfigured()) {
        Service service = device.findService(new UDAServiceId("AVTransport"));
        Action action = service.getAction("BecomeCoordinatorOfStandaloneGroup");
        ActionInvocation invocation = new ActionInvocation(action);
        executeActionInvocation(invocation);
        return true;
    } else {
        return false;
    }
}
Also used : Action(org.teleal.cling.model.meta.Action) ActionInvocation(org.teleal.cling.model.action.ActionInvocation) Service(org.teleal.cling.model.meta.Service) UpnpService(org.teleal.cling.UpnpService) UDAServiceId(org.teleal.cling.model.types.UDAServiceId)

Example 24 with ActionInvocation

use of org.teleal.cling.model.action.ActionInvocation in project openhab1-addons by openhab.

the class SonosZonePlayer method saveQueue.

public boolean saveQueue(String name, String queueID) {
    if (name != null && queueID != null && isConfigured()) {
        Service service = device.findService(new UDAServiceId("AVTransport"));
        Action action = service.getAction("SaveQueue");
        ActionInvocation invocation = new ActionInvocation(action);
        try {
            invocation.setInput("Title", name);
            invocation.setInput("ObjectID", queueID);
        } catch (InvalidValueException ex) {
            logger.error("Action Invalid Value Exception {}", ex.getMessage());
        } catch (NumberFormatException ex) {
            logger.error("Action Invalid Value Format Exception {}", ex.getMessage());
        }
        executeActionInvocation(invocation);
        return true;
    } else {
        return false;
    }
}
Also used : InvalidValueException(org.teleal.cling.model.types.InvalidValueException) Action(org.teleal.cling.model.meta.Action) ActionInvocation(org.teleal.cling.model.action.ActionInvocation) Service(org.teleal.cling.model.meta.Service) UpnpService(org.teleal.cling.UpnpService) UDAServiceId(org.teleal.cling.model.types.UDAServiceId)

Example 25 with ActionInvocation

use of org.teleal.cling.model.action.ActionInvocation in project openhab1-addons by openhab.

the class SonosZonePlayer method addURIToQueue.

public boolean addURIToQueue(String URI, String meta, int desiredFirstTrack, boolean enqueueAsNext) {
    if (isConfigured() && URI != null && meta != null) {
        Service service = device.findService(new UDAServiceId("AVTransport"));
        Action action = service.getAction("AddURIToQueue");
        ActionInvocation invocation = new ActionInvocation(action);
        try {
            invocation.setInput("InstanceID", "0");
            invocation.setInput("EnqueuedURI", URI);
            invocation.setInput("EnqueuedURIMetaData", meta);
            invocation.setInput("DesiredFirstTrackNumberEnqueued", new UnsignedIntegerFourBytes(desiredFirstTrack));
            invocation.setInput("EnqueueAsNext", enqueueAsNext);
        } catch (InvalidValueException ex) {
            logger.error("Action Invalid Value Exception {}", ex.getMessage());
        } catch (NumberFormatException ex) {
            logger.error("Action Invalid Value Format Exception {}", ex.getMessage());
        }
        executeActionInvocation(invocation);
        return true;
    }
    return false;
}
Also used : InvalidValueException(org.teleal.cling.model.types.InvalidValueException) Action(org.teleal.cling.model.meta.Action) UnsignedIntegerFourBytes(org.teleal.cling.model.types.UnsignedIntegerFourBytes) ActionInvocation(org.teleal.cling.model.action.ActionInvocation) Service(org.teleal.cling.model.meta.Service) UpnpService(org.teleal.cling.UpnpService) UDAServiceId(org.teleal.cling.model.types.UDAServiceId)

Aggregations

UpnpService (org.teleal.cling.UpnpService)25 ActionInvocation (org.teleal.cling.model.action.ActionInvocation)25 Action (org.teleal.cling.model.meta.Action)25 Service (org.teleal.cling.model.meta.Service)25 UDAServiceId (org.teleal.cling.model.types.UDAServiceId)25 InvalidValueException (org.teleal.cling.model.types.InvalidValueException)12 PeriodFormatter (org.joda.time.format.PeriodFormatter)2 PeriodFormatterBuilder (org.joda.time.format.PeriodFormatterBuilder)2 UnsignedIntegerFourBytes (org.teleal.cling.model.types.UnsignedIntegerFourBytes)2 SAXException (org.xml.sax.SAXException)2 Period (org.joda.time.Period)1 DateTimeFormatter (org.joda.time.format.DateTimeFormatter)1 ActionCallback (org.teleal.cling.controlpoint.ActionCallback)1 StateVariable (org.teleal.cling.model.meta.StateVariable)1 StateVariableTypeDetails (org.teleal.cling.model.meta.StateVariableTypeDetails)1 StateVariableValue (org.teleal.cling.model.state.StateVariableValue)1