How to use the plugin

Answered

Comments

19 comments

  • Avatar
    Andrey Terentyev

    Hello Takeshi,

    Here is the starting point for getting acquainted with the Nx Meta development.
    https://www.networkoptix.com/nx-meta/

    Here is the link to technical information
    https://support.networkoptix.com/hc/en-us/categories/360000737654-Develop-with-Nx-Meta

    > I added the sample files (stub_analytics_plugin.dll, sample_analytics_plugin.dll) built with v4.1 to the plugins directory of the server, but I don't see the plugin options in system administration
    Plugin files should placed in this derectory


    The server has to be restarted afterwards.

    0
    Comment actions Permalink
  • Avatar
    Takeshi Tanaka

    Thank you very much.

    By restarting the server (A server), I was able to confirm the application of the plug-in.

    Sorry to trouble you, but let me ask you another question.
    I want to apply the same plugin (.dll file) to another server (B server), but I can't apply it even if I follow the same steps.
    The software version is the same. (4.1.0.31398)

    I built a ".dll file" on server A, but I think it can be applied to server B as well.
    Do you have any tips to apply?

    0
    Comment actions Permalink
  • Avatar
    Andrey Terentyev

    Hello Takeshi,


    > I want to apply the same plugin (.dll file) to another server (B server), but I can't apply it even if I follow the same

    > I built a ".dll file" on server A, but I think it can be applied to server B as well.
    Just copying a plugin to B server It should work with no problem.

    Set log level to DEBUG on B server. Try again. Have a look at log_file.log of the Server. There should be messages from PluginManager.
    Make sure the B server has all the third party libs, frameworks your plugin is using.

    0
    Comment actions Permalink
  • Avatar
    Takeshi Tanaka

    I checked log_file.log.
    The following log was output,
    I checked the third party library, but all the ".dll files" shown in the error log were stored.
    I'm also checking why it can't be loaded, but if you have any hints, please let me know.

    2020-10-05 14:04:19.663 4760 ERROR PluginManager(0x24f3f8caf50): Failed loading Server Plugin [C:/Program Files/Network Optix/Nx Witness/MediaServer/plugins/axis_camera_plugin.dll] (): [cannotLoadLibrary]: Cannot load library C:\Program Files\Network Optix\Nx Witness\MediaServer\plugins\axis_camera_plugin.dll: 指定されたモジュールが見つかりません。
    2020-10-05 14:03:18.815 212c ERROR PluginManager(0x202911c7820): Failed loading Server Plugin [C:/Program Files/Network Optix/Nx Witness/MediaServer/plugins/image_library_plugin.dll] (): [cannotLoadLibrary]: Cannot load library C:\Program Files\Network Optix\Nx Witness\MediaServer\plugins\image_library_plugin.dll: 指定されたモジュールが見つかりません。
    2020-10-05 14:03:18.824 212c ERROR PluginManager(0x202911c7820): Failed loading Server Plugin [C:/Program Files/Network Optix/Nx Witness/MediaServer/plugins/sample_analytics_plugin.dll] (): [cannotLoadLibrary]: Cannot load library C:\Program Files\Network Optix\Nx Witness\MediaServer\plugins\sample_analytics_plugin.dll: 指定されたモジュールが見つかりません
    2020-10-05 14:03:18.828 212c ERROR PluginManager(0x202911c7820): Failed loading Server Plugin [C:/Program Files/Network Optix/Nx Witness/MediaServer/plugins/stub_analytics_plugin.dll] (): [cannotLoadLibrary]: Cannot load library C:\Program Files\Network Optix\Nx Witness\MediaServer\plugins\stub_analytics_plugin.dll: 指定されたモジュールが見つかりません。


    ※指定されたモジュールが見つかりません。(The specified module cannot be found.)
    0
    Comment actions Permalink
  • Avatar
    Andrey Terentyev

    Hi

    cannotLoadLibrary means the WinAPI LoadLibrary function can't load the .dll file.
    This fact indicates that the problem exists on the OS level.
    For example,
    - dynamically linked libs which plugin depends on are not accessible by the Server process.
    - ther are not sufficient permissions to access .dll files.
    - etc.

    As I see, all the four plugins are from the Meta SDKs and have been built by you. There is definitely something I can't know about your modification introduced to these plugins.
    Could you give more details on what changes have you made to the code?
    Could you share your code of stub_plugin, please? I' would to compile it and test in my lab.


    By the way,
    > The software version is the same. (4.1.0.31398)
    How have you determined this? Could you please share the screenshots of "System Administration->Updates..." dialog of both servers?

    0
    Comment actions Permalink
  • Avatar
    Takeshi Tanaka

    For the stub plugin code,
    I created the plugin without changing the downloaded SDK.

    * Download destination http://updates.networkoptix.com/default/31398/sdk/nxwitness-metadata_sdk-4.1.0.31398-universal.zip

    A server

    B server

     

     

    0
    Comment actions Permalink
  • Avatar
    Takeshi Tanaka
     
    I have confirmed that the same error log is output when I try it on another laptop computer.
    I hope for your reference.
    0
    Comment actions Permalink
  • Avatar
    Andrey Terentyev

    Hello Takeshi,

    I created a ticket. Let's move our discussion to the ticket system. Please, check out email.

    The solution will be published here after the investigation.

    0
    Comment actions Permalink
  • Avatar
    Andrey Terentyev

    Hello Takeshi,

    Since remote session is not possible let's move further here.

    I suppose there are OS level limitations for loading plugin library.

    - os filelevel permisstions
    - antivirus, DLP or other security software
    - etc.

    I suggest you creating a clear, empty windows virtual machine and test your scenarios in it.

    Could you share the binary of your compiled plugin, please?

    0
    Comment actions Permalink
  • Avatar
    Takeshi Tanaka

    Thank you for your continued consultation.

    You can't attach files here,
    I have attached the compiled plugin binary here.
    https://support.networkoptix.com/hc/en-us/requests/23505

    0
    Comment actions Permalink
  • Avatar
    Andrey Terentyev

    Hi,

    Thanks. I got it.

    Please, calculate the checksum for .dll files: the one from A server, and the one from B server, the one you've sent me.
    Do check sums differ?

    0
    Comment actions Permalink
  • Avatar
    Andrey Terentyev

    Takeshi,

    I tried the .dll you've sent. It can't be load. The same error.

    I've recompiled the sample plugin form the nxwitness-metadata_sdk-4.1.0.31398-universal.zip sources in my lab VM.

    I have Visual Studio 12017

    The .dll file is 928KB

    The file you've sent has 791KB. It seems to be Debug version, too, but it's obviously modified.

    Which version of Visual Studio are you using?

    0
    Comment actions Permalink
  • Avatar
    Takeshi Tanaka

    Hello

    When I ran the checksum, both gave the same result.
    The result will be posted to the png file. Above is Server A and below is the result of the uploaded file.

    Visual Studio is using 2019 Professional.

    The prerequisites for readme.md are:
    --CMake> = 3.3.2
    -Windows (7 or 10): Microsoft Visual Studio> = 2015

    Is there a problem with the 2019 Professional settings?
    I got the following error, so I changed the build tool from "v142" to "v140" and ran the build.
    ---
    Error MSB8020: Visual Studio 2015 build tool not found (Platform Toolset ='v140').
    ---


    0
    Comment actions Permalink
  • Avatar
    Andrey Terentyev

    Hello Takeshi,

    The root cause of the issue is following.

    By default, the Debug version is compiled by the build_samples.bat script.

    VS studio links to the plugin .dll file special debug libraries available on the machine the .dll is being compiled (A server), but which are NOT available on the B server. See the screenshot.
    On the left - release version.
    On the right - debug version. Pay attention to the "D" letter before the file extension.

    The solution is building the release version.

    build_samples.bat --release
    0
    Comment actions Permalink
  • Avatar
    Takeshi Tanaka

    > build_samples.bat --release

    With the .dll file created in the release build,
    The plugin also worked on the B server.
    Thanks to that, the problem was solved.

    Thank you very much for your consultation.

    0
    Comment actions Permalink
  • Avatar
    lechee lai

    any idea using VS 2019 sdk 4.1.0.31398 with build_samples.bat --release

     

    1>------ Build started: Project: ZERO_CHECK, Configuration: Debug|x64 ------
    1> Checking Build System
    2>------ Build started: Project: nx_kit, Configuration: Debug|x64 ------
    2> Building Custom Rule C:/opt/app/nx_sdk/nx_kit/CMakeLists.txt
    2> utils.cpp
    2> debug.cpp
    2> ini_config.cpp
    2> output_redirector.cpp
    2> test.cpp
    2> json.cpp
    2> Generating Code...
    2> nx_kit.vcxproj -> C:\opt\app\nx_sdk-build\sample_analytics_plugin\nx_kit\Debug\nx_kit.lib
    3>------ Build started: Project: nx_sdk, Configuration: Debug|x64 ------
    3> Building Custom Rule C:/opt/app/nx_sdk/samples/sample_analytics_plugin/CMakeLists.txt
    3> consuming_device_agent.cpp
    3> engine.cpp
    3> engine_info.cpp
    3> event_metadata.cpp
    3> event_metadata_packet.cpp
    3> metadata_types.cpp
    3> object_metadata.cpp
    3> object_metadata_packet.cpp
    3> object_track_best_shot_packet.cpp
    3> object_track_info.cpp
    3> pixel_format.cpp
    3> plugin.cpp
    3> timestamped_object_metadata.cpp
    3> attribute.cpp
    3> device_info.cpp
    3> error.cpp
    3> lib_context.cpp
    3> log_utils.cpp
    3> media_stream_statistics.cpp
    3> plugin_diagnostic_event.cpp
    3> Generating Code...
    3> Compiling...
    3> settings_response.cpp
    3>C:\opt\app\nx_sdk\src\nx\sdk\uuid.h(11,29): error C2065: 'uint8_t': undeclared identifier
    3>C:\opt\app\nx_sdk\src\nx\sdk\uuid.h(11,23): error C2923: 'std::array': 'uint8_t' is not a valid template type argument for parameter '_Ty'
    3>C:\opt\app\nx_sdk\src\nx\sdk\uuid.h(22,1): error C2955: 'std::array': use of class template requires template argument list
    3>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\include\array(418): message : see declaration of 'std::array'
    3>C:\opt\app\nx_sdk\src\nx\sdk\uuid.h(24,56): error C3203: 'array': unspecialized class template can't be used as a template argument for template parameter '_Tuple', expected a real type
    3>C:\opt\app\nx_sdk\src\nx\sdk\uuid.h(24,65): error C2027: use of undefined type 'std::tuple_size<int>'
    3>C:\opt\app\nx_sdk\src\nx/sdk/uuid.h(24): message : see declaration of 'std::tuple_size<int>'
    3>C:\opt\app\nx_sdk\src\nx\sdk\uuid.h(27,19): error C2061: syntax error: identifier 'uint8_t'
    3>C:\opt\app\nx_sdk\src\nx\sdk\uuid.h(37,18): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    3>C:\opt\app\nx_sdk\src\nx\sdk\uuid.h(37,18): error C2059: syntax error: '&'
    3>C:\opt\app\nx_sdk\src\nx\sdk\uuid.h(37,18): error C2090: function returns array
    3>C:\opt\app\nx_sdk\src\nx\sdk\uuid.h(42,19): error C2535: 'nx::sdk::Uuid::Uuid(void)': member function already defined or declared
    3>C:\opt\app\nx_sdk\src\nx/sdk/uuid.h(27): message : see declaration of 'nx::sdk::Uuid::Uuid'
    3>C:\opt\app\nx_sdk\src\nx\sdk\uuid.h(33,19): error C2065: 'b0': undeclared identifier
    3>C:\opt\app\nx_sdk\src\nx\sdk\uuid.h(33,23): error C2065: 'b1': undeclared identifier
    3>C:\opt\app\nx_sdk\src\nx\sdk\uuid.h(33,27): error C2065: 'b2': undeclared identifier
    3>C:\opt\app\nx_sdk\src\nx\sdk\uuid.h(33,31): error C2065: 'b3': undeclared identifier
    3>C:\opt\app\nx_sdk\src\nx\sdk\uuid.h(33,35): error C2065: 'b4': undeclared identifier
    3>C:\opt\app\nx_sdk\src\nx\sdk\uuid.h(33,39): error C2065: 'b5': undeclared identifier
    3>C:\opt\app\nx_sdk\src\nx\sdk\uuid.h(33,43): error C2065: 'b6': undeclared identifier
    3>C:\opt\app\nx_sdk\src\nx\sdk\uuid.h(33,47): error C2065: 'b7': undeclared identifier
    3>C:\opt\app\nx_sdk\src\nx\sdk\uuid.h(33,51): error C2065: 'b8': undeclared identifier
    3>C:\opt\app\nx_sdk\src\nx\sdk\uuid.h(33,55): error C2065: 'b9': undeclared identifier
    3>C:\opt\app\nx_sdk\src\nx\sdk\uuid.h(33,59): error C2065: 'bA': undeclared identifier
    3>C:\opt\app\nx_sdk\src\nx\sdk\uuid.h(33,63): error C2065: 'bB': undeclared identifier
    3>C:\opt\app\nx_sdk\src\nx\sdk\uuid.h(33,67): error C2065: 'bC': undeclared identifier
    3>C:\opt\app\nx_sdk\src\nx\sdk\uuid.h(33,71): error C2065: 'bD': undeclared identifier
    3>C:\opt\app\nx_sdk\src\nx\sdk\uuid.h(33,75): error C2065: 'bE': undeclared identifier
    3>C:\opt\app\nx_sdk\src\nx\sdk\uuid.h(33,79): error C2065: 'bF': undeclared identifier
    3>C:\opt\app\nx_sdk\src\nx\sdk\uuid.h(33,9): error C2614: 'nx::sdk::Uuid': illegal member initialization: 'UuidBase' is not a base or member
    3>C:\opt\app\nx_sdk\src\nx\sdk\uuid.h(39,16): error C3861: 'data': identifier not found
    3>C:\opt\app\nx_sdk\src\nx\sdk\uuid.h(39,24): error C2065: 'byteArray': undeclared identifier
    3>C:\opt\app\nx_sdk\src\nx\sdk\uuid.h(42,23): error C2614: 'nx::sdk::Uuid': illegal member initialization: 'UuidBase' is not a base or member
    3>C:\opt\app\nx_sdk\src\nx\sdk\uuid.h(44,40): error C2676: binary '==': 'const nx::sdk::Uuid' does not define this operator or a conversion to a type acceptable to the predefined operator
    3> string.cpp
    3>C:\opt\app\nx_sdk\src\nx\sdk\uuid.h(11,29): error C2065: 'uint8_t': undeclared identifier
    3>C:\opt\app\nx_sdk\src\nx\sdk\uuid.h(11,23): error C2923: 'std::array': 'uint8_t' is not a valid template type argument for parameter '_Ty'
    3>C:\opt\app\nx_sdk\src\nx\sdk\uuid.h(22,1): error C2955: 'std::array': use of class template requires template argument list
    3>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\include\array(418): message : see declaration of 'std::array'
    3>C:\opt\app\nx_sdk\src\nx\sdk\uuid.h(24,56): error C3203: 'array': unspecialized class template can't be used as a template argument for template parameter '_Tuple', expected a real type
    3>C:\opt\app\nx_sdk\src\nx\sdk\uuid.h(24,65): error C2027: use of undefined type 'std::tuple_size<int>'
    3>C:\opt\app\nx_sdk\src\nx/sdk/uuid.h(24): message : see declaration of 'std::tuple_size<int>'
    3>C:\opt\app\nx_sdk\src\nx\sdk\uuid.h(27,19): error C2061: syntax error: identifier 'uint8_t'
    3>C:\opt\app\nx_sdk\src\nx\sdk\uuid.h(37,18): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    3>C:\opt\app\nx_sdk\src\nx\sdk\uuid.h(37,18): error C2059: syntax error: '&'
    3>C:\opt\app\nx_sdk\src\nx\sdk\uuid.h(37,18): error C2090: function returns array
    3>C:\opt\app\nx_sdk\src\nx\sdk\uuid.h(42,19): error C2535: 'nx::sdk::Uuid::Uuid(void)': member function already defined or declared
    3>C:\opt\app\nx_sdk\src\nx/sdk/uuid.h(27): message : see declaration of 'nx::sdk::Uuid::Uuid'
    3>C:\opt\app\nx_sdk\src\nx\sdk\uuid.h(33,19): error C2065: 'b0': undeclared identifier
    3>C:\opt\app\nx_sdk\src\nx\sdk\uuid.h(33,23): error C2065: 'b1': undeclared identifier
    3>C:\opt\app\nx_sdk\src\nx\sdk\uuid.h(33,27): error C2065: 'b2': undeclared identifier
    3>C:\opt\app\nx_sdk\src\nx\sdk\uuid.h(33,31): error C2065: 'b3': undeclared identifier
    3>C:\opt\app\nx_sdk\src\nx\sdk\uuid.h(33,35): error C2065: 'b4': undeclared identifier
    3>C:\opt\app\nx_sdk\src\nx\sdk\uuid.h(33,39): error C2065: 'b5': undeclared identifier
    3>C:\opt\app\nx_sdk\src\nx\sdk\uuid.h(33,43): error C2065: 'b6': undeclared identifier
    3>C:\opt\app\nx_sdk\src\nx\sdk\uuid.h(33,47): error C2065: 'b7': undeclared identifier
    3>C:\opt\app\nx_sdk\src\nx\sdk\uuid.h(33,51): error C2065: 'b8': undeclared identifier
    3>C:\opt\app\nx_sdk\src\nx\sdk\uuid.h(33,55): error C2065: 'b9': undeclared identifier
    3>C:\opt\app\nx_sdk\src\nx\sdk\uuid.h(33,59): error C2065: 'bA': undeclared identifier
    3>C:\opt\app\nx_sdk\src\nx\sdk\uuid.h(33,63): error C2065: 'bB': undeclared identifier
    3>C:\opt\app\nx_sdk\src\nx\sdk\uuid.h(33,67): error C2065: 'bC': undeclared identifier
    3>C:\opt\app\nx_sdk\src\nx\sdk\uuid.h(33,71): error C2065: 'bD': undeclared identifier
    3>C:\opt\app\nx_sdk\src\nx\sdk\uuid.h(33,75): error C2065: 'bE': undeclared identifier
    3>C:\opt\app\nx_sdk\src\nx\sdk\uuid.h(33,79): error C2065: 'bF': undeclared identifier
    3>C:\opt\app\nx_sdk\src\nx\sdk\uuid.h(33,9): error C2614: 'nx::sdk::Uuid': illegal member initialization: 'UuidBase' is not a base or member
    3>C:\opt\app\nx_sdk\src\nx\sdk\uuid.h(39,16): error C3861: 'data': identifier not found
    3>C:\opt\app\nx_sdk\src\nx\sdk\uuid.h(39,24): error C2065: 'byteArray': undeclared identifier
    3>C:\opt\app\nx_sdk\src\nx\sdk\uuid.h(42,23): error C2614: 'nx::sdk::Uuid': illegal member initialization: 'UuidBase' is not a base or member
    3>C:\opt\app\nx_sdk\src\nx\sdk\uuid.h(44,40): error C2676: binary '==': 'const nx::sdk::Uuid' does not define this operator or a conversion to a type acceptable to the predefined operator
    3> string_list.cpp
    3> string_map.cpp
    3> to_string.cpp
    3> uuid_helper.cpp
    3> Generating Code...
    4>------ Build started: Project: sample_analytics_plugin, Configuration: Debug|x64 ------
    4> Building Custom Rule C:/opt/app/nx_sdk/samples/sample_analytics_plugin/CMakeLists.txt
    4> device_agent.cpp
    4> engine.cpp
    4> plugin.cpp
    4> Generating Code...
    4>C:\opt\app\nx_sdk-build\sample_analytics_plugin\LINK : fatal error LNK1104: cannot open file 'Debug\nx_sdk.lib'
    5>------ Build started: Project: ALL_BUILD, Configuration: Debug|x64 ------
    5> Building Custom Rule C:/opt/app/nx_sdk/samples/sample_analytics_plugin/CMakeLists.txt

    0
    Comment actions Permalink
  • Avatar
    Andrey Terentyev

    Hello lechee,

    > error C2065: 'uint8_t': undeclared identifier

    There is something wrong with your Visual Studio environment. Some standard header file is missing or a path to the header is not in the include list. uint8_t is a basic type and has no relation to Metadata SDK.

    See https://docs.microsoft.com/ru-ru/cpp/error-messages/compiler-errors-1/compiler-error-c2065?view=vs-2019

    0
    Comment actions Permalink
  • Avatar
    Andrey Terentyev

    Hello Iechee,

    Please include <stdint.h> in the metadata_sdk\src\nx\sdk\uuid.h. Like

    #include <stdint.h>

    This should solve the problem.

    0
    Comment actions Permalink
  • Avatar
    lechee lai

    That's great problem solved :-)

    0
    Comment actions Permalink

Please sign in to leave a comment.