ait.dsn.sle.common module

SLE Generic Items

The ait.dsn.sle.common module provides generic SLE classes, methods and attributes that are used to implement other SLE interfaces.

Attributes:
TML_SLE_FORMAT: The struct format string for pack-ing a SLE PDU

packet header.

TML_SLE_TYPE: The first 4 bytes of an SLE PDU packet header for

use when struct.pack-ing.

TML_CONTEXT_MSG_FORMAT: The struct format string for pack-ing a

SLE Context Message PDU.

TML_CONTEXT_MSG_TYPE: The first 4 bytes of an SLE Context Message

PDU header for use when struct.pack-ing.

TML_CONTEXT_HB_FORMAT: The struct format string for pack-ing a

SLE Heartbeat message PDU.

TML_CONTEXT_HEARTBEAT_TYPE: The first 4 bytes of an SLE Heartbeat

message PDU header for use when struct.pack-ing.

CCSDS_EPOCH: A datetime object pointing to the CCSDS Epoch.

Classes:
SLE: An SLE interface “base” class that provides interface-agnostic

methods and attributes for interfacing with SLE.

class ait.dsn.sle.common.SLE(*args, **kwargs)

Bases: object

SLE interface “base” class

The SLE class provides SLE interface-agnostic methods and attributes for interfacing with SLE.

add_handler(event, handler)

Add a “handler” function for an “event”

Arguments:
event:

A string of the PDU name for which the handler function should e called.

handler:

The function that should be called for the specified event. The function will be passed the decoded PyASN1 PDU as its only argument.

bind(pdu, **kwargs)

Bind to an SLE Interface

Arguments:
pdu:

The PyASN1 class instance that should be configured with generic SLE attributes, encoded, and sent to SLE.

connect()

Setup connection with DSN

Initialize TCP connection with DSN and send context message to configure communication.

decode(message, asn1Spec)

Decode a chunk of ASN.1 data

Arguments:
message:

A bytestring of data that contains an encoded ASN.1 PDU to be decoded.

asn1Spec:

An instance of a PyASN1 class that the data should be decoded against.

Returns:

The decoded PyASN1 object containing the message data.

Raises:

pyasn1.error.PyAsn1Error TypeError

disconnect()

Disconnect from SLE

Disconnect the SLE and telemetry output sockets and kill the greenlets for monitoring and processing data.

encode_pdu(pdu)

Encode a SLE PDU

Arguments:

pdu: The PyASN1 class instance to encode

Returns:

The ASN.1 encoded PDU struct.pack-ed into the SLE PDU packet structure.

property invoke_id
make_credentials()

Makes credentials for the initiator

send(data)

Send supplied data to DSN

stop(pdu)

Send a SLE Stop PDU.

Arguments:
pdu:

The PyASN1 class instance that should be configured with generic SLE attributes, encoded, and sent to SLE.

unbind(pdu, reason=0)

Unbind from the SLE Interface

Arguments:
pdu:

The PyASN1 class instance that should be configured with generic SLE attributes, encoded, and sent to SLE.

reason:

The reason code for why the unbind is happening.

ait.dsn.sle.common.conn_handler(handler)

Handler for processing data received from the DSN into PDUs

ait.dsn.sle.common.data_processor(handler)

Handler for decoding ASN.1 encoded PDUs

ait.dsn.sle.common.generate_encoded_time(datetime_)