qball2k5
12th April 2006, 16:25
Help me por favor!
I'm trying to implement threading....but it's not working.
Here's the class that's threaded
#ifndef MESSAGER_H
#define MESSAGER_H
#include <QString>
#include <QtXml/QDomDocument>
#include <QFile>
#include <QIODevice>
#include <QThread>
#include <QMutex>
#include <QWaitCondition>
#include "packet.h"
#include "constants.h"
#include "messager.h"
#include "include/bomMessage.h"
class Messager : public QThread
{
Q_OBJECT
public:
Messager(QObject *parent = 0);
~Messager();
bool SetCommand(int MessageType);
bool SetPort(int port);
bool SetBitrate(int rate);
bool SetAddress(int addr);
bool SetValveArray(bool values[]);
bool SetEnabled(bool OnOff);
bool SetDeviceNumber(int Device);
bool SetMessageID(int ID);
bool SetDirection(int Dir);
bool SetRPM(int Speed);
bool SetMultiplier(int Mult);
bool SetOpticType(int Type);
bool SetXMLName(QString name);
bool SetFileName(QString name);
bool SetRecord(bool Enabled);
bool GetReturnValue();
public slots:
void GetBowlOpticsStatus(int arrValues[]);
protected:
void run();
private:
bool Configure();
bool SendGoMessage();
bool SendValveMessage();
bool SendValveStatusMessage();
UINT16 ReadValveStatusMessage();
bool SendMotorMessage();
bool SendMotorStatusMessage();
bool SendSetBowlOpticsMessage();
bool SendBowlOpticsStatusMessage();
UINT16 ReadBowlOpticsStatusMessage();
void StartRecording();
bool LoadScript();
void StopRecording();
void GetValves(bool arrOpen[], double values[]);
void OutputToScript(Packet outgoingPacket, int address, int end);
bool SendMessage(Packet outgoing, UINT8 addr);
void OpenXMLFile();
void CloseXMLFile();
bool ReadXMLFile(QIODevice *device, int &PacketNum, Packet packets[], UINT8 addresses[]);
bool SuperScript(Packet packets[], UINT8 addresses[], int PacketNum);
bool RECORD;
bool returnValue;
volatile bool stopped;
QString fileName;
QMutex mutex;
QWaitCondition condition;
COMMAND MessageCommand;
int portNum;
int bitrate;
int address;
bool arrOpen[18];
bool Enabled;
int DeviceNumber;
int MessageID;
int Direction;
int RPM;
int Multiplier;
int OpticType;
QString XMLName;
QString FileName;
};
#endif
Here's where the class is instantied and accessed.
Messager messager;
messager.setPort(0);
messager.setBitrate(50);
messager.setCommand(Config);
messager.start();
When I compile I'm getting the following errors returned:
decksimulator.cpp: In constructor `DeckSimulator::DeckSimulator(QMainWindow*)':
decksimulator.cpp:74: error: 'class Messager' has no member named 'setPort'
decksimulator.cpp:75: error: 'class Messager' has no member named 'setBitrate'
decksimulator.cpp:76: error: 'class Messager' has no member named 'setCommand'
The problem is that clearly it does have those members declared...but they are not being seen. What am I doing wrong?
I can provide more code if necessary.
Thanks.
Rob
I'm trying to implement threading....but it's not working.
Here's the class that's threaded
#ifndef MESSAGER_H
#define MESSAGER_H
#include <QString>
#include <QtXml/QDomDocument>
#include <QFile>
#include <QIODevice>
#include <QThread>
#include <QMutex>
#include <QWaitCondition>
#include "packet.h"
#include "constants.h"
#include "messager.h"
#include "include/bomMessage.h"
class Messager : public QThread
{
Q_OBJECT
public:
Messager(QObject *parent = 0);
~Messager();
bool SetCommand(int MessageType);
bool SetPort(int port);
bool SetBitrate(int rate);
bool SetAddress(int addr);
bool SetValveArray(bool values[]);
bool SetEnabled(bool OnOff);
bool SetDeviceNumber(int Device);
bool SetMessageID(int ID);
bool SetDirection(int Dir);
bool SetRPM(int Speed);
bool SetMultiplier(int Mult);
bool SetOpticType(int Type);
bool SetXMLName(QString name);
bool SetFileName(QString name);
bool SetRecord(bool Enabled);
bool GetReturnValue();
public slots:
void GetBowlOpticsStatus(int arrValues[]);
protected:
void run();
private:
bool Configure();
bool SendGoMessage();
bool SendValveMessage();
bool SendValveStatusMessage();
UINT16 ReadValveStatusMessage();
bool SendMotorMessage();
bool SendMotorStatusMessage();
bool SendSetBowlOpticsMessage();
bool SendBowlOpticsStatusMessage();
UINT16 ReadBowlOpticsStatusMessage();
void StartRecording();
bool LoadScript();
void StopRecording();
void GetValves(bool arrOpen[], double values[]);
void OutputToScript(Packet outgoingPacket, int address, int end);
bool SendMessage(Packet outgoing, UINT8 addr);
void OpenXMLFile();
void CloseXMLFile();
bool ReadXMLFile(QIODevice *device, int &PacketNum, Packet packets[], UINT8 addresses[]);
bool SuperScript(Packet packets[], UINT8 addresses[], int PacketNum);
bool RECORD;
bool returnValue;
volatile bool stopped;
QString fileName;
QMutex mutex;
QWaitCondition condition;
COMMAND MessageCommand;
int portNum;
int bitrate;
int address;
bool arrOpen[18];
bool Enabled;
int DeviceNumber;
int MessageID;
int Direction;
int RPM;
int Multiplier;
int OpticType;
QString XMLName;
QString FileName;
};
#endif
Here's where the class is instantied and accessed.
Messager messager;
messager.setPort(0);
messager.setBitrate(50);
messager.setCommand(Config);
messager.start();
When I compile I'm getting the following errors returned:
decksimulator.cpp: In constructor `DeckSimulator::DeckSimulator(QMainWindow*)':
decksimulator.cpp:74: error: 'class Messager' has no member named 'setPort'
decksimulator.cpp:75: error: 'class Messager' has no member named 'setBitrate'
decksimulator.cpp:76: error: 'class Messager' has no member named 'setCommand'
The problem is that clearly it does have those members declared...but they are not being seen. What am I doing wrong?
I can provide more code if necessary.
Thanks.
Rob