Class: Tinkerforge::BrickESP32Ethernet

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

Overview

ESP32 microcontroller based Brick with Ethernet and 6 Bricklet ports

Constant Summary collapse

DEVICE_IDENTIFIER =

:nodoc:

115
DEVICE_DISPLAY_NAME =

:nodoc:

'ESP32 Ethernet Brick'
FUNCTION_GET_IDENTITY =

:nodoc:

255

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) ⇒ BrickESP32Ethernet

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



25
26
27
28
29
30
31
32
33
34
# File 'lib/tinkerforge/brick_esp32_ethernet.rb', line 25

def initialize(uid, ipcon)
  super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME

  @api_version = [2, 0, 0]

  @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE


  @ipcon.add_device self
end

Instance Method Details

#get_identityObject

Returns the UID, the UID where the Brick is connected to, the position, the hardware and firmware version as well as the device identifier.

The position is the position in the stack from ‘0’ (bottom) to ‘8’ (top).

The device identifier numbers can be found :ref:‘here <device_identifier>`. |device_identifier_constant|



44
45
46
# File 'lib/tinkerforge/brick_esp32_ethernet.rb', line 44

def get_identity
  send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
end