Class: RSMP::AlarmState

Inherits:
Object
  • Object
show all
Defined in:
lib/rsmp/alarm_state.rb

Overview

class that tracks the state of an alarm

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(component_id:, code:) ⇒ AlarmState

Returns a new instance of AlarmState.



6
7
8
9
10
11
12
13
14
15
# File 'lib/rsmp/alarm_state.rb', line 6

def initialize component_id:, code:
  @component_id = component_id
  @code = code
  @acknowledged = false
  @suspended = false
  @active = false
  @timestamp = nil
  @category = nil
  @priority = nil
end

Instance Attribute Details

#acknowledgedObject (readonly)

Returns the value of attribute acknowledged.



4
5
6
# File 'lib/rsmp/alarm_state.rb', line 4

def acknowledged
  @acknowledged
end

#activeObject (readonly)

Returns the value of attribute active.



4
5
6
# File 'lib/rsmp/alarm_state.rb', line 4

def active
  @active
end

#categoryObject (readonly)

Returns the value of attribute category.



4
5
6
# File 'lib/rsmp/alarm_state.rb', line 4

def category
  @category
end

#codeObject (readonly)

Returns the value of attribute code.



4
5
6
# File 'lib/rsmp/alarm_state.rb', line 4

def code
  @code
end

#component_idObject (readonly)

Returns the value of attribute component_id.



4
5
6
# File 'lib/rsmp/alarm_state.rb', line 4

def component_id
  @component_id
end

#priorityObject (readonly)

Returns the value of attribute priority.



4
5
6
# File 'lib/rsmp/alarm_state.rb', line 4

def priority
  @priority
end

#suspendedObject (readonly)

Returns the value of attribute suspended.



4
5
6
# File 'lib/rsmp/alarm_state.rb', line 4

def suspended
  @suspended
end

#timestampObject (readonly)

Returns the value of attribute timestamp.



4
5
6
# File 'lib/rsmp/alarm_state.rb', line 4

def timestamp
  @timestamp
end

Instance Method Details

#resumeObject



21
22
23
# File 'lib/rsmp/alarm_state.rb', line 21

def resume
  @suspended = false
end

#suspendObject



17
18
19
# File 'lib/rsmp/alarm_state.rb', line 17

def suspend
  @suspended = true
end