Add new icons and documentation
parent
4fe0e0ce78
commit
56d6f9a098
|
|
@ -101,15 +101,39 @@ DeviceManager::DeviceError DevicePluginSenic::executeAction(Device *device, cons
|
|||
if (nuimo.isNull())
|
||||
return DeviceManager::DeviceErrorHardwareFailure;
|
||||
|
||||
if (!nuimo->bluetoothDevice()->connected()) {
|
||||
return DeviceManager::DeviceErrorHardwareNotAvailable;
|
||||
}
|
||||
|
||||
if (action.actionTypeId() == nuimoShowLogoActionTypeId) {
|
||||
if (action.param(nuimoLogoParamTypeId).value().toString() == "Guh")
|
||||
nuimo->showGuhLogo();
|
||||
// "up",
|
||||
// "down",
|
||||
// "left",
|
||||
// "right",
|
||||
// "play",
|
||||
// "pause",
|
||||
// "stop",
|
||||
// "music",
|
||||
// "heart"
|
||||
|
||||
if (action.param(nuimoLogoParamTypeId).value().toString() == "Arrow up")
|
||||
nuimo->showArrowUp();
|
||||
|
||||
if (action.param(nuimoLogoParamTypeId).value().toString() == "Arrow down")
|
||||
nuimo->showArrowDown();
|
||||
if (action.param(nuimoLogoParamTypeId).value().toString() == "Up")
|
||||
nuimo->showImage(Nuimo::MatrixTypeUp);
|
||||
if (action.param(nuimoLogoParamTypeId).value().toString() == "Down")
|
||||
nuimo->showImage(Nuimo::MatrixTypeDown);
|
||||
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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -101,11 +101,17 @@
|
|||
"name": "logo",
|
||||
"displayName": "logo",
|
||||
"type": "QString",
|
||||
"defaultValue": "Guh",
|
||||
"defaultValue": "heart",
|
||||
"allowedValues": [
|
||||
"Guh",
|
||||
"Arrow up",
|
||||
"Arrow down"
|
||||
"Up",
|
||||
"Down",
|
||||
"Left",
|
||||
"Right",
|
||||
"Play",
|
||||
"Pause",
|
||||
"Stop",
|
||||
"Music",
|
||||
"Heart"
|
||||
]
|
||||
}
|
||||
]
|
||||
|
|
|
|||
Binary file not shown.
Binary file not shown.
169
senic/nuimo.cpp
169
senic/nuimo.cpp
|
|
@ -54,52 +54,133 @@ BluetoothLowEnergyDevice *Nuimo::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);
|
||||
}
|
||||
|
||||
void Nuimo::showArrowUp()
|
||||
{
|
||||
QByteArray matrix(
|
||||
" * "
|
||||
" *** "
|
||||
" * * * "
|
||||
" * * * "
|
||||
"* * *"
|
||||
" * "
|
||||
" * "
|
||||
" * "
|
||||
" * ");
|
||||
|
||||
showMatrix(matrix, 3);
|
||||
}
|
||||
|
||||
void Nuimo::showArrowDown()
|
||||
{
|
||||
QByteArray matrix(
|
||||
" * "
|
||||
" * "
|
||||
" * "
|
||||
" * "
|
||||
"* * *"
|
||||
" * * * "
|
||||
" * * * "
|
||||
" *** "
|
||||
" * ");
|
||||
|
||||
showMatrix(matrix, 3);
|
||||
showMatrix(matrix, time);
|
||||
}
|
||||
|
||||
void Nuimo::showMatrix(const QByteArray &matrix, const int &seconds)
|
||||
|
|
|
|||
|
|
@ -41,14 +41,24 @@ public:
|
|||
SwipeDirectionDown
|
||||
};
|
||||
|
||||
enum MatrixType {
|
||||
MatrixTypeUp,
|
||||
MatrixTypeDown,
|
||||
MatrixTypeLeft,
|
||||
MatrixTypeRight,
|
||||
MatrixTypePlay,
|
||||
MatrixTypePause,
|
||||
MatrixTypeStop,
|
||||
MatrixTypeMusic,
|
||||
MatrixTypeHeart
|
||||
};
|
||||
|
||||
explicit Nuimo(Device *device, BluetoothLowEnergyDevice *bluetoothDevice, QObject *parent = nullptr);
|
||||
|
||||
Device *device();
|
||||
BluetoothLowEnergyDevice *bluetoothDevice();
|
||||
|
||||
void showGuhLogo();
|
||||
void showArrowUp();
|
||||
void showArrowDown();
|
||||
void showImage(const MatrixType &matrixType);
|
||||
|
||||
private:
|
||||
Device *m_device = nullptr;
|
||||
|
|
|
|||
Loading…
Reference in New Issue