ecom.database

Module Contents

Classes

Unit

A representation of a physical unit.

Configuration

A configuration item of the secondary device.

ConfigurationValueDatapoint

A datapoint that is the value of a configuration.

ConfigurationValueResponseType

A response type that is the value of a configuration.

Constant

A constant in the communication database.

CommunicationDatabase

The shared communication database. Contains all information about the communication.

Functions

main()

Verifies the communication database.

class ecom.database.Unit[source]

Bases: ecom.datatypes.TypeInfo

A representation of a physical unit.

classmethod fromTypeInfo(name: str, typeInfo: ecom.datatypes.TypeInfo, description: Optional[str] = None) Unit[source]

Create a new unit type from a given base type.

Parameters:
  • name – The name of the unit.

  • typeInfo – The base type.

  • description – The description of the unit.

Returns:

The new unit.

class ecom.database.Configuration[source]

Bases: Generic[ecom.datatypes.V]

A configuration item of the secondary device.

id: ecom.datatypes.EnumType[source]

The id of the configuration item.

name: str[source]

The name of the configuration item.

type: ecom.datatypes.TypeInfo[ecom.datatypes.V][source]

The type of the configuration.

defaultValue: ecom.datatypes.V[source]

The default value of the configuration.

description: Optional[str][source]

A description of the configuration.

exception ecom.database.CommunicationDatabaseError[source]

Bases: RuntimeError

Indicates an error in the communication database.

exception ecom.database.UnknownTypeError(typ: str)[source]

Bases: CommunicationDatabaseError

Information about an unknown shared datatype was requested.

exception ecom.database.UnknownConstantError(constant: str)[source]

Bases: ValueError

Information about an unknown shared constant was requested.

exception ecom.database.UnknownDatapointError(datapointName: str)[source]

Bases: CommunicationDatabaseError

Information about an unknown datapoint was requested.

property datapointName[source]
Returns:

The name of the unknown datapoint.

class ecom.database.ConfigurationValueDatapoint[source]

Bases: ecom.message.DependantTelecommandDatapointType, _DbContainer

A datapoint that is the value of a configuration.

configureWith(providerValue)[source]

Create an instance of this dependant telecommand datapoint for the value of the provider.

Parameters:

providerValue – The value of the provider that this datapoint depends on.

class ecom.database.ConfigurationValueResponseType(database: CommunicationDatabase, *args, **kwargs)[source]

Bases: ecom.message.DependantTelecommandResponseType

A response type that is the value of a configuration.

configureWith(providerValue)[source]

Create an instance of the dependant response for the value of the provider.

Parameters:

providerValue – The value of the provider that this response depends on.

Returns:

The configured TelecommandResponseType instance.

class ecom.database.Constant[source]

Bases: Generic[ecom.datatypes.V]

A constant in the communication database.

name: str[source]

The name of the constant.

value: ecom.datatypes.V[source]

The value of the constant.

type: ecom.datatypes.TypeInfo[ecom.datatypes.V][source]

Information about the type of the constant.

description: str[source]

A description of the constant.

class ecom.database.CommunicationDatabase(dataDirectory: str)[source]

The shared communication database. Contains all information about the communication.

property constants: Dict[str, Constant][source]
Returns:

A name to value, description and type information mapping for all shared constants.

property telecommandTypes: List[ecom.message.TelecommandType][source]
Returns:

All telecommand types.

property telecommandTypeEnum: Optional[Type[ecom.datatypes.EnumType]][source]
Returns:

The enum class that is used for the telecommand types or None if no telecommand types exist.

property telemetryTypes: List[ecom.message.TelemetryType][source]
Returns:

All telemetry types.

property telemetryTypeEnum: Optional[Type[ecom.datatypes.EnumType]][source]
Returns:

The enum class that is used for the telemetry types or None if no telemetry types exist.

property dataTypes: Dict[str, ecom.datatypes.TypeInfo][source]
Returns:

All shared data types.

property units: Dict[str, List[Unit]][source]
Returns:

All mapping of names to all known units and their variants.

property configurations: List[Configuration][source]
Returns:

All configuration items of the secondary device.

property configurationEnum: Optional[Type[ecom.datatypes.EnumType]][source]
Returns:

The enum class that is used for the configurations or None if no configurations exist.

__eq__(o: object) bool[source]

Return self==value.

__repr__() str[source]

Return repr(self).

getTypeInfo(typeName: str) ecom.datatypes.TypeInfo[source]

Get the type info for a known datatype by its name.

Parameters:

typeName – The name of the type.

Returns:

The type info for the data type.

getTelecommandByName(name: str) ecom.message.TelecommandType[source]
Parameters:

name – The name of a telecommand type.

Returns:

The telecommand type with the specified name.

getTelecommand(telecommandId: ecom.datatypes.EnumType) ecom.message.TelecommandType[source]
Parameters:

telecommandId – The id enum value of a telecommand type.

Returns:

The telecommand type with the specified id.

getTelemetryByName(name: str) ecom.message.TelemetryType[source]
Parameters:

name – The name of a telemetry type.

Returns:

The telemetry type with the specified name.

getTelemetry(telemetryId: ecom.datatypes.EnumType) ecom.message.TelemetryType[source]
Parameters:

telemetryId – The id enum value of a telemetry type.

Returns:

The telemetry type with the specified id.

parseKnownTypeInfo(typeStr: str, name: Optional[str] = None, documentation: Optional[str] = None)[source]

Get the type info for a known datatype. Supports parsing type strings declaring an array of a known datatype.

Parameters:
  • typeStr – The type string to parse.

  • name – The name of the array data type, if the type is an array. If not provided, the typeStr is used.

  • documentation – The documentation of the data type, if the type is an array.

Returns:

The type information for the parsed type.

replaceType(typ: Type[ecom.datatypes.V], name: Optional[str] = None)[source]

Replace a type registered in the database with another Python class. This allows to define own types like enums for types defined in the communication database, make sure that the two types match and keep up to date with each other, and use the types on the Python side with IDE autocompletion support.

Parameters:
  • typ – The new type to replace the old type.

  • name – The name of the type to replace, if omitted the class name of the new type is used.

registerChangeListener(listener: Callable[[], None])[source]

Register a listener that will be called every time when the communication database has been changed.

Parameters:

listener – The callable that will be called when a change occurs.

ecom.database.main()[source]

Verifies the communication database.

Returns:

Whether the verification was successful.