Commit afef857f authored by jdelange's avatar jdelange

* po-hi-c/src/po_hi_lua.c

   - Interface PolyORB-HI-C service within LUA

 * po-hi-c/examples/aadlv2/lua/lua-ping.aadl
   po-hi-c/examples/aadlv2/lua/ping.lua
   - Example of PolyORB-HI-C use within LUA



git-svn-id: https://tecsw.estec.esa.int/svn/taste/trunk/po-hi-c@3675 129961e7-ef38-4bb5-a8f7-c9a525a55882
parent 88a80e10
......@@ -55,8 +55,8 @@ connections
parameter P_Spg.Data_Source -> Data_Source;
properties
Dispatch_Protocol => Periodic;
Period => 10 Ms;
Deadline => 10 ms;
Period => 1000 Ms;
Deadline => 1000 ms;
Priority => 2;
end P.Impl;
......
......@@ -7,5 +7,6 @@ function do_ping ()
end
function receive_ping (val)
time_wait (4000);
print ("value : " .. val);
end
......@@ -9,6 +9,24 @@
*/
#include <po_hi_lua.h>
#include <po_hi_time.h>
int __po_hi_lua_time_wait (lua_State* state)
{
__po_hi_time_t now;
__po_hi_time_t delay;
__po_hi_time_t deadline;
int msec;
msec = lua_tonumber (state, 1);
__po_hi_get_time (&now);
__po_hi_milliseconds (&delay, msec);
__po_hi_add_times (&deadline, &now, &delay);
__po_hi_delay_until (&deadline);
return 0;
}
int __po_hi_lua_load (__po_hi_lua_context_t* context, const char* filename)
{
......@@ -24,7 +42,11 @@ int __po_hi_lua_load (__po_hi_lua_context_t* context, const char* filename)
#ifdef __PO_HI_USE_LUA
context->state = lua_open();
luaL_openlibs (context->state);
lua_register (context->state, "time_wait", __po_hi_lua_time_wait);
if (luaL_dofile (context->state,filename) != 0)
{
return __PO_HI_INVALID;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment