Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/local connection #412

Merged
merged 57 commits into from
Dec 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
8b288d0
local connection creating proper public key in Windows and Linux
ctacke Oct 25, 2023
f3202f1
Mac public key to PEM format
Oct 25, 2023
69cf913
more simulation work
ctacke Oct 25, 2023
434d89f
Merge branch 'feature/local-connection' of https://github.com/Wildern…
ctacke Oct 25, 2023
0b382f7
simulator connection
ctacke Oct 27, 2023
b7da94a
Add install instructions/links up top
patridge Nov 3, 2023
3ae0abe
Merge pull request #392 from WildernessLabs/patridge-patch-1
adrianstevens Nov 3, 2023
bffd1dc
Add Helpers.
CartBlanche Nov 1, 2023
5b1f16a
Remove duplicate extension methods.
CartBlanche Nov 1, 2023
837f312
Point to new ExtensionMethods class.
CartBlanche Nov 1, 2023
33875e9
Normalise reference to CLI namespace instead of Cli.
CartBlanche Nov 1, 2023
56c5285
Make sure app.config.json and meadow.config.yaml are sent to device.
CartBlanche Nov 2, 2023
11b38e9
make EncodeAndSendPacketawaitable.
CartBlanche Nov 2, 2023
4adeacf
Refactor to re-use existing/shared command. Also added ConsoleSpinner…
CartBlanche Nov 2, 2023
b563be7
Add wifi.config.yaml to our list of AdditionalFiles.
CartBlanche Nov 2, 2023
f5e31d6
Make sure we order the list correctly.
CartBlanche Nov 2, 2023
bacf049
Add Trimmed and TrimmedDependencies properties for use during deploym…
CartBlanche Nov 2, 2023
9dfe53c
Separate out Deployment List generation.
CartBlanche Nov 2, 2023
728a575
Intial pass are adding -f support to firmware write. More work needed.
CartBlanche Nov 6, 2023
b02754c
Colour Code default firmware folder to green during firmware list.
CartBlanche Nov 6, 2023
6ccc534
Add simple ConsoleColourText extension methods.
CartBlanche Nov 6, 2023
a63e81a
Add colour coding to verbose text too.
CartBlanche Nov 6, 2023
fc28425
Pass cancellation token to downloadFile. Also Check for default gateway.
CartBlanche Nov 6, 2023
c456932
Don't pass cancellationTocken to ReadAsStreamAsync as it won't build …
CartBlanche Nov 7, 2023
eeaa17c
Try to include more files in both dependencies and trimming.
CartBlanche Nov 8, 2023
270c65d
Display last part of path, so we know if it came from trimming or not.
CartBlanche Nov 8, 2023
29f90e6
Make sure meadow is disabled before we try to delete files. Also add …
CartBlanche Nov 9, 2023
b31e2c7
Fix cloud package upload command. Add spinners for long running tasks.
CartBlanche Nov 9, 2023
e29ead1
Massaged Chris' RuntimeVersion change so we check the device's runtim…
CartBlanche Nov 9, 2023
d20f3d7
If not Mpak path is passed in, in checked the current directory and s…
CartBlanche Nov 9, 2023
62e0e04
Don't make mpak path mandatory
CartBlanche Nov 9, 2023
83dfcf9
Added TaskExtensions methods for Console Spinner and refactored to si…
CartBlanche Nov 10, 2023
7b46167
Slight refactor to make things a tad dev friendly. Re-implmented Skip…
CartBlanche Nov 10, 2023
1eb6f96
Reduce the amount of noise/duplication when deleting files.
CartBlanche Nov 10, 2023
a791e3b
Make our Console?.Output.Write Async calls.
CartBlanche Nov 11, 2023
9ee3210
BumpYamlDotNet to latest nuget.
CartBlanche Nov 14, 2023
81d3269
Use logger rather than Console.WriteLine where possible.
CartBlanche Nov 14, 2023
b910159
Rename TaskExtensions to UITaskExtensions for clarity.
CartBlanche Nov 14, 2023
211b420
push rename changes.
CartBlanche Nov 14, 2023
4300eb3
Allow a file path to be recognised by the esp command too.
CartBlanche Nov 16, 2023
6276d5d
Make our port read async.
CartBlanche Nov 16, 2023
9f0f931
Fix overwrite issue.
CartBlanche Nov 16, 2023
13fca60
Fix deprecated text.
CartBlanche Nov 16, 2023
ccf3e22
Refresh the local firmare list, incase this is a new download.
CartBlanche Nov 16, 2023
bd7a2e1
Only flash the MeadowComms.bin file if path provided.
CartBlanche Nov 16, 2023
c4f34c3
Setting Trimmed to false for now, so customers can at least deploy.
CartBlanche Nov 17, 2023
30a85cf
Bump to alpha 3, so we can get the Trimmed = false change out.
CartBlanche Nov 17, 2023
9f1e490
improve dependency filter for App.dll
ctacke Nov 23, 2023
c874a39
Merge pull request #403 from WildernessLabs/bug/dependency-filter
adrianstevens Nov 23, 2023
5af7282
Do a directory existing check, before we check for internet.
CartBlanche Nov 17, 2023
e1b2f86
Bump version to 1.4.4 for public release.
CartBlanche Nov 18, 2023
b7205e3
bump to v1.5.0.x
CartBlanche Nov 30, 2023
af2c57e
Comment out v2 auto-publishing. We'll do it manually for now.
CartBlanche Nov 30, 2023
e744e0a
Merge branch 'develop' into feature/local-connection
ctacke Dec 1, 2023
b737570
cleaning up local provisioning
ctacke Dec 2, 2023
1be3659
Merge branch 'develop' into feature/local-connection
Dec 5, 2023
793baeb
updates for Mac PEM provisioning
Dec 5, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ protected override async ValueTask ExecuteCommand()
Logger?.LogInformation("Requesting device public key (this will take a minute)...");
var publicKey = await connection.Device.GetPublicKey(CancellationToken);

var delim = "-----END PUBLIC KEY-----\n";
var delim = "-----END RSA PUBLIC KEY-----\n";
publicKey = publicKey.Substring(0, publicKey.IndexOf(delim) + delim.Length);


Expand Down
144 changes: 144 additions & 0 deletions Source/v2/Meadow.HCom/Connections/SimulatorConnection.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
using Microsoft.Extensions.Logging;

namespace Meadow.Hcom;

public class SimulatorConnection : ConnectionBase
{
public override string Name => "Simulator";

private HttpClient? _client = null;

public override Task<IMeadowDevice?> Attach(CancellationToken? cancellationToken = null, int timeoutSeconds = 10)
{
// TODO: use some config our environment variable to launch the simulator process if it's not running

_client = new HttpClient();

throw new NotImplementedException();
}

public override Task<DeviceInfo?> GetDeviceInfo(CancellationToken? cancellationToken = null)
{
throw new NotImplementedException();
}

public override Task RuntimeDisable(CancellationToken? cancellationToken = null)
{
throw new NotImplementedException();
}

public override Task RuntimeEnable(CancellationToken? cancellationToken = null)
{
throw new NotImplementedException();
}

public override Task DeleteFile(string meadowFileName, CancellationToken? cancellationToken = null)
{
throw new NotImplementedException();
}

public override Task EraseFlash(CancellationToken? cancellationToken = null)
{
throw new NotImplementedException();
}

public override Task<MeadowFileInfo[]?> GetFileList(bool includeCrcs, CancellationToken? cancellationToken = null)
{
throw new NotImplementedException();
}

public override Task<string> GetPublicKey(CancellationToken? cancellationToken = null)
{
throw new NotImplementedException();
}

public override Task<DateTimeOffset?> GetRtcTime(CancellationToken? cancellationToken = null)
{
throw new NotImplementedException();
}

public override Task<bool> IsRuntimeEnabled(CancellationToken? cancellationToken = null)
{
throw new NotImplementedException();
}

public override Task<bool> ReadFile(string meadowFileName, string? localFileName = null, CancellationToken? cancellationToken = null)
{
throw new NotImplementedException();
}

public override Task<string?> ReadFileString(string fileName, CancellationToken? cancellationToken = null)
{
throw new NotImplementedException();
}

public override Task ResetDevice(CancellationToken? cancellationToken = null)
{
throw new NotImplementedException();
}

public override Task SetDeveloperParameter(ushort parameter, uint value, CancellationToken? cancellationToken = null)
{
throw new NotImplementedException();
}

public override Task SetRtcTime(DateTimeOffset dateTime, CancellationToken? cancellationToken = null)
{
throw new NotImplementedException();
}

public override Task SetTraceLevel(int level, CancellationToken? cancellationToken = null)
{
throw new NotImplementedException();
}

public override Task StartDebugging(int port, ILogger? logger, CancellationToken? cancellationToken)
{
throw new NotImplementedException();
}

public override Task<DebuggingServer> StartDebuggingSession(int port, ILogger? logger, CancellationToken cancellationToken)
{
throw new NotImplementedException();
}

public override Task TraceDisable(CancellationToken? cancellationToken = null)
{
throw new NotImplementedException();
}

public override Task TraceEnable(CancellationToken? cancellationToken = null)
{
throw new NotImplementedException();
}

public override Task UartTraceDisable(CancellationToken? cancellationToken = null)
{
throw new NotImplementedException();
}

public override Task UartTraceEnable(CancellationToken? cancellationToken = null)
{
throw new NotImplementedException();
}

public override Task WaitForMeadowAttach(CancellationToken? cancellationToken = null)
{
throw new NotImplementedException();
}

public override Task<bool> WriteCoprocessorFile(string localFileName, int destinationAddress, CancellationToken? cancellationToken = null)
{
throw new NotImplementedException();
}

public override Task<bool> WriteFile(string localFileName, string? meadowFileName = null, CancellationToken? cancellationToken = null)
{
throw new NotImplementedException();
}

public override Task<bool> WriteRuntime(string localFileName, CancellationToken? cancellationToken = null)
{
throw new NotImplementedException();
}
}
13 changes: 12 additions & 1 deletion Source/v2/Meadow.Hcom/Connections/LocalConnection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ private string ExecuteBashCommandLine(string command)
FileName = "/bin/bash",
Arguments = $"-c \"{command}\"",
RedirectStandardOutput = true,
RedirectStandardError = true,
UseShellExecute = false,
CreateNoWindow = true
};
Expand All @@ -76,7 +77,10 @@ private string ExecuteBashCommandLine(string command)

process?.WaitForExit();

return process?.StandardOutput.ReadToEnd() ?? string.Empty;
var stdout = process?.StandardOutput.ReadToEnd() ?? string.Empty;
var stderr = process?.StandardError.ReadToEnd() ?? string.Empty;

return stdout;
}

public override Task<string> GetPublicKey(CancellationToken? cancellationToken = null)
Expand Down Expand Up @@ -110,6 +114,13 @@ public override Task<string> GetPublicKey(CancellationToken? cancellationToken =
{
// ssh-agent sh -c 'ssh-add; ssh-add -L'
var pubkey = this.ExecuteBashCommandLine("ssh-agent sh -c 'ssh-add; ssh-add -L'");

if (pubkey.StartsWith("ssh-rsa"))
{
// convert to PEM format
pubkey = this.ExecuteBashCommandLine("ssh-keygen -f ~/.ssh/id_rsa.pub -m 'PEM' -e");
}

return Task.FromResult(pubkey);
}
else
Expand Down
Loading