@Override
public void packetReceived(EventObject event, byte[] packet) {
try {
RFXComMessageInterface obj = RFXComMessageFactory.getMessageInterface(packet);
if (obj instanceof RFXComTransmitterMessage) {
RFXComTransmitterMessage resp = (RFXComTransmitterMessage) obj;
if (resp.seqNbr == getSeqNumber()) {
logger.debug("Transmitter response received:\n{}",
obj.toString());
setResponseMessage(resp);
synchronized (notifierObject) {
notifierObject.notify();
}
}
} else {
String id2 = obj.generateDeviceId();
List<RFXComValueSelector> supportedValueSelectors = obj
.getSupportedValueSelectors();
if (supportedValueSelectors != null) {
for (RFXComBindingProvider provider : providers) {
for (String itemName : provider.getItemNames()) {
String id1 = provider.getId(itemName);
boolean inBinding = provider.isInBinding(itemName);
if (id1.equals(id2) && inBinding) {
RFXComValueSelector valueSelector = provider
.getValueSelector(itemName);
if (supportedValueSelectors.contains(valueSelector)) {
try {
State value = obj.convertToState(valueSelector);
eventPublisher.postUpdate(itemName, value);
} catch (RFXComException e) {
logger.warn( "Data conversion error", e);
}
}