Bada familiar foundations

780 views

Published on

Presentation given at the Samsung bada Orange partner event held in London on May 5th 2011.



This presentation explains how to apply your knowledge of other mobile platforms to bada.

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
780
On SlideShare
0
From Embeds
0
Number of Embeds
18
Actions
Shares
0
Downloads
33
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • bada includes the NewLib C library- which is an implementation of the standard C library for embedded systems\nalso supports the C++ standard template library\n
  • bada includes the NewLib C library- which is an implementation of the standard C library for embedded systems\nalso supports the C++ standard template library\n
  • bada includes the NewLib C library- which is an implementation of the standard C library for embedded systems\nalso supports the C++ standard template library\n
  • bada includes the NewLib C library- which is an implementation of the standard C library for embedded systems\nalso supports the C++ standard template library\n
  • bada includes the NewLib C library- which is an implementation of the standard C library for embedded systems\nalso supports the C++ standard template library\n
  • bada includes the NewLib C library- which is an implementation of the standard C library for embedded systems\nalso supports the C++ standard template library\n
  • The constructor has no return type, so we don’t know if it fails. So if the memory allocation fails we could end up with a memory leak, since we don’t know to call the destructor\n
  • The constructor has no return type, so we don’t know if it fails. So if the memory allocation fails we could end up with a memory leak, since we don’t know to call the destructor\n
  • The constructor has no return type, so we don’t know if it fails. So if the memory allocation fails we could end up with a memory leak, since we don’t know to call the destructor\n
  • The constructor has no return type, so we don’t know if it fails. So if the memory allocation fails we could end up with a memory leak, since we don’t know to call the destructor\n
  • The constructor has no return type, so we don’t know if it fails. So if the memory allocation fails we could end up with a memory leak, since we don’t know to call the destructor\n
  • The constructor has no return type, so we don’t know if it fails. So if the memory allocation fails we could end up with a memory leak, since we don’t know to call the destructor\n
  • The constructor has no return type, so we don’t know if it fails. So if the memory allocation fails we could end up with a memory leak, since we don’t know to call the destructor\n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • ArrayList- for data that is updated less and stored in a contiguous area of memory- like the Symbian fixed array classes\nLinkedList- analogous to the segmented array classes in Symbian\nQt has QList, QLinkedList, QMap and QMultiMap classes\n
  • ArrayList- for data that is updated less and stored in a contiguous area of memory- like the Symbian fixed array classes\nLinkedList- analogous to the segmented array classes in Symbian\nQt has QList, QLinkedList, QMap and QMultiMap classes\n
  • ArrayList- for data that is updated less and stored in a contiguous area of memory- like the Symbian fixed array classes\nLinkedList- analogous to the segmented array classes in Symbian\nQt has QList, QLinkedList, QMap and QMultiMap classes\n
  • ArrayList- for data that is updated less and stored in a contiguous area of memory- like the Symbian fixed array classes\nLinkedList- analogous to the segmented array classes in Symbian\nQt has QList, QLinkedList, QMap and QMultiMap classes\n
  • ArrayList- for data that is updated less and stored in a contiguous area of memory- like the Symbian fixed array classes\nLinkedList- analogous to the segmented array classes in Symbian\nQt has QList, QLinkedList, QMap and QMultiMap classes\n
  • ArrayList- for data that is updated less and stored in a contiguous area of memory- like the Symbian fixed array classes\nLinkedList- analogous to the segmented array classes in Symbian\nQt has QList, QLinkedList, QMap and QMultiMap classes\n
  • ArrayList- for data that is updated less and stored in a contiguous area of memory- like the Symbian fixed array classes\nLinkedList- analogous to the segmented array classes in Symbian\nQt has QList, QLinkedList, QMap and QMultiMap classes\n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • In most cases the OnData handlers will be in the main thread. For sensors, these handlers are in different threads so you should use SendUserEvent to send a message to yourself which will be picked up in the main event loop\n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • Also mention data caging and using the AppID and the ‘trusted applications’ feature to share data between certain applications\n
  • Also mention data caging and using the AppID and the ‘trusted applications’ feature to share data between certain applications\n
  • Also mention data caging and using the AppID and the ‘trusted applications’ feature to share data between certain applications\n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • Bada familiar foundations

    1. 1. Copyright© 2010 Samsung Electronics, Co., Ltd. All rights reserved
    2. 2. badaFamiliar Foundations Copyright© 2010 Samsung Electronics, Co., Ltd. All rights reserved
    3. 3. badaFamiliar FoundationsSamsung badaOrange Partner eventMay 5th 2011Jon Lansdell Copyright© 2010 Samsung Electronics, Co., Ltd. All rights reserved
    4. 4. badaYou’d be surprised how much you already knowSamsung badaOrange Partner eventMay 5th 2011Jon Lansdell Copyright© 2010 Samsung Electronics, Co., Ltd. All rights reserved
    5. 5. Familiar foundations
    6. 6. Familiar foundations• C++ as the native language
    7. 7. Familiar foundations• C++ as the native language• The bada APIs
    8. 8. Familiar foundations• C++ as the native language• The bada APIs• Everything is asynchronous
    9. 9. Familiar foundations• C++ as the native language• The bada APIs• Everything is asynchronous• Alternatives to C++
    10. 10. Familiar foundations• C++ as the native language• The bada APIs• Everything is asynchronous• Alternatives to C++• Standard Technologies
    11. 11. Familiar foundations• C++ as the native language• The bada APIs• Everything is asynchronous• Alternatives to C++• Standard Technologies• The Privilege Model
    12. 12. C++ as the native language
    13. 13. C++ as the native language• bada is written in C++
    14. 14. C++ as the native language• bada is written in C++• native app development is in C++
    15. 15. C++ as the native language• bada is written in C++• native app development is in C++• bada is a platform for 3rd party app development
    16. 16. C++ as the native language• bada is written in C++• native app development is in C++• bada is a platform for 3rd party app development• you may find the IDE familiar
    17. 17. C++ as the native language
    18. 18. bada idioms: two phase construction
    19. 19. bada idioms: two phase construction• bada uses two phase construction
    20. 20. bada idioms: two phase construction• bada uses two phase construction• Why?
    21. 21. bada idioms: two phase construction• bada uses two phase construction• Why? – to increase runtime efficiency, bada does not use C++ exceptions
    22. 22. bada idioms: two phase construction• bada uses two phase construction• Why? – to increase runtime efficiency, bada does not use C++ exceptions – to prevent memory leaks
    23. 23. bada idioms: two phase construction• bada uses two phase construction• Why? – to increase runtime efficiency, bada does not use C++ exceptions – to prevent memory leaks• How?
    24. 24. bada idioms: two phase construction• bada uses two phase construction• Why? – to increase runtime efficiency, bada does not use C++ exceptions – to prevent memory leaks• How? – resource allocation is carried out in a separate Construct() method
    25. 25. bada idioms: two phase construction• bada uses two phase construction• Why? – to increase runtime efficiency, bada does not use C++ exceptions – to prevent memory leaks• How? – resource allocation is carried out in a separate Construct() method – Construct method returns a result return value
    26. 26. Two phase construction• An example result r = E_SUCCESS; // 1. Phase: create object CallManager *pCallManager = new CallManager(); // 2. Phase: initialize object (+allocations) r = pCallManager->Construct(); if(IsFailed(r)) { delete pCallManager; }
    27. 27. Two phase construction: Usage
    28. 28. Two phase construction: Usageclass A_may_leak {public: B *b1, *b2; A_may_leak(void) { b1=new B; b2=new B; // If b2 fails, the destructor will not be called and // b1 leaks. }...}
    29. 29. Two phase construction: Usageclass A_may_leak {public: B *b1, *b2; A_may_leak(void) { b1=new B; b2=new B; // If b2 fails, the destructor will not be called and // b1 leaks. }...}class A_resolved {public: B *b1, *b2; A_resolved(void): b1(NULL), b2(NULL) {} result Construct(void) { b1=new B; b2=new B; // Even if it fails, the destructor will // be called. } ~A_resolved(void) { delete b1; delete b2; }}
    30. 30. Two phase construction: Usageclass A_may_leak {public: B *b1, *b2; A_may_leak(void) { b1=new B; b2=new B; // If b2 fails, the destructor will not be called and // b1 leaks. }...}class A_resolved {public: B *b1, *b2; Most of the bada APIs A_resolved(void): b1(NULL), b2(NULL) {} follow this pattern result Construct(void) { b1=new B; b2=new B; // Even if it fails, the destructor will // be called. } ~A_resolved(void) { delete b1; delete b2; }}
    31. 31. The bada APIs: looking for similarities
    32. 32. The bada APIs: looking for similarities• 21 namespaces divided according to functionality
    33. 33. The bada APIs: looking for similarities• 21 namespaces divided according to functionality• Including classes to implement
    34. 34. The bada APIs: looking for similarities• 21 namespaces divided according to functionality• Including classes to implement – Locations
    35. 35. The bada APIs: looking for similarities• 21 namespaces divided according to functionality• Including classes to implement – Locations – Multimedia
    36. 36. The bada APIs: looking for similarities• 21 namespaces divided according to functionality• Including classes to implement – Locations – Multimedia – Sensors
    37. 37. The bada APIs: looking for similarities• 21 namespaces divided according to functionality• Including classes to implement – Locations – Multimedia – Sensors – User Interface
    38. 38. The bada APIs: looking for similarities• 21 namespaces divided according to functionality• Including classes to implement – Locations – Multimedia – Sensors – User Interface – and many more...
    39. 39. The bada APIs: looking for similarities• 21 namespaces divided according to functionality• Including classes to implement – Locations – Multimedia – Sensors – User Interface – and many more...• Organised in a logical way
    40. 40. The bada APIs: looking for similarities• 21 namespaces divided according to functionality• Including classes to implement – Locations – Multimedia – Sensors – User Interface – and many more...• Organised in a logical way – makes finding what you need easier
    41. 41. The bada APIs: looking for similarities• 21 namespaces divided according to functionality• Including classes to implement – Locations – Multimedia – Sensors – User Interface – and many more...• Organised in a logical way – makes finding what you need easier
    42. 42. bada namespaces
    43. 43. bada namespaces Basic bada features Osp::App Osp::Base Osp::Io Osp::Locales Osp::Net Osp::Security Osp::System Osp::Telephony Osp::Text Osp::Xml Osp::Test
    44. 44. bada namespaces Basic bada features User interaction features Osp::App Osp::Graphics Osp::Base Osp::Media Osp::Io Osp::Ui Osp::Locales Osp::Uix Osp::Net Osp::Web Osp::Security Osp::System Osp::Telephony Osp::Text Osp::Xml Osp::Test
    45. 45. bada namespaces Basic bada features User interaction features Service oriented features Osp::App Osp::Graphics Osp::Commerce Osp::Base Osp::Media Osp::Content Osp::Io Osp::Ui Osp::Locations Osp::Locales Osp::Uix Osp::Messaging Osp::Net Osp::Web Osp::Social Osp::Security Osp::System Osp::Telephony Osp::Text Osp::Xml Osp::Test
    46. 46. bada namespaces Basic bada features User interaction features Service oriented features Osp::App Osp::Graphics Osp::Commerce Osp::Base Osp::Media Osp::Content Osp::Io Osp::Ui Osp::Locations Osp::Locales Osp::Uix Osp::Messaging Osp::Net Osp::Web Osp::Social Osp::Security Osp::System Osp::Telephony Osp::Text Osp::Xml Osp::Test Service Device Kernel
    47. 47. The bada APIs: finding similarities
    48. 48. The bada APIs: finding similarities
    49. 49. The base namespace
    50. 50. The base namespace• Numeric types
    51. 51. The base namespace• Numeric types• DateTime
    52. 52. The base namespace• Numeric types• DateTime• String
    53. 53. The base namespace• Numeric types• DateTime• String – Unicode string
    54. 54. The base namespace• Numeric types• DateTime• String – Unicode string – Similar to Qt QString class
    55. 55. The base namespace• Numeric types• DateTime• String – Unicode string – Similar to Qt QString class – Easy to manipulate strings
    56. 56. Collections
    57. 57. Collections• Implemented in the Base::Collections sub namespace
    58. 58. Collections• Implemented in the Base::Collections sub namespace• Similar to collections in other platforms
    59. 59. Collections• Implemented in the Base::Collections sub namespace• Similar to collections in other platforms• ArrayList
    60. 60. Collections• Implemented in the Base::Collections sub namespace• Similar to collections in other platforms• ArrayList• LinkedList
    61. 61. Collections• Implemented in the Base::Collections sub namespace• Similar to collections in other platforms• ArrayList• LinkedList• Maps: key value pairs
    62. 62. Collections• Implemented in the Base::Collections sub namespace• Similar to collections in other platforms• ArrayList• LinkedList• Maps: key value pairs• Queues and Stacks
    63. 63. Collections• Implemented in the Base::Collections sub namespace• Similar to collections in other platforms• ArrayList• LinkedList• Maps: key value pairs• Queues and Stacks• Enumerators to traverse list contents
    64. 64. Everything is asynchronous
    65. 65. Listeners
    66. 66. Listeners• Responds to asynchronous requests• Eg registering a listener for sensor events:
    67. 67. Listeners• Responds to asynchronous requests• Eg registering a listener for sensor events: result ProximityForm::OnInitializing(void) { // add the sensor event listener if (pSensorManager->IsAvailable(SENSOR_TYPE_PROXIMITY )) { r = pSensorManager->AddSensorListener (*this, SENSOR_TYPE_PROXIMITY , minInterval, true); } }
    68. 68. Listeners
    69. 69. Listeners• Class which handles the event must also derive from listener class
    70. 70. Listeners• Class which handles the event must also derive from listener class• Listener class is an interface class consisting of pure virtual functions
    71. 71. Listeners• Class which handles the event must also derive from listener class• Listener class is an interface class consisting of pure virtual functions class ProximityForm : public Osp::Ui::Controls::Form, public Osp::Uix::ISensorEventListener { // ISensorEventListener method virtual void OnDataReceived (Osp::Uix::SensorType sensorType, Osp::Uix::SensorData &sensorData, result r); }
    72. 72. Listeners• You implement the event handling methods void ProximityForm::OnDataReceived (SensorType sensorType, SensorData &sensorData, result r) { switch(sensorType) { Case SENSOR_TYPE_PROXIMITY: { long time; sensorData.GetValue((SensorDataKey)PROXIMITY_DATA_KEY_TIMESTAMP , time); } } }
    73. 73. Alternatives to C++
    74. 74. Alternatives to C++• Web applications – Create applications with a mixture of HTML, CSS and Javascript – The bada C++ code to create and launch the web control is created for you
    75. 75. Alternatives to C++• Web applications – Create applications with a mixture of HTML, CSS and Javascript – The bada C++ code to create and launch the web control is created for you• Flash applications -based around a .SWF file -created using FlashLite 3.1 and Actionscript 2.0
    76. 76. Flash objects
    77. 77. Flash objects• Represented in bada as controls
    78. 78. Flash objects• Represented in bada as controls• Can communicate between Flash and bada using fscommand2 ActionScript
    79. 79. Flash objects• Represented in bada as controls• Can communicate between Flash and bada using fscommand2 ActionScript fscommand2("Set","SendDataEvent", "/");
    80. 80. Flash objects• Represented in bada as controls• Can communicate between Flash and bada using fscommand2 ActionScript fscommand2("Set","SendDataEvent", "/");• Data sent back to Flash using SendDataEventToActionScript API call pFlash->SendDataEventToActionScript(L"TestExtension",dataList);
    81. 81. Standard technologies
    82. 82. Standard technologies• OpenGL ES 1.1 and 2.0 !
    83. 83. Standard technologies• OpenGL ES 1.1 and 2.0• SQLite !
    84. 84. Standard technologies• OpenGL ES 1.1 and 2.0• SQLite• Networking classes !
    85. 85. Standard technologies• OpenGL ES 1.1 and 2.0• SQLite• Networking classes – HTTP 1.1 client support !
    86. 86. Standard technologies• OpenGL ES 1.1 and 2.0• SQLite• Networking classes – HTTP 1.1 client support – DNS resolution !
    87. 87. Standard technologies• OpenGL ES 1.1 and 2.0• SQLite• Networking classes – HTTP 1.1 client support – DNS resolution – Bluetooth !
    88. 88. Standard technologies• OpenGL ES 1.1 and 2.0• SQLite• Networking classes – HTTP 1.1 client support – DNS resolution – Bluetooth – WiFi !
    89. 89. Standard technologies• OpenGL ES 1.1 and 2.0• SQLite• Networking classes – HTTP 1.1 client support – DNS resolution – Bluetooth – WiFi• XML parsing !
    90. 90. Standard technologies• OpenGL ES 1.1 and 2.0• SQLite• Networking classes – HTTP 1.1 client support – DNS resolution – Bluetooth – WiFi• XML parsing !• Unit testing
    91. 91. Privileges: permission to code
    92. 92. Privileges: permission to code• In bada certain APIs are part of a privilege group which is assigned a privilege level
    93. 93. Privileges: permission to code• In bada certain APIs are part of a privilege group which is assigned a privilege level• The privilege groups an application requires are specified in the manifest file
    94. 94. Summary
    95. 95. Summary• Your knowledge of other platforms will give you a head start with bada
    96. 96. Summary• Your knowledge of other platforms will give you a head start with bada – C++ as a development language and a familiar IDE
    97. 97. Summary• Your knowledge of other platforms will give you a head start with bada – C++ as a development language and a familiar IDE – Some idioms that you might have seen before
    98. 98. Summary• Your knowledge of other platforms will give you a head start with bada – C++ as a development language and a familiar IDE – Some idioms that you might have seen before – Web applications and Flash
    99. 99. Summary• Your knowledge of other platforms will give you a head start with bada – C++ as a development language and a familiar IDE – Some idioms that you might have seen before – Web applications and Flash – Standard technologies
    100. 100. Quiz time
    101. 101. Quiz time• Which namespace was introduced in bada 1.1 ?

    ×