Module: RubyHome
- Defined in:
- lib/ruby_home.rb,
lib/ruby_home/errors.rb,
lib/ruby_home/greeter.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/configuration.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/hap/server_handler.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/http/services/verify_finish_service.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, Configuration, DuplicateCharacteristicError, DuplicateServiceError, FloatValue, IdentifierCache, IdentifyValue, Int32Value, NullValue, RubyHomeError, Service, ServiceCollection, ServiceFactory, ServiceTemplate, StartSRPService, StringValue, TextRecord, Uint32Value, Uint8Value, UnknownCategoriyIdentifierError, UnknownValueError, VerifyFinishService, VerifySRPService
Constant Summary
collapse
- VERSION =
'0.2.5'
Class Method Summary
collapse
Class Method Details
.configuration ⇒ Object
Also known as:
config
28
29
30
|
# File 'lib/ruby_home.rb', line 28
def configuration
@_configuration ||= Configuration.new
end
|
34
35
36
|
# File 'lib/ruby_home.rb', line 34
def configure
yield configuration
end
|
.dns_service ⇒ Object
62
63
64
|
# File 'lib/ruby_home.rb', line 62
def dns_service
@_dns_service ||= DNS::Service.new(configuration: configuration)
end
|
.greet ⇒ Object
70
71
72
|
# File 'lib/ruby_home.rb', line 70
def greet
Greeter.run
end
|
.hap_server ⇒ Object
66
67
68
|
# File 'lib/ruby_home.rb', line 66
def hap_server
@_hap_server ||= HAP::ServerHandler.new(configuration: configuration)
end
|
.run ⇒ Object
38
39
40
41
42
43
44
|
# File 'lib/ruby_home.rb', line 38
def run
trap 'INT' do shutdown end
trap 'TERM' do shutdown end
greet
start
end
|
.shutdown ⇒ Object
56
57
58
59
60
|
# File 'lib/ruby_home.rb', line 56
def shutdown
hap_server.shutdown
threads.each(&:exit)
end
|
.start ⇒ Object
46
47
48
49
50
|
# File 'lib/ruby_home.rb', line 46
def start
threads << Thread.start { dns_service.register }
threads << Thread.start { hap_server.run }
threads.each(&:join)
end
|
.threads ⇒ Object
52
53
54
|
# File 'lib/ruby_home.rb', line 52
def threads
@_threads ||= []
end
|