kopia lustrzana https://gitlab.com/eliggett/wfview
playing around with shuttle connection
rodzic
224c6183f0
commit
acbbd40c37
|
@ -0,0 +1,68 @@
|
|||
#include "shuttle.h"
|
||||
#include <QDebug>
|
||||
|
||||
shuttle::shuttle(QObject* parent)
|
||||
: QObject(parent), m_hid_dev(new QHidDevice())
|
||||
{
|
||||
|
||||
auto list = m_usb.devices();
|
||||
|
||||
for (auto l : list)
|
||||
{
|
||||
qDebug() << " Device:" << QString(l);
|
||||
}
|
||||
|
||||
m_send.append(static_cast<char>(0x81u));
|
||||
m_send.append(static_cast<char>(0x01u));
|
||||
|
||||
if (this->openDevice()) {
|
||||
qInfo("Device open!");
|
||||
//this->write(&m_send);
|
||||
qDebug() << "Manufacturer:" << m_hid_dev->manufacturer();
|
||||
qDebug() << "Product:" << m_hid_dev->product();
|
||||
}
|
||||
else {
|
||||
qWarning("Could not open device!");
|
||||
}
|
||||
}
|
||||
|
||||
shuttle::~shuttle()
|
||||
{
|
||||
this->closeDevice();
|
||||
m_hid_dev->deleteLater();
|
||||
}
|
||||
|
||||
|
||||
bool shuttle::openDevice()
|
||||
{
|
||||
qDebug("Opening");
|
||||
|
||||
return m_hid_dev->open(0x0b33, 0x0020);
|
||||
}
|
||||
|
||||
void shuttle::closeDevice()
|
||||
{
|
||||
qDebug("Closing");
|
||||
|
||||
if (m_hid_dev->isOpen()) {
|
||||
m_hid_dev->close();
|
||||
}
|
||||
}
|
||||
|
||||
void shuttle::read(QByteArray* buf)
|
||||
{
|
||||
QByteArray b(128, '0');
|
||||
m_hid_dev->read(&b, b.size());
|
||||
|
||||
qDebug() << "Reading" << b << b.size();
|
||||
buf->append(b);
|
||||
}
|
||||
|
||||
void shuttle::write(QByteArray* buf)
|
||||
{
|
||||
qDebug() << "Writing" << *buf << buf->size();
|
||||
if (m_hid_dev->write(buf, buf->size()) < 0) {
|
||||
qWarning("write failed");
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
#ifndef SHUTTLE_H
|
||||
#define SHUTTLE_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QtUsb/QUsb>
|
||||
#include <QtUsb/QHidDevice>
|
||||
|
||||
const quint8 USB_ENDPOINT_IN = 0x81; /* Bulk output endpoint for responses */
|
||||
const quint8 USB_ENDPOINT_OUT = 0x01; /* Bulk input endpoint for commands */
|
||||
const quint16 USB_TIMEOUT_MSEC = 300;
|
||||
|
||||
class shuttle : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit shuttle(QObject* parent = Q_NULLPTR);
|
||||
~shuttle(void);
|
||||
bool openDevice(void);
|
||||
void closeDevice(void);
|
||||
void read(QByteArray* buf);
|
||||
void write(QByteArray* buf);
|
||||
|
||||
signals:
|
||||
|
||||
private:
|
||||
QUsb m_usb;
|
||||
QHidDevice* m_hid_dev;
|
||||
QByteArray m_send, m_recv;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
|
@ -17,7 +17,7 @@ wfmain::wfmain(const QString serialPortCL, const QString hostCL, const QString s
|
|||
|
||||
setWindowIcon(QIcon( QString(":resources/wfview.png")));
|
||||
ui->setupUi(this);
|
||||
|
||||
shuttleDev = new shuttle();
|
||||
setWindowTitle(QString("wfview"));
|
||||
|
||||
this->serialPortCL = serialPortCL;
|
||||
|
@ -659,6 +659,7 @@ wfmain::~wfmain()
|
|||
delete rpt;
|
||||
delete ui;
|
||||
delete settings;
|
||||
delete shuttleDev;
|
||||
}
|
||||
|
||||
void wfmain::closeEvent(QCloseEvent *event)
|
||||
|
|
2
wfmain.h
2
wfmain.h
|
@ -28,6 +28,7 @@
|
|||
|
||||
#include <qcustomplot.h>
|
||||
#include <qserialportinfo.h>
|
||||
#include "shuttle.h"
|
||||
|
||||
namespace Ui {
|
||||
class wfmain;
|
||||
|
@ -705,6 +706,7 @@ private:
|
|||
|
||||
|
||||
SERVERCONFIG serverConfig;
|
||||
shuttle *shuttleDev;
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -6,6 +6,8 @@
|
|||
|
||||
QT += core gui serialport network multimedia
|
||||
|
||||
QT += usb
|
||||
|
||||
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport
|
||||
|
||||
TARGET = wfview
|
||||
|
@ -103,7 +105,8 @@ SOURCES += main.cpp\
|
|||
pttyhandler.cpp \
|
||||
resampler/resample.c \
|
||||
repeatersetup.cpp \
|
||||
rigctld.cpp
|
||||
rigctld.cpp \
|
||||
shuttle.cpp
|
||||
|
||||
HEADERS += wfmain.h \
|
||||
commhandler.h \
|
||||
|
@ -126,7 +129,8 @@ HEADERS += wfmain.h \
|
|||
resampler/resample_sse.h \
|
||||
repeatersetup.h \
|
||||
repeaterattributes.h \
|
||||
rigctld.h
|
||||
rigctld.h \
|
||||
shuttle.h
|
||||
|
||||
|
||||
FORMS += wfmain.ui \
|
||||
|
|
|
@ -57,7 +57,7 @@
|
|||
<ExceptionHandling>Sync</ExceptionHandling>
|
||||
<ObjectFileName>release\</ObjectFileName>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<PreprocessorDefinitions>_WINDOWS;UNICODE;_UNICODE;WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;QT_DEPRECATED_WARNINGS;QCUSTOMPLOT_COMPILE_LIBRARY;OUTSIDE_SPEEX;RANDOM_PREFIX=wf;GITSHORT="b5d6063";HOST="wfview.org";UNAME="build";NDEBUG;QT_NO_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>_WINDOWS;UNICODE;_UNICODE;WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;QT_DEPRECATED_WARNINGS;QCUSTOMPLOT_COMPILE_LIBRARY;OUTSIDE_SPEEX;RANDOM_PREFIX=wf;GITSHORT="224c618";HOST="wfview.org";UNAME="build";NDEBUG;QT_NO_DEBUG;QT_USB_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessToFile>false</PreprocessToFile>
|
||||
<ProgramDataBaseFileName></ProgramDataBaseFileName>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
|
@ -66,7 +66,7 @@
|
|||
<WarningLevel>Level3</WarningLevel>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation></ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>shell32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>$(QTDIR)\lib\Qt5Usb.lib;shell32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>C:\opensslx86\lib;C:\Utils\my_sql\mysql-5.7.25-win32\lib;C:\Utils\postgresqlx86\pgsql\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalOptions>-O2 -s "/MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='*' processorArchitecture='*'" %(AdditionalOptions)</AdditionalOptions>
|
||||
<DataExecutionPrevention>true</DataExecutionPrevention>
|
||||
|
@ -85,7 +85,7 @@
|
|||
<WarningLevel>0</WarningLevel>
|
||||
</Midl>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>_WINDOWS;UNICODE;_UNICODE;WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;QT_DEPRECATED_WARNINGS;QCUSTOMPLOT_COMPILE_LIBRARY;OUTSIDE_SPEEX;RANDOM_PREFIX=wf;GITSHORT=\"b5d6063\";HOST=\"wfview.org\";UNAME=\"build\";NDEBUG;QT_NO_DEBUG;QT_MULTIMEDIA_LIB;QT_PRINTSUPPORT_LIB;QT_WIDGETS_LIB;QT_GUI_LIB;QT_SERIALPORT_LIB;QT_NETWORK_LIB;QT_CORE_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>_WINDOWS;UNICODE;_UNICODE;WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;QT_DEPRECATED_WARNINGS;QCUSTOMPLOT_COMPILE_LIBRARY;OUTSIDE_SPEEX;RANDOM_PREFIX=wf;GITSHORT=\"224c618\";HOST=\"wfview.org\";UNAME=\"build\";NDEBUG;QT_NO_DEBUG;QT_MULTIMEDIA_LIB;QT_PRINTSUPPORT_LIB;QT_WIDGETS_LIB;QT_GUI_LIB;QT_SERIALPORT_LIB;QT_NETWORK_LIB;QT_USB_LIB;QT_CORE_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ResourceCompile>
|
||||
<QtMoc><CompilerFlavor>msvc</CompilerFlavor><Include>./$(Configuration)/moc_predefs.h</Include><ExecutionDescription>Moc'ing %(Identity)...</ExecutionDescription><DynamicSource>output</DynamicSource><QtMocDir>$(Configuration)</QtMocDir><QtMocFileName>moc_%(Filename).cpp</QtMocFileName></QtMoc><QtRcc><Compression>default</Compression><ExecutionDescription>Rcc'ing %(Identity)...</ExecutionDescription><QtRccDir>$(Configuration)</QtRccDir><QtRccFileName>qrc_%(Filename).cpp</QtRccFileName></QtRcc><QtUic><ExecutionDescription>Uic'ing %(Identity)...</ExecutionDescription><QtUicDir>$(ProjectDir)</QtUicDir><QtUicFileName>ui_%(Filename).h</QtUicFileName></QtUic></ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
|
@ -99,7 +99,7 @@
|
|||
<ExceptionHandling>Sync</ExceptionHandling>
|
||||
<ObjectFileName>debug\</ObjectFileName>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>_WINDOWS;UNICODE;_UNICODE;WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;QT_DEPRECATED_WARNINGS;QCUSTOMPLOT_COMPILE_LIBRARY;OUTSIDE_SPEEX;RANDOM_PREFIX=wf;GITSHORT="b5d6063";HOST="wfview.org";UNAME="build";%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>_WINDOWS;UNICODE;_UNICODE;WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;QT_DEPRECATED_WARNINGS;QCUSTOMPLOT_COMPILE_LIBRARY;OUTSIDE_SPEEX;RANDOM_PREFIX=wf;GITSHORT="224c618";HOST="wfview.org";UNAME="build";QT_USB_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessToFile>false</PreprocessToFile>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
|
@ -107,7 +107,7 @@
|
|||
<WarningLevel>Level3</WarningLevel>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation></ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>shell32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>$(QTDIR)\lib\Qt5Usbd.lib;shell32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>C:\opensslx86\lib;C:\Utils\my_sql\mysql-5.7.25-win32\lib;C:\Utils\postgresqlx86\pgsql\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalOptions>"/MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='*' processorArchitecture='*'" %(AdditionalOptions)</AdditionalOptions>
|
||||
<DataExecutionPrevention>true</DataExecutionPrevention>
|
||||
|
@ -124,7 +124,7 @@
|
|||
<WarningLevel>0</WarningLevel>
|
||||
</Midl>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>_WINDOWS;UNICODE;_UNICODE;WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;QT_DEPRECATED_WARNINGS;QCUSTOMPLOT_COMPILE_LIBRARY;OUTSIDE_SPEEX;RANDOM_PREFIX=wf;GITSHORT=\"b5d6063\";HOST=\"wfview.org\";UNAME=\"build\";QT_MULTIMEDIA_LIB;QT_PRINTSUPPORT_LIB;QT_WIDGETS_LIB;QT_GUI_LIB;QT_SERIALPORT_LIB;QT_NETWORK_LIB;QT_CORE_LIB;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>_WINDOWS;UNICODE;_UNICODE;WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;QT_DEPRECATED_WARNINGS;QCUSTOMPLOT_COMPILE_LIBRARY;OUTSIDE_SPEEX;RANDOM_PREFIX=wf;GITSHORT=\"224c618\";HOST=\"wfview.org\";UNAME=\"build\";QT_MULTIMEDIA_LIB;QT_PRINTSUPPORT_LIB;QT_WIDGETS_LIB;QT_GUI_LIB;QT_SERIALPORT_LIB;QT_NETWORK_LIB;QT_USB_LIB;QT_CORE_LIB;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ResourceCompile>
|
||||
<QtMoc><CompilerFlavor>msvc</CompilerFlavor><Include>./$(Configuration)/moc_predefs.h</Include><ExecutionDescription>Moc'ing %(Identity)...</ExecutionDescription><DynamicSource>output</DynamicSource><QtMocDir>$(Configuration)</QtMocDir><QtMocFileName>moc_%(Filename).cpp</QtMocFileName></QtMoc><QtRcc><Compression>default</Compression><ExecutionDescription>Rcc'ing %(Identity)...</ExecutionDescription><QtRccDir>$(Configuration)</QtRccDir><QtRccFileName>qrc_%(Filename).cpp</QtRccFileName></QtRcc><QtUic><ExecutionDescription>Uic'ing %(Identity)...</ExecutionDescription><QtUicDir>$(ProjectDir)</QtUicDir><QtUicFileName>ui_%(Filename).h</QtUicFileName></QtUic></ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
|
@ -144,6 +144,7 @@
|
|||
<ClCompile Include="rigctld.cpp" />
|
||||
<ClCompile Include="rigidentities.cpp" />
|
||||
<ClCompile Include="satellitesetup.cpp" />
|
||||
<ClCompile Include="shuttle.cpp" />
|
||||
<ClCompile Include="udphandler.cpp" />
|
||||
<ClCompile Include="udpserver.cpp" />
|
||||
<ClCompile Include="udpserversetup.cpp" />
|
||||
|
@ -266,6 +267,16 @@
|
|||
|
||||
|
||||
|
||||
</QtMoc>
|
||||
<QtMoc Include="shuttle.h">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</QtMoc>
|
||||
<ClInclude Include="resampler\speex_resampler.h" />
|
||||
<QtMoc Include="udphandler.h">
|
||||
|
@ -362,6 +373,8 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -117,6 +117,9 @@
|
|||
<ClCompile Include="wfmain.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="shuttle.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="resampler\arch.h">
|
||||
|
@ -190,51 +193,12 @@
|
|||
</QtMoc>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<CustomBuild Include="debug\moc_predefs.h.cbt">
|
||||
<Filter>Generated Files</Filter>
|
||||
</CustomBuild>
|
||||
<CustomBuild Include="release\moc_predefs.h.cbt">
|
||||
<Filter>Generated Files</Filter>
|
||||
</CustomBuild>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<QtUic Include="calibrationwindow.ui">
|
||||
|
@ -383,6 +347,7 @@
|
|||
<None Include="resources\wfview.png">
|
||||
<Filter>Resource Files</Filter>
|
||||
</None>
|
||||
<None Include="resources\wfview.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="resources\install.sh">
|
||||
|
@ -396,6 +361,11 @@
|
|||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="C:\Users\Phil\source\repos\wfview\wfview_resource.rc" />
|
||||
<ResourceCompile Include=".\wfview_resource.rc" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<QtMoc Include="shuttle.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</QtMoc>
|
||||
</ItemGroup>
|
||||
</Project>
|
Ładowanie…
Reference in New Issue