fa.models ========= .. module:: fa.models .. class:: FoneAstraDevice .. attribute:: name(CharField, max_length=200) The name of this device. .. attribute:: phone_number(CharField, max_length=25) The phone number of this device. .. attribute:: transport(CharField, max_length=255, blank=True, null=True) The name of the transport to use to talk to this device. This is the name as given in the settings file, not the name of the transport class itself. .. attribute:: receivers This is an iterable of tuples matching regular expressions to functions, in exactly the same form as URLs are defined. When a function matches, it is called with the matching device, then each of the matched groups as the argument list. Override this in subclasses. Example usage:: receivers = ( (r'2(.)(.{4})(.)(.{2})(.*)$', alert_handle), (r'^1(.{4})(\d)(\d{2})(.*)$', report_handle), ) .. method:: receive(self, msg) This is called when a message is received from this device. By default it tests the message against every regular expression in the receivers list and calls the matching function, but this implementation can be overridden. :param IncomingMessage msg: The received message. .. method:: send(self, message) Sends the given message to this *FoneAstraDevice* using this device's configured transport. :param string message: The message to send. Automatically handles transports and targets. .. class:: IncomingMessage .. attribute:: sender(CharField, max_length=25) .. attribute:: content(CharField, max_length=255) .. attribute:: send_time(DateTimeField) .. attribute:: transport(CharField, max_length=255) .. class:: OutgoingMessage .. attribute:: target(CharField, max_length=20) .. attribute:: content(CharField, max_length=255) .. attribute:: transport(CharField, max_length=255)