Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
cassy73 authored Dec 29, 2016
1 parent e0fa0c4 commit e9f3fa0
Show file tree
Hide file tree
Showing 8 changed files with 51 additions and 34 deletions.
2 changes: 1 addition & 1 deletion Dns.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ uint16_t DNSClient::BuildRequest(const char* aName)
}


uint16_t DNSClient::ProcessResponse(uint16_t aTimeout, IPAddress& aAddress)
int16_t DNSClient::ProcessResponse(uint16_t aTimeout, IPAddress& aAddress)
{
uint32_t startTime = millis();

Expand Down
2 changes: 1 addition & 1 deletion Dns.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class DNSClient

protected:
uint16_t BuildRequest(const char* aName);
uint16_t ProcessResponse(uint16_t aTimeout, IPAddress& aAddress);
int16_t ProcessResponse(uint16_t aTimeout, IPAddress& aAddress);

IPAddress iDNSServer;
uint16_t iRequestId;
Expand Down
2 changes: 1 addition & 1 deletion UIPClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ UIPClient::write(const uint8_t *buf, size_t size)
return _write(data, buf, size);
}

size_t
int16_t
UIPClient::_write(uip_userdata_t* u, const uint8_t *buf, size_t size)
{
#if ACTLOGLEVEL>=LOG_DEBUG_V3
Expand Down
21 changes: 12 additions & 9 deletions UIPClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,12 @@

#include "ethernet_comp.h"
#if defined(ARDUINO)
#include "Print.h"
#include "Client.h"
#include "Print.h"
#include "Client.h"
#endif
#if defined(__MBED__)
#include "mbed/Client.h"
#include "mbed/Print.h"
#include "mbed/Client.h"
#endif
#include "utility/mempool.h"
#include "utility/logging.h"
Expand Down Expand Up @@ -66,8 +67,12 @@ typedef struct {
#endif
} uip_userdata_t;

class UIPClient : public Client {

#if defined(ARDUINO)
class UIPClient : public Client {
#endif
#if defined(__MBED__)
class UIPClient : public Print, public Client {
#endif
public:
UIPClient();
virtual int connect(IPAddress ip, uint16_t port);
Expand All @@ -86,9 +91,7 @@ class UIPClient : public Client {
virtual int peek();
virtual void flush();

#if defined(ARDUINO)
using Print::write;
#endif
using Print::write;

private:
UIPClient(struct uip_conn *_conn);
Expand All @@ -99,7 +102,7 @@ class UIPClient : public Client {
static uip_userdata_t all_data[UIP_CONNS];
static uip_userdata_t* _allocateData();

static size_t _write(uip_userdata_t *,const uint8_t *buf, size_t size);
static int16_t _write(uip_userdata_t *,const uint8_t *buf, size_t size);
static int _available(uip_userdata_t *);

static uint8_t _currentBlock(memhandle* blocks);
Expand Down
23 changes: 14 additions & 9 deletions UIPServer.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,24 +21,29 @@

#include "ethernet_comp.h"
#if defined(ARDUINO)
#include "Server.h"
#include "Print.h"
#include "Server.h"
#endif
#if defined(__MBED__)
#include "mbed/Server.h"
#include "mbed/Print.h"
#include "mbed/Server.h"
#endif
#include "UIPClient.h"

class UIPServer : public Server {

#if defined(ARDUINO)
class UIPServer : public Server {
#endif
#if defined(__MBED__)
class UIPServer : public Print, public Server {
#endif
public:
UIPServer(uint16_t);
UIPClient available();
virtual void begin();
size_t write(uint8_t);
size_t write(const uint8_t *buf, size_t size);
#if defined(ARDUINO)
using Print::write;
#endif
virtual size_t write(uint8_t);
virtual size_t write(const uint8_t *buf, size_t size);

using Print::write;

private:
uint16_t _port;
Expand Down
7 changes: 6 additions & 1 deletion UIPUdp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,12 @@ UIPUDP::beginPacket(IPAddress ip, uint16_t port)
}
#if ACTLOGLEVEL>=LOG_DEBUG
LogObject.uart_send_str(F("rip: "));
LogObject.uart_send_dec(ip);
#if defined(ARDUINO)
LogObject.print(ip);
#endif
#if defined(__MBED__)
LogObject.printf("%d.%d.%d.%d",ip[0],ip[1],ip[2],ip[3]);
#endif
LogObject.uart_send_str(F(", port: "));
LogObject.uart_send_decln(port);
#endif
Expand Down
26 changes: 15 additions & 11 deletions UIPUdp.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,16 @@
#define UIPUDP_H

#include "ethernet_comp.h"
#if defined(__MBED__)
#include <mbed.h>
#include "mbed/Udp.h"
#endif
#if defined(ARDUINO)
#include <Arduino.h>
#include "Print.h"
#include <Udp.h>
#endif
#if defined(__MBED__)
#include <mbed.h>
#include "mbed/Print.h"
#include "mbed/Udp.h"
#endif
#include "utility/mempool.h"
extern "C" {
#include "utility/uip.h"
Expand All @@ -46,9 +48,12 @@ typedef struct {
bool send;
} uip_udp_userdata_t;

class UIPUDP : public UDP
{

#if defined(ARDUINO)
class UIPUDP : public UDP {
#endif
#if defined(__MBED__)
class UIPUDP : public Print, public UDP {
#endif
private:
struct uip_udp_conn *_uip_udp_conn;

Expand All @@ -74,10 +79,9 @@ class UIPUDP : public UDP
virtual size_t write(uint8_t);
// Write size bytes from buffer into the packet
virtual size_t write(const uint8_t *buffer, size_t size);

#if defined(ARDUINO)
using Print::write;
#endif

using Print::write;

// Start processing the next available incoming packet
// Returns the size of the packet in bytes, or 0 if no packets are available
virtual int parsePacket(void);
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ paragraph=implements the same API as stock Ethernet-lib. Just replace the includ
url=https://github.com/ntruchsess/arduino_uip
architectures=*
category=Communication
version=1.2.0
version=1.2.1
dependencies=
core-dependencies=arduino (>=1.5.0)

0 comments on commit e9f3fa0

Please sign in to comment.