Skip to content

Commit

Permalink
Fix return values for nexa and proove decoder
Browse files Browse the repository at this point in the history
  • Loading branch information
Mindavi authored and merbanan committed Apr 1, 2019
1 parent 4256075 commit b2621a9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions src/devices/nexa.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ static int nexa_callback(r_device *decoder, bitbuffer_t *bitbuffer) {

/* Reject codes of wrong length */
if (bitbuffer->bits_per_row[1] != 64 && bitbuffer->bits_per_row[1] != 72)
return 0;
return DECODE_ABORT_LENGTH;


bitbuffer_t databits = {0};
unsigned pos = bitbuffer_manchester_decode(bitbuffer, 1, 0, &databits, 80);

/* Reject codes when Manchester decoding fails */
if (pos != 64 && pos != 72)
return 0;
return DECODE_ABORT_LENGTH;

bitrow_t *bb = databits.bb;
uint8_t *b = bb[0];
Expand All @@ -46,15 +46,15 @@ static int nexa_callback(r_device *decoder, bitbuffer_t *bitbuffer) {
data = data_make(
"model", "", DATA_STRING, _X("Nexa-Security","Nexa"),
"id", "House Code", DATA_INT, sensor_id,
"group", "Group", DATA_INT, group_code,
"channel", "Channel", DATA_INT, channel_code,
"state", "State", DATA_STRING, on_bit ? "OFF" : "ON",
"unit", "Unit", DATA_INT, unit_bit,
"group", "Group", DATA_INT, group_code,
NULL);

decoder_output_data(decoder, data);

return 0;
return 1;
}

static char *output_fields[] = {
Expand Down
6 changes: 3 additions & 3 deletions src/devices/proove.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,14 @@ static int proove_callback(r_device *decoder, bitbuffer_t *bitbuffer) {

/* Reject codes of wrong length */
if (bitbuffer->bits_per_row[1] != 64)
return 0;
return DECODE_ABORT_LENGTH;

bitbuffer_t databits = {0};
unsigned pos = bitbuffer_manchester_decode(bitbuffer, 1, 0, &databits, 64);

/* Reject codes when Manchester decoding fails */
if (pos != 64)
return 0;
return DECODE_ABORT_LENGTH;

bitrow_t *bb = databits.bb;
uint8_t *b = bb[0];
Expand All @@ -70,7 +70,7 @@ static int proove_callback(r_device *decoder, bitbuffer_t *bitbuffer) {

decoder_output_data(decoder, data);

return 0;
return 1;
}

static char *output_fields[] = {
Expand Down

0 comments on commit b2621a9

Please sign in to comment.