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](https://github.com/WildernessLabs/Meadow.Contracts/blob/633/merge/Source/Meadow.Contracts/Platform OS/IPlatformOS.Storage.cs#L39)
public interface IPlatformOS : IPowerController

Properties

OSVersion

OS version.

[View Source](https://github.com/WildernessLabs/Meadow.Contracts/blob/633/merge/Source/Meadow.Contracts/Platform OS/IPlatformOS.Configuration.cs#L189)
string OSVersion { get; }

OSBuildDate

OS build date and time.

[View Source](https://github.com/WildernessLabs/Meadow.Contracts/blob/633/merge/Source/Meadow.Contracts/Platform OS/IPlatformOS.Configuration.cs#L194)
string OSBuildDate { get; }

RuntimeVersion

.NET Runtime version install on the device.

[View Source](https://github.com/WildernessLabs/Meadow.Contracts/blob/633/merge/Source/Meadow.Contracts/Platform OS/IPlatformOS.Configuration.cs#L199)
string RuntimeVersion { get; }

RebootOnUnhandledException

Should the system reboot on an exception?

[View Source](https://github.com/WildernessLabs/Meadow.Contracts/blob/633/merge/Source/Meadow.Contracts/Platform OS/IPlatformOS.Configuration.cs#L204)
bool RebootOnUnhandledException { get; }

InitializationTimeout

Number of seconds allowed for the system to initialize.

[View Source](https://github.com/WildernessLabs/Meadow.Contracts/blob/633/merge/Source/Meadow.Contracts/Platform OS/IPlatformOS.Configuration.cs#L209)
uint InitializationTimeout { get; }

AutomaticallyStartNetwork

Should a WiFi connection be made on startup.

[View Source](https://github.com/WildernessLabs/Meadow.Contracts/blob/633/merge/Source/Meadow.Contracts/Platform OS/IPlatformOS.Configuration.cs#L215)
bool AutomaticallyStartNetwork { get; }

SelectedNetwork

Which network is selected in meadow.config.yaml.

[View Source](https://github.com/WildernessLabs/Meadow.Contracts/blob/633/merge/Source/Meadow.Contracts/Platform OS/IPlatformOS.Configuration.cs#L220)
IPlatformOS.NetworkConnectionType SelectedNetwork { get; }

SdStorageSupported

Should SD card support be enabled on this platform?

[View Source](https://github.com/WildernessLabs/Meadow.Contracts/blob/633/merge/Source/Meadow.Contracts/Platform OS/IPlatformOS.Configuration.cs#L225)
bool SdStorageSupported { get; }

ReservedPins

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

[View Source](https://github.com/WildernessLabs/Meadow.Contracts/blob/633/merge/Source/Meadow.Contracts/Platform OS/IPlatformOS.Configuration.cs#L231)
string ReservedPins { get; }

LaunchArguments

The command line arguments provided when the Meadow application was launched

[View Source](https://github.com/WildernessLabs/Meadow.Contracts/blob/633/merge/Source/Meadow.Contracts/Platform OS/IPlatformOS.cs#L18)
string[]? LaunchArguments { get; }

NtpClient

Gets the OS INtpClient instance

[View Source](https://github.com/WildernessLabs/Meadow.Contracts/blob/633/merge/Source/Meadow.Contracts/Platform OS/IPlatformOS.cs#L36)
INtpClient NtpClient { get; }

FileSystem

FileSystemInfo property

[View Source](https://github.com/WildernessLabs/Meadow.Contracts/blob/633/merge/Source/Meadow.Contracts/Platform OS/IPlatformOS.Storage.cs#L44)
IPlatformOS.FileSystemInfo FileSystem { get; }

Methods

GetConfigurationValue<T>(ConfigurationValues)

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

[View Source](https://github.com/WildernessLabs/Meadow.Contracts/blob/633/merge/Source/Meadow.Contracts/Platform OS/IPlatformOS.Configuration.cs#L174)
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](https://github.com/WildernessLabs/Meadow.Contracts/blob/633/merge/Source/Meadow.Contracts/Platform OS/IPlatformOS.Configuration.cs#L182)
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](https://github.com/WildernessLabs/Meadow.Contracts/blob/633/merge/Source/Meadow.Contracts/Platform OS/IPlatformOS.Crypto.cs#L9)
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](https://github.com/WildernessLabs/Meadow.Contracts/blob/633/merge/Source/Meadow.Contracts/Platform OS/IPlatformOS.Crypto.cs#L20)
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](https://github.com/WildernessLabs/Meadow.Contracts/blob/633/merge/Source/Meadow.Contracts/Platform OS/IPlatformOS.Crypto.cs#L32)
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](https://github.com/WildernessLabs/Meadow.Contracts/blob/633/merge/Source/Meadow.Contracts/Platform OS/IPlatformOS.cs#L25)
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](https://github.com/WildernessLabs/Meadow.Contracts/blob/633/merge/Source/Meadow.Contracts/Platform OS/IPlatformOS.cs#L31)
Temperature GetCpuTemperature()
Returns

Meadow.Units.Temperature

GetSerialPortNames()

Gets a list of currently available serial ports

[View Source](https://github.com/WildernessLabs/Meadow.Contracts/blob/633/merge/Source/Meadow.Contracts/Platform OS/IPlatformOS.cs#L42)
SerialPortName[] GetSerialPortNames()
Returns

Meadow.Hardware.SerialPortName[]

GetSerialPortName(string)

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

[View Source](https://github.com/WildernessLabs/Meadow.Contracts/blob/633/merge/Source/Meadow.Contracts/Platform OS/IPlatformOS.cs#L49)
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](https://github.com/WildernessLabs/Meadow.Contracts/blob/633/merge/Source/Meadow.Contracts/Platform OS/IPlatformOS.cs#L60)
IEnumerable<PlatformOsMessage>? GetStartupMessages()
Returns

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

SetClock(DateTime)

Sets the platform OS clock

[View Source](https://github.com/WildernessLabs/Meadow.Contracts/blob/633/merge/Source/Meadow.Contracts/Platform OS/IPlatformOS.cs#L66)
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](https://github.com/WildernessLabs/Meadow.Contracts/blob/633/merge/Source/Meadow.Contracts/Platform OS/IPlatformOS.cs#L71)
int[] GetProcessorUtilization()
Returns

System.Int32[]

SetServerCertificateValidationMode(ServerCertificateValidationMode)

Sets the server certificate validation mode for SSL/TLS protocols

[View Source](https://github.com/WildernessLabs/Meadow.Contracts/blob/633/merge/Source/Meadow.Contracts/Platform OS/IPlatformOS.cs#L80)
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