Nested Classes | ||
---|---|---|
class | SmartEyeglassControlUtils.PointInWorldCoordinate | Defines a point in the real-world coordinate system. |
Constants | ||
---|---|---|
float | VERTICAL_RANGE_MAX | |
float | VERTICAL_RANGE_MIN |
Public Constructors | |
---|---|
SmartEyeglassControlUtils(java.lang.String hostAppPackageName, SmartEyeglassEventListener eventListener)
Creates an instance of this class. |
Public Methods | |
---|---|
final void |
activate(Context context)
Associates this instance with a service context. |
final void |
deactivate()
Unregisters this instance from the associated service context. |
void | onReceive(Context context, Intent intent) |
void |
setRequiredApiVersion(int version)
Set the minimum version of the SmartEyeglass API the app requires. |
void |
showImage(int resourceId)
Displays an image resource on the SmartEyeglass screen. |
void |
showImageWithCallback(int resourceId, int transactionNumber)
Draws an image on the SmartEyeglass display. |
void |
showBitmap(Bitmap bitmap)
Displays a bitmap on the SmartEyeglass screen. |
void |
showBitmap(Bitmap bitmap, int x, int y)
Updates a part of the SmartEyeglass screen with a given bitmap. |
void |
showBitmapWithCallback(Bitmap bitmap, int transactionNumber)
Draws an bitmap on the SmartEyeglass display. |
void |
showBitmapWithCallback(Bitmap bitmap, int x, int y, int transactionNumber)
Draws an bitmap on a specific region of the SmartEyeglass display. |
void |
startCamera(java.lang.String filePath)
Initiates camera operation on the SmartEyeglass device, providing a file specification for saving captured image data. |
void |
startCamera()
Initiates camera operation on the SmartEyeglass device. |
void |
stopCamera()
Terminates camera operation on the SmartEyeglass device. |
void |
setCameraMode(int jpegQuality, int resolution, int recordingMode)
Configures camera settings for the next camera operation. |
void |
requestCameraCapture()
Captures a still image when the camera module is running. |
void |
moveLowerLayer(Bitmap bitmap)
Transitions the screen display to the given bitmap using a built-in animation effect that looks like moving down to a lower layer. |
void |
moveUpperLayer(Bitmap bitmap)
Transitions the screen display to the given bitmap using a built-in animation effect that looks like moving up to a higher layer. |
void |
moveLowerLayer(int layoutId, Bundle[] layoutData)
Transitions the screen display to the given layout using a built-in animation effect that looks like moving down to a lower layer. |
void |
moveUpperLayer(int layoutId, Bundle[] layoutData)
Transitions the screen display to the given layout using a built-in animation effect that looks like moving up to a higher layer. |
void |
sendTextViewLayoutId(int textViewId)
Enables vertical stroll support for specified TextView in the current layout. |
void |
showDialogMessage(java.lang.String text, int mode)
Displays a simple dialog. |
void |
showDialogMessage(java.lang.String title, java.lang.String message, java.lang.String[] buttons)
Displays a customized dialog with up to three custom buttons. |
void |
enableVoiceTextInput()
Enables the voice-to-text input feature. |
void |
disableVoiceTextInput()
Disables voice-to-text input feature and removes the microphone icon from the screen. |
void |
enableSafeDisplayMode()
Enables the safe-display mode, which limits the display to the lower half of the screen in order to minimize interference with the user's field of view. |
void |
disableSafeDisplayMode()
Disables the safe-display mode, restoring full screen display. |
void |
setPowerMode(int powerMode)
Sets the power mode. |
void |
requestEnterStandbyMode()
Initiates Standby mode to conserve power. |
void |
disableSoundEffect()
Disables the sound effect that provides feedback when the user presses a button on the controller. |
void |
enableSoundEffect()
Enables the sound effect that provides feedback when the user presses a button on the controller. |
void |
setScreenDepth(int depth)
Controls screen depth, which is the apparent distance of the display plane from the user's eyes. |
void |
requestBatteryStatus()
Requests notification of the battery status. |
void |
requestTelephonyFunctionStatus()
Requests notification of the telephony function status. |
void |
setRenderMode(int renderingMode)
Turns AR rendering mode on or off. |
void |
changeARCylindricalVerticalRange(float range)
Limits the vertical range of cylindrical coordinate system. |
void |
registerARObject(RenderObject object)
Registers an image to be rendered by the AR engine. |
void |
moveARObject(RenderObject object)
Executes the change of position of a registered AR object. |
void |
sendARObjectResponse(RenderObject object, int result)
Sends object data in response to a request from the AR engine for update of a static object display. |
void |
sendARAnimationObject(int objectId, Bitmap bitmap)
Sends image data in response to a request from the AR engine for update of an animation display. |
void |
sendARAnimationObjectWithCallback(int objectId, Bitmap bitmap, int transactionNumber)
Sends the image data of each frame of the animation object. |
void |
changeARObjectOrder(RenderObject object)
Executes the change of rendering order of a registered AR object. |
void |
enableARAnimationRequest()
Request to enable AR animation feature. |
void |
disableARAnimationRequest()
Request to disables AR animation feature. |
void |
deleteARObject(RenderObject object)
Deletes an AR object. |
static PointF |
convertCoordinateSystemFromWorldToCylindrical(SmartEyeglassControlUtils.PointInWorldCoordinate viewingLocation, SmartEyeglassControlUtils.PointInWorldCoordinate targetLocation)
Converts the position of an object in the real world to the cylindrical coordinate system for a given user viewpoint. |
Protected Methods | |
---|---|
void |
sendToHostApp(Intent intent)
Sends an intent to HostApp, adding package names. |
Constant Value: 60.0 (0x0000003c)
Constant Value: 0.0 (0x00000000)
Creates an instance of this class.
hostAppPackageName | Package name of host application. |
---|---|
eventListener | Optional. The associated event listener, or NULL if not needed. |
Associates this instance with a service context.
context | The extension service context. |
---|
Unregisters this instance from the associated service context. You must call this method before destroying the associated context object (for example, in the
onDestroy()
method of the
Activity
). Failure to deactivate causes the Android framework to log an error.
context | |
---|---|
intent |
Set the minimum version of the SmartEyeglass API the app requires. Call this during initialization of the app so that HostApp can ensure compatibility.
This allows the framework to warn the user if they need to install an update, and exit gracefully from your app.
By default, the required API version is set to the highest level available in the SDK. For the best user experience, you should explicitly set it to the highest API level the app actually requires.
version | The minimum required API version |
---|
Displays an image resource on the SmartEyeglass screen. Display can take some time for a large image.
If an image is larger than the screen size, it is not displayed on the screen.
For screen size refer to
EXTRA_IMAGE_HEIGHT,
EXTRA_IMAGE_WIDTH
resourceId | The image resource ID. |
---|
Draws an image on the SmartEyeglass display. Returns the result in onResultShowImage when the operation is completed.
If an image is larger than the screen size, it is not displayed on the screen.
For screen size refer to
EXTRA_IMAGE_HEIGHT,
EXTRA_IMAGE_WIDTH
resourceId | The image resource ID. |
---|---|
transactionNumber | The transaction number.(allowed 0 or more) |
Displays a bitmap on the SmartEyeglass screen. Display can take some time for a large image.
If an image is larger than the screen size, it is not displayed on the screen.
For screen size refer to
EXTRA_IMAGE_HEIGHT,
EXTRA_IMAGE_WIDTH
bitmap | The bitmap object. |
---|
Updates a part of the SmartEyeglass screen with a given bitmap. Provide the screen position at which to place the upper-left corner of the bitmap. Coordinates are in pixels from the screen origin, the upper left corner.
If an image is larger than the screen size, it is not displayed on the screen.
For screen size refer to
EXTRA_IMAGE_HEIGHT,
EXTRA_IMAGE_WIDTH
bitmap | The bitmap to show. |
---|---|
x | The x position at which to draw. |
y | The y position at which to draw. |
Draws an bitmap on the SmartEyeglass display. Returns the result in onResultShowBitmap when the operation is completed.
If an image is larger than the screen size, it is not displayed on the screen.
For screen size refer to
EXTRA_IMAGE_HEIGHT,
EXTRA_IMAGE_WIDTH
bitmap | The bitmap to show. |
---|---|
transactionNumber | The transaction number. (allowed 0 or more) |
Draws an bitmap on a specific region of the SmartEyeglass display. Returns the result in onResultShowBitmap when the operation is completed.
If an image is larger than the screen size, it is not displayed on the screen.
For screen size refer to
EXTRA_IMAGE_HEIGHT,
EXTRA_IMAGE_WIDTH
bitmap | The bitmap to show. |
---|---|
x | The x position. |
y | The y position. |
transactionNumber | The transaction number. (allowed 0 or more) |
Initiates camera operation on the SmartEyeglass device, providing a file specification for saving captured image data.
filePath | Path of a file to which to save captured image data. |
---|
ControlCameraException |
---|
Initiates camera operation on the SmartEyeglass device. When the recording mode is CAMERA_MODE_STILL, CAMERA_MODE_JPG_STREAM_LOW_RATE, CAMERA_MODE_JPG_STREAM_HIGH_RATE, the extension receives onCameraReceived callback methods when the capture process finishes.
ControlCameraException |
---|
Terminates camera operation on the SmartEyeglass device.
Configures camera settings for the next camera operation.
jpegQuality | The desired JPEG quality (compression). One of: |
---|---|
resolution | The desired picture resolution. One of: |
recordingMode | The camera mode. One of: |
Captures a still image when the camera module is running.
Transitions the screen display to the given bitmap using a built-in animation effect that looks like moving down to a lower layer. Display can take some time for a large image. If an image larger than the screen size,it is not displayed on the screen.
For screen size refer to
EXTRA_IMAGE_HEIGHT,
EXTRA_IMAGE_WIDTH
bitmap | The new bitmap to show. |
---|
Transitions the screen display to the given bitmap using a built-in animation effect that looks like moving up to a higher layer. Display can take some time for a large image. If an image larger than the screen size,it is not displayed on the screen.
For screen size refer to
EXTRA_IMAGE_HEIGHT,
EXTRA_IMAGE_WIDTH
bitmap | The new bitmap to show. |
---|
Transitions the screen display to the given layout using a built-in animation effect that looks like moving down to a lower layer. Display can take some time for a large image.
layoutId | The resource ID for the new layout to show. |
---|---|
layoutData | The layout data bundle. |
Transitions the screen display to the given layout using a built-in animation effect that looks like moving up to a higher layer. Display can take some time for a large image.
layoutId | The resource ID for the new layout to show. |
---|---|
layoutData | The layout data bundle. |
Enables vertical stroll support for specified TextView in the current layout.
textViewId | The resource ID of the TextView. |
---|
Displays a simple dialog.
text | The message text. |
---|---|
mode | The dialog mode, one of: |
Displays a customized dialog with up to three custom buttons. The user closes the dialog by selecting one of the buttons.
title | The dialog title. |
---|---|
message | The message text. |
buttons | An array of one to three button labels. A 0-based index pointing into this array is returned to the onDialogClosed handler to indicate which button was selected. |
Enables the voice-to-text input feature. After that user can input text by pushing the Talk button. When feature is active it shows a microphone icon on the screen.
The system interrupts screen while voice-to-text input is in use. During the operation, the app has no control and cannot receive input events from the device keys or touch sensor.
The result of the operation is returned the onVoiceTextInput handler for your app.
Disables voice-to-text input feature and removes the microphone icon from the screen.
Enables the safe-display mode, which limits the display to the lower half of the screen in order to minimize interference with the user's field of view.
Disables the safe-display mode, restoring full screen display.
Sets the power mode. In normal mode (the default), the SmartEyeglass connects via Bluetooth. In high power mode, the connection can use Wi-Fi as well, which uses more power but allows faster data transfer.
powerMode | The PowerMode value, one of |
---|
Initiates Standby mode to conserve power. Standby mode terminates automatically when the user presses any button or touches the touch sensor.
Disables the sound effect that provides feedback when the user presses a button on the controller. The sound effect is on by default.
Enables the sound effect that provides feedback when the user presses a button on the controller. The sound effect is on by default. Use this call to re-enable the effect after you have turned it off.
Controls screen depth, which is the apparent distance of the display plane from the user's eyes.
depth | An integer in the range -4 to 6.
|
---|
Requests notification of the battery status. See onBatteryStatus
Requests notification of the telephony function status. See onTelephonyFunctionStatus
Turns AR rendering mode on or off.
renderingMode | The rendering mode. One of:
|
---|
Limits the vertical range of cylindrical coordinate system. Objects positioned outside of limit will stick to the edge of range. Resulting field of view will be -range..range degrees.
range | The new range value, must be between 0 and 60 degrees. |
---|
Registers an image to be rendered by the AR engine. Registration is asynchronous. The result of registration is sent to the onARRegistrationResult handler for your app.
object | The configured render object, an instance of CylindricalRenderObject or GlassesRenderObject. |
---|
Executes the change of position of a registered AR object. Before calling this method, update the position value in RenderObject.
object | The registered AR object. |
---|
Sends object data in response to a request from the AR engine for update of a static object display. Call this in your handler for onARObjectRequest. Image of more than 57822 pixels can not be sent.
object | The object identified in the request event. |
---|---|
result | The result passed in the request event. |
Sends image data in response to a request from the AR engine for update of an animation display. Call this in your handler for onARObjectRequest. Image of more than 57822 pixels can not be sent.
objectId | The object identified in the request event. |
---|---|
bitmap | The bitmap for the next animation frame. |
Sends the image data of each frame of the animation object. A processing result will be notified if display processing is completed. Response method onResultSendAnimationObject(int, int) Image of more than 57822 pixels can not be sent.
objectId | The object ID. |
---|---|
bitmap | The bitmap image. |
transactionNumber | The transaction number. (allowed 0 or more) |
Executes the change of rendering order of a registered AR object. Before calling this method, update the rendering order value in the object using setOrder or setOrder.
object | The registered object. |
---|
Request to enable AR animation feature. For operation result: onAREnableAnimationResponse
Request to disables AR animation feature. For operation result: onARDisableAnimationResponse
Deletes an AR object.
object | The registered object. |
---|
Converts the position of an object in the real world to the cylindrical coordinate system for a given user viewpoint.
viewingLocation | A user viewpoint in the real-world coordinate system. |
---|---|
targetLocation | The position of an object in the real-world coordinate system. |
A position in the cylindrical coordinate system.
Sends an intent to HostApp, adding package names.
intent | The intent to send. |
---|
This class provides the methods that you use to handle most SmartEyeglass-specific functionality. The API provides these features:
Use of these methods requires the "com.sony.smarteyeglass.permission.SMARTEYEGLASS" permission in the app's Android manifest. Camera and voice-to-text intents require additional specific permissions as noted.
Camera control
The Camera API provides access to two camera functions:
Your camera control app starts and stops camera operation in one of these modes. In JPEG stream mode, image capture begins automatically and continues until camera function is terminated. To capture a still image, you call requestCameraCapture() after starting the camera.
Audio control
SmartEyeglass hardware includes a microphone on the controller that can be used for voice input that is automatically translated to text. To initiate the asynchronous voice input operation, call enableVoiceTextInput(). Provide a handler for the result that is passed back upon completion of the operation. See onVoiceTextInput.
The SmartEyeglass is also a Bluetooth headset, and you can use the microphone and speaker for host-phone audio functions, including sound recording and playback, and telephony. In general, these functions use the standard Android BT HFP API. This class provides a method to query the current telephony status, requestTelephonyFunctionStatus().
Built-in UI utilites
Utilities that help you create a UI for your app include built-in animation effects for layer transitions, and predefined configurable dialogs.
The dialog methods make it easy to define and display a dialog with a message and optional choice buttons. Provide a handler for the result that is passed back to your app when the user dismisses the dialog, or it times out. See onDialogClosed.
Configuration options
You can enable and disable various configuration options for the SmartEyeglass, including:
User input event handling
Users can tap or swipe(left/right) on the touch pad, or press the Back key on the controller. You can override the handlers for these events that are part of the Smart Extension APIs in the Sony Add-on SDK package .
Permissions
Your app's Android manifest must declare this permissions to use SmartEyeglass features:
com.sony.smarteyeglass.permission.SMARTEYEGLASS
In addition, to use the camera and voice-to-text input features, you must request additional permissions:
For example, to use the camera functions, include this element in the Android manifest:
<uses-permission android:name="com.sony.smarteyeglass.permission.CAMERA"/>