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

Added removeNodeByNum to remove nodes from web #87

Merged
merged 1 commit into from
Jun 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
23 changes: 23 additions & 0 deletions src/meshDevice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -533,6 +533,29 @@ export abstract class MeshDevice {
);
}

/**
* Removes a node from the internal NodeDB of the radio by node number
*/
public async removeNodeByNum(nodeNum: number): Promise<number> {
this.log.debug(
Types.Emitter[Types.Emitter.RemoveNodeByNum],
`📻 Removing Node ${nodeNum} from NodeDB`,
);

const removeNodeByNum = new Protobuf.Admin.AdminMessage({
payloadVariant: {
case: "removeByNodenum",
value: nodeNum,
},
});

return await this.sendPacket(
removeNodeByNum.toBinary(),
Protobuf.Portnums.PortNum.ADMIN_APP,
"self",
);
}

/** Shuts down the current node after the specified amount of time has elapsed. */
public async shutdown(time: number): Promise<number> {
this.log.debug(
Expand Down
1 change: 1 addition & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ export enum Emitter {
RebootOta = 29,
FactoryReset = 30,
EnterDfuMode = 31,
RemoveNodeByNum = 32,
}

export interface LogEvent {
Expand Down
Loading