corrected jni source according to latest decode core

This commit is contained in:
strawmanbobi
2019-04-01 22:25:53 +08:00
parent c0ce80540f
commit af6620f3b1
25 changed files with 10399 additions and 188 deletions

View File

@@ -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')
{

View File

@@ -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)
{

View File

@@ -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.0";
#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;
@@ -118,7 +120,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 +170,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 +183,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 +199,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();
}
}
@@ -639,6 +651,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()

View File

@@ -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);

View File

@@ -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)