Class: SDN::Message::ILT2::SetLockStatus

Inherits:
SDN::Message show all
Defined in:
lib/sdn/message/ilt2/set.rb

Constant Summary collapse

MSG =
0x5B
PARAMS_LENGTH =
3
TARGET_TYPE =
{
  current: 0,
  up_limit: 1,
  down_limit: 2,
  ip: 4,
  unlock: 5
}

Instance Attribute Summary collapse

Attributes inherited from SDN::Message

#ack_requested, #dest, #node_type, #src

Instance Method Summary collapse

Methods inherited from SDN::Message

#==, #class_inspect, expected_response?, inherited, #inspect, parse, #serialize

Methods included from Helpers

#checksum, #from_number, #from_string, #is_group_address?, #node_type_from_number, #node_type_to_number, #node_type_to_string, #parse_address, #print_address, #to_number, #to_string, #transform_param

Constructor Details

#initialize(dest = nil, target_type = :unlock, target = nil, priority = 1, **kwargs) ⇒ SetLockStatus

Returns a new instance of SetLockStatus.



27
28
29
30
31
32
33
# File 'lib/sdn/message/ilt2/set.rb', line 27

def initialize(dest = nil, target_type = :unlock, target = nil, priority = 1, **kwargs)
  kwargs[:dest] ||= dest
  super(**kwargs)
  self.target_type = target_type
  self.target = target
  self.priority = priority
end

Instance Attribute Details

#priorityObject

when target_type is down_limit, target is number of 10ms intervals it’s still allowed to roll up



25
26
27
# File 'lib/sdn/message/ilt2/set.rb', line 25

def priority
  @priority
end

#targetObject

when target_type is down_limit, target is number of 10ms intervals it’s still allowed to roll up



25
26
27
# File 'lib/sdn/message/ilt2/set.rb', line 25

def target
  @target
end

#target_typeObject

when target_type is down_limit, target is number of 10ms intervals it’s still allowed to roll up



25
26
27
# File 'lib/sdn/message/ilt2/set.rb', line 25

def target_type
  @target_type
end

Instance Method Details

#paramsObject



56
57
58
# File 'lib/sdn/message/ilt2/set.rb', line 56

def params
  transform_param(TARGET_TYPE[target_type]) + transform_param(target) + transform_param(priority)
end

#parse(params) ⇒ Object



35
36
37
38
39
40
# File 'lib/sdn/message/ilt2/set.rb', line 35

def parse(params)
  super
  self.target_type = TARGET_TYPE.invert[to_number(params[0])]
  self.target = to_number(params[1])
  self.priority = to_number(params[2])
end