mirror of
https://github.com/meshtastic/Meshtastic-Apple.git
synced 2026-04-20 22:13:56 +00:00
Pull device hardware from a local json file
This commit is contained in:
parent
3798cd43be
commit
c61d39a7e1
6 changed files with 294 additions and 3 deletions
|
|
@ -31,6 +31,7 @@
|
|||
DD0E20FC2B87090400F2D100 /* atak.pb.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD0E20F92B87090400F2D100 /* atak.pb.swift */; };
|
||||
DD0E20FD2B87090400F2D100 /* clientonly.pb.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD0E20FA2B87090400F2D100 /* clientonly.pb.swift */; };
|
||||
DD0E20FE2B87090400F2D100 /* paxcount.pb.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD0E20FB2B87090400F2D100 /* paxcount.pb.swift */; };
|
||||
DD0E21012B8A6F1300F2D100 /* DeviceHardware.json in Resources */ = {isa = PBXBuildFile; fileRef = DD0E21002B8A6BC500F2D100 /* DeviceHardware.json */; };
|
||||
DD0F791B28713C8A00A6FDAD /* AdminMessageList.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD0F791A28713C8A00A6FDAD /* AdminMessageList.swift */; };
|
||||
DD13AA492AB73BF400BA0C98 /* PositionPopover.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD13AA482AB73BF400BA0C98 /* PositionPopover.swift */; };
|
||||
DD1925B728CDA5A400720036 /* CannedMessagesConfigEnums.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD1925B628CDA5A400720036 /* CannedMessagesConfigEnums.swift */; };
|
||||
|
|
@ -264,6 +265,7 @@
|
|||
DD0E20FA2B87090400F2D100 /* clientonly.pb.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = clientonly.pb.swift; sourceTree = "<group>"; };
|
||||
DD0E20FB2B87090400F2D100 /* paxcount.pb.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = paxcount.pb.swift; sourceTree = "<group>"; };
|
||||
DD0E20FF2B892E1300F2D100 /* MeshtasticDataModelV 28.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = "MeshtasticDataModelV 28.xcdatamodel"; sourceTree = "<group>"; };
|
||||
DD0E21002B8A6BC500F2D100 /* DeviceHardware.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = DeviceHardware.json; sourceTree = "<group>"; };
|
||||
DD0E9C222A30CE3A00580CBB /* MeshtasticDataModelV14.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = MeshtasticDataModelV14.xcdatamodel; sourceTree = "<group>"; };
|
||||
DD0F791A28713C8A00A6FDAD /* AdminMessageList.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AdminMessageList.swift; sourceTree = "<group>"; };
|
||||
DD13AA482AB73BF400BA0C98 /* PositionPopover.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PositionPopover.swift; sourceTree = "<group>"; };
|
||||
|
|
@ -865,6 +867,7 @@
|
|||
children = (
|
||||
DDB75A192A05EB67006ED576 /* alpha.png */,
|
||||
DDC2E15B26CE248F0042C5E4 /* Assets.xcassets */,
|
||||
DD0E21002B8A6BC500F2D100 /* DeviceHardware.json */,
|
||||
);
|
||||
path = Resources;
|
||||
sourceTree = "<group>";
|
||||
|
|
@ -1137,6 +1140,7 @@
|
|||
DDDE5A1329AFEAB900490C6C /* Assets.xcassets in Resources */,
|
||||
DDB75A1A2A05EB67006ED576 /* alpha.png in Resources */,
|
||||
DDC2E15C26CE248F0042C5E4 /* Assets.xcassets in Resources */,
|
||||
DD0E21012B8A6F1300F2D100 /* DeviceHardware.json in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -72,6 +72,14 @@
|
|||
<attribute name="serialEnabled" optional="YES" attributeType="Boolean" defaultValueString="0" usesScalarValueType="YES"/>
|
||||
<relationship name="deviceConfigNode" optional="YES" maxCount="1" deletionRule="Nullify" destinationEntity="NodeInfoEntity" inverseName="deviceConfig" inverseEntity="NodeInfoEntity"/>
|
||||
</entity>
|
||||
<entity name="DeviceHardwareEntity" representedClassName="DeviceHardwareEntity" syncable="YES" codeGenerationType="class">
|
||||
<attribute name="activelySupported" optional="YES" attributeType="Boolean" defaultValueString="NO" usesScalarValueType="YES"/>
|
||||
<attribute name="architecture" optional="YES" attributeType="Integer 32" defaultValueString="0" usesScalarValueType="YES"/>
|
||||
<attribute name="displayName" optional="YES" attributeType="String"/>
|
||||
<attribute name="hwModel" attributeType="Integer 32" defaultValueString="0" usesScalarValueType="YES"/>
|
||||
<attribute name="hwModelSlug" optional="YES" attributeType="String"/>
|
||||
<attribute name="platformioTarget" optional="YES" attributeType="String"/>
|
||||
</entity>
|
||||
<entity name="DeviceMetadataEntity" representedClassName="DeviceMetadataEntity" syncable="YES" codeGenerationType="class">
|
||||
<attribute name="canShutdown" optional="YES" attributeType="Boolean" usesScalarValueType="YES"/>
|
||||
<attribute name="deviceStateVersion" optional="YES" attributeType="Integer 32" defaultValueString="0" usesScalarValueType="YES"/>
|
||||
|
|
|
|||
274
Meshtastic/Resources/DeviceHardware.json
Normal file
274
Meshtastic/Resources/DeviceHardware.json
Normal file
|
|
@ -0,0 +1,274 @@
|
|||
[
|
||||
{
|
||||
"hwModel": 1,
|
||||
"hwModelSlug": "TLORA_V2",
|
||||
"platformioTarget": "tlora-v2",
|
||||
"architecture": "esp32",
|
||||
"activelySupported": false,
|
||||
"displayName": "T-LoRa V2"
|
||||
},
|
||||
{
|
||||
"hwModel": 2,
|
||||
"hwModelSlug": "TLORA_V1",
|
||||
"platformioTarget": "tlora-v1",
|
||||
"architecture": "esp32",
|
||||
"activelySupported": false,
|
||||
"displayName": "T-LoRa V1"
|
||||
},
|
||||
{
|
||||
"hwModel": 3,
|
||||
"hwModelSlug": "TLORA_V2_1_1P6",
|
||||
"platformioTarget": "tlora-v2-1-1_6",
|
||||
"architecture": "esp32",
|
||||
"activelySupported": true,
|
||||
"displayName": "T-LoRa V2.1-1.6"
|
||||
},
|
||||
{
|
||||
"hwModel": 4,
|
||||
"hwModelSlug": "TBEAM",
|
||||
"platformioTarget": "tbeam",
|
||||
"architecture": "esp32",
|
||||
"activelySupported": true,
|
||||
"displayName": "T-Beam"
|
||||
},
|
||||
{
|
||||
"hwModel": 5,
|
||||
"hwModelSlug": "HELTEC_V2_0",
|
||||
"platformioTarget": "heltec-v2_0",
|
||||
"architecture": "esp32",
|
||||
"activelySupported": false,
|
||||
"displayName": "Heltec V2.0"
|
||||
},
|
||||
{
|
||||
"hwModel": 6,
|
||||
"hwModelSlug": "TBEAM_V0P7",
|
||||
"platformioTarget": "tbeam0_7",
|
||||
"architecture": "esp32",
|
||||
"activelySupported": false,
|
||||
"displayName": "T-Beam V0.7"
|
||||
},
|
||||
{
|
||||
"hwModel": 7,
|
||||
"hwModelSlug": "T_ECHO",
|
||||
"platformioTarget": "t-echo",
|
||||
"architecture": "nrf52840",
|
||||
"activelySupported": true,
|
||||
"displayName": "T-Echo"
|
||||
},
|
||||
{
|
||||
"hwModel": 8,
|
||||
"hwModelSlug": "TLORA_V1_1P3",
|
||||
"platformioTarget": "tlora-v1_3",
|
||||
"architecture": "esp32",
|
||||
"activelySupported": false,
|
||||
"displayName": "T-LoRa V1.1-1.3"
|
||||
},
|
||||
{
|
||||
"hwModel": 9,
|
||||
"hwModelSlug": "RAK4631",
|
||||
"platformioTarget": "rak4631",
|
||||
"architecture": "nrf52840",
|
||||
"activelySupported": true,
|
||||
"displayName": "RAK4631"
|
||||
},
|
||||
{
|
||||
"hwModel": 10,
|
||||
"hwModelSlug": "HELTEC_V2_1",
|
||||
"platformioTarget": "heltec-v2_1",
|
||||
"architecture": "esp32",
|
||||
"activelySupported": false,
|
||||
"displayName": "Heltec V2.1"
|
||||
},
|
||||
{
|
||||
"hwModel": 11,
|
||||
"hwModelSlug": "HELTEC_V1",
|
||||
"platformioTarget": "heltec-v1",
|
||||
"architecture": "esp32",
|
||||
"activelySupported": false,
|
||||
"displayName": "Heltec V1"
|
||||
},
|
||||
{
|
||||
"hwModel": 12,
|
||||
"hwModelSlug": "TBEAM_S3_CORE",
|
||||
"platformioTarget": "tbeam-s3-core",
|
||||
"architecture": "esp32-s3",
|
||||
"activelySupported": true,
|
||||
"displayName": "T-Beam S3 Core"
|
||||
},
|
||||
{
|
||||
"hwModel": 13,
|
||||
"hwModelSlug": "RAK11200",
|
||||
"platformioTarget": "rak11200",
|
||||
"architecture": "esp32",
|
||||
"activelySupported": false,
|
||||
"displayName": "RAK11200"
|
||||
},
|
||||
{
|
||||
"hwModel": 14,
|
||||
"hwModelSlug": "NANO_G1",
|
||||
"platformioTarget": "nano-g1",
|
||||
"architecture": "esp32",
|
||||
"activelySupported": true,
|
||||
"displayName": "Nano G1"
|
||||
},
|
||||
{
|
||||
"hwModel": 15,
|
||||
"hwModelSlug": "TLORA_V2_1_1P8",
|
||||
"platformioTarget": "tlora-v2-1-1_8",
|
||||
"architecture": "esp32",
|
||||
"activelySupported": true,
|
||||
"displayName": "T-LoRa V2.1-1.8"
|
||||
},
|
||||
{
|
||||
"hwModel": 16,
|
||||
"hwModelSlug": "TLORA_T3_S3",
|
||||
"platformioTarget": "tlora-t3s3-v1",
|
||||
"architecture": "esp32-s3",
|
||||
"activelySupported": true,
|
||||
"displayName": "T-LoRa T3-S3"
|
||||
},
|
||||
{
|
||||
"hwModel": 17,
|
||||
"hwModelSlug": "NANO_G1_EXPLORER",
|
||||
"platformioTarget": "nano-g1-explorer",
|
||||
"architecture": "esp32",
|
||||
"activelySupported": true,
|
||||
"displayName": "Nano G1 Explorer"
|
||||
},
|
||||
{
|
||||
"hwModel": 18,
|
||||
"hwModelSlug": "NANO_G2_ULTRA",
|
||||
"platformioTarget": "nano-g2-ultra",
|
||||
"architecture": "nrf52840",
|
||||
"activelySupported": true,
|
||||
"displayName": "Nano G2 Ultra"
|
||||
},
|
||||
{
|
||||
"hwModel": 25,
|
||||
"hwModelSlug": "STATION_G1",
|
||||
"platformioTarget": "station-g1",
|
||||
"architecture": "esp32",
|
||||
"activelySupported": true,
|
||||
"displayName": "Station G1"
|
||||
},
|
||||
{
|
||||
"hwModel": 26,
|
||||
"hwModelSlug": "RAK11310",
|
||||
"platformioTarget": "rak11310",
|
||||
"architecture": "rp2040",
|
||||
"activelySupported": true,
|
||||
"displayName": "RAK11310"
|
||||
},
|
||||
{
|
||||
"hwModel": 39,
|
||||
"hwModelSlug": "DIY_V1",
|
||||
"platformioTarget": "meshtastic-diy-v1",
|
||||
"architecture": "esp32",
|
||||
"activelySupported": true,
|
||||
"displayName": "DIY V1"
|
||||
},
|
||||
{
|
||||
"hwModel": 39,
|
||||
"hwModelSlug": "HYDRA",
|
||||
"platformioTarget": "hydra",
|
||||
"architecture": "esp32",
|
||||
"activelySupported": true,
|
||||
"displayName": "Hydra"
|
||||
},
|
||||
{
|
||||
"hwModel": 41,
|
||||
"hwModelSlug": "DR_DEV",
|
||||
"platformioTarget": "meshtastic-dr-dev",
|
||||
"architecture": "esp32",
|
||||
"activelySupported": true,
|
||||
"displayName": "DR-DEV"
|
||||
},
|
||||
{
|
||||
"hwModel": 42,
|
||||
"hwModelSlug": "M5STACK",
|
||||
"platformioTarget": "m5stack-core",
|
||||
"architecture": "esp32",
|
||||
"activelySupported": true,
|
||||
"displayName": "M5 Stack"
|
||||
},
|
||||
{
|
||||
"hwModel": 43,
|
||||
"hwModelSlug": "HELTEC_V3",
|
||||
"platformioTarget": "heltec-v3",
|
||||
"architecture": "esp32-s3",
|
||||
"activelySupported": true,
|
||||
"displayName": "Heltec V3"
|
||||
},
|
||||
{
|
||||
"hwModel": 44,
|
||||
"hwModelSlug": "HELTEC_WSL_V3",
|
||||
"platformioTarget": "heltec-wsl-v3",
|
||||
"architecture": "esp32-s3",
|
||||
"activelySupported": true,
|
||||
"displayName": "Heltec Wireless Stick Lite V3"
|
||||
},
|
||||
{
|
||||
"hwModel": 47,
|
||||
"hwModelSlug": "RPI_PICO",
|
||||
"platformioTarget": "pico",
|
||||
"architecture": "rp2040",
|
||||
"activelySupported": true,
|
||||
"displayName": "Raspberry Pi Pico"
|
||||
},
|
||||
{
|
||||
"hwModel": 47,
|
||||
"hwModelSlug": "RPI_PICO",
|
||||
"platformioTarget": "picow",
|
||||
"architecture": "rp2040",
|
||||
"activelySupported": true,
|
||||
"displayName": "Raspberry Pi Pico W"
|
||||
},
|
||||
{
|
||||
"hwModel": 48,
|
||||
"hwModelSlug": "HELTEC_WIRELESS_TRACKER",
|
||||
"platformioTarget": "heltec-wireless-tracker",
|
||||
"architecture": "esp32-s3",
|
||||
"activelySupported": true,
|
||||
"displayName": "Heltec Wireless Tracker"
|
||||
},
|
||||
{
|
||||
"hwModel": 49,
|
||||
"hwModelSlug": "HELTEC_WIRELESS_PAPER",
|
||||
"platformioTarget": "heltec-wireless-paper",
|
||||
"architecture": "esp32-s3",
|
||||
"activelySupported": true,
|
||||
"displayName": "Heltec Wireless Paper"
|
||||
},
|
||||
{
|
||||
"hwModel": 50,
|
||||
"hwModelSlug": "T_DECK",
|
||||
"platformioTarget": "t-deck",
|
||||
"architecture": "esp32-s3",
|
||||
"activelySupported": true,
|
||||
"displayName": "T-Deck"
|
||||
},
|
||||
{
|
||||
"hwModel": 51,
|
||||
"hwModelSlug": "T_WATCH_S3",
|
||||
"platformioTarget": "t-watch-s3",
|
||||
"architecture": "esp32-s3",
|
||||
"activelySupported": true,
|
||||
"displayName": "T-Watch S3"
|
||||
},
|
||||
{
|
||||
"hwModel": 52,
|
||||
"hwModelSlug": "PICOMPUTER_S3",
|
||||
"platformioTarget": "picomputer-s3",
|
||||
"architecture": "esp32-s3",
|
||||
"activelySupported": true,
|
||||
"displayName": "Pi Computer S3"
|
||||
},
|
||||
{
|
||||
"hwModel": 53,
|
||||
"hwModelSlug": "HELTEC_HT62",
|
||||
"platformioTarget": "heltec-ht62-esp32c3-sx1262",
|
||||
"architecture": "esp32-c3",
|
||||
"activelySupported": true,
|
||||
"displayName": "Heltec HT62"
|
||||
}
|
||||
]
|
||||
|
|
@ -228,9 +228,10 @@ struct Channels: View {
|
|||
}
|
||||
|
||||
Section(header: Text("position")) {
|
||||
|
||||
VStack(alignment: .leading) {
|
||||
Toggle(isOn: $positionsEnabled) {
|
||||
Label("Positions Enabled", systemImage: positionsEnabled ? "mappin" : "mappin.slash")
|
||||
Label(channelRole == 1 ? "Positions Enabled" : "Allow Position Requests", systemImage: positionsEnabled ? "mappin" : "mappin.slash")
|
||||
}
|
||||
.toggleStyle(SwitchToggleStyle(tint: .accentColor))
|
||||
.disabled(!supportedVersion)
|
||||
|
|
|
|||
|
|
@ -122,6 +122,7 @@ struct PowerConfig: View {
|
|||
}
|
||||
|
||||
Api().loadDeviceHardwareData { (hw) in
|
||||
|
||||
for device in hw {
|
||||
let currentHardware = node?.user?.hwModel ?? "UNSET"
|
||||
let deviceString = device.hwModelSlug.replacingOccurrences(of: "_", with: "")
|
||||
|
|
|
|||
|
|
@ -46,10 +46,13 @@ struct FirmwareRelease: Codable {
|
|||
class Api : ObservableObject{
|
||||
|
||||
func loadDeviceHardwareData(completion:@escaping ([DeviceHardware]) -> ()) {
|
||||
guard let url = URL(string: "https://api.meshtastic.org/resource/deviceHardware") else {
|
||||
print("Invalid url...")
|
||||
|
||||
/// List from https://api.meshtastic.org/resource/deviceHardware
|
||||
guard let url = Bundle.main.url(forResource: "DeviceHardware.json", withExtension: nil) else {
|
||||
print("Couldn't find DeviceHardware.json in main bundle.")
|
||||
return
|
||||
}
|
||||
|
||||
URLSession.shared.dataTask(with: url) { data, response, error in
|
||||
let deviceHardware = try! JSONDecoder().decode([DeviceHardware].self, from: data!)
|
||||
DispatchQueue.main.async {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue