summaryrefslogtreecommitdiff
path: root/src/MtsIoSysfs.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/MtsIoSysfs.cpp')
-rw-r--r--src/MtsIoSysfs.cpp75
1 files changed, 75 insertions, 0 deletions
diff --git a/src/MtsIoSysfs.cpp b/src/MtsIoSysfs.cpp
new file mode 100644
index 0000000..0c9dc2e
--- /dev/null
+++ b/src/MtsIoSysfs.cpp
@@ -0,0 +1,75 @@
+/**********************************************************************
+* COPYRIGHT 2020 MULTI-TECH SYSTEMS, INC.
+*
+* ALL RIGHTS RESERVED BY AND FOR THE EXCLUSIVE BENEFIT OF
+* MULTI-TECH SYSTEMS, INC.
+*
+* MULTI-TECH SYSTEMS, INC. - CONFIDENTIAL AND PROPRIETARY
+* INFORMATION AND/OR TRADE SECRET.
+*
+* NOTICE: ALL CODE, PROGRAM, INFORMATION, SCRIPT, INSTRUCTION,
+* DATA, AND COMMENT HEREIN IS AND SHALL REMAIN THE CONFIDENTIAL
+* INFORMATION AND PROPERTY OF MULTI-TECH SYSTEMS, INC.
+* USE AND DISCLOSURE THEREOF, EXCEPT AS STRICTLY AUTHORIZED IN A
+* WRITTEN AGREEMENT SIGNED BY MULTI-TECH SYSTEMS, INC. IS PROHIBITED.
+*
+***********************************************************************/
+
+#include "Device.h"
+
+int main(int argc, char const* const argv[]) {
+ Device m;
+ if (argc < 2) {
+ m.printUsage(argv[0]);
+ }
+
+ for (int i = 1; i < argc; i++) {
+ if (argv[i][0] == '-') {
+ std::string parameter = &argv[i][1];
+ if (parameter == "-version") {
+ m.printVersion(argv[0]);
+ } else if (parameter == "-help") {
+ m.printUsage(argv[0]);
+ } else if (parameter == "-verbose") {
+ m.Verbose(true);
+ }
+ }
+ }
+ for (int i = 1; i < argc; i++) {
+ std::string parameter = argv[i];
+ if (parameter == "init") {
+ m.init();
+ } else if (parameter == "json") {
+ m.json();
+ } else if (parameter == "show") {
+ if (argv[i + 1] && !argv[i + 2]) {
+ m.show(argv[i + 1]);
+ } else {
+ m.logError("show name");
+ m.exitHandler(99);
+ }
+ } else if (parameter == "show-trigger") {
+ if (argv[i + 1] && !argv[i + 2]) {
+ m.showTrigger(std::string(argv[i + 1]));
+ } else {
+ m.logError("show-trigger name");
+ m.exitHandler(99);
+ }
+ } else if (parameter == "store") {
+ if (argv[i + 1] && argv[i + 2] && !argv[i + 3]) {
+ m.store(std::string(argv[i + 1]), std::string(argv[i + 2]));
+ } else {
+ m.logError("store name value");
+ m.exitHandler(99);
+ }
+ } else if (parameter == "store-trigger") {
+ if (argv[i + 1] && argv[i + 2] && !argv[i + 3]) {
+ m.storeTrigger(std::string(argv[i + 1]), std::string(argv[i + 2]));
+ } else {
+ m.logError("store name value");
+ m.exitHandler(99);
+ }
+ }
+ }
+ m.printUsage(argv[0]);
+}