//! Constants for the SUID lookup service and the `data_type` strings
//! libssc / SSC accept.

use crate::pb::Uid;

/// QRTR service ID for `sns_client_api_v01`. Matches libssc.
pub const SSC_QMI_SVC_ID: u32 = 0x190; // 400
/// QRTR encodes `(instance << 8) | version` in the 32-bit `instance` field.
/// 0 means "match any" — there's only one SSC instance in practice.
pub const SSC_QMI_INSTANCE: u32 = 0;

/// Inner protobuf message IDs (set on `SscClientRequestBody.msg_id` /
/// `SscClientResponseBody.msg_id`). Values from libssc/src/libssc-sensor.c.
pub const MSG_REQ_SUID: u32 = 512;
pub const MSG_RESP_SUID: u32 = 768;
pub const MSG_REQ_GET_ATTRIBUTES: u32 = 1;
pub const MSG_RESP_GET_ATTRIBUTES: u32 = 128;
pub const MSG_REQ_ENABLE_REPORT_CONTINUOUS: u32 = 513;
pub const MSG_REQ_ENABLE_REPORT_ON_CHANGE: u32 = 514;
pub const MSG_RESP_ENABLE_REPORT: u32 = 768;
pub const MSG_REQ_DISABLE_REPORT: u32 = 10;

/// Attribute IDs from libssc's SSC_ATTRIBUTE_* enum. Values are
/// type-specific — see the `Attribute` accessors for typed extraction.
pub const ATTR_NAME: i32 = 0;
pub const ATTR_VENDOR: i32 = 1;
pub const ATTR_TYPE: i32 = 2;
pub const ATTR_AVAILABLE: i32 = 3;
pub const ATTR_VERSION: i32 = 4;
pub const ATTR_API: i32 = 5;
pub const ATTR_SAMPLE_RATE: i32 = 6;
pub const ATTR_SAMPLE_RESOLUTIONS: i32 = 7;
pub const ATTR_FIFO_SIZE: i32 = 8;
pub const ATTR_ACTIVE_CURRENT_CONSUMPTION: i32 = 9;
pub const ATTR_SLEEP_CURRENT_CONSUMPTION: i32 = 10;
pub const ATTR_AVAILABLE_RANGES: i32 = 11;
pub const ATTR_OPERATING_MODES: i32 = 12;
pub const ATTR_DRI: i32 = 13;
pub const ATTR_STREAM_SYNC: i32 = 14;
pub const ATTR_EVENT_SIZE: i32 = 15;
pub const ATTR_STREAM_TYPE: i32 = 16;
pub const ATTR_DYNAMIC: i32 = 17;
pub const ATTR_HARDWARE_ID: i32 = 18;
pub const ATTR_RIGID_BODY: i32 = 19;
pub const ATTR_MOUNT_MATRIX: i32 = 20;
pub const ATTR_PHYSICAL_SENSOR: i32 = 21;
pub const ATTR_PHYSICAL_SENSOR_TESTS: i32 = 22;
pub const ATTR_SELECTED_RESOLUTION: i32 = 23;
pub const ATTR_SELECTED_RANGE: i32 = 24;
pub const ATTR_LOW_LATENCY_RATES: i32 = 25;
pub const ATTR_PASSIVE_REQUEST: i32 = 26;

/// Sentinel SUID for the SUID lookup service.
pub fn lookup_suid() -> Uid {
    Uid { high: 0xABABABABABABABAB, low: 0xABABABABABABABAB }
}

/// Canonical `data_type` strings exposed by stock SSC builds. Vendor builds
/// may add more — pass arbitrary strings to discovery to probe.
pub const STANDARD_DATA_TYPES: &[&str] = &[
    "accel",
    "gyro",
    "mag",
    "ambient_light",
    "proximity",
    "rotv",
    "humidity",
    "ambient_temperature",
    "device_orientation",
    "step_counter",
    "step_detect",
    "linear_accel",
    "gravity",
    "rotation_vector",
    "game_rotation_vector",
    "geomag_rotation_vector",
    "tilt",
    "heart_rate",
];
