optimized debug info for decode algorithm
This commit is contained in:
@@ -3,8 +3,8 @@ cmake_minimum_required(VERSION 3.2)
|
||||
########################################################
|
||||
project(irda_decoder)
|
||||
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
|
||||
add_definitions(-DBOARD_PC -DDEBUG)
|
||||
# add_definitions(-DBOARD_PC -DBOARD_PC_JNI)
|
||||
# add_definitions(-DBOARD_PC -DDEBUG)
|
||||
add_definitions(-DBOARD_PC -DBOARD_PC_JNI -DDEBUG)
|
||||
|
||||
IF (CMAKE_SYSTEM_NAME MATCHES "Linux")
|
||||
MESSAGE("compile platform : Linux")
|
||||
@@ -90,5 +90,5 @@ set(SOURCE_FILES_JNI_SHARED_LIB
|
||||
include/ir_decode.h)
|
||||
|
||||
# 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_executable(irda_decoder ${SOURCE_FILES_EXECUTABLE})
|
||||
add_library(irda_decoder SHARED ${SOURCE_FILES_JNI_SHARED_LIB})
|
||||
|
||||
@@ -54,7 +54,7 @@ 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
|
||||
|
||||
@@ -54,9 +54,9 @@ JNIEXPORT jint JNICALL Java_net_irext_decode_sdk_IRDecode_irOpenBinary
|
||||
JNIEXPORT jintArray JNICALL Java_net_irext_decode_sdk_IRDecode_irDecode
|
||||
(JNIEnv *env, jobject this_obj, jint key_code, jobject jni_ac_status, jint change_wind_direction)
|
||||
{
|
||||
UINT16 user_data[USER_DATA_SIZE];
|
||||
UINT16 user_data[USER_DATA_SIZE] = { 0 };
|
||||
int i = 0;
|
||||
jint copy_array[USER_DATA_SIZE] = {0};
|
||||
jint copy_array[USER_DATA_SIZE] = { 0 };
|
||||
t_remote_ac_status ac_status;
|
||||
|
||||
jclass n_ac_status = (*env)->GetObjectClass(env, jni_ac_status);
|
||||
|
||||
@@ -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')
|
||||
{
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -33,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;
|
||||
@@ -182,6 +182,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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -158,12 +158,13 @@ INT8 decode_as_ac(char *file_name)
|
||||
|
||||
if (TRUE == op_match && TRUE == need_control)
|
||||
{
|
||||
ir_printf("switch AC to power = %d, mode = %d, temp = %d, speed = %d, swing = %d\n",
|
||||
ir_printf("switch AC to power = %d, mode = %d, temp = %d, speed = %d, swing = %d with function code = %d\n",
|
||||
ac_status.ac_power,
|
||||
ac_status.ac_mode,
|
||||
ac_status.ac_temp,
|
||||
ac_status.ac_wind_speed,
|
||||
ac_status.ac_wind_dir
|
||||
ac_status.ac_wind_dir,
|
||||
function_code
|
||||
);
|
||||
|
||||
ir_decode(function_code, user_data, &ac_status, TRUE);
|
||||
|
||||
Reference in New Issue
Block a user