Specify the Design

Before diving into the code, it’s important to understand the user interface we’re building. A successful kOS UI application begins with a clear understanding of the available data and where it originates. Effective collaboration between UI and Java developers—by establishing clear contracts—helps prevent duplicated effort and ensures a cohesive system.

Our target state is a simple Consumer UI (CUI) that displays beverages based on the currently assigned ingredients. Users will be able to select available beverages and trigger the pouring process via the nozzle.

Wireframe of target State

Breaking Down the UI Components

For our data analysis and implementation, we have identified three main components:

Beverage List

Purpose:
  • Displays a list of beverages that are potentially available for pouring.
  • The list is derived from the Brandset and assigned ingredients, as configured in the beverage pipeline.

Beverage List

Inputs Source
beveragesList of beverages for the dispenserAvailability
selectedThe currently selected beverageNozzle
onBeverageSelectedevent handler for beverage selectionCUI Kit

Beverage Selection Item

Purpose:
  • Renders a single beverage within the list and allows users to select it for pouring.
States:

A Beverage Selection Item can be in one of three states:

  • Normal State: Default appearance when unselected.
  • Selected State: Visual feedback when the beverage is chosen.
  • Unavailable State: Indicates the beverage cannot be poured (e.g., due to missing ingredients).
Inputs Source
namethe name of the current beverage. Can fall back to the note on the Availability model if presentUI Brandset Data → Availability
iconthe URL of the icon to display for the current beverageUI Brandset Data → Availability
primaryColorthe primary background color for the beverageUI Brandset Data → Availability
secondaryColor(optional) a secondary color where a beverage is mixedUI Brandset Data → Availability
isAvailablewhether the beverage is currently available for pouring.Availability
selectedIs the current beverage selected.Nozzle
onBeverageSelectedEvent handler for beverage selectionCUI Kit

Pour Button

Purpose:
  • Initiates the pouring of a selected beverage.
States:

The Pour Button can be in one of the following states:

  • Disabled: No beverage is selected.
  • Enabled: A valid beverage is selected and ready for pouring.
  • Pouring In Progress: The beverage is currently being poured.
Inputs Source
canPourwhether the conditions for enabling pouring are currently met. Generally requires a valid selected beverage.Nozzle
isPouringis the nozzle is currently pouringNozzle
handlePourinvoked when the user initiates a pour by clicking on the pour buttonCUI Kit → Nozzle Model
handleCancelinvoked when the user cancels a pour by releasing the pour buttonCUI Kit → Nozzle Model
pourNamename of the beverage that is currently selected for pouringNozzle & Availability
primaryColorthe primary background color for the beverageUI Brandset Data → Availability
secondaryColor(optional) a secondary color where a beverage is mixedUI Brandset Data → Availability

Note: These colors are provided on a CUI application basis and are peer to the brand set data.

Data Sources and Services

The proposed UI leverages several services from the underlying system application:

Availability Service:

  • Provides the list of available beverages based on ingredient assignments.

Brandset UI Data:

  • Supplies additional information such as beverage names, icons, and color schemes.

Nozzle Service:

  • Manages selection and pouring actions, enabling the interactive aspects of the UI.

Summary

By breaking the UI into three main components—Beverage List, Beverage Selection Item, and Pour Button—we establish a clear structure for our Consumer UI. Each component is designed to interact with specific data sources and services:

  • Beverage List shows the available beverages.
  • Beverage Selection Item provides detailed, interactive representations of each beverage.
  • Pour Button allows users to initiate pouring actions.

This clear delineation ensures that data and responsibilities are well-organized, making it easier for UI developers to work closely with Java developers and maintain a robust, scalable application.