Add new icons and documentation

This commit is contained in:
Simon Stürz 2018-02-12 12:20:40 +01:00 committed by Michael Zanetti
parent 4fe0e0ce78
commit 56d6f9a098
6 changed files with 179 additions and 58 deletions

View File

@ -101,15 +101,39 @@ DeviceManager::DeviceError DevicePluginSenic::executeAction(Device *device, cons
if (nuimo.isNull()) if (nuimo.isNull())
return DeviceManager::DeviceErrorHardwareFailure; return DeviceManager::DeviceErrorHardwareFailure;
if (!nuimo->bluetoothDevice()->connected()) {
return DeviceManager::DeviceErrorHardwareNotAvailable;
}
if (action.actionTypeId() == nuimoShowLogoActionTypeId) { if (action.actionTypeId() == nuimoShowLogoActionTypeId) {
if (action.param(nuimoLogoParamTypeId).value().toString() == "Guh") // "up",
nuimo->showGuhLogo(); // "down",
// "left",
// "right",
// "play",
// "pause",
// "stop",
// "music",
// "heart"
if (action.param(nuimoLogoParamTypeId).value().toString() == "Arrow up") if (action.param(nuimoLogoParamTypeId).value().toString() == "Up")
nuimo->showArrowUp(); nuimo->showImage(Nuimo::MatrixTypeUp);
if (action.param(nuimoLogoParamTypeId).value().toString() == "Down")
if (action.param(nuimoLogoParamTypeId).value().toString() == "Arrow down") nuimo->showImage(Nuimo::MatrixTypeDown);
nuimo->showArrowDown(); if (action.param(nuimoLogoParamTypeId).value().toString() == "Left")
nuimo->showImage(Nuimo::MatrixTypeLeft);
if (action.param(nuimoLogoParamTypeId).value().toString() == "Right")
nuimo->showImage(Nuimo::MatrixTypeRight);
if (action.param(nuimoLogoParamTypeId).value().toString() == "Play")
nuimo->showImage(Nuimo::MatrixTypePlay);
if (action.param(nuimoLogoParamTypeId).value().toString() == "Pause")
nuimo->showImage(Nuimo::MatrixTypePause);
if (action.param(nuimoLogoParamTypeId).value().toString() == "Stop")
nuimo->showImage(Nuimo::MatrixTypeStop);
if (action.param(nuimoLogoParamTypeId).value().toString() == "Music")
nuimo->showImage(Nuimo::MatrixTypeStop);
if (action.param(nuimoLogoParamTypeId).value().toString() == "Heart")
nuimo->showImage(Nuimo::MatrixTypeHeart);
return DeviceManager::DeviceErrorNoError; return DeviceManager::DeviceErrorNoError;
} }

View File

@ -101,11 +101,17 @@
"name": "logo", "name": "logo",
"displayName": "logo", "displayName": "logo",
"type": "QString", "type": "QString",
"defaultValue": "Guh", "defaultValue": "heart",
"allowedValues": [ "allowedValues": [
"Guh", "Up",
"Arrow up", "Down",
"Arrow down" "Left",
"Right",
"Play",
"Pause",
"Stop",
"Music",
"Heart"
] ]
} }
] ]

Binary file not shown.

Binary file not shown.

View File

@ -54,52 +54,133 @@ BluetoothLowEnergyDevice *Nuimo::bluetoothDevice()
return m_bluetoothDevice; return m_bluetoothDevice;
} }
void Nuimo::showGuhLogo() void Nuimo::showImage(const Nuimo::MatrixType &matrixType)
{ {
QByteArray matrix( QByteArray matrix;
" " int time = 3;
" * " switch (matrixType) {
" ** " case MatrixTypeUp:
" *** ** " matrix = QByteArray(
" ***** " " * "
" ** " " *** "
" ** " " * * * "
" * " " * * * "
" "); "* * *"
" * "
" * "
" * "
" * ");
time = 3;
break;
case MatrixTypeDown:
matrix = QByteArray(
" * "
" * "
" * "
" * "
"* * *"
" * * * "
" * * * "
" *** "
" * ");
time = 3;
break;
case MatrixTypeLeft:
matrix = QByteArray(
" * "
" * "
" * "
" * "
"*********"
" * "
" * "
" * "
" * ");
time = 3;
break;
case MatrixTypeRight:
matrix = QByteArray(
" * "
" * "
" * "
" * "
"*********"
" * "
" * "
" * "
" * ");
time = 3;
break;
case MatrixTypePlay:
matrix = QByteArray(
" "
" * "
" ** "
" *** "
" **** "
" *** "
" ** "
" * "
" ");
time = 3;
break;
case MatrixTypePause:
matrix = QByteArray(
" "
" "
" ** ** "
" ** ** "
" ** ** "
" ** ** "
" ** ** "
" "
" ");
time = 3;
break;
case MatrixTypeStop:
matrix = QByteArray(
" "
" "
" ***** "
" ***** "
" ***** "
" ***** "
" ***** "
" "
" ");
time = 3;
break;
case MatrixTypeMusic:
matrix = QByteArray(
" *******"
" *******"
" * *"
" * *"
" * *"
" * *"
" ** **"
"*** ***"
" * * ");
time = 5;
break;
case MatrixTypeHeart:
matrix = QByteArray(
" "
" ** ** "
" ******* "
"*********"
"*********"
" ******* "
" ***** "
" *** "
" * ");
time = 5;
break;
default:
break;
}
showMatrix(matrix, 10); showMatrix(matrix, time);
}
void Nuimo::showArrowUp()
{
QByteArray matrix(
" * "
" *** "
" * * * "
" * * * "
"* * *"
" * "
" * "
" * "
" * ");
showMatrix(matrix, 3);
}
void Nuimo::showArrowDown()
{
QByteArray matrix(
" * "
" * "
" * "
" * "
"* * *"
" * * * "
" * * * "
" *** "
" * ");
showMatrix(matrix, 3);
} }
void Nuimo::showMatrix(const QByteArray &matrix, const int &seconds) void Nuimo::showMatrix(const QByteArray &matrix, const int &seconds)

View File

@ -41,14 +41,24 @@ public:
SwipeDirectionDown SwipeDirectionDown
}; };
enum MatrixType {
MatrixTypeUp,
MatrixTypeDown,
MatrixTypeLeft,
MatrixTypeRight,
MatrixTypePlay,
MatrixTypePause,
MatrixTypeStop,
MatrixTypeMusic,
MatrixTypeHeart
};
explicit Nuimo(Device *device, BluetoothLowEnergyDevice *bluetoothDevice, QObject *parent = nullptr); explicit Nuimo(Device *device, BluetoothLowEnergyDevice *bluetoothDevice, QObject *parent = nullptr);
Device *device(); Device *device();
BluetoothLowEnergyDevice *bluetoothDevice(); BluetoothLowEnergyDevice *bluetoothDevice();
void showGuhLogo(); void showImage(const MatrixType &matrixType);
void showArrowUp();
void showArrowDown();
private: private:
Device *m_device = nullptr; Device *m_device = nullptr;