rtl433  UNKNOWN
RTL-433 utility
directv.c File Reference

DirecTV RC66RX Remote Control decoder. More...

Functions

const char * get_dtv_button_label (uint8_t button_id)
 
void bitrow_set_bit (bitrow_t bitrow, unsigned bit_idx, unsigned bit_val)
 Set a single bit in a bitrow at bit_idx position. More...
 
unsigned bitrow_dpwm_decode (bitrow_t const bitrow, unsigned bit_len, unsigned start, bitrow_t bitrow_buf, unsigned *sync_pos, unsigned *sync_len)
 This is a differential PWM decode and is essentially only looking at symbol transitions, not the symbols themselves. More...
 
static int directv_decode (r_device *decoder, bitbuffer_t *bitbuffer)
 DirecTV RC66RX Remote Control decoder. More...
 

Variables

static const char * dtv_button_label []
 
static char * output_fields []
 
r_device directv
 

Detailed Description

DirecTV RC66RX Remote Control decoder.

Copyright (C) 2019 Karl Lohner klohn.nosp@m.er@t.nosp@m.hespi.nosp@m.ll.c.nosp@m.om

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

Function Documentation

◆ bitrow_dpwm_decode()

unsigned bitrow_dpwm_decode ( bitrow_t const  bitrow,
unsigned  bit_len,
unsigned  start,
bitrow_t  bitrow_buf,
unsigned *  sync_pos,
unsigned *  sync_len 
)

This is a differential PWM decode and is essentially only looking at symbol transitions, not the symbols themselves.

An inverted bitstring would yield the same result. Note that:

  • Initial contiguous alike symbol(s) is not considered data, regardless of length. Essentially, the
  • Any group of alike contiguous symbols with a length of 3 or more is considered a sync. If this happens anywhere except at the end of bitrow, any data already decoded is discarded, the length and position of the sync is noted, and data decoding resumes.
  • The one or two alike contiguous symbols immediately after a sync are not treated as data, they are essentially there to signify the end of the sync.

Return value is length of data decoded into bitrow_buf after last sync. If bitrow ends with a sync, that sync is ignored and returned data will be data before that sync.

Ensure that bitrow_buf is at least as big as bitrow or data overrun might occur.

Note that sync_pos and sync_len will be modified if a sync is found. If returned sync_pos is greater than start, it might mean there is data between start and sync_pos. If desired, call again with bit_len = sync_pos to find this data.

Maybe this can graduate to bitbuffer.c someday?

References bitrow_get_bit(), and bitrow_set_bit().

Referenced by directv_decode().

◆ bitrow_set_bit()

void bitrow_set_bit ( bitrow_t  bitrow,
unsigned  bit_idx,
unsigned  bit_val 
)

Set a single bit in a bitrow at bit_idx position.

Assume success, no bounds checking, so be careful! Maybe this can graduate to bitbuffer.c someday?

Referenced by bitrow_dpwm_decode().

◆ directv_decode()

int directv_decode ( r_device decoder,
bitbuffer_t bitbuffer 
)
static

DirecTV RC66RX Remote Control decoder.

The device uses FSK to transmit a PCM signal TRANSMISSION. Its FSK signal seems to be centered around 433.92 MHz with its MARK and SPACE frequencies each +/- 50 kHz from that center point.

A full signal TRANSMISSION consists of ROWS, which are collections of SYMBOLS. SYMBOLS, both the higher-frequency MARK (1) and lower-frequency SPACE (0), have a width of 600μs. If there is more than one ROW in a single TRANSMISSION, there will be a GAP of 27,600μs of silence between each ROW.

A TRANSMISSION may be generated in response to an EVENT on the remote. Observed EVENTS that may trigger a TRANSMISSION seem limited to manual button presses.

Each ROW in the TRANSMISSION consists of two ordered parts – its SYNC and its MESSAGE. Each ROW is expected to be complete; the device does not seem to ever truncate a signal inside of a ROW.

The SYNC may be either a LONG SYNC or a SHORT SYNC. The LONG SYNC consists of SYMBOLS 000111111111100. It is used in each row to signify that the MESSAGE which follows will be the first time this unique MESSAGE will be seen in this TRANSMISSION.

However, if a unique MESSAGE is to be sent more than once in a TRANSMISSION, each subsequent ROW with this repeated MESSAGE will send a SHORT SYNC instead of a LONG SYNC. A SHORT SYNC consists of SYMBOLS 0001111100.

ROWS are typically repeated for the duration of the EVENT (a button push on the remote) and a ROW is allowed to finish sending even if the EVENT ends before the ROW is completely sent.

ROWS in any single TRANSMISSION usually contain the same MESSAGE, however this is not always the case. TRANSMISSIONS may be one ROW for some short EVENTS, although some specific EVENTS generate TRANSMISSIONS of three rows, regardless the duration of the EVENT. Single TRANSMISSIONS have been observed to switch from one MESSAGE to another. This seems to happen for specific buttons, such as the [SELECT] button, which sends a single ROW containing a LONG SYNC and a MESSAGE that encodes a new [SELECT RELEASE] MESSAGE. Some buttons send one MESSAGE during the initial duration of the EVENT, but then switch to a new MESSAGE if the EVENT continues. Some TRANSMISSIONS stop sending ROWS after a duration even if the EVENT continues.

LOGICAL DATA in the MESSAGE may be decoded from the ROW using some sort of Differential Pulse Width Modulation (DPWM) method. Between each SYMBOL transition (both 1 to 0 and 0 to 1) consider the number of SYMBOLS. If there is only one SYMBOL, the LOGICAL DATA bit is a 0. If there are two SYMBOLS, the LOGICAL DATA bit is a 1. If there are 3 or more SYMBOLS, this is not DATA - it is a sync pulse. If a sync pulse is found (and is followed by more SYMBOLS i.e. the SYMBOL does not occur at the end of the ROW), both it and the one or two contiguous SYMBOLS after it are ignored and LOGICAL DATA would resume decoding from that next transition.

After decoding, there should be 40 bits (5 bytes) of LOGICAL DATA.

LOGICAL DATA layout in nibbles:

MM DD DD DB BC

Nibble # Letter Description
0 - 1 MM Model? Seems to always be 0x10
2 - 6 DDDDD Device ID. 0x00000 - 0xF423F are valid (000000 - 999999 in decimal)
7 - 8 BB Button Code. 0x00 - 0xFF maps to specific buttons or functions
9 C Checksum. Least Significant Nibble of sum of previous 9 nibbles, 0x0 - 0xF

Flex Spec to get ROW SYMBOLS:

$ rtl_433 -R 0 -X '-X n=DirecTV,m=FSK_PCM,s=600,l=600,g=30000,r=80000'

References bitbuffer_extract_bytes(), bitrow_dpwm_decode(), bitrow_printf(), bitbuffer::bits_per_row, DATA_FORMAT, DATA_INT, data_make(), DATA_STRING, decoder_output_data(), get_dtv_button_label(), and r_device::verbose.

◆ get_dtv_button_label()

const char* get_dtv_button_label ( uint8_t  button_id)

References dtv_button_label.

Referenced by directv_decode().

Variable Documentation

◆ directv

r_device directv
Initial value:
= {
.name = "DirecTV RC66RX Remote Control",
.modulation = FSK_PULSE_PCM,
.short_width = 600,
.long_width = 600,
.gap_limit = 30000,
.reset_limit = 50000,
.decode_fn = &directv_decode,
.disabled = 0,
.fields = output_fields,
}
FSK, Pulse Code Modulation.
Definition: r_device.h:19
static int directv_decode(r_device *decoder, bitbuffer_t *bitbuffer)
DirecTV RC66RX Remote Control decoder.
Definition: directv.c:277
static char * output_fields[]
Definition: directv.c:377

◆ dtv_button_label

const char* dtv_button_label[]
static

Referenced by get_dtv_button_label().

◆ output_fields

char* output_fields[]
static
Initial value:
= {
"model",
"id",
"button_id",
"button_name",
"event",
"mic",
NULL,
}