use of org.cybergarage.upnp.event.Property 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.cybergarage.upnp.event.Property in project i2p.i2p by i2p.
the class ControlPoint method httpRequestRecieved.
public void httpRequestRecieved(HTTPRequest httpReq) {
if (Debug.isOn() == true)
httpReq.print();
// Thanks for Giordano Sassaroli <sassarol@cefriel.it> (09/08/03)
if (httpReq.isNotifyRequest() == true) {
NotifyRequest notifyReq = new NotifyRequest(httpReq);
String uuid = notifyReq.getSID();
long seq = notifyReq.getSEQ();
PropertyList props = notifyReq.getPropertyList();
int propCnt = props.size();
for (int n = 0; n < propCnt; n++) {
Property prop = props.getProperty(n);
String varName = prop.getName();
String varValue = prop.getValue();
performEventListener(uuid, seq, varName, varValue);
}
httpReq.returnOK();
return;
}
httpReq.returnBadRequest();
}
Aggregations