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:
Best way to do this
This thread has 8 replies. Displaying all posts.
Post 1 made on Tuesday August 25, 2020 at 11:18
mpg7321
Regular Member
Joined:
Posts:
June 2020
109
So in my activities, on the advanced tab of the page I have been trying to set a few things when the Page is Shown. It works about 90% of the time. Like it to be %100.

I simple have the following sample for one of my pages

GlobalRS232("SIDVD");
GUI.widget("OverLay1").visible = false;
GUI.widget("OverLay2").visible = false;
GUI.widget("OverLay3").visible = false;
GUI.widget("OverLay4").visible = false;
GUI.widget("OverLay5").visible = false;
GUI.widget("OverLay6").visible = false;
GUI.widget("OverLay7").visible = false;
GUI.widget("OverLay8").visible = false;
GUI.widget("OverLay9").visible = false;
GUI.widget("OverLay10").visible = false;
Post 2 made on Tuesday August 25, 2020 at 14:49
Lyndel McGee
RC Moderator
Joined:
Posts:
August 2001
12,992
It might help others to use more descriptive subject lines in your posts such as

"GUI.widget() does not always work as expected".

Your post is not explicitly clear about which line(s) are not working.

However, I know SIDVD is a command sent to a Denon/Marantz unit to set the input to DVD so I can likely figure that piece out.

Activity script can run when a page is not yet visible.
GUI.widget() can return null when called from within the Activity script if a page script has not been executed. This frequently happens when entering an Activity for the first time. Only at the time a Page script executes are widgets available for you to tweak. See Sections 7.2 and 7.2.1 of the DEV Guide.

Your script is trying to set the 'visible' property of null will throw an error and all remaining lines will be skipped.

Section A.6.2.7 of the DEV Guide.
GUI.widget - Search for a widget that is currently displayed on the screen. This also includes firm keys and hard keys.

Return
Widget
The class instance corresponding to the found widget,or null if not found.

Either check for this condition and handle it or move the widget setup code into a Page script.

Last edited by Lyndel McGee on August 25, 2020 15:02.
Lyndel McGee
Philips Pronto Addict/Beta Tester
OP | Post 3 made on Wednesday August 26, 2020 at 10:56
mpg7321
Regular Member
Joined:
Posts:
June 2020
109
This is all on a page script not an activity script. So not sure what you mean by moving this to a page script. Not sure I understand how the widget be NULL if not found when all the widgets are on the page. To answer one of the first question, either every thing works or nothing works. So it makes scene if the first command hangs up then every thing else does not run. So the first line may be the problem then. You are correct it for a New Denon receiver via my GC device RS232 device. I also had the same issue with the old receiver too. So I wonder if there is some thing going on with the GC code you helped out with. Also seems to be more of an issue when ran from the remote. Have not experienced this on the simulator.
Post 4 made on Wednesday August 26, 2020 at 11:03
Lyndel McGee
RC Moderator
Joined:
Posts:
August 2001
12,992
On August 25, 2020 at 11:18, mpg7321 said...
So in my activities, on the advanced tab of the page I have been trying to set a few things when the Page is Shown. It works about 90% of the time. Like it to be %100.

I simple have the following sample for one of my pages

GlobalRS232("SIDVD");
GUI.widget("OverLay1").visible = false;
GUI.widget("OverLay2").visible = false;
GUI.widget("OverLay3").visible = false;
GUI.widget("OverLay4").visible = false;
GUI.widget("OverLay5").visible = false;
GUI.widget("OverLay6").visible = false;
GUI.widget("OverLay7").visible = false;
GUI.widget("OverLay8").visible = false;
GUI.widget("OverLay9").visible = false;
GUI.widget("OverLay10").visible = false;

Dohhh! You are correct. It clearly says in the Activities on the advanced tab of a page.


I agree that there is likely something going wrong with the GlobalRS232 line.

Why not put the GUI.widget lines before the GlobalRS232 line? That way if the 232 line fails, then at least the UI is setup the way you likely want it.

The only way to figure out what is wrong is to debug it with System.print or other things.
Lyndel McGee
Philips Pronto Addict/Beta Tester
OP | Post 5 made on Wednesday August 26, 2020 at 11:10
mpg7321
Regular Member
Joined:
Posts:
June 2020
109
On August 26, 2020 at 11:03, Lyndel McGee said...
Dohhh! You are correct. It clearly says in the Activities on the advanced tab of a page.

I agree that there is likely something going wrong with the GlobalRS232 line.

Why not put the GUI.widget lines before the GlobalRS232 line? That way if the 232 line fails, then at least the UI is setup the way you likely want it.

The only way to figure out what is wrong is to debug it with System.print or other things.

I just did what you suggested moved the first to last. So I will have to see if that works. I did edit my last response to saying that I never have the issue with the command from a button on a layout. Only on the page script. I if still have issues where either nothing works or every thing works then I will have to dig in more. It will take some time for testing.
Thanks
OP | Post 6 made on Wednesday August 26, 2020 at 11:38
mpg7321
Regular Member
Joined:
Posts:
June 2020
109
So did a system print and came back with an error,

System.setDebugMask(9);
var socket_GlobalRS232;
var buffer_GlobalRS232 = "";
var CR_GlobalRS232 = "\x0D";
function onSocketConnect() {
}
function onSocketData() {
var temp,first;
buffer_GlobalRS232+=socket_GlobalRS232.read();
first = buffer_GlobalRS232.indexOf(CR_GlobalRS232);
while (first >= 0) {
temp = buffer_GlobalRS232.substring(0, first);
buffer_GlobalRS232 = buffer_GlobalRS232.substring(first + 1);
notifyMessageReceived(temp);
first = buffer_GlobalRS232.indexOf(CR_GlobalRS232);
}}
function onSocketIOError(e)
{
System.print("sock IO Error error:" + e);
}
function notifyMessageReceived(message) {
System.print("Received:");
System.print(message);
}
function closeSocket() {
if (socket_GlobalRS232) {
if (socket_GlobalRS232.connected) socket_GlobalRS232.close;
socket_GlobalRS232 = null;
}}
function resetSocket() {
closeSocket();
socket_GlobalRS232 = new TCPSocket(false);
buffer_GlobalRS232 = "";
socket_GlobalRS232.onConnect = onSocketConnect;
socket_GlobalRS232.onData = onSocketData;
socket_GlobalRS232.onIOError = onSocketIOError;
}
function GlobalRS232(command) {
if (socket_GlobalRS232) socket_GlobalRS232.write(command + CR_GlobalRS232);
}
resetSocket();
socket_GlobalRS232.connect("192.168.1.6",4999,10000);

error is with line;

if (socket_GlobalRS232) socket_GlobalRS232.write(command + CR_GlobalRS232);

hard to read the entire error but says "socket not ready" offending line is pointing to the one listed above.
OP | Post 7 made on Wednesday August 26, 2020 at 11:46
mpg7321
Regular Member
Joined:
Posts:
June 2020
109
Think I found it. Was reading through the Denon protocol and I changed the delay from

socket_GlobalRS232.connect("192.168.1.6",4999,10000);
to
socket_GlobalRS232.connect("192.168.1.6",4999,500);

No longer getting an error

Last edited by mpg7321 on August 26, 2020 11:57.
Post 8 made on Wednesday August 26, 2020 at 13:20
Lyndel McGee
RC Moderator
Joined:
Posts:
August 2001
12,992
OK. The Socket Not ready error means you are trying to send data to a socket before it is connected.

function GlobalRS232(command) {
if (socket_GlobalRS232 && socket_GlobalRS232.connected) socket_GlobalRS232.write(command + CR_GlobalRS232);
}

The side effect to this issue is that you may now NOT send the command if the socket is not connected.
Lyndel McGee
Philips Pronto Addict/Beta Tester
OP | Post 9 made on Wednesday August 26, 2020 at 19:20
mpg7321
Regular Member
Joined:
Posts:
June 2020
109
I made the changes, now we shall see over time if its better.

FYI KODI has been working great with no errors. I have made some changes to the scripts and so far every thing is good. Now its fine tuning all the feedback I want and how to display it the way I want it. I also have it down to only looping one script while some thing is playing. Not the three I was doing before. So that I think has helped. Things like title and cover art I only need to retrieve once when the movie starts playing. I may not have the most efficient script but so far no problems.

Thanks again
Mike


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