-
Notifications
You must be signed in to change notification settings - Fork 36
DAL REST mapping
ivangrimaldi edited this page Jun 17, 2014
·
1 revision
##Getting devices list HTTP request:
GET http://localhost/devices/${device_uid}
Implementation in OSGi
final ServiceReference[] deviceSRefs = context.getServiceReferences(
Device.class.getName(),
'(' + Device.SERVICE_UID '=' + device_uid + ')');
if (null == deviceSRefs) {
return; // no such services
}
for (int i = 0; i < deviceSRefs.length; i++) {
printDevice(deviceSRefs[i]);
}
##Getting a device functions
HTTP request:
GET http://localhost/devices/${device_uid}/functions
Implementation in OSGi
final ServiceReference[] functionsRefs = context.getServiceReferences(
Function.class.getName(),
'(' + Function.SERVICE_DEVICE_UID '=' + device_uid + ')');
if (null == functionsRefs) {
return; // no such services
}
for (int i = 0; i < functionsRefs.length; i++) {
printFunction(functionsRefs[i]);
}