View my account

How to retrieve advanced mode options in C#?

Comments

2 comments

  • Eliza Davidov

    Hello F Cucchiara,

     

    Thank you for your interest in the Intel RealSense D435 camera.

     

    Please take a look at NativeMethods.cs file from C# wrapper, at line number 554: https://github.com/IntelRealSense/librealsense/blob/d6f6be84b46190c8c84c95f6ac279d239320fcda/wrappers/csharp/Intel.RealSense/NativeMethods.cs#L554 Here you have Advanced Modes defined in C#.

     

    Thank you and best regards,

    Eliza

    0
    Comment actions Permalink
  • F Cucchiara

    Thanks for the answer, Eliza!

    I could take a look at the NativeMethods.cs class and I tried to integrate it in my project. Something is still not clear for me, I'll try to explain it using as axample the rs2_get_slo_penalty_control method:

     

    internal static extern void rs2_get_slo_penalty_control(IntPtr dev, IntPtr group, int mode, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(ErrorMarshaler))] out object error);

     

    I found that a valid "dev" pointer value is AdvancedDevice.Handle:

     

    AdvancedDevice advancedDevice = AdvancedDevice.FromDevice(device);
    IntPtr devPtr = advancedDevice.Handle;

     

    But I couldn't find a way to create the "group" parameter structure, which in the C API is called STSloPenaltyControl:

     

    typedef struct
    {
      uint32_t sloK1Penalty;
      uint32_t sloK2Penalty;
      uint32_t sloK1PenaltyMod1;
      uint32_t sloK2PenaltyMod1;
      uint32_t sloK1PenaltyMod2;
      uint32_t sloK2PenaltyMod2;
     }STSloPenaltyControl;

     

    Am I missing something?

     

    Note: NativeMethods.cs class is marked as internal, so I had to create a new script, copy-and-paste the original file and then remove the "internal" keyword in order to access its methods without Reflections.

     

    Thanks,

    Francesco

     

     

     

     

    0
    Comment actions Permalink

Please sign in to leave a comment.