this repo has no description
1/*
2 * Information on the Sony IR protocol (SIRC):
3 * http://www.sbprojects.net/knowledge/ir/sirc.php
4 */
5
6// Good source for codes: https://web.archive.org/web/20160505000933/http://www.hifi-remote.com/sony/Sony_rcvr.htm
7
8export interface SonyProtocolVariation {
9 totalLengthBits: 12 | 15 | 20;
10 commandLengthBits: 7;
11 deviceTypeLengthBits: 5 | 8;
12 extensionLengthBits: 0 | 8;
13}
14
15export const SONY_PROTOCOL_COMMAND_LENGTH_BITS = 7;
16export const SONY_PROTOCOL_MAX_DEVICE_TYPE_LENGTH_BITS = 8;
17
18export const SONY_PROTOCOL_12_BITS: SonyProtocolVariation = {
19 totalLengthBits: 12,
20 commandLengthBits: SONY_PROTOCOL_COMMAND_LENGTH_BITS,
21 deviceTypeLengthBits: 5,
22 extensionLengthBits: 0,
23};
24export const SONY_PROTOCOL_15_BITS: SonyProtocolVariation = {
25 totalLengthBits: 15,
26 commandLengthBits: SONY_PROTOCOL_COMMAND_LENGTH_BITS,
27 deviceTypeLengthBits: 8,
28 extensionLengthBits: 0,
29};
30export const SONY_PROTOCOL_20_BITS: SonyProtocolVariation = {
31 totalLengthBits: 20,
32 commandLengthBits: SONY_PROTOCOL_COMMAND_LENGTH_BITS,
33 deviceTypeLengthBits: 5,
34 extensionLengthBits: 8,
35};
36export const DATA_LENGTH_BITS_TO_SONY_PROTOCOL_VARIATION = new Map<
37 number,
38 SonyProtocolVariation
39>([
40 [12, SONY_PROTOCOL_12_BITS],
41 [15, SONY_PROTOCOL_15_BITS],
42 [20, SONY_PROTOCOL_20_BITS],
43]);