Module: OpenZWave

Defined in:
lib/ansible/zwave/openzwave/ozw_headers.rb,
lib/ansible/config.rb,
lib/ansible/zwave/openzwave/ozw_types.rb,
lib/ansible/zwave/zwave_command_classes.rb,
lib/ansible/zwave/openzwave/ozw_constants.rb,
lib/ansible/zwave/openzwave/ozw_remote_manager.rb

Overview

Autogenerated by Thrift Compiler (1.0.0-dev)

DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING

Defined Under Namespace

Modules: DriverControllerCommand, RemoteManager, RemoteValueGenre, RemoteValueType Classes: Bool_Bool, Bool_Float, Bool_GetNodeClassInformation, Bool_Int, Bool_Int16, Bool_ListString, Bool_String, Bool_UInt8, DriverData, GetAllScenesReturnStruct, GetAssociationsReturnStruct, GetDriverStatisticsReturnStruct, GetSwitchPointReturnStruct, RemoteValueID, SceneGetValuesReturnStruct, UInt32_ListByte

Constant Summary collapse

OZW_SRC =

path to OpenZWave source

"#{Ansible.root}/ansible/zwave/openzwave/src"
NotificationTypes =

define OpenZWave global lookup tables

parse_ozw_headers( File.join(OZW_SRC, "Notification.h"), "NotificationType" )
ControllerCommands =
parse_ozw_headers( File.join(OZW_SRC, "Driver.h"), "ControllerCommand" )
ControllerStates =
parse_ozw_headers( File.join(OZW_SRC, "Driver.h"), "ControllerState" )
ValueGenres =
parse_ozw_headers( File.join(OZW_SRC, "value_classes", "ValueID.h"), "ValueGenre" )
ValueTypes =
parse_ozw_headers( File.join(OZW_SRC, "value_classes", "ValueID.h"), "ValueType" )
CommandClassesByName =

hashmap of ZWave’s command class symbol id to byte value

{
  :COMMAND_CLASS_NO_OPERATION => 0x00,
  :COMMAND_CLASS_BASIC => 0x20,
  :COMMAND_CLASS_CONTROLLER_REPLICATION => 0x21,
  :COMMAND_CLASS_APPLICATION_STATUS => 0x22,
  :COMMAND_CLASS_ZIP_SERVICES => 0x23,
  :COMMAND_CLASS_ZIP_SERVER => 0x24,
  :COMMAND_CLASS_SWITCH_BINARY => 0x25,
  :COMMAND_CLASS_SWITCH_MULTILEVEL => 0x26,
  :COMMAND_CLASS_SWITCH_ALL => 0x27,
  :COMMAND_CLASS_SWITCH_TOGGLE_BINARY => 0x28,
  :COMMAND_CLASS_SWITCH_TOGGLE_MULTILEVEL => 0x29,
  :COMMAND_CLASS_CHIMNEY_FAN => 0x2A,
  :COMMAND_CLASS_SCENE_ACTIVATION => 0x2B,
  :COMMAND_CLASS_SCENE_ACTUATOR_CONF => 0x2C,
  :COMMAND_CLASS_SCENE_CONTROLLER_CONF => 0x2D,
  :COMMAND_CLASS_ZIP_CLIENT => 0x2E,
  :COMMAND_CLASS_ZIP_ADV_SERVICES => 0x2F,
  :COMMAND_CLASS_SENSOR_BINARY => 0x30,
  :COMMAND_CLASS_SENSOR_MULTILEVEL => 0x31,
  :COMMAND_CLASS_METER => 0x32,
  :COMMAND_CLASS_ZIP_ADV_SERVER => 0x33,
  :COMMAND_CLASS_ZIP_ADV_CLIENT => 0x34,
  :COMMAND_CLASS_METER_PULSE => 0x35,
  :COMMAND_CLASS_METER_TBL_CONFIG => 0x3C,
  :COMMAND_CLASS_METER_TBL_MONITOR => 0x3D,
  :COMMAND_CLASS_METER_TBL_PUSH => 0x3E,
  :COMMAND_CLASS_THERMOSTAT_HEATING => 0x38,
  :COMMAND_CLASS_THERMOSTAT_MODE => 0x40,
  :COMMAND_CLASS_THERMOSTAT_OPERATING_STATE => 0x42,
  :COMMAND_CLASS_THERMOSTAT_SETPOINT => 0x43,
  :COMMAND_CLASS_THERMOSTAT_FAN_MODE => 0x44,
  :COMMAND_CLASS_THERMOSTAT_FAN_STATE => 0x45,
  :COMMAND_CLASS_CLIMATE_CONTROL_SCHEDULE => 0x46,
  :COMMAND_CLASS_THERMOSTAT_SETBACK => 0x47,
  :COMMAND_CLASS_DOOR_LOCK_LOGGING => 0x4c,
  :COMMAND_CLASS_SCHEDULE_ENTRY_LOCK => 0x4E,
  :COMMAND_CLASS_BASIC_WINDOW_COVERING => 0x50,
  :COMMAND_CLASS_MTP_WINDOW_COVERING => 0x51,
  :COMMAND_CLASS_MULTI_CHANNEL_V2 => 0x60,
  :COMMAND_CLASS_DOOR_LOCK => 0x62,
  :COMMAND_CLASS_USER_CODE => 0x63,
  :COMMAND_CLASS_CONFIGURATION => 0x70,
  :COMMAND_CLASS_ALARM => 0x71,
  :COMMAND_CLASS_MANUFACTURER_SPECIFIC => 0x72,
  :COMMAND_CLASS_POWERLEVEL => 0x73,
  :COMMAND_CLASS_PROTECTION => 0x75,
  :COMMAND_CLASS_LOCK => 0x76,
  :COMMAND_CLASS_NODE_NAMING => 0x77,
  :COMMAND_CLASS_FIRMWARE_UPDATE_MD => 0x7A,
  :COMMAND_CLASS_GROUPING_NAME => 0x7B,
  :COMMAND_CLASS_REMOTE_ASSOCIATION_ACTIVATE => 0x7C,
  :COMMAND_CLASS_REMOTE_ASSOCIATION => 0x7D,
  :COMMAND_CLASS_BATTERY => 0x80,
  :COMMAND_CLASS_CLOCK => 0x81,
  :COMMAND_CLASS_HAIL => 0x82,
  :COMMAND_CLASS_WAKE_UP => 0x84,
  :COMMAND_CLASS_ASSOCIATION => 0x85,
  :COMMAND_CLASS_VERSION => 0x86,
  :COMMAND_CLASS_INDICATOR => 0x87,
  :COMMAND_CLASS_PROPRIETARY => 0x88,
  :COMMAND_CLASS_LANGUAGE => 0x89,
  :COMMAND_CLASS_TIME => 0x8A,
  :COMMAND_CLASS_TIME_PARAMETERS => 0x8B,
  :COMMAND_CLASS_GEOGRAPHIC_LOCATION => 0x8C,
  :COMMAND_CLASS_COMPOSITE => 0x8D,
  :COMMAND_CLASS_MULTI_INSTANCE_ASSOCIATION => 0x8E,
  :COMMAND_CLASS_MULTI_CMD => 0x8F,
  :COMMAND_CLASS_ENERGY_PRODUCTION => 0x90,
  :COMMAND_CLASS_MANUFACTURER_PROPRIETARY => 0x91,
  :COMMAND_CLASS_SCREEN_MD => 0x92,
  :COMMAND_CLASS_SCREEN_ATTRIBUTES => 0x93,
  :COMMAND_CLASS_SIMPLE_AV_CONTROL => 0x94,
  :COMMAND_CLASS_AV_CONTENT_DIRECTORY_MD => 0x95,
  :COMMAND_CLASS_AV_RENDERER_STATUS => 0x96,
  :COMMAND_CLASS_AV_CONTENT_SEARCH_MD => 0x97,
  :COMMAND_CLASS_SECURITY => 0x98,
  :COMMAND_CLASS_AV_TAGGING_MD => 0x99,
  :COMMAND_CLASS_IP_CONFIGURATION => 0x9A,
  :COMMAND_CLASS_ASSOCIATION_COMMAND_CONFIGURATION => 0x9B,
  :COMMAND_CLASS_SENSOR_ALARM => 0x9C,
  :COMMAND_CLASS_SILENCE_ALARM => 0x9D,
  :COMMAND_CLASS_SENSOR_CONFIGURATION => 0x9E,
  :COMMAND_CLASS_MARK => 0xEF,
  :COMMAND_CLASS_NON_INTEROPERABLE => 0xF0
}
CommandClassesByID =

hashmap of ZWave’s command class byte to symbol

CommandClassesByName.invert

Class Method Summary collapse

Class Method Details

.parse_ozw_headers(headerfile, enum_name) ⇒ Object

helper function to parse OpenZWave headers



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/ansible/zwave/openzwave/ozw_headers.rb', line 41

def OpenZWave.parse_ozw_headers(headerfile, enum_name)
    puts "Parsing enum #{enum_name}\tfrom #{headerfile} ..." if $DEBUG
    #~ puts enum_re % enum_name
    foo = File.open(headerfile).read
    enum_array = {}
    if enum = Regexp.new(ENUM_RE % enum_name,  Regexp::EXTENDED | Regexp::IGNORECASE | Regexp::MULTILINE).match(foo) then
        index = 0
        #~ puts enum[1].inspect
        #~ puts '-----------------'
        enum[1].split("\n").each { |line|
            if md = ENUM_RE_LINE.match(line) then
                #puts md[1..-1].inspect
                index =  (md[2] and md[3].length > 0) ? md[3].to_i : index+1
                key, value = md[1], md[4]
                enum_array[index] = [key, value]
                # define back-reference to index as a module constant
                cname = enum_name+'_'+key.split('_')[1]
                #puts "defining constant OpenZWave::#{cname} == #{index}"
                const_set(key, index)
                puts "#{enum_name}[#{index}] = [#{key}, #{value}]" if $DEBUG
            end
        }
        return enum_array
    end
end