Пример #1
0
 /**
  * Returns the {@link SocketSession} for this {@link Bridge}. The default implementation is to
  * look in the parent {@link #getBridge()} for the {@link SocketSession}
  *
  * @return a {@link SocketSession} or null if none exists
  */
 @SuppressWarnings("rawtypes")
 public SocketSession getSocketSession() {
   final Bridge bridge = getBridge();
   if (bridge.getHandler() instanceof AbstractBridgeHandler) {
     return ((AbstractBridgeHandler) bridge.getHandler()).getSocketSession();
   }
   return null;
 }
Пример #2
0
  private synchronized MaxCubeBridgeHandler getMaxCubeBridgeHandler() {

    if (this.bridgeHandler == null) {
      Bridge bridge = getBridge();
      if (bridge == null) {
        logger.debug("Required bridge not defined for device {}.", maxDeviceSerial);
        return null;
      }
      ThingHandler handler = bridge.getHandler();
      if (handler instanceof MaxCubeBridgeHandler) {
        this.bridgeHandler = (MaxCubeBridgeHandler) handler;
        this.bridgeHandler.registerDeviceStatusListener(this);
        forceRefresh = true;
      } else {
        logger.debug(
            "No available bridge handler found for {} bridge {} .",
            maxDeviceSerial,
            bridge.getUID());
        return null;
      }
    }
    return this.bridgeHandler;
  }