Skip to content

Commit

Permalink
Fix command and admin factory
Browse files Browse the repository at this point in the history
  • Loading branch information
thebentern committed Nov 19, 2023
1 parent 8ad3cc5 commit 4cd8852
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
6 changes: 4 additions & 2 deletions Meshtastic.Cli/Commands/RemoveNodeCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@ public RemoveNodeCommand(string name, string description, Option<string> port, O
Option<OutputFormat> output, Option<LogLevel> log, Option<uint?> dest, Option<bool> selectDest) :
base(name, description)
{
var nodeNum = new Argument<uint>("nodenum", "Nodenum of the node to remove from the device NodeDB");
var nodeNumArgument = new Argument<uint>("nodenum", "Nodenum of the node to remove from the device NodeDB");
AddArgument(nodeNumArgument);

this.SetHandler(async (context, commandContext) =>
this.SetHandler(async (nodeNum, context, commandContext) =>
{
var handler = new RemoveNodeCommandHandler(nodeNum, context, commandContext);
await handler.Handle();
},
nodeNumArgument,
new DeviceConnectionBinder(port, host),
new CommandContextBinder(log, output, dest, selectDest));
}
Expand Down
4 changes: 4 additions & 0 deletions Meshtastic.Cli/Properties/launchSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,10 @@
"mqtt": {
"commandName": "Project",
"commandLineArgs": "mqtt-proxy"
},
"remove-node": {
"commandName": "Project",
"commandLineArgs": "remove-node 123456"
}
}
}
8 changes: 4 additions & 4 deletions Meshtastic/Data/MessageFactories/AdminMessageFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -113,13 +113,13 @@ public MeshPacket CreateFactoryResetMessage()
{
return GetNewMeshPacket(new AdminMessage() { FactoryReset = 1 });
}
public MeshPacket CreateRemoveByNodenumMessage(uint nodeNum)
public MeshPacket CreateNodeDbResetMessage()
{
return GetNewMeshPacket(new AdminMessage() { RemoveByNodenum = nodeNum });
return GetNewMeshPacket(new AdminMessage() { NodedbReset = 1 });
}
public MeshPacket CreateSetOwnerMessage()
public MeshPacket CreateRemoveByNodenumMessage(uint nodeNum)
{
return GetNewMeshPacket(new AdminMessage() { SetOwner = container.MyNodeInfo });
return GetNewMeshPacket(new AdminMessage() { RemoveByNodenum = nodeNum });
}
public MeshPacket CreateSetCannedMessage(string message)
{
Expand Down

0 comments on commit 4cd8852

Please sign in to comment.