mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-29 16:31:05 +02:00
CLuaInstMisc:: Add script function postMsg() to send a neutrino message
- Currently possible message: POSTMSG.STANDBY_ON
- Set Lua api version to 1.33
Origin commit data
------------------
Branch: ni/coolstream
Commit: 37e8c328c5
Author: Michael Liebmann <tuxcode.bbg@gmail.com>
Date: 2015-12-15 (Tue, 15 Dec 2015)
------------------
This commit was generated by Migit
This commit is contained in:
@@ -57,6 +57,7 @@ void CLuaInstMisc::LuaMiscRegister(lua_State *L)
|
|||||||
{ "runScript", CLuaInstMisc::runScriptExt },
|
{ "runScript", CLuaInstMisc::runScriptExt },
|
||||||
{ "GetRevision", CLuaInstMisc::GetRevision },
|
{ "GetRevision", CLuaInstMisc::GetRevision },
|
||||||
{ "checkVersion", CLuaInstMisc::checkVersion },
|
{ "checkVersion", CLuaInstMisc::checkVersion },
|
||||||
|
{ "postMsg", CLuaInstMisc::postMsg },
|
||||||
{ "__gc", CLuaInstMisc::MiscDelete },
|
{ "__gc", CLuaInstMisc::MiscDelete },
|
||||||
{ NULL, NULL }
|
{ NULL, NULL }
|
||||||
};
|
};
|
||||||
@@ -198,6 +199,22 @@ int CLuaInstMisc::checkVersion(lua_State *L)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int CLuaInstMisc::postMsg(lua_State *L)
|
||||||
|
{
|
||||||
|
lua_Integer msg = 0;
|
||||||
|
neutrino_msg_t post_msg = 0;
|
||||||
|
msg = luaL_checkint(L, 2);
|
||||||
|
switch (msg) {
|
||||||
|
case POSTMSG_STANDBY_ON:
|
||||||
|
post_msg = NeutrinoMessages::STANDBY_ON;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
g_RCInput->postMsg(post_msg, 0);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
int CLuaInstMisc::MiscDelete(lua_State *L)
|
int CLuaInstMisc::MiscDelete(lua_State *L)
|
||||||
{
|
{
|
||||||
CLuaMisc *D = MiscCheckData(L, 1);
|
CLuaMisc *D = MiscCheckData(L, 1);
|
||||||
|
@@ -31,6 +31,10 @@ class CLuaMisc
|
|||||||
class CLuaInstMisc
|
class CLuaInstMisc
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
enum {
|
||||||
|
POSTMSG_STANDBY_ON = 1
|
||||||
|
};
|
||||||
|
|
||||||
CLuaInstMisc() {};
|
CLuaInstMisc() {};
|
||||||
~CLuaInstMisc() {};
|
~CLuaInstMisc() {};
|
||||||
static CLuaInstMisc* getInstance();
|
static CLuaInstMisc* getInstance();
|
||||||
@@ -53,6 +57,7 @@ class CLuaInstMisc
|
|||||||
static int runScriptExt(lua_State *L);
|
static int runScriptExt(lua_State *L);
|
||||||
static int GetRevision(lua_State *L);
|
static int GetRevision(lua_State *L);
|
||||||
static int checkVersion(lua_State *L);
|
static int checkVersion(lua_State *L);
|
||||||
|
static int postMsg(lua_State *L);
|
||||||
static int MiscDelete(lua_State *L);
|
static int MiscDelete(lua_State *L);
|
||||||
|
|
||||||
static void miscFunctionDeprecated(lua_State *L, std::string oldFunc);
|
static void miscFunctionDeprecated(lua_State *L, std::string oldFunc);
|
||||||
|
@@ -335,6 +335,12 @@ static void set_lua_variables(lua_State *L)
|
|||||||
{ NULL, 0 }
|
{ NULL, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
table_key post_msg[] =
|
||||||
|
{
|
||||||
|
{ "STANDBY_ON", (lua_Integer)CLuaInstMisc::POSTMSG_STANDBY_ON },
|
||||||
|
{ NULL, 0 }
|
||||||
|
};
|
||||||
|
|
||||||
/* list of environment variable arrays to be exported */
|
/* list of environment variable arrays to be exported */
|
||||||
lua_envexport e[] =
|
lua_envexport e[] =
|
||||||
{
|
{
|
||||||
@@ -349,6 +355,7 @@ static void set_lua_variables(lua_State *L)
|
|||||||
{ "DYNFONT", dynfont },
|
{ "DYNFONT", dynfont },
|
||||||
{ "CURL", curl_status },
|
{ "CURL", curl_status },
|
||||||
{ "NMODE", neutrino_mode },
|
{ "NMODE", neutrino_mode },
|
||||||
|
{ "POSTMSG", post_msg },
|
||||||
{ NULL, NULL }
|
{ NULL, NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -31,7 +31,7 @@ extern "C" {
|
|||||||
#include "luainstance_helpers.h"
|
#include "luainstance_helpers.h"
|
||||||
|
|
||||||
#define LUA_API_VERSION_MAJOR 1
|
#define LUA_API_VERSION_MAJOR 1
|
||||||
#define LUA_API_VERSION_MINOR 32
|
#define LUA_API_VERSION_MINOR 33
|
||||||
|
|
||||||
/* inspired by Steve Kemp http://www.steve.org.uk/ */
|
/* inspired by Steve Kemp http://www.steve.org.uk/ */
|
||||||
class CLuaInstance
|
class CLuaInstance
|
||||||
|
Reference in New Issue
Block a user