diff --git a/src/ir_decoder/src/include/ir_decode.h b/src/ir_decoder/src/include/ir_decode.h index 17a71cb..0a19fc5 100644 --- a/src/ir_decoder/src/include/ir_decode.h +++ b/src/ir_decoder/src/include/ir_decode.h @@ -31,9 +31,6 @@ extern "C" #define IR_TYPE_STATUS 0 #define IR_TYPE_COMMANDS 1 -#define SUB_CATEGORY_QUATERNARY 0 -#define SUB_CATEGORY_HEXADECIMAL 1 - // remote control key definition #define KEY_TV_POWER 0 #define KEY_TV_MUTE 1 @@ -199,7 +196,8 @@ extern "C" #define STANDARD_KEY_COUNT 14 #define CHANNEL_KEY_COUNT 10 -typedef enum { +typedef enum +{ REMOTE_CATEGORY_NONE = 0, REMOTE_CATEGORY_AC = 1, REMOTE_CATEGORY_TV = 2, @@ -218,6 +216,14 @@ typedef enum { REMOTE_CATEGORY_MAX = 64, } t_remote_category; +typedef enum +{ + SUB_CATEGORY_QUATERNARY = 0, + SUB_CATEGORY_HEXADECIMAL = 1, + SUB_CATEGORY_NEXT = 2, + SUB_CATEGORY_MAX = 7, +} t_remote_sub_category; + /** * function get_lib_version * diff --git a/src/ir_decoder/src/ir_decode.c b/src/ir_decoder/src/ir_decode.c index 8e1808f..1f434d1 100644 --- a/src/ir_decoder/src/ir_decode.c +++ b/src/ir_decoder/src/ir_decode.c @@ -109,12 +109,18 @@ INT8 ir_file_open(const UINT8 category, const UINT8 sub_category, const char* fi if (category < REMOTE_CATEGORY_AC || category >= REMOTE_CATEGORY_NEXT) { - ir_printf("wrong remote category\n"); + ir_printf("wrong remote category : %d\n", category); return IR_DECODE_FAILED; } - remote_category = category; + if (sub_category < SUB_CATEGORY_QUATERNARY || + sub_category >= SUB_CATEGORY_NEXT) + { + ir_printf("wrong remote sub category : %d\n", sub_category); + return IR_DECODE_FAILED; + } + if (category == REMOTE_CATEGORY_AC) { ir_binary_type = IR_TYPE_STATUS;