Log In
New Account
  
Home My Page Project Cloud Code Snippets Project Openings Pierogi
Summary Forums Tracker Lists Tasks Docs News SCM Files
authorJohn Pietrzak <john@pietrzak.org>
Mon, 3 Sep 2012 22:23:27 +0000 (18:23 -0400)
committerJohn Pietrzak <john@pietrzak.org>
Mon, 3 Sep 2012 22:23:27 +0000 (18:23 -0400)
This is a quick release to add an extra button to the Select Keyset window
to make accessing favorites easier.  Several phrases have been reworked to
make them more self-explanatory.  Also, iRobot Roomba keyset and panel added.

26 files changed:
dialogs/pireditkeysetdialog.ui
dialogs/pirfavoritesdialog.ui
dialogs/pirtabschoicedialog.cpp
forms/pirroombaform.cpp [new file with mode: 0644]
forms/pirroombaform.h [new file with mode: 0644]
forms/pirroombaform.ui [new file with mode: 0644]
keysets/irobot.cpp [new file with mode: 0644]
keysets/irobot.h [new file with mode: 0644]
keysets/samsung.cpp
mainwindow.cpp
mainwindow.h
mainwindow.ui
pierogi.pro
pierogi.pro.user
pirkeynames.h
pirkeysetmanager.cpp
pirmakenames.cpp
pirmakenames.h
pirpanelmanager.cpp
pirpanelmanager.h
pirpanelnames.h
pirselectkeysetform.cpp
pirselectkeysetform.h
pirselectkeysetform.ui
protocols/irobotprotocol.cpp [new file with mode: 0644]
protocols/irobotprotocol.h [new file with mode: 0644]

index ad58a57..864fa84 100644 (file)
@@ -48,7 +48,7 @@
      <item>
       <widget class="QCheckBox" name="addToFavoritesCheckBox">
        <property name="text">
-        <string>Add keyset to favorites list</string>
+        <string>Favorite Keyset</string>
        </property>
       </widget>
      </item>
index e59385f..cd7e4b5 100644 (file)
@@ -11,7 +11,7 @@
    </rect>
   </property>
   <property name="windowTitle">
-   <string>Choose Favorite Keyset</string>
+   <string>Choose Keyset from Favorites</string>
   </property>
   <layout class="QVBoxLayout" name="verticalLayout">
    <property name="margin">
index 7cf9a4f..21d4662 100644 (file)
@@ -29,6 +29,9 @@ PIRTabsChoiceDialog::PIRTabsChoiceDialog(
 
   ui->tabsChoiceListWidget->addItem(
     new PIRTabsWidgetItem("Air Conditioner Panels", AC_Tabs));
+
+  ui->tabsChoiceListWidget->addItem(
+    new PIRTabsWidgetItem("Roomba Panels", Roomba_Tabs));
 }
 
 
diff --git a/forms/pirroombaform.cpp b/forms/pirroombaform.cpp
new file mode 100644 (file)
index 0000000..051af74
--- /dev/null
@@ -0,0 +1,122 @@
+#include "pirroombaform.h"
+#include "ui_pirroombaform.h"
+
+#include "mainwindow.h"
+#include "pirkeysetmanager.h"
+
+/*
+PIRRoombaForm::PIRRoombaForm(QWidget *parent) :
+  QWidget(parent),
+  ui(new Ui::PIRRoombaForm)
+{
+  ui->setupUi(this);
+}
+*/
+
+PIRRoombaForm::PIRRoombaForm(
+  MainWindow *mw)
+  : QWidget(0),
+    ui(new Ui::PIRRoombaForm),
+    mainWindow(mw)
+{
+  ui->setupUi(this);
+}
+
+PIRRoombaForm::~PIRRoombaForm()
+{
+  delete ui;
+}
+
+void PIRRoombaForm::enableButtons(
+  const PIRKeysetManager *km,
+  unsigned int id)
+{
+  emit spotEnabled(km->hasKey(id, RobotSpot_Key));
+  emit forwardEnabled(km->hasKey(id, RobotForward_Key));
+  emit cleanEnabled(km->hasKey(id, RobotClean_Key));
+  emit ccwEnabled(km->hasKey(id, RobotCCW_Key));
+  emit pauseEnabled(km->hasKey(id, Pause_Key));
+  emit cwEnabled(km->hasKey(id, RobotCW_Key));
+  emit maxEnabled(km->hasKey(id, RobotMax_Key));
+  emit powerEnabled(km->hasKey(id, Power_Key));
+}
+
+void PIRRoombaForm::on_spotButton_pressed()
+{
+  mainWindow->startRepeating(RobotSpot_Key);
+}
+
+void PIRRoombaForm::on_spotButton_released()
+{
+  mainWindow->stopRepeating();
+}
+
+void PIRRoombaForm::on_forwardButton_pressed()
+{
+  mainWindow->startRepeating(RobotForward_Key);
+}
+
+void PIRRoombaForm::on_forwardButton_released()
+{
+  mainWindow->stopRepeating();
+}
+
+void PIRRoombaForm::on_cleanButton_pressed()
+{
+  mainWindow->startRepeating(RobotClean_Key);
+}
+
+void PIRRoombaForm::on_cleanButton_released()
+{
+  mainWindow->stopRepeating();
+}
+
+void PIRRoombaForm::on_ccwButton_pressed()
+{
+  mainWindow->startRepeating(RobotCCW_Key);
+}
+
+void PIRRoombaForm::on_ccwButton_released()
+{
+  mainWindow->stopRepeating();
+}
+
+void PIRRoombaForm::on_pauseButton_pressed()
+{
+  mainWindow->startRepeating(Pause_Key);
+}
+
+void PIRRoombaForm::on_pauseButton_released()
+{
+  mainWindow->stopRepeating();
+}
+
+void PIRRoombaForm::on_cwButton_pressed()
+{
+  mainWindow->startRepeating(RobotCW_Key);
+}
+
+void PIRRoombaForm::on_cwButton_released()
+{
+  mainWindow->stopRepeating();
+}
+
+void PIRRoombaForm::on_maxButton_pressed()
+{
+  mainWindow->startRepeating(RobotMax_Key);
+}
+
+void PIRRoombaForm::on_maxButton_released()
+{
+  mainWindow->stopRepeating();
+}
+
+void PIRRoombaForm::on_powerButton_pressed()
+{
+  mainWindow->startRepeating(Power_Key);
+}
+
+void PIRRoombaForm::on_powerButton_released()
+{
+  mainWindow->stopRepeating();
+}
diff --git a/forms/pirroombaform.h b/forms/pirroombaform.h
new file mode 100644 (file)
index 0000000..f98346a
--- /dev/null
@@ -0,0 +1,62 @@
+#ifndef PIRROOMBAFORM_H
+#define PIRROOMBAFORM_H
+
+#include <QWidget>
+
+class MainWindow;
+class PIRKeysetManager;
+
+namespace Ui {
+class PIRRoombaForm;
+}
+
+class PIRRoombaForm : public QWidget
+{
+  Q_OBJECT
+  
+public:
+//  explicit PIRRoombaForm(QWidget *parent = 0);
+  PIRRoombaForm(
+    MainWindow *mw);
+
+  ~PIRRoombaForm();
+
+  void enableButtons(
+    const PIRKeysetManager *keyset,
+    unsigned int id);
+
+signals:
+  void spotEnabled(bool);
+  void forwardEnabled(bool);
+  void cleanEnabled(bool);
+  void ccwEnabled(bool);
+  void pauseEnabled(bool);
+  void cwEnabled(bool);
+  void maxEnabled(bool);
+  void powerEnabled(bool);
+  
+private slots:
+  void on_spotButton_pressed();
+  void on_spotButton_released();
+  void on_forwardButton_pressed();
+  void on_forwardButton_released();
+  void on_cleanButton_pressed();
+  void on_cleanButton_released();
+  void on_ccwButton_pressed();
+  void on_ccwButton_released();
+  void on_pauseButton_pressed();
+  void on_pauseButton_released();
+  void on_cwButton_pressed();
+  void on_cwButton_released();
+  void on_maxButton_pressed();
+  void on_maxButton_released();
+  void on_powerButton_pressed();
+  void on_powerButton_released();
+
+private:
+  Ui::PIRRoombaForm *ui;
+
+  MainWindow *mainWindow;
+};
+
+#endif // PIRROOMBAFORM_H
diff --git a/forms/pirroombaform.ui b/forms/pirroombaform.ui
new file mode 100644 (file)
index 0000000..e5c6e93
--- /dev/null
@@ -0,0 +1,289 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>PIRRoombaForm</class>
+ <widget class="QWidget" name="PIRRoombaForm">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>800</width>
+    <height>480</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Form</string>
+  </property>
+  <layout class="QGridLayout" name="gridLayout">
+   <property name="margin">
+    <number>8</number>
+   </property>
+   <item row="0" column="0">
+    <widget class="QPushButton" name="spotButton">
+     <property name="sizePolicy">
+      <sizepolicy hsizetype="Minimum" vsizetype="Expanding">
+       <horstretch>0</horstretch>
+       <verstretch>0</verstretch>
+      </sizepolicy>
+     </property>
+     <property name="text">
+      <string>Spot</string>
+     </property>
+    </widget>
+   </item>
+   <item row="0" column="1">
+    <widget class="QPushButton" name="forwardButton">
+     <property name="sizePolicy">
+      <sizepolicy hsizetype="Minimum" vsizetype="Expanding">
+       <horstretch>0</horstretch>
+       <verstretch>0</verstretch>
+      </sizepolicy>
+     </property>
+     <property name="text">
+      <string>Forward</string>
+     </property>
+    </widget>
+   </item>
+   <item row="0" column="2">
+    <widget class="QPushButton" name="cleanButton">
+     <property name="sizePolicy">
+      <sizepolicy hsizetype="Minimum" vsizetype="Expanding">
+       <horstretch>0</horstretch>
+       <verstretch>0</verstretch>
+      </sizepolicy>
+     </property>
+     <property name="text">
+      <string>Clean</string>
+     </property>
+    </widget>
+   </item>
+   <item row="1" column="0">
+    <widget class="QPushButton" name="ccwButton">
+     <property name="sizePolicy">
+      <sizepolicy hsizetype="Minimum" vsizetype="Expanding">
+       <horstretch>0</horstretch>
+       <verstretch>0</verstretch>
+      </sizepolicy>
+     </property>
+     <property name="text">
+      <string>Counterclockwise</string>
+     </property>
+    </widget>
+   </item>
+   <item row="1" column="1">
+    <widget class="QPushButton" name="pauseButton">
+     <property name="sizePolicy">
+      <sizepolicy hsizetype="Minimum" vsizetype="Expanding">
+       <horstretch>0</horstretch>
+       <verstretch>0</verstretch>
+      </sizepolicy>
+     </property>
+     <property name="text">
+      <string>Pause</string>
+     </property>
+     <property name="icon">
+      <iconset resource="../PierogiResources.qrc">
+       <normaloff>:/icons/playback_pause_icon&amp;48.png</normaloff>:/icons/playback_pause_icon&amp;48.png</iconset>
+     </property>
+     <property name="iconSize">
+      <size>
+       <width>48</width>
+       <height>48</height>
+      </size>
+     </property>
+    </widget>
+   </item>
+   <item row="1" column="2">
+    <widget class="QPushButton" name="cwButton">
+     <property name="sizePolicy">
+      <sizepolicy hsizetype="Minimum" vsizetype="Expanding">
+       <horstretch>0</horstretch>
+       <verstretch>0</verstretch>
+      </sizepolicy>
+     </property>
+     <property name="text">
+      <string>Clockwise</string>
+     </property>
+    </widget>
+   </item>
+   <item row="2" column="0">
+    <widget class="QPushButton" name="maxButton">
+     <property name="sizePolicy">
+      <sizepolicy hsizetype="Minimum" vsizetype="Expanding">
+       <horstretch>0</horstretch>
+       <verstretch>0</verstretch>
+      </sizepolicy>
+     </property>
+     <property name="text">
+      <string>Max</string>
+     </property>
+    </widget>
+   </item>
+   <item row="2" column="1">
+    <widget class="QPushButton" name="powerButton">
+     <property name="sizePolicy">
+      <sizepolicy hsizetype="Minimum" vsizetype="Expanding">
+       <horstretch>0</horstretch>
+       <verstretch>0</verstretch>
+      </sizepolicy>
+     </property>
+     <property name="text">
+      <string>Power</string>
+     </property>
+     <property name="icon">
+      <iconset resource="../PierogiResources.qrc">
+       <normaloff>:/icons/on-off_icon&amp;48.png</normaloff>:/icons/on-off_icon&amp;48.png</iconset>
+     </property>
+     <property name="iconSize">
+      <size>
+       <width>48</width>
+       <height>48</height>
+      </size>
+     </property>
+    </widget>
+   </item>
+  </layout>
+ </widget>
+ <resources>
+  <include location="../PierogiResources.qrc"/>
+ </resources>
+ <connections>
+  <connection>
+   <sender>PIRRoombaForm</sender>
+   <signal>spotEnabled(bool)</signal>
+   <receiver>spotButton</receiver>
+   <slot>setEnabled(bool)</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>399</x>
+     <y>239</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>136</x>
+     <y>85</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>PIRRoombaForm</sender>
+   <signal>forwardEnabled(bool)</signal>
+   <receiver>forwardButton</receiver>
+   <slot>setEnabled(bool)</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>399</x>
+     <y>239</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>399</x>
+     <y>85</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>PIRRoombaForm</sender>
+   <signal>cleanEnabled(bool)</signal>
+   <receiver>cleanButton</receiver>
+   <slot>setEnabled(bool)</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>399</x>
+     <y>239</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>663</x>
+     <y>85</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>PIRRoombaForm</sender>
+   <signal>ccwEnabled(bool)</signal>
+   <receiver>ccwButton</receiver>
+   <slot>setEnabled(bool)</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>399</x>
+     <y>239</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>136</x>
+     <y>241</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>PIRRoombaForm</sender>
+   <signal>pauseEnabled(bool)</signal>
+   <receiver>pauseButton</receiver>
+   <slot>setEnabled(bool)</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>399</x>
+     <y>239</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>399</x>
+     <y>241</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>PIRRoombaForm</sender>
+   <signal>cwEnabled(bool)</signal>
+   <receiver>cwButton</receiver>
+   <slot>setEnabled(bool)</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>399</x>
+     <y>239</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>663</x>
+     <y>241</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>PIRRoombaForm</sender>
+   <signal>maxEnabled(bool)</signal>
+   <receiver>maxButton</receiver>
+   <slot>setEnabled(bool)</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>399</x>
+     <y>239</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>136</x>
+     <y>398</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>PIRRoombaForm</sender>
+   <signal>powerEnabled(bool)</signal>
+   <receiver>powerButton</receiver>
+   <slot>setEnabled(bool)</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>399</x>
+     <y>239</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>399</x>
+     <y>398</y>
+    </hint>
+   </hints>
+  </connection>
+ </connections>
+ <slots>
+  <signal>spotEnabled(bool)</signal>
+  <signal>forwardEnabled(bool)</signal>
+  <signal>cleanEnabled(bool)</signal>
+  <signal>ccwEnabled(bool)</signal>
+  <signal>pauseEnabled(bool)</signal>
+  <signal>cwEnabled(bool)</signal>
+  <signal>maxEnabled(bool)</signal>
+  <signal>powerEnabled(bool)</signal>
+ </slots>
+</ui>
diff --git a/keysets/irobot.cpp b/keysets/irobot.cpp
new file mode 100644 (file)
index 0000000..393428c
--- /dev/null
@@ -0,0 +1,34 @@
+#include "irobot.h"
+#include "protocols/irobotprotocol.h"
+
+
+IRobotRoomba1::IRobotRoomba1(
+  unsigned int index)
+  : PIRKeysetMetaData(
+      "Roomba Keyset 1",
+      IRobot_Make,
+      index)
+{
+}
+
+
+void IRobotRoomba1::populateProtocol(
+  QObject *guiObject)
+{
+  if (threadableProtocol)
+  {
+    // Keyset already populated.
+    return;
+  }
+
+  threadableProtocol = new IRobotProtocol(guiObject, index);
+
+  addKey("CounterClockwise", RobotCCW_Key, 0x81, 8);
+  addKey("Forward", RobotForward_Key, 0x82, 8);
+  addKey("Clockwise", RobotCW_Key, 0x83, 8);
+  addKey("spot", RobotSpot_Key, 0x84, 8);
+  addKey("max", RobotMax_Key, 0x85, 8);
+  addKey("clean", RobotClean_Key, 0x88, 8); // "clear"
+  addKey("pause", Pause_Key, 0x89, 8);
+  addKey("power", Power_Key, 0x8A, 8);
+}
diff --git a/keysets/irobot.h b/keysets/irobot.h
new file mode 100644 (file)
index 0000000..c7c3064
--- /dev/null
@@ -0,0 +1,18 @@
+#ifndef IROBOT_H
+#define IROBOT_H
+
+#include "pirkeysetmetadata.h"
+
+class QObject;
+
+class IRobotRoomba1: public PIRKeysetMetaData
+{
+public:
+  IRobotRoomba1(
+    unsigned int index);
+
+  virtual void populateProtocol(
+    QObject *guiObject);
+};
+
+#endif // IROBOT_H
index 2001f37..da23518 100644 (file)
@@ -892,6 +892,43 @@ void SamsungAC1::populateProtocol(
 }
 
 
+/*
+SamsungAC2::SamsungAC2(
+  unsigned int index)
+  : PIRKeysetMetaData(
+      "AC Keyset 2",
+      Samsung_Make,
+      index)
+{
+}
+
+
+void SamsungAC2::populateProtocol(
+  QObject *guiObject)
+{
+  if (threadableProtocol)
+  {
+    // Keyset already populated.
+    return;
+  }
+
+  threadableProtocol = new ACProtocol(guiObject, index);
+
+  addKey("Power Off", PowerOff_Subkey, 0xC, 4);
+  addKey("Power On", PowerOn_Subkey, 0x0, 4);
+
+  addKey("Cool Mode - Normal", CoolModeNormal_Subkey, 0x7, 3);
+  addKey("Cool Mode - Turbo", CoolModeTurbo_Subkey, 0x1, 3);
+  addKey("Cool Mode - Far", CoolModeFar_Subkey, 0x2, 3);
+
+  addKey("Deflector L/R Off", DeflectorLROff_Subkey, 0x0, 1);
+  addKey("Deflector L/R On", DeflectorLROn_Subkey, 0x1, 1);
+  addKey("Deflector U/D Off", DeflectorUDOff_Subkey, 0x0, 1);
+  addKey("Deflector U/D On", DeflectorUDOn_Subkey, 0x1, 1);
+}
+*/
+
+
 SamsungDVBT1::SamsungDVBT1(
   unsigned int index)
   : PIRKeysetMetaData(
index bdce733..d55e661 100644 (file)
@@ -302,7 +302,7 @@ void MainWindow::on_actionSelectKeyset_triggered()
   selectKeysetForm->show();
 }
 
-void MainWindow::on_actionSelect_Device_By_Name_triggered()
+void MainWindow::on_actionBrowse_Device_List_triggered()
 {
   selectDeviceForm->show();
 }
index ef6f19a..ba00799 100644 (file)
@@ -103,7 +103,7 @@ public slots:
 
 private slots:
   void on_actionSelectKeyset_triggered();
-  void on_actionSelect_Device_By_Name_triggered();
+  void on_actionBrowse_Device_List_triggered();
   void on_actionPreferences_triggered();
   void on_actionAbout_triggered();
   void on_actionDocumentation_triggered();
index 19e19c5..4819770 100644 (file)
@@ -49,7 +49,7 @@
      <string>Pierogi</string>
     </property>
     <addaction name="actionSelectKeyset"/>
-    <addaction name="actionSelect_Device_By_Name"/>
+    <addaction name="actionBrowse_Device_List"/>
     <addaction name="actionPreferences"/>
     <addaction name="actionDocumentation"/>
     <addaction name="actionAbout"/>
@@ -58,7 +58,7 @@
   </widget>
   <action name="actionSelectKeyset">
    <property name="text">
-    <string>Select Keyset by Name</string>
+    <string>Select Keyset</string>
    </property>
   </action>
   <action name="actionAbout">
     <string>Documentation</string>
    </property>
   </action>
-  <action name="actionSelect_Device_By_Name">
+  <action name="actionPreferences">
    <property name="text">
-    <string>Select Keyset by Device</string>
+    <string>Preferences</string>
    </property>
   </action>
-  <action name="actionPreferences">
+  <action name="actionBrowse_Device_List">
    <property name="text">
-    <string>Preferences</string>
+    <string>Browse Device List</string>
    </property>
   </action>
  </widget>
index 0d16845..4fb68bf 100644 (file)
@@ -201,7 +201,10 @@ SOURCES += main.cpp mainwindow.cpp \
     dialogs/pirfavoritesdialog.cpp \
     keysets/medion.cpp \
     keysets/blaupunkt.cpp \
-    keysets/lifetec.cpp
+    keysets/lifetec.cpp \
+    keysets/irobot.cpp \
+    protocols/irobotprotocol.cpp \
+    forms/pirroombaform.cpp
 HEADERS += mainwindow.h \
     pirkeynames.h \
     pirmakenames.h \
@@ -378,7 +381,10 @@ HEADERS += mainwindow.h \
     dialogs/pirfavoritesdialog.h \
     keysets/medion.h \
     keysets/blaupunkt.h \
-    keysets/lifetec.h
+    keysets/lifetec.h \
+    keysets/irobot.h \
+    protocols/irobotprotocol.h \
+    forms/pirroombaform.h
 FORMS += mainwindow.ui \
     pirdocumentationform.ui \
     piraboutform.ui \
@@ -405,7 +411,8 @@ FORMS += mainwindow.ui \
     forms/pirvcrform.ui \
     forms/pirvideodiscform.ui \
     forms/piraudiodeviceform.ui \
-    dialogs/pirfavoritesdialog.ui
+    dialogs/pirfavoritesdialog.ui \
+    forms/pirroombaform.ui
 
 # Please do not modify the following two lines. Required for deployment.
 include(deployment.pri)
index 98159bc..7a9000d 100644 (file)
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE QtCreatorProject>
-<!-- Written by Qt Creator 2.4.1, 2012-09-02T21:07:06. -->
+<!-- Written by Qt Creator 2.4.1, 2012-09-03T17:58:02. -->
 <qtcreator>
  <data>
   <variable>ProjectExplorer.Project.ActiveTarget</variable>
@@ -78,8 +78,8 @@
      <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.2">
       <value type="QString" key="ProjectExplorer.ProcessStep.Arguments">dpkg-buildpackage -sa -S -uc -us</value>
       <value type="QString" key="ProjectExplorer.ProcessStep.Command">/Users/john/QtSDK/Maemo/4.6.2/bin/mad</value>
-      <value type="bool" key="ProjectExplorer.ProcessStep.Enabled">false</value>
-      <value type="QString" key="ProjectExplorer.ProcessStep.WorkingDirectory">/Users/john/Develop/n900/pierogi-1.1.5</value>
+      <value type="bool" key="ProjectExplorer.ProcessStep.Enabled">true</value>
+      <value type="QString" key="ProjectExplorer.ProcessStep.WorkingDirectory">/Users/john/Develop/n900/pierogi-1.1.6</value>
       <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Custom Process Step</value>
       <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
       <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.ProcessStep</value>
        <value type="QDateTime">2012-01-17T13:21:05</value>
        <value type="QDateTime">2012-01-23T09:47:37</value>
        <value type="QDateTime">2012-02-03T10:04:34</value>
-       <value type="QDateTime">2012-09-02T21:07:05</value>
+       <value type="QDateTime">2012-09-03T17:43:57</value>
        <value type="QDateTime">2012-03-04T19:56:48</value>
        <value type="QDateTime">2012-01-01T15:35:35</value>
        <value type="QDateTime">2012-03-12T20:02:57</value>
index 148a334..16abe63 100644 (file)
@@ -219,6 +219,14 @@ enum PIRKeyName{
   FanSlower_Key,
   EnergySave_Key,
 
+  // iRobot controls:
+  RobotForward_Key,
+  RobotCW_Key,
+  RobotCCW_Key,
+  RobotSpot_Key,
+  RobotMax_Key,
+  RobotClean_Key,
+
   // Other keys:
   Captions_Key,
   Info_Key,
index 0141a4d..817594c 100644 (file)
@@ -52,6 +52,7 @@
 #include "keysets/huawei.h"
 #include "keysets/humax.h"
 #include "keysets/hyundai.h"
+#include "keysets/irobot.h"
 #include "keysets/jvc.h"
 #include "keysets/kaon.h"
 #include "keysets/kathrein.h"
@@ -362,6 +363,8 @@ PIRKeysetManager::PIRKeysetManager()
   setupKeyset(new HyundaiAudio1(++counter));
   setupKeyset(new HyundaiTV1(++counter));
 
+  setupKeyset(new IRobotRoomba1(++counter));
+
   setupKeyset(new JVCSat1(++counter));
   setupKeyset(new JVCSat2(++counter));
   setupKeyset(new JVCVCR1(++counter));
index dd8c547..1fa1dec 100644 (file)
@@ -50,6 +50,7 @@ PIRMakeMgr::PIRMakeMgr()
   makes[Huawei_Make] = "Huawei";
   makes[Humax_Make] = "Humax";
   makes[Hyundai_Make] = "Hyundai";
+  makes[IRobot_Make] = "iRobot";
   makes[JVC_Make] = "JVC";
   makes[Kaon_Make] = "Kaon";
   makes[Kathrein_Make] = "Kathrein";
index 3661044..3df98e1 100644 (file)
@@ -51,6 +51,7 @@ enum PIRMakeName{
   Huawei_Make,
   Humax_Make,
   Hyundai_Make,
+  IRobot_Make,
   JVC_Make,
   Kaon_Make,
   Kathrein_Make,
index 36e61b5..0511bfc 100644 (file)
@@ -13,6 +13,7 @@
 #include "forms/piradjustform.h"
 #include "forms/pirairconditionerform.h"
 #include "forms/piraudiodeviceform.h"
+#include "forms/pirroombaform.h"
 
 #include "mainwindow.h"
 
@@ -39,6 +40,7 @@ PIRPanelManager::PIRPanelManager(
     adjustForm(0),
     acForm(0),
     audioDeviceForm(0),
+    roombaForm(0),
     altMainPanelFlag(false),
     currentTabsName(Universal_Tabs),
     mainWindow(mw)
@@ -86,6 +88,9 @@ PIRPanelManager::PIRPanelManager(
   shortPanelNames[Audio_Panel] = "Audio";
   longPanelNames[Audio_Panel] =
     "Audio Device Panel - various audio related buttons";
+  shortPanelNames[Roomba_Panel] = "Roomba";
+  longPanelNames[Roomba_Panel] =
+    "Roomba Panel - robotic vacuum cleaner controls";
 
   mainForm = new PIRMainForm(mainWindow);
   panels[Main_Panel] = mainForm;
@@ -126,6 +131,9 @@ PIRPanelManager::PIRPanelManager(
   audioDeviceForm = new PIRAudioDeviceForm(mainWindow);
   panels[Audio_Panel] = audioDeviceForm;
 
+  roombaForm = new PIRRoombaForm(mainWindow);
+  panels[Roomba_Panel] = roombaForm;
+
   // Set up the panel collections:
   PIRPanelNameList pset;
 
@@ -135,7 +143,7 @@ PIRPanelManager::PIRPanelManager(
   pset.push_back(Keypad_Panel);
   pset.push_back(Menu_Panel);
   pset.push_back(Media_Panel);
-  pset.push_back(Input_Panel);
+//  pset.push_back(Input_Panel);
   tabLists[Universal_Tabs] = pset;
 
   // The TV collection:
@@ -175,6 +183,11 @@ PIRPanelManager::PIRPanelManager(
   pset.push_back(Record_Panel);
   pset.push_back(Keypad_Panel);
   tabLists[Record_Tabs] = pset;
+
+  // The Roomba collection:
+  pset.clear();
+  pset.push_back(Roomba_Panel);
+  tabLists[Roomba_Tabs] = pset;
 }
 
 
@@ -252,6 +265,7 @@ void PIRPanelManager::commonEnableButtons(
   adjustForm->enableButtons(keyset, id);
   acForm->enableButtons(keyset, id);
   audioDeviceForm->enableButtons(keyset, id);
+  roombaForm->enableButtons(keyset, id);
 }
 
 
index 8c065ed..c2cb046 100644 (file)
@@ -16,6 +16,7 @@ class PIRInputForm;
 class PIRAdjustForm;
 class PIRAirConditionerForm;
 class PIRAudioDeviceForm;
+class PIRRoombaForm;
 
 class PIRKeysetWidgetItem;
 class PIRKeysetManager;
@@ -83,6 +84,7 @@ private:
   PIRAdjustForm *adjustForm;
   PIRAirConditionerForm *acForm;
   PIRAudioDeviceForm *audioDeviceForm;
+  PIRRoombaForm *roombaForm;
 
   PIRPanelDisplayNameCollection shortPanelNames;
   PIRPanelDisplayNameCollection longPanelNames;
index 19f3eee..967913c 100644 (file)
@@ -16,6 +16,7 @@ enum PIRPanelName
   Adjust_Panel,
   AC_Panel,
   Audio_Panel,
+  Roomba_Panel,
   Last_Panel_Marker // Used when traversing this enumeration.
 };
 
@@ -29,7 +30,8 @@ enum PIRTabBarName
 //  VideoTape_Tabs,
   Audio_Tabs,
   AC_Tabs,
-  Record_Tabs
+  Record_Tabs,
+  Roomba_Tabs
 };
 
 #endif // PIRPANELNAMES_H
index f4c2cb7..8d6f403 100644 (file)
@@ -9,6 +9,9 @@
 #include "pirkeysetwidgetitem.h"
 #include "dialogs/pireditkeysetdialog.h"
 
+// Debugging include:
+//#include <iostream>
+
 extern PIRMakeMgr makeManager;
 
 PIRSelectKeysetForm::PIRSelectKeysetForm(
@@ -17,6 +20,7 @@ PIRSelectKeysetForm::PIRSelectKeysetForm(
     ui(new Ui::PIRSelectKeysetForm),
     mainWindow(mw),
     editDialog(0),
+    showOnlyFavorites(false),
     currentMake(Any_Make)
 {
   ui->setupUi(this);
@@ -149,12 +153,20 @@ void PIRSelectKeysetForm::refilterList()
     // Does the keylist have the required make?
     if ((currentMake == Any_Make) || (item->getMake() == currentMake))
     {
-      // Does this keylist match the search string?
-      if ( searchString.isEmpty()
-        || item->text().contains(searchString, Qt::CaseInsensitive))
+      // If required, is the keyset a favorite?
+      if (!showOnlyFavorites || (item->isFavorite()))
       {
-        // Yes, we can show this keylist:
-        item->setHidden(false);
+        // Does this keylist match the search string?
+        if ( searchString.isEmpty()
+          || item->text().contains(searchString, Qt::CaseInsensitive))
+        {
+          // Yes, we can show this keylist:
+          item->setHidden(false);
+        }
+        else
+        {
+          item->setHidden(true);
+        }
       }
       else
       {
@@ -180,3 +192,10 @@ void PIRSelectKeysetForm::openKeysetDialog(
 
   editDialog->exec();
 }
+
+
+void PIRSelectKeysetForm::on_showFavoritesCheckBox_toggled(bool checked)
+{
+  showOnlyFavorites = checked;
+  refilterList();
+}
index 29e5667..58609f0 100644 (file)
@@ -58,6 +58,7 @@ private slots:
   
   void on_searchStringLineEdit_textChanged(const QString &arg1);
   void on_ssClosePushButton_clicked();
+  void on_showFavoritesCheckBox_toggled(bool checked);
 
 private:
   void refilterList();
@@ -67,6 +68,7 @@ private:
   MainWindow *mainWindow;
   PIREditKeysetDialog *editDialog;
 
+  bool showOnlyFavorites;
   PIRMakeName currentMake;
   QString searchString;
 };
index 62fe3bc..7b07973 100644 (file)
    <string>Select Keyset</string>
   </property>
   <layout class="QVBoxLayout" name="verticalLayout">
-   <property name="margin">
-    <number>8</number>
-   </property>
    <item>
-    <layout class="QHBoxLayout" name="horizontalLayout">
+    <layout class="QHBoxLayout" name="horizontalLayout_3">
      <item>
-      <widget class="QLabel" name="makeLabel">
-       <property name="sizePolicy">
-        <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
-         <horstretch>0</horstretch>
-         <verstretch>0</verstretch>
-        </sizepolicy>
-       </property>
+      <widget class="QCheckBox" name="showFavoritesCheckBox">
        <property name="text">
-        <string>Make:</string>
+        <string>Only Show Favorites</string>
        </property>
       </widget>
      </item>
      <item>
-      <widget class="QComboBox" name="makeComboBox">
-       <property name="sizePolicy">
-        <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
-         <horstretch>0</horstretch>
-         <verstretch>0</verstretch>
-        </sizepolicy>
+      <spacer name="horizontalSpacer">
+       <property name="orientation">
+        <enum>Qt::Horizontal</enum>
        </property>
-       <property name="focusPolicy">
-        <enum>Qt::NoFocus</enum>
+       <property name="sizeType">
+        <enum>QSizePolicy::Minimum</enum>
        </property>
-      </widget>
+       <property name="sizeHint" stdset="0">
+        <size>
+         <width>20</width>
+         <height>20</height>
+        </size>
+       </property>
+      </spacer>
+     </item>
+     <item>
+      <layout class="QHBoxLayout" name="horizontalLayout">
+       <item>
+        <widget class="QLabel" name="makeLabel">
+         <property name="sizePolicy">
+          <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
+           <horstretch>0</horstretch>
+           <verstretch>0</verstretch>
+          </sizepolicy>
+         </property>
+         <property name="text">
+          <string>Filter by Make:</string>
+         </property>
+        </widget>
+       </item>
+       <item>
+        <widget class="QComboBox" name="makeComboBox">
+         <property name="sizePolicy">
+          <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
+           <horstretch>0</horstretch>
+           <verstretch>0</verstretch>
+          </sizepolicy>
+         </property>
+         <property name="focusPolicy">
+          <enum>Qt::NoFocus</enum>
+         </property>
+        </widget>
+       </item>
+      </layout>
      </item>
     </layout>
    </item>
diff --git a/protocols/irobotprotocol.cpp b/protocols/irobotprotocol.cpp
new file mode 100644 (file)
index 0000000..c2ac7ab
--- /dev/null
@@ -0,0 +1,187 @@
+#include "irobotprotocol.h"
+
+#include "pirrx51hardware.h"
+
+#include "pirexception.h"
+
+// Some global communications stuff:
+#include <QMutex>
+extern bool commandInFlight;
+extern QMutex commandIFMutex;
+
+// The iRobot (Roomba) protocol seems to be extremely simple.
+// A "zero" is encoded with a 1000 usec pulse, 3000 usec space.
+// A "one" is encoded with a 3000 usec pulse, 1000 usec space.
+// So, it looks a little like a shift encoded protocol, even though it
+// is space-encoded.
+// There is no header and no trailer.
+// Each command may run for 100000 usec (sources differ), but it looks like
+// commands are not repeated at all...
+// The carrier frequency is the usual 38 kHz.
+
+IRobotProtocol::IRobotProtocol(
+  QObject *guiObject,
+  unsigned int index)
+  : SpaceProtocol(
+      guiObject, index,
+      1000, 3000,
+      3000, 1000,
+      0, 0,
+      0,
+      100000, true)
+{
+}
+
+
+void IRobotProtocol::startSendingCommand(
+  unsigned int threadableID,
+  PIRKeyName command)
+{
+  // Exceptions here are problematic; I'll try to weed them out by putting the
+  // whole thing in a try/catch block:
+  try
+  {
+    // First, check if we are meant to be the recipient of this command:
+    if (threadableID != id) return;
+
+    clearRepeatFlag();
+
+    KeycodeCollection::const_iterator i = keycodes.find(command);
+
+    // Do we even have this key defined?
+    if (i == keycodes.end())
+    {
+      std::string s = "Tried to send a non-existent command.\n";
+      throw PIRException(s);
+    }
+
+    // construct the device:
+    PIRRX51Hardware rx51device(carrierFrequency, dutyCycle);
+
+    int repeatCount = 0;
+    int commandDuration = 0;
+    while (repeatCount < MAX_REPEAT_COUNT)
+    {
+      // It looks like we only generate the command once, and remain
+      // silent for the rest of the time the button is held down.  So, no
+      // repeats.
+      if (!repeatCount)
+      {
+        commandDuration = generateCommand((*i).second, rx51device);
+
+        // Tell the device to send the command:
+        rx51device.sendCommandToDevice();
+      }
+
+      // sleep until the next repetition of command:
+      sleepUntilRepeat(commandDuration);
+
+      // Check whether we've reached the minimum required number of repetitons:
+      if (repeatCount >= minimumRepetitions)
+      {
+        // Check whether we've been asked to stop:
+        if (checkRepeatFlag())
+        {
+          QMutexLocker cifLocker(&commandIFMutex);
+          commandInFlight = false;
+          return;
+        }
+      }
+
+      ++repeatCount;
+    }
+  }
+  catch (PIRException e)
+  {
+    // inform the gui:
+    emit commandFailed(e.getError().c_str());
+  }
+
+  QMutexLocker cifLocker(&commandIFMutex);
+  commandInFlight = false;
+}
+
+
+int IRobotProtocol::generateCommand(
+  const PIRKeyBits &pkb,
+  PIRRX51Hardware &rx51device)
+{
+  int duration = 0;
+
+  // The protocol seems to involve 8 command bits, a 16000 usec pause, and
+  // the same 8 bits repeated again.  So, we need to tack a 16000 usec
+  // space on at the end of the first 8 bits, and just drop the last space
+  // definition at the end of the second 8 bits:
+
+  // The first 7 bits:
+  int index = 0;
+  CommandSequence::const_iterator i = pkb.firstCode.begin();
+  while ((index < 7) && (i != pkb.firstCode.end()))
+  {
+    if (*i)
+    {
+      rx51device.addPair(onePulse, oneSpace);
+      duration += onePulse + oneSpace;
+    }
+    else
+    {
+      rx51device.addPair(zeroPulse, zeroSpace);
+      duration += zeroPulse + zeroSpace;
+    }
+
+    ++index;
+    ++i;
+  }
+
+  // Eighth bit with extra space at the end:
+  if (i != pkb.firstCode.end())
+  {
+    if (*i)
+    {
+      rx51device.addPair(onePulse, oneSpace + 16000);
+      duration += onePulse + oneSpace + 16000;
+    }
+    else
+    {
+      rx51device.addPair(zeroPulse, zeroSpace + 16000);
+      duration += zeroPulse + zeroSpace + 16000;
+    }
+  }
+
+  // The following seven bits:
+  index = 0;
+  i = pkb.firstCode.begin();
+  while ((index < 7) && (i != pkb.firstCode.end()))
+  {
+    if (*i)
+    {
+      rx51device.addPair(onePulse, oneSpace);
+      duration += onePulse + oneSpace;
+    }
+    else
+    {
+      rx51device.addPair(zeroPulse, zeroSpace);
+      duration += zeroPulse + zeroSpace;
+    }
+
+    ++index;
+    ++i;
+  }
+
+  // The last half-bit:
+  if (i != pkb.firstCode.end())
+  {
+    if (*i)
+    {
+      rx51device.addSingle(onePulse);
+      duration += onePulse;
+    }
+    else
+    {
+      rx51device.addSingle(zeroPulse);
+      duration += zeroPulse;
+    }
+  }
+
+  return duration;
+}
diff --git a/protocols/irobotprotocol.h b/protocols/irobotprotocol.h
new file mode 100644 (file)
index 0000000..b2378c5
--- /dev/null
@@ -0,0 +1,30 @@
+#ifndef IROBOTPROTOCOL_H
+#define IROBOTPROTOCOL_H
+
+#include "spaceprotocol.h"
+
+class PIRRX51Hardware;
+
+// The iRobot protocol is extremely simple, but my sources differ slightly
+// on its exact properties (particularly how repetition is handled).  So
+// this may need some reworking in the future.
+
+class IRobotProtocol: public SpaceProtocol
+{
+public:
+  IRobotProtocol(
+    QObject *guiObject,
+    unsigned int index);
+
+public slots:
+  void startSendingCommand(
+    unsigned int threadableID,
+    PIRKeyName command);
+
+private:
+  int generateCommand(
+    const PIRKeyBits &bits,
+    PIRRX51Hardware &device);
+};
+
+#endif // IROBOTPROTOCOL_H

Terms of Use    Privacy Policy    Contribution Guidelines    Feedback

Powered By GForge Collaborative Development Environment