OK, this should finally cover all of Phil's and Stephen's comments:
- though, now that I'm writing this message, some more of the stuff in
the 'API change' section below should probably go into libconcord.h...

This patchset has been build and tested with a Harmony 785, on the 
following platforms:
- LINUX (Mandriva Kernel 2.6.25-custom/gcc-4.2.2)
- Windows XP Home SP3 / Visual C++ Express 2005

Change of libconcord API for IR codes learning
==============================================
This patch changes the part of the libconcord API releated to learning IR
signals. The main goals of the new API are:
a) allow to process LearnIR.EZTut files containing more than one key to learn
   (several keys selected in the web interface)
b) allow to inject IR signals from other sources, e.g. RC5 or NEC codes or
   Philips Pronto Hex format.
Also included are some minor, mostly editorial, changes to fix warnings
reported/marked by MS Visual C++ 2005 and the kdevelop editor
(see detailed descriptions for parts 1 and 2)

API change:
===========
The new learning API consists of four functions, which implement distinct
processing steps of the received data. Splitting the processing allows the
application to process (i.e. to display or replace) the intermediate data.

The functions have to be called in the following order:

1) int get_key_names(uint8_t *data, uint32_t size,
        char ***key_names, uint32_t *key_names_length);

To be called once in the beginning to return in key_names the key names and in
key_names_length the number of key names found in the buffer *data, i.e. the
contents of the received LearnIR.EZTut file. 
Note that in post_new_code below, Logitech will only accept keynames already
present in the database or user-defined via 'Learn new Key' web page for the
current device, so it is essential to read the key names to be learned first.

For each key name, repeat the following:

2) int learn_from_remote(uint32_t *carrier_clock,
        uint32_t **ir_signal, uint32_t *ir_signal_length);

Returns in carrier clock, ir_signal and ir_signal_length the IR code learned 
from another remote control via Harmony IR receiver.

carrier_clock    : in Hz, usually ~36000..40000
*ir_signal       : IR mark/space durations (alternating) in microsconds
ir_signal_length : total number of mark and space durations in ir_signal.
                   ir_signal will start with a mark and end with a space
                   duration, so ir_signal_length will always be even.

The function will stop learning when the IR signal is interrutped for longer 
than 0.5 sec. It will return with an error if no IR signal at all is received
within 4 sec.

Note: An application may also provide the IR code in this format from
      some other source. In this case, it is apparently not needed to call
      learn_from_remote.

3) int encode_for_posting(uint32_t carrier_clock,
        uint32_t *ir_signal, uint32_t ir_signal_length,
        char **encoded_signal);

Returns in *encoded_signal as a string the IR code specified by carrier_clock,
ir_signal and ir_signal_length encoded to Logitech posting string format.

Note: an application may allow to display and enter IR codes in this format,
      which would provide another format to exchange learned IR codes.

4) int post_new_code(uint8_t *data, uint32_t size, 
        char *key_name, char *encoded_signal);
 
Post encoded IR-code for key_name and using additional information from 
received XML *data to Logitech.

All functions return 0 in case of success, or some error code (>0, defined in
libconcord.h) in case of an error.
In case of an error, output parameter values should not be used.

Functions 1)..3) allocate memory for the returned data, which should be freed 
again after use by one of the following functions:
---------------------
void delete_key_names(char **key_names, uint32_t key_names_length);
void delete_ir_signal(uint32_t *ir_signal);
void delete_encoded_signal(char *encoded_signal);

Patchset description:
=====================
The patchset consists of two parts:
1/2 : changes to files in libconcord
2/2 : changes to concordance

Patchset installation:
======================
This patchset should be applied to concordance/libconcord CVS release 0.20.
Note: For MS Windows, I used some old cygwin version of patch.exe, which 
happened to exist on my machine. It only worked with this patchset when 
the concordance sources had been checked out from the CVS in UNIX format, 
i.e. without converting line terminators to DOS style.
For Tortoise CVS, I could set this option somehwere in the configuration.

TODO:
=====
While I managed to adapt the python bindings on my own, I would appreciate
any support to adapt the PERL bindings as well.
Any volunteers for testing on a Macintosh?

Andreas

-------------------------------------------------------------------------
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
concordance-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/concordance-devel

Reply via email to