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
ThresholdSignalToNoise
[db] Cuts off the signal to noise ratio if it is below a value
[EditableVariable("db", 0, false, "", "")]
public double ThresholdSignalToNoise
Field Value
Properties
CurrentLinkTime
[s] The total time that any link has been connected for
[EditableVariable("s", true, "", "")]
public double CurrentLinkTime { get; }
Property Value
MaxBitRate
Current maximum bit rate of the active link
[EditableVariable("bps", true, "", "")]
public double MaxBitRate { get; }
Property Value
NumMessagesReady
[-] The number of messages ready in the receiver
[EditableVariable("-", true, "", "")]
public int NumMessagesReady { get; }
Property Value
NumPacketsProcessing
[-] The number of messages being processed
[EditableVariable("-", true, "", "")]
public int NumPacketsProcessing { get; }
Property Value
RecentMessageFrequency
[Hz] The most-recent frequency of the latest message received
[EditableVariable("Hz", true, "", "")]
public double RecentMessageFrequency { get; }
Property Value
SignalToNoise
Current Signal to noise ratio of active link
[EditableVariable("-", true, "", "")]
public double SignalToNoise { get; }
Property Value
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
TransmitterThe 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
stringThe buffer key to look in for the object
recent
boolA 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
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
stringThe 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
stringThe 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
stringThe buffer key to look in for the bytes
recent
boolA 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
stringThe buffer key to look in for the object
recent
boolA 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
MessageThe message that will be overrwritten, with the data in the payload changing.
key
stringThe buffer key to look in for the object
recent
boolA 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
stringThe buffer key to look in for the object
recent
boolA 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
TransmitterThe transmitter for the connection
los
boolA flag if the los is clear