Class: PlcUtil::Awl::BasicType
- Inherits:
-
Object
- Object
- PlcUtil::Awl::BasicType
- Defined in:
- lib/plcutil/siemens/awl/basic_type.rb
Constant Summary collapse
- TYPES =
{ :bool => 1, :byte => 8, :char => 8, :date => 16, :dint => 32, :dword => 32, :int => 16, :real => 32, :s5time => 16, :time => 32, :time_of_day => 32, :word => 16, :date_and_time => 32, # only in VAR_TEMP :timer => 1, # only in FC calls :cont_c => 125 * 8 }
Instance Attribute Summary collapse
-
#bit_size ⇒ Object
Returns the value of attribute bit_size.
-
#type_name ⇒ Object
Returns the value of attribute type_name.
Class Method Summary collapse
Instance Method Summary collapse
- #end_address(start_addr) ⇒ Object
-
#initialize(bit_size, type_name) ⇒ BasicType
constructor
A new instance of BasicType.
- #skip_padding(addr) ⇒ Object
Constructor Details
#initialize(bit_size, type_name) ⇒ BasicType
Returns a new instance of BasicType.
24 25 26 |
# File 'lib/plcutil/siemens/awl/basic_type.rb', line 24 def initialize(bit_size, type_name) @bit_size, @type_name = bit_size, type_name end |
Instance Attribute Details
#bit_size ⇒ Object
Returns the value of attribute bit_size.
22 23 24 |
# File 'lib/plcutil/siemens/awl/basic_type.rb', line 22 def bit_size @bit_size end |
#type_name ⇒ Object
Returns the value of attribute type_name.
22 23 24 |
# File 'lib/plcutil/siemens/awl/basic_type.rb', line 22 def type_name @type_name end |
Class Method Details
Instance Method Details
#end_address(start_addr) ⇒ Object
39 40 41 |
# File 'lib/plcutil/siemens/awl/basic_type.rb', line 39 def end_address(start_addr) start_addr.skip bit_size end |
#skip_padding(addr) ⇒ Object
28 29 30 31 32 33 34 35 36 37 |
# File 'lib/plcutil/siemens/awl/basic_type.rb', line 28 def skip_padding(addr) case bit_size when 1 addr when 8 addr.next_byte else addr.next_word end end |