2017-01-09 20:23:01 +08:00
|
|
|
/**************************************************************************************
|
|
|
|
|
Filename: ir_decode.h
|
2016-11-03 23:04:54 +08:00
|
|
|
Revised: Date: 2016-10-01
|
2016-11-02 22:29:13 +08:00
|
|
|
Revision: Revision: 1.0
|
|
|
|
|
|
2016-11-03 22:53:45 +08:00
|
|
|
Description: This file provides algorithms for IR decode
|
|
|
|
|
|
2016-11-02 22:29:13 +08:00
|
|
|
Revision log:
|
2016-11-03 23:04:54 +08:00
|
|
|
* 2016-10-01: created by strawmanbobi
|
2017-01-09 20:23:01 +08:00
|
|
|
**************************************************************************************/
|
2016-12-14 21:37:56 +08:00
|
|
|
|
2016-11-02 22:29:13 +08:00
|
|
|
#ifndef _IRDA_DECODE_H_
|
|
|
|
|
#define _IRDA_DECODE_H_
|
|
|
|
|
|
2016-12-14 21:37:56 +08:00
|
|
|
#ifdef __cplusplus
|
|
|
|
|
extern "C"
|
|
|
|
|
{
|
|
|
|
|
#endif
|
|
|
|
|
|
2016-11-02 22:29:13 +08:00
|
|
|
#include <stdio.h>
|
2017-01-02 18:38:22 +08:00
|
|
|
#include "ir_defs.h"
|
2017-03-19 10:27:49 +08:00
|
|
|
#include "ir_ac_control.h"
|
|
|
|
|
#include "ir_tv_control.h"
|
2016-11-02 22:29:13 +08:00
|
|
|
|
2016-11-24 22:59:41 +08:00
|
|
|
#define IR_DECODE_FAILED (-1)
|
|
|
|
|
#define IR_DECODE_SUCCEEDED (0)
|
2016-11-02 22:29:13 +08:00
|
|
|
|
2016-12-17 21:38:33 +08:00
|
|
|
|
2016-11-02 22:29:13 +08:00
|
|
|
/* exported functions */
|
|
|
|
|
///////////////////////////////////////////////// AC Begin /////////////////////////////////////////////////
|
2016-12-24 20:45:17 +08:00
|
|
|
/*
|
2017-01-02 19:06:31 +08:00
|
|
|
* function ir_ac_file_open
|
2016-12-24 20:45:17 +08:00
|
|
|
*
|
|
|
|
|
* parameters: file name of remote binary
|
|
|
|
|
*
|
|
|
|
|
* return: IR_DECODE_SUCCEEDED / IR_DECODE_FAILED
|
|
|
|
|
*/
|
2017-01-02 19:06:31 +08:00
|
|
|
extern INT8 ir_ac_file_open(const char *file_name);
|
2016-12-24 20:45:17 +08:00
|
|
|
|
2016-11-02 22:29:13 +08:00
|
|
|
/*
|
2017-01-02 19:06:31 +08:00
|
|
|
* function ir_ac_lib_open
|
2016-11-02 22:29:13 +08:00
|
|
|
*
|
2016-11-07 22:39:28 +08:00
|
|
|
* parameters: binary (in) binary content
|
|
|
|
|
* binary_length (in) length of binary content
|
2016-11-02 22:29:13 +08:00
|
|
|
*
|
|
|
|
|
* return: IR_DECODE_SUCCEEDED / IR_DECODE_FAILED
|
|
|
|
|
*/
|
2017-01-02 19:06:31 +08:00
|
|
|
extern INT8 ir_ac_lib_open(UINT8 *binary, UINT16 binary_length);
|
2016-11-02 22:29:13 +08:00
|
|
|
|
|
|
|
|
/*
|
2017-01-02 19:06:31 +08:00
|
|
|
* function ir_ac_lib_parse
|
2016-11-02 22:29:13 +08:00
|
|
|
*
|
|
|
|
|
* parameters:
|
|
|
|
|
*
|
|
|
|
|
* return: IR_DECODE_SUCCEEDED / IR_DECODE_FAILED
|
|
|
|
|
*/
|
2017-01-02 19:06:31 +08:00
|
|
|
extern INT8 ir_ac_lib_parse();
|
2016-11-02 22:29:13 +08:00
|
|
|
|
|
|
|
|
/*
|
2017-01-02 19:06:31 +08:00
|
|
|
* function ir_ac_lib_control
|
2016-11-02 22:29:13 +08:00
|
|
|
*
|
|
|
|
|
* parameters: ac_status (in) indicates the current status of air conditioner to be controlled
|
|
|
|
|
* user_data (out) wave code array to be transmitted
|
|
|
|
|
* function_code (in) indicates the AC function to be updated
|
|
|
|
|
* change_wind_direction (in) indicates if the wind direction need to be changed
|
|
|
|
|
*
|
|
|
|
|
* return: length of wave code array
|
|
|
|
|
*/
|
2017-01-02 19:06:31 +08:00
|
|
|
extern UINT16 ir_ac_lib_control(remote_ac_status_t ac_status, UINT16 *user_data, UINT8 function_code,
|
|
|
|
|
BOOL change_wind_direction);
|
2016-11-02 22:29:13 +08:00
|
|
|
|
|
|
|
|
/*
|
2017-01-02 19:06:31 +08:00
|
|
|
* function ir_ac_lib_close
|
2016-11-02 22:29:13 +08:00
|
|
|
*
|
|
|
|
|
* parameters:
|
|
|
|
|
*
|
|
|
|
|
* return: IR_DECODE_SUCCEEDED / IR_DECODE_FAILED
|
|
|
|
|
*/
|
2017-03-14 12:55:56 +08:00
|
|
|
extern INT8 ir_ac_lib_close();
|
2016-11-02 22:29:13 +08:00
|
|
|
///////////////////////////////////////////////// AC End /////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
///////////////////////////////////////////////// TV Begin /////////////////////////////////////////////////
|
2016-12-24 20:45:17 +08:00
|
|
|
/*
|
2017-01-02 19:06:31 +08:00
|
|
|
* function ir_tv_file_open
|
2016-12-24 20:45:17 +08:00
|
|
|
*
|
|
|
|
|
* parameters: file name of remote binary
|
|
|
|
|
*
|
|
|
|
|
* return: IR_DECODE_SUCCEEDED / IR_DECODE_FAILED
|
|
|
|
|
*/
|
2017-03-25 22:39:20 +08:00
|
|
|
extern INT8 ir_tv_file_open(const char *file_name);
|
2016-12-24 20:45:17 +08:00
|
|
|
|
2016-11-02 22:29:13 +08:00
|
|
|
/*
|
2017-01-02 19:06:31 +08:00
|
|
|
* function ir_tv_lib_open
|
2016-11-02 22:29:13 +08:00
|
|
|
*
|
2016-11-07 22:39:28 +08:00
|
|
|
* parameters: binary (in) binary content
|
|
|
|
|
* binary_length (in) length of binary content
|
2016-11-02 22:29:13 +08:00
|
|
|
*
|
|
|
|
|
* return: IR_DECODE_SUCCEEDED / IR_DECODE_FAILED
|
|
|
|
|
*/
|
2017-03-25 22:39:20 +08:00
|
|
|
extern INT8 ir_tv_lib_open(UINT8 *binary, UINT16 binary_length);
|
2016-11-02 22:29:13 +08:00
|
|
|
|
|
|
|
|
/*
|
2017-01-02 19:06:31 +08:00
|
|
|
* function ir_tv_lib_parse
|
2016-11-02 22:29:13 +08:00
|
|
|
*
|
|
|
|
|
* parameters:
|
|
|
|
|
*
|
|
|
|
|
* return: IR_DECODE_SUCCEEDED / IR_DECODE_FAILED
|
|
|
|
|
*/
|
2017-01-21 20:28:52 +08:00
|
|
|
extern INT8 ir_tv_lib_parse(UINT8 ir_hex_encode);
|
2016-11-02 22:29:13 +08:00
|
|
|
|
|
|
|
|
/*
|
2017-01-02 19:06:31 +08:00
|
|
|
* function ir_tv_lib_control
|
2016-11-02 22:29:13 +08:00
|
|
|
*
|
|
|
|
|
* parameters: key_code (in) indicates the number of pressed key
|
|
|
|
|
* user_data (out) wave code array to be transmitted
|
|
|
|
|
*
|
|
|
|
|
* return: length of wave code array
|
|
|
|
|
*/
|
2017-01-02 19:06:31 +08:00
|
|
|
extern UINT16 ir_tv_lib_control(UINT8 key_code, UINT16 *user_data);
|
2016-11-05 21:00:10 +08:00
|
|
|
|
|
|
|
|
/*
|
2017-01-02 19:06:31 +08:00
|
|
|
* function ir_tv_lib_close
|
2016-11-05 21:00:10 +08:00
|
|
|
*
|
|
|
|
|
* parameters:
|
|
|
|
|
*
|
|
|
|
|
* return: IR_DECODE_SUCCEEDED / IR_DECODE_FAILED
|
|
|
|
|
*/
|
2017-01-02 19:06:31 +08:00
|
|
|
extern INT8 ir_tv_lib_close();
|
2016-11-02 22:29:13 +08:00
|
|
|
///////////////////////////////////////////////// TV End /////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
///////////////////////////////////////////////// Utils Begin /////////////////////////////////////////////////
|
|
|
|
|
/*
|
|
|
|
|
* function get_temperature_range
|
|
|
|
|
*
|
|
|
|
|
* parameters: ac_mode (in) specify in which AC mode the application need to get temperature info
|
|
|
|
|
* temp_min (out) the min temperature supported in a specified AC mode
|
|
|
|
|
* temp_max (out) the max temperature supported in a specified AC mode
|
|
|
|
|
*
|
|
|
|
|
* return: IR_DECODE_SUCCEEDED / IR_DECODE_FAILED
|
|
|
|
|
*/
|
2017-03-16 21:26:53 +08:00
|
|
|
extern INT8 get_temperature_range(UINT8 ac_mode, INT8 *temp_min, INT8 *temp_max);
|
2016-11-02 22:29:13 +08:00
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* function get_supported_mode
|
|
|
|
|
*
|
|
|
|
|
* parameters: supported_mode (out) mode supported by the remote in lower 5 bits
|
|
|
|
|
*
|
|
|
|
|
* return: IR_DECODE_SUCCEEDED / IR_DECODE_FAILED
|
|
|
|
|
*/
|
2017-03-16 21:26:53 +08:00
|
|
|
extern INT8 get_supported_mode(UINT8 *supported_mode);
|
2016-11-02 22:29:13 +08:00
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* function get_supported_wind_speed
|
|
|
|
|
*
|
|
|
|
|
* parameters: ac_mode (in) specify in which AC mode the application need to get wind speed info
|
|
|
|
|
* supported_wind_speed (out) wind speed supported by the remote in lower 4 bits
|
|
|
|
|
*
|
|
|
|
|
* return: IR_DECODE_SUCCEEDED / IR_DECODE_FAILED
|
|
|
|
|
*/
|
2017-03-16 21:26:53 +08:00
|
|
|
extern INT8 get_supported_wind_speed(UINT8 ac_mode, UINT8 *supported_wind_speed);
|
2016-11-02 22:29:13 +08:00
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* function get_supported_swing
|
|
|
|
|
*
|
|
|
|
|
* parameters: ac_mode (in) specify in which AC mode the application need to get swing info
|
|
|
|
|
* supported_swing (out) swing supported by the remote in lower 2 bits
|
|
|
|
|
*
|
|
|
|
|
* return: IR_DECODE_SUCCEEDED / IR_DECODE_FAILED
|
|
|
|
|
*/
|
2017-03-16 21:26:53 +08:00
|
|
|
extern INT8 get_supported_swing(UINT8 ac_mode, UINT8 *supported_swing);
|
2016-11-02 22:29:13 +08:00
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* function get_supported_wind_direction
|
|
|
|
|
*
|
|
|
|
|
* parameters: supported_wind_direction (out) swing supported by the remote in lower 2 bits
|
|
|
|
|
*
|
|
|
|
|
* return: IR_DECODE_SUCCEEDED / IR_DECODE_FAILED
|
|
|
|
|
*/
|
2017-03-16 21:26:53 +08:00
|
|
|
extern INT8 get_supported_wind_direction(UINT8 *supported_wind_direction);
|
2016-11-02 22:29:13 +08:00
|
|
|
|
2017-01-02 18:38:22 +08:00
|
|
|
// private extern function
|
|
|
|
|
#if (defined BOARD_PC || defined BOARD_PC_DLL)
|
2017-03-16 21:26:53 +08:00
|
|
|
|
2017-01-21 20:28:52 +08:00
|
|
|
extern void ir_lib_free_inner_buffer();
|
2017-03-16 21:26:53 +08:00
|
|
|
|
2017-01-02 18:38:22 +08:00
|
|
|
#endif
|
|
|
|
|
|
2016-11-02 22:29:13 +08:00
|
|
|
///////////////////////////////////////////////// Utils End /////////////////////////////////////////////////
|
|
|
|
|
|
2016-12-14 21:37:56 +08:00
|
|
|
#ifdef __cplusplus
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
2016-11-02 22:29:13 +08:00
|
|
|
#endif // _IRDA_DECODE_H_
|