Here's my updated code:
#ifndef JAUS_H
#define JAUS_H
#include <QtNetwork>
#include <QUdpSocket>
#include <QObject>
struct Jaus_header
{
unsigned short message_properties;
unsigned short command_code;
unsigned short data_control;
unsigned short sequence_num;
};
class Jaus_neighbor
: public QObject{
Q_OBJECT
public:
void handshake();
void capabilities_discover();
void sys_management();
void close_conn();
private:
Jaus_header head;
private slots:
Jaus_neighbor();
void prepare_header();
void read_jheader();
void send_jheader();
void do_command();
void startBroadcasting();
void stopBroadcasting();
void sendDatagram();
//void verifyDatagram();
};
#endif // JAUS_H
#ifndef JAUS_H
#define JAUS_H
#include <QtNetwork>
#include <QUdpSocket>
#include <QObject>
struct Jaus_header
{
unsigned short message_properties;
unsigned short command_code;
QByteArray dest_id[4];
QByteArray source_id[4];
unsigned short data_control;
unsigned short sequence_num;
};
class Jaus_neighbor : public QObject
{
Q_OBJECT
public:
void handshake();
void capabilities_discover();
void sys_management();
void close_conn();
private:
Jaus_header head;
QUdpSocket *udpSocket;
private slots:
Jaus_neighbor();
void prepare_header();
void read_jheader();
void send_jheader();
void do_command();
void startBroadcasting();
void stopBroadcasting();
void sendDatagram();
//void verifyDatagram();
};
#endif // JAUS_H
To copy to clipboard, switch view to plain text mode
#include "jaus.h"
Jaus_neighbor::Jaus_neighbor()
{
for (int i = 0; i < 4; i++)
{
head.dest_id[i] = 0;
head.source_id[i] = 0;
}
head.sequence_num = 0;
head.data_control = 0;
head.message_properties = 0;
head.command_code = 0;
}
void Jaus_neighbor::startBroadcasting()
{
}
void Jaus_neighbor::stopBroadcasting()
{
}
void Jaus_neighbor::sendDatagram()
{
//udpSocket->writeDatagram(message, QHostAddress::LocalHost, 9000);
}
void Jaus_neighbor::handshake()
{
Jaus_neighbor::startBroadcasting();
}
#include "jaus.h"
Jaus_neighbor::Jaus_neighbor()
{
udpSocket = new QUdpSocket(this);
for (int i = 0; i < 4; i++)
{
head.dest_id[i] = 0;
head.source_id[i] = 0;
}
head.sequence_num = 0;
head.data_control = 0;
head.message_properties = 0;
head.command_code = 0;
}
void Jaus_neighbor::startBroadcasting()
{
}
void Jaus_neighbor::stopBroadcasting()
{
}
void Jaus_neighbor::sendDatagram()
{
//udpSocket->writeDatagram(message, QHostAddress::LocalHost, 9000);
}
void Jaus_neighbor::handshake()
{
Jaus_neighbor::startBroadcasting();
}
To copy to clipboard, switch view to plain text mode
#include <QtCore/QCoreApplication>
#include <iostream>
#include "jaus.h"
using namespace std;
int main(int argc, char *argv[])
{
cout << "Initializing Jaus Connections..." << flush;
//Jaus_neighbor cop;
return a.exec();
}
#include <QtCore/QCoreApplication>
#include <iostream>
#include "jaus.h"
using namespace std;
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
cout << "Initializing Jaus Connections..." << flush;
//Jaus_neighbor cop;
return a.exec();
}
To copy to clipboard, switch view to plain text mode
I'm still getting the warnings -- but more importantly I think, is I'm getting the following error also: error: collect2: ld returned 1 exit status
If I comment out my default constructor, the app compiles fine.
Bookmarks