Class: RubyHome::HAP::EVResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby_home/hap/ev_response.rb

Instance Method Summary collapse

Constructor Details

#initialize(socket, body) ⇒ EVResponse

Returns a new instance of EVResponse.



4
5
6
7
8
# File 'lib/ruby_home/hap/ev_response.rb', line 4

def initialize(socket, body)
  @socket = socket
  @body = body
  cache[:accessory_to_controller_count] ||= 0
end

Instance Method Details

#send_responseObject



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/ruby_home/hap/ev_response.rb', line 10

def send_response
  response = ''

  send_header(response)
  send_body(response)

  encrypted_response = encrypter.encrypt(response).join
  cache[:accessory_to_controller_count] = encrypter.count

  socket << encrypted_response
end