use of org.apache.felix.upnp.basedriver.importer.core.event.message.StateChanged in project felix by apache.
the class MyCtrlPoint method newEventArrived.
/*
* (non-Javadoc)
*
* @see org.apache.felix.upnpbase.importer.MyEventListener#newEventArrived(java.lang.String,
* long, java.util.Dictionary)
*/
public void newEventArrived(String uuid, long seq, PropertyList props) {
Activator.logger.DEBUG("[Importer] newEventArrived");
Service service = serviceFromSid(uuid);
if (service != null) {
int size = props.size();
Hashtable hash = new Hashtable();
for (int i = 0; i < size; i++) {
Property prop = props.getProperty(i);
String varName = prop.getName();
String varValue = prop.getValue();
String upnpType = service.getStateVariable(varName).getDataType();
Object valueObj;
try {
valueObj = Converter.parseString(varValue, upnpType);
} catch (Exception e) {
Activator.logger.ERROR("[Importer] Bad data value in Notify event: " + "var name=" + varName + " value=" + varValue + " type=" + upnpType + "\n" + e);
return;
}
hash.put(varName, valueObj);
}
Device device = service.getDevice();
StateChanged msg = new StateChanged(uuid, seq, hash, device, service);
notifierQueue.enqueue(msg);
}
}
use of org.apache.felix.upnp.basedriver.importer.core.event.message.StateChanged in project felix by apache.
the class Notifier method run.
public void run() {
while (running) {
StateChanged msg = (StateChanged) notifierQueue.dequeue();
if (running) {
StateVarsToNotify vars = null;
if (msg.getSeq() == 0) {
vars = new StateVarsToNotify(msg);
monitor.putStateVars(msg.getSid(), vars);
} else {
monitor.updateStateVars(msg.getSid(), msg.getDictionary());
}
}
}
}
Aggregations