From 46a1cf6f06876efebbf789955f2689c1573f37ad Mon Sep 17 00:00:00 2001 From: Cristian Maglie Date: Thu, 4 Jul 2013 17:39:14 +0200 Subject: [PATCH] YunServer: added write() method --- hardware/arduino/avr/libraries/Bridge/YunServer.cpp | 6 ++++++ hardware/arduino/avr/libraries/Bridge/YunServer.h | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/hardware/arduino/avr/libraries/Bridge/YunServer.cpp b/hardware/arduino/avr/libraries/Bridge/YunServer.cpp index f23566a2f..3473ce8d9 100644 --- a/hardware/arduino/avr/libraries/Bridge/YunServer.cpp +++ b/hardware/arduino/avr/libraries/Bridge/YunServer.cpp @@ -46,3 +46,9 @@ YunClient YunServer::accept() { return YunClient(res[0]); } +size_t YunServer::write(uint8_t c) { + uint8_t cmd[] = { 'b', c }; + bridge.transfer(cmd, 2); + return 1; +} + diff --git a/hardware/arduino/avr/libraries/Bridge/YunServer.h b/hardware/arduino/avr/libraries/Bridge/YunServer.h index 734392414..69fdeabbc 100644 --- a/hardware/arduino/avr/libraries/Bridge/YunServer.h +++ b/hardware/arduino/avr/libraries/Bridge/YunServer.h @@ -32,7 +32,7 @@ public: void begin(); YunClient accept(); - virtual size_t write(uint8_t c) { /* TODO */ } + virtual size_t write(uint8_t c); void listenOnLocalhost() { useLocalhost = true; } void noListenOnLocalhost() { useLocalhost = false; }