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

  • 1,143 views
Uploaded on

 

More in: Technology , Education
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads

Views

Total Views
1,143
On Slideshare
0
From Embeds
0
Number of Embeds
3

Actions

Shares
Downloads
26
Comments
0
Likes
0

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide
  • SWITCH TO KAMEL LAPTOP/PRESENTATION – 25-30mins
  • Martin will talk more about custom controls in

Transcript

  • 1. Native Application (C/C++) development on BlackBerry 10 Aaron Ardiri Principal Developer Evangelist AARDIRI@rim.com twitter: @ARDIRI
  • 2. BlackBerry 10 SDKs C++/Qt Cascades C/C++ HTML5 BlackBerry® Native SDK WebWorks™ ActionScript Java Adobe® AIR® Android™ Runtime
  • 3. Native SDK OSS & Developer Experience
  • 4. Native SDK Hello World #include <stdio.h> #include <stdlib.h> int main(intargc, char **argv) { fprintf(stdout, “Hello World!n”); return EXIT_SUCCESS; }
  • 5. Native SDK BlackBerry Platform Services the 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
  • 6. Native SDK BlackBerry Platform Services bps_event_t *event_bps; event_bps = NULL; bps_get_event(&event_bps, timeout); // -1, forever if (event_bps != NULL) { event_domain = bps_event_get_domain(event_bps); if (event_domain == xxx) { // request event information within the domain } }
  • 7. Native SDK BlackBerry Platform Services handling {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
  • 8. NATIVE SDK: “HARDCORE” DEVELOPMENT VI, BASH &SSH DEBUGGING
  • 9. Native SDK Open Industry Standards
  • 10. Native SDK Open Source Support
  • 11. CASCADES SDK
  • 12. Cascades SDK OSS & Developer Experience
  • 13. Mature C++ application framework Good APIs Signals and Slots Many help classes QML QtGui Cascades
  • 14. 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 (Qt Quick) • Libraries to access device hardware • Provides development tools (Cascades Builder)
  • 15. Powerful toolkit with many components • QtNetwork Module • QtMedia Module • QtCore • C++ Extensions QtQuick • QtModeling Language (QML) • JavaScript based declarative language • Used in design of User Interface Applications Qt Creator • Aids in QML development
  • 16. Replacement for QtQuick • 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
  • 17. CascadesSDK Hello World import bb.cascades 1.0 Page { content: Label { text: "Hello World" } }
  • 18. Cascades SDK Hello World Page* root = new Page; Label* label = Label::create() .text("Hello World"); root->setContent(label); Application::instance()->setScene(root);
  • 19. 60 FPS!
  • 20. UI in separate thread App logic 28 Cascades Photos by rumpleteaser and whologwy Flickr
  • 21. Scene Graph Root Container Hello World RotationZ Scale Opacity Container Text: “Hello World”
  • 22. Scene Graph Designing 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
  • 23. In QML Container { opacity: 0.5 scaleX: 1.5; scaleY: 1.5 rotationZ: 45 ImageView { … } Label { … } }
  • 24. C++ Container *bubble= new Container(); bubble->setOpacity(0.5f); bubble->setScale(1.5f); bubble->setRotationZ(45); bubble->add(ImageView::create() ... ); bubble->add(Label::create() ... ); …
  • 25. Events Qt uses signals&slots paradigm Cascades events are mapped to Qt signals
  • 26. 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; } } … }
  • 27. 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); } } }
  • 28. C++ QML You can choose! No difference between UI created in QML or C++ They can be combined Typically, UI in QML and business logic in C++ QML supports JavaScript for signal handling
  • 29. Animations Any Cascades UI element can be animated Animations are “running” on the engine thread Remember the client server setup? Explicit&Implicit animations: translation, rotation, scale, opacity, …
  • 30. Core Controls
  • 31. Custom controls
  • 32. Custom Controls SpeedGauge Container DockLayout RotationZ (-0) TranslationY (30) RotationZ (-40) TranslationY(3 0)
  • 33. Standard List Items
  • 34. Custom list items
  • 35. Data Binding SQL XML JSON Anyth ing
  • 36. StackLayout&DockLayout
  • 37. Pages, Panes and Navigation
  • 38. CASCADES SDK: “PLEASING” DEVELOPMENT IDE, GUI, REAL-TIME UPDATES
  • 39. For More Information… developer.blackberry.com/cascades
  • 40. Thanks! Aaron Ardiri AARDIRI@rim.com twitter: @ARDIRI Luca Filigheddu LFILIGHEDDU@rim.com twitter: @FILOS