Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of jro by
Diff: JroEthernet.cpp
- Revision:
- 3:f0e6c145b075
- Parent:
- 2:3d8d52e9751c
- Child:
- 4:de495ce256b8
diff -r 3d8d52e9751c -r f0e6c145b075 JroEthernet.cpp
--- a/JroEthernet.cpp Thu Feb 05 19:01:42 2015 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,93 +0,0 @@
-#include "JroEthernet.h"
-
-JroEthernet::JroEthernet(EthernetInterface *eth_)
-{
- this->eth = eth_;
-}
-
-int JroEthernet::init(char *ip, char *mask, char *gateway)
-{
- int status = -1;
- // ETHERNET
- //screen->putc(0x36);
- //screen->putc(0x30);
-
- //status = this->eth->init();
- status = this->eth->init(ip, mask, gateway);
- //__screen.printf("\r\nIP Address is %s %d\r\n", eth.getIPAddress(), status);
- this->eth->setName(DEVICE_NAME);
- //screen->putc(0x36);
- //screen->putc(0x31);
-
- while(true){
-
- status = this->eth->connect(5000);
- if (status == 0)
- break;
- Thread::wait(500);
- status = this->eth->disconnect();
- }
-
- //screen->putc(0x36);
- //screen->putc(0x32);
-
- return 1;
-}
-
-int JroEthernet::changeIp(char *ip, char *mask, char *gateway)
-{
- return this->eth->setNewAddr(ip, mask, gateway);
- //screen.printf("\r\nIP Address is %s %d\r\n", eth.getIPAddress(), status);
-}
-
-int JroEthernet::openTCPServer(TCPSocketServer *server, int server_port)
-{
- server->bind(server_port);
- server->listen(1);
-
- this->server = server;
- this->rx_buffer = rx_buffer;
-
- return 1;
-}
-
-int JroEthernet::read(char* rx_buffer)
-{
- TCPSocketConnection client;
- int n, totalSize=0;
-
- this->server->accept(client);
-
- client.set_blocking(false, 1500); // Timeout after (1.5)s
-
- //__screen.printf("Connection from: %s\r\n", client.get_address());
-
- while (true) {
- n = client.receive(rx_buffer, sizeof(rx_buffer));
- if (n <= 0) break;
- totalSize += n;
- Thread::wait(200);
- }
-
- this->client = &client;
-
- if (totalSize > 5)
- return 1;
-
- return 0;
-}
-
-int JroEthernet::sendResponse(char *tx_buffer, int buffer_size)
-{
- this->client->send(tx_buffer, buffer_size);
-
- return 1;
-}
-
-int JroEthernet::closeClient()
-{
- this->client->close();
-
- return 1;
-
-}
\ No newline at end of file
