mad gaze x hkcs - · pdf filemad gaze x hkcs best smart glass app ... type_magnetic_field...
TRANSCRIPT
Table of Contents
1. Objective
2. Hardware Specification
3. Operating MAD Gaze
4. Hardware Sensors
4.1 Accelerometer
4.2 Magnetometer
4.3 Three-Axis Gyroscope
5. Code Sample
5.1 EditText Focus
5.2 Microphone Recording
5.3 Accelerometer
5.4 Layout Builder
5.5 Layout Testing
6. Support
1 Objective This technical document outlines the hardware and software specifications of
the two models of MAD Gaze - ARES and X5.
2 Hardware Specification MAD Gaze is an innovative device with Android based Operating System.
Hardware specification as below:
ARES Operating System Android 4.2
CPU 1.2 GHz Dual Core
RAM 512MB
Capacity 4GB
Display 320x240 transparent display screen
Audio Speaker
Camera 5M pixels
Video Playback 720P
Wi-Fi 802.11 b/g/n
Bluetooth 4.0
Positioning GPS and Glonass
Battery Capacity 370mAH
Sensors Three-Axis Gyroscope
Accelerometer
Magnetometer
Connection Micro-USB 2.0
Control Optical Trackpad
Voice Control
Mobile Control
Language English
Traditional Chinese
Simplified Chinese
X5
Operating System Android 5.1
CPU 1.3GHz Quad Core
RAM 2GB
Capacity 32GB
Display 800x480(WVGA) transparent display screen
Audio 3.5MM Stereo Audio
Speaker
Camera 8M pixels
Video Playback 1080P
Wi-Fi 802.11 b/g/n
Bluetooth 4.0LE
Positioning GPS and Glonass
Battery Capacity 600mAH
Sensors Three-Axis Gyroscope
Accelerometer
Magnetometer
Connection Micro-USB 2.0
Control 4 Button Set
Touch Panel
Voice Control
Mobile Control
Language English
Traditional Chinese
Simplified Chinese
3 Operating MAD Gaze This section covers the control of MAD Gaze. The Figure 3.1 illustrates
MAD Gaze control.
For ARES,
Figure 3.1 – Control of ARES
To control ARES, there are four gestures: Double Tap, Single Click, Double
Click and Long Press. Various gesture performs different function and can
be tracked by their corresponding Key Code. Figure 3.2 and Figure 3.3
illustrate the detail.
Event Function Equivalent Key Code
Double Tap Return KEYCODE_BACK
Long Press Home KEYCODE_HOME
Double Click Switch ON ScrollMode N/A
Single Click Click / Switch OFF
ScrollMode
N/A
Figure 3.2 – Controls Event of ARES
ScrollMode provides alternative controls in scrollable view, user should
trigger Double Click event before start scrolling, and quit ScrollMode with
Single Click event.
For X5,
Figure 3.3- Control of MAD Gaze X5
To control X5, there are buttons and touch panel.
For the buttons, single click and long press both perform different
function and can be tracked by different Key Code.
Function Equivalent Key Code
A Confirm KEYCODE_ENTER
B Forward KEYCODE_DPAD_RIGHT
C Backward KEYCODE_DPAD_LEFT
D Screen On/Off KEYCODE_SLEEP
Figure 3.4 – Single click on X5 buttons
Function Key Code
A Home KEYCODE_HOME
B Menu KEYCODE_MENU
C Return KEYCODE_BACK
D Shut Down KEYCODE_POWER
Figure 3.5 – Long press on X5 buttons
During Android development, onKeyDown is invoked while button is
clicked or long pressed with Key Code stated in the Figure 3.5 and Figure
3.4, such as KEYCODE_MENU, KEYCODE_HOME etc. Switch case is used to
identify the triggering button. Figure 3.6 & 3.7 will provide the detail
implementation.
Figure 3.6 – The implementation of detecting Key Code
For touch panel, tap gesture can invoke the element in UI. Since tap
gesture only target on focusable button, the elements are needed to set
focusable before setting the OnClickListener.
setFocusable(true) MANDATORY
setFocusableInTouchMode(true) OPTIONAL
requestFocus() MANDATORY
The following example shows the implementation of tap gesture on
touch panel.
Figure 3.7 – The implementation of tap gesture on touch panel
4 Hardware Sensors MAD Gaze is embedded with 3 sensors: Accelerometer, Magnetometer
and Gyroscope sensor. The Classes “SensorManager” and “Sensor”
are used to keep tracking on these sensors change. Figure 4.1 is the
example of initializing Sensor Manager and Sensor.
Figure 4.1 - The example of initializing Sensor Manager and Sensor
4.1 Accelerometer The Accelerometer collects the axis data when motion changed. The
following table shows obtained data:
Figure 4.2 - The obtained data from Accelerometer
Sensor Sensor event data Description
TYPE_ACCELEROMETER SensorEvent.values[0] Acceleration force along the x
axis (including gravity).
SensorEvent.values[1] Acceleration force along the y
axis (including gravity).
SensorEvent.values[2] Acceleration force along the z
axis (including gravity).
To keep track of the change in data collected, the following example
shows how to access the changing data from the sensor.
Figure 4.3 – Example to access the changing data from the Accelerometer
4.2 Magnetometer The Magnetometer provides raw field strength data (in μT) for each of
the three coordinate axes. The following table shows the obtained data:
Figure 4.4 - The accessed data in Magnetometer
Figure 4.5 – Example to prepare a gravity sensor listener
Sensor Sensor event data Description
TYPE_MAGNETIC_FIELD SensorEvent.values[0] Geomagnetic field strength along the x axis.
SensorEvent.values[1] Geomagnetic field strength along the y axis.
SensorEvent.values[2] Geomagnetic field strength along the z axis.
In order to keep tracking on the changes of sensor data, a sensor event
listener should be implemented as follow.
Figure 4.6 – Example to access the changing data from the Magnetometer
4.3 Three-Axis Gyroscope The Three-Axis Gyroscope collects the axis data when motion changed.
The following table shows the obtained data:
Figure 4.7 - The accessed data in Gyroscope Sensor
In order to keep tracking on the changes of sensor data, a sensor event
listener should be implemented as follow.
Figure 4.8 – Example to access the changing value from Gyroscope Sensor
Sensor Sensor event data Description
TYPE_GYROSCOPE SensorEvent.values[0] Rate of rotation around the x axis.
SensorEvent.values[1] Rate of rotation around the y axis.
SensorEvent.values[2] Rate of rotation around the z axis.
The following example shows how to re-register and unregister the
listeners:
Figure 4.9 – Example re-register and unregister the listener
5 Code Sample The Mad Gaze sample project shows four example, the menu layout
shown below:
Figure 5.1 – Layout of Menu
As the screen orientation on the Mad Gaze is landscape. So make sure
you added that element.
The SDK compile version of your android project
Device Maximum SDK Version
1 Mad Gaze ARES 16
2 Mad Gaze X5 22
5.1 EditText Focus
Figure 5.2 – Layout of Edittext button
There are two steps to change focus between two or more widgets, the
following example shows the steps:
Figure 5.3 – Changing focus step 1
Figure 5.4– Changing focus step 2
5.2 Microphone Recording
Figure 5.5 – Layout of Microphone button
Declaring the related variable:
Figure 5.6 – Declaring the variables
Method for start and stop recording
Figure 5.7 – Method for recording audio
Method for start and stop playing:
Figure 5.8 – Method for playing audio
5.3 Accelerometer
Figure 5.9 – Layout of Sensor button (Part 1)
Figure 5.10 – Layout of Sensor button (Part 2)
5.4 Layout Builder It is better to use dimen.xml to solve different resolution problem. Several
buttons may need to explicitly show on the layout so that it can be
activated by Mad Gaze ARES mouse. The following table shows the
dimen.xml location:
Device Location
1 Mad Gaze ARES res/value-ldpi
2 Mad Gaze X5 res/value-mdpi
Figure 5.11 – Mad Gaze ARES (240 x 320 - 120dpi)
Figure 5.12 – Mad Gaze X5 (480 x 800 – 160 dpi)
5.5 Layout Testing Here is a way to test your layout which is using Genymotion. After you
specify the Android OS, you have to change the screen size value on your
virtual device just you added. The following table shows the value of
screen size:
Device Screen Size
1 Mad Gaze ARES 240 x 320 - 120 dpi
2 Mad Gaze X5 480 x 800 - 160 dpi
Figure 5.13 – Configuration for Mad Gaze ARES in visual device
6 Support Official Website
http://madgaze.com/hkcs_contest16/
Official Email Address
Sample Code Download
http://madgaze.com/hkcs_contest16/supplements/sample/
IBM Bluemix Registration
https://console.ng.bluemix.net/registration/
IBM Bluemix Tutorial
http://www.ibm.com/cloud-computing/bluemix/library/
IBM Bluemix provides 30 days free service for each registration. Every
participant can reserve another 60 days free service extension by
providing us your Bluemix account name through mail at
[email protected] by Aug 19, 2016.
END