Table of Contents

Class Receiver

Namespace
NominalSystems.Classes
Assembly
NominalSystems.Classes.dll

This class handles the receiving of data from a LinkBlock and can read the data and submit it to some kind of data storage. The receiver can decode messages stored and return them as values ready for use.

public class Receiver : Antenna, IGroundStationAttachment, IPowerAttachment
Inheritance
Receiver
Implements
Inherited Members

Constructors

Receiver()

The default constructor for the receiver

public Receiver()

Fields

Diameter

[m] Diameter of the receiver dish

[EditableVariable("m", 0, false, "", "")]
public double Diameter

Field Value

double

ThresholdSignalToNoise

[db] Cuts off the signal to noise ratio if it is below a value

[EditableVariable("db", 0, false, "", "")]
public double ThresholdSignalToNoise

Field Value

double

Properties

CurrentLinkTime

[s] The total time that any link has been connected for

[EditableVariable("s", true, "", "")]
public double CurrentLinkTime { get; }

Property Value

double

MaxBitRate

Current maximum bit rate of the active link

[EditableVariable("bps", true, "", "")]
public double MaxBitRate { get; }

Property Value

double

NumMessagesReady

[-] The number of messages ready in the receiver

[EditableVariable("-", true, "", "")]
public int NumMessagesReady { get; }

Property Value

int

NumPacketsProcessing

[-] The number of messages being processed

[EditableVariable("-", true, "", "")]
public int NumPacketsProcessing { get; }

Property Value

int

RecentMessageFrequency

[Hz] The most-recent frequency of the latest message received

[EditableVariable("Hz", true, "", "")]
public double RecentMessageFrequency { get; }

Property Value

double

SignalToNoise

Current Signal to noise ratio of active link

[EditableVariable("-", true, "", "")]
public double SignalToNoise { get; }

Property Value

double

Methods

GetDataLinkMessage(Transmitter)

Attempts to fetch the data link message associated with a particular transmitter, receiver connection. If the message does not exist or a connection is not valid, it will return a null reference.

public DataLinkMessage? GetDataLinkMessage(Transmitter transmitter)

Parameters

transmitter Transmitter

The transmitter connected

Returns

DataLinkMessage

The data link message of the link block.

GetMessage(string, bool)

Attempts to receive a particular message from the receive object buffer based on a particular key. If the key is valid and the data exists, the message will be extracted from the timestamped message type.

public Message? GetMessage(string key = "", bool recent = true)

Parameters

key string

The buffer key to look in for the object

recent bool

A flag whether to get the most recent object instead of the one in the queue. If this is enabled, all other objects will be discarded.

Returns

Message

The message on the receive buffer

OnUpdate(double, double)

Called when the 'Component' should update

protected override void OnUpdate(double time, double step)

Parameters

time double

current time (seconds)

step double

the time step (seconds)

PopBytes(string)

Pops some data off the buffer with an option to find any data within the system, regardless of the key. If the key is left as empty, then the oldest data regardless of key will be returned from the queue.

public byte[] PopBytes(string key = "")

Parameters

key string

The optional key to search the data from

Returns

byte[]

The byte array from the received data

PopObject(string)

Pops an object off the buffer with an option to find any object within the system, regardless of the key. If the key is left as empty, then the oldest object, regardless of key, will be returned from the queue.

public object? PopObject(string key = "")

Parameters

key string

The optional key to search the object from

Returns

object

The object from the received data if it exists

ReceiveBytes(string, bool)

Receives some byte data from the buffer within a particular key on the buffer. This will be a raw byte data with no particular casting.

public byte[] ReceiveBytes(string key = "", bool recent = false)

Parameters

key string

The buffer key to look in for the bytes

recent bool

A flag whether to get the most recent bytes instead of the one in the queue. If this is enabled, all other bytes will be discarded.

Returns

byte[]

The byte array associated with the object

ReceiveCustom<T>(string, bool)

Looks in the data buffer at a particular key and attempts to find an object of a particular type. If the type matches, then the object decoded from the data bytes will be returned in the correct casted type. If an error has occurred, a null reference will be returned.

public T? ReceiveCustom<T>(string key = "", bool recent = false) where T : class

Parameters

key string

The buffer key to look in for the object

recent bool

A flag whether to get the most recent object instead of the one in the queue. If this is enabled, all other objects will be discarded.

Returns

T

The object deserialized in the buffer

Type Parameters

T

The type of object to cast to

ReceiveMessage(Message, string, bool)

Looks in the data buffer for a object that matches the message type found and attempts to overrwrite the payload of some other message with the message data that was found in the system. If the message was safely updated, a correct success boolean will be returned. This will not return the object that was received, but will overrwrite the message instead.

public bool ReceiveMessage(Message msg, string key = "", bool recent = true)

Parameters

msg Message

The message that will be overrwritten, with the data in the payload changing.

key string

The buffer key to look in for the object

recent bool

A flag whether to get the most recent object instead of the one in the queue. If this is enabled, all other objects will be discarded.

Returns

bool

A successful overrwrite flag

ReceiveObject(string, bool)

Receives an object from the buffer within a particular key on the buffer. This will be a raw object with no particular casting, that has been deserialized from the list of data assuming no corruption has taken place.

public object? ReceiveObject(string key = "", bool recent = false)

Parameters

key string

The buffer key to look in for the object

recent bool

A flag whether to get the most recent object instead of the one in the queue. If this is enabled, all other objects will be discarded.

Returns

object

The object deserialized in the buffer

SetLineOfSight(Transmitter, bool)

Updates the line of sight flag if this uses a particular transmission type that disables connection if the line of sight is blocked, for example, optical.

public void SetLineOfSight(Transmitter transmitter, bool los)

Parameters

transmitter Transmitter

The transmitter for the connection

los bool

A flag if the los is clear