User Tools

Site Tools


Simple Commands

The chapter before describes the general conditions to create a new driver. Based on this, we proceed with the SOLOIST 2 player example and integrate some simple commands. To do that, launch the device editor via main menu Configure → Edit Devices and select the device GenericDevice_1.

The two commands OnData and SendString are not used and should be deleted. To do that click on the command and then click on Delete Cmd (see screenshot)

As explained in the chapter before, each command for the SOLOIST 2 player need at least one parameter - the name of the device. The “*” character is used as a universal name and every SOLOIST accept this sign as his name. Because the SOLOIST name concern the device and not the command it is implemented as device parameter. In the field DP1 Name enter “Name” as identifier and “*” in the field DP1 Default. To add this parameter to the device click Update Device. More information about parameters is found in the Parameter Chapter.

The first command we implement is the STOP command. As explained in the chapter before the command string looks like this: “* STOP” + Chr(13). As feedback (Acknowledge) the SOLOIST 2 send “OK”+Chr(13)+Chr(10)+Chr(13)+Chr(10).

To implement the command follow the instructions in the screenshot.

1. The command name: Because the command is a Stop command the name is obvious. In V-Control command names are used as function calls. Therefore names like GoTo, Exit or Sub are illegal, because they are Basic functions respectively reserved keywords. If one of those reserved words is used, the compiler generates a compiler error while compiling the script.

2. The number serves as sort criterion in the command list.

3.The TabID determines if the command appears in the list of commands or events. If left blank, it appears nowhere. Why this make sense becomes clear in the chapter Acknowledge Commands.

4. The source code of the command. The variable ScriptResult has a special job. It contains the command string, that is sent via channel to the device. This means that the variable ScriptResult must contain a string that causes a Stop command for the Adtec player. The line ScriptResult = DP1 + “ STOP” + Chr(13) assigns parameter DP1 to ScriptResult. DP1 is the first of two available device parameter and contains in this case the name of the SOLOIST. Totally up to six parameter (DP1,DP2,P1,P2,P3,P4) are available, but this time we use only DP1. Then a space character followed by STOP (“ STOP”) is added. The Chr function converts an Integer value to ASCII code. The SOLOIST 2 expect a Carriage Return (ASCII code 13) as terminating character which is added by the Chr function. Now the command string is complete.

5. The command timeout in milliseconds. If there is no response (Acknowledge) within this time, a Timeout message is created.

The Timeout leads to the question, how V-Control knows if, respectively when, an Acknowledge is present. That tells the field Ack in Hex: Here the expected response is entered. The screenshot below shows that the string “OK” is expected. But V-Control needs the string as hexadecimal values.

This problem solves the button To Hex, which converts an ASCII String to hex code.

But the SOLOIST 2 not only send “OK” as Acknowledge. There are also the ASCII codes 13,10,13 and 10 added. So we have to append these codes (in hex) too.

The first command is complete and a click on the button Add Cmd save the command. Because V-Control compiles the script, we have to click the Compile button. If there is an error, the compiler posts a compiler error, otherwise the device is usable now. To do that, close the Device Editor and select the Device GenericDevice_1 again (see screenshot below). The Stop command now appears in the command list. The device parameter Name has the “*” character as default value. Alternatively we can use the real SOLOIST 2 name, e.g. “SOLOIST”.

If the command is working it is recommended to save the project. Until now, the driver exists only in the project file (“soloist_test.vc3” in this example), and this file contains all the work we did. If the driver is complete, we will export it and then import it to the device database. To complete the driver we start the Device Editor via main menu Configure → Edit Devices again. The table below shows the remaining simple commands for the SOLOIST 2 player. Proceed in the same way as we did with the Stop command.

Name Position TabID Timeout Script Ack in Hex
Play 11 Comands 500 Scriptresult = DP1 + “ PLAY” + chr(13) 4F4B0D0A0D0A
Next_Clip20 Comands 500 Scriptresult = DP1 + “ NEXT” + chr(13) 4F4B0D0A0D0A
Prev_Clip21 Comands 500 Scriptresult = DP1 + “ PREVIOUS” + chr(13) 4F4B0D0A0D0A
Still 22 Comands 500 Scriptresult = DP1 + “ PAUSE” + chr(13) 4F4B0D0A0D0A
Rewind 23 Comands 500 Scriptresult = DP1 + “ REWIND” + chr(13) 4F4B0D0A0D0A

The result should look like this:

Finally click the Compile button and test the driver.

simple_commands.txt · Last modified: 2013/08/19 10:03 by admin