Skip to content

This is an implementation that simulates an XPORT hardware ethernet interface in ruby. It allows a programmer to stub out the real hardware unit to enable rapid prototyping.

License

ezodude/xport-sim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This is an implementation of an XPORT hardware ethernet interface in ruby.
It allows a programmer to stub out the real hardware unit to enable rapid prototyping.

The XportSimulator simulates an XPORT to allow network/web connectivity using commands received from a serial port interface.

XPORT HTTP Request/Response Serial Protocol:

- Connect: C<IP ADDRESS>/<PORT NO>\n
  Returns 'C' to communicate a connection has been established.
  example: C82.165.199.35/80\n -> 'C'
  
- Do Http Request: GET <HTTP PATH minus Host Name> <HTTP PROTOCOL VERSION>\n
  example: GET /~myaccount/scraper.php HTTP/1.0\n

Serial Notifications:

- 'D': Disconnected - connection with the server has been lost.
- 'C': Connection Established - a connection with the server has been established.

----

This class depends on both the net/telnet library and the ruby-serialport gem.
Unfortunately, the ruby-serialport gem is NOT yet Ruby 1.9 compatible.
As such this code is also NOT yet Ruby 1.9 compatible.

----

Here's how to start listening to incoming serial port messages:

Set Serial port:
SERIAL_PORT = "/dev/tty.usbserial-A7007cvp"

Set a Baud Rate:
ex. of BAUD_RATE = 9600 # bits per sec

XportSimulator.new(SERIAL_PORT_ID, BAUD_RATE).listen

About

This is an implementation that simulates an XPORT hardware ethernet interface in ruby. It allows a programmer to stub out the real hardware unit to enable rapid prototyping.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages