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
|
/**********************************************************************
* 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::Lora2G4Card::Lora2G4Card(Device &d)
: LoraCard(d, std::regex("(MTAC-LORA-2G4)")) {}
void Device::Lora2G4Card::AddToDeviceInfo(const std::string Port,
const std::string ProductID) {
std::string ttyPath;
if (ProductID.rfind("MTCAP", 0) == 0) {
/*
Set to default value in case it is supported in
the future
*/
ttyPath = "/dev/ttyACM0";
} else {
/*
Set path based on mtcdt rules.
Path is linked to a AP hardware path
so that additional installed usb devices do
not cause any bugs dependant on usb load order
*/
std::string ttyPathBase = "/dev/ttyLora";
std::string ttyPathExtension = Port;
for (auto & c: ttyPathExtension) c = toupper(c);
ttyPath = ttyPathBase + ttyPathExtension;
}
LoraCard::AddToDeviceInfo(Port, ProductID);
device.accessoryCard.AddMember(
"ttyPath",
rapidjson::Value().SetString(ttyPath.c_str(), device.acAlloc),
device.acAlloc);
}
|