summaryrefslogtreecommitdiff
path: root/NxWidgets/nxwm/include
diff options
context:
space:
mode:
Diffstat (limited to 'NxWidgets/nxwm/include')
-rw-r--r--NxWidgets/nxwm/include/capplicationwindow.hxx10
-rw-r--r--NxWidgets/nxwm/include/ccalibration.hxx105
-rw-r--r--NxWidgets/nxwm/include/cfullscreenwindow.hxx10
-rw-r--r--NxWidgets/nxwm/include/cnxconsole.hxx10
-rw-r--r--NxWidgets/nxwm/include/cstartwindow.hxx10
-rw-r--r--NxWidgets/nxwm/include/ctouchscreen.hxx29
-rw-r--r--NxWidgets/nxwm/include/iapplication.hxx10
-rw-r--r--NxWidgets/nxwm/include/iapplicationwindow.hxx10
-rw-r--r--NxWidgets/nxwm/include/nxwmconfig.hxx30
9 files changed, 209 insertions, 15 deletions
diff --git a/NxWidgets/nxwm/include/capplicationwindow.hxx b/NxWidgets/nxwm/include/capplicationwindow.hxx
index 807f268a6..1a3d7eb48 100644
--- a/NxWidgets/nxwm/include/capplicationwindow.hxx
+++ b/NxWidgets/nxwm/include/capplicationwindow.hxx
@@ -159,6 +159,16 @@ namespace NxWM
void setWindowLabel(NXWidgets::CNxString &appname);
/**
+ * Report of this is a "normal" window or a full screen window. The
+ * primary purpose of this method is so that window manager will know
+ * whether or not it show draw the task bar.
+ *
+ * @return True if this is a full screen window.
+ */
+
+ bool isFullScreen(void) const;
+
+ /**
* Register to receive callbacks when toolbar icons are selected
*/
diff --git a/NxWidgets/nxwm/include/ccalibration.hxx b/NxWidgets/nxwm/include/ccalibration.hxx
index 535a14804..3d90d59a8 100644
--- a/NxWidgets/nxwm/include/ccalibration.hxx
+++ b/NxWidgets/nxwm/include/ccalibration.hxx
@@ -42,12 +42,14 @@
#include <nuttx/nx/nxglib.h>
+#include <pthread.h>
#include <fixedmath.h>
#include "cnxstring.hxx"
#include "cwidgeteventhandler.hxx"
#include "cwidgetcontrol.hxx"
+#include "ctaskbar.hxx"
#include "iapplication.hxx"
#include "cfullscreenwindow.hxx"
@@ -98,17 +100,32 @@ namespace NxWM
{
private:
/**
+ * The state of the calibration thread.
+ */
+
+ enum ECalThreadState
+ {
+ CALTHREAD_NOTRUNNING = 0, /**< The calibration thread has not yet been started */
+ CALTHREAD_STARTED, /**< The calibration thread has been started, but is not yet running */
+ CALTHREAD_RUNNING, /**< The calibration thread is running normally */
+ CALTHREAD_STOPREQUESTED, /**< The calibration thread has been requested to stop */
+ CALTHREAD_HIDE, /**< The hide() called by calibration thread running */
+ CALTHREAD_SHOW, /**< The redraw() called by calibration thread running */
+ CALTHREAD_TERMINATED /**< The calibration thread terminated normally */
+ };
+
+ /**
* Identifies the current display state
*/
- enum ECalibState
+ enum ECalibrationPhase
{
- CALIB_NOT_STARTED = 0, /**< Constructed, but not yet started */
- CALIB_UPPER_LEFT, /**< Touch point is in the upper left corner */
- CALIB_UPPER_RIGHT, /**< Touch point is in the upper right corner */
- CALIB_LOWER_RIGHT, /**< Touch point is in the lower left corner */
- CALIB_LOWER_LEFT, /**< Touch point is in the lower right corner */
- CALIB_COMPLETE /**< Calibration is complete */
+ CALPHASE_NOT_STARTED = 0, /**< Constructed, but not yet started */
+ CALPHASE_UPPER_LEFT, /**< Touch point is in the upper left corner */
+ CALPHASE_UPPER_RIGHT, /**< Touch point is in the upper right corner */
+ CALPHASE_LOWER_RIGHT, /**< Touch point is in the lower left corner */
+ CALPHASE_LOWER_LEFT, /**< Touch point is in the lower right corner */
+ CALPHASE_COMPLETE /**< Calibration is complete */
};
/**
@@ -126,15 +143,17 @@ namespace NxWM
* CCalibration state data
*/
+ CTaskbar *m_taskbar; /**< The taskbar (used to terminate calibration) */
CFullScreenWindow *m_window; /**< The window for the calibration display */
CTouchscreen *m_touchscreen; /**< The touchscreen device */
- enum ECalibState m_state; /**< Current calibration display state */
+ pthread_t m_thread; /**< The calibration thread ID */
struct SCalibScreenInfo m_screenInfo; /**< Describes the current calibration display */
struct nxgl_point_s m_touchPos; /**< This is the last touch position */
+ volatile uint8_t m_calthread; /**< Current calibration display state (See ECalibThreadState)*/
+ uint8_t m_calphase; /**< Current calibration display state (See ECalibrationPhase)*/
bool m_stop; /**< True: We have been asked to stop the calibration */
bool m_touched; /**< True: The screen is touched */
uint8_t m_touchId; /**< The ID of the touch */
- sem_t m_waitSem; /**< Supports wait for calibration data */
struct nxgl_point_s m_calibData[CALIB_DATA_POINTS];
/**
@@ -146,6 +165,42 @@ namespace NxWM
void touchscreenInput(struct touch_sample_s &sample);
/**
+ * Start the calibration thread.
+ *
+ * @param initialState. The initial state of the calibration thread
+ * @return True if the thread was successfully started.
+ */
+
+ bool startCalibration(enum ECalThreadState initialState);
+
+ /**
+ * Return true if the calibration thread is running normally. There are
+ * lots of potential race conditions. Let's hope that things are running
+ * orderly and we that we do not have to concern ourself with them
+ *
+ * @return True if the calibration thread is runnning normally.
+ */
+
+ inline bool isRunning(void) const
+ {
+ // What if the boundary states CALTHREAD_STARTED and CALTHREAD_STOPREQUESTED?
+
+ return (m_calthread == CALTHREAD_RUNNING ||
+ m_calthread == CALTHREAD_HIDE ||
+ m_calthread == CALTHREAD_SHOW);
+ }
+
+ /**
+ * The calibration thread. This is the entry point of a thread that provides the
+ * calibration displays, waits for input, and collects calibration data.
+ *
+ * @param arg. The CCalibration 'this' pointer cast to a void*.
+ * @return This function always returns NULL when the thread exits
+ */
+
+ static FAR void *calibration(FAR void *arg);
+
+ /**
* This is the calibration state machine. It is called initially and then
* as new touchscreen data is received.
*/
@@ -158,16 +213,36 @@ namespace NxWM
void showCalibration(void);
+ /**
+ * Finish calibration steps and provide the calibration data to the
+ * touchscreen driver.
+ */
+
+ void finishCalibration(void);
+
+ /**
+ * Given the raw touch data collected by the calibration thread, create the
+ * massaged calibration data needed by CTouchscreen.
+ *
+ * @param data. A reference to the location to save the calibration data
+ * @return True if the calibration data was successfully created.
+ */
+
+ bool createCalibrationData(struct SCalibrationData &data);
+
public:
/**
* CCalibration Constructor
*
+ * @param taskbar. The taskbar instance used to terminate calibration
* @param window. The window to use for the calibration display
- * @param touchscreen. An instance of the class that wraps the touchscreen device.
+ * @param touchscreen. An instance of the class that wraps the
+ * touchscreen device.
*/
- CCalibration(CFullScreenWindow *window, CTouchscreen *touchscreen);
+ CCalibration(CTaskbar *taskbar, CFullScreenWindow *window,
+ CTouchscreen *touchscreen);
/**
* CCalibration Destructor
@@ -230,12 +305,14 @@ namespace NxWM
void redraw(void);
/**
- * Wait for calibration data to be received.
+ * Report of this is a "normal" window or a full screen window. The
+ * primary purpose of this method is so that window manager will know
+ * whether or not it show draw the task bar.
*
- * @return True if the calibration data was successfully obtained.
+ * @return True if this is a full screen window.
*/
- bool waitCalibrationData(struct SCalibrationData &data);
+ bool isFullScreen(void) const;
};
}
diff --git a/NxWidgets/nxwm/include/cfullscreenwindow.hxx b/NxWidgets/nxwm/include/cfullscreenwindow.hxx
index fb4788830..3c4117689 100644
--- a/NxWidgets/nxwm/include/cfullscreenwindow.hxx
+++ b/NxWidgets/nxwm/include/cfullscreenwindow.hxx
@@ -123,6 +123,16 @@ namespace NxWM
void setWindowLabel(NXWidgets::CNxString &appname);
/**
+ * Report of this is a "normal" window or a full screen window. The
+ * primary purpose of this method is so that window manager will know
+ * whether or not it show draw the task bar.
+ *
+ * @return True if this is a full screen window.
+ */
+
+ bool isFullScreen(void) const;
+
+ /**
* Register to receive callbacks when toolbar icons are selected
*/
diff --git a/NxWidgets/nxwm/include/cnxconsole.hxx b/NxWidgets/nxwm/include/cnxconsole.hxx
index 1c7aab193..426cf165f 100644
--- a/NxWidgets/nxwm/include/cnxconsole.hxx
+++ b/NxWidgets/nxwm/include/cnxconsole.hxx
@@ -173,6 +173,16 @@ namespace NxWM
*/
void redraw(void);
+
+ /**
+ * Report of this is a "normal" window or a full screen window. The
+ * primary purpose of this method is so that window manager will know
+ * whether or not it show draw the task bar.
+ *
+ * @return True if this is a full screen window.
+ */
+
+ bool isFullScreen(void) const;
};
}
#endif // __cplusplus
diff --git a/NxWidgets/nxwm/include/cstartwindow.hxx b/NxWidgets/nxwm/include/cstartwindow.hxx
index a04a4f1a5..5a5ea12f4 100644
--- a/NxWidgets/nxwm/include/cstartwindow.hxx
+++ b/NxWidgets/nxwm/include/cstartwindow.hxx
@@ -189,6 +189,16 @@ namespace NxWM
void redraw(void);
/**
+ * Report of this is a "normal" window or a full screen window. The
+ * primary purpose of this method is so that window manager will know
+ * whether or not it show draw the task bar.
+ *
+ * @return True if this is a full screen window.
+ */
+
+ bool isFullScreen(void) const;
+
+ /**
* Add the application to the start window. The general sequence for
* setting up the start window is:
*
diff --git a/NxWidgets/nxwm/include/ctouchscreen.hxx b/NxWidgets/nxwm/include/ctouchscreen.hxx
index 52433c1de..396400204 100644
--- a/NxWidgets/nxwm/include/ctouchscreen.hxx
+++ b/NxWidgets/nxwm/include/ctouchscreen.hxx
@@ -167,6 +167,17 @@ namespace NxWM
}
/**
+ * Is the touchscreen calibrated?
+ *
+ * @return True if the touchscreen has been calibrated.
+ */
+
+ inline bool isCalibrated(void) const
+ {
+ return m_calibrated;
+ }
+
+ /**
* Provide touchscreen calibration data. If calibration data is received (and
* the touchscreen is enabled), then received touchscreen data will be scaled
* using the calibration data and forward to the NX layer which dispatches the
@@ -175,7 +186,23 @@ namespace NxWM
* @param data. A reference to the touchscreen data.
*/
- void setCalibrationData(struct SCalibrationData &caldata);
+ void setCalibrationData(const struct SCalibrationData &caldata);
+
+ /**
+ * Recover the calibration data so that it can be saved to non-volatile storage.
+ *
+ * @param data. A reference to the touchscreen data.
+ * @return True if calibration data was successfully returned.
+ */
+
+ inline bool getCalibrationData(struct SCalibrationData &caldata) const
+ {
+ if (m_calibrated)
+ {
+ caldata = m_calibData;
+ }
+ return m_calibrated;
+ }
/**
* Capture raw driver data. This method will capture mode one raw touchscreen
diff --git a/NxWidgets/nxwm/include/iapplication.hxx b/NxWidgets/nxwm/include/iapplication.hxx
index e92e1908e..0d33db7bc 100644
--- a/NxWidgets/nxwm/include/iapplication.hxx
+++ b/NxWidgets/nxwm/include/iapplication.hxx
@@ -170,6 +170,16 @@ namespace NxWM
{
return m_topapp;
}
+
+ /**
+ * Report of this is a "normal" window or a full screen window. The
+ * primary purpose of this method is so that window manager will know
+ * whether or not it show draw the task bar.
+ *
+ * @return True if this is a full screen window.
+ */
+
+ virtual bool isFullScreen(void) const = 0;
};
}
diff --git a/NxWidgets/nxwm/include/iapplicationwindow.hxx b/NxWidgets/nxwm/include/iapplicationwindow.hxx
index 115998775..b00a03fa2 100644
--- a/NxWidgets/nxwm/include/iapplicationwindow.hxx
+++ b/NxWidgets/nxwm/include/iapplicationwindow.hxx
@@ -130,6 +130,16 @@ namespace NxWM
virtual void setWindowLabel(NXWidgets::CNxString &appname) = 0;
/**
+ * Report of this is a "normal" window or a full screen window. The
+ * primary purpose of this method is so that window manager will know
+ * whether or not it show draw the task bar.
+ *
+ * @return True if this is a full screen window.
+ */
+
+ virtual bool isFullScreen(void) const = 0;
+
+ /**
* Register to receive callbacks when toolbar icons are selected
*/
diff --git a/NxWidgets/nxwm/include/nxwmconfig.hxx b/NxWidgets/nxwm/include/nxwmconfig.hxx
index 359f7d095..88c2ea8db 100644
--- a/NxWidgets/nxwm/include/nxwmconfig.hxx
+++ b/NxWidgets/nxwm/include/nxwmconfig.hxx
@@ -333,6 +333,10 @@
* Default: "/dev/input0"
* CONFIG_NXWM_TOUCHSCREEN_SIGNO - The realtime signal used to wake up the
* touchscreen listener thread. Default: 5
+ * CONFIG_NXWM_TOUCHSCREEN_LISTENERPRIO - Priority of the touchscreen listener
+ * thread. Default: SCHED_PRIORITY_DEFAULT
+ * CONFIG_NXWM_TOUCHSCREEN_LISTENERSTACK - Touchscreen listener thread stack
+ * size. Default 2048
*/
#ifndef CONFIG_NXWM_TOUCHSCREEN_DEVNO
@@ -347,6 +351,14 @@
# define CONFIG_NXWM_TOUCHSCREEN_SIGNO 5
#endif
+#ifndef CONFIG_NXWM_TOUCHSCREEN_LISTENERPRIO
+# define CONFIG_NXWM_TOUCHSCREEN_LISTENERPRIO SCHED_PRIORITY_DEFAULT
+#endif
+
+#ifndef CONFIG_NXWM_TOUCHSCREEN_LISTENERSTACK
+# define CONFIG_NXWM_TOUCHSCREEN_LISTENERSTACK 2048
+#endif
+
/* Calibration display ******************************************************/
/**
* Calibration display settings:
@@ -363,6 +375,12 @@
* MKRGB(255, 255, 96) (very light yellow)
* CONFIG_NXWM_CALIBRATION_ICON - The ICON to use for the touchscreen
* calibration application. Default: NxWM::g_calibrationBitmap
+ * CONFIG_NXWM_CALIBRATION_SIGNO - The realtime signal used to wake up the
+ * touchscreen calibration thread. Default: 5
+ * CONFIG_NXWM_CALIBRATION_LISTENERPRIO - Priority of the touchscreen listener
+ * thread. Default: SCHED_PRIORITY_DEFAULT
+ * CONFIG_NXWM_CALIBRATION_LISTENERSTACK - Touchscreen listener thread stack
+ * size. Default 2048
*/
#ifndef CONFIG_NXWM_CALIBRATION_BACKGROUNDCOLOR
@@ -385,6 +403,18 @@
# define CONFIG_NXWM_CALIBRATION_ICON NxWM::g_calibrationBitmap
#endif
+#ifndef CONFIG_NXWM_CALIBRATION_SIGNO
+# define CONFIG_NXWM_CALIBRATION_SIGNO 5
+#endif
+
+#ifndef CONFIG_NXWM_CALIBRATION_LISTENERPRIO
+# define CONFIG_NXWM_CALIBRATION_LISTENERPRIO SCHED_PRIORITY_DEFAULT
+#endif
+
+#ifndef CONFIG_NXWM_CALIBRATION_LISTENERSTACK
+# define CONFIG_NXWM_CALIBRATION_LISTENERSTACK 2048
+#endif
+
/****************************************************************************
* Global Function Prototypes
****************************************************************************/