-
Notifications
You must be signed in to change notification settings - Fork 1
/
fireMyEvent.py
40 lines (30 loc) · 955 Bytes
/
fireMyEvent.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
'''''
@author: zobov
Example:
Fire a custom event through VideoSDK or Room
API Version: 4.1.0+
'''
import config
import pyVideoSDK
from pyVideoSDK.methods import Methods
from pyVideoSDK.consts import EVENT, METHOD_RESPONSE
import pyVideoSDK.consts as C
from pprint import pprint
print(__doc__)
sdk = pyVideoSDK.open_session(ip = config.IP, port = config.PORT, pin = config.PIN, debug = config.DEBUG)
methods = Methods(sdk)
@sdk.handler(EVENT[C.EV_appStateChanged])
@sdk.handler(METHOD_RESPONSE[C.M_getAppState])
def on_state_change(response):
print(f' Application state is {response["appState"]}')
@sdk.handler(METHOD_RESPONSE[C.M_fireMyEvent])
def on_fire_my_event_result(response):
print(" Method call result:")
pprint(response)
@sdk.handler(EVENT[C.EV_myEvent])
def on_my_event(response):
print(" Event:")
pprint(response)
if __name__ == '__main__':
methods.fireMyEvent("hello_world_event")
sdk.run()