Module: Flic::Protocol::Commands

Defined in:
lib/flic/protocol/commands.rb,
lib/flic/protocol/commands/ping.rb,
lib/flic/protocol/commands/command.rb,
lib/flic/protocol/commands/get_info.rb,
lib/flic/protocol/commands/create_scanner.rb,
lib/flic/protocol/commands/remove_scanner.rb,
lib/flic/protocol/commands/get_button_uuid.rb,
lib/flic/protocol/commands/force_disconnect.rb,
lib/flic/protocol/commands/cancel_scan_wizard.rb,
lib/flic/protocol/commands/create_scan_wizard.rb,
lib/flic/protocol/commands/change_mode_parameters.rb,
lib/flic/protocol/commands/create_connection_channel.rb,
lib/flic/protocol/commands/remove_connection_channel.rb

Overview

A namespace module for all of the command classes

Defined Under Namespace

Classes: CancelScanWizard, ChangeModeParameters, Command, CreateConnectionChannel, CreateScanWizard, CreateScanner, ForceDisconnect, GetButtonUuid, GetInfo, Ping, RemoveConnectionChannel, RemoveScanner

Constant Summary collapse

COMMAND_CLASS_OPCODE =
{
    Commands::GetInfo                   => 0x00,
    Commands::CreateScanner             => 0x01,
    Commands::RemoveScanner             => 0x02,
    Commands::CreateConnectionChannel   => 0x03,
    Commands::RemoveConnectionChannel   => 0x04,
    Commands::ForceDisconnect           => 0x05,
    Commands::ChangeModeParameters      => 0x06,
    Commands::Ping                      => 0x07,
    Commands::GetButtonUuid             => 0x08,
    Commands::CreateScanWizard          => 0x09,
    Commands::CancelScanWizard          => 0x0A
}.freeze
OPCODE_COMMAND_CLASS =
COMMAND_CLASS_OPCODE.invert.freeze

Class Method Summary collapse

Class Method Details

.command_class_for_opcode(opcode) ⇒ Class

Finds the command class for a given opcode

Parameters:

  • opcode (Integer)

Returns:

  • (Class)


39
40
41
# File 'lib/flic/protocol/commands.rb', line 39

def self.command_class_for_opcode(opcode)
  OPCODE_COMMAND_CLASS[opcode]
end

.opcode_for_command_class(command_class) ⇒ Integer

Finds the opcode for a given command class

Parameters:

  • command_class (Class)

Returns:

  • (Integer)


46
47
48
# File 'lib/flic/protocol/commands.rb', line 46

def self.opcode_for_command_class(command_class)
  COMMAND_CLASS_OPCODE[command_class]
end