This Community site is new! Please help us build a community around the JNIOR.
Sign up, and help share your knowledge. Please sign-up even if you do not plan to post as a sign of support.
If there is evidence of a demand we will continue to develop the content here.

Identifying a Specific JNIOR

You got ideas? Let's hear 'em. Here we can talk about your experiences programming on the JNIOR or items that you may wish to have INTEG assist you with.
Post Reply
bscloutier
Posts: 401
Joined: Thu Sep 14, 2017 12:55 pm

Identifying a Specific JNIOR

Post by bscloutier » Tue Nov 14, 2017 10:47 am

It can get interesting when you have several JNIORs and need to physically find the one assigned a specific IP address. If each has a different purpose you can likely easily tell them apart by their application. It is not always so simple.

If you are running the Support Tool you can right-click the unit under the Beacon tab. The Query->Identify option will cause the unit's orange Status LED to flash rapidly for a brief period and you can see which unit it is. This works well if the unit is nearby. From experience for a more remote unit the Identify feature flashes long enough for you to jump up and run but not far.

Some people refer to the orange Status LED as the "heartbeat" LED. This is because it flashes periodically when there is an active JNIOR Protocol connection. With the Series 3 the JNIOR Protocol was the only way to remotely monitor and control your JNIOR. Many cinema systems maintained a constant connection and thereby kept the Status LED busy. The JNIOR Protocol is still supported by the Series 4 and many systems still use it but it is considered to be Deprecated. That is to say that we recommend use of the Websockets Interface now for that purpose and much more. So as a result the orange Status LED is much less of an indication of life as perhaps it once was.

Some applications like MODBUS may also periodically and purposely flash the Status LED. An application program has access to that LED. That seems logical but you probably didn't realize that JANOS knows Morse Code.

bscloutier
Posts: 401
Joined: Thu Sep 14, 2017 12:55 pm

Re: Identifying a Specific JNIOR

Post by bscloutier » Tue Nov 14, 2017 11:43 am

For most locations the last octet of the IP address is sufficient to completely identify a unit. Here is a simple little program that when run on the JNIOR will display the last octet of a unit's IP address in Morse Code using the orange Status LED. Since most of us are not quick at copying Morse I have this repeating the number 3 times.

package ident;

import com.integpg.system.JANOS;
import java.net.InetAddress;

public class Ident {

    public static void main(String[] args) throws Throwable {
        
        int octet = InetAddress.getLocalHost().getAddress()[3];
        JANOS.morseStatusLED(Integer.toString(octet), 3);
        
    }
    
}

Naturally in testing this simple example I find that JANOS has the digit '9' improperly coded (missing one long dash). This Morse Code feature hasn't been promoted to this point and so no one (apparently) has noticed. Anyway it has been corrected for the v1.6.3 JANOS release. My bad.

You can display just about anything that you might be able to read back. Here's the a Morse Code reference sheet for you. This is from the Wiki.
Attachments
1200px-International_Morse_Code.svg.png
1200px-International_Morse_Code.svg.png (29.02 KiB) Viewed 584 times

bscloutier
Posts: 401
Joined: Thu Sep 14, 2017 12:55 pm

Re: Identifying a Specific JNIOR

Post by bscloutier » Tue Nov 14, 2017 11:50 am

Now you can get your JNIOR to identify itself on boot. Just add the following Registry Key.
Run/Ident = /flash/ident.jar
You need to have placed the ident.jar file for this program in the /flash folder. With the program there all you need to type at the command line is ident and the following Registry Run key also works.
Run/Ident = ident
Now this will only run once on boot and terminate. So to identify a JNIOR you would have the reboot it. If you are physically at the JNIOR there are two ways to do that. Most people will pull the power, wait a second, and restore it. That works although the new 412DMX with ride-thru power supply technology doesn't reboot unless you want 20 seconds. Another way is to apply a jumper temporarily. That goes in the little hole between the LAN connector and the RS-232 COM port. You can also connect to the COM port but then you can just use IPCONFIG to identify the unit.

You can get a few Reset Switches from Amazon for a few bucks. Search "Power Swtch pc" or something similar. The two-pin header is on 0.200" centers and compatible with a reset switch from any old desktop. It looks like this.

2017-11-14_12-09-51.png
2017-11-14_12-09-51.png (36.5 KiB) Viewed 584 times

bscloutier
Posts: 401
Joined: Thu Sep 14, 2017 12:55 pm

Re: Identifying a Specific JNIOR

Post by bscloutier » Tue Nov 14, 2017 12:42 pm

Here's a neat little trick. Let's have our unit signal its IP Address on the quarter hour. So every 15 minutes we will signal the octet synchronized with the top of the hour.

package ident;

import com.integpg.system.JANOS;
import com.integpg.system.Timebase;
import java.net.InetAddress;

public class Ident {

    public static void main(String[] args) throws Throwable {

        // Infinite loop
        for (;;) {

            // Signal the last octet of our IP Address
            int octet = InetAddress.getLocalHost().getAddress()[3];
            JANOS.morseStatusLED(Integer.toString(octet), 3);
            
            // Signal on the quarter hour
            long delay = 900000 - Timebase.currentTimeMillis() % 900000;
            System.sleep(delay);
            
        }
        
    }
    
}

Here we set the program into an infinite loop. We want to sleep between signalling so as to not consume valuable CPU time. So Line 19 gets the time in milliseconds since 00:00:00 January 1, 1970 (Unix Epoch) and takes the Modulus 900,000. That's 15 minutes in milliseconds. We calculate the required delay as the amount of milliseconds left until the next quarter hour. Then we simply sleep and repeat.

Note that this program uses my favorite little trick for avoiding the need for try-catch clauses when developing. I include throws Throwable in the main() method declaration.

If an exception occurs it will be uncaught and will be issued to the errors.log file for later review. That would stop the program. If I were concerned about that I could implement the Watchdog class.

bscloutier
Posts: 401
Joined: Thu Sep 14, 2017 12:55 pm

Re: Identifying a Specific JNIOR

Post by bscloutier » Tue Nov 14, 2017 12:51 pm

Here's the JAR for this. Place this in your /flash folder and add the Registry Run key from the post above. You can then reboot the unit to get it started. Or you can issue the following command from the Command Line.
ident &
A trailing '&' on the command line when running a program causes the program to run in the background allowing the prompt to come right back. JANOS starts another process for the program and lets it go.
412dmx_r00 /> ps -v
      runtime       mem  hnd stk frm     id    desc
       57:11.278                          0: Idle Process
           4.429    2.6K   7  12          1: Network Service
           6.357    1.4K   7  17          2: System
        1:45.603   75.6K   9  22          4: Web Server
           0.677   34.8K   7  12          5: Console/10.0.0.20:53301
           0.770   21.2K   7  24   3      6: Console/10.0.0.20:53301/ident
6 total       59:09.743 uptime

412dmx_r00 />
Attachments
Ident.java
(662 Bytes) Downloaded 28 times
ident.jar
(1.55 KiB) Downloaded 28 times

bscloutier
Posts: 401
Joined: Thu Sep 14, 2017 12:55 pm

Re: Identifying a Specific JNIOR

Post by bscloutier » Tue Nov 14, 2017 12:53 pm

If you use one of our Control Panels with the JNIOR, have you noticed that the green LED on the PCB in back also displays Morse Code?

bscloutier
Posts: 401
Joined: Thu Sep 14, 2017 12:55 pm

Re: Identifying a Specific JNIOR

Post by bscloutier » Tue Nov 14, 2017 1:32 pm

So then I thought... If you want to find out an IP Address for the unit you could walk up and disconnect the LAN. Everything should recover when you replace it. Meanwhile our program could detect that and signal its IP Address. That could repeat kind of like and error signal. Here's the modified program.

package ident;

import com.integpg.system.JANOS;
import com.integpg.system.Network;
import java.net.InetAddress;

public class Ident {

    public static void main(String[] args) throws Throwable {

        // Infinite loop
        for (;;) {
            
            // Wait for network disconnect
            while (Network.isActive() || JANOS.isbusyStatusLED())
                System.sleep(5000);

            // Signal the last octet of our IP Address
            int octet = InetAddress.getLocalHost().getAddress()[3];
            JANOS.morseStatusLED(Integer.toString(octet), 3);
            
        }
        
    }
    
}

Now since on boot it takes a moment for the network to negotiate you will likely still see the IP Address signal.

Okay, this is all well and good except the Network.isActive() check only indicates whether or not the network has been detected and initially successfully negotiated. I would like it to indicate whether or not the network connection is Established. You can see that with the NETSTAT command. So this did not work. I disconnected the network it is wasn't detected.

So I changed the flag. That's the advantage when you are the author of the OS. The Network.isActive() check will work as before and it will return False when you disconnect. Now this program works. If do you want to use this program it is just another reason to update to v1.6.3 JANOS (I mean beyond the fact that the number '9' was wrong - ugh).
Attachments
Ident.java
(658 Bytes) Downloaded 30 times
ident.jar
(1.55 KiB) Downloaded 29 times

bscloutier
Posts: 401
Joined: Thu Sep 14, 2017 12:55 pm

Re: Identifying a Specific JNIOR

Post by bscloutier » Tue Nov 14, 2017 1:35 pm

If you have any other idea where this Morse Code feature would come in handy let me know. Now you can add it to your error handlers.

Post Reply