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.
Diff: lwip/TCPItem.cpp
- Revision:
- 0:439354122597
diff -r 000000000000 -r 439354122597 lwip/TCPItem.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lwip/TCPItem.cpp Wed Mar 17 03:17:38 2010 +0000 @@ -0,0 +1,30 @@ +#include "TCPItem.h" + +using namespace std; +using namespace mbed; + +void TCPItem::abort() const { + tcp_abort(this->_pcb); +} + +void TCPItem::release_callbacks() const { + tcp_arg(this->_pcb, NULL); + tcp_sent(this->_pcb, NULL); + tcp_recv(this->_pcb, NULL); + tcp_poll(this->_pcb, NULL, 255); + tcp_accept(this->_pcb, NULL); + tcp_err(this->_pcb, NULL); +} + +err_t TCPItem::close() { + err_t err = tcp_close(this->_pcb); + this->_pcb = NULL; + return err; +} + +void TCPItem::open() { + if(!this->_pcb) { + this->_pcb = tcp_new(); + tcp_arg(this->_pcb, this); + } +}