2019-12-23 13:13:13 +00:00
|
|
|
#include "coppino.h"
|
|
|
|
#include "ipv6.h"
|
|
|
|
#include "slip.h"
|
2019-12-24 15:54:16 +00:00
|
|
|
#include "udp.h"
|
|
|
|
|
2019-12-24 18:33:07 +00:00
|
|
|
int udp_server(char* output_buffer, const char* input_buffer, int len) {
|
|
|
|
const char msg[] = "HELLO-WORLD-UDP\n";
|
2019-12-24 15:54:16 +00:00
|
|
|
digitalWrite(13, !digitalRead(13));
|
2019-12-24 18:33:07 +00:00
|
|
|
memcpy(output_buffer, msg, strlen(msg));
|
|
|
|
return strlen(msg);
|
2019-12-24 15:54:16 +00:00
|
|
|
}
|
2019-12-23 13:13:13 +00:00
|
|
|
|
|
|
|
void setup() {
|
|
|
|
pinMode(13, OUTPUT);
|
|
|
|
|
2019-12-24 15:00:09 +00:00
|
|
|
Serial.begin(19200);
|
2019-12-23 21:30:58 +00:00
|
|
|
memcpy(&coppino::address, "\x20\x01\x04\x70\xc8\x44\x00\x31\x00\x00\x00\x00\x00\x00\xca\xfe", 16);
|
2019-12-24 15:54:16 +00:00
|
|
|
|
|
|
|
udp::set_handler(80, udp_server);
|
2019-12-23 13:13:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void loop() {
|
2019-12-24 15:00:09 +00:00
|
|
|
/* network service routing */
|
2019-12-23 13:13:13 +00:00
|
|
|
coppino::handler();
|
|
|
|
}
|