Message.pm |
Generic base class for Insteon object messages, including Insteon::X10Message. Primarily just stores variables for the object.
Nothing
new()
Instantiates a new object.
interface_data(data)
Save and retrieve the interface data defined by interface_data()
.
queue_time(data)
Stores the time at which a message was added to the queue. Used for calculating how long a message was delayed.
callback(data)
Data will be evaluated each time the message is sent.
failure_callback(data)
Data will be evaluated if the maximum number of retry attempts has been made and the message is not acknowledged.
success_callback(data)
Data will be evaluated after the receipt of an ACK from the device for this command.
send_attempts(data)
Stores and retrieves the number of times Misterhouse has tried to send the message.
setby(data)
Stores and retrieves what the source of this message was.
respond(data)
Stores and retrieves respond variable.
no_hop_increase(data)
Stores and retrieves no_hop_increase variable, if set to true, when the message is retried, no additional hops will be added. Typically used where the failure to deliver the last message attempt was not caused by a failure of the object to receive the message such as when the PLM is too busy to even attempt sending the message.
retry_count(data)
Stores and retrieves the number of times MisterHouse should try to deliver this message. If Insteon_retry_count is set in the ini parameters will default to that value, otherwise defaults to 5. Some messages types have specific retry counts, such as Insteon::RemoteLinc battery level requests which are only sent once.
send(p_interface)
Sends this message using the interface p_interface. If send_attempts
is
greater than 0 then
Insteon::BaseObject::default_hop_count
is increase by one. Calls callback()
when the message is sent.
Returns 1 if message sent or 0 if message retry count exceeds retry_count()
.
seconds_delayed()
Returns the number of seconds that elapsed between time set in queue_time
and when this routine was called.
send_timeout(p_timeout)
Stores and returns the number of milliseconds, p_timeout, that MisterHouse should wait before retrying this message again.
to_string()
Returns the hexadecimal representation of the message.
Sets the number of times MisterHouse will attempt to resend a message that has not been acknowledged. The default setting is 5.
Gregg Limming, Kevin Robert Keegan
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
Main class for all Insteon messages.
new()
Instantiates a new object.
command_to_hash(msg)
Takes msg, a hexadecimal message, and returns a hash of the message details.
command(data)
Stores and retrieves the Cmd1 value for this message.
command_type(data)
Stores and retrieves the Command Type value for this message.
extra(data)
Stores and retrieves the extra value for this message. For standard messages extra is Cmd2. For extended messages extra is Cmd2 + D1-D14.
send_timeout()
Calculates and returns the number of milliseconds that MisterHouse should wait for this message to be delivered. The time is based on message type, command type, and hop count.
Peek Related Messages = 4000 PLM Scene Commands = 3000 Ext / Std 0 Hop 2220 1400 1 Hop 2690 1700 2 Hop 3000 1900 3 Hop 3170 2000
These times were intially calculated by Gregg Limming and appear to have been calculated based on experience. In reality each hop of a standard message should take 50 ms and 108 for extended messages. Each time needs to be at least doubled to compensate for the return hops as well.
In reality, the PLM and even some Insteon devices appear to react much slower than the spec defines. These settings generally appear to work without causing errors or too much undue delay.
to_string()
Returns text based human readable representation of the message.
interface_data(data)
Stores data as the hexadecimal message, or if data is not specified, then derives the hexadecimal message and returns it.
_derive_interface_data()
Converts all of the attributes set for this message into a hexadecimal message that can be sent to the PLM. Will add checksums and crcs when necessary.
calculate_checksum( string )
Calculates a checksum of all hex bytes in the string. Returns two hex nibbles that represent the checksum in hex. One useful characteristic of the checksum is that summing over all the bytes "including" the checksum will always equal 00. This makes it very easy to validate a checksum.
calculate_crc16( string )
Calculates a two byte CRC value of string. This two byte CRC differs from the one byte checksum used in other extended commands. This CRC calculation is known to be used by the 2441TH Insteon Thermostat as well as the iMeter INSTEON device. It may be used by other devices in the future.
The calculation if the crc value involves data bytes from command 1 to the data 12 byte. This function will return two bytes, which are generally added to the data 13 & 14 bytes in an extended message.
To add a crc16 to a message set the $$message{add_crc16} flag to true.
Gregg Limming, Kevin Robert Keegan, Michael Stovenour
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
Main class for all Insteon X10 messages.
new()
Instantiates a new object.
get_formatted_data()
Converts an X10 message from the interface into the generic humand readable X10 message format.
generate_commands()
Generates and returns the X10 hexadecimal message for sending to the PLM.
Gregg Limming
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
Message.pm |