168
MOVERIO Pro Developer's Guide (Rev.1.0) Developer's Guide SEKIO EPSON CORPORATION

EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

  • Upload
    lythuan

  • View
    248

  • Download
    4

Embed Size (px)

Citation preview

Page 1: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

Developer's Guide

SEKIO EPSON CORPORATION

Page 2: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

Note the following points when using this guide.

The content of this guide may change without prior notice.

1. Reprinting part or all of this guide without prior permission from Seiko Epson, or reprinting for any other purposes

is strictly prohibited.

2. Programs and usage instructions used in this guide are for reference only, Seiko Epson cannot be held responsible

for any infringements (including industrial property rights) or damage caused to third parties. Furthermore, this

guide does not imply consent to licensing for third parties or industrial property rights for Seiko Epson.

3. This document does not relate to products that require a high level of reliability, such as life support equipment.

Epson accepts no responsibility if this product is used for such circumstances.

©SEIKO EPSON CORAPORATION 2015, All right reserved.

Page 3: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

Contents

1. Introduction _______________________________________________ 1

1.1. Product Summary and Functions _____________________________________________________2

1.2. Main System Specifications __________________________________________________________3

1.3. Basic Information for App Development _______________________________________________4

1.4. Other Main Functions _______________________________________________________________5

2. Developing Apps ___________________________________________ 6

2.1. Summary of Developing Apps _________________________________________________________7

2.2. Introduction to the Android SDK ______________________________________________________8

2.3. ADB driver settings ________________________________________________________________ 11

2.4. Connecting the BT-2000 to a computer _______________________________________________ 13

2.5. Including the SDK provided by EPSON ______________________________________________ 15

3. Display control ___________________________________________ 16

3.1. Display control summary___________________________________________________________ 17

3.2. Full screen display function ________________________________________________________ 18

3.3. Switch between 2D/3D display function ______________________________________________ 20

3.4. Backlight control __________________________________________________________________ 21

3.5. Mute function _____________________________________________________________________ 22

3.6. See-through function ______________________________________________________________ 23

4. UI control ________________________________________________ 24

4.1. UI control summary _______________________________________________________________ 25

4.2. Application interface list ___________________________________________________________ 29

4.3. Application interface details ________________________________________________________ 30

5. Audio commands _________________________________________ 32

5.1. Audio commands summary _________________________________________________________ 33

5.2. Application interface function summary _____________________________________________ 34

5.3. Application interface list ___________________________________________________________ 35

5.4. Application interface details ________________________________________________________ 36

5.5. Others ___________________________________________________________________________ 42

6. Camera control ___________________________________________ 45

6.1. Function summary ________________________________________________________________ 46

6.2. Available parameters ______________________________________________________________ 47

Page 4: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

6.3. Image organization and format _____________________________________________________ 48

6.4. Depth data characteristics _________________________________________________________ 49

6.5. Application interface function summary _____________________________________________ 51

6.6. Application interface list ___________________________________________________________ 52

6.7. Application interface details ________________________________________________________ 54

6.8. Depth Information Acquisition Flow Details __________________________________________ 86

6.9. Sample Code ______________________________________________________________________ 88

6.10. Important points ________________________________________________________________ 92

7. Sensor control ____________________________________________ 93

7.1. Sensor control summary ___________________________________________________________ 94

7.2. Using the sensor __________________________________________________________________ 97

7.3. Using SensorEventListener ________________________________________________________ 98

8. Bluetooth/BLE ___________________________________________ 99

8.1. Summary _______________________________________________________________________ 100

8.2. Usage method ___________________________________________________________________ 102

8.3. Important Points & Restrictions for BLE App Development ___________________________ 108

8.4. Import module ___________________________________________________________________ 109

8.5. Application interface list __________________________________________________________ 110

8.6. Supported GATT procedure table __________________________________________________ 112

8.7. Application interface details _______________________________________________________ 113

8.8. BLE Processing Sample Code ______________________________________________________ 147

9. Power control ____________________________________________ 157

9.1. Power control summary ___________________________________________________________ 158

9.2. Acquiring Battery Information _____________________________________________________ 159

10. Appendix _____________________________________________ 160

10.1. Self-diagnostic function _________________________________________________________ 161

Page 5: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

1

1. Introduction

Page 6: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

2

1.1. Product Summary and Functions

The BT-2000 is a smart headset for business use. The same optical see-through technology as

the consumer orientated MOVERIO BT-200 has been adopted. This allows information to be

displayed across a wide viewing area while keeping eye movement to a minimum, thereby

reducing fatigue and making it suitable for use at work. This also allows you to view your

surroundings while projecting an image, which adds an aspect of safety.

The weight of the product is supported by the entire head, allowing you to work for long periods

of time without feeling fatigued. You can work while checking images in a hands-free

environment.

Page 7: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

3

1.2. Main System Specifications

Item Specifications

Model number MOVERIO Pro BT-2000

Main processor OMAP4460 (dual core ARM Cortex A9)

System clock Max 1.2 GHz (Auto adjusts according to the system load and

temperature)

System software Android 4.0.4 / Linux 3.0.21

Internal storage (emmc) 8 GB (2 GB reserved for the system)

Main memory 1 GB

Power Battery operated/AC power operated

External memory MicroSD/MicroSDHC supported (32 GB max.)

No. of pixels in LCD panel 960x540 (QHD)/16:9/Refresh rate 60 Hz

Virtual screen size 80" (for virtual viewing distance of 5 m)

Color reproduction 24 bit full color (16,770,000 colors)

3D display Available (only for side by side)

User interface Audio commands: supports Japanese and English

Hardware keys: Power, lock, D-pad/OK key and A, B, X, Y keys

Others: Headset tap input function

Camera Built-in headset, stereo camera

Sensor Built-in headset, Gyro/acceleration/geomagnetic/tap detection

Wi-Fi IEEE 802.11a/b/g/n, Wi-Fi Direct support planned*

Bluetooth A2DP, HSP, HID, OPP, SPP, BLE support

GPS GPS function (cold start only), hot start support planned*

※ Support planned through later version upgrades.

Page 8: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

4

1.3. Basic Information for App Development

Item Description

CPU/ABI ARMv7 armeabi

Android API level 15

Device screen density mdpi

Screen type Tablet UI

Screen orientation Fixed at Landscape (without sensor rotation)

USB vendor ID 0x04B8

■ HOME, MENU, and BACK keys are supported by hardware keys

■ Touch screen is not used

■ Track pad is not supported

■ Except for Wi-Fi, data communication, such as 3G, is not supported

■ This is not a Google Certified device, meaning the following services which require Google

Certification are not available:

- Google Play

- Google location information service

- Additional services only available on Google Certified devices.

Page 9: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

5

1.4. Other Main Functions

As well as the standard Android API, the BT-2000, includes an EPSON original API, which

includes the following functions.

■ Display control

■ Physical UI control

■ Audio commands

■ Camera control

■ Sensor control

■ Bluetooth/BLE

■ Power control

The following chapters explain how to use these from an app.

Page 10: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

6

2. Developing Apps

Page 11: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

7

2.1. Summary of Developing Apps

The BT-2000 has adopted Android as the system software. Therefore, you can develop apps for

the BT-2000 in the same way as developing apps for Android smartphones. However, when

connecting the BT-2000 with the app development computer, or when using functions unique to

the BT-2000, you need to provide BT-2000 compatibility.

This chapter explains the following procedures necessary to develop apps for the BT-2000.

■ Introduction to the Android SDK

■ ADB driver settings

■ Connecting the BT-2000 to a computer

■ Including the SDK provided by EPSON

Page 12: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

8

2.2. Introduction to the Android SDK

The introduction to the Android SDK assumes the following steps will be performed in a Windows

7 environment.

2.2.1.1. Acquiring Android Studio

Download Android Studio from the following Website.

https://developer.android.com/sdk/index.html

2.2.1.2. Acquiring and installing JDK

Download the JDK (7 or later) from the following Website, and then install.

http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

(Not sure if it’s a good idea to include the link above as it may change over time)

2.2.1.3. Installing Android Studio

Follow the directions provided by the installer to install Android Studio.

Example) C:\Users\User name\AppData\Local\Android\sdk

* From here on, instructions assume Android Studio is installed in the folder above.

Page 13: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

9

2.2.1.4. Installing Platform-tools, SDK Platform, and USB Driver

Execute "C:\Users\User name\AppData\Local\Android\sdk\SDK Manager.exe".

* When you start SDK Manager, the dialog "No packages found" may be displayed.

This occurs when the proxy is not set correctly, and information cannot be updated.

Close all dialogs except for "Android SDK Manager", and then set the proxy in [Tools] -

[Options].

Page 14: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

10

Select the following necessary files in the SDK Manager, and then install.

■ [Tools] - [Android SDK Platform-tools]

■ [Android 4.0.3] - [SDK Platform]

■ [Extras] - [Google USB Driver」

Select the above, click [Install], and then select ‘Accept’ all.

This completes the introduction to the Android SDK.

Next, we will explain how to connect the BT-2000 to the app development computer, and setting

up the ADB driver.

Page 15: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

11

2.3. ADB driver settings

Here we will explain how to connect the BT-2000 to the app development computer, and set the

ADB driver.

2.3.1.1. Editing the Google USB Driver

Settings for the BT-2000 are added to the Google USB Driver installed in the previous item.

Open [C:\Users\User name\AppData\Local\Android\sdk\extras\google\usb_driver\android_winusb.inf]

in a text editor, and then add the following 6 lines to 2 points in the [Google.NTx86] and the

[Google.NTamd64].

;EPSON MOVERIO BT-2 series MTP

%SingleAdbInterface% = USB_Install, USB¥VID_04B8&PID_0C06

%CompositeAdbInterface% = USB_Install, USB¥VID_04B8&PID_0C06&MI_01

; EPSON MOVERIO BT-2 series PTP

%SingleAdbInterface% = USB_Install, USB¥VID_04B8&PID_0C07

%CompositeAdbInterface% = USB_Install, USB¥VID_04B8&PID_0C07&MI_01

Page 16: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

12

2.3.1.2. Vendor ID setting

Set ADB as the vendor ID.

Start the command prompt, run " cd C:\Users\User name\AppData\Local\Android\sdk\tools " and

change the work folder.

Execute the android.bat, and handle the "update adb" argument as shown below.

The file is created in [C:\Users\User name\.android\adb_usb.ini]

Open this file (adb_usb.ini) in notepad, and add the vendor ID (0x04B8) as shown below.

This completes setting up the ADB driver in the app development environment.

The next section explains how to connect the BT-2000 to a computer.

# ANDROID 3RD PARTY USB VENDOR ID LIST -- DO NOT EDIT.

# USE 'android update adb' TO GENERATE.

# 1 USB VENDOR ID PER LINE.

0x04B8

Omit

Omit

Page 17: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

13

2.4. Connecting the BT-2000 to a computer

This section explains how to connect the BT-2000 to a computer after the ADB driver setting has

been completed.

2.4.1.1. BT-2000 settings

Start the BT-2000, and then select "Settings" - "Developer options" - "USB debugging".

2.4.1.2. Install the BT-2000 driver

Connect a USB cable to the computer on which the BT-2000 is running and the ADB driver

settings are complete.

If the computer does not respond, disconnect the USB cable, restart the BT-2000, and then

reconnect the USB cable.

When "New device detected" is displayed on the computer, select [Control Panel] - [Hardware

and Sound] - [Device Manager].

Right-click [embt2] from [Other devices], and then select Update Driver Software.

Page 18: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

14

Select [Browse my computer for driver software].

Select the driver from the following path.

“C:\Users\User name\AppData\Local\Android\sdk\extras\google\usb_driver”

When [Android Composite ADB Interface] is displayed in [Android Device] as shown below, ADB

connection is available.

2.4.1.3. Checking the connection

You can check if the computer and the BT-2000 are connected by using the ADB check

command.

Start the command prompt, run "cd C:\Users\ User name \AppData\Local\Android\sdk\tools ", and

move the folder.* It is useful to maintain the environment variable path mentioned above.

When you execute "adb devices" the message "0123456789ABCDEF2 device" is displayed. ADB

connection is complete.

* If this is not displayed, reconnect the BT-2000 to the USB port, and rerun the "adb devices"

command.

Page 19: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

15

2.5. Including the SDK provided by EPSON

The following procedures assume app development in Android Studio.

- Create a Project from [File] - [New Project]

- Display Project View in Android Studio, and then create a "libs" folder in the Project folder from

[File] - [New] - [Directory].

- Copy the "*.jar" file you want to use for Explorer to the "libs" folder.

- Right-click the *.jar file in Project View from Android Studio, and then select [Add as Library...].

- Import necessary packages in the application source code.

- Add the necessary access permission in AndroidManifest.xml.

* The package name, permissions etc indicate the necessary items for each of the following

function sections.

Page 20: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

16

3. Display control

Page 21: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

17

3.1. Display control summary

This chapter explains the display control function for the BT-2000.

The BT-2000 is a smart headset with an optical see-through

function.

You can overlay information on the display using an optical

technique that provides clear images, without disturbing the

view of the user's surroundings. It is also possible to project more information since the device

uses a see-through system allowing images to be projected for both eyes, as opposed to the

single image one-eye type. The advantage with this device is that eye movement is kept to a

minimum, thereby reducing fatigue and making it suitable for use at work.

You can also flip-up the MOVERIO Pro display, which allows you to set the display section by

holding it with one hand when you want to superimpose video or images on your current work

space.

The following section explains the functions and usage methods available.

■ Full screen display function

■ Switch between 2D/3D display function (API)

■ Mute function (API)

■ Backlight control

■ See-through function

Page 22: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

18

3.2. Full screen display function

The MOVERIO Pro BT-2000 is based on Android 4.0 Tablet UI. This specification does not

normally allow full display in applications in Android 4.0 Tablet UI; however, you can follow the

steps below to enable full display by specifying a unique flag in the app.

■ Executing full screen in applications

Execute the following process in onCreate() for each Activity.

Window win = getWindow();

WindowManager.LayoutParams winParams = win.getAttributes();

winParams.flags |= WindowManager.LayoutParams.FLAG_SMARTFULLSCREEN;

win.setAttributes(winParams);

For apps with multiple Activitys, execute the above process for each Activity.

■ Add an import definition

import android.view.Window;

import android.view.WindowManager;

Furthermore, since the import file itself exists in the SDK, when using the standard SDK issued by

Google, the build will pass through with the following temporary support.

■ Change defined values to direct values (for standard SDK)

* Defined value: FLAG_SMARTFULLSCREEN = 0x80000000;

winParams.flags |= WindowManager.LayoutParams.FLAG_SMARTFULLSCREEN;

winParams.flags |= 0x80000000;

Page 23: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

19

Enable full screen

display

(hide status bar)

Disable full screen

display

(show status bar)

Page 24: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

20

3.3. Switch between 2D/3D display function

The BT-2000 allows you to display 3D content using Side by side.

The side by side method places images on the left and right of the screen frame.

When realizing the side by side system with image frames of QHD size, you need to arrange

images from left to right by reducing 960 x 540 by half

(480 x 540 pixels) to create one frame of a QHD image.

You can use the following interface to separate images for the left and right eyes in the side by

side system, and output each display.

■ Interface

int set2d3d(int dimension)

■ Parameter

dimension: 2D/3D mode status DIMENSION_2D/DIMENSION_3D

Left eye image Right eye image

Total 960

pixels 480 pixels 480 pixels

540 pixels

Page 25: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

21

3.4. Backlight control

3.4.1. Adjust backlight brightness

When changing the backlight display built-into the headset, you can change the transparency of

the displayed image.

When the brightness is low, the image is more transparent, and when the brightness is high, the

image is more opaque.

■ Interface

Display brightness settings

int setBacklight(int backlight)

Display brightness acquisition

int getBacklight()

■ Parameter

backlight: Brightness level 0 (dark) to 20 (bright)

3.4.2. Backlight auto dimmer

[TBD]

Page 26: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

22

3.5. Mute function

3.5.1. Display mute

The mute function allows you to temporarily stop displaying images.

Use the following interface to activate and then deactivate mute.

■ Procedure

Using DisplayControl from the library (Jar file) provided

■ Interface

int setMute(boolean mute)

■ Parameter

mute: Mute ON (TRUE)/OFF (FALSE)

■ Return value

Execution result 0 (normal value), any other value (error)

3.5.2. Audio mute

The audio mute function allows you to temporarily stop outputting audio.

Use the following interface to activate and then deactivate mute.

■ Procedure

Using AudioControl from the library (Jar file) provided

■ Interface

int setMute(boolean mute)

■ Parameter

mute: Mute ON (TRUE)/OFF (FALSE)

■ Return value

Execution result 0 (normal value), any other value (error)

Page 27: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

23

3.6. See-through function

MOVERIO Pro is a device that uses projection technology.

Projection is displayed by reflecting light through an Active Matrix LCD panel into a light-guided

panel. It is possible to create a half-mirror version (whereby not all the pixels are needed)

allowing images to be arranged over a real-life scene giving a sense of transparency, and creating

a more vivid augmented reality experience.

To create this transparent background effect, so visual elements (text, graphics…) stand out

vividly, the background will need to be set to black when drawing on the projection, so you

display the target section overlapping with the actual images.

(In this situation, we recommend that you do not use the shade.)

The following steps allow you to create this AR effect using the see-through function.

1) Execute full screen support.

To reduce the feeling of being in a screen, remove everything except for the necessary image

(status bar etc…).

2) Make the background black.

Make everything black except for the object you want to display.

In theory, the black section should keep out external light.

Object you want to display Displayed scene

Real scene view

Page 28: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

24

4. UI control

Page 29: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

25

4.1. UI control summary

The user interface for the BT-2000 is composed of 11 hardware buttons; power, key lock, A, B, X,

Y, D-pad (up, down, left, right), and the select/OK key. This section explains the functions called

when these buttons are pressed, as well as the key assignment change function that is unique to

the BT-2000.

4.1.1. Hardware button types and functions

The BT-2000 comes with the hardware buttons shown in figure 4-1. The functions for each

button are shown in table 4-1.

Figure 4-1 BT-2000 built-in hardware button

Table 4-1 List of main parameter combinations

Button name Function

Power Turn the device ON/OFF

Key lock Enable/disable button input

A button Back

B button Home

X button Menu

Y button MultiFunctionOSD display*1 (See table 2)

D-pad up Upper input

D-pad down Lower input

D-pad left Left input

D-pad right Right input

Select/OK key Confirm

LED indicator

Key lock button

D-pad (up, down, left, right)

D-pad (select/OK)

Power button

A button

B button

X button

Y button

Page 30: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

26

Table 4-2: MultiFunctionOSD display function

MultiFunction operations

Number of times

button pressed

Function Adjustment method

Press once Display OSD, adjust

volume

D-pad up/right: Volume Up

D-pad down/left: Volume Down

Press twice Adjust brightness D-pad up/right: Increase screen brightness

D-pad down/left: Decrease screen

brightness

Press three times Switch between 2D/3D D-pad up/right: Set 2D

D-pad down/left: Set 3D

Page 31: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

27

4.1.2. BT-2000 change key assignment function

The BT-2000 allows you to change the functions assigned to the hardware buttons mentioned

above. The standard hardware button assignments are applied in Default mode, the changed

hardware button assignments are applied in User mode.

Default mode User mode

Button name Function Button name Function

Power Turn the device

ON/OFF

Power Turn the device ON/OFF

Key lock Enable/disable

button input

Key lock Enable/disable button

input

A button Back A button F1

B button Home B button F2

X button Menu Change

mode

X button F3

Y button Multi Function OSD

Display

Y button F4

D-pad up Move up D-pad up Move up

D-pad down Move down D-pad down Move down

D-pad left Move left D-pad left Move left

D-pad right Move right D-pad right Move right

select/OK key Confirm select/OK key Confirm

Figure 1: Hardware buttons and functions

Events called when hardware buttons are pressed

The following key events are generated in default mode.

Hardware button Key event

A button KeyEvent.KEYCODE_BACK

B button KeyEvent.KEYCODE_HOME

X button KeyEvent.KEYCODE_MENU

Y button ( Reserved in the system )

D-pad up KeyEvent.KEYCODE_DPAD_UP

D-pad down KeyEvent.KEYCODE_DPAD_DOWN

D-pad left KeyEvent.KEYCODE_DPAD_LEFT

D-pad right KeyEvent.KEYCODE_DPAD_RIGHT

select/OK key KeyEvent.KEYCODE_DPAD_CENTER

The following events are generated in user mode.

Page 32: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

28

Hardware

buttons

Key event

A button KeyEvent.KEYCODE_F1

B button KeyEvent.KEYCODE_F2

X button KeyEvent.KEYCODE_F3

Y button KeyEvent.KEYCODE_F4

D-pad up KeyEvent.KEYCODE_DPAD_UP

D-pad down KeyEvent.KEYCODE_DPAD_DOWN

D-pad left KeyEvent.KEYCODE_DPAD_LEFT

D-pad right KeyEvent.KEYCODE_DPAD_RIGHT

select/OK key KeyEvent.KEYCODE_DPAD_CENTER

■ Using the change function for key assignments

By changing the key assignments, the key codes called when you press the A, B, X, or Y buttons

are not the standard Back, Home, or Menu buttons in Android, instead, the key codes are

changed to F1 to F4.

Therefore, you can include optional funtions to the F1 to F4 codes making use of the A, B, X, and

Y buttons as with the application's original function.

■ Specifications for status transitions in key assignment mode

Status transitions (where the value of the key is changed) for the key assignment mode cannot

be set in the app; they should be set in the system. For example, when the key assignment

mode for application A is set to User mode, and then a different application B is started, the key

assignment mode for application B is also set to User mode.

The BT-2000 is equipped with a standard iWnnIME text input system. This system uses the

Back, Menu, and D-pad keys for input, and automatically changes the key assignments to

Default mode when starting up the BT-2000. When closing an app, the key assignment mode

changes to the mode set in iWnnIME for the last app that was started, however operations are

not guaranteed when an error occurs or if the app does not close normally. For key assignment

mode management, we recommend using the mode used for the last app to be started.

When an app is constructed with multiple source calls, and calls that apply not just iWnnIME, we

recommend managing the key assignment status according to each app that is started.

Page 33: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

29

4.2. Application interface list

Tables 4-3 provide a list of application interfaces for changing key assignments.

You also need to import the following models to use each API.

android.btutil.KeyAssign

Table 4-4-3 android.btutil.KeyAssign for application interface list

NO. Function name Function summary Notes

1 getKeyAssignMode Acquires the mode for the current key

assignment.

2 setKeyAssignMode Set and apply a key assignment mode.

Page 34: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

30

4.3. Application interface details

4.3.1. getKeyAssignMode

Function

Acquire the mode for the current key assignment.

Format

Parameter

None.

Return value

Model Explanation

Int - KEYASSIGN_MODE_DEFAULT: Default mode

- KEYASSIGN_MODE_USER: User mode

Usage procedure

static int getKeyAssignMode (void);

int mode; /*Acquire the current mode*/

mode = KeyAssign.getKeyAssignMode ();

/*Acquire provided camera mode*/

if (mode == KeyAssign.KEYASSIGN_MODE_USER) {

/*Process*/ }

Page 35: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

31

4.3.2. setKeyAssignMode

Function

Set key assignment mode and apply to the system.

Format

Parameter

Model name Explanation

int mode Key assignment mode to be set. You can specify the value

using a macro for the following android.btutil.KeyAssign

classes.

- KEYASSIGN_MODE_DEFAULT (or 0)

- KEYASSIGN_MODE_USER (or 1)

Return value

false: setting failed

true: setting succeeded

Use procedure 1 (when side by side is set)

boolean setKeyAssignMode(int mode);

/*Set user mode*/

KeyAssign.setKeyAssignMode (KeyAssign.KEYASSIGN_MODE_USER);

Page 36: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

32

5. Audio commands

Page 37: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

33

5.1. Audio commands summary

The BT-2000 allows you to select*1 an information file containing vocabulary that you want to use

for audio recognition. The device recognizes the audio included in this vocabulary information, and

returns the corresponding ID.Audio is input using a microphone, and the device recognizes audio

that has been registered*2.

Audio is registered using an audio information file that matches IDs to recognized vocabulary (lms

file).

When recognized audio is input, the application can use a callback function to acquire the ID for the

audio.

By mounting an optional process in the application for each ID acquired by callback, audio input can

be used as a trigger.

*1 When no file is specified, the default list stored on the system is selected automatically.

*2 Only vocabulary that has already been registered can be recognized, this differs from the

standard sound recognition software that uses network access to confirm words.

Page 38: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

34

5.2. Application interface function summary

You can use the following functions by using audio command API.

(1) Connect to a service class that provides audio command functions.

(2) Disconnect from a service class that provides audio command functions.

(3) Acquire an interface to control audio commands.

(4) Register a callback.

(5) Cancel a callback.

(6) Set parameters used for the audio recognition start conditions.

(7) Enable audio input status.

(8) Disable audio input status.

To use API, execute VoiceCommandClient.bindToRemoteRunningService() first and connect to a

service class that provides an audio command function. Next, execute

VoiceCommandClient.registerCallback() to register a callback to receive recognition results.

When connection to the service is complete, execute getVoiceCommandSystemInterface() to

acquire the interface for controlling the audio command function.

Page 39: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

35

5.3. Application interface list

Tables 5-1 and 5-2 provide a list of application interfaces for using the audio command function.

You also need to import the following models to use each API.

android.media.epson.IVoiceCommandInterface

android.media.epson.IVoiceCommandServiceCallbacks

android.media.epson.VoiceCommandClient

android.media.epsonVoiceCommandClientCallbacks

android.media.epson.VoiceCommandServiceCommon

Table 5-1 android.media.epson.IVoiceCommandInterface for application interface list

NO. Function name Function summary Notes

1 setSnr Set parameters used for the audio recognition start

conditions. Set the recognition start conditions according

to the amount (S/N ratio) of audio (noise) being input in the

usage environment.

2 getSnr Acquire the current value for the set S/N ratio.

3 setAmp Set parameters used for the audio recognition start

conditions. Set the recognition start conditions according

to the amplitude for the input audio.

4 getAmp Acquire the setting for the amplitude of the current input

audio.

5 start Enable audio input.

6 stop Disable audio input.

Table 5-2 android.media.epson. VoiceCommandClient for application interface list

NO. Function name Function summary Notes

1 registerCallback Register a callback to acquire the recognition

results for an audio command.

2 unRegisterCallback Cancel a callback to acquire the recognition

results for an audio command.

3 getVoiceCommandSystemInterface Acquire an IVoiceCommandInterface class as the

interface to control audio commands.

4 bindToRemoteRunningService Connect to a service class of audio commands.

5 unBindFromRemoteRunningService Disconnect from a service class of audio

commands.

Page 40: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

36

5.4. Application interface details

5.4.1. setSnr

Function

Set parameters used for the audio recognition start conditions. Set the recognition start

conditions according to the amount (S/N ratio) of audio (noise) being input in the usage

environment.

Format

Parameter

Value of the S/N ratio to be set. Minimum: 0, Maximum: 255.99

If the value is too large, the app should not be influenced by surrounding noise,

however the user will need to talk loudly to trigger a response.

Return value

Model Explanation

boolean Set the value for the S/N ratio as the voice recognition start

condition.

5.4.2. getSnr

Function

Acquire the set S/N ratio.

Format

Parameter

None.

Return value

Model Explanation

float The current S/N ratio value used as the recognition start condition.

boolean setSnr (float snr);

float getSnr();

Page 41: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

37

5.4.3. setAmp

Function

Set parameters used for the audio recognition start conditions. Set the amplitude value as

one of the recognition start conditions.

Format

Parameter

Value of the amplitude to be set. Minimum: 0, Maximum: 32767

If the value is too large, the app should not be influenced by surrounding noise,

however the user will need to talk loudly to trigger a response.

Return value

Model Explanation

boolean Success: true, Failure: false

boolean setSnr (int amp);

Page 42: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

38

5.4.4. getAmp

Function

Acquire the set amplitude value.

Format

Parameter

None.

Return value

Model Explanation

Int Set the value for the amplitude as the input audio voice recognition

start condition.

5.4.5. start

Function

Enable audio input status.

Format

Parameter

Absolute path to the lms file. When null is specified, the lms file stored in the system is

automatically selected and set (the default lms file) based on the region information for

the operating system of the BT-2000.

Return value

Model Explanation

boolean Success: true, Failure: false

int getAmp();

boolean start(String path);

Page 43: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

39

5.4.6. stop

Function

Disable audio input.

Format

Parameter

None.

Return value

Model Explanation

boolean Success: true, Failure: false

5.4.7. registerCallback

Function

Register a callback to acquire the recognition results for an audio command.

Format

Parameter

VoiceCommandClientCallbacks class object

Return value

None

boolean stop(void);

void registerCallback(VoiceCommandClientCallbacks cb)

Page 44: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

40

5.4.8. unRegisterCallback

Function

Cancel a callback to acquire the recognition results for an audio command.

Format

Parameter

None.

Return value

None.

5.4.9. getVoiceCommandSystemInterface

Function

Acquire a class as the interface to control audio commands.

Format

Parameter

None.

Return value

Model Explanation

IVoiceCommandInterface Interface for audio command control

void unRegisterCallback()

IVoiceCommandInterface getVoiceCommandSystemInterface()

Page 45: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

41

5.4.10. bindToRemoteRunningService

Function

Connect to a service class that provides audio command functions.

Format

Parameter

An Activity object connected to the audio command service.

Return value

None.

5.4.11. unBindFromRemoteRunningService

Function

Disconnect from an audio command service.

Format

Parameter

An Activity object connected to the audio command service.

Return value

None.

void bindToRemoteRunningService(Activity activity);

void unBindFromRemoteRunningService(Activity activity)

Page 46: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

42

5.5. Others

5.5.1. Timing for reflecting the setting for the voice recognition start conditions

When audio input recognition switches from disabled to enabled, the voice recognition start

conditions are reflected in the system.

Therefore, when IVoiceCommandInterface.start() is called after calling

IVoiceCommandInterface.stop(), audio input is disabled and IVoiceCommandInterface.setSnr() is

called, the setting is then reflected once by the system when you change the recognition start

conditions when audio input is enabled.

5.5.2. List of default lms files and vocabulary

- /system/vendor/bin/epe_au01_E1.lms default lms file(Except for Japan)

- /system/vendor/bin/epe_au01_E2.lms

- /system/vendor/bin/epe_au01_j1.lms default lms file(For Japan)

- /system/vendor/bin/epe_au01_j2.lms

- epe_au01_E1.lms

ID number Audio input ID number Audio input ID number Audio input

3 Next 21 Blue 34 Action 4

4 Return 22 Red 35 Action 5

5 Enter 23 Green 36 Action 6

6 Start 24 Yellow 51 Zoom In

7 Stop 31 Action 1 52 Zoom Out

18 Display On 32 Action 2 101 Version

19 Display Off 33 Action 3

- epe_au01_E2.lms

ID number Audio input ID number Audio input ID number Audio input

1 Home 14 Go Right 41 Item 1

2 Menu 15 Go Left 42 Item 2

8 Try Again 16 Go up 43 Item 3

9 Finish 17 Go Down 44 Item 4

10 Connect 21 Blue 45 Item 5

11 Shoot 22 Red 46 Item 6

12 Rotate 23 Green 101 Version

13 Setting 24 Yellow

Page 47: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

43

- epe_au01_j1.lms

ID number Audio input ID number Audio input ID number Audio input

3 Next 21 Blue 34 Select 4

4 Return 22 Red 35 Select 5

5 Confirm 23 Green 36 Select 6

6 Start 24 Yellow 51 Zoom In

7 Stop 31 Select 1 52 Zoom Out

18 Display On 32 Select 2 101 Version

19 Display Off 33 Select 3

- epe_au01_j2.lms

ID number Audio input ID number Audio input ID number Audio input

1 Home 14 Go Right 41 Item 1

2 Menu 15 Go Left 42 Item 2

8 Try Again 16 Go Up 43 Item 3

9 Finish 17 Go Down 44 Item 4

10 Connect 21 Blue 45 Item 5

11 Shoot 22 Red 46 Item 6

12 Rotate 23 Green 101 Version

13 Setting 24 Yellow

Page 48: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

44

5.5.3. Callbacks that acquire recognition results

Create callbacks in the following format.

void onVoiceCommand(int arg0, String arg1)

For int arg0, the recognized word is assigned an ID, and for String arg1 the recognized word text

string is stored.

5.5.4. Audio command API usage flow example

See the sample source for audio commands for more details.

Page 49: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

45

6. Camera control

Page 50: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

46

6.1. Function summary

This chapter explains the available camera functions for the BT-2000.

The headset section of the BT-2000 is equipped with a stereo camera which offers a wide

variety of uses including the following three types of camera image.

1) Standard camera images

2) Stereo images using the compound camera

3) Depth (distance) images using the compound camera

See figures 6-1 to 6-3 for the functions for each image. When handling these images, you need

to change the camera to a mode that supports the target image. For image combinations

supported in each mode, see table 6-1 or 6-2.

Table 6-1 Image size for each mode (for still images)

Side by Side 5MPixel Full HD HD VGA Depth

2048x1936x2 2596x1948 1920x1080 1280x720 640x480 640x480

Single VGA ― ― ― ― ○ ―

Single 720 ― ― ― ○ ― ―

Single 1080 ― ― ○ ― ― ―

Single 5M ― ○ ― ― ― ―

Side by Side ○ ― ― ― ― ―

Depth ― ― ― ― ― ―

EdoF ― ○ ― ― ― ―

Table 6-2 Image size for each mode (while previewing)

Side by Side 5MPixel Full HD HD VGA Depth

2048x1936x2 2596x1948 1920x1080 1280x720 640x480 640x480

Single VGA ― ― ― ― ○ ―

Single 720 ― ― ― ○ ○ ―

Single 1080 ― ― ○ ○ ○ ―

Single 5M ― ― ○ ○ ○ ―

Side by Side ― ― ○ ○ ○ ―

Depth ― ― ― ― ― ○

EdoF ― ― ○ ○ ○ ○

Page 51: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

47

6.2. Available parameters

A list of available parameters is provided in table 6-3.

Table 6-3 List of available parameters

Parameter name Setting region Default value

Mode Single VGA / Single 720 / Single 1080 / Single 5M

Side by Side / Depth / EdoF

Single VGA

Preview resolution*1 1080p / 720p / VGA VGA

Depth ON/OFF*1 OFF/ON OFF

Frame rate*1 60/30/15/7.5 30

Exposure*2 -5 to +6 0

White balance*2 Daylight/ fluorescent/ Warm florescent fluorescent

Contrast -3 to +3 0

Edge blending -3 to +3 0

*1: The available range varies depending on the mode. See table 6-4 for more information.

*2: Exposure and white balance are set manually. Make settings according to your usage

environment.

Table 6-4 List of main parameter combinations

No. Mode Camera

resolution

Preview resolution Shooting

resolution

Frame rate

1 edof 2596x1948 640x480

1280x720

1920x1080

2596x1948 7.5fps

2 side-by-side 4096x1948 640x480

1280x720

1920x1080

4096x1948 7.5fps

3 single-through-vga 640x480 640x480 640x480 7.5fps

15fps

30fps

60fps

4 single-through-720p 1280x720 640x480

1280x720

1280x720 7.5fps

15fps

30fps

5 single-through-1080p 1920x1080 640x480

1280x720

1920x1080

1920x1080 7.5fps

15fps

6 single-through-5m 2596x1948 640x480

1280x720

1920x1080

2596x1948 7.5fps

7 depth-only - - - 7.5fps

15fps

Page 52: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

48

6.3. Image organization and format

You can acquire the following three types of data using API in the BT-2000.

・ Standard images (NV21)

・ Side by Side images (NV21)

・ Depth (distance) data (8bit Gray Scale)

Figure 6-1 Example of standard images

Figure 6-2 Example of side by side images

Depth data is explained in the next section.

Page 53: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

49

6.4. Depth data characteristics

Depth data is managed using 8 bit gray scale data, whereby the data values (brightness)

indicate the distance. This is done by calculating the parallax (the offset between the two

cameras) for the compound camera in the hardware, and aggregating the VGA size in pixels.

Note that depth data is reduced to VGA size even if the mode setting is set to 5MP in size. Also,

if the resolution is not high enough in VGA for the depth data, then you can acquire side by side

images and increase the resolution using range measurement software.

The higher the the depth value brings the depth data distance closer, and reducing the value

makes it further away. When converting the brightness as gray scale data, the highest value of

255 brings the distance closer, and the lowest value of 0 makes it further away.

Figure 6-3 Shooting depth images

Furthermore, use data inferred in this way as the correct value is not provided in the product

specifications for depth data with a 50 pixel edge.

Figure 6-4 Available range for depth data

Far Near

Except for surrounding 50

pixels

the area is available

50pixel

50pixel

Page 54: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

50

For the relationship between the value and the distance acquired by depth data, see the

following table. Note that changes and calculation errors in the shooting environment for the

depth data may also occur. Distance: Distanse = 10 × 255 𝐷𝑒𝑛𝑠𝑖𝑡𝑦⁄ [𝑐𝑚] (equation 6-1)

Table 6-5 Brightness value and measurement distance

Number Range Number Range Number Range Number Range Number Range Number Range

0 ∞ 48 53.1 96 26.6 144 17.7 192 13.3 240 10.6

1 2550 49 52.0 97 26.3 145 17.6 193 13.2 241 10.6

2 1275 50 51.0 98 26.0 146 17.5 194 13.1 242 10.5

3 850 51 50.0 99 25.8 147 17.3 195 13.1 243 10.5

4 638 52 49.0 100 25.5 148 17.2 196 13.0 244 10.5

5 510 53 48.1 101 25.2 149 17.1 197 12.9 245 10.4

6 425 54 47.2 102 25.0 150 17.0 198 12.9 246 10.4

7 364 55 46.4 103 24.8 151 16.9 199 12.8 247 10.3

8 319 56 45.5 104 24.5 152 16.8 200 12.8 248 10.3

9 283 57 44.7 105 24.3 153 16.7 201 12.7 249 10.2

10 255 58 44.0 106 24.1 154 16.6 202 12.6 250 10.2

11 232 59 43.2 107 23.8 155 16.5 203 12.6 251 10.2

12 213 60 42.5 108 23.6 156 16.3 204 12.5 252 10.1

13 196 61 41.8 109 23.4 157 16.2 205 12.4 253 10.1

14 182 62 41.1 110 23.2 158 16.1 206 12.4 254 10.0

15 170 63 40.5 111 23.0 159 16.0 207 12.3 255 10.0

16 159 64 39.8 112 22.8 160 15.9 208 12.3

17 150 65 39.2 113 22.6 161 15.8 209 12.2

18 142 66 38.6 114 22.4 162 15.7 210 12.1

19 134 67 38.1 115 22.2 163 15.6 211 12.1

20 128 68 37.5 116 22.0 164 15.5 212 12.0

21 121 69 37.0 117 21.8 165 15.5 213 12.0

22 126 70 36.4 118 21.6 166 15.4 214 11.9

23 111 71 35.9 119 21.4 167 15.3 215 11.9

24 106 72 35.4 120 21.3 168 15.2 216 11.8

25 102 73 34.9 121 21.1 169 15.1 217 11.8

26 98.1 74 34.5 122 20.9 170 15.0 218 11.7

27 94.4 75 34.0 123 20.7 171 14.9 219 11.6

28 91.1 76 33.6 124 20.6 172 14.8 220 11.6

29 87.9 77 33.1 125 20.4 173 14.7 221 11.5

30 85.0 78 32.7 126 20.2 174 14.7 222 11.5

31 82.3 79 32.3 127 20.1 175 14.6 223 11.4

32 79.7 80 31.9 128 19.9 176 14.5 224 11.4

33 77.3 81 31.5 129 19.8 177 14.4 225 11.3

34 75.0 82 31.1 130 19.6 178 14.3 226 11.3

35 72.9 83 30.7 131 19.5 179 14.2 227 11.2

36 70.8 84 30.4 132 19.3 180 14.2 228 11.2

37 68.9 85 30.0 133 19.2 181 14.1 229 11.1

38 67.1 86 29.7 134 19.0 182 14.0 230 11.1

39 65.4 87 29.3 135 18.9 183 13.9 231 11.0

40 63.8 88 29.0 135 18.8 184 13.9 232 11.0

41 62.2 89 28.7 137 18.6 185 13.8 233 10.9

42 60.7 90 28.3 138 18.5 186 13.7 234 10.9

43 59.3 91 28.0 139 18.3 187 13.6 235 10.9

44 58.0 92 27.7 140 18.2 188 13.6 236 10.8

45 56.7 93 27.4 141 18.1 189 13.5 237 10.8

46 55.4 94 27.1 142 18.0 190 13.4 238 10.7

47 54.3 95 26.8 143 17.8 191 13.4 239 10.7

Page 55: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

51

6.5. Application interface function summary

The following explains how to use API to achieve the following three functions.

1) Set the camera mode, frame rate, preview resolution, and camera resolution for the

BT-2000, and display a preview.

2) Process the image data in the app.

3) Acquire depth information with the application.

Note that the API specification explained in this section is not thread safe in compliance with the

specifications compared to android.hardware.Camera, and therefore cannot be used at the

same time for multiple threads.

The following 13 APIs are used in (1).

1-1 getSupportedEpsonCameraMode

1-2 setEpsonCameraMode

1-3 getEpsonCameraMode

1-4 setPreviewFpsRange

1-5 setPreviewSize

1-6 getSupportedSharpnessMin

1-7 getSupportedSharpnessMax

1-8 getSharpness

1-9 setSharpness

1-10 getSupportedContrastMin

1-11 getSupportedContrastMax

1-12 getContrast

1-13 setContrast

The following 5 APIs are used in (2).

2-1 onPreviewFrame

2-2 setPreviewCallback

2-3 setOneShotPreviewCallback

2-4 setPreviewCallbackWithBuffer

2-5 addCallbackBuffer

The following 4 APIs are used in (3).

3-1 onDepthMap

3-2 setDepthCallback

3-3 startDepthStreaming

3-4 stopDepthStreaming

Page 56: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

52

6.6. Application interface list

Tables 6-4 and 6-5 provide a list of application interfaces for using the following functions.

1) You can change the camera mode, frame rate, and preview resolution for the BT-2000, and

display a preview.

2) Acquire preview data with the application.

You also need to import the following models to use each API.

android.hardware.Camera

Table 6-6 Camera.Parameters application interface list

NO. Function name Function summary Notes

1 getSupportedEpsonCameraMode Acquire a list of modes supported by the

camera.

2 setEpsonCameraMode Set the camera mode.

3 getEpsonCameraMode Acquire the current camera mode setting.

4 setPreviewFpsRange Set the frame rate range. Standard Android

API

5 setPreviewSize Set the preview resolution. Standard Android

API

6 getSupportedSharpnessMin Acquire the minimum available sharpness value.

7 getSupportedSharpnessMax Acquire the maximum available sharpness

value.

8 getSharpness Acquire the current sharpness value.

9 setSharpness Set the sharpness value.

10 getSupportedContrastMin Acquire the minimum available contrast value.

11 getSupportedContrastMax Acquire the maximum available contrast value.

12 getContrast Acquire the current contrast value.

13 setContrast Set the contrast value.

Table 6-7 Camera.PreviewCallback application interface list

NO. Function name Function summary Notes

1 onPreviewFrame Describes processing content when acquiring image

data.

Standard Android

API

2 setPreviewCallback Register the image data acquisition callback

method. Called repeatedly when image data is

acquired.

Standard Android

API

3 setOneShotPreviewCallback Register the image data acquisition callback

method. Calls once for each image data registered.

Standard Android

API

4 setPreviewCallbackWithBuffer Register the image data acquisition callback

method. You can raise the processing efficiancy by

specifying a buffer.

Standard Android

API

5 addCallbackBuffer Register the buffer used in

setPreviewCallbackWithBuffer.

Standard Android

API

Page 57: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

53

By using the API provided by the BT-2000, you can display a preview and handle image data.

In either situation, you need to set the camera parameters. You can change the camera mode,

frame rate, preview resolution, and camera resolution. However, when setting the camera

parameters, you need to stop the previews temporarily by using stopPreview. Also, make sure

you use pre-established parameter combinations, see table 6-8.

Note that values larger than 1080p set for the preview will not be displayed.

When handling image data, you need to register the image data acquisition callback method.

Figure 6-5 shows an example of the flow for the API used in this guide.

After starting the camera, the camera mode is set and the preview starts. During a preview, you

can register the image acquisition callback method as necessary, and acquire images. Execute

processing for the acquired images in the app.

* Because the API in this guide does not comply with the android.hardware.Camera

specifications and thread safe are not available, do not handle multiple threads at the same

time.

Figure 6-5 Example of API usage flow

(1) Set Mode

(2) receive the images

Camera.open

Camera.getParameters

Camera.Parameters. setEpsonCameraMode

Camera.startPreview

Camera.stopPreview

Camera.setParameters

Camera. setPreviewCallback

Camera.PreviewCallback. onPreviewFrame

If the callback is registered...

registrer callback method

Page 58: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

54

6.7. Application interface details

6.7.1. getSupportedEpsonCameraMode

Function

Acquire a list of camera modes supported by the BT-2000 camera.

Format

Parameter

None.

Return value

Model Explanation

List<String> Acquire the current camera mode set in the BT-2000.

Camera mode list

Camera mode Explanation

edof Refocus the host and execute AR mode. You can acquire

still and depth information at the same time. The camera

resolution and shooting resolution is 2596 x 1948.

side-by-side Mode in which the host creates depth information. You can

acquire images from two camera sensors at the same

time. The camera resolution and shooting resolution is

2596 x 1948.

single-through-vga Standard, still image mode. The camera resolution and

shooting resolution is 640 x 480.

single-through-720p Standard, still image mode. The camera resolution and

shooting resolution is 1280 x 720.

single-through-1080p Standard, still image mode. The camera resolution and

shooting resolution is 1920 x 1080.

single-through-5m Standard, still image mode. The camera resolution and

shooting resolution is 2596 x 1948.

depth-only Mode to acquire only depth information.

List<String> getSupportedEpsonCameraMode (void);

Page 59: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

55

Procedure (camera is a Camera class object)

/*Start camera*/ camera = Camera.open(); /*Acquire current parameters*/ Camera.Parameters params = camera.getParameters(); /*Acquire provided camera mode*/ List<String> Supported = params.getSupportedEpsonCameraMode();

Page 60: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

56

6.7.2. setEpsonCameraMode

Function

Set the BT-2000 camera mode.

Format

Parameter

Model name in/out Explanation

String mode in Set camera mode. Set using macros for the following seven

Camera.Parameters classes.

- EPSON_CAMERA_MODE_EDOF

- EPSON_CAMERA_MODE_SIDE_BY_SIDE

- EPSON_CAMERA_MODE_SINGLE_THROUGH-VGA

- EPSON_CAMERA_MODE_SINGLE_THROUGH-720P

- EPSON_CAMERA_MODE_SINGLE_THROUGH-1080P

- EPSON_CAMERA_MODE_SINGLE_THROUGH-5M

- EPSON_CAMERA_MODE_DEPTH_ONLY

Return value

None.

Measurement table for macro and camera mode

Macro Camera mode

EPSON_CAMERA_MODE_EDOF edof

EPSON_CAMERA_MODE_SIDE_BY_SIDE side-by-side

EPSON_CAMERA_MODE_SINGLE_THROUGH-VGA single-through-vga

EPSON_CAMERA_MODE_SINGLE_THROUGH-720P single-through-720p

EPSON_CAMERA_MODE_SINGLE_THROUGH-1080P single-through-1080p

EPSON_CAMERA_MODE_SINGLE_THROUGH-5M single-through-5m

EPSON_CAMERA_MODE_DEPTH_ONLY depth-only

void setEpsonCameraMode ( String mode );

Page 61: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

57

Use procedure 1 (when side by side is set)

Use procedure 2 (when preview has already started)

Important points

After setting the camera mode in setEpsonCameraMode, be sure to perform

setParameters. Changed content is not reflected in the camera device until

setParameters is executed.

When the preview has already started, use stopPreview to temporarily stop the

preview, and then set the camera mode.

Each camera mode has a limited combination of preview resolutions and frame rates.

Note that a run-time exception will occur in setParameters for combinations that

exceed the limit.

The parameters for associated frame rates and preview resolutions will not change

even if you set the camera mode in setEpsonCameraMode. Application developers

should set these parameters using appropriate combinations before executing

setParameters. Table 6-8 lists the available combination of parameters from the API.

/*Start camera*/

camera = Camera.open();

/*Acquire current parameter (or default value)*/

Camera.Parameters params = camera.getParameters();

/*Set camera mode to side by side*/

params.setEpsonCameraMode(EPSON_CAMERA_MODE_SIDE_BY_SIDE);

/*Reflect camera setting in camera device*/

camera.setParameters(params);

/*Start preview*/

camera.startPreview();

/*Stop preview*/

camera.stopPreview();

/*Acquire current parameter (or default value)*/

Camera.Parameters params = camera.getParameters();

/*From here on, use procedure 1*/

Page 62: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

58

Table 6-8 List of parameter combinations

No. Mode Camera

resolution

Preview

resolution

Shooting

resolution

Frame rate

1 edof 2596x1948

640x480

1280x720

1920x1080

2596x1948 7.5fps

2 side-by-side 4096x1948

640x480

1280x720

1920x1080

4096x1948 7.5fps

3 single-through-vga 640x480 640x480 640x480

7.5fps

15fps

30fps

60fps

4 single-through-720p 1280x720 640x480

1280x720 1280x720

7.5fps

15fps

30fps

5 single-through-1080p 1920x1080

640x480

1280x720

1920x1080

1920x1080 7.5fps

15fps

6 single-through-5m 2596x1948

640x480

1280x720

1920x1080

2596x1948 7.5fps

7 depth-only - - - 7.5fps

15fps

Hyphens (-) in the table indicate that the parameter is not supported.

The shooting resolution is determined for each mode individually. Note that you cannot change

the settings using the standard Android API setPictureSize.

Page 63: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

59

6.7.3. getEpsonCameraMode

Function

Acquire the current camera mode.

Format

Parameter

None.

Return value

Model Explanation

String You can acquire the current camera mode as a return value.

Available values in the current version:

”edof”

”side-by-side”

”single-through-vga”

“single-through-720p”

“single-through-1080p”

“single-through-5m”

”depth-only”

Usage procedure

String getEpsonCameraMode (void);

/*Start camera*/

camera = Camera.open();

/*Acquire current parameters*/

Camera.Parameters params = camera.getParameters();

/*Acquire the current camera mode*/

String mode = params.getEpsonCameraMode();

Page 64: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

60

6.7.4. setPreviewFpsRange

Function

Set the minimum and maximum values for the frame rate.

You need to set the respective values for each of the values that can be acquired in

getSupportedPreviewFpsRange().

Format

Parameter

Model name in/out Explanation

int min in Minimum value for preview FPS (Set the value in multipliers

of 1000, so 7.5 fps would be 7500)

int max in Maximum value for preview FPS (Set the value in

multipliers of 1000)

Return value

None.

Use procedure 1 (set the fps to 7.5)

void setPreviewFpsRange ( int min, int max );

/*Start camera*/

camera = Camera.open();

/*Acquire current parameter (or default value)*/

Camera.Parameters params = camera.getParameters();

/*Set camera mode to side by side*/

params.setPreviewFpsRange(7500, 7500);

/*Reflect camera setting in camera device*/

camera.setParameters(params);

/*Start preview*/

camera.startPreview();

Page 65: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

61

Use procedure 2 (when preview has already started)

Important points

After setting the frame rate in setPreviewFpsRange, be sure to perform

setParameters. Changed content is not reflected in the camera device until

setParameters is executed.

When the preview has already started, use stopPreview to temporarily stop the

preview.

Each frame rate has a limited combination of preview resolutions and camera

modes. Note that a run-time exception will occur in setParameters for

combinations that exceed the limit.

/*Stop preview*/

camera.stopPreview();

/*Acquire current parameter (or default value)*/

Camera.Parameters params = camera.getParameters();

/*From here on, use procedure 1*/

Page 66: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

62

6.7.5. setPreviewSize

Function

Set the preview resolution.

Table 6-8 shows the preview resolutions that can be set for each camera mode.

Format

Parameter

Model name in/out Explanation

int width in Width of preview image

int height in Height of preview image

Return value

None.

Use procedure 1 (Set the camera mode to single-through-5m and the preview resolution

to VGA)

In this example, the width and height of the image are reduced to approximately 1/4 and

displayed in a preview.

void setPreviewSize ( int width, int height );

/*Start camera*/

camera = Camera.open();

/*Acquire current parameter (or default value)*/

Camera.Parameters params = camera.getParameters();

/*Set camera mode to single-through-5m*/

params.setEpsonCameraMode(EPSON_CAMERA_MODE_SINGLE_THROUGH-5M);

/*Set preview resolution to VGA*/

params.setPreviewSize(640, 480);

/*Reflect camera setting in camera device*/

camera.setParameters(params);

/*Start preview*/

camera.startPreview();

Page 67: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

63

Use procedure 2 (when preview has already started)

Important points

After setting the preview resolution in setPreviewSize, be sure to perform

setParameters. Changed content is not reflected until setParameters is executed.

When the preview has already started, use stopPreview to temporarily stop the

preview.

Each preview resolution has a limited combination of frame rates and camera

modes. Note that a run-time exception will occur in setParameters for

combinations that exceed the limit.

You cannot set 5M or 8M as the preview resolution. If you want to acquire images

in 5M or 8M, perform shooting by using takePicture.

The resolution set for preview resolution uses image data acquired in

PreviewCallback.

/*Stop preview*/

camera.stopPreview();

/*Acquire current parameter (or default value)*/

Camera.Parameters params = camera.getParameters();

/*From here on, use procedure 1*/

Page 68: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

64

6.7.6. getSupportedSharpnessMin/getSupportedSharpnessMax

Function

Acquire the minimum/maximum available sharpness value.

Format

Parameter

None.

Return value

Model Explanation

int Return the minimum/maximum available sharpness value.

For the BT-2000, these are -3 and +3.

int getSupportedSharpnessMin ();

int getSupportedSharpnessMax ();

Page 69: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

65

6.7.7. getSharpness

Function

Acquire the current sharpness value.

Format

Parameter

None.

Return value

Model Explanation

int Return the current sharpness value.

For the BT-2000, this is -3 to +3.

int getSharpness ();

Page 70: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

66

6.7.8. setSharpness

Function

Set the sharpness value.

Format

Parameter

None.

Return value

Model Explanation

int Set the sharpness value.

For the BT-2000, you can set -3 to +3.

Usage procedure

Important points

After setting the shatpness value in setSharpness, be sure to perform

setParameters. Changed content is not reflected until setParameters is executed.

void setSharpness (int);

/*Start camera*/

camera = Camera.open();

/*Acquire current parameter (or default value)*/

Camera.Parameters params = camera.getParameters();

/*Acquire the current sharpness value*/

int sharpness = params.getSharpness();

sharpness++;

/*When the sharpness value enters an available setting range, it is

set*/

if (sharpness <= params.getSupportedSharpnessMax() &&

sharpness >= params.getSupportedSharpnessMin() ) {

params.setSharpness(sharpness);

camera.setParameters(params);

}

Page 71: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

67

6.7.9. getSupportedContrastMin/getSupportedContrastMax

Function

Acquire the minimum/maximum available contrast value.

Format

Parameter

None.

Return value

Model Explanation

int Return the minimum/maximum available contrast value.

For the BT-2000, these are -3 and +3.

int getSupportedContrastMin ();

int getSupportedContrastMax ();

Page 72: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

68

6.7.10. getContrast

Function

Acquire the current contrast value.

Format

Parameter

None.

Return value

Model Explanation

int Return the current contrast value.

For the BT-2000, this is -3 to +3.

int getContrast ();

Page 73: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

69

6.7.11. setContrast

Function

Set the contrast value.

Format

Parameter

None.

Return value

Model Explanation

int Set the contrast value.

For the BT-2000, you can set -3 to +3.

Usage procedure

Important points

After setting the contrast value in setContrast, be sure to perform setParameters.

Changed content is not reflected until setParameters is executed.

void setContrast (int);

/*Start camera*/

camera = Camera.open();

/*Acquire current parameter (or default value)*/

Camera.Parameters params = camera.getParameters();

/*Acquire the current contrast value.*/

int contrast = params.getContrast();

contrast++;

/*When the contrast value enters an available setting range, it is

set*/

if (contrast <= params.getSupportedContrastMax() &&

contrast >= params.getSupportedContrastMin() ) {

params.setContrast(contrast);

camera.setParameters(params);

}

Page 74: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

70

6.7.12. onPreviewFrame

Function

Use the standard Android API.

Describe processing content when acquiring image data.

Format

Parameter

Model name in/out Explanation

byte[] data in Image data acquired from a camera. The default is

NV21 format.

Camera

camera

in Camera service object.

Return value

None.

Usage procedure

void onPreviewFrame (

byte[] data

Camera camera

);

// App developer applies processing when acquiring image data private Camera.PreviewCallback mPreviewCB = new

Camera.PreviewCallback() {

@Override

public void onPreviewFrame(byte data[], Camera camera) {

Log.d(TAG, "Save preview image");

synchronized (lockObject) {

savePreviewData(data);

}

}

};

//Register the callback method at the optimal time

camera.setPreviewCallback(mPreviewCB);

Page 75: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

71

Important points

You need to describe how image data is handled in the application.

PreviewCallback cannot guarantee the actual time of image acquisition. If there

are a high volume of calculations being performed in onPreviewFrame, and these

are not completed by the time of the next image data acquisition, the next image

data will be corrupted. We recommend acquiring image data through a

sub-thread.

You can use the following three APIs as the API that registers the callback method.

Page 76: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

72

6.7.13. setPreviewCallback

Function

When the callback method described in 6.6.12 is registered, it is called each time

image data is acquired. The registered callback method is executed repeatedly while

previewing.

Format

Parameter

Model name in/out Explanation

Camera.PreviewCallback cb in Callback object that receives image data.

Return value

None.

Usage procedure

void setPreviewCallback (

Camera.PreviewCallback cb

);

// App developer applies processing when acquiring image data private Camera.PreviewCallback mPreviewCB = new

Camera.PreviewCallback() {

@Override

public void onPreviewFrame(byte data[], Camera camera) {

Log.d(TAG, "Save preview image");

synchronized (lockObject) {

savePreviewData(data);

}

}

};

//Register the callback method at the optimal time

camera.setPreviewCallback(mPreviewCB);

・・・・・・

// When you remove the callback method, register null

camera.setPreviewCallback(null);

Page 77: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

73

Important points

To cancel image data acquisition, register null as the callback method.

Page 78: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

74

6.7.14. setOneShotPreviewCallback

Function

When the callback method described in 6.6.12 is registered, it is called when image

data is acquired. This registered callback method is only executed once.

Format

Parameter

Model name in/out Explanation

Camera.PreviewCallback

cb

in Callback object that receives a preview image.

Return value

None.

Usage procedure

The same as the previous section. However, setOneShotPreviewCallback is used as

the registered callback method.

void setOneShotPreviewCallback (

Camera.PreviewCallback cb

);

Page 79: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

75

6.7.15. setPreviewCallbackWithBuffer

Function

When the callback method described in 6.7.12 is registered, it is called when image

data is acquired. The registered callback method is executed repeatedly while

previewing. You can secure buffer processing by specifying a dedicated buffer for

image data processing.

Format

Parameter

Model name in/out Explanation

Camera.PreviewCallback

cb

in Callback object that receives image data.

Return value

None.

void setPreviewCallbackWithBuffer (

Camera.PreviewCallback cb

);

Page 80: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

76

Usage procedure

Important points

You need to reserve the buffer region from the application.

This provides high-speed processing when compared to setPreviewCallback or

setOneShotPreviewCallback by securing and opening the memory.

The application developer needs to describe the buffer management process.

Specifically, the following processes are necessary.

Register the buffer to be used in addCallbackBuffer described later.

Calculate the size of the buffer to be registered as the width x height x 1 pixel

byte. The width and the height should both be higher than their respective

resolutions.

Each time onPreviewFrame is called, you need to re-register the buffer.

If no buffer is registered, the frame is corrupted and is not called by the

callback method.

You can register multiple buffers.

// App developer applies processing when acquiring image data

private Camera.PreviewCallback mPreviewCB = new

Camera.PreviewCallback() {

@Override

public void onPreviewFrame(byte data[], Camera camera) {

Log.d(TAG, "Save preview image");

synchronized (lockObject) {

savePreviewData(data);

}

// Register the buffer to be used camera.addCallbackBuffer(mPreviewData);

}

};

// Register the buffer to be used camera.addCallbackBuffer(mPreviewData);

//Register the callback method at the optimal time

camera.setPreviewCallbackWithBuffer(mPreviewCB);

Page 81: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

77

6.7.16. addCallbackBuffer

Function

The API for registering the buffer used in setPreviewCallbackWithBuffer.

Format

Parameter

Model name in/out Explanation

byte[]

callbackBuffer

in Buffer to be registered

Return value

None.

Usage procedure

void setPreviewCallbackWithBuffer (

byte[] callbackBuffer

);

// App developer applies processing when acquiring image data

private Camera.PreviewCallback mPreviewCB = new

Camera.PreviewCallback() {

@Override

public void onPreviewFrame(byte data[], Camera camera) {

Log.d(TAG, "Save preview image");

synchronized (lockObject) {

savePreviewData(data);

}

// Register the buffer to be used camera.addCallbackBuffer(mPreviewData);

}

};

// Register the buffer to be used camera.addCallbackBuffer(mPreviewData);

//Register the callback method at the optimal time

camera.setPreviewCallbackWithBuffer(mPreviewCB);

Page 82: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

78

Important points

Only necessary when using setPreviewCallbackWithBuffer. Buffers are

automatically secured for setPreviewCallback and setOneShotPreviewCallback.

If the buffer size you register is smaller than the image data, null is returned for

data.

If a registered buffer region is not secured in the application, an error log is output

when addCallbackBuffer is executed. Errors and exceptions do not occur.

Page 83: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

79

startDepthStreaming

Function

Start depth information acquisition.

Format

Parameter

None.

Return value

None.

Exception

Exception

occurred

Explanation

RuntimeException An exception occurs under the following two

conditions.

(1) A preview has not started.

(2) The camera is in a mode that does not output

depth information (side by side or single through).

Usage procedure

void startDepthStreaming()

/*Start camera*/

camera = Camera.open();

/*Acquire current parameter (or default value)*/

Camera.Parameters params = camera.getParameters();

/*Set the camera mode to depth-only*/

params.setEpsonCameraMode(EPSON_CAMERA_MODE_DEPTH_ONLY);

/*Reflect camera setting in camera device*/

camera.setParameters(params);

/*Start preview*/

camera.startPreview();

/*Start depth information acquisition*/ camera.startDepthStreaming();

Page 84: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

80

Important points

If this method is used after executing startPreview, you can execute by selecting

your own timing.

When resuming a preview using stopPreview -> startPreview, make sure you

execute this method to resume depth information acquisition.

When resuming a preview startPreview after executing takePicture, make sure

you execute this method to resume depth information acquisition.

You need to restart the application if the application closes in a RuntimeException.

Page 85: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

81

6.7.17. stopDepthStreaming

Function

Stop depth information acquisition.

Format

Parameter

None.

Return value

None.

Usage procedure

Important points

If depth information acquisition has not stopped when stopPreview is executed,

stopDepthStreaming is executed as part of the stopPreview process.

void stopDepthStreaming()

/*Start camera*/

camera = Camera.open();

/*Acquire current parameter (or default value)*/

Camera.Parameters params = camera.getParameters();

/*Set the camera mode to depth-only*/

params.setEpsonCameraMode(EPSON_CAMERA_MODE_DEPTH_ONLY);

/*Reflect camera setting in camera device*/

camera.setParameters(params);

/*Start preview*/

camera.startPreview();

/*Start depth information acquisition*/ camera.startDepthStreaming();

・・・・・・

/*End Depth information acquisition*/

camera.stopDepthStreaming();

/*Stop preview*/

camera.stopPreview();

Page 86: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

82

6.7.18. onDepthMap

Function

The process executed is written during depth information acquisition.

Format

Parameter

Model name in/out Explanation

byte[] data in Depth information. VGA size, RAW 8 format,

300 K byte data.

Camera

camera

in Camera service object

Return value

None.

Usage procedure

void onDepthMap( byte[] data, Camera camera )

// App developer applies processing when acquiring depth information private Camera.DepthCallback mDepthCB = new Camera.DepthCallback() {

@Override

public void onDepthMap(byte data[], Camera camera) {

Log.d(TAG, "Save depth map");

synchronized (lockObject) {

saveDepthMap(data);

}

}

};

//Register the callback method at the optimal time

camera.setDepthCallback(mDepthCB);

Page 87: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

83

Notes:

To use the depth information application, you need to describe the process in

onDepthMap.

To execute onDepthMap, you need to meet all of the following conditions.

(1) The camera mode is set to edof or depth-only mode.

(2) startPreview is executed.

(3) startDepthStreaming is executed.

(4) A callback method is registered in setDepthCallback.

For edof mode, you can execute depth information acquisition, preview display,

and preview data acquisition at the same time.

For depth-only mode, preview display is unavailable. To display depth data, you

need to convert the data format to image format to display images.

Page 88: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

84

6.7.19. setDepthCallback

Function

Register the callback method executed during depth information acquisition.

Format

Parameter

Model name in/out Explanation

Camera.DepthCallback

cb

in Callback object that processes depth information.

Return value

None.

Usage procedure

void setDepthCallback( Camera.DepthCallback cb )

// App developer applies processing when acquiring depth information private Camera.DepthCallback mDepthCB = new Camera.DepthCallback() {

@Override

public void onDepthMap(byte data[], Camera camera) {

Log.d(TAG, "Save depth map");

synchronized (lockObject) {

saveDepthMap(data);

}

}

};

//Register the callback method at the optimal time

camera.setDepthCallback(mDepthCB);

・・・・・・

// When you remove the callback method, register null

camera.setDepthCallback(null);

Page 89: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

85

Important points

To cancel depth information acquisition, set null as the callback method.

This method can be executed regardless of the preview status or camera mode,

you can execute by selecting your own timing.

Registration is only canceled if null is registered as the callback method, or the

object is removed. Note that the callback method is not canceled by canceling the

preview or depth information acquisition.

Page 90: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

86

6.8. Depth Information Acquisition Flow Details

Figure 6-6 shows the mechanical status for the camera application (camera app) when

acquiring depth information. You need to perform the following five steps to acquire depth

information.

(1) Set the camera mode to depth-only.

(2) When using edof mode, readjust for edof mode*.

(3) The preview starts after step (1).

(4) Depth information acquisition starts after step (2).

(5) Register the depth callback method at the optimal time.

The camera app sets the camera mode, resolution, preview starts and transfers to preview

status.

If the preview starts immediately, depth information acquisition is stopped. Start depth

information acquisition (startDepthStreaming) to transfer to the depth information acquisition

status. The depth information acquisition can be used in the edof or depth-only mode.

If the camera is in a mode that cannot acquire depth information (side by side or

single-through), an exception is generated. If depth callback has already been registered

during depth information acquisition, then this can be processed based on the depth

information in the callback function. For registering depth callback, use the onDepthMap API

for setDepthCallback and processing depth information.

When returning to a depth information acquisition stop status, you will need to stop the depth

information acquisition (stopDepthStreaming). When stopping a preview during the depth

information acquisition, the depth information acquisition will be processed at the same time.

* When depth data is used in edof mode, perform depth-only.

Page 91: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

87

Figure 6-6 Mechanical status figure for depth information acquisition

For edof mode, you can execute depth information acquisition, preview display, and preview

data acquisition at the same time.

For depth-only mode, preview display is unavailable. Do not shoot images or execute preview

data acquisition. Availability of depth information acquisition and previews is shown in the

following table.

Table 6-9 Depth information acquisition and preview availability

Camera mode Depth

information

acquisition

Preview

display

Preview data

acquisition

Notes

edof ○ △ ○ Same time processing

available*

side-by-side × △ ○ Preview only

single-vga × △ ○ Preview only

single-720

single-1080

single-5M

depth-only ○ × × Depth information only

△: Indicates that preview display may not be available depending on the resolution.

*: When using depth data in edof mode, make sure you set depth-only in advance, and

enable depth data.

not ready previewing

receiving depth active

receiving and treating depth data

receiving depth inactive ready to preview

exception

exit preview

exit preview

start to recieve stop to recieve

start preview

set parameters

Page 92: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

88

6.9. Sample Code

This sample code is for preview data acquisition while displaying a preview at 1080p in Single 5

M mode.

package jp.epson.moverio.bt2pro.test.cameratest;

import java.io.File;

import java.io.FileOutputStream;

import java.io.IOException;

import java.lang.reflect.Method;

import java.text.SimpleDateFormat;

import java.util.ArrayList;

import java.util.Calendar;

import java.util.List;

import java.util.StringTokenizer;

import android.hardware.Camera;

import android.os.Bundle;

import android.os.Environment;

import android.app.Activity;

import android.content.ContentResolver;

import android.content.ContentValues;

import android.util.Log;

import android.view.Menu;

import android.view.MenuItem;

import android.view.SurfaceHolder;

import android.view.SurfaceView;

import android.view.View;

import android.view.WindowManager;

import android.widget.Button;

import android.provider.MediaStore;

import android.provider.MediaStore.Images;

public class CameraTestActivity extends Activity {

private String TAG = this.getClass().getName();

private Camera camera = null;

private SurfaceHolder mHolder = null;

private byte[] mPreviewData = new byte [1920*1080*3/2];

private byte[] mPreviewBuf = new byte [1920*1080*3/2];

private Object lockObject = new Object();

Page 93: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

89

@Override

protected void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

setContentView(R.layout.activity_camera_test);

// Full Screen

getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);

getWindow().addFlags(0x80000000);

// Camera preview

SurfaceView cameraPreview = (SurfaceView) findViewById(R.id.preview);

cameraPreview.getHolder().addCallback(previewCallback);

cameraPreview.getHolder().setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);

mHolder = cameraPreview.getHolder();

}

/*Image data acquisition call back*/

private Camera.PreviewCallback mPreviewCB = new Camera.PreviewCallback() {

@Override

public void onPreviewFrame(byte data[], Camera camera) {

synchronized (lockObject) {

mPreviewData = data;

}

camera.addCallbackBuffer(mPreviewBuf);

}

};

@Override

protected void onDestroy(){

super.onDestroy();

Log.e(TAG,"onDestroy");

}

private SurfaceHolder.Callback previewCallback =

new SurfaceHolder.Callback() {

@Override

public void surfaceDestroyed(SurfaceHolder holder) {

Log.d(TAG,"surfaceDestroyed");

camera.stopPreview();

camera.release();

camera = null;

}

Page 94: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

90

@Override

public void surfaceCreated(SurfaceHolder holder) {

Log.d(TAG,"surfaceDestroyed");

try{

camera = Camera.open();

camera.setPreviewDisplay(holder);

}catch(RuntimeException e){

e.printStackTrace();

}

camera.addCallbackBuffer(mPreviewBuf);

camera.setPreviewCallbackWithBuffer(mPreviewCB);

}

@Override

public void surfaceChanged(SurfaceHolder holder, int format, int width,

int height) {

/*End Depth information acquisition*/

camera.stopDepthStreaming();

camera.stopPreview();

Camera.Parameters params = camera.getParameters();

/*Set camera mode to Single 5 M mode*/

params.setEpsonCameraMode(EPSON_CAMERA_MODE_ SINGLE_THROUGH-5M);

/*Set preview resolution to 1080p*/

params.setPreviewSize(1920, 1080);

/*Apply parameter changes to camera device*/

camera.setParameters(params);

camera.addCallbackBuffer(mPreviewData);

camera.setPreviewCallbackWithBuffer(mPreviewCB);

try{

camera.startPreview();

}catch(RuntimeException e){

e.printStackTrace();

}

}

};

Page 95: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

91

@Override

public boolean onCreateOptionsMenu(Menu menu) {

// Inflate the menu; this adds items to the action bar if it is present.

getMenuInflater().inflate(R.menu.camera_test, menu);

return true;

}

boolean ret = true;

@Override

public boolean onOptionsItemSelected(MenuItem item) {

Log.e(TAG, "onOptionsItemSelected");

return ret;

}

}

Page 96: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

92

6.10. Important points

1) After closing the camera app, the system executes deallocation processing in the background

for the camera. If the camera is used again soon after, an error may occur. Make sure that the

camera is not reconnected within three seconds of camera deallocation.

2) The main use for the BT-2000 camera is for monitoring. It is possible to shoot images, but

make sure continuous shooting is not allowed in a short period of time. Note that an error may

occur when shooting continuously in a short period of time.

3) After setting the camera mode, frame rate, preview resolution, sharpness value, and contrast

value, be sure to perform setParameters. Changed content is not reflected in the camera device

until setParameters is executed.

4) Exposure and white balance are set manually. As this cannot be set automatically, make

settings according to your usage environment.

5) The parameters for associated frame rates and preview resolutions will not change even if you

set the camera mode in setEpsonCameraMode. Set these parameters using appropriate

combinations before executing setParameters.

6) When the preview has already started, use stopPreview to temporarily stop the preview, and

then execute setParameters.

7) Each camera mode has a limited combination of preview resolutions and frame rates. Note

that a run-time exception will occur in setParameters for combinations that exceed the limit.

8) You cannot set 5M or 8M (side by side) as the preview resolution. If you want to acquire

images in 5M or 8M (side by side), perform shooting by using tekePicture.

9) When using depth data in edof mode, make sure you set depth-only in advance, and enable

depth data.

10) PreviewCallback cannot guarantee the actual time of image acquisition. If there are a high

volume of calculations being performed in onPreviewFrame, and these are not completed by

the time of the next image data acquisition, the next image data will be corrupted. We

recommend acquiring image data through a sub-thread.

11) You need to restart the application if the application closes in a RuntimeException.

Page 97: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

93

7. Sensor control

Page 98: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

94

7.1. Sensor control summary

The BT-2000 is equipped with an IMU (high precision, high stability inertia measurement unit), a

geomagnetic sensor, and an ALS (ambient light sensor). Tap detection and azimuth detection are

also available.

7.1.1. IMU and the geomagnetic sensor

The BT-2000 is equipped with an IMU and a geomagnetic sensor. The IMU can detect tri-axis

acceleration and tri-axis angular velocity. The IMU allows high precision stance detection. There is

also a built-in tri-axis geomagnetic sensor which combined with the IMU allows for azimuth

calculations.

The following shows the specifications for the IMU and the geomagnetic sensor.

Sampling rate* Range

IMU Acceleration Max. 125 Hz ±5.8 G

Angular velocity Max. 125 Hz ±450 deg/s

Geomagnetic sensor Max. 100 Hz ±1200 μT

* When the load on the system is high, the sampling rate may not reach the specified

maximum.

+Y

+X +Z

Page 99: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

95

7.1.2. ALS

The BT-2000 is equipped with an ALS (ambient light sensor). This sensor allows the device to

acquire the ambient light for the user's surroundings. Also, the BT-2000 is equipped with automatic

optics that auto adjust the display brightness according to the user's surroundings.

The following shows the specifications for the ALS.

Sampling rate* Range

ALS Approx. 1[Hz] 0 to 65528 lx

* When the load on the system is high, the sampling rate may not reach the specified

maximum.

Page 100: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

96

7.1.3. Headset tap detection

The headset for the BT-2000 is equipped with a tap detection function. The headset's tap

detection function acts as an input device for the user. For example, this can be used to change

screen information.

Page 101: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

97

7.2. Using the sensor

The sensor uses the standard Android API, SensorEventListener. The following lists the available

sensor types and usage examples.

7.2.1. Sensor type

The BT-2000 can use the following sensors. The following sesnor types are also defined in the

Android Sensor class.

Sensor type ID (Hex) Constant name

IMU Accelerometer 0x00000001 TYPE_ACCELEROMETER

Gyroscope 0x00000004 TYPE_GYROSCOPE

Geomagnetic sensor Geomagnetic sensor 0x00000002 TYPE_MAGNETIC_FIELD

ALS Sensor Illumination 0x00000005 TYPE_LIGHT

Others Tap detection 0x00002001 TYPE_HEADSET_TAP

Azimuth detection 0x00000003 TYPE_ORIENTATION

* You can acquire the above from the Android Sensor class.

Page 102: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

98

7.3. Using SensorEventListener

It is necessary to implement SensorEventListener for sensors using Activity or Service.

Example: Implementing SensorEventListener in Activity

public class SampleActivity extends Activity implements SensorEventListener

7.3.1. Registering sensors being used When using a sensor, you need to register a sensor listener. Example) Registering an accelerometer

//System sensor service acquisition

SensorManager sm = (SensorManager)getSystemService(SENSOR_SERVICE);

//Registering an accelerometer (TYPE_ACCELEROMETER)

Sensor s = sm.getDefaultSensor(Sensor.TYPE_ACCELEROMETER);

sm.registerListener(this, s, SensorManager.SENSOR_DELAY_NORMAL);

7.3.2. Acquiring a sensor value You can use the sensor value by acquiring a sensor event in onSensorChanged for SensorEventListener.

Example) Acquiring a sensor value for the accelerometer

@Override

public void onSensorChanged(SensorEvent event) {

//Acquiring the accelerometer value (display log)

if(event.sensor.getType() == Sensor.TYPE_ACCELEROMETER){

Log.d("Sample","ax="+event.values[0]+",ay="+event.values[1]+",az="+event.values[2]);

}

}

Page 103: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

99

8. Bluetooth/BLE

Page 104: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

100

8.1. Summary

This chapter explains the Bluetooth/BLE function built into the MOVERIO Pro BT-2000.

The BT-2000 supports Bluetooth 4.0 LE, and in addition to the conventional Bluetooth

3.0+HS function, it also supports LowEnergy. For convenience, this section describes the

Bluetooth 3.0+HS Bluetooth Legacy and the LowEnergy BLE.

8.1.1. Supported specifications

8.1.1.1. Bluetooth Legacy specifications

This describes the Bluetooth Legacy specifications for the BT-2000.

Table 8-1 Bluetooth Legacy module and protocol stack

Item Specifications

Module specifications Bluetooth3.0 + HS (Bluetooth Class2)

Protocol stack specifications Based on Core Spec Version 3.0

Table 8-2 Bluetooth Legacy protocol support

Profile Role Version

Headset Profile(HSP) Audio Gateway 1.1

Advanced Audio Distribution Profile(A2DP) Source 1.2

Human Interface Device(HID) Host 1.0

Object Push Profile(OPP) Client/Server 1.1

Serial Port Profile(SPP) Device A/Device B 1.2

Audio/Video Remote Control Profile(AVRCP) Target 1.0

Audio/Video Control Transport Protocol(AVCTP) Target 1.3

Audio/Video Distribution Transport Protocol(AVDTP) Source/Acceptor/Initiator 1.2

Generic Audio Video Distribution Profile(GAVDP) Acceptor/Initiator 1.0

Page 105: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

101

8.1.1.2. BLE specifications

This describes the BLE specifications for the BT-2000.

Table 8-3 BLE protocol stack specifications

Item Specifications

Protocol stack specifications Based on Core Spec Version 4.1 (Low Energy Host)

Table 8-4 BLE protocol support

Profile Role Version

Find Me Profile(FMP) Locator 1.0

Proximity Profile(PXP) Monitor 1.0

* New profiles can be supported through applications you delevop for the user.

BLE Beacon function

The BLE Beacon function detects Beacon devices within communication range using the

Advertise function for GAP (General Access Profile), not the function described in the BLE

profile.

When the BT-2000 is within the Bluetooth communication area for a Beacon device, the

Beacon device is detected using Advertise data being broadcast by the Beacon device (note 1),

and then calculates the distance from the Beacon device using the strength of the radio

waves.

Note 1)

If the Beacon device supports the iBeacon standards, the device can determine Immediate/Near/Far from the

RSSI value. If the device does not support the iBeacon standards, the distance need to be calculated from the

RSSI value.

Figure 8-1 Image of BLE Beacon usage

Bluetooth communication area Beacon

device

Beacon

device

Page 106: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

102

8.2. Usage method

This section describes how to use Bluetooth Legacy and BLE.

8.2.1. Using Bluetooth Legacy

You can use Bluetooth Legacy for the BT-2000 from [Bluetooth] in the [Settings] app.

Figure 8-2 Bluetooth Legacy Settings screen

8.2.1.1. Turning Bluetooth Legacy ON/OFF

To turn on the Bluetooth Legacy function, move your cursor over the ON/OFF switch (2), and

then press the select button.

8.2.1.2. Searching using Bluetooth Legacy

Press the [Search for Devices] button to search for Bluetooth Legacy devices in the area.

8.2.1.3. Connecting using Bluetooth Legacy

You can select the device you want to connect to in [Available Devices], and then perform

pairing.

8.2.1.4. Disconnecting using Bluetooth Legacy

You can select the device you want to disconnect from in [Paired Devices], and then

disconnect.

ON/OFF switch (1)

ON/OFF switch (2)

Page 107: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

103

8.2.2. Using BLE

To test the BLE function for the BT-2000, sample BLEBeacon and PXP/FMP applications have

been preinstalled. Refer to these sample applications when developing a BLE application for

the user.

The following explains how to use the sample applications.

8.2.2.1. Using the BLEBeacon sample application

Select the BLEBeacon icon from the app list.

Figure 8-3 BLEBeacon icon

BLE turns on automatically when the app starts, and the BLE icon is displayed in the

notification area.

Figure 8-4 BLEBeacon app screen

Table 8-5 BLEBeacon app screen composition

Item Explanation

Scan Start Starts scanning for the BLE Beacon.

Scan Stop Stops scanning for the BLE Beacon.

Address Displays the Bluetooth Device Address.

Device Name(m/n) Displays the Device Name and the Major/Minor numbers.

* Depends on the Advertise data configuration from the Beacon.

Distance Displays the determined distance and RSSI value Note 2)

Page 108: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

104

Determining distance for the BLEBeacon

You need to perform distance determination for the BT-2000 and the Beacon in the app.

Distance determination is calculated based on the Measured Power included in the Advertise

data by the BLEBeacon app.

Since Measured Power support varies depending on the Beacon manufacturer, you will need

to decide whether or not ("Use" or "Do not use") to use the distance determination based on

Measured Power supplied by the company identifier in the BLEBeacon app. Distance is

determined from the Measured Power and RSSI value as shown below.

Table 8-6 Determining distance for the BLEBeacon app

Determination result RSSI value (when Measured Power for the Beacon is set to -70)

Immediate 127 to -70 (=Measured Power)

Near -51 to -90 (=Measured Power - 20)

Far -91 to 128

Unknown

Could not receive Advertise data for more than three seconds

Or the company identifier was not Apple (0x004C) or Nordic

(0x0059).

Page 109: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

105

8.2.2.2. Using the FMP_PXP sample application

Select the FMP_PXP icon from the app list.

*This application still includes some Japanese language. Please reference the following translation notes as your

reference when you use this application.

Figure 8-5 BLEBeacon icon

Check the ON/OFF status for the BLE when the app starts, and then displays a confirmation

dialog if BLE is not ON.

Figure 8-6 BLE confirmation dialog

Figure 8-7 FMP_PXP app Scan screen composition

Bluetooth Low Energy is unenabled.

Do you want to enable Bluetooth Low Energy?

Please push “Scan Start” botton.

Authentication method

Target conection device

Target service selection

Page 110: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

106

Table 8-7 FMP_PXP app Scan screen composition

Item Explanation

Scan Start Starts scanning for the BLE device.

Scan Stop Stops scanning for the BLE device.

Connect Starts connecting.

Disconnect Starts disconnecting.

Clear Clears the list.

Authentication method

Select the authentication method.

- Just Works

- Passkey Entry

Select search service

Select the service that you want to use to search from the

services included with the connected device.

- Immediate Alert Service

- Tx Power Service

- Link Loss Service

DiscPriSrvByUUID From the list of services on the connected device, select the

Service you want from [Select search service].

DiscAllPriSrv Displays all services for the connected device.

ProfileActivity Displays ProfileActivity based on information for the

connected device.

Authenticating using Passkey Entry

When connecting to a BLE device that requires password authentication, execute Connect in

Passkey Entry.

One of the following pairing dialogs is displayed depending on the Passkey Entry connection.

Figure 8-8 FMP_PXP app Scan screen composition

Pairing setting request of BLE

If you want to set the PasskeyInput

DeviceName as pairs, please enter the

passkey necessary to the device.

6-digit number (000000-999999) is

acceptable only.

If you want the next device to pair,

PasskeyDisplay DeviceName

Please enter the following passkey to Remote Device.

Page 111: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

107

Figure 8-9 FMP_PXP app Profile screen composition

Table 8-8 FMP_PXP app Profile screen composition

Item Explanation

Set Alert Level Set one of the following as the BLE Device Alert Level.

No Alert/Mid Alert/High Alert

Select Sub-procedure You can read the value for the selected sub-procedure.

Current Alert Level You can read the value set for the current Alert Level.

Alert level setting

Current Alert level

Sub-Procedure setting

Page 112: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

108

8.3. Important Points & Restrictions for BLE App Development

■ BLE interface

The BLE interface for the BT-2000 uses an original API that does not support the standard

Android API.

Therefore, when developing an application that uses BLE, use the SDK provided by Epson.

■ BLE ON/OFF

BLE differs from Bluetooth Legacy in that the ON/OFF switch is not installed on the system

(OS) in BLE.

In applications that use BLE on the BT-2000, design so that the BLE function can be turned

ON/OFF.

■ BLE API access from multiple applications

Avoid designs that allow multiple BLE applications to access the BLE API at the same time.

Data may not be exchanged depending on the timing.

■ Using the BLE API

We do not recommend designs in which the BLE API is called in the Advertise notification

callback function provided in the BLE SDK (onScanResult).

Page 113: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

109

8.4. Import module

To use API, place the ble.jar in the libs folder, and import the following modules.

import android.bluetooth.BluetoothLeAdapterManager;

import android.bluetooth.BluetoothLeChipCode;

import android.bluetooth.BluetoothLeErrorCodeDescription;

import android.bluetooth.BluetoothLeGapCallback;

import android.bluetooth.BluetoothLeGapCallback.AddrType;

import android.bluetooth.BluetoothLeGapCallback.AuthType;

import android.bluetooth.BluetoothLeGapEvtAuthStatus;

import android.bluetooth.BluetoothLeGapEvtConnected;

import android.bluetooth.BluetoothLeGattCallback;

import android.bluetooth.BluetoothLeGattService;

import android.bluetooth.BluetoothLeAdapterManager;

import android.bluetooth.BluetoothLeGapCallback.PassKeyType;

Page 114: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

110

8.5. Application interface list

Tables 8-9, 8-10, and 8-11 provide a list of application interfaces.

Table 8-9 android.bluetooth.BluetoothLeAdapterManager for application interface list

NO. Function name Function summary

1 getInstance Acquires instance.

2 isEnable Acquires enable/disable status for BLE.

3 enable Enables BLE.

4 disable Disables BLE.

5 startScan Starts scanning for the BLE.

6 stopScan Stops scanning for the BLE.

7 getDeviceName Acquires the local device name.

8 getBdAddress Acquires the local BD device.

9 connect Starts connecting to the BLE device.

10 connectCancel Cancels connecting to the BLE device.

11 disconnect Disconnects from the BLE device.

12 setAuthType Sets the authentication type.

13 notifyInputPasskey Sets the Padd Key entry.

14 setGapCallback Registers a callback for the GAP function.

15 discPriSrv(char) Searches for the Priary Service for the BLE device.

16 discChar Searches for the Characteristic for the BLE device.

17 discCharDesc Searches for the Characteristic Description for the BLE device.

18 readGatt Acquires the Characteristic Value and the Characteristic

Descriptor.

19 readUuidGatt Acquires the Characteristic Value for the set UUID.

20 writeWithoutRspGatt Writes the Characteristic Value (without a response)

21 writeGatt Writes the Characteristic Value and the Characteristic

Descriptor.

22 confirmation Executes an Indication response.

23 setGattCallback Registers a callback for the GAP function.

Page 115: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

111

Table 8-10 android.bluetooth.BluetoothLeGapCallback for application interface list

NO. Callback function

name.

Function summary

24 onScanResult Callback function for scan results (Advertise data)

reception.

25 onConnectResult Callback function for connection results reception.

26 onDisconnectResult Callback function for disconnection results reception.

27 onPasskeyInput Callback function for Pass Key input results reception.

28 onPasskeyDisplay Callback function for Pass Key display results reception.

Table 8-11 android.bluetooth.BluetoothLeGattCallback for application interface list

NO. Callback function name. Function summary

29 onDiscPriSrvResult Callback function for search results reception for Primary

Service.

30 onDiscCharResult Callback function for search results reception for

Characteristic.

31 onDiscCharDescResult Callback function for search results reception for

Characteristic Descriptor.

32 onReadGattResult Callback function for acquisition results reception for

Characteristic Value.

33 onReadUuidGattResult Callback function for acquisition results reception for

Characteristic Value.

34 onWriteGattResult Callback for writing results reception for Characteristic

Value.

35 hvxEvt Callback function for reception of Indication/Notification

Page 116: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

112

8.6. Supported GATT procedure table

The following shows a list of Bluetooth GATT procedures and supported BLE API procedures.

Table 8-12 Supported GATT procedure for BLE API table

GATT Procedure GATT Sub-Procedure Functions that

support BLE API

Server Configuration Exchange MTU Not supported

Primary Service Discovery

Discover All Primary Services discPriSrv(char)

Discover Primary Services By Service UUID discPriSrv(char,

byte[])

Relationship Discovery Find Included Services Not supported

Characteristic Discovery Discover All Characteristic of a Service discChar

Discover All Characteristic by UUID Not supported

Characteristic Descriptor Discovery Discover All Characteristic Descriptors discCharDesc

Characteristic Value Read

Read Characteristic Value readGatt(char)

Read Using Characteristic UUID readUuidGatt

Read Long Characteristic Values readGatt(char, char)

Read Multiple Characteristic Values Not supported

Characteristic Value Write

Write Without Response writeWithoutRspGat

t

Signed Write Without Response Not supported

Write Characteristic Value writeGatt

Write Long Characteristic Values Not supported

Characteristic Value Reliable Writes Not supported

Characteristic Value Notification Notifications BluetoothLeGattCall

back.hvxEvt

Characteristic Value Indication Indications

BluetoothLeGattCall

back.hvxEvt,

confirmation

Characteristic Descriptor Value

Write

Write Characteristic Descriptors writeGatt

Write Long Characteristic Descriptors Not supported

Page 117: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

113

8.7. Application interface details

8.7.1. getInstance

Function

Acquire instances in the BluetoothLeAdapterManager class.

Format

Parameters

None

Return value

Model Explanation

BluetoothLeAdapterManager Except for NULL: Instances in the

BluetoothLeAdapterManager class.

NULL: Fails to acquire instance.

8.7.2. isEnable

Function

Acquire BLE status (enabled or disabled).

Format

Parameters

None

Return value

Model Explanation

boolean true: BLE enable

false: BLE disable

BluetoothLeAdapterManager BluetoothLeAdapterManager getInstance(void);

boolean isEnable(void);

Page 118: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

114

8.7.3. enable

Function

Enable BLE.

Format

Parameters

None

Return value

Model Explanation

boolean true: success

false: fail

8.7.4. disable

Function

Disable BLE.

Format

Parameters

None

Return value

Model Explanation

boolean true: success

false: fail

boolean enable(void);

boolean disable(void);

Page 119: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

115

8.7.5. startScan

Function

Start the BLE scan (Advertise reception).

Format

Parameters

None

Return value

None

Usage method

To receive scan results (Advertise data), you need to register the callback function in

setGapCallback in advance.

The following callback function sends a notification for received Advertise data.

BluetoothLeGapCallback.onScanResult

void startScan(void);

Page 120: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

116

8.7.6. stopScan

Function

Stop the BLE scan (Advertise reception).

Format

Parameters

None

Return value

None

8.7.7. getDeviceName

Function

Acquire the local device name.

Format

Parameters

None

Return value

Model Explanation

String Except for NULL: local device name.

NULL: Fail

void stopScan(void);

String getDeviceName(void);

Page 121: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

117

8.7.8. getBdAddress

Function

Acquire the local BD device.

Format

Parameters

None

Return value

Model Explanation

String Except for NULL: local BD device.

(Text strings that include colons in the

format: ”11:22:33:44:55:66”)

NULL: Fail

String getBdAddress (void);

Page 122: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

118

8.7.9. connect

Function

Specify the partner BD address (remote BD address), connection timeout, and the

number of times to retry, and then connect.

Format

Parameter

Model name Explanation

AddrType addrType Remote BD address classification

*See "BD address classification" for more details

String Remote BD address

int timeout Timeout time (ms)

Set from 120 to 32000 ms in increments of 10 ms.

int retryReconnect Number of retry times

Return value

Model Explanation

int BluetoothLeChipCode.SUCCESS: success

BluetoothLeChipCode.BaseError.INVALID_ADDR: invalid memory address

BluetoothLeChipCode.BaseError.INVALID_PARAM: invalid parameter

BluetoothLeChipCode.BaseError.INVALID_STATE: invalid status

BluetoothLeChipCode.BaseError.INVALID_ADDR: invalid remote BD address

BluetoothLeChipCode.BaseError.NO_MEM: maximum connections

BluetoothLeChipCode.BaseError.BUSY: system busy status

Usage method

To receive connection processing results, you need to register the callback function in

setGapCallback in advance.

The following callback function sends a notification for connection processing results.

BluetoothLeGapCallback.onConnectResult

int connect(AddrType addrType, String addr, int timeout, int retryReconnect);

Page 123: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

119

BD address classification

Value Explanation

BluetoothLeGapCallback.AddrType.PUBLIC Public

BluetoothLeGapCallback.AddrType.RANDOM_STATIC Random

BluetoothLeGapCallback.AddrType.RANDOM_PRIVATE_RESOLVABLE

BluetoothLeGapCallback.AddrType.RANDOM_PRIVATE_NON_RESOLVABLE

Page 124: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

120

8.7.10. connectCancel

Function

Connection canceled while connecting to the BLE device.

Format

Parameter

Model name Explanation

None ―

Return value

Model Explanation

Int BluetoothLeChipCode.SUCCESS: success

BluetoothLeChipCode.BaseError.INVALID_STATE: invalid status

int connectCancel(void);

Page 125: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

121

8.7.11. disconnect

Function

Specify the partner BD address (remote BD address), connection timeout, and the

number of times to retry, and then connect.

Format

Parameter

Model name Explanation

char connectedHandle Connection handle

* Specify the connection handle (ConnectedHandle) in the

connected status (connStatus) acquired in onConnectResult.

byte hci_status_code Status code

Normally, the following is specified.

BluetoothLeErrorCodeDescription.SigDefinition.

REMOTE_USER_TERMINATED_CONNECTION

* Specify the following if there is a connection parameter tat

is not allowed.

BluetoothLeErrorCodeDescription.SigDefinition.

CONN_INTERVAL_UNACCEPTABLE

Return value

Mode

l

Explanation

Int BluetoothLeChipCode.SUCCESS: success

BluetoothLeChipCode.BaseError.INVALID_PARAM: invalid parameter

BluetoothLeChipCode.BaseError.INVALID_STATE: invalid status

BluetoothLeChipCode.STKError.INVALID_CONN_HANDLE: invalid connection

handle

Usage method

To receive disconnection processing results, you need to register the callback function in

setGapCallback in advance.

The following callback function sends a notification for disconnection processing results.

BluetoothLeGapCallback.onDisconnectResult

int disconnect(char connectedHandle , byte hci_status_code)

Page 126: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

122

8.7.12. setAuthType

Function

Set authentication classification.

Format

Parameter

Model name Explanation

AuthType authType Authentication classification

Return value

Model Explanation

int BluetoothLeChipCode.SUCCESS: success

BluetoothLeChipCode.BaseError.INVALID_PARAM: invalid parameter

BluetoothLeChipCode.BaseError.INVALID_STATE: invalid status

BluetoothLeChipCode.STKError.INVALID_CONN_HANDLE: invalid connection

handle

Authentication classification

Value Explanation

BluetoothLeGapCallback.AuthType.JUSTWORKS Omit pin code

BluetoothLeGapCallback.AuthType.PASSKEYENTRY PIN code authention

boolean setAuthType(AuthType authType);

Page 127: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

123

8.7.13. notifyInputPasskey

Function

Register a pass key.

Format

Parameter

Model name Explanation

PassKeyType passKeyType Passkey type

String passKey Key string

Return value

Model Explanation

int BluetoothLeChipCode.SUCCESS: success

BluetoothLeChipCode.BaseError.INVALID_PARAM: invalid parameter

BluetoothLeChipCode.BaseError.INVALID_STATE: invalid status

BluetoothLeChipCode.BaseError.INVALID_ADDR: invalid memory address

BluetoothLeChipCode.STKError.INVALID_CONN_HANDLE: invalid connection

handle

int notifyInputPasskey(PassKeyType passKeyType, String passKey);

Page 128: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

124

8.7.14. setGapCallback

Function

Register the BluetoothLeGapCallback class where the callback function used for GAP

functions is mounted.

Format

Parameter

Model name Explanation

BluetoothLeGapCallback callback Callback class

Return value

None

Callback function used for GAP functions

See the callback function descriptions in 8.7.24 to 8.7.28 for information on the callback

function for GAP functions that can be registered to the BluetoothLeGapCallback class.

void setGapCallback(BluetoothLeGapCallback callback);

Page 129: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

125

8.7.15. discPriSrv

Function

Start searching the connected BLE device for a Primary Service.

Use format -2 when specifying a UUID and searching for the Primary Service.

Format -1

Format -2

Parameter

Model name Explanation

char connectedHandle Connection handle

char findStartHandle Handle location for starting the search

byte[] uuid UUID for search target

Return value

Model Explanation

int BluetoothLeChipCode.SUCCESS: success

BluetoothLeChipCode.BaseError.INVALID_PARAM: invalid parameter

BluetoothLeChipCode.BaseError.INVALID_STATE: invalid status

BluetoothLeChipCode.BaseError.BUSY: system busy status

BluetoothLeChipCode.STKError.INVALID_CONN_HANDLE: invalid

connection handle

Usage method

To receive search results, you need to register the callback function in setGattCallback in

advance.

The following callback function sends a notification for search results.

BluetoothLeGattCallback.onDiscPriSrvResult

int discPriSrv(char connectedHandle, char findStartHandle);

int discPriSrv(char connectedHandle, char findStartHandle, byte[] uuid);

Page 130: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

126

8.7.16. discChar

Function

Start searching the connected BLE device for Characteristics.

Format

Parameter

Model name Explanation

char connectedHandle Connection handle

char startHandle Handle location for starting the search

char endHandle Handle location for ending the search

Return value

Model Explanation

int BluetoothLeChipCode.SUCCESS: success

BluetoothLeChipCode.BaseError.INVALID_ADDR: invalid memory address

BluetoothLeChipCode.BaseError.INVALID_STATE: invalid status

BluetoothLeChipCode.BaseError.BUSY: system busy status

BluetoothLeChipCode.STKError.INVALID_CONN_HANDLE:invalid connection

handle

Usage method

To receive search results, you need to register the callback function in setGattCallback in

advance.

The following callback function sends a notification for search results.

BluetoothLeGattCallback.onDiscCharResult

int discChar(char connectedHandle, char startHandle, char endHandle);

Page 131: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

127

8.7.17. discCharDesc

Function

Start searching the connected BLE device for Characteristic Descriptors.

Format

Parameter

Model name Explanation

char connectedHandle Connection handle

char startHandle Handle location for starting the search

char endHandle Handle location for ending the search

Return value

Model Explanation

int BluetoothLeChipCode.SUCCESS: success

BluetoothLeChipCode.BaseError.INVALID_ADDR: invalid memory address

BluetoothLeChipCode.BaseError.INVALID_STATE: invalid status

BluetoothLeChipCode.BaseError.BUSY: system busy status

BluetoothLeChipCode.STKError.INVALID_CONN_HANDLE: invalid connection

handle

Usage method

To receive search results, you need to register the callback function in setGattCallback in

advance.

The following callback function sends a notification for search results.

BluetoothLeGattCallback.onDiscCharDescResult

int discCharDesc(char connectedHandle, char startHandle, char endHandle);

Page 132: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

128

8.7.18. readGatt

Function

Start acquiring Characteristic Values/Characteristic Descriptors for the connected BLE

device.

Use format -2 when handling Characteristic Values/Characteristic Descriptors with a long

data length.

Format -1

Format -2

Parameter

Model name Explanation

char connectedHandle Connection handle

char handle Handle location for Charcteristic Value

char offset Reading location for the value

Return value

Model Explanation

int BluetoothLeChipCode.SUCCESS: success

BluetoothLeChipCode.BaseError.INVALID_ADDR: invalid memory address

BluetoothLeChipCode.BaseError.INVALID_STATE: invalid status

BluetoothLeChipCode.BaseError.BUSY: system busy status

BluetoothLeChipCode.STKError.INVALID_CONN_HANDLE: invalid connection

handle

Usage method

To receive search results, you need to register the callback function in setGattCallback in

advance.

The following callback function sends a notification for search results.

BluetoothLeGattCallback.onReadGattResult

int readGatt(char connectedHandle, char handle);

int readGatt(char connectedHandle, char handle, char offset);

Page 133: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

129

8.7.19. readUuidGatt

Function

Start acquiring Characteristic Values for the connected BLE device according to the

specified UUID.

Format

Parameter

Model name Explanation

char connectedHandle Connection handle

byte[] uuid UUID for acquisition target Characteristic

char startHandle Handle location for starting the search

char endHandle Handle location for ending the search

Return value

Model Explanation

int BluetoothLeChipCode.SUCCESS: success

BluetoothLeChipCode.BaseError.INVALID_ADDR: invalid memory address

BluetoothLeChipCode.BaseError.INVALID_STATE: invalid status

BluetoothLeChipCode.BaseError.BUSY: system busy status

BluetoothLeChipCode.STKError.INVALID_CONN_HANDLE: invalid connection

handle

Usage method

To receive search results, you need to register the callback function in setGattCallback in

advance.

The following callback function sends a notification for search results.

BluetoothLeGattCallback.onReadUuidGattResult

int readUuidGatt(char connectedHandle,byte[] uuid, char startHandle,

char endHandle);

Page 134: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

130

8.7.20. writeWithoutRspGatt

Function

Write to for the Characteristic Value specified with the handle.

No result notification through a callback.

Format

Parameter

Model name Explanation

char connectedHandle Connection handle

char handle Handle location for Characteristic Value

byte[] value Written value

Return value

Model Explanation

int BluetoothLeChipCode.SUCCESS: success

BluetoothLeChipCode.BaseError.INVALID_ADDR: invalid memory address

BluetoothLeChipCode.BaseError.INVALID_STATE: invalid status

BluetoothLeChipCode.BaseError.BUSY: system busy status

BluetoothLeChipCode.BaseError.INVALID_PARAM: invalid parameter

BluetoothLeChipCode.BaseError.DATA_SIZE: exceeded data size

BluetoothLeChipCode.BaseError.NO_TX_BUFFERS: exceeded buffer capacity

BluetoothLeChipCode.STKError.INVALID_CONN_HANDLE: invalid connection

handle

int writeWithoutRspGatt(char connectedHandle, char handle, byte[] value);

Page 135: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

131

8.7.21. writeGatt

Function

Write to for the Characteristic Value specified with the handle.

Format

Parameter

Model name Explanation

char connectedHandle Connection handle

char handle Handle location for Characteristic Value

byte[] value Written value

Return value

Model Explanation

int BluetoothLeChipCode.SUCCESS: success

BluetoothLeChipCode.BaseError.INVALID_ADDR: invalid memory address

BluetoothLeChipCode.BaseError.INVALID_STATE: invalid status

BluetoothLeChipCode.BaseError.BUSY: system busy status

BluetoothLeChipCode.BaseError.INVALID_PARAM: invalid parameter

BluetoothLeChipCode.BaseError.DATA_SIZE: exceeded data size

BluetoothLeChipCode.BaseError.NO_TX_BUFFERS: exceeded buffer capacity

BluetoothLeChipCode.STKError.INVALID_CONN_HANDLE: invalid connection

handle

Usage method

To receive search results, you need to register the callback function in setGattCallback in

advance.

The following callback function sends a notification for search results.

BluetoothLeGattCallback.onWriteGattResult

int writeGatt(char connectedHandle, char handle, byte[] value);

Page 136: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

132

8.7.22. confirmation

Function

Response to Indication.

Format

Parameter

Model name Explanation

char connectedHandle Connection handle

char handle Handle location for Characteristic Value

Return value

Model Explanation

int BluetoothLeChipCode.SUCCESS: success

BluetoothLeChipCode.BaseError.INVALID_STATE: invalid status

BluetoothLeChipCode.STKError.INVALID_CONN_HANDLE: invalid connection

handle

BluetoothLeChipCode.STKError.INVALID_ATTR_HANDLE: invalid attribute

handle

int confirmation(char connectedHandle, char handle);

Page 137: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

133

8.7.23. setGattCallback

Function

Register the BluetoothLeGattCallback class where the callback function used for GATT

functions is mounted.

Format

Parameter

Model name Explanation

BluetoothLeGattCallback callback Callback class

Return value

None

Callback function for the GATT function

See the callback function descriptions in 8.7.29 to 8.7.35 for information on the callback

function for GATT functions that can be registered to the BluetoothLeGattCallback.

void setGattCallback(BluetoothLeGattCallback callback);

Page 138: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

134

8.7.24. BluetoothLeGapCallback.onScanResult

Function

Provide an interface for the callback function to receive scan results (Advertise data).

Use format -2 to acquire the scan response and the advertise type.

Related API: startScan/stopScan

Format -1

Format -2

Parameter

Model name Explanation

AddrType addrType Remote BD address classification

String addr Remote BD address

int rssi Received radio wave strength (dBm)

boolean scan_rsp Scan response data

true: Received PDU is SCAN_RSP

false: Received PDU is anything except for SCAN_RSP

AdvType adv_type Advertise type

AdvType.ADV_IND

AdvType.ADV_DIRECT_IND

AdvType.ADV_SCAN_IND

AdvType.ADV_NONCONN_IND

AdvType.SCAN_RSP

AdvType.UNKNOWN

byte[] adv_data Advertise data (31octet)

void onScanResult(AddrType addrType, String addr, int rssi, byte[] adv_data);

void onScanResult(AddrType addrType, String addr, int rssi, boolean scan_rsp,

AdvType adv_type, byte[] adv_data);

Page 139: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

135

8.7.25. BluetoothLeGapCallback.onConnectResult

Function

Provide an interface for the callback function to receive connection results for BLE.

Related API: connect

Format

Parameter

Model name Explanation

byte response Connection information

BluetoothLeGapEvtConnected

connStatus

Connection complete status

Since connection fails if a CONNECTION_TIMEOUT

occurs, the value is undefined.

BluetoothLeGapEvtAuthStatus

authStatus

※ Not supported. Do not use as value is

undefined.

void onConnectResult(byte response, BluetoothLeGapEvtConnected connStatus,

BluetoothLeGapEvtAuthStatus authStatus);

Page 140: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

136

Connection information

Connection information

BluetoothLeErrorCodeDescription.SUCCESS

BluetoothLeErrorCodeDescription.SigDefinition.CONNECTION_TIMEOUT

BluetoothLeErrorCodeDescription.SigDefinition.REMOTE_USER_TERMINATED_CONNECTION

BluetoothLeErrorCodeDescription.SigDefinition.CONNECTION_TERMINATED_BY_LOCAL_HOST

BluetoothLeErrorCodeDescription.SigDefinition.LMP_LL_RESPONSE_TIMEOUT

BluetoothLeErrorCodeDescription.SigDefinition.CONN_INTERVAL_UNACCEPTABLE

BluetoothLeErrorCodeDescription.ChipDefinition.AUTHENTICATE_TIME_OUT

BluetoothLeErrorCodeDescription.ChipDefinition.AUTHENTICATE_PDU_INVALID

BluetoothLeErrorCodeDescription.ChipDefinition.CONNECTION_TIMEOUT

BluetoothLeErrorCodeDescription.ChipDefinition.PASSKEY_ENTRY_FAILED

BluetoothLeErrorCodeDescription.ChipDefinition.OUT_OF_BAND_KEY_NOT_AVAILABLE

BluetoothLeErrorCodeDescription.ChipDefinition.AUTHENTICATION_REQUIREMENTS_NOT_MET

BluetoothLeErrorCodeDescription.ChipDefinition.CONFIRM_VALUE_FAILED

BluetoothLeErrorCodeDescription.ChipDefinition.PAIRING_NOT_SUPPORTED

BluetoothLeErrorCodeDescription.ChipDefinition.ENCRYPTION_KEY_SIZE

BluetoothLeErrorCodeDescription.ChipDefinition.UNSUPPORTED_SMP_COMMAND

BluetoothLeErrorCodeDescription.ChipDefinition.UNSPECIFIED_REASON

BluetoothLeErrorCodeDescription.ChipDefinition.TOO_LITTLE_TIME_ELAPSED_SINCE_LAST_ATTEMPT

BluetoothLeErrorCodeDescription.ChipDefinition.INVALID_PARAMETERS

BluetoothLeErrorCodeDescription.ChipDefinition.AUTHENTICATE_API_CALL_ERROR

BluetoothLeErrorCodeDescription.ChipDefinition.RECEIVED_DISCONNECT_IN_AUTHENTICATING

Connection complete status (class BluetoothLeGapEvtConnected)

Member's name Explanation

char connectedHandle Connection handle

byte addrType BD address classification

byte[] addr BD address

BleConnectParams params Connection parameter

Page 141: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

137

8.7.26. BluetoothLeGapCallback.onDisconnectResult

Function

Provide an interface for the callback function to receive disconnection results for BLE.

Related API: disconnect

Format

Parameter

Model name Explanation

char connectedHandle Connection handle

byte response Disconnection reason

boolean reconnecting Flag during reconnecting

true: During reconnecting

false: not reconnecting

Disconnection reason

Disconnection reason

BluetoothLeErrorCodeDescription.SigDefinition.CONNECTION_TIMEOUT

BluetoothLeErrorCodeDescription.SigDefinition.CONNECTION_TERMINATED_BY_LOCAL_HOST

BluetoothLeErrorCodeDescription.SigDefinition.LMP_LL_RESPONSE_TIMEOUT

are the main values.

For details on other values,

see "Specification of the Bluetooth System v4.1, Vol 2, Part D : Error Code Descriptions"

void onDisconnectResult(char connectedHandle, byte response,

boolean reconnecting);

Page 142: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

138

8.7.27. BluetoothLeGapCallback.onPasskeyInput

Function

Provide an interface for the callback function to confirm pass key input reception.

Format

Parameter

Model name Explanation

PassKeyType passKeyType Connection handle

8.7.28. BluetoothLeGapCallback.onPasskeyDisplay

Function

Provide an interface for the callback function to display pass key reception.

Format

Parameter

Model name Explanation

String passKey Key string

void onPasskeyInput(PassKeyType passKeyType);

void onPasskeyDisplay(String passKey);

Page 143: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

139

8.7.29. BluetoothLeGattCallback.onDiscPriSrvResult

Function

Provide an interface for the callback function to receive search results for the Primary

Service.

Related API: discPriSrv

Format

Parameter

Model name Explanation

char connectedHandle Connection handle

int status Search results

* Returns the value defined in

BluetoothLeChipCode.GattStatus

BluetoothLeGattService[] data Service information

Search results

BluetoothLeChipCode.GattStatus definition

public static class GattStatus {

/** Success. */

public static final int BLE_GATT_STATUS_SUCCESS = 0x0000;

/** Unknown or not applicable status. */

public static final int BLE_GATT_STATUS_UNKNOWN = 0x0001;

/** ATT Error: Invalid Error Code. */

public static final int BLE_GATT_STATUS_ATTERR_INVALID = 0x0100;

/** ATT Error: Invalid Attribute Handle. */

public static final int BLE_GATT_STATUS_ATTERR_INVALID_HANDLE = 0x0101;

/** ATT Error: Read not permitted. */

public static final int BLE_GATT_STATUS_ATTERR_READ_NOT_PERMITTED = 0x0102;

/** ATT Error: Write not permitted. */

public static final int BLE_GATT_STATUS_ATTERR_WRITE_NOT_PERMITTED = 0x0103;

/** ATT Error: Used in ATT as Invalid PDU. */

public static final int BLE_GATT_STATUS_ATTERR_INVALID_PDU = 0x0104;

/** ATT Error: Authenticated link required. */

public static final int BLE_GATT_STATUS_ATTERR_INSUF_AUTHENTICATION = 0x0105;

/** ATT Error: Used in ATT as Request Not Supported. */

public static final int BLE_GATT_STATUS_ATTERR_REQUEST_NOT_SUPPORTED = 0x0106;

/** ATT Error: Offset specified was past the end of the attribute. */

public static final int BLE_GATT_STATUS_ATTERR_INVALID_OFFSET = 0x0107;

/** ATT Error: Used in ATT as Insufficient Authorisation. */

public static final int BLE_GATT_STATUS_ATTERR_INSUF_AUTHORIZATION = 0x0108;

/** ATT Error: Used in ATT as Prepare Queue Full. */

void onDiscPriSrvResult(char connectedHandle, int status ,

BluetoothLeGattService[] data);

Page 144: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

140

public static final int BLE_GATT_STATUS_ATTERR_PREPARE_QUEUE_FULL = 0x0109;

/** ATT Error: Used in ATT as Attribute not found. */

public static final int BLE_GATT_STATUS_ATTERR_ATTRIBUTE_NOT_FOUND = 0x010A;

/** ATT Error: Attribute cannot be read or written using read/write blob requests. */

public static final int BLE_GATT_STATUS_ATTERR_ATTRIBUTE_NOT_LONG = 0x010B;

/** ATT Error: Encryption key size used is insufficient. */

public static final int BLE_GATT_STATUS_ATTERR_INSUF_ENC_KEY_SIZE = 0x010C;

/** ATT Error: Invalid value size. */

public static final int BLE_GATT_STATUS_ATTERR_INVALID_ATT_VAL_LENGTH = 0x010D;

/** ATT Error: Very unlikely error. */

public static final int BLE_GATT_STATUS_ATTERR_UNLIKELY_ERROR = 0x010E;

/** ATT Error: Encrypted link required. */

public static final int BLE_GATT_STATUS_ATTERR_INSUF_ENCRYPTION = 0x010F;

/** ATT Error: Attribute type is not a supported grouping attribute. */

public static final int BLE_GATT_STATUS_ATTERR_UNSUPPORTED_GROUP_TYPE = 0x0110;

/** ATT Error: Encrypted link required. */

public static final int BLE_GATT_STATUS_ATTERR_INSUF_RESOURCES = 0x0111;

/** ATT Error: Reserved for Future Use range #1 begin. */

public static final int BLE_GATT_STATUS_ATTERR_RFU_RANGE1_BEGIN = 0x0112;

/** ATT Error: Reserved for Future Use range #1 end. */

public static final int BLE_GATT_STATUS_ATTERR_RFU_RANGE1_END = 0x017F;

/** ATT Error: Application range begin. */

public static final int BLE_GATT_STATUS_ATTERR_APP_BEGIN = 0x0180;

/** ATT Error: Application range end. */

public static final int BLE_GATT_STATUS_ATTERR_APP_END = 0x019F;

/** ATT Error: Reserved for Future Use range #2 begin. */

public static final int BLE_GATT_STATUS_ATTERR_RFU_RANGE2_BEGIN = 0x01A0;

/** ATT Error: Reserved for Future Use range #2 end. */

public static final int BLE_GATT_STATUS_ATTERR_RFU_RANGE2_END = 0x01DF;

/** ATT Error: Reserved for Future Use range #3 begin. */

public static final int BLE_GATT_STATUS_ATTERR_RFU_RANGE3_BEGIN = 0x01E0;

/** ATT Error: Reserved for Future Use range #3 end. */

public static final int BLE_GATT_STATUS_ATTERR_RFU_RANGE3_END = 0x01FC;

/** ATT Common Profile and Service Error: Client Characteristic Configuration Descriptor improperly

configured. */

public static final int BLE_GATT_STATUS_ATTERR_CPS_CCCD_CONFIG_ERROR = 0x01FD;

/** ATT Common Profile and Service Error: Procedure Already in Progress. */

public static final int BLE_GATT_STATUS_ATTERR_CPS_PROC_ALR_IN_PROG = 0x01FE;

/** ATT Common Profile and Service Error: Out Of Range. */

public static final int BLE_GATT_STATUS_ATTERR_CPS_OUT_OF_RANGE = 0x01FF;

};

Service information (class BluetoothLeGattService)

Member's name Explanation

byte[] uuid UUID (16bit only)

char startHandle Start handle location

char endHandle End handle location

Page 145: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

141

8.7.30. BluetoothLeGattCallback.onDiscCharResult

Function

Provide an interface for the callback function to receive search results for the

Characteristic.

Related API: discChar

Format

Parameter

Model name Explanation

char connectedHandle Connection handle

int status Search results

* Returns the value defined in

BluetoothLeChipCode.GattStatus

BluetoothLeGattChar[] data Characteristic information

Characteristic information (class BluetoothLeGattChar)

Member's name Explanation

byte[] uuid UUID (16bit only)

char handleDecl Handle for Characteristic Declaration

char handleValue Handle for Characteristic Value

CharacteristicProperties properties Characteristic setting information

Characteristic setting information (class BluetoothLeGattChar.CharacteristicProperties)

Function name Explanation

boolean IsBrodcast() Determine if anything is broadcast

boolean IsRead() Determine readGatt/readUuidGatt

IsWriteWoResp() Determine writeWithoutRspGatt

IsWrite() Determine writeGatt

IsNofify() Determine Notification

IsIndicate() Determine Indication

void onDiscCharResult(char connectedHandle, int status,

BluetoothLeGattChar[] data);

Page 146: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

142

8.7.31. BluetoothLeGattCallback.onDiscCharDescResult

Function

Provide an interface for the callback function to receive search results for the

Characteristic Descriptor.

Related API: discCharDesc

Format

Parameter

Model name Explanation

char connectedHandle Connection handle

int status Search results

* Returns the value defined in

BluetoothLeChipCode.GattStatus

BluetoothLeGattDesc[] data Characteristic Descriptor information

Characteristic Descriptor information (class BluetoothLeGattDesc)

Member's name Explanation

byte[] uuid Characteristic Descriptor UUID

char handle Handle for Characteristic Descriptor

void onDiscCharDescResult(char connectedHandle, int status,

BluetoothLeGattDesc[] data);

Page 147: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

143

8.7.32. BluetoothLeGattCallback.onReadGattResult

Function

Provide an interface for the callback function for acquisition results reception of

Characteristic Value using readGatt API.

Related API: readGatt

Format

Parameter

Model name Explanation

char connectedHandle Connection handle

int status Search results

* Returns the value defined in

BluetoothLeChipCode.GattStatus

BluetoothLeGattEvtReadRsp data Read Response data

Read Response data (class BluetoothLeGattEvtReadRsp)

Member's name Explanation

byte[] data Read Response data

char handle Handle

char offset Data offset

void onReadGattResult(char connectedHandle, int status,

BluetoothLeGattEvtReadRsp data);

Page 148: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

144

8.7.33. BluetoothLeGattCallback.onReadUuidGattResult

Function

Provide an interface for the callback function for acquisition results reception of

Characteristic Value using readUuidGatt API.

Related API: readUuidGatt

Format

Parameter

Model name Explanation

char connectedHandle Connection handle

int status Search results

* Returns the value defined in

BluetoothLeChipCode.GattStatus

byte[] data Characteristic Value data

void onReadUuidGattResult(char connectedHandle, int status, byte[] data);

Page 149: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

145

8.7.34. BluetoothLeGattCallback.onWriteGattResult

Function

Provide an interface for the callback function for writing results reception of Characteristic

Value using writeGattRes API.

Related API: writeGattRes

Format

Parameter

Model name Explanation

char connectedHandle Connection handle

int status Search results

* Returns the value defined in

BluetoothLeChipCode.GattStatus

BluetoothLeGattEvtWriteRsp data Write Response data

Write Response data (class BluetoothLeGattEvtWriteRsp)

Member's name Explanation

byte[] data Write data

char handle Handle

char offset Data offset

byte writeOp Write operation code

void onWriteGattResult(char connectedHandle, int status,

BluetoothLeGattEvtWriteRsp data);

Page 150: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

146

8.7.35. BluetoothLeGattCallback.hvxEvt

Function

Provide an interface for the callback function to receive Indication/Notification using

confirmation API.

Related API: confirmation

Format

Parameter

Model name Explanation

char connectedHandle Connection handle

int status Search results

* Returns the value defined in

BluetoothLeChipCode.GattStatus

hvxEvtType type Indication/Notification classification

byte[] data Characteristic handle value

void hvxEvt(char connectedHandle, int status, char handle,

hvxEvtType type, byte[] data);

Page 151: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

147

8.8. BLE Processing Sample Code

When developing a BLE app, describe the sample code used in the BLE API.

8.8.1. Enabling BLE

Call isEnable() and acquire the current status.

Since BLE is disabled when this function returns false, call enable() to enable BLE.

private BluetoothLeAdapterManager mManager;

if ( ! mManager.isEnable() ) {

// BLE Off

if ( ! mManager.enable() ) {

//Error processing: display error message for BLE-On failure

}

} else {

// BLE On

}

8.8.2. Disabling BLE

Call isEnable() and acquire the current status.

Since BLE is enabled when this function returns true, call disable() to disable BLE.

private BluetoothLeAdapterManager mManager;

if ( mManager.isEnable() ) {

// BLE On

if ( ! mManager.disable() ) {

//Error processing: display error message for BLE-Off failure

}

} else {

// BLE Off

}

Page 152: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

148

8.8.3. Registering scan start and callback

To start the Beacon function, register the callback function using setGapCallback() to receive

Advertise from the Beacon device, and start scanning using startScan().

import android.widget.Toast;

public class MainActivity extends Activity {

private BluetoothLeAdapterManager mManager;

@Override

protected void onCreate(Bundle savedInstanceState) {

//Instance acquisition for the BLE manager class

mManager = BluetoothLeAdapterManager.getInstance();

//Register a callback for the GAP function provided

mManager.setGapCallback(mLeGapCallback);

}

private void scanLe(final boolean enable) {

if ( enable ) {

//Start scanning

mManager.starScan();

} else {

//Stop scanning

mManager.stopScan();

}

}

Receive scan results using the following callback, and output the received signal strength to a

log.

private BluetoothLeGapCallback mLeGapCallback = new BluetoothLeGapCallback(){

@Override

public void onScanResult(AddrType addrType, String addr, int rssi

, byte[] adv_data) {

Log.i(“DEBUG”, “rssi=” + rssi);

}

};

}

Page 153: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

149

8.8.4. Connecting and Disconnecting BLE

The following provides an example of the processing for connecting and disconnecting BLE.

Connecting: Enable GAP callback registration and scanning before connecting.Connect using

information in (addrType, addr) in the scan results (onScanResult()).

Disconnecting: Disconnect using the connection handle (connStatus.connectedHandle) in the

connection results (onConnectResult()).

import android.bluetooth.BluetoothLeAdapterManager;

import android.bluetooth.BluetoothLeGapEvtConnected;

import android.bluetooth.BluetoothLeGattCallback;

public class MainActivity extends Activity {

private BluetoothLeAdapterManager mManager;

private boolean mConnectingFlg = false;

@Override

protected void onCreate(Bundle savedInstanceState) {

//Instance acquisition for the BLE manager class

mManager = BluetoothLeAdapterManager.getInstance();

//Register a callback for the GAP function provided

mManager.setGapCallback (mLeGapCallback);

}

private void connectLe(final boolean enable) {

if ( enable ) {

//BLE connect

//Set the addrType and addr acquired in onScanResult

mManager.connect(addrType, addr, 1000, 0);

} else {

//BLE disconnect

//Set the connection handle ConnectedHandle in connected event status

connStatus acquired in onConnectResult

mManager.disconnect(ConnectedHandle,

REMOTE_USER_TERMINATED_CONNECTION);

}

}

Page 154: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

150

Use the following callback to output logs when connecting and disconnecting.

private BluetoothLeGapCallback mLeGapCallback = new BluetoothLeGapCallback() {

@Override

public void onConnectResult(byte response,

final BluetoothLeGapEvtConnected connStatus,

BluetoothLeGapEvtAuthStatus authStatus) {

Log.i(“DEBUG”, “connectedHandle=“

+ connStatus.connectedHandle);

};

@Override

public void onDisconnectResult(char connectedHandle,

byte response, boolean reconnecting) {

Log.i(“DEBUG”, “Disconnect“);

};

};

Page 155: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

151

8.8.5. Searching for Primary Service

You can search for the Primary Service on a connected BLE device byexecuting the callback

function setGattCallback() and Primary Service search using discPriSrv().

import android.bluetooth.BluetoothLeAdapterManager;

import android.bluetooth.BluetoothLeGapEvtConnected;

import android.bluetooth.BluetoothLeGattCallback;

public class MainActivity extends Activity {

private BluetoothLeAdapterManager mManager;

@Override

protected void onCreate(Bundle savedInstanceState) {

//Instance acquisition for the BLE manager class

mManager = BluetoothLeAdapterManager.getInstance();

//Register a callback for the GATT function provided

mManager.setGattCallback(mLeGattCallback);

//Searching for Primary Service

//Set the connection handle ConnectedHandle in connected event status

connStatus acquired in onConnectResult

mManager.discPriSrv(ConnectedHandle, (char) 1);

}

Use the following callback to output logs when a Primary Service is detected.

private BluetoothLeGattCallback mLeGattCallback =

new BluetoothLeGattCallback() {

@Override

public void onDiscPriSrvResult(char connectedHandle,

int status, BluetoothLeGattService[] data) {

for (int cnt=0; cnt<data.length; cnt++) {

Log.i(“DEBUG”, “startHandle=” +

data[cnt].startHandle + “ endHandle=” +

data[cnt].endHandle);

}

};

};

}

Page 156: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

152

8.8.6. Searching for Characteristic

You can search for the Characteristics on a connected BLE device byexecuting the callback

function setGattCallback() and Characteristic search using discChar().

import android.bluetooth.BluetoothLeAdapterManager;

import android.bluetooth.BluetoothLeGapEvtConnected;

import android.bluetooth.BluetoothLeGattCallback;

public class MainActivity extends Activity {

private BluetoothLeAdapterManager mManager;

@Override

protected void onCreate(Bundle savedInstanceState) {

//Instance acquisition for the BLE manager class

mManager = BluetoothLeAdapterManager.getInstance();

//Register a callback for the GATT function provided

mManager.setGattCallback(mLeGattCallback);

//Searching for Characteristic

//Set StartHandle and EndHandle from the Service information

acquired in onDiscPriSrvResult

mManager.discChar (ConnectedHandle, StartHandle, EndHandle);

}

Use the following callback to output logs when a Characteristic is detected.

private BluetoothLeGattCallback mLeGattCallback =

new BluetoothLeGattCallback() {

@Override

public void onDiscCharResult(char connectedHandle,

int status, BluetoothLeGattChar[] data) {

for (int cnt=0; cnt<data.length; cnt++) {

Log.i(“DEBUG”, “HandleValue=” +

data[cnt].handleValue+ “ uuid=” +

data[cnt].uuid);

}

};

};

}

Page 157: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

153

8.8.7. Searching for Characteristic Descriptor

You can search for the Characteristic Descriptor on a connected BLE device by

executing the callback function setGattCallback() and Characteristic Descriptor search using

discCharDesc().

import android.bluetooth.BluetoothLeAdapterManager;

import android.bluetooth.BluetoothLeGapEvtConnected;

import android.bluetooth.BluetoothLeGattCallback;

public class MainActivity extends Activity {

private BluetoothLeAdapterManager mManager;

@Override

protected void onCreate(Bundle savedInstanceState) {

//Instance acquisition for the BLE manager class

mManager = BluetoothLeAdapterManager.getInstance();

//Register a callback for the GATT function provided

mManager.setGattCallback(mLeGattCallback);

//Searching for Characteristic Descriptor

//Set StartHandle and EndHandle from the acquired onDiscPriSrvResult

mManager.discCharDesc (ConnectedHandle, StartHandle, EndHandle);

}

Use the following callback to output logs when a Characteristic Descriptor is detected.

private BluetoothLeGattCallback mLeGattCallback =

new BluetoothLeGattCallback() {

@Override

public void onDiscCharDescResult (char connectedHandle,

int status, BluetoothLeGattChar[] data) {

for (int cnt=0; cnt<data.length; cnt++) {

Log.i(“DEBUG”, “HandleValue=” + data[cnt].handleValue

+ “ CharacteristicUuid=” + data[cnt].uuid);

}

};

};

}

Page 158: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

154

8.8.8. Acquiring Characteristic Value by Specifying a Handle

You can acquire the Characteristic Value on a connected BLE device by

executing the callback function setGattCallback() and Characteristic Value acquisition using

readGatt().

import android.bluetooth.BluetoothLeAdapterManager;

import android.bluetooth.BluetoothLeGapEvtConnected;

import android.bluetooth.BluetoothLeGattCallback;

public class MainActivity extends Activity {

private BluetoothLeAdapterManager mManager;

@Override

protected void onCreate(Bundle savedInstanceState) {

//Instance acquisition for the BLE manager class

mManager = BluetoothLeAdapterManager.getInstance();

//Register a callback for the GATT function provided

mManager.setGattCallback(mLeGattCallback);

//Acquire (READ) Characteristic Value

//Set the handle HandleValue in Characteristic Value from the Characteristic

//information acquired in onDiscCharResult()

mManager.readGatt(ConnectedHandle, HandleValue)

}

Use the following callback to output logs when a Characteristic Value is acquired.

private BluetoothLeGattCallback mLeGattCallback =

new BluetoothLeGattCallback() {

@Override

public void onReadGattResult (

char status, BluetoothLeGattEvtReadRsp data) {

Log.i(“DEBUG”, “Characteristic Value=” + data.data);

}

};

}

Page 159: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

155

8.8.9. Acquiring Characteristic Value by Specifying a UUID

You can acquire the Characteristic Value on a connected BLE device by specifying a UUID. To

do this execute the callback function registration using setGattCallback() and Characteristic

Value acquisition using readUuidGatt().

import android.bluetooth.BluetoothLeAdapterManager;

import android.bluetooth.BluetoothLeGapEvtConnected;

import android.bluetooth.BluetoothLeGattCallback;

public class MainActivity extends Activity {

private BluetoothLeAdapterManager mManager;

@Override

protected void onCreate(Bundle savedInstanceState) {

//Instance acquisition for the BLE manager class

mManager = BluetoothLeAdapterManager.getInstance();

//Register a callback for the GATT function provided

mManager.setGattCallback(mLeGattCallback);

//Acquire (READ) Characteristic Value

//Set StartHandle and EndHandle from the acquired onDiscPriSrvResult

//Set the UUID for the Characteristic information acquired in

// onDiscCharDescResult

mManager.readUuidGatt(ConnectedHandle, Uuid, StartHandle, EndHandle);

}

Use the following callback to output logs when a Characteristic Value is acquired.

private BluetoothLeGattCallback mLeGattCallback =

new BluetoothLeGattCallback() {

@Override

onReadUuidGattResult(char connectedHandle, int status,

BluetoothLeGattEvtReadUuidRsp[] data) {

Log.i(“DEBUG”, “Characteristic Value=” + data.data);

}

};

}

Page 160: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

156

8.8.10. Writing a Characteristic Value

You can write the Characteristic Value to a connected BLE device by

executing the callback function setGattCallback() and Characteristic Value writing using

writeGatt().

import android.bluetooth.BluetoothLeAdapterManager;

import android.bluetooth.BluetoothLeGapEvtConnected;

import android.bluetooth.BluetoothLeGattCallback;

public class MainActivity extends Activity {

private BluetoothLeAdapterManager mManager;

@Override

protected void onCreate(Bundle savedInstanceState) {

//Instance acquisition for the BLE manager class

mManager = BluetoothLeAdapterManager.getInstance();

//Register a callback for the GATT function provided

mManager.setGattCallback(mLeGattCallback);

//Writing a Characteristic Value

//Set the handle HandleValue in Characteristic Value from the Characteristic

// information acquired in onDiscCharResult()

mManager.writeGatt(ConnectedHandle, HandleValue, 0x01);

}

Use the following callback to output logs when a Characteristic Value is written.

private BluetoothLeGattCallback mLeGattCallback =

new BluetoothLeGattCallback() {

@Override

public void onWriteGattResult(char connectedHandle, int status,

BluetoothLeGattEvtWriteRsp data) {

//Since the value written in writeGatt is returned for confirmation,

// no processing is performed

Log.i(“DEBUG”, “write ok”);

}

};

}

Page 161: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

157

9. Power control

Page 162: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

158

9.1. Power control summary

You can install two batteries in the BT-2000 and acquire power supply information.

■ Power supply information

The following power supply information types are defined in the Android BatteryManager class.

Power supply type Battery

information

type

Constant

Power status Overall status of batteries

A/B

int EXTRA_STATUS

Amount of power

remaining

Amount of power remaining

in batteries A/B [%]

int EXTRA_LEVEL

AC adapter connection Info. on AC adapter

connected/disconnected

int EXTRA_PLUGGED

Battery A status Status String EXTRA_STATUS_A

Battery A installed Battery installed boolean EXTRA_PRESENT_A

Amount of power

remaining in battery A

Power remaining [%] int EXTRA_LEVEL_A

Battery A current Current [mA] int EXTRA_CURRENT_A

Battery A voltage Voltage [mV] int EXTRA_VOLTAGE_A

Battery A temperature Temperature [deg C] int EXTRA_TEMPERATURE_A

Battery B status Status String EXTRA_STATUS_B

Battery B installed Battery installed boolean EXTRA_PRESENT_B

Amount of power

remaining in battery B

Power remaining [%] int EXTRA_LEVEL_B

Battery B current Current [mA] int EXTRA_CURRENT_B

Battery B voltage Voltage [mV] int EXTRA_VOLTAGE_B

Battery B temperature Temperature [deg C] int EXTRA_TEMPERATURE_B

Page 163: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

159

9.2. Acquiring Battery Information

Use the Filter intent broadcast by the operating system, and acquire the battery information.

Usage examples are displayed below.

■ Register the receiver of the battery information broadcast by the app

IntentFilter filter = new IntentFilter();

filter.addAction(Intent.ACTION_BATTERY_CHANGED);

registerReceiver(mBroadcastReceiver, filter);

■ Acquire broadcast battery information

Example: Acquiring the amount of power remaining, status, and installation status for battery A

@Override

public void onReceive(Context context, Intent intent){

int level_a = intent.getIntExtra(BatteryManager.EXTRA_LEVEL_A, 0);

String status_a = intent.getStringExtra(BatteryManager.EXTRA_STATUS_A);

boolean present_a = intent.getBooleanExtra(BatteryManager.EXTRA_PRESENT_A, false);

Page 164: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

160

10. Appendix

Page 165: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

161

10.1. Self-diagnostic function

10.1.1. Self-diagnostic function summary

The BT-2000 is equipped with a self-diagnostic function to check the status of internal devices.

You can check the following devices and content using the self-diagnostic function.

Table 10-1 Confirmation items using the self-diagnostic function

Device type Display name Diagnostic method

CPU CPU Error check

Power control IC PMIC Check power supply status

Main memory (RAM) DDR Check RAM data

Data memory (Flash) eMMC Reading and writing to data

region

Wireless LAN module WLAN Check communication with

device

Bluetooth 3.0 Bluetooth Check communication with

device

Bluetooth Low Energy BLE Check communication with

device

Audio IC Audio IC Reading device information

characteristics

Audio commands IC Voice Command Reading device information

characteristics

Sensor Sensor MCU Communication check

IMU sensor IMU Acquire sensor data

Sensor Illumination Sensor Illumination Acquire sensor data

Charger IC A Charger IC A Check status

Charger IC B Charger IC B Check status

Battery A Battery A Check status

Battery B Battery B Check status

The self-diagnostic function is a basic diagnostic tool. Be aware that it may not be able to locate

faults in individual functions in the device.Especially when some functions are not available.

Page 166: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

162

10.1.2. Using the self-diagnostic function

The self-diagnostic function is provided as an app. Start "SelfDiagnosis" from the app list.

Figure 10-1 Start SelfDiagnosis app

When the app starts, click the "Start Diag" button at the top of the screen to start the diagnostic

procedure.

Figure 10-2 Start SelfDiagnosis app screen

Page 167: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

163

When the diagnosis has been performed, the results for each device are displayed. See table 10-1

above for details about the target items and the checking method.

Figure 10-3 SelfDiagnosis check results

Page 168: EPSON BT-2000 Developer's Guide · Acquiring Android Studio ... Close all dialogs except for "Android SDK Manager", ... MOVERIO Pro Developer's Guide (Rev.1.0)

MOVERIO Pro Developer's Guide (Rev.1.0)

164

― Memo ―