Add new icons and documentation
This commit is contained in:
parent
4fe0e0ce78
commit
56d6f9a098
@ -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;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
BIN
senic/docs/nuimo-gatt-profile.pdf
Normal file
BIN
senic/docs/nuimo-gatt-profile.pdf
Normal file
Binary file not shown.
BIN
senic/docs/senic-matrix-map.ods
Normal file
BIN
senic/docs/senic-matrix-map.ods
Normal file
Binary file not shown.
169
senic/nuimo.cpp
169
senic/nuimo.cpp
@ -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)
|
||||||
|
|||||||
@ -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;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user