|
|
|
@ -111,12 +111,10 @@ int smaller;
|
|
|
|
int flip_ctr = 0;
|
|
|
|
int flip_ctr = 0;
|
|
|
|
int phase = 1;
|
|
|
|
int phase = 1;
|
|
|
|
int ctr = 0;
|
|
|
|
int ctr = 0;
|
|
|
|
int sock = 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void write_to_buffer(int i, int symbol, int val);
|
|
|
|
void write_to_buffer(int i, int symbol, int val);
|
|
|
|
void write_wave();
|
|
|
|
void write_wave();
|
|
|
|
#define SAMPLES (S_RATE / BIT_RATE)
|
|
|
|
#define SAMPLES (S_RATE / BIT_RATE)
|
|
|
|
#define FRAME_CNT 11// //33 // Add 3 frames to the count
|
|
|
|
#define FRAME_CNT 11 //33 // Add 3 frames to the count
|
|
|
|
|
|
|
|
|
|
|
|
//#define BUF_LEN (FRAME_CNT * (SYNC_BITS + 10 * (8 + 6 * DATA_LEN + 96)) * SAMPLES)
|
|
|
|
//#define BUF_LEN (FRAME_CNT * (SYNC_BITS + 10 * (8 + 6 * DATA_LEN + 96)) * SAMPLES)
|
|
|
|
#define BUF_LEN (FRAME_CNT * (SYNC_BITS + 10 * (HEADER_LEN + RS_FRAMES * (RS_FRAME_LEN + PARITY_LEN))) * SAMPLES)
|
|
|
|
#define BUF_LEN (FRAME_CNT * (SYNC_BITS + 10 * (HEADER_LEN + RS_FRAMES * (RS_FRAME_LEN + PARITY_LEN))) * SAMPLES)
|
|
|
|
@ -291,37 +289,6 @@ int main(int argc, char *argv[]) {
|
|
|
|
AX25_PREAMBLE_LEN,
|
|
|
|
AX25_PREAMBLE_LEN,
|
|
|
|
AX25_POSTAMBLE_LEN);
|
|
|
|
AX25_POSTAMBLE_LEN);
|
|
|
|
|
|
|
|
|
|
|
|
// socket open
|
|
|
|
|
|
|
|
int error = 0;
|
|
|
|
|
|
|
|
struct sockaddr_in address;
|
|
|
|
|
|
|
|
int 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");
|
|
|
|
|
|
|
|
error = 1;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Infinite loop */
|
|
|
|
/* Infinite loop */
|
|
|
|
//for (;;)
|
|
|
|
//for (;;)
|
|
|
|
|
|
|
|
|
|
|
|
@ -727,9 +694,6 @@ int get_tlm_fox() {
|
|
|
|
int data;
|
|
|
|
int data;
|
|
|
|
int val;
|
|
|
|
int val;
|
|
|
|
int offset = 0;
|
|
|
|
int offset = 0;
|
|
|
|
ctr = 0;
|
|
|
|
|
|
|
|
flip_ctr = 0;
|
|
|
|
|
|
|
|
phase = 1;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (i = 1; i <= SYNC_BITS * SAMPLES; i++)
|
|
|
|
for (i = 1; i <= SYNC_BITS * SAMPLES; i++)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
@ -802,14 +766,41 @@ int get_tlm_fox() {
|
|
|
|
|
|
|
|
|
|
|
|
// socket write
|
|
|
|
// 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");
|
|
|
|
|
|
|
|
error = 1;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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)
|
|
|
|
if (!error)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
printf("Sending buffer over socket!\n");
|
|
|
|
printf("Sending buffer over socket!\n");
|
|
|
|
send(sock, buffer, sizeof(buffer), 0);
|
|
|
|
send(sock, buffer, sizeof(buffer), 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
sleep(20);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|