Esempio n. 1
0
        /// <summary>
        /// Retrieve the value for a specific camera feature.
        /// </summary>
        /// <returns>The feature value.</returns>
        /// <param name="feature">Feature name.</param>
        public int GetFeature(string feature)
        {
            int result = 0;

            Psinc.GetFeature(this.camera, feature, out result);

            return(result);
        }
Esempio n. 2
0
 /// <summary>
 /// Write a block of data to a device.
 /// </summary>
 /// <returns><c>true</c>, if successful, <c>false</c> otherwise.</returns>
 /// <param name="device">Name of device.</param>
 /// <param name="buffer">Buffer to be written.</param>
 public bool DeviceWrite(string device, byte [] buffer)
 {
     unsafe
     {
         fixed(byte *data = buffer)
         {
             return(Psinc.DeviceWrite(this.camera, device, (IntPtr)data, buffer.Length) == (int)ReturnCodes.Ok);
         }
     }
 }
Esempio n. 3
0
        /// <summary>
        /// Read a block of data from a device
        /// </summary>
        /// <returns>The number of bytes read or 0 if unsuccessful.</returns>
        /// <param name="device">Name of device.</param>
        /// <param name="buffer">Buffer in which to write the data.</param>
        public int DeviceRead(string device, byte [] buffer)
        {
            int used = 0;

            unsafe
            {
                fixed(byte *data = buffer)
                {
                    if (Psinc.DeviceRead(this.camera, device, (IntPtr)data, buffer.Length, out used) == (int)ReturnCodes.Ok)
                    {
                        return(used);
                    }
                }
            }

            return(0);
        }
Esempio n. 4
0
        /// <summary>
        /// Grab an HDR frame from context A and B in rapid succession.Camera is restored to context A when
        /// complete.
        /// </summary>
        /// <returns><c>true</c>, if successful, <c>false</c> otherwise.</returns>
        /// <param name="imageA">Instance of image in which to write the grabbed frame for context A.</param>
        /// <param name="flashA">Required flash power for context A.</param>
        /// <param name="imageB">Instance of image in which to write the grabbed frame for context B.</param>
        /// <param name="flashB">Required flash power for context B.</param>
        public bool GrabMultiple(ImageHDR imageA, byte flashA, ImageHDR imageB, byte flashB)
        {
            bool result = false;

            Psinc.SetContext(this.camera, 0);
            Psinc.SetFlash(this.camera, flashA);

            if (Psinc.GrabHDR(this.camera, imageA.Pointer) == (int)ReturnCodes.Ok)
            {
                Psinc.SetContext(this.camera, 1);
                Psinc.SetFlash(this.camera, flashB);

                result = Psinc.GrabHDR(this.camera, imageB.Pointer) == (int)ReturnCodes.Ok;

                Psinc.SetContext(this.camera, 0);
            }

            return(result);
        }
Esempio n. 5
0
 /// <summary>
 /// Releases all resource used by the <see cref="libpsinc.Camera"/> object.
 /// </summary>
 /// <remarks>Call <see cref="Dispose"/> when you are finished using the <see cref="libpsinc.Camera"/>. The
 /// <see cref="Dispose"/> method leaves the <see cref="libpsinc.Camera"/> in an unusable state. After calling
 /// <see cref="Dispose"/>, you must release all references to the <see cref="libpsinc.Camera"/> so the garbage
 /// collector can reclaim the memory that the <see cref="libpsinc.Camera"/> was occupying.</remarks>
 public void Dispose()
 {
     Psinc.Delete(this.camera);
 }
Esempio n. 6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="libpsinc.Camera"/> class.
 /// </summary>
 public Camera()
 {
     this.camera = Psinc.Create();
 }
Esempio n. 7
0
 /// <summary>
 /// Enable logging to the console with "info" level verbosity. Only
 /// necessary to call this once at the start of an application.
 /// </summary>
 public static void EnableLogging()
 {
     Psinc.EnableLogging();
 }
Esempio n. 8
0
 /// <summary>
 /// Write a single byte to a device.
 /// </summary>
 /// <returns><c>true</c>, if successful, <c>false</c> otherwise.</returns>
 /// <param name="device">Name of device.</param>
 /// <param name="value">Value to transmit.</param>
 public bool DeviceWrite(string device, byte value)
 {
     return(Psinc.DeviceWriteByte(this.camera, device, value) == (int)ReturnCodes.Ok);
 }
Esempio n. 9
0
 /// <summary>
 /// Send an initialisation value to a device
 /// </summary>
 /// <returns><c>true</c>, if successful, <c>false</c> otherwise.</returns>
 /// <param name="device">Name of device.</param>
 /// <param name="configuration">Configuration value.</param>
 public bool DeviceInitialise(string device, byte configuration)
 {
     return(Psinc.DeviceInitialise(this.camera, device, configuration) == (int)ReturnCodes.Ok);
 }
Esempio n. 10
0
 /// <summary>
 /// Set the camera context (where supported).
 /// </summary>
 /// <param name="context">Context index.</param>
 public bool SetContext(byte context)
 {
     return(Psinc.SetContext(this.camera, context) == (int)ReturnCodes.Ok);
 }
Esempio n. 11
0
 /// <summary>
 /// Sets the flash power (0 for disabled).
 /// </summary>
 /// <param name="power">Power level.</param>
 public bool SetFlash(byte power)
 {
     return(Psinc.SetFlash(this.camera, power) == (int)ReturnCodes.Ok);
 }
Esempio n. 12
0
 /// <summary>
 /// Set a specific camera feature to the given value.
 /// </summary>
 /// <param name="feature">Feature name.</param>
 /// <param name="value">Value to set</param>
 public bool SetFeature(string feature, int value)
 {
     return(Psinc.SetFeature(this.camera, feature, value) == (int)ReturnCodes.Ok);
 }
Esempio n. 13
0
 /// <summary>
 /// Grab an HDR frame and write to the supplied image instance. This function blocks until
 /// an image has been grabbed or an error occurrs.
 /// </summary>
 /// <returns>True if a camera was connected and an image was succesfully grabbed.</returns>
 /// <param name="image">Instance of image in which to write the grabbed frame.</param>
 public bool Grab(ImageHDR image)
 {
     return(Psinc.GrabHDR(this.camera, image.Pointer) == (int)ReturnCodes.Ok);
 }
Esempio n. 14
0
 /// <summary>
 /// Initialise the camera and instruct it to connect to a specific camera.
 /// </summary>
 /// <param name="serial">
 /// An empty serial number will instruct it to connect to the first
 /// camera it can find. The serial number supports regular expressions and can therefore
 /// be used to connect to a specific ID regardless of serial number, for example ".*:primary"
 /// where the ID of the camera has been set to "primary".
 /// </param>
 public void Initialise(string serial)
 {
     Psinc.Initialise(this.camera, serial);
 }