Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump Protos #736

Merged
merged 1 commit into from
Jun 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions MeshtasticProtobufs/Sources/meshtastic/config.pb.swift
Original file line number Diff line number Diff line change
Expand Up @@ -630,6 +630,11 @@ public struct Config {
/// I2C address of INA_2XX to use for reading device battery voltage
public var deviceBatteryInaAddress: UInt32 = 0

///
/// If non-zero, we want powermon log outputs. With the particular (bitfield) sources enabled.
/// Note: we picked an ID of 32 so that lower more efficient IDs can be used for more frequently used options.
public var powermonEnables: UInt64 = 0

public var unknownFields = SwiftProtobuf.UnknownStorage()

public init() {}
Expand Down Expand Up @@ -2079,6 +2084,7 @@ extension Config.PowerConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImple
7: .standard(proto: "ls_secs"),
8: .standard(proto: "min_wake_secs"),
9: .standard(proto: "device_battery_ina_address"),
32: .standard(proto: "powermon_enables"),
]

public mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
Expand All @@ -2095,6 +2101,7 @@ extension Config.PowerConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImple
case 7: try { try decoder.decodeSingularUInt32Field(value: &self.lsSecs) }()
case 8: try { try decoder.decodeSingularUInt32Field(value: &self.minWakeSecs) }()
case 9: try { try decoder.decodeSingularUInt32Field(value: &self.deviceBatteryInaAddress) }()
case 32: try { try decoder.decodeSingularUInt64Field(value: &self.powermonEnables) }()
default: break
}
}
Expand Down Expand Up @@ -2125,6 +2132,9 @@ extension Config.PowerConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImple
if self.deviceBatteryInaAddress != 0 {
try visitor.visitSingularUInt32Field(value: self.deviceBatteryInaAddress, fieldNumber: 9)
}
if self.powermonEnables != 0 {
try visitor.visitSingularUInt64Field(value: self.powermonEnables, fieldNumber: 32)
}
try unknownFields.traverse(visitor: &visitor)
}

Expand All @@ -2137,6 +2147,7 @@ extension Config.PowerConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImple
if lhs.lsSecs != rhs.lsSecs {return false}
if lhs.minWakeSecs != rhs.minWakeSecs {return false}
if lhs.deviceBatteryInaAddress != rhs.deviceBatteryInaAddress {return false}
if lhs.powermonEnables != rhs.powermonEnables {return false}
if lhs.unknownFields != rhs.unknownFields {return false}
return true
}
Expand Down
30 changes: 15 additions & 15 deletions MeshtasticProtobufs/Sources/meshtastic/powermon.pb.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,17 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP

/// Note: There are no 'PowerMon' messages normally in use (PowerMons are sent only as structured logs - slogs).
///But we wrap our State enum in this message to effectively nest a namespace (without our linter yelling at us)
struct PowerMon {
public struct PowerMon {
// 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 unknownFields = SwiftProtobuf.UnknownStorage()
public var unknownFields = SwiftProtobuf.UnknownStorage()

/// Any significant power changing event in meshtastic should be tagged with a powermon state transition.
///If you are making new meshtastic features feel free to add new entries at the end of this definition.
enum State: SwiftProtobuf.Enum {
typealias RawValue = Int
public enum State: SwiftProtobuf.Enum {
public typealias RawValue = Int
case none // = 0
case cpuDeepSleep // = 1
case cpuLightSleep // = 2
Expand Down Expand Up @@ -62,11 +62,11 @@ struct PowerMon {
case gpsActive // = 2048
case UNRECOGNIZED(Int)

init() {
public init() {
self = .none
}

init?(rawValue: Int) {
public init?(rawValue: Int) {
switch rawValue {
case 0: self = .none
case 1: self = .cpuDeepSleep
Expand All @@ -85,7 +85,7 @@ struct PowerMon {
}
}

var rawValue: Int {
public var rawValue: Int {
switch self {
case .none: return 0
case .cpuDeepSleep: return 1
Expand All @@ -106,14 +106,14 @@ struct PowerMon {

}

init() {}
public init() {}
}

#if swift(>=4.2)

extension PowerMon.State: CaseIterable {
// The compiler won't synthesize support with the UNRECOGNIZED case.
static let allCases: [PowerMon.State] = [
public static let allCases: [PowerMon.State] = [
.none,
.cpuDeepSleep,
.cpuLightSleep,
Expand Down Expand Up @@ -142,26 +142,26 @@ extension PowerMon.State: @unchecked Sendable {}
fileprivate let _protobuf_package = "meshtastic"

extension PowerMon: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
static let protoMessageName: String = _protobuf_package + ".PowerMon"
static let _protobuf_nameMap = SwiftProtobuf._NameMap()
public static let protoMessageName: String = _protobuf_package + ".PowerMon"
public static let _protobuf_nameMap = SwiftProtobuf._NameMap()

mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
public mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
while let _ = try decoder.nextFieldNumber() {
}
}

func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
public func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
try unknownFields.traverse(visitor: &visitor)
}

static func ==(lhs: PowerMon, rhs: PowerMon) -> Bool {
public static func ==(lhs: PowerMon, rhs: PowerMon) -> Bool {
if lhs.unknownFields != rhs.unknownFields {return false}
return true
}
}

extension PowerMon.State: SwiftProtobuf._ProtoNameProviding {
static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
0: .same(proto: "None"),
1: .same(proto: "CPU_DeepSleep"),
2: .same(proto: "CPU_LightSleep"),
Expand Down
8 changes: 4 additions & 4 deletions scripts/gen_protos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

# simple sanity checking for repo
if [ ! -d "./protobufs" ]; then
echo 'Please check out the protobuf submodule by running: `git submodule update --init`'
exit
git submodule update --init
else
git submodule update
fi

# simple sanity checking for executable
if [ ! -x "$(which protoc)" ]; then
echo 'Please install swift-protobuf by running: `brew install swift-protobuf`'
exit
brew install swift-protobuf
fi

protoc --proto_path=./protobufs --swift_opt=Visibility=Public --swift_out=./MeshtasticProtobufs/Sources ./protobufs/meshtastic/*.proto
Expand Down