Class: RubyHome::HAP::Session
- Inherits:
-
Object
- Object
- RubyHome::HAP::Session
- Defined in:
- lib/ruby_home/hap/session.rb
Instance Attribute Summary collapse
-
#accessory_to_controller_count ⇒ Object
writeonly
Sets the attribute accessory_to_controller_count.
-
#accessory_to_controller_key ⇒ Object
Returns the value of attribute accessory_to_controller_key.
-
#controller_to_accessory_count ⇒ Object
writeonly
Sets the attribute controller_to_accessory_count.
-
#controller_to_accessory_key ⇒ Object
Returns the value of attribute controller_to_accessory_key.
-
#session_key ⇒ Object
Returns the value of attribute session_key.
-
#shared_secret ⇒ Object
Returns the value of attribute shared_secret.
-
#socket ⇒ Object
readonly
Returns the value of attribute socket.
-
#srp_session ⇒ Object
Returns the value of attribute srp_session.
Instance Method Summary collapse
- #active? ⇒ Boolean
- #decrypter ⇒ Object
- #decryption_time? ⇒ Boolean
- #encrypter ⇒ Object
- #encryption_time? ⇒ Boolean
-
#initialize(socket) ⇒ Session
constructor
A new instance of Session.
- #received_encrypted_request? ⇒ Boolean
- #sufficient_privileges? ⇒ Boolean
Constructor Details
#initialize(socket) ⇒ Session
Returns a new instance of Session.
4 5 6 7 8 |
# File 'lib/ruby_home/hap/session.rb', line 4 def initialize(socket) @socket = socket @accessory_to_controller_count = 0 @controller_to_accessory_count = 0 end |
Instance Attribute Details
#accessory_to_controller_count=(value) ⇒ Object
Sets the attribute accessory_to_controller_count
13 14 15 |
# File 'lib/ruby_home/hap/session.rb', line 13 def accessory_to_controller_count=(value) @accessory_to_controller_count = value end |
#accessory_to_controller_key ⇒ Object
Returns the value of attribute accessory_to_controller_key.
12 13 14 |
# File 'lib/ruby_home/hap/session.rb', line 12 def accessory_to_controller_key @accessory_to_controller_key end |
#controller_to_accessory_count=(value) ⇒ Object
Sets the attribute controller_to_accessory_count
14 15 16 |
# File 'lib/ruby_home/hap/session.rb', line 14 def controller_to_accessory_count=(value) @controller_to_accessory_count = value end |
#controller_to_accessory_key ⇒ Object
Returns the value of attribute controller_to_accessory_key.
11 12 13 |
# File 'lib/ruby_home/hap/session.rb', line 11 def controller_to_accessory_key @controller_to_accessory_key end |
#session_key ⇒ Object
Returns the value of attribute session_key.
16 17 18 |
# File 'lib/ruby_home/hap/session.rb', line 16 def session_key @session_key end |
#shared_secret ⇒ Object
Returns the value of attribute shared_secret.
15 16 17 |
# File 'lib/ruby_home/hap/session.rb', line 15 def shared_secret @shared_secret end |
#socket ⇒ Object (readonly)
Returns the value of attribute socket.
10 11 12 |
# File 'lib/ruby_home/hap/session.rb', line 10 def socket @socket end |
#srp_session ⇒ Object
Returns the value of attribute srp_session.
17 18 19 |
# File 'lib/ruby_home/hap/session.rb', line 17 def srp_session @srp_session end |
Instance Method Details
#active? ⇒ Boolean
43 44 45 |
# File 'lib/ruby_home/hap/session.rb', line 43 def active? !socket.closed? end |
#decrypter ⇒ Object
35 36 37 |
# File 'lib/ruby_home/hap/session.rb', line 35 def decrypter HTTPDecryption.new(controller_to_accessory_key, decrypter_params) end |
#decryption_time? ⇒ Boolean
31 32 33 |
# File 'lib/ruby_home/hap/session.rb', line 31 def decryption_time? controller_to_accessory_key.present? end |
#encrypter ⇒ Object
27 28 29 |
# File 'lib/ruby_home/hap/session.rb', line 27 def encrypter HTTPEncryption.new(accessory_to_controller_key, encrypter_params) end |
#encryption_time? ⇒ Boolean
19 20 21 |
# File 'lib/ruby_home/hap/session.rb', line 19 def encryption_time? accessory_to_controller_key? && received_encrypted_request? end |
#received_encrypted_request? ⇒ Boolean
23 24 25 |
# File 'lib/ruby_home/hap/session.rb', line 23 def received_encrypted_request? controller_to_accessory_count > 0 end |
#sufficient_privileges? ⇒ Boolean
39 40 41 |
# File 'lib/ruby_home/hap/session.rb', line 39 def sufficient_privileges? controller_to_accessory_key? && accessory_to_controller_key? end |