using System;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using UnityEngine;

public class XvNativeAPI 
{
    //ʼ Xvisio 豸ȡ豸ָ
    [DllImport("xv-wrapper")]
    public static extern bool initXvDevice();

    /// <summary>
    /// ȡ6ɶȣ6DoFλݣṩԤ
    /// </summary>
    /// <param name="poseData">ָ洢λݵָ</param>
    /// <param name="timestamp">ָ洢ʱָ</param>
    /// <param name="prediction">Ԥʱ䣬λΪ</param>
    /// <returns>trueȡλ˳ɹfalseȡλʧ</returns>
    [DllImport("xv-wrapper")]
    public static extern bool xv_test_get_6dof([In, Out] double[] poseData, ref long timestamp, double prediction);


    /// <summary>
    /// rgbع
    /// </summary>
    /// <param name="aecMode">عģʽ0ʾԶع⣬1ʾֶع</param>
    /// <param name="exposureGain">ع棬ֶعģʽЧΧΪ[0,255]</param>
    /// <param name="exposureTimeMs">عʱ䣬ֶعģʽЧλΪ</param>
    [DllImport("xv-wrapper")]
    public static extern void rgb_set_exposure(int aecMode, int exposureGain, float exposureTimeMs);

    // RGB 
    [DllImport("xv-wrapper")]
    public static extern void startRgbStream();
    //ֹͣ RGB 
    [DllImport("xv-wrapper")]
    public static extern void stopRgbStream();



    // TOF 
    [DllImport("xv-wrapper")]
    public static extern void startTofStream();

    //ֹͣ TOF 
    [DllImport("xv-wrapper")]
    public static extern void stopTofStream();

    // PMD TOF ⹦
    [DllImport("xv-wrapper")]
    public static extern bool setPmdTofIRFunction();

    /// <summary>
    /// ʶעصȡؼ
    /// </summary>
    /// <returns>ɹʱػص IDʧʱ -1</returns>
    [DllImport("xv-wrapper")]
    public static extern int xv_start_skeleton_ex_with_cb();

    /// <summary>
    /// ۶עص gazeCallback
    /// </summary>
    /// <returns>ɹʱػص IDʧʱ -1</returns>
    [DllImport("xv-wrapper")]
    public static extern int start_et_gaze_callback();


    /// <summary>
    /// ȡ˫Ŀı궨
    /// </summary>
    /// <returns>trueɹȡ궨falseȡʧ</returns>
    [DllImport("xv-wrapper")]
    public static extern bool xvReadStereoFisheyesCalibration();

    /// <summary>
    /// شݻȡעص STMDataCallback ڴ
    /// </summary>
    /// <returns>trueɹشݻȡ</returns>
    [DllImport("xv-wrapper")]
    public static extern bool stm_start();

    /// <summary>
    /// ֹͣشݻȡȡصע
    /// </summary>
    /// <returns>trueɹֹͣشݻȡ</returns>
    [DllImport("xv-wrapper")]
    public static extern bool stm_stop();

    //ֱעص
    [DllImport("xv-wrapper")]
    public static extern void xv_controller_register();


    //ʶ𱾵Ƶ
    [DllImport("xv-wrapper")]
    public static extern void xv_recognize_from_local(string name);
    /// <summary>
    /// лʶԴ
    /// </summary>
    /// <param name="source">source1ʾmicʵʱʶ2ʾǱpcmļʶ</param>
    [DllImport("xv-wrapper")]
    public static extern void xv_audio_recognize_switch_source(int source);



    /// <summary>
    /// ȡ̬
    /// </summary>
    /// <param name="poseData"></param>
    /// <returns></returns>

    [DllImport("xv-wrapper")]
    public static extern bool xv_get_prob([In, Out] double[] poseData);



    /// <summary>
    /// ȡIRͼ
    /// </summary>
    /// <param name="data">ͼ RGBAʽ</param>
    /// <param name="width"></param>
    /// <param name="height"></param>
    /// <returns></returns>
    [DllImport("xv-wrapper")]
    public static extern bool xv_get_tofir_image(IntPtr data, int width, int height);


    [DllImport("xv-wrapper")]
    public static extern void startTofIRStream();

    //
}
