/*! \file
 * \brief A DoubleClickPreventionMessage configures the double-click prevention for the device.
 *
 * \copyright
 * COPYRIGHT NOTICE: (c) 2021-2022 Neonode Technologies AB. All rights reserved.
 */

#ifndef MESSAGE_DOUBLECLICKPREVENTIONMESSAGE_DOUBLECLICKPREVENTIONMESSAGE_H
#define MESSAGE_DOUBLECLICKPREVENTIONMESSAGE_DOUBLECLICKPREVENTIONMESSAGE_H 1

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

/*!
 * \brief This structure represents a double-click prevention message.
 *
 * This structure represents a message that configures the double-click prevention settings.
 */
struct DoubleClickPreventionMessage
{
    /*!
     * 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);
    bool         Enabled;                        //!< True when Double-Click Prevention is enabled.
    bool         HasEnabled;                     //!< True when Enabled is valid.
    uint32_t     DoubleClickPreventionTime;      //!< Time period when no additional touches will be reported in 
                                                 //!< prevention area.
    bool         HasDoubleClickPreventionTime;   //!< True when DoubleClickPreventionTime is valid.
    uint32_t     DoubleClickPreventionRadius;    //!< The radius of the area around the touch defining area where
                                                 //!< touches are suppressed.
    bool         HasDoubleClickPreventionRadius; //!< True when DoubleClickPreventionRadius is valid.
};

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

/*!
 * \brief Internal constructor for DoubleClickPreventionMessage.
 *
 * Internal constructor for DoubleClickPreventionMessage.
 * 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 DoubleClickPreventionMessage.
 */
DLLINTERNAL DoubleClickPreventionMessage * DoubleClickPreventionMessage_New (MessageGroup messageGroup, uint32_t size);

#ifdef __cplusplus
}
#endif // __cplusplus

#endif // MESSAGE_DOUBLECLICKPREVENTIONMESSAGE_DOUBLECLICKPREVENTIONMESSAGE_H
