added auto symbol mode
parent
dc8ad5c03a
commit
a20c43c0e5
|
|
@ -110,6 +110,14 @@ Device::DeviceError DevicePluginSenic::executeAction(Device *device, const Actio
|
|||
nuimo->showImage(Nuimo::MatrixTypeMusic);
|
||||
if (action.param(nuimoShowLogoActionLogoParamTypeId).value().toString() == "Heart")
|
||||
nuimo->showImage(Nuimo::MatrixTypeHeart);
|
||||
if (action.param(nuimoShowLogoActionLogoParamTypeId).value().toString() == "Next")
|
||||
nuimo->showImage(Nuimo::MatrixTypeNext);
|
||||
if (action.param(nuimoShowLogoActionLogoParamTypeId).value().toString() == "Previous")
|
||||
nuimo->showImage(Nuimo::MatrixTypePrevious);
|
||||
if (action.param(nuimoShowLogoActionLogoParamTypeId).value().toString() == "Circle")
|
||||
nuimo->showImage(Nuimo::MatrixTypeCircle);
|
||||
if (action.param(nuimoShowLogoActionLogoParamTypeId).value().toString() == "Light")
|
||||
nuimo->showImage(Nuimo::MatrixTypeLight);
|
||||
|
||||
return Device::DeviceErrorNoError;
|
||||
}
|
||||
|
|
@ -185,8 +193,13 @@ void DevicePluginSenic::onButtonPressed()
|
|||
Nuimo *nuimo = static_cast<Nuimo *>(sender());
|
||||
Device *device = m_nuimos.value(nuimo);
|
||||
emitEvent(Event(nuimoPressedEventTypeId, device->id(), ParamList() << Param(nuimoPressedEventButtonNameParamTypeId, "•")));
|
||||
|
||||
if(m_autoSymbolMode) {
|
||||
nuimo->showImage(Nuimo::MatrixType::MatrixTypeCircle);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void DevicePluginSenic::onButtonReleased()
|
||||
{
|
||||
// TODO: user timer for detekt long pressed (if needed)
|
||||
|
|
@ -197,6 +210,7 @@ void DevicePluginSenic::onSwipeDetected(const Nuimo::SwipeDirection &direction)
|
|||
Nuimo *nuimo = static_cast<Nuimo *>(sender());
|
||||
Device *device = m_nuimos.value(nuimo);
|
||||
|
||||
|
||||
switch (direction) {
|
||||
case Nuimo::SwipeDirectionLeft:
|
||||
emitEvent(Event(nuimoPressedEventTypeId, device->id(), ParamList() << Param(nuimoPressedEventButtonNameParamTypeId, "←")));
|
||||
|
|
@ -211,6 +225,23 @@ void DevicePluginSenic::onSwipeDetected(const Nuimo::SwipeDirection &direction)
|
|||
emitEvent(Event(nuimoPressedEventTypeId, device->id(), ParamList() << Param(nuimoPressedEventButtonNameParamTypeId, "↓")));
|
||||
break;
|
||||
}
|
||||
|
||||
if (m_autoSymbolMode) {
|
||||
switch (direction) {
|
||||
case Nuimo::SwipeDirectionLeft:
|
||||
nuimo->showImage(Nuimo::MatrixType::MatrixTypeLeft);
|
||||
break;
|
||||
case Nuimo::SwipeDirectionRight:
|
||||
nuimo->showImage(Nuimo::MatrixType::MatrixTypeRight);
|
||||
break;
|
||||
case Nuimo::SwipeDirectionUp:
|
||||
nuimo->showImage(Nuimo::MatrixType::MatrixTypeUp);
|
||||
break;
|
||||
case Nuimo::SwipeDirectionDown:
|
||||
nuimo->showImage(Nuimo::MatrixType::MatrixTypeDown);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DevicePluginSenic::onRotationValueChanged(const uint &value)
|
||||
|
|
@ -219,3 +250,15 @@ void DevicePluginSenic::onRotationValueChanged(const uint &value)
|
|||
Device *device = m_nuimos.value(nuimo);
|
||||
device->setStateValue(nuimoRotationStateTypeId, value);
|
||||
}
|
||||
|
||||
void DevicePluginSenic::onPluginConfigurationChanged(const ParamTypeId ¶mTypeId, const QVariant &value)
|
||||
{
|
||||
qCDebug(dcSenic()) << "Plugin configuration changed";
|
||||
|
||||
// Check auto symbol mode
|
||||
if (paramTypeId == senicPluginAutoSymbolsParamTypeId) {
|
||||
qCDebug(dcSenic()) << "Auto symbol mode" << (value.toBool() ? "enabled." : "disabled.");
|
||||
m_autoSymbolMode = value.toBool();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,10 +49,12 @@ public:
|
|||
private:
|
||||
QHash<Nuimo *, Device *> m_nuimos;
|
||||
PluginTimer *m_reconnectTimer = nullptr;
|
||||
bool m_autoSymbolMode = true;
|
||||
|
||||
bool verifyExistingDevices(const QBluetoothDeviceInfo &deviceInfo);
|
||||
|
||||
private slots:
|
||||
void onPluginConfigurationChanged(const ParamTypeId ¶mTypeId, const QVariant &value);
|
||||
void onReconnectTimeout();
|
||||
void onBluetoothDiscoveryFinished();
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,15 @@
|
|||
"displayName": "Senic",
|
||||
"id": "413e9d77-335f-4ecf-abbc-8f2a8a399c39",
|
||||
"name": "Senic",
|
||||
"paramTypes": [
|
||||
{
|
||||
"id": "ba3d4269-940b-42ee-8c73-1e1bdea329c2",
|
||||
"name": "autoSymbols",
|
||||
"displayName": "Automatically display symbols",
|
||||
"type": "bool",
|
||||
"defaultValue": true
|
||||
}
|
||||
],
|
||||
"vendors": [
|
||||
{
|
||||
"displayName": "Senic",
|
||||
|
|
@ -108,7 +117,11 @@
|
|||
"Pause",
|
||||
"Stop",
|
||||
"Music",
|
||||
"Heart"
|
||||
"Heart",
|
||||
"Next",
|
||||
"Previous",
|
||||
"Circle",
|
||||
"Light"
|
||||
]
|
||||
}
|
||||
]
|
||||
|
|
|
|||
|
|
@ -176,7 +176,57 @@ void Nuimo::showImage(const Nuimo::MatrixType &matrixType)
|
|||
" * ");
|
||||
time = 5;
|
||||
break;
|
||||
default:
|
||||
case MatrixTypeNext:
|
||||
matrix = QByteArray(
|
||||
" "
|
||||
" * ** "
|
||||
" ** ** "
|
||||
" *** ** "
|
||||
" ****** "
|
||||
" *** ** "
|
||||
" ** ** "
|
||||
" * ** "
|
||||
" ");
|
||||
time = 5;
|
||||
break;
|
||||
case MatrixTypePrevious:
|
||||
matrix = QByteArray(
|
||||
" "
|
||||
" ** * "
|
||||
" ** ** "
|
||||
" ** *** "
|
||||
" ****** "
|
||||
" ** *** "
|
||||
" ** ** "
|
||||
" ** * "
|
||||
" ");
|
||||
time = 5;
|
||||
break;
|
||||
case MatrixTypeCircle:
|
||||
matrix = QByteArray(
|
||||
" "
|
||||
" "
|
||||
" *** "
|
||||
" * * "
|
||||
" * * "
|
||||
" * * "
|
||||
" *** "
|
||||
" "
|
||||
" ");
|
||||
time = 5;
|
||||
break;
|
||||
case MatrixTypeLight:
|
||||
matrix = QByteArray(
|
||||
" "
|
||||
" *** "
|
||||
" * * "
|
||||
" * * "
|
||||
" * * "
|
||||
" *** "
|
||||
" *** "
|
||||
" *** "
|
||||
" * ");
|
||||
time = 5;
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -50,7 +50,11 @@ public:
|
|||
MatrixTypePause,
|
||||
MatrixTypeStop,
|
||||
MatrixTypeMusic,
|
||||
MatrixTypeHeart
|
||||
MatrixTypeHeart,
|
||||
MatrixTypeNext,
|
||||
MatrixTypePrevious,
|
||||
MatrixTypeCircle,
|
||||
MatrixTypeLight
|
||||
};
|
||||
|
||||
explicit Nuimo(Device *device, BluetoothLowEnergyDevice *bluetoothDevice, QObject *parent = nullptr);
|
||||
|
|
|
|||
Loading…
Reference in New Issue