Table of Contents

Class SwarmTile

Namespace
Iot.Device.Swarm
Assembly
Iot.Device.Swarm.dll

Swarm Tile class.

public class SwarmTile
Inheritance
SwarmTile

Constructors

SwarmTile(string)

Initializes a new instance of the SwarmTile class.

public SwarmTile(string portName)

Parameters

portName string

The port where the Swarm Tile is connected to (for example, COM1).

Properties

BackgroundNoiseRssi

Gets received background noise signal strength in dBm.

public int BackgroundNoiseRssi { get; }

Property Value

int

Remarks

For reliable operation, this value should consistently be less than (more negative) than -93 dBm. Use OperationalQuality.

DateTimeIsValid

Gets a value indicating whether GPS has acquired a valid date/time reference.

public bool DateTimeIsValid { get; }

Property Value

bool

DateTimeStatus

Gets the current DateTimeInfo from the Tile.

public DateTimeInfo DateTimeStatus { get; }

Property Value

DateTimeInfo

Exceptions

ErrorExecutingCommandException

Tile returned error when executing the command.

TimeoutException

Timeout occurred when waiting for command execution.

DateTimeStatusRate

Gets or sets the rate of unsolicited report messages for date and time.

public uint DateTimeStatusRate { get; set; }

Property Value

uint

Number of seconds in between each message. Set to 0 to disable.

Exceptions

ErrorExecutingCommandException

Tile returned error when executing the command.

TimeoutException

Timeout occurred when waiting for command execution.

DeviceID

Gets device ID that identifies this device on the Swarm network.

public string DeviceID { get; }

Property Value

string

DeviceName

Gets device type name.

public string DeviceName { get; }

Property Value

string

DeviceReady

Gets or sets event signaling that the Tile is ready for operation.

public AutoResetEvent DeviceReady { get; set; }

Property Value

AutoResetEvent

Remarks

This event indicates that there is communication to/from the Tile. In case the Tile is powered off or in sleep mode it won't be able to respond to commands, therefore this event won't be immediately signaled. Despite this, there is nothing preventing the application from using the library. As soon as the Tile is responsive, this event will be signaled and the PowerStateChanged will be raised.

FirmwareTimeStamp

Gets the time stamp of the device firmware.

public string FirmwareTimeStamp { get; }

Property Value

string

FirmwareVersion

Gets the device firmware version.

public string FirmwareVersion { get; }

Property Value

string

FrequencyDeviation

Gets frequency deviation in Hz for packet.

public int FrequencyDeviation { get; }

Property Value

int

GeospatialInformation

Gets the current GeospatialInformation from the Tile.

public GeospatialInformation GeospatialInformation { get; }

Property Value

GeospatialInformation

Exceptions

ErrorExecutingCommandException

Tile returned error when executing the command.

TimeoutException

Timeout occurred when waiting for command execution.

GeospatialInformationRate

Gets or sets the rate of unsolicited report messages for geospatial information.

public uint GeospatialInformationRate { get; set; }

Property Value

uint

Number of seconds in between each message. Set to 0 to disable.

Exceptions

ErrorExecutingCommandException

Tile returned error when executing the command.

TimeoutException

Timeout occurred when waiting for command execution.

GpsFixQuality

Gets the current GpsFixQuality from the Tile.

public GpsFixQuality GpsFixQuality { get; }

Property Value

GpsFixQuality

Exceptions

ErrorExecutingCommandException

Tile returned error when executing the command.

TimeoutException

Timeout occurred when waiting for command execution.

GpsFixQualityRate

Gets or sets the rate of unsolicited report messages for GPS fix quality.

public uint GpsFixQualityRate { get; set; }

Property Value

uint

Number of seconds in between each message. Set to 0 to disable.

Exceptions

ErrorExecutingCommandException

Tile returned error when executing the command.

TimeoutException

Timeout occurred when waiting for command execution.

JammingSpoofingIndication

Gets the current JammingSpoofingIndication from the Tile.

public JammingSpoofingIndication JammingSpoofingIndication { get; }

Property Value

JammingSpoofingIndication

Exceptions

ErrorExecutingCommandException

Tile returned error when executing the command.

TimeoutException

Timeout occurred when waiting for command execution.

JammingSpoofingIndicationRate

Gets or sets the rate of unsolicited report messages for jamming and spoofing indicators.

public uint JammingSpoofingIndicationRate { get; set; }

Property Value

uint

Number of seconds in between each message. Set to 0 to disable.

Exceptions

ErrorExecutingCommandException

Tile returned error when executing the command.

TimeoutException

Timeout occurred when waiting for command execution.

LastErrorMessage

Gets last error message from the Tile.

public string LastErrorMessage { get; }

Property Value

string

LastPacketReceivedTimestamp

Gets time-stamp of the last packet received.

public DateTime LastPacketReceivedTimestamp { get; }

Property Value

DateTime

MessagesReceived

Gets messages received database.

public MessagesReceivedManagement MessagesReceived { get; }

Property Value

MessagesReceivedManagement

MessagesToTransmit

Gets messages to transmit database.

public MessagesToTransmitManagement MessagesToTransmit { get; }

Property Value

MessagesToTransmitManagement

OperationalQuality

Quality of the operation based on the background noise signal strength.

public OperationalQuality OperationalQuality { get; }

Property Value

OperationalQuality

PostionIsValid

Gets a value indicating whether GPS has acquired a valid position 3D fix.

public bool PostionIsValid { get; }

Property Value

bool

PowerState

Gets power state of the Swarm Tile.

public PowerState PowerState { get; }

Property Value

PowerState

ReceiveTestRate

Gets or sets the rate of unsolicited report messages for device power state.

public uint ReceiveTestRate { get; set; }

Property Value

uint

Number of seconds in between each message. Set to 0 to disable.

Exceptions

ErrorExecutingCommandException

Tile returned error when executing the command.

TimeoutException

Timeout occurred when waiting for command execution.

SatelliteId

Gets ID of the last satellite heard.

public int SatelliteId { get; }

Property Value

int

SatelliteRssi

Gets received signal strength in dBm from satellite for last packet received.

public int SatelliteRssi { get; }

Property Value

int

SetGpio1Mode

Gets or sets the mode for GPIO1 pin.

public GpioMode SetGpio1Mode { get; set; }

Property Value

GpioMode

Mode for GPIO1 pin.

Exceptions

ErrorExecutingCommandException

Tile returned error when executing the command.

TimeoutException

Timeout occurred when waiting for command execution.

SignalToNoiseRatio

Gets signal to noise ratio in dB for last packet received.

public int SignalToNoiseRatio { get; }

Property Value

int

TimeoutForCommandExecution

Gets or sets the timeout for command execution (in milliseconds).

public int TimeoutForCommandExecution { get; set; }

Property Value

int

Methods

Close()

Close connection to Swarm Tile.

public void Close()

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

public void Dispose()

Finalize()

Finalizes an instance of the SwarmTile class.

protected override void Finalize()

OnBackgroundNoiseInfoAvailable(int)

Raises the DateTimeStatusAvailable event.

protected void OnBackgroundNoiseInfoAvailable(int rssi)

Parameters

rssi int

Value for background noise RSSI.

OnDateTimeStatusAvailable(DateTimeInfo)

Raises the DateTimeStatusAvailable event.

protected void OnDateTimeStatusAvailable(DateTimeInfo dateTimeInfo)

Parameters

dateTimeInfo DateTimeInfo

Updated data.

OnGeospatialInfoAvailable(GeospatialInformation)

Raises the GeospatialInfoAvailable event.

protected void OnGeospatialInfoAvailable(GeospatialInformation geoSpatialInfo)

Parameters

geoSpatialInfo GeospatialInformation

Updated data.

OnMessageEvent(MessageEvent, string)

Raises the MessageEvent event.

protected void OnMessageEvent(MessageEvent messageEvent, string messageId)

Parameters

messageEvent MessageEvent

Event occurred about a message.

messageId string

Id of message the event is related with.

OnPowerStateChanged(PowerState)

Raises the PowerStateChanged event.

protected void OnPowerStateChanged(PowerState powerStatus)

Parameters

powerStatus PowerState

New power status of the device.

OnTileStatusEvent(TileStatus)

Raises the TileStatusEvent event.

protected void OnTileStatusEvent(TileStatus status)

Parameters

status TileStatus

Event occurred about a message.

PowerOff()

Put Tile in Power Off mode.

public void PowerOff()

Remarks

After issuing this command all Tile power supplies should be disconnect. If power is not disconnected, the Tile enters a low power mode until power is completely removed and restored.

RestartDevice()

Perform a software cold restart of the device.

public void RestartDevice()

SendToSleep(DateTime)

Puts the device into a low-power sleep mode.

public void SendToSleep(DateTime wakeupTime)

Parameters

wakeupTime DateTime

Sleep until date and time.

Exceptions

ErrorExecutingCommandException

Tile returned error when executing the command.

TimeoutException

Timeout occurred when waiting for command execution.

SendToSleep(uint)

Puts the device into a low-power sleep mode.

public void SendToSleep(uint value)

Parameters

value uint

Sleep for this many seconds.

Exceptions

ArgumentException

If rate is < 5.

ErrorExecutingCommandException

Tile returned error when executing the command.

TimeoutException

Timeout occurred when waiting for command execution.

TryToSendMessage(MessageToTransmit, out string)

Tries to send a message to the Swarm network.

public bool TryToSendMessage(MessageToTransmit message, out string messageId)

Parameters

message MessageToTransmit

The message with the data to be transmitted.

messageId string

The ID assigned to this message.

Returns

bool

true if the message has been successfully added to the queue for transmission, false otherwise.

Remarks

Sending messages it's only possible if the Tile has a valid date and time information. That can be checked with DateTimeIsValid. In case of failure, the error is stored in the LastErrorMessage property.

Exceptions

ErrorExecutingCommandException

Tile returned error when executing the command.

TimeoutException

Timeout occurred when waiting for command execution.

Events

BackgroundNoiseInfoAvailable

Event raised when there is a new reading of background noise RSSI.

public event SwarmTile.BackgroundNoiseInfoHandler BackgroundNoiseInfoAvailable

Event Type

SwarmTile.BackgroundNoiseInfoHandler

Remarks

Use ReceiveTestRate property to configure the rate that this event is generated.

DateTimeStatusAvailable

Event raised when there is an updated DateTimeInfo.

public event SwarmTile.DateTimeStatusHandler DateTimeStatusAvailable

Event Type

SwarmTile.DateTimeStatusHandler

Remarks

Use DateTimeStatusRate property to configure the rate that this event is generated.

GeospatialInfoAvailable

Event raised when there is an updated GeospatialInformation.

public event SwarmTile.GeospatialInfoHandler GeospatialInfoAvailable

Event Type

SwarmTile.GeospatialInfoHandler

Remarks

Use GeospatialInformationRate property to configure the rate that this event is generated.

MessageEvent

Event raised related with a message.

public event SwarmTile.MessageEventHandler MessageEvent

Event Type

SwarmTile.MessageEventHandler

PowerStateChanged

Event raised when the power state of the device changes.

public event SwarmTile.PowerStateChangedHandler PowerStateChanged

Event Type

SwarmTile.PowerStateChangedHandler

TileStatusEvent

Event raised when there is a new Tile Status.

public event SwarmTile.TileStatusEventHandler TileStatusEvent

Event Type

SwarmTile.TileStatusEventHandler