Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added usb-serial adapter page under utilities

  • Loading branch information...
commit afa4c6dec8095c03fea6449c8db7624a49846375 1 parent d97a682
kipr authored
Showing with 1,856 additions and 256 deletions.
  1. +5 −5 Makefile
  2. +1 −1  Readme.markdown
  3. +10 −7 cbcui/cbcui.pro
  4. +1 −1  cbcui/src/Brightness.cpp
  5. +1 −1  cbcui/src/Compiler.h
  6. +31 −23 cbcui/src/FileManager.cpp
  7. +1 −0  cbcui/src/FileManager.h
  8. +23 −10 cbcui/src/Keypad.cpp
  9. +4 −1 cbcui/src/Keypad.h
  10. +9 −2 cbcui/src/MainWindow.cpp
  11. +243 −0 cbcui/src/Serial/SerialPage.cpp
  12. +75 −0 cbcui/src/Serial/SerialPage.h
  13. +107 −20 cbcui/src/{ → Serial}/SerialPort.cpp
  14. +7 −1 cbcui/src/{ → Serial}/SerialPort.h
  15. +3 −4 cbcui/src/{ → Serial}/SerialServer.cpp
  16. 0  cbcui/src/{ → Serial}/SerialServer.h
  17. +2 −1  cbcui/src/Utilities.cpp
  18. +2 −0  cbcui/src/Utilities.h
  19. +25 −0 cbcui/src/keyboard/CBCKbdPlugin.cpp
  20. +16 −0 cbcui/src/keyboard/CBCKbdPlugin.h
  21. BIN  cbcui/src/keyboard/CBCKbdPlugin.o
  22. +234 −0 cbcui/src/keyboard/Makefile
  23. +9 −0 cbcui/src/keyboard/cbcKeyPlugin.pro
  24. +1 −0  cbcui/src/keyboard/libcbckbdplugin.so
  25. +1 −0  cbcui/src/keyboard/libcbckbdplugin.so.1
  26. +1 −0  cbcui/src/keyboard/libcbckbdplugin.so.1.0
  27. BIN  cbcui/src/keyboard/libcbckbdplugin.so.1.0.0
  28. +212 −0 cbcui/src/keyboard/qcbclinuxinput.cpp
  29. +20 −0 cbcui/src/keyboard/qcbclinuxinput.h
  30. +78 −0 cbcui/src/keyboard/qcbclinuxinput.moc
  31. BIN  cbcui/src/keyboard/qcbclinuxinput.o
  32. +82 −21 cbcui/ui/About.ui
  33. +307 −0 cbcui/ui/Serial.ui
  34. +159 −37 cbcui/ui/Utilities.ui
  35. +1 −1  filesystem/ext2/files/FIRMWARE_VERSION
  36. +35 −29 filesystem/ext2/files/cbc_boot
  37. +1 −0  filesystem/ext2/files/config/ts_vars.env
  38. +3 −3 filesystem/ext2/files/gui/startup.sh
  39. +43 −11 filesystem/ext2/files/usercode/mount-usb
  40. +15 −3 filesystem/ext2/files/usercode/umount-usb
  41. +6 −8 filesystem/upgrade/Makefile
  42. +27 −15 filesystem/upgrade/{userhook0.body → cbc_interface.body}
  43. +55 −0 filesystem/upgrade/make-cbc_interface.pl
  44. +0 −51 filesystem/upgrade/make-userhook0.pl
View
10 Makefile
@@ -1,8 +1,8 @@
QTEMBEDDED_QMAKE=/mnt/kiss/qt/bin/qmake
-all: userhook0
+all: cbc_interface
-clean: userhook0_clean
+clean: cbc_interface_clean
fb_print:
make -C utils/fb_print
@@ -42,10 +42,10 @@ cbcui: userlib
cbcui_clean:
(if test -e cbcui/Makefile; then make -C cbcui distclean; fi)
-userhook0: cbcui userlib fb_print
+cbc_interface: cbcui userlib fb_print
make -C filesystem/upgrade
-userhook0_clean: cbcui_clean userlib_clean fb_print_clean
+cbc_interface_clean: cbcui_clean userlib_clean fb_print_clean
make -C filesystem/upgrade clean
-.PHONY: userhook0 cbcui userlib libcbc tracklib shared_mem fb_print
+.PHONY: cbc_interface cbcui userlib libcbc tracklib shared_mem fb_print
View
2  Readme.markdown
@@ -42,5 +42,5 @@ Building the software is simple:
cd cbc
make
-You should now have a userhook0 file in filesystem/upgrade. Happy Hacking!
+You should now have a CBC_interface file in filesystem/upgrade. Happy Hacking!
View
17 cbcui/cbcui.pro
@@ -46,10 +46,11 @@ HEADERS += src/MainWindow.h \
src/Keypad.h \
src/MotorTuning.h \
src/MotorTest.h \
- src/SerialPort.h \
- src/SerialServer.h \
src/Brightness.h \
- src/Volume.h
+ src/Volume.h \
+ src//Serial/SerialPort.h \
+ src/Serial/SerialServer.h \
+ src/Serial/SerialPage.h
FORMS += ui/MainWindow.ui \
ui/MainMenu.ui \
ui/Programs.ui \
@@ -73,7 +74,8 @@ FORMS += ui/MainWindow.ui \
ui/MotorTuning.ui \
ui/MotorTest.ui \
ui/Brightness.ui \
- ui/Volume.ui
+ ui/Volume.ui \
+ ui/Serial.ui
SOURCES += src/main.cpp \
src/MainWindow.cpp \
src/MainMenu.cpp \
@@ -101,10 +103,11 @@ SOURCES += src/main.cpp \
src/Keypad.cpp \
src/MotorTuning.cpp \
src/MotorTest.cpp \
- src/SerialPort.cpp \
- src/SerialServer.cpp \
src/Brightness.cpp \
- src/Volume.cpp
+ src/Volume.cpp \
+ src/Serial/SerialPort.cpp \
+ src/Serial/SerialServer.cpp \
+ src/Serial/SerialPage.cpp
# Vision
SOURCES += src/vision/Blob.cpp
View
2  cbcui/src/Brightness.cpp
@@ -37,7 +37,7 @@ Brightness::Brightness(QWidget *parent) :
{
setupUi(this);
- m_dimAfter = m_settings.value(DIM_AFTER_KEY, 1).toInt(); // set dim delay value
+ m_dimAfter = m_settings.value(DIM_AFTER_KEY, 3).toInt(); // set dim delay value
m_brightness = m_settings.value(BRIGHTNESS_KEY, 500).toInt(); // brightness values range from 0-512
m_dimOff = m_settings.value(DIM_OFF_KEY,false).toBool(); // when screen goes dim it is turned off
m_settings.sync();
View
2  cbcui/src/Compiler.h
@@ -23,7 +23,7 @@
#include "ui_Compiler.h"
#include "Page.h"
-#include "SerialServer.h"
+#include "Serial/SerialServer.h"
#include <QProcess>
View
54 cbcui/src/FileManager.cpp
@@ -124,13 +124,6 @@ FileManager::~FileManager()
{
}
-bool FileManager::isUSBMounted()
-{
- QFileInfo info("/mnt/browser/usb");
-
- return info.exists();
-}
-
void FileManager::on_ui_directoryBrowser_clicked(const QModelIndex &index)
{
m_index = index;
@@ -148,11 +141,6 @@ void FileManager::updateGUI()
QString indexName = m_dir.filePath(m_index);
ui_directoryBrowser->setCurrentIndex(m_index);
- if(this->isUSBMounted())
- ui_mountButton->setText("Unmnt. USB");
- else
- ui_mountButton->setText("Mount USB");
-
// Directory user interface setup
if(m_dir.isDir(m_index)) {
ui_actionButton->setText("Open");
@@ -161,7 +149,7 @@ void FileManager::updateGUI()
if(indexName == DEFAULT_PATH ||
indexName == INTERNAL_USER_PATH ||
- indexName == USB_USER_PATH ||
+ indexName.startsWith(USB_USER_PATH) ||
indexName.endsWith("."))
{
// ui_copyButton->hide(); // uncomment to allow copy
@@ -188,7 +176,7 @@ void FileManager::updateGUI()
ui_actionButton->show();
ui_stopButton->show();
}
- else if(filename == "userhook0")
+ else if(filename == "CBC_interface")
{
ui_actionButton->setText("Install");
ui_actionButton->show();
@@ -212,30 +200,41 @@ void FileManager::on_ui_homeButton_clicked()
updateGUI();
}
-// mounts and Unmounts the external usb stick
+bool FileManager::isUSBMounted()
+{
+ QFileInfo info(USB_USER_PATH);
+
+ return info.exists();
+}
+
+// mounts and unmounts the external usb stick
void FileManager::on_ui_mountButton_clicked()
{
QProcess mount;
- if(!this->isUSBMounted()){
- mount.start("/mnt/kiss/usercode/mount-usb");
+ if(!this->isUSBMounted())
+ {
+ mount.start(QString("/mnt/kiss/usercode/mount-usb ").append(USB_USER_PATH));
mount.waitForFinished();
if(mount.exitCode()) return; // don't change gui if mount fails
m_index = m_dir.index(USB_USER_PATH);
+ ui_mountButton->setText("Unmnt. USB");
}
else{
- if(m_dir.filePath(m_index).startsWith(USB_USER_PATH)){
+ if(m_dir.filePath(m_index).startsWith(USB_USER_PATH))
+ {
m_index = m_dir.index(DEFAULT_PATH);
ui_directoryBrowser->setRootIndex(m_index);
ui_directoryBrowser->setCurrentIndex(m_index);
m_dir.setFilter(QDir::AllEntries | QDir::NoDotAndDotDot);
}
- mount.start("/mnt/kiss/usercode/umount-usb");
+ mount.start(QString("/mnt/kiss/usercode/umount-usb ").append(USB_USER_PATH));
mount.waitForFinished();
if(mount.exitCode()) return; // don't change gui if unmount fails
+ ui_mountButton->setText("Mount USB");
QProcess::startDetached("btplay /mnt/kiss/sounds/disconnected.wav");
}
@@ -296,11 +295,11 @@ void FileManager::on_ui_actionButton_clicked()
qWarning("%s",qPrintable(soundFile));
QProcess::startDetached(soundFile.toLocal8Bit());
}
- // file is a userhook0 update file
- else if(fileInfo.fileName() == "userhook0"){
+// file is a CBC_interface update file
+ else if(fileInfo.fileName() == "CBC_interface"){
int ret = QMessageBox::warning(this,
- "Update Userhook0",
+ "Update CBC Interface",
"This will take a few minutes!\nDo not unplug USB key.",
QMessageBox::Cancel | QMessageBox::Ok,
QMessageBox::Cancel);
@@ -309,7 +308,16 @@ void FileManager::on_ui_actionButton_clicked()
QFile upgradeFile("/psp/kiss_upgrade");
if(upgradeFile.open(QIODevice::WriteOnly | QIODevice::Text))
{
- upgradeFile.write(fileInfo.absoluteFilePath().remove("/browser").toLocal8Bit());
+ QProcess updateFeatures;
+ // run the CBC Interface file to get all new features it includes
+ updateFeatures.start(fileInfo.absoluteFilePath().append(" --features"));
+ updateFeatures.waitForFinished();
+ // save the features names
+ QString featureString(updateFeatures.readAllStandardOutput());
+
+ // prepend the location of the interface file to the update arguments
+ featureString.prepend(fileInfo.absoluteFilePath().remove("/browser"));
+ upgradeFile.write(featureString.toLocal8Bit());
upgradeFile.close();
::system("reboot"); // reboot the cbc to install
}
View
1  cbcui/src/FileManager.h
@@ -74,6 +74,7 @@ public slots:
Compiler m_compiler;
QFileSystemModel m_dir;
QModelIndex m_index;
+ //QStringList m_usbMounts;
};
#endif
View
33 cbcui/src/Keypad.cpp
@@ -21,8 +21,8 @@
#include <QMessageBox>
#include <QProcess>
-Keypad::Keypad(QWidget *parent, int min, int max)
- : QDialog(parent),minVal(min),maxVal(max)
+Keypad::Keypad(QWidget *parent, int min, int max, int type)
+ : QDialog(parent),keypadType(type),minVal(min),maxVal(max)
{
setupUi(this);
this->move(100,25);
@@ -34,6 +34,11 @@ Keypad::Keypad(QWidget *parent, int min, int max)
#endif
userValue = 0;
+ if(keypadType)
+ {
+ ui_negateButton->setText("Sp");
+ }
+
}
Keypad::~Keypad()
@@ -84,15 +89,19 @@ void Keypad::on_ui_nineButton_clicked(bool)
}
void Keypad::on_ui_zeroButton_clicked(bool)
{
- if(ui_outputLine->text() == "" || ui_outputLine->text().toInt() == 0) return;
+ if((ui_outputLine->text() == "" || ui_outputLine->text().toInt() == 0) && keypadType == 0) return;
ui_outputLine->insert(QString::number(0));
}
void Keypad::on_ui_negateButton_clicked(bool)
{
- QString value = ui_outputLine->text();
- userValue = value.toInt();
- userValue = -userValue;
- this->refreshView();
+ if(keypadType == 0){
+ QString value = ui_outputLine->text();
+ userValue = value.toInt();
+ userValue = -userValue;
+ this->refreshView();
+ }
+ else
+ ui_outputLine->insert(" ");
}
void Keypad::on_ui_clearButton_clicked(bool)
{
@@ -101,9 +110,9 @@ void Keypad::on_ui_clearButton_clicked(bool)
}
void Keypad::on_ui_enterButton_clicked(bool)
{
- QString value = ui_outputLine->text();
- userValue = value.toInt();
- if(userValue < minVal || userValue > maxVal){
+ userString = ui_outputLine->text();
+ userValue = userString.toInt();
+ if(keypadType == 0 && (userValue < minVal || userValue > maxVal)){
QProcess::startDetached("aplay /mnt/kiss/sounds/quack.wav");
QMessageBox::warning(this,
"Input Error",
@@ -123,6 +132,10 @@ int Keypad::getValue()
{
return userValue;
}
+QString Keypad::getString()
+{
+ return userString;
+}
void Keypad::setRange(int min, int max)
{
View
5 cbcui/src/Keypad.h
@@ -29,7 +29,7 @@ class Keypad : public QDialog, private Ui::Keypad
Q_OBJECT
public:
- Keypad(QWidget *parent = 0,int min=0, int max=100);
+ Keypad(QWidget *parent = 0,int min=0, int max=100, int type=0);
~Keypad();
public slots:
@@ -48,11 +48,14 @@ public slots:
void on_ui_clearButton_clicked(bool checked = false);
void show();
int getValue();
+ QString getString();
void setRange(int min,int max);
private:
+ int keypadType;
void refreshView();
int userValue;
+ QString userString;
int minVal;
int maxVal;
};
View
11 cbcui/src/MainWindow.cpp
@@ -24,18 +24,24 @@
#include "UserProgram.h"
#include "CbobData.h"
#include <QMessageBox>
+#include <QWSServer>
#include <QProcess>
-MainWindow::MainWindow(QWidget *parent) : QDialog(parent), m_mainMenu(0)
+MainWindow::MainWindow(QWidget *parent) :
+ QDialog(parent),
+ m_mainMenu(0)
{
setupUi(this);
setWindowState(windowState() | Qt::WindowFullScreen);
m_mainMenu = new MainMenu(ui_widget);
-
m_mainMenu->raisePage();
+ QWSServer *qserver = QWSServer::instance();
+
+ //qserver->closeKeyboard();
+
QObject::connect(ui_runstopButton, SIGNAL(clicked()), UserProgram::instance(), SLOT(toggleState()));
QObject::connect(CbobData::instance(), SIGNAL(refresh()), this, SLOT(updateBatteryDisplay()));
QObject::connect(CbobData::instance(), SIGNAL(lowBattery(float)), this, SLOT(batteryWarning(float)));
@@ -143,3 +149,4 @@ void MainWindow::hideEStop()
//|| motorTest is running || motorTune is running || servo is running)
else ui_estopButton->hide();
}
+
View
243 cbcui/src/Serial/SerialPage.cpp
@@ -0,0 +1,243 @@
+#include "SerialPage.h"
+#include <QFile>
+
+
+#define MAXPORTCOUNT 6
+
+SerialThread::SerialThread(QObject *parent) : QThread(parent),m_activePort(-1)
+{
+ m_quit = false;
+}
+
+SerialThread::~SerialThread()
+{
+ stop();
+}
+
+void SerialThread::stop()
+{
+ m_mutex.lock();
+ m_quit = true;
+ m_mutex.unlock();
+
+ wait();
+}
+
+void SerialThread::run()
+{
+ int port = -1;
+ int baud;
+ QList<SerialPort*> portList;
+ populatePorts(portList);
+ this->m_command.clear();
+
+ m_quit = false;
+ while(!m_quit){
+
+ if(port != this->m_activePort)
+ {
+ if(port >= 0 && port < portList.size())
+ portList[port]->close();
+
+ m_mutex.lock();
+ port = this->m_activePort;
+ m_mutex.unlock();
+
+ if(port < 0 || port >= portList.size())
+ continue;
+
+ portList[port]->open(QIODevice::ReadWrite);
+ baud = portList[port]->getBaudRate();
+
+ m_mutex.lock();
+ this->m_baudSetting = baud;
+ m_mutex.unlock();
+ emit baudSetting(baud);
+ }
+ else if(port < 0 || port >= portList.size()){
+ msleep(100);
+ continue;
+ }
+
+ if(baud != this->m_baudSetting){
+ m_mutex.lock();
+ baud = this->m_baudSetting;
+ m_mutex.unlock();
+
+ portList[port]->setBaudRate(baud);
+ }
+
+ if(this->m_command.size() > 0){
+ m_mutex.lock();
+ QByteArray ba = this->m_command;
+ this->m_command.clear();
+ m_mutex.unlock();
+
+ portList[port]->write(ba);
+ }
+
+ int count = portList[port]->bytesAvailable();
+ if(count > 0){
+ QByteArray oba = portList[port]->read(count);
+ emit newData(oba);
+ }
+
+ QThread::yieldCurrentThread();
+ }
+
+ if(port >= 0 && port < portList.size())
+ portList[port]->close();
+
+ while(portList.size()){
+ delete portList.last();
+ portList.removeLast();
+ }
+}
+
+void SerialThread::populatePorts(QList<SerialPort*> &pl)
+{
+ QStringList portNames;
+ // add the CBC Create port first
+ if(QFile::exists("/dev/uart1")){
+ SerialPort *spt = new SerialPort("/dev/uart1");
+ pl.append(spt);
+ portNames << "/dev/uart1";
+ }
+
+ // find all the external usb-serial ports
+ int i=0;
+ QString portName = QString("/dev/ttyUSB%1").arg(i);
+ while(i < MAXPORTCOUNT)
+ {
+ if(QFile::exists(portName)){
+ SerialPort *spt = new SerialPort(portName,this);
+ pl.append(spt);
+ portNames << portName;
+ }
+ i++;
+ portName = QString("/dev/ttyUSB%1").arg(i);
+ }
+ emit portList(portNames);
+}
+
+void SerialThread::setActivePort(int index)
+{
+ QMutexLocker locker(&m_mutex);
+ m_activePort = index;
+}
+
+void SerialThread::setBaudRate(int baud)
+{
+ QMutexLocker locker(&m_mutex);
+ m_baudSetting = baud;
+}
+
+void SerialThread::sendCommand(QByteArray ba)
+{
+ QMutexLocker locker(&m_mutex);
+ m_command = ba;
+}
+
+/*#################################################################################*/
+
+SerialPage::SerialPage(QWidget *parent) : Page(parent)
+{
+ setupUi(this);
+
+ ui_outputConsole->ensureCursorVisible();
+
+ connect(&m_sThread, SIGNAL(newData(QByteArray)), this, SLOT(consoleUpdate(QByteArray)));
+ connect(&m_sThread, SIGNAL(baudSetting(int)), this, SLOT(updateBaud(int)));
+ connect(&m_sThread, SIGNAL(portList(QStringList)), this, SLOT(updatePortList(QStringList)));
+ connect(this, SIGNAL(newBaudRate(int)), &m_sThread, SLOT(setBaudRate(int)));
+ connect(this, SIGNAL(sendCommand(QByteArray)), &m_sThread, SLOT(sendCommand(QByteArray)));
+ connect(ui_portComboBox, SIGNAL(currentIndexChanged(int)), &m_sThread, SLOT(setActivePort(int)));
+ connect(ui_baudComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(setBaudRate(int)));
+
+ // populate the symbolic link name list
+ //ui_symbolicComboBox->clear();
+ //for(int i=0;i<m_portList.size();i++){
+ // ui_symbolicComboBox->addItem(QString("serial%1").arg(i));
+ //m_portList[i].linkName = QString("serial%1").arg(i);
+ //}
+}
+
+SerialPage::~SerialPage()
+{
+ m_sThread.stop();
+}
+
+void SerialPage::show()
+{
+ m_sThread.start();
+ Page::show();
+}
+
+void SerialPage::hide()
+{
+ m_sThread.stop();
+ Page::hide();
+}
+
+void SerialPage::updatePortList(QStringList pl)
+{
+ ui_portComboBox->clear();
+ ui_portComboBox->addItems(pl);
+ ui_portComboBox->setCurrentIndex(0);
+}
+
+void SerialPage::updateBaud(int baud)
+{
+ ui_baudComboBox->setCurrentIndex(ui_baudComboBox->findText(QString::number(baud)));
+}
+
+void SerialPage::consoleUpdate(QByteArray ba)
+{
+ if(ui_byteCodeCheckBox->isChecked()){
+ for(int i=0;i<ba.size();i++)
+ ui_outputConsole->appendPlainText(QString::number(ba.at(i)));
+ }
+ else
+ ui_outputConsole->insertPlainText(QString(ba));
+
+ ui_outputConsole->centerCursor();
+}
+
+void SerialPage::setBaudRate(int index)
+{
+ emit newBaudRate(ui_baudComboBox->itemText(index).toInt());
+}
+
+
+void SerialPage::on_ui_commandLineEdit_selectionChanged()
+{
+ Keypad user_keypad(this,0,2048,1);
+
+ ui_commandLineEdit->setStyleSheet("QLineEdit#ui_commandLineEdit{background-color:red}");
+ user_keypad.exec();
+ QString value = user_keypad.getString();
+
+ ui_commandLineEdit->setText(value);
+ ui_commandLineEdit->setStyleSheet("QLineEdit#ui_commandLineEdit{background-color:white}");
+}
+
+
+void SerialPage::on_ui_sendButton_clicked()
+{
+ QByteArray ba;
+ // write the command to the device
+ if(ui_byteCodeCheckBox->isChecked()){
+ // byte codes are separated by spaces
+ QStringList args = ui_commandLineEdit->text().split(QLatin1Char(' '));
+
+ foreach (const QString &arg, args){
+ ba.append(arg.toInt());
+ //ui_outputConsole->insertPlainText(arg);
+ }
+ }
+ else{
+ //send the command as ascii code
+ ba = ui_commandLineEdit->text().toLocal8Bit();
+ }
+ emit sendCommand(ba);
+}
View
75 cbcui/src/Serial/SerialPage.h
@@ -0,0 +1,75 @@
+#ifndef __SERIALPAGE_H__
+#define __SERIALPAGE_H__
+
+#include "ui_Serial.h"
+#include "Page.h"
+#include "SerialPort.h"
+#include <QThread>
+#include <QMutex>
+
+#include "../Keypad.h"
+
+class SerialThread : public QThread
+{
+ Q_OBJECT
+public:
+ SerialThread(QObject *parent=0);
+ ~SerialThread();
+
+ void stop();
+
+signals:
+ void portList(QStringList);
+ void newData(QByteArray);
+ void baudSetting(int);
+
+public slots:
+ void setActivePort(int index);
+ void setBaudRate(int baud);
+ void sendCommand(QByteArray ba);
+
+protected:
+ void run();
+
+private:
+ QMutex m_mutex;
+ QByteArray m_command;
+ int m_baudSetting;
+ int m_activePort;
+ bool m_quit;
+
+ void populatePorts(QList<SerialPort*> &pl);
+};
+
+class SerialPage : public Page, private Ui::SerialPage
+{
+ Q_OBJECT
+public:
+ SerialPage(QWidget *parent = 0);
+ ~SerialPage();
+
+signals:
+ void newBaudRate(int);
+ void sendCommand(QByteArray);
+
+public slots:
+ void show();
+ void hide();
+
+ void updatePortList(QStringList pl);
+ void updateBaud(int baud);
+ void consoleUpdate(QByteArray ba);
+ void setBaudRate(int index);
+ void on_ui_commandLineEdit_selectionChanged();
+ void on_ui_sendButton_clicked();
+
+private:
+ struct _symLink{
+ QString dev;
+ int linkNum;
+ };
+
+ SerialThread m_sThread;
+};
+
+#endif // SERIALPAGE_H
View
127 cbcui/src/SerialPort.cpp → cbcui/src/Serial/SerialPort.cpp
@@ -21,7 +21,6 @@
#include <unistd.h>
#include <string.h>
#include <fcntl.h>
-#include <termios.h>
#include <sys/time.h>
#include <sys/ioctl.h>
#include <sys/select.h>
@@ -34,12 +33,11 @@ SerialPort::SerialPort(QString filename, QObject *parent) : QIODevice(parent), m
}
SerialPort::~SerialPort()
-{
+{
}
bool SerialPort::open(OpenMode mode)
{
- //qWarning"SerialPort::open");
if(isOpen())
return true;
else if(mode == QIODevice::ReadWrite) {
@@ -58,6 +56,104 @@ bool SerialPort::open(OpenMode mode)
return false;
}
+void SerialPort::configure()
+{
+ if(isOpen()){
+ struct ::termios portdata;
+ tcgetattr(m_fd, &portdata);
+
+ portdata.c_oflag = 0; // no output options
+ portdata.c_lflag = 0; // no local options
+ portdata.c_iflag = IGNBRK | IGNPAR; // ignore break cond. and parity errors
+ // portdata.c_cflag &= ~CRTSCTS; // disable flow control
+ portdata.c_cflag &= ~PARENB; // disable parity
+ portdata.c_cflag &= ~CSTOPB; // 1 stop bit
+ portdata.c_cflag &= ~CSIZE; // no mask
+ portdata.c_cflag |= CS8; // 8 data bits
+ portdata.c_cflag |= CREAD;
+ portdata.c_cflag |= CLOCAL;
+ portdata.c_cc[VMIN] = 1; // minimum # of chars to read
+ portdata.c_cc[VTIME] = 0; // time to wait in tenths
+
+ cfsetispeed(&portdata, m_baudRate);
+ cfsetospeed(&portdata, m_baudRate);
+ tcsetattr(m_fd, TCSANOW, &portdata);
+ }
+ else
+ qWarning("Port not opened");
+}
+
+void SerialPort::setBaudRate(int baud)
+{
+ switch(baud){
+ case 1200:
+ m_baudRate = B1200;
+ break;
+ case 1800:
+ m_baudRate = B1800;
+ break;
+ case 2400:
+ m_baudRate = B2400;
+ break;
+ case 4800:
+ m_baudRate = B4800;
+ break;
+ case 9600:
+ m_baudRate = B9600;
+ break;
+ case 19200:
+ m_baudRate = B19200;
+ break;
+ case 38400:
+ m_baudRate = B38400;
+ break;
+ case 57600:
+ m_baudRate = B57600;
+ break;
+ case 115200:
+ m_baudRate = B115200;
+ break;
+ default:
+ m_baudRate = B57600;
+ }
+ this->configure();
+}
+
+int SerialPort::getBaudRate()
+{
+ if(isOpen()){
+ struct ::termios portdata;
+ tcgetattr(m_fd, &portdata);
+ speed_t baud = cfgetospeed(&portdata);
+
+ switch(baud){
+ case B1200:
+ return 1200;
+ case B1800:
+ return 1800;
+ case B2400:
+ return 2400;
+ case B4800:
+ return 4800;
+ case B9600:
+ return 9600;
+ case B19200:
+ return 19200;
+ case B38400:
+ return 38400;
+ case B57600:
+ return 57600;
+ case B115200:
+ return 115200;
+ default:
+ return 0;
+ }
+ }
+ else{
+ qWarning("Port not open");
+ }
+}
+
void SerialPort::close()
{
if(isOpen()) {
@@ -69,7 +165,6 @@ void SerialPort::close()
qint64 SerialPort::bytesAvailable() const
{
- //qWarning"SerialPort::bytesAvailable");
if(isOpen()) {
int byteCount = 0;
if(ioctl(m_fd, FIONREAD, &byteCount) == 0)
@@ -82,7 +177,6 @@ qint64 SerialPort::bytesAvailable() const
bool SerialPort::waitForReadyRead(int msecs)
{
- //qWarning"SerialPort::waitForReadyRead");
if(isOpen()) {
if(bytesAvailable()) return true;
return select(msecs);
@@ -92,7 +186,6 @@ bool SerialPort::waitForReadyRead(int msecs)
bool SerialPort::select(int msecs) const
{
- //qWarning"SerialPort::select m_fd = %d", m_fd);
fd_set fds;
struct timeval timeout;
@@ -102,25 +195,19 @@ bool SerialPort::select(int msecs) const
timeout.tv_sec = (msecs / 1000);
timeout.tv_usec = (msecs % 1000) * 1000;
- //qWarning"::select");
int n = ::select(m_fd + 1, &fds, 0, 0, &timeout);
-
- //qWarning"SerialPort::select return");
+
if(n == 1) return true;
return false;
}
qint64 SerialPort::readData(char *data, qint64 maxSize)
{
- //qWarning"SerialPort::readData");
- if(isOpen()) {
- //if(select(250)){
- //qWarning"::read");
- int ret = ::read(m_fd, data, maxSize);
- //qWarning"return");
- if(ret >= 0) return ret;
- //}
- //qWarning"return 0");
+ if(isOpen())
+ {
+ int ret = ::read(m_fd, data, maxSize);
+ if(ret >= 0)
+ return ret;
return 0;
}
return -1;
@@ -128,10 +215,10 @@ qint64 SerialPort::readData(char *data, qint64 maxSize)
qint64 SerialPort::writeData(const char *data, qint64 maxSize)
{
- //qWarning"SerialPort::writeData");
if(isOpen()) {
int ret = ::write(m_fd, data, maxSize);
- if(ret >= 0) return ret;
+ if(ret >= 0)
+ return ret;
}
return -1;
}
View
8 cbcui/src/SerialPort.h → cbcui/src/Serial/SerialPort.h
@@ -22,7 +22,7 @@
#define __SERIAL_PORT_H__
/* Currenty hard-wired for ReadWrite at 38400 */
-
+#include <termios.h>
#include <QIODevice>
#include <QString>
@@ -35,6 +35,9 @@ Q_OBJECT
bool open(OpenMode mode = 0);
void close();
+ void setBaudRate(int baud);
+ int getBaudRate();
+ QString getPortName() { return m_name; }
qint64 bytesAvailable() const;
bool waitForReadyRead(int msecs);
@@ -47,8 +50,11 @@ Q_OBJECT
private:
QString m_name;
+ QString m_linkName;
int m_fd;
+ speed_t m_baudRate;
+ void configure();
bool select(int msecs) const;
};
View
7 cbcui/src/SerialServer.cpp → cbcui/src/Serial/SerialServer.cpp
@@ -48,7 +48,8 @@ void SerialServer::run()
QByteArray header;
while (!m_quit) {
header.clear();
- if(readPacket(&header)) {
+ if(readPacket(&header))
+ {
processTransfer(header);
}
}
@@ -58,7 +59,7 @@ void SerialServer::run()
void SerialServer::stop()
{
- m_quit = 1;
+ m_quit = true;
while(isRunning());
}
@@ -74,8 +75,6 @@ void SerialServer::processTransfer(QByteArray& header)
if(startWord != SERIAL_START)
return;
- //qWarning("Got start...");
- //qWarning("packetcount=%d", packetCount);
QByteArray compressedData;
QProcess::startDetached("aplay /mnt/kiss/sounds/downloading.wav");
View
0  cbcui/src/SerialServer.h → cbcui/src/Serial/SerialServer.h
File renamed without changes
View
3  cbcui/src/Utilities.cpp
@@ -20,11 +20,12 @@
#include "Utilities.h"
-Utilities::Utilities(QWidget *parent) : Page(parent), m_createStatus(parent)
+Utilities::Utilities(QWidget *parent) : Page(parent), m_createStatus(parent), m_serialPage(parent)
{
setupUi(this);
QObject::connect(ui_createButton, SIGNAL(clicked()), &m_createStatus, SLOT(raisePage()));
+ QObject::connect(ui_serialButton, SIGNAL(clicked()), &m_serialPage, SLOT(raisePage()));
}
Utilities::~Utilities()
View
2  cbcui/src/Utilities.h
@@ -25,6 +25,7 @@
#include "Page.h"
#include "CreateStatus.h"
+#include "Serial/SerialPage.h"
class Utilities : public Page, private Ui::Utilities
{
@@ -36,6 +37,7 @@ class Utilities : public Page, private Ui::Utilities
private:
CreateStatus m_createStatus;
+ SerialPage m_serialPage;
};
#endif
View
25 cbcui/src/keyboard/CBCKbdPlugin.cpp
@@ -0,0 +1,25 @@
+#include "CBCKbdPlugin.h"
+//#include "qcbclinuxinput.h"
+
+QT_BEGIN_NAMESPACE
+
+CBCKbdPlugin::CBCKbdPlugin() : QKbdDriverPlugin()
+{
+}
+
+QStringList CBCKbdPlugin::keys() const
+{
+ return (QStringList() << QLatin1String("CBCKbdInput"));
+}
+
+QCBCLinuxInputKeyboardHandler* CBCKbdPlugin::create(const QString &driver, const QString &device)
+{
+ Q_UNUSED(device);
+ if(driver.compare(QLatin1String("CBCKbdInput"), Qt::CaseInsensitive))
+ return 0;
+ return new QCBCLinuxInputKeyboardHandler(device);
+}
+
+Q_EXPORT_PLUGIN2(cbckbdplugin, CBCKbdPlugin)
+
+QT_END_NAMESPACE
View
16 cbcui/src/keyboard/CBCKbdPlugin.h
@@ -0,0 +1,16 @@
+#include <qkbddriverplugin_qws.h>
+#include "qcbclinuxinput.h"
+
+#ifndef CBCKBDPLUGIN_H
+#define CBCKBDPLUGIN_H
+
+class CBCKbdPlugin : public QKbdDriverPlugin
+{
+public:
+ CBCKbdPlugin();
+
+ QStringList keys() const;
+ QCBCLinuxInputKeyboardHandler* create(const QString &driver, const QString &device);
+};
+
+#endif // CBCKBDPLUGIN_H
View
BIN  cbcui/src/keyboard/CBCKbdPlugin.o
Binary file not shown
View
234 cbcui/src/keyboard/Makefile
@@ -0,0 +1,234 @@
+#############################################################################
+# Makefile for building: libcbckbdplugin.so.1.0.0
+# Generated by qmake (2.01a) (Qt 4.7.1) on: Fri Apr 1 19:05:45 2011
+# Project: cbcKeyPlugin.pro
+# Template: lib
+# Command: /mnt/kiss/qt/bin/qmake -o Makefile cbcKeyPlugin.pro
+#############################################################################
+
+####### Compiler, tools and options
+
+CC = arm-linux-gcc
+CXX = arm-linux-g++
+DEFINES = -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED
+CFLAGS = -pipe -O2 -Wall -W -D_REENTRANT -fPIC $(DEFINES)
+CXXFLAGS = -pipe -O2 -Wall -W -D_REENTRANT -fPIC $(DEFINES)
+INCPATH = -I/mnt/kiss/qt/mkspecs/qws/linux-arm-g++ -I. -I/mnt/kiss/qt/include/QtCore -I/mnt/kiss/qt/include/QtNetwork -I/mnt/kiss/qt/include/QtGui -I/mnt/kiss/qt/include -I.
+LINK = arm-linux-g++
+LFLAGS = -Wl,-O1 -Wl,-rpath,/mnt/kiss/qt/lib -shared -Wl,-soname,libcbckbdplugin.so.1
+LIBS = $(SUBLIBS) -L/mnt/kiss/qt/lib -lQtGui -L/mnt/kiss/qt/lib -lQtNetwork -lQtCore -lpthread
+AR = arm-linux-ar cqs
+RANLIB =
+QMAKE = /mnt/kiss/qt/bin/qmake
+TAR = tar -cf
+COMPRESS = gzip -9f
+COPY = cp -f
+SED = sed
+COPY_FILE = $(COPY)
+COPY_DIR = $(COPY) -r
+STRIP = arm-linux-strip
+INSTALL_FILE = install -m 644 -p
+INSTALL_DIR = $(COPY_DIR)
+INSTALL_PROGRAM = install -m 755 -p
+DEL_FILE = rm -f
+SYMLINK = ln -f -s
+DEL_DIR = rmdir
+MOVE = mv -f
+CHK_DIR_EXISTS= test -d
+MKDIR = mkdir -p
+
+####### Output directory
+
+OBJECTS_DIR = ./
+
+####### Files
+
+SOURCES = CBCKbdPlugin.cpp \
+ qcbclinuxinput.cpp
+OBJECTS = CBCKbdPlugin.o \
+ qcbclinuxinput.o
+DIST = /mnt/kiss/qt/mkspecs/common/g++.conf \
+ /mnt/kiss/qt/mkspecs/common/unix.conf \
+ /mnt/kiss/qt/mkspecs/common/linux.conf \
+ /mnt/kiss/qt/mkspecs/common/qws.conf \
+ /mnt/kiss/qt/mkspecs/qconfig.pri \
+ /mnt/kiss/qt/mkspecs/features/qt_functions.prf \
+ /mnt/kiss/qt/mkspecs/features/qt_config.prf \
+ /mnt/kiss/qt/mkspecs/features/exclusive_builds.prf \
+ /mnt/kiss/qt/mkspecs/features/default_pre.prf \
+ /mnt/kiss/qt/mkspecs/features/release.prf \
+ /mnt/kiss/qt/mkspecs/features/default_post.prf \
+ /mnt/kiss/qt/mkspecs/features/warn_on.prf \
+ /mnt/kiss/qt/mkspecs/features/qt.prf \
+ /mnt/kiss/qt/mkspecs/features/unix/thread.prf \
+ /mnt/kiss/qt/mkspecs/features/moc.prf \
+ /mnt/kiss/qt/mkspecs/features/resources.prf \
+ /mnt/kiss/qt/mkspecs/features/uic.prf \
+ /mnt/kiss/qt/mkspecs/features/yacc.prf \
+ /mnt/kiss/qt/mkspecs/features/lex.prf \
+ /mnt/kiss/qt/mkspecs/features/include_source_dir.prf \
+ cbcKeyPlugin.pro
+QMAKE_TARGET = cbckbdplugin
+DESTDIR =
+TARGET = libcbckbdplugin.so.1.0.0
+TARGETA = libcbckbdplugin.a
+TARGETD = libcbckbdplugin.so.1.0.0
+TARGET0 = libcbckbdplugin.so
+TARGET1 = libcbckbdplugin.so.1
+TARGET2 = libcbckbdplugin.so.1.0
+
+first: all
+####### Implicit rules
+
+.SUFFIXES: .o .c .cpp .cc .cxx .C
+
+.cpp.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
+
+.cc.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
+
+.cxx.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
+
+.C.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
+
+.c.o:
+ $(CC) -c $(CFLAGS) $(INCPATH) -o "$@" "$<"
+
+####### Build rules
+
+all: Makefile $(TARGET)
+
+$(TARGET): $(OBJECTS) $(SUBLIBS) $(OBJCOMP)
+ -$(DEL_FILE) $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2)
+ $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(LIBS) $(OBJCOMP)
+ -ln -s $(TARGET) $(TARGET0)
+ -ln -s $(TARGET) $(TARGET1)
+ -ln -s $(TARGET) $(TARGET2)
+
+
+
+staticlib: $(TARGETA)
+
+$(TARGETA): $(OBJECTS) $(OBJCOMP)
+ -$(DEL_FILE) $(TARGETA)
+ $(AR) $(TARGETA) $(OBJECTS)
+
+Makefile: cbcKeyPlugin.pro /mnt/kiss/qt/mkspecs/qws/linux-arm-g++/qmake.conf /mnt/kiss/qt/mkspecs/common/g++.conf \
+ /mnt/kiss/qt/mkspecs/common/unix.conf \
+ /mnt/kiss/qt/mkspecs/common/linux.conf \
+ /mnt/kiss/qt/mkspecs/common/qws.conf \
+ /mnt/kiss/qt/mkspecs/qconfig.pri \
+ /mnt/kiss/qt/mkspecs/features/qt_functions.prf \
+ /mnt/kiss/qt/mkspecs/features/qt_config.prf \
+ /mnt/kiss/qt/mkspecs/features/exclusive_builds.prf \
+ /mnt/kiss/qt/mkspecs/features/default_pre.prf \
+ /mnt/kiss/qt/mkspecs/features/release.prf \
+ /mnt/kiss/qt/mkspecs/features/default_post.prf \
+ /mnt/kiss/qt/mkspecs/features/warn_on.prf \
+ /mnt/kiss/qt/mkspecs/features/qt.prf \
+ /mnt/kiss/qt/mkspecs/features/unix/thread.prf \
+ /mnt/kiss/qt/mkspecs/features/moc.prf \
+ /mnt/kiss/qt/mkspecs/features/resources.prf \
+ /mnt/kiss/qt/mkspecs/features/uic.prf \
+ /mnt/kiss/qt/mkspecs/features/yacc.prf \
+ /mnt/kiss/qt/mkspecs/features/lex.prf \
+ /mnt/kiss/qt/mkspecs/features/include_source_dir.prf \
+ /mnt/kiss/qt/lib/libQtGui.prl \
+ /mnt/kiss/qt/lib/libQtNetwork.prl \
+ /mnt/kiss/qt/lib/libQtCore.prl
+ $(QMAKE) -o Makefile cbcKeyPlugin.pro
+/mnt/kiss/qt/mkspecs/common/g++.conf:
+/mnt/kiss/qt/mkspecs/common/unix.conf:
+/mnt/kiss/qt/mkspecs/common/linux.conf:
+/mnt/kiss/qt/mkspecs/common/qws.conf:
+/mnt/kiss/qt/mkspecs/qconfig.pri:
+/mnt/kiss/qt/mkspecs/features/qt_functions.prf:
+/mnt/kiss/qt/mkspecs/features/qt_config.prf:
+/mnt/kiss/qt/mkspecs/features/exclusive_builds.prf:
+/mnt/kiss/qt/mkspecs/features/default_pre.prf:
+/mnt/kiss/qt/mkspecs/features/release.prf:
+/mnt/kiss/qt/mkspecs/features/default_post.prf:
+/mnt/kiss/qt/mkspecs/features/warn_on.prf:
+/mnt/kiss/qt/mkspecs/features/qt.prf:
+/mnt/kiss/qt/mkspecs/features/unix/thread.prf:
+/mnt/kiss/qt/mkspecs/features/moc.prf:
+/mnt/kiss/qt/mkspecs/features/resources.prf:
+/mnt/kiss/qt/mkspecs/features/uic.prf:
+/mnt/kiss/qt/mkspecs/features/yacc.prf:
+/mnt/kiss/qt/mkspecs/features/lex.prf:
+/mnt/kiss/qt/mkspecs/features/include_source_dir.prf:
+/mnt/kiss/qt/lib/libQtGui.prl:
+/mnt/kiss/qt/lib/libQtNetwork.prl:
+/mnt/kiss/qt/lib/libQtCore.prl:
+qmake: FORCE
+ @$(QMAKE) -o Makefile cbcKeyPlugin.pro
+
+dist:
+ @$(CHK_DIR_EXISTS) .tmp/cbckbdplugin1.0.0 || $(MKDIR) .tmp/cbckbdplugin1.0.0
+ $(COPY_FILE) --parents $(SOURCES) $(DIST) .tmp/cbckbdplugin1.0.0/ && $(COPY_FILE) --parents CBCKbdPlugin.h qcbclinuxinput.h .tmp/cbckbdplugin1.0.0/ && $(COPY_FILE) --parents CBCKbdPlugin.cpp qcbclinuxinput.cpp .tmp/cbckbdplugin1.0.0/ && (cd `dirname .tmp/cbckbdplugin1.0.0` && $(TAR) cbckbdplugin1.0.0.tar cbckbdplugin1.0.0 && $(COMPRESS) cbckbdplugin1.0.0.tar) && $(MOVE) `dirname .tmp/cbckbdplugin1.0.0`/cbckbdplugin1.0.0.tar.gz . && $(DEL_FILE) -r .tmp/cbckbdplugin1.0.0
+
+
+clean:compiler_clean
+ -$(DEL_FILE) $(OBJECTS)
+ -$(DEL_FILE) *~ core *.core
+
+
+####### Sub-libraries
+
+distclean: clean
+ -$(DEL_FILE) $(TARGET)
+ -$(DEL_FILE) $(TARGET0) $(TARGET1) $(TARGET2) $(TARGETA)
+ -$(DEL_FILE) Makefile
+
+
+check: first
+
+mocclean: compiler_moc_header_clean compiler_moc_source_clean
+
+mocables: compiler_moc_header_make_all compiler_moc_source_make_all
+
+compiler_moc_header_make_all:
+compiler_moc_header_clean:
+compiler_rcc_make_all:
+compiler_rcc_clean:
+compiler_image_collection_make_all: qmake_image_collection.cpp
+compiler_image_collection_clean:
+ -$(DEL_FILE) qmake_image_collection.cpp
+compiler_moc_source_make_all: qcbclinuxinput.moc
+compiler_moc_source_clean:
+ -$(DEL_FILE) qcbclinuxinput.moc
+qcbclinuxinput.moc: qcbclinuxinput.h \
+ qcbclinuxinput.cpp
+ /mnt/kiss/qt/bin/moc $(DEFINES) $(INCPATH) qcbclinuxinput.cpp -o qcbclinuxinput.moc
+
+compiler_uic_make_all:
+compiler_uic_clean:
+compiler_yacc_decl_make_all:
+compiler_yacc_decl_clean:
+compiler_yacc_impl_make_all:
+compiler_yacc_impl_clean:
+compiler_lex_make_all:
+compiler_lex_clean:
+compiler_clean: compiler_moc_source_clean
+
+####### Compile
+
+CBCKbdPlugin.o: CBCKbdPlugin.cpp CBCKbdPlugin.h \
+ qcbclinuxinput.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o CBCKbdPlugin.o CBCKbdPlugin.cpp
+
+qcbclinuxinput.o: qcbclinuxinput.cpp qcbclinuxinput.h \
+ qcbclinuxinput.moc
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o qcbclinuxinput.o qcbclinuxinput.cpp
+
+####### Install
+
+install: FORCE
+
+uninstall: FORCE
+
+FORCE:
+
View
9 cbcui/src/keyboard/cbcKeyPlugin.pro
@@ -0,0 +1,9 @@
+TEMPLATE =lib
+CONFIG += PLUGIN
+
+HEADERS = cbckbdplugin.h \
+ qcbclinuxinput.h
+SOURCES = cbckbdplugin.cpp \
+ qcbclinuxinput.cpp
+
+TARGET = cbckbdplugin
View
1  cbcui/src/keyboard/libcbckbdplugin.so
View
1  cbcui/src/keyboard/libcbckbdplugin.so.1
View
1  cbcui/src/keyboard/libcbckbdplugin.so.1.0
View
BIN  cbcui/src/keyboard/libcbckbdplugin.so.1.0.0
Binary file not shown
View
212 cbcui/src/keyboard/qcbclinuxinput.cpp
@@ -0,0 +1,212 @@
+#include "qcbclinuxinput.h"
+
+#include <QSocketNotifier>
+#include <QStringList>
+#include <QFile>
+
+#include <qplatformdefs.h>
+
+#include <errno.h>
+#include <termios.h>
+
+#include <linux/kd.h>
+#include <linux/input.h>
+
+class QCBCLinuxKbPrivate : public QObject
+{
+ Q_OBJECT
+public:
+ QCBCLinuxKbPrivate(QCBCLinuxInputKeyboardHandler *h, const QString &device);
+ ~QCBCLinuxKbPrivate();
+
+private:
+ bool openDevice();
+ void closeDevice();
+ void switchLed(int, bool);
+
+
+private Q_SLOTS:
+ void readKeycode();
+
+private:
+ QCBCLinuxInputKeyboardHandler *m_handler;
+ int m_proc_fd;
+ int m_fd;
+ int m_tty_fd;
+ struct termios m_tty_attr;
+ int m_orig_kbmode;
+ QString m_dev;
+ int m_repeat_delay;
+ int m_repeat_rate;
+};
+
+
+
+QCBCLinuxInputKeyboardHandler::QCBCLinuxInputKeyboardHandler(const QString &device)
+ : QWSKeyboardHandler(device)
+{
+ d = new QCBCLinuxKbPrivate(this, device);
+}
+
+QCBCLinuxInputKeyboardHandler::~QCBCLinuxInputKeyboardHandler()
+{
+ delete d;
+}
+
+bool QCBCLinuxInputKeyboardHandler::filterInputEvent(quint16 &, qint32 &)
+{
+ return false;
+}
+
+
+QCBCLinuxKbPrivate::QCBCLinuxKbPrivate(QCBCLinuxInputKeyboardHandler *h, const QString &device)
+ : m_handler(h),m_proc_fd(-1), m_fd(-1), m_tty_fd(-1), m_orig_kbmode(K_XLATE)
+{
+ setObjectName(QLatin1String("CBC LinuxInputSubsystem Keyboard Handler"));
+
+ m_dev = QLatin1String("/dev/input/event1");
+ m_repeat_delay = -1;
+ m_repeat_rate = -1;
+
+ // set the Repeat delay and rate of the keyboard
+ // this is based on the values input from the export QWS_KEYBOARD
+ // environment variable
+ QStringList args = device.split(QLatin1Char(':'));
+ foreach (const QString &arg, args){
+ if(arg.startsWith(QLatin1String("repeat-delay=")))
+ m_repeat_delay = arg.mid(13).toInt();
+ else if(arg.startsWith(QLatin1String("repeat-rate=")))
+ m_repeat_rate = arg.mid(12).toInt();
+ else if(arg.startsWith(QLatin1String("/dev/")))
+ m_dev = arg;
+ }
+
+ if(!openDevice()){
+ qWarning("NO keyboard input device '%s': %s", qPrintable(m_dev), strerror(errno));
+ return;
+ }
+}
+
+bool QCBCLinuxKbPrivate::openDevice()
+{
+ m_fd = ::open(m_dev.toLocal8Bit().constData(), O_RDWR, 0);
+
+ if (m_fd < 0)
+ return false;
+
+ if(m_repeat_delay > 0 && m_repeat_rate > 0){
+ int kbdrep[2] = { m_repeat_delay, m_repeat_rate };
+ ::ioctl(m_fd, EVIOCSREP, kbdrep);
+ }
+
+ QSocketNotifier *notifier;
+ notifier = new QSocketNotifier(m_fd, QSocketNotifier::Read, this);
+ connect(notifier, SIGNAL(activated(int)), this, SLOT(readKeycode()));
+
+ m_tty_fd = isatty(0) ? 0:-1;
+
+ if(m_tty_fd >= 0){
+ tcgetattr(m_tty_fd, &m_tty_attr);
+ struct ::termios termdata;
+ tcgetattr(m_tty_fd, &termdata);
+ ::ioctl(m_tty_fd, KDGKBMODE, &m_orig_kbmode);
+ ::ioctl(m_tty_fd, KDSKBMODE, K_MEDIUMRAW);
+
+ termdata.c_iflag = (IGNPAR | IGNBRK) & (~PARMRK) & (~ISTRIP);
+ termdata.c_oflag = 0;
+ termdata.c_cflag = CREAD | CS8;
+ termdata.c_lflag = 0;
+ termdata.c_cc[VTIME]=0;
+ termdata.c_cc[VMIN]=1;
+ cfsetispeed(&termdata, 9600);
+ cfsetospeed(&termdata, 9600);
+ tcsetattr(m_tty_fd, TCSANOW, &termdata);
+ }
+ return true;
+}
+
+void QCBCLinuxKbPrivate::closeDevice()
+{
+ if(m_tty_fd >=0){
+ ::ioctl(m_tty_fd, KDSKBMODE, m_orig_kbmode);
+ tcsetattr(m_tty_fd, TCSANOW, &m_tty_attr);
+ }
+ if(m_fd >= 0)
+ ::close(m_fd);
+}
+
+QCBCLinuxKbPrivate::~QCBCLinuxKbPrivate()
+{
+ this->closeDevice();
+}
+
+void QCBCLinuxKbPrivate::switchLed(int led, bool state)
+{
+ struct ::input_event led_ie;
+ ::gettimeofday(&led_ie.time, 0);
+ led_ie.type = EV_LED;
+ led_ie.code = led;
+ led_ie.value = state;
+
+ QT_WRITE(m_fd, &led_ie, sizeof(led_ie));
+}
+
+void QCBCLinuxKbPrivate::readKeycode()
+{
+ struct ::input_event buffer[32];
+ int n = 0;
+
+ forever {
+ n = QT_READ(m_fd, reinterpret_cast<char *>(buffer) + n, sizeof(buffer) - n);
+
+ if (n == 0) {
+ qWarning("Got EOF from the input device.");
+ return;
+ } else if (n < 0 && (errno != EINTR && errno != EAGAIN)) {
+ qWarning("Could not read from input device: %s", strerror(errno));
+ return;
+ } else if (n % sizeof(buffer[0]) == 0) {
+ break;
+ }
+ }
+
+ n /= sizeof(buffer[0]);
+
+ for (int i = 0; i < n; ++i) {
+ if (buffer[i].type != EV_KEY)
+ continue;
+
+ quint16 code = buffer[i].code;
+ qint32 value = buffer[i].value;
+
+ if (m_handler->filterInputEvent(code, value))
+ continue;
+
+ QWSKeyboardHandler::KeycodeAction ka;
+ ka = m_handler->processKeycode(code, value != 0, value == 2);
+
+ switch (ka) {
+ case QWSKeyboardHandler::CapsLockOn:
+ case QWSKeyboardHandler::CapsLockOff:
+ switchLed(LED_CAPSL, ka == QWSKeyboardHandler::CapsLockOn);
+ break;
+
+ case QWSKeyboardHandler::NumLockOn:
+ case QWSKeyboardHandler::NumLockOff:
+ switchLed(LED_NUML, ka == QWSKeyboardHandler::NumLockOn);
+ break;
+
+ case QWSKeyboardHandler::ScrollLockOn:
+ case QWSKeyboardHandler::ScrollLockOff:
+ switchLed(LED_SCROLLL, ka == QWSKeyboardHandler::ScrollLockOn);
+ break;
+
+ default:
+ // ignore console switching and reboot
+ break;
+ }
+ }
+}
+
+
+#include "qcbclinuxinput.moc"
View
20 cbcui/src/keyboard/qcbclinuxinput.h
@@ -0,0 +1,20 @@
+#ifndef QCBCLINUXINPUT_H
+#define QCBCLINUXINPUT_H
+
+#include <QWSKeyboardHandler>
+
+class QCBCLinuxKbPrivate;
+
+class QCBCLinuxInputKeyboardHandler : public QWSKeyboardHandler
+{
+public:
+ QCBCLinuxInputKeyboardHandler(const QString &device);
+ virtual ~QCBCLinuxInputKeyboardHandler();
+ virtual bool filterInputEvent(quint16 &input_code, qint32 &input_value);
+
+private:
+ QCBCLinuxKbPrivate *d;
+};
+
+
+#endif // QCBCLINUXINPUT_H
View
78 cbcui/src/keyboard/qcbclinuxinput.moc
@@ -0,0 +1,78 @@
+/****************************************************************************
+** Meta object code from reading C++ file 'qcbclinuxinput.cpp'
+**
+** Created: Mon Apr 4 14:35:56 2011
+** by: The Qt Meta Object Compiler version 62 (Qt 4.7.1)
+**
+** WARNING! All changes made in this file will be lost!
+*****************************************************************************/
+
+#if !defined(Q_MOC_OUTPUT_REVISION)
+#error "The header file 'qcbclinuxinput.cpp' doesn't include <QObject>."
+#elif Q_MOC_OUTPUT_REVISION != 62
+#error "This file was generated using the moc from 4.7.1. It"
+#error "cannot be used with the include files from this version of Qt."
+#error "(The moc has changed too much.)"
+#endif
+
+QT_BEGIN_MOC_NAMESPACE
+static const uint qt_meta_data_QCBCLinuxKbPrivate[] = {
+
+ // content:
+ 5, // revision
+ 0, // classname
+ 0, 0, // classinfo
+ 1, 14, // methods
+ 0, 0, // properties
+ 0, 0, // enums/sets
+ 0, 0, // constructors
+ 0, // flags
+ 0, // signalCount
+
+ // slots: signature, parameters, type, tag, flags
+ 20, 19, 19, 19, 0x08,
+
+ 0 // eod
+};
+
+static const char qt_meta_stringdata_QCBCLinuxKbPrivate[] = {
+ "QCBCLinuxKbPrivate\0\0readKeycode()\0"
+};
+
+const QMetaObject QCBCLinuxKbPrivate::staticMetaObject = {
+ { &QObject::staticMetaObject, qt_meta_stringdata_QCBCLinuxKbPrivate,
+ qt_meta_data_QCBCLinuxKbPrivate, 0 }
+};
+
+#ifdef Q_NO_DATA_RELOCATION
+const QMetaObject &QCBCLinuxKbPrivate::getStaticMetaObject() { return staticMetaObject; }
+#endif //Q_NO_DATA_RELOCATION
+
+const QMetaObject *QCBCLinuxKbPrivate::metaObject() const
+{
+ return QObject::d_ptr->metaObject ? QObject::d_ptr->metaObject : &staticMetaObject;
+}
+
+void *QCBCLinuxKbPrivate::qt_metacast(const char *_clname)
+{
+ if (!_clname) return 0;
+ if (!strcmp(_clname, qt_meta_stringdata_QCBCLinuxKbPrivate))
+ return static_cast<void*>(const_cast< QCBCLinuxKbPrivate*>(this));
+ return QObject::qt_metacast(_clname);
+}
+
+int QCBCLinuxKbPrivate::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
+{
+ _id = QObject::qt_metacall(_c, _id, _a);
+ if (_id < 0)
+ return _id;
+ if (_c == QMetaObject::InvokeMetaMethod) {
+ switch (_id) {
+ case 0: readKeycode(); break;
+ default: ;
+ }
+ _id -= 1;
+ }
+ return _id;
+}
+QT_END_MOC_NAMESPACE
View
BIN  cbcui/src/keyboard/qcbclinuxinput.o
Binary file not shown
View
103 cbcui/ui/About.ui
@@ -35,15 +35,16 @@
</sizepolicy>
</property>
<property name="text">
- <string>&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
+ <string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
+&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
-&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;&quot;&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:11pt; font-weight:600;&quot;&gt;CBC BOTBALL CONTROLLER&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;Copyright (C) 2009-2010 &lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;KISS Institute for Practical Robotics&lt;/p&gt;
-&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;http://www.kipr.org/&lt;/p&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;http://www.botball.org/&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Ubuntu'; font-size:11pt; font-weight:400; font-style:normal;&quot;&gt;
+&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Sans Serif'; font-size:14pt; font-weight:600;&quot;&gt;CBC BOTBALL CONTROLLER&lt;/span&gt;&lt;/p&gt;
+&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Sans Serif';&quot;&gt;Copyright (C) 2009-2011 &lt;/span&gt;&lt;/p&gt;
+&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Sans Serif';&quot;&gt;KISS Institute for Practical Robotics&lt;/span&gt;&lt;/p&gt;
+&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Sans Serif'; font-size:9pt;&quot;&gt;&lt;/p&gt;
+&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Sans Serif'; font-size:12pt;&quot;&gt;http://www.kipr.org/&lt;/span&gt;&lt;/p&gt;
+&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Sans Serif'; font-size:12pt;&quot;&gt;http://www.botball.org/&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
@@ -54,10 +55,22 @@ p, li { white-space: pre-wrap; }
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QLabel" name="label">
+ <property name="minimumSize">
+ <size>
+ <width>100</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>120</width>
+ <height>16777215</height>
+ </size>
+ </property>
<property name="text">
<string>CBC Software by:
-Jorge Villatoro
Matt Roman
+Logan Cox
Randy Sargent</string>
</property>
</widget>
@@ -68,6 +81,21 @@ Randy Sargent</string>
<number>0</number>
</property>
<item>
+ <widget class="QLabel" name="label_4">
+ <property name="font">
+ <font>
+ <underline>true</underline>
+ </font>
+ </property>
+ <property name="text">
+ <string>Version Numbers</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignCenter</set>
+ </property>
+ </widget>
+ </item>
+ <item>
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="spacing">
<number>0</number>
@@ -76,18 +104,26 @@ Randy Sargent</string>
<widget class="QLabel" name="label_3">
<property name="minimumSize">
<size>
- <width>70</width>
+ <width>90</width>
<height>16</height>
</size>
</property>
<property name="maximumSize">
<size>
- <width>70</width>
+ <width>90</width>
<height>16</height>
</size>
</property>
+ <property name="font">
+ <font>
+ <pointsize>11</pointsize>
+ </font>
+ </property>
<property name="text">
- <string>OS Version:</string>
+ <string>Operating Sys.</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignCenter</set>
</property>
</widget>
</item>
@@ -106,7 +142,10 @@ Randy Sargent</string>
</size>
</property>
<property name="text">
- <string>1.1.1.1</string>
+ <string>1.1.1</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignCenter</set>
</property>
</widget>
</item>
@@ -121,18 +160,26 @@ Randy Sargent</string>
<widget class="QLabel" name="label_5">
<property name="minimumSize">
<size>
- <width>70</width>
+ <width>90</width>
<height>16</height>
</size>
</property>
<property name="maximumSize">
<size>
- <width>70</width>
+ <width>90</width>
<height>16</height>
</size>
</property>
+ <property name="font">
+ <font>
+ <pointsize>11</pointsize>
+ </font>
+ </property>
<property name="text">
- <string>UH Version:</string>
+ <string>CBC Interface</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignCenter</set>
</property>
</widget>
</item>
@@ -151,7 +198,10 @@ Randy Sargent</string>
</size>
</property>
<property name="text">
- <string>1.1.1.1</string>
+ <string>A.1.1</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignCenter</set>
</property>
</widget>
</item>
@@ -166,18 +216,26 @@ Randy Sargent</string>
<widget class="QLabel" name="label_7">
<property name="minimumSize">
<size>
- <width>70</width>
+ <width>90</width>
<height>16</height>
</size>
</property>
<property name="maximumSize">
<size>
- <width>70</width>
+ <width>90</width>
<height>16</height>
</size>
</property>
+ <property name="font">
+ <font>
+ <pointsize>11</pointsize>
+ </font>
+ </property>
<property name="text">
- <string>FW Version:</string>
+ <string>Firmware</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignCenter</set>
</property>
</widget>
</item>
@@ -196,7 +254,10 @@ Randy Sargent</string>
</size>
</property>
<property name="text">
- <string>1.1.1.1</string>
+ <string>999</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignCenter</set>
</property>
</widget>
</item>
View
307 cbcui/ui/Serial.ui
@@ -0,0 +1,307 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>SerialPage</class>
+ <widget class="QWidget" name="SerialPage">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>320</width>
+ <height>212</height>
+ </rect>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>320</width>
+ <height>212</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>329</width>
+ <height>212</height>
+ </size>
+ </property>
+ <property name="windowTitle">
+ <string>Form</string>
+ </property>
+ <layout class="QVBoxLayout">
+ <property name="spacing">
+ <number>0</number>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_5">
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <property name="topMargin">
+ <number>3</number>
+ </property>
+ <property name="bottomMargin">
+ <number>3</number>
+ </property>
+ <item>
+ <widget class="QComboBox" name="ui_portComboBox">
+ <property name="minimumSize">
+ <size>
+ <width>155</width>
+ <height>20</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>155</width>
+ <height>20</height>
+ </size>
+ </property>
+ <item>
+ <property name="text">
+ <string>CBC_Serial</string>
+ </property>
+ </item>
+ </widget>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QLabel" name="label_3">
+ <property name="minimumSize">
+ <size>
+ <width>65</width>
+ <height>20</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>65</width>
+ <height>20</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>Baud Rate</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QComboBox" name="ui_baudComboBox">
+ <property name="minimumSize">
+ <size>
+ <width>85</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>85</width>
+ <height>20</height>
+ </size>
+ </property>
+ <item>
+ <property name="text">
+ <string>1200</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>1800</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>2400</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>4800</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>9600</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>19200</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>38400</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>57600</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>76800</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>115200</string>
+ </property>
+ </item>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <widget class="Line" name="line">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_8">
+ <item>
+ <widget class="QLabel" name="label_2">
+ <property name="text">
+ <string>Command</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer_3">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="ui_byteCodeCheckBox">
+ <property name="text">
+ <string>byte code format</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_3">
+ <property name="spacing">
+ <number>9</number>
+ </property>
+ <item>
+ <widget class="QLineEdit" name="ui_commandLineEdit">
+ <property name="minimumSize">
+ <size>
+ <width>225</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>225</width>
+ <height>25</height>
+ </size>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer_2">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QPushButton" name="ui_sendButton">
+ <property name="minimumSize">
+ <size>
+ <width>80</width>
+ <height>30</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>80</width>
+ <height>30</height>
+ </size>
+ </property>
+ <property name="styleSheet">
+ <string notr="true">QPushButton{
+border:0px;
+background-image:url(:/actions/rivet80x30L.png);
+color:black;
+font-size:12pt;
+}
+QPushButton:pressed{
+border:0px;
+background-image:url(:/actions/rivet80x30D.png);
+color:white;
+font-size:12pt;
+}</string>
+ </property>
+ <property name="text">
+ <string>Send</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <widget class="QLabel" name="label">
+ <property name="text">
+ <string>Output</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPlainTextEdit" name="ui_outputConsole">
+ <property name="minimumSize">
+ <size>
+ <width>0</width>
+ <height>110</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>320</width>
+ <height>120</height>
+ </size>
+ </property>
+ <property name="styleSheet">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
View
196 cbcui/ui/Utilities.ui
@@ -1,7 +1,8 @@
-<ui version="4.0" >
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
<class>Utilities</class>
- <widget class="QWidget" name="Utilities" >
- <property name="geometry" >
+ <widget class="QWidget" name="Utilities">
+ <property name="geometry">
<rect>
<x>0</x>
<y>0</y>
@@ -9,35 +10,41 @@
<height>213</height>
</rect>
</property>
- <property name="windowTitle" >
+ <property name="windowTitle">
<string>Form</string>
</property>
- <layout class="QGridLayout" >
- <item row="0" column="0" >
- <widget class="QPushButton" name="ui_createButton" >
- <property name="enabled" >
- <bool>false</bool>
- </property>
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimumSize" >
- <size>
- <width>95</width>
- <height>30</height>
- </size>
- </property>
- <property name="maximumSize" >
- <size>
- <width>95</width>
- <height>30</height>
- </size>
- </property>
- <property name="styleSheet" >
- <string>QPushButton{
+ <widget class="QPushButton" name="ui_createButton">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>44</x>
+ <y>61</y>
+ <width>95</width>
+ <height>30</height>
+ </rect>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>95</width>
+ <height>30</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>95</width>
+ <height>30</height>
+ </size>
+ </property>
+ <property name="styleSheet">
+ <string notr="true">QPushButton{
border:0px;
background-image:url(:/actions/rivet95x30L.png);
color:black;
@@ -49,13 +56,128 @@ background-image:url(:/actions/rivet95x30D.png);
color:white;
font-size:12pt;
}</string>
- </property>
- <property name="text" >
- <string>iRobot Create</string>
- </property>
- </widget>
- </item>
- </layout>
+ </property>
+ <property name="text">
+ <string>iRobot Create</string>
+ </property>
+ </widget>
+ <widget class="QPushButton" name="ui_serialButton">