|
@@ -6,6 +6,7 @@
|
|
|
#include <sys/timer.h>
|
|
#include <sys/timer.h>
|
|
|
#include <sys/confnet.h>
|
|
#include <sys/confnet.h>
|
|
|
#include <sys/socket.h>
|
|
#include <sys/socket.h>
|
|
|
|
|
+#include <netinet/tcp.h>
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
#include <stdlib.h>
|
|
|
#include <string.h>
|
|
#include <string.h>
|
|
@@ -26,6 +27,9 @@
|
|
|
#include "alarm.h"
|
|
#include "alarm.h"
|
|
|
|
|
|
|
|
bool isReceiving;
|
|
bool isReceiving;
|
|
|
|
|
+u_short mss = 1460;
|
|
|
|
|
+u_long rx_to = 3000;
|
|
|
|
|
+u_short tcpbufsiz = 1500;
|
|
|
|
|
|
|
|
void NetworkInit() {
|
|
void NetworkInit() {
|
|
|
/* Register de internet controller. */
|
|
/* Register de internet controller. */
|
|
@@ -51,6 +55,8 @@ char* httpGet(char address[]){
|
|
|
int len = sizeof(http);
|
|
int len = sizeof(http);
|
|
|
|
|
|
|
|
char buffer[300];
|
|
char buffer[300];
|
|
|
|
|
+ memset(buffer, 0, 300);
|
|
|
|
|
+
|
|
|
if (NutTcpConnect(sock, inet_addr("62.195.226.247"), 80)) {
|
|
if (NutTcpConnect(sock, inet_addr("62.195.226.247"), 80)) {
|
|
|
printf("Can't connect to server\n");
|
|
printf("Can't connect to server\n");
|
|
|
}else{
|
|
}else{
|
|
@@ -94,6 +100,15 @@ char* httpGet(char address[]){
|
|
|
return content;
|
|
return content;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+int getTimeZone()
|
|
|
|
|
+{
|
|
|
|
|
+ char* content = httpGet("/gettimezone.php");
|
|
|
|
|
+ int timezone = atoi(content);
|
|
|
|
|
+ free(content);
|
|
|
|
|
+ printf("%d", timezone);
|
|
|
|
|
+ return timezone;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
void parseAlarmJson(char* content){
|
|
void parseAlarmJson(char* content){
|
|
|
int r;
|
|
int r;
|
|
|
int i;
|
|
int i;
|