mirror of
https://github.com/meshtastic/Meshtastic-Apple.git
synced 2026-04-20 22:13:56 +00:00
Merge pull request #22 from garthvh/feature/messaging_updates
Update Protobufs, remove buggy last connected device code
This commit is contained in:
commit
4e7cd5f86a
17 changed files with 1225 additions and 721 deletions
|
|
@ -9,6 +9,8 @@
|
|||
/* Begin PBXBuildFile section */
|
||||
C9483F6D2773017500998F6B /* MapView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9483F6C2773017500998F6B /* MapView.swift */; };
|
||||
C9A7BC1027759A9600760B50 /* PositionAnnotationView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9A7BC0F27759A9600760B50 /* PositionAnnotationView.swift */; };
|
||||
DD17E5DD277D49D400010EC2 /* apponly.pb.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD17E5DB277D49D400010EC2 /* apponly.pb.swift */; };
|
||||
DD17E5DE277D49D400010EC2 /* storeforward.pb.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD17E5DC277D49D400010EC2 /* storeforward.pb.swift */; };
|
||||
DD1BF2F92776FE2E008C8D2F /* UserMessageList.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD1BF2F82776FE2E008C8D2F /* UserMessageList.swift */; };
|
||||
DD23A50F26FD1B4400D9B90C /* PeripheralModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD23A50E26FD1B4400D9B90C /* PeripheralModel.swift */; };
|
||||
DD2E65262767A01F00E45FC5 /* NodeDetail.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD2E65252767A01F00E45FC5 /* NodeDetail.swift */; };
|
||||
|
|
@ -72,6 +74,8 @@
|
|||
/* Begin PBXFileReference section */
|
||||
C9483F6C2773017500998F6B /* MapView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MapView.swift; sourceTree = "<group>"; };
|
||||
C9A7BC0F27759A9600760B50 /* PositionAnnotationView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PositionAnnotationView.swift; sourceTree = "<group>"; };
|
||||
DD17E5DB277D49D400010EC2 /* apponly.pb.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = apponly.pb.swift; sourceTree = "<group>"; };
|
||||
DD17E5DC277D49D400010EC2 /* storeforward.pb.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = storeforward.pb.swift; sourceTree = "<group>"; };
|
||||
DD1BF2F82776FE2E008C8D2F /* UserMessageList.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserMessageList.swift; sourceTree = "<group>"; };
|
||||
DD23A50E26FD1B4400D9B90C /* PeripheralModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PeripheralModel.swift; sourceTree = "<group>"; };
|
||||
DD2E65252767A01F00E45FC5 /* NodeDetail.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NodeDetail.swift; sourceTree = "<group>"; };
|
||||
|
|
@ -202,6 +206,8 @@
|
|||
DDAF8C5626ED07740058C060 /* Protobufs */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
DD17E5DB277D49D400010EC2 /* apponly.pb.swift */,
|
||||
DD17E5DC277D49D400010EC2 /* storeforward.pb.swift */,
|
||||
DDAF8C5E26ED09B50058C060 /* radioconfig.pb.swift */,
|
||||
DDAF8C6426ED0A490058C060 /* channel.pb.swift */,
|
||||
DDAF8C6826ED0D070058C060 /* deviceonly.pb.swift */,
|
||||
|
|
@ -537,6 +543,7 @@
|
|||
DD47E3CE26F103C600029299 /* NodeList.swift in Sources */,
|
||||
DD47E3D626F17ED900029299 /* CircleText.swift in Sources */,
|
||||
DDC2E18F26CE25FE0042C5E4 /* ContentView.swift in Sources */,
|
||||
DD17E5DE277D49D400010EC2 /* storeforward.pb.swift in Sources */,
|
||||
DDAF8C6326ED0A230058C060 /* admin.pb.swift in Sources */,
|
||||
C9483F6D2773017500998F6B /* MapView.swift in Sources */,
|
||||
DDAF8C5826ED07FD0058C060 /* mesh.pb.swift in Sources */,
|
||||
|
|
@ -546,6 +553,7 @@
|
|||
DD8169F9271F1A6100F4AB02 /* MeshLogger.swift in Sources */,
|
||||
DD539502276DAA6A00AD86B1 /* MapLocation.swift in Sources */,
|
||||
DDAF8C6726ED0C8C0058C060 /* remote_hardware.pb.swift in Sources */,
|
||||
DD17E5DD277D49D400010EC2 /* apponly.pb.swift in Sources */,
|
||||
DDAF8C6526ED0A490058C060 /* channel.pb.swift in Sources */,
|
||||
DD47E3DD26F390A000029299 /* Messages.swift in Sources */,
|
||||
DDC2E15826CE248E0042C5E4 /* MeshtasticClientApp.swift in Sources */,
|
||||
|
|
@ -719,13 +727,13 @@
|
|||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 1.39;
|
||||
MARKETING_VERSION = 1.42;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = gvh.MeshtasticClient;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SUPPORTS_MACCATALYST = YES;
|
||||
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = YES;
|
||||
SWIFT_VERSION = 5.0;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
TARGETED_DEVICE_FAMILY = "1,2,6";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
|
|
@ -746,13 +754,13 @@
|
|||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 1.39;
|
||||
MARKETING_VERSION = 1.42;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = gvh.MeshtasticClient;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SUPPORTS_MACCATALYST = YES;
|
||||
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = YES;
|
||||
SWIFT_VERSION = 5.0;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
TARGETED_DEVICE_FAMILY = "1,2,6";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ class BLEManager: NSObject, ObservableObject, CBCentralManagerDelegate, CBPeriph
|
|||
@Published var peripherals = [Peripheral]()
|
||||
|
||||
@Published var connectedPeripheral: Peripheral!
|
||||
@Published var lastConnectedPeripheral: String
|
||||
//@Published var lastConnectedPeripheral: String
|
||||
@Published var lastConnectionError: String
|
||||
|
||||
@Published var isSwitchedOn: Bool = false
|
||||
|
|
@ -54,7 +54,7 @@ class BLEManager: NSObject, ObservableObject, CBCentralManagerDelegate, CBPeriph
|
|||
override init() {
|
||||
|
||||
self.meshLoggingEnabled = true // UserDefaults.standard.object(forKey: "meshActivityLog") as? Bool ?? true
|
||||
self.lastConnectedPeripheral = ""
|
||||
//self.lastConnectedPeripheral = ""
|
||||
self.lastConnectionError = ""
|
||||
super.init()
|
||||
// let bleQueue: DispatchQueue = DispatchQueue(label: "CentralManager")
|
||||
|
|
@ -221,7 +221,7 @@ class BLEManager: NSObject, ObservableObject, CBCentralManagerDelegate, CBPeriph
|
|||
if meshLoggingEnabled { MeshLogger.log("💥 Fetch NodeInfo Failed") }
|
||||
}
|
||||
|
||||
lastConnectedPeripheral = peripheral.identifier.uuidString
|
||||
//lastConnectedPeripheral = peripheral.identifier.uuidString
|
||||
|
||||
// Discover Services
|
||||
peripheral.discoverServices([meshtasticServiceCBUUID])
|
||||
|
|
@ -365,10 +365,23 @@ class BLEManager: NSObject, ObservableObject, CBCentralManagerDelegate, CBPeriph
|
|||
// TODO: Convert to CoreData
|
||||
// FIXME: Remove broken JSON file data layer implementation
|
||||
func peripheral(_ peripheral: CBPeripheral, didUpdateValueFor characteristic: CBCharacteristic, error: Error?) {
|
||||
if let e = error {
|
||||
|
||||
|
||||
if let e = error {
|
||||
|
||||
print("🚫 didUpdateValueFor Characteristic error \(e)")
|
||||
|
||||
print("🚫 didUpdateValueFor Characteristic error \(e)")
|
||||
if meshLoggingEnabled { MeshLogger.log("🚫 BLE didUpdateValueFor characteristic error by \(peripheral.name ?? "Unknown") \(e)") }
|
||||
let errorCode = (e as NSError).code
|
||||
|
||||
if errorCode == 5 { // CBATTErrorDomain Code=5 "Authentication is insufficient."
|
||||
|
||||
// BLE Pin connection error
|
||||
// We will try and re-connect to this device
|
||||
lastConnectionError = "🚫 BLE \(e.localizedDescription) Please try connecting again and check the PIN carefully."
|
||||
if meshLoggingEnabled { MeshLogger.log("🚫 BLE \(e.localizedDescription) Please try connecting again and check the PIN carefully.") }
|
||||
self.centralManager?.cancelPeripheralConnection(peripheral)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
switch characteristic.uuid {
|
||||
|
|
@ -825,16 +838,17 @@ class BLEManager: NSObject, ObservableObject, CBCentralManagerDelegate, CBPeriph
|
|||
let preferredPeripheral = peripherals.filter({ $0.peripheral.identifier.uuidString == UserDefaults.standard.object(forKey: "preferredPeripheralId") as? String ?? "" }).first
|
||||
if preferredPeripheral != nil && preferredPeripheral?.peripheral != nil {
|
||||
connectTo(peripheral: preferredPeripheral!.peripheral)
|
||||
} else {
|
||||
|
||||
// Try and connect to the last connected device
|
||||
let lastConnectedPeripheral = peripherals.filter({ $0.peripheral.identifier.uuidString == self.lastConnectedPeripheral }).first
|
||||
if lastConnectedPeripheral != nil && lastConnectedPeripheral?.peripheral != nil {
|
||||
connectTo(peripheral: lastConnectedPeripheral!.peripheral)
|
||||
}
|
||||
}
|
||||
print("🚫 Message Send Failed, not properly connected to \(lastConnectedPeripheral)")
|
||||
if meshLoggingEnabled { MeshLogger.log("🚫 Message Send Failed, not properly connected to \(lastConnectedPeripheral)") }
|
||||
// else {
|
||||
//
|
||||
// // Try and connect to the last connected device
|
||||
// let lastConnectedPeripheral = peripherals.filter({ $0.peripheral.identifier.uuidString == self.lastConnectedPeripheral }).first
|
||||
// if lastConnectedPeripheral != nil && lastConnectedPeripheral?.peripheral != nil {
|
||||
// connectTo(peripheral: lastConnectedPeripheral!.peripheral)
|
||||
// }
|
||||
// }
|
||||
//print("🚫 Message Send Failed, not properly connected to \(lastConnectedPeripheral)")
|
||||
//if meshLoggingEnabled { MeshLogger.log("🚫 Message Send Failed, not properly connected to \(lastConnectedPeripheral)") }
|
||||
|
||||
success = false
|
||||
} else if message.count < 1 {
|
||||
|
|
@ -861,7 +875,7 @@ class BLEManager: NSObject, ObservableObject, CBCentralManagerDelegate, CBPeriph
|
|||
} else if fetchedUsers.count >= 1 {
|
||||
|
||||
let newMessage = MessageEntity(context: context!)
|
||||
newMessage.messageId = Int64(UInt32.random(in: UInt32.min..<UInt32.max))
|
||||
newMessage.messageId = Int64(UInt32.random(in: UInt32(UInt8.max)..<UInt32.max))
|
||||
newMessage.messageTimestamp = Int32(Date().timeIntervalSince1970)
|
||||
newMessage.receivedACK = false
|
||||
newMessage.direction = "IN"
|
||||
|
|
|
|||
|
|
@ -2,10 +2,12 @@
|
|||
<model type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" lastSavedToolsVersion="19574" systemVersion="21C52" minimumToolsVersion="Automatic" sourceLanguage="Swift" userDefinedModelVersionIdentifier="">
|
||||
<entity name="MessageEntity" representedClassName="MessageEntity" syncable="YES" codeGenerationType="class">
|
||||
<attribute name="direction" attributeType="String"/>
|
||||
<attribute name="isTapback" optional="YES" attributeType="Boolean" defaultValueString="NO" usesScalarValueType="YES"/>
|
||||
<attribute name="messageId" attributeType="Integer 64" defaultValueString="0" usesScalarValueType="YES"/>
|
||||
<attribute name="messagePayload" attributeType="String"/>
|
||||
<attribute name="messageTimestamp" attributeType="Integer 32" defaultValueString="0" usesScalarValueType="YES"/>
|
||||
<attribute name="receivedACK" attributeType="Boolean" usesScalarValueType="YES"/>
|
||||
<attribute name="replyID" optional="YES" attributeType="Integer 64" defaultValueString="0" usesScalarValueType="YES"/>
|
||||
<relationship name="fromUser" maxCount="1" deletionRule="Nullify" ordered="YES" destinationEntity="UserEntity" inverseName="sentMessages" inverseEntity="UserEntity"/>
|
||||
<relationship name="toUser" maxCount="1" deletionRule="Nullify" destinationEntity="UserEntity" inverseName="receivedMessages" inverseEntity="UserEntity"/>
|
||||
<uniquenessConstraints>
|
||||
|
|
@ -65,7 +67,7 @@
|
|||
<relationship name="userNode" optional="YES" maxCount="1" deletionRule="Nullify" destinationEntity="NodeInfoEntity" inverseName="user" inverseEntity="NodeInfoEntity"/>
|
||||
</entity>
|
||||
<elements>
|
||||
<element name="MessageEntity" positionX="-36" positionY="63" width="128" height="134"/>
|
||||
<element name="MessageEntity" positionX="-36" positionY="63" width="128" height="164"/>
|
||||
<element name="MyInfoEntity" positionX="-18" positionY="81" width="128" height="149"/>
|
||||
<element name="NodeInfoEntity" positionX="-63" positionY="-18" width="128" height="149"/>
|
||||
<element name="PositionEntity" positionX="-54" positionY="54" width="128" height="119"/>
|
||||
|
|
|
|||
|
|
@ -32,14 +32,16 @@ class PersistenceController {
|
|||
let container: NSPersistentContainer
|
||||
|
||||
init(inMemory: Bool = false) {
|
||||
|
||||
container = NSPersistentContainer(name: "Meshtastic")
|
||||
if inMemory {
|
||||
container.persistentStoreDescriptions.first!.url = URL(fileURLWithPath: "/dev/null")
|
||||
}
|
||||
container.loadPersistentStores(completionHandler: { (_, error) in
|
||||
|
||||
// Merge policy that favors in memory data over data in the db
|
||||
self.container.viewContext.mergePolicy = NSMergeByPropertyObjectTrumpMergePolicy
|
||||
|
||||
self.container.viewContext.automaticallyMergesChangesFromParent = true
|
||||
|
||||
if let error = error as NSError? {
|
||||
// Replace this implementation with code to handle the error appropriately.
|
||||
|
|
@ -53,21 +55,24 @@ class PersistenceController {
|
|||
* The store could not be migrated to the current model version.
|
||||
Check the error message to determine what the actual problem was.
|
||||
*/
|
||||
|
||||
let firstStoreURL = self.container.persistentStoreCoordinator.persistentStores.first?.url
|
||||
|
||||
do {
|
||||
|
||||
try self.container.persistentStoreCoordinator.destroyPersistentStore(at: firstStoreURL!, type: .sqlite, options: nil)
|
||||
|
||||
print("💥 Something went terribly wrong, CoreData database truncated. All app data is lost.")
|
||||
|
||||
} catch {
|
||||
print("💣 Failed to destroy broken CoreData database, delete the app.")
|
||||
}
|
||||
|
||||
print("💣💥 Unresolved error \(error), \(error.userInfo)")
|
||||
self.clearDatabase()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
public func clearDatabase() {
|
||||
guard let url = self.container.persistentStoreDescriptions.first?.url else { return }
|
||||
|
||||
let persistentStoreCoordinator = self.container.persistentStoreCoordinator
|
||||
|
||||
do {
|
||||
|
||||
try persistentStoreCoordinator.destroyPersistentStore(at:url, ofType: NSSQLiteStoreType, options: nil)
|
||||
try persistentStoreCoordinator.addPersistentStore(ofType: NSSQLiteStoreType, configurationName: nil, at: url, options: nil)
|
||||
print("💥 Something went terribly wrong, CoreData database truncated. All app data is lost.")
|
||||
|
||||
} catch let error {
|
||||
print("💣 Failed to destroy broken CoreData database, delete the app. Attempted to clear persistent store: " + error.localizedDescription)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ import SwiftProtobuf
|
|||
// incompatible with the version of SwiftProtobuf to which you are linking.
|
||||
// Please ensure that you are building against the same version of the API
|
||||
// that was used to generate this file.
|
||||
private struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck {
|
||||
fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck {
|
||||
struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {}
|
||||
typealias Version = _2
|
||||
}
|
||||
|
|
@ -29,10 +29,10 @@ struct AdminMessage {
|
|||
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
|
||||
// methods supported on all messages.
|
||||
|
||||
var variant: AdminMessage.OneOf_Variant?
|
||||
var variant: AdminMessage.OneOf_Variant? = nil
|
||||
|
||||
///
|
||||
/// set the radio provisioning for this node
|
||||
/// Set the radio provisioning for this node
|
||||
var setRadio: RadioConfig {
|
||||
get {
|
||||
if case .setRadio(let v)? = variant {return v}
|
||||
|
|
@ -66,7 +66,7 @@ struct AdminMessage {
|
|||
}
|
||||
|
||||
///
|
||||
/// Send the current RadioConfig in the response for this message.
|
||||
/// Send the current RadioConfig in the response to this message.
|
||||
var getRadioRequest: Bool {
|
||||
get {
|
||||
if case .getRadioRequest(let v)? = variant {return v}
|
||||
|
|
@ -84,7 +84,7 @@ struct AdminMessage {
|
|||
}
|
||||
|
||||
///
|
||||
/// Send the specified channel in the response for this message
|
||||
/// Send the specified channel in the response to this message
|
||||
/// NOTE: This field is sent with the channel index + 1 (to ensure we never try to send 'zero' - which protobufs treats as not present)
|
||||
var getChannelRequest: UInt32 {
|
||||
get {
|
||||
|
|
@ -102,6 +102,24 @@ struct AdminMessage {
|
|||
set {variant = .getChannelResponse(newValue)}
|
||||
}
|
||||
|
||||
///
|
||||
/// Send the current owner data in the response to this message.
|
||||
var getOwnerRequest: Bool {
|
||||
get {
|
||||
if case .getOwnerRequest(let v)? = variant {return v}
|
||||
return false
|
||||
}
|
||||
set {variant = .getOwnerRequest(newValue)}
|
||||
}
|
||||
|
||||
var getOwnerResponse: User {
|
||||
get {
|
||||
if case .getOwnerResponse(let v)? = variant {return v}
|
||||
return User()
|
||||
}
|
||||
set {variant = .getOwnerResponse(newValue)}
|
||||
}
|
||||
|
||||
///
|
||||
/// Setting channels/radio config remotely carries the risk that you might send an invalid config and the radio never talks to your mesh again.
|
||||
/// Therefore if setting either of these properties remotely, you must send a confirm_xxx message within 10 minutes.
|
||||
|
|
@ -148,7 +166,7 @@ struct AdminMessage {
|
|||
|
||||
enum OneOf_Variant: Equatable {
|
||||
///
|
||||
/// set the radio provisioning for this node
|
||||
/// Set the radio provisioning for this node
|
||||
case setRadio(RadioConfig)
|
||||
///
|
||||
/// Set the owner for this node
|
||||
|
|
@ -161,15 +179,19 @@ struct AdminMessage {
|
|||
/// If the client sets a particular channel to be primary, the previous channel will be set to SECONDARY automatically.
|
||||
case setChannel(Channel)
|
||||
///
|
||||
/// Send the current RadioConfig in the response for this message.
|
||||
/// Send the current RadioConfig in the response to this message.
|
||||
case getRadioRequest(Bool)
|
||||
case getRadioResponse(RadioConfig)
|
||||
///
|
||||
/// Send the specified channel in the response for this message
|
||||
/// Send the specified channel in the response to this message
|
||||
/// NOTE: This field is sent with the channel index + 1 (to ensure we never try to send 'zero' - which protobufs treats as not present)
|
||||
case getChannelRequest(UInt32)
|
||||
case getChannelResponse(Channel)
|
||||
///
|
||||
/// Send the current owner data in the response to this message.
|
||||
case getOwnerRequest(Bool)
|
||||
case getOwnerResponse(User)
|
||||
///
|
||||
/// Setting channels/radio config remotely carries the risk that you might send an invalid config and the radio never talks to your mesh again.
|
||||
/// Therefore if setting either of these properties remotely, you must send a confirm_xxx message within 10 minutes.
|
||||
/// If you fail to do so, the radio will assume loss of comms and revert your changes.
|
||||
|
|
@ -218,6 +240,14 @@ struct AdminMessage {
|
|||
guard case .getChannelResponse(let l) = lhs, case .getChannelResponse(let r) = rhs else { preconditionFailure() }
|
||||
return l == r
|
||||
}()
|
||||
case (.getOwnerRequest, .getOwnerRequest): return {
|
||||
guard case .getOwnerRequest(let l) = lhs, case .getOwnerRequest(let r) = rhs else { preconditionFailure() }
|
||||
return l == r
|
||||
}()
|
||||
case (.getOwnerResponse, .getOwnerResponse): return {
|
||||
guard case .getOwnerResponse(let l) = lhs, case .getOwnerResponse(let r) = rhs else { preconditionFailure() }
|
||||
return l == r
|
||||
}()
|
||||
case (.confirmSetChannel, .confirmSetChannel): return {
|
||||
guard case .confirmSetChannel(let l) = lhs, case .confirmSetChannel(let r) = rhs else { preconditionFailure() }
|
||||
return l == r
|
||||
|
|
@ -255,10 +285,12 @@ extension AdminMessage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementat
|
|||
5: .standard(proto: "get_radio_response"),
|
||||
6: .standard(proto: "get_channel_request"),
|
||||
7: .standard(proto: "get_channel_response"),
|
||||
8: .standard(proto: "get_owner_request"),
|
||||
9: .standard(proto: "get_owner_response"),
|
||||
32: .standard(proto: "confirm_set_channel"),
|
||||
33: .standard(proto: "confirm_set_radio"),
|
||||
34: .standard(proto: "exit_simulator"),
|
||||
35: .standard(proto: "reboot_seconds")
|
||||
35: .standard(proto: "reboot_seconds"),
|
||||
]
|
||||
|
||||
mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
|
||||
|
|
@ -348,6 +380,27 @@ extension AdminMessage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementat
|
|||
self.variant = .getChannelResponse(v)
|
||||
}
|
||||
}()
|
||||
case 8: try {
|
||||
var v: Bool?
|
||||
try decoder.decodeSingularBoolField(value: &v)
|
||||
if let v = v {
|
||||
if self.variant != nil {try decoder.handleConflictingOneOf()}
|
||||
self.variant = .getOwnerRequest(v)
|
||||
}
|
||||
}()
|
||||
case 9: try {
|
||||
var v: User?
|
||||
var hadOneofValue = false
|
||||
if let current = self.variant {
|
||||
hadOneofValue = true
|
||||
if case .getOwnerResponse(let m) = current {v = m}
|
||||
}
|
||||
try decoder.decodeSingularMessageField(value: &v)
|
||||
if let v = v {
|
||||
if hadOneofValue {try decoder.handleConflictingOneOf()}
|
||||
self.variant = .getOwnerResponse(v)
|
||||
}
|
||||
}()
|
||||
case 32: try {
|
||||
var v: Bool?
|
||||
try decoder.decodeSingularBoolField(value: &v)
|
||||
|
|
@ -387,9 +440,8 @@ extension AdminMessage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementat
|
|||
|
||||
func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
|
||||
// The use of inline closures is to circumvent an issue where the compiler
|
||||
// allocates stack space for every if/case branch local when no optimizations
|
||||
// are enabled. https://github.com/apple/swift-protobuf/issues/1034 and
|
||||
// https://github.com/apple/swift-protobuf/issues/1182
|
||||
// allocates stack space for every case branch when no optimizations are
|
||||
// enabled. https://github.com/apple/swift-protobuf/issues/1034
|
||||
switch self.variant {
|
||||
case .setRadio?: try {
|
||||
guard case .setRadio(let v)? = self.variant else { preconditionFailure() }
|
||||
|
|
@ -419,6 +471,14 @@ extension AdminMessage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementat
|
|||
guard case .getChannelResponse(let v)? = self.variant else { preconditionFailure() }
|
||||
try visitor.visitSingularMessageField(value: v, fieldNumber: 7)
|
||||
}()
|
||||
case .getOwnerRequest?: try {
|
||||
guard case .getOwnerRequest(let v)? = self.variant else { preconditionFailure() }
|
||||
try visitor.visitSingularBoolField(value: v, fieldNumber: 8)
|
||||
}()
|
||||
case .getOwnerResponse?: try {
|
||||
guard case .getOwnerResponse(let v)? = self.variant else { preconditionFailure() }
|
||||
try visitor.visitSingularMessageField(value: v, fieldNumber: 9)
|
||||
}()
|
||||
case .confirmSetChannel?: try {
|
||||
guard case .confirmSetChannel(let v)? = self.variant else { preconditionFailure() }
|
||||
try visitor.visitSingularBoolField(value: v, fieldNumber: 32)
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ import SwiftProtobuf
|
|||
// incompatible with the version of SwiftProtobuf to which you are linking.
|
||||
// Please ensure that you are building against the same version of the API
|
||||
// that was used to generate this file.
|
||||
private struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck {
|
||||
fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck {
|
||||
struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {}
|
||||
typealias Version = _2
|
||||
}
|
||||
|
|
@ -167,30 +167,40 @@ struct ChannelSettings {
|
|||
var unknownFields = SwiftProtobuf.UnknownStorage()
|
||||
|
||||
///
|
||||
/// Standard predefined channel settings
|
||||
/// Standard predefined channel settings
|
||||
/// Note: these mappings must match ModemConfigChoice in the device code.
|
||||
enum ModemConfig: SwiftProtobuf.Enum {
|
||||
typealias RawValue = Int
|
||||
|
||||
///
|
||||
/// < Bw = 125 kHz, Cr = 4/5, Sf(7) = 128chips/symbol, CRC
|
||||
/// < on. Default medium range (5.469 kbps)
|
||||
/// < on. ShortSlow | Short Range / Slow (5.469 kbps)
|
||||
case bw125Cr45Sf128 // = 0
|
||||
|
||||
///
|
||||
/// < Bw = 500 kHz, Cr = 4/5, Sf(7) = 128chips/symbol, CRC
|
||||
/// < on. Fast+short range (21.875 kbps)
|
||||
/// < on. ShortFast | Short Range / Fast (21.875 kbps)
|
||||
case bw500Cr45Sf128 // = 1
|
||||
|
||||
///
|
||||
/// < Bw = 31.25 kHz, Cr = 4/8, Sf(9) = 512chips/symbol,
|
||||
/// < CRC on. Slow+long range (275 bps)
|
||||
/// < CRC on. LongFast | Long Range / Fast (275 bps)
|
||||
case bw3125Cr48Sf512 // = 2
|
||||
|
||||
///
|
||||
/// < Bw = 125 kHz, Cr = 4/8, Sf(12) = 4096chips/symbol, CRC
|
||||
/// < on. Slow+long range (183 bps)
|
||||
/// < on. LongSlow | Long Range / Slow (183 bps)
|
||||
case bw125Cr48Sf4096 // = 3
|
||||
|
||||
///
|
||||
/// < Bw = 250 kHz, Cr = 4/6, Sf(11) = 2048chips/symbol, CRC
|
||||
/// < on. MediumSlow | Medium Range / Slow (895 bps)
|
||||
case bw250Cr46Sf2048 // = 4
|
||||
|
||||
///
|
||||
/// < Bw = 250 kHz, Cr = 4/7, Sf(10) = 1024chips/symbol, CRC
|
||||
/// < on. MediumFast | Medium Range / Fast (1400 bps)
|
||||
case bw250Cr47Sf1024 // = 5
|
||||
case UNRECOGNIZED(Int)
|
||||
|
||||
init() {
|
||||
|
|
@ -203,6 +213,8 @@ struct ChannelSettings {
|
|||
case 1: self = .bw500Cr45Sf128
|
||||
case 2: self = .bw3125Cr48Sf512
|
||||
case 3: self = .bw125Cr48Sf4096
|
||||
case 4: self = .bw250Cr46Sf2048
|
||||
case 5: self = .bw250Cr47Sf1024
|
||||
default: self = .UNRECOGNIZED(rawValue)
|
||||
}
|
||||
}
|
||||
|
|
@ -213,6 +225,8 @@ struct ChannelSettings {
|
|||
case .bw500Cr45Sf128: return 1
|
||||
case .bw3125Cr48Sf512: return 2
|
||||
case .bw125Cr48Sf4096: return 3
|
||||
case .bw250Cr46Sf2048: return 4
|
||||
case .bw250Cr47Sf1024: return 5
|
||||
case .UNRECOGNIZED(let i): return i
|
||||
}
|
||||
}
|
||||
|
|
@ -230,7 +244,9 @@ extension ChannelSettings.ModemConfig: CaseIterable {
|
|||
.bw125Cr45Sf128,
|
||||
.bw500Cr45Sf128,
|
||||
.bw3125Cr48Sf512,
|
||||
.bw125Cr48Sf4096
|
||||
.bw125Cr48Sf4096,
|
||||
.bw250Cr46Sf2048,
|
||||
.bw250Cr47Sf1024,
|
||||
]
|
||||
}
|
||||
|
||||
|
|
@ -245,8 +261,8 @@ struct Channel {
|
|||
|
||||
///
|
||||
/// The index of this channel in the channel table (from 0 to MAX_NUM_CHANNELS-1)
|
||||
/// (Someday - not currently implemented) An index of -1 could be used to mean "set by name",
|
||||
/// in which case the target node will find and set the channel by settings.name.
|
||||
/// (Someday - not currently implemented) An index of -1 could be used to mean "set by name",
|
||||
/// in which case the target node will find and set the channel by settings.name.
|
||||
var index: Int32 = 0
|
||||
|
||||
///
|
||||
|
|
@ -289,7 +305,7 @@ struct Channel {
|
|||
|
||||
///
|
||||
/// Secondary channels are only used for encryption/decryption/authentication purposes.
|
||||
/// Their radio settings (freq etc) are ignored, only psk is used.
|
||||
/// Their radio settings (freq etc) are ignored, only psk is used.
|
||||
case secondary // = 2
|
||||
case UNRECOGNIZED(Int)
|
||||
|
||||
|
|
@ -319,7 +335,7 @@ struct Channel {
|
|||
|
||||
init() {}
|
||||
|
||||
fileprivate var _settings: ChannelSettings?
|
||||
fileprivate var _settings: ChannelSettings? = nil
|
||||
}
|
||||
|
||||
#if swift(>=4.2)
|
||||
|
|
@ -329,7 +345,7 @@ extension Channel.Role: CaseIterable {
|
|||
static var allCases: [Channel.Role] = [
|
||||
.disabled,
|
||||
.primary,
|
||||
.secondary
|
||||
.secondary,
|
||||
]
|
||||
}
|
||||
|
||||
|
|
@ -350,7 +366,7 @@ extension ChannelSettings: SwiftProtobuf.Message, SwiftProtobuf._MessageImplemen
|
|||
5: .same(proto: "name"),
|
||||
10: .same(proto: "id"),
|
||||
16: .standard(proto: "uplink_enabled"),
|
||||
17: .standard(proto: "downlink_enabled")
|
||||
17: .standard(proto: "downlink_enabled"),
|
||||
]
|
||||
|
||||
mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
|
||||
|
|
@ -434,7 +450,9 @@ extension ChannelSettings.ModemConfig: SwiftProtobuf._ProtoNameProviding {
|
|||
0: .same(proto: "Bw125Cr45Sf128"),
|
||||
1: .same(proto: "Bw500Cr45Sf128"),
|
||||
2: .same(proto: "Bw31_25Cr48Sf512"),
|
||||
3: .same(proto: "Bw125Cr48Sf4096")
|
||||
3: .same(proto: "Bw125Cr48Sf4096"),
|
||||
4: .same(proto: "Bw250Cr46Sf2048"),
|
||||
5: .same(proto: "Bw250Cr47Sf1024"),
|
||||
]
|
||||
}
|
||||
|
||||
|
|
@ -443,7 +461,7 @@ extension Channel: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBa
|
|||
static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
||||
1: .same(proto: "index"),
|
||||
2: .same(proto: "settings"),
|
||||
3: .same(proto: "role")
|
||||
3: .same(proto: "role"),
|
||||
]
|
||||
|
||||
mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
|
||||
|
|
@ -461,16 +479,12 @@ extension Channel: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBa
|
|||
}
|
||||
|
||||
func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
|
||||
// The use of inline closures is to circumvent an issue where the compiler
|
||||
// allocates stack space for every if/case branch local when no optimizations
|
||||
// are enabled. https://github.com/apple/swift-protobuf/issues/1034 and
|
||||
// https://github.com/apple/swift-protobuf/issues/1182
|
||||
if self.index != 0 {
|
||||
try visitor.visitSingularInt32Field(value: self.index, fieldNumber: 1)
|
||||
}
|
||||
try { if let v = self._settings {
|
||||
if let v = self._settings {
|
||||
try visitor.visitSingularMessageField(value: v, fieldNumber: 2)
|
||||
} }()
|
||||
}
|
||||
if self.role != .disabled {
|
||||
try visitor.visitSingularEnumField(value: self.role, fieldNumber: 3)
|
||||
}
|
||||
|
|
@ -490,6 +504,6 @@ extension Channel.Role: SwiftProtobuf._ProtoNameProviding {
|
|||
static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
||||
0: .same(proto: "DISABLED"),
|
||||
1: .same(proto: "PRIMARY"),
|
||||
2: .same(proto: "SECONDARY")
|
||||
2: .same(proto: "SECONDARY"),
|
||||
]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ import SwiftProtobuf
|
|||
// incompatible with the version of SwiftProtobuf to which you are linking.
|
||||
// Please ensure that you are building against the same version of the API
|
||||
// that was used to generate this file.
|
||||
private struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck {
|
||||
fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck {
|
||||
struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {}
|
||||
typealias Version = _2
|
||||
}
|
||||
|
|
@ -56,7 +56,7 @@ struct LegacyRadioConfig {
|
|||
|
||||
init() {}
|
||||
|
||||
fileprivate var _preferences: LegacyRadioConfig.LegacyPreferences?
|
||||
fileprivate var _preferences: LegacyRadioConfig.LegacyPreferences? = nil
|
||||
}
|
||||
|
||||
///
|
||||
|
|
@ -180,7 +180,7 @@ struct ChannelFile {
|
|||
extension LegacyRadioConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
|
||||
static let protoMessageName: String = "LegacyRadioConfig"
|
||||
static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
||||
1: .same(proto: "preferences")
|
||||
1: .same(proto: "preferences"),
|
||||
]
|
||||
|
||||
mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
|
||||
|
|
@ -196,13 +196,9 @@ extension LegacyRadioConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImplem
|
|||
}
|
||||
|
||||
func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
|
||||
// The use of inline closures is to circumvent an issue where the compiler
|
||||
// allocates stack space for every if/case branch local when no optimizations
|
||||
// are enabled. https://github.com/apple/swift-protobuf/issues/1034 and
|
||||
// https://github.com/apple/swift-protobuf/issues/1182
|
||||
try { if let v = self._preferences {
|
||||
if let v = self._preferences {
|
||||
try visitor.visitSingularMessageField(value: v, fieldNumber: 1)
|
||||
} }()
|
||||
}
|
||||
try unknownFields.traverse(visitor: &visitor)
|
||||
}
|
||||
|
||||
|
|
@ -216,7 +212,7 @@ extension LegacyRadioConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImplem
|
|||
extension LegacyRadioConfig.LegacyPreferences: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
|
||||
static let protoMessageName: String = LegacyRadioConfig.protoMessageName + ".LegacyPreferences"
|
||||
static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
||||
15: .same(proto: "region")
|
||||
15: .same(proto: "region"),
|
||||
]
|
||||
|
||||
mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
|
||||
|
|
@ -256,17 +252,17 @@ extension DeviceState: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementati
|
|||
8: .same(proto: "version"),
|
||||
7: .standard(proto: "rx_text_message"),
|
||||
9: .standard(proto: "no_save"),
|
||||
11: .standard(proto: "did_gps_reset")
|
||||
11: .standard(proto: "did_gps_reset"),
|
||||
]
|
||||
|
||||
fileprivate class _StorageClass {
|
||||
var _legacyRadio: LegacyRadioConfig?
|
||||
var _myNode: MyNodeInfo?
|
||||
var _owner: User?
|
||||
var _legacyRadio: LegacyRadioConfig? = nil
|
||||
var _myNode: MyNodeInfo? = nil
|
||||
var _owner: User? = nil
|
||||
var _nodeDb: [NodeInfo] = []
|
||||
var _receiveQueue: [MeshPacket] = []
|
||||
var _version: UInt32 = 0
|
||||
var _rxTextMessage: MeshPacket?
|
||||
var _rxTextMessage: MeshPacket? = nil
|
||||
var _noSave: Bool = false
|
||||
var _didGpsReset: Bool = false
|
||||
|
||||
|
|
@ -319,28 +315,24 @@ extension DeviceState: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementati
|
|||
|
||||
func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
|
||||
try withExtendedLifetime(_storage) { (_storage: _StorageClass) in
|
||||
// The use of inline closures is to circumvent an issue where the compiler
|
||||
// allocates stack space for every if/case branch local when no optimizations
|
||||
// are enabled. https://github.com/apple/swift-protobuf/issues/1034 and
|
||||
// https://github.com/apple/swift-protobuf/issues/1182
|
||||
try { if let v = _storage._legacyRadio {
|
||||
if let v = _storage._legacyRadio {
|
||||
try visitor.visitSingularMessageField(value: v, fieldNumber: 1)
|
||||
} }()
|
||||
try { if let v = _storage._myNode {
|
||||
}
|
||||
if let v = _storage._myNode {
|
||||
try visitor.visitSingularMessageField(value: v, fieldNumber: 2)
|
||||
} }()
|
||||
try { if let v = _storage._owner {
|
||||
}
|
||||
if let v = _storage._owner {
|
||||
try visitor.visitSingularMessageField(value: v, fieldNumber: 3)
|
||||
} }()
|
||||
}
|
||||
if !_storage._nodeDb.isEmpty {
|
||||
try visitor.visitRepeatedMessageField(value: _storage._nodeDb, fieldNumber: 4)
|
||||
}
|
||||
if !_storage._receiveQueue.isEmpty {
|
||||
try visitor.visitRepeatedMessageField(value: _storage._receiveQueue, fieldNumber: 5)
|
||||
}
|
||||
try { if let v = _storage._rxTextMessage {
|
||||
if let v = _storage._rxTextMessage {
|
||||
try visitor.visitSingularMessageField(value: v, fieldNumber: 7)
|
||||
} }()
|
||||
}
|
||||
if _storage._version != 0 {
|
||||
try visitor.visitSingularUInt32Field(value: _storage._version, fieldNumber: 8)
|
||||
}
|
||||
|
|
@ -380,7 +372,7 @@ extension DeviceState: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementati
|
|||
extension ChannelFile: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
|
||||
static let protoMessageName: String = "ChannelFile"
|
||||
static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
||||
1: .same(proto: "channels")
|
||||
1: .same(proto: "channels"),
|
||||
]
|
||||
|
||||
mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ import SwiftProtobuf
|
|||
// incompatible with the version of SwiftProtobuf to which you are linking.
|
||||
// Please ensure that you are building against the same version of the API
|
||||
// that was used to generate this file.
|
||||
private struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck {
|
||||
fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck {
|
||||
struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {}
|
||||
typealias Version = _2
|
||||
}
|
||||
|
|
@ -43,7 +43,7 @@ extension EnvironmentalMeasurement: SwiftProtobuf.Message, SwiftProtobuf._Messag
|
|||
static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
||||
1: .same(proto: "temperature"),
|
||||
2: .standard(proto: "relative_humidity"),
|
||||
3: .standard(proto: "barometric_pressure")
|
||||
3: .standard(proto: "barometric_pressure"),
|
||||
]
|
||||
|
||||
mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -15,7 +15,7 @@ import SwiftProtobuf
|
|||
// incompatible with the version of SwiftProtobuf to which you are linking.
|
||||
// Please ensure that you are building against the same version of the API
|
||||
// that was used to generate this file.
|
||||
private struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck {
|
||||
fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck {
|
||||
struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {}
|
||||
typealias Version = _2
|
||||
}
|
||||
|
|
@ -30,35 +30,29 @@ struct ServiceEnvelope {
|
|||
///
|
||||
/// The (probably encrypted) packet
|
||||
var packet: MeshPacket {
|
||||
get {return _storage._packet ?? MeshPacket()}
|
||||
set {_uniqueStorage()._packet = newValue}
|
||||
get {return _packet ?? MeshPacket()}
|
||||
set {_packet = newValue}
|
||||
}
|
||||
/// Returns true if `packet` has been explicitly set.
|
||||
var hasPacket: Bool {return _storage._packet != nil}
|
||||
var hasPacket: Bool {return self._packet != nil}
|
||||
/// Clears the value of `packet`. Subsequent reads from it will return its default value.
|
||||
mutating func clearPacket() {_uniqueStorage()._packet = nil}
|
||||
mutating func clearPacket() {self._packet = nil}
|
||||
|
||||
///
|
||||
/// The global channel ID it was sent on
|
||||
var channelID: String {
|
||||
get {return _storage._channelID}
|
||||
set {_uniqueStorage()._channelID = newValue}
|
||||
}
|
||||
var channelID: String = String()
|
||||
|
||||
///
|
||||
/// The sending gateway node ID. Can we use this to authenticate/prevent fake
|
||||
/// nodeid impersonation for senders? - i.e. use gateway/mesh id (which is authenticated) + local node id as
|
||||
/// the globally trusted nodenum
|
||||
var gatewayID: String {
|
||||
get {return _storage._gatewayID}
|
||||
set {_uniqueStorage()._gatewayID = newValue}
|
||||
}
|
||||
var gatewayID: String = String()
|
||||
|
||||
var unknownFields = SwiftProtobuf.UnknownStorage()
|
||||
|
||||
init() {}
|
||||
|
||||
fileprivate var _storage = _StorageClass.defaultInstance
|
||||
fileprivate var _packet: MeshPacket? = nil
|
||||
}
|
||||
|
||||
// MARK: - Code below here is support for the SwiftProtobuf runtime.
|
||||
|
|
@ -68,80 +62,40 @@ extension ServiceEnvelope: SwiftProtobuf.Message, SwiftProtobuf._MessageImplemen
|
|||
static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
||||
1: .same(proto: "packet"),
|
||||
2: .standard(proto: "channel_id"),
|
||||
3: .standard(proto: "gateway_id")
|
||||
3: .standard(proto: "gateway_id"),
|
||||
]
|
||||
|
||||
fileprivate class _StorageClass {
|
||||
var _packet: MeshPacket?
|
||||
var _channelID: String = String()
|
||||
var _gatewayID: String = String()
|
||||
|
||||
static let defaultInstance = _StorageClass()
|
||||
|
||||
private init() {}
|
||||
|
||||
init(copying source: _StorageClass) {
|
||||
_packet = source._packet
|
||||
_channelID = source._channelID
|
||||
_gatewayID = source._gatewayID
|
||||
}
|
||||
}
|
||||
|
||||
fileprivate mutating func _uniqueStorage() -> _StorageClass {
|
||||
if !isKnownUniquelyReferenced(&_storage) {
|
||||
_storage = _StorageClass(copying: _storage)
|
||||
}
|
||||
return _storage
|
||||
}
|
||||
|
||||
mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
|
||||
_ = _uniqueStorage()
|
||||
try withExtendedLifetime(_storage) { (_storage: _StorageClass) in
|
||||
while let fieldNumber = try decoder.nextFieldNumber() {
|
||||
// The use of inline closures is to circumvent an issue where the compiler
|
||||
// allocates stack space for every case branch when no optimizations are
|
||||
// enabled. https://github.com/apple/swift-protobuf/issues/1034
|
||||
switch fieldNumber {
|
||||
case 1: try { try decoder.decodeSingularMessageField(value: &_storage._packet) }()
|
||||
case 2: try { try decoder.decodeSingularStringField(value: &_storage._channelID) }()
|
||||
case 3: try { try decoder.decodeSingularStringField(value: &_storage._gatewayID) }()
|
||||
default: break
|
||||
}
|
||||
while let fieldNumber = try decoder.nextFieldNumber() {
|
||||
// The use of inline closures is to circumvent an issue where the compiler
|
||||
// allocates stack space for every case branch when no optimizations are
|
||||
// enabled. https://github.com/apple/swift-protobuf/issues/1034
|
||||
switch fieldNumber {
|
||||
case 1: try { try decoder.decodeSingularMessageField(value: &self._packet) }()
|
||||
case 2: try { try decoder.decodeSingularStringField(value: &self.channelID) }()
|
||||
case 3: try { try decoder.decodeSingularStringField(value: &self.gatewayID) }()
|
||||
default: break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
|
||||
try withExtendedLifetime(_storage) { (_storage: _StorageClass) in
|
||||
// The use of inline closures is to circumvent an issue where the compiler
|
||||
// allocates stack space for every if/case branch local when no optimizations
|
||||
// are enabled. https://github.com/apple/swift-protobuf/issues/1034 and
|
||||
// https://github.com/apple/swift-protobuf/issues/1182
|
||||
try { if let v = _storage._packet {
|
||||
try visitor.visitSingularMessageField(value: v, fieldNumber: 1)
|
||||
} }()
|
||||
if !_storage._channelID.isEmpty {
|
||||
try visitor.visitSingularStringField(value: _storage._channelID, fieldNumber: 2)
|
||||
}
|
||||
if !_storage._gatewayID.isEmpty {
|
||||
try visitor.visitSingularStringField(value: _storage._gatewayID, fieldNumber: 3)
|
||||
}
|
||||
if let v = self._packet {
|
||||
try visitor.visitSingularMessageField(value: v, fieldNumber: 1)
|
||||
}
|
||||
if !self.channelID.isEmpty {
|
||||
try visitor.visitSingularStringField(value: self.channelID, fieldNumber: 2)
|
||||
}
|
||||
if !self.gatewayID.isEmpty {
|
||||
try visitor.visitSingularStringField(value: self.gatewayID, fieldNumber: 3)
|
||||
}
|
||||
try unknownFields.traverse(visitor: &visitor)
|
||||
}
|
||||
|
||||
static func ==(lhs: ServiceEnvelope, rhs: ServiceEnvelope) -> Bool {
|
||||
if lhs._storage !== rhs._storage {
|
||||
let storagesAreEqual: Bool = withExtendedLifetime((lhs._storage, rhs._storage)) { (_args: (_StorageClass, _StorageClass)) in
|
||||
let _storage = _args.0
|
||||
let rhs_storage = _args.1
|
||||
if _storage._packet != rhs_storage._packet {return false}
|
||||
if _storage._channelID != rhs_storage._channelID {return false}
|
||||
if _storage._gatewayID != rhs_storage._gatewayID {return false}
|
||||
return true
|
||||
}
|
||||
if !storagesAreEqual {return false}
|
||||
}
|
||||
if lhs._packet != rhs._packet {return false}
|
||||
if lhs.channelID != rhs.channelID {return false}
|
||||
if lhs.gatewayID != rhs.gatewayID {return false}
|
||||
if lhs.unknownFields != rhs.unknownFields {return false}
|
||||
return true
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ import SwiftProtobuf
|
|||
// incompatible with the version of SwiftProtobuf to which you are linking.
|
||||
// Please ensure that you are building against the same version of the API
|
||||
// that was used to generate this file.
|
||||
private struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck {
|
||||
fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck {
|
||||
struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {}
|
||||
typealias Version = _2
|
||||
}
|
||||
|
|
@ -43,7 +43,7 @@ enum PortNum: SwiftProtobuf.Enum {
|
|||
|
||||
///
|
||||
/// Deprecated: do not use in new code (formerly called OPAQUE)
|
||||
/// A message sent from a device outside of the mesh, in a form the mesh does not understand
|
||||
/// A message sent from a device outside of the mesh, in a form the mesh does not understand
|
||||
/// NOTE: This must be 0, because it is documented in IMeshService.aidl to be so
|
||||
case unknownApp // = 0
|
||||
|
||||
|
|
@ -206,7 +206,7 @@ extension PortNum: CaseIterable {
|
|||
.zpsApp,
|
||||
.privateApp,
|
||||
.atakForwarder,
|
||||
.max
|
||||
.max,
|
||||
]
|
||||
}
|
||||
|
||||
|
|
@ -232,6 +232,6 @@ extension PortNum: SwiftProtobuf._ProtoNameProviding {
|
|||
68: .same(proto: "ZPS_APP"),
|
||||
256: .same(proto: "PRIVATE_APP"),
|
||||
257: .same(proto: "ATAK_FORWARDER"),
|
||||
511: .same(proto: "MAX")
|
||||
511: .same(proto: "MAX"),
|
||||
]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ import SwiftProtobuf
|
|||
// incompatible with the version of SwiftProtobuf to which you are linking.
|
||||
// Please ensure that you are building against the same version of the API
|
||||
// that was used to generate this file.
|
||||
private struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck {
|
||||
fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck {
|
||||
struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {}
|
||||
typealias Version = _2
|
||||
}
|
||||
|
|
@ -114,7 +114,7 @@ extension RegionCode: CaseIterable {
|
|||
.anz,
|
||||
.kr,
|
||||
.tw,
|
||||
.ru
|
||||
.ru,
|
||||
]
|
||||
}
|
||||
|
||||
|
|
@ -217,7 +217,7 @@ extension ChargeCurrent: CaseIterable {
|
|||
.ma1080,
|
||||
.ma1160,
|
||||
.ma1240,
|
||||
.ma1320
|
||||
.ma1320,
|
||||
]
|
||||
}
|
||||
|
||||
|
|
@ -292,7 +292,7 @@ extension GpsOperation: CaseIterable {
|
|||
.gpsOpStationary,
|
||||
.gpsOpMobile,
|
||||
.gpsOpTimeOnly,
|
||||
.gpsOpDisabled
|
||||
.gpsOpDisabled,
|
||||
]
|
||||
}
|
||||
|
||||
|
|
@ -304,23 +304,23 @@ enum GpsCoordinateFormat: SwiftProtobuf.Enum {
|
|||
typealias RawValue = Int
|
||||
|
||||
///
|
||||
/// GPS coordinates are displayed in the normal decimal degrees format:
|
||||
/// GPS coordinates are displayed in the normal decimal degrees format:
|
||||
/// DD.DDDDDD DDD.DDDDDD
|
||||
case gpsFormatDec // = 0
|
||||
|
||||
///
|
||||
/// GPS coordinates are displayed in the degrees minutes seconds format:
|
||||
/// GPS coordinates are displayed in the degrees minutes seconds format:
|
||||
/// DD°MM'SS"C DDD°MM'SS"C, where C is the compass point representing the locations quadrant
|
||||
case gpsFormatDms // = 1
|
||||
|
||||
///
|
||||
/// GPS coordinates are displayed in Universal Transverse Mercator format:
|
||||
/// GPS coordinates are displayed in Universal Transverse Mercator format:
|
||||
/// ZZB EEEEEE NNNNNNN, where Z is zone, B is band, E is easting, N is northing
|
||||
case gpsFormatUtm // = 2
|
||||
|
||||
///
|
||||
/// GPS coordinates are displayed in Military Grid Reference System format:
|
||||
/// ZZB CD EEEEE NNNNN, where Z is zone, B is band, C is the east 100k square, D is the north 100k square,
|
||||
/// GPS coordinates are displayed in Military Grid Reference System format:
|
||||
/// ZZB CD EEEEE NNNNN, where Z is zone, B is band, C is the east 100k square, D is the north 100k square,
|
||||
/// E is easting, N is northing
|
||||
case gpsFormatMgrs // = 3
|
||||
|
||||
|
|
@ -375,7 +375,7 @@ extension GpsCoordinateFormat: CaseIterable {
|
|||
.gpsFormatUtm,
|
||||
.gpsFormatMgrs,
|
||||
.gpsFormatOlc,
|
||||
.gpsFormatOsgr
|
||||
.gpsFormatOsgr,
|
||||
]
|
||||
}
|
||||
|
||||
|
|
@ -430,14 +430,14 @@ extension LocationSharing: CaseIterable {
|
|||
static var allCases: [LocationSharing] = [
|
||||
.locUnset,
|
||||
.locEnabled,
|
||||
.locDisabled
|
||||
.locDisabled,
|
||||
]
|
||||
}
|
||||
|
||||
#endif // swift(>=4.2)
|
||||
|
||||
///
|
||||
/// Bit field of boolean configuration options, indicating which optional
|
||||
/// Bit field of boolean configuration options, indicating which optional
|
||||
/// fields to include when assembling POSITION messages
|
||||
/// Longitude and latitude are always included (also time if GPS-synced)
|
||||
///
|
||||
|
|
@ -529,7 +529,7 @@ extension PositionFlags: CaseIterable {
|
|||
.posBattery,
|
||||
.posSatinview,
|
||||
.posSeqNos,
|
||||
.posTimestamp
|
||||
.posTimestamp,
|
||||
]
|
||||
}
|
||||
|
||||
|
|
@ -556,7 +556,7 @@ struct RadioConfig {
|
|||
var unknownFields = SwiftProtobuf.UnknownStorage()
|
||||
|
||||
///
|
||||
/// see [software design](/software/other/sw-design.md) for more information on these preferences
|
||||
/// See [software design](/software/other/sw-design.md) for more information on these preferences
|
||||
struct UserPreferences {
|
||||
// SwiftProtobuf.Message conformance is added in an extension below. See the
|
||||
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
|
||||
|
|
@ -760,7 +760,7 @@ struct RadioConfig {
|
|||
/// How long should we try to get our position during each gps_update_interval attempt? (in seconds)
|
||||
/// Or if zero, use the default of 30 seconds.
|
||||
/// If we don't get a new gps fix in that time, the gps will be put into sleep until the next gps_update_rate
|
||||
/// window.
|
||||
/// window.
|
||||
var gpsAttemptTime: UInt32 {
|
||||
get {return _storage._gpsAttemptTime}
|
||||
set {_uniqueStorage()._gpsAttemptTime = newValue}
|
||||
|
|
@ -798,7 +798,7 @@ struct RadioConfig {
|
|||
|
||||
///
|
||||
/// The server to use for our MQTT global message gateway feature.
|
||||
/// If not set, the default server will be used
|
||||
/// If not set, the default server will be used
|
||||
var mqttServer: String {
|
||||
get {return _storage._mqttServer}
|
||||
set {_uniqueStorage()._mqttServer = newValue}
|
||||
|
|
@ -936,7 +936,7 @@ struct RadioConfig {
|
|||
|
||||
///
|
||||
/// Preferences for the StoreForwardPlugin
|
||||
/// FIXME - Move this out of UserPreferences and into a section for plugin configuration. (was 136)
|
||||
///FIXME - Move this out of UserPreferences and into a section for plugin configuration. (was 136)
|
||||
var storeForwardPluginEnabled: Bool {
|
||||
get {return _storage._storeForwardPluginEnabled}
|
||||
set {_uniqueStorage()._storeForwardPluginEnabled = newValue}
|
||||
|
|
@ -988,7 +988,7 @@ struct RadioConfig {
|
|||
}
|
||||
|
||||
///
|
||||
/// Interval in seconds of how often we should try to send our
|
||||
/// Interval in seconds of how often we should try to send our
|
||||
/// measurements to the mesh
|
||||
var environmentalMeasurementPluginUpdateInterval: UInt32 {
|
||||
get {return _storage._environmentalMeasurementPluginUpdateInterval}
|
||||
|
|
@ -1035,7 +1035,7 @@ struct RadioConfig {
|
|||
}
|
||||
|
||||
///
|
||||
/// Circumvents the logic block for determining whether the device is powered or not.
|
||||
/// Circumvents the logic block for determining whether the device is powered or not.
|
||||
/// Useful for devices with finicky ADC issues on the battery sense pins.
|
||||
var isAlwaysPowered: Bool {
|
||||
get {return _storage._isAlwaysPowered}
|
||||
|
|
@ -1043,13 +1043,45 @@ struct RadioConfig {
|
|||
}
|
||||
|
||||
///
|
||||
/// Automatically toggles to the next page on the screen like a carousel, based the specified interval in seconds.
|
||||
/// Automatically toggles to the next page on the screen like a carousel, based the specified interval in seconds.
|
||||
/// Potentially useful for devices without user buttons.
|
||||
var autoScreenCarouselSecs: UInt32 {
|
||||
get {return _storage._autoScreenCarouselSecs}
|
||||
set {_uniqueStorage()._autoScreenCarouselSecs = newValue}
|
||||
}
|
||||
|
||||
///
|
||||
/// If non-zero, the device will fully power off this many seconds after external power is removed.
|
||||
var onBatteryShutdownAfterSecs: UInt32 {
|
||||
get {return _storage._onBatteryShutdownAfterSecs}
|
||||
set {_uniqueStorage()._onBatteryShutdownAfterSecs = newValue}
|
||||
}
|
||||
|
||||
///
|
||||
/// Overrides HOPS_RELIABLE and sets the maximum number of hops. This can't be greater than 7.
|
||||
var hopLimit: UInt32 {
|
||||
get {return _storage._hopLimit}
|
||||
set {_uniqueStorage()._hopLimit = newValue}
|
||||
}
|
||||
|
||||
///
|
||||
/// MQTT username to use (most useful for a custom MQTT server).
|
||||
/// If using a custom server, this will be honoured even if empty.
|
||||
/// If using the default server, this will only be honoured if set, otherwise the device will use the default username
|
||||
var mqttUsername: String {
|
||||
get {return _storage._mqttUsername}
|
||||
set {_uniqueStorage()._mqttUsername = newValue}
|
||||
}
|
||||
|
||||
///
|
||||
/// MQTT password to use (most useful for a custom MQTT server).
|
||||
/// If using a custom server, this will be honoured even if empty.
|
||||
/// If using the default server, this will only be honoured if set, otherwise the device will use the default password
|
||||
var mqttPassword: String {
|
||||
get {return _storage._mqttPassword}
|
||||
set {_uniqueStorage()._mqttPassword = newValue}
|
||||
}
|
||||
|
||||
var unknownFields = SwiftProtobuf.UnknownStorage()
|
||||
|
||||
enum EnvironmentalMeasurementSensorType: SwiftProtobuf.Enum {
|
||||
|
|
@ -1087,7 +1119,7 @@ struct RadioConfig {
|
|||
|
||||
init() {}
|
||||
|
||||
fileprivate var _preferences: RadioConfig.UserPreferences?
|
||||
fileprivate var _preferences: RadioConfig.UserPreferences? = nil
|
||||
}
|
||||
|
||||
#if swift(>=4.2)
|
||||
|
|
@ -1096,7 +1128,7 @@ extension RadioConfig.UserPreferences.EnvironmentalMeasurementSensorType: CaseIt
|
|||
// The compiler won't synthesize support with the UNRECOGNIZED case.
|
||||
static var allCases: [RadioConfig.UserPreferences.EnvironmentalMeasurementSensorType] = [
|
||||
.dht11,
|
||||
.ds18B20
|
||||
.ds18B20,
|
||||
]
|
||||
}
|
||||
|
||||
|
|
@ -1115,7 +1147,7 @@ extension RegionCode: SwiftProtobuf._ProtoNameProviding {
|
|||
6: .same(proto: "ANZ"),
|
||||
7: .same(proto: "KR"),
|
||||
8: .same(proto: "TW"),
|
||||
9: .same(proto: "RU")
|
||||
9: .same(proto: "RU"),
|
||||
]
|
||||
}
|
||||
|
||||
|
|
@ -1137,7 +1169,7 @@ extension ChargeCurrent: SwiftProtobuf._ProtoNameProviding {
|
|||
13: .same(proto: "MA1080"),
|
||||
14: .same(proto: "MA1160"),
|
||||
15: .same(proto: "MA1240"),
|
||||
16: .same(proto: "MA1320")
|
||||
16: .same(proto: "MA1320"),
|
||||
]
|
||||
}
|
||||
|
||||
|
|
@ -1147,7 +1179,7 @@ extension GpsOperation: SwiftProtobuf._ProtoNameProviding {
|
|||
1: .same(proto: "GpsOpStationary"),
|
||||
2: .same(proto: "GpsOpMobile"),
|
||||
3: .same(proto: "GpsOpTimeOnly"),
|
||||
4: .same(proto: "GpsOpDisabled")
|
||||
4: .same(proto: "GpsOpDisabled"),
|
||||
]
|
||||
}
|
||||
|
||||
|
|
@ -1158,7 +1190,7 @@ extension GpsCoordinateFormat: SwiftProtobuf._ProtoNameProviding {
|
|||
2: .same(proto: "GpsFormatUTM"),
|
||||
3: .same(proto: "GpsFormatMGRS"),
|
||||
4: .same(proto: "GpsFormatOLC"),
|
||||
5: .same(proto: "GpsFormatOSGR")
|
||||
5: .same(proto: "GpsFormatOSGR"),
|
||||
]
|
||||
}
|
||||
|
||||
|
|
@ -1166,7 +1198,7 @@ extension LocationSharing: SwiftProtobuf._ProtoNameProviding {
|
|||
static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
||||
0: .same(proto: "LocUnset"),
|
||||
1: .same(proto: "LocEnabled"),
|
||||
2: .same(proto: "LocDisabled")
|
||||
2: .same(proto: "LocDisabled"),
|
||||
]
|
||||
}
|
||||
|
||||
|
|
@ -1181,14 +1213,14 @@ extension PositionFlags: SwiftProtobuf._ProtoNameProviding {
|
|||
32: .same(proto: "POS_BATTERY"),
|
||||
64: .same(proto: "POS_SATINVIEW"),
|
||||
128: .same(proto: "POS_SEQ_NOS"),
|
||||
256: .same(proto: "POS_TIMESTAMP")
|
||||
256: .same(proto: "POS_TIMESTAMP"),
|
||||
]
|
||||
}
|
||||
|
||||
extension RadioConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
|
||||
static let protoMessageName: String = "RadioConfig"
|
||||
static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
||||
1: .same(proto: "preferences")
|
||||
1: .same(proto: "preferences"),
|
||||
]
|
||||
|
||||
mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
|
||||
|
|
@ -1204,13 +1236,9 @@ extension RadioConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementati
|
|||
}
|
||||
|
||||
func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
|
||||
// The use of inline closures is to circumvent an issue where the compiler
|
||||
// allocates stack space for every if/case branch local when no optimizations
|
||||
// are enabled. https://github.com/apple/swift-protobuf/issues/1034 and
|
||||
// https://github.com/apple/swift-protobuf/issues/1182
|
||||
try { if let v = self._preferences {
|
||||
if let v = self._preferences {
|
||||
try visitor.visitSingularMessageField(value: v, fieldNumber: 1)
|
||||
} }()
|
||||
}
|
||||
try unknownFields.traverse(visitor: &visitor)
|
||||
}
|
||||
|
||||
|
|
@ -1287,7 +1315,11 @@ extension RadioConfig.UserPreferences: SwiftProtobuf.Message, SwiftProtobuf._Mes
|
|||
147: .standard(proto: "environmental_measurement_plugin_sensor_pin"),
|
||||
150: .standard(proto: "position_flags"),
|
||||
151: .standard(proto: "is_always_powered"),
|
||||
152: .standard(proto: "auto_screen_carousel_secs")
|
||||
152: .standard(proto: "auto_screen_carousel_secs"),
|
||||
153: .standard(proto: "on_battery_shutdown_after_secs"),
|
||||
154: .standard(proto: "hop_limit"),
|
||||
155: .standard(proto: "mqtt_username"),
|
||||
156: .standard(proto: "mqtt_password"),
|
||||
]
|
||||
|
||||
fileprivate class _StorageClass {
|
||||
|
|
@ -1355,6 +1387,10 @@ extension RadioConfig.UserPreferences: SwiftProtobuf.Message, SwiftProtobuf._Mes
|
|||
var _positionFlags: UInt32 = 0
|
||||
var _isAlwaysPowered: Bool = false
|
||||
var _autoScreenCarouselSecs: UInt32 = 0
|
||||
var _onBatteryShutdownAfterSecs: UInt32 = 0
|
||||
var _hopLimit: UInt32 = 0
|
||||
var _mqttUsername: String = String()
|
||||
var _mqttPassword: String = String()
|
||||
|
||||
static let defaultInstance = _StorageClass()
|
||||
|
||||
|
|
@ -1425,6 +1461,10 @@ extension RadioConfig.UserPreferences: SwiftProtobuf.Message, SwiftProtobuf._Mes
|
|||
_positionFlags = source._positionFlags
|
||||
_isAlwaysPowered = source._isAlwaysPowered
|
||||
_autoScreenCarouselSecs = source._autoScreenCarouselSecs
|
||||
_onBatteryShutdownAfterSecs = source._onBatteryShutdownAfterSecs
|
||||
_hopLimit = source._hopLimit
|
||||
_mqttUsername = source._mqttUsername
|
||||
_mqttPassword = source._mqttPassword
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1507,6 +1547,10 @@ extension RadioConfig.UserPreferences: SwiftProtobuf.Message, SwiftProtobuf._Mes
|
|||
case 150: try { try decoder.decodeSingularUInt32Field(value: &_storage._positionFlags) }()
|
||||
case 151: try { try decoder.decodeSingularBoolField(value: &_storage._isAlwaysPowered) }()
|
||||
case 152: try { try decoder.decodeSingularUInt32Field(value: &_storage._autoScreenCarouselSecs) }()
|
||||
case 153: try { try decoder.decodeSingularUInt32Field(value: &_storage._onBatteryShutdownAfterSecs) }()
|
||||
case 154: try { try decoder.decodeSingularUInt32Field(value: &_storage._hopLimit) }()
|
||||
case 155: try { try decoder.decodeSingularStringField(value: &_storage._mqttUsername) }()
|
||||
case 156: try { try decoder.decodeSingularStringField(value: &_storage._mqttPassword) }()
|
||||
default: break
|
||||
}
|
||||
}
|
||||
|
|
@ -1707,6 +1751,18 @@ extension RadioConfig.UserPreferences: SwiftProtobuf.Message, SwiftProtobuf._Mes
|
|||
if _storage._autoScreenCarouselSecs != 0 {
|
||||
try visitor.visitSingularUInt32Field(value: _storage._autoScreenCarouselSecs, fieldNumber: 152)
|
||||
}
|
||||
if _storage._onBatteryShutdownAfterSecs != 0 {
|
||||
try visitor.visitSingularUInt32Field(value: _storage._onBatteryShutdownAfterSecs, fieldNumber: 153)
|
||||
}
|
||||
if _storage._hopLimit != 0 {
|
||||
try visitor.visitSingularUInt32Field(value: _storage._hopLimit, fieldNumber: 154)
|
||||
}
|
||||
if !_storage._mqttUsername.isEmpty {
|
||||
try visitor.visitSingularStringField(value: _storage._mqttUsername, fieldNumber: 155)
|
||||
}
|
||||
if !_storage._mqttPassword.isEmpty {
|
||||
try visitor.visitSingularStringField(value: _storage._mqttPassword, fieldNumber: 156)
|
||||
}
|
||||
}
|
||||
try unknownFields.traverse(visitor: &visitor)
|
||||
}
|
||||
|
|
@ -1780,6 +1836,10 @@ extension RadioConfig.UserPreferences: SwiftProtobuf.Message, SwiftProtobuf._Mes
|
|||
if _storage._positionFlags != rhs_storage._positionFlags {return false}
|
||||
if _storage._isAlwaysPowered != rhs_storage._isAlwaysPowered {return false}
|
||||
if _storage._autoScreenCarouselSecs != rhs_storage._autoScreenCarouselSecs {return false}
|
||||
if _storage._onBatteryShutdownAfterSecs != rhs_storage._onBatteryShutdownAfterSecs {return false}
|
||||
if _storage._hopLimit != rhs_storage._hopLimit {return false}
|
||||
if _storage._mqttUsername != rhs_storage._mqttUsername {return false}
|
||||
if _storage._mqttPassword != rhs_storage._mqttPassword {return false}
|
||||
return true
|
||||
}
|
||||
if !storagesAreEqual {return false}
|
||||
|
|
@ -1792,6 +1852,6 @@ extension RadioConfig.UserPreferences: SwiftProtobuf.Message, SwiftProtobuf._Mes
|
|||
extension RadioConfig.UserPreferences.EnvironmentalMeasurementSensorType: SwiftProtobuf._ProtoNameProviding {
|
||||
static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
||||
0: .same(proto: "DHT11"),
|
||||
1: .same(proto: "DS18B20")
|
||||
1: .same(proto: "DS18B20"),
|
||||
]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,13 +15,13 @@ import SwiftProtobuf
|
|||
// incompatible with the version of SwiftProtobuf to which you are linking.
|
||||
// Please ensure that you are building against the same version of the API
|
||||
// that was used to generate this file.
|
||||
private struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck {
|
||||
fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck {
|
||||
struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {}
|
||||
typealias Version = _2
|
||||
}
|
||||
|
||||
///
|
||||
/// An example app to show off the plugin system. This message is used for
|
||||
/// An example app to show off the plugin system. This message is used for
|
||||
/// REMOTE_HARDWARE_APP PortNums.
|
||||
///
|
||||
/// Also provides easy remote access to any GPIO.
|
||||
|
|
@ -126,7 +126,7 @@ extension HardwareMessage.TypeEnum: CaseIterable {
|
|||
.watchGpios,
|
||||
.gpiosChanged,
|
||||
.readGpios,
|
||||
.readGpiosReply
|
||||
.readGpiosReply,
|
||||
]
|
||||
}
|
||||
|
||||
|
|
@ -139,7 +139,7 @@ extension HardwareMessage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplemen
|
|||
static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
||||
1: .same(proto: "typ"),
|
||||
2: .standard(proto: "gpio_mask"),
|
||||
3: .standard(proto: "gpio_value")
|
||||
3: .standard(proto: "gpio_value"),
|
||||
]
|
||||
|
||||
mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
|
||||
|
|
@ -185,6 +185,6 @@ extension HardwareMessage.TypeEnum: SwiftProtobuf._ProtoNameProviding {
|
|||
2: .same(proto: "WATCH_GPIOS"),
|
||||
3: .same(proto: "GPIOS_CHANGED"),
|
||||
4: .same(proto: "READ_GPIOS"),
|
||||
5: .same(proto: "READ_GPIOS_REPLY")
|
||||
5: .same(proto: "READ_GPIOS_REPLY"),
|
||||
]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,20 +15,20 @@ import SwiftProtobuf
|
|||
// incompatible with the version of SwiftProtobuf to which you are linking.
|
||||
// Please ensure that you are building against the same version of the API
|
||||
// that was used to generate this file.
|
||||
private struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck {
|
||||
fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck {
|
||||
struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {}
|
||||
typealias Version = _2
|
||||
}
|
||||
|
||||
struct StoreAndForwardMessage {
|
||||
struct StoreAndForward {
|
||||
// SwiftProtobuf.Message conformance is added in an extension below. See the
|
||||
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
|
||||
// methods supported on all messages.
|
||||
|
||||
var rr: StoreAndForwardMessage.RequestResponse = .unset
|
||||
var rr: StoreAndForward.RequestResponse = .unset
|
||||
|
||||
var stats: StoreAndForwardMessage.Statistics {
|
||||
get {return _stats ?? StoreAndForwardMessage.Statistics()}
|
||||
var stats: StoreAndForward.Statistics {
|
||||
get {return _stats ?? StoreAndForward.Statistics()}
|
||||
set {_stats = newValue}
|
||||
}
|
||||
/// Returns true if `stats` has been explicitly set.
|
||||
|
|
@ -36,8 +36,8 @@ struct StoreAndForwardMessage {
|
|||
/// Clears the value of `stats`. Subsequent reads from it will return its default value.
|
||||
mutating func clearStats() {self._stats = nil}
|
||||
|
||||
var history: StoreAndForwardMessage.History {
|
||||
get {return _history ?? StoreAndForwardMessage.History()}
|
||||
var history: StoreAndForward.History {
|
||||
get {return _history ?? StoreAndForward.History()}
|
||||
set {_history = newValue}
|
||||
}
|
||||
/// Returns true if `history` has been explicitly set.
|
||||
|
|
@ -45,6 +45,15 @@ struct StoreAndForwardMessage {
|
|||
/// Clears the value of `history`. Subsequent reads from it will return its default value.
|
||||
mutating func clearHistory() {self._history = nil}
|
||||
|
||||
var heartbeat: StoreAndForward.Heartbeat {
|
||||
get {return _heartbeat ?? StoreAndForward.Heartbeat()}
|
||||
set {_heartbeat = newValue}
|
||||
}
|
||||
/// Returns true if `heartbeat` has been explicitly set.
|
||||
var hasHeartbeat: Bool {return self._heartbeat != nil}
|
||||
/// Clears the value of `heartbeat`. Subsequent reads from it will return its default value.
|
||||
mutating func clearHeartbeat() {self._heartbeat = nil}
|
||||
|
||||
var unknownFields = SwiftProtobuf.UnknownStorage()
|
||||
|
||||
///
|
||||
|
|
@ -56,7 +65,13 @@ struct StoreAndForwardMessage {
|
|||
///
|
||||
/// Unset/unused
|
||||
case unset // = 0
|
||||
|
||||
///
|
||||
/// Router is an in error state.
|
||||
case routerError // = 1
|
||||
|
||||
///
|
||||
/// Router heartbeat
|
||||
case routerHeartbeat // = 2
|
||||
|
||||
///
|
||||
|
|
@ -71,6 +86,13 @@ struct StoreAndForwardMessage {
|
|||
///
|
||||
/// Router is currently busy. Please try again later.
|
||||
case routerBusy // = 5
|
||||
|
||||
///
|
||||
/// Router is responding to a request for history.
|
||||
case routerHistory // = 6
|
||||
|
||||
///
|
||||
/// Client is an in error state.
|
||||
case clientError // = 101
|
||||
|
||||
///
|
||||
|
|
@ -89,7 +111,10 @@ struct StoreAndForwardMessage {
|
|||
///
|
||||
/// The response to a "Ping"
|
||||
case clientPong // = 105
|
||||
case max // = 255
|
||||
|
||||
///
|
||||
/// Client has requested that the router abort processing the client's request
|
||||
case clientAbort // = 106
|
||||
case UNRECOGNIZED(Int)
|
||||
|
||||
init() {
|
||||
|
|
@ -104,12 +129,13 @@ struct StoreAndForwardMessage {
|
|||
case 3: self = .routerPing
|
||||
case 4: self = .routerPong
|
||||
case 5: self = .routerBusy
|
||||
case 6: self = .routerHistory
|
||||
case 101: self = .clientError
|
||||
case 102: self = .clientHistory
|
||||
case 103: self = .clientStats
|
||||
case 104: self = .clientPing
|
||||
case 105: self = .clientPong
|
||||
case 255: self = .max
|
||||
case 106: self = .clientAbort
|
||||
default: self = .UNRECOGNIZED(rawValue)
|
||||
}
|
||||
}
|
||||
|
|
@ -122,12 +148,13 @@ struct StoreAndForwardMessage {
|
|||
case .routerPing: return 3
|
||||
case .routerPong: return 4
|
||||
case .routerBusy: return 5
|
||||
case .routerHistory: return 6
|
||||
case .clientError: return 101
|
||||
case .clientHistory: return 102
|
||||
case .clientStats: return 103
|
||||
case .clientPing: return 104
|
||||
case .clientPong: return 105
|
||||
case .max: return 255
|
||||
case .clientAbort: return 106
|
||||
case .UNRECOGNIZED(let i): return i
|
||||
}
|
||||
}
|
||||
|
|
@ -193,6 +220,28 @@ struct StoreAndForwardMessage {
|
|||
/// The window of messages that was used to filter the history client requested
|
||||
var window: UInt32 = 0
|
||||
|
||||
///
|
||||
/// The window of messages that was used to filter the history client requested
|
||||
var lastRequest: UInt32 = 0
|
||||
|
||||
var unknownFields = SwiftProtobuf.UnknownStorage()
|
||||
|
||||
init() {}
|
||||
}
|
||||
|
||||
struct Heartbeat {
|
||||
// SwiftProtobuf.Message conformance is added in an extension below. See the
|
||||
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
|
||||
// methods supported on all messages.
|
||||
|
||||
///
|
||||
/// Number of that will be sent to the client
|
||||
var period: UInt32 = 0
|
||||
|
||||
///
|
||||
/// If set, this is not the primary Store & Forward router on the mesh
|
||||
var secondary: UInt32 = 0
|
||||
|
||||
var unknownFields = SwiftProtobuf.UnknownStorage()
|
||||
|
||||
init() {}
|
||||
|
|
@ -200,27 +249,29 @@ struct StoreAndForwardMessage {
|
|||
|
||||
init() {}
|
||||
|
||||
fileprivate var _stats: StoreAndForwardMessage.Statistics?
|
||||
fileprivate var _history: StoreAndForwardMessage.History?
|
||||
fileprivate var _stats: StoreAndForward.Statistics? = nil
|
||||
fileprivate var _history: StoreAndForward.History? = nil
|
||||
fileprivate var _heartbeat: StoreAndForward.Heartbeat? = nil
|
||||
}
|
||||
|
||||
#if swift(>=4.2)
|
||||
|
||||
extension StoreAndForwardMessage.RequestResponse: CaseIterable {
|
||||
extension StoreAndForward.RequestResponse: CaseIterable {
|
||||
// The compiler won't synthesize support with the UNRECOGNIZED case.
|
||||
static var allCases: [StoreAndForwardMessage.RequestResponse] = [
|
||||
static var allCases: [StoreAndForward.RequestResponse] = [
|
||||
.unset,
|
||||
.routerError,
|
||||
.routerHeartbeat,
|
||||
.routerPing,
|
||||
.routerPong,
|
||||
.routerBusy,
|
||||
.routerHistory,
|
||||
.clientError,
|
||||
.clientHistory,
|
||||
.clientStats,
|
||||
.clientPing,
|
||||
.clientPong,
|
||||
.max
|
||||
.clientAbort,
|
||||
]
|
||||
}
|
||||
|
||||
|
|
@ -228,12 +279,13 @@ extension StoreAndForwardMessage.RequestResponse: CaseIterable {
|
|||
|
||||
// MARK: - Code below here is support for the SwiftProtobuf runtime.
|
||||
|
||||
extension StoreAndForwardMessage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
|
||||
static let protoMessageName: String = "StoreAndForwardMessage"
|
||||
extension StoreAndForward: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
|
||||
static let protoMessageName: String = "StoreAndForward"
|
||||
static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
||||
1: .same(proto: "rr"),
|
||||
2: .same(proto: "stats"),
|
||||
3: .same(proto: "history")
|
||||
3: .same(proto: "history"),
|
||||
4: .same(proto: "heartbeat"),
|
||||
]
|
||||
|
||||
mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
|
||||
|
|
@ -245,38 +297,39 @@ extension StoreAndForwardMessage: SwiftProtobuf.Message, SwiftProtobuf._MessageI
|
|||
case 1: try { try decoder.decodeSingularEnumField(value: &self.rr) }()
|
||||
case 2: try { try decoder.decodeSingularMessageField(value: &self._stats) }()
|
||||
case 3: try { try decoder.decodeSingularMessageField(value: &self._history) }()
|
||||
case 4: try { try decoder.decodeSingularMessageField(value: &self._heartbeat) }()
|
||||
default: break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
|
||||
// The use of inline closures is to circumvent an issue where the compiler
|
||||
// allocates stack space for every if/case branch local when no optimizations
|
||||
// are enabled. https://github.com/apple/swift-protobuf/issues/1034 and
|
||||
// https://github.com/apple/swift-protobuf/issues/1182
|
||||
if self.rr != .unset {
|
||||
try visitor.visitSingularEnumField(value: self.rr, fieldNumber: 1)
|
||||
}
|
||||
try { if let v = self._stats {
|
||||
if let v = self._stats {
|
||||
try visitor.visitSingularMessageField(value: v, fieldNumber: 2)
|
||||
} }()
|
||||
try { if let v = self._history {
|
||||
}
|
||||
if let v = self._history {
|
||||
try visitor.visitSingularMessageField(value: v, fieldNumber: 3)
|
||||
} }()
|
||||
}
|
||||
if let v = self._heartbeat {
|
||||
try visitor.visitSingularMessageField(value: v, fieldNumber: 4)
|
||||
}
|
||||
try unknownFields.traverse(visitor: &visitor)
|
||||
}
|
||||
|
||||
static func ==(lhs: StoreAndForwardMessage, rhs: StoreAndForwardMessage) -> Bool {
|
||||
static func ==(lhs: StoreAndForward, rhs: StoreAndForward) -> Bool {
|
||||
if lhs.rr != rhs.rr {return false}
|
||||
if lhs._stats != rhs._stats {return false}
|
||||
if lhs._history != rhs._history {return false}
|
||||
if lhs._heartbeat != rhs._heartbeat {return false}
|
||||
if lhs.unknownFields != rhs.unknownFields {return false}
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
extension StoreAndForwardMessage.RequestResponse: SwiftProtobuf._ProtoNameProviding {
|
||||
extension StoreAndForward.RequestResponse: SwiftProtobuf._ProtoNameProviding {
|
||||
static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
||||
0: .same(proto: "UNSET"),
|
||||
1: .same(proto: "ROUTER_ERROR"),
|
||||
|
|
@ -284,27 +337,28 @@ extension StoreAndForwardMessage.RequestResponse: SwiftProtobuf._ProtoNameProvid
|
|||
3: .same(proto: "ROUTER_PING"),
|
||||
4: .same(proto: "ROUTER_PONG"),
|
||||
5: .same(proto: "ROUTER_BUSY"),
|
||||
6: .same(proto: "ROUTER_HISTORY"),
|
||||
101: .same(proto: "CLIENT_ERROR"),
|
||||
102: .same(proto: "CLIENT_HISTORY"),
|
||||
103: .same(proto: "CLIENT_STATS"),
|
||||
104: .same(proto: "CLIENT_PING"),
|
||||
105: .same(proto: "CLIENT_PONG"),
|
||||
255: .same(proto: "MAX")
|
||||
106: .same(proto: "CLIENT_ABORT"),
|
||||
]
|
||||
}
|
||||
|
||||
extension StoreAndForwardMessage.Statistics: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
|
||||
static let protoMessageName: String = StoreAndForwardMessage.protoMessageName + ".Statistics"
|
||||
extension StoreAndForward.Statistics: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
|
||||
static let protoMessageName: String = StoreAndForward.protoMessageName + ".Statistics"
|
||||
static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
||||
1: .same(proto: "MessagesTotal"),
|
||||
2: .same(proto: "MessagesSaved"),
|
||||
3: .same(proto: "MessagesMax"),
|
||||
4: .same(proto: "UpTime"),
|
||||
5: .same(proto: "Requests"),
|
||||
6: .same(proto: "RequestsHistory"),
|
||||
7: .same(proto: "Heartbeat"),
|
||||
8: .same(proto: "ReturnMax"),
|
||||
9: .same(proto: "ReturnWindow")
|
||||
1: .standard(proto: "messages_total"),
|
||||
2: .standard(proto: "messages_saved"),
|
||||
3: .standard(proto: "messages_max"),
|
||||
4: .standard(proto: "up_time"),
|
||||
5: .same(proto: "requests"),
|
||||
6: .standard(proto: "requests_history"),
|
||||
7: .same(proto: "heartbeat"),
|
||||
8: .standard(proto: "return_max"),
|
||||
9: .standard(proto: "return_window"),
|
||||
]
|
||||
|
||||
mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
|
||||
|
|
@ -358,7 +412,7 @@ extension StoreAndForwardMessage.Statistics: SwiftProtobuf.Message, SwiftProtobu
|
|||
try unknownFields.traverse(visitor: &visitor)
|
||||
}
|
||||
|
||||
static func ==(lhs: StoreAndForwardMessage.Statistics, rhs: StoreAndForwardMessage.Statistics) -> Bool {
|
||||
static func ==(lhs: StoreAndForward.Statistics, rhs: StoreAndForward.Statistics) -> Bool {
|
||||
if lhs.messagesTotal != rhs.messagesTotal {return false}
|
||||
if lhs.messagesSaved != rhs.messagesSaved {return false}
|
||||
if lhs.messagesMax != rhs.messagesMax {return false}
|
||||
|
|
@ -373,11 +427,12 @@ extension StoreAndForwardMessage.Statistics: SwiftProtobuf.Message, SwiftProtobu
|
|||
}
|
||||
}
|
||||
|
||||
extension StoreAndForwardMessage.History: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
|
||||
static let protoMessageName: String = StoreAndForwardMessage.protoMessageName + ".History"
|
||||
extension StoreAndForward.History: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
|
||||
static let protoMessageName: String = StoreAndForward.protoMessageName + ".History"
|
||||
static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
||||
1: .same(proto: "HistoryMessages"),
|
||||
2: .same(proto: "Window")
|
||||
1: .standard(proto: "history_messages"),
|
||||
2: .same(proto: "window"),
|
||||
3: .standard(proto: "last_request"),
|
||||
]
|
||||
|
||||
mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
|
||||
|
|
@ -388,6 +443,7 @@ extension StoreAndForwardMessage.History: SwiftProtobuf.Message, SwiftProtobuf._
|
|||
switch fieldNumber {
|
||||
case 1: try { try decoder.decodeSingularUInt32Field(value: &self.historyMessages) }()
|
||||
case 2: try { try decoder.decodeSingularUInt32Field(value: &self.window) }()
|
||||
case 3: try { try decoder.decodeSingularUInt32Field(value: &self.lastRequest) }()
|
||||
default: break
|
||||
}
|
||||
}
|
||||
|
|
@ -400,12 +456,54 @@ extension StoreAndForwardMessage.History: SwiftProtobuf.Message, SwiftProtobuf._
|
|||
if self.window != 0 {
|
||||
try visitor.visitSingularUInt32Field(value: self.window, fieldNumber: 2)
|
||||
}
|
||||
if self.lastRequest != 0 {
|
||||
try visitor.visitSingularUInt32Field(value: self.lastRequest, fieldNumber: 3)
|
||||
}
|
||||
try unknownFields.traverse(visitor: &visitor)
|
||||
}
|
||||
|
||||
static func ==(lhs: StoreAndForwardMessage.History, rhs: StoreAndForwardMessage.History) -> Bool {
|
||||
static func ==(lhs: StoreAndForward.History, rhs: StoreAndForward.History) -> Bool {
|
||||
if lhs.historyMessages != rhs.historyMessages {return false}
|
||||
if lhs.window != rhs.window {return false}
|
||||
if lhs.lastRequest != rhs.lastRequest {return false}
|
||||
if lhs.unknownFields != rhs.unknownFields {return false}
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
extension StoreAndForward.Heartbeat: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
|
||||
static let protoMessageName: String = StoreAndForward.protoMessageName + ".Heartbeat"
|
||||
static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
||||
1: .same(proto: "period"),
|
||||
2: .same(proto: "secondary"),
|
||||
]
|
||||
|
||||
mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
|
||||
while let fieldNumber = try decoder.nextFieldNumber() {
|
||||
// The use of inline closures is to circumvent an issue where the compiler
|
||||
// allocates stack space for every case branch when no optimizations are
|
||||
// enabled. https://github.com/apple/swift-protobuf/issues/1034
|
||||
switch fieldNumber {
|
||||
case 1: try { try decoder.decodeSingularUInt32Field(value: &self.period) }()
|
||||
case 2: try { try decoder.decodeSingularUInt32Field(value: &self.secondary) }()
|
||||
default: break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
|
||||
if self.period != 0 {
|
||||
try visitor.visitSingularUInt32Field(value: self.period, fieldNumber: 1)
|
||||
}
|
||||
if self.secondary != 0 {
|
||||
try visitor.visitSingularUInt32Field(value: self.secondary, fieldNumber: 2)
|
||||
}
|
||||
try unknownFields.traverse(visitor: &visitor)
|
||||
}
|
||||
|
||||
static func ==(lhs: StoreAndForward.Heartbeat, rhs: StoreAndForward.Heartbeat) -> Bool {
|
||||
if lhs.period != rhs.period {return false}
|
||||
if lhs.secondary != rhs.secondary {return false}
|
||||
if lhs.unknownFields != rhs.unknownFields {return false}
|
||||
return true
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,8 +16,8 @@ struct Channels: View {
|
|||
|
||||
HStack {
|
||||
|
||||
Image(systemName: "dial.max.fill")
|
||||
.font(.system(size: 62))
|
||||
Image(systemName: "megaphone.fill")
|
||||
.font(.largeTitle)
|
||||
.symbolRenderingMode(.hierarchical)
|
||||
.padding(.trailing)
|
||||
.foregroundColor(.accentColor)
|
||||
|
|
|
|||
|
|
@ -175,19 +175,11 @@ struct Messages: View {
|
|||
.padding(.bottom, 15)
|
||||
|
||||
Button(action: {
|
||||
if bleManager.sendMessage(message: typingMessage, toUserNum: Int64(self.bleManager.broadcastNodeNum)) {
|
||||
if self.bleManager.sendMessage(message: typingMessage, toUserNum: Int64(self.bleManager.broadcastNodeNum)) {
|
||||
typingMessage = ""
|
||||
focusedField = nil
|
||||
} else {
|
||||
|
||||
_ = Timer.scheduledTimer(withTimeInterval: 3.0, repeats: false) { (_) in
|
||||
|
||||
if bleManager.sendMessage(message: typingMessage, toUserNum: Int64(self.bleManager.broadcastNodeNum)) {
|
||||
typingMessage = ""
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}) {
|
||||
Image(systemName: "arrow.up.circle.fill").font(.largeTitle).foregroundColor(.blue)
|
||||
}
|
||||
|
|
@ -203,9 +195,9 @@ struct Messages: View {
|
|||
ZStack {
|
||||
|
||||
ConnectedDevice(
|
||||
bluetoothOn: bleManager.isSwitchedOn,
|
||||
deviceConnected: bleManager.connectedPeripheral != nil,
|
||||
name: (bleManager.connectedPeripheral != nil) ? bleManager.connectedPeripheral.shortName : "???")
|
||||
bluetoothOn: self.bleManager.isSwitchedOn,
|
||||
deviceConnected: self.bleManager.connectedPeripheral != nil,
|
||||
name: (self.bleManager.connectedPeripheral != nil) ? self.bleManager.connectedPeripheral.shortName : "???")
|
||||
}
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,24 +25,15 @@ struct NodeMap: View {
|
|||
|
||||
private var locationNodes: FetchedResults<NodeInfoEntity>
|
||||
|
||||
var annotations: [MapLocation] = [MapLocation]()
|
||||
|
||||
var body: some View {
|
||||
|
||||
let location = LocationHelper.currentLocation
|
||||
let currentCoordinatePosition = CLLocationCoordinate2D(latitude: location.latitude, longitude: location.longitude)
|
||||
let regionBinding = Binding<MKCoordinateRegion>(
|
||||
get: {
|
||||
MKCoordinateRegion(center: currentCoordinatePosition, span: MKCoordinateSpan(latitudeDelta: 0.0359, longitudeDelta: 0.0359))
|
||||
},
|
||||
set: { _ in }
|
||||
)
|
||||
|
||||
NavigationView {
|
||||
|
||||
ZStack {
|
||||
|
||||
MapView(nodes: self.locationNodes)// .environmentObject(userSettings)
|
||||
MapView(nodes: self.locationNodes)//.environmentObject(bleManager)
|
||||
// }
|
||||
.frame(maxHeight: .infinity)
|
||||
.ignoresSafeArea(.all, edges: [.leading, .trailing])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue