summaryrefslogtreecommitdiffstats
path: root/radio/radiomessage.cpp
diff options
context:
space:
mode:
authorScott Murray <scott.murray@konsulko.com>2019-01-03 01:10:01 -0500
committerScott Murray <scott.murray@konsulko.com>2019-01-03 01:21:10 -0500
commit8053629c99f157e716a4560ef8d1e194d569d960 (patch)
tree507ac4a57b8311325f2ce4898791f220059bc1ba /radio/radiomessage.cpp
parentf2835952c4c1a47f8c8bc8dbb343d7980f49ef8f (diff)
libqtappfw: Add radio binding support
Add initial support for the radio binding. At the moment, everything required for the current demo radio application is in place. Further development will be required to fill in support for changing bands and the stereo mode. Change-Id: I1b1866856ce8388b34624c14c692102c344a7a62 Signed-off-by: Scott Murray <scott.murray@konsulko.com>
Diffstat (limited to 'radio/radiomessage.cpp')
-rw-r--r--radio/radiomessage.cpp42
1 files changed, 42 insertions, 0 deletions
diff --git a/radio/radiomessage.cpp b/radio/radiomessage.cpp
new file mode 100644
index 0000000..2a96a80
--- /dev/null
+++ b/radio/radiomessage.cpp
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2018 Konsulko Group
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <QDebug>
+#include <QJsonArray>
+#include <QJsonDocument>
+#include <QJsonObject>
+
+#include "radiomessage.h"
+
+bool RadioMessage::createRequest(QString verb, QJsonObject parameter)
+{
+ QStringList verbs {"frequency",
+ "band",
+ "band_supported",
+ "frequency_range",
+ "frequency_step",
+ "start",
+ "stop",
+ "scan_start",
+ "scan_stop",
+ "stereo_mode",
+ "subscribe",
+ "unsubscribe" };
+ if (!verbs.contains(verb))
+ return false;
+
+ return Message::createRequest("radio", verb, parameter);
+}