Page 1 of 1

while learning commands, call SendRemoteCommand ?

PostPosted: Sat 17. Jan 2009, 09:55
by Fischer
Hello,
i have an itrans usb.

In a multi thread environment,
is is possible to call LearnIRCode() in one thread, to learn some ir commands coming from a Remote Com,
and calling SendRemoteCommand() in an other thread ?

If it is not clear, ask some question please.
Thanks
Regards

Re: while learning commands, call SendRemoteCommand ?

PostPosted: Sat 17. Jan 2009, 15:01
by IRTrans
Hi,
that is not possible - the IRTrans Device cannot send codes while it is learning.

Furthermore the irserver not multithreaded either.

IRTrans

Re: while learning commands, call SendRemoteCommand ?

PostPosted: Sat 17. Jan 2009, 15:48
by Fischer
Hello,

lets suppose i am calling LearnIRCode() with a long time out,
is it possible to force to end this call, result can be "Timeout" ?

With your "irtrans client" it is possible to finish learning with the button "Finish learning" !!

thanks

Re: while learning commands, call SendRemoteCommand ?

PostPosted: Sat 17. Jan 2009, 20:42
by IRTrans
Hi,
internally there is a call to abort learning (however, I don't think the GUI Client uses it).

The Call is not available in the APIs. Which API are you using ?

IRTrans

Re: while learning commands, call SendRemoteCommand ?

PostPosted: Sat 17. Jan 2009, 21:29
by Fischer
hello, i use irtrans.h api (see below) :
however gui client is able to interrupt leaarning process.


IRTRANSDLL_API int ConnectIRTransServer (char host[],SOCKET *sock);
IRTRANSDLL_API void DisconnectIRTransServer (SOCKET serv);
IRTRANSDLL_API NETWORKSTATUS *LearnIRCode (SOCKET serv, char rem[],char com[],unsigned short timeout);
IRTRANSDLL_API NETWORKSTATUS *LearnRepeatIRCode (SOCKET serv, char rem[],char com[],unsigned short timeout);
IRTRANSDLL_API NETWORKSTATUS *SendRemoteCommand (SOCKET serv, char rem[],char com[],int mask,int LEDSel,int bus);
IRTRANSDLL_API NETWORKRECV *ReceiveIR (SOCKET serv);
IRTRANSDLL_API NETWORKSTATUS *ReloadIRDatabase (SOCKET serv);
IRTRANSDLL_API int GetDeviceStatus (SOCKET serv, void *result);
IRTRANSDLL_API int GetDeviceStatusExN (SOCKET serv, int offset,void *result);
IRTRANSDLL_API NETWORKSTATUS *SendRemoteCommandEx (SOCKET serv, char rem[],char com[],word mask,byte LEDSel,byte bus);
IRTRANSDLL_API NETWORKSTATUS *SendCCFCommand (SOCKET serv, char ccfstr[],byte repeat,word mask,byte LEDSel,byte bus);
IRTRANSDLL_API NETWORKSTATUS *SendCCFCommandLong (SOCKET serv, char ccfstr[],byte repeat,word mask,byte LEDSel,byte bus);
IRTRANSDLL_API int GetRemotes (SOCKET serv,int16_t offset,REMOTEBUFFER *rem);
IRTRANSDLL_API int GetCommands (SOCKET serv,char rem[],int16_t offset,COMMANDBUFFER *com);

Re: while learning commands, call SendRemoteCommand ?

PostPosted: Sat 17. Jan 2009, 23:04
by IRTrans
Well, the GUI Client is not interrupting the Learn process.

If you close the learn dialog while learning a command it will get a timeout error AFTER the learn timeout expired ...

We will see if we can add a cancel for learn commands in a future release of the DLL.

IRTrans

Re: while learning commands, call SendRemoteCommand ?

PostPosted: Sat 17. Jan 2009, 23:12
by IRTrans
Hi,
I just rechecked it: There is no way to interrupt an active learn command.

The reason is, that the irserver is a singlethreaded application that is waiting for the learn result until the timeout expires.

IRTrans

Re: while learning commands, call SendRemoteCommand ?

PostPosted: Thu 29. Jan 2009, 23:18
by Fischer
hello,
concerning interrupting learning function, do you plane to do it it the future ?

How can i use NETWORKRECV *ReceiveIR (SOCKET serv) ?
Where can i retrieve the result/data ?


I have a question, little tricky, ...

lets say irtrans is in listening mode,
this means that he is able to listen all ir commands comming from ir remote commands : tv, recorder, ..
If it receives ir commands, it sends to my client.
My client analyses the command and if the ir command is coming from "the blue button of the tv remote command" i will do some specific action.
I assume that this mode is able to listen/spy the ir command comming from anywhere.
Is this possible ?
I hope i was clear in my request.

Regards

Re: while learning commands, call SendRemoteCommand ?

PostPosted: Fri 30. Jan 2009, 00:38
by IRTrans
Hi,
currently we do not have any plans to change the way the learning process works. Changing that would mean to change the whole structure of the server
as multiple threads would be needed.

NETWORKRECV *ReceiveIR (SOCKET serv) will give you back any received IR Code in the NETWORKRECV structure. If the code can be mapped
it will contain the name of the remote and command. Please note that this is not like learning an IR Code - only the data information is returned
and no timing data.

This call will allow you to analyze received IR Commands. Please note that this call will block until an IR Code is received.

IRTrans