Variables

SECS variable types.

class secsgem.secs.variables.SecsVar[source]

Bases: object

Base class for SECS variables.

Due to the python types, wrapper classes for variables are required. If constructor is called with SecsVar or subclass only the value is copied.

formatCode = -1
static generate(dataformat)[source]

Generate actual variable from data format.

Parameters:dataformat (list/SecsVar based class) – dataformat to create variable for
Returns:created variable
Return type:SecsVar based class
static get_format(dataformat, showname=False)[source]

Gets the format of the function.

Returns:returns the string representation of the function
Return type:string
set(value)[source]

Set the internal value to the provided value.

Parameters:value (various) – new value
encode_item_header(length)[source]

Encode item header depending on the number of length bytes required.

Parameters:length (integer) – number of bytes in data
Returns:encoded item header bytes
Return type:string
decode_item_header(data, text_pos=0)[source]

Encode item header depending on the number of length bytes required.

Parameters:
  • data (string) – encoded data
  • text_pos (integer) – start of item header in data
Returns:

start position for next item, format code, length item of data

Return type:

(integer, integer, integer)

class secsgem.secs.variables.SecsVarDynamic(types, value=None, count=-1)[source]

Bases: secsgem.secs.variables.SecsVar

Variable with interchangable type.

set(value)[source]

Set the internal value to the provided value.

In doubt provide the variable wrapped in the matching secsgem.secs.variables.SecsVar class, to avoid confusion.

Example:

>>> import secsgem
>>>
>>> var = secsgem.SecsVarDynamic([secsgem.SecsVarString, secsgem.SecsVarU1])
>>> var.set(secsgem.SecsVarU1(10))
>>> var
<U1 10 >

If no type is provided the default type is used which might not be the expected type.

Parameters:value (various) – new value
get()[source]

Return the internal value.

Returns:internal value
Return type:various
encode()[source]

Encode the value to secs data.

Returns:encoded data bytes
Return type:string
decode(data, start=0)[source]

Decode the secs byte data to the value.

Parameters:
  • data (string) – encoded data bytes
  • start (integer) – start position of value the data
Returns:

new start position

Return type:

integer

decode_item_header(data, text_pos=0)

Encode item header depending on the number of length bytes required.

Parameters:
  • data (string) – encoded data
  • text_pos (integer) – start of item header in data
Returns:

start position for next item, format code, length item of data

Return type:

(integer, integer, integer)

encode_item_header(length)

Encode item header depending on the number of length bytes required.

Parameters:length (integer) – number of bytes in data
Returns:encoded item header bytes
Return type:string
formatCode = -1
static generate(dataformat)

Generate actual variable from data format.

Parameters:dataformat (list/SecsVar based class) – dataformat to create variable for
Returns:created variable
Return type:SecsVar based class
static get_format(dataformat, showname=False)

Gets the format of the function.

Returns:returns the string representation of the function
Return type:string
class secsgem.secs.variables.ANYVALUE(value=None)[source]

Bases: secsgem.secs.variables.SecsVarDynamic

Dummy data item for generation of unknown types.

Types:
decode(data, start=0)

Decode the secs byte data to the value.

Parameters:
  • data (string) – encoded data bytes
  • start (integer) – start position of value the data
Returns:

new start position

Return type:

integer

decode_item_header(data, text_pos=0)

Encode item header depending on the number of length bytes required.

Parameters:
  • data (string) – encoded data
  • text_pos (integer) – start of item header in data
Returns:

start position for next item, format code, length item of data

Return type:

(integer, integer, integer)

encode()

Encode the value to secs data.

Returns:encoded data bytes
Return type:string
encode_item_header(length)

Encode item header depending on the number of length bytes required.

Parameters:length (integer) – number of bytes in data
Returns:encoded item header bytes
Return type:string
formatCode = -1
static generate(dataformat)

Generate actual variable from data format.

Parameters:dataformat (list/SecsVar based class) – dataformat to create variable for
Returns:created variable
Return type:SecsVar based class
get()

Return the internal value.

Returns:internal value
Return type:various
static get_format(dataformat, showname=False)

Gets the format of the function.

Returns:returns the string representation of the function
Return type:string
set(value)

Set the internal value to the provided value.

In doubt provide the variable wrapped in the matching secsgem.secs.variables.SecsVar class, to avoid confusion.

Example:

>>> import secsgem
>>>
>>> var = secsgem.SecsVarDynamic([secsgem.SecsVarString, secsgem.SecsVarU1])
>>> var.set(secsgem.SecsVarU1(10))
>>> var
<U1 10 >

If no type is provided the default type is used which might not be the expected type.

Parameters:value (various) – new value
class secsgem.secs.variables.SecsVarList(dataformat, value=None)[source]

Bases: secsgem.secs.variables.SecsVar

List variable type. List with items of different types.

formatCode = 0
textCode = 'L'
preferredTypes = [<class 'dict'>]
static get_format(dataformat, showname=False)[source]

Gets the format of the variable.

Returns:returns the string representation of the function
Return type:string
static get_name_from_format(dataformat)[source]

Generates a name for the passed dataformat.

Parameters:dataformat (list/SecsVar based class) – dataformat to get name for
Returns:name for dataformat
Return type:str
set(value)[source]

Set the internal value to the provided value.

Parameters:value (dict/list) – new value
get()[source]

Return the internal value.

Returns:internal value
Return type:list
encode()[source]

Encode the value to secs data.

Returns:encoded data bytes
Return type:string
decode(data, start=0)[source]

Decode the secs byte data to the value.

Parameters:
  • data (string) – encoded data bytes
  • start (integer) – start position of value the data
Returns:

new start position

Return type:

integer

decode_item_header(data, text_pos=0)

Encode item header depending on the number of length bytes required.

Parameters:
  • data (string) – encoded data
  • text_pos (integer) – start of item header in data
Returns:

start position for next item, format code, length item of data

Return type:

(integer, integer, integer)

encode_item_header(length)

Encode item header depending on the number of length bytes required.

Parameters:length (integer) – number of bytes in data
Returns:encoded item header bytes
Return type:string
static generate(dataformat)

Generate actual variable from data format.

Parameters:dataformat (list/SecsVar based class) – dataformat to create variable for
Returns:created variable
Return type:SecsVar based class
class secsgem.secs.variables.SecsVarArray(dataFormat, value=None, count=-1)[source]

Bases: secsgem.secs.variables.SecsVar

List variable type. List with items of same type.

formatCode = 0
textCode = 'L'
preferredTypes = [<class 'list'>]
static get_format(dataformat, showname=False)[source]

Gets the format of the variable.

Returns:returns the string representation of the function
Return type:string
append(data)[source]

Append data to the internal list.

Parameters:value (various) – new value
set(value)[source]

Set the internal value to the provided value.

Parameters:value (list) – new value
get()[source]

Return the internal value.

Returns:internal value
Return type:list
encode()[source]

Encode the value to secs data.

Returns:encoded data bytes
Return type:string
decode(data, start=0)[source]

Decode the secs byte data to the value.

Parameters:
  • data (string) – encoded data bytes
  • start (integer) – start position of value the data
Returns:

new start position

Return type:

integer

decode_item_header(data, text_pos=0)

Encode item header depending on the number of length bytes required.

Parameters:
  • data (string) – encoded data
  • text_pos (integer) – start of item header in data
Returns:

start position for next item, format code, length item of data

Return type:

(integer, integer, integer)

encode_item_header(length)

Encode item header depending on the number of length bytes required.

Parameters:length (integer) – number of bytes in data
Returns:encoded item header bytes
Return type:string
static generate(dataformat)

Generate actual variable from data format.

Parameters:dataformat (list/SecsVar based class) – dataformat to create variable for
Returns:created variable
Return type:SecsVar based class
class secsgem.secs.variables.SecsVarBinary(value=None, count=-1)[source]

Bases: secsgem.secs.variables.SecsVar

Secs type for binary data.

formatCode = 8
textCode = 'B'
preferredTypes = [<class 'bytes'>, <class 'bytearray'>]
supports_value(value)[source]

Check if the current instance supports the provided value.

Parameters:value (any) – value to test
set(value)[source]

Set the internal value to the provided value.

Parameters:value (string/integer) – new value
get()[source]

Return the internal value.

Returns:internal value
Return type:list/integer
encode()[source]

Encode the value to secs data.

Returns:encoded data bytes
Return type:string
decode(data, start=0)[source]

Decode the secs byte data to the value.

Parameters:
  • data (string) – encoded data bytes
  • start (integer) – start position of value the data
Returns:

new start position

Return type:

integer

decode_item_header(data, text_pos=0)

Encode item header depending on the number of length bytes required.

Parameters:
  • data (string) – encoded data
  • text_pos (integer) – start of item header in data
Returns:

start position for next item, format code, length item of data

Return type:

(integer, integer, integer)

encode_item_header(length)

Encode item header depending on the number of length bytes required.

Parameters:length (integer) – number of bytes in data
Returns:encoded item header bytes
Return type:string
static generate(dataformat)

Generate actual variable from data format.

Parameters:dataformat (list/SecsVar based class) – dataformat to create variable for
Returns:created variable
Return type:SecsVar based class
static get_format(dataformat, showname=False)

Gets the format of the function.

Returns:returns the string representation of the function
Return type:string
class secsgem.secs.variables.SecsVarBoolean(value=None, count=-1)[source]

Bases: secsgem.secs.variables.SecsVar

Secs type for boolean data.

formatCode = 9
textCode = 'BOOLEAN'
preferredTypes = [<class 'bool'>]
supports_value(value)[source]

Check if the current instance supports the provided value.

Parameters:value (any) – value to test
set(value)[source]

Set the internal value to the provided value.

Parameters:value (list/boolean) – new value
get()[source]

Return the internal value.

Returns:internal value
Return type:list/boolean
encode()[source]

Encode the value to secs data.

Returns:encoded data bytes
Return type:string
decode(data, start=0)[source]

Decode the secs byte data to the value.

Parameters:
  • data (string) – encoded data bytes
  • start (integer) – start position of value the data
Returns:

new start position

Return type:

integer

decode_item_header(data, text_pos=0)

Encode item header depending on the number of length bytes required.

Parameters:
  • data (string) – encoded data
  • text_pos (integer) – start of item header in data
Returns:

start position for next item, format code, length item of data

Return type:

(integer, integer, integer)

encode_item_header(length)

Encode item header depending on the number of length bytes required.

Parameters:length (integer) – number of bytes in data
Returns:encoded item header bytes
Return type:string
static generate(dataformat)

Generate actual variable from data format.

Parameters:dataformat (list/SecsVar based class) – dataformat to create variable for
Returns:created variable
Return type:SecsVar based class
static get_format(dataformat, showname=False)

Gets the format of the function.

Returns:returns the string representation of the function
Return type:string
class secsgem.secs.variables.SecsVarText(value='', count=-1)[source]

Bases: secsgem.secs.variables.SecsVar

Secs type base for any text data.

formatCode = -1
textCode = ''
controlChars = '\x00\x01\x02\x03\x04\x05\x06\x07\x08\t\n\x0b\x0c\r\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f\x7f\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f\xad'
coding = ''
supports_value(value)[source]

Check if the current instance supports the provided value.

Parameters:value (any) – value to test
set(value)[source]

Set the internal value to the provided value.

Parameters:value (string/integer) – new value
get()[source]

Return the internal value.

Returns:internal value
Return type:string
encode()[source]

Encode the value to secs data.

Returns:encoded data bytes
Return type:string
decode(data, start=0)[source]

Decode the secs byte data to the value.

Parameters:
  • data (string) – encoded data bytes
  • start (integer) – start position of value the data
Returns:

new start position

Return type:

integer

decode_item_header(data, text_pos=0)

Encode item header depending on the number of length bytes required.

Parameters:
  • data (string) – encoded data
  • text_pos (integer) – start of item header in data
Returns:

start position for next item, format code, length item of data

Return type:

(integer, integer, integer)

encode_item_header(length)

Encode item header depending on the number of length bytes required.

Parameters:length (integer) – number of bytes in data
Returns:encoded item header bytes
Return type:string
static generate(dataformat)

Generate actual variable from data format.

Parameters:dataformat (list/SecsVar based class) – dataformat to create variable for
Returns:created variable
Return type:SecsVar based class
static get_format(dataformat, showname=False)

Gets the format of the function.

Returns:returns the string representation of the function
Return type:string
class secsgem.secs.variables.SecsVarString(value='', count=-1)[source]

Bases: secsgem.secs.variables.SecsVarText

Secs type for string data.

Parameters:
  • value (string) – initial value
  • count (integer) – number of items this value
formatCode = 16
textCode = 'A'
preferredTypes = [<class 'bytes'>, <class 'str'>]
controlChars = '\x00\x01\x02\x03\x04\x05\x06\x07\x08\t\n\x0b\x0c\r\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f\x7f\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f\xa0¡¢£¤¥¦§¨©ª«¬\xad®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ'
coding = 'latin-1'
decode(data, start=0)

Decode the secs byte data to the value.

Parameters:
  • data (string) – encoded data bytes
  • start (integer) – start position of value the data
Returns:

new start position

Return type:

integer

decode_item_header(data, text_pos=0)

Encode item header depending on the number of length bytes required.

Parameters:
  • data (string) – encoded data
  • text_pos (integer) – start of item header in data
Returns:

start position for next item, format code, length item of data

Return type:

(integer, integer, integer)

encode()

Encode the value to secs data.

Returns:encoded data bytes
Return type:string
encode_item_header(length)

Encode item header depending on the number of length bytes required.

Parameters:length (integer) – number of bytes in data
Returns:encoded item header bytes
Return type:string
static generate(dataformat)

Generate actual variable from data format.

Parameters:dataformat (list/SecsVar based class) – dataformat to create variable for
Returns:created variable
Return type:SecsVar based class
get()

Return the internal value.

Returns:internal value
Return type:string
static get_format(dataformat, showname=False)

Gets the format of the function.

Returns:returns the string representation of the function
Return type:string
set(value)

Set the internal value to the provided value.

Parameters:value (string/integer) – new value
supports_value(value)

Check if the current instance supports the provided value.

Parameters:value (any) – value to test
class secsgem.secs.variables.SecsVarJIS8(value='', count=-1)[source]

Bases: secsgem.secs.variables.SecsVarText

Secs type for string data.

Parameters:
  • value (string) – initial value
  • count (integer) – number of items this value
formatCode = 17
textCode = 'J'
preferredTypes = [<class 'bytes'>, <class 'str'>]
controlChars = '\x00\x01\x02\x03\x04\x05\x06\x07\x08\t\n\x0b\x0c\r\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f\x7f\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f\xad'
coding = 'jis-8'
decode(data, start=0)

Decode the secs byte data to the value.

Parameters:
  • data (string) – encoded data bytes
  • start (integer) – start position of value the data
Returns:

new start position

Return type:

integer

decode_item_header(data, text_pos=0)

Encode item header depending on the number of length bytes required.

Parameters:
  • data (string) – encoded data
  • text_pos (integer) – start of item header in data
Returns:

start position for next item, format code, length item of data

Return type:

(integer, integer, integer)

encode()

Encode the value to secs data.

Returns:encoded data bytes
Return type:string
encode_item_header(length)

Encode item header depending on the number of length bytes required.

Parameters:length (integer) – number of bytes in data
Returns:encoded item header bytes
Return type:string
static generate(dataformat)

Generate actual variable from data format.

Parameters:dataformat (list/SecsVar based class) – dataformat to create variable for
Returns:created variable
Return type:SecsVar based class
get()

Return the internal value.

Returns:internal value
Return type:string
static get_format(dataformat, showname=False)

Gets the format of the function.

Returns:returns the string representation of the function
Return type:string
set(value)

Set the internal value to the provided value.

Parameters:value (string/integer) – new value
supports_value(value)

Check if the current instance supports the provided value.

Parameters:value (any) – value to test
class secsgem.secs.variables.SecsVarNumber(value=None, count=-1)[source]

Bases: secsgem.secs.variables.SecsVar

Secs base type for numeric data.

formatCode = 0
textCode = ''
supports_value(value)[source]

Check if the current instance supports the provided value.

Parameters:value (any) – value to test
set(value)[source]

Set the internal value to the provided value.

Parameters:value (list/integer/float) – new value
get()[source]

Return the internal value.

Returns:internal value
Return type:list/integer/float
encode()[source]

Encode the value to secs data.

Returns:encoded data bytes
Return type:string
decode(data, start=0)[source]

Decode the secs byte data to the value.

Parameters:
  • data (string) – encoded data bytes
  • start (integer) – start position of value the data
Returns:

new start position

Return type:

integer

decode_item_header(data, text_pos=0)

Encode item header depending on the number of length bytes required.

Parameters:
  • data (string) – encoded data
  • text_pos (integer) – start of item header in data
Returns:

start position for next item, format code, length item of data

Return type:

(integer, integer, integer)

encode_item_header(length)

Encode item header depending on the number of length bytes required.

Parameters:length (integer) – number of bytes in data
Returns:encoded item header bytes
Return type:string
static generate(dataformat)

Generate actual variable from data format.

Parameters:dataformat (list/SecsVar based class) – dataformat to create variable for
Returns:created variable
Return type:SecsVar based class
static get_format(dataformat, showname=False)

Gets the format of the function.

Returns:returns the string representation of the function
Return type:string
class secsgem.secs.variables.SecsVarI8(value=None, count=-1)[source]

Bases: secsgem.secs.variables.SecsVarNumber

Secs type for 8 byte signed data.

Parameters:
  • value (list/integer) – initial value
  • count (integer) – number of items this value
formatCode = 24
textCode = 'I8'
preferredTypes = [<class 'int'>]
decode(data, start=0)

Decode the secs byte data to the value.

Parameters:
  • data (string) – encoded data bytes
  • start (integer) – start position of value the data
Returns:

new start position

Return type:

integer

decode_item_header(data, text_pos=0)

Encode item header depending on the number of length bytes required.

Parameters:
  • data (string) – encoded data
  • text_pos (integer) – start of item header in data
Returns:

start position for next item, format code, length item of data

Return type:

(integer, integer, integer)

encode()

Encode the value to secs data.

Returns:encoded data bytes
Return type:string
encode_item_header(length)

Encode item header depending on the number of length bytes required.

Parameters:length (integer) – number of bytes in data
Returns:encoded item header bytes
Return type:string
static generate(dataformat)

Generate actual variable from data format.

Parameters:dataformat (list/SecsVar based class) – dataformat to create variable for
Returns:created variable
Return type:SecsVar based class
get()

Return the internal value.

Returns:internal value
Return type:list/integer/float
static get_format(dataformat, showname=False)

Gets the format of the function.

Returns:returns the string representation of the function
Return type:string
set(value)

Set the internal value to the provided value.

Parameters:value (list/integer/float) – new value
supports_value(value)

Check if the current instance supports the provided value.

Parameters:value (any) – value to test
class secsgem.secs.variables.SecsVarI1(value=None, count=-1)[source]

Bases: secsgem.secs.variables.SecsVarNumber

Secs type for 1 byte signed data.

Parameters:
  • value (list/integer) – initial value
  • count (integer) – number of items this value
formatCode = 25
textCode = 'I1'
preferredTypes = [<class 'int'>]
decode(data, start=0)

Decode the secs byte data to the value.

Parameters:
  • data (string) – encoded data bytes
  • start (integer) – start position of value the data
Returns:

new start position

Return type:

integer

decode_item_header(data, text_pos=0)

Encode item header depending on the number of length bytes required.

Parameters:
  • data (string) – encoded data
  • text_pos (integer) – start of item header in data
Returns:

start position for next item, format code, length item of data

Return type:

(integer, integer, integer)

encode()

Encode the value to secs data.

Returns:encoded data bytes
Return type:string
encode_item_header(length)

Encode item header depending on the number of length bytes required.

Parameters:length (integer) – number of bytes in data
Returns:encoded item header bytes
Return type:string
static generate(dataformat)

Generate actual variable from data format.

Parameters:dataformat (list/SecsVar based class) – dataformat to create variable for
Returns:created variable
Return type:SecsVar based class
get()

Return the internal value.

Returns:internal value
Return type:list/integer/float
static get_format(dataformat, showname=False)

Gets the format of the function.

Returns:returns the string representation of the function
Return type:string
set(value)

Set the internal value to the provided value.

Parameters:value (list/integer/float) – new value
supports_value(value)

Check if the current instance supports the provided value.

Parameters:value (any) – value to test
class secsgem.secs.variables.SecsVarI2(value=None, count=-1)[source]

Bases: secsgem.secs.variables.SecsVarNumber

Secs type for 2 byte signed data.

Parameters:
  • value (list/integer) – initial value
  • count (integer) – number of items this value
formatCode = 26
textCode = 'I2'
preferredTypes = [<class 'int'>]
decode(data, start=0)

Decode the secs byte data to the value.

Parameters:
  • data (string) – encoded data bytes
  • start (integer) – start position of value the data
Returns:

new start position

Return type:

integer

decode_item_header(data, text_pos=0)

Encode item header depending on the number of length bytes required.

Parameters:
  • data (string) – encoded data
  • text_pos (integer) – start of item header in data
Returns:

start position for next item, format code, length item of data

Return type:

(integer, integer, integer)

encode()

Encode the value to secs data.

Returns:encoded data bytes
Return type:string
encode_item_header(length)

Encode item header depending on the number of length bytes required.

Parameters:length (integer) – number of bytes in data
Returns:encoded item header bytes
Return type:string
static generate(dataformat)

Generate actual variable from data format.

Parameters:dataformat (list/SecsVar based class) – dataformat to create variable for
Returns:created variable
Return type:SecsVar based class
get()

Return the internal value.

Returns:internal value
Return type:list/integer/float
static get_format(dataformat, showname=False)

Gets the format of the function.

Returns:returns the string representation of the function
Return type:string
set(value)

Set the internal value to the provided value.

Parameters:value (list/integer/float) – new value
supports_value(value)

Check if the current instance supports the provided value.

Parameters:value (any) – value to test
class secsgem.secs.variables.SecsVarI4(value=None, count=-1)[source]

Bases: secsgem.secs.variables.SecsVarNumber

Secs type for 4 byte signed data.

Parameters:
  • value (list/integer) – initial value
  • count (integer) – number of items this value
formatCode = 28
textCode = 'I4'
preferredTypes = [<class 'int'>]
decode(data, start=0)

Decode the secs byte data to the value.

Parameters:
  • data (string) – encoded data bytes
  • start (integer) – start position of value the data
Returns:

new start position

Return type:

integer

decode_item_header(data, text_pos=0)

Encode item header depending on the number of length bytes required.

Parameters:
  • data (string) – encoded data
  • text_pos (integer) – start of item header in data
Returns:

start position for next item, format code, length item of data

Return type:

(integer, integer, integer)

encode()

Encode the value to secs data.

Returns:encoded data bytes
Return type:string
encode_item_header(length)

Encode item header depending on the number of length bytes required.

Parameters:length (integer) – number of bytes in data
Returns:encoded item header bytes
Return type:string
static generate(dataformat)

Generate actual variable from data format.

Parameters:dataformat (list/SecsVar based class) – dataformat to create variable for
Returns:created variable
Return type:SecsVar based class
get()

Return the internal value.

Returns:internal value
Return type:list/integer/float
static get_format(dataformat, showname=False)

Gets the format of the function.

Returns:returns the string representation of the function
Return type:string
set(value)

Set the internal value to the provided value.

Parameters:value (list/integer/float) – new value
supports_value(value)

Check if the current instance supports the provided value.

Parameters:value (any) – value to test
class secsgem.secs.variables.SecsVarF8(value=None, count=-1)[source]

Bases: secsgem.secs.variables.SecsVarNumber

Secs type for 8 byte float data.

Parameters:
  • value (list/float) – initial value
  • count (integer) – number of items this value
formatCode = 32
textCode = 'F8'
preferredTypes = [<class 'float'>]
decode(data, start=0)

Decode the secs byte data to the value.

Parameters:
  • data (string) – encoded data bytes
  • start (integer) – start position of value the data
Returns:

new start position

Return type:

integer

decode_item_header(data, text_pos=0)

Encode item header depending on the number of length bytes required.

Parameters:
  • data (string) – encoded data
  • text_pos (integer) – start of item header in data
Returns:

start position for next item, format code, length item of data

Return type:

(integer, integer, integer)

encode()

Encode the value to secs data.

Returns:encoded data bytes
Return type:string
encode_item_header(length)

Encode item header depending on the number of length bytes required.

Parameters:length (integer) – number of bytes in data
Returns:encoded item header bytes
Return type:string
static generate(dataformat)

Generate actual variable from data format.

Parameters:dataformat (list/SecsVar based class) – dataformat to create variable for
Returns:created variable
Return type:SecsVar based class
get()

Return the internal value.

Returns:internal value
Return type:list/integer/float
static get_format(dataformat, showname=False)

Gets the format of the function.

Returns:returns the string representation of the function
Return type:string
set(value)

Set the internal value to the provided value.

Parameters:value (list/integer/float) – new value
supports_value(value)

Check if the current instance supports the provided value.

Parameters:value (any) – value to test
class secsgem.secs.variables.SecsVarF4(value=None, count=-1)[source]

Bases: secsgem.secs.variables.SecsVarNumber

Secs type for 4 byte float data.

Parameters:
  • value (list/float) – initial value
  • count (integer) – number of items this value
formatCode = 36
textCode = 'F4'
preferredTypes = [<class 'float'>]
decode(data, start=0)

Decode the secs byte data to the value.

Parameters:
  • data (string) – encoded data bytes
  • start (integer) – start position of value the data
Returns:

new start position

Return type:

integer

decode_item_header(data, text_pos=0)

Encode item header depending on the number of length bytes required.

Parameters:
  • data (string) – encoded data
  • text_pos (integer) – start of item header in data
Returns:

start position for next item, format code, length item of data

Return type:

(integer, integer, integer)

encode()

Encode the value to secs data.

Returns:encoded data bytes
Return type:string
encode_item_header(length)

Encode item header depending on the number of length bytes required.

Parameters:length (integer) – number of bytes in data
Returns:encoded item header bytes
Return type:string
static generate(dataformat)

Generate actual variable from data format.

Parameters:dataformat (list/SecsVar based class) – dataformat to create variable for
Returns:created variable
Return type:SecsVar based class
get()

Return the internal value.

Returns:internal value
Return type:list/integer/float
static get_format(dataformat, showname=False)

Gets the format of the function.

Returns:returns the string representation of the function
Return type:string
set(value)

Set the internal value to the provided value.

Parameters:value (list/integer/float) – new value
supports_value(value)

Check if the current instance supports the provided value.

Parameters:value (any) – value to test
class secsgem.secs.variables.SecsVarU8(value=None, count=-1)[source]

Bases: secsgem.secs.variables.SecsVarNumber

Secs type for 8 byte unsigned data.

Parameters:
  • value (list/integer) – initial value
  • count (integer) – number of items this value
formatCode = 40
textCode = 'U8'
preferredTypes = [<class 'int'>]
decode(data, start=0)

Decode the secs byte data to the value.

Parameters:
  • data (string) – encoded data bytes
  • start (integer) – start position of value the data
Returns:

new start position

Return type:

integer

decode_item_header(data, text_pos=0)

Encode item header depending on the number of length bytes required.

Parameters:
  • data (string) – encoded data
  • text_pos (integer) – start of item header in data
Returns:

start position for next item, format code, length item of data

Return type:

(integer, integer, integer)

encode()

Encode the value to secs data.

Returns:encoded data bytes
Return type:string
encode_item_header(length)

Encode item header depending on the number of length bytes required.

Parameters:length (integer) – number of bytes in data
Returns:encoded item header bytes
Return type:string
static generate(dataformat)

Generate actual variable from data format.

Parameters:dataformat (list/SecsVar based class) – dataformat to create variable for
Returns:created variable
Return type:SecsVar based class
get()

Return the internal value.

Returns:internal value
Return type:list/integer/float
static get_format(dataformat, showname=False)

Gets the format of the function.

Returns:returns the string representation of the function
Return type:string
set(value)

Set the internal value to the provided value.

Parameters:value (list/integer/float) – new value
supports_value(value)

Check if the current instance supports the provided value.

Parameters:value (any) – value to test
class secsgem.secs.variables.SecsVarU1(value=None, count=-1)[source]

Bases: secsgem.secs.variables.SecsVarNumber

Secs type for 1 byte unsigned data.

Parameters:
  • value (list/integer) – initial value
  • count (integer) – number of items this value
formatCode = 41
textCode = 'U1'
preferredTypes = [<class 'int'>]
decode(data, start=0)

Decode the secs byte data to the value.

Parameters:
  • data (string) – encoded data bytes
  • start (integer) – start position of value the data
Returns:

new start position

Return type:

integer

decode_item_header(data, text_pos=0)

Encode item header depending on the number of length bytes required.

Parameters:
  • data (string) – encoded data
  • text_pos (integer) – start of item header in data
Returns:

start position for next item, format code, length item of data

Return type:

(integer, integer, integer)

encode()

Encode the value to secs data.

Returns:encoded data bytes
Return type:string
encode_item_header(length)

Encode item header depending on the number of length bytes required.

Parameters:length (integer) – number of bytes in data
Returns:encoded item header bytes
Return type:string
static generate(dataformat)

Generate actual variable from data format.

Parameters:dataformat (list/SecsVar based class) – dataformat to create variable for
Returns:created variable
Return type:SecsVar based class
get()

Return the internal value.

Returns:internal value
Return type:list/integer/float
static get_format(dataformat, showname=False)

Gets the format of the function.

Returns:returns the string representation of the function
Return type:string
set(value)

Set the internal value to the provided value.

Parameters:value (list/integer/float) – new value
supports_value(value)

Check if the current instance supports the provided value.

Parameters:value (any) – value to test
class secsgem.secs.variables.SecsVarU2(value=None, count=-1)[source]

Bases: secsgem.secs.variables.SecsVarNumber

Secs type for 2 byte unsigned data.

Parameters:
  • value (list/integer) – initial value
  • count (integer) – number of items this value
formatCode = 42
textCode = 'U2'
preferredTypes = [<class 'int'>]
decode(data, start=0)

Decode the secs byte data to the value.

Parameters:
  • data (string) – encoded data bytes
  • start (integer) – start position of value the data
Returns:

new start position

Return type:

integer

decode_item_header(data, text_pos=0)

Encode item header depending on the number of length bytes required.

Parameters:
  • data (string) – encoded data
  • text_pos (integer) – start of item header in data
Returns:

start position for next item, format code, length item of data

Return type:

(integer, integer, integer)

encode()

Encode the value to secs data.

Returns:encoded data bytes
Return type:string
encode_item_header(length)

Encode item header depending on the number of length bytes required.

Parameters:length (integer) – number of bytes in data
Returns:encoded item header bytes
Return type:string
static generate(dataformat)

Generate actual variable from data format.

Parameters:dataformat (list/SecsVar based class) – dataformat to create variable for
Returns:created variable
Return type:SecsVar based class
get()

Return the internal value.

Returns:internal value
Return type:list/integer/float
static get_format(dataformat, showname=False)

Gets the format of the function.

Returns:returns the string representation of the function
Return type:string
set(value)

Set the internal value to the provided value.

Parameters:value (list/integer/float) – new value
supports_value(value)

Check if the current instance supports the provided value.

Parameters:value (any) – value to test
class secsgem.secs.variables.SecsVarU4(value=None, count=-1)[source]

Bases: secsgem.secs.variables.SecsVarNumber

Secs type for 4 byte unsigned data.

Parameters:
  • value (list/integer) – initial value
  • count (integer) – number of items this value
formatCode = 44
textCode = 'U4'
decode(data, start=0)

Decode the secs byte data to the value.

Parameters:
  • data (string) – encoded data bytes
  • start (integer) – start position of value the data
Returns:

new start position

Return type:

integer

decode_item_header(data, text_pos=0)

Encode item header depending on the number of length bytes required.

Parameters:
  • data (string) – encoded data
  • text_pos (integer) – start of item header in data
Returns:

start position for next item, format code, length item of data

Return type:

(integer, integer, integer)

encode()

Encode the value to secs data.

Returns:encoded data bytes
Return type:string
encode_item_header(length)

Encode item header depending on the number of length bytes required.

Parameters:length (integer) – number of bytes in data
Returns:encoded item header bytes
Return type:string
static generate(dataformat)

Generate actual variable from data format.

Parameters:dataformat (list/SecsVar based class) – dataformat to create variable for
Returns:created variable
Return type:SecsVar based class
get()

Return the internal value.

Returns:internal value
Return type:list/integer/float
static get_format(dataformat, showname=False)

Gets the format of the function.

Returns:returns the string representation of the function
Return type:string
set(value)

Set the internal value to the provided value.

Parameters:value (list/integer/float) – new value
supports_value(value)

Check if the current instance supports the provided value.

Parameters:value (any) – value to test
preferredTypes = [<class 'int'>]