コード例 #1
0
ファイル: seecam_ar0130.cpp プロジェクト: alexzk1/qtcam
void See3CAM_AR130::setCroppedVGAMode()
{
    bool ret = false;
    u_int8_t cropped_vga_status = 0;
    ret = enableCroppedVGAMode(&cropped_vga_status);
    if(!ret)
    {
        emit deviceStatus("Failure", "Unable to switch to cropped VGA Mode");
        return void();
    }
    else
    {
        switch(cropped_vga_status)
        {
        case 1 :        
            emit deviceStatus("Success","Cropped VGA mode set successfully");
            break;
        case 2 :            
            emit deviceStatus("Failure","The current resolution is not 640x480, please switch to 640x480 before using the Cropping and Binning modes");
            break;
        case 3 :            
            emit deviceStatus("Failure","Device is already in Cropped VGA mode");
            break;
        case 4 :            
            emit deviceStatus("Failure","Failed to set Cropped VGA mode");
            break;
        default :            
            emit deviceStatus("Failure","Unknown error");
        }
    }
}
コード例 #2
0
ファイル: seecam_11cug.cpp プロジェクト: fjtsai/qtcam
void See3CAM_11CUG::setBinnedVGAMode()
{
    bool ret = false;
    u_int8_t binned_vga_status = 0;
    ret = enableBinnedVGAMode(&binned_vga_status);
    if(ret == false)
    {
        printf("Unable to switch to binned VGA Mode");
        emit deviceStatus("Failure","Unable to switch to binned VGA Mode");
        return void();
    }
    else
    {
        switch(binned_vga_status)
        {
        case 1 :
            emit deviceStatus("Success","Binned VGA mode set successfully");
            break;
        case 2 :
            emit deviceStatus("Failure","The current resolution is not 640x480, please switch to 640x480 before using the Cropping and Binning modes");
            break;
        case 3 :
            emit deviceStatus("Failure","Device is already in Binned VGA mode");
            break;
        case 4 :
            emit deviceStatus("Failure","Failed to set Binned VGA mode");
            break;
        default :
            printf("Unknown %d \n",binned_vga_status);
            emit deviceStatus("Failure","Unknown error");

        }
    }
}
コード例 #3
0
ファイル: seecam_11cug.cpp プロジェクト: fjtsai/qtcam
    uint See3CAM_11CUG::getWbValues(camRGBcolor rgbColor)
    {
        if(uvccamera::hid_fd < 0)
        {
            return 0;
        }

        bool timeout = true;
        int ret =0;
        unsigned int start, end = 0;
        uint rgbValue = 0;

        if((rgbColor == Red || rgbColor == Green || rgbColor == Blue))
        {
            //Initialize the buffer
            memset(g_out_packet_buf, 0x00, sizeof(g_out_packet_buf));

            //Set the Report Number
            g_out_packet_buf[1] = WHITE_BAL_CONTROL; /* Report Number */
            g_out_packet_buf[2] = GET_WB_GAIN; /* Report Number */
            g_out_packet_buf[3] = rgbColor; /* Report Number */

            ret = write(uvccamera::hid_fd, g_out_packet_buf, BUFFER_LENGTH);
            if (ret < 0) {
                perror("write");
                emit deviceStatus("Failure",tr("Unable to get whitebalance values"));
            } else {
                printf("%s(): write() wrote %d bytes\n", __func__, ret);
            }
            start = uvc.getTickCount();
            while(timeout)
            {
                /* Get a report from the device */
                ret = read(uvccamera::hid_fd, g_in_packet_buf, BUFFER_LENGTH);
                if (ret < 0) {
                    //perror("read");
                } else {
                    printf("%s(): read %d bytes:\n", __func__,ret);
                    if(g_in_packet_buf[0] == WHITE_BAL_CONTROL  &&
                            g_in_packet_buf[1] == GET_WB_GAIN &&
                            g_in_packet_buf[2] == rgbColor ) {
                        if(g_in_packet_buf[4] == WB_FAIL)
                            emit deviceStatus("Failure",tr("Unable to get whitebalance values"));
                        else if (g_in_packet_buf[4] == WB_SUCCESS) {
                            rgbValue = g_in_packet_buf[3];
                            timeout = false;
                        }
                    }
                }
                end = uvc.getTickCount();
                if(end - start > TIMEOUT)
                {
                    printf("%s(): Timeout occurred\n", __func__);
                    timeout = false;
                    emit deviceStatus("Failure",tr("Unable to get whitebalance values"));
                }
            }
        }
        else
        {
            return 0;
        }
        return rgbValue;
    }