en50221_app_ai.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. /*
  2. en50221 encoder An implementation for libdvb
  3. an implementation for the en50221 transport layer
  4. Copyright (C) 2004, 2005 Manu Abraham <abraham.manu@gmail.com>
  5. Copyright (C) 2005 Julian Scheel (julian at jusst dot de)
  6. Copyright (C) 2006 Andrew de Quincey (adq_dvb@lidskialf.net)
  7. This library is free software; you can redistribute it and/or modify
  8. it under the terms of the GNU Lesser General Public License as
  9. published by the Free Software Foundation; either version 2.1 of
  10. the License, or (at your option) any later version.
  11. This program is distributed in the hope that it will be useful,
  12. but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. GNU Lesser General Public License for more details.
  15. You should have received a copy of the GNU Lesser General Public
  16. License along with this library; if not, write to the Free Software
  17. Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  18. */
  19. #ifndef __EN50221_APPLICATION_AI_H__
  20. #define __EN50221_APPLICATION_AI_H__
  21. #ifdef __cplusplus
  22. extern "C" {
  23. #endif
  24. #include <stdlib.h>
  25. #include <stdint.h>
  26. #include <libdvben50221/en50221_app_utils.h>
  27. #define EN50221_APP_AI_RESOURCEID MKRID(2,1,1)
  28. #define APPLICATION_TYPE_CA 0x01
  29. #define APPLICATION_TYPE_EPG 0x02
  30. /**
  31. * Type definition for application callback function - called when we receive
  32. * an application info object.
  33. *
  34. * @param arg Private argument.
  35. * @param slot_id Slot id concerned.
  36. * @param session_number Resource id concerned.
  37. * @param application_type Type of application.
  38. * @param application_manufacturer Manufacturer of application.
  39. * @param manufacturer_code Manufacturer specific code.
  40. * @param menu_string_length Length of menu string.
  41. * @param menu_string The menu string itself.
  42. * @return 0 on success, -1 on failure.
  43. */
  44. typedef int (*en50221_app_ai_callback) (void *arg,
  45. uint8_t slot_id,
  46. uint16_t session_number,
  47. uint8_t application_type,
  48. uint16_t application_manufacturer,
  49. uint16_t manufacturer_code,
  50. uint8_t menu_string_length,
  51. uint8_t * menu_string);
  52. /**
  53. * Opaque type representing an application information resource.
  54. */
  55. struct en50221_app_ai;
  56. /**
  57. * Create an instance of an application information resource.
  58. *
  59. * @param funcs Send functions to use.
  60. * @return Instance, or NULL on failure.
  61. */
  62. extern struct en50221_app_ai *en50221_app_ai_create(struct en50221_app_send_functions *funcs);
  63. /**
  64. * Destroy an instance of an application information resource.
  65. *
  66. * @param ai Instance to destroy.
  67. */
  68. extern void en50221_app_ai_destroy(struct en50221_app_ai *ai);
  69. /**
  70. * Register a callback for reception of application_info objects.
  71. *
  72. * @param ai Application information instance.
  73. * @param callback Callback function.
  74. * @param arg Private argument passed during calls to the callback.
  75. */
  76. extern void en50221_app_ai_register_callback(struct en50221_app_ai *ai,
  77. en50221_app_ai_callback,
  78. void *arg);
  79. /**
  80. * send a enquiry for the app_info provided by a module
  81. *
  82. * @param ai Application information instance.
  83. * @param session_number Session to send on.
  84. * @return 0 on success, -1 on failure.
  85. */
  86. extern int en50221_app_ai_enquiry(struct en50221_app_ai *ai,
  87. uint16_t session_number);
  88. /**
  89. * send a enter_menu tag, this will make the application
  90. * open a new MMI session to provide a Menu, or so.
  91. *
  92. * @param ai Application information instance.
  93. * @param session_number Session to send on.
  94. * @return 0 on success, -1 on failure.
  95. */
  96. extern int en50221_app_ai_entermenu(struct en50221_app_ai *ai,
  97. uint16_t session_number);
  98. /**
  99. * Pass data received for this resource into it for parsing.
  100. *
  101. * @param ai Application information instance.
  102. * @param slot_id Slot ID concerned.
  103. * @param session_number Session number concerned.
  104. * @param resource_id Resource ID concerned.
  105. * @param data The data.
  106. * @param data_length Length of data in bytes.
  107. * @return 0 on success, -1 on failure.
  108. */
  109. extern int en50221_app_ai_message(struct en50221_app_ai *ai,
  110. uint8_t slot_id,
  111. uint16_t session_number,
  112. uint32_t resource_id,
  113. uint8_t *data,
  114. uint32_t data_length);
  115. #ifdef __cplusplus
  116. }
  117. #endif
  118. #endif