Module: Flic::Client::Features::ConnectionChannel
- Included in:
- Flic::Client
- Defined in:
- lib/flic/client/features/connection_channel.rb
Instance Method Summary collapse
- #add_connection_channel(connection_channel) ⇒ Object
- #connection_channels ⇒ Object
- #initialize ⇒ Object
- #remove_connection_channel(connection_channel) ⇒ Object
- #shutdown ⇒ Object
Instance Method Details
#add_connection_channel(connection_channel) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/flic/client/features/connection_channel.rb', line 20 def add_connection_channel(connection_channel) connection_channel_id = _add_connection_channel(connection_channel) if connection_channel_id send_command Protocol::Commands::CreateConnectionChannel.new( connection_channel_id: connection_channel_id, bluetooth_address: connection_channel., latency_mode: connection_channel.latency_mode, auto_disconnect_time: connection_channel.auto_disconnect_time ) end end |
#connection_channels ⇒ Object
16 17 18 |
# File 'lib/flic/client/features/connection_channel.rb', line 16 def connection_channels @connection_channel_id_connection_channel_semaphore.synchronize { @connection_channel_id_connection_channel.values } end |
#initialize ⇒ Object
9 10 11 12 13 14 |
# File 'lib/flic/client/features/connection_channel.rb', line 9 def initialize(*) @connection_channel_id_connection_channel_semaphore = Mutex.new @connection_channel_id_connection_channel = {} super end |
#remove_connection_channel(connection_channel) ⇒ Object
33 34 35 36 37 38 39 40 41 |
# File 'lib/flic/client/features/connection_channel.rb', line 33 def remove_connection_channel(connection_channel) connection_channel_id = find_connection_channel_id_by_connection_channel(connection_channel) if connection_channel_id send_command Protocol::Commands::RemoveConnectionChannel.new( connection_channel_id: connection_channel_id ) end end |
#shutdown ⇒ Object
43 44 45 46 47 48 49 50 |
# File 'lib/flic/client/features/connection_channel.rb', line 43 def shutdown(*) connection_channels.each do |connection_channel| _remove_connection_channel(connection_channel) connection_channel.removed self end super end |