Hi all,
I have made a small ethernet server/client class that uses the ehternet lib from Arduino. But when i want to use it in my sketch by including it i get te following error:
C:\Users\Gebruiker\Documents\Arduino\libraries\CommunicationModuleTCPIP/CommunicationModuleTCPIP.h:38: error: 'IPAdress' has not been declared
The class and its base class looks the following:
Base class communicationmodule:
/*
* CommunicationModule.h
*
* Created on: 16 okt. 2013
* Author: Gebruiker
*/
#ifndef COMMUNICATIONMODULE_H_
#define COMMUNICATIONMODULE_H_
#include "Arduino.h"
// ObjectInfo struct definition
struct ObjectInfo {
int32_t ObjectXCor;
int32_t ObjectYCor;
int32_t ObjectMass;
};
// ObjectInfo struct definition
struct SensorDataStruct{
int32_t PingData;
int32_t IRData;
int32_t ForceData;
int32_t CompassData;
};
// ObjectInfo struct definition
union Packet{
struct CommStruct{
ObjectInfo VisionData;
SensorDataStruct SensorData;
} CommData;
unsigned char bytes[28];
};
class CommunicationModule
{
public:
CommunicationModule();
void Send();
void Recieve();
void SendBuffer();
void RecieveBuffer();
Packet SendData;
Packet RecieveData;
private:
int _pin;
};
#endif /* COMMUNICATIONMODULE_H_ */
And the TCP class:
/*
* CommunicationModuleTCPIP.cpp
*
* Author: Roy Stegers
*
* This is the TCP/IP communication module class, it provides both the client and server functions.
* A object can be a client or a server, never both at the same time.
*/
#ifndef COMMUNICATIONMODULETCPIP_H_
#define COMMUNICATIONMODULETCPIP_H_
#include "CommunicationModule.h"
#include <SPI.h>
#include <Servo.h>
#include <Dhcp.h>
#include <Dns.h>
#include <Ethernet.h>
#include <EthernetClient.h>
#include <EthernetServer.h>
#include <EthernetUdp.h>
#include <util.h>
class CommunicationModuleTCPIP : public CommunicationModule
{
public:
CommunicationModuleTCPIP(byte MacAdress[], IPAddress ServerIPServerIPAdress, int ServPort, bool Server);
CommunicationModuleTCPIP();
int Connect(IPAdress ServerIP, int Port);
void Send();
void Send(Packet SendPacket);
void Recieve();
void SendBuffer(char Buffer[], int Size);
void RecieveBuffer(char Buffer[], int Size);
bool IsServer;
byte Mac[];
IPAddress ServerIP;
int ServerPort;
EthernetClient Client;
EthernetServer ServerObject;
bool DataRecieved;
private:
};
#endif
The sketch that includes the TCP class:
#include <SPI.h>
#include <Servo.h>
#include <Ethernet.h>
#include <EthernetClient.h>
#include <EthernetServer.h>
#include <EthernetUdp.h>
#include <util.h>
#include <Dhcp.h>
#include <Dns.h>
#include <CommunicationModule.h>
#include <CommunicationModuleTCPIP.h>
void setup(){
}
void loop(){
}
Does anybody have a idea what the problem might be? All sugestions are welcome!