UAP Base Classes

Base classes for User Access Policy (UAP) configuration.

Base classes and helpers for User Access Policy (UAP) configuration

class tropicsquare.config.uap_base.UapPermissionField(value=0xFF)[source]

Bases: object

Represents an 8-bit UAP permission field.

Each field contains permission bits for 4 pairing key slots:

  • Bit 0: Pairing Key slot 0 has access

  • Bit 1: Pairing Key slot 1 has access

  • Bit 2: Pairing Key slot 2 has access

  • Bit 3: Pairing Key slot 3 has access

  • Bits 4-7: Reserved

Parameters:

value (int)

__init__(value=0xFF)[source]

Initialize permission field.

Parameters:

value (int) – 8-bit permission value (default: 0xFF = all slots have access)

Return type:

None

get_slot_permission(slot)[source]

Check if pairing key slot has access.

Parameters:

slot (int) – Slot number (0-3)

Returns:

True if slot has access

Return type:

bool

set_slot_permission(slot, has_access)[source]

Set permission for pairing key slot.

Parameters:
  • slot (int) – Slot number (0-3)

  • has_access (bool) – True to grant access, False to deny

Return type:

None

property pkey_slot_0: bool

Pairing Key slot 0 has access.

property pkey_slot_1: bool

Pairing Key slot 1 has access.

property pkey_slot_2: bool

Pairing Key slot 2 has access.

property pkey_slot_3: bool

Pairing Key slot 3 has access.

property value: int

Raw 8-bit value.

to_dict()[source]

Export as dictionary.

Return type:

dict

__str__()[source]

Format as table cells: x | x | | x

No leading/trailing pipes - will be added by parent class. Returns 4 cells separated by ‘ | ‘.

Return type:

str

class tropicsquare.config.uap_base.UapMultiSlotConfig(value=0xFFFFFFFF)[source]

Bases: BaseConfig

Base class for UAP configs with multiple slots.

Used for configs that have 4 slots, each with 8-bit permission field.

Parameters:

value (int)

__str__()[source]

Table row: ClassName | slot_0 || slot_1 || slot_2 || slot_3 |

Uses || to visually separate 4 different slot permission fields.

Return type:

str

class tropicsquare.config.uap_base.UapSingleFieldConfig(value=0xFFFFFFFF)[source]

Bases: BaseConfig

Base class for UAP configs with single 8-bit permission field.

Parameters:

value (int)

__init__(value=0xFFFFFFFF)[source]

Initialize with default all-access value.

Parameters:

value (int)

Return type:

None

property permissions: UapPermissionField

Get permission field (8 bits at position 0).

to_dict()[source]

Export as dictionary.

Return type:

dict

__str__()[source]

Table row: ClassName | permissions cells |

Return type:

str

class tropicsquare.config.uap_base.UapDualFieldConfig(value=0xFFFFFFFF)[source]

Bases: BaseConfig

Base class for UAP configs with two 8-bit permission fields (CFG and FUNC).

Parameters:

value (int)

__init__(value=0xFFFFFFFF)[source]

Initialize with default all-access value.

Parameters:

value (int)

Return type:

None

property cfg_permissions: UapPermissionField

Get CFG permission field (8 bits at position 0).

property func_permissions: UapPermissionField

Get FUNC permission field (8 bits at position 8).

to_dict()[source]

Export as dictionary.

Return type:

dict

__str__()[source]

Table row: ClassName | cfg cells || func cells |

Uses || to visually separate cfg and func permission fields.

Return type:

str

See Also