/* (non-Javadoc)
  * @see tuwien.auto.calimero.link.event.LinkListener#indication
  * (tuwien.auto.calimero.FrameEvent)
  */
 public void indication(FrameEvent e) {
   assertNotNull(e);
   assertTrue(e instanceof MonitorFrameEvent);
   assertEquals(mon, e.getSource());
   ind = (CEMIBusMon) e.getFrame();
   raw = ((MonitorFrameEvent) e).getRawFrame();
   assertEquals(CEMIBusMon.MC_BUSMON_IND, ind.getMessageCode());
   System.out.println("indication");
   Debug.printMonData(ind);
   if (raw != null) Debug.printTP1Frame(lmon.raw);
 }
Пример #2
0
    public void frameReceived(final FrameEvent e) {
      try {
        final CEMI frame = e.getFrame();

        final CEMIBusMon mon;
        if (frame == null) mon = (CEMIBusMon) CEMIFactory.fromEmiBusmon(e.getFrameBytes());
        else if (frame instanceof CEMIBusMon) mon = (CEMIBusMon) frame;
        else {
          logger.warn(
              "received unsupported frame type with msg code 0x"
                  + Integer.toHexString(frame.getMessageCode()));
          return;
        }
        logger.trace("received monitor indication");
        final AbstractMonitor netmon = (AbstractMonitor) source;
        MonitorFrameEvent mfe = new MonitorFrameEvent(netmon, mon);
        if (decode) {
          try {
            final RawFrame rf =
                RawFrameFactory.create(netmon.medium.getMedium(), mon.getPayload(), 0, extBusmon);
            mfe = new MonitorFrameEvent(netmon, mon, rf);
          } catch (final KNXFormatException ex) {
            logger.error("decoding raw frame", ex);
            mfe = new MonitorFrameEvent(netmon, mon, ex);
            // workaround for PL, BCU might not have switched to ext. busmonitor
            if (extBusmon) {
              extBusmon = false;
              logger.warn("disable extended busmonitor mode, maybe this helps");
            }
          }
        }
        addEvent(new Indication(mfe));
      } catch (final KNXFormatException kfe) {
        logger.warn("unspecified frame event - ignored", kfe);
      } catch (final RuntimeException rte) {
        logger.warn("unspecified frame event - ignored", rte);
      }
    }