Contenu connexe Similaire à In touch with smart devices Similaire à In touch with smart devices (20) Plus de Droidcon Berlin (20) In touch with smart devices1. In Touch with Smart Devices
The future is connected.
Masanori Fujita
Zühlke Engineering GmbH
Slide 1
March 2012
Masanori Fujita
© Zühlke 2012
2. What about Android@Home?
• Android@Home announced at
Google I/O in May 2011
• Vision: “think of your entire
home as an accessory”
– Control lighting
– Collect sensor data
– Play media
• new wireless protocol to
communicate with accessories
• so far, no updates on this
In Touch with Smart Devices | Masanori Fujita March 2012 Slide 2 © Zühlke 2012
3. • Lighting
• Heating system
• Washing Machine
• Dish washer
• Weather sensors
• Door bell
• Audio & Video
4. Supported interfaces types
GSM/3G
USB WiFi
NFC Bluetooth
In Touch with Smart Devices | Masanori Fujita March 2012 Slide 4 © Zühlke 2012
6. Traditional Roles
Accessory
Master Device
Accessory
• PCs • Input Devices
• Mass Storage
• Printer
• Camera
• MP3 Players
• Smartphones
In Touch with Smart Devices | Masanori Fujita March 2012 Slide 6 © Zühlke 2012
7. New Roles
Accessory
Master Device
Accessory
• PCs • Input Devices
• Smartphones • Mass Storage
• Printer
• Camera
• MP3 Players
• Smartphones
In Touch with Smart Devices | Masanori Fujita March 2012 Slide 7 © Zühlke 2012
8. USB Host Mode
• USB host is required to provide
500mA current
• USB On-the-Go is used to act as
limited USB host
• USB Host Mode is optional
Accessory
Accessory
In Touch with Smart Devices | Masanori Fujita March 2012 Slide 8 © Zühlke 2012
11. ADK Initialization Process
Wait for Android Request USB
device to connect device descriptor
Accessory
Power On Android device
connected
Request
accessory support
Android Device
Send
no OEM’s vendor
and product ID
Wait for accessory
to connect
Power On Device in accessory mode?
Send
yes Google’s vendor
and product ID
In Touch with Smart Devices | Masanori Fujita March 2012 Slide 11 © Zühlke 2012
12. Android: Many form-factors
Samsung Galaxy S II
HTC Velocity 4G
Motorola Pro+
In Touch with Smart Devices | Masanori Fujita March 2012 Slide 12 © Zühlke 2012
13. USB Support in Android
Oct-11
4.0
Feb-11 May-11 Jul-11
3.0 3.1 3.2
Oct 09 Jan 10 May 10 Dec-10
2.0 2.1 2.2 2.3
Sep-08 Feb-09 Apr 09 Sep-09
1.0 1.1 1.5 1.6
Sep 2008 Mar 2012
ADK (since 3.1 + 2.3.4)
USB Host Mode (since 3.1)
In Touch with Smart Devices | Masanori Fujita March 2012 Slide 13 © Zühlke 2012
14. • Reliable and high speed
connection
• Easy handling for user and
developer
• Power supply and form-
factors might be an issue for
accessory designers
16. Which Bluetooth profiles does your phone
support?
SPP HDP
DUN
SIM
HID
FAX
HFP
OPP
OPP
HSP
In Touch with Smart Devices | Masanori Fujita March 2012 Slide 16 © Zühlke 2012
17. The built-in Bluetooth Stack
Android API Socket
(android.bluetooth.*)
Serial Port Profile (SPP)
Virtual serial port
Service Discovery
RFCOMM Protocol
L2CAP
Link Manager Layer
Bluetooth
Baseband
Controller
Radio Layer
In Touch with Smart Devices | Masanori Fujita March 2012 Slide 17 © Zühlke 2012
18. What the API offers…
• Scan for devices
• Listen for incoming RFCOMM connections
• Establish RFCOMM connections
• Communicate with HFP, HSP, HDP, A2DP devices
• Implement new Bluetooth profiles
In Touch with Smart Devices | Masanori Fujita March 2012 Slide 18 © Zühlke 2012
19. Not all profiles use RFCOMM
Example: HID
Human Interface Device Profile
Service Discovery
Protocol
L2CAP
Link Manager Layer
Bluetooth
Baseband
Controller
Radio Layer
In Touch with Smart Devices | Masanori Fujita March 2012 Slide 19 © Zühlke 2012
20. You should only rely on serial
communication, unless…
• you can implement a profile in Java that solely builds
upon RFCOMM and SDP.
• you have a defined set of target devices
– accessing the native BT driver
– create native extensions
– add profiles to API
– compile custom ROM
• Google defines other profiles to be mandatory for
Android devices and offer them as API
In Touch with Smart Devices | Masanori Fujita March 2012 Slide 20 © Zühlke 2012
21. • Supported by most devices
• Handling might be tricky for
user
• Only serial communication is
guaranteed
24. Reading and writing tags
• Support for different
types of tags
– NFC Forum Type 1-4
– Mifare *
• API features
– Reacting on tag
discovery
– Reading and writing
passive tag with serial
NDEF messages passive number, deployment
– Sector level I/O access
date, date of last
inspection etc.
active
Card emulation
providing live status
information, allow
device settings
In Touch with Smart Devices | Masanori Fujita March 2012 Slide 24 © Zühlke 2012
25. Beaming to and from your smart device
• Android Beam™ is technically an NDEF push
in peer-to-peer mode
– Google’s own NDEF Push Protocol (NPP)
– NFC Forum’s new Simple NDEF Exchange Protocol (SNEP)
• No bi-directional data exchange using lower layers
active
Realtime status
information, allow
device settings
In Touch with Smart Devices | Masanori Fujita March 2012 Slide 25 © Zühlke 2012
26. Android as a Card
• Card emulation is not exposed in Android API
• Would add many valuable scenarios
• Also consider discussion around secure elements
– in a SIM card
– embedded in a chip
– on stickers
In Touch with Smart Devices | Masanori Fujita March 2012 Slide 26 © Zühlke 2012
28. • Future Android devices will
probably have support for
NFC
• Easy handling for user and
developer
• Need to find workaround for
missing card emulation
mode
29. What is the best way to connect to your
devices and accessories?
Which UX do you desire?
?
What about security?
How does the
device’s environment
look like?
Can you define the
How much data will
deployment targets?
you produce?
In Touch with Smart Devices | Masanori Fujita March 2012 Slide 29 © Zühlke 2012
31. Home Automation made easy
powered by ELV
ELV pluggable sensors and actors
In Touch with Smart Devices | Masanori Fujita March 2012 Slide 31 © Zühlke 2012
32. Home Automation made easy
powered by ELV
ELV pluggable sensors and actors
UART
In Touch with Smart Devices | Masanori Fujita March 2012 Slide 32 © Zühlke 2012
33. Introducing Arduino
• Open Source prototyping board
• ATmega328 @ 16 MHz
• 14 digital and 6 analog I/O pins
• USB
• UART
• I2C
• SPI
• Many many shields
In Touch with Smart Devices | Masanori Fujita March 2012 Slide 33 © Zühlke 2012
34. Home Automation made easy
powered by ELV + Arduino + Android
ELV pluggable sensors and actors
3G
Internet
DSL
WiFi
UART
Ethernet
In Touch with Smart Devices | Masanori Fujita March 2012 Slide 34 © Zühlke 2012
35. Udp.begin(localPort);
server.begin();
Serial.begin(9600);
while(timeStatus() == timeNotSet) {
unsigned long t = getNtpTime();
if (t > 0) {
setTime(t);
}
}
setSyncProvider(getNtpTime);
setSyncInterval(60);
}
bool event_1_triggered = false;
bool event_2_triggered = false;
void loop()
{
time_t t = now();
for(int i = 0; i < EVENT_COUNT; i = i + 1) {
// check whether On-Event was not fired and On-Time has been
reached
if (!triggered_events[i*2] && hour(t) == time_table[i*FIELDS] &&
minute(t) == time_table[i*FIELDS+1]) {
fs20.send_cmd(time_table[i*FIELDS+4], CMD_ON, 0xFF);
triggered_events[i*2] = true;
triggered_events[i*2+1] = false;
}
// check whether Off-Event was not fired and Off-Time has been
reached
if (!triggered_events[i*2+1] && hour(t) == time_table[i*FIELDS+2]
&& minute(t) == time_table[i*FIELDS+3]) {
fs20.send_cmd(time_table[i*FIELDS+4], CMD_OFF, 0xFF);
triggered_events[i*2] = false;
triggered_events[i*2+1] = true;
}
}
// wait for a new client:
Client client = server.available();
// when the client sends the first byte, say hello:
if (client) {
if (client.connected() && client.available()) {
// read the bytes incoming from the client:
char c1 = client.read();
char c2 = client.read();
char c3 = client.read();
fs20.send_cmd(c1, c2, c3);
}
}
40. Thermometer
Accelerometer
External Sensors
WiFi
Twitter
Email
Text Messaging