Permalink
Browse files

*Fixed GPS gpsOnLine flag

*Connected InternalPhoneGPS to devicesManager's SignalMapper for device_connected
	and device_disconnected.
*Devices Manager emits all device_connected signals for simulation env too!


git-svn-id: http://www.cpscotti.com/pushsnowboarding@18 c819a03f-852d-4de4-a68c-c3ac47756727
  • Loading branch information...
1 parent 7a69337 commit 19efde04bcd197c8e84e3c0c51392f4b24921af4 cpscotti committed Feb 16, 2011
Showing with 55 additions and 15 deletions.
  1. +39 −8 PushBurton2/devicesmanager.cpp
  2. +3 −0 PushBurton2/graphicsdeviceinfo.cpp
  3. +13 −7 PushBurton2/pushn8phonegps.cpp
View
47 PushBurton2/devicesmanager.cpp
@@ -220,12 +220,19 @@ void DevicesManager::switch_to_simulation_device()
SetupAbstractDevices();
- emit foot_l_connected();
- emit foot_r_connected();
- emit motion_box_connected();
- emit heart_connected();
- emit gsr_connected();
- emit phone_gps_connected();
+ emit device_connected(QString("LBoot"));
+ emit device_connected(QString("RBoot"));
+ emit device_connected(QString("Arm"));
+ emit device_connected(QString("Board"));
+ emit device_connected(QString("Location"));
+ emit device_connected(QString("Heart"));
+
+// emit foot_l_connected();
+// emit foot_r_connected();
+// emit motion_box_connected();
+// emit heart_connected();
+// emit gsr_connected();
+// emit phone_gps_connected();
}
@@ -249,14 +256,38 @@ void DevicesManager::SetupPhoneDevices()
PushN8PhoneAcc * phoneAcc = new PushN8PhoneAcc();
configuredDevices->push_back(phoneAcc);
+ connect(phoneAcc, SIGNAL(connected()), &connectedMapper, SLOT(map()));
+ connectedMapper.setMapping(phoneAcc, "PhoneAcc");
+
+ connect(phoneAcc, SIGNAL(disconnected()), &disconnectedMapper, SLOT(map()));
+ disconnectedMapper.setMapping(phoneAcc, "PhoneAcc");
+
+
+
PushN8PhoneMag * phoneMag = new PushN8PhoneMag();
configuredDevices->push_back(phoneMag);
+ connect(phoneMag, SIGNAL(connected()), &connectedMapper, SLOT(map()));
+ connectedMapper.setMapping(phoneMag, "PhoneMag");
+
+ connect(phoneMag, SIGNAL(disconnected()), &disconnectedMapper, SLOT(map()));
+ disconnectedMapper.setMapping(phoneMag, "PhoneMag");
+
+
+
PushN8PhoneGPS * phoneGPS = new PushN8PhoneGPS(this);
configuredDevices->push_back(phoneGPS);
- emit phone_gps_connecting();
- connect(phoneGPS, SIGNAL(connected()), this, SIGNAL(phone_gps_connected()));
+ emit device_connecting(QString("Location"));
+
+ connect(phoneGPS, SIGNAL(connected()), &connectedMapper, SLOT(map()));
+ connectedMapper.setMapping(phoneGPS, "Location");
+
+ connect(phoneGPS, SIGNAL(disconnected()), &disconnectedMapper, SLOT(map()));
+ disconnectedMapper.setMapping(phoneGPS, "Location");
+
+// emit phone_gps_connecting();
+// connect(phoneGPS, SIGNAL(connected()), this, SIGNAL(phone_gps_connected()));
}
void DevicesManager::SetupAbstractDevices()
View
3 PushBurton2/graphicsdeviceinfo.cpp
@@ -139,6 +139,8 @@ void GraphicsDeviceInfo::device_connecting(const QString& devName)
void GraphicsDeviceInfo::device_connected(const QString& devName)
{
+ qDebug() << "Got connected: " << devName;
+
if(devName == "Heart") {
heartOn = true;
heartBlink = 0;
@@ -155,6 +157,7 @@ void GraphicsDeviceInfo::device_connected(const QString& devName)
leftBootOn = true;
leftBootBlink = 0;
} else if(devName == "Location") {
+ qDebug() << "GOT GPS Connected signal!!";
locationOn = true;
locationBlink = 0;
}
View
20 PushBurton2/pushn8phonegps.cpp
@@ -85,18 +85,24 @@ bool PushN8PhoneGPS::is_online()
void PushN8PhoneGPS::positionUpdated(QGeoPositionInfo info)
{
- if(info.coordinate().isValid() && !gpsOnline)
- {
- //emitting connected signal when receiving first reading
+ if(info.isValid() && !gpsOnline) {
emit connected();
gpsOnline = true;
+ qDebug() << "GPS now connected";
+ }
- } else if(gpsOnline) {
+// if(info.coordinate().isValid() && !gpsOnline)
+// {
+// //emitting connected signal when receiving first reading
+// emit connected();
+// gpsOnline = true;
- gpsOnline = false;
- emit disconnected();
+// } else if(gpsOnline) {
- }
+// gpsOnline = false;
+// emit disconnected();
+
+// }
if(!streaming)
return;

0 comments on commit 19efde0

Please sign in to comment.