So, maybe we can agree on the following interface:
/*
* IR-stuff
* ===========================
* Data structure information:
*
* carrier_clock : in Hz, usually ~36000..40000
* ir_signal : IR mark/space durations (alternating) in microsconds
* ir_signal_length : total number of mark/space durations in ir_signal
* ir_signal will start with a mark and end with a space duration,
* hence ir_signal_length will always be an even number.
*
* They are usually filled in by calling learn_from_remote(...),
* to learn IR signals from an existing other remote, but may also
* be set by the application, e.g. be derived from Pilips Pronto Hex
* codes or RC5/NEC/... command codes (separate conversion library required).
*
* encoded posting format : IR code data converted to Logitech
* posting string format, returned by encode_for_posting.
* Having the encoding separate from the posting keeps the
* parameter list of post_new_code() tidy and allows the
* application to display the encoded signal when desired.
*/
/*
* Scans the contents of the received LearnIR.EZTut file
* (read into *data[size]) for the key names to be learned.
*
* Returns an array of strings containing the key names,
* terminated by a NULL pointer: ("a", "b", "c", NULL),
* or NULL in case of any error while scanning.
*
* Memory allocated for the strings must be freed by the caller
* via destroy_key_names() when not needed any longer, i.e.
* after all codes have been posted via post_new_code.
*/
char **get_key_names(uint8_t *data, uint32_t size);
void destroy_key_names(char **garbage);
/*
* Fills ir_data with IR code learned from other remote
* via Harmony IR receiver.
*
* Returns 0 for success, error code for failure.
*
* Memory allocated for ir_signal must be freed by the caller
* via destroy_ir_signal() when not needed any longer,
* i.e. after calling encode_for_posting
*/
int learn_from_remote(uint32_t *carrier_clock, uint32_t **ir_signal,
uint32_t *ir_signal_length);
void destroy_ir_signal(uint32_t *garbage);
/*
* Encodes IR code in to Logitech posting string format.
*
* Returns encoded string or NULL in case of failure.
*
* Memory allocated for the string must be freed by the caller
* via destroy_post_string() when not needed any longer,
* i.e. after calling post_new_code
*/
char *encode_for_posting(uint32_t carrier_clock, uint32_t *ir_signal,
uint32_t ir_signal_length);
void destroy_post_string(char *garbage);
/*
* Posts encoded IR-code with key_name and additional
* information from XML data[size] to Logitech.
*
* Returns 0 for success, error code for failure.
*/
int post_new_code(uint8_t *data, uint32_t size, char *key_name, char *code);
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
concordance-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/concordance-devel