#PDR15 - Smartstrap Workshop
-
Upload
pebble-technology -
Category
Technology
-
view
1.521 -
download
2
Transcript of #PDR15 - Smartstrap Workshop
2015 Pebble Developer Retreat
Smartstraps
Brian Gomberg
What is a smartstrap?
Electrical Connection
GND GNDDATA PWR
Smartstrap Protocol
Smartstrap Protocol
•Master / slave model (watch is master)
•Notification mechanism
•Data arrives intact or not at all
Physical Layer
Link Layer
Profile Layer
Link Control Profile Raw Data Profile Generic Service Profile
Generic Service Profile
•Attributes and Services:
•An attribute is a distinct piece of information
•A service is a collection of related attributes
Defining Services and Attributes
Connection Process
Charging flux capacitors!
What profiles do you support?
I support ALL the profiles!
Profile Discovery
All Profiles Supported
Woot! Are you ready to go?
Let’s talk faster.Status Request
Change Baud Rate
What services do you support?
I support service 0x1234, the best service.
Service Discovery
Service 0x1234
static SmartstrapAttribute *color_attr;
static void init(void) { const SmartstrapServiceId service_id = 0x1234; const SmartstrapAttributeId attribute_id = 0x0042; const size_t length = 1; color_attr = smartstrap_attribute_create(service_id, attribute_id, length); smartstrap_subscribe((SmartstrapHandlers) { ... });}
static void deinit(void) { smartstrap_attribute_destroy(color_attr); smartstrap_unsubscribe();}
static const uint16_t SERVICES[] = {0x1234};static uint8_t buffer[GET_PAYLOAD_BUFFER_SIZE(1)];
void setup() { const uint8_t pin = 1; ArduinoPebbleSerial::begin_software(pin, buffer, sizeof(buffer), Baud57600, SERVICES, 1);}
Reading Attributes
What is your favorite color?
I like green.
Read 0x1234, 0x0042
0b11001100
smartstrap_attribute_read(color_attr);
uint16_t service_id, attribute_id;size_t length;RequestType type;if (ArduinoPebbleSerial::feed(&service_id, &attribute_id, &length, &type)) { // ... buffer[0] = 0b11110111; ArduinoPebbleSerial::write(true, buffer, 1);}
static void prv_did_read_handler(SmartstrapAttribute *attribute, SmartstrapResult result, const uint8_t *data, size_t length) { // handle read...}
Notifications
Wait! I change my mind!
Notification
0x1234, 0x0042
ArduinoPebbleSerial::notify(0x1234, 0x0042);
static void prv_notify_handler(SmartstrapAttribute *attribute) { // ...}
Demo
Smartstrap AdapterPebble Time Teensy 3.1
Links• Documentation: http://developer.pebble.com/guides/hardware/
• Arduino Library: https://github.com/pebble/ArduinoPebbleSerial
• Teensy 3.2: https://www.pjrc.com/store/teensy32.html
Examples
Questions?
Slack Room: #smartstraps Email: [email protected]