diff --git a/cc26xx-example/ti/BLE-CC264x/ble_cc26xx/Projects/ble/SimpleBLEPeripheral-IREXT/CC26xx/Source/Application/ir_decoder/include/ir_decode.h b/cc26xx-example/ti/BLE-CC264x/ble_cc26xx/Projects/ble/SimpleBLEPeripheral-IREXT/CC26xx/Source/Application/ir_decoder/include/ir_decode.h index b2fff07..4132128 100644 --- a/cc26xx-example/ti/BLE-CC264x/ble_cc26xx/Projects/ble/SimpleBLEPeripheral-IREXT/CC26xx/Source/Application/ir_decoder/include/ir_decode.h +++ b/cc26xx-example/ti/BLE-CC264x/ble_cc26xx/Projects/ble/SimpleBLEPeripheral-IREXT/CC26xx/Source/Application/ir_decoder/include/ir_decode.h @@ -34,6 +34,168 @@ extern "C" #define SUB_CATEGORY_QUATERNARY 0 #define SUB_CATEGORY_HEXADECIMAL 1 +// remote control key definition +#define KEY_TV_POWER 0 +#define KEY_TV_MUTE 1 +#define KEY_TV_UP 2 +#define KEY_TV_DOWN 3 +#define KEY_TV_LEFT 4 +#define KEY_TV_RIGHT 5 +#define KEY_TV_OK 6 +#define KEY_TV_VOL_PLUS 7 +#define KEY_TV_VOL_MINUS 8 +#define KEY_TV_BACK 9 +#define KEY_TV_INPUT 10 +#define KEY_TV_MENU 11 +#define KEY_TV_HOME 12 +#define KEY_TV_SETTINGS 13 + +#define KEY_AC_POWER 0 +#define KEY_AC_TEMP_PLUS 1 +#define KEY_AC_TEMP_MINUS 2 +#define KEY_AC_MODE_SWITCH 8 +#define KEY_AC_WIND_SPEED 9 +#define KEY_AC_WIND_DIRECTION 10 + +#define KEY_STB_POWER 0 +#define KEY_STB_MUTE 1 +#define KEY_STB_UP 2 +#define KEY_STB_DOWN 3 +#define KEY_STB_LEFT 4 +#define KEY_STB_RIGHT 5 +#define KEY_STB_OK 6 +#define KEY_STB_VOL_PLUS 7 +#define KEY_STB_VOL_MINUS 8 +#define KEY_STB_BACK 9 +#define KEY_STB_INPUT 10 +#define KEY_STB_MENU 11 +#define KEY_STB_PAGE_UP 12 +#define KEY_STB_PAGE_DOWN 13 + +#define KEY_NETBOX_POWER 0 +#define KEY_NETBOX_UP 1 +#define KEY_NETBOX_DOWN 2 +#define KEY_NETBOX_LEFT 3 +#define KEY_NETBOX_RIGHT 4 +#define KEY_NETBOX_OK 5 +#define KEY_NETBOX_VOL_PLUS 6 +#define KEY_NETBOX_VOL_MINUS 7 +#define KEY_NETBOX_BACK 8 +#define KEY_NETBOX_MENU 9 +#define KEY_NETBOX_HOME 10 + +#define KEY_IPTV_POWER 0 +#define KEY_IPTV_MUTE 1 +#define KEY_IPTV_UP 2 +#define KEY_IPTV_DOWN 3 +#define KEY_IPTV_LEFT 4 +#define KEY_IPTV_RIGHT 5 +#define KEY_IPTV_OK 6 +#define KEY_IPTV_VOL_PLUS 7 +#define KEY_IPTV_VOL_MINUS 8 +#define KEY_IPTV_BACK 9 +#define KEY_IPTV_INPUT 10 +#define KEY_IPTV_MENU 11 +#define KEY_IPTV_PAGE_UP 12 +#define KEY_IPTV_PAGE_DOWN 13 + +#define KEY_DVD_POWER 0 +#define KEY_DVD_UP 1 +#define KEY_DVD_DOWN 2 +#define KEY_DVD_LEFT 3 +#define KEY_DVD_RIGHT 4 +#define KEY_DVD_OK 5 +#define KEY_DVD_VOL_PLUS 6 +#define KEY_DVD_VOL_MINUS 7 +#define KEY_DVD_PLAY 8 +#define KEY_DVD_PAUSE 9 +#define KEY_DVD_EJECT 10 +#define KEY_DVD_REWIND 11 +#define KEY_DVD_FASTFORWARD 12 +#define KEY_DVD_MENU 13 + +#define KEY_FAN_POWER 0 +#define KEY_FAN_WIND_PLUS 6 +#define KEY_FAN_WIND_MUNIS 7 +#define KEY_FAN_SWING 8 +#define KEY_FAN_WIND_SPEED 9 +#define KEY_FAN_WIND_TYPE 10 + +#define KEY_PROJECTOR_POWER 0 +#define KEY_PROJECTOR_UP 1 +#define KEY_PROJECTOR_DOWN 2 +#define KEY_PROJECTOR_LEFT 3 +#define KEY_PROJECTOR_RIGHT 4 +#define KEY_PROJECTOR_OK 5 +#define KEY_PROJECTOR_VOL_PLUS 6 +#define KEY_PROJECTOR_VOL_MINUS 7 +#define KEY_PROJECTOR_ZOOM_OUT 8 +#define KEY_PROJECTOR_MENU 9 +#define KEY_PROJECTOR_ZOOM_IN 10 +#define KEY_PROJECTOR_BACK 11 + +#define KEY_STEREO_POWER 0 +#define KEY_STEREO_UP 1 +#define KEY_STEREO_DOWN 2 +#define KEY_STEREO_LEFT 3 +#define KEY_STEREO_RIGHT 4 +#define KEY_STEREO_OK 5 +#define KEY_STEREO_VOL_PLUS 6 +#define KEY_STEREO_VOL_MINUS 7 +#define KEY_STEREO_MUTE 8 +#define KEY_STEREO_MENU 9 + +#define KEY_BULB_POWER 0 +#define KEY_BULB_COLOR_1 1 +#define KEY_BULB_COLOR_2 2 +#define KEY_BULB_COLOR_3 3 +#define KEY_BULB_COLOR_4 4 +#define KEY_BULB_COLOR_0 5 +#define KEY_BULB_BRIGHT_PLUS 6 +#define KEY_BULB_BRIGHT_MINUS 7 +#define KEY_BULB_BRIGHT_POWER_ON 8 +#define KEY_BULB_BRIGHT_RAINBOW 9 +#define KEY_BULB_BRIGHT_POWER_OFF 10 + +#define KEY_CLEANROBOT_POWER 0 +#define KEY_CLEANROBOT_FOWWARD 1 +#define KEY_CLEANROBOT_BACKWARD 2 +#define KEY_CLEANROBOT_LEFT 3 +#define KEY_CLEANROBOT_RIGHT 4 +#define KEY_CLEANROBOT_START 5 +#define KEY_CLEANROBOT_STOP 6 +#define KEY_CLEANROBOT_AUTO 8 +#define KEY_CLEANROBOT_SPOT 9 +#define KEY_CLEANROBOT_SPEED 10 +#define KEY_CLEANROBOT_TIMER 11 +#define KEY_CLEANROBOT_CHARGE 12 +#define KEY_CLEANROBOT_PRESERVE 13 + +#define KEY_AIRCLEANER_POWER 0 +#define KEY_AIRCLEANER_ION 5 +#define KEY_AIRCLEANER_AUTO 8 +#define KEY_AIRCLEANER_WIND_SPEED 9 +#define KEY_AIRCLEANER_MODE_SWITCH 10 +#define KEY_AIRCLEANER_TIMER 11 +#define KEY_AIRCLEANER_LIGHT 12 +#define KEY_AIRCLEANER_FORCE 13 + +#define KEY_DYSON_POWER 0 +#define KEY_DYSON_WIND_SPEED_PLUS 1 +#define KEY_DYSON_WIND_SPEED_MINUS 2 +#define KEY_DYSON_TIMER_MINUS 3 +#define KEY_DYSON_TIMER_PLUS 4 +#define KEY_DYSON_AUTO 5 +#define KEY_DYSON_TEMP_PLUS 6 +#define KEY_DYSON_TEMP_MINUS 7 +#define KEY_DYSON_SWING 8 +#define KEY_DYSON_DIFFUSION 9 +#define KEY_DYSON_FAV 10 +#define KEY_DYSON_TIMER 11 +#define KEY_DYSON_SLEEP 12 +#define KEY_DYSON_COOL 13 + + // exported functions /** * function ir_file_open @@ -153,6 +315,12 @@ extern INT8 get_supported_wind_direction(UINT8 *supported_wind_direction); extern void ir_lib_free_inner_buffer(); #endif +// this function is preferred being called by JNI only +UINT16 ir_decode_combo(const UINT8 category, const UINT8 sub_category, + UINT8* binary, UINT16 binary_length, + UINT8 key_code, UINT16* user_data, + t_remote_ac_status* ac_status, BOOL change_wind_direction); + #ifdef __cplusplus } #endif diff --git a/cc26xx-example/ti/BLE-CC264x/ble_cc26xx/Projects/ble/SimpleBLEPeripheral-IREXT/CC26xx/Source/Application/ir_decoder/include/ir_defs.h b/cc26xx-example/ti/BLE-CC264x/ble_cc26xx/Projects/ble/SimpleBLEPeripheral-IREXT/CC26xx/Source/Application/ir_decoder/include/ir_defs.h index b16e660..940e6b5 100644 --- a/cc26xx-example/ti/BLE-CC264x/ble_cc26xx/Projects/ble/SimpleBLEPeripheral-IREXT/CC26xx/Source/Application/ir_decoder/include/ir_defs.h +++ b/cc26xx-example/ti/BLE-CC264x/ble_cc26xx/Projects/ble/SimpleBLEPeripheral-IREXT/CC26xx/Source/Application/ir_decoder/include/ir_defs.h @@ -32,6 +32,11 @@ extern "C" #define FORMAT_HEX 16 #define FORMAT_DECIMAL 10 +// #define USE_DYNAMIC_TAG 1 + +#if defined USE_DYNAMIC_TAG +#include +#endif typedef unsigned char UINT8; typedef signed char INT8; @@ -54,12 +59,13 @@ void noprint(const char *fmt, ...); #define ir_memcpy(A, B, C) memcpy(A, B, C) #define ir_memset(A, B, C) memset(A, B, C) #define ir_strlen(A) strlen(A) -#if (defined BOARD_PC) && (!defined BOARD_PC_JNI) +#if ((defined BOARD_PC) || (defined BOARD_PC_JNI)) && (defined DEBUG) #define ir_printf printf #else #define ir_printf noprint #endif #define USER_DATA_SIZE 1636 +// #define USER_DATA_SIZE 4096 #ifdef __cplusplus } diff --git a/cc26xx-example/ti/BLE-CC264x/ble_cc26xx/Projects/ble/SimpleBLEPeripheral-IREXT/CC26xx/Source/Application/ir_decoder/src/ir_ac_apply.c b/cc26xx-example/ti/BLE-CC264x/ble_cc26xx/Projects/ble/SimpleBLEPeripheral-IREXT/CC26xx/Source/Application/ir_decoder/src/ir_ac_apply.c index 905ddc8..267df48 100644 --- a/cc26xx-example/ti/BLE-CC264x/ble_cc26xx/Projects/ble/SimpleBLEPeripheral-IREXT/CC26xx/Source/Application/ir_decoder/src/ir_ac_apply.c +++ b/cc26xx-example/ti/BLE-CC264x/ble_cc26xx/Projects/ble/SimpleBLEPeripheral-IREXT/CC26xx/Source/Application/ir_decoder/src/ir_ac_apply.c @@ -495,6 +495,11 @@ static INT8 apply_checksum_spec_byte_onebyte(UINT8 *ac_code, t_tag_checksum_data static UINT8 has_function(struct ac_protocol *protocol, UINT8 function) { + if (function < AC_FUNCTION_POWER || function > AC_FUNCTION_WIND_FIX) + { + return FALSE; + } + if (0 != protocol->function1.len) { if (0 != protocol->function1.comp_data[function - 1].seg_len) @@ -518,6 +523,11 @@ INT8 apply_function(struct ac_protocol *protocol, UINT8 function) { UINT16 i = 0; + if (function < AC_FUNCTION_POWER || function > AC_FUNCTION_WIND_FIX) + { + return IR_DECODE_FAILED; + } + // function index starts from 1 (AC_FUNCTION_POWER), do -1 operation at first if (0 == protocol->function1.len) { diff --git a/cc26xx-example/ti/BLE-CC264x/ble_cc26xx/Projects/ble/SimpleBLEPeripheral-IREXT/CC26xx/Source/Application/ir_decoder/src/ir_ac_parse_forbidden_info.c b/cc26xx-example/ti/BLE-CC264x/ble_cc26xx/Projects/ble/SimpleBLEPeripheral-IREXT/CC26xx/Source/Application/ir_decoder/src/ir_ac_parse_forbidden_info.c index 0ea1c47..331a243 100644 --- a/cc26xx-example/ti/BLE-CC264x/ble_cc26xx/Projects/ble/SimpleBLEPeripheral-IREXT/CC26xx/Source/Application/ir_decoder/src/ir_ac_parse_forbidden_info.c +++ b/cc26xx-example/ti/BLE-CC264x/ble_cc26xx/Projects/ble/SimpleBLEPeripheral-IREXT/CC26xx/Source/Application/ir_decoder/src/ir_ac_parse_forbidden_info.c @@ -22,7 +22,7 @@ extern t_ac_protocol *context; INT8 parse_nmode_data_speed(char *pdata, t_ac_n_mode seq) { - char buf[16] = {0}; + char buf[16] = { 0 }; char *p = pdata; UINT16 pos = 0; UINT16 cnt = 0, index = 0; @@ -47,7 +47,7 @@ INT8 parse_nmode_data_speed(char *pdata, t_ac_n_mode seq) INT8 parse_nmode_data_temp(char *pdata, t_ac_n_mode seq) { - char buf[16] = {0}; + char buf[16] = { 0 }; char *p = pdata; UINT16 pos = 0; UINT16 cnt = 0, index = 0; @@ -71,8 +71,8 @@ INT8 parse_nmode_data_temp(char *pdata, t_ac_n_mode seq) INT8 parse_nmode_pos(char *buf, t_ac_n_mode index) { UINT16 i = 0; - char data[64] = {0}; - // char start[8] = {0}; + char data[64] = { 0 }; + // char start[8] = { 0 }; if (ir_strlen(buf) == 1) { if (buf[0] == 'S' || buf[0] == 's') @@ -111,7 +111,7 @@ INT8 parse_nmode(struct tag_head *tag, t_ac_n_mode index) UINT16 i = 0; UINT16 preindex = 0; - char buf[64] = {0}; + char buf[64] = { 0 }; if (tag->p_data[0] == 'N' && tag->p_data[1] == 'A') { diff --git a/cc26xx-example/ti/BLE-CC264x/ble_cc26xx/Projects/ble/SimpleBLEPeripheral-IREXT/CC26xx/Source/Application/ir_decoder/src/ir_ac_parse_frame_info.c b/cc26xx-example/ti/BLE-CC264x/ble_cc26xx/Projects/ble/SimpleBLEPeripheral-IREXT/CC26xx/Source/Application/ir_decoder/src/ir_ac_parse_frame_info.c index b96bca1..0a86f46 100644 --- a/cc26xx-example/ti/BLE-CC264x/ble_cc26xx/Projects/ble/SimpleBLEPeripheral-IREXT/CC26xx/Source/Application/ir_decoder/src/ir_ac_parse_frame_info.c +++ b/cc26xx-example/ti/BLE-CC264x/ble_cc26xx/Projects/ble/SimpleBLEPeripheral-IREXT/CC26xx/Source/Application/ir_decoder/src/ir_ac_parse_frame_info.c @@ -19,7 +19,7 @@ Revision log: INT8 parse_boot_code(struct tag_head *tag) { - UINT8 buf[16] = {0}; + UINT8 buf[16] = { 0 }; UINT8 *p = NULL; UINT16 pos = 0; UINT16 cnt = 0, index = 0; @@ -53,8 +53,8 @@ INT8 parse_boot_code(struct tag_head *tag) INT8 parse_zero(struct tag_head *tag) { - UINT8 low[16] = {0}; - UINT8 high[16] = {0}; + UINT8 low[16] = { 0 }; + UINT8 high[16] = { 0 }; UINT16 index = 0; UINT8 *p = NULL; @@ -84,8 +84,8 @@ INT8 parse_zero(struct tag_head *tag) INT8 parse_one(struct tag_head *tag) { - UINT8 low[16] = {0}; - UINT8 high[16] = {0}; + UINT8 low[16] = { 0 }; + UINT8 high[16] = { 0 }; UINT16 index = 0; UINT8 *p = NULL; @@ -115,7 +115,7 @@ INT8 parse_one(struct tag_head *tag) INT8 parse_delay_code_data(UINT8 *pdata) { - UINT8 buf[16] = {0}; + UINT8 buf[16] = { 0 }; UINT8 *p = NULL; UINT16 pos = 0; UINT16 cnt = 0, index = 0; @@ -146,7 +146,7 @@ INT8 parse_delay_code_data(UINT8 *pdata) INT8 parse_delay_code_pos(UINT8 *buf) { UINT16 i = 0; - UINT8 data[64] = {0}, start[8] = {0}; + UINT8 data[64] = { 0 }, start[8] = { 0 }; if (NULL == buf) { @@ -171,7 +171,7 @@ INT8 parse_delay_code_pos(UINT8 *buf) INT8 parse_delay_code(struct tag_head *tag) { - UINT8 buf[64] = {0}; + UINT8 buf[64] = { 0 }; UINT16 i = 0; UINT16 preindex = 0; preindex = 0; @@ -228,7 +228,7 @@ INT8 parse_frame_len(struct tag_head *tag, UINT16 len) INT8 parse_endian(struct tag_head *tag) { - UINT8 buf[8] = {0}; + UINT8 buf[8] = { 0 }; if (NULL == tag) { @@ -241,7 +241,7 @@ INT8 parse_endian(struct tag_head *tag) INT8 parse_lastbit(struct tag_head *tag) { - UINT8 buf[8] = {0}; + UINT8 buf[8] = { 0 }; if (NULL == tag) { @@ -254,7 +254,7 @@ INT8 parse_lastbit(struct tag_head *tag) INT8 parse_repeat_times(struct tag_head *tag) { - char asc_code[8] = {0}; + char asc_code[8] = { 0 }; if (NULL == tag) { return IR_DECODE_FAILED; @@ -270,7 +270,7 @@ INT8 parse_repeat_times(struct tag_head *tag) INT8 parse_delay_code_tag48_pos(UINT8 *buf) { UINT16 i = 0; - UINT8 data[64] = {0}, start[8] = {0}; + UINT8 data[64] = { 0 }, start[8] = { 0 }; if (NULL == buf) { @@ -297,7 +297,7 @@ INT8 parse_bit_num(struct tag_head *tag) { UINT16 i = 0; UINT16 preindex = 0; - UINT8 buf[64] = {0}; + UINT8 buf[64] = { 0 }; if (NULL == tag) { diff --git a/cc26xx-example/ti/BLE-CC264x/ble_cc26xx/Projects/ble/SimpleBLEPeripheral-IREXT/CC26xx/Source/Application/ir_decoder/src/ir_decode.c b/cc26xx-example/ti/BLE-CC264x/ble_cc26xx/Projects/ble/SimpleBLEPeripheral-IREXT/CC26xx/Source/Application/ir_decoder/src/ir_decode.c index 299d4ef..ce86a3a 100644 --- a/cc26xx-example/ti/BLE-CC264x/ble_cc26xx/Projects/ble/SimpleBLEPeripheral-IREXT/CC26xx/Source/Application/ir_decoder/src/ir_decode.c +++ b/cc26xx-example/ti/BLE-CC264x/ble_cc26xx/Projects/ble/SimpleBLEPeripheral-IREXT/CC26xx/Source/Application/ir_decoder/src/ir_decode.c @@ -22,6 +22,8 @@ Revision log: struct ir_bin_buffer binary_file; struct ir_bin_buffer *p_ir_buffer = &binary_file; +const char* release = "0.2.1"; + #if defined USE_DYNAMIC_TAG struct tag_head *tags; #else @@ -31,7 +33,7 @@ struct tag_head tags[TAG_COUNT_FOR_PROTOCOL]; UINT8 *ir_hex_code = NULL; UINT8 ir_hex_len = 0; -UINT8 byteArray[PROTOCOL_SIZE] = {0}; +UINT8 byteArray[PROTOCOL_SIZE] = { 0 }; size_t binary_length = 0; UINT8 *binary_content = NULL; @@ -175,7 +177,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(UINT8 key_code, UINT16* user_data, + t_remote_ac_status* ac_status, BOOL change_wind_direction) { if (IR_TYPE_COMMANDS == ir_binary_type) { @@ -187,6 +190,13 @@ UINT16 ir_decode(UINT8 key_code, UINT16* user_data, t_remote_ac_status* ac_statu { return 0; } + ir_printf("ac status is not null in decode core : power = %d, mode = %d, " + "temp = %d, wind_dir = %d, wind_speed = %d, " + "keycode = %d, change_wind_direction = %d\n", + ac_status->ac_power, ac_status->ac_mode, + ac_status->ac_temp, ac_status->ac_wind_dir, + ac_status->ac_wind_speed, + key_code, change_wind_direction); return ir_ac_control(*ac_status, user_data, key_code, change_wind_direction); } } @@ -196,10 +206,12 @@ INT8 ir_close() { if (IR_TYPE_COMMANDS == ir_binary_type) { + ir_printf("tv binary close\n"); return ir_tv_binary_close(); } else { + ir_printf("ac binary close\n"); return ir_ac_binary_close(); } } @@ -273,7 +285,7 @@ static INT8 ir_ac_binary_open(UINT8 *binary, UINT16 binary_length) return IR_DECODE_SUCCEEDED; } -static UINT16 ir_ac_control(t_remote_ac_status ac_status, UINT16 *user_data, UINT8 function_code, +static UINT16 ir_ac_control(t_remote_ac_status ac_status, UINT16 *user_data, UINT8 key_code, BOOL change_wind_direction) { UINT16 time_length = 0; @@ -282,6 +294,36 @@ static UINT16 ir_ac_control(t_remote_ac_status ac_status, UINT16 *user_data, UIN UINT16 i = 0; #endif + UINT8 function_code = 0; + + switch(key_code) + { + case 0: + function_code = AC_FUNCTION_POWER; + break; + case 1: + function_code = AC_FUNCTION_MODE; + break; + case 2: + function_code = AC_FUNCTION_TEMPERATURE_UP; + break; + case 3: + function_code = AC_FUNCTION_TEMPERATURE_DOWN; + break; + case 7: + function_code = AC_FUNCTION_TEMPERATURE_UP; + break; + case 8: + function_code = AC_FUNCTION_TEMPERATURE_DOWN; + break; + case 9: + function_code = AC_FUNCTION_WIND_SPEED; + break; + case 10: + function_code = AC_FUNCTION_WIND_SWING; + break; + } + if (0 == context->default_code.len) { ir_printf("\ndefault code is empty\n"); @@ -646,6 +688,25 @@ static INT8 ir_tv_binary_close() } //////// TV End //////// +// combo decode for JNI which means call open, decode and then close in one JNI call +UINT16 ir_decode_combo(const UINT8 category, const UINT8 sub_category, + UINT8* binary, UINT16 binary_length, + UINT8 key_code, UINT16* user_data, + t_remote_ac_status* ac_status, BOOL change_wind_direction) +{ + UINT16 decoded_length = 0; + if (IR_DECODE_SUCCEEDED == + ir_binary_open(category, sub_category, binary, binary_length)) + { + decoded_length = ir_decode(key_code, user_data, ac_status, change_wind_direction); + ir_close(); + return decoded_length; + } + else + { + return 0; + } +} #if (defined BOARD_PC || defined BOARD_PC_DLL) void ir_lib_free_inner_buffer() diff --git a/cc26xx-example/ti/BLE-CC264x/ble_cc26xx/Projects/ble/SimpleBLEPeripheral-IREXT/CC26xx/Source/Application/ir_decoder/src/ir_tv_control.c b/cc26xx-example/ti/BLE-CC264x/ble_cc26xx/Projects/ble/SimpleBLEPeripheral-IREXT/CC26xx/Source/Application/ir_decoder/src/ir_tv_control.c index f116b35..dd7869a 100644 --- a/cc26xx-example/ti/BLE-CC264x/ble_cc26xx/Projects/ble/SimpleBLEPeripheral-IREXT/CC26xx/Source/Application/ir_decoder/src/ir_tv_control.c +++ b/cc26xx-example/ti/BLE-CC264x/ble_cc26xx/Projects/ble/SimpleBLEPeripheral-IREXT/CC26xx/Source/Application/ir_decoder/src/ir_tv_control.c @@ -315,7 +315,7 @@ static void print_ir_time(t_ir_data *data, UINT8 key_index, UINT16 *ir_time) } else if (ir_decode_flag == IRDA_DECODE_2_BITS) { - // for quanternary formatted code + // for quaternary formatted code process_decode_number(key_code, data, 2, ir_time); } else if (ir_decode_flag == IRDA_DECODE_4_BITS) diff --git a/jni-example/decodesdk/libs/ir_decode_0.2.1-linux-x64.so b/jni-example/decodesdk/libs/ir_decode_0.2.1-linux-x64.so new file mode 100644 index 0000000..85bdf33 Binary files /dev/null and b/jni-example/decodesdk/libs/ir_decode_0.2.1-linux-x64.so differ diff --git a/jni-example/decodesdk/libs/libirda_decoder.so b/jni-example/decodesdk/libs/libirda_decoder.so deleted file mode 100644 index 38d58c9..0000000 Binary files a/jni-example/decodesdk/libs/libirda_decoder.so and /dev/null differ diff --git a/jni-example/decodesdk/src/net/irext/decode/sdk/IRDecode.java b/jni-example/decodesdk/src/net/irext/decode/sdk/IRDecode.java index 1bfb76e..8a656ae 100644 --- a/jni-example/decodesdk/src/net/irext/decode/sdk/IRDecode.java +++ b/jni-example/decodesdk/src/net/irext/decode/sdk/IRDecode.java @@ -49,7 +49,7 @@ public class IRDecode { } private IRDecode() { - String libPath = "/data/irext/libirda_decoder.so"; + String libPath = "/data/irext/ir_decode_0.2.1-linux-x64.so"; System.out.println("loading decode library " + libPath); System.load(libPath); } diff --git a/win32-example/DecodeTestWin/ir_decoder/include/ir_decode.h b/win32-example/DecodeTestWin/ir_decoder/include/ir_decode.h index b2fff07..4132128 100644 --- a/win32-example/DecodeTestWin/ir_decoder/include/ir_decode.h +++ b/win32-example/DecodeTestWin/ir_decoder/include/ir_decode.h @@ -34,6 +34,168 @@ extern "C" #define SUB_CATEGORY_QUATERNARY 0 #define SUB_CATEGORY_HEXADECIMAL 1 +// remote control key definition +#define KEY_TV_POWER 0 +#define KEY_TV_MUTE 1 +#define KEY_TV_UP 2 +#define KEY_TV_DOWN 3 +#define KEY_TV_LEFT 4 +#define KEY_TV_RIGHT 5 +#define KEY_TV_OK 6 +#define KEY_TV_VOL_PLUS 7 +#define KEY_TV_VOL_MINUS 8 +#define KEY_TV_BACK 9 +#define KEY_TV_INPUT 10 +#define KEY_TV_MENU 11 +#define KEY_TV_HOME 12 +#define KEY_TV_SETTINGS 13 + +#define KEY_AC_POWER 0 +#define KEY_AC_TEMP_PLUS 1 +#define KEY_AC_TEMP_MINUS 2 +#define KEY_AC_MODE_SWITCH 8 +#define KEY_AC_WIND_SPEED 9 +#define KEY_AC_WIND_DIRECTION 10 + +#define KEY_STB_POWER 0 +#define KEY_STB_MUTE 1 +#define KEY_STB_UP 2 +#define KEY_STB_DOWN 3 +#define KEY_STB_LEFT 4 +#define KEY_STB_RIGHT 5 +#define KEY_STB_OK 6 +#define KEY_STB_VOL_PLUS 7 +#define KEY_STB_VOL_MINUS 8 +#define KEY_STB_BACK 9 +#define KEY_STB_INPUT 10 +#define KEY_STB_MENU 11 +#define KEY_STB_PAGE_UP 12 +#define KEY_STB_PAGE_DOWN 13 + +#define KEY_NETBOX_POWER 0 +#define KEY_NETBOX_UP 1 +#define KEY_NETBOX_DOWN 2 +#define KEY_NETBOX_LEFT 3 +#define KEY_NETBOX_RIGHT 4 +#define KEY_NETBOX_OK 5 +#define KEY_NETBOX_VOL_PLUS 6 +#define KEY_NETBOX_VOL_MINUS 7 +#define KEY_NETBOX_BACK 8 +#define KEY_NETBOX_MENU 9 +#define KEY_NETBOX_HOME 10 + +#define KEY_IPTV_POWER 0 +#define KEY_IPTV_MUTE 1 +#define KEY_IPTV_UP 2 +#define KEY_IPTV_DOWN 3 +#define KEY_IPTV_LEFT 4 +#define KEY_IPTV_RIGHT 5 +#define KEY_IPTV_OK 6 +#define KEY_IPTV_VOL_PLUS 7 +#define KEY_IPTV_VOL_MINUS 8 +#define KEY_IPTV_BACK 9 +#define KEY_IPTV_INPUT 10 +#define KEY_IPTV_MENU 11 +#define KEY_IPTV_PAGE_UP 12 +#define KEY_IPTV_PAGE_DOWN 13 + +#define KEY_DVD_POWER 0 +#define KEY_DVD_UP 1 +#define KEY_DVD_DOWN 2 +#define KEY_DVD_LEFT 3 +#define KEY_DVD_RIGHT 4 +#define KEY_DVD_OK 5 +#define KEY_DVD_VOL_PLUS 6 +#define KEY_DVD_VOL_MINUS 7 +#define KEY_DVD_PLAY 8 +#define KEY_DVD_PAUSE 9 +#define KEY_DVD_EJECT 10 +#define KEY_DVD_REWIND 11 +#define KEY_DVD_FASTFORWARD 12 +#define KEY_DVD_MENU 13 + +#define KEY_FAN_POWER 0 +#define KEY_FAN_WIND_PLUS 6 +#define KEY_FAN_WIND_MUNIS 7 +#define KEY_FAN_SWING 8 +#define KEY_FAN_WIND_SPEED 9 +#define KEY_FAN_WIND_TYPE 10 + +#define KEY_PROJECTOR_POWER 0 +#define KEY_PROJECTOR_UP 1 +#define KEY_PROJECTOR_DOWN 2 +#define KEY_PROJECTOR_LEFT 3 +#define KEY_PROJECTOR_RIGHT 4 +#define KEY_PROJECTOR_OK 5 +#define KEY_PROJECTOR_VOL_PLUS 6 +#define KEY_PROJECTOR_VOL_MINUS 7 +#define KEY_PROJECTOR_ZOOM_OUT 8 +#define KEY_PROJECTOR_MENU 9 +#define KEY_PROJECTOR_ZOOM_IN 10 +#define KEY_PROJECTOR_BACK 11 + +#define KEY_STEREO_POWER 0 +#define KEY_STEREO_UP 1 +#define KEY_STEREO_DOWN 2 +#define KEY_STEREO_LEFT 3 +#define KEY_STEREO_RIGHT 4 +#define KEY_STEREO_OK 5 +#define KEY_STEREO_VOL_PLUS 6 +#define KEY_STEREO_VOL_MINUS 7 +#define KEY_STEREO_MUTE 8 +#define KEY_STEREO_MENU 9 + +#define KEY_BULB_POWER 0 +#define KEY_BULB_COLOR_1 1 +#define KEY_BULB_COLOR_2 2 +#define KEY_BULB_COLOR_3 3 +#define KEY_BULB_COLOR_4 4 +#define KEY_BULB_COLOR_0 5 +#define KEY_BULB_BRIGHT_PLUS 6 +#define KEY_BULB_BRIGHT_MINUS 7 +#define KEY_BULB_BRIGHT_POWER_ON 8 +#define KEY_BULB_BRIGHT_RAINBOW 9 +#define KEY_BULB_BRIGHT_POWER_OFF 10 + +#define KEY_CLEANROBOT_POWER 0 +#define KEY_CLEANROBOT_FOWWARD 1 +#define KEY_CLEANROBOT_BACKWARD 2 +#define KEY_CLEANROBOT_LEFT 3 +#define KEY_CLEANROBOT_RIGHT 4 +#define KEY_CLEANROBOT_START 5 +#define KEY_CLEANROBOT_STOP 6 +#define KEY_CLEANROBOT_AUTO 8 +#define KEY_CLEANROBOT_SPOT 9 +#define KEY_CLEANROBOT_SPEED 10 +#define KEY_CLEANROBOT_TIMER 11 +#define KEY_CLEANROBOT_CHARGE 12 +#define KEY_CLEANROBOT_PRESERVE 13 + +#define KEY_AIRCLEANER_POWER 0 +#define KEY_AIRCLEANER_ION 5 +#define KEY_AIRCLEANER_AUTO 8 +#define KEY_AIRCLEANER_WIND_SPEED 9 +#define KEY_AIRCLEANER_MODE_SWITCH 10 +#define KEY_AIRCLEANER_TIMER 11 +#define KEY_AIRCLEANER_LIGHT 12 +#define KEY_AIRCLEANER_FORCE 13 + +#define KEY_DYSON_POWER 0 +#define KEY_DYSON_WIND_SPEED_PLUS 1 +#define KEY_DYSON_WIND_SPEED_MINUS 2 +#define KEY_DYSON_TIMER_MINUS 3 +#define KEY_DYSON_TIMER_PLUS 4 +#define KEY_DYSON_AUTO 5 +#define KEY_DYSON_TEMP_PLUS 6 +#define KEY_DYSON_TEMP_MINUS 7 +#define KEY_DYSON_SWING 8 +#define KEY_DYSON_DIFFUSION 9 +#define KEY_DYSON_FAV 10 +#define KEY_DYSON_TIMER 11 +#define KEY_DYSON_SLEEP 12 +#define KEY_DYSON_COOL 13 + + // exported functions /** * function ir_file_open @@ -153,6 +315,12 @@ extern INT8 get_supported_wind_direction(UINT8 *supported_wind_direction); extern void ir_lib_free_inner_buffer(); #endif +// this function is preferred being called by JNI only +UINT16 ir_decode_combo(const UINT8 category, const UINT8 sub_category, + UINT8* binary, UINT16 binary_length, + UINT8 key_code, UINT16* user_data, + t_remote_ac_status* ac_status, BOOL change_wind_direction); + #ifdef __cplusplus } #endif diff --git a/win32-example/DecodeTestWin/ir_decoder/include/ir_defs.h b/win32-example/DecodeTestWin/ir_decoder/include/ir_defs.h index b16e660..940e6b5 100644 --- a/win32-example/DecodeTestWin/ir_decoder/include/ir_defs.h +++ b/win32-example/DecodeTestWin/ir_decoder/include/ir_defs.h @@ -32,6 +32,11 @@ extern "C" #define FORMAT_HEX 16 #define FORMAT_DECIMAL 10 +// #define USE_DYNAMIC_TAG 1 + +#if defined USE_DYNAMIC_TAG +#include +#endif typedef unsigned char UINT8; typedef signed char INT8; @@ -54,12 +59,13 @@ void noprint(const char *fmt, ...); #define ir_memcpy(A, B, C) memcpy(A, B, C) #define ir_memset(A, B, C) memset(A, B, C) #define ir_strlen(A) strlen(A) -#if (defined BOARD_PC) && (!defined BOARD_PC_JNI) +#if ((defined BOARD_PC) || (defined BOARD_PC_JNI)) && (defined DEBUG) #define ir_printf printf #else #define ir_printf noprint #endif #define USER_DATA_SIZE 1636 +// #define USER_DATA_SIZE 4096 #ifdef __cplusplus } diff --git a/win32-example/DecodeTestWin/ir_decoder/src/ir_ac_apply.c b/win32-example/DecodeTestWin/ir_decoder/src/ir_ac_apply.c index 905ddc8..267df48 100644 --- a/win32-example/DecodeTestWin/ir_decoder/src/ir_ac_apply.c +++ b/win32-example/DecodeTestWin/ir_decoder/src/ir_ac_apply.c @@ -495,6 +495,11 @@ static INT8 apply_checksum_spec_byte_onebyte(UINT8 *ac_code, t_tag_checksum_data static UINT8 has_function(struct ac_protocol *protocol, UINT8 function) { + if (function < AC_FUNCTION_POWER || function > AC_FUNCTION_WIND_FIX) + { + return FALSE; + } + if (0 != protocol->function1.len) { if (0 != protocol->function1.comp_data[function - 1].seg_len) @@ -518,6 +523,11 @@ INT8 apply_function(struct ac_protocol *protocol, UINT8 function) { UINT16 i = 0; + if (function < AC_FUNCTION_POWER || function > AC_FUNCTION_WIND_FIX) + { + return IR_DECODE_FAILED; + } + // function index starts from 1 (AC_FUNCTION_POWER), do -1 operation at first if (0 == protocol->function1.len) { diff --git a/win32-example/DecodeTestWin/ir_decoder/src/ir_ac_parse_forbidden_info.c b/win32-example/DecodeTestWin/ir_decoder/src/ir_ac_parse_forbidden_info.c index 0ea1c47..331a243 100644 --- a/win32-example/DecodeTestWin/ir_decoder/src/ir_ac_parse_forbidden_info.c +++ b/win32-example/DecodeTestWin/ir_decoder/src/ir_ac_parse_forbidden_info.c @@ -22,7 +22,7 @@ extern t_ac_protocol *context; INT8 parse_nmode_data_speed(char *pdata, t_ac_n_mode seq) { - char buf[16] = {0}; + char buf[16] = { 0 }; char *p = pdata; UINT16 pos = 0; UINT16 cnt = 0, index = 0; @@ -47,7 +47,7 @@ INT8 parse_nmode_data_speed(char *pdata, t_ac_n_mode seq) INT8 parse_nmode_data_temp(char *pdata, t_ac_n_mode seq) { - char buf[16] = {0}; + char buf[16] = { 0 }; char *p = pdata; UINT16 pos = 0; UINT16 cnt = 0, index = 0; @@ -71,8 +71,8 @@ INT8 parse_nmode_data_temp(char *pdata, t_ac_n_mode seq) INT8 parse_nmode_pos(char *buf, t_ac_n_mode index) { UINT16 i = 0; - char data[64] = {0}; - // char start[8] = {0}; + char data[64] = { 0 }; + // char start[8] = { 0 }; if (ir_strlen(buf) == 1) { if (buf[0] == 'S' || buf[0] == 's') @@ -111,7 +111,7 @@ INT8 parse_nmode(struct tag_head *tag, t_ac_n_mode index) UINT16 i = 0; UINT16 preindex = 0; - char buf[64] = {0}; + char buf[64] = { 0 }; if (tag->p_data[0] == 'N' && tag->p_data[1] == 'A') { diff --git a/win32-example/DecodeTestWin/ir_decoder/src/ir_ac_parse_frame_info.c b/win32-example/DecodeTestWin/ir_decoder/src/ir_ac_parse_frame_info.c index b96bca1..0a86f46 100644 --- a/win32-example/DecodeTestWin/ir_decoder/src/ir_ac_parse_frame_info.c +++ b/win32-example/DecodeTestWin/ir_decoder/src/ir_ac_parse_frame_info.c @@ -19,7 +19,7 @@ Revision log: INT8 parse_boot_code(struct tag_head *tag) { - UINT8 buf[16] = {0}; + UINT8 buf[16] = { 0 }; UINT8 *p = NULL; UINT16 pos = 0; UINT16 cnt = 0, index = 0; @@ -53,8 +53,8 @@ INT8 parse_boot_code(struct tag_head *tag) INT8 parse_zero(struct tag_head *tag) { - UINT8 low[16] = {0}; - UINT8 high[16] = {0}; + UINT8 low[16] = { 0 }; + UINT8 high[16] = { 0 }; UINT16 index = 0; UINT8 *p = NULL; @@ -84,8 +84,8 @@ INT8 parse_zero(struct tag_head *tag) INT8 parse_one(struct tag_head *tag) { - UINT8 low[16] = {0}; - UINT8 high[16] = {0}; + UINT8 low[16] = { 0 }; + UINT8 high[16] = { 0 }; UINT16 index = 0; UINT8 *p = NULL; @@ -115,7 +115,7 @@ INT8 parse_one(struct tag_head *tag) INT8 parse_delay_code_data(UINT8 *pdata) { - UINT8 buf[16] = {0}; + UINT8 buf[16] = { 0 }; UINT8 *p = NULL; UINT16 pos = 0; UINT16 cnt = 0, index = 0; @@ -146,7 +146,7 @@ INT8 parse_delay_code_data(UINT8 *pdata) INT8 parse_delay_code_pos(UINT8 *buf) { UINT16 i = 0; - UINT8 data[64] = {0}, start[8] = {0}; + UINT8 data[64] = { 0 }, start[8] = { 0 }; if (NULL == buf) { @@ -171,7 +171,7 @@ INT8 parse_delay_code_pos(UINT8 *buf) INT8 parse_delay_code(struct tag_head *tag) { - UINT8 buf[64] = {0}; + UINT8 buf[64] = { 0 }; UINT16 i = 0; UINT16 preindex = 0; preindex = 0; @@ -228,7 +228,7 @@ INT8 parse_frame_len(struct tag_head *tag, UINT16 len) INT8 parse_endian(struct tag_head *tag) { - UINT8 buf[8] = {0}; + UINT8 buf[8] = { 0 }; if (NULL == tag) { @@ -241,7 +241,7 @@ INT8 parse_endian(struct tag_head *tag) INT8 parse_lastbit(struct tag_head *tag) { - UINT8 buf[8] = {0}; + UINT8 buf[8] = { 0 }; if (NULL == tag) { @@ -254,7 +254,7 @@ INT8 parse_lastbit(struct tag_head *tag) INT8 parse_repeat_times(struct tag_head *tag) { - char asc_code[8] = {0}; + char asc_code[8] = { 0 }; if (NULL == tag) { return IR_DECODE_FAILED; @@ -270,7 +270,7 @@ INT8 parse_repeat_times(struct tag_head *tag) INT8 parse_delay_code_tag48_pos(UINT8 *buf) { UINT16 i = 0; - UINT8 data[64] = {0}, start[8] = {0}; + UINT8 data[64] = { 0 }, start[8] = { 0 }; if (NULL == buf) { @@ -297,7 +297,7 @@ INT8 parse_bit_num(struct tag_head *tag) { UINT16 i = 0; UINT16 preindex = 0; - UINT8 buf[64] = {0}; + UINT8 buf[64] = { 0 }; if (NULL == tag) { diff --git a/win32-example/DecodeTestWin/ir_decoder/src/ir_decode.c b/win32-example/DecodeTestWin/ir_decoder/src/ir_decode.c index a60d202..227fbe2 100644 --- a/win32-example/DecodeTestWin/ir_decoder/src/ir_decode.c +++ b/win32-example/DecodeTestWin/ir_decoder/src/ir_decode.c @@ -22,6 +22,8 @@ Revision log: struct ir_bin_buffer binary_file; struct ir_bin_buffer *p_ir_buffer = &binary_file; +const char* release = "0.2.1"; + #if defined USE_DYNAMIC_TAG struct tag_head *tags; #else @@ -31,7 +33,7 @@ struct tag_head tags[TAG_COUNT_FOR_PROTOCOL]; UINT8 *ir_hex_code = NULL; UINT8 ir_hex_len = 0; -UINT8 byteArray[PROTOCOL_SIZE] = {0}; +UINT8 byteArray[PROTOCOL_SIZE] = { 0 }; size_t binary_length = 0; UINT8 *binary_content = NULL; @@ -53,12 +55,19 @@ lp_apply_ac_parameter apply_table[AC_APPLY_MAX] = }; // static functions declarations +#if !defined NO_FS static INT8 ir_ac_file_open(const char *file_name); +#endif + static INT8 ir_ac_binary_open(UINT8 *binary, UINT16 binary_length); static UINT16 ir_ac_control(t_remote_ac_status ac_status, UINT16 *user_data, UINT8 function_code, BOOL change_wind_direction); static INT8 ir_ac_binary_close(); + +#if !defined NO_FS static INT8 ir_tv_file_open(const char *file_name); +#endif + static INT8 ir_tv_binary_open(UINT8 *binary, UINT16 binary_length); static INT8 ir_tv_binary_parse(UINT8 ir_hex_encode); static UINT16 ir_tv_control(UINT8 key, UINT16 *l_user_data); @@ -118,7 +127,7 @@ INT8 ir_file_open(const UINT8 category, const UINT8 sub_category, const char* fi #else INT8 ir_file_open(const UINT8 category, const UINT8 sub_category, const char* file_name) { - return IR_DECODE_SUCCESS; + return IR_DECODE_SUCCEEDED; } #endif @@ -168,7 +177,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(UINT8 key_code, UINT16* user_data, + t_remote_ac_status* ac_status, BOOL change_wind_direction) { if (IR_TYPE_COMMANDS == ir_binary_type) { @@ -180,6 +190,13 @@ UINT16 ir_decode(UINT8 key_code, UINT16* user_data, t_remote_ac_status* ac_statu { return 0; } + ir_printf("ac status is not null in decode core : power = %d, mode = %d, " + "temp = %d, wind_dir = %d, wind_speed = %d, " + "keycode = %d, change_wind_direction = %d\n", + ac_status->ac_power, ac_status->ac_mode, + ac_status->ac_temp, ac_status->ac_wind_dir, + ac_status->ac_wind_speed, + key_code, change_wind_direction); return ir_ac_control(*ac_status, user_data, key_code, change_wind_direction); } } @@ -189,10 +206,12 @@ INT8 ir_close() { if (IR_TYPE_COMMANDS == ir_binary_type) { + ir_printf("tv binary close\n"); return ir_tv_binary_close(); } else { + ir_printf("ac binary close\n"); return ir_ac_binary_close(); } } @@ -206,9 +225,9 @@ void ir_lib_free_inner_buffer(); // static function definitions //////// AC Begin //////// +#if !defined NO_FS static INT8 ir_ac_file_open(const char *file_name) { -#if !defined NO_FS size_t ret = 0; #if !defined WIN32 FILE *stream = fopen(file_name, "rb"); @@ -252,9 +271,9 @@ static INT8 ir_ac_file_open(const char *file_name) binary_length = 0; return IR_DECODE_FAILED; } -#endif return IR_DECODE_SUCCEEDED; } +#endif static INT8 ir_ac_binary_open(UINT8 *binary, UINT16 binary_length) { @@ -266,7 +285,7 @@ static INT8 ir_ac_binary_open(UINT8 *binary, UINT16 binary_length) return IR_DECODE_SUCCEEDED; } -static UINT16 ir_ac_control(t_remote_ac_status ac_status, UINT16 *user_data, UINT8 function_code, +static UINT16 ir_ac_control(t_remote_ac_status ac_status, UINT16 *user_data, UINT8 key_code, BOOL change_wind_direction) { UINT16 time_length = 0; @@ -275,6 +294,36 @@ static UINT16 ir_ac_control(t_remote_ac_status ac_status, UINT16 *user_data, UIN UINT16 i = 0; #endif + UINT8 function_code = 0; + + switch(key_code) + { + case 0: + function_code = AC_FUNCTION_POWER; + break; + case 1: + function_code = AC_FUNCTION_MODE; + break; + case 2: + function_code = AC_FUNCTION_TEMPERATURE_UP; + break; + case 3: + function_code = AC_FUNCTION_TEMPERATURE_DOWN; + break; + case 7: + function_code = AC_FUNCTION_TEMPERATURE_UP; + break; + case 8: + function_code = AC_FUNCTION_TEMPERATURE_DOWN; + break; + case 9: + function_code = AC_FUNCTION_WIND_SPEED; + break; + case 10: + function_code = AC_FUNCTION_WIND_SWING; + break; + } + if (0 == context->default_code.len) { ir_printf("\ndefault code is empty\n"); @@ -543,9 +592,9 @@ INT8 get_supported_wind_direction(UINT8 *supported_wind_direction) //////// AC End //////// //////// TV Begin //////// +#if !defined NO_FS static INT8 ir_tv_file_open(const char *file_name) { -#if !defined NO_FS size_t ret = 0; #if !defined WIN32 @@ -590,9 +639,9 @@ static INT8 ir_tv_file_open(const char *file_name) binary_length = 0; return IR_DECODE_FAILED; } -#endif return IR_DECODE_SUCCEEDED; } +#endif static INT8 ir_tv_binary_open(UINT8 *binary, UINT16 binary_length) { @@ -639,6 +688,25 @@ static INT8 ir_tv_binary_close() } //////// TV End //////// +// combo decode for JNI which means call open, decode and then close in one JNI call +UINT16 ir_decode_combo(const UINT8 category, const UINT8 sub_category, + UINT8* binary, UINT16 binary_length, + UINT8 key_code, UINT16* user_data, + t_remote_ac_status* ac_status, BOOL change_wind_direction) +{ + UINT16 decoded_length = 0; + if (IR_DECODE_SUCCEEDED == + ir_binary_open(category, sub_category, binary, binary_length)) + { + decoded_length = ir_decode(key_code, user_data, ac_status, change_wind_direction); + ir_close(); + return decoded_length; + } + else + { + return 0; + } +} #if (defined BOARD_PC || defined BOARD_PC_DLL) void ir_lib_free_inner_buffer() diff --git a/win32-example/DecodeTestWin/ir_decoder/src/ir_tv_control.c b/win32-example/DecodeTestWin/ir_decoder/src/ir_tv_control.c index f116b35..dd7869a 100644 --- a/win32-example/DecodeTestWin/ir_decoder/src/ir_tv_control.c +++ b/win32-example/DecodeTestWin/ir_decoder/src/ir_tv_control.c @@ -315,7 +315,7 @@ static void print_ir_time(t_ir_data *data, UINT8 key_index, UINT16 *ir_time) } else if (ir_decode_flag == IRDA_DECODE_2_BITS) { - // for quanternary formatted code + // for quaternary formatted code process_decode_number(key_code, data, 2, ir_time); } else if (ir_decode_flag == IRDA_DECODE_4_BITS)