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