diff --git a/examples/jupyter/va_notebook_example.ipynb b/examples/jupyter/va_notebook_example.ipynb index bcbc074c3e1e3b793e7c6a6694fdc832945a4458..7536198be2971cf6eef4abdbbce93464c3ff3bd5 100644 --- a/examples/jupyter/va_notebook_example.ipynb +++ b/examples/jupyter/va_notebook_example.ipynb @@ -14,9 +14,8 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": null, "metadata": { - "collapsed": true, "scrolled": false }, "outputs": [], @@ -37,21 +36,9 @@ }, { "cell_type": "code", - "execution_count": 3, - "metadata": {}, - "outputs": [ - { - "ename": "ImportError", - "evalue": "DLL load failed: Das angegebene Modul wurde nicht gefunden.", - "output_type": "error", - "traceback": [ - "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[1;31mImportError\u001b[0m Traceback (most recent call last)", - "\u001b[1;32m<ipython-input-3-9508d0d3eded>\u001b[0m in \u001b[0;36m<module>\u001b[1;34m()\u001b[0m\n\u001b[1;32m----> 1\u001b[1;33m \u001b[1;32mimport\u001b[0m \u001b[0mva\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m", - "\u001b[1;31mImportError\u001b[0m: DLL load failed: Das angegebene Modul wurde nicht gefunden." - ] - } - ], + "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "import va" ] @@ -73,9 +60,7 @@ { "cell_type": "code", "execution_count": null, - "metadata": { - "collapsed": true - }, + "metadata": {}, "outputs": [], "source": [ "connection_status = va.connect()" @@ -91,9 +76,7 @@ { "cell_type": "code", "execution_count": null, - "metadata": { - "collapsed": true - }, + "metadata": {}, "outputs": [], "source": [ "connected = va.is_connected()\n", @@ -113,9 +96,7 @@ { "cell_type": "code", "execution_count": null, - "metadata": { - "collapsed": true - }, + "metadata": {}, "outputs": [], "source": [ "if not connected :\n", @@ -125,9 +106,7 @@ { "cell_type": "code", "execution_count": null, - "metadata": { - "collapsed": true - }, + "metadata": {}, "outputs": [], "source": [ "import os\n", @@ -145,9 +124,7 @@ { "cell_type": "code", "execution_count": null, - "metadata": { - "collapsed": true - }, + "metadata": {}, "outputs": [], "source": [ "va.add_search_path( current_working_dir )" @@ -156,23 +133,32 @@ { "cell_type": "code", "execution_count": null, - "metadata": { - "collapsed": true - }, + "metadata": {}, "outputs": [], "source": [ - "vamods = va.enumerate_modules()\n", + "vamods = va.get_modules()\n", "print( vamods )" ] }, { "cell_type": "code", "execution_count": null, - "metadata": { - "collapsed": true - }, + "metadata": {}, "outputs": [], - "source": [] + "source": [ + "hw = va.get_hardware_configuration()\n", + "print( hw )" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "core_conf = va.get_core_configuration()\n", + "print( core_conf )" + ] } ], "metadata": { diff --git a/src/vasingleton.cpp b/src/vasingleton.cpp index 492254930730ccfcb89e71266d361c133de1ade6..3155c41db8f5e8fe40de41bf790618af3781e1c6 100644 --- a/src/vasingleton.cpp +++ b/src/vasingleton.cpp @@ -147,6 +147,9 @@ static struct PyMethodDef va_methods[] = { "set_core_clock", ( PyCFunction ) set_core_clock, METH_FASTCALL, no_doc }, { "substitute_macro", ( PyCFunction ) substitute_macro, METH_FASTCALL, no_doc }, { "find_file_path", ( PyCFunction ) find_file_path, METH_FASTCALL, no_doc }, + { "get_core_configuration", ( PyCFunction ) get_core_configuration, METH_FASTCALL, no_doc }, + { "get_hardware_configuration", ( PyCFunction ) get_hardware_configuration, METH_FASTCALL, no_doc }, + { "get_file_list", ( PyCFunction ) get_file_list, METH_FASTCALL, no_doc }, { "get_log_level_str", ( PyCFunction ) get_log_level_str, METH_FASTCALL, no_doc }, { "parse_auralization_mode_str", ( PyCFunction ) parse_auralization_mode_str, METH_FASTCALL, no_doc }, { "get_auralization_mode_str", ( PyCFunction ) get_auralization_mode_str, METH_FASTCALL, no_doc }, diff --git a/src/vasingletonmethods.hpp b/src/vasingletonmethods.hpp index 8cd0fce6770ffc650939cc2c958060c87ba2988b..396bdf73a729ae3227e03bf1a9bcf307e81ddf36 100644 --- a/src/vasingletonmethods.hpp +++ b/src/vasingletonmethods.hpp @@ -2153,6 +2153,50 @@ static PyObject* find_file_path( PyObject*, PyObject** ppArgs, Py_ssize_t nArgs, VAPY_CATCH_RETURN; }; +static PyObject* get_core_configuration( PyObject*, PyObject** ppArgs, Py_ssize_t nArgs, PyObject* pKeywordNames ) +{ + VAPY_REQUIRE_CONN_TRY; + + static const char * const _keywords[] = { "filter_enabled", NULL }; + static _PyArg_Parser _parser = { "|b:get_core_configuration", _keywords, 0 }; + bool bFilterEnabled = true; + if( !_PyArg_ParseStack( ppArgs, nArgs, pKeywordNames, &_parser, &bFilterEnabled ) ) + return NULL; + + CVAStruct oCoreConfig = g_pVANetClient->GetCoreInstance()->GetCoreConfiguration( bFilterEnabled ); + return ConvertVAStructToPythonDict( oCoreConfig ); + + VAPY_CATCH_RETURN; +}; + +static PyObject* get_hardware_configuration( PyObject*, PyObject**, Py_ssize_t, PyObject* ) +{ + VAPY_REQUIRE_CONN_TRY; + + CVAStruct oHWConfig = g_pVANetClient->GetCoreInstance()->GetHardwareConfiguration(); + return ConvertVAStructToPythonDict( oHWConfig ); + + VAPY_CATCH_RETURN; +}; + +static PyObject* get_file_list( PyObject*, PyObject** ppArgs, Py_ssize_t nArgs, PyObject* pKeywordNames ) +{ + VAPY_REQUIRE_CONN_TRY; + + static const char * const _keywords[] = { "recursive", "filter_suffix_mask", NULL }; + static _PyArg_Parser _parser = { "|bs:get_file_list", _keywords, 0 }; + bool bFilterEnabled = true; + char* pcFilterSuffixMask = nullptr; + if( !_PyArg_ParseStack( ppArgs, nArgs, pKeywordNames, &_parser, &bFilterEnabled, &pcFilterSuffixMask ) ) + return NULL; + + std::string sFilterSuffixMask = pcFilterSuffixMask ? std::string( pcFilterSuffixMask ) : "*"; + CVAStruct oFileList = g_pVANetClient->GetCoreInstance()->GetFileList( bFilterEnabled, sFilterSuffixMask ); + return ConvertVAStructToPythonDict( oFileList ); + + VAPY_CATCH_RETURN; +}; + static PyObject* get_log_level_str( PyObject*, PyObject** ppArgs, Py_ssize_t nArgs, PyObject* pKeywordNames ) {