MLGenericSerial Plugin

From Cinemar Wiki
Jump to: navigation, search

Allows for sending data over the serial port to control serial devices 1) Extract dll to Program Files\MLServer\MLGenericSerial.dll 2) Register MLGenericSerial.dll 3) Extract mdb to Program Files\MLServer\data

ML Multi Device Generic Serial Plugin

To Install

1. STOP MLServer 2. If you have the old MLGenericSerial.DLL file then unregister it (RegSvr32 MLGenericSerial.dll /u) 3. Copy/Overwrite the MLGenericSerial.dll to your MLServer\Plugin folder 4. Register MLGenericSerial.dll (RegSvr32 MLGenericSerial.dll) 5. Copy the GenericSerial.XML file to you MLServer\Data folder

Start up MLServer and do settings on MLGeneric serial. It is important to verify if the new system kept all the information from the old MLGenericSerial. System no longer uses the serial_mapping.mdb file but instead will create a MyConfig.XML file in the data folder.

Any comments or requests can be sent to

Current Revision: RC1.A - To be tested: Multiple devices - To be tested: Complicated and large HEX protocol. This would be more about testing my saving and loading of binary data from XML files. Involves a lot of Base64 encode/decode. - To be tested: Learn Command in the Commands popup. I wanted to give you guys the capability of teaching the plugin new commands. This means as a user you can have it listen to the output from the hardware and create the signature of your command. - To be Coded: Haven't yet coded the COMMAND testing. I will do that soon and send over a new version. Shouldn't have any effect on the actual pluggin

Protocol Definition


The MLGenericSerial plugin understands SEND command. It can take up to 2 parameters

Parameter 1 => Command to send to the SerialPort

Parameter 2 => DeviceName or Number (same as tabs **tab1 = 1, tab2 = 2) to send the command to

Example: MLGenericSerial|Send~Start~Device4

This command will send "Start" to the 4th device

This command can also be represented as: MLGenericSerial|Send~Start~4


The MLGenericSerial plugin understands SendMap command. This allows you to create human understandable commands that are interpreted and send the a machine-readable command to the hardware.

For example, if powering on the device on tab 1 requires sending it the string "0230303003" then you could do it two ways.

1. Using the Send command: MLGenericSerial|Send~0230303003~1

2. Create a mapped command called PowerOn, using 0230303003 as the Incoming Value, and MLGenericSerial|SendMap~PowerOn~1 as the MLServeCommand to Run.


Wildcard is the capability of defining a partial fingerprint for a command and when that partial match is found to execute it. To answer the immediate question, yes you can wildcard match multiple commands in one shot (1*B*, 1*C* will execute both commands when the device sends 1ABCDEF).

Protocol for wildcard is <<[*,#,x],[&]>> Where * = String Value # = Ascii Value x = HEX Value & = Wildcarded value

So in this example

Mapped command = 02 2A 03 (HEX) or �*� in (ASCII) Device transmits = 02 30 03 (HEX) or �0� (ASCII)

Doing MLServerCmd.SetVariable|Sound~<<*1>> would give us Sound = 0 Doing MLServerCmd.SetVariable|Sound~<<#1>> would give us Sound = 48 Doing MLServerCmd.SetVariable|Sound~<<x1>> would give us Sound = 30

Imagine a mapped command = 02 2A 2B 2A 2C 2A 03 (HEX) or �*+*,*� in ASCII Device transmits 02 30 2B 30 2C 30 03 (HEX) or �0+0,0� in ASCII

Doing MLServerCmd.SetVariable|Sound~<<*1>> != <<#2>> != <<x3>> would give us Sound = 0 != 48 != 30

You can also do arithmetic operations on the wildcarded part of the command. Doing <<*1 + 10>> would in our previous sample produce Sound = 10

Supported arithmetic operators are [+ - * /]. You may also do string concatenations by doing <<*1 & "is my favorite number">> So in our sample Sound would equal [0 is my favorite number]

A real world example

A piece of hardware that submits variable updates on the sound as it is being changed.

Protocol from hardware = 1026XX where XX is the HEX value of the current sound 10262B, 10262C, 1062D etc...

As a user 2B means jack s**t but Sound = Level5 makes sense. So how do I go about setting a variable to 5.

So if in our sample protocol sound level 0 = 0x26 or ASCII 38 then we could do Sound~<<#1-38>> which gives us Sound~5 for 2B

Represented in MLGeneric serial protocol it would be a new command

Incoming: 1062* Command: MLServCmd.SetVariable|Sound~<<#1-38>>

Additional Info:

The plugin can create a log file (same folder as the dll file) that will contain additional information that might be useful during debugging. An example of such information is with the learn command. The learn command will listen to the port and just append whatever is being sent to it by the hardware. It will in log every value and ascii of each character received. This will allow you to figure out the protocol of whatever it is you're trying to learn. To activate this feature, go to the main window and in the Debug menu select Debug Log.