1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
/**********************************************************************
* 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"
Device::Lora03Card::Lora03Card(Device &d)
: LoraCard(d, std::regex("(MTAC-003)(.*)|(MTCAP3-003)(.*)")) {}
void Device::Lora03Card::AddToDeviceInfo(const std::string Port,
const std::string ProductID) {
LoraCard::AddToDeviceInfo(Port, ProductID);
/* Map the spi path to the port/hw version */
std::string deviceHwVersion = "";
MTS::System::readFile(HW_VERSION_PATH, deviceHwVersion);
if (deviceHwVersion.find("MTCAP3") != std::string::npos) {
spiPath = "/dev/spidev1.0";
spiPath1261 = "/dev/spidev1.1";
tmp102 = 0x48;
} else if (Port.back() == '2') {
spiPath = "/dev/spidev1.0";
spiPath1261 = "/dev/spidev1.1";
tmp102 = 0x49;
device.capabilityList["loraLbt"] = true;
} else {
spiPath = "/dev/spidev0.0";
spiPath1261 = "/dev/spidev0.1";
tmp102 = 0x48;
device.capabilityList["loraLbt"] = true;
}
device.accessoryCard.AddMember(
"spiPath",
rapidjson::Value().SetString(spiPath.c_str(), device.acAlloc),
device.acAlloc);
device.accessoryCard.AddMember(
"spiPath1261",
rapidjson::Value().SetString(spiPath1261.c_str(), device.acAlloc),
device.acAlloc);
device.accessoryCard.AddMember("tmp102", tmp102, device.acAlloc);
}
|