3 * Identifies button event, but does not attempt to decrypt rolling code...
5 * Copyright (C) 2016 Adrian Stevenson
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
15 static const char* command_code[] ={"boot", "unlock" , "lock",};
17 static const char* get_command_codes(const uint8_t* bytes) {
18 return command_code[bytes[46] - 0xAA];
21 static int hondaremote_callback(bitbuffer_t *bitbuffer) {
22 bitrow_t *bb = bitbuffer->bb;
23 uint8_t *bytes = bitbuffer->bb[0];
24 char time_str[LOCAL_TIME_BUFLEN];
28 for (int i = 0; i < bitbuffer->num_rows; i++)
31 if (((bitbuffer->bits_per_row[i] >385) && (bitbuffer->bits_per_row[i] <=394)) &&
32 ((bytes[0] == 0xFF ) && (bytes[38] == 0xFF)))
36 fprintf (stdout,"passed validation bits per row %02d\n",(bitbuffer->bits_per_row[i]));
37 for (unsigned n=40; n<(50); ++n)
39 fprintf(stdout,"Byte %02d", n);
40 fprintf(stdout,"= %02X\n", bytes[n]);
44 //call function to lookup what button was pressed
45 const char* code = get_command_codes(bytes);
46 device_id = (bytes[44]>>8|bytes[45]);
49 local_time_str(0, time_str);
51 "time", "", DATA_STRING, time_str,
52 "model", "", DATA_STRING, "Honda Remote",
53 "device id", "", DATA_INT, device_id,
54 "code", "", DATA_STRING, code,
57 data_acquired_handler(data);
64 static char *output_fields[] = {
73 r_device hondaremote = {
74 .name = "Honda Car Key",
75 .modulation = FSK_PULSE_PWM_RAW,
77 .long_limit = 800, // Not used
79 .json_callback = &hondaremote_callback,
82 .fields = output_fields