HbbTv  17.9.0
Open source HBBTV engine
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
npapi_utils.h
Go to the documentation of this file.
1 /*******************************************************************************
2  * Copyright © 2014 The DTVKit Open Software Foundation Ltd (www.dtvkit.org)
3  * Copyright © 2013 Ocean Blue Software Ltd
4  *
5  * This file is part of a DTVKit Software Component
6  * You are permitted to copy, modify or distribute this file subject to the terms
7  * of the DTVKit 1.0 Licence which can be found in licence.txt or at www.dtvkit.org
8  *
9  * THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
10  * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES
11  * OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
12  *
13  * If you or your organisation is not a member of DTVKit then you have access
14  * to this source code outside of the terms of the licence agreement
15  * and you are expected to delete this and any associated files immediately.
16  * Further information on DTVKit, membership and terms can be found at www.dtvkit.org
17  *******************************************************************************/
26 // pre-processor mechanism so multiple inclusions don't cause compilation error
27 #ifndef _NPAPI_UTILS_H
28 #define _NPAPI_UTILS_H
29 
30 #include "plugin.h"
31 
32 //---Constant and macro definitions for public use-----------------------------
33 
34 
35 //---Enumerations for public use-----------------------------------------------
36 
37 //---Global type defs for public use-------------------------------------------
38 
39 //---Global Function prototypes for public use---------------------------------
40 void NP_UtilsInit(void);
41 
42 void NP_UtilsArrayToResult(NPP instance, U32BIT *array, U32BIT num_elements, NPVariant *result);
43 void NP_UtilsStringToResult(S_HBBTV_STRING str, NPVariant *result);
44 void NP_UtilsHbbtvStringToResult(void *hbbtv_string, NPVariant *result);
45 bool NP_UtilsStringIsNumeric(char *in_string);
46 
47 /*!**************************************************************************
48  * @brief Extracts a number from an NPVariant and saves it (with casting)
49  * into the U32BIT pointed by output. This function checks whether
50  * the NPVariant contains an uint32_t or a double
51  * @param input - NPVariant variable containing the number
52  * @param output - pointer to an U32BIT variable where to store the result
53  * @return TRUE/FALSE - Success
54  ****************************************************************************/
55 BOOLEAN NP_UtilsGetU32BIT(const NPVariant *input, U32BIT *output);
56 
57 /*!**************************************************************************
58  * @brief Adds a new event lister to an object.
59  * @param input - NPP plugin instance reference
60  * @param input - Pointer to head of handler list
61  * @param input - NPObject reference to new event handler
62  * @param input - Object-specific event-type id
63  * @return Pointer to new head of the handler list
64  ****************************************************************************/
66  const NPVariant *value, U32BIT event_type );
67 
68 /*!**************************************************************************
69  * @brief Remove an event lister from an object.
70  * @param input - Pointer to head of handler list
71  * @param input - NPObject reference of event handler to be removed
72  * @return Pointer to new head of the handler list
73  ****************************************************************************/
74 U32BIT NP_UtilsRemoveEventListener(S_PLUGIN *plugin, NPObject *handler);
75 
76 /*!**************************************************************************
77  * @brief Free all event handlers for an object.
78  * @param input - Pointer to head of handler list to be freed
79  * @return void
80  ****************************************************************************/
82 
83 
84 /*!**************************************************************************
85  * @brief Call browser's pluginthreadasynccall to execute JS callback function
86  * @param input - NPP plugin instance reference
87  * @param input - NP object of JS Callback function to invoke
88  * @param input - Array of arguments
89  * @param input - Number of arguments
90  ****************************************************************************/
91 void NP_UtilsAsyncCallback( S_PLUGIN **plugin_list, void *handle,
92  U32BIT event_type, NPVariant *args, uint32_t num_args );
93 
94 
95 /*!**************************************************************************
96  * @brief Resolve URL, convert to full path URL, if needed.
97  * @param input - NPP plugin instance reference
98  * @param input/output - URL (input relative or full, output is full path)
99  * @return TRUE - if relative URL and was converted to full path,
100  * Note: uri->zptr will need to be freed after use.
101  * FALSE - already full path (not touched)
102  ****************************************************************************/
103 BOOLEAN NP_UtilsResolveUrl(NPP instance, S_HBBTV_STRING *uri);
104 
105 #endif /*_NPAPI_UTILS_H*/
106 //*****************************************************************************
107 // End of file
108 //*****************************************************************************
BOOLEAN NP_UtilsResolveUrl(NPP instance, S_HBBTV_STRING *uri)
Resolve URL, convert to full path URL, if needed.
Definition: npapi_utils.c:544
Definition: npapi.h:178
Definition: plugin.h:77
U32BIT NP_UtilsRemoveEventListener(S_PLUGIN *plugin, NPObject *handler)
Remove an event lister from an object.
Definition: npapi_utils.c:285
NPAPI Plugin.
void NP_UtilsFreeAllEventListeners(S_PLUGIN *plugin)
Free all event handlers for an object.
Definition: npapi_utils.c:325
Definition: npruntime.h:100
void NP_UtilsAsyncCallback(S_PLUGIN **plugin_list, void *handle, U32BIT event_type, NPVariant *args, uint32_t num_args)
Call browser's pluginthreadasynccall to execute JS callback function.
Definition: npapi_utils.c:497
Definition: hbbtv_types.h:167
Definition: npruntime.h:323
BOOLEAN NP_UtilsGetU32BIT(const NPVariant *input, U32BIT *output)
Extracts a number from an NPVariant and saves it (with casting) into the U32BIT pointed by output...
Definition: npapi_utils.c:193
NPObject * NP_UtilsAddEventListener(S_PLUGIN *plugin, const NPVariant *value, U32BIT event_type)
Adds a new event lister to an object.
Definition: npapi_utils.c:244