VEE Wear Framework

The VEE Wear Framework allows developers to build a VEE Wear Kernel executable and develop VEE Wear Apps.

The Framework contains the following components:

  • the source code of the VEE Wear Kernel

  • the source code of common VEE Wear Apps (health, settings, etc.)

  • the VEE Wear Services library

Note

The source code is available on demand. You can contact MicroEJ Support to evaluate VEE Wear.

VEE Wear Kernel

The VEE Wear Kernel is the core Application running on the wearable device. It manages the lifecycle of VEE Wear Apps.

The Kernel is board agnostic and can be fully customized to any hardware. It must be built from its source code (available on demand) with the VEE Port corresponding to the target hardware. The build generates an executable file and a Virtual Device which must be provided to app developers so that they can build their Apps.

The VEE Wear Kernel Application requires the following amount of memory:

  • RAM: around 400KB (mainly for Java heap and buffered images)

  • ROM: from 250KB to 1MB for each App (mainly for its images)

The Kernel provides the following APIs to the Apps:

Library

Version

EDC

1.3

BON

1.4

Trace

1.1

FS

2.1

MicroUI

3.1

Drawing

1.0

MicroVG

1.2

Audio

1.0

Bluetooth

2.2

VEE Wear Services

0.10

VEE Wear Services Library

The VEE Wear Services library allows VEE Wear Apps to communicate with the Kernel and with other Apps.

The library provides interfaces to services that are implemented by the Kernel:

Service

Provided Features

ComponentService

register App components

DeviceService

get device information

ExternalResourceService

create and delete external resources

FontService

get fonts

HealthService

get health information

NavigationService

navigate across the UI

TimeService

get time information

The KernelServiceProvider class provides static methods to get an instance of every service. It also provides a shared instance of Timer, which can be used by any App to schedule tasks without creating an additional thread.

The library also provides interfaces to components that are implemented by the Apps:

Component

Provided Features

Activity

user interface that can be shown in the Activity Launcher

Watchface

user interface that can be shown in the Watchface Picker

ComplicationDataSource

data that can be displayed on watchface complications

Using ComponentService, Apps can register their own components into the Kernel. Once a component is registered, its lifecycle is managed by the Kernel: the Kernel will call the methods of the component when the user navigates in the relevant menus of the watch.

To use the VEE Wear Services, add the following line to the project build file:

implementation("com.microej.library.wear:wear-services:0.10.0")

VEE Wear Apps

Apps are the cornerstone of VEE Wear: they provide exciting and unique features that make a smartwatch unforgettable. With VEE Wear, Apps can be deployed over USB or Bluetooth and installed dynamically on the device. Partial software update allows manufacturers to provide new features and bug fixes without having to validate and deploy an entire firmware.

Creating an App

To create an App project, follow these steps:

  • Create an SDK 6 Application project.

  • Open the build.gradle.kts file.

  • Add a dependency to the VEE Wear Services library: add implementation("com.microej.library.wear:wear-services:0.10.0") in the dependencies block.

Implementing the Entry Point

The entry point of an App contains the code that will be called by the Kernel when the App is installed and uninstalled. The name of the entry point class must be declared in the build.gradle.kts file. The class should implement the FeatureEntryPoint interface.

The entry point can perform any operation, such as registering components, adding Bluetooth services or running timer tasks. However, the entry point is not the place to show a UI: this should be done by the Activities or Watchfaces registered by the App.

Note

Apps can use any library, as long as it doesn’t require a Foundation Library that is not provided by the Kernel.

Implementing an Activity

An Activity is a user interface which is shown by the Activity Launcher:

../_images/vee-wear-activities.png

To implement an Activity, implement the Activity interface and its methods:

  • getName() should return the name of the Activity. This is the name that is visible in the Activity Launcher.

  • renderIcon() should render the icon of the Activity in the given region. This is the icon that is visible in the Activity Launcher.

  • show() should show the fullscreen UI of the Activity. The implementation can call Display.requestShow() or Desktop.requestShow() to show its UI and handle events. Make sure to handle events so that the user can exit the Activity.

Once the Activity is implemented, make sure it is registered in the Kernel by calling ComponentService.registerActivity(). This method is usually called in the entry point of the App.

Implementing a Watchface

A Watchface is a user interface which can be shown by the Watchface Picker.

../_images/vee-wear-watchfaces.png

To implement a Watchface, implement the Watchface interface and its methods:

Once the Wathface is implemented, make sure it is registered in the Kernel by calling ComponentService.registerWatchface(). This method is usually called in the entry point of the App.

Implementing a Complication Data Source

A Complication Data Source provides data which can be displayed on a watchface complication. Complication Data Sources can provide a text, an icon and a progress value. Watchfaces can render complications the way they want using the data provided by the source.

../_images/vee-wear-source.png

To implement a Complication Data Source, implement the ComplicationDataSource interface and its methods:

Once the Complication Data Source is implemented, make sure it is registered in the Kernel by calling ComponentService.registerComplicationDataSource(). This method is usually called in the entry point of the App.

Building an App

Selecting the Kernel

To be able to build your App, you must add a dependency to the VEE Wear Kernel by following these steps:

  • Open the build.gradle.kts file.

  • Define the path to the VEE Wear Framework on your machine: add val veeWearFramework = "/path/to/VEE-Wear-Framework"

  • Add a dependency to the VEE Wear Kernel: add microejVee(files("$veeWearFramework/Virtual-Device", "$veeWearFramework/kernel.out")) in the dependencies block.

Building the App

Once the project is configured, the App can be built like any MicroEJ Application:

  • To test an App on simulator, launch the runOnSimulator Gradle task.

  • To build an App, launch the buildFeature Gradle task. You can then install the App by deploying the build/feature/application/application.fo Feature file to the watch over USB or Bluetooth.