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

Login:
Pass:
 
 

Topic:
How to catch extender not being available in script
This thread has 4 replies. Displaying all posts.
Post 1 made on Wednesday January 14, 2009 at 11:40
pthornhill
Long Time Member
Joined:
Posts:
June 2008
53
I' trying the following code to catch instance when the extender is not available - however "ext1 == null" is never true even when there's no network connection or no extender on the network.

var ext1 = CF.extender[1];
if (ext1 == null)
{System.print("couldnt get the extender");}
else
{rest of code assuming extender is available}

What's the best way to catch instance where extender is not available, so you don't execute any further code which will error when extender doesn't respond?
Post 2 made on Wednesday January 14, 2009 at 12:17
Jon Welfringer
Long Time Member
Joined:
Posts:
December 2002
175
Just taking a stab here.... since the extender has it's own IP address, how about trying to open a socket connection to it.
Post 3 made on Wednesday January 14, 2009 at 17:22
Lyndel McGee
RC Moderator
Joined:
Posts:
August 2001
12,992
Opening socket is not the answer.

The only good way to do this is to use try/catch syntax around extender operations and look at any errors you might catch.

See Flanagan and Dev Guide for more info on these Javascript keywords as well as the Error Object that is involved.
Lyndel McGee
Philips Pronto Addict/Beta Tester
Post 4 made on Thursday January 15, 2009 at 04:12
PS2
Long Time Member
Joined:
Posts:
October 2005
76
This is what I use.


// Send READY command to Yamaha
// At this time we have not set up the callback functions
// so this becomes synchronous serial communication
var retry = 5;
var result = "";
try {
    while (retry > 0) {
    result = serial.match("\x11000\x03", "\x03", 500);
    retry = retry - 1;
  }
}
catch (e) {
  // Unable to communicate with serial extender
  serial = null;
  return;
}
Post 5 made on Thursday January 15, 2009 at 04:19
PS2
Long Time Member
Joined:
Posts:
October 2005
76
On January 14, 2009 at 11:40, pthornhill said...
I' trying the following code to catch instance when the
extender is not available - however "ext1 == null" is
never true even when there's no network connection or
no extender on the network.

This will be true or false based on whether there is a checkmark for the extender in the Extenders tab of the systems properties. Uncheck extender #0 and check extender #1 and see what happens.


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