Class: Tinkerforge::BrickDaemon

Inherits:
Device
  • Object
show all
Defined in:
lib/tinkerforge/ip_connection.rb

Overview

internal

Constant Summary collapse

FUNCTION_GET_AUTHENTICATION_NONCE =

:nodoc:

1
FUNCTION_AUTHENTICATE =

:nodoc:

2

Constants inherited from Device

Device::DEVICE_IDENTIFIER_CHECK_MATCH, Device::DEVICE_IDENTIFIER_CHECK_MISMATCH, Device::DEVICE_IDENTIFIER_CHECK_PENDING, Device::RESPONSE_EXPECTED_ALWAYS_TRUE, Device::RESPONSE_EXPECTED_FALSE, Device::RESPONSE_EXPECTED_INVALID_FUNCTION_ID, Device::RESPONSE_EXPECTED_TRUE

Instance Attribute Summary

Attributes inherited from Device

#callback_formats, #expected_response_function_id, #expected_response_sequence_number, #high_level_callbacks, #registered_callbacks, #replaced, #uid

Instance Method Summary collapse

Methods inherited from Device

#check_validity, #dequeue_response, #enqueue_response, #get_api_version, #get_response_expected, #send_request, #set_response_expected, #set_response_expected_all

Constructor Details

#initialize(uid, ipcon) ⇒ BrickDaemon

Creates an object with the unique device ID uid and adds it to the IP Connection ipcon.



534
535
536
537
538
539
540
541
542
543
# File 'lib/tinkerforge/ip_connection.rb', line 534

def initialize(uid, ipcon)
  super uid, ipcon, 0, 'Brick Daemon'

  @api_version = [2, 0, 0]

  @response_expected[FUNCTION_GET_AUTHENTICATION_NONCE] = RESPONSE_EXPECTED_ALWAYS_TRUE
  @response_expected[FUNCTION_AUTHENTICATE] = RESPONSE_EXPECTED_TRUE

  @ipcon.add_device self
end

Instance Method Details

#authenticate(client_nonce, digest) ⇒ Object



549
550
551
# File 'lib/tinkerforge/ip_connection.rb', line 549

def authenticate(client_nonce, digest)
  send_request FUNCTION_AUTHENTICATE, [client_nonce, digest], 'C4 C20', 0, ''
end

#get_authentication_nonceObject



545
546
547
# File 'lib/tinkerforge/ip_connection.rb', line 545

def get_authentication_nonce
  send_request FUNCTION_GET_AUTHENTICATION_NONCE, [], '', 12, 'C4'
end