Method: Tinkerforge::IPConnection#initialize
- Defined in:
- lib/tinkerforge/ip_connection.rb
#initialize ⇒ IPConnection
Creates an IP Connection object that can be used to enumerate the available devices. It is also required for the constructor of Bricks and Bricklets.
583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 |
# File 'lib/tinkerforge/ip_connection.rb', line 583 def initialize @host = nil @port = 0 @timeout = 2.5 @auto_reconnect = true @auto_reconnect_allowed = false @auto_reconnect_pending = false @next_sequence_number = 0 # protected by sequence_number_mutex @sequence_number_mutex = Mutex.new @next_authentication_nonce = 0 # protected by authentication_mutex @authentication_mutex = Mutex.new # protects authentication handshake @devices = {} @replace_mutex = Mutex.new # used to synchronize replacements in the devices dict @registered_callbacks = {} @socket_mutex = Mutex.new @socket_send_mutex = Mutex.new @socket = nil # protected by socket_mutex @socket_id = 0 # protected by socket_mutex @receive_flag = false @receive_thread = nil @callback = nil @disconnect_probe_flag = false @disconnect_probe_queue = nil @disconnect_probe_thread = nil # protected by socket_mutex @waiter_queue = Queue.new @brickd = BrickDaemon.new '2', self end |