updated decore core in examples to 0.2.2

This commit is contained in:
strawmanbobi
2019-07-03 19:21:45 +08:00
parent 849053a2f4
commit 9e94d02031
10 changed files with 67 additions and 49 deletions

View File

@@ -4,7 +4,7 @@ include $(CLEAR_VARS)
LOCAL_CFLAGS := -DBOARD_ANDROID LOCAL_CFLAGS := -DBOARD_ANDROID
LOCAL_MODULE := libirdecode LOCAL_MODULE := libirdecode
LOCAL_SRC_FILES := ./jni/ir_decode_jni.c \ LOCAL_SRC_FILES := ./jni/src/ir_decode_jni.c \
./src/ir_decode.c \ ./src/ir_decode.c \
./src/ir_tv_control.c \ ./src/ir_tv_control.c \
./src/ir_ac_apply.c \ ./src/ir_ac_apply.c \

View File

@@ -51,11 +51,12 @@ extern "C"
#define KEY_TV_SETTINGS 13 #define KEY_TV_SETTINGS 13
#define KEY_AC_POWER 0 #define KEY_AC_POWER 0
#define KEY_AC_TEMP_PLUS 1 #define KEY_AC_MODE_SWITCH 1
#define KEY_AC_TEMP_MINUS 2 #define KEY_AC_TEMP_PLUS 2
#define KEY_AC_MODE_SWITCH 8 #define KEY_AC_TEMP_MINUS 3
#define KEY_AC_WIND_SPEED 9 #define KEY_AC_WIND_SPEED 9
#define KEY_AC_WIND_DIRECTION 10 #define KEY_AC_WIND_SWING 10
#define KEY_AC_WIND_FIX 11
#define KEY_STB_POWER 0 #define KEY_STB_POWER 0
#define KEY_STB_MUTE 1 #define KEY_STB_MUTE 1

View File

@@ -1136,7 +1136,14 @@ INT8 parse_swing_info(struct tag_head *tag, t_swing_info *si)
*/ */
// count how many swing types are there // count how many swing types are there
si->type = SWING_TYPE_NORMAL; si->type = SWING_TYPE_NORMAL;
si->mode_count = (UINT8) ((tag->len + 1) >> 1); si->mode_count = 1;
for (i = 0; i < tag->len; i++)
{
if (tag->p_data[i] == ',')
{
si->mode_count++;
}
}
return IR_DECODE_SUCCEEDED; return IR_DECODE_SUCCEEDED;
} }

View File

@@ -22,7 +22,7 @@ Revision log:
struct ir_bin_buffer binary_file; struct ir_bin_buffer binary_file;
struct ir_bin_buffer *p_ir_buffer = &binary_file; struct ir_bin_buffer *p_ir_buffer = &binary_file;
const char* release = "0.2.1"; const char* release = "0.2.2";
#if defined USE_DYNAMIC_TAG #if defined USE_DYNAMIC_TAG
struct tag_head *tags; struct tag_head *tags;
@@ -55,12 +55,19 @@ lp_apply_ac_parameter apply_table[AC_APPLY_MAX] =
}; };
// static functions declarations // static functions declarations
#if !defined NO_FS
static INT8 ir_ac_file_open(const char *file_name); static INT8 ir_ac_file_open(const char *file_name);
#endif
static INT8 ir_ac_binary_open(UINT8 *binary, UINT16 binary_length); 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, static UINT16 ir_ac_control(t_remote_ac_status ac_status, UINT16 *user_data, UINT8 function_code,
BOOL change_wind_direction); BOOL change_wind_direction);
static INT8 ir_ac_binary_close(); static INT8 ir_ac_binary_close();
#if !defined NO_FS
static INT8 ir_tv_file_open(const char *file_name); 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_open(UINT8 *binary, UINT16 binary_length);
static INT8 ir_tv_binary_parse(UINT8 ir_hex_encode); static INT8 ir_tv_binary_parse(UINT8 ir_hex_encode);
static UINT16 ir_tv_control(UINT8 key, UINT16 *l_user_data); static UINT16 ir_tv_control(UINT8 key, UINT16 *l_user_data);
@@ -218,9 +225,9 @@ void ir_lib_free_inner_buffer();
// static function definitions // static function definitions
//////// AC Begin //////// //////// AC Begin ////////
#if !defined NO_FS
static INT8 ir_ac_file_open(const char *file_name) static INT8 ir_ac_file_open(const char *file_name)
{ {
#if !defined NO_FS
size_t ret = 0; size_t ret = 0;
#if !defined WIN32 #if !defined WIN32
FILE *stream = fopen(file_name, "rb"); FILE *stream = fopen(file_name, "rb");
@@ -264,9 +271,9 @@ static INT8 ir_ac_file_open(const char *file_name)
binary_length = 0; binary_length = 0;
return IR_DECODE_FAILED; return IR_DECODE_FAILED;
} }
#endif
return IR_DECODE_SUCCEEDED; return IR_DECODE_SUCCEEDED;
} }
#endif
static INT8 ir_ac_binary_open(UINT8 *binary, UINT16 binary_length) static INT8 ir_ac_binary_open(UINT8 *binary, UINT16 binary_length)
{ {
@@ -298,14 +305,10 @@ static UINT16 ir_ac_control(t_remote_ac_status ac_status, UINT16 *user_data, UIN
function_code = AC_FUNCTION_MODE; function_code = AC_FUNCTION_MODE;
break; break;
case 2: case 2:
function_code = AC_FUNCTION_TEMPERATURE_UP;
break;
case 3:
function_code = AC_FUNCTION_TEMPERATURE_DOWN;
break;
case 7: case 7:
function_code = AC_FUNCTION_TEMPERATURE_UP; function_code = AC_FUNCTION_TEMPERATURE_UP;
break; break;
case 3:
case 8: case 8:
function_code = AC_FUNCTION_TEMPERATURE_DOWN; function_code = AC_FUNCTION_TEMPERATURE_DOWN;
break; break;
@@ -315,6 +318,9 @@ static UINT16 ir_ac_control(t_remote_ac_status ac_status, UINT16 *user_data, UIN
case 10: case 10:
function_code = AC_FUNCTION_WIND_SWING; function_code = AC_FUNCTION_WIND_SWING;
break; break;
case 11:
function_code = AC_FUNCTION_WIND_FIX;
break;
} }
if (0 == context->default_code.len) if (0 == context->default_code.len)
@@ -585,9 +591,9 @@ INT8 get_supported_wind_direction(UINT8 *supported_wind_direction)
//////// AC End //////// //////// AC End ////////
//////// TV Begin //////// //////// TV Begin ////////
#if !defined NO_FS
static INT8 ir_tv_file_open(const char *file_name) static INT8 ir_tv_file_open(const char *file_name)
{ {
#if !defined NO_FS
size_t ret = 0; size_t ret = 0;
#if !defined WIN32 #if !defined WIN32
@@ -632,9 +638,9 @@ static INT8 ir_tv_file_open(const char *file_name)
binary_length = 0; binary_length = 0;
return IR_DECODE_FAILED; return IR_DECODE_FAILED;
} }
#endif
return IR_DECODE_SUCCEEDED; return IR_DECODE_SUCCEEDED;
} }
#endif
static INT8 ir_tv_binary_open(UINT8 *binary, UINT16 binary_length) static INT8 ir_tv_binary_open(UINT8 *binary, UINT16 binary_length)
{ {

View File

@@ -51,11 +51,12 @@ extern "C"
#define KEY_TV_SETTINGS 13 #define KEY_TV_SETTINGS 13
#define KEY_AC_POWER 0 #define KEY_AC_POWER 0
#define KEY_AC_TEMP_PLUS 1 #define KEY_AC_MODE_SWITCH 1
#define KEY_AC_TEMP_MINUS 2 #define KEY_AC_TEMP_PLUS 2
#define KEY_AC_MODE_SWITCH 8 #define KEY_AC_TEMP_MINUS 3
#define KEY_AC_WIND_SPEED 9 #define KEY_AC_WIND_SPEED 9
#define KEY_AC_WIND_DIRECTION 10 #define KEY_AC_WIND_SWING 10
#define KEY_AC_WIND_FIX 11
#define KEY_STB_POWER 0 #define KEY_STB_POWER 0
#define KEY_STB_MUTE 1 #define KEY_STB_MUTE 1

View File

@@ -1136,7 +1136,14 @@ INT8 parse_swing_info(struct tag_head *tag, t_swing_info *si)
*/ */
// count how many swing types are there // count how many swing types are there
si->type = SWING_TYPE_NORMAL; si->type = SWING_TYPE_NORMAL;
si->mode_count = (UINT8) ((tag->len + 1) >> 1); si->mode_count = 1;
for (i = 0; i < tag->len; i++)
{
if (tag->p_data[i] == ',')
{
si->mode_count++;
}
}
return IR_DECODE_SUCCEEDED; return IR_DECODE_SUCCEEDED;
} }

View File

@@ -22,7 +22,7 @@ Revision log:
struct ir_bin_buffer binary_file; struct ir_bin_buffer binary_file;
struct ir_bin_buffer *p_ir_buffer = &binary_file; struct ir_bin_buffer *p_ir_buffer = &binary_file;
const char* release = "0.2.1"; const char* release = "0.2.2";
#if defined USE_DYNAMIC_TAG #if defined USE_DYNAMIC_TAG
struct tag_head *tags; struct tag_head *tags;
@@ -305,14 +305,10 @@ static UINT16 ir_ac_control(t_remote_ac_status ac_status, UINT16 *user_data, UIN
function_code = AC_FUNCTION_MODE; function_code = AC_FUNCTION_MODE;
break; break;
case 2: case 2:
function_code = AC_FUNCTION_TEMPERATURE_UP;
break;
case 3:
function_code = AC_FUNCTION_TEMPERATURE_DOWN;
break;
case 7: case 7:
function_code = AC_FUNCTION_TEMPERATURE_UP; function_code = AC_FUNCTION_TEMPERATURE_UP;
break; break;
case 3:
case 8: case 8:
function_code = AC_FUNCTION_TEMPERATURE_DOWN; function_code = AC_FUNCTION_TEMPERATURE_DOWN;
break; break;
@@ -322,6 +318,9 @@ static UINT16 ir_ac_control(t_remote_ac_status ac_status, UINT16 *user_data, UIN
case 10: case 10:
function_code = AC_FUNCTION_WIND_SWING; function_code = AC_FUNCTION_WIND_SWING;
break; break;
case 11:
function_code = AC_FUNCTION_WIND_FIX;
break;
} }
if (0 == context->default_code.len) if (0 == context->default_code.len)

View File

@@ -51,11 +51,12 @@ extern "C"
#define KEY_TV_SETTINGS 13 #define KEY_TV_SETTINGS 13
#define KEY_AC_POWER 0 #define KEY_AC_POWER 0
#define KEY_AC_TEMP_PLUS 1 #define KEY_AC_MODE_SWITCH 1
#define KEY_AC_TEMP_MINUS 2 #define KEY_AC_TEMP_PLUS 2
#define KEY_AC_MODE_SWITCH 8 #define KEY_AC_TEMP_MINUS 3
#define KEY_AC_WIND_SPEED 9 #define KEY_AC_WIND_SPEED 9
#define KEY_AC_WIND_DIRECTION 10 #define KEY_AC_WIND_SWING 10
#define KEY_AC_WIND_FIX 11
#define KEY_STB_POWER 0 #define KEY_STB_POWER 0
#define KEY_STB_MUTE 1 #define KEY_STB_MUTE 1

View File

@@ -1099,8 +1099,6 @@ INT8 parse_function_2_tag34(struct tag_head *tag, t_function_2 *function2)
INT8 parse_swing_info(struct tag_head *tag, t_swing_info *si) INT8 parse_swing_info(struct tag_head *tag, t_swing_info *si)
{ {
int i;
if (NULL == tag) if (NULL == tag)
{ {
return IR_DECODE_FAILED; return IR_DECODE_FAILED;
@@ -1137,16 +1135,15 @@ INT8 parse_swing_info(struct tag_head *tag, t_swing_info *si)
* length greater than 1 indicates both auto-swing and some swing angles are supported * length greater than 1 indicates both auto-swing and some swing angles are supported
*/ */
// count how many swing types are there // count how many swing types are there
si->type = SWING_TYPE_NORMAL; si->type = SWING_TYPE_NORMAL;
//si->mode_count = (UINT8) ((tag->len + 1) >> 1); si->mode_count = 1;
si->mode_count = 1; for (i = 0; i < tag->len; i++)
for (i = 0; i < tag->len; i++) {
{ if (tag->p_data[i] == ',')
if (tag->p_data[i] == ',') {
{ si->mode_count++;
si->mode_count++; }
} }
}
return IR_DECODE_SUCCEEDED; return IR_DECODE_SUCCEEDED;
} }

View File

@@ -22,7 +22,7 @@ Revision log:
struct ir_bin_buffer binary_file; struct ir_bin_buffer binary_file;
struct ir_bin_buffer *p_ir_buffer = &binary_file; struct ir_bin_buffer *p_ir_buffer = &binary_file;
const char* release = "0.2.1"; const char* release = "0.2.2";
#if defined USE_DYNAMIC_TAG #if defined USE_DYNAMIC_TAG
struct tag_head *tags; struct tag_head *tags;
@@ -305,14 +305,10 @@ static UINT16 ir_ac_control(t_remote_ac_status ac_status, UINT16 *user_data, UIN
function_code = AC_FUNCTION_MODE; function_code = AC_FUNCTION_MODE;
break; break;
case 2: case 2:
function_code = AC_FUNCTION_TEMPERATURE_UP;
break;
case 3:
function_code = AC_FUNCTION_TEMPERATURE_DOWN;
break;
case 7: case 7:
function_code = AC_FUNCTION_TEMPERATURE_UP; function_code = AC_FUNCTION_TEMPERATURE_UP;
break; break;
case 3:
case 8: case 8:
function_code = AC_FUNCTION_TEMPERATURE_DOWN; function_code = AC_FUNCTION_TEMPERATURE_DOWN;
break; break;
@@ -322,6 +318,9 @@ static UINT16 ir_ac_control(t_remote_ac_status ac_status, UINT16 *user_data, UIN
case 10: case 10:
function_code = AC_FUNCTION_WIND_SWING; function_code = AC_FUNCTION_WIND_SWING;
break; break;
case 11:
function_code = AC_FUNCTION_WIND_FIX;
break;
} }
if (0 == context->default_code.len) if (0 == context->default_code.len)