From 8cdc5b4770f84a442f5900002580451737cf69c9 Mon Sep 17 00:00:00 2001 From: Michael Zanetti Date: Mon, 26 Feb 2018 00:30:10 +0100 Subject: [PATCH] fix interface based eventdescriptors --- libnymea-core/jsonrpc/jsontypes.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/libnymea-core/jsonrpc/jsontypes.cpp b/libnymea-core/jsonrpc/jsontypes.cpp index d22aafec..25873b33 100644 --- a/libnymea-core/jsonrpc/jsontypes.cpp +++ b/libnymea-core/jsonrpc/jsontypes.cpp @@ -508,8 +508,13 @@ QVariantMap JsonTypes::packEvent(const Event &event) QVariantMap JsonTypes::packEventDescriptor(const EventDescriptor &eventDescriptor) { QVariantMap variant; - variant.insert("eventTypeId", eventDescriptor.eventTypeId()); - variant.insert("deviceId", eventDescriptor.deviceId()); + if (eventDescriptor.type() == EventDescriptor::TypeDevice) { + variant.insert("eventTypeId", eventDescriptor.eventTypeId()); + variant.insert("deviceId", eventDescriptor.deviceId()); + } else { + variant.insert("interface", eventDescriptor.interface()); + variant.insert("interfaceEvent", eventDescriptor.interfaceEvent()); + } QVariantList params; foreach (const ParamDescriptor ¶mDescriptor, eventDescriptor.paramDescriptors()) params.append(packParamDescriptor(paramDescriptor));