Package org.teleal.cling.model.action

Examples of org.teleal.cling.model.action.ActionInvocation


    if(isConfigured()) {

      Service service = device.findService(new UDAServiceId("AlarmClock"));
      Action action = service.getAction("ListAlarms");
      ActionInvocation invocation = new ActionInvocation(action);

      executeActionInvocation(invocation);

      try {
        sonosAlarms = SonosXMLParser.getAlarmsFromStringResult(invocation.getOutput("CurrentAlarmList").toString());
      } catch (SAXException e) {
        logger.error("Could not parse Alarms from String {}",invocation.getOutput("CurrentAlarmList").toString());
      }
    }

    return sonosAlarms;
  }
View Full Code Here


  public boolean updateAlarm(SonosAlarm alarm) {
    if(alarm != null && isConfigured()) {
      Service service = device.findService(new UDAServiceId("AlarmClock"));
      Action action = service.getAction("ListAlarms");
      ActionInvocation invocation = new ActionInvocation(action);


      DateTimeFormatter formatter = DateTimeFormat.forPattern("HH:mm:ss");

      PeriodFormatter pFormatter= new PeriodFormatterBuilder()
      .printZeroAlways()
      .appendHours()
      .appendSeparator(":")
      .appendMinutes()
      .appendSeparator(":")
      .appendSeconds()
      .toFormatter();


      try {
        invocation.setInput("ID",Integer.toString(alarm.getID()));
        invocation.setInput("StartLocalTime",formatter.print(alarm.getStartTime()));
        invocation.setInput("Duration",pFormatter.print(alarm.getDuration()));
        invocation.setInput("Recurrence",alarm.getRecurrence());
        invocation.setInput("RoomUUID",alarm.getRoomUUID());
        invocation.setInput("ProgramURI",alarm.getProgramURI());
        invocation.setInput("ProgramMetaData",alarm.getProgramMetaData());
        invocation.setInput("PlayMode",alarm.getPlayMode());
        invocation.setInput("Volume",Integer.toString(alarm.getVolume()));
        if(alarm.getIncludeLinkedZones()) {
          invocation.setInput("IncludeLinkedZones","1");
        } else {
          invocation.setInput("IncludeLinkedZones","0");
        }

        if(alarm.getEnabled()) {
          invocation.setInput("Enabled", "1");             
        } else {
          invocation.setInput("Enabled", "0");             
        }
      } catch (InvalidValueException ex) {
        logger.error("Action Invalid Value Exception {}",ex.getMessage());
      } catch (NumberFormatException ex) {
        logger.error("Action Invalid Value Format Exception {}",ex.getMessage())
View Full Code Here

  public boolean snoozeAlarm(int minutes){
    if(isAlarmRunning() && isConfigured()) {

      Service service = device.findService(new UDAServiceId("AVTransport"));
      Action action = service.getAction("SnoozeAlarm");
      ActionInvocation invocation = new ActionInvocation(action);

      Period snoozePeriod = Period.minutes(minutes);
      PeriodFormatter pFormatter= new PeriodFormatterBuilder()
      .printZeroAlways()
      .appendHours()
      .appendSeparator(":")
      .appendMinutes()
      .appendSeparator(":")
      .appendSeconds()
      .toFormatter();

      try {
        invocation.setInput("Duration",pFormatter.print(snoozePeriod));
      } catch (InvalidValueException ex) {
        logger.error("Action Invalid Value Exception {}",ex.getMessage());
      } catch (NumberFormatException ex) {
        logger.error("Action Invalid Value Format Exception {}",ex.getMessage())
      }
View Full Code Here

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

      return false;
    }

    Service service = device.findService(new UDAServiceId("AVTransport"));
    Action action = service.getAction("RemoveAllTracksFromQueue");
    ActionInvocation invocation = new ActionInvocation(action);

    try {
      invocation.setInput("InstanceID", "0");

    } catch (InvalidValueException ex) {
      logger.error("Action Invalid Value Exception {}", ex.getMessage());
    } catch (NumberFormatException ex) {
      logger.error("Action Invalid Value Format Exception {}",
View Full Code Here

TOP

Related Classes of org.teleal.cling.model.action.ActionInvocation

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.