Variables
SECS variable types.
- class secsgem.secs.variables.F4(value=None, count=-1)[source]
Secs type for 4 byte float data.
- Parameters:
value – initial value
count – number of items this value
- class secsgem.secs.variables.F8(value=None, count=-1)[source]
Secs type for 8 byte float data.
- Parameters:
value – initial value
count – number of items this value
- class secsgem.secs.variables.I1(value=None, count=-1)[source]
Secs type for 1 byte signed data.
- Parameters:
value – initial value
count – number of items this value
- class secsgem.secs.variables.I2(value=None, count=-1)[source]
Secs type for 2 byte signed data.
- Parameters:
value – initial value
count – number of items this value
- class secsgem.secs.variables.I4(value=None, count=-1)[source]
Secs type for 4 byte signed data.
- Parameters:
value – initial value
count – number of items this value
- class secsgem.secs.variables.I8(value=None, count=-1)[source]
Secs type for 8 byte signed data.
- Parameters:
value – initial value
count – number of items this value
- class secsgem.secs.variables.JIS8(value='', count=-1)[source]
Secs type for string data.
- Parameters:
value – initial value
count – number of items this value
- class secsgem.secs.variables.U1(value=None, count=-1)[source]
Secs type for 1 byte unsigned data.
- Parameters:
value – initial value
count – number of items this value
- class secsgem.secs.variables.U2(value=None, count=-1)[source]
Secs type for 2 byte unsigned data.
- Parameters:
value – initial value
count – number of items this value
- class secsgem.secs.variables.U4(value=None, count=-1)[source]
Secs type for 4 byte unsigned data.
- Parameters:
value – initial value
count – number of items this value
- class secsgem.secs.variables.U8(value=None, count=-1)[source]
Secs type for 8 byte unsigned data.
- Parameters:
value – initial value
count – number of items this value
- class secsgem.secs.variables.Array(data_format, value=None, count=-1)[source]
List variable type. List with items of same type.
- class secsgem.secs.variables.Base(value=None)[source]
Base class for SECS variables.
Due to the python types, wrapper classes for variables are required. If constructor is called with Base or subclass only the value is copied.
- encode_item_header(length)[source]
Encode item header depending on the number of length bytes required.
- Parameters:
length – number of bytes in data
- Returns:
encoded item header bytes
- decode_item_header(data, text_pos=0)[source]
Encode item header depending on the number of length bytes required.
- Parameters:
data – encoded data
text_pos – start of item header in data
- Return type:
tuple[int,int,int]- Returns:
start position for next item, format code, length item of data
- property is_dynamic: bool
Check if this instance is Dynamic or derived.
- property preferred_type
Get the preferred type for this variable.
- class secsgem.secs.variables.Binary(value=None, count=-1)[source]
Secs type for binary data.
- class secsgem.secs.variables.Boolean(value=None, count=-1)[source]
Secs type for boolean data.
- class secsgem.secs.variables.Dynamic(types, value=None, count=-1)[source]
Variable with interchangable type.
- property preferred_type
Get the preferred type.
- set(value)[source]
Set the internal value to the provided value.
In doubt provide the variable wrapped in the matching
secsgem.secs.variables.Baseclass, to avoid confusion.- Parameters:
value – new value
Example
>>> import secsgem.secs >>> >>> var = secsgem.secs.variables.Dynamic([secsgem.secs.variables.String, ... secsgem.secs.variables.U1]) >>> var.set(secsgem.secs.variables.U1(10)) >>> var <U1 10 >
If no type is provided the default type is used which might not be the expected type.
- decode(data, start=0)[source]
Decode the secs byte data to the value.
- Parameters:
data – encoded data bytes
start – start position of value the data
- Returns:
new start position
- property is_dynamic: bool
Check if this instance is Dynamic or derived.
- class secsgem.secs.variables.List(data_format, value=None)[source]
List variable type. List with items of different types.
- static get_format(data_format, showname=False)[source]
Get the format of the variable.
- Returns:
string representation of the function