-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
109 additions
and
73 deletions.
There are no files selected for viewing
17 changes: 17 additions & 0 deletions
17
Source/Meadow.Cloud/MultiPlatform/CloudSample.Core/CommandController.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
using Meadow; | ||
using Meadow.Cloud; | ||
|
||
namespace CloudSample; | ||
|
||
public class CommandController | ||
{ | ||
public CommandController(ICommandService commandService) | ||
{ | ||
commandService.Subscribe<SampleCommand>(OnSampleCommandRecevied); | ||
} | ||
|
||
private void OnSampleCommandRecevied(SampleCommand command) | ||
{ | ||
Resolver.Log.Info($"Command received: Data = {command.Data}"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
Source/Meadow.Cloud/MultiPlatform/CloudSample.Core/TelemetryController.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<string, object> | ||
{ | ||
{ "Int Value", random.Next(43) }, | ||
{ "String Value", BitConverter.ToString(BitConverter.GetBytes(random.NextDouble())) } | ||
}; | ||
|
||
cloudService.SendEvent(DataEventId, "CloudSample Data", data); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
using Meadow; | ||
|
||
namespace StorageInfo_Sample; | ||
|
||
public class MeadowApp : App<RaspberryPi> | ||
{ | ||
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(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
using Meadow; | ||
|
||
namespace StorageInfo_Sample; | ||
|
||
public class Program | ||
{ | ||
public static async Task Main(string[] args) | ||
{ | ||
await MeadowOS.Start(args); | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
Source/RaspberryPi/StorageInfo_Sample/StorageInfo_Sample.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<ProjectReference Include="..\..\..\..\Meadow.Core\source\implementations\linux\Meadow.Linux\Meadow.Linux.csproj" /> | ||
<ProjectReference Include="..\..\..\..\Meadow.Foundation\Source\Meadow.Foundation.Core\Meadow.Foundation.Core.csproj" /> | ||
</ItemGroup> | ||
</Project> |