1. SensorHub Events
onEvent("sensors.sample", function () {
//
});
onEvent("sensors.flush", function () {
//
});
sensors.sample
Fired when the SensorHub module is requesting all register modules to provide a sample. Each module should call sampleAdd
to send one or more measurements as a response to this event.
sensors.flush
Fired when the SensorHub has finished flushing the data to the uplink modules.
2. Uplink Events
onEvent("uplink.error", function () {
//
});
onEvent("uplink.done", function () {
//
});
onEvent("uplink.data", function (data) {
//
});
uplink.error
Fired when the Uplink module has encountered an error while uploading the data.
uplink.done
Fired when the Uplink module completed the transmission.
uplink.data
Fired when the server has responded with some downlink data. The data
argument is a binary string with the incoming data.
3. UART Events
onEvent("uart0.data", function (data) {
//
});
onEvent("uart1.data", function (data) {
//
});
uart0.data
uart1.data
Fired when there is an incoming data chunk on either of the UART0 or UART1 interfaces.
Note that UART1 is available only when a respective peripheral is installed on the device.
4. System Events
onEvent("runlevel.changing", function (toLevel, fromLevel) {
//
});
onEvent("runlevel.reached", function (toLevel) {
//
});
runlevel.changing
runlevel.reached
The runlevel.*
events are dispatched when the kernel is switching run-levels. Refer to getRunlevel()
function above for more details on run-levels.
The runlevel.changing
is dispatched when the system is about to switch run-levels. This can occur for example when the external power supply is disconnected or re-supplied.