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
Type | Name | Description |
---|---|---|
Meadow.IPlatformOS.ConfigurationValues | item | Item to retrieve. |
Type Parameters
Name | Description |
---|---|
T | Type 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
Type | Name | Description |
---|---|---|
Meadow.IPlatformOS.ConfigurationValues | item | Item to set. |
<T> | value | Value of item. |
Type Parameters
Name | Description |
---|---|
T | Type 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
Type | Name | Description |
---|---|---|
System.Byte[] | encryptedValue | The value to decrypt |
System.String | privateKeyPem | The 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
Type | Name | Description |
---|---|---|
System.Byte[] | encryptedValue | The value to decrypt |
System.Byte[] | key | The key used for encrypting the buffer |
System.Byte[] | iv | The 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
Type | Name | Description |
---|---|---|
Meadow.DeviceCapabilities | capabilities | |
System.String[] | args | The 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
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
Type | Name |
---|---|
System.String | portName |
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
Type | Name |
---|---|
System.DateTime | dateTime |
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
Type | Name | Description |
---|---|---|
Meadow.ServerCertificateValidationMode | authmode | The 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