diff --git a/fhem/CHANGED b/fhem/CHANGED index be1c634dc..1b51aacd5 100644 --- a/fhem/CHANGED +++ b/fhem/CHANGED @@ -1,5 +1,6 @@ # Add changes at the top of the list. Keep it in ASCII, and 80-char wide. # Do not insert empty lines here, update check depends on it. + - feature: 10_MYSENSORS_DEVICE: heartbeat, alive check, sleep and RSSI - change: 74_AMADtasker: AMAD Taskerproject change to new battery states - feature: 49_SSCamSTRM: new attr hideDisplayName regarding to Forum #88667 - bugfix: 49_SSCam: global vars diff --git a/fhem/FHEM/10_MYSENSORS_DEVICE.pm b/fhem/FHEM/10_MYSENSORS_DEVICE.pm index a568e301e..1d536350f 100755 --- a/fhem/FHEM/10_MYSENSORS_DEVICE.pm +++ b/fhem/FHEM/10_MYSENSORS_DEVICE.pm @@ -28,7 +28,10 @@ use strict; use warnings; my %gets = ( - "version" => "", + # "version" => 1, + "heartbeat" => 1, #request node to send hearbeat, MySensorsCore.cpp L 429 + # "presentation" => 1, #request node to redo presentation, MySensorsCore.cpp L 426 + "RSSI" => 1, #request RSSI values (available only for recent versions, not for all transceiver types ); sub MYSENSORS_DEVICE_Initialize($) { @@ -39,6 +42,7 @@ sub MYSENSORS_DEVICE_Initialize($) { $hash->{DefFn} = "MYSENSORS::DEVICE::Define"; $hash->{UndefFn} = "MYSENSORS::DEVICE::UnDefine"; $hash->{SetFn} = "MYSENSORS::DEVICE::Set"; + $hash->{GetFn} = "MYSENSORS::DEVICE::Get"; $hash->{AttrFn} = "MYSENSORS::DEVICE::Attr"; $hash->{AttrList} = @@ -114,8 +118,8 @@ my %static_types = ( S_CUSTOM => { receives => [V_VAR1,V_VAR2,V_VAR3,V_VAR4,V_VAR5], sends => [V_VAR1,V_VAR2,V_VAR3,V_VAR4,V_VAR5] }, # Use this for custom sensors where no other fits. S_DUST => { receives => [], sends => [V_LEVEL,V_UNIT_PREFIX] }, # Dust level sensor S_SCENE_CONTROLLER => { receives => [], sends => [V_SCENE_ON,V_SCENE_OFF] }, # Scene controller device - S_RGB_LIGHT => { receives => [V_RGB,V_WATT], sends => [V_RGB,V_WATT] }, # RGB light - S_RGBW_LIGHT => { receives => [V_RGBW,V_WATT], sends => [V_RGBW,V_WATT] }, # RGBW light (with separate white component) + S_RGB_LIGHT => { receives => [V_RGB,V_WATT,V_PERCENTAGE], sends => [V_RGB,V_WATT,V_PERCENTAGE] }, # RGB light + S_RGBW_LIGHT => { receives => [V_RGBW,V_WATT,V_PERCENTAGE], sends => [V_RGBW,V_WATT,V_PERCENTAGE] }, # RGBW light (with separate white component) S_COLOR_SENSOR => { receives => [V_RGB], sends => [V_RGB] }, # Color sensor S_HVAC => { receives => [], sends => [V_STATUS,V_TEMP,V_HVAC_SETPOINT_HEAT,V_HVAC_SETPOINT_COOL,V_HVAC_FLOW_STATE,V_HVAC_FLOW_MODE,V_HVAC_SPEED] }, # Thermostat/HVAC device S_MULTIMETER => { receives => [], sends => [V_VOLTAGE,V_CURRENT,V_IMPEDANCE] }, # Multimeter device @@ -270,6 +274,35 @@ sub Set($@) { } } +sub Get($@) { + my ($hash, @a) = @_; + my $type = $hash->{TYPE}; + return "\"get $type\" needs at least one parameter" if(@a < 2); + if(!defined($gets{$a[1]})) { + my @cList = map { $_ =~ m/^(file|raw)$/ ? $_ : "$_:noArg" } sort keys %gets; + return "Unknown argument $a[1], choose one of " . join(" ", @cList); + } + my $command = $a[1]; + COMMAND_HANDLER: { + $command eq "version" and do { + sendMessage($hash->{IODev}, radioId => $hash->{radioId}, cmd => C_INTERNAL, ack => 0, subType => I_VERSION); + last; + }; + $command eq "heartbeat" and do { + sendMessage($hash->{IODev}, radioId => $hash->{radioId}, cmd => C_INTERNAL, ack => 0, subType => I_HEARTBEAT_REQUEST); + last; + }; + $command eq "presentation" and do { + sendMessage($hash->{IODev}, radioId => $hash->{radioId}, cmd => C_INTERNAL, ack => 0, subType => I_PRESENTATION); + last; + }; + $command eq "RSSI" and do { + sendMessage($hash->{IODev}, radioId => $hash->{radioId}, cmd => C_INTERNAL, ack => 0, subType => I_SIGNAL_REPORT_REQUEST); + last; + }; + } +} + sub Attr($$$$) { my ($command,$name,$attribute,$value) = @_; @@ -480,7 +513,7 @@ sub onSetMessage($$) { readingsSingleUpdate($hash, $reading, $value, 1); }; Log3 ($hash->{NAME}, 4, "MYSENSORS_DEVICE $hash->{NAME}: ignoring C_SET-message ".GP_Catch($@)) if $@; - refreshInternalMySTimer($hash,"Alive") if $hash->{timeoutAlive}; + refreshInternalMySTimer($hash,"Alive") if $hash->{timeoutAlive}; #deactivate in case of wanted reduction of alive to internal (heartbeat/battery/smartsleep) messages } else { Log3 ($hash->{NAME}, 5, "MYSENSORS_DEVICE $hash->{NAME}: ignoring C_SET-message without payload"); }; @@ -502,107 +535,199 @@ sub onRequestMessage($$) { } sub onInternalMessage($$) { - my ($hash,$msg) = @_; - my $name = $hash->{NAME}; - my $type = $msg->{subType}; - my $typeStr = internalMessageTypeToStr($type); - INTERNALMESSAGE: { - $type == I_BATTERY_LEVEL and do { - readingsSingleUpdate($hash, "batterylevel", $msg->{payload}, 1); - Log3 ($name, 4, "MYSENSORS_DEVICE $name: batterylevel $msg->{payload}"); - last; - }; - $type == I_TIME and do { - if ($msg->{ack}) { - Log3 ($name, 4, "MYSENSORS_DEVICE $name: response to time-request acknowledged"); - } else { - sendClientMessage($hash,cmd => C_INTERNAL, childId => 255, subType => I_TIME, payload => time); - Log3 ($name, 4, "MYSENSORS_DEVICE $name: update of time requested"); - } - last; - }; - $type == I_VERSION and do { - $hash->{$typeStr} = $msg->{payload}; - last; - }; - $type == I_ID_REQUEST and do { - $hash->{$typeStr} = $msg->{payload}; - last; - }; - $type == I_ID_RESPONSE and do { - $hash->{$typeStr} = $msg->{payload}; - last; - }; - $type == I_INCLUSION_MODE and do { - $hash->{$typeStr} = $msg->{payload}; - last; - }; - $type == I_CONFIG and do { - if ($msg->{ack}) { - Log3 ($name, 4, "MYSENSORS_DEVICE $name: response to config-request acknowledged"); - } else { - readingsSingleUpdate($hash, "parentId", $msg->{payload}, 1); - sendClientMessage($hash,cmd => C_INTERNAL, childId => 255, subType => I_CONFIG, payload => AttrVal($name,"config","M")); - Log3 ($name, 4, "MYSENSORS_DEVICE $name: respond to config-request, node parentId = " . $msg->{payload}); - } - last; - }; - $type == I_FIND_PARENT and do { - $hash->{$typeStr} = $msg->{payload}; - last; - }; - $type == I_FIND_PARENT_RESPONSE and do { - $hash->{$typeStr} = $msg->{payload}; - last; - }; - $type == I_LOG_MESSAGE and do { - $hash->{$typeStr} = $msg->{payload}; - last; - }; - $type == I_CHILDREN and do { - readingsSingleUpdate($hash, "state", "routingtable cleared", 1); - Log3 ($name, 3, "MYSENSORS_DEVICE $name: routingtable cleared"); - last; - }; - $type == I_SKETCH_NAME and do { - $hash->{$typeStr} = $msg->{payload}; - readingsSingleUpdate($hash, "SKETCH_NAME", $msg->{payload}, 1); - last; - }; - $type == I_SKETCH_VERSION and do { - $hash->{$typeStr} = $msg->{payload}; - readingsSingleUpdate($hash, "SKETCH_VERSION", $msg->{payload}, 1); - last; - }; - $type == I_REBOOT and do { - $hash->{$typeStr} = $msg->{payload}; - last; - }; - $type == I_GATEWAY_READY and do { - $hash->{$typeStr} = $msg->{payload}; - last; - }; - $type == I_REQUEST_SIGNING and do { - $hash->{$typeStr} = $msg->{payload}; - last; - }; - $type == I_GET_NONCE and do { - $hash->{$typeStr} = $msg->{payload}; - last; - }; - $type == I_GET_NONCE_RESPONSE and do { - $hash->{$typeStr} = $msg->{payload}; - last; - }; - } + my ($hash,$msg) = @_; + my $name = $hash->{NAME}; + my $type = $msg->{subType}; + my $typeStr = internalMessageTypeToStr($type); + INTERNALMESSAGE: { + $type == I_BATTERY_LEVEL and do { + # readingsSingleUpdate($hash, "batterylevel", $msg->{payload}, 1); + # Log3 ($name, 3, "MYSENSORS_DEVICE $name: batterylevel is deprecated and will be removed soon, use batteryPercent instead (Forum #87575)"); + readingsSingleUpdate($hash, "batteryPercent", $msg->{payload}, 1); + refreshInternalMySTimer($hash,"Alive") if $hash->{timeoutAlive}; + Log3 ($name, 4, "MYSENSORS_DEVICE $name: batteryPercent $msg->{payload}"); + last; + }; + $type == I_TIME and do { + if ($msg->{ack}) { + Log3 ($name, 4, "MYSENSORS_DEVICE $name: response to time-request acknowledged"); + } else { + sendClientMessage($hash,cmd => C_INTERNAL, childId => 255, subType => I_TIME, payload => time); + Log3 ($name, 4, "MYSENSORS_DEVICE $name: update of time requested"); + } + last; + }; + $type == I_VERSION and do { + $hash->{$typeStr} = $msg->{payload}; + last; + }; + $type == I_ID_REQUEST and do { + $hash->{$typeStr} = $msg->{payload}; + last; + }; + $type == I_ID_RESPONSE and do { + $hash->{$typeStr} = $msg->{payload}; + last; + }; + $type == I_INCLUSION_MODE and do { + $hash->{$typeStr} = $msg->{payload}; + last; + }; + $type == I_CONFIG and do { + if ($msg->{ack}) { + Log3 ($name, 4, "MYSENSORS_DEVICE $name: response to config-request acknowledged"); + } else { + readingsSingleUpdate($hash, "parentId", $msg->{payload}, 1); + sendClientMessage($hash,cmd => C_INTERNAL, childId => 255, subType => I_CONFIG, payload => AttrVal($name,"config","M")); + Log3 ($name, 4, "MYSENSORS_DEVICE $name: respond to config-request, node parentId = " . $msg->{payload}); + } + last; + }; + $type == I_FIND_PARENT and do { + $hash->{$typeStr} = $msg->{payload}; + last; + }; + $type == I_FIND_PARENT_RESPONSE and do { + $hash->{$typeStr} = $msg->{payload}; + last; + }; + $type == I_LOG_MESSAGE and do { + $hash->{$typeStr} = $msg->{payload}; + last; + }; + $type == I_CHILDREN and do { + readingsSingleUpdate($hash, "state", "routingtable cleared", 1); + Log3 ($name, 3, "MYSENSORS_DEVICE $name: routingtable cleared"); + last; + }; + $type == I_SKETCH_NAME and do { + #$hash->{$typeStr} = $msg->{payload}; + readingsSingleUpdate($hash, "SKETCH_NAME", $msg->{payload}, 1); + last; + }; + $type == I_SKETCH_VERSION and do { + #$hash->{$typeStr} = $msg->{payload}; + readingsSingleUpdate($hash, "SKETCH_VERSION", $msg->{payload}, 1); + last; + }; + $type == I_REBOOT and do { + #$hash->{$typeStr} = $msg->{payload}; + last; + }; + $type == I_GATEWAY_READY and do { + $hash->{$typeStr} = $msg->{payload}; + last; + }; + $type == I_REQUEST_SIGNING and do { + $hash->{$typeStr} = $msg->{payload}; + last; + }; + $type == I_GET_NONCE and do { + $hash->{$typeStr} = $msg->{payload}; + last; + }; + $type == I_GET_NONCE_RESPONSE and do { + $hash->{$typeStr} = $msg->{payload}; + last; + }; + $type == I_HEARTBEAT_REQUEST and do { + #$hash->{$typeStr} = $msg->{payload}; + eval { + sendMessage($hash->{IODev},radioId => 0, childId => 0, cmd => C_INTERNAL, ack => 0, subType => I_HEARTBEAT_RESPONSE); + }; + refreshInternalMySTimer($hash,"Alive") if $hash->{timeoutAlive}; + last; + }; + $type == I_PRESENTATION and do { + #$hash->{$typeStr} = $msg->{payload}; + last; + }; + $type == I_DISCOVER_REQUEST and do { + #$hash->{$typeStr} = $msg->{payload}; + last; + }; + $type == I_DISCOVER_RESPONSE and do { + #$hash->{$typeStr} = $msg->{payload}; + last; + }; + $type == I_HEARTBEAT_RESPONSE and do { + readingsSingleUpdate($hash, "heartbeat", "last", 0); + refreshInternalMySTimer($hash,"Alive") if $hash->{timeoutAlive}; + $hash->{$typeStr} = $msg->{payload}; + last; + }; + $type == I_LOCKED and do { + $hash->{$typeStr} = $msg->{payload}; + last; + }; + $type == I_REGISTRATION_REQUEST and do { + $hash->{$typeStr} = $msg->{payload}; + last; + }; + $type == I_REGISTRATION_RESPONSE and do { + $hash->{$typeStr} = $msg->{payload}; + last; + }; + $type == I_DEBUG and do { + $hash->{$typeStr} = $msg->{payload}; + last; + }; + $type == I_SIGNAL_REPORT_REVERSE and do { + #$hash->{$typeStr} = $msg->{payload}; + readingsSingleUpdate($hash, "rssi_DEVICE", $msg->{payload}, 1) if ($msg->{payload} > -256 ); + last; + }; + $type == I_SIGNAL_REPORT_RESPONSE and do { + #$hash->{$typeStr} = $msg->{payload}; + readingsSingleUpdate($hash, "rssi_at_IODev", $msg->{payload}, 1) if ($msg->{payload} > -256 ); + last; + }; + $type == I_PRE_SLEEP_NOTIFICATION and do { + #$hash->{$typeStr} = $msg->{payload}; + readingsSingleUpdate($hash, "nowSleeping", "1", 0); + refreshInternalMySTimer($hash,"Alive") if $hash->{timeoutAlive}; + last; + }; + $type == I_POST_SLEEP_NOTIFICATION and do { + #$hash->{$typeStr} = $msg->{payload}; + readingsSingleUpdate($hash, "nowSleeping", "0", 0); + refreshInternalMySTimer($hash,"Alive") if $hash->{timeoutAlive}; + #here we can send out retained and outstanding messages + $hash->{nexttry} = -1; + MYSENSORS::Timer($hash); + my $retainedMsg; + while (defined($retainedMsg = shift @{$hash->{retainedMessagesForRadioId}})) { + sendClientMessage($hash,$retainedMsg); + }; + last; + }; + } } sub sendClientMessage($%) { my ($hash,%msg) = @_; $msg{radioId} = $hash->{radioId}; $msg{ack} = $hash->{ack} unless defined $msg{ack}; - sendMessage($hash->{IODev},%msg); - refreshInternalMySTimer($hash,"Ack") if (($hash->{ack} or $hash->{IODev}->{ack}) and $hash->{timeoutAck}) ; + unless ($hash->{nowSleeping}) { + sendMessage($hash->{IODev},%msg); + refreshInternalMySTimer($hash,"Ack") if (($hash->{ack} or $hash->{IODev}->{ack}) and $hash->{timeoutAck}); + } else { + #write to queue if node is asleep + my $retainedMessagesForRadioId = $hash->{retainedMessagesForRadioId}->{$msg{radioId}}; + unless (defined $retainedMessagesForRadioId) { + $retainedMessagesForRadioId = { + messages => [], + }; + $hash->{retainedMessagesForRadioId}->{$msg{radioId}} = $retainedMessagesForRadioId; + } + my $messages = $retainedMessagesForRadioId->{messages}; + @$messages = grep { + $_->{childId} != $msg{childId} + or $_->{cmd} != $msg{cmd} + or $_->{subType} != $msg{subType} + } @$messages; + push @$messages,\%msg; + } } sub rawToMappedReading($$$$) { @@ -740,4 +865,4 @@ sub timeoutMySTimer($) { =end html -=cut +=cut \ No newline at end of file diff --git a/fhem/FHEM/lib/Device/MySensors/Constants.pm b/fhem/FHEM/lib/Device/MySensors/Constants.pm index 32e3ed73b..a5ac0cc63 100644 --- a/fhem/FHEM/lib/Device/MySensors/Constants.pm +++ b/fhem/FHEM/lib/Device/MySensors/Constants.pm @@ -4,17 +4,17 @@ use List::Util qw(first); #-- Message types use constant { - C_PRESENTATION => 0, - C_SET => 1, - C_REQ => 2, - C_INTERNAL => 3, - C_STREAM => 4, + C_PRESENTATION => 0, + C_SET => 1, + C_REQ => 2, + C_INTERNAL => 3, + C_STREAM => 4, }; use constant commands => qw( C_PRESENTATION C_SET C_REQ C_INTERNAL C_STREAM ); sub commandToStr($) { - (commands)[shift]; + (commands)[shift]; } #-- Variable types @@ -84,46 +84,64 @@ use constant variableTypes => qw{ V_TEMP V_HUM V_STATUS V_PERCENTAGE V_PRESSURE V_HVAC_FLOW_STATE V_HVAC_SPEED V_LIGHT_LEVEL V_VAR1 V_VAR2 V_VAR3 V_VAR4 V_VAR5 V_UP V_DOWN V_STOP V_IR_SEND V_IR_RECEIVE V_FLOW V_VOLUME V_LOCK_STATUS V_LEVEL V_VOLTAGE V_CURRENT V_RGB V_RGBW V_ID V_UNIT_PREFIX V_HVAC_SETPOINT_COOL V_HVAC_SETPOINT_HEAT V_HVAC_FLOW_MODE - V_TEXT V_CUSTOM V_POSITION V_IR_RECORD V_PH V_ORP V_EC V_VAR V_VA V_POWER_FACTOR }; + V_TEXT V_CUSTOM V_POSITION V_IR_RECORD V_PH V_ORP V_EC V_VAR V_VA V_POWER_FACTOR }; sub variableTypeToStr($) { (variableTypes)[shift]; } sub variableTypeToIdx($) { - my $var = shift; - return first { (variableTypes)[$_] eq $var } 0 .. scalar(variableTypes); + my $var = shift; + return first { (variableTypes)[$_] eq $var } 0 .. scalar(variableTypes); } #-- Internal messages use constant { - I_BATTERY_LEVEL => 0, - I_TIME => 1, - I_VERSION => 2, - I_ID_REQUEST => 3, - I_ID_RESPONSE => 4, - I_INCLUSION_MODE => 5, - I_CONFIG => 6, - I_FIND_PARENT => 7, - I_FIND_PARENT_RESPONSE => 8, - I_LOG_MESSAGE => 9, - I_CHILDREN => 10, - I_SKETCH_NAME => 11, - I_SKETCH_VERSION => 12, - I_REBOOT => 13, - I_GATEWAY_READY => 14, - I_REQUEST_SIGNING => 15, - I_GET_NONCE => 16, - I_GET_NONCE_RESPONSE => 17, + I_BATTERY_LEVEL => 0, + I_TIME => 1, + I_VERSION => 2, + I_ID_REQUEST => 3, + I_ID_RESPONSE => 4, + I_INCLUSION_MODE => 5, + I_CONFIG => 6, + I_FIND_PARENT => 7, + I_FIND_PARENT_RESPONSE => 8, + I_LOG_MESSAGE => 9, + I_CHILDREN => 10, + I_SKETCH_NAME => 11, + I_SKETCH_VERSION => 12, + I_REBOOT => 13, + I_GATEWAY_READY => 14, + I_REQUEST_SIGNING => 15, + I_GET_NONCE => 16, + I_GET_NONCE_RESPONSE => 17, + I_HEARTBEAT_REQUEST => 18, + I_PRESENTATION => 19, + I_DISCOVER_REQUEST => 20, + I_DISCOVER_RESPONSE => 21, + I_HEARTBEAT_RESPONSE => 22, + I_LOCKED => 23, # Node is locked (reason in string-payload) + I_PING => 24, # Ping sent to node, payload incremental hop counter + I_PONG => 25, # In return to ping, sent back to sender, payload incremental hop counter + I_REGISTRATION_REQUEST => 26, # Register request to GW + I_REGISTRATION_RESPONSE => 27, # Register response from GW + I_DEBUG => 28, + I_SIGNAL_REPORT_REQUEST => 29, + I_SIGNAL_REPORT_REVERSE => 30, + I_SIGNAL_REPORT_RESPONSE => 31, + I_PRE_SLEEP_NOTIFICATION => 32, + I_POST_SLEEP_NOTIFICATION => 33, }; -use constant internalMessageTypes => qw{ I_BATTERY_LEVEL I_TIME I_VERSION I_ID_REQUEST I_ID_RESPONSE - I_INCLUSION_MODE I_CONFIG I_FIND_PARENT I_FIND_PARENT_RESPONSE - I_LOG_MESSAGE I_CHILDREN I_SKETCH_NAME I_SKETCH_VERSION - I_REBOOT I_GATEWAY_READY I_REQUEST_SIGNING I_GET_NONCE I_GET_NONCE_RESPONSE }; +use constant internalMessageTypes => qw{ I_BATTERY_LEVEL I_TIME I_VERSION I_ID_REQUEST I_ID_RESPONSE + I_INCLUSION_MODE I_CONFIG I_FIND_PARENT I_FIND_PARENT_RESPONSE + I_LOG_MESSAGE I_CHILDREN I_SKETCH_NAME I_SKETCH_VERSION + I_REBOOT I_GATEWAY_READY I_REQUEST_SIGNING I_GET_NONCE I_GET_NONCE_RESPONSE I_HEARTBEAT_REQUEST I_PRESENTATION I_DISCOVER_REQUEST + I_DISCOVER_RESPONSE I_HEARTBEAT_RESPONSE I_LOCKED I_PING I_PONG I_REGISTRATION_REQUEST I_REGISTRATION_RESPONSE I_DEBUG + I_SIGNAL_REPORT_REQUEST I_SIGNAL_REPORT_REVERSE I_SIGNAL_REPORT_RESPONSE I_PRE_SLEEP_NOTIFICATION I_POST_SLEEP_NOTIFICATION }; sub internalMessageTypeToStr($) { - (internalMessageTypes)[shift]; + (internalMessageTypes)[shift]; } #-- Sensor types @@ -131,7 +149,7 @@ use constant { S_DOOR => 0, S_MOTION => 1, S_SMOKE => 2, - S_BINARY => 3, + S_BINARY => 3, S_DIMMER => 4, S_COVER => 5, S_TEMP => 6, @@ -174,7 +192,7 @@ use constant sensorTypes => qw{ S_DOOR S_MOTION S_SMOKE S_BINARY S_DIMMER S_COVE S_RAIN S_UV S_WEIGHT S_POWER S_HEATER S_DISTANCE S_LIGHT_LEVEL S_ARDUINO_NODE S_ARDUINO_REPEATER_NODE S_LOCK S_IR S_WATER S_AIR_QUALITY S_CUSTOM S_DUST S_SCENE_CONTROLLER S_RGB_LIGHT S_RGBW_LIGHT S_COLOR_SENSOR S_HVAC S_MULTIMETER S_SPRINKLER S_WATER_LEAK S_SOUND S_VIBRATION - S_MOISTURE S_INFO S_GAS S_GPS S_WATER_QUALITY}; + S_MOISTURE S_INFO S_GAS S_GPS S_WATER_QUALITY }; sub sensorTypeToStr($) { (sensorTypes)[shift]; @@ -204,20 +222,20 @@ sub datastreamTypeToStr($) { #-- Payload types use constant { - P_STRING => 0, - P_BYTE => 1, - P_INT16 => 2, - P_UINT16 => 3, - P_LONG32 => 4, - P_ULONG32 => 5, - P_CUSTOM => 6, - P_FLOAT32 => 7, + P_STRING => 0, + P_BYTE => 1, + P_INT16 => 2, + P_UINT16 => 3, + P_LONG32 => 4, + P_ULONG32 => 5, + P_CUSTOM => 6, + P_FLOAT32 => 7, }; use constant payloadTypes => qw{ P_STRING P_BYTE P_INT16 P_UINT16 P_LONG32 P_ULONG32 P_CUSTOM P_FLOAT32 }; sub payloadTypeToStr($) { - (payloadTypes)[shift]; + (payloadTypes)[shift]; } sub subTypeToStr($$) { @@ -274,4 +292,4 @@ use Exporter ('import'); %EXPORT_TAGS = (all => [@EXPORT_OK]); -1; +1; \ No newline at end of file