1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-17 02:52:12 +01:00

2nd attempting adding pipx config code.

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@2505 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
pip 2011-01-21 13:05:38 +00:00 committed by pip
parent 21ea998327
commit aec73a209d
18 changed files with 1808 additions and 0 deletions

View File

@ -0,0 +1,2 @@
#include "delay.h"

View File

@ -0,0 +1,13 @@
#ifndef DELAY_H
#define DELAY_H
#include <QThread>
class delay : public QThread
{
public:
static void msleep(unsigned long msecs)
{
QThread::msleep(msecs);
}
};
#endif // DELAY_H

View File

@ -0,0 +1,13 @@
<plugin name="PipXtreme" version="1.0.0" compatVersion="1.0.0">
<vendor>The OpenPilot Project</vendor>
<copyright>(C) 2011 Cathy Moss A.K.A. Pip</copyright>
<license>The GNU Public License (GPL) Version 3</license>
<description>A plugin to configure the PipXtreme OP modem via USB HID or Serial Port</description>
<url>http://www.openpilot.org</url>
<dependencyList>
<dependency name="Core" version="1.0.0"/>
<dependency name="UAVObjects" version="1.0.0"/>
<dependency name="UAVTalk" version="1.0.0"/>
<dependency name="RAWHid" version="1.0.0"/>
</dependencyList>
</plugin>

View File

@ -0,0 +1,40 @@
TEMPLATE = lib
TARGET = PipXtreme
QT += svg
include(../../openpilotgcsplugin.pri)
include(../../plugins/coreplugin/coreplugin.pri)
include(../../plugins/uavobjects/uavobjects.pri)
include(../../plugins/uavtalk/uavtalk.pri)
include(../../plugins/rawhid/rawhid.pri)
INCLUDEPATH += ../../libs/qextserialport/src
HEADERS += pipxtremegadget.h \
pipxtremegadgetconfiguration.h \
pipxtremegadgetfactory.h \
pipxtremegadgetoptionspage.h \
pipxtremegadgetwidget.h \
plugin.h \
delay.h \
devicewidget.h \
SSP/port.h \
SSP/qssp.h \
SSP/qsspt.h \
SSP/common.h
SOURCES += pipxtremegadget.cpp \
pipxtremegadgetconfiguration.cpp \
pipxtremegadgetfactory.cpp \
pipxtremegadgetoptionspage.cpp \
pipxtremegadgetwidget.cpp \
pipxtremeplugin.cpp \
delay.cpp \
SSP/port.cpp \
SSP/qssp.cpp \
SSP/qsspt.cpp
OTHER_FILES += PipXtreme.pluginspec
FORMS += \
pipxtreme.ui \
pipxtreme.ui
RESOURCES += \
pipxtreme.qrc

View File

@ -0,0 +1,5 @@
<RCC>
<qresource prefix="/pipxtreme">
<file>images/view-refresh.svg</file>
</qresource>
</RCC>

View File

@ -0,0 +1,722 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>PipXtremeWidget</class>
<widget class="QWidget" name="PipXtremeWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>570</width>
<height>381</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<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="QPushButton" name="connectButton">
<property name="enabled">
<bool>true</bool>
</property>
<property name="mouseTracking">
<bool>true</bool>
</property>
<property name="toolTip">
<string>Tells the mainboard to go down
to bootloader mode.
(Only enabled if telemetry link is established, either
through serial or USB)</string>
</property>
<property name="text">
<string> Connect </string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="telemetryLink">
<property name="minimumSize">
<size>
<width>200</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>When telemetry is not connected, select the communication
method using this combo box.
You can use this to force a communication channel when doing
a &quot;Boot&quot; (button on the left). It is updated automatically when
halting a running board.</string>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="refreshPorts">
<property name="toolTip">
<string>Refresh the list of serial ports</string>
</property>
<property name="text">
<string>...</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>8</height>
</size>
</property>
</spacer>
</item>
<item>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Serial Number</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="lineEdit_SerialNumber">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="font">
<font>
<weight>75</weight>
<italic>false</italic>
<bold>true</bold>
</font>
</property>
<property name="acceptDrops">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">QLineEdit {
border: none;
border-radius: 1px;
padding: 0 8px;
background: rgba(0, 0, 0, 16);
/* background: transparent; */
/* selection-background-color: darkgray;*/
}</string>
</property>
<property name="frame">
<bool>true</bool>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QLabel" name="label">
<property name="text">
<string>Paired Serial Number</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QLineEdit" name="lineEdit_PairedSerialNumber">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_10">
<property name="text">
<string>Frequency Band</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="lineEdit_FrequencyBand">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="styleSheet">
<string notr="true">QLineEdit {
border: none;
border-radius: 1px;
padding: 0 8px;
background: rgba(0, 0, 0, 16);
/* background: transparent; */
/* selection-background-color: darkgray;*/
}</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Min Frequency (MHz)</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="lineEdit_MinFrequency">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="styleSheet">
<string notr="true">QLineEdit {
border: none;
border-radius: 1px;
padding: 0 8px;
background: rgba(0, 0, 0, 16);
/* background: transparent; */
/* selection-background-color: darkgray;*/
}</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Max Frequency (MHz)</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLineEdit" name="lineEdit_MaxFrequency">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="styleSheet">
<string notr="true">QLineEdit {
border: none;
border-radius: 1px;
padding: 0 8px;
background: rgba(0, 0, 0, 16);
/* background: transparent; */
/* selection-background-color: darkgray;*/
}</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_12">
<property name="text">
<string>Frequency Step Size (Hz)</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QLineEdit" name="lineEdit_FrequencyStepSize">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="styleSheet">
<string notr="true">QLineEdit {
border: none;
border-radius: 1px;
padding: 0 8px;
background: rgba(0, 0, 0, 16);
/* background: transparent; */
/* selection-background-color: darkgray;*/
}</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="label_11">
<property name="text">
<string>State</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QLineEdit" name="lineEdit_State">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="styleSheet">
<string notr="true">QLineEdit {
border: none;
border-radius: 1px;
padding: 0 8px;
background: rgba(0, 0, 0, 16);
/* background: transparent; */
/* selection-background-color: darkgray;*/
}</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="6" column="3">
<widget class="QComboBox" name="comboBox_SerialPortSpeed">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
</widget>
</item>
<item row="5" column="3">
<widget class="QComboBox" name="comboBox_MaxRFTxPower">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="modelColumn">
<number>0</number>
</property>
</widget>
</item>
<item row="4" column="3">
<widget class="QComboBox" name="comboBox_MaxRFBandwidth">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
</widget>
</item>
<item row="3" column="3">
<widget class="QDoubleSpinBox" name="doubleSpinBox_Frequency">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="accelerated">
<bool>true</bool>
</property>
<property name="decimals">
<number>8</number>
</property>
<property name="minimum">
<double>0.000000000000000</double>
</property>
<property name="maximum">
<double>1000.000000000000000</double>
</property>
<property name="singleStep">
<double>0.000001000000000</double>
</property>
</widget>
</item>
<item row="2" column="3">
<widget class="QSpinBox" name="spinBox_FrequencyCalibration">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="accelerated">
<bool>true</bool>
</property>
<property name="maximum">
<number>255</number>
</property>
</widget>
</item>
<item row="6" column="2">
<widget class="QLabel" name="label_8">
<property name="text">
<string>Serial Port Speed</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="5" column="2">
<widget class="QLabel" name="label_7">
<property name="text">
<string>Max RF Tx Power</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="4" column="2">
<widget class="QLabel" name="label_6">
<property name="text">
<string>Max RF Datarate (bits/s)</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="3" column="2">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Frequency (MHz)</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QLabel" name="label_13">
<property name="text">
<string>Frequency Calibration</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QLabel" name="label_14">
<property name="text">
<string>Mode</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="1" column="3">
<widget class="QComboBox" name="comboBox_Mode">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_10">
<item>
<widget class="QLabel" name="label_9">
<property name="text">
<string>AES Encryption Key</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEdit_AESKey">
<property name="toolTip">
<string>The AES encryption key</string>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="frame">
<bool>true</bool>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_AESKeyRandom">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>Radomise the AES encryption key</string>
</property>
<property name="text">
<string> Rand</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBox_AESEnable">
<property name="layoutDirection">
<enum>Qt::RightToLeft</enum>
</property>
<property name="text">
<string>Enable</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>8</height>
</size>
</property>
</spacer>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_11">
<item>
<widget class="QPushButton" name="pushButton_ScanSpectrum">
<property name="toolTip">
<string>Scan whole band</string>
</property>
<property name="text">
<string> Scan Spectrum </string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_8">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_12">
<item>
<widget class="QGraphicsView" name="graphicsView_Spectrum">
<property name="backgroundBrush">
<brush brushstyle="NoBrush">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</property>
<property name="foregroundBrush">
<brush brushstyle="NoBrush">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</property>
<property name="interactive">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View File

@ -0,0 +1,49 @@
/**
******************************************************************************
*
* @file pipxtremegadget.cpp
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @addtogroup GCSPlugins GCS Plugins
* @{
* @{
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "pipxtremegadget.h"
#include "pipxtremegadgetwidget.h"
#include "pipxtremegadgetconfiguration.h"
PipXtremeGadget::PipXtremeGadget(QString classId, PipXtremeGadgetWidget *widget, QWidget *parent) :
IUAVGadget(classId, parent),
m_widget(widget)
{
}
PipXtremeGadget::~PipXtremeGadget()
{
}
/**
* Loads a configuration.
*
*/
void PipXtremeGadget::loadConfiguration(IUAVGadgetConfiguration* config)
{
Q_UNUSED(config);
/* PipXtremeGadgetConfiguration *m = qobject_cast< PipXtremeGadgetConfiguration*>(config);
*/
}

View File

@ -0,0 +1,55 @@
/**
******************************************************************************
*
* @file pipxtremegadget.h
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @addtogroup GCSPlugins GCS Plugins
* @{
* @{
* @brief The YModem protocol serial uploader plugin
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef PIPXTREMEGADGET_H
#define PIPXTREMEGADGET_H
#include <coreplugin/iuavgadget.h>
#include "pipxtremegadgetwidget.h"
class IUAVGadget;
class QWidget;
class QString;
class PipXtremeGadgetWidget;
using namespace Core;
class PipXtremeGadget : public Core::IUAVGadget
{
Q_OBJECT
public:
PipXtremeGadget(QString classId, PipXtremeGadgetWidget *widget, QWidget *parent = 0);
~PipXtremeGadget();
QWidget *widget() { return m_widget; }
void loadConfiguration(IUAVGadgetConfiguration* config);
private:
PipXtremeGadgetWidget *m_widget;
};
#endif

View File

@ -0,0 +1,105 @@
/**
******************************************************************************
*
* @file pipxtremegadgetconfiguration.cpp
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @addtogroup GCSPlugins GCS Plugins
* @{
* @{
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "pipxtremegadgetconfiguration.h"
#include <qextserialport/src/qextserialport.h>
/**
* Loads a saved configuration or defaults if non exist.
*
*/
PipXtremeGadgetConfiguration::PipXtremeGadgetConfiguration(QString classId, QSettings* qSettings, QObject *parent) :
IUAVGadgetConfiguration(classId, parent),
m_defaultPort("Unknown"),
m_defaultSpeed(BAUD57600),
m_defaultDataBits(DATA_8),
m_defaultFlow(FLOW_OFF),
m_defaultParity(PAR_NONE),
m_defaultStopBits(STOP_1),
m_defaultTimeOut(5000)
{
//if a saved configuration exists load it
if (qSettings != 0)
{
BaudRateType speed;
DataBitsType databits;
FlowType flow;
ParityType parity;
StopBitsType stopbits;
int ispeed = qSettings->value("defaultSpeed").toInt();
int idatabits = qSettings->value("defaultDataBits").toInt();
int iflow = qSettings->value("defaultFlow").toInt();
int iparity = qSettings->value("defaultParity").toInt();
int istopbits = qSettings->value("defaultStopBits").toInt();
QString port = qSettings->value("defaultPort").toString();
databits=(DataBitsType) idatabits;
flow=(FlowType)iflow;
parity=(ParityType)iparity;
stopbits=(StopBitsType)istopbits;
speed=(BaudRateType)ispeed;
m_defaultPort=port;
m_defaultSpeed=speed;
m_defaultDataBits=databits;
m_defaultFlow=flow;
m_defaultParity=parity;
m_defaultStopBits=stopbits;
}
}
/**
* Clones a configuration.
*
*/
IUAVGadgetConfiguration *PipXtremeGadgetConfiguration::clone()
{
PipXtremeGadgetConfiguration *m = new PipXtremeGadgetConfiguration(this->classId());
m->m_defaultSpeed = m_defaultSpeed;
m->m_defaultDataBits = m_defaultDataBits;
m->m_defaultFlow = m_defaultFlow;
m->m_defaultParity = m_defaultParity;
m->m_defaultStopBits = m_defaultStopBits;
m->m_defaultPort = m_defaultPort;
return m;
}
/**
* Saves a configuration.
*
*/
void PipXtremeGadgetConfiguration::saveConfig(QSettings* qSettings) const
{
qSettings->setValue("defaultSpeed", m_defaultSpeed);
qSettings->setValue("defaultDataBits", m_defaultDataBits);
qSettings->setValue("defaultFlow", m_defaultFlow);
qSettings->setValue("defaultParity", m_defaultParity);
qSettings->setValue("defaultStopBits", m_defaultStopBits);
qSettings->setValue("defaultPort", m_defaultPort);
}

View File

@ -0,0 +1,72 @@
/**
******************************************************************************
*
* @file pipxtremegadgetconfiguration.h
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @addtogroup GCSPlugins GCS Plugins
* @{
* @{
* @brief The YModem protocol serial uploader plugin
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef PIPXTREMEGADGETCONFIGURATION_H
#define PIPXTREMEGADGETCONFIGURATION_H
#include <coreplugin/iuavgadgetconfiguration.h>
#include <qextserialport/src/qextserialport.h>
using namespace Core;
class PipXtremeGadgetConfiguration : public IUAVGadgetConfiguration
{
Q_OBJECT
public:
explicit PipXtremeGadgetConfiguration(QString classId, QSettings* qSettings = 0, QObject *parent = 0);
//set port configuration functions
void setSpeed(BaudRateType speed) {m_defaultSpeed=speed;}
void setDataBits(DataBitsType databits) {m_defaultDataBits=databits;}
void setFlow(FlowType flow) {m_defaultFlow=flow;}
void setParity(ParityType parity) {m_defaultParity=parity;}
void setStopBits(StopBitsType stopbits) {m_defaultStopBits=stopbits;}
void setPort(QString port){m_defaultPort=port;}
void setTimeOut(long timeout){m_defaultTimeOut=timeout;}
//get port configuration functions
BaudRateType Speed() {return m_defaultSpeed;}
DataBitsType DataBits() {return m_defaultDataBits;}
FlowType Flow() {return m_defaultFlow;}
ParityType Parity() {return m_defaultParity;}
StopBitsType StopBits() {return m_defaultStopBits;}
QString Port(){return m_defaultPort;}
long TimeOut(){return m_defaultTimeOut;}
void saveConfig(QSettings* settings) const;
IUAVGadgetConfiguration *clone();
private:
QString m_defaultPort;
BaudRateType m_defaultSpeed;
DataBitsType m_defaultDataBits;
FlowType m_defaultFlow;
ParityType m_defaultParity;
StopBitsType m_defaultStopBits;
long m_defaultTimeOut;
};
#endif

View File

@ -0,0 +1,57 @@
/**
******************************************************************************
*
* @file pipxtremegadgetfactory.cpp
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @addtogroup GCSPlugins GCS Plugins
* @{
* @{
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "pipxtremegadgetfactory.h"
#include "pipxtremegadgetwidget.h"
#include "pipxtremegadget.h"
#include "pipxtremegadgetconfiguration.h"
#include "pipxtremegadgetoptionspage.h"
#include <coreplugin/iuavgadget.h>
PipXtremeGadgetFactory::PipXtremeGadgetFactory(QObject *parent) :
IUAVGadgetFactory(QString("PipXtreme"), tr("PipXtreme Gadget"), parent)
{
}
PipXtremeGadgetFactory::~PipXtremeGadgetFactory()
{
}
Core::IUAVGadget* PipXtremeGadgetFactory::createGadget(QWidget *parent)
{
PipXtremeGadgetWidget* gadgetWidget = new PipXtremeGadgetWidget(parent);
return new PipXtremeGadget(QString("PipXtreme"), gadgetWidget, parent);
}
IUAVGadgetConfiguration *PipXtremeGadgetFactory::createConfiguration(QSettings* qSettings)
{
return new PipXtremeGadgetConfiguration(QString("PipXtreme"), qSettings);
}
IOptionsPage *PipXtremeGadgetFactory::createOptionsPage(IUAVGadgetConfiguration *config)
{
return new PipXtremeGadgetOptionsPage(qobject_cast<PipXtremeGadgetConfiguration*>(config));
}

View File

@ -0,0 +1,50 @@
/**
******************************************************************************
*
* @file pipxtremegadgetfactory.h
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @addtogroup GCSPlugins GCS Plugins
* @{
* @{
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef PIPXTREMEGADGETFACTORY_H
#define PIPXTREMEGADGETFACTORY_H
#include <coreplugin/iuavgadgetfactory.h>
namespace Core {
class IUAVGadget;
class IUAVGadgetFactory;
}
using namespace Core;
class PipXtremeGadgetFactory : public Core::IUAVGadgetFactory
{
Q_OBJECT
public:
PipXtremeGadgetFactory(QObject *parent = 0);
~PipXtremeGadgetFactory();
Core::IUAVGadget *createGadget(QWidget *parent);
IUAVGadgetConfiguration *createConfiguration(QSettings* qSettings);
IOptionsPage *createOptionsPage(IUAVGadgetConfiguration *config);
};
#endif

View File

@ -0,0 +1,69 @@
/**
******************************************************************************
*
* @file pipxtremegadgetoptionspage.cpp
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @addtogroup GCSPlugins GCS Plugins
* @{
* @{
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "pipxtremegadgetoptionspage.h"
#include "pipxtremegadgetconfiguration.h"
#include <QtGui/QLabel>
#include <QtGui/QSpinBox>
#include <QtGui/QDoubleSpinBox>
#include <QtGui/QHBoxLayout>
#include <QtGui/QVBoxLayout>
#include <QtGui/QTextEdit>
#include <QtGui/QComboBox>
#include <QtAlgorithms>
#include <QStringList>
PipXtremeGadgetOptionsPage::PipXtremeGadgetOptionsPage(PipXtremeGadgetConfiguration *config, QObject *parent) :
IOptionsPage(parent),
m_config(config)
{
}
//creates options page widget
QWidget *PipXtremeGadgetOptionsPage::createPage(QWidget *parent)
{
//main widget
QWidget *widget = new QWidget;
return widget;
}
/**
* Called when the user presses apply or OK.
*
* Saves the current values
*
*/
void PipXtremeGadgetOptionsPage::apply()
{
}
void PipXtremeGadgetOptionsPage::finish()
{
}

View File

@ -0,0 +1,74 @@
/**
******************************************************************************
*
* @file pipxtremegadgetoptionspage.h
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @addtogroup GCSPlugins GCS Plugins
* @{
* @{
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef PIPXTREMEGADGETOPTIONSPAGE_H
#define PIPXTREMEGADGETOPTIONSPAGE_H
#include <qextserialport/src/qextserialenumerator.h>
#include "coreplugin/dialogs/ioptionspage.h"
#include "QString"
#include <QStringList>
#include <QDebug>
namespace Core {
class IUAVGadgetConfiguration;
}
class PipXtremeGadgetConfiguration;
class QTextEdit;
class QComboBox;
class QSpinBox;
using namespace Core;
class PipXtremeGadgetOptionsPage : public IOptionsPage
{
Q_OBJECT
public:
explicit PipXtremeGadgetOptionsPage(PipXtremeGadgetConfiguration *config, QObject *parent = 0);
QWidget *createPage(QWidget *parent);
void apply();
void finish();
private:
PipXtremeGadgetConfiguration *m_config;
QComboBox *m_portCB;
QComboBox *m_speedCB;
QComboBox *m_databitsCB;
QComboBox *m_flowCB;
QComboBox *m_parityCB;
QComboBox *m_stopbitsCB;
QSpinBox *m_timeoutSpin;
QStringList BaudRateTypeString;
QStringList BaudRateTypeStringALL;
QStringList DataBitsTypeStringALL;
QStringList ParityTypeStringALL;
QStringList StopBitsTypeStringALL;
QStringList DataBitsTypeString;
QStringList ParityTypeString;
QStringList StopBitsTypeString;
QStringList FlowTypeString;
};
#endif

View File

@ -0,0 +1,290 @@
/**
******************************************************************************
*
* @file pipxtremegadgetwidget.cpp
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @addtogroup GCSPlugins GCS Plugins
* @{
* @{
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "pipxtremegadgetwidget.h"
// constructor
PipXtremeGadgetWidget::PipXtremeGadgetWidget(QWidget *parent) : QWidget(parent)
{
m_config = new Ui_PipXtremeWidget();
m_config->setupUi(this);
currentStep = IAP_STATE_READY;
rescueStep = RESCUE_STEP0;
resetOnly = false;
m_config->comboBox_Mode->clear();
m_config->comboBox_Mode->addItem("Normal", 0);
m_config->comboBox_Mode->addItem("Scan Spectrum", 1);
m_config->comboBox_Mode->addItem("Tx Carrier Calibrate", 2);
m_config->comboBox_Mode->addItem("Tx Spectrum Test", 3);
m_config->comboBox_SerialPortSpeed->clear();
m_config->comboBox_SerialPortSpeed->addItem("1200", 1200);
m_config->comboBox_SerialPortSpeed->addItem("2400", 2400);
m_config->comboBox_SerialPortSpeed->addItem("4800", 4800);
m_config->comboBox_SerialPortSpeed->addItem("9600", 9600);
m_config->comboBox_SerialPortSpeed->addItem("19200", 19200);
m_config->comboBox_SerialPortSpeed->addItem("38400", 38400);
m_config->comboBox_SerialPortSpeed->addItem("57600", 57600);
m_config->comboBox_SerialPortSpeed->addItem("115200", 115200);
m_config->comboBox_SerialPortSpeed->addItem("230400", 230400);
m_config->comboBox_SerialPortSpeed->addItem("460800", 460800);
m_config->comboBox_SerialPortSpeed->addItem("921600", 921600);
m_config->doubleSpinBox_Frequency->setSingleStep(0.00015625);
m_config->graphicsView_Spectrum->setScene(new QGraphicsScene(this));
QGraphicsScene *spec_scene = m_config->graphicsView_Spectrum->scene();
if (spec_scene)
{
spec_scene->setBackgroundBrush(Qt::black);
spec_scene->clear();
// spec_scene->addItem(m_background);
// spec_scene->addItem(m_joystickEnd);
// spec_scene->setSceneRect(m_background->boundingRect());
}
m_config->pushButton_ScanSpectrum->setEnabled(false);
// Listen to autopilot connection events
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
TelemetryManager *telMngr = pm->getObject<TelemetryManager>();
connect(telMngr, SIGNAL(connected()), this, SLOT(onModemConnect()));
connect(telMngr, SIGNAL(disconnected()), this, SLOT(onModemDisconnect()));
// Note: remove listening to the connection manager, it overlaps with
// listening to the telemetry manager, we should only listen to one, not both.
// Also listen to disconnect actions from the user:
// Core::ConnectionManager *cm = Core::ICore::instance()->connectionManager();
// connect(cm, SIGNAL(deviceDisconnected()), this, SLOT(onModemDisconnect()));
connect(m_config->connectButton, SIGNAL(clicked()), this, SLOT(goToAPIMode()));
getSerialPorts();
QIcon rbi;
rbi.addFile(QString(":pipxtreme/images/view-refresh.svg"));
m_config->refreshPorts->setIcon(rbi);
connect(m_config->refreshPorts, SIGNAL(clicked()), this, SLOT(getSerialPorts()));
// delay::msleep(600); // just for pips reference
}
// destructor
PipXtremeGadgetWidget::~PipXtremeGadgetWidget()
{
}
void PipXtremeGadgetWidget::resizeEvent(QResizeEvent *event)
{
if (m_config)
{
if (m_config->graphicsView_Spectrum)
{
QGraphicsScene *spec_scene = m_config->graphicsView_Spectrum->scene();
if (spec_scene)
{
// spec_scene->setSceneRect(QRect(QPoint(0, 0), event->size()));
// spec_scene->setBackgroundBrush(Qt::black);
}
}
}
// PipXtremeGadgetWidget::resizeEvent(event);
}
bool sortPorts(const QextPortInfo &s1,const QextPortInfo &s2)
{
return (s1.portName < s2.portName);
}
// Gets the list of serial ports
void PipXtremeGadgetWidget::getSerialPorts()
{
QStringList list;
m_config->refreshPorts->setEnabled(false);
m_config->telemetryLink->setEnabled(false);
// Populate the telemetry combo box:
m_config->telemetryLink->clear();
// list.append(QString("USB"));
QList<QextPortInfo> ports = QextSerialEnumerator::getPorts();
// sort the list by port number (nice idea from PT_Dreamer :))
qSort(ports.begin(), ports.end(),sortPorts);
foreach (QextPortInfo port, ports)
{
list.append(port.friendName);
}
m_config->telemetryLink->addItems(list);
m_config->refreshPorts->setEnabled(true);
m_config->telemetryLink->setEnabled(true);
}
QString PipXtremeGadgetWidget::getPortDevice(const QString &friendName)
{
QList<QextPortInfo> ports = QextSerialEnumerator::getPorts();
foreach (QextPortInfo port, ports)
{
#ifdef Q_OS_WIN
if (port.friendName == friendName)
return port.portName;
#else
if (port.friendName == friendName)
return port.physName;
#endif
}
return "";
}
void PipXtremeGadgetWidget::onModemConnect()
{
m_config->connectButton->setText(tr(" Disconnect "));
m_config->telemetryLink->setEnabled(false);
m_config->pushButton_ScanSpectrum->setEnabled(true);
}
void PipXtremeGadgetWidget::onModemDisconnect()
{
m_config->connectButton->setText(tr(" Connect "));
m_config->telemetryLink->setEnabled(true);
m_config->pushButton_ScanSpectrum->setEnabled(false);
}
// Ask the modem to go into API mode
void PipXtremeGadgetWidget::goToAPIMode(UAVObject* callerObj, bool success)
{
Q_UNUSED(callerObj);
/*
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
UAVObjectManager *objManager = pm->getObject<UAVObjectManager>();
UAVObject *fwIAP = dynamic_cast<UAVDataObject*>(objManager->getObject(QString("FirmwareIAPObj")));
switch (currentStep)
{
case IAP_STATE_READY:
getSerialPorts(); // Useful in case a new serial port appeared since the initial list,
// otherwise we won't find it when we stop the board.
// The board is running, send the 1st IAP Reset order:
fwIAP->getField("Command")->setValue("1122");
connect(fwIAP,SIGNAL(transactionCompleted(UAVObject*,bool)),this,SLOT(goToAPIMode(UAVObject*, bool)));
currentStep = IAP_STATE_STEP_1;
fwIAP->updated();
break;
case IAP_STATE_STEP_1:
if (!success)
{
currentStep = IAP_STATE_READY;
disconnect(fwIAP, SIGNAL(transactionCompleted(UAVObject*,bool)),this,SLOT(goToAPIMode(UAVObject*, bool)));
break;
}
delay::msleep(600);
fwIAP->getField("Command")->setValue("2233");
currentStep = IAP_STATE_READY;
fwIAP->updated();
break;
}
*/
}
// Tell the modem to reset
void PipXtremeGadgetWidget::systemReset()
{
resetOnly = true;
/*
if (dfu)
{
delete dfu;
dfu = NULL;
}
*/
goToAPIMode();
}
// Tells the system to boot (from Bootloader state)
void PipXtremeGadgetWidget::systemBoot()
{
/*
// Suspend telemety & polling in case it is not done yet
Core::ConnectionManager *cm = Core::ICore::instance()->connectionManager();
cm->disconnectDevice();
cm->suspendPolling();
QString devName = m_config->telemetryLink->currentText();
repaint();
if (!dfu)
{
if (devName == "USB")
dfu = new DFUObject(DFU_DEBUG, false, QString());
else
dfu = new DFUObject(DFU_DEBUG,true,getPortDevice(devName));
}
dfu->AbortOperation();
if (!dfu->enterDFU(0))
{
delete dfu;
dfu = NULL;
return;
}
dfu->JumpToApp();
// Restart the polling thread
cm->resumePolling();
m_config->telemetryLink->setEnabled(true);
if (currentStep == IAP_STATE_BOOTLOADER )
{
}
currentStep = IAP_STATE_READY;
delete dfu; // Frees up the USB/Serial port too
dfu = NULL;
*/
}
// Shows a message box with an error string.
void PipXtremeGadgetWidget::error(QString errorString, int errorNumber)
{
Q_UNUSED(errorNumber);
QMessageBox msgBox;
msgBox.setIcon(QMessageBox::Critical);
msgBox.setText(errorString + " [" + QString::number(errorNumber) + "]");
msgBox.exec();
}

View File

@ -0,0 +1,86 @@
/**
******************************************************************************
*
* @file pipxtremegadgetwidget.h
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @addtogroup GCSPlugins GCS Plugins
* @{
* @{
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef PIPXTREMEGADGETWIDGET_H
#define PIPXTREMEGADGETWIDGET_H
#include "ui_pipxtreme.h"
#include "delay.h"
//#include "op_dfu.h"
#include <qextserialport.h>
#include <qextserialenumerator.h>
#include "uavtalk/telemetrymanager.h"
#include "extensionsystem/pluginmanager.h"
#include "uavobjects/uavobjectmanager.h"
#include "uavobjects/uavobject.h"
#include "rawhid/rawhidplugin.h"
#include <QtGui/QWidget>
#include <QLabel>
#include <QLineEdit>
#include <QThread>
#include <QMessageBox>
#include <QTimer>
//using namespace OP_DFU;
class PipXtremeGadgetWidget : public QWidget
{
Q_OBJECT
public:
PipXtremeGadgetWidget(QWidget *parent = 0);
~PipXtremeGadgetWidget();
typedef enum { IAP_STATE_READY, IAP_STATE_STEP_1} IAPStep;
typedef enum { RESCUE_STEP0, RESCUE_STEP1, RESCUE_STEP2, RESCUE_STEP3, RESCUE_POWER1, RESCUE_POWER2, RESCUE_DETECT } RescueStep;
public slots:
void onModemConnect();
void onModemDisconnect();
protected:
void resizeEvent(QResizeEvent *event);
private:
Ui_PipXtremeWidget *m_config;
// DFUObject *dfu;
IAPStep currentStep;
RescueStep rescueStep;
bool resetOnly;
QString getPortDevice(const QString &friendName);
private slots:
void error(QString errorString,int errorNumber);
void goToAPIMode(UAVObject* = NULL, bool = false);
void systemReset();
void systemBoot();
void getSerialPorts();
};
#endif

View File

@ -0,0 +1,61 @@
/**
******************************************************************************
*
* @file pipxtremeplugin.cpp
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @addtogroup GCSPlugins GCS Plugins
* @{
* @{
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "pipxtremeplugin.h"
#include "pipxtremegadgetfactory.h"
#include <QtPlugin>
#include <QStringList>
#include <extensionsystem/pluginmanager.h>
PipXtremePlugin::PipXtremePlugin()
{
// Do nothing
}
PipXtremePlugin::~PipXtremePlugin()
{
// Do nothing
}
bool PipXtremePlugin::initialize(const QStringList& args, QString *errMsg)
{
Q_UNUSED(args);
Q_UNUSED(errMsg);
mf = new PipXtremeGadgetFactory(this);
addAutoReleasedObject(mf);
return true;
}
void PipXtremePlugin::extensionsInitialized()
{
// Do nothing
}
void PipXtremePlugin::shutdown()
{
// Do nothing
}
Q_EXPORT_PLUGIN(PipXtremePlugin)

View File

@ -0,0 +1,45 @@
/**
******************************************************************************
*
* @file pipxtremeplugin.h
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @addtogroup GCSPlugins GCS Plugins
* @{
* @{
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef PIPXTREMEPLUGIN_H
#define PIPXTREMEPLUGIN_H
#include <extensionsystem/iplugin.h>
class PipXtremeGadgetFactory;
class PipXtremePlugin : public ExtensionSystem::IPlugin
{
public:
PipXtremePlugin();
~PipXtremePlugin();
void extensionsInitialized();
bool initialize(const QStringList & arguments, QString * errorString);
void shutdown();
private:
PipXtremeGadgetFactory *mf;
};
#endif