From aaea0f9199a2925fab7c040d9b65e65c8f1a301d Mon Sep 17 00:00:00 2001 From: strawmanbobi Date: Tue, 7 Nov 2017 13:56:03 +0800 Subject: [PATCH] added backward compatibility for command based ir decode --- src/ir_decoder/CMakeLists.txt | 4 ++-- src/ir_decoder/include/ir_decode.h | 8 +++++++- src/ir_decoder/src/ir_decode.c | 3 ++- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/ir_decoder/CMakeLists.txt b/src/ir_decoder/CMakeLists.txt index 6bc310a..b195e9a 100644 --- a/src/ir_decoder/CMakeLists.txt +++ b/src/ir_decoder/CMakeLists.txt @@ -89,6 +89,6 @@ set(SOURCE_FILES_JNI_SHARED_LIB src/ir_decode.c include/ir_decode.h) -add_executable(irda_decoder ${SOURCE_FILES_EXECUTABLE}) -# add_library(irda_decoder SHARED ${SOURCE_FILES_SHARED_LIB}) +add_library(irda_decoder SHARED ${SOURCE_FILES_SHARED_LIB}) +# add_executable(irda_decoder ${SOURCE_FILES_EXECUTABLE}) # add_library(irda_decoder SHARED ${SOURCE_FILES_JNI_SHARED_LIB}) diff --git a/src/ir_decoder/include/ir_decode.h b/src/ir_decoder/include/ir_decode.h index b2fff07..7e88ee2 100644 --- a/src/ir_decoder/include/ir_decode.h +++ b/src/ir_decoder/include/ir_decode.h @@ -34,6 +34,10 @@ extern "C" #define SUB_CATEGORY_QUATERNARY 0 #define SUB_CATEGORY_HEXADECIMAL 1 +// update 2017-11-07: for backward compatibility purpose +#define ir_decode(key_code, user_data, ac_status, change_wind_direction) \ + ir_decode_f(key_code, user_data, ac_status, change_wind_direction, 0) + // exported functions /** * function ir_file_open @@ -72,10 +76,12 @@ extern INT8 ir_binary_open(const UINT8 category, const UINT8 sub_category, UINT8 * user_data (out) - output decoded data in INT16 array format * ac_status(in) - pointer to AC status (optional) * change_wind_direction (in) - if control changes wind direction for AC (for AC only) + * output_format - 0x00 for analog signal output, 0x01 for digital signal output, default is 0x00 * * returns: length of decoded data (0 indicates decode failure) */ -extern UINT16 ir_decode(UINT8 key_code, UINT16* user_data, t_remote_ac_status* ac_status, BOOL change_wind_direction); +extern UINT16 ir_decode_f(UINT8 key_code, UINT16* user_data, t_remote_ac_status* ac_status, BOOL change_wind_direction, + UINT8 output_format); /** * function ir_close diff --git a/src/ir_decoder/src/ir_decode.c b/src/ir_decoder/src/ir_decode.c index f2b8cdd..8c45eae 100644 --- a/src/ir_decoder/src/ir_decode.c +++ b/src/ir_decoder/src/ir_decode.c @@ -159,7 +159,8 @@ INT8 ir_binary_open(const UINT8 category, const UINT8 sub_category, UINT8* binar } -UINT16 ir_decode(UINT8 key_code, UINT16* user_data, t_remote_ac_status* ac_status, BOOL change_wind_direction) +UINT16 ir_decode_f(UINT8 key_code, UINT16* user_data, t_remote_ac_status* ac_status, BOOL change_wind_direction, + UINT8 output_format) { if (IR_TYPE_COMMANDS == ir_binary_type) {