pub struct Callbacks<'a> {
pub store_node_config: Option<&'a mut (dyn FnMut(NodeId) + 'a)>,
pub store_objects: Option<&'a mut (dyn Fn(&mut dyn Read<Error = Infallible>, usize) + 'a)>,
pub reset_app: Option<&'a mut (dyn FnMut(&'a [ODEntry<'a>]) + 'a)>,
pub reset_comms: Option<&'a mut (dyn FnMut(&'a [ODEntry<'a>]) + 'a)>,
pub enter_operational: Option<&'a mut (dyn FnMut(&'a [ODEntry<'a>]) + 'a)>,
pub enter_stopped: Option<&'a mut (dyn FnMut(&'a [ODEntry<'a>]) + 'a)>,
pub enter_preoperational: Option<&'a mut (dyn FnMut(&'a [ODEntry<'a>]) + 'a)>,
}Expand description
Collection of callbacks events which Node object can call.
Most are optional, and may be implemented by the application or not.
Fields§
§store_node_config: Option<&'a mut (dyn FnMut(NodeId) + 'a)>Store node config to flash
An application should implement this callback in order to support storing a configured node
ID persistently. It is triggered when the LSS StoreConfiguration command is received. The
passed NodeId should be stored, and used when creating the Node object on the next boot.
store_objects: Option<&'a mut (dyn Fn(&mut dyn Read<Error = Infallible>, usize) + 'a)>Store object data to persistent flash
The bytes read from the provided reader (arg 1) should be stored. The total number of bytes in the stream is given in the second arg.
reset_app: Option<&'a mut (dyn FnMut(&'a [ODEntry<'a>]) + 'a)>The RESET_APP NMT state has been entered
If the application supported storing persistent object values, it should restore them now
using the restore_stored_objects method. The application
should also do whatever is appropraite to reset its state to it’s reset condition.
reset_comms: Option<&'a mut (dyn FnMut(&'a [ODEntry<'a>]) + 'a)>The RESET_COMMS NMT state has been entered
During RESET COMMS, communications objects (i.e. 0x1000-0x1fff) are reset to their boot up
values. Application which store persistent object values should restore ONLY THE COMM
OBJECTS now, using the restore_stored_comm_objects
function.
This event will only be triggered by an NMT RESET_COMMS command – when a RESET_APP event occurs, only the reset_app callback is called.
enter_operational: Option<&'a mut (dyn FnMut(&'a [ODEntry<'a>]) + 'a)>The node is entering OPERATIONAL state
enter_stopped: Option<&'a mut (dyn FnMut(&'a [ODEntry<'a>]) + 'a)>The node is entering the STOPPED state
enter_preoperational: Option<&'a mut (dyn FnMut(&'a [ODEntry<'a>]) + 'a)>The node is entering the PRE-OPERATIONAL state