Skip to main content

Interface IPlatformOS

Provides an abstraction for OS services such as configuration so that Meadow can operate on different OS's and platforms.

Assembly: Meadow.Contracts.dll
View Source
Declaration
public interface IPlatformOS : IPowerController

Properties

OSVersion

OS version.

View Source
Declaration
string OSVersion { get; }

OSBuildDate

OS build date and time.

View Source
Declaration
string OSBuildDate { get; }

RuntimeVersion

.NET Runtime version install on the device.

View Source
Declaration
string RuntimeVersion { get; }

RebootOnUnhandledException

Should the system reboot on an exception?

View Source
Declaration
bool RebootOnUnhandledException { get; }

InitializationTimeout

Number of seconds allowed for the system to initialize.

View Source
Declaration
uint InitializationTimeout { get; }

AutomaticallyStartNetwork

Should a WiFi connection be made on startup.

View Source
Declaration
bool AutomaticallyStartNetwork { get; }

SelectedNetwork

Which network is selected in meadow.config.yaml.

View Source
Declaration
IPlatformOS.NetworkConnectionType SelectedNetwork { get; }

SdStorageSupported

Should SD card support be enabled on this platform?

View Source
Declaration
bool SdStorageSupported { get; }

ReservedPins

Names of any pins that should be reserved for OS use.

View Source
Declaration
string ReservedPins { get; }

NtpServers

Gets a list of NTP servers used for time synchronization

View Source
Declaration
string[] NtpServers { get; }

LaunchArguments

The command line arguments provided when the Meadow application was launched

View Source
Declaration
string[]? LaunchArguments { get; }

NtpClient

Gets the OS INtpClient instance

View Source
Declaration
INtpClient NtpClient { get; }

FileSystem

FileSystemInfo property

View Source
Declaration
IPlatformOS.FileSystemInfo FileSystem { get; }

Methods

GetConfigurationValue<T>(ConfigurationValues)

Get a configuration value, as specified in meadow.config.yaml, from the OS.

View Source
Declaration
T GetConfigurationValue<T>(IPlatformOS.ConfigurationValues item) where T : struct
Returns

<T>: Value for the specified item.

Parameters
TypeNameDescription
Meadow.IPlatformOS.ConfigurationValuesitemItem to retrieve.
Type Parameters
NameDescription
TType of the object being retrieved.

SetConfigurationValue<T>(ConfigurationValues, T)

Send a configuration value to the OS.

View Source
Declaration
void SetConfigurationValue<T>(IPlatformOS.ConfigurationValues item, T value) where T : struct
Parameters
TypeNameDescription
Meadow.IPlatformOS.ConfigurationValuesitemItem to set.
<T>valueValue of item.
Type Parameters
NameDescription
TType of the object being set.

GetPublicKeyInPemFormat()

Retrieves the device's public key in PEM format

View Source
Declaration
string? GetPublicKeyInPemFormat()
Returns

System.String: A public key, including header and footer, or null if none is found### RsaDecrypt(byte[], string) Performs RSA decryption of a value using the Meadow device certificate.

View Source
Declaration
byte[] RsaDecrypt(byte[] encryptedValue, string privateKeyPem)
Returns

System.Byte[]: The decrypted value

Parameters
TypeNameDescription
System.Byte[]encryptedValueThe value to decrypt
System.StringprivateKeyPemThe private key to use for decryption (in PEM format)

AesDecrypt(byte[], byte[], byte[])

Performs AES decryption of a value using the Meadow device certificate.

View Source
Declaration
byte[] AesDecrypt(byte[] encryptedValue, byte[] key, byte[] iv)
Returns

System.Byte[]: The decrypted value

Parameters
TypeNameDescription
System.Byte[]encryptedValueThe value to decrypt
System.Byte[]keyThe key used for encrypting the buffer
System.Byte[]ivThe initialization vector to use for decryption

Initialize(DeviceCapabilities, string[]?)

Initializes platform-specific OS features

View Source
Declaration
void Initialize(DeviceCapabilities capabilities, string[]? args)
Parameters
TypeNameDescription
Meadow.DeviceCapabilitiescapabilities
System.String[]argsThe command line arguments provided when the Meadow application was launched

GetCpuTemperature()

Gets the current CPU temperature

View Source
Declaration
Temperature GetCpuTemperature()
Returns

Meadow.Units.Temperature

GetPrimaryDiskSpaceInUse()

Gets the amount of storage space in use on the primary storage device

View Source
Declaration
DigitalStorage GetPrimaryDiskSpaceInUse()
Returns

Meadow.Units.DigitalStorage

GetSerialPortNames()

Gets a list of currently available serial ports

View Source
Declaration
SerialPortName[] GetSerialPortNames()
Returns

Meadow.Hardware.SerialPortName[]

GetSerialPortName(string)

Finds a platform serial port name by either friendly or system name

View Source
Declaration
SerialPortName? GetSerialPortName(string portName)
Returns

Meadow.Hardware.SerialPortName

Parameters
TypeName
System.StringportName

GetStartupMessages()

Retrieves any messages generated by the Meadow host OS prior to starting the Meadow stack

View Source
Declaration
IEnumerable<PlatformOsMessage>? GetStartupMessages()
Returns

System.Collections.Generic.IEnumerable<Meadow.PlatformOsMessage>

SetClock(DateTime)

Sets the platform OS clock

View Source
Declaration
void SetClock(DateTime dateTime)
Parameters
TypeName
System.DateTimedateTime

GetProcessorUtilization()

Retrieves the current usage (as a percentage in the range of 0-100) for each processor/core

View Source
Declaration
int[] GetProcessorUtilization()
Returns

System.Int32[]

SetServerCertificateValidationMode(ServerCertificateValidationMode)

Sets the server certificate validation mode for SSL/TLS protocols

View Source
Declaration
void SetServerCertificateValidationMode(ServerCertificateValidationMode authmode)
Parameters
TypeNameDescription
Meadow.ServerCertificateValidationModeauthmodeThe validation mode to be set: None for no validation, Optional for facultative validation,
Required for mandatory validation
Exceptions

System.ArgumentException
Thrown when an invalid validation mode is provided System.Exception
Thrown when there is an error setting the validation mode

Events

MeadowSystemError

This event is raised in the event that an exception or error occurs outside of the managed stack, such as with a coprocessor

View Source
Declaration
event EventHandler<MeadowSystemErrorInfo>? MeadowSystemError
Event Type

System.EventHandler<Meadow.MeadowSystemErrorInfo>