/*! \file
 * \brief A TouchModeMessage sets the touch mode for the device.
 *
 * \copyright
 * COPYRIGHT NOTICE: (c) 2018-2022 Neonode Technologies AB. All rights reserved.
 */

#ifndef MESSAGE_TOUCHMODEMESSAGE_TOUCHMODEMESSAGE_H
#define MESSAGE_TOUCHMODEMESSAGE_TOUCHMODEMESSAGE_H 1

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

/*!
 * \brief This structure represents a touch mode message.
 *
 * This structure represents a message that decides the touch mode.
 */
struct TouchModeMessage
{
    /*!
     * 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);
    TouchModes   TouchMode;             //!< Touch Mode.
    bool         HasTouchMode;          //!< True when TouchMode is valid.
    uint32_t     ClickOnTouchTime;      //!< How long to wait for before a touch is clicked in Click on Touch Mode.
    bool         HasClickOnTouchTime;   //!< True when ClickOnTouchTime is valid.
    uint32_t     ClickOnTouchRadius;    //!< How far the touch has to move before it is switched to Normal Mode.
    bool         HasClickOnTouchRadius; //!< True when ClickOnTouchRadius is valid.
};

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

/*!
 * \brief Internal constructor for TouchModeMessage.
 *
 * Do not use this, but use the Factory creator instead.
 * \n\n
 * On failure, see errno.
 * - ::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 TouchModeMessage.
 */
DLLINTERNAL TouchModeMessage * TouchModeMessage_New (MessageGroup messageGroup, uint32_t size);

#ifdef __cplusplus
}
#endif // __cplusplus

#endif // MESSAGE_TOUCHMODEMESSAGE_TOUCHMODEMESSAGE_H
