Module: RubyHome

Defined in:
lib/ruby_home.rb,
lib/ruby_home/greeter.rb,
lib/ruby_home/hap/tlv.rb,
lib/ruby_home/version.rb,
lib/ruby_home/password.rb,
lib/ruby_home/device_id.rb,
lib/ruby_home/hap/server.rb,
lib/ruby_home/hex_helper.rb,
lib/ruby_home/dns/service.rb,
lib/ruby_home/hap/service.rb,
lib/ruby_home/persistable.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/hap/ev_response.rb,
lib/ruby_home/hap/hap_request.rb,
lib/ruby_home/hap/hap_response.rb,
lib/ruby_home/http/application.rb,
lib/ruby_home/identifier_cache.rb,
lib/ruby_home/hap/characteristic.rb,
lib/ruby_home/hap/http_decryption.rb,
lib/ruby_home/hap/http_encryption.rb,
lib/ruby_home/hap/crypto/session_key.rb,
lib/ruby_home/hap/accessory_collection.rb,
lib/ruby_home/factories/service_factory.rb,
lib/ruby_home/hap/crypto/chacha20poly1305.rb,
lib/ruby_home/http/services/socket_notifier.rb,
lib/ruby_home/http/services/start_srp_service.rb,
lib/ruby_home/factories/characteristic_factory.rb,
lib/ruby_home/http/services/verify_srp_service.rb,
lib/ruby_home/http/serializers/object_serializer.rb,
lib/ruby_home/factories/default_values/base_value.rb,
lib/ruby_home/factories/default_values/bool_value.rb,
lib/ruby_home/factories/default_values/null_value.rb,
lib/ruby_home/http/serializers/service_serializer.rb,
lib/ruby_home/factories/default_values/float_value.rb,
lib/ruby_home/factories/default_values/int32_value.rb,
lib/ruby_home/factories/default_values/uint8_value.rb,
lib/ruby_home/factories/templates/service_template.rb,
lib/ruby_home/http/controllers/identify_controller.rb,
lib/ruby_home/http/controllers/pairings_controller.rb,
lib/ruby_home/factories/default_values/string_value.rb,
lib/ruby_home/factories/default_values/uint32_value.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, DeviceID, Greeter, HAP, HTTP, HexHelper, Password, Persistable Classes: Accessory, AccessoryCollection, AccessoryInfo, BaseValue, BoolDefaultValue, Characteristic, CharacteristicFactory, CharacteristicTemplate, DuplicateCharacteristicError, DuplicateServiceError, FloatDefaultValue, IdentifierCache, Int32DefaultValue, NullDefaultValue, Service, ServiceFactory, ServiceTemplate, StartSRPService, StringDefaultValue, TextRecord, Uint32DefaultValue, Uint8DefaultValue, VerifySRPService

Constant Summary collapse

VERSION =
'0.1.8'

Class Method Summary collapse

Class Method Details

.dns_serviceObject



44
45
46
# File 'lib/ruby_home.rb', line 44

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

.greetObject



56
57
58
# File 'lib/ruby_home.rb', line 56

def greet
  Greeter.run
end

.hap_serverObject



48
49
50
# File 'lib/ruby_home.rb', line 48

def hap_server
  @@_hap_server ||= HAP::Server.new('0.0.0.0', 4567, socket_store)
end

.runObject



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

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

  greet
  start
end

.shutdownObject



40
41
42
# File 'lib/ruby_home.rb', line 40

def shutdown
  threads.each(&:exit)
end

.socket_storeObject



52
53
54
# File 'lib/ruby_home.rb', line 52

def socket_store
  @@_socket_store ||= {}
end

.startObject



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

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

.threadsObject



36
37
38
# File 'lib/ruby_home.rb', line 36

def threads
  @@_threads ||= []
end