add api and bgapi methods

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@12179 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale 2009-02-20 16:52:11 +00:00
parent 1c73921625
commit 459b27af94
10 changed files with 502 additions and 4 deletions

View File

@ -2333,6 +2333,68 @@ fail:
}
static int _wrap_ESLconnection_api(lua_State* L) {
int SWIG_arg = -1;
ESLconnection *arg1 = (ESLconnection *) 0 ;
char *arg2 = (char *) 0 ;
char *arg3 = (char *) 0 ;
ESLevent *result = 0 ;
SWIG_check_num_args("api",3,3)
if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("api",1,"ESLconnection *");
if(!lua_isstring(L,2)) SWIG_fail_arg("api",2,"char const *");
if(!lua_isstring(L,3)) SWIG_fail_arg("api",3,"char const *");
if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_ESLconnection,0))){
SWIG_fail_ptr("ESLconnection_api",1,SWIGTYPE_p_ESLconnection);
}
arg2 = (char *)lua_tostring(L, 2);
arg3 = (char *)lua_tostring(L, 3);
result = (ESLevent *)(arg1)->api((char const *)arg2,(char const *)arg3);
SWIG_arg=0;
SWIG_NewPointerObj(L,result,SWIGTYPE_p_ESLevent,0); SWIG_arg++;
return SWIG_arg;
if(0) SWIG_fail;
fail:
lua_error(L);
return SWIG_arg;
}
static int _wrap_ESLconnection_bgapi(lua_State* L) {
int SWIG_arg = -1;
ESLconnection *arg1 = (ESLconnection *) 0 ;
char *arg2 = (char *) 0 ;
char *arg3 = (char *) 0 ;
ESLevent *result = 0 ;
SWIG_check_num_args("bgapi",3,3)
if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("bgapi",1,"ESLconnection *");
if(!lua_isstring(L,2)) SWIG_fail_arg("bgapi",2,"char const *");
if(!lua_isstring(L,3)) SWIG_fail_arg("bgapi",3,"char const *");
if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_ESLconnection,0))){
SWIG_fail_ptr("ESLconnection_bgapi",1,SWIGTYPE_p_ESLconnection);
}
arg2 = (char *)lua_tostring(L, 2);
arg3 = (char *)lua_tostring(L, 3);
result = (ESLevent *)(arg1)->bgapi((char const *)arg2,(char const *)arg3);
SWIG_arg=0;
SWIG_NewPointerObj(L,result,SWIGTYPE_p_ESLevent,0); SWIG_arg++;
return SWIG_arg;
if(0) SWIG_fail;
fail:
lua_error(L);
return SWIG_arg;
}
static int _wrap_ESLconnection_sendEvent(lua_State* L) {
int SWIG_arg = -1;
ESLconnection *arg1 = (ESLconnection *) 0 ;
@ -2595,6 +2657,8 @@ static swig_lua_method swig_ESLconnection_methods[] = {
{"getInfo", _wrap_ESLconnection_getInfo},
{"send", _wrap_ESLconnection_send},
{"sendRecv", _wrap_ESLconnection_sendRecv},
{"api", _wrap_ESLconnection_api},
{"bgapi", _wrap_ESLconnection_bgapi},
{"sendEvent", _wrap_ESLconnection_sendEvent},
{"recvEvent", _wrap_ESLconnection_recvEvent},
{"recvEventTimed", _wrap_ESLconnection_recvEventTimed},

View File

@ -130,6 +130,8 @@ sub DESTROY {
*getInfo = *ESLc::ESLconnection_getInfo;
*send = *ESLc::ESLconnection_send;
*sendRecv = *ESLc::ESLconnection_sendRecv;
*api = *ESLc::ESLconnection_api;
*bgapi = *ESLc::ESLconnection_bgapi;
*sendEvent = *ESLc::ESLconnection_sendEvent;
*recvEvent = *ESLc::ESLconnection_recvEvent;
*recvEventTimed = *ESLc::ESLconnection_recvEventTimed;

View File

@ -2824,6 +2824,106 @@ XS(_wrap_ESLconnection_sendRecv) {
}
XS(_wrap_ESLconnection_api) {
{
ESLconnection *arg1 = (ESLconnection *) 0 ;
char *arg2 = (char *) 0 ;
char *arg3 = (char *) 0 ;
ESLevent *result = 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
int res3 ;
char *buf3 = 0 ;
int alloc3 = 0 ;
int argvi = 0;
dXSARGS;
if ((items < 3) || (items > 3)) {
SWIG_croak("Usage: ESLconnection_api(self,cmd,arg);");
}
res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_ESLconnection, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLconnection_api" "', argument " "1"" of type '" "ESLconnection *""'");
}
arg1 = reinterpret_cast< ESLconnection * >(argp1);
res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLconnection_api" "', argument " "2"" of type '" "char const *""'");
}
arg2 = reinterpret_cast< char * >(buf2);
res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
if (!SWIG_IsOK(res3)) {
SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "ESLconnection_api" "', argument " "3"" of type '" "char const *""'");
}
arg3 = reinterpret_cast< char * >(buf3);
result = (ESLevent *)(arg1)->api((char const *)arg2,(char const *)arg3);
ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ESLevent, 0 | SWIG_SHADOW); argvi++ ;
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
XSRETURN(argvi);
fail:
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
SWIG_croak_null();
}
}
XS(_wrap_ESLconnection_bgapi) {
{
ESLconnection *arg1 = (ESLconnection *) 0 ;
char *arg2 = (char *) 0 ;
char *arg3 = (char *) 0 ;
ESLevent *result = 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
int res3 ;
char *buf3 = 0 ;
int alloc3 = 0 ;
int argvi = 0;
dXSARGS;
if ((items < 3) || (items > 3)) {
SWIG_croak("Usage: ESLconnection_bgapi(self,cmd,arg);");
}
res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_ESLconnection, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLconnection_bgapi" "', argument " "1"" of type '" "ESLconnection *""'");
}
arg1 = reinterpret_cast< ESLconnection * >(argp1);
res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLconnection_bgapi" "', argument " "2"" of type '" "char const *""'");
}
arg2 = reinterpret_cast< char * >(buf2);
res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
if (!SWIG_IsOK(res3)) {
SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "ESLconnection_bgapi" "', argument " "3"" of type '" "char const *""'");
}
arg3 = reinterpret_cast< char * >(buf3);
result = (ESLevent *)(arg1)->bgapi((char const *)arg2,(char const *)arg3);
ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ESLevent, 0 | SWIG_SHADOW); argvi++ ;
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
XSRETURN(argvi);
fail:
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
SWIG_croak_null();
}
}
XS(_wrap_ESLconnection_sendEvent) {
{
ESLconnection *arg1 = (ESLconnection *) 0 ;
@ -3268,6 +3368,8 @@ static swig_command_info swig_commands[] = {
{"ESLc::ESLconnection_getInfo", _wrap_ESLconnection_getInfo},
{"ESLc::ESLconnection_send", _wrap_ESLconnection_send},
{"ESLc::ESLconnection_sendRecv", _wrap_ESLconnection_sendRecv},
{"ESLc::ESLconnection_api", _wrap_ESLconnection_api},
{"ESLc::ESLconnection_bgapi", _wrap_ESLconnection_bgapi},
{"ESLc::ESLconnection_sendEvent", _wrap_ESLconnection_sendEvent},
{"ESLc::ESLconnection_recvEvent", _wrap_ESLconnection_recvEvent},
{"ESLc::ESLconnection_recvEventTimed", _wrap_ESLconnection_recvEventTimed},

View File

@ -131,6 +131,16 @@ class ESLconnection {
return is_resource($r) ? new ESLevent($r) : $r;
}
function api($cmd,$arg) {
$r=ESLconnection_api($this->_cPtr,$cmd,$arg);
return is_resource($r) ? new ESLevent($r) : $r;
}
function bgapi($cmd,$arg) {
$r=ESLconnection_bgapi($this->_cPtr,$cmd,$arg);
return is_resource($r) ? new ESLevent($r) : $r;
}
function sendEvent($send_me) {
return ESLconnection_sendEvent($this->_cPtr,$send_me);
}

View File

@ -1886,6 +1886,86 @@ fail:
}
ZEND_NAMED_FUNCTION(_wrap_ESLconnection_api) {
ESLconnection *arg1 = (ESLconnection *) 0 ;
char *arg2 = (char *) 0 ;
char *arg3 = (char *) 0 ;
ESLevent *result = 0 ;
zval **args[3];
SWIG_ResetError();
if(ZEND_NUM_ARGS() != 3 || zend_get_parameters_array_ex(3, args) != SUCCESS) {
WRONG_PARAM_COUNT;
}
{
if(SWIG_ConvertPtr(*args[0], (void **) &arg1, SWIGTYPE_p_ESLconnection, 0) < 0) {
SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of ESLconnection_api. Expected SWIGTYPE_p_ESLconnection");
}
}
if(!arg1) SWIG_PHP_Error(E_ERROR, "this pointer is NULL");
/*@SWIG:/usr/local/share/swig/1.3.35/php4/utils.i,26,CONVERT_STRING_IN@*/
convert_to_string_ex(args[1]);
arg2 = (char *) Z_STRVAL_PP(args[1]);
/*@SWIG@*/;
/*@SWIG:/usr/local/share/swig/1.3.35/php4/utils.i,26,CONVERT_STRING_IN@*/
convert_to_string_ex(args[2]);
arg3 = (char *) Z_STRVAL_PP(args[2]);
/*@SWIG@*/;
result = (ESLevent *)(arg1)->api((char const *)arg2,(char const *)arg3);
{
SWIG_SetPointerZval(return_value, (void *)result, SWIGTYPE_p_ESLevent, 0);
}
return;
fail:
zend_error(SWIG_ErrorCode(),SWIG_ErrorMsg());
}
ZEND_NAMED_FUNCTION(_wrap_ESLconnection_bgapi) {
ESLconnection *arg1 = (ESLconnection *) 0 ;
char *arg2 = (char *) 0 ;
char *arg3 = (char *) 0 ;
ESLevent *result = 0 ;
zval **args[3];
SWIG_ResetError();
if(ZEND_NUM_ARGS() != 3 || zend_get_parameters_array_ex(3, args) != SUCCESS) {
WRONG_PARAM_COUNT;
}
{
if(SWIG_ConvertPtr(*args[0], (void **) &arg1, SWIGTYPE_p_ESLconnection, 0) < 0) {
SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of ESLconnection_bgapi. Expected SWIGTYPE_p_ESLconnection");
}
}
if(!arg1) SWIG_PHP_Error(E_ERROR, "this pointer is NULL");
/*@SWIG:/usr/local/share/swig/1.3.35/php4/utils.i,26,CONVERT_STRING_IN@*/
convert_to_string_ex(args[1]);
arg2 = (char *) Z_STRVAL_PP(args[1]);
/*@SWIG@*/;
/*@SWIG:/usr/local/share/swig/1.3.35/php4/utils.i,26,CONVERT_STRING_IN@*/
convert_to_string_ex(args[2]);
arg3 = (char *) Z_STRVAL_PP(args[2]);
/*@SWIG@*/;
result = (ESLevent *)(arg1)->bgapi((char const *)arg2,(char const *)arg3);
{
SWIG_SetPointerZval(return_value, (void *)result, SWIGTYPE_p_ESLevent, 0);
}
return;
fail:
zend_error(SWIG_ErrorCode(),SWIG_ErrorMsg());
}
ZEND_NAMED_FUNCTION(_wrap_ESLconnection_sendEvent) {
ESLconnection *arg1 = (ESLconnection *) 0 ;
ESLevent *arg2 = (ESLevent *) 0 ;
@ -2248,6 +2328,8 @@ static zend_function_entry ESL_functions[] = {
SWIG_ZEND_NAMED_FE(eslconnection_getinfo,_wrap_ESLconnection_getInfo,NULL)
SWIG_ZEND_NAMED_FE(eslconnection_send,_wrap_ESLconnection_send,NULL)
SWIG_ZEND_NAMED_FE(eslconnection_sendrecv,_wrap_ESLconnection_sendRecv,NULL)
SWIG_ZEND_NAMED_FE(eslconnection_api,_wrap_ESLconnection_api,NULL)
SWIG_ZEND_NAMED_FE(eslconnection_bgapi,_wrap_ESLconnection_bgapi,NULL)
SWIG_ZEND_NAMED_FE(eslconnection_sendevent,_wrap_ESLconnection_sendEvent,NULL)
SWIG_ZEND_NAMED_FE(eslconnection_recvevent,_wrap_ESLconnection_recvEvent,NULL)
SWIG_ZEND_NAMED_FE(eslconnection_recveventtimed,_wrap_ESLconnection_recvEventTimed,NULL)

View File

@ -52,6 +52,8 @@ ZEND_NAMED_FUNCTION(_wrap_ESLconnection_connected);
ZEND_NAMED_FUNCTION(_wrap_ESLconnection_getInfo);
ZEND_NAMED_FUNCTION(_wrap_ESLconnection_send);
ZEND_NAMED_FUNCTION(_wrap_ESLconnection_sendRecv);
ZEND_NAMED_FUNCTION(_wrap_ESLconnection_api);
ZEND_NAMED_FUNCTION(_wrap_ESLconnection_bgapi);
ZEND_NAMED_FUNCTION(_wrap_ESLconnection_sendEvent);
ZEND_NAMED_FUNCTION(_wrap_ESLconnection_recvEvent);
ZEND_NAMED_FUNCTION(_wrap_ESLconnection_recvEventTimed);

View File

@ -3728,6 +3728,98 @@ fail:
}
SWIGINTERN PyObject *_wrap_ESLconnection_api(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
ESLconnection *arg1 = (ESLconnection *) 0 ;
char *arg2 = (char *) 0 ;
char *arg3 = (char *) 0 ;
ESLevent *result = 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
int res3 ;
char *buf3 = 0 ;
int alloc3 = 0 ;
PyObject * obj0 = 0 ;
PyObject * obj1 = 0 ;
PyObject * obj2 = 0 ;
if (!PyArg_ParseTuple(args,(char *)"OOO:ESLconnection_api",&obj0,&obj1,&obj2)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ESLconnection, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLconnection_api" "', argument " "1"" of type '" "ESLconnection *""'");
}
arg1 = reinterpret_cast< ESLconnection * >(argp1);
res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLconnection_api" "', argument " "2"" of type '" "char const *""'");
}
arg2 = reinterpret_cast< char * >(buf2);
res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
if (!SWIG_IsOK(res3)) {
SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "ESLconnection_api" "', argument " "3"" of type '" "char const *""'");
}
arg3 = reinterpret_cast< char * >(buf3);
result = (ESLevent *)(arg1)->api((char const *)arg2,(char const *)arg3);
resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ESLevent, 0 | 0 );
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
return resultobj;
fail:
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
return NULL;
}
SWIGINTERN PyObject *_wrap_ESLconnection_bgapi(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
ESLconnection *arg1 = (ESLconnection *) 0 ;
char *arg2 = (char *) 0 ;
char *arg3 = (char *) 0 ;
ESLevent *result = 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
int res3 ;
char *buf3 = 0 ;
int alloc3 = 0 ;
PyObject * obj0 = 0 ;
PyObject * obj1 = 0 ;
PyObject * obj2 = 0 ;
if (!PyArg_ParseTuple(args,(char *)"OOO:ESLconnection_bgapi",&obj0,&obj1,&obj2)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ESLconnection, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLconnection_bgapi" "', argument " "1"" of type '" "ESLconnection *""'");
}
arg1 = reinterpret_cast< ESLconnection * >(argp1);
res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLconnection_bgapi" "', argument " "2"" of type '" "char const *""'");
}
arg2 = reinterpret_cast< char * >(buf2);
res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
if (!SWIG_IsOK(res3)) {
SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "ESLconnection_bgapi" "', argument " "3"" of type '" "char const *""'");
}
arg3 = reinterpret_cast< char * >(buf3);
result = (ESLevent *)(arg1)->bgapi((char const *)arg2,(char const *)arg3);
resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ESLevent, 0 | 0 );
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
return resultobj;
fail:
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
return NULL;
}
SWIGINTERN PyObject *_wrap_ESLconnection_sendEvent(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
ESLconnection *arg1 = (ESLconnection *) 0 ;
@ -4086,6 +4178,8 @@ static PyMethodDef SwigMethods[] = {
{ (char *)"ESLconnection_getInfo", _wrap_ESLconnection_getInfo, METH_VARARGS, NULL},
{ (char *)"ESLconnection_send", _wrap_ESLconnection_send, METH_VARARGS, NULL},
{ (char *)"ESLconnection_sendRecv", _wrap_ESLconnection_sendRecv, METH_VARARGS, NULL},
{ (char *)"ESLconnection_api", _wrap_ESLconnection_api, METH_VARARGS, NULL},
{ (char *)"ESLconnection_bgapi", _wrap_ESLconnection_bgapi, METH_VARARGS, NULL},
{ (char *)"ESLconnection_sendEvent", _wrap_ESLconnection_sendEvent, METH_VARARGS, NULL},
{ (char *)"ESLconnection_recvEvent", _wrap_ESLconnection_recvEvent, METH_VARARGS, NULL},
{ (char *)"ESLconnection_recvEventTimed", _wrap_ESLconnection_recvEventTimed, METH_VARARGS, NULL},

View File

@ -2851,6 +2851,98 @@ fail:
}
SWIGINTERN VALUE
_wrap_ESLconnection_api(int argc, VALUE *argv, VALUE self) {
ESLconnection *arg1 = (ESLconnection *) 0 ;
char *arg2 = (char *) 0 ;
char *arg3 = (char *) 0 ;
ESLevent *result = 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
int res3 ;
char *buf3 = 0 ;
int alloc3 = 0 ;
VALUE vresult = Qnil;
if ((argc < 2) || (argc > 2)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_ESLconnection, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "ESLconnection *","api", 1, self ));
}
arg1 = reinterpret_cast< ESLconnection * >(argp1);
res2 = SWIG_AsCharPtrAndSize(argv[0], &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "char const *","api", 2, argv[0] ));
}
arg2 = reinterpret_cast< char * >(buf2);
res3 = SWIG_AsCharPtrAndSize(argv[1], &buf3, NULL, &alloc3);
if (!SWIG_IsOK(res3)) {
SWIG_exception_fail(SWIG_ArgError(res3), Ruby_Format_TypeError( "", "char const *","api", 3, argv[1] ));
}
arg3 = reinterpret_cast< char * >(buf3);
result = (ESLevent *)(arg1)->api((char const *)arg2,(char const *)arg3);
vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ESLevent, 0 | 0 );
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
return vresult;
fail:
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
return Qnil;
}
SWIGINTERN VALUE
_wrap_ESLconnection_bgapi(int argc, VALUE *argv, VALUE self) {
ESLconnection *arg1 = (ESLconnection *) 0 ;
char *arg2 = (char *) 0 ;
char *arg3 = (char *) 0 ;
ESLevent *result = 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
int res3 ;
char *buf3 = 0 ;
int alloc3 = 0 ;
VALUE vresult = Qnil;
if ((argc < 2) || (argc > 2)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_ESLconnection, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "ESLconnection *","bgapi", 1, self ));
}
arg1 = reinterpret_cast< ESLconnection * >(argp1);
res2 = SWIG_AsCharPtrAndSize(argv[0], &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "char const *","bgapi", 2, argv[0] ));
}
arg2 = reinterpret_cast< char * >(buf2);
res3 = SWIG_AsCharPtrAndSize(argv[1], &buf3, NULL, &alloc3);
if (!SWIG_IsOK(res3)) {
SWIG_exception_fail(SWIG_ArgError(res3), Ruby_Format_TypeError( "", "char const *","bgapi", 3, argv[1] ));
}
arg3 = reinterpret_cast< char * >(buf3);
result = (ESLevent *)(arg1)->bgapi((char const *)arg2,(char const *)arg3);
vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ESLevent, 0 | 0 );
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
return vresult;
fail:
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
return Qnil;
}
SWIGINTERN VALUE
_wrap_ESLconnection_sendEvent(int argc, VALUE *argv, VALUE self) {
ESLconnection *arg1 = (ESLconnection *) 0 ;
@ -3507,6 +3599,8 @@ SWIGEXPORT void Init_ESL(void) {
rb_define_method(cESLconnection.klass, "getInfo", VALUEFUNC(_wrap_ESLconnection_getInfo), -1);
rb_define_method(cESLconnection.klass, "send", VALUEFUNC(_wrap_ESLconnection_send), -1);
rb_define_method(cESLconnection.klass, "sendRecv", VALUEFUNC(_wrap_ESLconnection_sendRecv), -1);
rb_define_method(cESLconnection.klass, "api", VALUEFUNC(_wrap_ESLconnection_api), -1);
rb_define_method(cESLconnection.klass, "bgapi", VALUEFUNC(_wrap_ESLconnection_bgapi), -1);
rb_define_method(cESLconnection.klass, "sendEvent", VALUEFUNC(_wrap_ESLconnection_sendEvent), -1);
rb_define_method(cESLconnection.klass, "recvEvent", VALUEFUNC(_wrap_ESLconnection_recvEvent), -1);
rb_define_method(cESLconnection.klass, "recvEventTimed", VALUEFUNC(_wrap_ESLconnection_recvEventTimed), -1);

View File

@ -54,6 +54,50 @@ ESLevent *ESLconnection::sendRecv(const char *cmd)
return NULL;
}
ESLevent *ESLconnection::api(const char *cmd, const char *arg)
{
size_t len = strlen(cmd) + strlen(arg) + 5;
char *cmd_buf;
cmd_buf = (char *) malloc(len);
assert(cmd_buf);
snprintf(cmd_buf, len, "api %s %s", cmd, arg);
*(cmd_buf + len) = '\0';
if (esl_send_recv(&handle, cmd_buf) == ESL_SUCCESS) {
esl_event_t *event;
esl_event_dup(&event, handle.last_sr_event);
return new ESLevent(event, 1);
}
free(cmd_buf);
return NULL;
}
ESLevent *ESLconnection::bgapi(const char *cmd, const char *arg)
{
size_t len = strlen(cmd) + strlen(arg) + 5;
char *cmd_buf;
cmd_buf = (char *) malloc(len);
assert(cmd_buf);
snprintf(cmd_buf, len, "bgapi %s %s", cmd, arg);
*(cmd_buf + len) = '\0';
if (esl_send_recv(&handle, cmd_buf) == ESL_SUCCESS) {
esl_event_t *event;
esl_event_dup(&event, handle.last_sr_event);
return new ESLevent(event, 1);
}
free(cmd_buf);
return NULL;
}
ESLevent *ESLconnection::getInfo()
{
if (handle.connected && handle.info_event) {
@ -98,9 +142,10 @@ ESLevent *ESLconnection::recvEvent()
}
if (esl_recv_event(&handle, NULL) == ESL_SUCCESS) {
if (handle.last_ievent) {
esl_event_t *e = handle.last_ievent ? handle.last_ievent : handle.last_event;
if (e) {
esl_event_t *event;
esl_event_dup(&event, handle.last_ievent);
esl_event_dup(&event, e);
last_event_obj = new ESLevent(event, 1);
return last_event_obj;
}
@ -117,9 +162,10 @@ ESLevent *ESLconnection::recvEventTimed(int ms)
}
if (esl_recv_event_timed(&handle, ms, NULL) == ESL_SUCCESS) {
if (handle.last_ievent) {
esl_event_t *e = handle.last_ievent ? handle.last_ievent : handle.last_event;
if (e) {
esl_event_t *event;
esl_event_dup(&event, handle.last_ievent);
esl_event_dup(&event, e);
last_event_obj = new ESLevent(event, 1);
return last_event_obj;
}

View File

@ -77,6 +77,8 @@ class ESLconnection {
ESLevent *getInfo();
esl_status_t send(const char *cmd);
ESLevent *sendRecv(const char *cmd);
ESLevent *api(const char *cmd, const char *arg);
ESLevent *bgapi(const char *cmd, const char *arg);
esl_status_t sendEvent(ESLevent *send_me);
ESLevent *recvEvent();
ESLevent *recvEventTimed(int ms);