web_service

Module Contents

Classes

WebService

Web service

Functions

main()

Set names, collect params, and give service to server

class web_service.WebService(name)

Bases: harmoni_common_lib.service_manager.HarmoniServiceManager

Web service

setup_web(self)

Setup the web service, and waiting for the web browser to connect

request(self, data)

Request to web page: requesting to the webpage to display something and waiting for a user event (e.g., button click, input text)

Parameters

data (str) – string of json which contains two items: {“container_id”: str, “set_view”: str} container_id: id of the container found in the ./web/src/config/config.json file set_view: the content you want to set your container of (e.g., string of image location, text)

Returns

state of the request (SUCCESS, FAIL) message (str): content of the response message

Return type

response (int)

do(self, data)

Do to web page (display a page on the web browser)

Parameters

data (str) – string of json which contains two items: {“container_id”: str, “set_view”: str} container_id: id of the container found in the ./web/src/config/config.json file set_view: the content you want to set your container of (e.g., string of image location, text)

Returns

state of the request (SUCCESS, FAIL) message (str): empty string (not expecting any response)

Return type

response (int)

_get_web_data(self, data)

Getting web data from the TTS results

Parameters

data (str) – string of behavior_data object from TTS

Returns

array of items with corresponding values of “container_id” and “set_view” to display when speaking

Return type

web_array (list)

send_request(self, display_view)

Sending the request to the web page

Parameters

display_view (str) – string oj json with information to display (“container_id” and “set_view” values)

_event_click_callback(self, event)

Callback for subscription to the web page

web_service.main()

Set names, collect params, and give service to server