Example #1
0
        /// <summary>
        /// Get camera's parameter as float value.
        /// </summary>
        ///
        /// <param name="parameterName">Parameter name to get from camera.</param>
        ///
        /// <returns>Returns float value of the requested parameter.</returns>
        ///
        /// <remarks><para>See <see cref="CameraParameter"/> class for the list of some possible configuration parameters. See
        /// XIMEA documentation for the complete list of supported parameters.</para></remarks>
        ///
        ///
        public float GetParamFloat(string parameterName)
        {
            lock (_sync)
            {
                CheckConnection();

                ParameterType type = ParameterType.Float;

                int errorCode = XimeaAPI.xiGetParam(_deviceHandle, parameterName, out float value, out int size, ref type);
                HandleError(errorCode);

                return(value);
            }
        }
Example #2
0
        /// <summary>
        /// Get camera's parameter as integer value.
        /// </summary>
        ///
        /// <param name="parameterName">Parameter name to get from camera.</param>
        ///
        /// <returns>Returns integer value of the requested parameter.</returns>
        ///
        /// <remarks><para>See <see cref="CameraParameter"/> class for the list of some possible configuration parameters. See
        /// XIMEA documentation for the complete list of supported parameters.</para></remarks>
        ///
        /// <exception cref="VideoException">An error occurred while communicating with a camera. See error
        /// message for additional information.</exception>
        /// <exception cref="NotConnectedException">No camera was opened, so can not access its methods.</exception>
        ///
        public int GetParamInt(string parameterName)
        {
            lock ( sync )
            {
                CheckConnection( );

                int           value;
                int           size;
                ParameterType type = ParameterType.Integer;

                int errorCode = XimeaAPI.xiGetParam(deviceHandle, parameterName, out value, out size, ref type);
                HandleError(errorCode);

                return(value);
            }
        }
Example #3
0
        /// <summary>
        /// Get camera's parameter as string value.
        /// </summary>
        ///
        /// <param name="parameterName">Parameter name to get from camera.</param>
        ///
        /// <returns>Returns string value of the requested parameter.</returns>
        ///
        /// <remarks><para>See <see cref="CameraParameter"/> class for the list of some possible configuration parameters. See
        /// XIMEA documentation for the complete list of supported parameters.</para></remarks>
        ///
        /// <exception cref="VideoException">An error occurred while communicating with a camera. See error
        /// message for additional information.</exception>
        /// <exception cref="NotConnectedException">No camera was opened, so can not access its methods.</exception>
        ///
        public string GetParamString(string parameterName)
        {
            lock ( sync )
            {
                CheckConnection( );

                byte[]        bytes = new byte[260];
                int           size  = bytes.Length;
                ParameterType type  = ParameterType.String;

                unsafe
                {
                    fixed(byte *ptr = bytes)
                    {
                        int errorCode = XimeaAPI.xiGetParam(deviceHandle, parameterName, ptr, out size, ref type);

                        HandleError(errorCode);
                    }
                }

                return(Encoding.ASCII.GetString(bytes, 0, size));
            }
        }