////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2020-2021 Qualcomm Technologies, Inc.
// All Rights Reserved.
// Confidential and Proprietary - Qualcomm Technologies, Inc.
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// @file  camxoisdriverapi.h
/// @brief OIS Driver function declarations
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

#ifndef CAMXOISDRIVERAPI_H
#define CAMXOISDRIVERAPI_H

#include "camxcdktypes.h"

#ifdef __cplusplus
extern "C"
{
#endif // __cplusplus

/// @brief LensPosition to hold the formated lens position data
typedef struct LensPosition
{
    FLOAT   shiftX;         ///< OIS lens position shift in X direction
    FLOAT   shiftY;         ///< OIS lens position shift in Y direction
    UINT64  timeStampInNS;  ///< time stamp of the sample w.r.t Qtimer in nano seconds
}LensPosition;

/// @brief LensPositionDataInfo to hold the formated lens position and info need to format
typedef struct LensPositionDataInfo
{
    LensPosition*   pLensPos;                           ///< OIS lens position data to be filled in after format
    UINT            validSamples;                       ///< number valid samples to be filled in after formatting
    UINT32          totalSamples;                       ///< Total samples lensPos can hold
    UINT8*          pRawLensPosData;                    ///< Pointer to raw lens position data
    UINT32          rawDataSize;                        ///< Size of the raw lens position data
    UINT64          QTimerInNS;                         ///< QTimer values in nano seconds at the time of lens position read
    UINT64          prevPacketLastSampleQTimerTSInNS;   ///< Qtimer in nanosecond of last sample in previous packet
}LensPositionDataInfo;

/// @brief APIs which OIS library can implement
typedef struct OISLibraryAPI
{
    UINT  size;         ///< Size of OIS library API structure
    UINT  majorVersion; ///< Major version of the Library API
    UINT  minorVersion; ///< Minor version of the Library API

    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    /// pFormatOISLensPositionData
    ///
    /// @brief  Format the OIS lens position data
    ///
    /// @param  pLensPosData  Pointer to lens position data having format info and also to copy the formated data
    ///
    /// @return true if successful else false
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    BOOL (*pFormatOISLensPositionData)(
        LensPositionDataInfo* pLensPosData);
} OISLibraryAPI;

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// GetOISLibraryAPIs
///
/// @brief Returns the OIS library API structure.This function is the entry point for the library.
///     CamX will query the shared library for this method by name.
///
/// @param pOISLibraryAPI pointer to the OIS library API structure.
///
/// @return None
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
CDK_VISIBILITY_PUBLIC void GetOISLibraryAPIs(
    OISLibraryAPI* pOISLibraryAPI);

#ifdef __cplusplus
} // CamX Namespace
#endif // __cplusplus

#endif // CAMXOISDRIVERAPI_H
