<item>
<widget class="QCheckBox" name="addToFavoritesCheckBox">
<property name="text">
- <string>Add keyset to favorites list</string>
+ <string>Favorite Keyset</string>
</property>
</widget>
</item>
</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">
ui->tabsChoiceListWidget->addItem(
new PIRTabsWidgetItem("Air Conditioner Panels", AC_Tabs));
+
+ ui->tabsChoiceListWidget->addItem(
+ new PIRTabsWidgetItem("Roomba Panels", Roomba_Tabs));
}
--- /dev/null
+#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();
+}
--- /dev/null
+#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
--- /dev/null
+<?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&48.png</normaloff>:/icons/playback_pause_icon&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&48.png</normaloff>:/icons/on-off_icon&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>
--- /dev/null
+#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);
+}
--- /dev/null
+#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
}
+/*
+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(
selectKeysetForm->show();
}
-void MainWindow::on_actionSelect_Device_By_Name_triggered()
+void MainWindow::on_actionBrowse_Device_List_triggered()
{
selectDeviceForm->show();
}
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();
<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"/>
</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>
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 \
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 \
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)
<?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>
<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>
FanSlower_Key,
EnergySave_Key,
+ // iRobot controls:
+ RobotForward_Key,
+ RobotCW_Key,
+ RobotCCW_Key,
+ RobotSpot_Key,
+ RobotMax_Key,
+ RobotClean_Key,
+
// Other keys:
Captions_Key,
Info_Key,
#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"
setupKeyset(new HyundaiAudio1(++counter));
setupKeyset(new HyundaiTV1(++counter));
+ setupKeyset(new IRobotRoomba1(++counter));
+
setupKeyset(new JVCSat1(++counter));
setupKeyset(new JVCSat2(++counter));
setupKeyset(new JVCVCR1(++counter));
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";
Huawei_Make,
Humax_Make,
Hyundai_Make,
+ IRobot_Make,
JVC_Make,
Kaon_Make,
Kathrein_Make,
#include "forms/piradjustform.h"
#include "forms/pirairconditionerform.h"
#include "forms/piraudiodeviceform.h"
+#include "forms/pirroombaform.h"
#include "mainwindow.h"
adjustForm(0),
acForm(0),
audioDeviceForm(0),
+ roombaForm(0),
altMainPanelFlag(false),
currentTabsName(Universal_Tabs),
mainWindow(mw)
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;
audioDeviceForm = new PIRAudioDeviceForm(mainWindow);
panels[Audio_Panel] = audioDeviceForm;
+ roombaForm = new PIRRoombaForm(mainWindow);
+ panels[Roomba_Panel] = roombaForm;
+
// Set up the panel collections:
PIRPanelNameList pset;
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:
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;
}
adjustForm->enableButtons(keyset, id);
acForm->enableButtons(keyset, id);
audioDeviceForm->enableButtons(keyset, id);
+ roombaForm->enableButtons(keyset, id);
}
class PIRAdjustForm;
class PIRAirConditionerForm;
class PIRAudioDeviceForm;
+class PIRRoombaForm;
class PIRKeysetWidgetItem;
class PIRKeysetManager;
PIRAdjustForm *adjustForm;
PIRAirConditionerForm *acForm;
PIRAudioDeviceForm *audioDeviceForm;
+ PIRRoombaForm *roombaForm;
PIRPanelDisplayNameCollection shortPanelNames;
PIRPanelDisplayNameCollection longPanelNames;
Adjust_Panel,
AC_Panel,
Audio_Panel,
+ Roomba_Panel,
Last_Panel_Marker // Used when traversing this enumeration.
};
// VideoTape_Tabs,
Audio_Tabs,
AC_Tabs,
- Record_Tabs
+ Record_Tabs,
+ Roomba_Tabs
};
#endif // PIRPANELNAMES_H
#include "pirkeysetwidgetitem.h"
#include "dialogs/pireditkeysetdialog.h"
+// Debugging include:
+//#include <iostream>
+
extern PIRMakeMgr makeManager;
PIRSelectKeysetForm::PIRSelectKeysetForm(
ui(new Ui::PIRSelectKeysetForm),
mainWindow(mw),
editDialog(0),
+ showOnlyFavorites(false),
currentMake(Any_Make)
{
ui->setupUi(this);
// 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
{
editDialog->exec();
}
+
+
+void PIRSelectKeysetForm::on_showFavoritesCheckBox_toggled(bool checked)
+{
+ showOnlyFavorites = checked;
+ refilterList();
+}
void on_searchStringLineEdit_textChanged(const QString &arg1);
void on_ssClosePushButton_clicked();
+ void on_showFavoritesCheckBox_toggled(bool checked);
private:
void refilterList();
MainWindow *mainWindow;
PIREditKeysetDialog *editDialog;
+ bool showOnlyFavorites;
PIRMakeName currentMake;
QString searchString;
};
<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>
--- /dev/null
+#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;
+}
--- /dev/null
+#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