返回信息流菜鸟,从githup上找到的客户端和服务器端通信例子,跑不动。
如图:
Arduino中打开是这样的:
编译时候报错:
In file included from sketch\SocketIOClient.cpp:26:0:
SocketIOClient.h:34: error: 'SocketIOClient' does not name a type
SocketIOClient client;
^
exit status 1
'SocketIOClient' does not name a type
SocketIOClient是一个类,求助。这是缺少什么东西呢?还是那里有点问题???求版内大神解救。
SocketIOClient.h代码如下:
/*
socket.io-arduino-client: a Socket.IO client for the Arduino
Based on the Kevin Rohling WebSocketClient
Copyright 2013 Bill Roy
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
*/
#include "Arduino.h"
#include <Ethernet.h>
#include "SPI.h"
// Length of static data buffers
#define DATA_BUFFER_LEN 120
#define SID_LEN 24
SocketIOClient client;
class SocketIOClient {
public:
typedef void (*DataArrivedDelegate)(SocketIOClient client, char *data);
bool connect(char hostname[], int port = 80);
bool connected();
void disconnect();
void monitor();
void setDataArrivedDelegate(DataArrivedDelegate dataArrivedDelegate);
void send(char *data);
private:
void sendHandshake(char hostname[]);
EthernetClient client;
DataArrivedDelegate dataArrivedDelegate;
bool readHandshake();
void readLine();
char *dataptr;
char databuffer[DATA_BUFFER_LEN];
char sid[SID_LEN];
char *hostname;
int port;
void findColon(char which);
void terminateCommand(void);
bool waitForInput(void);
void eatHeader(void);
};
这是一条镜像帖。来源:北邮人论坛 / embedded-system / #16030同步于 2015/12/26
Embedded_System机器人发帖
[问题]Arduino error: 'SocketIOClient' does not name a type
ywq956283501
2015/12/26镜像同步0 回复
订阅后,新回复会通过你的通知中心匿名送达。
0 条回复
暂无回复 · 你可以订阅本帖等待新回复。