/*! \file
 * \brief An TouchMessage contains the Data of a Touch.
 *
 * \copyright
 * COPYRIGHT NOTICE: (c) 2017-2022 Neonode Technologies AB. All rights reserved.
 */

#ifndef MESSAGE_TOUCHMESSAGE_TOUCHMESSAGE_H
#define MESSAGE_TOUCHMESSAGE_TOUCHMESSAGE_H 1

#ifndef ZFORCECOMMON_H
    #error Please include "zForceCommon.h" before this file.
#endif // ZFORCECOMMON_H

/*!
 * \brief This structure represents a touch message.
 *
 * This structure represents a message containing touch information.
 */
struct TouchMessage
{
    /*!
     * The Message Type of the Message.
     * \n\n
     * Inherited from Message base class.
	 */
    MessageType      MessageType;
    /*!
     * The Message Group of the Message.
     * \n\n
     * Inherited from Message base class.
	 */
    MessageGroup     MessageGroup;
    /*!
     * If an error occurred, this is True.
     * \n\n
     * Inherited from Message base class.
	 */
    bool             Error;
    /*!
     * Error Code, valid when Error == true.
     * \n\n
     * Inherited from Message base class.
	 */
    int              ErrorCode;
    /*!
     * Unique serial number for this message.
     * \n\n
     * Inherited from Message base class.
	 */
    uint64_t         SerialNumber;
    /*!
     * Destructor.
     * \n\n
     * Inherited from Message base class.
	 */
    void             ( * Destructor)(Message * self);
    uint32_t         Id;             //!< Id of the Touch.
    TouchEvent       Event;          //!< Event of the Touch.
    uint32_t         X;              //!< X axis value.
    bool             HasX;           //!< True when X is valid.
    uint32_t         Y;              //!< Y axis value.
    bool             HasY;           //!< True when Y is valid.
    uint32_t         Z;              //!< Z axis value.
    bool             HasZ;           //!< True when Z is valid.
    uint32_t         SizeX;          //!< Size of the object on the X axis.
    bool             HasSizeX;       //!< True when SizeX is valid.
    uint32_t         SizeY;          //!< Size of the object on the Y axis.
    bool             HasSizeY;       //!< True when SizeY is valid.
    uint32_t         SizeZ;          //!< Size of the object on the Z axis.
    bool             HasSizeZ;       //!< True when SizeZ is valid.
    TouchOrientation Orientation;    //!< Orientation of the object.
    bool             HasOrientation; //!< True when Orientation is valid.
    uint32_t         Confidence;     //!< Detection confidence.
    bool             HasConfidence;  //!< True when Confidence is valid.
    uint32_t         Pressure;       //!< Pressure of the object.
    bool             HasPressure;    //!< True when Pressure is valid.
    uint64_t         Timestamp;      //!< Message timestamp.
    bool             HasTimestamp;   //!< True when Timestamp is valid.
};

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

/*!
 * \brief Internal constructor for TouchMessage.
 *
 * Internal constructor for TouchMessage.
 * Do not use this constructor, always use the factory creator.
 * \n\n
 * On failure, errno is set.
 * - ::EOUTOFMEMORY - Out of memory.
 * - ::EINVALIDSIZE - Invalid size.
 *
 * \param messageGroup MessageGroup of Message.
 * \param size If this is used as a base class for another class, set size to non-zero.
 *
 * \return Pointer to TouchMessage.
 */

DLLINTERNAL TouchMessage * TouchMessage_New (MessageGroup messageGroup, uint32_t size);

#ifdef __cplusplus
}
#endif // __cplusplus

#endif // MESSAGE_TOUCHMESSAGE_TOUCHMESSAGE_H

