org.hfbk.vis.ScriptRouter Class Reference

Collaboration diagram for org.hfbk.vis.ScriptRouter:

Collaboration graph
List of all members.

Public Member Functions

 ScriptRouter (VisClient client)
void updateRoutes ()

Package Functions

boolean dispatch (String route, String[] args)

Package Attributes

Scripter engine
String currentRoutes
VisClient client

Detailed Description

a Router that dispatches incoming messages (String arrays) to a user-defined script. The script has access to the client and can modify any public structure by accessing public fields and invoke public methods.

the scripts are named by String and are parsed from Prefs.current.routes, the syntax is routeName1:script1

the scripts are defined in JavaScript. the message content is accessed via the args[] array. to use them as numbers, they must be converted in JavaScript style. some examples:

poti1:client.mouseViewpoint.tfov=args[0]-0; //if receiving message from poti1, set the field of view to its first argument. sonar2:if(args[0]<50) client.reset(); //if sonar2 receives an target less then 50cm, reset the client. ...

maybe we just use RegExps? a fixed own syntax? eg. match to const. string fragments wrapping type denominators:

"[scale, poti1, {int value}]"

or in scanf format, or....

Definition at line 38 of file

Constructor & Destructor Documentation

org.hfbk.vis.ScriptRouter.ScriptRouter ( VisClient  client  ) 

create a router

Definition at line 49 of file

References org.hfbk.vis.ScriptRouter.client, and org.hfbk.vis.ScriptRouter.updateRoutes().

Here is the call graph for this function:

Member Function Documentation

void org.hfbk.vis.ScriptRouter.updateRoutes (  ) 

update the routes, if Prefs changed

Definition at line 57 of file

References org.hfbk.vis.ScriptRouter.client, org.hfbk.vis.ScriptRouter.currentRoutes, org.hfbk.vis.ScriptRouter.engine, and org.hfbk.util.Scripter.evaluate().

Referenced by org.hfbk.vis.ScriptRouter.dispatch(), and org.hfbk.vis.ScriptRouter.ScriptRouter().

Here is the call graph for this function:

Here is the caller graph for this function:

boolean org.hfbk.vis.ScriptRouter.dispatch ( String  route,
String[]  args 
) [package]

dispatch a message to given route.

true, if the message was handled by a route

Definition at line 73 of file

References, org.hfbk.vis.ScriptRouter.engine, org.hfbk.util.Scripter.getFunction(), and org.hfbk.vis.ScriptRouter.updateRoutes().

Referenced by org.hfbk.vis.UdpListener.parseMsg().

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation

Scripter org.hfbk.vis.ScriptRouter.engine [package]

Definition at line 40 of file

Referenced by org.hfbk.vis.ScriptRouter.dispatch(), and org.hfbk.vis.ScriptRouter.updateRoutes().

String org.hfbk.vis.ScriptRouter.currentRoutes [package]

Definition at line 42 of file

Referenced by org.hfbk.vis.ScriptRouter.updateRoutes().

VisClient org.hfbk.vis.ScriptRouter.client [package]

Definition at line 44 of file

Referenced by org.hfbk.vis.ScriptRouter.ScriptRouter(), and org.hfbk.vis.ScriptRouter.updateRoutes().

The documentation for this class was generated from the following file:
Generated on Tue Apr 7 17:58:19 2009 for visclient by  doxygen 1.5.1