this repo has no description
1export const UNFOLDED_CIRCLE_PROTOCOL_SONY = 4;
2
3export interface ParsedUnfoldedHex {
4 protocolNum: number;
5 data: number;
6 dataLengthBits: number;
7 repeatCount: number;
8}
9
10export function parseUnfoldedHex(
11 unfoldedHex: string,
12): ParsedUnfoldedHex | undefined {
13 const match = unfoldedHex.match(
14 /(?<protocolNum>\d+);(?<hexData>0x[0-9A-Fa-f]+);(?<dataLengthBits>\d+);(?<repeatCount>\d+)/,
15 );
16 if (match == null) {
17 return undefined;
18 }
19
20 return {
21 protocolNum: Number.parseInt(match.groups!["protocolNum"]!),
22 data: Number.parseInt(match.groups!["hexData"]!),
23 dataLengthBits: Number.parseInt(match.groups!["dataLengthBits"]!),
24 repeatCount: Number.parseInt(match.groups!["repeatCount"]!),
25 };
26}