Skip to content
Aqueous edited this page Feb 23, 2012 · 15 revisions

#Device Simulator Project

Rationale

We need a program that will enable local testing of roomtrol-daemon. Instead of deploying every time we make a change to an actual remote Roomtrol box, we should just be able to run Roomtrol 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 roomtrol-daemon on a serial device terminal such as /dev/ttys1. This project will run as a separate process external from roomtrol-daemon. 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 roomtrol-daemon interacts with devices.

Helpful Links

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

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

Deadline

April 15, 2012 at noon