SlideShare una empresa de Scribd logo
1 de 33
Start to Finish:
Porting to BlackBerry 10 Native
Aaron Ardiri

Senior Technical Evangelist
aardiri@rim.com

twitter: @ardiri
Getting Started
BlackBerry Dev Zone: You’ll find everything you need

developer.blackberry.com

2
Getting Started

3
Getting Started

4
Getting Started

5
Getting Started
5 Easy Steps!

Download the Native SDK
developer.blackberry.com/native

Register for Signing Keys
Run the getting started wizard


Window -> Preferences -> BlackBerry
Sets up your environment, keys, debug token

Create your application and deploy it to your device
Publish to AppWorld™ - make money!
6
Source

7
So; how was it done?
Porting 101 – the textbook guide
application anatomy (mainline, event loop et al)
identify a way to debug/handle logging of the application
play nice with the navigator/user experience of the platform
create a framebuffer object for graphics
create a PCM audio callback system for music and sound effects
create a handler for input events like touch and keyboard
create a resource manager for preferences, game assets
create bindings to system resources (memory, time, files, networking)
8
:: application anatomy
#include <stdio.h>
#include <stdlib.h>
int
main(intargc, char **argv)
{
fprintf(stdout, “Hello World!n”);
return EXIT_SUCCESS;
}

9
:: application anatomy - BPS
The BlackBerry Platform Services (BPS) library
provides an application with a single consistent
interface to a number of different services.
-

event loop
input/output (sensors, audio, LED, screen, multimedia)
device information
payment services
network status and geo-location
10
:: application anatomy - a real “main()”
int
main(intargc, char **argv)
{
if (application_initialize())
{
application_eventloop();
application_terminate();
}
return EXIT_SUCCESS;
}
11
:: application anatomy – event handling
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 == navigator_get_domain())
{
// request the event id in the navigator domain
e_id = bps_event_get_code(event_bps);
}
}

12
:: debugging/logging
The BlackBerry 10 Platform logs all stdout
messages to the application sandbox
fprintf(stdout, “[INFO] my log linen”);
fflush(stdout);
to view the contents of the log – SSH into the device/simulator:
$ cd /accounts/1000/appdata/com.xxx.yyy/logs
$ cat log
13
:: play nice with navigator/UX
The BlackBerry Platform Services (BPS) library
issues navigator events applications should handle:
navigator_request_events(0); // request events
NAVIGATOR_EXIT
NAVIGATOR_SWIPE_DOWN
NAVIGATOR_ORIENTATION_CHECK
NAVIGATOR_WINDOW_STATE
- fullscreen, thumbnail, invisible
14
:: play nice with navigator/UX
event_domain :: navigator_get_domain()
switch (e_id)
{
case NAVIGATOR_EXIT:
// user has requested we exit the application
running = 0;
break;

15
:: play nice with navigator/UX
event_domain :: navigator_get_domain()
switch (e_id)
{
case NAVIGATOR_WINDOW_STATE:
switch (navigator_event_get_window_state(event_bps))
{
case NAVIGATOR_WINDOW_FULLSCREEN:
case NAVIGATOR_WINDOW_THUMBNAIL:
case NAVIGATOR_WINDOW_INVISIBLE:
break;
16
:: create a framebuffer (gfx)
The BlackBerry 10 platform provides a composited
windowing API (low level) – which allows the
creation of a pixmap (framebuffer) for graphics.
screen_create_context(..);
screen_create_window(..);
screen_set_window_property_iv(..)
screen_create_window_buffers(..);

17
:: create a pcm audio callback
The BlackBerry 10 platform provides an ALSA
compliant audio library for capturing and playback
of digital audio stream handling
snd_pcm_open_preferred(..);
snd_pcm_plugin_params(..);
snd_pcm_plugin_prepare(..);
snd_pcm_plugin_write(..);

18
:: create a handler for touch, key
screen_request_events(..);
then capture the appropriate screen related events (pointer, touch, key)
SCREEN_EVENT_POINTER
SCREEN_EVENT_MTOUCH_TOUCH
SCREEN_EVENT_MTOUCH_MOVE
SCREEN_EVENT_MTOUCH_RELEASE
SCREEN_EVENT_KEYBOARD

19
:: create a handler for touch, key
event_domain :: screen_get_domain()
// obtain the screen event from the abstract bps event
event_scr= screen_event_get_event(event_bps);

// obtain the event id in the screen domain
screen_get_event_property_iv(event_scr,
SCREEN_PROPERTY_TYPE, &e_id);

20
:: create a handler for touch, key
event_domain :: screen_get_domain()
switch (e_id)
{
case SCREEN_EVENT_POINTER:
// obtain the position and mouse button state
screen_get_event_property_iv(event_scr,
SCREEN_PROPERTY_SOURCE_POSITION,pos);
screen_get_event_property_iv(event_scr,
SCREEN_PROPERTY_BUTTONS, &state);

21
:: create a handler for touch, key
event_domain :: screen_get_domain()
switch (e_id)
{
case SCREEN_EVENT_MTOUCH_TOUCH:
// get the information about the touch event
screen_get_mtouch_event(event_scr, &event_mt, 0);

id = event_touch.contact_id;
x = event_touch.x;
y = event_touch.y; // obtain the (x,y) position
22
:: create a handler for touch, key
event_domain :: screen_get_domain()
switch (e_id)
{
case SCREEN_EVENT_KEYBOARD:
// get the information about the keyboard event
screen_get_event_property_iv(event_scr,
SCREEN_PROPERTY_KEY_FLAGS, &state);
if ((state & (KEY_DOWN || KEY_REPEAT)) != 0)
screen_get_event_property_iv(event_scr,
SCREEN_PROPERTY_KEY_SYM, &key);
23
:: resource manager for assets
Each app is confined to it’s own sandbox


Only your app has read/write access to it’s sandbox

$(SANDBOX)/
$(SANDBOX)/app
$(SANDBOX)/data
$(SANDBOX)/temp
$(SANDBOX)/logs
$(SANDBOX)/shared
24
:: resource manager for assets
#define MAX_PATH_LENGTH 256
{

char sandbox[MAX_PATH_LENGTH];
char path[MAX_PATH_LENGTH];
getcwd(sandbox, MAX_PATH_LENGTH);
sprintf(path, "%s/data/preferences.dat", sandbox);
}

Then use POSIX file functions to read/write the contents of the file.
25
:: generate bindings to system
The BlackBerry 10 platform provides a vast number of POSIX
compliant C libraries that can be used as-is when the
appropriate BlackBerry Platform Services API doesn’t exist.
pthread, strings, math, timers, memory, file io etc

A number of open-source libraries are also available for use
openAL, openSSL, SQLite, zlib, libxml2, freetype
26
:: building the basics – main.c

DEMO
… tv static (with white noise) …
edit - compile – deploy – debug – run
(command line tools)
27
:: migration to SHARK

DEMO
… cronk / caveman HD …
edit - compile – deploy – debug – run
(command line tools)
28
Destination

29
:: next steps - extend

30
:: next steps – open source

blackberry.github.org
31
QUESTIONS
contact me for the “tv static” application sources
THANK YOU
Aaron Ardiri

Senior Technical Evangelist
aardiri@rim.com

Más contenido relacionado

Similar a Start to Finish: Porting to BlackBerry 10

Bringing the Open Web & APIs to 
mobile devices with Firefox OS - GOTO confer...
Bringing the Open Web & APIs to 
mobile devices with Firefox OS - GOTO confer...Bringing the Open Web & APIs to 
mobile devices with Firefox OS - GOTO confer...
Bringing the Open Web & APIs to 
mobile devices with Firefox OS - GOTO confer...Robert Nyman
 
Firefox OS, the Open Web & WebAPIs - HTML5DevConf, San Francisco
Firefox OS, the Open Web & WebAPIs - HTML5DevConf, San FranciscoFirefox OS, the Open Web & WebAPIs - HTML5DevConf, San Francisco
Firefox OS, the Open Web & WebAPIs - HTML5DevConf, San FranciscoRobert Nyman
 
Bringing the Open Web & APIs to 
mobile devices with Firefox OS - BrazilJS
Bringing the Open Web & APIs to 
mobile devices with Firefox OS - BrazilJSBringing the Open Web & APIs to 
mobile devices with Firefox OS - BrazilJS
Bringing the Open Web & APIs to 
mobile devices with Firefox OS - BrazilJSRobert Nyman
 
Bringing the Open Web & APIs to 
mobile devices with Firefox OS - SpainJS
Bringing the Open Web & APIs to 
mobile devices with Firefox OS - SpainJSBringing the Open Web & APIs to 
mobile devices with Firefox OS - SpainJS
Bringing the Open Web & APIs to 
mobile devices with Firefox OS - SpainJSRobert Nyman
 
Firefox OS, the Open Web & WebAPIs - Geek Meet Västerås
Firefox OS, the Open Web & WebAPIs - Geek Meet VästeråsFirefox OS, the Open Web & WebAPIs - Geek Meet Västerås
Firefox OS, the Open Web & WebAPIs - Geek Meet VästeråsRobert Nyman
 
What Web Developers Need to Know to Develop Windows 8 Apps
What Web Developers Need to Know to Develop Windows 8 AppsWhat Web Developers Need to Know to Develop Windows 8 Apps
What Web Developers Need to Know to Develop Windows 8 AppsDoris Chen
 
Bringing the open web and APIs to mobile devices with Firefox OS - Whisky W...
 	Bringing the open web and APIs to mobile devices with Firefox OS - Whisky W... 	Bringing the open web and APIs to mobile devices with Firefox OS - Whisky W...
Bringing the open web and APIs to mobile devices with Firefox OS - Whisky W...Robert Nyman
 
How to implement camera recording for USB webcam or IP camera in C#.NET
How to implement camera recording for USB webcam or IP camera in C#.NETHow to implement camera recording for USB webcam or IP camera in C#.NET
How to implement camera recording for USB webcam or IP camera in C#.NETOzeki Informatics Ltd.
 
Introduction to BlackBerry 10 NDK for Game Developers.
Introduction to BlackBerry 10 NDK for Game Developers.Introduction to BlackBerry 10 NDK for Game Developers.
Introduction to BlackBerry 10 NDK for Game Developers.ardiri
 
WebAPIs & Apps - Mozilla London
WebAPIs & Apps - Mozilla LondonWebAPIs & Apps - Mozilla London
WebAPIs & Apps - Mozilla LondonRobert Nyman
 
WebAPIs & WebRTC - Spotify/sthlm.js
WebAPIs & WebRTC - Spotify/sthlm.jsWebAPIs & WebRTC - Spotify/sthlm.js
WebAPIs & WebRTC - Spotify/sthlm.jsRobert Nyman
 
Web versus Native: round 1!
Web versus Native: round 1!Web versus Native: round 1!
Web versus Native: round 1!Chris Mills
 
Post Exploitation Bliss: Loading Meterpreter on a Factory iPhone, Black Hat U...
Post Exploitation Bliss: Loading Meterpreter on a Factory iPhone, Black Hat U...Post Exploitation Bliss: Loading Meterpreter on a Factory iPhone, Black Hat U...
Post Exploitation Bliss: Loading Meterpreter on a Factory iPhone, Black Hat U...Vincenzo Iozzo
 
Fiware IoT Proposal & Community
Fiware IoT Proposal & Community Fiware IoT Proposal & Community
Fiware IoT Proposal & Community TIDChile
 
Criando jogos para o windows 8
Criando jogos para o windows 8Criando jogos para o windows 8
Criando jogos para o windows 8José Farias
 
Virus Bulletin 2015: Exposing Gatekeeper
Virus Bulletin 2015: Exposing GatekeeperVirus Bulletin 2015: Exposing Gatekeeper
Virus Bulletin 2015: Exposing GatekeeperSynack
 

Similar a Start to Finish: Porting to BlackBerry 10 (20)

Bringing the Open Web & APIs to 
mobile devices with Firefox OS - GOTO confer...
Bringing the Open Web & APIs to 
mobile devices with Firefox OS - GOTO confer...Bringing the Open Web & APIs to 
mobile devices with Firefox OS - GOTO confer...
Bringing the Open Web & APIs to 
mobile devices with Firefox OS - GOTO confer...
 
Firefox OS, the Open Web & WebAPIs - HTML5DevConf, San Francisco
Firefox OS, the Open Web & WebAPIs - HTML5DevConf, San FranciscoFirefox OS, the Open Web & WebAPIs - HTML5DevConf, San Francisco
Firefox OS, the Open Web & WebAPIs - HTML5DevConf, San Francisco
 
Bringing the Open Web & APIs to 
mobile devices with Firefox OS - BrazilJS
Bringing the Open Web & APIs to 
mobile devices with Firefox OS - BrazilJSBringing the Open Web & APIs to 
mobile devices with Firefox OS - BrazilJS
Bringing the Open Web & APIs to 
mobile devices with Firefox OS - BrazilJS
 
Bringing the Open Web & APIs to 
mobile devices with Firefox OS - SpainJS
Bringing the Open Web & APIs to 
mobile devices with Firefox OS - SpainJSBringing the Open Web & APIs to 
mobile devices with Firefox OS - SpainJS
Bringing the Open Web & APIs to 
mobile devices with Firefox OS - SpainJS
 
Firefox OS, the Open Web & WebAPIs - Geek Meet Västerås
Firefox OS, the Open Web & WebAPIs - Geek Meet VästeråsFirefox OS, the Open Web & WebAPIs - Geek Meet Västerås
Firefox OS, the Open Web & WebAPIs - Geek Meet Västerås
 
What Web Developers Need to Know to Develop Windows 8 Apps
What Web Developers Need to Know to Develop Windows 8 AppsWhat Web Developers Need to Know to Develop Windows 8 Apps
What Web Developers Need to Know to Develop Windows 8 Apps
 
Bringing the open web and APIs to mobile devices with Firefox OS - Whisky W...
 	Bringing the open web and APIs to mobile devices with Firefox OS - Whisky W... 	Bringing the open web and APIs to mobile devices with Firefox OS - Whisky W...
Bringing the open web and APIs to mobile devices with Firefox OS - Whisky W...
 
How to implement camera recording for USB webcam or IP camera in C#.NET
How to implement camera recording for USB webcam or IP camera in C#.NETHow to implement camera recording for USB webcam or IP camera in C#.NET
How to implement camera recording for USB webcam or IP camera in C#.NET
 
Android Things
Android ThingsAndroid Things
Android Things
 
HTML5 WebWorks
HTML5 WebWorksHTML5 WebWorks
HTML5 WebWorks
 
Introduction to BlackBerry 10 NDK for Game Developers.
Introduction to BlackBerry 10 NDK for Game Developers.Introduction to BlackBerry 10 NDK for Game Developers.
Introduction to BlackBerry 10 NDK for Game Developers.
 
Android Froyo
Android FroyoAndroid Froyo
Android Froyo
 
WebAPIs & Apps - Mozilla London
WebAPIs & Apps - Mozilla LondonWebAPIs & Apps - Mozilla London
WebAPIs & Apps - Mozilla London
 
WebAPIs & WebRTC - Spotify/sthlm.js
WebAPIs & WebRTC - Spotify/sthlm.jsWebAPIs & WebRTC - Spotify/sthlm.js
WebAPIs & WebRTC - Spotify/sthlm.js
 
Web versus Native: round 1!
Web versus Native: round 1!Web versus Native: round 1!
Web versus Native: round 1!
 
Post Exploitation Bliss: Loading Meterpreter on a Factory iPhone, Black Hat U...
Post Exploitation Bliss: Loading Meterpreter on a Factory iPhone, Black Hat U...Post Exploitation Bliss: Loading Meterpreter on a Factory iPhone, Black Hat U...
Post Exploitation Bliss: Loading Meterpreter on a Factory iPhone, Black Hat U...
 
Linux mouse
Linux mouseLinux mouse
Linux mouse
 
Fiware IoT Proposal & Community
Fiware IoT Proposal & Community Fiware IoT Proposal & Community
Fiware IoT Proposal & Community
 
Criando jogos para o windows 8
Criando jogos para o windows 8Criando jogos para o windows 8
Criando jogos para o windows 8
 
Virus Bulletin 2015: Exposing Gatekeeper
Virus Bulletin 2015: Exposing GatekeeperVirus Bulletin 2015: Exposing Gatekeeper
Virus Bulletin 2015: Exposing Gatekeeper
 

Más de ardiri

20180517 Oraclecode Shenzhen Keynote
20180517 Oraclecode Shenzhen Keynote20180517 Oraclecode Shenzhen Keynote
20180517 Oraclecode Shenzhen Keynoteardiri
 
20180517 OracleCode Singapore Keynote
20180517 OracleCode Singapore Keynote20180517 OracleCode Singapore Keynote
20180517 OracleCode Singapore Keynoteardiri
 
Feasibility of Security in Micro-Controllers
Feasibility of Security in Micro-ControllersFeasibility of Security in Micro-Controllers
Feasibility of Security in Micro-Controllersardiri
 
Introduction to the Internet of Things
Introduction to the Internet of ThingsIntroduction to the Internet of Things
Introduction to the Internet of Thingsardiri
 
Native Application (C/C++) on BlackBerry 10
Native Application (C/C++) on BlackBerry 10Native Application (C/C++) on BlackBerry 10
Native Application (C/C++) on BlackBerry 10ardiri
 
iPhone Introduction
iPhone IntroductioniPhone Introduction
iPhone Introductionardiri
 
Game Development using SDL and the PDK
Game Development using SDL and the PDK Game Development using SDL and the PDK
Game Development using SDL and the PDK ardiri
 

Más de ardiri (7)

20180517 Oraclecode Shenzhen Keynote
20180517 Oraclecode Shenzhen Keynote20180517 Oraclecode Shenzhen Keynote
20180517 Oraclecode Shenzhen Keynote
 
20180517 OracleCode Singapore Keynote
20180517 OracleCode Singapore Keynote20180517 OracleCode Singapore Keynote
20180517 OracleCode Singapore Keynote
 
Feasibility of Security in Micro-Controllers
Feasibility of Security in Micro-ControllersFeasibility of Security in Micro-Controllers
Feasibility of Security in Micro-Controllers
 
Introduction to the Internet of Things
Introduction to the Internet of ThingsIntroduction to the Internet of Things
Introduction to the Internet of Things
 
Native Application (C/C++) on BlackBerry 10
Native Application (C/C++) on BlackBerry 10Native Application (C/C++) on BlackBerry 10
Native Application (C/C++) on BlackBerry 10
 
iPhone Introduction
iPhone IntroductioniPhone Introduction
iPhone Introduction
 
Game Development using SDL and the PDK
Game Development using SDL and the PDK Game Development using SDL and the PDK
Game Development using SDL and the PDK
 

Último

Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Alkin Tezuysal
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch TuesdayIvanti
 
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotesMuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotesManik S Magar
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Kaya Weers
 
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...Nikki Chapple
 
Glenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security ObservabilityGlenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security Observabilityitnewsafrica
 
Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...itnewsafrica
 
QCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesQCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesBernd Ruecker
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationKnoldus Inc.
 
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxGenerative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxfnnc6jmgwh
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical InfrastructureVarsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructureitnewsafrica
 
Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024TopCSSGallery
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfIngrid Airi González
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfNeo4j
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 

Último (20)

Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch Tuesday
 
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotesMuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)
 
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
 
Glenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security ObservabilityGlenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security Observability
 
Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...
 
QCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesQCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architectures
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog Presentation
 
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxGenerative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical InfrastructureVarsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
 
Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdf
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdf
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 

Start to Finish: Porting to BlackBerry 10

  • 1. Start to Finish: Porting to BlackBerry 10 Native Aaron Ardiri Senior Technical Evangelist aardiri@rim.com twitter: @ardiri
  • 2. Getting Started BlackBerry Dev Zone: You’ll find everything you need developer.blackberry.com 2
  • 6. Getting Started 5 Easy Steps! Download the Native SDK developer.blackberry.com/native Register for Signing Keys Run the getting started wizard  Window -> Preferences -> BlackBerry Sets up your environment, keys, debug token Create your application and deploy it to your device Publish to AppWorld™ - make money! 6
  • 8. So; how was it done? Porting 101 – the textbook guide application anatomy (mainline, event loop et al) identify a way to debug/handle logging of the application play nice with the navigator/user experience of the platform create a framebuffer object for graphics create a PCM audio callback system for music and sound effects create a handler for input events like touch and keyboard create a resource manager for preferences, game assets create bindings to system resources (memory, time, files, networking) 8
  • 9. :: application anatomy #include <stdio.h> #include <stdlib.h> int main(intargc, char **argv) { fprintf(stdout, “Hello World!n”); return EXIT_SUCCESS; } 9
  • 10. :: application anatomy - BPS The BlackBerry Platform Services (BPS) library provides an application with a single consistent interface to a number of different services. - event loop input/output (sensors, audio, LED, screen, multimedia) device information payment services network status and geo-location 10
  • 11. :: application anatomy - a real “main()” int main(intargc, char **argv) { if (application_initialize()) { application_eventloop(); application_terminate(); } return EXIT_SUCCESS; } 11
  • 12. :: application anatomy – event handling 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 == navigator_get_domain()) { // request the event id in the navigator domain e_id = bps_event_get_code(event_bps); } } 12
  • 13. :: debugging/logging The BlackBerry 10 Platform logs all stdout messages to the application sandbox fprintf(stdout, “[INFO] my log linen”); fflush(stdout); to view the contents of the log – SSH into the device/simulator: $ cd /accounts/1000/appdata/com.xxx.yyy/logs $ cat log 13
  • 14. :: play nice with navigator/UX The BlackBerry Platform Services (BPS) library issues navigator events applications should handle: navigator_request_events(0); // request events NAVIGATOR_EXIT NAVIGATOR_SWIPE_DOWN NAVIGATOR_ORIENTATION_CHECK NAVIGATOR_WINDOW_STATE - fullscreen, thumbnail, invisible 14
  • 15. :: play nice with navigator/UX event_domain :: navigator_get_domain() switch (e_id) { case NAVIGATOR_EXIT: // user has requested we exit the application running = 0; break; 15
  • 16. :: play nice with navigator/UX event_domain :: navigator_get_domain() switch (e_id) { case NAVIGATOR_WINDOW_STATE: switch (navigator_event_get_window_state(event_bps)) { case NAVIGATOR_WINDOW_FULLSCREEN: case NAVIGATOR_WINDOW_THUMBNAIL: case NAVIGATOR_WINDOW_INVISIBLE: break; 16
  • 17. :: create a framebuffer (gfx) The BlackBerry 10 platform provides a composited windowing API (low level) – which allows the creation of a pixmap (framebuffer) for graphics. screen_create_context(..); screen_create_window(..); screen_set_window_property_iv(..) screen_create_window_buffers(..); 17
  • 18. :: create a pcm audio callback The BlackBerry 10 platform provides an ALSA compliant audio library for capturing and playback of digital audio stream handling snd_pcm_open_preferred(..); snd_pcm_plugin_params(..); snd_pcm_plugin_prepare(..); snd_pcm_plugin_write(..); 18
  • 19. :: create a handler for touch, key screen_request_events(..); then capture the appropriate screen related events (pointer, touch, key) SCREEN_EVENT_POINTER SCREEN_EVENT_MTOUCH_TOUCH SCREEN_EVENT_MTOUCH_MOVE SCREEN_EVENT_MTOUCH_RELEASE SCREEN_EVENT_KEYBOARD 19
  • 20. :: create a handler for touch, key event_domain :: screen_get_domain() // obtain the screen event from the abstract bps event event_scr= screen_event_get_event(event_bps); // obtain the event id in the screen domain screen_get_event_property_iv(event_scr, SCREEN_PROPERTY_TYPE, &e_id); 20
  • 21. :: create a handler for touch, key event_domain :: screen_get_domain() switch (e_id) { case SCREEN_EVENT_POINTER: // obtain the position and mouse button state screen_get_event_property_iv(event_scr, SCREEN_PROPERTY_SOURCE_POSITION,pos); screen_get_event_property_iv(event_scr, SCREEN_PROPERTY_BUTTONS, &state); 21
  • 22. :: create a handler for touch, key event_domain :: screen_get_domain() switch (e_id) { case SCREEN_EVENT_MTOUCH_TOUCH: // get the information about the touch event screen_get_mtouch_event(event_scr, &event_mt, 0); id = event_touch.contact_id; x = event_touch.x; y = event_touch.y; // obtain the (x,y) position 22
  • 23. :: create a handler for touch, key event_domain :: screen_get_domain() switch (e_id) { case SCREEN_EVENT_KEYBOARD: // get the information about the keyboard event screen_get_event_property_iv(event_scr, SCREEN_PROPERTY_KEY_FLAGS, &state); if ((state & (KEY_DOWN || KEY_REPEAT)) != 0) screen_get_event_property_iv(event_scr, SCREEN_PROPERTY_KEY_SYM, &key); 23
  • 24. :: resource manager for assets Each app is confined to it’s own sandbox  Only your app has read/write access to it’s sandbox $(SANDBOX)/ $(SANDBOX)/app $(SANDBOX)/data $(SANDBOX)/temp $(SANDBOX)/logs $(SANDBOX)/shared 24
  • 25. :: resource manager for assets #define MAX_PATH_LENGTH 256 { char sandbox[MAX_PATH_LENGTH]; char path[MAX_PATH_LENGTH]; getcwd(sandbox, MAX_PATH_LENGTH); sprintf(path, "%s/data/preferences.dat", sandbox); } Then use POSIX file functions to read/write the contents of the file. 25
  • 26. :: generate bindings to system The BlackBerry 10 platform provides a vast number of POSIX compliant C libraries that can be used as-is when the appropriate BlackBerry Platform Services API doesn’t exist. pthread, strings, math, timers, memory, file io etc A number of open-source libraries are also available for use openAL, openSSL, SQLite, zlib, libxml2, freetype 26
  • 27. :: building the basics – main.c DEMO … tv static (with white noise) … edit - compile – deploy – debug – run (command line tools) 27
  • 28. :: migration to SHARK DEMO … cronk / caveman HD … edit - compile – deploy – debug – run (command line tools) 28
  • 30. :: next steps - extend 30
  • 31. :: next steps – open source blackberry.github.org 31
  • 32. QUESTIONS contact me for the “tv static” application sources
  • 33. THANK YOU Aaron Ardiri Senior Technical Evangelist aardiri@rim.com

Notas del editor

  1. Need to shrink the long URLs or remove one of them. DRC is almost empty, but also almost impossible to find
  2. Need to shrink the long URLs or remove one of them. DRC is almost empty, but also almost impossible to find
  3. Should we have a bunch of screen shots walking through this?