SPP Studio
From SpinetiX Support Wiki
This page is related to Hyper Media Director software.
Description
The Serial Port Protocols Studio application allows testing serial port protocol files on a PC, directly connected to the appliance (for instance, a screen). Although it does not feature an editor for the protocol file itself (you need an external XML editor for that), it should help in debugging protocol files and testing that the appliance behaves as expected when the commands are sent.
The SPP Studio application is included by default in the installer of the Hyper Media Director software; after installation, the application can be found in the SpinetiX folder in the Start menu of Windows.
The SPP Studio application is not present in the Elementi software, as it was discontinued, along with the Hyper Media Director software.
Getting started
In order to work with protocol files, you need to perform the following operations:
- Make sure that your RS232 port settings are correct.
- The "Settings" button (top menu, right side) is used to configure the speed and the various options for the transmission on the RS232 port. The default settings should work with most appliances.
- Open your protocol file using the Open button.
- Start the finite state machine using the Run button. Now SPP Studio is ready to send commands to your appliance.
Sending Commands
Depending on your protocol file, a different set of commands will be shown in the SPP Studio interface - a button is added for each <onStart>
element present inside the "start" state element.
For instance, the following file will lead to the set of commands shown in the image on the right:
<state xml:id='start' desc='Start command'>
<onStart command='PowerOn' goto='transmit_poweron' />
<onStart command='PowerOff' goto='transmit_poweroff' />
<onStart command='MuteOn' goto='transmit_muteon' />
<onStart command='MuteOff' goto='transmit_muteoff' />
<onStart command='SelectInput' goto='select_input_start'>
<set var='Input' to='$PARAM1'/>
</onStart>
<onStart command='SetVolume' goto='transmit_vol'>
<set var='Volume' to='%d{$PARAM1*60/100}'/>
</onStart>
</state>
Pressing any button is equivalent to sending the command using the sendComPort() JavaScript command on the HMP.
For instance:
- The PowerOn button is equivalent to the execution of the following script
sendComPort("monitor", "PowerOn");
. - The SetVolume button with a value of 50 in the first parameters text box is equivalent to the execution of the following script
sendComPort("monitor", "PowerOn", 50);
.
Advanced debugging
With SPP Studio you can see the characters which are sent and received on the RS232 interface. The dialog between the PC and the appliance is shown just under the parameters input area. The characters sent to the appliance are shown in blue, while the ones received from the appliance are shown in italic black. Non-printable characters are shown using their character code, i.e. 
 means character 13, end of line (\n).
The example in the snapshot shows the dialog between the PC and a Sharp Aquaos when the user presses the MuteOn, MuteOff and SetVolume button (with an input of 50 for the volume).
- The mute on command is sent (MUTE0001\n), and the screen replies that the settings have been modified as expected (OK\n).
- The mute off command is sent (MUTE0002\n), and the screen replies that the settings have been modified as expected (OK\n).
- The volume command is sent (VOL0030\n), and the screen replies that the settings have been modified as expected (OK\n). Note that the Sharp Aquos expects a volume between 0 and 60, whereas we have defined in the protocol file that the volume was between 0 and 100. Thus the value of 50 has to be converted to 30 when sent to the screen using the set command in the protocol file:
<set var='Data' to='%d{$PARAM1*60/100}'/>
It is possible to increase the logging level of the finite state machine to indicate exactly what is happening during the exchange. To do so, change the "Log Level" setting from "Info" to "Trace". The debugging mode will indicate all the steps taken by the finite state machine to send and receive information from/to the appliance.
For instance, the effect of the "SetVolume" command is shown in the snapshot image.
- The finite state machine starts with the state ‘start’.
- The command SetVolume is received.
- The variables ‘Command’ and ‘Data’ are set respectively to ‘VOLM’ and ‘30’.
- The FSM moves to the state transmit and sends the ‘VOLM0030\n’ characters.
- The FSM receives ‘OK\n’ from the screen and thus moves from the ‘transmit’ state back to the ‘start’ state, ready to receive new commands.