updated decoder dll component

This commit is contained in:
2017-01-02 19:18:09 +08:00
parent 13cc9c0812
commit 22a8773a25
11 changed files with 78 additions and 177 deletions

View File

@@ -2,20 +2,19 @@ LIBRARY
EXPORTS
irda_context_init @1
irda_ac_file_open @2
irda_ac_lib_open @3
irda_ac_lib_parse @4
irda_ac_lib_control @5
irda_ac_lib_close @6
ir_ac_file_open @1
ir_ac_lib_open @2
ir_ac_lib_parse @3
ir_ac_lib_control @4
ir_ac_lib_close @5
irda_tv_file_open @7
irda_tv_lib_open @8
irda_tv_lib_parse @9
irda_tv_lib_control @10
irda_tv_lib_close @11
get_temperature_range @12
get_supported_mode @13
get_supported_wind_speed @14
get_supported_swing @15
get_supported_wind_direction @16
ir_tv_file_open @6
ir_tv_lib_open @7
ir_tv_lib_parse @8
ir_tv_lib_control @9
ir_tv_lib_close @19
get_temperature_range @11
get_supported_mode @12
get_supported_wind_speed @13
get_supported_swing @14
get_supported_wind_direction @15

View File

@@ -147,15 +147,17 @@
<Text Include="ReadMe.txt" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="include\irda_ac_apply.h" />
<ClInclude Include="include\irda_ac_build_frame.h" />
<ClInclude Include="include\irda_ac_parse_forbidden_info.h" />
<ClInclude Include="include\irda_ac_parse_frame_info.h" />
<ClInclude Include="include\irda_ac_parse_parameter.h" />
<ClInclude Include="include\irda_decode.h" />
<ClInclude Include="include\irda_defs.h" />
<ClInclude Include="include\irda_tv_parse_protocol.h" />
<ClInclude Include="include\irda_utils.h" />
<ClInclude Include="include\ir_ac_apply.h" />
<ClInclude Include="include\ir_ac_binary_parse.h" />
<ClInclude Include="include\ir_ac_build_frame.h" />
<ClInclude Include="include\ir_ac_control.h" />
<ClInclude Include="include\ir_ac_parse_forbidden_info.h" />
<ClInclude Include="include\ir_ac_parse_frame_info.h" />
<ClInclude Include="include\ir_ac_parse_parameter.h" />
<ClInclude Include="include\ir_decode.h" />
<ClInclude Include="include\ir_defs.h" />
<ClInclude Include="include\ir_tv_control.h" />
<ClInclude Include="include\ir_utils.h" />
<ClInclude Include="stdafx.h" />
<ClInclude Include="targetver.h" />
</ItemGroup>
@@ -174,14 +176,17 @@
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
</PrecompiledHeader>
</ClCompile>
<ClCompile Include="irda_ac_apply.c" />
<ClCompile Include="irda_ac_build_frame.c" />
<ClCompile Include="irda_ac_parse_forbidden_info.c" />
<ClCompile Include="irda_ac_parse_frame_info.c" />
<ClCompile Include="irda_ac_parse_parameter.c" />
<ClCompile Include="irda_decode.c" />
<ClCompile Include="irda_tv_parse_protocol.c" />
<ClCompile Include="irda_utils.c" />
<ClCompile Include="src\ir_ac_apply.c" />
<ClCompile Include="src\ir_ac_binary_parse.c" />
<ClCompile Include="src\ir_ac_build_frame.c" />
<ClCompile Include="src\ir_ac_control.c" />
<ClCompile Include="src\ir_ac_parse_forbidden_info.c" />
<ClCompile Include="src\ir_ac_parse_frame_info.c" />
<ClCompile Include="src\ir_ac_parse_parameter.c" />
<ClCompile Include="src\ir_decode.c" />
<ClCompile Include="src\ir_test_main.c" />
<ClCompile Include="src\ir_tv_control.c" />
<ClCompile Include="src\ir_utils.c" />
<ClCompile Include="stdafx.c">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>

View File

@@ -9,28 +9,10 @@ Revision log:
* 2016-10-12: created by strawmanbobi
**************************************************************************************************/
/*
*inclusion
*/
#if defined WIN32
#include "stdafx.h"
#endif
#include "../include/ir_utils.h"
#include "../include/ir_ac_apply.h"
/*
* global vars
*/
/*
* external vars
*/
/*
* function declaration
*/
static INT8 apply_ac_power(struct ac_protocol *protocol, UINT8 power_status);
static INT8 apply_ac_mode(struct ac_protocol *protocol, UINT8 mode_status);
@@ -43,9 +25,6 @@ static INT8 apply_ac_swing(struct ac_protocol *protocol, UINT8 swing_status);
static UINT8 has_function(struct ac_protocol *protocol, UINT8 function);
/*
* function definition
*/
INT8 apply_ac_parameter_type_1(UINT8 *dc_data, tag_comp *comp_data, UINT8 current_seg, UINT8 is_temp)
{
@@ -167,7 +146,7 @@ static INT8 apply_ac_power(struct ac_protocol *protocol, UINT8 power_status)
}
for (i = 0; i < protocol->power1.comp_data[power_status].seg_len; i += 2)
{
apply_ac_parameter_type_1(ir_hex_code, &(protocol->power1.comp_data[power_status]), i, FALSE);
apply_ac_parameter_type_1(ir_hex_code, &(protocol->power1.comp_data[power_status]), (UINT8)i, FALSE);
}
return IR_DECODE_SUCCEEDED;
}
@@ -188,7 +167,7 @@ static INT8 apply_ac_mode(struct ac_protocol *protocol, UINT8 mode_status)
for (i = 0; i < protocol->mode1.comp_data[mode_status].seg_len; i += 2)
{
apply_ac_parameter_type_1(ir_hex_code, &(protocol->mode1.comp_data[mode_status]), i, FALSE);
apply_ac_parameter_type_1(ir_hex_code, &(protocol->mode1.comp_data[mode_status]), (UINT8)i, FALSE);
}
// get return here since wind mode 1 is already applied
@@ -208,8 +187,8 @@ static INT8 apply_ac_mode(struct ac_protocol *protocol, UINT8 mode_status)
for (i = 0; i < protocol->mode2.comp_data[mode_status].seg_len; i += 3)
{
apply_ac_parameter_type_2(ir_hex_code,
&(protocol->mode2.comp_data[mode_status]),
i, FALSE);
&(protocol->mode2.comp_data[mode_status]),
(UINT8)i, FALSE);
}
return IR_DECODE_SUCCEEDED;
}
@@ -230,7 +209,7 @@ static INT8 apply_ac_wind_speed(struct ac_protocol *protocol, UINT8 wind_speed)
for (i = 0; i < protocol->speed1.comp_data[wind_speed].seg_len; i += 2)
{
apply_ac_parameter_type_1(ir_hex_code, &(protocol->speed1.comp_data[wind_speed]), i, FALSE);
apply_ac_parameter_type_1(ir_hex_code, &(protocol->speed1.comp_data[wind_speed]), (UINT8)i, FALSE);
}
// get return here since wind speed 1 is already applied
@@ -250,8 +229,8 @@ static INT8 apply_ac_wind_speed(struct ac_protocol *protocol, UINT8 wind_speed)
for (i = 0; i < protocol->speed2.comp_data[wind_speed].seg_len; i += 3)
{
apply_ac_parameter_type_2(ir_hex_code,
&(protocol->speed2.comp_data[wind_speed]),
i, FALSE);
&(protocol->speed2.comp_data[wind_speed]),
(UINT8)i, FALSE);
}
return IR_DECODE_SUCCEEDED;
}
@@ -274,11 +253,11 @@ static INT8 apply_ac_temperature(struct ac_protocol *protocol, UINT8 temp_diff)
{
if (TEMP_TYPE_DYNAMIC == protocol->temp1.type)
{
apply_ac_parameter_type_1(ir_hex_code, &(protocol->temp1.comp_data[temp_diff]), i, TRUE);
apply_ac_parameter_type_1(ir_hex_code, &(protocol->temp1.comp_data[temp_diff]), (UINT8)i, TRUE);
}
else if (TEMP_TYPE_STATIC == protocol->temp1.type)
{
apply_ac_parameter_type_1(ir_hex_code, &(protocol->temp1.comp_data[temp_diff]), i, FALSE);
apply_ac_parameter_type_1(ir_hex_code, &(protocol->temp1.comp_data[temp_diff]), (UINT8)i, FALSE);
}
}
@@ -302,11 +281,11 @@ static INT8 apply_ac_temperature(struct ac_protocol *protocol, UINT8 temp_diff)
{
if (TEMP_TYPE_DYNAMIC == protocol->temp2.type)
{
apply_ac_parameter_type_2(ir_hex_code, &(protocol->temp2.comp_data[temp_diff]), i, TRUE);
apply_ac_parameter_type_2(ir_hex_code, &(protocol->temp2.comp_data[temp_diff]), (UINT8)i, TRUE);
}
else if (TEMP_TYPE_STATIC == protocol->temp2.type)
{
apply_ac_parameter_type_2(ir_hex_code, &(protocol->temp2.comp_data[temp_diff]), i, FALSE);
apply_ac_parameter_type_2(ir_hex_code, &(protocol->temp2.comp_data[temp_diff]), (UINT8)i, FALSE);
}
}
}
@@ -335,7 +314,7 @@ static INT8 apply_ac_swing(struct ac_protocol *protocol, UINT8 swing_mode)
for (i = 0; i < protocol->swing1.comp_data[swing_mode].seg_len; i += 2)
{
apply_ac_parameter_type_1(ir_hex_code, &(protocol->swing1.comp_data[swing_mode]), i, FALSE);
apply_ac_parameter_type_1(ir_hex_code, &(protocol->swing1.comp_data[swing_mode]), (UINT8)i, FALSE);
}
// get return here since temperature 1 is already applied
@@ -361,8 +340,8 @@ static INT8 apply_ac_swing(struct ac_protocol *protocol, UINT8 swing_mode)
for (i = 0; i < protocol->swing2.comp_data[swing_mode].seg_len; i += 3)
{
apply_ac_parameter_type_2(ir_hex_code,
&(protocol->swing2.comp_data[swing_mode]),
i, FALSE);
&(protocol->swing2.comp_data[swing_mode]),
(UINT8)i, FALSE);
}
return IR_DECODE_SUCCEEDED;
}
@@ -569,7 +548,7 @@ INT8 apply_function(struct ac_protocol *protocol, UINT8 function)
for (i = 0; i < protocol->function1.comp_data[function - 1].seg_len; i += 2)
{
apply_ac_parameter_type_1(ir_hex_code, &(protocol->function1.comp_data[function - 1]), i, FALSE);
apply_ac_parameter_type_1(ir_hex_code, &(protocol->function1.comp_data[function - 1]), (UINT8)i, FALSE);
}
// get return here since function 1 is already applied
@@ -589,8 +568,8 @@ INT8 apply_function(struct ac_protocol *protocol, UINT8 function)
for (i = 0; i < protocol->function2.comp_data[function - 1].seg_len; i += 3)
{
apply_ac_parameter_type_2(ir_hex_code,
&(protocol->function2.comp_data[function - 1]),
i, FALSE);
&(protocol->function2.comp_data[function - 1]),
(UINT8)i, FALSE);
}
return IR_DECODE_SUCCEEDED;
}

View File

@@ -9,10 +9,6 @@ Revision log:
* 2016-10-01: created by strawmanbobi
**************************************************************************************************/
#if defined WIN32
#include "stdafx.h"
#endif
#include <stdio.h>
#include "../include/ir_ac_build_frame.h"
@@ -20,6 +16,7 @@ Revision log:
extern protocol* context;
//return bit number per byte,default value is 8
UINT8 bits_per_byte(UINT8 index)
{
@@ -32,12 +29,12 @@ UINT8 bits_per_byte(UINT8 index)
if (context->bitnum_cnt >= MAX_BITNUM)
size = MAX_BITNUM;
else
size = context->bitnum_cnt;
size = (UINT8)context->bitnum_cnt;
for (i = 0; i < size; i++)
{
if (context->bitnum[i].pos == index)
return context->bitnum[i].bits;
return (UINT8)context->bitnum[i].bits;
if (context->bitnum[i].pos > index)
return 8;
}
@@ -53,7 +50,7 @@ UINT16 add_delaycode(UINT8 index)
if(context->dc_cnt != 0)
{
size = context->dc_cnt;
size = (UINT8)context->dc_cnt;
for (i = 0; i < size; i++)
{
@@ -110,7 +107,7 @@ UINT16 create_ir_frame()
for (i = 0; i < ir_hex_len; i++)
{
bitnum = bits_per_byte(i);
bitnum = bits_per_byte((UINT8)i);
//IR_PRINTF("bitnum:%d\n", bitnum);
for (j = 0; j < bitnum; j++)
{
@@ -132,7 +129,7 @@ UINT16 create_ir_frame()
context->time[context->code_cnt++] = context->zero.high;
}
}
add_delaycode(i);
add_delaycode((UINT8)i);
}
framelen = context->code_cnt;

View File

@@ -9,36 +9,18 @@ Revision log:
* 2016-10-05: created by strawmanbobi
**************************************************************************************************/
/*
*inclusion
*/
#if defined WIN32
#include "stdafx.h"
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "../include/ir_decode.h"
#include "../include/ir_ac_parse_forbidden_info.h"
/*
* global vars
*/
/*
* external vars
*/
extern protocol* context;
/*
* function declaration
*/
/*
* function definition
*/
INT8 parse_nmode_data_speed(char *pdata, ac_n_mode seq)
{
char buf[16] = {0};
@@ -56,7 +38,7 @@ INT8 parse_nmode_data_speed(char *pdata, ac_n_mode seq)
pos = index + 1;
index = pos;
context->n_mode[seq].speed[cnt++] = atoi(buf);
context->n_mode[seq].speed_cnt = cnt;
context->n_mode[seq].speed_cnt = (UINT8)cnt;
irda_memset(buf, 0, 16);
}
@@ -81,7 +63,7 @@ INT8 parse_nmode_data_temp(char *pdata, ac_n_mode seq)
pos = index + 1;
index = pos;
context->n_mode[seq].temp[cnt++] = atoi(buf) - 16;
context->n_mode[seq].temp_cnt = cnt;
context->n_mode[seq].temp_cnt = (UINT8)cnt;
irda_memset(buf, 0, 16);
}
return IR_DECODE_SUCCEEDED;

View File

@@ -9,14 +9,6 @@ Revision log:
* 2016-10-11: created by strawmanbobi
**************************************************************************************************/
/*
*inclusion
*/
#if defined WIN32
#include "stdafx.h"
#endif
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
@@ -24,22 +16,7 @@ Revision log:
#include "../include/ir_utils.h"
#include "../include/ir_ac_parse_frame_info.h"
/*
* global vars
*/
/*
* external vars
*/
/*
* function declaration
*/
/*
* function definition
*/
INT8 parse_bootcode(struct tag_head *tag)
{
UINT8 buf[16] = {0};

View File

@@ -9,14 +9,6 @@ Revision log:
* 2016-10-12: created by strawmanbobi
**************************************************************************************************/
/*
*inclusion
*/
#if defined WIN32
#include "stdafx.h"
#endif
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
@@ -24,21 +16,7 @@ Revision log:
#include "../include/ir_utils.h"
#include "../include/ir_ac_parse_parameter.h"
/*
* global vars
*/
/*
* external vars
*/
/*
* function declaration
*/
/*
* function definition
*/
INT8 parse_comp_data_type_1(UINT8 *data, UINT16 *trav_offset, tag_comp *comp)
{
UINT8 seg_len = data[*trav_offset];
@@ -205,7 +183,7 @@ INT8 parse_power_1(struct tag_head *tag, power_1 *power1)
string_to_hex_common(tag->pdata, hex_data, hex_len);
// parse hex data to power1 data structure
power1->len = hex_len;
power1->len = (UINT8)hex_len;
for (seg_index = AC_POWER_ON; seg_index < AC_POWER_MAX; seg_index++)
{
@@ -257,7 +235,7 @@ INT8 parse_temp_1(struct tag_head *tag, temp_1 *temp1)
{
// dynamic temperature tag
temp1->type = TEMP_TYPE_DYNAMIC;
temp1->len = hex_len;
temp1->len = (UINT8)hex_len;
UINT8 seg_len = hex_data[0];
for (seg_index = AC_TEMP_16; seg_index < AC_TEMP_MAX; seg_index++)
@@ -284,7 +262,7 @@ INT8 parse_temp_1(struct tag_head *tag, temp_1 *temp1)
else
{
// static temperature tag
temp1->len = hex_len;
temp1->len = (UINT8)hex_len;
temp1->type = TEMP_TYPE_STATIC;
for (seg_index = AC_TEMP_16; seg_index < AC_TEMP_MAX; seg_index++)
{
@@ -330,7 +308,7 @@ INT8 parse_mode_1(struct tag_head *tag, mode_1 *mode1)
string_to_hex_common(tag->pdata, hex_data, hex_len);
// parse hex data to mode1 data structure
mode1->len = hex_len;
mode1->len = (UINT8)hex_len;
for (seg_index = AC_MODE_COOL; seg_index < AC_MODE_MAX; seg_index++)
{
@@ -376,7 +354,7 @@ INT8 parse_speed_1(struct tag_head *tag, speed_1 *speed1)
string_to_hex_common(tag->pdata, hex_data, hex_len);
// parse hex data to speed1 data structure
speed1->len = hex_len;
speed1->len = (UINT8)hex_len;
for (seg_index = AC_WS_AUTO; seg_index < AC_WS_MAX; seg_index++)
{
@@ -423,7 +401,7 @@ INT8 parse_swing_1(struct tag_head *tag, swing_1 *swing1, UINT16 swing_count)
// parse hex data to swing1 data structure
swing1->count = swing_count;
swing1->len = hex_len;
swing1->len = (UINT8)hex_len;
swing1->comp_data = (tag_comp *) irda_malloc(sizeof(tag_comp) * swing_count);
if (NULL == swing1->comp_data)
{
@@ -760,7 +738,7 @@ INT8 parse_function_1_tag29(struct tag_head *tag, function_1 *function1)
string_to_hex_common(tag->pdata, hex_data, hex_len);
// parse hex data to mode1 data structure
function1->len = hex_len;
function1->len = (UINT8)hex_len;
// seg_index in TAG only refers to functional count
for (seg_index = AC_FUNCTION_POWER; seg_index < AC_FUNCTION_MAX; seg_index++)
@@ -821,7 +799,7 @@ INT8 parse_temp_2(struct tag_head *tag, temp_2 *temp2)
{
// dynamic temperature tag
temp2->type = TEMP_TYPE_DYNAMIC;
temp2->len = hex_len;
temp2->len = (UINT8)hex_len;
UINT8 seg_len = hex_data[0];
for (seg_index = AC_TEMP_16; seg_index < AC_TEMP_MAX; seg_index++)
@@ -848,7 +826,7 @@ INT8 parse_temp_2(struct tag_head *tag, temp_2 *temp2)
else
{
// static temperature tag
temp2->len = hex_len;
temp2->len = (UINT8)hex_len;
temp2->type = TEMP_TYPE_STATIC;
for (seg_index = AC_TEMP_16; seg_index < AC_TEMP_MAX; seg_index++)
{
@@ -899,7 +877,7 @@ INT8 parse_mode_2(struct tag_head *tag, mode_2 *mode2)
string_to_hex_common(tag->pdata, hex_data, hex_len);
// parse hex data to mode1 data structure
mode2->len = hex_len;
mode2->len = (UINT8)hex_len;
for (seg_index = AC_MODE_COOL; seg_index < AC_MODE_MAX; seg_index++)
{
@@ -950,7 +928,7 @@ INT8 parse_speed_2(struct tag_head *tag, speed_2 *speed2)
string_to_hex_common(tag->pdata, hex_data, hex_len);
// parse hex data to speed1 data structure
speed2->len = hex_len;
speed2->len = (UINT8)hex_len;
for (seg_index = AC_WS_AUTO; seg_index < AC_WS_MAX; seg_index++)
{
@@ -1002,7 +980,7 @@ INT8 parse_swing_2(struct tag_head *tag, swing_2 *swing2, UINT16 swing_count)
// parse hex data to swing2 data structure
swing2->count = swing_count;
swing2->len = hex_len;
swing2->len = (UINT8)hex_len;
swing2->comp_data = (tag_comp *) irda_malloc(sizeof(tag_comp) * swing_count);
if (NULL == swing2->comp_data)
{
@@ -1128,7 +1106,7 @@ INT8 parse_function_2_tag34(struct tag_head *tag, function_2 *function2)
string_to_hex_common(tag->pdata, hex_data, hex_len);
// parse hex data to mode1 data structure
function2->len = hex_len;
function2->len = (UINT8)hex_len;
// seg_index in TAG only refers to functional count
for (seg_index = AC_FUNCTION_POWER; seg_index < AC_FUNCTION_MAX; seg_index++)
@@ -1233,7 +1211,7 @@ INT8 parse_solo_code(struct tag_head *tag, solo_code *sc)
string_to_hex_common(tag->pdata, hex_data, hex_len);
// parse hex data to mode1 data structure
sc->len = hex_len;
sc->len = (UINT8)hex_len;
sc->solo_func_count = hex_len - 1;
// per each function takes just 1 byte of length

View File

@@ -9,10 +9,6 @@ Revision log:
* 2016-10-01: created by strawmanbobi
**************************************************************************************************/
#if defined WIN32
#include "stdafx.h"
#endif
#include <stdio.h>
#include <stdlib.h>

View File

@@ -9,10 +9,6 @@ Revision log:
* 2016-11-05: created by strawmanbobi
**************************************************************************************************/
#if defined WIN32
#include "stdafx.h"
#endif
#include <stdio.h>
#if !defined WIN32

View File

@@ -9,10 +9,6 @@ Revision log:
* 2016-10-21: created by strawmanbobi
**************************************************************************************************/
#if defined WIN32
#include "stdafx.h"
#endif
#include <string.h>
#include "../include/ir_defs.h"

View File

@@ -9,10 +9,6 @@ Revision log:
* 2016-10-01: created by strawmanbobi
**************************************************************************************************/
#ifdef WIN32
#include "stdafx.h"
#endif
#include "../include/ir_utils.h"
UINT8 char_to_hex(char chr)