A library for talking to Multi-Tech's Cellular SocketModem Devices.
Dependents: M2X_dev axeda_wrapper_dev MTS_M2x_Example1 MTS_Cellular_Connect_Example ... more
Diff: tests/passThrough.h
- Revision:
- 118:da77017d6c09
- Parent:
- 117:e59a616ffe16
- Parent:
- 116:8b58efef3528
- Child:
- 119:544578fd290c
--- a/tests/passThrough.h Tue Dec 31 22:00:53 2013 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,34 +0,0 @@ -#include "MTSSerial.h" - -using namespace mts; - -void passThrough() { - int tmp; - char buf[128]; - int size = 128; - - MTSSerial *port1 = new MTSSerial(PTC4, PTC3, 512, 512); - port1->baud(19200); - MTSSerial *port2 = new MTSSerial(PTD3, PTD2, 512, 512); - port2->baud(19200); - - wait(3); - printf("starting passthrough\n\r"); - - while (true) { - if ((tmp = port1->read(buf, size)) < 0) { - printf("read on port1 failed\n\r"); - } else if (tmp > 0) { - if ((tmp = port2->write(buf, tmp)) < 0) { - printf("write on port2 failed\n\r"); - } - } - if ((tmp = port2->read(buf, size)) < 0) { - printf("read on port2 failed\n\r"); - } else if (tmp > 0) { - if ((tmp = port1->write(buf, tmp)) < 0) { - printf("write on port1 failed\n\r"); - } - } - } -} \ No newline at end of file