Skip to content

Commit

Permalink
Merge pull request #87 from Hunter275/add-removeNodeByNum
Browse files Browse the repository at this point in the history
Added removeNodeByNum to remove nodes from web
  • Loading branch information
thebentern authored Jun 9, 2024
2 parents 345f78e + 12dc41d commit f83a70b
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
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

0 comments on commit f83a70b

Please sign in to comment.