Quantcast

Does MH support an event model

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Does MH support an event model

Brian M
Greetings, all.

Does MH have the hooks to support an event-model of coding, rather than
polling?  I think I've seen hints of it in some of the code, but I
haven't found it in the documents the last time I looked.  I'm thinking
of something like the following two portions, from the MH
user/home-owners point of view:

1) The user writes a subroutine (e.g.ThermX) to do whatever it is they
want (e.g. when the garage door sensor says the door opened, turn up the
heat)
2) The user associates the subroutine with a device.  Perhaps this would
be done in code (e.g. "$garage_door->register(&ThermX);"), or perhaps in an
.ini file (e.g. "register garage_door ThermX).

Then, anytime the device has an event, MH calls any subroutines that
have been registered against it.  MH would pass the handle of object
that triggered the event, so that the subroutine could check the state
(did the door just open or close).  This would allow the same subroutine
to be reused with multiple devices if desired.

This approach wouldn't add any new features, but it would make coding a
lot cleaner.  The user's code could be written knowing it was only
called because something happened, rather than whether this is just
another polling cycle.  The approach would also pull all of the user
code out of the main loop.  I'm not knowledgeable in MH internals, but
I'm guessing that it would add a little code to the MH base whenever it
updates an objects state  ("an event just happened on the garage door
sensor, do we have any subroutines we need to call?"), and perhaps some
start-up code to read a .ini file if that approach were used, but it
should be pretty small.

So the first question is "Is there already such a thing?", and if not,
is it something people would find valuable?

               -Brian

------------------------------------------------------------------------------
Mobile security can be enabling, not merely restricting. Employees who
bring their own devices (BYOD) to work are irked by the imposition of MDM
restrictions. Mobile Device Manager Plus allows you to control only the
apps on BYO-devices by containerizing them, leaving personal data untouched!
https://ad.doubleclick.net/ddm/clk/304595813;131938128;j
________________________________________________________
To unsubscribe from this list, go to: https://lists.sourceforge.net/lists/listinfo/misterhouse-users

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Does MH support an event model

H Plato
I think you’re looking for ‘tie_event’, that is part of the Generic_Item

http://misterhouse.sourceforge.net/lib/Generic_Item.html

Would that work?

> On May 23, 2016, at 8:40 AM, Brian M <[hidden email]> wrote:
>
> Greetings, all.
>
> Does MH have the hooks to support an event-model of coding, rather than
> polling?  I think I've seen hints of it in some of the code, but I
> haven't found it in the documents the last time I looked.  I'm thinking
> of something like the following two portions, from the MH
> user/home-owners point of view:
>
> 1) The user writes a subroutine (e.g.ThermX) to do whatever it is they
> want (e.g. when the garage door sensor says the door opened, turn up the
> heat)
> 2) The user associates the subroutine with a device.  Perhaps this would
> be done in code (e.g. "$garage_door->register(&ThermX);"), or perhaps in an
> .ini file (e.g. "register garage_door ThermX).
>
> Then, anytime the device has an event, MH calls any subroutines that
> have been registered against it.  MH would pass the handle of object
> that triggered the event, so that the subroutine could check the state
> (did the door just open or close).  This would allow the same subroutine
> to be reused with multiple devices if desired.
>
> This approach wouldn't add any new features, but it would make coding a
> lot cleaner.  The user's code could be written knowing it was only
> called because something happened, rather than whether this is just
> another polling cycle.  The approach would also pull all of the user
> code out of the main loop.  I'm not knowledgeable in MH internals, but
> I'm guessing that it would add a little code to the MH base whenever it
> updates an objects state  ("an event just happened on the garage door
> sensor, do we have any subroutines we need to call?"), and perhaps some
> start-up code to read a .ini file if that approach were used, but it
> should be pretty small.
>
> So the first question is "Is there already such a thing?", and if not,
> is it something people would find valuable?
>
>               -Brian
>
> ------------------------------------------------------------------------------
> Mobile security can be enabling, not merely restricting. Employees who
> bring their own devices (BYOD) to work are irked by the imposition of MDM
> restrictions. Mobile Device Manager Plus allows you to control only the
> apps on BYO-devices by containerizing them, leaving personal data untouched!
> https://ad.doubleclick.net/ddm/clk/304595813;131938128;j
> ________________________________________________________
> To unsubscribe from this list, go to: https://lists.sourceforge.net/lists/listinfo/misterhouse-users
>


------------------------------------------------------------------------------
Mobile security can be enabling, not merely restricting. Employees who
bring their own devices (BYOD) to work are irked by the imposition of MDM
restrictions. Mobile Device Manager Plus allows you to control only the
apps on BYO-devices by containerizing them, leaving personal data untouched!
https://ad.doubleclick.net/ddm/clk/304595813;131938128;j
________________________________________________________
To unsubscribe from this list, go to: https://lists.sourceforge.net/lists/listinfo/misterhouse-users

Loading...