Search in sources :

Example 1 with DSCAlarmEventListener

use of org.openhab.binding.dscalarm.internal.DSCAlarmEventListener in project openhab1-addons by openhab.

the class SerialConnector method handleIncomingMessage.

/**
     * Handles an incoming message
     * 
     * @param incomingMessage
     */
public synchronized void handleIncomingMessage(String incomingMessage) {
    APIMessage Message = new APIMessage(incomingMessage);
    logger.debug("handleIncomingMessage(): Message received: {} - {}", incomingMessage, Message.toString());
    DSCAlarmEvent event = new DSCAlarmEvent(this);
    event.dscAlarmEventMessage(Message);
    // send message to event listeners
    try {
        Iterator<DSCAlarmEventListener> iterator = _listeners.iterator();
        while (iterator.hasNext()) {
            ((DSCAlarmEventListener) iterator.next()).dscAlarmEventRecieved(event);
        }
    } catch (Exception e) {
        logger.error("handleIncomingMessage(): Event listener invoking error", e);
    }
}
Also used : DSCAlarmEventListener(org.openhab.binding.dscalarm.internal.DSCAlarmEventListener) APIMessage(org.openhab.binding.dscalarm.internal.protocol.APIMessage) DSCAlarmEvent(org.openhab.binding.dscalarm.internal.DSCAlarmEvent) TooManyListenersException(java.util.TooManyListenersException) PortInUseException(gnu.io.PortInUseException) UnsupportedCommOperationException(gnu.io.UnsupportedCommOperationException) IOException(java.io.IOException) NoSuchPortException(gnu.io.NoSuchPortException) UnsupportedEncodingException(java.io.UnsupportedEncodingException)

Example 2 with DSCAlarmEventListener

use of org.openhab.binding.dscalarm.internal.DSCAlarmEventListener in project openhab1-addons by openhab.

the class TCPConnector method handleIncomingMessage.

/**
     * Handles an incoming message
     *
     * @param incomingMessage
     */
public synchronized void handleIncomingMessage(String incomingMessage) {
    APIMessage Message = new APIMessage(incomingMessage);
    logger.debug("handleIncomingMessage(): Message received: {} - {}", incomingMessage, Message.toString());
    DSCAlarmEvent event = new DSCAlarmEvent(this);
    event.dscAlarmEventMessage(Message);
    // send message to event listeners
    try {
        Iterator<DSCAlarmEventListener> iterator = _listeners.iterator();
        while (iterator.hasNext()) {
            ((DSCAlarmEventListener) iterator.next()).dscAlarmEventRecieved(event);
        }
    } catch (Exception e) {
        logger.error("handleIncomingMessage(): Event listener invoking error", e);
    }
}
Also used : DSCAlarmEventListener(org.openhab.binding.dscalarm.internal.DSCAlarmEventListener) APIMessage(org.openhab.binding.dscalarm.internal.protocol.APIMessage) DSCAlarmEvent(org.openhab.binding.dscalarm.internal.DSCAlarmEvent) IOException(java.io.IOException) UnknownHostException(java.net.UnknownHostException) SocketException(java.net.SocketException)

Aggregations

IOException (java.io.IOException)2 DSCAlarmEvent (org.openhab.binding.dscalarm.internal.DSCAlarmEvent)2 DSCAlarmEventListener (org.openhab.binding.dscalarm.internal.DSCAlarmEventListener)2 APIMessage (org.openhab.binding.dscalarm.internal.protocol.APIMessage)2 NoSuchPortException (gnu.io.NoSuchPortException)1 PortInUseException (gnu.io.PortInUseException)1 UnsupportedCommOperationException (gnu.io.UnsupportedCommOperationException)1 UnsupportedEncodingException (java.io.UnsupportedEncodingException)1 SocketException (java.net.SocketException)1 UnknownHostException (java.net.UnknownHostException)1 TooManyListenersException (java.util.TooManyListenersException)1