String Converter January 19, 2023
String Converter is an application that works as a middle man between two devices trying to communicate with each other, converting the commands between them so they can understand one another. This post aims to explain how this application is setup to work after installing it on your JNIOR.
To configure StringConverter, you’ll first open a web browser and enter the in the URL your JNIOR’s IP address followed by “stringconverter”. For example, if your JNIOR’s IP address is 10.0.0.100, StringConverter’s URL in the web browser will be “10.0.0.100/stringconverter”.
After accessing StringConverter’s Web Page, the first thing you’ll need to do is setup the connection settings at the top of the page. There are two connections you are setting up: one for the device sending to the JNIOR (Server Settings), and one for device the JNIOR is sending to (Client Settings). This communication can go from Client, to JNIOR, to Server as well though.
Ethernet and Serial Connections
When settings up the connections for String Converter, you can either have a Serial connection or an Ethernet connection for the Server and Client. Serial and Ethernet connections will require different settings to connect, but will always have a field for the Termination String. So before explaining the settings of each type of connection we’ll go over the Termination String. The Termination String is used to determine when the end of a command has been reached. Termination Strings are not required, but if not entered String Converter will wait for a timeout. This means after a device has sent to a command to the String Converter application, it will wait for small amount of time and if nothing else was sent it assumes the command has been fully sent.
For the Ethernet settings, for the Server Settings only the port number value is listed, because the IP will always be the JNIOR’s IP. The port value should be set to listen for the device sending to it. (If the device is sending on port 9222, the set the server port number value to 9222) For the Client, the IP field will be there and requires the IP and port number of the device the JNIOR is sending to.
For both Server and Client Serial Settings, you only have to declare if the Serial connection is going to the AUX or COM (RS-232) port of the JNIOR.
If the device connecting to the JNIOR has specific Serial settings, you’ll need to set the JNIOR to match them. This is set on the JNIOR Web Page in the Serial I/O section under the Configuration Tab.
Lastly, when entering the connection settings for the Server and Client, fields other then the termination string can’t be left empty. This is true for both Serial AND Ethernet connections of the Server and Client, meaning if you are using a Serial connection for the Server or Client, the Ethernet settings for them cannot be left blank even while hidden. String Converter’s web page will not let you save if a field (other then the Termination String) in the Server or Client’s connections settings is left blank. Dummy data can be entered to get around this.
Once the connection settings have been entered, the next section to setup is the Conversions. In this section there are conversions from the Server to the Client, and conversions from the Client to the Server.
The arrows between the conversions indicate what the command is being converted to. For example if under Server to Client Conversions you have “test >>> testing”, that means that if the Server sends “test” to the String Converter application, it will convert it to “testing” and pass that command over to the Client.
NOTE: When making conversions, make sure a command doesn’t have multiple conversions. An example would be having one conversion be “test >>> testing” and another conversion be “test >>> tester”. StringConverter wouldn’t know which conversion to use for test because it has more then one defined, and will not save if you do this.
Hex can be entered in conversions regardless if its being sent from the Server or Client. Hex values should be formatted as \x00 for each hex value with no spaces between them.
Regex or Regular Expression, is a sequence of characters that represents a search pattern in text. Regex can be used to represent certain parts of text without specifically entering them. A good example of how this is useful is if you are trying to make conversions in StringConverter for commands that set the volume of device. If the devices range of volume is 1 – 100, and you want conversions to handle each volume level, you’d have to make one hundred conversions! To avoid that, you can use a regex pattern to represent the digit of the volume, while specifying the rest of the command that would be used to set the volume. When implementing Regex for each grouping of values, they can each be substituted in for by order. In the order they are defined in the conversion from left to right, the first grouping is represented by %1, the second by %2, the third by %3, etc. regexr.com is a good place to try out testing and understanding regular expressions if you are unfamiliar with them.
After you have defined your connection settings and conversions correctly. You’ll want to save your settings for StringConverter. Either at the bottom right or top right of the page should have a Save button. Select this, and if there are no errors in your configuration it will save. If it doesn’t save, then that means you need to look back through and make sure you have everything filled out, that no commands have multiple conversions for themselves, and that the Serial setting aren’t set to the same Serial port. After saving, the last step is to restart the StringConverter application. The easiest way to do this is by rebooting the JNIOR. This is needed to make sure the JNIOR is listening and connecting on the right connection settings. Now StringConverter should be ready to convert commands between your two devices!