Contents Up Previous Next

HiPi::Interrupt::Message

This module is passed to the message handlers either in a class derived from HiPi::Interrupt::Handler or to the callbacks registered with an instance of HiPi::Interrupt::Handler.

An instance of this class provides information for the messages received from the interrupt handler threads.

After a handler has been created using:

my $handler = HiPi::::Interrupt::HandlerClass->new

The following accessors are available.

$msg->action

Returns the action that the message is associated with. Possible values are:

add The message is returned as a result of a call to $handler->add_pin. You can determine which pin by calling $msg->pinid and you can determine success by calling $msg->error.

remove The message is returned as a result of a call to $handler->remove_pin. You can determine which pin by calling $msg->pinid and you can determine success by calling $msg->error.

interrupt The message is returned as a result of an interrupt being received by the handler. You can determine which pin by calling $msg->pinid and you can determine success by calling $msg->error.

error The message is a general error not associated with the response to a particular request.

stop The message is returned as a result of a call to $handler->stop

$msg->error

Returns true if there was an error processing an instruction or interrupt, False if the message is the result of a successful instruction. When $msg->error is true then error details are contained in $msg->msgtext.

$msg->pinid

Returns the BCM GPIO Pin Number associated with the message if any. Returns -1 if the message is not associated with a particular GPIO pin.

$msg->value

For interrupt messages this contains the value of the pin ( 1 or 0 ) at the time of the interrupt. This means you do not have to read the pin value separately.

$msg->timestamp

Returns an epoch timestamp in milliseconds for the message.

$msg->msgtext

May contain text information about the message. When $msg->error is true $msg->msgtext returns the error description.

$msg->pinclass

Returns the name of the pinclass handler that returned the message.

gpio - Handler for pins managed by kernel sysfs and HiPi::Device::GPIO.

bcmd - Handler for pins managed using HiPi::BCM2835.

wire - Handler for pins managed using HiPi::Wiring.





Contents Up Previous Next


HiPi Modules Copyright © 2013 Mark Dootson