![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Control of mbed using OSC. Based on code from the Make Controller. Right now you can turn the onboard LEDs on/off and toggle 8 digital out pins. More I/O will be done in the future.
lwip/TCPItem.cpp@0:439354122597, 2010-03-17 (annotated)
- Committer:
- pehrhovey
- Date:
- Wed Mar 17 03:17:38 2010 +0000
- Revision:
- 0:439354122597
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
pehrhovey | 0:439354122597 | 1 | #include "TCPItem.h" |
pehrhovey | 0:439354122597 | 2 | |
pehrhovey | 0:439354122597 | 3 | using namespace std; |
pehrhovey | 0:439354122597 | 4 | using namespace mbed; |
pehrhovey | 0:439354122597 | 5 | |
pehrhovey | 0:439354122597 | 6 | void TCPItem::abort() const { |
pehrhovey | 0:439354122597 | 7 | tcp_abort(this->_pcb); |
pehrhovey | 0:439354122597 | 8 | } |
pehrhovey | 0:439354122597 | 9 | |
pehrhovey | 0:439354122597 | 10 | void TCPItem::release_callbacks() const { |
pehrhovey | 0:439354122597 | 11 | tcp_arg(this->_pcb, NULL); |
pehrhovey | 0:439354122597 | 12 | tcp_sent(this->_pcb, NULL); |
pehrhovey | 0:439354122597 | 13 | tcp_recv(this->_pcb, NULL); |
pehrhovey | 0:439354122597 | 14 | tcp_poll(this->_pcb, NULL, 255); |
pehrhovey | 0:439354122597 | 15 | tcp_accept(this->_pcb, NULL); |
pehrhovey | 0:439354122597 | 16 | tcp_err(this->_pcb, NULL); |
pehrhovey | 0:439354122597 | 17 | } |
pehrhovey | 0:439354122597 | 18 | |
pehrhovey | 0:439354122597 | 19 | err_t TCPItem::close() { |
pehrhovey | 0:439354122597 | 20 | err_t err = tcp_close(this->_pcb); |
pehrhovey | 0:439354122597 | 21 | this->_pcb = NULL; |
pehrhovey | 0:439354122597 | 22 | return err; |
pehrhovey | 0:439354122597 | 23 | } |
pehrhovey | 0:439354122597 | 24 | |
pehrhovey | 0:439354122597 | 25 | void TCPItem::open() { |
pehrhovey | 0:439354122597 | 26 | if(!this->_pcb) { |
pehrhovey | 0:439354122597 | 27 | this->_pcb = tcp_new(); |
pehrhovey | 0:439354122597 | 28 | tcp_arg(this->_pcb, this); |
pehrhovey | 0:439354122597 | 29 | } |
pehrhovey | 0:439354122597 | 30 | } |