Module: RubyHome

Defined in:
lib/ruby_home.rb,
lib/ruby_home/greeter.rb,
lib/ruby_home/hap/tlv.rb,
lib/ruby_home/service.rb,
lib/ruby_home/version.rb,
lib/ruby_home/password.rb,
lib/ruby_home/accessory.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/session.rb,
lib/ruby_home/persistable.rb,
lib/ruby_home/hap/decrypter.rb,
lib/ruby_home/hap/encrypter.rb,
lib/ruby_home/accessory_info.rb,
lib/ruby_home/characteristic.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/service_collection.rb,
lib/ruby_home/accessory_collection.rb,
lib/ruby_home/hap/values/base_value.rb,
lib/ruby_home/hap/values/bool_value.rb,
lib/ruby_home/hap/values/null_value.rb,
lib/ruby_home/hap/crypto/session_key.rb,
lib/ruby_home/hap/values/float_value.rb,
lib/ruby_home/hap/values/int32_value.rb,
lib/ruby_home/hap/values/uint8_value.rb,
lib/ruby_home/hap/values/string_value.rb,
lib/ruby_home/hap/values/uint32_value.rb,
lib/ruby_home/characteristic_collection.rb,
lib/ruby_home/factories/service_factory.rb,
lib/ruby_home/hap/values/identify_value.rb,
lib/ruby_home/hap/crypto/chacha20poly1305.rb,
lib/ruby_home/http/serializers/uuid_helper.rb,
lib/ruby_home/http/services/session_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/http/serializers/service_serializer.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/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, BoolValue, Characteristic, CharacteristicCollection, CharacteristicFactory, CharacteristicTemplate, DuplicateCharacteristicError, DuplicateServiceError, FloatValue, IdentifierCache, IdentifyValue, Int32Value, NullValue, Service, ServiceCollection, ServiceFactory, ServiceTemplate, StartSRPService, StringValue, TextRecord, Uint32Value, Uint8Value, VerifySRPService

Constant Summary collapse

VERSION =
'0.1.19'

Class Method Summary collapse

Class Method Details

.dns_serviceObject



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

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

.greetObject



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

def greet
  Greeter.run
end

.hap_serverObject



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

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

.runObject



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

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

  greet
  start
end

.shutdownObject



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

def shutdown
  hap_server.shutdown

  threads.each(&:exit)
end

.startObject



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

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

.threadsObject



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

def threads
  @_threads ||= []
end