43 |
43 |
44 QTM_BEGIN_NAMESPACE |
44 QTM_BEGIN_NAMESPACE |
45 |
45 |
46 QGeoSatelliteInfoSourceMaemo::QGeoSatelliteInfoSourceMaemo(QObject *parent) : QGeoSatelliteInfoSource(parent) |
46 QGeoSatelliteInfoSourceMaemo::QGeoSatelliteInfoSourceMaemo(QObject *parent) : QGeoSatelliteInfoSource(parent) |
47 { |
47 { |
48 client_id_ = -1; |
48 registered = false; |
49 } |
49 } |
|
50 |
50 |
51 |
51 int QGeoSatelliteInfoSourceMaemo::init() |
52 int QGeoSatelliteInfoSourceMaemo::init() |
52 { |
53 { |
53 int status; |
54 dbusComm = new DBusComm(); |
|
55 int status = dbusComm->init(); |
54 |
56 |
55 dbusComm = new DBusComm(); |
57 if (status == 0) { |
56 status = dbusComm->init(); |
58 QObject::connect(dbusComm, SIGNAL(receivedSatellitesInView(const QList<QGeoSatelliteInfo> &)), |
57 |
59 this, SLOT(newSatellitesInView(const QList<QGeoSatelliteInfo> &))); |
58 QObject::connect(dbusComm, SIGNAL(npeMessage(const QByteArray &)), |
60 QObject::connect(dbusComm, SIGNAL(receivedSatellitesInUse(const QList<QGeoSatelliteInfo> &)), |
59 this, SLOT(npeMessages(const QByteArray &))); |
61 this, SLOT(newSatellitesInUse(const QList<QGeoSatelliteInfo> &))); |
|
62 } |
60 |
63 |
61 return status; |
64 return status; |
62 } |
|
63 |
|
64 // This method receives messages from DBus. |
|
65 |
|
66 void QGeoSatelliteInfoSourceMaemo::dbusMessages(const QByteArray &msg) |
|
67 { |
|
68 Q_UNUSED(msg) |
|
69 |
|
70 return; |
|
71 } |
65 } |
72 |
66 |
73 |
67 |
74 void QGeoSatelliteInfoSourceMaemo::startUpdates() |
68 void QGeoSatelliteInfoSourceMaemo::startUpdates() |
75 { |
69 { |
76 #if 0 |
70 if (registered == false) |
77 int len = npe.NewStartTrackingMsg(&msg, client_id_, NpeIf::MethodAll, |
71 registered = dbusComm->sendDBusRegister(); |
78 NpeIf::OptionNone , 1); |
|
79 |
72 |
80 // cout << "ISI Message len " << len << "\n"; |
73 dbusComm->sendConfigRequest(DBusComm::CommandSatStart, 0, 0); |
81 dbusComm->sendIsiMessage(msg, len); |
|
82 delete [] msg; |
|
83 #endif |
|
84 |
|
85 #if 0 // Test ! |
|
86 QList<QGeoSatelliteInfo> list; |
|
87 QGeoSatelliteInfo tmp; |
|
88 |
|
89 tmp.setPrnNumber(33); |
|
90 tmp.setSignalStrength(15); |
|
91 tmp.setProperty(QGeoSatelliteInfo::Azimuth, 45.0); |
|
92 tmp.setProperty(QGeoSatelliteInfo::Elevation, 25.5); |
|
93 list.append(tmp); |
|
94 list.append(tmp); |
|
95 list.append(tmp); |
|
96 |
|
97 emit satellitesInViewUpdated(list); |
|
98 emit satellitesInUseUpdated(list); |
|
99 #endif |
|
100 |
|
101 |
|
102 } |
74 } |
103 |
75 |
104 |
76 |
105 void QGeoSatelliteInfoSourceMaemo::stopUpdates() |
77 void QGeoSatelliteInfoSourceMaemo::stopUpdates() |
106 { |
78 { |
|
79 if (registered == false) |
|
80 registered = dbusComm->sendDBusRegister(); |
107 |
81 |
|
82 dbusComm->sendConfigRequest(DBusComm::CommandSatStop, 0, 0); |
|
83 } |
108 |
84 |
109 } |
|
110 |
85 |
111 void QGeoSatelliteInfoSourceMaemo::requestUpdate(int timeout) |
86 void QGeoSatelliteInfoSourceMaemo::requestUpdate(int timeout) |
112 { |
87 { |
113 int a; |
88 if (registered == false) |
114 a = timeout + 1; |
89 registered = dbusComm->sendDBusRegister(); |
115 |
90 |
|
91 dbusComm->sendConfigRequest(DBusComm::CommandSatOneShot, 0, timeout); |
116 } |
92 } |
117 |
93 |
118 #if 0 |
94 |
119 void satellitesInViewUpdated(const QList<QGeoSatelliteInfo> &satellites); |
95 void QGeoSatelliteInfoSourceMaemo::newSatellitesInView(const QList<QGeoSatelliteInfo> &update) |
120 void satellitesInUseUpdated(const QList<QGeoSatelliteInfo> &satellites); |
96 { |
121 void requestTimeout(); |
97 emit satellitesInViewUpdated(update); |
122 #endif |
98 } |
|
99 |
|
100 |
|
101 void QGeoSatelliteInfoSourceMaemo::newSatellitesInUse(const QList<QGeoSatelliteInfo> &update) |
|
102 { |
|
103 emit satellitesInUseUpdated(update); |
|
104 } |
123 |
105 |
124 #include "moc_qgeosatelliteinfosource_maemo_p.cpp" |
106 #include "moc_qgeosatelliteinfosource_maemo_p.cpp" |
125 QTM_END_NAMESPACE |
107 QTM_END_NAMESPACE |
126 |
108 |