summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHarsh Sharma <harsh.sharma@multitech.com>2020-01-09 12:10:01 -0600
committerHarsh Sharma <harsh.sharma@multitech.com>2020-01-09 12:10:01 -0600
commit8c7856e74ba7bc149180aa3ab9f820043260cdc8 (patch)
tree5b8d0f9a6ce3f78fc9caaa5afe107afb4c7d3e81 /src
parentd32e7c87879f19951b707617cb7291339be86309 (diff)
downloadmts-io-sysfs-8c7856e74ba7bc149180aa3ab9f820043260cdc8.tar.gz
mts-io-sysfs-8c7856e74ba7bc149180aa3ab9f820043260cdc8.tar.bz2
mts-io-sysfs-8c7856e74ba7bc149180aa3ab9f820043260cdc8.zip
Added spidev as to accessory card object, moved setting capabilities for lora accessory cards to a common base class function
Diffstat (limited to 'src')
-rw-r--r--src/AccessoryCards/LoraCard.cpp5
-rw-r--r--src/AccessoryCards/LoraCard15.cpp6
-rw-r--r--src/AccessoryCards/LoraCard21.cpp5
-rw-r--r--src/AccessoryCards/LoraCard21Ext.cpp5
-rw-r--r--src/Version.cpp2
5 files changed, 14 insertions, 9 deletions
diff --git a/src/AccessoryCards/LoraCard.cpp b/src/AccessoryCards/LoraCard.cpp
index ba50aa7..66047f3 100644
--- a/src/AccessoryCards/LoraCard.cpp
+++ b/src/AccessoryCards/LoraCard.cpp
@@ -19,5 +19,10 @@
Device::LoraCard::LoraCard(Device& d, const std::string productId, const std::string port) : AccessoryCard(d) {
spiPath = "/dev/spidev0.0";
+}
+
+void Device::LoraCard::setCapabilities() {
device.capabilityList["lora"] = true;
+ device.accessoryCard.AddMember("spiPath", rapidjson::Value().SetString(spiPath.c_str(), device.accessoryCardsAlloc), device.accessoryCardsAlloc);
+ device.accessoryCard.AddMember("fpgaVersion", fpgaVersion, device.accessoryCardsAlloc);
} \ No newline at end of file
diff --git a/src/AccessoryCards/LoraCard15.cpp b/src/AccessoryCards/LoraCard15.cpp
index df5c969..7d2140b 100644
--- a/src/AccessoryCards/LoraCard15.cpp
+++ b/src/AccessoryCards/LoraCard15.cpp
@@ -19,8 +19,8 @@
Device::Lora15Card::Lora15Card(Device& d, const std::string productId, const std::string port) : LoraCard(d, productId, port) {
int ret;
- fpgaVersion = 255;
- if ((productId.find("MTCDT3-") == 0) && (port.back() == '2')) {
+ printf("PORT %s\n", port.c_str());
+ if ((productId.rfind("MTCDT3-", 0) == 0 || productId.rfind("MTLGA-", 0) == 0) && (port.back() == '2')) {
spiPath = "/dev/spidev1.0";
} else if (productId.find("MTAC-LORA-") == 0) {
if (port.back() == '2') {
@@ -42,7 +42,7 @@ Device::Lora15Card::Lora15Card(Device& d, const std::string productId, const std
spiClose();
spi_target_ptr = NULL;
- device.accessoryCard.AddMember("fpgaVersion", fpgaVersion, device.accessoryCardsAlloc);
+ setCapabilities();
}
int Device::Lora15Card::spiOpen(const char *spidev) {
diff --git a/src/AccessoryCards/LoraCard21.cpp b/src/AccessoryCards/LoraCard21.cpp
index 70bec11..99f76d6 100644
--- a/src/AccessoryCards/LoraCard21.cpp
+++ b/src/AccessoryCards/LoraCard21.cpp
@@ -19,6 +19,7 @@
Device::Lora21Card::Lora21Card(Device& d, const std::string productId, const std::string port): LoraCard(d, productId, port) {
spiPath = "/dev/spidev32766.2";
- MTS::System::cmd(LORA_2_1_FPGA_VERSION, fpgaVersion);
- device.accessoryCard.AddMember("fpgaVersion", std::stoi(fpgaVersion), device.accessoryCardsAlloc);
+ MTS::System::cmd(LORA_2_1_FPGA_VERSION, cmdFpgaVersion);
+ fpgaVersion = std::stoi(cmdFpgaVersion);
+ setCapabilities();
} \ No newline at end of file
diff --git a/src/AccessoryCards/LoraCard21Ext.cpp b/src/AccessoryCards/LoraCard21Ext.cpp
index b7531c7..51b43f7 100644
--- a/src/AccessoryCards/LoraCard21Ext.cpp
+++ b/src/AccessoryCards/LoraCard21Ext.cpp
@@ -18,7 +18,6 @@
#include "Device.h"
Device::Lora21ExtCard::Lora21ExtCard(Device& d, const std::string productId, const std::string port): Lora21Card(d, productId, port) {
- MTS::System::cmd(LORA_2_1_EXT_FPGA_VERSION, fpgaVersion2);
- device.accessoryCard.AddMember("fpgaVersion2", std::stoi(fpgaVersion2), device.accessoryCardsAlloc);
-
+ MTS::System::cmd(LORA_2_1_EXT_FPGA_VERSION, cmdFpgaVersion2);
+ device.accessoryCard.AddMember("fpgaVersion2", std::stoi(cmdFpgaVersion2), device.accessoryCardsAlloc);
} \ No newline at end of file
diff --git a/src/Version.cpp b/src/Version.cpp
index 5513345..365abbb 100644
--- a/src/Version.cpp
+++ b/src/Version.cpp
@@ -1,4 +1,4 @@
//Pre-Build Auto-Generated Source
#include "Version.h"
-const std::string Version::version("v1.0.0-6-gc4811dd");
+const std::string Version::version("v1.0.0-8-gd32e7c8");