diff --git a/Source/Meadow.Cloud/MultiPlatform/CloudSample.Core/CommandController.cs b/Source/Meadow.Cloud/MultiPlatform/CloudSample.Core/CommandController.cs new file mode 100644 index 00000000..9940d581 --- /dev/null +++ b/Source/Meadow.Cloud/MultiPlatform/CloudSample.Core/CommandController.cs @@ -0,0 +1,17 @@ +using Meadow; +using Meadow.Cloud; + +namespace CloudSample; + +public class CommandController +{ + public CommandController(ICommandService commandService) + { + commandService.Subscribe(OnSampleCommandRecevied); + } + + private void OnSampleCommandRecevied(SampleCommand command) + { + Resolver.Log.Info($"Command received: Data = {command.Data}"); + } +} diff --git a/Source/Meadow.Cloud/MultiPlatform/CloudSample.Core/MainController.cs b/Source/Meadow.Cloud/MultiPlatform/CloudSample.Core/MainController.cs index cda893a0..323c133c 100644 --- a/Source/Meadow.Cloud/MultiPlatform/CloudSample.Core/MainController.cs +++ b/Source/Meadow.Cloud/MultiPlatform/CloudSample.Core/MainController.cs @@ -1,8 +1,6 @@ using Meadow; -using Meadow.Cloud; using Meadow.Logging; using System; -using System.Collections.Generic; using System.Threading; namespace CloudSample; @@ -71,45 +69,8 @@ public void Start() private void ControlTimerProc(object o) { - telemetryController.LogTelemetry(); + // telemetryController.LogTelemetry(); controlTimer.Change(10000, -1); } } - -public class TelemetryController -{ - private const int DataEventId = 2000; - - private Random random = new(); - private IMeadowCloudService cloudService; - - public TelemetryController(IMeadowCloudService cloudService) - { - this.cloudService = cloudService; - } - - public void LogTelemetry() - { - var data = new Dictionary - { - { "Int Value", random.Next(43) }, - { "String Value", BitConverter.ToString(BitConverter.GetBytes(random.NextDouble())) } - }; - - cloudService.SendEvent(DataEventId, "CloudSample Data", data); - } -} - -public class CommandController -{ - public CommandController(ICommandService commandService) - { - commandService.Subscribe(OnSampleCommandRecevied); - } - - private void OnSampleCommandRecevied(SampleCommand command) - { - Resolver.Log.Info($"Command received: Data = {command.Data}"); - } -} diff --git a/Source/Meadow.Cloud/MultiPlatform/CloudSample.Core/TelemetryController.cs b/Source/Meadow.Cloud/MultiPlatform/CloudSample.Core/TelemetryController.cs new file mode 100644 index 00000000..b83e1d41 --- /dev/null +++ b/Source/Meadow.Cloud/MultiPlatform/CloudSample.Core/TelemetryController.cs @@ -0,0 +1,29 @@ +using Meadow.Cloud; +using System; +using System.Collections.Generic; + +namespace CloudSample; + +public class TelemetryController +{ + private const int DataEventId = 2000; + + private Random random = new(); + private IMeadowCloudService cloudService; + + public TelemetryController(IMeadowCloudService cloudService) + { + this.cloudService = cloudService; + } + + public void LogTelemetry() + { + var data = new Dictionary + { + { "Int Value", random.Next(43) }, + { "String Value", BitConverter.ToString(BitConverter.GetBytes(random.NextDouble())) } + }; + + cloudService.SendEvent(DataEventId, "CloudSample Data", data); + } +} diff --git a/Source/Meadow.Cloud/MultiPlatform/CloudSample.Desktop/app.config.yaml b/Source/Meadow.Cloud/MultiPlatform/CloudSample.Desktop/app.config.yaml index a9109318..e7a249d3 100644 --- a/Source/Meadow.Cloud/MultiPlatform/CloudSample.Desktop/app.config.yaml +++ b/Source/Meadow.Cloud/MultiPlatform/CloudSample.Desktop/app.config.yaml @@ -1,16 +1,4 @@ -# Uncomment additional options as needed. -# To learn more about these config options, including custom application configuration settings, check out the Application Settings Configuration documentation. -# http://developer.wildernesslabs.co/Meadow/Meadow.OS/Configuration/Application_Settings_Configuration/ - -# App lifecycle configuration. -Lifecycle: - - # Control whether Meadow will restart when an unhandled app exception occurs. Combine with Lifecycle > AppFailureRestartDelaySeconds to control restart timing. - RestartOnAppFailure: true - - # When app set to restart automatically on app failure, -# AppFailureRestartDelaySeconds: 15 - +# Meadow.Cloud configuration. # Logging configuration. Logging: @@ -20,18 +8,7 @@ Logging: # Trace, Debug, Information, Warning, or Error Default: Trace -# Meadow.Cloud configuration. MeadowCloud: - # Enable Meadow.Cloud features Enabled: true - EnableUpdates: true - -# Meadow.Cloud Health Metrics. -HealthMetrics: - - # Enable Health Metrics -# Enabled: true - - # How often to send metrics to Meadow.Cloud (in minutes) -# Interval: 15 \ No newline at end of file + EnableUpdates: true \ No newline at end of file diff --git a/Source/Meadow.Cloud/MultiPlatform/CloudSample.RasPi/app.config.yaml b/Source/Meadow.Cloud/MultiPlatform/CloudSample.RasPi/app.config.yaml index f946983f..dac84d45 100644 --- a/Source/Meadow.Cloud/MultiPlatform/CloudSample.RasPi/app.config.yaml +++ b/Source/Meadow.Cloud/MultiPlatform/CloudSample.RasPi/app.config.yaml @@ -6,10 +6,5 @@ Logging: MeadowCloud: Enabled: true EnableUpdates: true - -HealthMetrics: - # Enable Health Metrics -# Enabled: true - - # How often to send metrics to Meadow.Cloud (in minutes) -# Interval: 15 \ No newline at end of file + EnableHealthMetrics: true + HealthMetricsIntervalMinutes: 1 diff --git a/Source/Meadow.Samples.sln b/Source/Meadow.Samples.sln index 4fabfe39..4176c97f 100644 --- a/Source/Meadow.Samples.sln +++ b/Source/Meadow.Samples.sln @@ -489,7 +489,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Walking_DigitalOutputs", "M EndProject Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "Walking_DigitalOutputs_Fs", "Meadow F7\Utilities\WalkingDigitalOutputs_F#\Walking_DigitalOutputs_Fs.fsproj", "{DB444522-6F37-4AC0-83B1-70C693395CD4}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FeatherF7_OTA", "Meadow.Cloud\FeatherF7_OTA\FeatherF7_OTA.csproj", "{5F901575-0744-4A27-B2BE-AE868D361817}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FeatherF7_OTA", "Meadow.Cloud\FeatherF7_OTA\FeatherF7_OTA.csproj", "{5F901575-0744-4A27-B2BE-AE868D361817}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StorageInfo_Sample", "RaspberryPi\StorageInfo_Sample\StorageInfo_Sample.csproj", "{043EA273-EF6D-48BC-920D-D63F827B1C55}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -2291,6 +2293,12 @@ Global {5F901575-0744-4A27-B2BE-AE868D361817}.Simulation|Any CPU.ActiveCfg = Debug|Any CPU {5F901575-0744-4A27-B2BE-AE868D361817}.Simulation|Any CPU.Build.0 = Debug|Any CPU {5F901575-0744-4A27-B2BE-AE868D361817}.Simulation|Any CPU.Deploy.0 = Debug|Any CPU + {043EA273-EF6D-48BC-920D-D63F827B1C55}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {043EA273-EF6D-48BC-920D-D63F827B1C55}.Debug|Any CPU.Build.0 = Debug|Any CPU + {043EA273-EF6D-48BC-920D-D63F827B1C55}.Release|Any CPU.ActiveCfg = Release|Any CPU + {043EA273-EF6D-48BC-920D-D63F827B1C55}.Release|Any CPU.Build.0 = Release|Any CPU + {043EA273-EF6D-48BC-920D-D63F827B1C55}.Simulation|Any CPU.ActiveCfg = Debug|Any CPU + {043EA273-EF6D-48BC-920D-D63F827B1C55}.Simulation|Any CPU.Build.0 = Debug|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -2527,6 +2535,7 @@ Global {435CD7FA-15FF-43A3-AA1B-3EFCF8859DDA} = {8BC5FD06-80AB-4975-9964-EF1DA973D7BF} {DB444522-6F37-4AC0-83B1-70C693395CD4} = {8BC5FD06-80AB-4975-9964-EF1DA973D7BF} {5F901575-0744-4A27-B2BE-AE868D361817} = {0F5B8EEF-8895-42C6-9E93-A9152EDEEDDB} + {043EA273-EF6D-48BC-920D-D63F827B1C55} = {67E244C3-7B2D-45CE-A490-E7B1E1A6A9F9} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {E3F002EA-1A25-487F-9A5D-93D1E7EC6E31} diff --git a/Source/RaspberryPi/StorageInfo_Sample/MeadowApp.cs b/Source/RaspberryPi/StorageInfo_Sample/MeadowApp.cs new file mode 100644 index 00000000..f9d1da0c --- /dev/null +++ b/Source/RaspberryPi/StorageInfo_Sample/MeadowApp.cs @@ -0,0 +1,25 @@ +using Meadow; + +namespace StorageInfo_Sample; + +public class MeadowApp : App +{ + public override Task Run() + { + Resolver.Log.Info($"\nMeadow file system info"); + Resolver.Log.Info($"-----------------------"); + + Resolver.Log.Info($"Meadow root: {Device.PlatformOS.FileSystem.FileSystemRoot}"); + Resolver.Log.Info($"Data dir: {Device.PlatformOS.FileSystem.DataDirectory}"); + Resolver.Log.Info($"Temp dir: {Device.PlatformOS.FileSystem.TempDirectory}"); + + + Resolver.Log.Info($"\n{"Filesystem",-15}{"1-K blocks",-15}{"Available",-15}Drive Name"); + foreach (LinuxStorageInformation drive in Device.PlatformOS.FileSystem.Drives) + { + Resolver.Log.Info($"{drive.Filesystem,-15}{drive.Size.KibiBytes,-15}{drive.SpaceAvailable.KibiBytes,-15}{drive.Name}"); + } + + return base.Run(); + } +} \ No newline at end of file diff --git a/Source/RaspberryPi/StorageInfo_Sample/Program.cs b/Source/RaspberryPi/StorageInfo_Sample/Program.cs new file mode 100644 index 00000000..c8ebac61 --- /dev/null +++ b/Source/RaspberryPi/StorageInfo_Sample/Program.cs @@ -0,0 +1,11 @@ +using Meadow; + +namespace StorageInfo_Sample; + +public class Program +{ + public static async Task Main(string[] args) + { + await MeadowOS.Start(args); + } +} \ No newline at end of file diff --git a/Source/RaspberryPi/StorageInfo_Sample/StorageInfo_Sample.csproj b/Source/RaspberryPi/StorageInfo_Sample/StorageInfo_Sample.csproj new file mode 100644 index 00000000..16e8f3ab --- /dev/null +++ b/Source/RaspberryPi/StorageInfo_Sample/StorageInfo_Sample.csproj @@ -0,0 +1,12 @@ + + + Exe + net8.0 + enable + enable + + + + + + \ No newline at end of file