merged AC/TV public API into one

This commit is contained in:
2017-05-08 19:00:25 +08:00
parent 678e9459da
commit 9ce38f3056
3 changed files with 244 additions and 156 deletions

View File

@@ -25,168 +25,134 @@ extern "C"
#define IR_DECODE_FAILED (-1)
#define IR_DECODE_SUCCEEDED (0)
#define IR_CATEGORY_AC 1
#define IR_CATEGORY_TV 2
/* exported functions */
///////////////////////////////////////////////// AC Begin /////////////////////////////////////////////////
/*
* function ir_ac_file_open
#define IR_TYPE_STATUS 0
#define IR_TYPE_COMMANDS 1
#define SUB_CATEGORY_QUATERNARY 0
#define SUB_CATEGORY_HEXADECIMAL 1
// exported functions
/**
* function ir_file_open
*
* parameters: file name of remote binary
* description: open IR binary code from file
*
* parameters: category (in) - category ID get from indexing API
* sub_category (in) - subcategory ID get from indexing API
* file_name (in) - file name of IR binary
*
* returns: IR_DECODE_SUCCEEDED / IR_DECODE_FAILED
*
* return: IR_DECODE_SUCCEEDED / IR_DECODE_FAILED
*/
extern INT8 ir_ac_file_open(const char *file_name);
extern INT8 ir_file_open(const UINT8 category, const UINT8 sub_category, const char* file_name);
/*
* function ir_ac_lib_open
/**
* function ir_binary_open
*
* parameters: binary (in) binary content
* binary_length (in) length of binary content
* description: open IR binary code from buffer
*
* return: IR_DECODE_SUCCEEDED / IR_DECODE_FAILED
* parameters: category (in) - category ID get from indexing API
* sub_category (in) - subcategory ID get from indexing API
* binary (in) - pointer to binary buffer
* binary_length (in) - binary buffer size
*
* returns: IR_DECODE_SUCCEEDED / IR_DECODE_FAILED
*/
extern INT8 ir_ac_lib_open(UINT8 *binary, UINT16 binary_length);
extern INT8 ir_binary_open(const UINT8 category, const UINT8 sub_category, UINT8* binary, UINT16 binary_length);
/*
* function ir_ac_lib_parse
/**
* function ir_decode
*
* parameters:
* description: decode IR binary into INT16 array which indicates the IR levels
*
* return: IR_DECODE_SUCCEEDED / IR_DECODE_FAILED
* parameters: key_code (in) - the code of pressed key
* user_data (out) - output decoded data in INT16 array format
* ac_status(in) - pointer to AC status (optional)
* change_wind_direction (in) - if control changes wind direction for AC (for AC only)
*
* returns: length of decoded data (0 indicates decode failure)
*/
extern INT8 ir_ac_lib_parse();
extern UINT16 ir_decode(UINT8 key_code, UINT16* user_data, remote_ac_status_t* ac_status, BOOL change_wind_direction);
/*
* function ir_ac_lib_control
/**
* function ir_close
*
* 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
* description: close IR binary code
*
* return: length of wave code array
* parameters: N/A
*
* returns: IR_DECODE_SUCCEEDED / IR_DECODE_FAILED
*/
extern UINT16 ir_ac_lib_control(remote_ac_status_t ac_status, UINT16 *user_data, UINT8 function_code,
BOOL change_wind_direction);
extern INT8 ir_close();
/*
* function ir_ac_lib_close
/**
* function get_temperature_range
*
* parameters:
*
* return: IR_DECODE_SUCCEEDED / IR_DECODE_FAILED
*/
extern INT8 ir_ac_lib_close();
///////////////////////////////////////////////// AC End /////////////////////////////////////////////////
///////////////////////////////////////////////// TV Begin /////////////////////////////////////////////////
/*
* function ir_tv_file_open
*
* parameters: file name of remote binary
*
* return: IR_DECODE_SUCCEEDED / IR_DECODE_FAILED
*/
extern INT8 ir_tv_file_open(const char *file_name);
/*
* function ir_tv_lib_open
*
* parameters: binary (in) binary content
* binary_length (in) length of binary content
*
* return: IR_DECODE_SUCCEEDED / IR_DECODE_FAILED
*/
extern INT8 ir_tv_lib_open(UINT8 *binary, UINT16 binary_length);
/*
* function ir_tv_lib_parse
*
* parameters:
*
* return: IR_DECODE_SUCCEEDED / IR_DECODE_FAILED
*/
extern INT8 ir_tv_lib_parse(UINT8 ir_hex_encode);
/*
* function ir_tv_lib_control
*
* 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
*/
extern UINT16 ir_tv_lib_control(UINT8 key_code, UINT16 *user_data);
/*
* function ir_tv_lib_close
*
* parameters:
*
* return: IR_DECODE_SUCCEEDED / IR_DECODE_FAILED
*/
extern INT8 ir_tv_lib_close();
///////////////////////////////////////////////// TV End /////////////////////////////////////////////////
///////////////////////////////////////////////// Utils Begin /////////////////////////////////////////////////
/*
* function get_temperature_range
* description: get the supported temperature range [min, max] for the opened AC IR binary
*
* 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
* returns: IR_DECODE_SUCCEEDED / IR_DECODE_FAILED
*/
extern INT8 get_temperature_range(UINT8 ac_mode, INT8 *temp_min, INT8 *temp_max);
/*
* function get_supported_mode
/**
* function get_supported_mode
*
* description: get supported mode for the opened AC IR binary
*
* parameters: supported_mode (out) mode supported by the remote in lower 5 bits
*
* return: IR_DECODE_SUCCEEDED / IR_DECODE_FAILED
* returns: IR_DECODE_SUCCEEDED / IR_DECODE_FAILED
*/
extern INT8 get_supported_mode(UINT8 *supported_mode);
/*
* function get_supported_wind_speed
/**
* function get_supported_wind_speed
*
* description: get supported wind speed levels for the opened AC IR binary in certain mode
*
* 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
* returns: IR_DECODE_SUCCEEDED / IR_DECODE_FAILED
*/
extern INT8 get_supported_wind_speed(UINT8 ac_mode, UINT8 *supported_wind_speed);
/*
* function get_supported_swing
/**
* function get_supported_swing
*
* description: get supported swing functions for the opened AC IR binary in certain mode
*
* 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
* returns: IR_DECODE_SUCCEEDED / IR_DECODE_FAILED
*/
extern INT8 get_supported_swing(UINT8 ac_mode, UINT8 *supported_swing);
/*
* function get_supported_wind_direction
/**
* function get_supported_wind_direction
*
* description: get supported wind directions for the opened AC IR binary in certain mode
*
* parameters: supported_wind_direction (out) swing supported by the remote in lower 2 bits
*
* return: IR_DECODE_SUCCEEDED / IR_DECODE_FAILED
* returns: IR_DECODE_SUCCEEDED / IR_DECODE_FAILED
*/
extern INT8 get_supported_wind_direction(UINT8 *supported_wind_direction);
// private extern function
#if (defined BOARD_PC || defined BOARD_PC_DLL)
extern void ir_lib_free_inner_buffer();
#endif
///////////////////////////////////////////////// Utils End /////////////////////////////////////////////////
#ifdef __cplusplus
}
#endif