Class BabelZigBeeDemo

java.lang.Object
pt.unl.fct.di.novasys.babel.core.GenericProtocol
pt.paradigmshift.iot.demos.BabelZigBeeDemo
All Implemented Interfaces:
BabelDemo

public class BabelZigBeeDemo extends pt.unl.fct.di.novasys.babel.core.GenericProtocol implements BabelDemo
Minimal ZigBee send/receive demo built on the ParadigmShift radio stack.

Like BabelLoRaDemo, the application code is radio-agnostic: it sends with a BroadcastRadioPacketRequest (an NWK-layer broadcast to all joined devices) addressed to ZigBeeProtocol.PROTOCOL_ID, and receives via the generic RadioPacketReceivedNotification. The only ZigBee-specific touch is the optional ZigBeePacketReceivedNotification down-cast used to print the packet id / value.

Two roles, selected by the constructor flag:

  • sender — broadcasts "ParadigmShift ZigBee #<n>" every few seconds. Note ZigBee broadcasts are unacknowledged: sleepy end devices that are not awake at that moment miss the frame;
  • receiver — only listens and prints frames arriving from joined end devices.

Runs only with an Ember (EZSP) ZigBee coordinator dongle attached over USB serial. The serial port is auto-discovered unless zigbee.serial.port is set. Developed by ParadigmShift, Lda.

Author:
ParadigmShift, Lda (info@paradigmshift.pt)
  • Nested Class Summary

    Nested classes/interfaces inherited from class pt.unl.fct.di.novasys.babel.core.GenericProtocol

    pt.unl.fct.di.novasys.babel.core.GenericProtocol.ProtocolMetricsBabelMetrics
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    Config key: seconds the network is left open for joining at startup.
    static final String
     
    static final String
    Config key: serial port of the EZSP dongle; empty ⇒ auto-discover.

    Fields inherited from class pt.unl.fct.di.novasys.babel.core.GenericProtocol

    babel, babelSecurity

    Fields inherited from interface pt.unl.fct.di.tardis.babel.iot.demos.BabelDemo

    PROTO_ID, PROTO_NAME
  • Constructor Summary

    Constructors
    Constructor
    Description
    BabelZigBeeDemo(boolean sender)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Builds and starts this demo's Babel runtime: obtain Babel.getInstance(), load config, instantiate and register the control/radio protocols the demo needs plus the demo itself, init(...) each in dependency order, and finally Babel.start() the event loop.
    void
     

    Methods inherited from class pt.unl.fct.di.novasys.babel.core.GenericProtocol

    addSecret, addSecret, addSecret, addSecret, cancelTimer, closeConnection, closeConnection, closeConnection, closeConnection, closeConnection, closeConnection, createChannel, createSecureChannel, createSecureChannel, createSecureChannel, createSecureChannelWithAliases, createSecureChannelWithAliases, createSecureChannelWithIdentities, createSecureChannelWithIdentities, createSecureChannelWithProtoIdentities, enableGenericMetrics, generateIdentity, generateIdentity, generateIdentity, generateIdentity, generateIdentity, generateIdentity, generateIdentity, generateSecret, generateSecret, generateSecret, generateSecret, generateSecretFromPassword, generateSecretFromPassword, generateSecretFromPassword, generateSecretFromPassword, getChannelOrThrow, getDefaultChannel, getDefaultProtoIdentity, getDefaultProtoIdentityCrypt, getDefaultProtoSecret, getMillisSinceBabelStart, getOrGenerateDefaultProtoIdentity, getProtoId, getProtoName, hasProtocolThreadStarted, openConnection, openConnection, openConnection, openConnection, registerChannelEventHandler, registerMessageHandler, registerMessageHandler, registerMessageHandler, registerMessageHandler, registerMessageHandler, registerMessageHandler, registerMessageHandler, registerMessageHandler, registerMessageHandler, registerMessageHandler, registerMessageHandler, registerMessageHandler, registerMessageHandler, registerMessageHandler, registerMessageHandler, registerMessageHandler, registerMessageHandler, registerMessageHandler, registerMessageSerializer, registerMetric, registerReplyHandler, registerRequestHandler, registerSharedChannel, registerTimerHandler, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendReply, sendRequest, setDefaultChannel, setDefaultProtoIdentity, setDefaultProtoIdentity, setDefaultProtoSecret, setupPeriodicTimer, setupTimer, startEventThread, subscribeNotification, triggerNotification, unsubscribeNotification

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • ZIGBEE_PORT

      public static final String ZIGBEE_PORT
      Config key: serial port of the EZSP dongle; empty ⇒ auto-discover.
      See Also:
    • ZIGBEE_PERMIT_JOIN

      public static final String ZIGBEE_PERMIT_JOIN
      Config key: seconds the network is left open for joining at startup.
      See Also:
    • ZIGBEE_PERMIT_JOIN_DEFAULT

      public static final String ZIGBEE_PERMIT_JOIN_DEFAULT
      See Also:
  • Constructor Details

    • BabelZigBeeDemo

      public BabelZigBeeDemo(boolean sender)
      Parameters:
      sender - true to broadcast periodically, false to run as a pure receiver
  • Method Details

    • init

      public void init(Properties props) throws pt.unl.fct.di.novasys.babel.exceptions.HandlerRegistrationException
      Specified by:
      init in class pt.unl.fct.di.novasys.babel.core.GenericProtocol
      Throws:
      pt.unl.fct.di.novasys.babel.exceptions.HandlerRegistrationException
    • execute

      public void execute() throws Exception
      Description copied from interface: BabelDemo
      Builds and starts this demo's Babel runtime: obtain Babel.getInstance(), load config, instantiate and register the control/radio protocols the demo needs plus the demo itself, init(...) each in dependency order, and finally Babel.start() the event loop. Main calls this once.
      Specified by:
      execute in interface BabelDemo
      Throws:
      Exception