// @file sns_heart_rate.proto
//
// @brief Defines message types for Heart Rate Detection Sensors.
//
// @copyright
// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
// All Rights Reserved.
// Confidential and Proprietary - Qualcomm Technologies, Inc.
//
// @details
// A sensor of this type returns the current heart rate in beats per minute
// (BPM).  Because this sensor is on-change, events must be generated when and
// only when BPM or status have changed since the last event.
//
// ## Attribute Requirements:
// 1. SNS_STD_SENSOR_ATTRID_TYPE is "heart_rate"
// 2. SNS_STD_SENSOR_ATTRID_STREAM_TYPE: SNS_STD_SENSOR_STREAM_TYPE_ON_CHANGE
// 3. SNS_STD_SENSOR_ATTRID_API attribute contains "sns_heart_rate.proto"
//
// ## Processing Stream Requests: 
// - The Heart Beat Sensor handles the SNS_STD_SENSOR_MSGID_SNS_STD_ON_CHANGE_CONFIG
//    message ID for all stream enable/update requests.
// No configuration is available for this sensor.
//
// ## Publishing Stream Events:
// - SNS_HEART_RATE_MSGID_SNS_HEART_RATE_EVENT: Output of the Heart Rate sensor will be 
//  populated in sns_heart_rate_event.
//
// - SNS_HEART_RATE_MSGID_SNS_HEART_RATE_EVENT::heart_rate = current heart rate in beats per minute (BPM)
//
// - SNS_HEART_RATE_MSGID_SNS_HEART_RATE_EVENT::heart_rate_event_status specifies the reliability of the sample value
// Upon the first activation, unless the device is known to not be on the
// body, the status field of the first event must be set to UNRELIABLE.
syntax = "proto2";
import "nanopb.proto";
import "sns_std_sensor.proto";

// @brief Message IDs for Heart Rate Sensor
enum sns_heart_rate_msgid {
  option (nanopb_enumopt).long_names = false;

  SNS_HEART_RATE_MSGID_SNS_HEART_RATE_EVENT = 779;
}

// @brief Heart Rate sensor event status
enum sns_heart_rate_event_status {
  option (nanopb_enumopt).long_names = false;

  SNS_HR_STATUS_NO_CONTACT = -1;
  SNS_HR_STATUS_UNRELIABLE  = 0;
  SNS_HR_STATUS_ACCURACY_LOW = 1;
  SNS_HR_STATUS_ACCURACY_MEDIUM = 2;
  SNS_HR_STATUS_ACCURACY_HIGH = 3;
}

// @brief Event generated by Heart Rate sensor to convey determined state 
message sns_heart_rate_event
{
  // @brief Heart rate sensor sample value
  required float heart_rate = 1;
  
  // @brief Heart rate sensor sample status
  required sns_heart_rate_event_status heart_rate_event_status = 2 [default = SNS_HR_STATUS_NO_CONTACT];
}