XYOracleNetwork/sdk-ble-flutter

View on GitHub
ios/Classes/protos/device.pb.swift

Summary

Maintainability
D
2 days
Test Coverage
// DO NOT EDIT.
//
// Generated by the Swift generator plugin for the protocol buffer compiler.
// Source: protos/device.proto
//
// For information on using the generated types, please see the documenation:
//   https://github.com/apple/swift-protobuf/

import Foundation
import SwiftProtobuf

// If the compiler emits an error on this type, it is because this file
// was generated by a version of the `protoc` Swift plug-in that is
// incompatible with the version of SwiftProtobuf to which you are linking.
// Please ensure that your are building against the same version of the API
// that was used to generate this file.
fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck {
  struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {}
  typealias Version = _2
}

struct Family {
  // 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 uuid: String = String()

  var prefix: String = String()

  var name: String = String()

  var id: String = String()

  var unknownFields = SwiftProtobuf.UnknownStorage()

  init() {}
}

struct Range {
  // 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 min: Int64 = 0

  var max: Int64 = 0

  var unknownFields = SwiftProtobuf.UnknownStorage()

  init() {}
}

struct IBeacon {
  // 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 major: Int64 = 0

  var minor: Int64 = 0

  var uuid: String = String()

  var unknownFields = SwiftProtobuf.UnknownStorage()

  init() {}
}

struct BluetoothDevice {
  // 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 id: String {
    get {return _storage._id}
    set {_uniqueStorage()._id = newValue}
  }

  var family: Family {
    get {return _storage._family ?? Family()}
    set {_uniqueStorage()._family = newValue}
  }
  /// Returns true if `family` has been explicitly set.
  var hasFamily: Bool {return _storage._family != nil}
  /// Clears the value of `family`. Subsequent reads from it will return its default value.
  mutating func clearFamily() {_uniqueStorage()._family = nil}

  var beacon: IBeacon {
    get {return _storage._beacon ?? IBeacon()}
    set {_uniqueStorage()._beacon = newValue}
  }
  /// Returns true if `beacon` has been explicitly set.
  var hasBeacon: Bool {return _storage._beacon != nil}
  /// Clears the value of `beacon`. Subsequent reads from it will return its default value.
  mutating func clearBeacon() {_uniqueStorage()._beacon = nil}

  var rssi: Int64 {
    get {return _storage._rssi}
    set {_uniqueStorage()._rssi = newValue}
  }

  var range: Range {
    get {return _storage._range ?? Range()}
    set {_uniqueStorage()._range = newValue}
  }
  /// Returns true if `range` has been explicitly set.
  var hasRange: Bool {return _storage._range != nil}
  /// Clears the value of `range`. Subsequent reads from it will return its default value.
  mutating func clearRange() {_uniqueStorage()._range = nil}

  var connected: Bool {
    get {return _storage._connected}
    set {_uniqueStorage()._connected = newValue}
  }

  var name: String {
    get {return _storage._name}
    set {_uniqueStorage()._name = newValue}
  }

  var address: String {
    get {return _storage._address}
    set {_uniqueStorage()._address = newValue}
  }

  var unknownFields = SwiftProtobuf.UnknownStorage()

  init() {}

  fileprivate var _storage = _StorageClass.defaultInstance
}

// MARK: - Code below here is support for the SwiftProtobuf runtime.

extension Family: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  static let protoMessageName: String = "Family"
  static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
    1: .same(proto: "uuid"),
    2: .same(proto: "prefix"),
    3: .same(proto: "name"),
    4: .same(proto: "id"),
  ]

  mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
    while let fieldNumber = try decoder.nextFieldNumber() {
      switch fieldNumber {
      case 1: try decoder.decodeSingularStringField(value: &self.uuid)
      case 2: try decoder.decodeSingularStringField(value: &self.prefix)
      case 3: try decoder.decodeSingularStringField(value: &self.name)
      case 4: try decoder.decodeSingularStringField(value: &self.id)
      default: break
      }
    }
  }

  func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
    if !self.uuid.isEmpty {
      try visitor.visitSingularStringField(value: self.uuid, fieldNumber: 1)
    }
    if !self.prefix.isEmpty {
      try visitor.visitSingularStringField(value: self.prefix, fieldNumber: 2)
    }
    if !self.name.isEmpty {
      try visitor.visitSingularStringField(value: self.name, fieldNumber: 3)
    }
    if !self.id.isEmpty {
      try visitor.visitSingularStringField(value: self.id, fieldNumber: 4)
    }
    try unknownFields.traverse(visitor: &visitor)
  }

  static func ==(lhs: Family, rhs: Family) -> Bool {
    if lhs.uuid != rhs.uuid {return false}
    if lhs.prefix != rhs.prefix {return false}
    if lhs.name != rhs.name {return false}
    if lhs.id != rhs.id {return false}
    if lhs.unknownFields != rhs.unknownFields {return false}
    return true
  }
}

extension Range: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  static let protoMessageName: String = "Range"
  static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
    1: .same(proto: "min"),
    2: .same(proto: "max"),
  ]

  mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
    while let fieldNumber = try decoder.nextFieldNumber() {
      switch fieldNumber {
      case 1: try decoder.decodeSingularSInt64Field(value: &self.min)
      case 2: try decoder.decodeSingularSInt64Field(value: &self.max)
      default: break
      }
    }
  }

  func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
    if self.min != 0 {
      try visitor.visitSingularSInt64Field(value: self.min, fieldNumber: 1)
    }
    if self.max != 0 {
      try visitor.visitSingularSInt64Field(value: self.max, fieldNumber: 2)
    }
    try unknownFields.traverse(visitor: &visitor)
  }

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

extension IBeacon: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  static let protoMessageName: String = "IBeacon"
  static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
    1: .same(proto: "major"),
    2: .same(proto: "minor"),
    3: .same(proto: "uuid"),
  ]

  mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
    while let fieldNumber = try decoder.nextFieldNumber() {
      switch fieldNumber {
      case 1: try decoder.decodeSingularInt64Field(value: &self.major)
      case 2: try decoder.decodeSingularInt64Field(value: &self.minor)
      case 3: try decoder.decodeSingularStringField(value: &self.uuid)
      default: break
      }
    }
  }

  func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
    if self.major != 0 {
      try visitor.visitSingularInt64Field(value: self.major, fieldNumber: 1)
    }
    if self.minor != 0 {
      try visitor.visitSingularInt64Field(value: self.minor, fieldNumber: 2)
    }
    if !self.uuid.isEmpty {
      try visitor.visitSingularStringField(value: self.uuid, fieldNumber: 3)
    }
    try unknownFields.traverse(visitor: &visitor)
  }

  static func ==(lhs: IBeacon, rhs: IBeacon) -> Bool {
    if lhs.major != rhs.major {return false}
    if lhs.minor != rhs.minor {return false}
    if lhs.uuid != rhs.uuid {return false}
    if lhs.unknownFields != rhs.unknownFields {return false}
    return true
  }
}

extension BluetoothDevice: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  static let protoMessageName: String = "BluetoothDevice"
  static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
    1: .same(proto: "id"),
    2: .same(proto: "family"),
    3: .same(proto: "beacon"),
    4: .same(proto: "rssi"),
    5: .same(proto: "range"),
    6: .same(proto: "connected"),
    7: .same(proto: "name"),
    8: .same(proto: "address"),
  ]

  fileprivate class _StorageClass {
    var _id: String = String()
    var _family: Family? = nil
    var _beacon: IBeacon? = nil
    var _rssi: Int64 = 0
    var _range: Range? = nil
    var _connected: Bool = false
    var _name: String = String()
    var _address: String = String()

    static let defaultInstance = _StorageClass()

    private init() {}

    init(copying source: _StorageClass) {
      _id = source._id
      _family = source._family
      _beacon = source._beacon
      _rssi = source._rssi
      _range = source._range
      _connected = source._connected
      _name = source._name
      _address = source._address
    }
  }

  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() {
        switch fieldNumber {
        case 1: try decoder.decodeSingularStringField(value: &_storage._id)
        case 2: try decoder.decodeSingularMessageField(value: &_storage._family)
        case 3: try decoder.decodeSingularMessageField(value: &_storage._beacon)
        case 4: try decoder.decodeSingularSInt64Field(value: &_storage._rssi)
        case 5: try decoder.decodeSingularMessageField(value: &_storage._range)
        case 6: try decoder.decodeSingularBoolField(value: &_storage._connected)
        case 7: try decoder.decodeSingularStringField(value: &_storage._name)
        case 8: try decoder.decodeSingularStringField(value: &_storage._address)
        default: break
        }
      }
    }
  }

  func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
    try withExtendedLifetime(_storage) { (_storage: _StorageClass) in
      if !_storage._id.isEmpty {
        try visitor.visitSingularStringField(value: _storage._id, fieldNumber: 1)
      }
      if let v = _storage._family {
        try visitor.visitSingularMessageField(value: v, fieldNumber: 2)
      }
      if let v = _storage._beacon {
        try visitor.visitSingularMessageField(value: v, fieldNumber: 3)
      }
      if _storage._rssi != 0 {
        try visitor.visitSingularSInt64Field(value: _storage._rssi, fieldNumber: 4)
      }
      if let v = _storage._range {
        try visitor.visitSingularMessageField(value: v, fieldNumber: 5)
      }
      if _storage._connected != false {
        try visitor.visitSingularBoolField(value: _storage._connected, fieldNumber: 6)
      }
      if !_storage._name.isEmpty {
        try visitor.visitSingularStringField(value: _storage._name, fieldNumber: 7)
      }
      if !_storage._address.isEmpty {
        try visitor.visitSingularStringField(value: _storage._address, fieldNumber: 8)
      }
    }
    try unknownFields.traverse(visitor: &visitor)
  }

  static func ==(lhs: BluetoothDevice, rhs: BluetoothDevice) -> 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._id != rhs_storage._id {return false}
        if _storage._family != rhs_storage._family {return false}
        if _storage._beacon != rhs_storage._beacon {return false}
        if _storage._rssi != rhs_storage._rssi {return false}
        if _storage._range != rhs_storage._range {return false}
        if _storage._connected != rhs_storage._connected {return false}
        if _storage._name != rhs_storage._name {return false}
        if _storage._address != rhs_storage._address {return false}
        return true
      }
      if !storagesAreEqual {return false}
    }
    if lhs.unknownFields != rhs.unknownFields {return false}
    return true
  }
}