diff --git a/src/ir_decoder/.gitignore b/src/ir_decoder/.gitignore index d2ad33f..043a659 100644 --- a/src/ir_decoder/.gitignore +++ b/src/ir_decoder/.gitignore @@ -4,4 +4,9 @@ obj/ .idea/ cmake-build-debug/ cmake-build-release/ -.DS_Store \ No newline at end of file +Debug/ +Release/ +*.sdf +*.opensdf +.DS_Store +.vs \ No newline at end of file diff --git a/src/ir_decoder/dllmain.c b/src/ir_decoder/dllmain.c new file mode 100644 index 0000000..41f3f93 --- /dev/null +++ b/src/ir_decoder/dllmain.c @@ -0,0 +1,18 @@ +#include "stdafx.h" + +BOOL APIENTRY DllMain( HMODULE hModule, + DWORD ul_reason_for_call, + LPVOID lpReserved + ) +{ + switch (ul_reason_for_call) + { + case DLL_PROCESS_ATTACH: + case DLL_THREAD_ATTACH: + case DLL_THREAD_DETACH: + case DLL_PROCESS_DETACH: + break; + } + return TRUE; +} + diff --git a/src/ir_decoder/include/irda_ac_apply.h b/src/ir_decoder/include/irda_ac_apply.h index 284f804..a8ab871 100644 --- a/src/ir_decoder/include/irda_ac_apply.h +++ b/src/ir_decoder/include/irda_ac_apply.h @@ -9,11 +9,6 @@ Revision log: * 2016-10-12: created by strawmanbobi **************************************************************************************************/ -/* - *inclusion - */ -#include "irda_decode.h" - #ifndef _IRDA_APPLY_H_ #define _IRDA_APPLY_H_ @@ -22,19 +17,11 @@ extern "C" { #endif -/* - * public macros - */ +#include "irda_decode.h" + #define MIN_TAG_LENGTH_TYPE_1 4 #define MIN_TAG_LENGTH_TYPE_2 6 -/* - * public type definition - */ - -/* - * public function declaration - */ extern INT8 apply_ac_power(struct ac_protocol *protocol, UINT8 power_status); extern INT8 apply_ac_mode(struct ac_protocol *protocol, UINT8 mode_status); diff --git a/src/ir_decoder/include/irda_ac_build_frame.h b/src/ir_decoder/include/irda_ac_build_frame.h index 3c4fda2..cae208b 100644 --- a/src/ir_decoder/include/irda_ac_build_frame.h +++ b/src/ir_decoder/include/irda_ac_build_frame.h @@ -8,7 +8,6 @@ Description: This file provides generic utils for IR frame build Revision log: * 2016-10-01: created by strawmanbobi **************************************************************************************************/ -#include "irda_defs.h" #ifndef _IRDA_IRFRAME_H_ #define _IRDA_IRFRAME_H_ @@ -18,6 +17,8 @@ extern "C" { #endif +#include "irda_defs.h" + extern UINT16 create_ir_frame(); #ifdef __cplusplus diff --git a/src/ir_decoder/include/irda_ac_parse_forbidden_info.h b/src/ir_decoder/include/irda_ac_parse_forbidden_info.h index 36a4c68..32f3edc 100644 --- a/src/ir_decoder/include/irda_ac_parse_forbidden_info.h +++ b/src/ir_decoder/include/irda_ac_parse_forbidden_info.h @@ -9,11 +9,6 @@ Revision log: * 2016-10-05: created by strawmanbobi **************************************************************************************************/ -/* - *inclusion - */ -#include "irda_decode.h" - #ifndef _IRDA_PARSE_PARSE_H_ #define _IRDA_PARSE_PARSE_H_ @@ -22,21 +17,12 @@ extern "C" { #endif -/* - * public macros - */ +#include "irda_decode.h" -/* - * public type definition - */ - -/* - * public function declaration - */ -extern INT8 parse_nmode(struct tag_head *tag, ac_n_mode index); + extern INT8 parse_nmode(struct tag_head *tag, ac_n_mode index); #ifdef __cplusplus - } +} #endif #endif // _IRDA_PARSE_PARSE_H_ diff --git a/src/ir_decoder/include/irda_ac_parse_frame_parameter.h b/src/ir_decoder/include/irda_ac_parse_frame_parameter.h index 13c672c..832b559 100644 --- a/src/ir_decoder/include/irda_ac_parse_frame_parameter.h +++ b/src/ir_decoder/include/irda_ac_parse_frame_parameter.h @@ -9,11 +9,6 @@ Revision log: * 2016-10-11: created by strawmanbobi **************************************************************************************************/ -/* - *inclusion - */ -#include "irda_decode.h" - #ifndef _IRDA_PARSE_FRAME_PARAMETER_H_ #define _IRDA_PARSE_FRAME_PARAMETER_H_ @@ -22,17 +17,8 @@ extern "C" { #endif -/* - * public macros - */ +#include "irda_decode.h" -/* - * public type definition - */ - -/* - * public function declaration - */ extern INT8 parse_bootcode(struct tag_head *tag); extern INT8 parse_zero(struct tag_head *tag); diff --git a/src/ir_decoder/include/irda_ac_parse_parameter.h b/src/ir_decoder/include/irda_ac_parse_parameter.h index ee9243f..6674ece 100644 --- a/src/ir_decoder/include/irda_ac_parse_parameter.h +++ b/src/ir_decoder/include/irda_ac_parse_parameter.h @@ -9,11 +9,6 @@ Revision log: * 2016-10-12: created by strawmanbobi **************************************************************************************************/ -/* - *inclusion - */ -#include "irda_decode.h" - #ifndef _IRDA_PARSE_AC_PARAMETER_H_ #define _IRDA_PARSE_AC_PARAMETER_H_ @@ -22,17 +17,7 @@ extern "C" { #endif -/* - * public macros - */ - -/* - * public type definition - */ - -/* - * public function declaration - */ +#include "irda_decode.h" extern INT8 parse_common_ac_parameter(t_tag_head *tag, tag_comp *comp_data, UINT8 with_end, UINT8 type); diff --git a/src/ir_decoder/include/irda_decode.h b/src/ir_decoder/include/irda_decode.h index af92423..48d59a5 100644 --- a/src/ir_decoder/include/irda_decode.h +++ b/src/ir_decoder/include/irda_decode.h @@ -8,9 +8,15 @@ Description: This file provides algorithms for IR decode Revision log: * 2016-10-01: created by strawmanbobi **************************************************************************************************/ + #ifndef _IRDA_DECODE_H_ #define _IRDA_DECODE_H_ +#ifdef __cplusplus +extern "C" +{ +#endif + #include #include "irda_defs.h" @@ -573,4 +579,8 @@ INT8 get_supported_wind_direction(UINT8* supported_wind_direction); ///////////////////////////////////////////////// Utils End ///////////////////////////////////////////////// +#ifdef __cplusplus +} +#endif + #endif // _IRDA_DECODE_H_ diff --git a/src/ir_decoder/include/irda_defs.h b/src/ir_decoder/include/irda_defs.h index 5ca463f..d6cb9b4 100644 --- a/src/ir_decoder/include/irda_defs.h +++ b/src/ir_decoder/include/irda_defs.h @@ -9,18 +9,19 @@ Revision log: * 2016-10-01: created by strawmanbobi **************************************************************************************************/ -#if defined BOARD_ANDROID -#include -#define LOG_TAG "irda_decode" -#endif - #ifndef PARSE_IR_DEFS_H #define PARSE_IR_DEFS_H + #ifdef __cplusplus extern "C" { #endif +#if defined BOARD_ANDROID +#include +#define LOG_TAG "irda_decode" +#endif + #define TRUE 1 #define FALSE 0 @@ -28,7 +29,7 @@ typedef unsigned char UINT8; typedef signed char INT8; typedef unsigned short UINT16; typedef signed short INT16; -typedef unsigned char BOOL; +typedef int BOOL; #define irda_malloc(A) malloc(A) #define irda_free(A) free(A) diff --git a/src/ir_decoder/include/irda_main.h b/src/ir_decoder/include/irda_main.h index e3e51eb..b27d1d7 100644 --- a/src/ir_decoder/include/irda_main.h +++ b/src/ir_decoder/include/irda_main.h @@ -11,6 +11,7 @@ Revision log: #ifndef IRDA_DECODER_IRDA_MAIN_H #define IRDA_DECODER_IRDA_MAIN_H + #ifdef __cplusplus extern "C" { @@ -18,22 +19,8 @@ extern "C" extern struct ir_bin_buffer *pirda_buffer; -/* - * function irda_ac_file_open - * - * parameters: file_name (in) specified bin file path - * - * return: IR_DECODE_SUCCEEDED / IR_DECODE_FAILED - */ extern INT8 irda_ac_file_open(const char *file_name); -/* - * function irda_tv_lib_open - * - * parameters: file_name (in, for PC and MT6580) specified bin file path - * - * return: IR_DECODE_SUCCEEDED / IR_DECODE_FAILED - */ extern INT8 irda_tv_file_open(const char *file_name); #ifdef __cplusplus diff --git a/src/ir_decoder/include/irda_tv_parse_protocol.h b/src/ir_decoder/include/irda_tv_parse_protocol.h index 09ca17e..af54b7a 100644 --- a/src/ir_decoder/include/irda_tv_parse_protocol.h +++ b/src/ir_decoder/include/irda_tv_parse_protocol.h @@ -11,20 +11,14 @@ Revision log: #ifndef _IRDA_LIB_H_ #define _IRDA_LIB_H_ + #ifdef __cplusplus extern "C" { #endif -/* - * inclusions - */ + #include "irda_defs.h" - -/* - * macros and constants - */ - #define STB_CHANNEL_OFFSET 14 #define IRDA_FLAG_NORMAL 0 diff --git a/src/ir_decoder/include/irda_utils.h b/src/ir_decoder/include/irda_utils.h index 3b883f5..25d69c2 100644 --- a/src/ir_decoder/include/irda_utils.h +++ b/src/ir_decoder/include/irda_utils.h @@ -8,8 +8,6 @@ Description: This file provides generic utils for IRDA algorithms Revision log: * 2016-10-01: created by strawmanbobi **************************************************************************************************/ -#include "irda_defs.h" -#include "irda_decode.h" #ifndef _IRDA_UTILS_H_ #define _IRDA_UTILS_H_ @@ -19,6 +17,9 @@ extern "C" { #endif +#include "irda_defs.h" +#include "irda_decode.h" + #include extern void string_to_hex(UINT8 *p, ac_hex *pac_hex, UINT16 len); diff --git a/src/ir_decoder/ir_decoder.sln b/src/ir_decoder/ir_decoder.sln new file mode 100644 index 0000000..b8d61a3 --- /dev/null +++ b/src/ir_decoder/ir_decoder.sln @@ -0,0 +1,28 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.23107.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ir_decoder", "ir_decoder.vcxproj", "{8ACC347D-023C-4939-B371-C193EEA210F8}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {8ACC347D-023C-4939-B371-C193EEA210F8}.Debug|x64.ActiveCfg = Debug|x64 + {8ACC347D-023C-4939-B371-C193EEA210F8}.Debug|x64.Build.0 = Debug|x64 + {8ACC347D-023C-4939-B371-C193EEA210F8}.Debug|x86.ActiveCfg = Debug|Win32 + {8ACC347D-023C-4939-B371-C193EEA210F8}.Debug|x86.Build.0 = Debug|Win32 + {8ACC347D-023C-4939-B371-C193EEA210F8}.Release|x64.ActiveCfg = Release|x64 + {8ACC347D-023C-4939-B371-C193EEA210F8}.Release|x64.Build.0 = Release|x64 + {8ACC347D-023C-4939-B371-C193EEA210F8}.Release|x86.ActiveCfg = Release|Win32 + {8ACC347D-023C-4939-B371-C193EEA210F8}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/src/ir_decoder/ir_decoder.vcxproj b/src/ir_decoder/ir_decoder.vcxproj new file mode 100644 index 0000000..e710162 --- /dev/null +++ b/src/ir_decoder/ir_decoder.vcxproj @@ -0,0 +1,195 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + {8ACC347D-023C-4939-B371-C193EEA210F8} + Win32Proj + ir_decoder + 8.1 + + + + DynamicLibrary + true + v140 + Unicode + + + DynamicLibrary + false + v140 + true + Unicode + + + DynamicLibrary + true + v140 + Unicode + + + DynamicLibrary + false + v140 + true + Unicode + + + + + + + + + + + + + + + + + + + + + true + + + true + + + false + + + false + + + + NotUsing + Level3 + Disabled + WIN32;_DEBUG;_WINDOWS;_USRDLL;IR_DECODER_EXPORTS;%(PreprocessorDefinitions) + true + + + Windows + true + + + + + Use + Level3 + Disabled + _DEBUG;_WINDOWS;_USRDLL;IR_DECODER_EXPORTS;%(PreprocessorDefinitions) + true + + + Windows + true + + + + + Level3 + Use + MaxSpeed + true + true + WIN32;NDEBUG;_WINDOWS;_USRDLL;IR_DECODER_EXPORTS;%(PreprocessorDefinitions) + true + + + Windows + true + true + true + + + + + Level3 + Use + MaxSpeed + true + true + NDEBUG;_WINDOWS;_USRDLL;IR_DECODER_EXPORTS;%(PreprocessorDefinitions) + true + + + Windows + true + true + true + + + + + + + + + + + + + + + + + + + + + + false + + + false + + + false + + + false + + + + + + + + + + + + + + Create + Create + Create + Create + + + + + + \ No newline at end of file diff --git a/src/ir_decoder/irda_ac_apply.c b/src/ir_decoder/irda_ac_apply.c index 7ad53fa..d95f903 100644 --- a/src/ir_decoder/irda_ac_apply.c +++ b/src/ir_decoder/irda_ac_apply.c @@ -8,10 +8,15 @@ Description: This file provides methods for AC IR applying functionalities Revision log: * 2016-10-12: created by strawmanbobi **************************************************************************************************/ + /* *inclusion */ +#if defined WIN32 +#include "stdafx.h" +#endif + #include "include/irda_utils.h" #include "include/irda_ac_apply.h" diff --git a/src/ir_decoder/irda_ac_build_frame.c b/src/ir_decoder/irda_ac_build_frame.c index 61fb918..db2ceba 100644 --- a/src/ir_decoder/irda_ac_build_frame.c +++ b/src/ir_decoder/irda_ac_build_frame.c @@ -8,6 +8,11 @@ Description: This file provides algorithms for IR frame build Revision log: * 2016-10-01: created by strawmanbobi **************************************************************************************************/ + +#if defined WIN32 +#include "stdafx.h" +#endif + #include #include "include/irda_ac_build_frame.h" diff --git a/src/ir_decoder/irda_ac_parse_forbidden_info.c b/src/ir_decoder/irda_ac_parse_forbidden_info.c index ded5b12..230ab11 100644 --- a/src/ir_decoder/irda_ac_parse_forbidden_info.c +++ b/src/ir_decoder/irda_ac_parse_forbidden_info.c @@ -12,6 +12,11 @@ Revision log: /* *inclusion */ + +#if defined WIN32 +#include "stdafx.h" +#endif + #include #include #include diff --git a/src/ir_decoder/irda_ac_parse_frame_parameter.c b/src/ir_decoder/irda_ac_parse_frame_parameter.c index 3666ca0..80d7cb0 100644 --- a/src/ir_decoder/irda_ac_parse_frame_parameter.c +++ b/src/ir_decoder/irda_ac_parse_frame_parameter.c @@ -12,6 +12,11 @@ Revision log: /* *inclusion */ + +#if defined WIN32 +#include "stdafx.h" +#endif + #include #include #include diff --git a/src/ir_decoder/irda_ac_parse_parameter.c b/src/ir_decoder/irda_ac_parse_parameter.c index dc07a29..3174491 100644 --- a/src/ir_decoder/irda_ac_parse_parameter.c +++ b/src/ir_decoder/irda_ac_parse_parameter.c @@ -8,9 +8,15 @@ Description: This file provides algorithms for IR decode for AC functionality Revision log: * 2016-10-12: created by strawmanbobi **************************************************************************************************/ + /* *inclusion */ + +#if defined WIN32 +#include "stdafx.h" +#endif + #include #include #include diff --git a/src/ir_decoder/irda_decode.c b/src/ir_decoder/irda_decode.c index 277f025..f7ec188 100644 --- a/src/ir_decoder/irda_decode.c +++ b/src/ir_decoder/irda_decode.c @@ -8,6 +8,11 @@ Description: This file provides algorithms for IR decode (status type) Revision log: * 2016-10-01: created by strawmanbobi **************************************************************************************************/ + +#if defined WIN32 +#include "stdafx.h" +#endif + #include #include @@ -905,7 +910,7 @@ INT8 apply_temperature(remote_ac_status_t ac_status, UINT8 function_code) } UINT16 irda_ac_lib_control(remote_ac_status_t ac_status, UINT16 *user_data, UINT8 function_code, - UINT8 change_wind_direction) + BOOL change_wind_direction) { UINT16 time_length = 0; UINT8 i = 0; diff --git a/src/ir_decoder/irda_main.c b/src/ir_decoder/irda_main.c index 7300f64..4f7a631 100644 --- a/src/ir_decoder/irda_main.c +++ b/src/ir_decoder/irda_main.c @@ -9,9 +9,17 @@ Revision log: * 2016-11-05: created by strawmanbobi **************************************************************************************************/ +#if defined WIN32 +#include "stdafx.h" +#endif + #include #include + +#if !defined WIN32 #include +#endif + #include #include "include/irda_defs.h" @@ -27,7 +35,12 @@ INT8 irda_tv_file_open(const char* file_name); INT8 irda_ac_file_open(const char* file_name) { +#if !defined WIN32 FILE *stream = fopen(file_name, "rb"); +#else + FILE *stream; + fopen_s(&stream, file_name, "rb"); +#endif if (NULL == stream) { IR_PRINTF("\nfile open failed : %d\n", errno); @@ -209,7 +222,13 @@ INT8 decode_as_ac(const char* file_name) INT8 irda_tv_file_open(const char* file_name) { int print_index = 0; + +#if !defined WIN32 FILE *stream = fopen(file_name, "rb"); +#else + FILE *stream; + fopen_s(&stream, file_name, "rb"); +#endif IR_PRINTF("file name = %s\n", file_name); diff --git a/src/ir_decoder/irda_tv_parse_protocol.c b/src/ir_decoder/irda_tv_parse_protocol.c index 3d3c4c6..f51bc72 100644 --- a/src/ir_decoder/irda_tv_parse_protocol.c +++ b/src/ir_decoder/irda_tv_parse_protocol.c @@ -13,6 +13,10 @@ Revision log: * INCLUDES **************************************************************************************************/ +#if defined WIN32 +#include "stdafx.h" +#endif + #include #include "include/irda_defs.h" diff --git a/src/ir_decoder/irda_utils.c b/src/ir_decoder/irda_utils.c index 094f5aa..0e8eaf1 100644 --- a/src/ir_decoder/irda_utils.c +++ b/src/ir_decoder/irda_utils.c @@ -9,6 +9,10 @@ Revision log: * 2016-10-01: created by strawmanbobi **************************************************************************************************/ +#ifdef WIN32 +#include "stdafx.h" +#endif + #include "include/irda_utils.h" UINT8 char_to_hex(char chr) diff --git a/src/ir_decoder/stdafx.c b/src/ir_decoder/stdafx.c new file mode 100644 index 0000000..1577c4e --- /dev/null +++ b/src/ir_decoder/stdafx.c @@ -0,0 +1 @@ +#include "stdafx.h" \ No newline at end of file diff --git a/src/ir_decoder/stdafx.h b/src/ir_decoder/stdafx.h new file mode 100644 index 0000000..d122c0b --- /dev/null +++ b/src/ir_decoder/stdafx.h @@ -0,0 +1,7 @@ +#pragma once + +#include "targetver.h" + +#define WIN32_LEAN_AND_MEAN + +#include diff --git a/src/ir_decoder/targetver.h b/src/ir_decoder/targetver.h new file mode 100644 index 0000000..05ba7d4 --- /dev/null +++ b/src/ir_decoder/targetver.h @@ -0,0 +1,3 @@ +#pragma once + +#include