Permalink
Browse files

Merge branch 'master' of github.com:pushsnowboarding/Push-Snowboarding

Conflicts:
	PushBurton2/PushBurton2.pro.user
  • Loading branch information...
2 parents 601417d + c35ef9d commit 6064c6e80a77af0de420a1a1b2d6b0d25edee432 cpscotti committed Jun 14, 2011
Showing with 2,443 additions and 1,714 deletions.
  1. +6 −0 Arduino/FootPressure/FootPressure.pde
  2. +6 −0 Arduino/GSR/GSR.pde
  3. +6 −0 Arduino/Heart/Heart.pde
  4. +18 −0 Arduino/IMU/IMU.pde
  5. +15 −4 PushBurton2/PushBurton2.pro
  6. +24 −277 PushBurton2/PushBurton2.pro.user
  7. +137 −0 PushBurton2/broadcasterdevice.cpp
  8. +68 −0 PushBurton2/broadcasterdevice.h
  9. +13 −10 PushBurton2/devicesmanager.cpp
  10. +9 −19 PushBurton2/devicesmanager.h
  11. +11 −30 PushBurton2/fuzzydetector.cpp
  12. +151 −3 PushBurton2/graphicssettings.cpp
  13. +35 −0 PushBurton2/graphicssettings.h
  14. +1 −1 PushBurton2/liveview.cpp
  15. +8 −1 PushBurton2/main.cpp
  16. +12 −1 PushBurton2/mainwindow.cpp
  17. +1 −1 PushBurton2/mainwindow.h
  18. +21 −11 PushBurton2/npushairtimetick.cpp
  19. +4 −1 PushBurton2/npushairtimetick.h
  20. +57 −0 PushBurton2/npushrotationstick.cpp
  21. +34 −0 PushBurton2/npushrotationstick.h
  22. +4 −4 PushBurton2/npushtickdisposer.cpp
  23. +2 −0 PushBurton2/npushtickdisposer.h
  24. +16 −1 PushBurton2/pushburtongenericdevice.h
  25. +114 −110 PushBurton2/pushdevicesholder.cpp
  26. +2 −2 PushBurton2/pushn8absnormfeetdevice.cpp
  27. +1 −1 PushBurton2/pushn8absnormfeetdevice.h
  28. +43 −81 PushBurton2/pushn8airtimedetector.cpp
  29. +7 −6 PushBurton2/pushn8airtimedetector.h
  30. +232 −232 PushBurton2/pushn8btdevice.cpp
  31. +81 −81 PushBurton2/pushn8phoneacc.cpp
  32. +56 −56 PushBurton2/pushn8phoneacc.h
  33. +193 −193 PushBurton2/pushn8phonegps.cpp
  34. +89 −89 PushBurton2/pushn8phonegps.h
  35. +82 −82 PushBurton2/pushn8phonemag.cpp
  36. +56 −56 PushBurton2/pushn8phonemag.h
  37. +2 −2 PushBurton2/pushn8simplereportsgenerator.cpp
  38. +1 −1 PushBurton2/pushn8simplereportsgenerator.h
  39. +261 −253 PushBurton2/pushn8simulationdevice.cpp
  40. +92 −83 PushBurton2/pushn8simulationdevice.h
  41. +137 −0 PushBurton2/rotationcounter.cpp
  42. +68 −0 PushBurton2/rotationcounter.h
  43. +2 −0 PushBurton2/runmanager.cpp
  44. +1 −0 PushBurton2/runmanager.h
  45. +44 −22 PushBurton2/ubiqlogsaver.cpp
  46. +10 −0 PushBurton2/ubiqlogsaver.h
  47. +125 −0 PushBurton2/virtualbrosdevice.cpp
  48. +85 −0 PushBurton2/virtualbrosdevice.h
  49. BIN Schematics/blankFrame.jpg
  50. BIN Schematics/hw_general.png
@@ -9,6 +9,12 @@
*
*/
+/*
+ * Arduino responds to char 'A' from the serial port.
+ * Replies with:
+ * FOOT,<value heel>,<value toes>,END;
+ */
+
//FOOT, arduino pro mini 3.3v connected to FSRs in divider with 1.5K resistor talking to bluetooth at 115200 Baud on a bluetooth mate.
void setup()
View
@@ -9,6 +9,12 @@
*
*/
+/*
+ * Arduino responds to char 'A' from the serial port.
+ * Replies with:
+ * GSR,<value>,END;
+ */
+
//GSR, arduino pro mini 3.3v connected to analog in port 3 with a 300K resistor tied to ground talking to bluetooth at 115200 Baud on a bluetooth mate.
void setup()
@@ -10,6 +10,12 @@
*
*/
+/*
+ * Arduino responds to char 'A' from the serial port.
+ * Replies with:
+ * HRM,<average last 32 beats>,<average last 16 beats>,<average last beat>,END;
+ */
+
volatile boolean inService = false;
long timeArray[] ={
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
View
@@ -1,4 +1,22 @@
+
+/*
+ * Copyright (c) 2011 Nokia Corporation
+ *
+ * This file is part of the Push Snowboarding Project, More info at:
+ * http://pushsnowboarding.com/tech/developer-centre/
+ *
+ * This file is under the GPLv3 License, more details at:
+ * http://www.gnu.org/licenses/
+ *
+ */
+
+/*
+ * Arduino responds to char 'A' from the serial port.
+ * Replies with:
+ * IMU,<gyro's x>,<gyro's y>,<gyro's z>,<acc's x>,<acc's y>,<acc's z>,<mag's x>,<mag's y>,<mag's z>,END;
+ */
+
#include <Wire.h>
int XGyro, YGyro, ZGyro;
@@ -26,8 +26,7 @@
#-------------------------------------------------
-QT += core gui
-QT += xml
+QT += core gui xml phonon network
TARGET = PushBurton2
TEMPLATE = app
@@ -76,7 +75,11 @@ SOURCES += main.cpp\
graphicsreportview.cpp \
graphicslidingdownbts.cpp \
liveview.cpp \
- graphicssettings.cpp
+ graphicssettings.cpp \
+ virtualbrosdevice.cpp \
+ rotationcounter.cpp \
+ npushrotationstick.cpp \
+ broadcasterdevice.cpp
HEADERS += mainwindow.h \
graphicpixmapbt.h \
@@ -122,7 +125,11 @@ HEADERS += mainwindow.h \
graphicslidingdownbts.h \
liveview.h \
graphicssettings.h \
- FilesystemConventions.h
+ FilesystemConventions.h \
+ virtualbrosdevice.h \
+ rotationcounter.h \
+ npushrotationstick.h \
+ broadcasterdevice.h
FORMS += mainwindow.ui \
liveview.ui
@@ -131,6 +138,9 @@ CONFIG += mobility
MOBILITY = location sensors
#LIBS += -lQBluetooth
+soundFiles.sources = sounds/*.mp3
+DEPLOYMENT += soundFiles
+
symbian {
TARGET.UID3 = 0xece639d4
@@ -172,6 +182,7 @@ symbian {
addFiles.sources = $(EPOCROOT)Epoc32/release/$(PLATFORM)/$(CFG)/QBluetooth.dll
addFiles.path = /sys/bin
+
DEPLOYMENT += addFiles
isEmpty(ICON):ICON = images/burton_logo.svg
Oops, something went wrong.
@@ -0,0 +1,137 @@
+#include "broadcasterdevice.h"
+
+BroadcasterDevice::BroadcasterDevice(QObject *parent) :
+ PushBurtonGenericDevice(parent)
+{
+
+ running = false;
+
+
+ xmlWriter = 0;
+
+ currConnection = 0;
+
+
+
+ serverAddress = QHostAddress("192.168.0.3");
+
+ serverPort = 45454;
+
+}
+
+
+BroadcasterDevice::~BroadcasterDevice()
+{
+ if(currConnection)
+ currConnection->disconnectFromHost();
+}
+
+
+QString BroadcasterDevice::getName()
+{
+
+ return QString("push.network.broadcaster");
+}
+
+
+bool BroadcasterDevice::start_run()
+{
+ if(!running) {
+ running = true;
+ return true;
+ }
+ return false;
+}
+
+bool BroadcasterDevice::end_run()
+{
+ if(running) {
+ running = false;
+
+ return true;
+ }
+ return false;
+}
+
+void BroadcasterDevice::incoming_reading(NPushLogTick * tick)
+{
+ if(running) {
+ if(xmlWriter && currConnection->isWritable()) {
+ tick->dump_to_xml(*xmlWriter);
+ currConnection->flush();
+ }
+ }
+}
+
+void BroadcasterDevice::connected()
+{
+ qDebug() << "Connected";
+ xmlWriter = new QXmlStreamWriter(currConnection);
+ qDebug() << "coupled with xml writer";
+
+ emit connectionUpdate(true);
+}
+
+void BroadcasterDevice::disconnected()
+{
+ if(xmlWriter) {
+ delete xmlWriter;
+ xmlWriter = 0;
+ }
+ if(currConnection) {
+ currConnection->close();
+ currConnection->deleteLater();
+ currConnection = 0;
+ }
+ emit connectionUpdate(false);
+}
+
+void BroadcasterDevice::tryToConnect()
+{
+ if(currConnection) {
+ qDebug() << "Cleaning up old connection";
+ currConnection->close();
+ currConnection->deleteLater();
+ currConnection = 0;
+ }
+
+ qDebug() << "Trying to establish new connection";
+
+ currConnection = new QTcpSocket(this);
+
+ currConnection->connectToHost(serverAddress, serverPort, QIODevice::WriteOnly);
+
+ connect(currConnection, SIGNAL(connected()),
+ this, SLOT(connected()));
+
+ connect(currConnection, SIGNAL(disconnected()),
+ this, SLOT(disconnected()));
+}
+
+void BroadcasterDevice::setServerAddress(const QString &addr)
+{
+ serverAddress.setAddress(addr);
+ qDebug() << "Address set to " << serverAddress.toString();
+}
+
+void BroadcasterDevice::setServerPort(quint16 port)
+{
+ serverPort = port;
+ qDebug() << "Port set to " << serverPort;
+}
+
+void BroadcasterDevice::tryToDisconnect()
+{
+ if(xmlWriter) {
+ delete xmlWriter;
+ xmlWriter = 0;
+ }
+
+ if(currConnection) {
+ currConnection->close();
+ currConnection->deleteLater();
+ currConnection = 0;
+ }
+
+ emit connectionUpdate(false);
+}
@@ -0,0 +1,68 @@
+#ifndef BROADCASTERDEVICE_H
+#define BROADCASTERDEVICE_H
+
+#include "npushlogtick.h"
+#include "pushburtongenericdevice.h"
+
+#include <QtNetwork>
+#include <QHostAddress>
+#include <QXmlStreamWriter>
+#include <QIODevice>
+
+#include <QDebug>
+
+class BroadcasterDevice : public PushBurtonGenericDevice
+{
+ Q_OBJECT
+public:
+ explicit BroadcasterDevice(QObject *parent = 0);
+
+ ~BroadcasterDevice();
+
+
+ QString getName();
+ bool is_online() {
+ return true;
+ }
+
+ //Our device subscribes to other devices so we need to reimplement these 2 functions
+ //accordingly. One can argue that subscribesToAny wouldn't be necessary but it SURE
+ //prevents doing a huge amount of unnecessary checks.
+ bool subscribesToAny() { return true; }
+
+ //This function will return true when the given device is a AirTimeDetector
+ bool subscribesTo(PushBurtonGenericDevice*) { return true; }
+
+ bool start_run();
+ bool end_run();
+
+signals:
+ void connectionUpdate(bool connState);
+
+public slots:
+
+ void tryToConnect();
+ void tryToDisconnect();
+
+ void setServerAddress(const QString& addr);
+ void setServerPort(quint16 port);
+
+ void connected();
+ void disconnected();
+ void incoming_reading(NPushLogTick *);
+
+private:
+ bool running;
+
+ QHostAddress serverAddress;
+ quint16 serverPort;
+
+
+ QTcpSocket *currConnection;
+
+ QXmlStreamWriter *xmlWriter;
+
+
+};
+
+#endif // BROADCASTERDEVICE_H
@@ -209,13 +209,13 @@ void DevicesManager::stop_bt_search()
#endif
}
-void DevicesManager::switch_to_simulation_device()
+void DevicesManager::switch_to_simulation_device(const QString& fname)
{
//TODO
qDebug() << "Switched to simulation device!";
configuredDevices->deleteAllAndClear();
- PushN8SimulationDevice * simulationDevice = new PushN8SimulationDevice();
+ PushN8SimulationDevice * simulationDevice = new PushN8SimulationDevice(fname);
configuredDevices->push_back(simulationDevice);
SetupAbstractDevices();
@@ -227,12 +227,8 @@ void DevicesManager::switch_to_simulation_device()
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();
+ emit request_run_start();
+ connect(simulationDevice, SIGNAL(simulationEnded()), this, SIGNAL(request_run_end()));
}
@@ -286,8 +282,6 @@ void DevicesManager::SetupPhoneDevices()
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()
@@ -300,4 +294,13 @@ void DevicesManager::SetupAbstractDevices()
PushN8SimpleReportsGenerator * reportGenerator = new PushN8SimpleReportsGenerator();
configuredDevices->push_back(reportGenerator);
+
+ RotationCounter * spin2WinKid = new RotationCounter();
+ configuredDevices->push_back(spin2WinKid);
+
+ VirtualBrosDevice * virtualBros = new VirtualBrosDevice();
+ configuredDevices->push_back(virtualBros);
+
+ BroadcasterDevice * brodDevice = new BroadcasterDevice();
+ configuredDevices->push_back(brodDevice);
}
Oops, something went wrong.

0 comments on commit 6064c6e

Please sign in to comment.