ich bin gerade dabei ein Programm zum Auslesen einer GPS Maus zu schreiben.
Das entsprechende Plugin "qtposition_gpsd-master" arbeitet korrekt, da die Demoprogramme
"satelliteinfo" und "weatherinfo" korrekt arbeiten. Die Anbindung an den gpsd - dämon arbeitet also.
Leider wird keine von den Slots, welche ich dem Objekt zugeordnet habe, aufgerufen. Ich weiss leider nicht wieso.
Hier meine Defines der Slots
Code: Alles auswählen
class SensorThread : public QThread
{
Q_OBJECT
...
private slots:
void positionUpdated(QGeoPositionInfo);
void positionError(QGeoPositionInfoSource::Error);
void updateTimeout(void);
....
}
Code: Alles auswählen
void SensorThread::run(void)
{
SensorValueData SensorValue; // Query Buffer Element
QDateTime DateTimeInfo; // Time buffer value
int16_t i;
m_ProgramInfo->writelog(tr("carclient"),tr("SensorThread"),tr("Info"),tr("Thread startup"));
qt_Position = QGeoPositionInfoSource::createDefaultSource(this);
if (qt_Position)
{
connect(qt_Position, SIGNAL(positionUpdated(QGeoPositionInfo)),this, SLOT(positionUpdated(QGeoPositionInfo)));
connect(qt_Position, SIGNAL(error(QGeoPositionInfoSource::Error)),this, SLOT(positionError(QGeoPositionInfoSource::Error)));
connect(qt_Position, SIGNAL(updateTimeout()),this, SLOT(updateTimeout()));
qt_Position->setUpdateInterval(500);
qt_Position->setPreferredPositioningMethods(QGeoPositionInfoSource::SatellitePositioningMethods);
qt_Position->startUpdates();
}
else
m_ProgramInfo->writelog(tr("carclient"),tr("SensorThread"),tr("Error"),tr("Could not create qt_Position Object"));
Code: Alles auswählen
void SensorThread::positionUpdated(QGeoPositionInfo info)
{
m_PositionInfo=info;
}
void SensorThread::positionError(QGeoPositionInfoSource::Error gpserror)
{
qDebug() << gpserror;
}
void SensorThread::updateTimeout(void)
{
qDebug() << "Time out";
}
Hier noch der Log der Applikationsausgabe:
Über diesen Eintrag bin ich noch nicht ganz Schlau geworden.&"warning: GDB: Failed to set controlling terminal: Unpassender IOCTL/O-Control) f\303\274r das Ger\303\244t\n"
QObject: Cannot create children for a parent that is in a different thread.
(Parent is SensorThread(0x5555558f42f0), parent's thread is QThread(0x5555557b6f30), current thread is SensorThread(0x5555558f42f0)
Connected to gpsd
Created slave QBuffer(0x7fffd4005540)
Unpausing slave QBuffer(0x7fffd4005540)
Starting gpsd
Debugging has finished
Es scheint sich wohl die Art des Starten von Threads geändert haben. Habe eine lange Pause in QT gemacht.QObject: Cannot create children for a parent that is in a different thread.
(Parent is SensorThread(0x5555558f42f0), parent's thread is QThread(0x5555557b6f30), current thread is SensorThread(0x5555558f42f0)
Hat jemand eine Idee, was ich hier falsch gemacht habe ?
Viele Grüße
R.