updated Android example project
This commit is contained in:
@@ -12,7 +12,9 @@ Revision log:
|
|||||||
#ifndef _IR_APPLY_H_
|
#ifndef _IR_APPLY_H_
|
||||||
#define _IR_APPLY_H_
|
#define _IR_APPLY_H_
|
||||||
|
|
||||||
|
#if defined (BOARD_PC)
|
||||||
#pragma ide diagnostic ignored "OCUnusedMacroInspection"
|
#pragma ide diagnostic ignored "OCUnusedMacroInspection"
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C"
|
extern "C"
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/**************************************************************************************
|
/**************************************************************************************
|
||||||
Filename: ir_utils.c
|
Filename: ir_ac_build_frame.h
|
||||||
Revised: Date: 2016-10-26
|
Revised: Date: 2016-10-26
|
||||||
Revision: Revision: 1.0
|
Revision: Revision: 1.0
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,9 @@ Revision log:
|
|||||||
#ifndef _IR_DECODER_IR_AC_CONTROL_H
|
#ifndef _IR_DECODER_IR_AC_CONTROL_H
|
||||||
#define _IR_DECODER_IR_AC_CONTROL_H
|
#define _IR_DECODER_IR_AC_CONTROL_H
|
||||||
|
|
||||||
|
#if defined (BOARD_PC)
|
||||||
#pragma ide diagnostic ignored "OCUnusedGlobalDeclarationInspection"
|
#pragma ide diagnostic ignored "OCUnusedGlobalDeclarationInspection"
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C"
|
extern "C"
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/**************************************************************************************
|
/**************************************************************************************
|
||||||
Filename: ir_parse_forbidden_info.h
|
Filename: ir_ac_parse_forbidden_info.h
|
||||||
Revised: Date: 2016-10-05
|
Revised: Date: 2016-10-05
|
||||||
Revision: Revision: 1.0
|
Revision: Revision: 1.0
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/**************************************************************************************
|
/**************************************************************************************
|
||||||
Filename: ir_parse_frame_parameter.h
|
Filename: ir_ac_parse_frame_info.h
|
||||||
Revised: Date: 2016-10-11
|
Revised: Date: 2016-10-11
|
||||||
Revision: Revision: 1.0
|
Revision: Revision: 1.0
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/**************************************************************************************
|
/**************************************************************************************
|
||||||
Filename: ir_parse_ac_parameter.h
|
Filename: ir_ac_parse_parameter.h
|
||||||
Revised: Date: 2016-10-12
|
Revised: Date: 2016-10-12
|
||||||
Revision: Revision: 1.0
|
Revision: Revision: 1.0
|
||||||
|
|
||||||
|
|||||||
@@ -12,8 +12,10 @@ Revision log:
|
|||||||
#ifndef _IR_DECODE_H_
|
#ifndef _IR_DECODE_H_
|
||||||
#define _IR_DECODE_H_
|
#define _IR_DECODE_H_
|
||||||
|
|
||||||
|
#if defined (BOARD_PC)
|
||||||
#pragma ide diagnostic ignored "OCUnusedGlobalDeclarationInspection"
|
#pragma ide diagnostic ignored "OCUnusedGlobalDeclarationInspection"
|
||||||
#pragma ide diagnostic ignored "OCUnusedMacroInspection"
|
#pragma ide diagnostic ignored "OCUnusedMacroInspection"
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C"
|
extern "C"
|
||||||
@@ -219,10 +221,11 @@ typedef enum
|
|||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
SUB_CATEGORY_QUATERNARY = 0,
|
SUB_CATEGORY_BINARY = 0, // deprecated
|
||||||
SUB_CATEGORY_HEXADECIMAL = 1,
|
SUB_CATEGORY_QUATERNARY = 1,
|
||||||
SUB_CATEGORY_NEXT = 2,
|
SUB_CATEGORY_HEXADECIMAL = 2,
|
||||||
SUB_CATEGORY_MAX = 7,
|
SUB_CATEGORY_NEXT = 3,
|
||||||
|
SUB_CATEGORY_MAX = 4,
|
||||||
} t_remote_sub_category;
|
} t_remote_sub_category;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -12,8 +12,10 @@ Revision log:
|
|||||||
#ifndef _IR_DEFS_H
|
#ifndef _IR_DEFS_H
|
||||||
#define _IR_DEFS_H
|
#define _IR_DEFS_H
|
||||||
|
|
||||||
|
#if defined (BOARD_PC)
|
||||||
#pragma ide diagnostic ignored "OCUnusedGlobalDeclarationInspection"
|
#pragma ide diagnostic ignored "OCUnusedGlobalDeclarationInspection"
|
||||||
#pragma ide diagnostic ignored "OCUnusedMacroInspection"
|
#pragma ide diagnostic ignored "OCUnusedMacroInspection"
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C"
|
extern "C"
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/**************************************************************************************
|
/**************************************************************************************
|
||||||
Filename: ir_lib.h
|
Filename: ir_tv_control.h
|
||||||
Revised: Date: 2016-02-23
|
Revised: Date: 2016-02-23
|
||||||
Revision: Revision: 1.0
|
Revision: Revision: 1.0
|
||||||
|
|
||||||
@@ -12,8 +12,10 @@ Revision log:
|
|||||||
#ifndef _IR_TV_CONTROL_H_
|
#ifndef _IR_TV_CONTROL_H_
|
||||||
#define _IR_TV_CONTROL_H_
|
#define _IR_TV_CONTROL_H_
|
||||||
|
|
||||||
|
#if defined (BOARD_PC)
|
||||||
#pragma ide diagnostic ignored "OCUnusedMacroInspection"
|
#pragma ide diagnostic ignored "OCUnusedMacroInspection"
|
||||||
#pragma ide diagnostic ignored "OCUnusedGlobalDeclarationInspection"
|
#pragma ide diagnostic ignored "OCUnusedGlobalDeclarationInspection"
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C"
|
extern "C"
|
||||||
|
|||||||
@@ -12,7 +12,9 @@ Revision log:
|
|||||||
#ifndef _IR_UTILS_H_
|
#ifndef _IR_UTILS_H_
|
||||||
#define _IR_UTILS_H_
|
#define _IR_UTILS_H_
|
||||||
|
|
||||||
|
#if defined (BOARD_PC)
|
||||||
#pragma ide diagnostic ignored "OCUnusedGlobalDeclarationInspection"
|
#pragma ide diagnostic ignored "OCUnusedGlobalDeclarationInspection"
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C"
|
extern "C"
|
||||||
|
|||||||
@@ -8,8 +8,10 @@ Description: This file provides methods for AC IR applying functionalities
|
|||||||
Revision log:
|
Revision log:
|
||||||
* 2016-10-12: created by strawmanbobi
|
* 2016-10-12: created by strawmanbobi
|
||||||
**************************************************************************************/
|
**************************************************************************************/
|
||||||
|
#if defined (BOARD_PC)
|
||||||
#pragma ide diagnostic ignored "bugprone-branch-clone"
|
#pragma ide diagnostic ignored "bugprone-branch-clone"
|
||||||
#pragma ide diagnostic ignored "hicpp-signed-bitwise"
|
#pragma ide diagnostic ignored "hicpp-signed-bitwise"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "include/ir_utils.h"
|
#include "include/ir_utils.h"
|
||||||
#include "include/ir_ac_apply.h"
|
#include "include/ir_ac_apply.h"
|
||||||
|
|||||||
@@ -33,11 +33,11 @@ const UINT16 tag_index[TAG_COUNT_FOR_PROTOCOL] =
|
|||||||
INT8 binary_parse_offset()
|
INT8 binary_parse_offset()
|
||||||
{
|
{
|
||||||
int i = 0;
|
int i = 0;
|
||||||
#if defined BOARD_ESP8266
|
#if defined(ESP8266) || defined(ESP32)
|
||||||
UINT8 *phead = (UINT8 *)&p_ir_buffer->data[1];
|
UINT8 *phead = (UINT8 *)&p_ir_buffer->data[1];
|
||||||
#else
|
#else
|
||||||
UINT16 *phead = (UINT16 *)&p_ir_buffer->data[1];
|
UINT16 *phead = (UINT16 *)&p_ir_buffer->data[1];
|
||||||
#endif // BOARD_ESP8266
|
#endif // ESPRESSIF
|
||||||
|
|
||||||
tag_count = p_ir_buffer->data[0];
|
tag_count = p_ir_buffer->data[0];
|
||||||
if (TAG_COUNT_FOR_PROTOCOL != tag_count)
|
if (TAG_COUNT_FOR_PROTOCOL != tag_count)
|
||||||
@@ -63,7 +63,7 @@ INT8 binary_parse_offset()
|
|||||||
#if defined BOARD_STM8 && defined COMPILER_IAR
|
#if defined BOARD_STM8 && defined COMPILER_IAR
|
||||||
UINT16 offset = *(phead + i);
|
UINT16 offset = *(phead + i);
|
||||||
tags[i].offset = (offset >> 8) | (offset << 8);
|
tags[i].offset = (offset >> 8) | (offset << 8);
|
||||||
#elif defined BOARD_ESP8266
|
#elif defined(ESP8266) || defined(ESP32)
|
||||||
UINT16 tmp_a = *(phead + i * 2);
|
UINT16 tmp_a = *(phead + i * 2);
|
||||||
UINT16 tmp_b = *(phead + i * 2 + 1);
|
UINT16 tmp_b = *(phead + i * 2 + 1);
|
||||||
tags[i].offset = tmp_b << 8 | tmp_a;
|
tags[i].offset = tmp_b << 8 | tmp_a;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/**************************************************************************************
|
/**************************************************************************************
|
||||||
Filename: ir_irframe.c
|
Filename: ir_ac_build_frame.c
|
||||||
Revised: Date: 2016-10-01
|
Revised: Date: 2016-10-01
|
||||||
Revision: Revision: 1.0
|
Revision: Revision: 1.0
|
||||||
|
|
||||||
@@ -9,8 +9,10 @@ Revision log:
|
|||||||
* 2016-10-01: created by strawmanbobi
|
* 2016-10-01: created by strawmanbobi
|
||||||
**************************************************************************************/
|
**************************************************************************************/
|
||||||
|
|
||||||
|
#if defined (BOARD_PC)
|
||||||
#pragma ide diagnostic ignored "hicpp-signed-bitwise"
|
#pragma ide diagnostic ignored "hicpp-signed-bitwise"
|
||||||
#pragma ide diagnostic ignored "readability-redundant-declaration"
|
#pragma ide diagnostic ignored "readability-redundant-declaration"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "include/ir_ac_build_frame.h"
|
#include "include/ir_ac_build_frame.h"
|
||||||
#include "include/ir_decode.h"
|
#include "include/ir_decode.h"
|
||||||
|
|||||||
@@ -550,10 +550,11 @@ INT8 free_ac_context()
|
|||||||
return IR_DECODE_SUCCEEDED;
|
return IR_DECODE_SUCCEEDED;
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma clang diagnostic push
|
#if defined (BOARD_PC)
|
||||||
#pragma ide diagnostic ignored "hicpp-signed-bitwise"
|
#pragma ide diagnostic ignored "hicpp-signed-bitwise"
|
||||||
|
#endif
|
||||||
|
|
||||||
BOOL is_solo_function(UINT8 function_code)
|
BOOL is_solo_function(UINT8 function_code)
|
||||||
{
|
{
|
||||||
return (((context->solo_function_mark >> (function_code - 1)) & 0x01) == 0x01) ? TRUE : FALSE;
|
return (((context->solo_function_mark >> (function_code - 1)) & 0x01) == 0x01) ? TRUE : FALSE;
|
||||||
}
|
}
|
||||||
#pragma clang diagnostic pop
|
|
||||||
@@ -9,7 +9,9 @@ Revision log:
|
|||||||
* 2016-10-05: created by strawmanbobi
|
* 2016-10-05: created by strawmanbobi
|
||||||
**************************************************************************************/
|
**************************************************************************************/
|
||||||
|
|
||||||
|
#if defined (BOARD_PC)
|
||||||
#pragma ide diagnostic ignored "readability-redundant-declaration"
|
#pragma ide diagnostic ignored "readability-redundant-declaration"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/**************************************************************************************
|
/**************************************************************************************
|
||||||
Filename: ir_parse_frame_parameter.c
|
Filename: ir_ac_parse_frame_info.c
|
||||||
Revised: Date: 2016-10-11
|
Revised: Date: 2016-10-11
|
||||||
Revision: Revision: 1.0
|
Revision: Revision: 1.0
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/**************************************************************************************
|
/**************************************************************************************
|
||||||
Filename: ir_parse_ac_parameter.c
|
Filename: ir_ac_parse_parameter.c
|
||||||
Revised: Date: 2016-10-12
|
Revised: Date: 2016-10-12
|
||||||
Revision: Revision: 1.0
|
Revision: Revision: 1.0
|
||||||
|
|
||||||
|
|||||||
@@ -31,8 +31,10 @@ struct tag_head tags[TAG_COUNT_FOR_PROTOCOL];
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
static UINT8 byte_array[PROTOCOL_SIZE] = { 0 };
|
static UINT8 byte_array[PROTOCOL_SIZE] = { 0 };
|
||||||
|
#if !defined NO_FS
|
||||||
static size_t binary_length = 0;
|
static size_t binary_length = 0;
|
||||||
static UINT8 *binary_content = NULL;
|
static UINT8 *binary_content = NULL;
|
||||||
|
#endif
|
||||||
|
|
||||||
static t_remote_category remote_category = REMOTE_CATEGORY_NONE;
|
static t_remote_category remote_category = REMOTE_CATEGORY_NONE;
|
||||||
static UINT8 ir_binary_type = IR_TYPE_STATUS;
|
static UINT8 ir_binary_type = IR_TYPE_STATUS;
|
||||||
@@ -137,13 +139,13 @@ INT8 ir_file_open(const UINT8 category, const UINT8 sub_category, const char* fi
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
ir_binary_type = IR_TYPE_COMMANDS;
|
ir_binary_type = IR_TYPE_COMMANDS;
|
||||||
if (1 == sub_category)
|
if (SUB_CATEGORY_QUATERNARY == sub_category)
|
||||||
{
|
{
|
||||||
ir_hexadecimal = SUB_CATEGORY_QUATERNARY;
|
ir_hexadecimal = 0;
|
||||||
}
|
}
|
||||||
else if (2 == sub_category)
|
else if (SUB_CATEGORY_HEXADECIMAL == sub_category)
|
||||||
{
|
{
|
||||||
ir_hexadecimal = SUB_CATEGORY_HEXADECIMAL;
|
ir_hexadecimal = 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -178,7 +180,7 @@ INT8 ir_binary_open(const UINT8 category, const UINT8 sub_category, UINT8* binar
|
|||||||
ir_printf("wrong remote category\n");
|
ir_printf("wrong remote category\n");
|
||||||
return IR_DECODE_FAILED;
|
return IR_DECODE_FAILED;
|
||||||
}
|
}
|
||||||
remote_category = category;
|
remote_category = (t_remote_category) category;
|
||||||
|
|
||||||
if (sub_category < SUB_CATEGORY_QUATERNARY ||
|
if (sub_category < SUB_CATEGORY_QUATERNARY ||
|
||||||
sub_category >= SUB_CATEGORY_NEXT)
|
sub_category >= SUB_CATEGORY_NEXT)
|
||||||
@@ -203,13 +205,13 @@ INT8 ir_binary_open(const UINT8 category, const UINT8 sub_category, UINT8* binar
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
ir_binary_type = IR_TYPE_COMMANDS;
|
ir_binary_type = IR_TYPE_COMMANDS;
|
||||||
if (1 == sub_category)
|
if (SUB_CATEGORY_QUATERNARY == sub_category)
|
||||||
{
|
{
|
||||||
ir_hexadecimal = SUB_CATEGORY_QUATERNARY;
|
ir_hexadecimal = 0;
|
||||||
}
|
}
|
||||||
else if (2 == sub_category)
|
else if (SUB_CATEGORY_HEXADECIMAL == sub_category)
|
||||||
{
|
{
|
||||||
ir_hexadecimal = SUB_CATEGORY_HEXADECIMAL;
|
ir_hexadecimal = 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -468,19 +470,6 @@ static UINT16 ir_ac_control(t_remote_ac_status ac_status, UINT16* user_data, UIN
|
|||||||
|
|
||||||
time_length = create_ir_frame();
|
time_length = create_ir_frame();
|
||||||
|
|
||||||
#if (defined BOARD_PC)
|
|
||||||
#if (defined BOARD_PC_JNI)
|
|
||||||
ir_printf("code count = %d\n", context->code_cnt);
|
|
||||||
#else
|
|
||||||
int i = 0;
|
|
||||||
for (i = 0; i < context->code_cnt; i++)
|
|
||||||
{
|
|
||||||
ir_printf("%d,", context->time[i]);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
ir_printf("\n");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return time_length;
|
return time_length;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -724,15 +713,6 @@ static UINT16 ir_tv_control(UINT8 key, UINT16 *l_user_data)
|
|||||||
memset(l_user_data, 0x00, USER_DATA_SIZE);
|
memset(l_user_data, 0x00, USER_DATA_SIZE);
|
||||||
ir_code_length = tv_binary_decode(key, l_user_data);
|
ir_code_length = tv_binary_decode(key, l_user_data);
|
||||||
|
|
||||||
#if defined BOARD_PC
|
|
||||||
// have some debug
|
|
||||||
ir_printf("length of IR code = %d\n", ir_code_length);
|
|
||||||
for (print_index = 0; print_index < ir_code_length; print_index++)
|
|
||||||
{
|
|
||||||
ir_printf("%d ", l_user_data[print_index]);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return ir_code_length;
|
return ir_code_length;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -760,7 +740,7 @@ UINT16 ir_decode_combo(const UINT8 category, const UINT8 sub_category,
|
|||||||
return IR_DECODE_FAILED;
|
return IR_DECODE_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
remote_category = category;
|
remote_category = (t_remote_category) category;
|
||||||
|
|
||||||
if (key_code < 0 || key_code >= KEY_CODE_MAX[remote_category])
|
if (key_code < 0 || key_code >= KEY_CODE_MAX[remote_category])
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
/**************************************************************************************
|
/**************************************************************************************
|
||||||
Filename: ir_main.c
|
Filename: ir_decode_test.c
|
||||||
Revised: Date: 2016-11-05
|
Revised: Date: 2016-11-05
|
||||||
Revision: Revision: 1.0
|
Revision: Revision: 1.0
|
||||||
|
|
||||||
Description: This file provides main entry for irda decoder
|
Description: This file provides main entry for irda decoder test
|
||||||
|
|
||||||
Revision log:
|
Revision log:
|
||||||
* 2016-11-05: created by strawmanbobi
|
* 2016-11-05: created by strawmanbobi
|
||||||
@@ -12,7 +12,6 @@ Revision log:
|
|||||||
#pragma ide diagnostic ignored "OCUnusedMacroInspection"
|
#pragma ide diagnostic ignored "OCUnusedMacroInspection"
|
||||||
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <libgen.h>
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@@ -60,9 +59,10 @@ static INT8 decode_as_ac(char *file_name)
|
|||||||
{
|
{
|
||||||
BOOL op_match = TRUE;
|
BOOL op_match = TRUE;
|
||||||
BOOL change_wind_dir = FALSE;
|
BOOL change_wind_dir = FALSE;
|
||||||
UINT8 function_code = AC_FUNCTION_MAX;
|
|
||||||
int key_code = 0;
|
int key_code = 0;
|
||||||
int first_time = 1;
|
int first_time = 1;
|
||||||
|
int length = 0;
|
||||||
|
int index = 0;
|
||||||
|
|
||||||
// get status
|
// get status
|
||||||
UINT8 supported_mode = 0x00;
|
UINT8 supported_mode = 0x00;
|
||||||
@@ -72,13 +72,13 @@ static INT8 decode_as_ac(char *file_name)
|
|||||||
UINT8 supported_swing = 0x00;
|
UINT8 supported_swing = 0x00;
|
||||||
UINT8 supported_wind_direction = 0x00;
|
UINT8 supported_wind_direction = 0x00;
|
||||||
|
|
||||||
BOOL need_control;
|
BOOL need_control = TRUE;
|
||||||
|
|
||||||
// init air conditioner status
|
// init air conditioner status
|
||||||
ac_status.ac_display = 0;
|
ac_status.ac_display = 0;
|
||||||
ac_status.ac_sleep = 0;
|
ac_status.ac_sleep = 0;
|
||||||
ac_status.ac_timer = 0;
|
ac_status.ac_timer = 0;
|
||||||
ac_status.ac_power = AC_POWER_OFF;
|
ac_status.ac_power = AC_POWER_ON;
|
||||||
ac_status.ac_mode = AC_MODE_COOL;
|
ac_status.ac_mode = AC_MODE_COOL;
|
||||||
ac_status.ac_temp = AC_TEMP_20;
|
ac_status.ac_temp = AC_TEMP_20;
|
||||||
ac_status.ac_wind_dir = AC_SWING_ON;
|
ac_status.ac_wind_dir = AC_SWING_ON;
|
||||||
@@ -162,8 +162,9 @@ static INT8 decode_as_ac(char *file_name)
|
|||||||
{
|
{
|
||||||
switch (key_code)
|
switch (key_code)
|
||||||
{
|
{
|
||||||
|
// notice: only if ac_power is turned on will user_data change when input a different key_code
|
||||||
case 0:
|
case 0:
|
||||||
ac_status.ac_power = ((ac_status.ac_wind_dir == AC_POWER_ON) ? AC_POWER_OFF : AC_POWER_ON);
|
ac_status.ac_power = ((ac_status.ac_power == AC_POWER_ON) ? AC_POWER_OFF : AC_POWER_ON);
|
||||||
need_control = TRUE;
|
need_control = TRUE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -210,15 +211,20 @@ static INT8 decode_as_ac(char *file_name)
|
|||||||
|
|
||||||
if (TRUE == op_match && TRUE == need_control)
|
if (TRUE == op_match && TRUE == need_control)
|
||||||
{
|
{
|
||||||
printf("switch AC to power = %d, mode = %d, temp = %d, speed = %d, swing = %d with function code = %d\n",
|
printf("switch AC to power = %d, mode = %d, temp = %d, speed = %d, swing = %d with key_code = %d\n",
|
||||||
ac_status.ac_power,
|
ac_status.ac_power,
|
||||||
ac_status.ac_mode,
|
ac_status.ac_mode,
|
||||||
ac_status.ac_temp,
|
ac_status.ac_temp,
|
||||||
ac_status.ac_wind_speed,
|
ac_status.ac_wind_speed,
|
||||||
ac_status.ac_wind_dir,
|
ac_status.ac_wind_dir,
|
||||||
function_code);
|
key_code);
|
||||||
|
length = ir_decode(key_code, user_data, &ac_status, change_wind_dir);
|
||||||
ir_decode(function_code, user_data, &ac_status, change_wind_dir);
|
printf("\n === Binary decoded : %d\n", length);
|
||||||
|
for (index = 0; index < length; index++)
|
||||||
|
{
|
||||||
|
printf("%d, ", user_data[index]);
|
||||||
|
}
|
||||||
|
printf("\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} while (TRUE);
|
} while (TRUE);
|
||||||
@@ -233,6 +239,8 @@ static INT8 decode_as_tv(char *file_name, UINT8 ir_hex_encode)
|
|||||||
// keyboard input
|
// keyboard input
|
||||||
int key_code = 0;
|
int key_code = 0;
|
||||||
int first_time = 1;
|
int first_time = 1;
|
||||||
|
int length = 0;
|
||||||
|
int index = 0;
|
||||||
|
|
||||||
// here remote category TV represents for command typed IR code
|
// here remote category TV represents for command typed IR code
|
||||||
if (IR_DECODE_FAILED == ir_file_open(REMOTE_CATEGORY_TV, ir_hex_encode, file_name))
|
if (IR_DECODE_FAILED == ir_file_open(REMOTE_CATEGORY_TV, ir_hex_encode, file_name))
|
||||||
@@ -258,7 +266,13 @@ static INT8 decode_as_tv(char *file_name, UINT8 ir_hex_encode)
|
|||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
ir_decode(key_code, user_data, NULL, 0);
|
length = ir_decode(key_code, user_data, NULL, 0);
|
||||||
|
printf("\n === Binary decoded : %d\n", length);
|
||||||
|
for (index = 0; index < length; index++)
|
||||||
|
{
|
||||||
|
printf("%d, ", user_data[index]);
|
||||||
|
}
|
||||||
|
printf("===\n");
|
||||||
|
|
||||||
} while (TRUE);
|
} while (TRUE);
|
||||||
|
|
||||||
@@ -280,7 +294,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
if (4 != argc)
|
if (4 != argc)
|
||||||
{
|
{
|
||||||
print_usage(basename(argv[0]));
|
print_usage((argv[0]));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/**************************************************************************************
|
/**************************************************************************************
|
||||||
Filename: ir_lib.c
|
Filename: ir_tv_control.c
|
||||||
Revised: Date: 2016-10-21
|
Revised: Date: 2016-10-21
|
||||||
Revision: Revision: 1.0
|
Revision: Revision: 1.0
|
||||||
|
|
||||||
@@ -9,7 +9,9 @@ Revision log:
|
|||||||
* 2016-10-21: created by strawmanbobi
|
* 2016-10-21: created by strawmanbobi
|
||||||
**************************************************************************************/
|
**************************************************************************************/
|
||||||
|
|
||||||
|
#if defined (BOARD_PC)
|
||||||
#pragma ide diagnostic ignored "hicpp-signed-bitwise"
|
#pragma ide diagnostic ignored "hicpp-signed-bitwise"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
@@ -118,7 +120,8 @@ static BOOL get_ir_protocol(UINT8 encode_type)
|
|||||||
|
|
||||||
if (encode_type == 0)
|
if (encode_type == 0)
|
||||||
{
|
{
|
||||||
cycles_num_size = 8; /* "BOOT", "STOP", "SEP", "ONE", "ZERO", "FLIP", "TWO", "THREE" */
|
cycles_num_size = 8;
|
||||||
|
/* "BOOT", "STOP", "SEP", "ONE", "ZERO", "FLIP", "TWO", "THREE" */
|
||||||
if (prot_cycles_num[IRDA_TWO] == 0 && prot_cycles_num[IRDA_THREE] == 0)
|
if (prot_cycles_num[IRDA_TWO] == 0 && prot_cycles_num[IRDA_THREE] == 0)
|
||||||
{
|
{
|
||||||
ir_decode_flag = IRDA_DECODE_1_BIT;
|
ir_decode_flag = IRDA_DECODE_1_BIT;
|
||||||
|
|||||||
Reference in New Issue
Block a user