Skip to content

Commit

Permalink
ノードプロファイルを無効化する手段を"83"(id)を消すようにする
Browse files Browse the repository at this point in the history
  • Loading branch information
banban525 committed Oct 28, 2024
1 parent bf62f3e commit 9ef2d2b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
16 changes: 13 additions & 3 deletions server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,12 @@ if(fs.existsSync(settingsFilePath)){
}
}

let nodeProfileIdBackup = EL.Node_details["83"];
const disableNodeProfile = settings?.debugSetting?.disableNodeProfile ?? false;
if(disableNodeProfile)
{
console.log("Disable Node Profile");
delete EL.Node_details["9e"];
delete EL.Node_details["83"];
}

class Logger implements ILogger {
Expand Down Expand Up @@ -162,7 +163,11 @@ controller.sendCommandCallback = (command: string): void => {
if(command === "enableNodeProfile")
{
logger.log(`enableNodeProfile`);
EL.Node_details["9e"] = [0x00];
EL.Node_details["83"] = nodeProfileIdBackup;
if(settings.nodeProfileId !== undefined && settings.nodeProfileId !== "")
{
EL.Node_details["83"] = EL.toHexArray(settings.nodeProfileId);
}
}
};

Expand Down Expand Up @@ -305,7 +310,12 @@ async function userFunc(rinfo: rinfo, els: eldata): Promise<void> {
}

EL.initialize(echoObjectList, userFunc, 4, options);
if(settings.nodeProfileId !== undefined && settings.nodeProfileId !== "")
nodeProfileIdBackup = EL.Node_details["83"];
if(settings.debugSetting?.disableNodeProfile)
{
delete EL.Node_details["83"];
}
else if(settings.nodeProfileId !== undefined && settings.nodeProfileId !== "")
{
EL.Node_details["83"] = EL.toHexArray(settings.nodeProfileId);
}
Expand Down
4 changes: 2 additions & 2 deletions server/typings/echonet-lite/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ declare module "echonet-lite" {
const Node_details: {
"80": number[];
"82": number[];
"83": number[];
"83"?: number[];
"88": number[];
"8a": number[];
"9d": number[];
"9e"?: number[];
"9e": number[];
"9f": number[];
d3: number[];
d4: number[];
Expand Down

0 comments on commit 9ef2d2b

Please sign in to comment.