From: John M. <mcc...@st...> - 2004-02-02 00:07:39
|
John wrote: >> What is the correct strategy for processing a queue of group member changes? Bruce replied: > I'm not sure I follow the question... John tries again: Each member of the group is bound to a pin (configured as input) of a Weeder Digital IO Module. When the pin changes state, MH receives a three-byte packet, whose meaning ('on' or 'off') has been defined in an .mht file. These packets may be coming fast, and a pin may have returned to the previous state (and sent an offsetting packet) before its first state- change gets processed. Is the following the right strategy for processing one incoming state change at a time? Will MH serve up one incoming member state change per pass? if ('member on' eq state_now $All_Sensors || 'member off' eq state_now $All_Sensors) { $sensorname = member_changed $All_Sensors; $sensorstate = ('member on' eq state_now $All_Sensors) ? 'on' : 'off'; # Can't use $sensor->{state} since it may have changed. ? # .... # Do things based on the state of $sensorname and $sensorstate # .... } |