SlideShare a Scribd company logo
Riaan Cornelius
Project Hoptimus – Automating the home brewing process
What will we be covering
> Beer brewing 101
> Project Hoptimus
> Challenges when developing IOT solutions
> Clean architecture
> What’s next
Beer brewing 101
Beer brewing 101
Malting
Mashing
Lautering Boiling
Whirlpooling
Fermenting Conditioning
Filtering
Packaging
Beer brewing 101
Beer brewing process - simplified
Mashing
• Extracting sugars from malted barley
• Separating wort from grains
Boiling
• Boiling wort
• Adding hops, spices or other additives
Fermenting
• Adding yeast to boiled (and cooled) wort
• Fermenting at a specific temperature until all sugar is converted
Packaging
• Getting beer into some vessel (Bottle or keg usually)
• Enjoy once beer is carbonated
Project Hoptimus - Requirements
Recipe
•Import recipe (BeerXML standard)
•Display overview and current brew process
Mashing
•Pump in correct amount of water
•Monitor temperature for mash duration
•Pump wort to boil kettle
Boil
•Boil water for boil duration
•Alarms to add hops / additives
•Pump wort to fermenter once wort is cooled
Ferment
•Monitor and control temperature for duration of fermentation
•Monitor specific gravity to determine when fermentation is done
•Log all measurements to cloud database
Challenges when developing IOT applications
> Hardware is difficult to emulate
> Testing physical sensors is hard
> God objects abound in Android
> Behaviour tends to spread across classes
Clean Architecture
Hexagonal architecture
> Not a silver bullet
> Separates contract from implementation
> Makes code easier to test
> Allows running your IOT app on an emulator
Hexagonal Architecture
Hexagonal architecture on Android Things
> We need to create a standard Android Things project and make two
simple changes:
1. Add a provided dependency to your build.gradle
2. Add an intent filter to your manifest
> For each service / piece of hardware
1. Create a port (the contract)
2. Create an adapter for a mock implementation
3. Create an adapter for the real implementation
Project setup – build.gradle
apply plugin: 'com.android.application'
android {
...
}
dependencies {
...
compileOnly 'com.google.android.things:androidthings:0.7-devpreview'
...
}
Project setup – intent filter
<activity android:name=".HomeActivity"
android:label="@string/app_name">
<!-- This allows launching on an emulator -->
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<!-- This is to launch at boot on AndroidThings -->
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.IOT_LAUNCHER" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
Hardware setup – Port (contract)
public interface TemperatureSensor {
Float read();
void close();
}
Hardware setup – Adapter (mock implementation)
public class MockTemperatureSensor implements TemperatureSensor {
private static final String TAG = MockTemperatureSensor.class.getSimpleName();
@Override
public Float read() {
return 23.3F;
}
@Override
public void close() {
Log.d(TAG, "close");
}
}
Hardware setup – Adapter (real implementation)
public class BMP280TemperatureSensor implements TemperatureSensor {
private Bmx280SensorDriver driver;
// ...
private Float temperature;
public BMP280TemperatureSensor(Context context) {
// ...
driver = new Bmx280SensorDriver("I2C1");
driver.registerTemperatureSensor();
}
@Override
public Float read() {
return temperature;
}
@Override
public void close() {
// ...
driver.close();
}
private class TemperatureListener implements SensorEventListener { ... }
}
Hardware setup – Activity
class TemperatureActivity : Activity() {
private lateinit var temperatureSensor: TemperatureSensor
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_temperature)
temperatureSensor = getTempSensor()
val button = findViewById<Button>(R.id.button)
val text = findViewById<TextView>(R.id.textTemperature)
button.setOnClickListener({ text.text = temperatureSensor.read().toString() })
}
private fun getTempSensor(): TemperatureSensor {
return if (BuildConfig.MOCK_BUILD) {
MockTemperatureSensor()
} else {
BMP280TemperatureSensor(this)
}
}
}
Hardware setup – BuildTypes
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
buildConfigField "boolean", "MOCK_BUILD", "false"
}
debug {
minifyEnabled false
buildConfigField "boolean", "MOCK_BUILD", "true"
}
}
Hardware setup – Testing
@LargeTest
@RunWith(AndroidJUnit4.class)
public class TemperatureActivityTest {
@Rule
public ActivityTestRule<TemperatureActivity> mActivityTestRule =
new ActivityTestRule<>(TemperatureActivity.class);
@Test
public void temperatureActivityTest() {
// Click button to read temperature
ViewInteraction button = onView(allOf(withId(R.id.button), withText("Read"),
childAtPosition(childAtPosition(withId(android.R.id.content), 0), 0),
isDisplayed()));
button.perform(click());
// Check temperature was read from port
ViewInteraction textView2 = onView(allOf(withId(R.id.textTemperature),
childAtPosition(childAtPosition(withId(android.R.id.content), 0), 1),
isDisplayed()));
textView2.check(matches(withText("23.3")));
}
}
Hardware setup - Testing
What’s next?
> Gluing it all together
> More complex sensors
> Google Nearby API to get alarms / reminders on my phone
/* THANK YOU*/
Riaan Cornelius
http://riaancornelius.com/
riaan.cornelius@entelect.co.za
@riaancornelius
http://www.devconf.co.za/

More Related Content

What's hot

Git workflows
Git workflowsGit workflows
Git workflowsXpand IT
 
Using Cocoapods
Using CocoapodsUsing Cocoapods
Using Cocoapods
jeffreysambells
 
Git Workflow With Gitflow
Git Workflow With GitflowGit Workflow With Gitflow
Git Workflow With GitflowJosh Dvir
 
Git Ready! Workflows
Git Ready! WorkflowsGit Ready! Workflows
Git Ready! Workflows
Atlassian
 
CocoaPods introduction
CocoaPods introductionCocoaPods introduction
CocoaPods introduction
Jordi Giménez
 
Chef at Etsy
Chef at EtsyChef at Etsy
Chef at Etsy
Jon Cowie
 
Git 101 - Crash Course in Version Control using Git
Git 101 - Crash Course in Version Control using GitGit 101 - Crash Course in Version Control using Git
Git 101 - Crash Course in Version Control using Git
Geoff Hoffman
 
Git-flow workflow and pull-requests
Git-flow workflow and pull-requestsGit-flow workflow and pull-requests
Git-flow workflow and pull-requests
Bartosz Kosarzycki
 
Chef Intro @ SF Bay Area LSPE meetup
Chef Intro @ SF Bay Area LSPE meetupChef Intro @ SF Bay Area LSPE meetup
Chef Intro @ SF Bay Area LSPE meetup
mdxp
 
Chef for beginners module 1
Chef for beginners   module 1Chef for beginners   module 1
Chef for beginners module 1
Chef
 
Compliance Automation Workshop
Compliance Automation WorkshopCompliance Automation Workshop
Compliance Automation Workshop
Chef
 
Introduction to github slideshare
Introduction to github slideshareIntroduction to github slideshare
Introduction to github slideshare
Rakesh Sukumar
 
Git collaboration
Git collaborationGit collaboration
Git collaboration
Pham Quy (Jack)
 
Git and GitHub workflows
Git and GitHub workflowsGit and GitHub workflows
Git and GitHub workflows
Arthur Shvetsov
 
Rise of the Machines - Automate your Development
Rise of the Machines - Automate your DevelopmentRise of the Machines - Automate your Development
Rise of the Machines - Automate your Development
Sven Peters
 
Git branching strategies
Git branching strategiesGit branching strategies
Git branching strategies
jstack
 
Michelin Starred Cooking with Chef
Michelin Starred Cooking with ChefMichelin Starred Cooking with Chef
Michelin Starred Cooking with Chef
Jon Cowie
 
Gitflow
GitflowGitflow
Git and git hub
Git and git hubGit and git hub
Git and git hub
Kamalnath L P
 

What's hot (20)

Git workflows
Git workflowsGit workflows
Git workflows
 
Using Cocoapods
Using CocoapodsUsing Cocoapods
Using Cocoapods
 
Git Workflow With Gitflow
Git Workflow With GitflowGit Workflow With Gitflow
Git Workflow With Gitflow
 
Git Ready! Workflows
Git Ready! WorkflowsGit Ready! Workflows
Git Ready! Workflows
 
CocoaPods introduction
CocoaPods introductionCocoaPods introduction
CocoaPods introduction
 
Chef at Etsy
Chef at EtsyChef at Etsy
Chef at Etsy
 
Git 101 - Crash Course in Version Control using Git
Git 101 - Crash Course in Version Control using GitGit 101 - Crash Course in Version Control using Git
Git 101 - Crash Course in Version Control using Git
 
Git-flow workflow and pull-requests
Git-flow workflow and pull-requestsGit-flow workflow and pull-requests
Git-flow workflow and pull-requests
 
Chef Intro @ SF Bay Area LSPE meetup
Chef Intro @ SF Bay Area LSPE meetupChef Intro @ SF Bay Area LSPE meetup
Chef Intro @ SF Bay Area LSPE meetup
 
Chef for beginners module 1
Chef for beginners   module 1Chef for beginners   module 1
Chef for beginners module 1
 
Compliance Automation Workshop
Compliance Automation WorkshopCompliance Automation Workshop
Compliance Automation Workshop
 
Behat sauce
Behat sauceBehat sauce
Behat sauce
 
Introduction to github slideshare
Introduction to github slideshareIntroduction to github slideshare
Introduction to github slideshare
 
Git collaboration
Git collaborationGit collaboration
Git collaboration
 
Git and GitHub workflows
Git and GitHub workflowsGit and GitHub workflows
Git and GitHub workflows
 
Rise of the Machines - Automate your Development
Rise of the Machines - Automate your DevelopmentRise of the Machines - Automate your Development
Rise of the Machines - Automate your Development
 
Git branching strategies
Git branching strategiesGit branching strategies
Git branching strategies
 
Michelin Starred Cooking with Chef
Michelin Starred Cooking with ChefMichelin Starred Cooking with Chef
Michelin Starred Cooking with Chef
 
Gitflow
GitflowGitflow
Gitflow
 
Git and git hub
Git and git hubGit and git hub
Git and git hub
 

Similar to Project Hoptimus - Brewing beer using Android Things

Auto Code Generation and Rapid Brewery/Distillery Automation
Auto Code Generation and Rapid Brewery/Distillery AutomationAuto Code Generation and Rapid Brewery/Distillery Automation
Auto Code Generation and Rapid Brewery/Distillery Automation
DMC, Inc.
 
Flamingo Hello World Tutorial
Flamingo Hello World TutorialFlamingo Hello World Tutorial
Flamingo Hello World Tutorial
i-love-flamingo
 
Maven
MavenMaven
Maven
Shraddha
 
AAI-3218 Production Deployment Best Practices for WebSphere Liberty Profile
AAI-3218 Production Deployment Best Practices for WebSphere Liberty ProfileAAI-3218 Production Deployment Best Practices for WebSphere Liberty Profile
AAI-3218 Production Deployment Best Practices for WebSphere Liberty Profile
WASdev Community
 
A Supermarket of Your Own: Running a Private Chef Supermarket
A Supermarket of Your Own: Running a Private Chef SupermarketA Supermarket of Your Own: Running a Private Chef Supermarket
A Supermarket of Your Own: Running a Private Chef Supermarket
Nell Shamrell-Harrington
 
Get started with docker &amp; dev ops
Get started with docker &amp; dev opsGet started with docker &amp; dev ops
Get started with docker &amp; dev ops
Asya Dudnik
 
Android Workshop
Android WorkshopAndroid Workshop
Android Workshop
Junda Ong
 
Maven advanced
Maven advancedMaven advanced
Maven advanced
Smita Prasad
 
Continuous Delivery, Continuous Integration
Continuous Delivery, Continuous Integration Continuous Delivery, Continuous Integration
Continuous Delivery, Continuous Integration
Amazon Web Services
 
InSpec at DevOps ATL Meetup January 22, 2020
InSpec at DevOps ATL Meetup January 22, 2020InSpec at DevOps ATL Meetup January 22, 2020
InSpec at DevOps ATL Meetup January 22, 2020
Mandi Walls
 
Beta testing iPhone apps
Beta testing iPhone appsBeta testing iPhone apps
Beta testing iPhone apps
Shawn Grimes
 
Prescriptive System Security with InSpec
Prescriptive System Security with InSpecPrescriptive System Security with InSpec
Prescriptive System Security with InSpec
All Things Open
 
Prescriptive Security with InSpec - All Things Open 2019
Prescriptive Security with InSpec - All Things Open 2019Prescriptive Security with InSpec - All Things Open 2019
Prescriptive Security with InSpec - All Things Open 2019
Mandi Walls
 
Rapid Application Development with CakePHP 1.3
Rapid Application Development with CakePHP 1.3Rapid Application Development with CakePHP 1.3
Rapid Application Development with CakePHP 1.3
kidtangerine
 
Managed Beans: When, Why and How
Managed Beans: When, Why and HowManaged Beans: When, Why and How
Managed Beans: When, Why and How
Russell Maher
 
DevOps on AWS: Accelerating Software Delivery with the AWS Developer Tools
DevOps on AWS: Accelerating Software Delivery with the AWS Developer ToolsDevOps on AWS: Accelerating Software Delivery with the AWS Developer Tools
DevOps on AWS: Accelerating Software Delivery with the AWS Developer Tools
Amazon Web Services
 
Get started with docker &amp; dev ops
Get started with docker &amp; dev opsGet started with docker &amp; dev ops
Get started with docker &amp; dev ops
Asya Dudnik
 
Dev ops &amp; laas fundamental
Dev ops &amp; laas fundamentalDev ops &amp; laas fundamental
Dev ops &amp; laas fundamental
Kanin Kearpimy
 
WordPress Acceptance Testing, Solved!
WordPress Acceptance Testing, Solved!WordPress Acceptance Testing, Solved!
WordPress Acceptance Testing, Solved!
Taylor Lovett
 

Similar to Project Hoptimus - Brewing beer using Android Things (20)

Auto Code Generation and Rapid Brewery/Distillery Automation
Auto Code Generation and Rapid Brewery/Distillery AutomationAuto Code Generation and Rapid Brewery/Distillery Automation
Auto Code Generation and Rapid Brewery/Distillery Automation
 
Flamingo Hello World Tutorial
Flamingo Hello World TutorialFlamingo Hello World Tutorial
Flamingo Hello World Tutorial
 
Maven
MavenMaven
Maven
 
AAI-3218 Production Deployment Best Practices for WebSphere Liberty Profile
AAI-3218 Production Deployment Best Practices for WebSphere Liberty ProfileAAI-3218 Production Deployment Best Practices for WebSphere Liberty Profile
AAI-3218 Production Deployment Best Practices for WebSphere Liberty Profile
 
A Supermarket of Your Own: Running a Private Chef Supermarket
A Supermarket of Your Own: Running a Private Chef SupermarketA Supermarket of Your Own: Running a Private Chef Supermarket
A Supermarket of Your Own: Running a Private Chef Supermarket
 
Get started with docker &amp; dev ops
Get started with docker &amp; dev opsGet started with docker &amp; dev ops
Get started with docker &amp; dev ops
 
Android Workshop
Android WorkshopAndroid Workshop
Android Workshop
 
Maven advanced
Maven advancedMaven advanced
Maven advanced
 
Continuous Delivery, Continuous Integration
Continuous Delivery, Continuous Integration Continuous Delivery, Continuous Integration
Continuous Delivery, Continuous Integration
 
InSpec at DevOps ATL Meetup January 22, 2020
InSpec at DevOps ATL Meetup January 22, 2020InSpec at DevOps ATL Meetup January 22, 2020
InSpec at DevOps ATL Meetup January 22, 2020
 
Beta testing iPhone apps
Beta testing iPhone appsBeta testing iPhone apps
Beta testing iPhone apps
 
CICD_1670665418.pdf
CICD_1670665418.pdfCICD_1670665418.pdf
CICD_1670665418.pdf
 
Prescriptive System Security with InSpec
Prescriptive System Security with InSpecPrescriptive System Security with InSpec
Prescriptive System Security with InSpec
 
Prescriptive Security with InSpec - All Things Open 2019
Prescriptive Security with InSpec - All Things Open 2019Prescriptive Security with InSpec - All Things Open 2019
Prescriptive Security with InSpec - All Things Open 2019
 
Rapid Application Development with CakePHP 1.3
Rapid Application Development with CakePHP 1.3Rapid Application Development with CakePHP 1.3
Rapid Application Development with CakePHP 1.3
 
Managed Beans: When, Why and How
Managed Beans: When, Why and HowManaged Beans: When, Why and How
Managed Beans: When, Why and How
 
DevOps on AWS: Accelerating Software Delivery with the AWS Developer Tools
DevOps on AWS: Accelerating Software Delivery with the AWS Developer ToolsDevOps on AWS: Accelerating Software Delivery with the AWS Developer Tools
DevOps on AWS: Accelerating Software Delivery with the AWS Developer Tools
 
Get started with docker &amp; dev ops
Get started with docker &amp; dev opsGet started with docker &amp; dev ops
Get started with docker &amp; dev ops
 
Dev ops &amp; laas fundamental
Dev ops &amp; laas fundamentalDev ops &amp; laas fundamental
Dev ops &amp; laas fundamental
 
WordPress Acceptance Testing, Solved!
WordPress Acceptance Testing, Solved!WordPress Acceptance Testing, Solved!
WordPress Acceptance Testing, Solved!
 

Recently uploaded

Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
Elena Simperl
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Inflectra
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
Thijs Feryn
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
Ana-Maria Mihalceanu
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
Laura Byrne
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
Product School
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
ControlCase
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
OnBoard
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
Alison B. Lowndes
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Ramesh Iyer
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Albert Hoitingh
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
Sri Ambati
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
UiPathCommunity
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance
 

Recently uploaded (20)

Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
 

Project Hoptimus - Brewing beer using Android Things

  • 1. Riaan Cornelius Project Hoptimus – Automating the home brewing process
  • 2. What will we be covering > Beer brewing 101 > Project Hoptimus > Challenges when developing IOT solutions > Clean architecture > What’s next
  • 4. Beer brewing 101 Malting Mashing Lautering Boiling Whirlpooling Fermenting Conditioning Filtering Packaging
  • 6. Beer brewing process - simplified Mashing • Extracting sugars from malted barley • Separating wort from grains Boiling • Boiling wort • Adding hops, spices or other additives Fermenting • Adding yeast to boiled (and cooled) wort • Fermenting at a specific temperature until all sugar is converted Packaging • Getting beer into some vessel (Bottle or keg usually) • Enjoy once beer is carbonated
  • 7. Project Hoptimus - Requirements Recipe •Import recipe (BeerXML standard) •Display overview and current brew process Mashing •Pump in correct amount of water •Monitor temperature for mash duration •Pump wort to boil kettle Boil •Boil water for boil duration •Alarms to add hops / additives •Pump wort to fermenter once wort is cooled Ferment •Monitor and control temperature for duration of fermentation •Monitor specific gravity to determine when fermentation is done •Log all measurements to cloud database
  • 8. Challenges when developing IOT applications > Hardware is difficult to emulate > Testing physical sensors is hard > God objects abound in Android > Behaviour tends to spread across classes
  • 10. Hexagonal architecture > Not a silver bullet > Separates contract from implementation > Makes code easier to test > Allows running your IOT app on an emulator
  • 12. Hexagonal architecture on Android Things > We need to create a standard Android Things project and make two simple changes: 1. Add a provided dependency to your build.gradle 2. Add an intent filter to your manifest > For each service / piece of hardware 1. Create a port (the contract) 2. Create an adapter for a mock implementation 3. Create an adapter for the real implementation
  • 13. Project setup – build.gradle apply plugin: 'com.android.application' android { ... } dependencies { ... compileOnly 'com.google.android.things:androidthings:0.7-devpreview' ... }
  • 14. Project setup – intent filter <activity android:name=".HomeActivity" android:label="@string/app_name"> <!-- This allows launching on an emulator --> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> <!-- This is to launch at boot on AndroidThings --> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.IOT_LAUNCHER" /> <category android:name="android.intent.category.DEFAULT" /> </intent-filter> </activity>
  • 15. Hardware setup – Port (contract) public interface TemperatureSensor { Float read(); void close(); }
  • 16. Hardware setup – Adapter (mock implementation) public class MockTemperatureSensor implements TemperatureSensor { private static final String TAG = MockTemperatureSensor.class.getSimpleName(); @Override public Float read() { return 23.3F; } @Override public void close() { Log.d(TAG, "close"); } }
  • 17. Hardware setup – Adapter (real implementation) public class BMP280TemperatureSensor implements TemperatureSensor { private Bmx280SensorDriver driver; // ... private Float temperature; public BMP280TemperatureSensor(Context context) { // ... driver = new Bmx280SensorDriver("I2C1"); driver.registerTemperatureSensor(); } @Override public Float read() { return temperature; } @Override public void close() { // ... driver.close(); } private class TemperatureListener implements SensorEventListener { ... } }
  • 18. Hardware setup – Activity class TemperatureActivity : Activity() { private lateinit var temperatureSensor: TemperatureSensor override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_temperature) temperatureSensor = getTempSensor() val button = findViewById<Button>(R.id.button) val text = findViewById<TextView>(R.id.textTemperature) button.setOnClickListener({ text.text = temperatureSensor.read().toString() }) } private fun getTempSensor(): TemperatureSensor { return if (BuildConfig.MOCK_BUILD) { MockTemperatureSensor() } else { BMP280TemperatureSensor(this) } } }
  • 19. Hardware setup – BuildTypes buildTypes { release { minifyEnabled true proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' buildConfigField "boolean", "MOCK_BUILD", "false" } debug { minifyEnabled false buildConfigField "boolean", "MOCK_BUILD", "true" } }
  • 20. Hardware setup – Testing @LargeTest @RunWith(AndroidJUnit4.class) public class TemperatureActivityTest { @Rule public ActivityTestRule<TemperatureActivity> mActivityTestRule = new ActivityTestRule<>(TemperatureActivity.class); @Test public void temperatureActivityTest() { // Click button to read temperature ViewInteraction button = onView(allOf(withId(R.id.button), withText("Read"), childAtPosition(childAtPosition(withId(android.R.id.content), 0), 0), isDisplayed())); button.perform(click()); // Check temperature was read from port ViewInteraction textView2 = onView(allOf(withId(R.id.textTemperature), childAtPosition(childAtPosition(withId(android.R.id.content), 0), 1), isDisplayed())); textView2.check(matches(withText("23.3"))); } }
  • 21. Hardware setup - Testing
  • 22. What’s next? > Gluing it all together > More complex sensors > Google Nearby API to get alarms / reminders on my phone
  • 23. /* THANK YOU*/ Riaan Cornelius http://riaancornelius.com/ riaan.cornelius@entelect.co.za @riaancornelius http://www.devconf.co.za/