Implementing Event Handlers for Enrollment Events
IzoT devices can be hosts or clients for ISI connections. A single device may be both a host for some connections, and client for others. Hosts advertise that they wish to find other devices with matching datapoints (clients), and clients can answer the call from any host that the client feels it is willing to match up with. There is an enrollment event for hosts, and another for clients.
# For automatic ISI connections # - the keypad is an ISI host for the 'Light Level' function # - the keypad is an ISI client for the 'Keypad' function def on_user_interface(sender, argument): framework.isi.state = argument.event_code # Update the isi engine 'state' in the framework if argument.event_code == izot.device.isi.IsiEvent.WARM: auto_enrollment_start() # Event handler registration app.isi.OnUserInterface += on_user_interface def on_enrollment (sender, argument): """ Checks whether incoming enrollment invitation is acceptable """ if argument.enrollment.type_id == lux_assembly.enrollment.type_id: argument.result = lux_assembly elif argument.enrollment.type_id == keypad_assembly.enrollment.type_id: argument.result = keypad_assembly # Event handler registration app.isi.OnEnrollment += on_enrollment