The Glassmark lens encoders can be operated in a wired USB mode. This enables developers to access encoder values and use the device with their own systems.
Wired communication is done through the USB port on the encoder. The encoder will enumerate as a USB CDC communication device. The serial settings are as follows:
Baud Rate: 115200 Data Bits: 8 Parity Bits: 0 Stop Bits: 1
In order to activate wired mode, the boot sequence must be interrupted. Once connected, the encoder will send a serial packet with the following string:
"######"
Once the encoder sends this packet, the host device will have a window of two seconds to interrupt the boot. Any serial data received in this two second window will enable wired mode.
Once in wired mode, the following commands may be used:
$g : Gets device current status.
A Glassmark II will respond with a JSON string of the following format
{"cam":"\"A\"","num":"\"2\"","pos":1234}
Where 'cam' is the current camera assignment, 'num' is the current encoder slot, and 'pos' is the position of the encoder.
A Glassmark II will send the current value as an int followed by a newline operator.
$w[int] : Writes a new encoder value to the device. An integer after the 'w' will become the new encoder position. Ex: $w12345 Only for Glassmark I.
$s : Toggles data streaming mode. In streaming mode, the device will send data automatically when the encoders position changes. The device will respond with a JSON string of the following format
{"cam":"\"A\"","num":"\"2\"","pos":320}
Where 'cam' is the current camera assignment, 'num' is the current encoder slot, and 'pos' is the position of the encoder. Only for Glassmark I.
$c[char] : Sets the encoders assigned camera letter. Currently supported letters are A-D, or 0 for unassigned. Ex: $cA
Letters must be capitalized. This value is retained through power cycles. Only for Glassmark I.
$n[int] : Sets the encoders assigned slot number. Currently supported numbers are 1-3, or 0 for unassigned. Ex: $n2
This value is retained through power cycles. Only for Glassmark I.
$b : Toggles blackout mode. In blackout mode, all LEDs on the encoder will be turned off. Only for Glassmark I.