HbbTv  17.9.0
Open source HBBTV engine
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
Functions
npapi_utils.h File Reference

NPAPI Utilities for HBBtv. More...

#include "plugin.h"

Go to the source code of this file.

Functions

void NP_UtilsInit (void)
 
void NP_UtilsArrayToResult (NPP instance, U32BIT *array, U32BIT num_elements, NPVariant *result)
 
void NP_UtilsStringToResult (S_HBBTV_STRING str, NPVariant *result)
 
void NP_UtilsHbbtvStringToResult (void *hbbtv_string, NPVariant *result)
 
bool NP_UtilsStringIsNumeric (char *in_string)
 
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. This function checks whether the NPVariant contains an uint32_t or a double. More...
 
NPObjectNP_UtilsAddEventListener (S_PLUGIN *plugin, const NPVariant *value, U32BIT event_type)
 Adds a new event lister to an object. More...
 
U32BIT NP_UtilsRemoveEventListener (S_PLUGIN *plugin, NPObject *handler)
 Remove an event lister from an object. More...
 
void NP_UtilsFreeAllEventListeners (S_PLUGIN *plugin)
 Free all event handlers for an object. More...
 
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. More...
 
BOOLEAN NP_UtilsResolveUrl (NPP instance, S_HBBTV_STRING *uri)
 Resolve URL, convert to full path URL, if needed. More...
 

Detailed Description

NPAPI Utilities for HBBtv.

Date
April 2013
Author
Adam Sturtridge

Function Documentation

NPObject* NP_UtilsAddEventListener ( S_PLUGIN plugin,
const NPVariant value,
U32BIT  event_type 
)

Adds a new event lister to an object.


Parameters
input- NPP plugin instance reference
input- Pointer to head of handler list
input- NPObject reference to new event handler
input- Object-specific event-type id
Returns
Pointer to new head of the handler list

Parameters
input- Pointer to plugin object
input- NPVariant reference to new event handler
input- Object-specific event-type id
Returns
Pointer to handler object
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.


Parameters
input- NPP plugin instance reference
input- NP object of JS Callback function to invoke
input- Array of arguments
input- Number of arguments
void NP_UtilsFreeAllEventListeners ( S_PLUGIN plugin)

Free all event handlers for an object.


Parameters
input- Pointer to head of handler list to be freed
Returns
void
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. This function checks whether the NPVariant contains an uint32_t or a double.


Parameters
input- NPVariant variable containing the number
output- pointer to an U32BIT variable where to store the result
Returns
TRUE/FALSE - Success
U32BIT NP_UtilsRemoveEventListener ( S_PLUGIN plugin,
NPObject handler 
)

Remove an event lister from an object.


Parameters
input- Pointer to head of handler list
input- NPObject reference of event handler to be removed
Returns
Pointer to new head of the handler list
BOOLEAN NP_UtilsResolveUrl ( NPP  instance,
S_HBBTV_STRING uri 
)

Resolve URL, convert to full path URL, if needed.


Parameters
input- NPP plugin instance reference
input/output- URL (input relative or full, output is full path)
Returns
TRUE - if relative URL and was converted to full path, Note: uri->zptr will need to be freed after use. FALSE - already full path (not touched)