Workspace 6.21.5
Classes | Typedefs | Functions | Variables
workspaceweb_c.h File Reference
#include <QHash>
#include <QMap>
#include <QString>
#include "Workspace/Application/Web/workspaceweb_api.h"
Include dependency graph for workspaceweb_c.h:
This graph shows which files directly or indirectly include this file:

Classes

struct  WorkspaceId
 Identifies a running Workspace client process by the host / port that it is connected on. More...
 

Typedefs

using EventLoopStartedCallback = int(*)()
 
typedef const char * JSONString
 A string expected to be formatted in JSON format.
 
using ListCallback = int(*)(const WorkspaceId *, JSONString)
 
using NewConnectionCallback = int(*)(const WorkspaceId *)
 
using WatchCallback = int(*)(const WorkspaceId *, JSONString)
 
using WorkspaceErrorCallback = int(*)(const WorkspaceId *, const char *)
 
using WorkspaceFailedCallback = int(*)(const WorkspaceId *)
 
using WorkspaceSucceededCallback = int(*)(const WorkspaceId *)
 

Functions

CSIRO_WORKSPACEWEB_API int server_init (int logLevel)
 
CSIRO_WORKSPACEWEB_API int server_listen_for_connection (const char *host, int port, NewConnectionCallback callback)
 
CSIRO_WORKSPACEWEB_API int server_listen_for_connection_and_wait (const char *host, int port, NewConnectionCallback callback)
 
CSIRO_WORKSPACEWEB_API int server_poll (int timeoutMs)
 
CSIRO_WORKSPACEWEB_API int server_start_event_loop (EventLoopStartedCallback callback)
 
CSIRO_WORKSPACEWEB_API int server_stop_event_loop ()
 
CSIRO_WORKSPACEWEB_API int workspace_cancel_watch (const WorkspaceId *ws, const char *watchId)
 
CSIRO_WORKSPACEWEB_API int workspace_list_global_names (const WorkspaceId *ws, ListCallback callback)
 
CSIRO_WORKSPACEWEB_API int workspace_list_inputs (const WorkspaceId *ws, ListCallback callback)
 
CSIRO_WORKSPACEWEB_API int workspace_list_outputs (const WorkspaceId *ws, ListCallback callback)
 
CSIRO_WORKSPACEWEB_API int workspace_register_func_error (const WorkspaceId *ws, WorkspaceErrorCallback callback)
 
CSIRO_WORKSPACEWEB_API int workspace_register_func_failed (const WorkspaceId *ws, WorkspaceFailedCallback callback)
 
CSIRO_WORKSPACEWEB_API int workspace_register_func_success (const WorkspaceId *ws, WorkspaceSucceededCallback callback)
 
CSIRO_WORKSPACEWEB_API int workspace_run_continuously (const WorkspaceId *ws)
 
CSIRO_WORKSPACEWEB_API int workspace_run_once (const WorkspaceId *ws)
 
CSIRO_WORKSPACEWEB_API int workspace_set_global_name (const WorkspaceId *ws, const char *globalName, const char *content)
 
CSIRO_WORKSPACEWEB_API int workspace_set_input (const WorkspaceId *ws, const char *inputName, const char *content)
 
CSIRO_WORKSPACEWEB_API int workspace_stop (const WorkspaceId *ws)
 
CSIRO_WORKSPACEWEB_API int workspace_terminate (const WorkspaceId *ws)
 
CSIRO_WORKSPACEWEB_API int workspace_watch (const WorkspaceId *ws, JSONString watches, WatchCallback func, bool singleShot)
 

Variables

const int WORKSPACE_MAX_HOST_LEN = 255
 

Detailed Description

Declares the C API to our WorkspaceWeb library. This allows external applications or environments (such as the workspaceweb python module) to interact with a running workspace.

The API operations in a client/server manner. One server is created in the application, which will then listen for running WorkspaceWeb instances (clients) which will then connect to it over TCP/IP. In most cases, the application itself will also be responsible for spawning the WorkspaceWeb instances as child processes.

The best way to use the API is asynchronously. This can be done as follows:

1) Initialise the server: server_init() 2) Register callbacks for success, failure, error, watch and most importantly, new connections. 3) Listen for new connections: server_listen_for_connection() Each new connection will result in a callback to the application, with the connected client address and port (WorkspaceId) provided as arguments. 4) Launch one or more workspace-web applications (optional - these may already exist and be running elsewhere on the network). 5) Register one or more watches on inputs / outputs / globalNames in the workflow using workspace_register_watch. 6) Set / get any inputs or global names on your workflow using workspace_set_input or workspace_set_global_name. 7) Use server_poll() to check for any updates.

Typedef Documentation

◆ EventLoopStartedCallback

using EventLoopStartedCallback = int (*)()

◆ JSONString

typedef const char* JSONString

◆ ListCallback

using ListCallback = int (*)(const WorkspaceId*, JSONString)

◆ NewConnectionCallback

using NewConnectionCallback = int (*)(const WorkspaceId*)

◆ WatchCallback

using WatchCallback = int (*)(const WorkspaceId*, JSONString)

◆ WorkspaceErrorCallback

using WorkspaceErrorCallback = int (*)(const WorkspaceId*, const char*)

◆ WorkspaceFailedCallback

using WorkspaceFailedCallback = int (*)(const WorkspaceId*)

◆ WorkspaceSucceededCallback

using WorkspaceSucceededCallback = int (*)(const WorkspaceId*)

Variable Documentation

◆ WORKSPACE_MAX_HOST_LEN

const int WORKSPACE_MAX_HOST_LEN = 255