40
Native Application (C/C++) development on BlackBerry 10 Aaron Ardiri Principal Developer Evangelist AARDIRI @rim.com twitter: @ARDIRI

Native Application (C/C++) on BlackBerry 10

  • Upload
    ardiri

  • View
    1.435

  • Download
    4

Embed Size (px)

DESCRIPTION

 

Citation preview

Page 1: Native Application (C/C++) on BlackBerry 10

Native Application (C/C++) development on BlackBerry 10

Aaron Ardiri

Principal Developer Evangelist

[email protected]: @ARDIRI

Page 2: Native Application (C/C++) on BlackBerry 10

BlackBerry 10SDKs

C++/Qt

CascadesActionScript

Adobe® AIR®HTML5 BlackBerry®

WebWorks™

C/C++

Native SDKJava

Android™

Runtime

Page 3: Native Application (C/C++) on BlackBerry 10

Native SDKOSS & Developer Experience

Page 4: Native Application (C/C++) on BlackBerry 10

#include <stdio.h>#include <stdlib.h>

int main(int argc, char **argv){ fprintf(stdout, “Hello World!\n”); return EXIT_SUCCESS;}

Native SDKHello World

Page 5: Native Application (C/C++) on BlackBerry 10

Native SDKBlackBerry Platform Servicesthe BlackBerry Platform Services (BPS) library provides an application with a single consistent interface to a number of different services during the execution of the application.

• universal event management• user interaction/navigator• input/output (sensors, audio, LED, screen, multimedia)• device information, locale and payment services• network status and geo-location

Page 6: Native Application (C/C++) on BlackBerry 10

Native SDKBlackBerry Platform Servicesbps_event_t *event_bps;

event_bps = NULL;bps_get_event(&event_bps, timeout); // -1, foreverif (event_bps != NULL){ event_domain = bps_event_get_domain(event_bps); if (event_domain == xxx) { // request event information within the domain }}

Page 7: Native Application (C/C++) on BlackBerry 10

Native SDKBlackBerry Platform Serviceshandling {service} events

{service}_request_events({param}); // request events

then capture the appropriate {service} events

event_domain = bps_event_get_domain(event_bps); if (event_domain == {service}_get_domain()) { // handle the {service} event

Page 8: Native Application (C/C++) on BlackBerry 10

NATIVE SDK:“HARDCORE” DEVELOPMENT

VI, BASH & SSH DEBUGGING

Page 9: Native Application (C/C++) on BlackBerry 10

Native SDKOpen Industry Standards

Page 10: Native Application (C/C++) on BlackBerry 10

Native SDKOpen Source Support

Page 11: Native Application (C/C++) on BlackBerry 10

CASCADES SDK

Page 12: Native Application (C/C++) on BlackBerry 10

Cascades SDKOSS & Developer Experience

Page 13: Native Application (C/C++) on BlackBerry 10

Mature C++ application framework

Good APIs

Signals and Slots

Many help classes

QML

QtGui Cascades

Page 14: Native Application (C/C++) on BlackBerry 10

Qt• Cross-platform application framework• Design GUI, Command line, Daemon Applications• More than a software development kit• Extends C++ (Meta Object Compiler)Cascades• Replacement for Qt UI Creation Kit (QtQuick)• Libraries to access device hardware• Provides development tools (Cascades Builder)

Page 15: Native Application (C/C++) on BlackBerry 10

Powerful toolkit with many components • Qt Network Module• Qt Media Module• Qt Core • C++ Extensions Qt Quick • Qt Modeling Language (QML)• JavaScript based declarative language• Used in design of User Interface Applications Qt Creator• Aids in QML development

Page 16: Native Application (C/C++) on BlackBerry 10

Replacement for Qt Quick• Cascades UI rendering is NOT on the main thread! Features • Provides BlackBerry Look and Feel • Provides advanced placement management of

components • Supports multiple resolutions • Supports orientation changes (Landscape vs

Portrait) Uses QML • Replaces Qt Creator

• QNX Momentics IDE Plugin – Cascades Builder

Page 17: Native Application (C/C++) on BlackBerry 10

import bb.cascades 1.0

Page { content: Label { text: "Hello World" }}

Cascades SDKHello World

Page 18: Native Application (C/C++) on BlackBerry 10

Page* root = new Page;Label* label = Label::create() .text("Hello World");root->setContent(label);Application::instance()->setScene(root);

Cascades SDKHello World

Page 19: Native Application (C/C++) on BlackBerry 10

60 FPS!

Page 20: Native Application (C/C++) on BlackBerry 10

App logic

Photos by rumpleteaser and whologwy Flickr

Cascades

UI in separate thread28°

Page 21: Native Application (C/C++) on BlackBerry 10

Scene Graph

RootContainer

Text: “Hello World”

Container

Hello World

RotationZScaleOpacity

Page 22: Native Application (C/C++) on BlackBerry 10

Scene GraphDesigning UI with QML• QML User Interfaces built on Object-Tree Model • Need a root node

Typical root nodes• Anything that subclasses AbstractPane• Page – individual screen within an application• NavigationPane• TabbedPane

Container – contains multiple UI objects • Used for custom components

Page 23: Native Application (C/C++) on BlackBerry 10

In QML

Container { opacity: 0.5 scaleX: 1.5; scaleY: 1.5 rotationZ: 45 ImageView { … } Label { … }}

Page 24: Native Application (C/C++) on BlackBerry 10

C++

Container *bubble= new Container();bubble->setOpacity(0.5f);bubble->setScale(1.5f);bubble->setRotationZ(45);bubble->add(ImageView::create() ... );bubble->add(Label::create() ... );…

Page 25: Native Application (C/C++) on BlackBerry 10

Events

Qt uses signals & slots paradigm

Cascades events are mapped to Qt signals

Page 26: Native Application (C/C++) on BlackBerry 10

Handling Touch Events in QML

Container{ onTouch: { if (event.isDown()) { scaleX = 2; scaleY = 2; rotationZ = 45; } else if (event.isUp()){ scaleX = 1; scaleY = 1; rotationZ = 0; } } …}

Page 27: Native Application (C/C++) on BlackBerry 10

Handling Touch Events in C++

QObject::connect(bubble,SIGNAL (touch(bb::cascades::TouchEvent*)) this,SLOT (touched(bb::cascades::TouchEvent*)));

touched(bb::cascades::TouchEvent *t){ if (t->isDown()) { bubble->setScale(2f); bubble->setRotation(45.0f); } else if (t->isUp()) { bubble->setScale(1f); bubble->setRotation(0.0f); } } }

Page 28: Native Application (C/C++) on BlackBerry 10

You can choose!

No difference between UI created in QML or C++

They can be combinedTypically, UI in QML and business logic in C++

QML supports JavaScript for signal handling

C++ QML

Page 29: Native Application (C/C++) on BlackBerry 10

Animations

Any Cascades UI element can be animated

Animations are “running” on the engine threadRemember the client server setup?

Explicit & Implicit animations:translation, rotation, scale, opacity, …

Page 30: Native Application (C/C++) on BlackBerry 10

Core Controls

Page 31: Native Application (C/C++) on BlackBerry 10

Custom controls

Page 32: Native Application (C/C++) on BlackBerry 10

Custom Controls

ContainerDockLayout

SpeedGauge

RotationZ (-0) RotationZ (-40)

TranslationY (30)

TranslationY(30)

Page 33: Native Application (C/C++) on BlackBerry 10

Standard List Items

Page 34: Native Application (C/C++) on BlackBerry 10

Custom list items

Page 35: Native Application (C/C++) on BlackBerry 10

Data Binding

SQL

XML

JSON

Anything

Page 36: Native Application (C/C++) on BlackBerry 10

StackLayout & DockLayout

Page 37: Native Application (C/C++) on BlackBerry 10

Pages, Panes and Navigation

Page 38: Native Application (C/C++) on BlackBerry 10

CASCADES SDK:“PLEASING” DEVELOPMENT

IDE, GUI, REAL-TIME UPDATES

Page 39: Native Application (C/C++) on BlackBerry 10

For More Information…

developer.blackberry.com/cascades

Page 40: Native Application (C/C++) on BlackBerry 10

Thanks!

Aaron [email protected]

twitter: @ARDIRI

Luca [email protected]

twitter: @FILOS