syntax = "proto3";

package aruba.iotops.common.v1;

// IBeacon protocol
message IBeacon {
  // a UUID specific to their app and deployment use case
  optional string ibeacon_uuid = 1;
  // specifies a specific iBeacon and use case.
  //    minimum: 0,
  //    maximum: 65535,
  //    example: "10".
  optional uint32 ibeacon_major = 2;
  // subdivision of region or use case.
  //    minimum: 0,
  //    maximum: 65535,
  //    example: "20".
  optional uint32 ibeacon_minor = 3;
  // measured power value in RSSI of a Proximity Beacon at a distance of 1 meter from the beacon.
  //    minimum: -100,
  //    maximum: 0,
  //    example: "10".
  optional sint32 ibeacon_power = 4;
  // trailing data after specified iBeacon packet
  optional bytes beacon_extra = 5;
}

// Eddystone protocol
message Eddystone {
  // Eddystone UID
  message EddyUID {
    // The Ranging Data is the Tx power in dBm emitted by the beacon at -1 meters.
    //      minimum: -100,
    //      maximum: 20,
    //      example: "-5".
    optional sint32 calibrated_power = 1;
    // The 9-byte Namespace ID component is unique self-assigned beacon ID namespace.
    //      max_length: 9,
    //      min_length: 9.
    optional bytes eddystone_uid_nid = 2;
    // The 5-byte Instance ID component is unique within the namespace.
    //      max_length: 5,
    //      min_length: 5.
    optional bytes eddystone_uid_bid = 3;
  }
  // opaque, unique Beacon ID. Also see: https://github.com/google/eddystone/tree/master/eddystone-uid
  optional EddyUID eddystone_uid = 1;

  // Eddystone-URL
  message EddyURL {
    // The Ranging Data is the Tx power in dBm emitted by the beacon at 0 meters.
    //      minimum: -100,
    //      maximum: 20,
    //      example: "-5".
    optional sint32 calibrated_power = 1;
    // The URL Scheme Prefix byte defines the identifier scheme, an optional prefix and how the remainder of the URL is encoded.
    //      minimum: 0,
    //      maximum: 3.
    optional uint32 eddystone_url_prefix = 2;
    // a URL using a compressed encoding format.
    //      min_length: 1,
    //      max_length: 17.
    optional bytes eddystone_url_encoded_url = 3;
  }
  // a URL using a compressed encoding format. Also see: https://github.com/google/eddystone/tree/master/eddystone-url
  optional EddyURL eddystone_url = 2;

  // Eddystone-TLM
  message EddyTLM {
    // TLM version allows for future development of this frame type. At present the value must be 0x00
    //  example: "1".
    optional uint32 version = 1;
    // Battery voltage is the current battery charge in Volt.
    //      minimum: 0,
    //      example: "100".
    optional float battery_voltage = 2;
    // Beacon temperature is the temperature in degrees Celsius sensed by the beacon.
    //  example: "18.5".
    optional float beacon_temperature = 3;
    // the running count of advertisement frames of all types emitted by the beacon since power-up or reboot.
    //      minimum: 0,
    //      example: "100".
    optional uint64 adv_count = 4;
    // a 0.1 second resolution counter that represents time since beacon power-up or reboot.
    //      minimum: 0,
    //      example: "200".
    optional uint64 sec_count = 5;
  }
  // Telemetry frames of Eddystone. Also see: https://github.com/google/eddystone/blob/master/eddystone-tlm/tlm-plain.md
  optional EddyTLM eddystone_tlm = 3;

  // Eddystone-EID
  message EddyEID {
    // The Ranging Data is the Tx power in dBm emitted by the beacon at 0 meters.
    //      minimum: -100,
    //      maximum: 20,
    //      example: "-5".
    optional sint32 calibrated_power = 1;
    // 8-byte Ephemeral Identifier.
    //     max_length: 8,
    //     min_length: 8.
    optional bytes eddystone_eid_eid = 2;
  }
  // encrypted ephemeral identifier. Also see: https://github.com/google/eddystone/tree/master/eddystone-eid
  optional EddyEID eddystone_eid = 4;
}
