... | @@ -150,7 +150,7 @@ Here is a List of implemented EEP packets and devices |
... | @@ -150,7 +150,7 @@ Here is a List of implemented EEP packets and devices |
|
## How to add a new Device/ EEP Packet
|
|
## How to add a new Device/ EEP Packet
|
|
|
|
|
|
In the manual of devices is a description called EnOcean Equipment Profile (EEP).
|
|
In the manual of devices is a description called EnOcean Equipment Profile (EEP).
|
|
This information is necessary to get the detailed information of the sent packet and data. All EEP are described in this PDF <http://www.enocean-alliance.org/eep/>. In this document you can find a description which byte stands for which data in the packet.
|
|
This information is necessary to get the detailed information of the sent packet and data. All EEP are described in this PDF <http://www.enocean-alliance.org/eep/>. This document contains the information which byte contains which data in the data packet.
|
|
|
|
|
|
To add a new EEP a new class must be created in the Package `org.enosar.service.io.enocean.eep`. This class inherits from `EEPRadioPacket.java`.
|
|
To add a new EEP a new class must be created in the Package `org.enosar.service.io.enocean.eep`. This class inherits from `EEPRadioPacket.java`.
|
|
The new class matches the incoming bytes to EnosarType DTO's. The class also handles sending new EnOcean Messages to the device and maps the EnosarType DTO's to a EnOceanMessage that can be sent to the EnOcean device. To send a EnOcean Message to a device the ResponseRadioPacket is implemented (as new EnOcean Message).
|
|
The new class matches the incoming bytes to EnosarType DTO's. The class also handles sending new EnOcean Messages to the device and maps the EnosarType DTO's to a EnOceanMessage that can be sent to the EnOcean device. To send a EnOcean Message to a device the ResponseRadioPacket is implemented (as new EnOcean Message).
|
... | @@ -178,6 +178,8 @@ public class D5_00_01Device extends EEPRadioPacket { |
... | @@ -178,6 +178,8 @@ public class D5_00_01Device extends EEPRadioPacket { |
|
* @param enOceanMsg get a EnOceanMEssage
|
|
* @param enOceanMsg get a EnOceanMEssage
|
|
*/
|
|
*/
|
|
public void newRadioPacketReceived(EnOceanMessage enOceanMsg) {
|
|
public void newRadioPacketReceived(EnOceanMessage enOceanMsg) {
|
|
|
|
//called when a new RadioPacket from a device received
|
|
|
|
//here the bytes should be mapped to private variables
|
|
super.newRadioPacketReceived(enOceanMsg);
|
|
super.newRadioPacketReceived(enOceanMsg);
|
|
|
|
|
|
// Check if it is no teach in
|
|
// Check if it is no teach in
|
... | @@ -195,6 +197,8 @@ public class D5_00_01Device extends EEPRadioPacket { |
... | @@ -195,6 +197,8 @@ public class D5_00_01Device extends EEPRadioPacket { |
|
|
|
|
|
@Override
|
|
@Override
|
|
public List<EnosarType> getAllEnosarTypesOfDevice() {
|
|
public List<EnosarType> getAllEnosarTypesOfDevice() {
|
|
|
|
//Called when the Service sends the publishes the data in the MessagingService
|
|
|
|
//here the private variables are Mapped to EnosarTypes DTO's
|
|
List<EnosarType> returnList = new ArrayList<EnosarType>();
|
|
List<EnosarType> returnList = new ArrayList<EnosarType>();
|
|
SwitchDTO switchDTO = new SwitchDTO();
|
|
SwitchDTO switchDTO = new SwitchDTO();
|
|
if (closed) {
|
|
if (closed) {
|
... | @@ -209,19 +213,31 @@ public class D5_00_01Device extends EEPRadioPacket { |
... | @@ -209,19 +213,31 @@ public class D5_00_01Device extends EEPRadioPacket { |
|
|
|
|
|
@Override
|
|
@Override
|
|
public List<EnOceanMessage> setStatusOrControlDevice(List<EnosarType> deviceDTO) {
|
|
public List<EnOceanMessage> setStatusOrControlDevice(List<EnosarType> deviceDTO) {
|
|
|
|
//called when data/controls from the CommunicatinService received and should be sent to a EnOcean device
|
|
|
|
//here EnOceanMessages are generated from the EnosarType DTO's that can be sent to the device
|
|
return null; // Cannot send data to this device
|
|
return null; // Cannot send data to this device
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public String getEnosarDevice() {
|
|
public String getEnosarDevice() {
|
|
|
|
//A identifier for the SmartHome device type
|
|
return EnosarDevice.CONTACT;
|
|
return EnosarDevice.CONTACT;
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
```
|
|
```
|
|
The new implemented class then must be added to a list of all implemented Devices in the Package `ìmpl` Class `DeviceHandler.java`.
|
|
The new implemented class then must be added to a list of all implemented Devices in the Package `org.enosar.service.io.enocean.impl` in the Class `DeviceHandler.java`.
|
|
There is a Map called `radioProtocols` e.g.: `radioProtocols.put("A50701", A5_07_01Device.class);` where the first String ("A50701") is the description of the packet which must be entered in the Address Management.
|
|
There is a Map called `radioProtocols` add there an entry for the packet/device as shown in the example below.
|
|
|
|
```java
|
|
|
|
/** A Map with all Implemented EEP Radio protocols to generate new instances */
|
|
|
|
private static final Map<String, Class<?>> radioProtocols;
|
|
|
|
static{
|
|
|
|
radioProtocols= new HashMap<String, Class<?>>();
|
|
|
|
radioProtocols.put("A50218", A5_02_18Device.class);
|
|
|
|
radioProtocols.put("A50401", A5_04_01Device.class);
|
|
|
|
}
|
|
|
|
```
|
|
|
|
The first string in the map is the identifier of the Packet Type that is used in the Address Management (see [Device and Address Management](#device)).
|
|
|
|
|
|
For an example see the code. `A5_04_01Device.java` is a simple one and `D2_01_08Device.java` is an example also a EnOcean Message is sent. |
|
For other examples of the implementation of packets/devices see the code. `A5_04_01Device.java` is a simple one and `D2_01_08Device.java` is an example that also can send EnOcean Messages. |