Add sensor driver structure
This commit is contained in:
parent
17192e104d
commit
c9917a055c
@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
#include "AdaptiveBrightness.hpp"
|
#include "AdaptiveBrightness.hpp"
|
||||||
#include "log_to_file.hpp"
|
#include "log_to_file.hpp"
|
||||||
|
#include "sensor_driver.hpp"
|
||||||
|
|
||||||
int main(int argc, char* argv[])
|
int main(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
@ -12,6 +13,8 @@ int main(int argc, char* argv[])
|
|||||||
|
|
||||||
qDebug("Starting application");
|
qDebug("Starting application");
|
||||||
|
|
||||||
|
SensorDriver sensorDriver;
|
||||||
|
|
||||||
QApplication application(argc, argv);
|
QApplication application(argc, argv);
|
||||||
AdaptiveBrightness mainWindow;
|
AdaptiveBrightness mainWindow;
|
||||||
mainWindow.show();
|
mainWindow.show();
|
||||||
|
38
AdaptiveBrightness/sensor_driver.cpp
Normal file
38
AdaptiveBrightness/sensor_driver.cpp
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
#include "sensor_driver.hpp"
|
||||||
|
|
||||||
|
#include <QSerialPortInfo>
|
||||||
|
#include <QtDebug>
|
||||||
|
#include <QtGlobal>
|
||||||
|
|
||||||
|
SensorDriver::SensorDriver()
|
||||||
|
{
|
||||||
|
qDebug("Initializing sensor driver");
|
||||||
|
|
||||||
|
const auto serialPortInfos = QSerialPortInfo::availablePorts();
|
||||||
|
|
||||||
|
qDebug() << "Total number of ports available: " << serialPortInfos.count();
|
||||||
|
|
||||||
|
const QString blankString = "N/A";
|
||||||
|
QString description;
|
||||||
|
QString manufacturer;
|
||||||
|
QString serialNumber;
|
||||||
|
|
||||||
|
for(const QSerialPortInfo& serialPortInfo: serialPortInfos) {
|
||||||
|
description = serialPortInfo.description();
|
||||||
|
manufacturer = serialPortInfo.manufacturer();
|
||||||
|
serialNumber = serialPortInfo.serialNumber();
|
||||||
|
qInfo() << "Port: " << serialPortInfo.portName();
|
||||||
|
qInfo() << "Location: " << serialPortInfo.systemLocation();
|
||||||
|
qInfo() << "Description: " << (!description.isEmpty() ? description : blankString);
|
||||||
|
qInfo() << "Manufacturer: " << (!manufacturer.isEmpty() ? manufacturer : blankString);
|
||||||
|
qInfo() << "Serial number: " << (!serialNumber.isEmpty() ? serialNumber : blankString);
|
||||||
|
qInfo() << "Vendor Identifier: " << (serialPortInfo.hasVendorIdentifier() ? QByteArray::number(serialPortInfo.vendorIdentifier(), 16) : blankString);
|
||||||
|
qInfo() << "Product Identifier: ";
|
||||||
|
qInfo() << (serialPortInfo.hasProductIdentifier() ? QByteArray::number(serialPortInfo.productIdentifier(), 16) : blankString);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SensorDriver::~SensorDriver()
|
||||||
|
{
|
||||||
|
qDebug("Destroying sensor driver");
|
||||||
|
}
|
9
AdaptiveBrightness/sensor_driver.hpp
Normal file
9
AdaptiveBrightness/sensor_driver.hpp
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
class SensorDriver {
|
||||||
|
public:
|
||||||
|
SensorDriver();
|
||||||
|
~SensorDriver();
|
||||||
|
|
||||||
|
private:
|
||||||
|
};
|
Loading…
Reference in New Issue
Block a user