Class: McProtocolE::Frame3e::Device

Inherits:
Object
  • Object
show all
Defined in:
lib/mc_protocol_e/frame_3e/device.rb

Overview

This class shows a device.

Defined Under Namespace

Modules: Code, Type

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(code:, type:) ⇒ Device

Constructor.

Parameters:

  • code (String)

    device code

  • type (Symbol)

    device type



49
50
51
52
# File 'lib/mc_protocol_e/frame_3e/device.rb', line 49

def initialize(code:, type:)
  @code = code
  @type = type
end

Instance Attribute Details

#codeObject (readonly)

Returns the value of attribute code.



44
45
46
# File 'lib/mc_protocol_e/frame_3e/device.rb', line 44

def code
  @code
end

Class Method Details

.annunciatorObject



78
79
80
# File 'lib/mc_protocol_e/frame_3e/device.rb', line 78

def self.annunciator
  new(code: Code::ANNUNCIATOR, type: Type::BIT)
end

.counter_coilObject



126
127
128
# File 'lib/mc_protocol_e/frame_3e/device.rb', line 126

def self.counter_coil
  new(code: Code::COUNTER_COIL, type: Type::BIT)
end

.counter_contactObject



122
123
124
# File 'lib/mc_protocol_e/frame_3e/device.rb', line 122

def self.counter_contact
  new(code: Code::COUNTER_CONTACT, type: Type::BIT)
end

.counter_current_valueObject



130
131
132
# File 'lib/mc_protocol_e/frame_3e/device.rb', line 130

def self.counter_current_value
  new(code: Code::COUNTER_CURRENT_VALUE, type: Type::WORD)
end

.data_registerObject



90
91
92
# File 'lib/mc_protocol_e/frame_3e/device.rb', line 90

def self.data_register
  new(code: Code::DATA_REGISTER, type: Type::WORD)
end

.direct_access_inputObject



142
143
144
# File 'lib/mc_protocol_e/frame_3e/device.rb', line 142

def self.direct_access_input
  new(code: Code::DIRECT_ACCESS_INPUT, type: Type::BIT)
end

.direct_access_outputObject



146
147
148
# File 'lib/mc_protocol_e/frame_3e/device.rb', line 146

def self.direct_access_output
  new(code: Code::DIRECT_ACCESS_OUTPUT, type: Type::BIT)
end

.edge_relayObject



82
83
84
# File 'lib/mc_protocol_e/frame_3e/device.rb', line 82

def self.edge_relay
  new(code: Code::EDGE_RELAY, type: Type::BIT)
end

.file_register_bsmObject



154
155
156
# File 'lib/mc_protocol_e/frame_3e/device.rb', line 154

def self.file_register_bsm
  new(code: Code::FILE_REGISTER_BSM, type: Type::WORD)
end

.file_register_snamObject



158
159
160
# File 'lib/mc_protocol_e/frame_3e/device.rb', line 158

def self.file_register_snam
  new(code: Code::FILE_REGISTER_SNAM, type: Type::BIT)
end

.index_registerObject



150
151
152
# File 'lib/mc_protocol_e/frame_3e/device.rb', line 150

def self.index_register
  new(code: Code::INDEX_REGISTER, type: Type::WORD)
end

.inputObject



62
63
64
# File 'lib/mc_protocol_e/frame_3e/device.rb', line 62

def self.input
  new(code: Code::INPUT, type: Type::BIT)
end

.internal_relayObject



70
71
72
# File 'lib/mc_protocol_e/frame_3e/device.rb', line 70

def self.internal_relay
  new(code: Code::INTERNAL_RELAY, type: Type::BIT)
end

.latch_relayObject



74
75
76
# File 'lib/mc_protocol_e/frame_3e/device.rb', line 74

def self.latch_relay
  new(code: Code::LATCH_RELAY, type: Type::BIT)
end


94
95
96
# File 'lib/mc_protocol_e/frame_3e/device.rb', line 94

def self.link_register
  new(code: Code::LINK_REGISTER, type: Type::WORD)
end


86
87
88
# File 'lib/mc_protocol_e/frame_3e/device.rb', line 86

def self.link_relay
  new(code: Code::LINK_RELAY, type: Type::BIT)
end


138
139
140
# File 'lib/mc_protocol_e/frame_3e/device.rb', line 138

def self.link_special_register
  new(code: Code::LINK_SPECIAL_REGISTER, type: Type::WORD)
end


134
135
136
# File 'lib/mc_protocol_e/frame_3e/device.rb', line 134

def self.link_special_relay
  new(code: Code::LINK_SPECIAL_RELAY, type: Type::BIT)
end

.outputObject



66
67
68
# File 'lib/mc_protocol_e/frame_3e/device.rb', line 66

def self.output
  new(code: Code::OUTPUT, type: Type::BIT)
end

.retentive_timer_coilObject



114
115
116
# File 'lib/mc_protocol_e/frame_3e/device.rb', line 114

def self.retentive_timer_coil
  new(code: Code::RETENTIVE_TIMER_COIL, type: Type::BIT)
end

.retentive_timer_contactObject



110
111
112
# File 'lib/mc_protocol_e/frame_3e/device.rb', line 110

def self.retentive_timer_contact
  new(code: Code::RETENTIVE_TIMER_CONTACT, type: Type::BIT)
end

.retentive_timer_current_valueObject



118
119
120
# File 'lib/mc_protocol_e/frame_3e/device.rb', line 118

def self.retentive_timer_current_value
  new(code: Code::RETENTIVE_TIMER_CURRENT_VALUE, type: Type::WORD)
end

.special_registerObject



58
59
60
# File 'lib/mc_protocol_e/frame_3e/device.rb', line 58

def self.special_register
  new(code: Code::SPECIAL_REGISTER, type: Type::WORD)
end

.special_relayObject



54
55
56
# File 'lib/mc_protocol_e/frame_3e/device.rb', line 54

def self.special_relay
  new(code: Code::SPECIAL_RELAY, type: Type::BIT)
end

.timer_coilObject



102
103
104
# File 'lib/mc_protocol_e/frame_3e/device.rb', line 102

def self.timer_coil
  new(code: Code::TIMER_COIL, type: Type::BIT)
end

.timer_contactObject



98
99
100
# File 'lib/mc_protocol_e/frame_3e/device.rb', line 98

def self.timer_contact
  new(code: Code::TIMER_CONTACT, type: Type::BIT)
end

.timer_current_valueObject



106
107
108
# File 'lib/mc_protocol_e/frame_3e/device.rb', line 106

def self.timer_current_value
  new(code: Code::TIMER_CURRENT_VALUE, type: Type::WORD)
end

Instance Method Details

#bit?Boolean

Returns:

  • (Boolean)


162
163
164
# File 'lib/mc_protocol_e/frame_3e/device.rb', line 162

def bit?
  type == Type::BIT
end

#to_bObject



170
171
172
# File 'lib/mc_protocol_e/frame_3e/device.rb', line 170

def to_b
  code
end

#word?Boolean

Returns:

  • (Boolean)


166
167
168
# File 'lib/mc_protocol_e/frame_3e/device.rb', line 166

def word?
  type == Type::WORD
end