Module: Zklib::PINManagement

Included in:
Zklib
Defined in:
lib/zklib/pin_management.rb

Constant Summary collapse

PIN_WIDTH_KEYWORD =
'~PIN2Width'

Instance Method Summary collapse

Instance Method Details

#get_pin_widthObject

Get PIN width



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/zklib/pin_management.rb', line 6

def get_pin_width
  execute_cmd(
    command:        CMD_DEVICE,
    command_string: PIN_WIDTH_KEYWORD
  ) do |opts|
    return puts "ERROR: #{options[:error]}" unless opts[:valid]

    data = opts[:data]
    if data.length > 8
      data.split("\u0000").pop.tr("#{PIN_WIDTH_KEYWORD}=", '')
    else
      puts 'ERROR: Invalid PIN width response'
    end
  end
end