Your Universal Remote Control Center
RemoteCentral.com
Philips Pronto Professional Forum - View Post
Previous section Next section Previous page Next page Up level
Up level
The following page was printed from RemoteCentral.com:

Login:
Pass:
 
 

Page 2 of 2
Topic:
Pronto TSU9600 via RFX9600 RS232 talk with Sierra Video Pro Matrix 88V5S
This thread has 17 replies. Displaying posts 16 through 18.
OP | Post 16 made on Friday September 17, 2010 at 12:31
bnokes@AAVViD
Long Time Member
Joined:
Posts:
June 2009
31
can it be something other then \r like if the equipment sends some other kind of string other then a \r ? :) and if so then that would have to be in here: so if label = s.match(" ", "a different string here", 2000);
Post 17 made on Friday September 17, 2010 at 15:48
Lyndel McGee
RC Moderator
Joined:
Posts:
August 2001
12,999
On September 17, 2010 at 12:31, bnokes@AAVViD said...
can it be something other then \r like if the equipment sends some other kind of string other then a \r ? :) and if so then that would have to be in here: so if label = s.match(" ", "a different string here", 2000);

As BluPhenix says (or some other string). This is where you must read the protocol specification from your equipment. If you are lucky, they will always terminate a response with a specific character or sequence of characters. In that case, that character or sequence of characters is what you must use as the 2nd parameter for match().

If the equipment does NOT supply such a string, you will have to resort to using serial.receive for an anticipated number of characters and rely on the likelihood that you will be getting impartial messages which will require you to concatenate strings together

var buffer;

// serPort is a variable containing target serial port. check for proper casing against Dev Guide for onData below, please.
serPort.onData = function(x)
{
buffer += x;
// Your code goes here.. check buffer for a complete message String.substring() useful here.
// Your code goes here.. If complete message there, extract full message. String.substring() useful for this.
// Your code goes here.. Process the complete message.
// Your code goes here.. Remove complete message from buffer.
buffer = buffer(fullMsg.length); // assuming fullMsg is variable with string containing complete message, this discards the first fullMsg.length characters from the buffer.
};
Lyndel McGee
Philips Pronto Addict/Beta Tester
OP | Post 18 made on Wednesday September 22, 2010 at 13:58
bnokes@AAVViD
Long Time Member
Joined:
Posts:
June 2009
31
On September 15, 2010 at 20:54, Lyndel McGee said...
\r (just like in C/C++) is Carriage Return.

You need to remove the extra space in " " such that your command looks like:

label = s.match("", "\r", 2000);

What this line does is wait up to 2 seconds to receive a line of text from the serial port. The empty string (same as null) in the first parameter sends nothing and therefore this match operation only does receive with timeout of 2 seconds. I highly recommend reading Appendix A or B of the Dev Guide that discusses each of these functions based on the ProntoScript object type. If it is not in an appendix, there should be a dedicated section in the guide for these. I can't recall if they removed the appendix in the latest dev guide but it was there in previous releases and was invaluable.

Assuming that you get a string (the extender saw a string ending in \r within 2 seconds), the variable label will contain the string received provided that you have not assigned an onData and onTimeout functions (asynchronous serial port usage).

I also have developer-guide-1.3.9.pdf Version 1.3.9 and DevelopersGuide_ProntoScript_Jan08 Version 1.1

yes i remember reading about this some what and trying to understand, but I also have seen other code that takes me back and would like to know why they are doing this one way some one else another way. Let me find some examples i'll get back to you.
Page 2 of 2


Jump to


Protected Feature Before you can reply to a message...
You must first register for a Remote Central user account - it's fast and free! Or, if you already have an account, please login now.

Please read the following: Unsolicited commercial advertisements are absolutely not permitted on this forum. Other private buy & sell messages should be posted to our Marketplace. For information on how to advertise your service or product click here. Remote Central reserves the right to remove or modify any post that is deemed inappropriate.

Hosting Services by ipHouse