platformservices_20_specific.js 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /*
  2. * Event service object based on com.nokia.device.event Interface
  3. */
  4. var so = null;
  5. /*
  6. * Initializes event service object
  7. */
  8. function initEvents(){
  9. try {
  10. so = nokia.device.load("commlog");
  11. }
  12. catch (e) {
  13. alert(e);
  14. }
  15. }
  16. /*
  17. * Gets list of events based on filter
  18. * See createFilter() for details
  19. */
  20. function GetEvents(filter){
  21. try {
  22. transaction_id = so.getList(onGetEventsNotification, filter, onGetEventsNotificationErr);
  23. }
  24. catch (e) {
  25. alert(e);
  26. }
  27. }
  28. /*
  29. This is callback function for Events API getList ( callback,[match] ) function
  30. An iterator object consisting of objects containing the matching events data is further
  31. passed to the display events function located in basic.js.
  32. Event data item schema:
  33. {
  34. "type": String, // One of "SMS", "Call"
  35. "time": String, // Event Time.Eg: "Wednesday, 25 February, 2009 12:38:05 pm"
  36. "phoneNumber": String,
  37. "flag": String, // One of "Incoming", "Outgoing", "Received", "Missed"
  38. "summary": String
  39. }
  40. */
  41. function onGetEventsNotification(iter){
  42. try {
  43. DisplayEvents(iter);
  44. }
  45. catch (e) {
  46. alert(e);
  47. }
  48. }
  49. /*
  50. * Error callback handler for getList
  51. */
  52. function onGetEventsNotificationErr(err){
  53. alert(err.toString());
  54. }
  55. /*
  56. * This function returns filter object for get event calls
  57. Event Matching Pattern
  58. {
  59. "type": String, // Optional.One of "SMS", "Call".
  60. "flag": String // Optional.One of "Outgoing", "Received", "Missed"
  61. "nofLogs": Integer, // Optional.Limits filter to maximum number of logs to retrieve
  62. "phone": String // Optional.Phone number
  63. }
  64. */
  65. function createFilter(ftype, fflag, fnofLogs, fphone){
  66. try {
  67. var filter = {
  68. type: ftype,
  69. flag: fflag,
  70. nofLogs: fnofLogs,
  71. phoneNumber: fphone,
  72. };
  73. return filter;
  74. }
  75. catch (e) {
  76. alert(e);
  77. }
  78. }