Book Image

Getting Started with UDOO

By : Maurizio Caporali, Emanuele Palazzetti
Book Image

Getting Started with UDOO

By: Maurizio Caporali, Emanuele Palazzetti

Overview of this book

Table of Contents (16 chapters)
Getting Started with UDOO
Credits
Foreword
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Improving the boiler with an antifreeze check


Now that the forecast fetching is up and running, we can proceed with implementing the antifreeze feature. To achieve the interaction and the logic previously discussed, we should:

  1. Enhance the Preset class storing the user's antifreeze setpoint. In this class, we should provide two utilities to disable the antifreeze check and to find out whether the feature is enabled or not.

  2. Handle the antifreeze feature in the Overview activity, updating the user interface when a setpoint is selected.

  3. Update the boiler logic in the SensorThread class so it takes into account the antifreeze check when it's enabled.

We begin our work by changing the Preset class with the following steps:

  1. At the top of the class, add the highlighted declarations:

    private static final String CURRENT_LOCATION = "__LOCATION__";
    private static final String CURRENT_ANTIFREEZE = "__ANTIFREEZE__";
    private static final float ANTIFREEZE_DISABLED = -Float.MAX_VALUE
    

    We use the ANTIFREEZE_DISABLED...