protected void dispatchPinDigitalStateChangeEvent(Pin pin, PinState state) {
// if the pin listeners map contains this pin, then dispatch event
if (listeners.containsKey(pin)) {
// dispatch this event to all listener handlers
for (PinListener listener : listeners.get(pin)) {
listener.handlePinEvent(new PinDigitalStateChangeEvent(this, pin, state));
}
}
}