Skip to content

open-jumpco/kfsm-android-compose-traffic

Repository files navigation

KFSM Android Compose Traffic Intersection Demo

This application demonstrates using 2 state machines to provide a solution. The traffic light state machine operates the light and only has a stop and go event. The stop event will switch to amber and after a timeout switch to red and generate a stopped notification.

The intersection state machine cycles through controlling the lights in order, sending go to current light and then waiting after stopped before switching to next light sending the go event.

The TrafficIntersectionModel can be created by providing a different number of lights.

The application illustrates how to create a view models that uses LiveData to represent the changing values and states so that compose can update the UI efficiently.

Demo

Two Traffic Lights

Two Traffic Lights

Three Traffic Lights

Three Traffic Lights

Traffic Intersection Classes

Static

Generated Traffic Light Models

Simple State Diagram

Static

Detailed State Diagram

Static

Generated Intersection Models

Simple State Diagram

Static

Detailed State Diagram

Static

About

KFSM Adroid Compose Traffic Intersection Demo

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages