AHF_Notifier

AHF_Notifier.AHF_Notifier module

class AHF_Notifier.AHF_Notifier(taskP, settingsDictP)

Bases: AHF_Base.AHF_Base

Some remote way of notifying somebody, with email or text or something.

hardwareTest()

Tests functionality, gives user a chance to change settings. :Returns: bool – True if any settings have changed

abstract notify(msgStr)

a more general method to send text information

abstract notifyStuck(tag, cageID, duration, isStuck)

Sends a text message with the given information.

Two types of message can be sent, depending if isStuck is True or False No timing is done by the AHF_Notifier class, the durations are only for building the text mssg :param tag: RFID tag of the mouse :param cageID: cage ID of the mouse that is stuck :param durationSecs: how long the mouse has been inside the chamber :param isStuck: boolean signifying if the mouse has been inside the chamber for too long, or has just left the chamber :return: nothing

AHF_Notifier.AHF_Notifier_Requests module

class AHF_Notifier_Requests.AHF_Notifier_Requests(taskP, settingsDictP)

Bases: AHF_Notifier.AHF_Notifier

sends text messages to a tuple of phone numbers using a web service, textbelt.com You need to get an account and pay for some messages to get an account key As it uses http requests to send the message to the web service, your Pi needs to be online

AHF_Notifier_Requests needs requests module, which is not installed by default. The best way to install python modules is with pip. Assuming you are using Python 3: sudo apt-get install python3-pip sudo pip-3 install requests

static about()

Returns a brief message describing your sub-class, used when asking user to pick a sub-class of this class

static config_user_get(starterDict={})

static method that querries user for settings, with default responses from starterDict, and returns starterDict with settings as edited by the user.

notify(msgStr)

a more general method to send text information

notifyStuck(tag, cageID, duration, isStuck)

Sends a text message with the given information.

Two types of message can be sent, depending if isStuck is True or False No timing is done by the AHF_Notifier class, the durations are only for building the text mssg :param tag: RFID tag of the mouse :param durationSecs: how long the mouse has been inside the chamber :param isStuck: boolean signifying if the mouse has been inside the chamber for too long, or has just left the chamber :return: nothing

setdown()

oppposite of setup. Releases any hardware resouces. can be run before editing settings so GPIO pins can be reused, for example. This strategy should be used in hardwareTest method.

setup()

does hardware initialization with(possibly updated) info in self.settingsDict Run by __init__, or can be run separately after editing the settingsDict

Returns

code

bool whether setup completed without errors

textBeltURL = 'http://textbelt.com/text'