Skip to content

Freebird Events

simen edited this page May 10, 2017 · 12 revisions

System Ready and Error

  • 'ready'                                  Emitted when freebird is ready.
  • 'error'                                   Emitted when error occurs.

Network Notifications

  • 'ncEnabled'                           Emitted when a netcore is enabled.
  • 'ncDisabled'                          Emitted when a netcore is disabled.
  • 'ncStarted'                            Emitted when a netcore is started.
  • 'ncStopped'                          Emitted when a netcore is stopped.
  • 'ncPermitJoin'                       Emitted when a netcore is (dis)allowing devices joining.

Device Notifications

  • 'devIncoming'                       Emitted when a new device is incoming.
  • 'devLeaving'                          Emitted when a device is leaving.
  • 'devReporting'                      Emitted when a report message of device attribute(s) is coming.
  • 'devNetChanged'                  Emitted when network information of a device has changed.
  • 'devStatusChanged'              Emitted when status of a device has changed.
  • 'devPropsChanged'               Emitted when meta-property(ies) of a device has changed.
  • 'devAttrsChanged'                Emitted when attribute(s) on a device has changed.

Gadget Notifications

  • 'gadIncoming'                       Emitted when a new gadget is incoming.
  • 'gadLeaving'                          Emitted when a gadget is leaving.
  • 'gadReporting'                      Emitted when a report message of gadget attribute(s) is coming.
  • 'gadPanelChanged'               Emitted when panel information of a gadget has changed.
  • 'gadPropsChanged'              Emitted when meta-property(ies) of a gadget has changed.
  • 'gadAttrsChanged'                Emitted when attribue(s) on a gadget has changed.

Banned Activities

  • 'bannedDevIncoming'           Emitted when a banned device is trying to join the network.
  • 'bannedDevReporting'          Emitted when a banned device is trying to report its attributes.
  • 'bannedGadIncoming'          Emitted when a banned gadget is trying to join the network.
  • 'bannedGadReporting'         Emitted when a banned gadget is trying to report its attributes.



Event: 'ready'

Emitted when freebird is ready.

Listener: function (msg) {}

freebird.on('ready', function (msg) {
    // ...
});

Listener Arguments:

  1. msg (Object): { netcore: 'mqtt-core' }



Event: 'error'

Emitted when freebird error occurs.

Listener: function (err) {}

freebird.on('error', function (err) {
    // ...
});

Listener Arguments:

  1. err (Object): An error object



Event: 'ncEnabled'

Emitted when a netcore is enabled.

Listener: function (msg) {}

freebird.on('ncEnabled', function (msg) {
    // ...
});

Listener Arguments:

  1. msg (Object): { ncName: 'mqtt-core' }



Event: 'ncDisabled'

Emitted when a netcore is disabled.

Listener: function (msg) {}

freebird.on('ncDisabled', function (msg) {
    // ...
});

Listener Arguments:

  1. msg (Object): { ncName: 'mqtt-core' }



Event: 'ncStarted'

Emitted when a netcore is started.

Listener: function (msg) {}

freebird.on('ncStarted', function (msg) {
    // ...
});

Listener Arguments:

  1. msg (Object): { ncName: 'mqtt-core' }



Event: 'ncStopped'

Emitted when a netcore is stopped.

Listener: function (msg) {}

freebird.on('ncStopped', function (msg) {
    // ...
});

Listener Arguments:

  1. msg (Object): { ncName: 'mqtt-core' }



Event: 'ncPermitJoin'

Emitted when a netcore is now allowing or disallowing devices to join the network, where timeLeft is number of seconds left to allow devices to join the network.

Listener: function (msg) {}

freebird.on('ncPermitJoin', function (msg) {
    // ...
});

Listener Arguments:

  1. msg (Object): { ncName: 'mqtt-core', timeLeft: 60 }



Event: 'devIncoming'

Emitted when a new device is incoming.

Listener: function (msg) {}

freebird.on('devIncoming', function (msg) {
    // ...
});

Listener Arguments:

  1. msg (Object): { ncName: 'mqtt-core', permAddr: '00:0c:29:ff:ed:7c', id: 5, device: device }



Event: 'devLeaving'

Emitted when a device is leaving.

Listener: function (msg) {}

freebird.on('devIncoming', function (msg) {
    // ...
});

Listener Arguments:

  1. msg (Object): { ncName: 'mqtt-core', permAddr: '00:0c:29:ff:ed:7c', id: 5 }



Event: 'devReporting'

Emitted when a report message of certain attribute(s) on a device is coming. data property is partial changes of devAttrsObj

Listener: function (msg) {}

freebird.on('devReporting', function (msg) {
    // ...
});

Listener Arguments:

  1. msg (Object): { ncName: 'mqtt-core', permAddr: '00:0c:29:ff:ed:7c', id: 5, data: devAttrs }



Event: 'devNetChanged'

Emitted when network information of a device has changed. data property is partial changes of netInfoObj, _data property is the old netInfoObj value that before changed.

Listener: function (msg) {}

freebird.on('devNetChanged', function (msg) {
    // ...
});

Listener Arguments:

  1. msg (Object): { ncName: 'mqtt-core', permAddr: '00:0c:29:ff:ed:7c', id: 5, data: netInfoObj, _data: oldValue }



Event: 'devStatusChanged'

Emitted when status of a device has changed. The status can be 'online', 'sleep', 'offline', and 'unknown'.

Listener: function (msg) {}

freebird.on('devStatusChanged', function (msg) {
    // ...
});

Listener Arguments:

  1. msg (Object): { ncName: 'mqtt-core', permAddr: '00:0c:29:ff:ed:7c', id: 5, data: 'offline' }



Event: 'devPropsChanged'

Emitted when meta-property(ies) of a device has changed. data property is partial changes of devPropsObj, _data property is the old devPropsObj value that before changed.

Listener: function (msg) {}

freebird.on('devPropsChanged', function (msg) {
    // ...
});

Listener Arguments:

  1. msg (Object): { ncName: 'mqtt-core', permAddr: '00:0c:29:ff:ed:7c', id: 5, data: delta, _data: oldValue }



Event: 'devAttrsChanged'

Emitted when attribute(s) on a device has changed. data property is partial changes of devAttrsObj, _data property is the old devAttrsObj value that before changed.

Listener: function (msg) {}

freebird.on('devAttrsChanged', function (msg) {
    // ...
});

Listener Arguments:

  1. msg (Object): { ncName: 'mqtt-core', permAddr: '00:0c:29:ff:ed:7c', id: 5, data: delta, _data: oldValue }



Event: 'gadIncoming'

Emitted when a new gadget is incoming.

Listener: function (msg) {}

freebird.on('gadIncoming', function (msg) {
    // ...
});

Listener Arguments:

  1. msg (Object): { ncName: 'mqtt-core', permAddr: '00:0c:29:ff:ed:7c', auxId: 'magnetometer/0', id: 5, gadget: gadget }



Event: 'gadLeaving'

Emitted when a gadget is leaving.

Listener: function (msg) {}

freebird.on('gadLeaving', function (msg) {
    // ...
});

Listener Arguments:

  1. msg (Object): { ncName: 'mqtt-core', permAddr: '00:0c:29:ff:ed:7c', auxId: 'magnetometer/0', id: 5 }



Event: 'gadReporting'

Emitted when a report message of certain attribute(s) on a gadget is coming. data property is partial changes of gadAttrsObj.

Listener: function (msg) {}

freebird.on('gadReporting', function (msg) {
    // ...
});

Listener Arguments:

  1. msg (Object): { ncName: 'mqtt-core', permAddr: '00:0c:29:ff:ed:7c', auxId: 'magnetometer/0', id: 5, data: delta }



Event: 'gadPanelChanged'

Emitted when panel information of a gadget has changed. data property is partial changes of panelInfoObj, _data property is the old panelInfoObj value that before changed.

Listener: function (msg) {}

freebird.on('gadPanelChanged', function (msg) {
    // ...
});

Listener Arguments:

  1. msg (Object): { ncName: 'mqtt-core', permAddr: '00:0c:29:ff:ed:7c', auxId: 'magnetometer/0', id: 5, data: delta, _delta: oldVal }



Event: 'gadPropsChanged'

Emitted when meta-property(ies) of a gadget has changed. data property is partial changes of gadPropsObj, _data property is the old gadPropsObj value that before changed.

Listener: function (msg) {}

freebird.on('gadPropsChanged', function (msg) {
    // ...
});

Listener Arguments:

  1. msg (Object): { ncName: 'mqtt-core', permAddr: '00:0c:29:ff:ed:7c', auxId: 'magnetometer/0', id: 5, data: delta, _delta: oldVal }



Event: 'gadAttrsChanged'

Emitted when attribue(s) on a gadget has changed. data property is partial changes of gadAttrsObj, _data property is the old gadAttrsObj value that before changed.

Listener: function (msg) {}

freebird.on('gadAttrsChanged', function (msg) {
    // ...
});

Listener Arguments:

  1. msg (Object): { ncName: 'mqtt-core', permAddr: '00:0c:29:ff:ed:7c', auxId: 'magnetometer/0', id: 5, data: delta }



Event: 'bannedDevIncoming'

Emitted when a banned device is trying to join the network.

Listener: function (msg) {}

freebird.on('bannedDevIncoming', function (msg) {
    // ...
});

Listener Arguments:

  1. msg (Object): { ncName: 'mqtt-core', permAddr: '00:0c:29:ff:ed:7c' }



Event: 'bannedDevReporting'

Emitted when a banned device is trying to report its attributes.

Listener: function (msg) {}

freebird.on('bannedDevReporting', function (msg) {
    // ...
});

Listener Arguments:

  1. msg (Object): { ncName: 'mqtt-core', permAddr: '00:0c:29:ff:ed:7c' }



Event: 'bannedGadIncoming'

Emitted when a banned gadget is trying to join the network.

Listener: function (msg) {}

freebird.on('bannedGadIncoming', function (msg) {
    // ...
});

Listener Arguments:

  1. msg (Object): { ncName: 'mqtt-core', permAddr: '00:0c:29:ff:ed:7c', auxId: 'magnetometer/0' }



Event: 'bannedGadReporting'

Emitted when a banned gadget is trying to report its attributes.

Listener: function (msg) {}

freebird.on('bannedGadReporting', function (msg) {
    // ...
});

Listener Arguments:

  1. msg (Object): { ncName: 'mqtt-core', permAddr: '00:0c:29:ff:ed:7c', auxId: 'magnetometer/0' }