RDK Documentation (Open Sourced RDK Components)
jseventlistener.h
Go to the documentation of this file.
1 /*
2  * If not stated otherwise in this file or this component's license file the
3  * following copyright and licenses apply:
4  *
5  * Copyright 2018 RDK Management
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18 */
19 
20 /**
21  * @file jseventlistener.h
22  * @brief Event Listner impl for AAMPMediaPlayer_JS object
23  */
24 
25 
26 #ifndef __AAMP_JSEVENTLISTENER__H__
27 #define __AAMP_JSEVENTLISTENER__H__
28 
29 
30 #include "jsbindings.h"
31 
32 
33 /**
34  * @class AAMP_JSEventListener
35  * @brief Event listener impl for AAMPMediaPlayer_JS object
36  */
38 {
39 public:
40  /**
41  * @fn AddEventListener
42  * @param[in] obj instance of PrivAAMPStruct_JS
43  * @param[in] type event type
44  * @param[in] jsCallback callback to be registered as listener
45  */
46  static void AddEventListener(PrivAAMPStruct_JS* obj, AAMPEventType type, JSObjectRef jsCallback);
47  /**
48  * @fn RemoveEventListener
49  * @param[in] obj instance of PrivAAMPStruct_JS
50  * @param[in] type event type
51  * @param[in] jsCallback callback to be removed as listener
52  */
53  static void RemoveEventListener(PrivAAMPStruct_JS* obj, AAMPEventType type, JSObjectRef jsCallback);
54  /**
55  * @fn RemoveAllEventListener
56  * @param[in] obj instance of PrivAAMPStruct_JS
57  */
58  static void RemoveAllEventListener(PrivAAMPStruct_JS* obj);
59  /**
60  * @fn AAMP_JSEventListener
61  * @param[in] obj instance of PrivAAMPStruct_JS
62  * @param[in] type event type
63  * @param[in] jsCallback callback for the event type
64  */
65  AAMP_JSEventListener(PrivAAMPStruct_JS* obj, AAMPEventType type, JSObjectRef jsCallback);
66  /**
67  * @fn ~AAMP_JSEventListener
68  */
70  /**
71  * @brief Copy constructor disabled
72  *
73  */
75  /**
76  * @brief assignment operator disabled
77  *
78  */
80  /**
81  * @fn Event
82  * @param[in] e AAMPEventPtr event object
83  */
84  void Event(const AAMPEventPtr& e);
85 
86  virtual void SetEventProperties(const AAMPEventPtr& ev, JSObjectRef jsEventObj)
87  {
88  }
89 
90 public:
91  PrivAAMPStruct_JS* p_obj; /**< JS execution context to use */
92  AAMPEventType p_type; /**< event type */
93  JSObjectRef p_jsCallback; /**< callback registered for event */
94 };
95 
96 #endif /** __AAMP_JSEVENTLISTENER__H__ **/
PrivAAMPStruct_JS
Private data structure for JS binding object.
Definition: jsbindings.h:35
AAMPEventObjectListener
Class for AAMP event listening Uses shared_ptr for event objects for better memory management New AAM...
Definition: AampEventListener.h:87
AAMP_JSEventListener::~AAMP_JSEventListener
~AAMP_JSEventListener()
AAMP_JSEventListener Destructor.
Definition: jseventlistener.cpp:1509
AAMP_JSEventListener
Event listener impl for AAMPMediaPlayer_JS object.
Definition: jseventlistener.h:37
AAMP_JSEventListener::RemoveEventListener
static void RemoveEventListener(PrivAAMPStruct_JS *obj, AAMPEventType type, JSObjectRef jsCallback)
Removes a JS listener for a particular event.
Definition: jseventlistener.cpp:1688
AAMP_JSEventListener::AAMP_JSEventListener
AAMP_JSEventListener(PrivAAMPStruct_JS *obj, AAMPEventType type, JSObjectRef jsCallback)
AAMP_JSEventListener Constructor.
Definition: jseventlistener.cpp:1495
AAMP_JSEventListener::p_type
AAMPEventType p_type
Definition: jseventlistener.h:92
AAMP_JSEventListener::Event
void Event(const AAMPEventPtr &e)
Callback invoked for dispatching event.
Definition: jseventlistener.cpp:1520
AAMP_JSEventListener::operator=
AAMP_JSEventListener & operator=(const AAMP_JSEventListener &)=delete
assignment operator disabled
AAMP_JSEventListener::p_obj
PrivAAMPStruct_JS * p_obj
Definition: jseventlistener.h:91
AAMP_JSEventListener::RemoveAllEventListener
static void RemoveAllEventListener(PrivAAMPStruct_JS *obj)
Remove all JS listeners registered.
Definition: jseventlistener.cpp:1721
AAMP_JSEventListener::p_jsCallback
JSObjectRef p_jsCallback
Definition: jseventlistener.h:93
AAMPEventType
AAMPEventType
Type of the events sending to the JSPP player.
Definition: AampEvent.h:44
AAMP_JSEventListener::AddEventListener
static void AddEventListener(PrivAAMPStruct_JS *obj, AAMPEventType type, JSObjectRef jsCallback)
Adds a JS function as listener for a particular event.
Definition: jseventlistener.cpp:1571