|
|
|
|
@ -37,6 +37,12 @@
|
|
|
|
|
#include <math.h>
|
|
|
|
|
#include "Adafruit_INA219.h" // From Adafruit INA219 library for Arduino
|
|
|
|
|
#include "make_wav.h"
|
|
|
|
|
#include <sys/socket.h>
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
#include <netinet/in.h>
|
|
|
|
|
#include <string.h>
|
|
|
|
|
#include <arpa/inet.h>
|
|
|
|
|
#define PORT 8080
|
|
|
|
|
|
|
|
|
|
#define A 1
|
|
|
|
|
#define B 2
|
|
|
|
|
@ -750,13 +756,51 @@ int get_tlm_fox() {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
write_wav("transmit.wav", BUF_LEN, buffer, S_RATE);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int error = 0;
|
|
|
|
|
int count;
|
|
|
|
|
for (count = 0; count < DATA_LEN; count++) {
|
|
|
|
|
printf("%02X", b[count]);
|
|
|
|
|
}
|
|
|
|
|
printf("\n");
|
|
|
|
|
|
|
|
|
|
// socket write
|
|
|
|
|
|
|
|
|
|
struct sockaddr_in address;
|
|
|
|
|
int sock = 0, valread;
|
|
|
|
|
struct sockaddr_in serv_addr;
|
|
|
|
|
// char *hello = "Hello from client";
|
|
|
|
|
// char buffer[1024] = {0};
|
|
|
|
|
if ((sock = socket(AF_INET, SOCK_STREAM, 0)) < 0)
|
|
|
|
|
{
|
|
|
|
|
printf("\n Socket creation error \n");
|
|
|
|
|
dataviz = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
memset(&serv_addr, '0', sizeof(serv_addr));
|
|
|
|
|
|
|
|
|
|
serv_addr.sin_family = AF_INET;
|
|
|
|
|
serv_addr.sin_port = htons(PORT);
|
|
|
|
|
|
|
|
|
|
// Convert IPv4 and IPv6 addresses from text to binary form
|
|
|
|
|
if(inet_pton(AF_INET, "127.0.0.1", &serv_addr.sin_addr)<=0)
|
|
|
|
|
{
|
|
|
|
|
printf("\nInvalid address/ Address not supported \n");
|
|
|
|
|
error = 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (connect(sock, (struct sockaddr *)&serv_addr, sizeof(serv_addr)) < 0)
|
|
|
|
|
{
|
|
|
|
|
printf("\nConnection Failed \n");
|
|
|
|
|
error = 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!error)
|
|
|
|
|
{
|
|
|
|
|
printf("Sending buffer over socket!\n");
|
|
|
|
|
send(sock, buffer, sizeof(buffer), 0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|