Ejemplo n.º 1
0
        /// <summary>
        /// Inititate camera with specific settings
        /// </summary>
        /// <param name="colorType">Color depth</param>
        /// <param name="previewResolution">Preview resolution</param>
        /// <param name="jpegResolution">Jpeg image resolution</param>
        /// <returns>True if succeeded</returns>
        public bool Initial(ColorType colorType, PreviewResolution previewResolution, JpegResolution jpegResolution)
        {
            // Create the command
            command[0] = CMD_PREFIX;
            command[1] = CMD_INITIAL;
            command[2] = 0;
            command[3] = (byte)colorType;
            command[4] = (byte)previewResolution;
            command[5] = (byte)jpegResolution;

            // send 'Initial' command
            SendCommand(command);

            // Wait for ACK
            if (!ReceiveACK(CMD_INITIAL, 100))
            {
                return(false);
            }

            // Create package size command
            int packsize = PACKAGE_SIZE;

            command[0] = CMD_PREFIX;
            command[1] = CMD_PACKAGESIZE;
            command[2] = 0x08;
            command[3] = (byte)packsize;        // PACKAGE_SIZE Low byte
            command[4] = (byte)(packsize >> 8); // PACKAGE_SIZE High byte
            command[5] = 0x00;

            // Send 'Set Package Size' command
            SendCommand(command);

            // Wait for ACK
            if (!ReceiveACK(CMD_PACKAGESIZE, 100))
            {
                return(false);
            }

            return(true);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Inititate camera with specific settings
        /// </summary>
        /// <param name="colorType">Color depth</param>
        /// <param name="previewResolution">Preview resolution</param>
        /// <param name="jpegResolution">Jpeg image resolution</param>
        /// <returns>True if succeeded</returns>
        public bool Initial(ColorType colorType, PreviewResolution previewResolution, JpegResolution jpegResolution)
        {
            // Create the command
            command[0] = CMD_PREFIX;
            command[1] = CMD_INITIAL;
            command[2] = 0;
            command[3] = (byte)colorType;
            command[4] = (byte)previewResolution;
            command[5] = (byte)jpegResolution;

            // send 'Initial' command
            SendCommand(command);

            // Wait for ACK
            if (! ReceiveACK(CMD_INITIAL)) //100
                return false;

            // Create package size command
            int packsize = PACKAGE_SIZE;
            command[0] = CMD_PREFIX;
            command[1] = CMD_PACKAGESIZE;
            command[2] = 0x08;
            command[3] = (byte)packsize; // PACKAGE_SIZE Low byte
            command[4] = (byte)(packsize >> 8); // PACKAGE_SIZE High byte
            command[5] = 0x00;

            // Send 'Set Package Size' command
            SendCommand(command);

            // Wait for ACK
            if (!ReceiveACK(CMD_PACKAGESIZE)) //100
                return false;

            return true;
        }