Skip to content

Device Simulator Project

Robert Christensen edited this page Mar 5, 2014 · 1 revision

Rationale

We need a program that will enable local testing of cmdr. Instead of deploying to an actual remote cmdr box every time we make a change, we should just be able to run cmdr on our development machines, and expect it to behave just like it would if it were running on a computer connected to actual projectors and switchers.

We also need to be able to develop device drivers for devices that we don't even have. As long as we have the complete RS232 Specifications for a given model of a device, we should be able to simulate exactly how an actual device behaves, and thus write a working driver for it without ever touching the device.

The way to accomplish this is to write a program in Ruby that simulates the behavior of a projector communicating with cmdr on a serial device terminal such as /dev/ttys1. This project will run as a separate process external from cmdr. It will set up a pseudo terminal whose slave roomtrol-daemon will connect to (for example, /dev/pts/5 ). Thus it will "pretend" to be the projector to which roomtrol-daemon normally connects.

To Start

Understand Linux devices.

Understand Linux terminals and pseudo terminals and the difference between the two.

Play with minicom to see how cmdr interacts with devices.

Helpful Links

http://linux.die.net/man/4/ptmx

http://www.ruby-doc.org/stdlib-1.9.3/libdoc/pty/rdoc/PTY.html#method-c-getpty

Example usage

$ ./simulator --device_class EpsonProjector

Slave is on: /dev/pts/5 Master is on: /dev/ptmx/7 Slave: PWR=ON Master: OK Slave: PWR? Master PWR=01

*Note: this may not be what an actual conversation looks like