Skip to content

Commit

Permalink
feat(longrange): move LongRangeChannel to core..Protocols.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
jtbraun committed Nov 15, 2023
1 parent 1bb54b2 commit 9b5c7ba
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 8 deletions.
19 changes: 19 additions & 0 deletions packages/core/src/capabilities/Protocols.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,3 +87,22 @@ export function isEmptyRoute(route: Route): boolean {
&& route.routeSpeed === ZWaveDataRate["9k6"]
);
}

export enum LongRangeChannel {
Unknown = 0x00, // Reserved
A = 0x01,
B = 0x02,
// 0x03..0xFF are reserved and must not be used
}

export function longRangeChannelToString(channel: LongRangeChannel): string {
switch (channel) {
case LongRangeChannel.Unknown:
return "Unknown";
case LongRangeChannel.A:
return "Channel A (912MHz)";
case LongRangeChannel.B:
return "Channel B (920MHz)";
}
return `Unknown (${num2hex(channel)})`;
}
3 changes: 2 additions & 1 deletion packages/zwave-js/src/lib/controller/Controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ import {
nwiHomeIdFromDSK,
securityClassIsS2,
securityClassOrder,
LongRangeChannel,
} from "@zwave-js/core";
import { migrateNVM } from "@zwave-js/nvmedit";
import {
Expand Down Expand Up @@ -182,7 +183,7 @@ import {
type SerialAPISetup_SetTXStatusReportResponse,
} from "../serialapi/capability/SerialAPISetupMessages";
import {
GetLongRangeChannelRequest, LongRangeChannel,
GetLongRangeChannelRequest,
type GetLongRangeChannelResponse,
} from "../serialapi/capability/LongRangeSetupMessages";
import { SetApplicationNodeInformationRequest } from "../serialapi/capability/SetApplicationNodeInformationRequest";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,9 @@ import {
priority,
} from "@zwave-js/serial";

// TODO: move to header?
export enum LongRangeChannel {
Unknown = 0x00, // Reserved
A = 0x01,
B = 0x02,
// 0x03..0xFF are reserved and must not be used
}
import {
LongRangeChannel
} from "@zwave-js/core";

@messageTypes(MessageType.Request, FunctionType.GetLongRangeChannel)
@expectedResponse(FunctionType.GetLongRangeChannel)
Expand Down

0 comments on commit 9b5c7ba

Please sign in to comment.