Class: RubyHome::Characteristic
- Inherits:
-
Object
- Object
- RubyHome::Characteristic
- Includes:
- Wisper::Publisher
- Defined in:
- lib/ruby_home/hap/characteristic.rb
Constant Summary collapse
- PROPERTIES =
{ 'cnotify' => 'ev', 'read' => 'pr', 'uncnotify' => nil, 'write' => 'pw', }.freeze
Instance Attribute Summary collapse
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#format ⇒ Object
readonly
Returns the value of attribute format.
-
#instance_id ⇒ Object
Returns the value of attribute instance_id.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#properties ⇒ Object
readonly
Returns the value of attribute properties.
-
#service ⇒ Object
readonly
Returns the value of attribute service.
-
#unit ⇒ Object
readonly
Returns the value of attribute unit.
-
#uuid ⇒ Object
readonly
Returns the value of attribute uuid.
-
#value ⇒ Object
Returns the value of attribute value.
Instance Method Summary collapse
- #accessory ⇒ Object
- #accessory_id ⇒ Object
-
#initialize(uuid:, name:, description:, format:, unit:, properties:, service:, value: nil) ⇒ Characteristic
constructor
A new instance of Characteristic.
- #inspect ⇒ Object
- #save ⇒ Object
- #service_iid ⇒ Object
Constructor Details
#initialize(uuid:, name:, description:, format:, unit:, properties:, service:, value: nil) ⇒ Characteristic
Returns a new instance of Characteristic.
14 15 16 17 18 19 20 21 22 23 |
# File 'lib/ruby_home/hap/characteristic.rb', line 14 def initialize(uuid:, name:, description:, format:, unit:, properties:, service: , value: nil) @uuid = uuid @name = name @description = description @format = format @unit = unit @properties = properties @service = service @value = value end |
Instance Attribute Details
#description ⇒ Object (readonly)
Returns the value of attribute description.
25 26 27 |
# File 'lib/ruby_home/hap/characteristic.rb', line 25 def description @description end |
#format ⇒ Object (readonly)
Returns the value of attribute format.
25 26 27 |
# File 'lib/ruby_home/hap/characteristic.rb', line 25 def format @format end |
#instance_id ⇒ Object
Returns the value of attribute instance_id.
26 27 28 |
# File 'lib/ruby_home/hap/characteristic.rb', line 26 def instance_id @instance_id end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
25 26 27 |
# File 'lib/ruby_home/hap/characteristic.rb', line 25 def name @name end |
#properties ⇒ Object (readonly)
Returns the value of attribute properties.
25 26 27 |
# File 'lib/ruby_home/hap/characteristic.rb', line 25 def properties @properties end |
#service ⇒ Object (readonly)
Returns the value of attribute service.
25 26 27 |
# File 'lib/ruby_home/hap/characteristic.rb', line 25 def service @service end |
#unit ⇒ Object (readonly)
Returns the value of attribute unit.
25 26 27 |
# File 'lib/ruby_home/hap/characteristic.rb', line 25 def unit @unit end |
#uuid ⇒ Object (readonly)
Returns the value of attribute uuid.
25 26 27 |
# File 'lib/ruby_home/hap/characteristic.rb', line 25 def uuid @uuid end |
#value ⇒ Object
Returns the value of attribute value.
25 26 27 |
# File 'lib/ruby_home/hap/characteristic.rb', line 25 def value @value end |
Instance Method Details
#accessory ⇒ Object
28 29 30 |
# File 'lib/ruby_home/hap/characteristic.rb', line 28 def accessory service.accessory end |
#accessory_id ⇒ Object
32 33 34 |
# File 'lib/ruby_home/hap/characteristic.rb', line 32 def accessory_id accessory.id end |
#inspect ⇒ Object
45 46 47 48 49 50 51 52 53 |
# File 'lib/ruby_home/hap/characteristic.rb', line 45 def inspect { name: name, value: value, accessory_id: accessory_id, service_iid: service_iid, instance_id: instance_id } end |
#save ⇒ Object
55 56 57 58 |
# File 'lib/ruby_home/hap/characteristic.rb', line 55 def save IdentifierCache.add_accessory(accessory) IdentifierCache.add_characteristic(self) end |
#service_iid ⇒ Object
36 37 38 |
# File 'lib/ruby_home/hap/characteristic.rb', line 36 def service_iid service.instance_id end |