From b9c4bd1be0f60b6aa498842c8f6e2d7cbcdd4ea5 Mon Sep 17 00:00:00 2001 From: fburton Date: Sun, 23 Aug 2009 03:47:09 +0000 Subject: Getting started information for Lua integration --- docs/TCF Getting Started.html | 163 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 162 insertions(+), 1 deletion(-) (limited to 'docs') diff --git a/docs/TCF Getting Started.html b/docs/TCF Getting Started.html index 9e8d5b30e..6ed3b19a6 100644 --- a/docs/TCF Getting Started.html +++ b/docs/TCF Getting Started.html @@ -16,6 +16,7 @@
  • Creating Eclipse Workspace
  • TCF Plugins
  • Building TCF Agent +
  • TCF Integration with Lua
  • Browsing Agent Source Code in CDT
  • Using TCF With Remote System Explorer
  • Using TCF With Eclipse Debugger @@ -170,6 +171,166 @@ commands to build and run the agent. To run the agent on VxWorks Simulator you will need to setup a simulated network - see Networking with the VxWorks Simulator chapter in Wind River VxWorks Simulator user's guide for details.

    +

    TCF Integration with Lua

    + +

    The TCF integration with Lua allows writing TCF client and server programs in the Lua programming lanugage. The integration is done so the main loop is the TCF event dispatch loop. At startup a Lua program is invoked to allow an initial setup after which it should return to enter the TCF dispatch loop.

    + +

    TCF functions are accessible from the Lua table named "tcf". Accessible functions are:

    + + + + + + + + + + +
    Function + Callback + Description +
    read_command(read_command_callback) + read_command_callback(string) + Reads one line from stdin or if the -s command line option is specified from the specified file. +
    peer = peer_server_find(peer_name) + NA + Looks up peer object with the specified name. Returns nil if not found. +
    peers = peer_server_list() + NA + Returns a table of discovered peer objects. +
    peer = peer_server_from_url(peer_url) + NA + Creates a peer object from the specified URL. +
    protocol = protocol_alloc() + NA + Created a new protocol object. +
    channel_connect(peer, protocol, connect_callback) + connect_callback(channel, errorString) + Creates connection to specified peer. +
    event = post_event(post_event_callback, micro_seconds) + post_event_callback() + The micro_seconds argument is optional. Then not present the callback function will be invoked after currently pending event have been processed. +
    + +

    Protocol object functions:

    + + + + +
    Function + Callback + Description +
    command_handler(protocol, service, name, command_callback) + command_callback(token, data) + Register command handler for service and name with protocol. The command_callback function will be called each time a command of the specified name and service is received on a channel associated with the protocol object. +
    + +

    Channel object functions:

    + + + + + + + + + + + + +
    Function + Callback + Description +
    close(channel) + NA + Disconnects the specified channel. +
    connecting_handler(channel, connecting_callback) + connecting_callback() + Register callback function which is called when the channel enters connecting state. +
    connected_handler(channel, connected_callback) + connected_callback() + Register callback function which is called when the channel enters connected state. +
    receive_handler(channel, receive_callback) + receive_callback() + Register callback function which is called when the channel receives a message. +
    disconnected_handler(channel, disconnected_callback) + disconnected_callback() + Register callback function which is called when the channel is disconnected. +
    event_handler(channel, service, name, event_callback) + event_callback(data) + Register callback function which is called when an event for service and name is received. +
    start(channel) + NA + Starts communication on channel. +
    send_command(channel, service, name, data, replay_callback) + replay_callback(data, error) + Send a command to channel and register callback when reply is received. +
    services = get_services(channel) + NA + Create a table of service names supported by remote peer. +
    + +

    Peer object functions:

    + + + + + + + + + +
    Function + Callback + Description +
    id = getid(peer) + NA + Return ID of peer. +
    getnames(peer) + NA + Return table of peer propery names. +
    getvalue(peer, name) + NA + Return value of propery name. +
    setvalue(peer, name, value) + NA + Set value of propery name. +
    getflags(peer) + NA + Return table of flags for peer. +
    setflags(peer, flags) + NA + Set flags for peer. +
    + +

    Event object functions:

    + + + + +
    Function + Callback + Description +
    cancel(event) + NA + Cancel event created by post_event(). +
    + +

    Download and Build

    + +The integration has only been tested on Linux at this point. + +

    cd <luadir> +
    curl -O http://www.lua.org/ftp/lua-5.1.4.tar.gz +
    tar zxf lua-5.1.4.tar.gz +
    cd lua-5.1.4 +
    make linux +
    make local +
    cd <tcfdir>/agent +
    make LUADIR=<luadir>/lua-5.1.4 + +

    ./GNU/Linux/i686/Debug/tcflua tcf_example.lua +

    Browsing Agent Source Code in CDT

    On Linux, the default configuration from the CDT .project file included in TCF should be fine for correctly browsing the agent source code. Linux is recommended @@ -234,4 +395,4 @@ Source level debugging is fully supported if the source code can be found in a C

    - \ No newline at end of file + -- cgit v1.2.3