// @file sns_offbody_detect.proto
//
// Defines the API for Offbody Detection Sensors.
//
// Copyright (c) 2017 Qualcomm Technologies, Inc.
// All Rights Reserved.
// Confidential and Proprietary - Qualcomm Technologies, Inc.

syntax = "proto2";
import "nanopb.proto";
import "sns_std_sensor.proto";

// An offbody detect sensor reports every time the device transitions from
// off-body to on-body and from on-body to off-body (e.g. a wearable device
// being removed from the wrist would trigger an event indicating an off-body
// transition).
//
// This sensor must be able to detect and report an on-body to off-body
// transition within 1 second of the device being removed from the body,
// and must be able to detect and report an off-body to on-body transition
// within 5 seconds of the device being put back onto the body.
//
// ## Offbody Detection sensor attributes:
// SNS_STD_SENSOR_ATTRID_TYPE is "offbody_detect"
// SNS_STD_SENSOR_ATTRID_STREAM_TYPE: SNS_STD_SENSOR_STREAM_TYPE_ON_CHANGE
//
// ## Request Message: SNS_STD_SENSOR_MSGID_SNS_STD_ON_CHANGE_CONFIG
// No configuration is available for this sensor.
//
// ## Event Message: SNS_OFFBODY_DETECT_MSGID_SNS_OFFBODY_DETECT_EVENT

// Message IDs for Offbody Detection Sensor
enum sns_offbody_detect_msgid {
  option (nanopb_enumopt).long_names = false;

  SNS_OFFBODY_DETECT_MSGID_SNS_OFFBODY_DETECT_EVENT = 772;
}

enum sns_offbody_detect_event_type
{
  option (nanopb_enumopt).long_names = false;

  // Current state is unknown: not yet detected
  SNS_OFFBODY_DETECT_EVENT_TYPE_UNKNOWN     = 0;
  // Device has been detected to be on-body
  SNS_OFFBODY_DETECT_EVENT_TYPE_ON          = 1;
  // Device has been detected to be off-body
  SNS_OFFBODY_DETECT_EVENT_TYPE_OFF         = 2;
}

message sns_offbody_detect_event
{
  // Detected state
  required sns_offbody_detect_event_type state = 1 [default = SNS_OFFBODY_DETECT_EVENT_TYPE_UNKNOWN];
}
