Package org.fourthline.cling.support.lastchange

Examples of org.fourthline.cling.support.lastchange.LastChange


        throws Exception {

        // We don't use the service's internal LastChange but a fresh new one just for
        // this initial event. Modifying the internal one would trigger event notification's
        // to other subscribers!
        LastChange lc = new LastChange(getLastChangeParser());

        // Get the current "logical" instances of the service
        UnsignedIntegerFourBytes[] ids = getImplementation().getCurrentInstanceIds();
        if (ids == null) {
          log.warning("LenientChangeAwareService got a null ID from "
              + getImplementation().getClass().getCanonicalName());
            getImplementation().appendCurrentState(lc, new UnsignedIntegerFourBytes(0));
        } else {
          if (ids.length > 0) {
              for (UnsignedIntegerFourBytes instanceId : ids) {
                  // Iterate through all "logical" instances and ask them what their state is
                  getImplementation().appendCurrentState(lc, instanceId);
              }
          } else {
              // Use the default "logical" instance with ID 0
              getImplementation().appendCurrentState(lc, new UnsignedIntegerFourBytes(0));
          }
        }

        // Sum it all up and return it in the initial event to the GENA subscriber
        StateVariable variable = getService().getStateVariable("LastChange");
        Collection<StateVariableValue> values = new ArrayList();
        values.add(new StateVariableValue(variable, lc.toString()));
        return values;
    }
View Full Code Here

TOP

Related Classes of org.fourthline.cling.support.lastchange.LastChange

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.