-
-
Notifications
You must be signed in to change notification settings - Fork 623
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add command to shut down Z-Wave chip (#5553)
- Loading branch information
Showing
7 changed files
with
114 additions
and
1 deletion.
There are no files selected for viewing
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
41 changes: 41 additions & 0 deletions
41
packages/zwave-js/src/lib/serialapi/application/ShutdownMessages.ts
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,41 @@ | ||
import { MessageOrCCLogEntry, MessagePriority } from "@zwave-js/core"; | ||
import type { ZWaveHost } from "@zwave-js/host"; | ||
import { | ||
expectedResponse, | ||
FunctionType, | ||
Message, | ||
MessageBaseOptions, | ||
MessageDeserializationOptions, | ||
MessageType, | ||
messageTypes, | ||
priority, | ||
} from "@zwave-js/serial"; | ||
|
||
export interface ShutdownRequestOptions extends MessageBaseOptions { | ||
someProperty: number; | ||
} | ||
|
||
@messageTypes(MessageType.Request, FunctionType.Shutdown) | ||
@priority(MessagePriority.Normal) | ||
@expectedResponse(FunctionType.Shutdown) | ||
export class ShutdownRequest extends Message {} | ||
|
||
@messageTypes(MessageType.Response, FunctionType.Shutdown) | ||
export class ShutdownResponse extends Message { | ||
public constructor( | ||
host: ZWaveHost, | ||
options: MessageDeserializationOptions, | ||
) { | ||
super(host, options); | ||
this.success = this.payload[0] !== 0; | ||
} | ||
|
||
public readonly success: boolean; | ||
|
||
public toLogEntry(): MessageOrCCLogEntry { | ||
return { | ||
...super.toLogEntry(), | ||
message: { success: this.success }, | ||
}; | ||
} | ||
} |