From 2eb2091ff509d30bcbdf53c5c6af78fc83e18642 Mon Sep 17 00:00:00 2001 From: strawmanbobi Date: Sat, 17 Dec 2016 21:38:33 +0800 Subject: [PATCH] fixed windows dll importing issue for decoder --- src/ir_decoder/CMakeLists.txt | 4 ++-- src/ir_decoder/include/irda_decode.h | 5 +++-- src/ir_decoder/ir_decode.def | 4 +--- src/ir_decoder/ir_decoder.vcxproj | 2 -- src/ir_decoder/irda_decode.c | 15 +++++---------- src/ir_decoder/irda_main.c | 2 ++ src/ir_decoder/irda_tv_parse_protocol.c | 4 ++-- 7 files changed, 15 insertions(+), 21 deletions(-) diff --git a/src/ir_decoder/CMakeLists.txt b/src/ir_decoder/CMakeLists.txt index 4887d9c..946d687 100644 --- a/src/ir_decoder/CMakeLists.txt +++ b/src/ir_decoder/CMakeLists.txt @@ -44,5 +44,5 @@ set(SOURCE_FILES_SHARED_LIB irda_utils.c include/irda_utils.h) -# add_executable(irda_decoder ${SOURCE_FILES_EXECUTABLE}) -add_library(irda_decoder SHARED ${SOURCE_FILES_SHARED_LIB}) +add_executable(irda_decoder ${SOURCE_FILES_EXECUTABLE}) +# add_library(irda_decoder SHARED ${SOURCE_FILES_SHARED_LIB}) diff --git a/src/ir_decoder/include/irda_decode.h b/src/ir_decoder/include/irda_decode.h index 48d59a5..6b96a05 100644 --- a/src/ir_decoder/include/irda_decode.h +++ b/src/ir_decoder/include/irda_decode.h @@ -434,6 +434,7 @@ extern protocol* context; extern remote_ac_status_t ac_status; extern UINT16 user_data[]; + /* exported functions */ ///////////////////////////////////////////////// AC Begin ///////////////////////////////////////////////// /* @@ -515,7 +516,7 @@ extern INT8 irda_tv_lib_parse(UINT8 irda_hex_encode); * * return: length of wave code array */ -extern UINT16 irda_tv_lib_control(UINT8 key_code, UINT16 * l_user_data); +extern UINT16 irda_tv_lib_control(UINT8 key_code, UINT16* user_data); /* * function irda_tv_lib_close @@ -575,7 +576,7 @@ extern INT8 get_supported_swing(UINT8 ac_mode, UINT8* supported_swing); * * return: IR_DECODE_SUCCEEDED / IR_DECODE_FAILED */ -INT8 get_supported_wind_direction(UINT8* supported_wind_direction); +extern INT8 get_supported_wind_direction(UINT8* supported_wind_direction); ///////////////////////////////////////////////// Utils End ///////////////////////////////////////////////// diff --git a/src/ir_decoder/ir_decode.def b/src/ir_decoder/ir_decode.def index 1ccec99..4c67494 100644 --- a/src/ir_decoder/ir_decode.def +++ b/src/ir_decoder/ir_decode.def @@ -15,6 +15,4 @@ get_temperature_range @10 get_supported_mode @11 get_supported_wind_speed @12 get_supported_swing @13 -get_supported_wind_direction @14 -irda_ac_file_open @15 -irda_tv_file_open @16 \ No newline at end of file +get_supported_wind_direction @14 \ No newline at end of file diff --git a/src/ir_decoder/ir_decoder.vcxproj b/src/ir_decoder/ir_decoder.vcxproj index 95dc334..5c798aa 100644 --- a/src/ir_decoder/ir_decoder.vcxproj +++ b/src/ir_decoder/ir_decoder.vcxproj @@ -153,7 +153,6 @@ - @@ -180,7 +179,6 @@ - diff --git a/src/ir_decoder/irda_decode.c b/src/ir_decoder/irda_decode.c index 779507c..c7b49f0 100644 --- a/src/ir_decoder/irda_decode.c +++ b/src/ir_decoder/irda_decode.c @@ -42,10 +42,9 @@ UINT16 tv_bin_length = 0; UINT8 tag_count = 0; UINT16 tag_head_offset = 0; -UINT8 byteArray[PROTOCOL_SIZE] = {0}; -UINT16 user_data[USER_DATA_SIZE] = {0}; -UINT8 tv_bin[EXPECTED_MEM_SIZE] = {0}; -remote_ac_status_t ac_status; +UINT8 byteArray[PROTOCOL_SIZE] = { 0 }; +UINT8 tv_bin[EXPECTED_MEM_SIZE] = { 0 }; + // 2016-10-09 updated by strawmanbobi, change global data context to array pointer protocol *context = (protocol *) byteArray; @@ -1029,10 +1028,6 @@ void irda_ac_lib_close() } free_ac_context(); - if (NULL != binary_content) - { - free(binary_content); - } return; } @@ -1203,7 +1198,7 @@ UINT16 irda_tv_lib_control(UINT8 key, UINT16* l_user_data) { UINT16 print_index = 0; UINT16 irda_code_length = 0; - memset(user_data, 0x00, USER_DATA_SIZE); + memset(l_user_data, 0x00, USER_DATA_SIZE); irda_code_length = tv_lib_control(key, l_user_data); // have some debug @@ -1211,7 +1206,7 @@ UINT16 irda_tv_lib_control(UINT8 key, UINT16* l_user_data) IR_PRINTF("length of IRDA code = %d\n", irda_code_length); for(print_index = 0; print_index < irda_code_length; print_index++) { - IR_PRINTF("%d ", user_data[print_index]); + IR_PRINTF("%d ", l_user_data[print_index]); } IR_PRINTF("\n=============================\n\n"); diff --git a/src/ir_decoder/irda_main.c b/src/ir_decoder/irda_main.c index 4f7a631..6b4e7fc 100644 --- a/src/ir_decoder/irda_main.c +++ b/src/ir_decoder/irda_main.c @@ -29,6 +29,8 @@ Revision log: // global variable definition long binary_length = 0; UINT8 *binary_content = NULL; +remote_ac_status_t ac_status; +UINT16 user_data[USER_DATA_SIZE]; INT8 irda_ac_file_open(const char* file_name); INT8 irda_tv_file_open(const char* file_name); diff --git a/src/ir_decoder/irda_tv_parse_protocol.c b/src/ir_decoder/irda_tv_parse_protocol.c index f51bc72..e889bab 100644 --- a/src/ir_decoder/irda_tv_parse_protocol.c +++ b/src/ir_decoder/irda_tv_parse_protocol.c @@ -42,14 +42,14 @@ Revision log: /************************************************************************************************** * LOCAL DATA TYPES **************************************************************************************************/ -#pragma pack(1) + struct buffer { UINT8 *data; UINT16 len; UINT16 offset; } irda_file; -#pragma pack() +