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.

Parameters:
  • types (list of secsgem.secs.variables.SecsVar classes) – list of supported types, default first. empty list means all types are support, SecsVarString default
  • value (various) – initial value
  • count (integer) – max number of items in 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
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_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
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
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

Parameters:
  • dataformat (OrderedDict) – internal data values
  • value (dict/list) – initial value
  • count (integer) – number of fields in the list
formatCode = 0
textCode = 'L'
preferredTypes = [<type 'dict'>]
class SecsVarListIter(keys)[source]

Bases: object

next()

Get the next item or raise StopIteration if at end of list

static SecsVarList.get_format(dataformat, showname=False)[source]

Gets the format of the variable

Returns:returns the string representation of the function
Return type:string
static SecsVarList.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
SecsVarList.set(value)[source]

Set the internal value to the provided value

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

Return the internal value

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

Encode the value to secs data

Returns:encoded data bytes
Return type:string
SecsVarList.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

SecsVarList.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)

SecsVarList.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
SecsVarList.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

Parameters:
  • dataFormat (secsgem.secs.variables.SecsVar) – internal data definition/sample
  • value (list) – initial value
  • count (integer) – number of fields in the list
formatCode = 0
textCode = 'L'
preferredTypes = [<type 'list'>]
class SecsVarArrayIter(values)[source]

Bases: object

next()

Get the next item or raise StopIteration if at end of list

static SecsVarArray.get_format(dataformat, showname=False)[source]

Gets the format of the variable

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

Append data to the internal list

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

Set the internal value to the provided value

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

Return the internal value

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

Encode the value to secs data

Returns:encoded data bytes
Return type:string
SecsVarArray.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

SecsVarArray.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)

SecsVarArray.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
SecsVarArray.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

Parameters:
  • value (string/integer) – initial value
  • count (integer) – number of items this value
formatCode = 8
textCode = 'B'
preferredTypes = [<type 'str'>, <type '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
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_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

Parameters:
  • value (list/boolean) – initial value
  • count (integer) – number of items this value
formatCode = 9
textCode = 'BOOLEAN'
preferredTypes = [<type '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
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_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

Parameters:
  • value (string) – initial value
  • count (integer) – number of items this value
formatCode = -1
textCode = u''
controlChars = u'\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
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_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 = u'A'
preferredTypes = [<type 'str'>, <type 'unicode'>]
controlChars = u'\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 = 'ascii'
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
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
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 = u'J'
preferredTypes = [<type 'str'>, <type 'unicode'>]
controlChars = u'\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
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
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

Parameters:
  • value (list/integer/float) – initial value
  • count (integer) – number of items this value
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
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_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 = [<type 'long'>, <type '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
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
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 = [<type 'int'>, <type 'long'>]
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
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
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 = [<type 'int'>, <type 'long'>]
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
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
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 = [<type 'int'>, <type 'long'>]
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
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
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 = [<type '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
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
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 = [<type '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
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
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 = [<type 'long'>, <type '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
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
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 = [<type 'int'>, <type 'long'>]
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
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
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 = [<type 'int'>, <type 'long'>]
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
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
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
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
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 = [<type 'int'>, <type 'long'>]