... | ... | @@ -150,22 +150,78 @@ Here is a List of implemented EEP packets and devices |
|
|
## How to add a new Device/ EEP Packet
|
|
|
|
|
|
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 data. All EEP are described in this PDF <http://www.enocean-alliance.org/eep/>.
|
|
|
To add a new EEP a new class must be created in the Package `eep`. This class inherits from `EEPRadioPacket.java`.
|
|
|
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.
|
|
|
|
|
|
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 DTO's, stores the actual data and can send new EnOcean Messages to the device.
|
|
|
To send a EnOcean Message to a device the ResponseRadioPacket is implemented (as new EnOcean Message).
|
|
|
Here is an example of the strcutre and methods of such a implementation
|
|
|
```java
|
|
|
public class D5_00_01Device extends EEPRadioPacket {
|
|
|
/** TAG */
|
|
|
public static final String TAG = D5_00_01Device.class.getName();
|
|
|
|
|
|
private boolean closed;
|
|
|
|
|
|
public D5_00_01Device(EnOceanMessage enOceanMsg) {
|
|
|
super(enOceanMsg);
|
|
|
newRadioPacketReceived(enOceanMsg);
|
|
|
|
|
|
}
|
|
|
|
|
|
public D5_00_01Device(String enostarID, String enoceanID) {
|
|
|
super(enostarID, enoceanID);
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* @param enOceanMsg get a EnOceanMEssage
|
|
|
*/
|
|
|
public void newRadioPacketReceived(EnOceanMessage enOceanMsg) {
|
|
|
super.newRadioPacketReceived(enOceanMsg);
|
|
|
|
|
|
// Check if it is no teach in
|
|
|
if ((getUserDataPayload()[0] & 0x08) == 8) {
|
|
|
if ((getUserDataPayload()[0] & 0x01) == 1) {
|
|
|
closed = true;
|
|
|
} else {
|
|
|
closed = false;
|
|
|
}
|
|
|
|
|
|
}
|
|
|
Activator.getLog().log(LogService.LOG_DEBUG,"Closed: " + closed);
|
|
|
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public List<EnosarType> getAllEnosarTypesOfDevice() {
|
|
|
List<EnosarType> returnList = new ArrayList<EnosarType>();
|
|
|
SwitchDTO switchDTO = new SwitchDTO();
|
|
|
if (closed) {
|
|
|
switchDTO.setState(SwitchDTO.State.ON);
|
|
|
} else {
|
|
|
switchDTO.setState(SwitchDTO.State.OFF);
|
|
|
}
|
|
|
returnList.add(switchDTO);
|
|
|
return returnList;
|
|
|
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public List<EnOceanMessage> setStatusOrControlDevice(List<EnosarType> deviceDTO) {
|
|
|
return null; // Cannot send data to this device
|
|
|
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public String getEnosarDevice() {
|
|
|
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`.
|
|
|
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.
|
|
|
|
|
|
|
|
|
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. |
|
|
|
|
|
|
|
|
## How it works
|
|
|
An implemented Basedriver is connected to the serial interface of the EnOcean Pi. Over this implementation incoming messages are forwarded and handled. Outgoing messages
|
|
|
are sent over the serial interface.
|
|
|
All devices must have an entry in the Address Management. |
|
|
\ No newline at end of file |