Skip to content

The program crashes while executing GetStreamProfileList() #11

@LiubovPil

Description

@LiubovPil

Hi there!

I am using a ob_csharp.dll to handle streams for Orrbec Femto Bolt (firmwareVersion - 1.1.2) in my c# programm (WinUI3, net9.0)

My program fails while executing method GetStreamProfileList() (for Pipeline and Sensor classes). Another methods (for example, pipeline.GetDevice() or device.GetDeviceInfo()) don't crash the programm

public void GetStreamProfileList()
        {
            StreamProfileKeyList.Clear();

            Sensor currentSensor = device.GetSensor(sensorType);  //sensorType equals SensorType.OB_SENSOR_IR
            
            StreamProfileList streamProfileList;
            streamProfileList = currentSensor.GetStreamProfileList();   //also pipeline.GetStreamProfileList(sensorType) doesn't work

            for (int i = 0; i < streamProfileList.ProfileCount(); i++)
            {
                StreamProfile streamProfile = streamProfileList.GetProfile(i);
                if (streamProfile is VideoStreamProfile)
                {
                    VideoStreamProfile videoStreamProfile = (VideoStreamProfile)streamProfile;
                    streamProfileDict.Add(($"{sensorType}/{videoStreamProfile.GetWidth()}/" +
                        $"{videoStreamProfile.GetHeight()}/{videoStreamProfile.GetFPS()}/" +
                        $"{videoStreamProfile.GetFormat()}"), videoStreamProfile);
                }
                else if (streamProfile is AccelStreamProfile)
                {
                    AccelStreamProfile accelStreamProfile = (AccelStreamProfile)streamProfile;
                    streamProfileDict.Add(($"{sensorType}/{accelStreamProfile.GetFullScaleRange()}/" +
                        $"{accelStreamProfile.GetSampleRate()}"), accelStreamProfile);
                }
                else if (streamProfile is GyroStreamProfile)
                {
                    GyroStreamProfile gyroStreamProfile = (GyroStreamProfile)streamProfile;
                    streamProfileDict.Add(($"{sensorType}/{gyroStreamProfile.GetFullScaleRange()}/" +
                        $"{gyroStreamProfile.GetSampleRate()}"), gyroStreamProfile);
                }
                else
                {
                    streamProfileDict.Add(($"{sensorType}/no stream profile"), streamProfile);
                }
            }
        }

Did anyone have this problem?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions