Class: Ansible::KNX::DPTFrame

Inherits:
BinData::Record
  • Object
show all
Defined in:
lib/ansible/knx/knx_dpt.rb

Overview

a base class for DPT data structures. derives from BinData::Record, implements some common stuff

Instance Method Summary collapse

Instance Method Details

#validate_rangesObject

make sure all frame fields are valid (within min,max range)



39
40
41
42
43
44
45
46
47
48
49
# File 'lib/ansible/knx/knx_dpt.rb', line 39

def validate_ranges()
    # range checking is global: applies to all subtypes
    field_names.each { |fieldname|
        # skip padding fields
        next if /pad/.match(fieldname)
        field = self.send(fieldname)
        if range = field.get_parameter(:range) then
            raise "#{self}: field #{fieldname} value (#{field.value}) out of range #{range}" unless range === field.value
        end
    }
end