diff --git a/android-example/decodesdk/ir_decoder/include/ir_tv_control.h b/android-example/decodesdk/ir_decoder/include/ir_tv_control.h index 50dfaf4..eafb9b7 100644 --- a/android-example/decodesdk/ir_decoder/include/ir_tv_control.h +++ b/android-example/decodesdk/ir_decoder/include/ir_tv_control.h @@ -199,11 +199,11 @@ typedef struct ir_data_tv } t_ir_data_tv; -extern INT8 tv_lib_open(UINT8 *binary, UINT16 binary_length); +extern INT8 tv_binary_open(UINT8 *binary, UINT16 binary_length); -extern BOOL tv_lib_parse(UINT8 encode_type); +extern BOOL tv_binary_parse(UINT8 encode_type); -extern UINT16 tv_lib_control(UINT8 key, UINT16 *user_data); +extern UINT16 tv_binary_decode(UINT8 key, UINT16 *user_data); extern UINT8 tv_lib_close(); diff --git a/android-example/decodesdk/ir_decoder/jni/ir_decode_jni.c b/android-example/decodesdk/ir_decoder/jni/ir_decode_jni.c index 7500e93..779a526 100644 --- a/android-example/decodesdk/ir_decoder/jni/ir_decode_jni.c +++ b/android-example/decodesdk/ir_decoder/jni/ir_decode_jni.c @@ -57,7 +57,7 @@ JNIEXPORT jintArray JNICALL Java_net_irext_decodesdk_IRDecode_irDecode UINT16 user_data[USER_DATA_SIZE]; int i = 0; jint copy_array[USER_DATA_SIZE] = {0}; - remote_ac_status_t ac_status; + t_remote_ac_status ac_status; jclass n_ac_status = (*env)->GetObjectClass(env, jni_ac_status); @@ -78,14 +78,14 @@ JNIEXPORT jintArray JNICALL Java_net_irext_decodesdk_IRDecode_irDecode jfieldID ac_wind_speed_fid = (*env)->GetFieldID(env, n_ac_status, "acWindSpeed", "I"); jint i_ac_wind_speed = (*env)->GetIntField(env, jni_ac_status, ac_wind_speed_fid); - ac_status.acDisplay = 0; - ac_status.acSleep = 0; - ac_status.acTimer = 0; - ac_status.acPower = i_ac_power; - ac_status.acMode = i_ac_mode; - ac_status.acTemp = i_ac_temp; - ac_status.acWindDir = i_ac_wind_dir; - ac_status.acWindSpeed = i_ac_wind_speed; + ac_status.ac_display = 0; + ac_status.ac_sleep = 0; + ac_status.ac_timer = 0; + ac_status.ac_power = i_ac_power; + ac_status.ac_mode = i_ac_mode; + ac_status.ac_temp = i_ac_temp; + ac_status.ac_wind_dir = i_ac_wind_dir; + ac_status.ac_wind_speed = i_ac_wind_speed; } int wave_code_length = ir_decode(key_code, user_data, &ac_status, change_wind_direction); diff --git a/android-example/decodesdk/ir_decoder/src/ir_ac_build_frame.c b/android-example/decodesdk/ir_decoder/src/ir_ac_build_frame.c index f3f767d..456d86a 100644 --- a/android-example/decodesdk/ir_decoder/src/ir_ac_build_frame.c +++ b/android-example/decodesdk/ir_decoder/src/ir_ac_build_frame.c @@ -141,5 +141,3 @@ UINT16 create_ir_frame() return context->code_cnt; } - - diff --git a/android-example/decodesdk/ir_decoder/src/ir_decode.c b/android-example/decodesdk/ir_decoder/src/ir_decode.c index 367e874..22d211a 100644 --- a/android-example/decodesdk/ir_decoder/src/ir_decode.c +++ b/android-example/decodesdk/ir_decoder/src/ir_decode.c @@ -54,15 +54,15 @@ lp_apply_ac_parameter apply_table[AC_APPLY_MAX] = // static functions declarations static INT8 ir_ac_file_open(const char *file_name); -static INT8 ir_ac_lib_open(UINT8 *binary, UINT16 binary_length); -static UINT16 ir_ac_lib_control(t_remote_ac_status ac_status, UINT16 *user_data, UINT8 function_code, +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_lib_close(); +static INT8 ir_ac_binary_close(); static INT8 ir_tv_file_open(const char *file_name); -static INT8 ir_tv_lib_open(UINT8 *binary, UINT16 binary_length); -static INT8 ir_tv_lib_parse(UINT8 ir_hex_encode); -static UINT16 ir_tv_lib_control(UINT8 key, UINT16 *l_user_data); -static INT8 ir_tv_lib_close(); +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); +static INT8 ir_tv_binary_close(); void noprint(const char *fmt, ...) @@ -71,7 +71,7 @@ void noprint(const char *fmt, ...) } // pubic function definitions - +#if (!defined BOARD_51 && !defined BOARD_CC26XX) INT8 ir_file_open(const UINT8 category, const UINT8 sub_category, const char* file_name) { INT8 ret = IR_DECODE_SUCCEEDED; @@ -107,7 +107,7 @@ INT8 ir_file_open(const UINT8 category, const UINT8 sub_category, const char* fi ret = ir_tv_file_open(file_name); if (IR_DECODE_SUCCEEDED == ret) { - return ir_tv_lib_parse(ir_hexadecimal); + return ir_tv_binary_parse(ir_hexadecimal); } else { @@ -115,7 +115,12 @@ 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; +} +#endif INT8 ir_binary_open(const UINT8 category, const UINT8 sub_category, UINT8* binary, UINT16 binary_length) { @@ -124,7 +129,7 @@ INT8 ir_binary_open(const UINT8 category, const UINT8 sub_category, UINT8* binar if (category == IR_CATEGORY_AC) { ir_binary_type = IR_TYPE_STATUS; - ret = ir_ac_lib_open(binary, binary_length); + ret = ir_ac_binary_open(binary, binary_length); if (IR_DECODE_SUCCEEDED == ret) { return ir_ac_lib_parse(); @@ -150,10 +155,10 @@ INT8 ir_binary_open(const UINT8 category, const UINT8 sub_category, UINT8* binar return IR_DECODE_FAILED; } - ret = ir_tv_lib_open(binary, binary_length); + ret = ir_tv_binary_open(binary, binary_length); if (IR_DECODE_SUCCEEDED == ret) { - return ir_tv_lib_parse(ir_hexadecimal); + return ir_tv_binary_parse(ir_hexadecimal); } else { @@ -167,7 +172,7 @@ UINT16 ir_decode(UINT8 key_code, UINT16* user_data, t_remote_ac_status* ac_statu { if (IR_TYPE_COMMANDS == ir_binary_type) { - return ir_tv_lib_control(key_code, user_data); + return ir_tv_control(key_code, user_data); } else { @@ -175,7 +180,7 @@ UINT16 ir_decode(UINT8 key_code, UINT16* user_data, t_remote_ac_status* ac_statu { return 0; } - return ir_ac_lib_control(*ac_status, user_data, key_code, change_wind_direction); + return ir_ac_control(*ac_status, user_data, key_code, change_wind_direction); } } @@ -184,11 +189,11 @@ INT8 ir_close() { if (IR_TYPE_COMMANDS == ir_binary_type) { - return ir_tv_lib_close(); + return ir_tv_binary_close(); } else { - return ir_ac_lib_close(); + return ir_ac_binary_close(); } } @@ -241,7 +246,7 @@ static INT8 ir_ac_file_open(const char *file_name) fclose(stream); - if (IR_DECODE_FAILED == ir_ac_lib_open(binary_content, (UINT16) binary_length)) + if (IR_DECODE_FAILED == ir_ac_binary_open(binary_content, (UINT16) binary_length)) { ir_free(binary_content); binary_length = 0; @@ -251,7 +256,7 @@ static INT8 ir_ac_file_open(const char *file_name) return IR_DECODE_SUCCEEDED; } -static INT8 ir_ac_lib_open(UINT8 *binary, UINT16 binary_length) +static INT8 ir_ac_binary_open(UINT8 *binary, UINT16 binary_length) { // it is recommended that the parameter binary pointing to // a global memory block in embedded platform environment @@ -261,7 +266,7 @@ static INT8 ir_ac_lib_open(UINT8 *binary, UINT16 binary_length) return IR_DECODE_SUCCEEDED; } -static UINT16 ir_ac_lib_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 function_code, BOOL change_wind_direction) { UINT16 time_length = 0; @@ -377,7 +382,7 @@ static UINT16 ir_ac_lib_control(t_remote_ac_status ac_status, UINT16 *user_data, return time_length; } -static INT8 ir_ac_lib_close() +static INT8 ir_ac_binary_close() { #if defined USE_DYNAMIC_TAG // free context @@ -579,7 +584,7 @@ static INT8 ir_tv_file_open(const char *file_name) fclose(stream); - if (IR_DECODE_FAILED == ir_tv_lib_open(binary_content, (UINT16) binary_length)) + if (IR_DECODE_FAILED == ir_tv_binary_open(binary_content, (UINT16) binary_length)) { ir_free(binary_content); binary_length = 0; @@ -589,14 +594,14 @@ static INT8 ir_tv_file_open(const char *file_name) return IR_DECODE_SUCCEEDED; } -static INT8 ir_tv_lib_open(UINT8 *binary, UINT16 binary_length) +static INT8 ir_tv_binary_open(UINT8 *binary, UINT16 binary_length) { - return tv_lib_open(binary, binary_length); + return tv_binary_open(binary, binary_length); } -static INT8 ir_tv_lib_parse(UINT8 ir_hex_encode) +static INT8 ir_tv_binary_parse(UINT8 ir_hex_encode) { - if (FALSE == tv_lib_parse(ir_hex_encode)) + if (FALSE == tv_binary_parse(ir_hex_encode)) { ir_printf("parse irda binary failed\n"); return IR_DECODE_FAILED; @@ -604,14 +609,14 @@ static INT8 ir_tv_lib_parse(UINT8 ir_hex_encode) return IR_DECODE_SUCCEEDED; } -static UINT16 ir_tv_lib_control(UINT8 key, UINT16 *l_user_data) +static UINT16 ir_tv_control(UINT8 key, UINT16 *l_user_data) { #if defined BOARD_PC UINT16 print_index = 0; #endif UINT16 ir_code_length = 0; memset(l_user_data, 0x00, USER_DATA_SIZE); - ir_code_length = tv_lib_control(key, l_user_data); + ir_code_length = tv_binary_decode(key, l_user_data); #if defined BOARD_PC // have some debug @@ -625,7 +630,7 @@ static UINT16 ir_tv_lib_control(UINT8 key, UINT16 *l_user_data) return ir_code_length; } -static INT8 ir_tv_lib_close() +static INT8 ir_tv_binary_close() { #if (defined BOARD_PC || defined BOARD_PC_DLL) ir_lib_free_inner_buffer(); diff --git a/android-example/decodesdk/ir_decoder/src/ir_tv_control.c b/android-example/decodesdk/ir_decoder/src/ir_tv_control.c index 78cb9b9..f116b35 100644 --- a/android-example/decodesdk/ir_decoder/src/ir_tv_control.c +++ b/android-example/decodesdk/ir_decoder/src/ir_tv_control.c @@ -53,7 +53,7 @@ static void convert_to_ir_time(UINT8 value, UINT16 *ir_time); static void replace_with(t_ir_cycles *pcycles_num, UINT16 *ir_time); -INT8 tv_lib_open(UINT8 *binary, UINT16 binary_length) +INT8 tv_binary_open(UINT8 *binary, UINT16 binary_length) { // load binary to buffer pbuffer->data = binary; @@ -62,7 +62,7 @@ INT8 tv_lib_open(UINT8 *binary, UINT16 binary_length) return IR_DECODE_SUCCEEDED; } -BOOL tv_lib_parse(UINT8 encode_type) +BOOL tv_binary_parse(UINT8 encode_type) { if (FALSE == get_ir_protocol(encode_type)) { @@ -72,7 +72,7 @@ BOOL tv_lib_parse(UINT8 encode_type) return get_ir_keymap(); } -UINT16 tv_lib_control(UINT8 key, UINT16 *user_data) +UINT16 tv_binary_decode(UINT8 key, UINT16 *user_data) { UINT16 i = 0;