Vela

App developers

Build your first Vela app

Make a small counter that responds to a physical remote. This exercise uses the real SDK 1.0 card protocol. You can run the app portion on Linux today with a C compiler and a terminal. The public SDK and development emulator let you install the result and drive it with remote input. Download the tools and boot the guest.

1. Get the two source files

Download the C source and the application manifest into the same empty directory. Alternatively, on a machine with curl:

curl -fSso remote-counter.c https://velaos.polymathlabs.xyz/downloads/remote-counter.c
curl -fSso manifest.json https://velaos.polymathlabs.xyz/downloads/counter-manifest.json
cc -std=c17 -Wall -Wextra -Werror -O2 remote-counter.c -o counter

The example keeps one unsigned integer between zero and 99. Left and Right change the value. OK returns it to zero. It sends its initial frame immediately so the viewer receives feedback as soon as the program launches.

2. Drive the same input contract from a terminal

printf 'RRLO' | ./counter

The body of each output line starts with 0, 1, 2, 1 and 0 in that order. The three fields on each line are the protocol name, title and body, separated by real tab characters. End of input closes the program. This exercises the application logic on your computer. Only a Vela shell turns the frames into television pixels and supplies the trusted Home and Back actions.

3. Package for a development television

From the same directory on an x86-64 Linux host with static libc development files installed, compile again with static linking. Install the public SDK and start the matching x86-64 development guest using the release quickstart. Run the following in the directory containing the source and manifest.

cc -std=c17 -O2 -static remote-counter.c -o counter-static
vela-sdk package manifest.json counter-static counter.vapp
vela-sdk install counter.vapp
vela-sdk launch org.example.counter

If your browser saved the manifest as counter-manifest.json, pass that filename to the build command. For an ARM64 television, rebuild the executable with a matching Linux target compiler and static sysroot. The installer checks the ELF machine type.

4. Use the remote and leave the app

Press Right twice, Left once and OK. The focused app owns those four input events. Press Home to return to the shell. You can terminate the process from the host with the following command.

vela-sdk terminate org.example.counter

Where to go next

Change the program to track a choice among three items. Ignore events it cannot act on, preserve the current selection at each boundary, and emit a frame only when the visible state changes. The runtime contract specifies what the shell does when a process stalls or produces malformed output. Save your application and its current phase in your developer workspace.

If you already maintain an Android app, assess its existing source and plan a Vela version.