added backward compatibility for command based ir decode

This commit is contained in:
2017-11-07 13:56:03 +08:00
parent 8a19a07b22
commit aaea0f9199
3 changed files with 11 additions and 4 deletions

View File

@@ -89,6 +89,6 @@ set(SOURCE_FILES_JNI_SHARED_LIB
src/ir_decode.c src/ir_decode.c
include/ir_decode.h) 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}) # add_library(irda_decoder SHARED ${SOURCE_FILES_JNI_SHARED_LIB})

View File

@@ -34,6 +34,10 @@ extern "C"
#define SUB_CATEGORY_QUATERNARY 0 #define SUB_CATEGORY_QUATERNARY 0
#define SUB_CATEGORY_HEXADECIMAL 1 #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 // exported functions
/** /**
* function ir_file_open * 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 * user_data (out) - output decoded data in INT16 array format
* ac_status(in) - pointer to AC status (optional) * ac_status(in) - pointer to AC status (optional)
* change_wind_direction (in) - if control changes wind direction for AC (for AC only) * 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) * 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 * function ir_close

View File

@@ -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) if (IR_TYPE_COMMANDS == ir_binary_type)
{ {