Overview
The purpose of the EEBUS SPINE Exporter is to:
API Details
The API allows to fully customize the device and its structure. This can be done in a very flexible way. There are four general levels of customization:
A feature can be removed by unregistering the corresponding OSGI service or any of its ancestors.
The four levels above are following the SPINE specification. Only the "SPINEDeviceAccessHandler" requires some explanation and showcasing. Here is an excerpt from the com.prosyst.mbs.spine.virtual-device-demo which implements the SPINEDeviceAccessHandler to get an instance of SpineDeviceAccess which is called deviceAccess. In the sample below the handler uses the deviceAccess to get all of the devices subscribed for changes in the Operation State and notifies them for any change:
void notifyOperationStateUpdated() {
List<FeatureAddressType> subscribers = deviceAccess.getSubscriptions(featureAddress);
CmdType cmdState = new CmdType();
cmdState.setDeviceDiagnosisStateData(getDeviceDiagnosisState());
PayloadType payload = new PayloadType();
payload.getCmd().add(cmdState);
for (FeatureAddressType addressDestination : subscribers) {
DatagramType stateDatagram = new DatagramType();
HeaderType header = new HeaderType();
header.setAddressSource(featureAddress);
header.setAddressDestination(addressDestination);
header.setAckRequest(null);
header.setCmdClassifier(CmdClassifierType.NOTIFY);
header.setSpecificationVersion(SPINEConstants.CURRENT_VERSION);
stateDatagram.setHeader(header);
stateDatagram.setPayload(payload);
SPINEDevice targetDevice = deviceAccess.getDevice(addressDestination.getDevice());
targetDevice.send(stateDatagram);
}
}
Request handling
When an incoming request comes the following verifications are performed:
For the cases when some of the components is missing the appropriate set of exceptions is prepared. Here is an example of a well defined function handler. It handles reading of DeviceClassificationManufacturerData and is part of the com.prosyst.mbs.spine.virtual-device-demo:
boolean isRequestSupported(FeatureAddressType sourceAddress, CmdClassifierType cmdClassifier, CmdType cmdRequest) {
return cmdClassifier == CmdClassifierType.READ && cmdRequest.getDeviceClassificationManufacturerData() != null;
}
CmdType handleReadRequest(FeatureAddressType sourceAddress, CmdType cmdRequest) {
CmdType cmdResponse = new CmdType();
cmdResponse.setDeviceClassificationManufacturerData(getManufacturerData());
return cmdResponse;
}
DeviceClassificationManufacturerDataType getManufacturerData() {
DeviceClassificationManufacturerDataType result = new DeviceClassificationManufacturerDataType();
result.setDeviceName("My Virtual Device");
result.setDeviceCode("My Virtual Device Code");
result.setSerialNumber("1234567890");
result.setSoftwareRevision("1.1.0");
result.setVendorName("Bosch.IO GmbH");
result.setBrandName("Bosch.IO");
return result;
}
As the isRequestSupported method shows this handler declares that it can handle only READ requests containing a DeviceClassificationManufacturerData element. After the verifications are performed and this handler is requested to process the request it provides the actual response through the handleReadRequest method. As it shows it just populates the DeviceClassificationManufacturerData with some hardcoded values because it has a demo purpose.
Virtual Devices and Destination List
The Exported devices are "visible" through the "DestinationList" function of the primary feature of the primary entity of the local device i.e. using the address of the machine where the SPINE module is running. For more information you can see "Chapter 7.2 Destination list" from the "EEBus SPINE Technical Specification - Protocol Specification".