rho::String js_Mpos_getSimpleStringProperty(const rho::String& strObjID, rho::json::CJSONArray& argv, const rho::String& strCallbackID, const rho::String& strJsVmID, const rho::String& strCallbackParam) { RAWTRACE4("getSimpleStringProperty(strObjID = %s, argc = %d, strCallbackID = %s, strJsVmID = %s)", strObjID.c_str(), argv.getSize(), strCallbackID.c_str(), strJsVmID.c_str()); #ifdef OS_ANDROID if ( jnienv() == 0 ) { rho_nativethread_start(); } #endif rho::apiGenerator::CMethodResult oRes; oRes.setRequestedType(CMethodResult::eString); rho::common::CInstanceClassFunctorBase<rho::apiGenerator::CMethodResult>* pFunctor = 0; int argc = argv.getSize(); rho::IMpos* pObj = rho::CMposFactoryBase::getInstance()->getModuleByID(strObjID); if ( oRes.hasCallback() ) { pFunctor = rho_makeInstanceClassFunctor1( pObj, &rho::IMpos::getSimpleStringProperty, oRes ); rho::CMposFactoryBase::getMposSingletonS()->addCommandToQueue( pFunctor ); } else { pObj->getSimpleStringProperty( oRes ); } return oRes.toJSON(); }
rho::String js_s_Externalstorage_getSDPath(const rho::String& strObjID, rho::json::CJSONArray& argv, const rho::String& strCallbackID, const rho::String& strJsVmID, const rho::String& strCallbackParam) { RAWTRACE3("getSDPath(strObjID = %s, strCallbackID = %s, strJsVmID = %s)", strObjID.c_str(), strCallbackID.c_str(), strJsVmID.c_str()); rho::apiGenerator::CMethodResult oRes; oRes.setRequestedType(CMethodResult::eString); rho::common::CInstanceClassFunctorBase<rho::apiGenerator::CMethodResult>* pFunctor = 0; int argc = argv.getSize(); if ( oRes.hasCallback() ) { pFunctor = rho_makeInstanceClassFunctor1( rho::CExternalstorageFactoryBase::getExternalstorageSingletonS(), &rho::IExternalstorageSingleton::getSDPath, oRes ); rho::CExternalstorageFactoryBase::getExternalstorageSingletonS()->addCommandToQueue( pFunctor ); } else { rho::CExternalstorageFactoryBase::getExternalstorageSingletonS()->getSDPath( oRes ); } return oRes.toJSON(); }
rho::String js_WifiConfig_getSimpleStringProperty(const rho::String& strObjID, rho::json::CJSONArray& argv, const rho::String& strCallbackID, const rho::String& strJsVmID, const rho::String& strCallbackParam) { RAWTRACE3("getSimpleStringProperty(strObjID = %s, strCallbackID = %s, strJsVmID = %s)", strObjID.c_str(), strCallbackID.c_str(), strJsVmID.c_str()); rho::apiGenerator::CMethodResult oRes; oRes.setRequestedType(CMethodResult::eString); rho::common::CInstanceClassFunctorBase<rho::apiGenerator::CMethodResult>* pFunctor = 0; int argc = argv.getSize(); rho::IWifiConfig* pObj = rho::CWifiConfigFactoryBase::getInstance()->getModuleByID(strObjID); if ( oRes.hasCallback() ) { pFunctor = rho_makeInstanceClassFunctor1( pObj, &rho::IWifiConfig::getSimpleStringProperty, oRes ); rho::CWifiConfigFactoryBase::getWifiConfigSingletonS()->addCommandToQueue( pFunctor ); } else { pObj->getSimpleStringProperty( oRes ); } return oRes.toJSON(); }
rho::String js_s_Megamodule_getObjectByIndex(const rho::String& strObjID, rho::json::CJSONArray& argv, const rho::String& strCallbackID, const rho::String& strJsVmID, const rho::String& strCallbackParam) { RAWTRACE2("%s(id=%s)", __FUNCTION__, strObjID.c_str()); MethodResultJni result(false); if(!result) { result.setError("JNI error: failed to initialize MethodResult java object"); RAWLOG_ERROR("JNI error: failed to initialize MethodResult java object ^^^"); return CMethodResultConvertor().toJSON(result); } int argc = argv.getSize(); if((argc < 1) || (argc > 1)) { result.setArgError("Wrong number of arguments"); RAWLOG_ERROR1("Wrong number of arguments: %d ^^^", argc); return CMethodResultConvertor().toJSON(result); } if(strCallbackID.length() != 0) { result.setCallBack(strCallbackID, strCallbackParam); } result.setObjectClassPath("Rho.Examples.Megamodule"); RAWTRACE("Object class path is set"); ObjectProxy::getObjectByIndex(argumentsAdapter(argv), result); rho::String res = CMethodResultConvertor().toJSON(result); RAWTRACE(res.c_str()); RAWTRACE2("%s(id=%s) end ^^^", __FUNCTION__, strObjID.c_str()); return res; }
rho::String js_Megamodule_getIntegerProperty(const rho::String& strObjID, rho::json::CJSONArray& argv, const rho::String& strCallbackID, const rho::String& strJsVmID, const rho::String& strCallbackParam) { RAWTRACE2("%s(id=%s)", __FUNCTION__, strObjID.c_str()); MethodResultJni result(false); if(!result) { result.setError("JNI error: failed to initialize MethodResult java object"); RAWLOG_ERROR("JNI error: failed to initialize MethodResult java object ^^^"); return CMethodResultConvertor().toJSON(result); } ObjectProxy megamodule(strObjID); int argc = argv.getSize(); if((argc < 0) || (argc > 0)) { result.setArgError("Wrong number of arguments"); RAWLOG_ERROR1("Wrong number of arguments: %d ^^^", argc); return CMethodResultConvertor().toJSON(result); } if(strCallbackID.length() != 0) { result.setCallBack(strCallbackID, strCallbackParam); } megamodule.getIntegerProperty(argumentsAdapter(argv), result); rho::String res = CMethodResultConvertor().toJSON(result); RAWTRACE(res.c_str()); RAWTRACE2("%s(id=%s) end ^^^", __FUNCTION__, strObjID.c_str()); return res; }
rho::String js_Mpos_getProperty(const rho::String& strObjID, rho::json::CJSONArray& argv, const rho::String& strCallbackID, const rho::String& strJsVmID, const rho::String& strCallbackParam) { RAWTRACE4("getProperty(strObjID = %s, argc = %d, strCallbackID = %s, strJsVmID = %s)", strObjID.c_str(), argv.getSize(), strCallbackID.c_str(), strJsVmID.c_str()); #ifdef OS_ANDROID if ( jnienv() == 0 ) { rho_nativethread_start(); } #endif rho::apiGenerator::CMethodResult oRes; oRes.setRequestedType(CMethodResult::eString); rho::common::CInstanceClassFunctorBase<rho::apiGenerator::CMethodResult>* pFunctor = 0; int argc = argv.getSize(); rho::IMpos* pObj = rho::CMposFactoryBase::getInstance()->getModuleByID(strObjID); if ( argc == 0 ) { oRes.setArgError( "Wrong number of arguments: " + convertToStringA(argc) + " instead of " + convertToStringA(1) ); return oRes.toJSON(); } rho::String arg0 = ""; if ( argc > 0 ) { if ( argv[0].isString() ) { arg0 = argv[0].getStringObject(); } else if (!argv[0].isNull()) { oRes.setArgError( "Type error: argument " "0" " should be " "string" ); return oRes.toJSON(); } } oRes.setCallInUIThread(false); oRes.setJSCallback( strCallbackID ); oRes.setCallbackParam( strCallbackParam ); if ( oRes.hasCallback() ) { pFunctor = rho_makeInstanceClassFunctor2( pObj, &rho::IMpos::getProperty, arg0, oRes ); rho::CMposFactoryBase::getMposSingletonS()->addCommandToQueue( pFunctor ); } else { pObj->getProperty( arg0, oRes ); } return oRes.toJSON(); }
rho::String js_Barcode1_enumerate(rho::json::CJSONArray& argv, const rho::String& strObjID) { CMethodResult oRes; rho::common::IRhoRunnable* pFunctor = 0; bool bUseCallback = false; int argc = argv.getSize(); int nCallbackArg = 0; if ( argc > nCallbackArg ) { if ( !argv[nCallbackArg].isString() ) { oRes.setArgError(L"Type error: callback should be String"); return oRes.toJSON(); } oRes.setCallInUIThread(false); oRes.setRubyCallback( argv[nCallbackArg].getString() ); if ( argc > nCallbackArg + 1 ) { if ( !argv[nCallbackArg + 1].isString() ) { oRes.setArgError(L"Type error: callback parameter should be String"); return oRes.toJSON(); } oRes.setCallbackParam( argv[nCallbackArg + 1].getString() ); } } pFunctor = rho_makeInstanceClassFunctor1( CBarcode1FactoryBase::getBarcode1SingletonS(), &IBarcode1Singleton::enumerate, oRes ); if ( bUseCallback ) CBarcode1FactoryBase::getBarcode1SingletonS()->addCommandToQueue( pFunctor ); else { delete pFunctor; CBarcode1FactoryBase::getBarcode1SingletonS()->enumerate( oRes ); } return oRes.toJSON(); }
rho::String js_s_NativeBridgeTest_testFloat(const rho::String& strObjID, rho::json::CJSONArray& argv, const rho::String& strCallbackID, const rho::String& strJsVmID, const rho::String& strCallbackParam) { RAWTRACE4("testFloat(strObjID = %s, argc = %d, strCallbackID = %s, strJsVmID = %s)", strObjID.c_str(), argv.getSize(), strCallbackID.c_str(), strJsVmID.c_str()); #ifdef OS_ANDROID if ( jnienv() == 0 ) { rho_nativethread_start(); } #endif rho::apiGenerator::CMethodResult oRes; oRes.setRequestedType(CMethodResult::eDouble); rho::common::CInstanceClassFunctorBase<rho::apiGenerator::CMethodResult>* pFunctor = 0; int argc = argv.getSize(); if ( argc == 0 ) { oRes.setArgError( "Wrong number of arguments: " + convertToStringA(argc) + " instead of " + convertToStringA(1) ); return oRes.toJSON(); } double arg0 = 0; if ( argc > 0 ) { if ( argv[0].isFloat() ) arg0 = argv[0].getDouble(); else if ( argv[0].isInteger() ) arg0 = (int64)argv[0].getUInt64(); else if (!argv[0].isNull()) { oRes.setArgError("Type error: argument " "0" " should be " "float" ); return oRes.toJSON(); } } oRes.setCallInUIThread(false); oRes.setJSCallback( strCallbackID ); oRes.setCallbackParam( strCallbackParam ); if ( oRes.hasCallback() ) { pFunctor = rho_makeInstanceClassFunctor2( rho::CNativeBridgeTestFactoryBase::getNativeBridgeTestSingletonS(), &rho::INativeBridgeTestSingleton::testFloat, arg0, oRes ); rho::CNativeBridgeTestFactoryBase::getNativeBridgeTestSingletonS()->addCommandToQueue( pFunctor ); } else { rho::CNativeBridgeTestFactoryBase::getNativeBridgeTestSingletonS()->testFloat( arg0, oRes ); } return oRes.toJSON(); }
rho::String js_Barcode1_start(rho::json::CJSONArray& argv, const rho::String& strObjID) { CMethodResult oRes; rho::common::IRhoRunnable* pFunctor = 0; bool bUseCallback = false; int argc = argv.getSize(); int nCallbackArg = 0; IBarcode1* pObj = CBarcode1FactoryBase::getInstance()->getModuleByID(convertToStringW(strObjID)); if ( argc > nCallbackArg ) { oRes.setArgError(L"Wrong number of arguments: " + convertToStringW(argc) + L" instead of " + convertToStringW(0) ); return oRes.toJSON(); if ( !argv[nCallbackArg].isString() ) { oRes.setArgError(L"Type error: callback should be String"); return oRes.toJSON(); } oRes.setCallInUIThread(false); oRes.setRubyCallback( argv[nCallbackArg].getString() ); if ( argc > nCallbackArg + 1 ) { if ( !argv[nCallbackArg + 1].isString() ) { oRes.setArgError(L"Type error: callback parameter should be String"); return oRes.toJSON(); } oRes.setCallbackParam( argv[nCallbackArg + 1].getString() ); } } pFunctor = rho_makeInstanceClassFunctor1( pObj, &IBarcode1::start, oRes ); CBarcode1FactoryBase::getBarcode1SingletonS()->addCommandToQueue( pFunctor ); return oRes.toJSON(); }
rho::String js_s_Mpos_enumerate(const rho::String& strObjID, rho::json::CJSONArray& argv, const rho::String& strCallbackID, const rho::String& strJsVmID, const rho::String& strCallbackParam) { RAWTRACE3("enumerate(strObjID = %s, strCallbackID = %s, strJsVmID = %s)", strObjID.c_str(), strCallbackID.c_str(), strJsVmID.c_str()); #ifdef OS_ANDROID if ( jnienv() == 0 ) { rho_nativethread_start(); } #endif rho::apiGenerator::CMethodResult oRes; oRes.setParamName( "result" ); oRes.setJSObjectClassPath( "Rho.Mpos" ); oRes.setRequestedType(CMethodResult::eStringArray); rho::common::CInstanceClassFunctorBase<rho::apiGenerator::CMethodResult>* pFunctor = 0; int argc = argv.getSize(); oRes.setCallInUIThread(false); oRes.setJSCallback( strCallbackID ); oRes.setCallbackParam( strCallbackParam ); if ( oRes.hasCallback() ) { pFunctor = rho_makeInstanceClassFunctor1( rho::CMposFactoryBase::getMposSingletonS(), &rho::IMposSingleton::enumerate, oRes ); rho::CMposFactoryBase::getMposSingletonS()->addCommandToQueue( pFunctor ); } else { rho::CMposFactoryBase::getMposSingletonS()->enumerate( oRes ); } return oRes.toJSON(); }
rho::String js_Cordovabarcode_scan(const rho::String& strObjID, rho::json::CJSONArray& argv, const rho::String& strCallbackID, const rho::String& strJsVmID, const rho::String& strCallbackParam) { RAWTRACE2("%s(id=%s)", __FUNCTION__, strObjID.c_str()); MethodResultJni result(false); if(!result) { result.setError("JNI error: failed to initialize MethodResult java object"); RAWLOG_ERROR("JNI error: failed to initialize MethodResult java object ^^^"); return CMethodResultConvertor().toJSON(result); } ObjectProxy cordovabarcode(strObjID); int argc = argv.getSize(); if((argc < 1) || (argc > 1)) { result.setArgError("Wrong number of arguments"); RAWLOG_ERROR1("Wrong number of arguments: %d ^^^", argc); return CMethodResultConvertor().toJSON(result); } if(strCallbackID.length() != 0) { result.setCallBack(strCallbackID, strCallbackParam); } if(!result.hasCallback()) { if(!result.isError()) { result.setArgError("No callback handler provided"); } RAWLOG_ERROR1("Error setting callback: %s", result.getErrorMessage().c_str()); return CMethodResultConvertor().toJSON(result); } cordovabarcode.scan(argumentsAdapter(argv), result); rho::String res = CMethodResultConvertor().toJSON(result); RAWTRACE(res.c_str()); RAWTRACE2("%s(id=%s) end ^^^", __FUNCTION__, strObjID.c_str()); return res; }
rho::String js_s_SimpleOnlyStaticModule_joinStrings(rho::json::CJSONArray& argv, const rho::String& strObjID) { RAWTRACE2("%s(id=%s)", __FUNCTION__, strObjID.c_str()); MethodResultJni result; if(!result) { result.setError("JNI error: failed to initialize MethodResult java object"); RAWLOG_ERROR("JNI error: failed to initialize MethodResult java object ^^^"); return result.toJson(); } int argc = argv.getSize(); if((argc < 1) || (argc > 3)) { result.setArgError("Wrong number of arguments"); RAWLOG_ERROR1("Wrong number of arguments: %d ^^^", argc); return result.toJson(); } if(argc > 1) { if(argc > 2) result.setCallBack(argv[1], argv[2]); else result.setCallBack(argv[1]); if(!result.hasCallBackUrl()) { RAWLOG_ERROR("Error setting callback ^^^"); return result.toJson(); } } ObjectProxy::joinStrings(argumentsAdapter(argv), result); rho::String res = result.toJson(); RAWTRACE2("%s(id=%s) end ^^^", __FUNCTION__, strObjID.c_str()); return res; }
rho::String js_GenPropBag_getAllProperties(const rho::String& strObjID, rho::json::CJSONArray& argv, const rho::String& strCallbackID, const rho::String& strJsVmID, const rho::String& strCallbackParam) { RAWTRACE3("getAllProperties(strObjID = %s, strCallbackID = %s, strJsVmID = %s)", strObjID.c_str(), strCallbackID.c_str(), strJsVmID.c_str()); rho::apiGenerator::CMethodResult oRes; oRes.setRequestedType(CMethodResult::eStringHash); rho::common::CInstanceClassFunctorBase<rho::apiGenerator::CMethodResult>* pFunctor = 0; int argc = argv.getSize(); rho::IGenPropBag* pObj = rho::CGenPropBagFactoryBase::getInstance()->getModuleByID(strObjID); oRes.setCallInUIThread(false); oRes.setJSCallback( strCallbackID ); oRes.setCallbackParam( strCallbackParam ); if ( oRes.hasCallback() ) { pFunctor = rho_makeInstanceClassFunctor1( pObj, &rho::IGenPropBag::getAllProperties, oRes ); rho::CGenPropBagFactoryBase::getGenPropBagSingletonS()->addCommandToQueue( pFunctor ); } else { pObj->getAllProperties( oRes ); } return oRes.toJSON(); }
rho::String js_Barcode1_setProperties(rho::json::CJSONArray& argv, const rho::String& strObjID) { CMethodResult oRes; rho::common::IRhoRunnable* pFunctor = 0; bool bUseCallback = false; int argc = argv.getSize(); int nCallbackArg = 0; IBarcode1* pObj = CBarcode1FactoryBase::getInstance()->getModuleByID(convertToStringW(strObjID)); nCallbackArg = 1; if ( argc == 0 ) { oRes.setArgError(L"Wrong number of arguments: " + convertToStringW(argc) + L" instead of " + convertToStringW(1) ); return oRes.toJSON(); } rho::Hashtable<rho::StringW, rho::StringW> arg0; if ( argc > 0 ) { if ( argv[0].isObject() ) { CJSONStructIterator objIter(argv[0]); for( ; !objIter.isEnd(); objIter.next() ) { arg0[convertToStringW(objIter.getCurKey())] = convertToStringW(objIter.getCurString()); } } else if (!argv[0].isNull()) { oRes.setArgError(L"Type error: argument " L"0" L" should be " L"hash" ); return oRes.toJSON(); } } if ( argc > nCallbackArg ) { oRes.setArgError(L"Wrong number of arguments: " + convertToStringW(argc) + L" instead of " + convertToStringW(1) ); return oRes.toJSON(); if ( !argv[nCallbackArg].isString() ) { oRes.setArgError(L"Type error: callback should be String"); return oRes.toJSON(); } oRes.setCallInUIThread(false); oRes.setRubyCallback( argv[nCallbackArg].getString() ); if ( argc > nCallbackArg + 1 ) { if ( !argv[nCallbackArg + 1].isString() ) { oRes.setArgError(L"Type error: callback parameter should be String"); return oRes.toJSON(); } oRes.setCallbackParam( argv[nCallbackArg + 1].getString() ); } } pFunctor = rho_makeInstanceClassFunctor2( pObj, &IBarcode1::setProperties, arg0, oRes ); if ( bUseCallback ) CBarcode1FactoryBase::getBarcode1SingletonS()->addCommandToQueue( pFunctor ); else { delete pFunctor; pObj->setProperties( arg0, oRes ); } return oRes.toJSON(); }
rho::String js_WifiConfig_setProperties(const rho::String& strObjID, rho::json::CJSONArray& argv, const rho::String& strCallbackID, const rho::String& strJsVmID, const rho::String& strCallbackParam) { RAWTRACE3("setProperties(strObjID = %s, strCallbackID = %s, strJsVmID = %s)", strObjID.c_str(), strCallbackID.c_str(), strJsVmID.c_str()); rho::apiGenerator::CMethodResult oRes; rho::common::CInstanceClassFunctorBase<rho::apiGenerator::CMethodResult>* pFunctor = 0; int argc = argv.getSize(); rho::IWifiConfig* pObj = rho::CWifiConfigFactoryBase::getInstance()->getModuleByID(strObjID); if ( argc == 0 ) { oRes.setArgError( "Wrong number of arguments: " + convertToStringA(argc) + " instead of " + convertToStringA(1) ); return oRes.toJSON(); } rho::Hashtable<rho::String, rho::String> arg0; if ( argc > 0 ) { if ( argv[0].isObject() ) { CJSONStructIterator objIter(argv[0]); for( ; !objIter.isEnd(); objIter.next() ) { arg0[objIter.getCurKey()] = objIter.getCurString(); } } else if (!argv[0].isNull()) { oRes.setArgError("Type error: argument " "0" " should be " "hash" ); return oRes.toJSON(); } } if ( oRes.hasCallback() ) { pFunctor = rho_makeInstanceClassFunctor2( pObj, &rho::IWifiConfig::setProperties, arg0, oRes ); rho::CWifiConfigFactoryBase::getWifiConfigSingletonS()->addCommandToQueue( pFunctor ); } else { pObj->setProperties( arg0, oRes ); } return oRes.toJSON(); }
rho::String js_WifiConfig_setSimpleStringProperty(const rho::String& strObjID, rho::json::CJSONArray& argv, const rho::String& strCallbackID, const rho::String& strJsVmID, const rho::String& strCallbackParam) { RAWTRACE3("setSimpleStringProperty(strObjID = %s, strCallbackID = %s, strJsVmID = %s)", strObjID.c_str(), strCallbackID.c_str(), strJsVmID.c_str()); rho::apiGenerator::CMethodResult oRes; rho::common::CInstanceClassFunctorBase<rho::apiGenerator::CMethodResult>* pFunctor = 0; int argc = argv.getSize(); rho::IWifiConfig* pObj = rho::CWifiConfigFactoryBase::getInstance()->getModuleByID(strObjID); if ( argc == 0 ) { oRes.setArgError( "Wrong number of arguments: " + convertToStringA(argc) + " instead of " + convertToStringA(1) ); return oRes.toJSON(); } rho::String arg0 = ""; if ( argc > 0 ) { if ( argv[0].isString() ) { arg0 = argv[0].getString(); } else if (!argv[0].isNull()) { oRes.setArgError( "Type error: argument " "0" " should be " "string" ); return oRes.toJSON(); } } if ( oRes.hasCallback() ) { pFunctor = rho_makeInstanceClassFunctor2( pObj, &rho::IWifiConfig::setSimpleStringProperty, arg0, oRes ); rho::CWifiConfigFactoryBase::getWifiConfigSingletonS()->addCommandToQueue( pFunctor ); } else { pObj->setSimpleStringProperty( arg0, oRes ); } return oRes.toJSON(); }
rho::String js_WifiConfig_getProperties(const rho::String& strObjID, rho::json::CJSONArray& argv, const rho::String& strCallbackID, const rho::String& strJsVmID, const rho::String& strCallbackParam) { RAWTRACE3("getProperties(strObjID = %s, strCallbackID = %s, strJsVmID = %s)", strObjID.c_str(), strCallbackID.c_str(), strJsVmID.c_str()); rho::apiGenerator::CMethodResult oRes; oRes.setRequestedType(CMethodResult::eStringHash); rho::common::CInstanceClassFunctorBase<rho::apiGenerator::CMethodResult>* pFunctor = 0; int argc = argv.getSize(); rho::IWifiConfig* pObj = rho::CWifiConfigFactoryBase::getInstance()->getModuleByID(strObjID); if ( argc == 0 ) { oRes.setArgError( "Wrong number of arguments: " + convertToStringA(argc) + " instead of " + convertToStringA(1) ); return oRes.toJSON(); } rho::Vector<rho::String> arg0; if ( argc > 0 ) { if ( argv[0].isArray() ) { CJSONArray arParam(argv[0]); for( int i = 0; i < arParam.getSize(); i++ ) { arg0.addElement( arParam[i].getString() ); } } else if (!argv[0].isNull()) { oRes.setArgError("Type error: argument " "0" " should be " "array" ); return oRes.toJSON(); } } oRes.setCallInUIThread(false); oRes.setJSCallback( strCallbackID ); oRes.setCallbackParam( strCallbackParam ); if ( oRes.hasCallback() ) { pFunctor = rho_makeInstanceClassFunctor2( pObj, &rho::IWifiConfig::getProperties, arg0, oRes ); rho::CWifiConfigFactoryBase::getWifiConfigSingletonS()->addCommandToQueue( pFunctor ); } else { pObj->getProperties( arg0, oRes ); } return oRes.toJSON(); }
rho::String js_Cordovabarcode_scan(const rho::String& strObjID, rho::json::CJSONArray& argv, const rho::String& strCallbackID, const rho::String& strJsVmID, const rho::String& strCallbackParam) { RAWTRACE4("scan(strObjID = %s, argc = %d, strCallbackID = %s, strJsVmID = %s)", strObjID.c_str(), argv.getSize(), strCallbackID.c_str(), strJsVmID.c_str()); #ifdef OS_ANDROID if ( jnienv() == 0 ) { rho_nativethread_start(); } #endif rho::apiGenerator::CMethodResult oRes; oRes.setRequestedType(CMethodResult::eStringHash); rho::common::CInstanceClassFunctorBase<rho::apiGenerator::CMethodResult>* pFunctor = 0; int argc = argv.getSize(); rho::ICordovabarcode* pObj = rho::CCordovabarcodeFactoryBase::getInstance()->getModuleByID(strObjID); if ( argc == 0 ) { oRes.setArgError( "Wrong number of arguments: " + convertToStringA(argc) + " instead of " + convertToStringA(1) ); return oRes.toJSON(); } rho::Hashtable<rho::String, rho::String> arg0; if ( argc > 0 ) { CJSONEntry value(argv[0]); if ( value.isObject() ) { CJSONStructIterator objIter(value); for( ; !objIter.isEnd(); objIter.next() ) { arg0[objIter.getCurKey()] = objIter.getCurString(); } } else if (!value.isNull()) { oRes.setArgError("Type error: argument " "0" " should be " "hash" ); return oRes.toJSON(); } } oRes.setCallInUIThread(false); oRes.setJSCallback( strCallbackID ); oRes.setCallbackParam( strCallbackParam ); if ( !oRes.hasCallback() ) { oRes.setArgError("Callback argument is missed"); return oRes.toJSON(); } if ( oRes.hasCallback() ) { pFunctor = rho_makeInstanceClassFunctor2( pObj, &rho::ICordovabarcode::scan, arg0, oRes ); rho::CCordovabarcodeFactoryBase::getCordovabarcodeSingletonS()->addCommandToQueue( pFunctor ); } else { pObj->scan( arg0, oRes ); } return oRes.toJSON(); }
rho::String js_s_JavascriptVM_executeScript(rho::json::CJSONArray& argv, const rho::String& strObjID) { rho::apiGenerator::CMethodResult oRes; rho::common::IRhoRunnable* pFunctor = 0; bool bUseCallback = false; int argc = argv.getSize(); int nCallbackArg = 0; nCallbackArg = 1; if ( argc == 0 ) { oRes.setArgError(L"Wrong number of arguments: " + convertToStringW(argc) + L" instead of " + convertToStringW(1) ); return oRes.toJSON(); } rho::StringW arg0; if ( argc > 0 ) { if ( argv[0].isString() ) { arg0 = convertToStringW(argv[0].getString()); oRes.setStringParam(argv[0].getString()); } else if (!argv[0].isNull()) { oRes.setArgError(L"Type error: argument " L"0" L" should be " L"string" ); return oRes.toJSON(); } } if ( argc > nCallbackArg ) { oRes.setArgError(L"Wrong number of arguments: " + convertToStringW(argc) + L" instead of " + convertToStringW(1) ); return oRes.toJSON(); if ( !argv[nCallbackArg].isString() ) { oRes.setArgError(L"Type error: callback should be String"); return oRes.toJSON(); } oRes.setCallInUIThread(false); oRes.setRubyCallback( argv[nCallbackArg].getString() ); if ( argc > nCallbackArg + 1 ) { if ( !argv[nCallbackArg + 1].isString() ) { oRes.setArgError(L"Type error: callback parameter should be String"); return oRes.toJSON(); } oRes.setCallbackParam( argv[nCallbackArg + 1].getString() ); } } pFunctor = rho_makeInstanceClassFunctor2( rho::CJavascriptVMFactoryBase::getJavascriptVMSingletonS(), &rho::IJavascriptVMSingleton::executeScript, arg0, oRes ); if ( bUseCallback ) rho::CJavascriptVMFactoryBase::getJavascriptVMSingletonS()->addCommandToQueue( pFunctor ); else { delete pFunctor; rho::CJavascriptVMFactoryBase::getJavascriptVMSingletonS()->executeScript( arg0, oRes ); } return oRes.toJSON(); }
rho::String js_Mpos_calcSumm(const rho::String& strObjID, rho::json::CJSONArray& argv, const rho::String& strCallbackID, const rho::String& strJsVmID, const rho::String& strCallbackParam) { RAWTRACE4("calcSumm(strObjID = %s, argc = %d, strCallbackID = %s, strJsVmID = %s)", strObjID.c_str(), argv.getSize(), strCallbackID.c_str(), strJsVmID.c_str()); #ifdef OS_ANDROID if ( jnienv() == 0 ) { rho_nativethread_start(); } #endif rho::apiGenerator::CMethodResult oRes; oRes.setRequestedType(CMethodResult::eInt); rho::common::CInstanceClassFunctorBase<rho::apiGenerator::CMethodResult>* pFunctor = 0; int argc = argv.getSize(); rho::IMpos* pObj = rho::CMposFactoryBase::getInstance()->getModuleByID(strObjID); if ( argc == 0 ) { oRes.setArgError( "Wrong number of arguments: " + convertToStringA(argc) + " instead of " + convertToStringA(2) ); return oRes.toJSON(); } int arg0 = 0; if ( argc > 0 ) { if ( argv[0].isInteger() ) arg0 = argv[0].getInt(); else if (!argv[0].isNull()) { oRes.setArgError("Type error: argument " "0" " should be " "integer" ); return oRes.toJSON(); } } if ( argc == 1 ) { oRes.setArgError( "Wrong number of arguments: " + convertToStringA(argc) + " instead of " + convertToStringA(2) ); return oRes.toJSON(); } int arg1 = 0; if ( argc > 1 ) { if ( argv[1].isInteger() ) arg1 = argv[1].getInt(); else if (!argv[1].isNull()) { oRes.setArgError("Type error: argument " "1" " should be " "integer" ); return oRes.toJSON(); } } if ( oRes.hasCallback() ) { pFunctor = rho_makeInstanceClassFunctor3( pObj, &rho::IMpos::calcSumm, arg0, arg1, oRes ); rho::CMposFactoryBase::getMposSingletonS()->addCommandToQueue( pFunctor ); } else { pObj->calcSumm( arg0, arg1, oRes ); } return oRes.toJSON(); }
rho::String js_GenPropBag_setFloatProp(const rho::String& strObjID, rho::json::CJSONArray& argv, const rho::String& strCallbackID, const rho::String& strJsVmID, const rho::String& strCallbackParam) { RAWTRACE3("setFloatProp(strObjID = %s, strCallbackID = %s, strJsVmID = %s)", strObjID.c_str(), strCallbackID.c_str(), strJsVmID.c_str()); rho::apiGenerator::CMethodResult oRes; rho::common::CInstanceClassFunctorBase<rho::apiGenerator::CMethodResult>* pFunctor = 0; int argc = argv.getSize(); rho::IGenPropBag* pObj = rho::CGenPropBagFactoryBase::getInstance()->getModuleByID(strObjID); if ( argc == 0 ) { oRes.setArgError( "Wrong number of arguments: " + convertToStringA(argc) + " instead of " + convertToStringA(1) ); return oRes.toJSON(); } double arg0 = 0; if ( argc > 0 ) { if ( argv[0].isFloat() ) arg0 = argv[0].getDouble(); else if ( argv[0].isInteger() ) arg0 = (int64)argv[0].getUInt64(); else if (!argv[0].isNull()) { oRes.setArgError("Type error: argument " "0" " should be " "float" ); return oRes.toJSON(); } } if ( oRes.hasCallback() ) { pFunctor = rho_makeInstanceClassFunctor2( pObj, &rho::IGenPropBag::setFloatProp, arg0, oRes ); rho::CGenPropBagFactoryBase::getGenPropBagSingletonS()->addCommandToQueue( pFunctor ); } else { pObj->setFloatProp( arg0, oRes ); } return oRes.toJSON(); }
rho::String js_Barcode1_setProperty(rho::json::CJSONArray& argv, const rho::String& strObjID) { CMethodResult oRes; rho::common::IRhoRunnable* pFunctor = 0; bool bUseCallback = false; int argc = argv.getSize(); int nCallbackArg = 0; IBarcode1* pObj = CBarcode1FactoryBase::getInstance()->getModuleByID(convertToStringW(strObjID)); nCallbackArg = 1; if ( argc == 0 ) { oRes.setArgError(L"Wrong number of arguments: " + convertToStringW(argc) + L" instead of " + convertToStringW(2) ); return oRes.toJSON(); } rho::StringW arg0; if ( argc > 0 ) { if ( argv[0].isString() ) { arg0 = convertToStringW(argv[0].getString()); oRes.setStringParam(argv[0].getString()); } else if (!argv[0].isNull()) { oRes.setArgError(L"Type error: argument " L"0" L" should be " L"string" ); return oRes.toJSON(); } } nCallbackArg = 2; if ( argc == 1 ) { oRes.setArgError(L"Wrong number of arguments: " + convertToStringW(argc) + L" instead of " + convertToStringW(2) ); return oRes.toJSON(); } rho::StringW arg1; if ( argc > 1 ) { if ( argv[1].isString() ) { arg1 = convertToStringW(argv[1].getString()); } else if (!argv[1].isNull()) { oRes.setArgError(L"Type error: argument " L"1" L" should be " L"string" ); return oRes.toJSON(); } } if ( argc > nCallbackArg ) { oRes.setArgError(L"Wrong number of arguments: " + convertToStringW(argc) + L" instead of " + convertToStringW(2) ); return oRes.toJSON(); if ( !argv[nCallbackArg].isString() ) { oRes.setArgError(L"Type error: callback should be String"); return oRes.toJSON(); } oRes.setCallInUIThread(false); oRes.setRubyCallback( argv[nCallbackArg].getString() ); if ( argc > nCallbackArg + 1 ) { if ( !argv[nCallbackArg + 1].isString() ) { oRes.setArgError(L"Type error: callback parameter should be String"); return oRes.toJSON(); } oRes.setCallbackParam( argv[nCallbackArg + 1].getString() ); } } pFunctor = rho_makeInstanceClassFunctor3( pObj, &IBarcode1::setProperty, arg0, arg1, oRes ); if ( bUseCallback ) CBarcode1FactoryBase::getBarcode1SingletonS()->addCommandToQueue( pFunctor ); else { delete pFunctor; pObj->setProperty( arg0, arg1, oRes ); } return oRes.toJSON(); }