Photo updates

This commit is contained in:
Garth Vander Houwen 2022-08-15 19:40:46 -07:00
parent 543fc09876
commit ed437a450b
6 changed files with 287 additions and 488 deletions

View file

@ -1225,7 +1225,7 @@ class BLEManager: NSObject, ObservableObject, CBCentralManagerDelegate, CBPeriph
public func saveCannedMessageModuleMessages(messages: String, fromUser: UserEntity, toUser: UserEntity, wantResponse: Bool) -> Int64 {
var adminPacket = AdminMessage()
adminPacket.setCannedMessageModulePart1 = messages
adminPacket.setCannedMessageModuleMessages = messages
var meshPacket: MeshPacket = MeshPacket()
meshPacket.to = UInt32(toUser.num)
@ -1254,7 +1254,7 @@ class BLEManager: NSObject, ObservableObject, CBCentralManagerDelegate, CBPeriph
public func getCannedMessageModuleMessages(destNum: Int64, wantResponse: Bool) -> Bool {
var adminPacket = AdminMessage()
adminPacket.getCannedMessageModulePart1Request = true
adminPacket.getCannedMessageModuleMessagesRequest = true
var meshPacket: MeshPacket = MeshPacket()
meshPacket.to = UInt32(connectedPeripheral.num)

View file

@ -233,123 +233,33 @@ struct AdminMessage {
}
///
/// Get the Canned Message Module message part1 in the response to this message.
var getCannedMessageModulePart1Request: Bool {
/// Get the Canned Message Module messages in the response to this message.
var getCannedMessageModuleMessagesRequest: Bool {
get {
if case .getCannedMessageModulePart1Request(let v)? = variant {return v}
if case .getCannedMessageModuleMessagesRequest(let v)? = variant {return v}
return false
}
set {variant = .getCannedMessageModulePart1Request(newValue)}
set {variant = .getCannedMessageModuleMessagesRequest(newValue)}
}
///
/// TODO: REPLACE
var getCannedMessageModulePart1Response: String {
/// Get the Canned Message Module messages in the response to this message.
var getCannedMessageModuleMessagesResponse: String {
get {
if case .getCannedMessageModulePart1Response(let v)? = variant {return v}
if case .getCannedMessageModuleMessagesResponse(let v)? = variant {return v}
return String()
}
set {variant = .getCannedMessageModulePart1Response(newValue)}
set {variant = .getCannedMessageModuleMessagesResponse(newValue)}
}
///
/// Get the Canned Message Module message part2 in the response to this message.
var getCannedMessageModulePart2Request: Bool {
/// Set the Canned Message Module messages text.
var setCannedMessageModuleMessages: String {
get {
if case .getCannedMessageModulePart2Request(let v)? = variant {return v}
return false
}
set {variant = .getCannedMessageModulePart2Request(newValue)}
}
///
/// TODO: REPLACE
var getCannedMessageModulePart2Response: String {
get {
if case .getCannedMessageModulePart2Response(let v)? = variant {return v}
if case .setCannedMessageModuleMessages(let v)? = variant {return v}
return String()
}
set {variant = .getCannedMessageModulePart2Response(newValue)}
}
///
/// Get the Canned Message Module message part3 in the response to this message.
var getCannedMessageModulePart3Request: Bool {
get {
if case .getCannedMessageModulePart3Request(let v)? = variant {return v}
return false
}
set {variant = .getCannedMessageModulePart3Request(newValue)}
}
///
/// TODO: REPLACE
var getCannedMessageModulePart3Response: String {
get {
if case .getCannedMessageModulePart3Response(let v)? = variant {return v}
return String()
}
set {variant = .getCannedMessageModulePart3Response(newValue)}
}
///
/// Get the Canned Message Module message part4 in the response to this message.
var getCannedMessageModulePart4Request: Bool {
get {
if case .getCannedMessageModulePart4Request(let v)? = variant {return v}
return false
}
set {variant = .getCannedMessageModulePart4Request(newValue)}
}
///
/// TODO: REPLACE
var getCannedMessageModulePart4Response: String {
get {
if case .getCannedMessageModulePart4Response(let v)? = variant {return v}
return String()
}
set {variant = .getCannedMessageModulePart4Response(newValue)}
}
///
/// Set the canned message module part 1 text.
var setCannedMessageModulePart1: String {
get {
if case .setCannedMessageModulePart1(let v)? = variant {return v}
return String()
}
set {variant = .setCannedMessageModulePart1(newValue)}
}
///
/// Set the canned message module part 2 text.
var setCannedMessageModulePart2: String {
get {
if case .setCannedMessageModulePart2(let v)? = variant {return v}
return String()
}
set {variant = .setCannedMessageModulePart2(newValue)}
}
///
/// Set the canned message module part 3 text.
var setCannedMessageModulePart3: String {
get {
if case .setCannedMessageModulePart3(let v)? = variant {return v}
return String()
}
set {variant = .setCannedMessageModulePart3(newValue)}
}
///
/// Set the canned message module part 4 text.
var setCannedMessageModulePart4: String {
get {
if case .setCannedMessageModulePart4(let v)? = variant {return v}
return String()
}
set {variant = .setCannedMessageModulePart4(newValue)}
set {variant = .setCannedMessageModuleMessages(newValue)}
}
///
@ -454,41 +364,14 @@ struct AdminMessage {
/// Tell the node to reboot in this many seconds (or <0 to cancel reboot)
case rebootSeconds(Int32)
///
/// Get the Canned Message Module message part1 in the response to this message.
case getCannedMessageModulePart1Request(Bool)
/// Get the Canned Message Module messages in the response to this message.
case getCannedMessageModuleMessagesRequest(Bool)
///
/// TODO: REPLACE
case getCannedMessageModulePart1Response(String)
/// Get the Canned Message Module messages in the response to this message.
case getCannedMessageModuleMessagesResponse(String)
///
/// Get the Canned Message Module message part2 in the response to this message.
case getCannedMessageModulePart2Request(Bool)
///
/// TODO: REPLACE
case getCannedMessageModulePart2Response(String)
///
/// Get the Canned Message Module message part3 in the response to this message.
case getCannedMessageModulePart3Request(Bool)
///
/// TODO: REPLACE
case getCannedMessageModulePart3Response(String)
///
/// Get the Canned Message Module message part4 in the response to this message.
case getCannedMessageModulePart4Request(Bool)
///
/// TODO: REPLACE
case getCannedMessageModulePart4Response(String)
///
/// Set the canned message module part 1 text.
case setCannedMessageModulePart1(String)
///
/// Set the canned message module part 2 text.
case setCannedMessageModulePart2(String)
///
/// Set the canned message module part 3 text.
case setCannedMessageModulePart3(String)
///
/// Set the canned message module part 4 text.
case setCannedMessageModulePart4(String)
/// Set the Canned Message Module messages text.
case setCannedMessageModuleMessages(String)
///
/// Tell the node to shutdown in this many seconds (or <0 to cancel shutdown)
case shutdownSeconds(Int32)
@ -581,52 +464,16 @@ struct AdminMessage {
guard case .rebootSeconds(let l) = lhs, case .rebootSeconds(let r) = rhs else { preconditionFailure() }
return l == r
}()
case (.getCannedMessageModulePart1Request, .getCannedMessageModulePart1Request): return {
guard case .getCannedMessageModulePart1Request(let l) = lhs, case .getCannedMessageModulePart1Request(let r) = rhs else { preconditionFailure() }
case (.getCannedMessageModuleMessagesRequest, .getCannedMessageModuleMessagesRequest): return {
guard case .getCannedMessageModuleMessagesRequest(let l) = lhs, case .getCannedMessageModuleMessagesRequest(let r) = rhs else { preconditionFailure() }
return l == r
}()
case (.getCannedMessageModulePart1Response, .getCannedMessageModulePart1Response): return {
guard case .getCannedMessageModulePart1Response(let l) = lhs, case .getCannedMessageModulePart1Response(let r) = rhs else { preconditionFailure() }
case (.getCannedMessageModuleMessagesResponse, .getCannedMessageModuleMessagesResponse): return {
guard case .getCannedMessageModuleMessagesResponse(let l) = lhs, case .getCannedMessageModuleMessagesResponse(let r) = rhs else { preconditionFailure() }
return l == r
}()
case (.getCannedMessageModulePart2Request, .getCannedMessageModulePart2Request): return {
guard case .getCannedMessageModulePart2Request(let l) = lhs, case .getCannedMessageModulePart2Request(let r) = rhs else { preconditionFailure() }
return l == r
}()
case (.getCannedMessageModulePart2Response, .getCannedMessageModulePart2Response): return {
guard case .getCannedMessageModulePart2Response(let l) = lhs, case .getCannedMessageModulePart2Response(let r) = rhs else { preconditionFailure() }
return l == r
}()
case (.getCannedMessageModulePart3Request, .getCannedMessageModulePart3Request): return {
guard case .getCannedMessageModulePart3Request(let l) = lhs, case .getCannedMessageModulePart3Request(let r) = rhs else { preconditionFailure() }
return l == r
}()
case (.getCannedMessageModulePart3Response, .getCannedMessageModulePart3Response): return {
guard case .getCannedMessageModulePart3Response(let l) = lhs, case .getCannedMessageModulePart3Response(let r) = rhs else { preconditionFailure() }
return l == r
}()
case (.getCannedMessageModulePart4Request, .getCannedMessageModulePart4Request): return {
guard case .getCannedMessageModulePart4Request(let l) = lhs, case .getCannedMessageModulePart4Request(let r) = rhs else { preconditionFailure() }
return l == r
}()
case (.getCannedMessageModulePart4Response, .getCannedMessageModulePart4Response): return {
guard case .getCannedMessageModulePart4Response(let l) = lhs, case .getCannedMessageModulePart4Response(let r) = rhs else { preconditionFailure() }
return l == r
}()
case (.setCannedMessageModulePart1, .setCannedMessageModulePart1): return {
guard case .setCannedMessageModulePart1(let l) = lhs, case .setCannedMessageModulePart1(let r) = rhs else { preconditionFailure() }
return l == r
}()
case (.setCannedMessageModulePart2, .setCannedMessageModulePart2): return {
guard case .setCannedMessageModulePart2(let l) = lhs, case .setCannedMessageModulePart2(let r) = rhs else { preconditionFailure() }
return l == r
}()
case (.setCannedMessageModulePart3, .setCannedMessageModulePart3): return {
guard case .setCannedMessageModulePart3(let l) = lhs, case .setCannedMessageModulePart3(let r) = rhs else { preconditionFailure() }
return l == r
}()
case (.setCannedMessageModulePart4, .setCannedMessageModulePart4): return {
guard case .setCannedMessageModulePart4(let l) = lhs, case .setCannedMessageModulePart4(let r) = rhs else { preconditionFailure() }
case (.setCannedMessageModuleMessages, .setCannedMessageModuleMessages): return {
guard case .setCannedMessageModuleMessages(let l) = lhs, case .setCannedMessageModuleMessages(let r) = rhs else { preconditionFailure() }
return l == r
}()
case (.shutdownSeconds, .shutdownSeconds): return {
@ -675,6 +522,10 @@ struct AdminMessage {
///
/// TODO: REPLACE
case loraConfig // = 5
///
/// TODO: REPLACE
case bluetoothConfig // = 6
case UNRECOGNIZED(Int)
init() {
@ -689,6 +540,7 @@ struct AdminMessage {
case 3: self = .wifiConfig
case 4: self = .displayConfig
case 5: self = .loraConfig
case 6: self = .bluetoothConfig
default: self = .UNRECOGNIZED(rawValue)
}
}
@ -701,6 +553,7 @@ struct AdminMessage {
case .wifiConfig: return 3
case .displayConfig: return 4
case .loraConfig: return 5
case .bluetoothConfig: return 6
case .UNRECOGNIZED(let i): return i
}
}
@ -787,6 +640,7 @@ extension AdminMessage.ConfigType: CaseIterable {
.wifiConfig,
.displayConfig,
.loraConfig,
.bluetoothConfig,
]
}
@ -836,18 +690,9 @@ extension AdminMessage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementat
33: .standard(proto: "confirm_set_radio"),
34: .standard(proto: "exit_simulator"),
35: .standard(proto: "reboot_seconds"),
36: .standard(proto: "get_canned_message_module_part1_request"),
37: .standard(proto: "get_canned_message_module_part1_response"),
38: .standard(proto: "get_canned_message_module_part2_request"),
39: .standard(proto: "get_canned_message_module_part2_response"),
40: .standard(proto: "get_canned_message_module_part3_request"),
41: .standard(proto: "get_canned_message_module_part3_response"),
42: .standard(proto: "get_canned_message_module_part4_request"),
43: .standard(proto: "get_canned_message_module_part4_response"),
44: .standard(proto: "set_canned_message_module_part1"),
45: .standard(proto: "set_canned_message_module_part2"),
46: .standard(proto: "set_canned_message_module_part3"),
47: .standard(proto: "set_canned_message_module_part4"),
36: .standard(proto: "get_canned_message_module_messages_request"),
37: .standard(proto: "get_canned_message_module_messages_response"),
44: .standard(proto: "set_canned_message_module_messages"),
51: .standard(proto: "shutdown_seconds"),
52: .standard(proto: "get_device_metadata_request"),
53: .standard(proto: "get_device_metadata_response"),
@ -1056,7 +901,7 @@ extension AdminMessage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementat
try decoder.decodeSingularBoolField(value: &v)
if let v = v {
if self.variant != nil {try decoder.handleConflictingOneOf()}
self.variant = .getCannedMessageModulePart1Request(v)
self.variant = .getCannedMessageModuleMessagesRequest(v)
}
}()
case 37: try {
@ -1064,55 +909,7 @@ extension AdminMessage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementat
try decoder.decodeSingularStringField(value: &v)
if let v = v {
if self.variant != nil {try decoder.handleConflictingOneOf()}
self.variant = .getCannedMessageModulePart1Response(v)
}
}()
case 38: try {
var v: Bool?
try decoder.decodeSingularBoolField(value: &v)
if let v = v {
if self.variant != nil {try decoder.handleConflictingOneOf()}
self.variant = .getCannedMessageModulePart2Request(v)
}
}()
case 39: try {
var v: String?
try decoder.decodeSingularStringField(value: &v)
if let v = v {
if self.variant != nil {try decoder.handleConflictingOneOf()}
self.variant = .getCannedMessageModulePart2Response(v)
}
}()
case 40: try {
var v: Bool?
try decoder.decodeSingularBoolField(value: &v)
if let v = v {
if self.variant != nil {try decoder.handleConflictingOneOf()}
self.variant = .getCannedMessageModulePart3Request(v)
}
}()
case 41: try {
var v: String?
try decoder.decodeSingularStringField(value: &v)
if let v = v {
if self.variant != nil {try decoder.handleConflictingOneOf()}
self.variant = .getCannedMessageModulePart3Response(v)
}
}()
case 42: try {
var v: Bool?
try decoder.decodeSingularBoolField(value: &v)
if let v = v {
if self.variant != nil {try decoder.handleConflictingOneOf()}
self.variant = .getCannedMessageModulePart4Request(v)
}
}()
case 43: try {
var v: String?
try decoder.decodeSingularStringField(value: &v)
if let v = v {
if self.variant != nil {try decoder.handleConflictingOneOf()}
self.variant = .getCannedMessageModulePart4Response(v)
self.variant = .getCannedMessageModuleMessagesResponse(v)
}
}()
case 44: try {
@ -1120,31 +917,7 @@ extension AdminMessage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementat
try decoder.decodeSingularStringField(value: &v)
if let v = v {
if self.variant != nil {try decoder.handleConflictingOneOf()}
self.variant = .setCannedMessageModulePart1(v)
}
}()
case 45: try {
var v: String?
try decoder.decodeSingularStringField(value: &v)
if let v = v {
if self.variant != nil {try decoder.handleConflictingOneOf()}
self.variant = .setCannedMessageModulePart2(v)
}
}()
case 46: try {
var v: String?
try decoder.decodeSingularStringField(value: &v)
if let v = v {
if self.variant != nil {try decoder.handleConflictingOneOf()}
self.variant = .setCannedMessageModulePart3(v)
}
}()
case 47: try {
var v: String?
try decoder.decodeSingularStringField(value: &v)
if let v = v {
if self.variant != nil {try decoder.handleConflictingOneOf()}
self.variant = .setCannedMessageModulePart4(v)
self.variant = .setCannedMessageModuleMessages(v)
}
}()
case 51: try {
@ -1263,54 +1036,18 @@ extension AdminMessage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementat
guard case .rebootSeconds(let v)? = self.variant else { preconditionFailure() }
try visitor.visitSingularInt32Field(value: v, fieldNumber: 35)
}()
case .getCannedMessageModulePart1Request?: try {
guard case .getCannedMessageModulePart1Request(let v)? = self.variant else { preconditionFailure() }
case .getCannedMessageModuleMessagesRequest?: try {
guard case .getCannedMessageModuleMessagesRequest(let v)? = self.variant else { preconditionFailure() }
try visitor.visitSingularBoolField(value: v, fieldNumber: 36)
}()
case .getCannedMessageModulePart1Response?: try {
guard case .getCannedMessageModulePart1Response(let v)? = self.variant else { preconditionFailure() }
case .getCannedMessageModuleMessagesResponse?: try {
guard case .getCannedMessageModuleMessagesResponse(let v)? = self.variant else { preconditionFailure() }
try visitor.visitSingularStringField(value: v, fieldNumber: 37)
}()
case .getCannedMessageModulePart2Request?: try {
guard case .getCannedMessageModulePart2Request(let v)? = self.variant else { preconditionFailure() }
try visitor.visitSingularBoolField(value: v, fieldNumber: 38)
}()
case .getCannedMessageModulePart2Response?: try {
guard case .getCannedMessageModulePart2Response(let v)? = self.variant else { preconditionFailure() }
try visitor.visitSingularStringField(value: v, fieldNumber: 39)
}()
case .getCannedMessageModulePart3Request?: try {
guard case .getCannedMessageModulePart3Request(let v)? = self.variant else { preconditionFailure() }
try visitor.visitSingularBoolField(value: v, fieldNumber: 40)
}()
case .getCannedMessageModulePart3Response?: try {
guard case .getCannedMessageModulePart3Response(let v)? = self.variant else { preconditionFailure() }
try visitor.visitSingularStringField(value: v, fieldNumber: 41)
}()
case .getCannedMessageModulePart4Request?: try {
guard case .getCannedMessageModulePart4Request(let v)? = self.variant else { preconditionFailure() }
try visitor.visitSingularBoolField(value: v, fieldNumber: 42)
}()
case .getCannedMessageModulePart4Response?: try {
guard case .getCannedMessageModulePart4Response(let v)? = self.variant else { preconditionFailure() }
try visitor.visitSingularStringField(value: v, fieldNumber: 43)
}()
case .setCannedMessageModulePart1?: try {
guard case .setCannedMessageModulePart1(let v)? = self.variant else { preconditionFailure() }
case .setCannedMessageModuleMessages?: try {
guard case .setCannedMessageModuleMessages(let v)? = self.variant else { preconditionFailure() }
try visitor.visitSingularStringField(value: v, fieldNumber: 44)
}()
case .setCannedMessageModulePart2?: try {
guard case .setCannedMessageModulePart2(let v)? = self.variant else { preconditionFailure() }
try visitor.visitSingularStringField(value: v, fieldNumber: 45)
}()
case .setCannedMessageModulePart3?: try {
guard case .setCannedMessageModulePart3(let v)? = self.variant else { preconditionFailure() }
try visitor.visitSingularStringField(value: v, fieldNumber: 46)
}()
case .setCannedMessageModulePart4?: try {
guard case .setCannedMessageModulePart4(let v)? = self.variant else { preconditionFailure() }
try visitor.visitSingularStringField(value: v, fieldNumber: 47)
}()
case .shutdownSeconds?: try {
guard case .shutdownSeconds(let v)? = self.variant else { preconditionFailure() }
try visitor.visitSingularInt32Field(value: v, fieldNumber: 51)
@ -1343,6 +1080,7 @@ extension AdminMessage.ConfigType: SwiftProtobuf._ProtoNameProviding {
3: .same(proto: "WIFI_CONFIG"),
4: .same(proto: "DISPLAY_CONFIG"),
5: .same(proto: "LORA_CONFIG"),
6: .same(proto: "BLUETOOTH_CONFIG"),
]
}

View file

@ -29,19 +29,7 @@ struct CannedMessageModuleConfig {
///
/// Predefined messages for canned message module separated by '|' characters.
var messagesPart1: String = String()
///
/// TODO: REPLACE
var messagesPart2: String = String()
///
/// TODO: REPLACE
var messagesPart3: String = String()
///
/// TODO: REPLACE
var messagesPart4: String = String()
var messages: String = String()
var unknownFields = SwiftProtobuf.UnknownStorage()
@ -57,10 +45,7 @@ extension CannedMessageModuleConfig: @unchecked Sendable {}
extension CannedMessageModuleConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
static let protoMessageName: String = "CannedMessageModuleConfig"
static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
11: .same(proto: "messagesPart1"),
12: .same(proto: "messagesPart2"),
13: .same(proto: "messagesPart3"),
14: .same(proto: "messagesPart4"),
1: .same(proto: "messages"),
]
mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
@ -69,36 +54,21 @@ extension CannedMessageModuleConfig: SwiftProtobuf.Message, SwiftProtobuf._Messa
// allocates stack space for every case branch when no optimizations are
// enabled. https://github.com/apple/swift-protobuf/issues/1034
switch fieldNumber {
case 11: try { try decoder.decodeSingularStringField(value: &self.messagesPart1) }()
case 12: try { try decoder.decodeSingularStringField(value: &self.messagesPart2) }()
case 13: try { try decoder.decodeSingularStringField(value: &self.messagesPart3) }()
case 14: try { try decoder.decodeSingularStringField(value: &self.messagesPart4) }()
case 1: try { try decoder.decodeSingularStringField(value: &self.messages) }()
default: break
}
}
}
func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
if !self.messagesPart1.isEmpty {
try visitor.visitSingularStringField(value: self.messagesPart1, fieldNumber: 11)
}
if !self.messagesPart2.isEmpty {
try visitor.visitSingularStringField(value: self.messagesPart2, fieldNumber: 12)
}
if !self.messagesPart3.isEmpty {
try visitor.visitSingularStringField(value: self.messagesPart3, fieldNumber: 13)
}
if !self.messagesPart4.isEmpty {
try visitor.visitSingularStringField(value: self.messagesPart4, fieldNumber: 14)
if !self.messages.isEmpty {
try visitor.visitSingularStringField(value: self.messages, fieldNumber: 1)
}
try unknownFields.traverse(visitor: &visitor)
}
static func ==(lhs: CannedMessageModuleConfig, rhs: CannedMessageModuleConfig) -> Bool {
if lhs.messagesPart1 != rhs.messagesPart1 {return false}
if lhs.messagesPart2 != rhs.messagesPart2 {return false}
if lhs.messagesPart3 != rhs.messagesPart3 {return false}
if lhs.messagesPart4 != rhs.messagesPart4 {return false}
if lhs.messages != rhs.messages {return false}
if lhs.unknownFields != rhs.unknownFields {return false}
return true
}

View file

@ -77,6 +77,14 @@ struct Config {
set {payloadVariant = .lora(newValue)}
}
var bluetooth: Config.BluetoothConfig {
get {
if case .bluetooth(let v)? = payloadVariant {return v}
return Config.BluetoothConfig()
}
set {payloadVariant = .bluetooth(newValue)}
}
var unknownFields = SwiftProtobuf.UnknownStorage()
///
@ -88,6 +96,7 @@ struct Config {
case wifi(Config.WiFiConfig)
case display(Config.DisplayConfig)
case lora(Config.LoRaConfig)
case bluetooth(Config.BluetoothConfig)
#if !swift(>=4.1)
static func ==(lhs: Config.OneOf_PayloadVariant, rhs: Config.OneOf_PayloadVariant) -> Bool {
@ -119,6 +128,10 @@ struct Config {
guard case .lora(let l) = lhs, case .lora(let r) = rhs else { preconditionFailure() }
return l == r
}()
case (.bluetooth, .bluetooth): return {
guard case .bluetooth(let l) = lhs, case .bluetooth(let r) = rhs else { preconditionFailure() }
return l == r
}()
default: return false
}
}
@ -906,6 +919,68 @@ struct Config {
init() {}
}
struct BluetoothConfig {
// 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.
///
/// Enable Bluetooth on the device
var enabled: Bool = false
///
/// Determines the pairing strategy for the device
var mode: Config.BluetoothConfig.PairingMode = .randomPin
///
/// Specified pin for PairingMode.FixedPin
var fixedPin: UInt32 = 0
var unknownFields = SwiftProtobuf.UnknownStorage()
enum PairingMode: SwiftProtobuf.Enum {
typealias RawValue = Int
///
/// Device generates a random pin that will be shown on the screen of the device for pairing
case randomPin // = 0
///
/// Device requires a specified fixed pin for pairing
case fixedPin // = 1
///
/// Device requires no pin for pairing
case noPin // = 2
case UNRECOGNIZED(Int)
init() {
self = .randomPin
}
init?(rawValue: Int) {
switch rawValue {
case 0: self = .randomPin
case 1: self = .fixedPin
case 2: self = .noPin
default: self = .UNRECOGNIZED(rawValue)
}
}
var rawValue: Int {
switch self {
case .randomPin: return 0
case .fixedPin: return 1
case .noPin: return 2
case .UNRECOGNIZED(let i): return i
}
}
}
init() {}
}
init() {}
}
@ -1014,6 +1089,15 @@ extension Config.LoRaConfig.ModemPreset: CaseIterable {
]
}
extension Config.BluetoothConfig.PairingMode: CaseIterable {
// The compiler won't synthesize support with the UNRECOGNIZED case.
static var allCases: [Config.BluetoothConfig.PairingMode] = [
.randomPin,
.fixedPin,
.noPin,
]
}
#endif // swift(>=4.2)
#if swift(>=5.5) && canImport(_Concurrency)
@ -1032,6 +1116,8 @@ extension Config.DisplayConfig.GpsCoordinateFormat: @unchecked Sendable {}
extension Config.LoRaConfig: @unchecked Sendable {}
extension Config.LoRaConfig.RegionCode: @unchecked Sendable {}
extension Config.LoRaConfig.ModemPreset: @unchecked Sendable {}
extension Config.BluetoothConfig: @unchecked Sendable {}
extension Config.BluetoothConfig.PairingMode: @unchecked Sendable {}
#endif // swift(>=5.5) && canImport(_Concurrency)
// MARK: - Code below here is support for the SwiftProtobuf runtime.
@ -1045,6 +1131,7 @@ extension Config: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBas
4: .same(proto: "wifi"),
5: .same(proto: "display"),
6: .same(proto: "lora"),
7: .same(proto: "bluetooth"),
]
mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
@ -1131,6 +1218,19 @@ extension Config: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBas
self.payloadVariant = .lora(v)
}
}()
case 7: try {
var v: Config.BluetoothConfig?
var hadOneofValue = false
if let current = self.payloadVariant {
hadOneofValue = true
if case .bluetooth(let m) = current {v = m}
}
try decoder.decodeSingularMessageField(value: &v)
if let v = v {
if hadOneofValue {try decoder.handleConflictingOneOf()}
self.payloadVariant = .bluetooth(v)
}
}()
default: break
}
}
@ -1166,6 +1266,10 @@ extension Config: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBas
guard case .lora(let v)? = self.payloadVariant else { preconditionFailure() }
try visitor.visitSingularMessageField(value: v, fieldNumber: 6)
}()
case .bluetooth?: try {
guard case .bluetooth(let v)? = self.payloadVariant else { preconditionFailure() }
try visitor.visitSingularMessageField(value: v, fieldNumber: 7)
}()
case nil: break
}
try unknownFields.traverse(visitor: &visitor)
@ -1663,3 +1767,55 @@ extension Config.LoRaConfig.ModemPreset: SwiftProtobuf._ProtoNameProviding {
6: .same(proto: "ShortFast"),
]
}
extension Config.BluetoothConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
static let protoMessageName: String = Config.protoMessageName + ".BluetoothConfig"
static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
1: .same(proto: "enabled"),
2: .same(proto: "mode"),
3: .standard(proto: "fixed_pin"),
]
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.decodeSingularBoolField(value: &self.enabled) }()
case 2: try { try decoder.decodeSingularEnumField(value: &self.mode) }()
case 3: try { try decoder.decodeSingularUInt32Field(value: &self.fixedPin) }()
default: break
}
}
}
func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
if self.enabled != false {
try visitor.visitSingularBoolField(value: self.enabled, fieldNumber: 1)
}
if self.mode != .randomPin {
try visitor.visitSingularEnumField(value: self.mode, fieldNumber: 2)
}
if self.fixedPin != 0 {
try visitor.visitSingularUInt32Field(value: self.fixedPin, fieldNumber: 3)
}
try unknownFields.traverse(visitor: &visitor)
}
static func ==(lhs: Config.BluetoothConfig, rhs: Config.BluetoothConfig) -> Bool {
if lhs.enabled != rhs.enabled {return false}
if lhs.mode != rhs.mode {return false}
if lhs.fixedPin != rhs.fixedPin {return false}
if lhs.unknownFields != rhs.unknownFields {return false}
return true
}
}
extension Config.BluetoothConfig.PairingMode: SwiftProtobuf._ProtoNameProviding {
static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
0: .same(proto: "RandomPin"),
1: .same(proto: "FixedPin"),
2: .same(proto: "NoPin"),
]
}

View file

@ -91,6 +91,17 @@ struct LocalConfig {
/// Clears the value of `lora`. Subsequent reads from it will return its default value.
mutating func clearLora() {_uniqueStorage()._lora = nil}
///
/// The part of the config that is specific to the Bluetooth settings
var bluetooth: Config.BluetoothConfig {
get {return _storage._bluetooth ?? Config.BluetoothConfig()}
set {_uniqueStorage()._bluetooth = newValue}
}
/// Returns true if `bluetooth` has been explicitly set.
var hasBluetooth: Bool {return _storage._bluetooth != nil}
/// Clears the value of `bluetooth`. Subsequent reads from it will return its default value.
mutating func clearBluetooth() {_uniqueStorage()._bluetooth = nil}
///
/// A version integer used to invalidate old save files when we make
/// incompatible changes This integer is set at build time and is private to
@ -221,7 +232,8 @@ extension LocalConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementati
4: .same(proto: "wifi"),
5: .same(proto: "display"),
6: .same(proto: "lora"),
7: .same(proto: "version"),
7: .same(proto: "bluetooth"),
8: .same(proto: "version"),
]
fileprivate class _StorageClass {
@ -231,6 +243,7 @@ extension LocalConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementati
var _wifi: Config.WiFiConfig? = nil
var _display: Config.DisplayConfig? = nil
var _lora: Config.LoRaConfig? = nil
var _bluetooth: Config.BluetoothConfig? = nil
var _version: UInt32 = 0
static let defaultInstance = _StorageClass()
@ -244,6 +257,7 @@ extension LocalConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementati
_wifi = source._wifi
_display = source._display
_lora = source._lora
_bluetooth = source._bluetooth
_version = source._version
}
}
@ -269,7 +283,8 @@ extension LocalConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementati
case 4: try { try decoder.decodeSingularMessageField(value: &_storage._wifi) }()
case 5: try { try decoder.decodeSingularMessageField(value: &_storage._display) }()
case 6: try { try decoder.decodeSingularMessageField(value: &_storage._lora) }()
case 7: try { try decoder.decodeSingularUInt32Field(value: &_storage._version) }()
case 7: try { try decoder.decodeSingularMessageField(value: &_storage._bluetooth) }()
case 8: try { try decoder.decodeSingularUInt32Field(value: &_storage._version) }()
default: break
}
}
@ -300,8 +315,11 @@ extension LocalConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementati
try { if let v = _storage._lora {
try visitor.visitSingularMessageField(value: v, fieldNumber: 6)
} }()
try { if let v = _storage._bluetooth {
try visitor.visitSingularMessageField(value: v, fieldNumber: 7)
} }()
if _storage._version != 0 {
try visitor.visitSingularUInt32Field(value: _storage._version, fieldNumber: 7)
try visitor.visitSingularUInt32Field(value: _storage._version, fieldNumber: 8)
}
}
try unknownFields.traverse(visitor: &visitor)
@ -318,6 +336,7 @@ extension LocalConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementati
if _storage._wifi != rhs_storage._wifi {return false}
if _storage._display != rhs_storage._display {return false}
if _storage._lora != rhs_storage._lora {return false}
if _storage._bluetooth != rhs_storage._bluetooth {return false}
if _storage._version != rhs_storage._version {return false}
return true
}

View file

@ -798,23 +798,6 @@ struct User {
/// Also, "long_name" should be their licence number.
var isLicensed: Bool = false
///
/// Transmit power at antenna connector, in decibel-milliwatt
/// An optional self-reported value useful in network planning, discovery
/// and positioning - along with ant_gain_dbi and ant_azimuth below
var txPowerDbm: UInt32 = 0
///
/// Antenna gain (applicable to both Tx and Rx), in decibel-isotropic
var antGainDbi: UInt32 = 0
///
/// Directional antenna true azimuth *if applicable*, in degrees (0-360)
/// Only applicable in case of stationary nodes with a directional antenna
/// Zero = not applicable (mobile or omni) or not specified
/// (use a value of 360 to indicate an antenna azimuth of zero degrees)
var antAzimuth: UInt32 = 0
var unknownFields = SwiftProtobuf.UnknownStorage()
init() {}
@ -1500,65 +1483,58 @@ struct NodeInfo {
///
/// The node number
var num: UInt32 {
get {return _storage._num}
set {_uniqueStorage()._num = newValue}
}
var num: UInt32 = 0
///
/// The user info for this node
var user: User {
get {return _storage._user ?? User()}
set {_uniqueStorage()._user = newValue}
get {return _user ?? User()}
set {_user = newValue}
}
/// Returns true if `user` has been explicitly set.
var hasUser: Bool {return _storage._user != nil}
var hasUser: Bool {return self._user != nil}
/// Clears the value of `user`. Subsequent reads from it will return its default value.
mutating func clearUser() {_uniqueStorage()._user = nil}
mutating func clearUser() {self._user = nil}
///
/// This position data. Note: before 1.2.14 we would also store the last time we've heard from this node in position.time, that is no longer true.
/// Position.time now indicates the last time we received a POSITION from that node.
var position: Position {
get {return _storage._position ?? Position()}
set {_uniqueStorage()._position = newValue}
get {return _position ?? Position()}
set {_position = newValue}
}
/// Returns true if `position` has been explicitly set.
var hasPosition: Bool {return _storage._position != nil}
var hasPosition: Bool {return self._position != nil}
/// Clears the value of `position`. Subsequent reads from it will return its default value.
mutating func clearPosition() {_uniqueStorage()._position = nil}
mutating func clearPosition() {self._position = nil}
///
/// Returns the Signal-to-noise ratio (SNR) of the last received message,
/// as measured by the receiver. Return SNR of the last received message in dB
var snr: Float {
get {return _storage._snr}
set {_uniqueStorage()._snr = newValue}
}
var snr: Float = 0
///
/// Set to indicate the last time we received a packet from this node
var lastHeard: UInt32 {
get {return _storage._lastHeard}
set {_uniqueStorage()._lastHeard = newValue}
}
var lastHeard: UInt32 = 0
///
/// The latest device metrics for the node.
var deviceMetrics: DeviceMetrics {
get {return _storage._deviceMetrics ?? DeviceMetrics()}
set {_uniqueStorage()._deviceMetrics = newValue}
get {return _deviceMetrics ?? DeviceMetrics()}
set {_deviceMetrics = newValue}
}
/// Returns true if `deviceMetrics` has been explicitly set.
var hasDeviceMetrics: Bool {return _storage._deviceMetrics != nil}
var hasDeviceMetrics: Bool {return self._deviceMetrics != nil}
/// Clears the value of `deviceMetrics`. Subsequent reads from it will return its default value.
mutating func clearDeviceMetrics() {_uniqueStorage()._deviceMetrics = nil}
mutating func clearDeviceMetrics() {self._deviceMetrics = nil}
var unknownFields = SwiftProtobuf.UnknownStorage()
init() {}
fileprivate var _storage = _StorageClass.defaultInstance
fileprivate var _user: User? = nil
fileprivate var _position: Position? = nil
fileprivate var _deviceMetrics: DeviceMetrics? = nil
}
///
@ -2480,9 +2456,6 @@ extension User: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase,
4: .same(proto: "macaddr"),
6: .standard(proto: "hw_model"),
7: .standard(proto: "is_licensed"),
10: .standard(proto: "tx_power_dbm"),
11: .standard(proto: "ant_gain_dbi"),
12: .standard(proto: "ant_azimuth"),
]
mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
@ -2497,9 +2470,6 @@ extension User: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase,
case 4: try { try decoder.decodeSingularBytesField(value: &self.macaddr) }()
case 6: try { try decoder.decodeSingularEnumField(value: &self.hwModel) }()
case 7: try { try decoder.decodeSingularBoolField(value: &self.isLicensed) }()
case 10: try { try decoder.decodeSingularUInt32Field(value: &self.txPowerDbm) }()
case 11: try { try decoder.decodeSingularUInt32Field(value: &self.antGainDbi) }()
case 12: try { try decoder.decodeSingularUInt32Field(value: &self.antAzimuth) }()
default: break
}
}
@ -2524,15 +2494,6 @@ extension User: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase,
if self.isLicensed != false {
try visitor.visitSingularBoolField(value: self.isLicensed, fieldNumber: 7)
}
if self.txPowerDbm != 0 {
try visitor.visitSingularUInt32Field(value: self.txPowerDbm, fieldNumber: 10)
}
if self.antGainDbi != 0 {
try visitor.visitSingularUInt32Field(value: self.antGainDbi, fieldNumber: 11)
}
if self.antAzimuth != 0 {
try visitor.visitSingularUInt32Field(value: self.antAzimuth, fieldNumber: 12)
}
try unknownFields.traverse(visitor: &visitor)
}
@ -2543,9 +2504,6 @@ extension User: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase,
if lhs.macaddr != rhs.macaddr {return false}
if lhs.hwModel != rhs.hwModel {return false}
if lhs.isLicensed != rhs.isLicensed {return false}
if lhs.txPowerDbm != rhs.txPowerDbm {return false}
if lhs.antGainDbi != rhs.antGainDbi {return false}
if lhs.antAzimuth != rhs.antAzimuth {return false}
if lhs.unknownFields != rhs.unknownFields {return false}
return true
}
@ -3050,98 +3008,56 @@ extension NodeInfo: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationB
6: .standard(proto: "device_metrics"),
]
fileprivate class _StorageClass {
var _num: UInt32 = 0
var _user: User? = nil
var _position: Position? = nil
var _snr: Float = 0
var _lastHeard: UInt32 = 0
var _deviceMetrics: DeviceMetrics? = nil
static let defaultInstance = _StorageClass()
private init() {}
init(copying source: _StorageClass) {
_num = source._num
_user = source._user
_position = source._position
_snr = source._snr
_lastHeard = source._lastHeard
_deviceMetrics = source._deviceMetrics
}
}
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.decodeSingularUInt32Field(value: &_storage._num) }()
case 2: try { try decoder.decodeSingularMessageField(value: &_storage._user) }()
case 3: try { try decoder.decodeSingularMessageField(value: &_storage._position) }()
case 4: try { try decoder.decodeSingularFloatField(value: &_storage._snr) }()
case 5: try { try decoder.decodeSingularFixed32Field(value: &_storage._lastHeard) }()
case 6: try { try decoder.decodeSingularMessageField(value: &_storage._deviceMetrics) }()
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.decodeSingularUInt32Field(value: &self.num) }()
case 2: try { try decoder.decodeSingularMessageField(value: &self._user) }()
case 3: try { try decoder.decodeSingularMessageField(value: &self._position) }()
case 4: try { try decoder.decodeSingularFloatField(value: &self.snr) }()
case 5: try { try decoder.decodeSingularFixed32Field(value: &self.lastHeard) }()
case 6: try { try decoder.decodeSingularMessageField(value: &self._deviceMetrics) }()
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
if _storage._num != 0 {
try visitor.visitSingularUInt32Field(value: _storage._num, fieldNumber: 1)
}
try { if let v = _storage._user {
try visitor.visitSingularMessageField(value: v, fieldNumber: 2)
} }()
try { if let v = _storage._position {
try visitor.visitSingularMessageField(value: v, fieldNumber: 3)
} }()
if _storage._snr != 0 {
try visitor.visitSingularFloatField(value: _storage._snr, fieldNumber: 4)
}
if _storage._lastHeard != 0 {
try visitor.visitSingularFixed32Field(value: _storage._lastHeard, fieldNumber: 5)
}
try { if let v = _storage._deviceMetrics {
try visitor.visitSingularMessageField(value: v, fieldNumber: 6)
} }()
// 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.num != 0 {
try visitor.visitSingularUInt32Field(value: self.num, fieldNumber: 1)
}
try { if let v = self._user {
try visitor.visitSingularMessageField(value: v, fieldNumber: 2)
} }()
try { if let v = self._position {
try visitor.visitSingularMessageField(value: v, fieldNumber: 3)
} }()
if self.snr != 0 {
try visitor.visitSingularFloatField(value: self.snr, fieldNumber: 4)
}
if self.lastHeard != 0 {
try visitor.visitSingularFixed32Field(value: self.lastHeard, fieldNumber: 5)
}
try { if let v = self._deviceMetrics {
try visitor.visitSingularMessageField(value: v, fieldNumber: 6)
} }()
try unknownFields.traverse(visitor: &visitor)
}
static func ==(lhs: NodeInfo, rhs: NodeInfo) -> 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._num != rhs_storage._num {return false}
if _storage._user != rhs_storage._user {return false}
if _storage._position != rhs_storage._position {return false}
if _storage._snr != rhs_storage._snr {return false}
if _storage._lastHeard != rhs_storage._lastHeard {return false}
if _storage._deviceMetrics != rhs_storage._deviceMetrics {return false}
return true
}
if !storagesAreEqual {return false}
}
if lhs.num != rhs.num {return false}
if lhs._user != rhs._user {return false}
if lhs._position != rhs._position {return false}
if lhs.snr != rhs.snr {return false}
if lhs.lastHeard != rhs.lastHeard {return false}
if lhs._deviceMetrics != rhs._deviceMetrics {return false}
if lhs.unknownFields != rhs.unknownFields {return false}
return true
}