implement trigger interfaces

This commit is contained in:
Michael Zanetti 2018-04-11 23:25:02 +02:00
parent 8cb6e72701
commit 34c00d69de
2 changed files with 6 additions and 4 deletions

View File

@ -99,7 +99,7 @@ DeviceManager::DeviceSetupStatus DevicePluginUdpCommander::setupDevice(Device *d
DeviceManager::DeviceError DevicePluginUdpCommander::executeAction(Device *device, const Action &action) { DeviceManager::DeviceError DevicePluginUdpCommander::executeAction(Device *device, const Action &action) {
if (device->deviceClassId() == udpCommanderDeviceClassId) { if (device->deviceClassId() == udpCommanderDeviceClassId) {
if (action.actionTypeId() == udpCommanderOutputDataActionTypeId) { if (action.actionTypeId() == udpCommanderTriggerActionTypeId) {
QUdpSocket *udpSocket = m_commanderList.key(device); QUdpSocket *udpSocket = m_commanderList.key(device);
int port = device->paramValue(udpCommanderPortParamTypeId).toInt(); int port = device->paramValue(udpCommanderPortParamTypeId).toInt();
QHostAddress address = QHostAddress(device->paramValue(udpCommanderAddressParamTypeId).toString()); QHostAddress address = QHostAddress(device->paramValue(udpCommanderAddressParamTypeId).toString());
@ -151,7 +151,7 @@ void DevicePluginUdpCommander::readPendingDatagrams()
} }
qCDebug(dcUdpCommander()) << device->name() << "got command from" << sender.toString() << senderPort; qCDebug(dcUdpCommander()) << device->name() << "got command from" << sender.toString() << senderPort;
Event ev = Event(udpReceiverDataReceivedEventTypeId, device->id()); Event ev = Event(udpReceiverTriggeredEventTypeId, device->id());
ParamList params; ParamList params;
params.append(Param(udpReceiverDataParamTypeId, datagram)); params.append(Param(udpReceiverDataParamTypeId, datagram));
ev.setParams(params); ev.setParams(params);

View File

@ -13,6 +13,7 @@
"displayName": "UDP Receiver", "displayName": "UDP Receiver",
"name": "udpReceiver", "name": "udpReceiver",
"deviceIcon": "Network", "deviceIcon": "Network",
"interfaces": ["inputtrigger"],
"basicTags": ["Service", "Sensor"], "basicTags": ["Service", "Sensor"],
"createMethods": ["user"], "createMethods": ["user"],
"paramTypes": [ "paramTypes": [
@ -29,7 +30,7 @@
"eventTypes": [ "eventTypes": [
{ {
"id": "5fecbba3-ffbb-456b-872c-a2f571c681cb", "id": "5fecbba3-ffbb-456b-872c-a2f571c681cb",
"name": "dataReceived", "name": "triggered",
"displayName": "Data received", "displayName": "Data received",
"paramTypes": [ "paramTypes": [
{ {
@ -48,6 +49,7 @@
"displayName": "UDP Commander", "displayName": "UDP Commander",
"deviceIcon": "Network", "deviceIcon": "Network",
"basicTags": ["Service", "Sensor"], "basicTags": ["Service", "Sensor"],
"interfaces": ["outputtrigger"],
"createMethods": ["user"], "createMethods": ["user"],
"paramTypes": [ "paramTypes": [
{ {
@ -71,7 +73,7 @@
"actionTypes": [ "actionTypes": [
{ {
"id": "6bc52462-b192-46a4-a6df-92cc5a479c89", "id": "6bc52462-b192-46a4-a6df-92cc5a479c89",
"name": "outputData", "name": "trigger",
"displayName": "Send data", "displayName": "Send data",
"paramTypes": [ "paramTypes": [
{ {