-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #574 from WildernessLabs/nsh_enable_disable
Nsh enable disable commands
- Loading branch information
Showing
14 changed files
with
143 additions
and
12 deletions.
There are no files selected for viewing
25 changes: 25 additions & 0 deletions
25
Source/v2/Meadow.CLI/Commands/Current/Nsh/NshDisableCommand.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,25 @@ | ||
using CliFx.Attributes; | ||
using Microsoft.Extensions.Logging; | ||
|
||
namespace Meadow.CLI.Commands.DeviceManagement; | ||
|
||
[Command("nsh disable", Description = "Disables the Nuttx shell on the Meadow device")] | ||
public class NshDisableCommand : BaseDeviceCommand<RuntimeEnableCommand> | ||
{ | ||
public NshDisableCommand(MeadowConnectionManager connectionManager, ILoggerFactory loggerFactory) | ||
: base(connectionManager, loggerFactory) | ||
{ } | ||
|
||
protected override async ValueTask ExecuteCommand() | ||
{ | ||
var device = await GetCurrentDevice(); | ||
|
||
Logger?.LogInformation("Disabling NSH..."); | ||
|
||
var state = await device.IsRuntimeEnabled(CancellationToken); | ||
|
||
await device.NshDisable(CancellationToken); | ||
|
||
Logger?.LogInformation("NSH disabled"); | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
Source/v2/Meadow.CLI/Commands/Current/Nsh/NshEnableCommand.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,25 @@ | ||
using CliFx.Attributes; | ||
using Microsoft.Extensions.Logging; | ||
|
||
namespace Meadow.CLI.Commands.DeviceManagement; | ||
|
||
[Command("nsh enable", Description = "Enables the Nuttx shell on the Meadow device")] | ||
public class NshEnableCommand : BaseDeviceCommand<RuntimeEnableCommand> | ||
{ | ||
public NshEnableCommand(MeadowConnectionManager connectionManager, ILoggerFactory loggerFactory) | ||
: base(connectionManager, loggerFactory) | ||
{ } | ||
|
||
protected override async ValueTask ExecuteCommand() | ||
{ | ||
var device = await GetCurrentDevice(); | ||
|
||
Logger?.LogInformation("Enabling NSH..."); | ||
|
||
var state = await device.IsRuntimeEnabled(CancellationToken); | ||
|
||
await device.NshEnable(CancellationToken); | ||
|
||
Logger?.LogInformation("NSH enabled"); | ||
} | ||
} |
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
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
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
6 changes: 6 additions & 0 deletions
6
Source/v2/Meadow.Hcom/SerialRequests/NshEnableDisableRequest.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,6 @@ | ||
namespace Meadow.Hcom; | ||
|
||
internal class NshEnableDisableRequest : Request | ||
{ | ||
public override RequestType RequestType => RequestType.HCOM_MDOW_REQUEST_ENABLE_DISABLE_NSH; | ||
} |