module Flic::Client::Features::GetInfo
Public Class Methods
new(*)
click to toggle source
Calls superclass method
# File lib/flic/client/features/get_info.rb, line 9 def initialize(*) @get_info_callbacks_semaphore = Mutex.new @get_info_callbacks = [] super end
Public Instance Methods
get_info(callback = Proc.new)
click to toggle source
# File lib/flic/client/features/get_info.rb, line 16 def get_info(callback = Proc.new) @get_info_callbacks_semaphore.synchronize do @get_info_callbacks << callback end send_command Protocol::Commands::GetInfo.new end
Private Instance Methods
handle_event(event)
click to toggle source
Calls superclass method
# File lib/flic/client/features/get_info.rb, line 26 def handle_event(event) case event when Protocol::Events::GetInfoResponse server_info = ServerInfo.new( event.bluetooth_controller_state, event.bluetooth_address, event.bluetooth_address_type, event.maximum_pending_connections, event.maximum_concurrently_connected_buttons, event.current_pending_connections, event.currently_no_space_for_new_connection, event.verified_buttons_bluetooth_addresses ) callback = @get_info_callbacks_semaphore.synchronize do @get_info_callbacks.shift end callback.call server_info if callback else super end end