Class: Tinkerforge::BrickDaemon
- 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::RESPONSE_EXPECTED_ALWAYS_FALSE, 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, #registered_callbacks, #uid
Instance Method Summary collapse
- #authenticate(client_nonce, digest) ⇒ Object
- #get_authentication_nonce ⇒ Object
-
#initialize(uid, ipcon) ⇒ BrickDaemon
constructor
Creates an object with the unique device ID
uidand adds it to the IP Connectionipcon.
Methods inherited from Device
#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.
442 443 444 445 446 447 448 449 |
# File 'lib/tinkerforge/ip_connection.rb', line 442 def initialize(uid, ipcon) super uid, ipcon @api_version = [2, 0, 0] @response_expected[FUNCTION_GET_AUTHENTICATION_NONCE] = RESPONSE_EXPECTED_ALWAYS_TRUE @response_expected[FUNCTION_AUTHENTICATE] = RESPONSE_EXPECTED_TRUE end |
Instance Method Details
#authenticate(client_nonce, digest) ⇒ Object
455 456 457 |
# File 'lib/tinkerforge/ip_connection.rb', line 455 def authenticate(client_nonce, digest) send_request(FUNCTION_AUTHENTICATE, [client_nonce, digest], 'C4 C20', 0, '') end |
#get_authentication_nonce ⇒ Object
451 452 453 |
# File 'lib/tinkerforge/ip_connection.rb', line 451 def get_authentication_nonce send_request(FUNCTION_GET_AUTHENTICATION_NONCE, [], '', 4, 'C4') end |