Module: RubyHome

Defined in:
lib/ruby_home.rb,
lib/ruby_home/hap/tlv.rb,
lib/ruby_home/version.rb,
lib/ruby_home/device_id.rb,
lib/ruby_home/hex_helper.rb,
lib/ruby_home/dns/service.rb,
lib/ruby_home/hap/service.rb,
lib/ruby_home/hap/accessory.rb,
lib/ruby_home/accessory_info.rb,
lib/ruby_home/dns/text_record.rb,
lib/ruby_home/hap/crypto/hkdf.rb,
lib/ruby_home/http/hap_server.rb,
lib/ruby_home/http/application.rb,
lib/ruby_home/http/hap_request.rb,
lib/ruby_home/identifier_cache.rb,
lib/ruby_home/http/hap_response.rb,
lib/ruby_home/hap/characteristic.rb,
lib/ruby_home/hap/http_decryption.rb,
lib/ruby_home/hap/http_encryption.rb,
lib/ruby_home/rack/handler/hap_server.rb,
lib/ruby_home/factories/accessory_factory.rb,
lib/ruby_home/hap/crypto/chacha20poly1305.rb,
lib/ruby_home/factories/characteristic_factory.rb,
lib/ruby_home/http/serializers/object_serializer.rb,
lib/ruby_home/http/serializers/service_serializer.rb,
lib/ruby_home/factories/templates/service_template.rb,
lib/ruby_home/http/controllers/pairings_controller.rb,
lib/ruby_home/http/serializers/accessory_serializer.rb,
lib/ruby_home/http/controllers/accessories_controller.rb,
lib/ruby_home/http/controllers/application_controller.rb,
lib/ruby_home/http/controllers/pair_setups_controller.rb,
lib/ruby_home/http/controllers/pair_verifies_controller.rb,
lib/ruby_home/http/serializers/characteristic_serializer.rb,
lib/ruby_home/factories/templates/characteristic_template.rb,
lib/ruby_home/http/controllers/characteristics_controller.rb,
lib/ruby_home/http/serializers/characteristic_value_serializer.rb

Defined Under Namespace

Modules: DNS, HAP, HTTP, HexHelper, Rack Classes: Accessory, AccessoryFactory, AccessoryInfo, Characteristic, CharacteristicFactory, CharacteristicTemplate, DeviceID, IdentifierCache, Service, ServiceTemplate, TextRecord

Constant Summary collapse

VERSION =
'0.1.3'

Class Method Summary collapse

Class Method Details

.dns_serviceObject



38
39
40
# File 'lib/ruby_home.rb', line 38

def dns_service
  @_dns_service ||= RubyHome::DNS::Service.new(http_server.port)
end

.http_serverObject



42
43
44
# File 'lib/ruby_home.rb', line 42

def http_server
  @_http_server ||= RubyHome::HTTP::Application.new
end

.runObject



17
18
19
20
21
22
# File 'lib/ruby_home.rb', line 17

def run
  trap 'INT'  do shutdown end
  trap 'TERM' do shutdown end

  start
end

.shutdownObject



34
35
36
# File 'lib/ruby_home.rb', line 34

def shutdown
  threads.each(&:exit)
end

.startObject



24
25
26
27
28
# File 'lib/ruby_home.rb', line 24

def start
  threads << Thread.start { dns_service.register }
  threads << Thread.start { http_server.run }
  threads.each(&:join)
end

.threadsObject



30
31
32
# File 'lib/ruby_home.rb', line 30

def threads
  @@threads ||= []
end