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 19:33:47 +0000
commit3dec5b3292428e327678eaaa9ac79666c3a928fd (patch)
tree5deb0ebdff5cb008ef8b5d5f7671aab075888635 /radio/radiomessage.cpp
parente146895c7620f924a5541931e4ebc52206843176 (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> (cherry picked from commit 8053629c99f157e716a4560ef8d1e194d569d960)
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);
+}