这篇教程C++ GP_DEBUG函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中GP_DEBUG函数的典型用法代码示例。如果您正苦于以下问题:C++ GP_DEBUG函数的具体用法?C++ GP_DEBUG怎么用?C++ GP_DEBUG使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了GP_DEBUG函数的27个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: put_file_funcstatic int put_file_func (CameraFilesystem *fs, const char *folder, const char *filename, CameraFileType type, CameraFile *file, void *data, GPContext *context) { Camera *camera=data; const char *data_file; long unsigned int data_size; /* * Upload the file to the camera. Use gp_file_get_data_and_size, etc. */ GP_DEBUG ("*** put_file_func"); GP_DEBUG ("*** folder: %s", folder); GP_DEBUG ("*** filename: %s", filename); gp_file_get_data_and_size (file, &data_file, &data_size); if ( data_size == 0) { gp_context_error (context, _("The file to be uploaded has a null length")); return GP_ERROR_BAD_PARAMETERS; } /* Should check memory here */ /* if (available_memory < data_size) { gp_context_error (context, _("Not enough memory available on the memory card")); return GP_ERROR_NO_MEMORY; } */ tiger_upload_file (camera->pl, filename,data_file,data_size); return GP_OK;}
开发者ID:ryanstout,项目名称:libgphoto2,代码行数:34,
示例2: get_info_funcstatic int get_info_func (CameraFilesystem *fs, const char *folder, const char *filename, CameraFileInfo *info, void *data, GPContext *context){ Camera *camera = data; int n; struct jamcam_file *jc_file; GP_DEBUG ("* get_info_func"); GP_DEBUG ("*** folder: %s", folder); GP_DEBUG ("*** filename: %s",filename); /* Get the file number from the CameraFileSystem */ CHECK (n = gp_filesystem_number (camera->fs, folder, filename, context)); jc_file = jamcam_file_info( camera, n ); /* fixme, get file size also */ info->file.fields = GP_FILE_INFO_TYPE; strcpy (info->file.type, GP_MIME_PPM); info->file.width = jc_file->width; info->file.height = jc_file->height; info->preview.fields = GP_FILE_INFO_TYPE; strcpy (info->preview.type, GP_MIME_PPM); info->preview.width = 80; info->preview.height = 60; return (GP_OK);}
开发者ID:CastorGemini,项目名称:libgphoto2,代码行数:31,
示例3: lg_gsm_initint lg_gsm_init (GPPort *port, Model *model, Info *info) { char firmware[54]; char oknok[6]; memset (oknok,0,6); memset (firmware,0,54); GP_DEBUG("Running lg_gsm_init/n"); port->timeout=20000; /* syncstart */ MSGWRITE(port, 0x13, 0x6, 0x0, "", 0); WRITE(port, sync_start, 6); READ(port, oknok, 6); /* getfirmware : write 0x010000000000 */ MSGWRITE(port, 0x13, 0x6, 0x0, "", 0); WRITE(port, get_firmware, 0x6); READ(port, firmware, 54); /* syncstop */ MSGWRITE(port, 0x13, 0x6, 0x0, "", 0); WRITE(port, sync_stop, 6); READ(port, oknok, 6); /* This information, too. */ memcpy (info, &firmware[6], 40); GP_DEBUG("info = %s/n", info); /*GP_DEBUG("info[20] = 0x%x/n", firmware[26]);*/ GP_DEBUG("Leaving lg_gsm_init/n"); return GP_OK;}
开发者ID:CastorGemini,项目名称:libgphoto2,代码行数:31,
示例4: camera_initintcamera_init(Camera *camera, GPContext *context){ GPPortSettings settings; CameraAbilities abilities; int ret = 0; /* First, set up all the function pointers */ camera->functions->summary = camera_summary; camera->functions->about = camera_about; camera->functions->exit = camera_exit; GP_DEBUG ("Initializing the camera/n"); ret = gp_port_get_settings(camera->port,&settings); if (ret < 0) return ret; ret = gp_camera_get_abilities(camera,&abilities); if (ret < 0) return ret; GP_DEBUG("product number is 0x%x/n", abilities.usb_product); switch (camera->port->type) { case GP_PORT_SERIAL: return ( GP_ERROR ); case GP_PORT_USB: settings.usb.config = 1; settings.usb.altsetting = 0; settings.usb.interface = 1; settings.usb.inep = 0x84; settings.usb.outep =0x05; break; default: return ( GP_ERROR ); } ret = gp_port_set_settings(camera->port,settings); if (ret < 0) return ret; GP_DEBUG("interface = %i/n", settings.usb.interface); GP_DEBUG("inep = %x/n", settings.usb.inep); GP_DEBUG("outep = %x/n", settings.usb.outep); /* Tell the CameraFilesystem where to get lists from */ gp_filesystem_set_funcs (camera->fs, &fsfuncs, camera); camera->pl = malloc (sizeof (CameraPrivateLibrary)); if (!camera->pl) return GP_ERROR_NO_MEMORY; memset (camera->pl, 0, sizeof (CameraPrivateLibrary)); switch(abilities.usb_product) { case 0x2130: camera->pl->model = AOX_MODEL_DMAX; break; default: camera->pl->model = AOX_MODEL_MINI; } /* Connect to the camera */ aox_init (camera->port, &camera->pl->model, camera->pl->info); return GP_OK;}
开发者ID:ryanstout,项目名称:libgphoto2,代码行数:60,
示例5: parse_fb_paramsstatic int parse_fb_params(char *params, int *flags, const char **fb){ char *param; if (!params) return 0; do { param = params; params = next_param(params); if (!strcasecmp(param, "no_shadow")) { *flags &= ~GP_FB_SHADOW; GP_DEBUG(1, "Shadow framebuffer disabled"); continue; } if (!strcasecmp(param, "new_console")) { *flags |= GP_FB_ALLOC_CON; GP_DEBUG(1, "Console allocation enabled"); continue; } *fb = param; if (strncmp(*fb, "/dev/", 5)) GP_WARN("Console dev set to '%s', are you sure?", *fb); GP_DEBUG(1, "Framebuffer console set to '%s'", *fb); } while (params); return 0;}
开发者ID:gfxprim,项目名称:gfxprim,代码行数:34,
示例6: get_file_funcstatic intget_file_func (CameraFilesystem *fs, const char *folder, const char *filename, CameraFileType type, CameraFile *file, void *user_data, GPContext *context){ Camera *camera = user_data; int k; char *data; int len; k = gp_filesystem_number(camera->fs, "/", filename, context); switch (type) { case GP_FILE_TYPE_PREVIEW: return GP_ERROR_NOT_SUPPORTED; case GP_FILE_TYPE_NORMAL: len = lg_gsm_get_picture_size (camera->port, k); GP_DEBUG("len = %i/n", len); data = malloc(len); if (!data) { GP_DEBUG("malloc failed/n"); return GP_ERROR_NO_MEMORY; } lg_gsm_read_picture_data (camera->port, data, len, k); gp_file_append (file, data, len); free (data); break; default: return GP_ERROR_NOT_SUPPORTED; } return GP_OK;}
开发者ID:AleksKolkov,项目名称:libgphoto2,代码行数:35,
示例7: seek_cur_pos/* Seek to the current position */static void seek_cur_pos(struct zip_priv *priv){ unsigned int cur_table = priv->cur_pos / ZIP_CHUNKS_IN_TABLE; unsigned int cur_pos; if (priv->cur_table_pos != cur_table) { unsigned int i; GP_DEBUG(3, "cur_pos %u out of cur table %u", priv->cur_pos, priv->cur_table_pos); priv->cur_table = &priv->table; for (i = 0; i < cur_table; i++) { if (priv->cur_table->next) priv->cur_table = priv->cur_table->next; else GP_WARN("The cur_pos points after last table"); } priv->cur_table_pos = cur_table; } //TODO: Asert that we are not in last table and cur_pos < table_used cur_pos = priv->cur_pos % ZIP_CHUNKS_IN_TABLE; GP_DEBUG(2, "Setting current position to %u (%li)", priv->cur_pos, priv->cur_table->offsets[cur_pos]); gp_io_seek(priv->io, priv->cur_table->offsets[cur_pos], GP_IO_SEEK_SET);}
开发者ID:gfxprim,项目名称:gfxprim,代码行数:33,
示例8: voidgp_io *gp_io_mem(void *buf, size_t size, void (*free)(void *)){ gp_io *io; struct mem_io *mem_io; GP_DEBUG(1, "Creating IOMem %p size=%zu", buf, size); io = malloc(sizeof(gp_io) + sizeof(*mem_io)); if (!io) { GP_DEBUG(1, "Malloc failed :("); errno = ENOMEM; return NULL; } io->read = mem_read; io->seek = mem_seek; io->close = mem_close; io->write = NULL; mem_io = GP_IO_PRIV(io); mem_io->free = free; mem_io->buf = buf; mem_io->size = size; mem_io->pos = 0; return io;}
开发者ID:gfxprim,项目名称:gfxprim,代码行数:29,
示例9: GP_DEBUGgp_io *gp_io_sub_io(gp_io *pio, size_t size){ gp_io *io; struct sub_io *sub_io; GP_DEBUG(1, "Creating SubIO (from %p) size=%zu", pio, size); io = malloc(sizeof(gp_io) + sizeof(*sub_io)); if (!io) { GP_DEBUG(1, "Malloc failed :("); errno = ENOMEM; return NULL; } io->read = sub_read; io->seek = sub_seek; io->close = sub_close; io->write = NULL; sub_io = GP_IO_PRIV(io); sub_io->cur = sub_io->start = gp_io_tell(pio); //TODO: Overflow sub_io->end = sub_io->start + size; sub_io->io = pio; return io;}
开发者ID:gfxprim,项目名称:gfxprim,代码行数:29,
示例10: camera_capturestatic int camera_capture (Camera *camera, CameraCaptureType type, CameraFilePath *path, GPContext *context) { if (type != GP_CAPTURE_IMAGE) return (GP_ERROR_NOT_SUPPORTED); if ( dimagev_shutter(camera->pl) < GP_OK ) { GP_DEBUG( "camera_capture::unable to open shutter"); return GP_ERROR_IO; } /* Now check how many pictures are taken, and return the last one. */ if ( dimagev_get_camera_status(camera->pl) != 0 ) { GP_DEBUG( "camera_capture::unable to get camera status"); return GP_ERROR_IO; }#if defined HAVE_SNPRINTF snprintf(path->folder, sizeof(path->folder), "/"); snprintf(path->name, sizeof(path->name), DIMAGEV_FILENAME_FMT, camera->pl->status->number_images);#else sprintf(path->folder, "/"); sprintf(path->name, DIMAGEV_FILENAME_FMT, camera->pl->status->number_images);#endif /* Tell the CameraFilesystem about this picture */ gp_filesystem_append (camera->fs, path->folder, path->name, context); return GP_OK;}
开发者ID:JohnChu,项目名称:Snoopy,代码行数:29,
示例11: camera_get_config_cam_descintcamera_get_config_cam_desc (Camera *camera, CameraWidget **window, GPContext *context){ CameraWidget *section; int indw, indr; const CameraDescType *cam_desc = NULL; GP_DEBUG ("*** camera_get_config_cam_desc"); CHECK (camera_start (camera, context)); gp_widget_new (GP_WIDGET_WINDOW, _("Camera Configuration"), window); cam_desc = camera->pl->cam_desc; for (indw = 0; indw < 2 /* XXX sizeof () */; indw++) { GP_DEBUG ("%s registers", cam_desc->regset[indw].window_name); gp_widget_new (GP_WIDGET_SECTION, _(cam_desc->regset[indw].window_name), §ion); gp_widget_append (*window, section); for (indr = 0; indr < cam_desc->regset[indw].reg_cnt; indr++) { camera_cam_desc_get_widget (camera, &cam_desc->regset[indw].regs[indr], section, context); } } return (GP_OK);}
开发者ID:rajbot,项目名称:gphoto,代码行数:26,
示例12: Dimera_Preview/* Download a live image from the camera and return it in a mallocedbuffer with PGM headers */static uint8_t *Dimera_Preview( long *size, Camera *camera, GPContext *context ){ uint8_t buffer[VIEWFIND_SZ/2], *p; int i; uint8_t *image; uint32_t exposure_total; unsigned brightness; if ( !(image = (unsigned char *) malloc( VIEWFIND_SZ + sizeof( Dimera_viewhdr ) - 1 )) ) { ERROR( "Get Preview, allocation failed" ); gp_context_error (context, _("Out of memory")); return NULL; } /* set image size */ *size = VIEWFIND_SZ + sizeof( Dimera_viewhdr ) - 1; /* set image header */ memcpy( image, Dimera_viewhdr, sizeof( Dimera_viewhdr ) - 1 ); if ( mesa_snap_view( camera->port, buffer, TRUE, 0, 0, 0, camera->pl->exposure, VIEW_TYPE) < 0 ) { ERROR( "Get Preview, mesa_snap_view failed" ); free (image); gp_context_error (context, _("Problem taking live image")); return NULL; } /* copy the buffer, splitting the pixels up */ exposure_total = 0; for ( p = image + sizeof( Dimera_viewhdr ) - 1, i = 0; i < (VIEWFIND_SZ/2) ; i++ ) { *p++ = buffer[i] >> 4; *p++ = buffer[i] & 0xf; exposure_total += (buffer[i] >> 4) + (buffer[i] & 0xf); } /* Automatic exposure control */ /* Current picture brightness, where 0 is is dark and 255 is bright */ brightness = exposure_total / (VIEWFIND_SZ / 16); GP_DEBUG( "Average pixel brightness %f, Current exposure value: %d", brightness / 16.0, camera->pl->exposure); if (camera->pl->auto_exposure && (brightness < 96 || brightness > 160)) { /* Picture brightness needs to be corrected for next time */ camera->pl->exposure = calc_new_exposure(camera->pl->exposure, brightness); GP_DEBUG( "New exposure value: %d", camera->pl->exposure); } return image;}
开发者ID:Dvizhenka,项目名称:libgphoto2,代码行数:61,
示例13: lg_gsm_list_filesint lg_gsm_list_files (GPPort *port, CameraList *list) { int num_pics; int i; char oknok[6]; char photonumber[22]; char photolist[142000]; /* max_photos * 142 */ char name[44]; char value[88]; memset (oknok,0,6); memset (photonumber,0,22); memset (photolist,0,142000); memset (name,0,44); memset (value,0,88); GP_DEBUG("Running lg_gsm_list_files/n"); /* set timeout to 3s */ /*port->timeout=20000;*/ /* syncstart */ MSGWRITE(port, 0x13, 0x6, 0x0, "", 0); WRITE(port, sync_start, 6); READ(port, oknok, 6); /* lsphoto : write 0x04000800000040000000ffffffff */ MSGWRITE(port, 0x13, 0xe, 0x0, "", 0); WRITE(port, list_all_photo, 0xe); READ(port, photonumber, 0x16); num_pics=photonumber[20]+256*photonumber[21]; /* increase timeout to 20s */ /*port->timeout=20000;*/ /* read 142 * nb_photos */ READ(port, photolist, 142*num_pics); for (i = 0; i < num_pics; i++){ /* sprintf( name, "lg_gsm_pic%03i.jpg", i ); */ memcpy(name,&photolist[6+142*i],44); memcpy(value,&photolist[50+142*i],80); gp_list_append(list, name, value); } /* restore timeout to 5s */ /*port->timeout=5000; */ /* syncstop */ MSGWRITE(port, 0x13, 0x6, 0x0, "", 0); WRITE(port, sync_stop, 6); READ(port, oknok, 6); /*port->timeout=5000;*/ GP_DEBUG("Number of pics : %03i/n", num_pics); GP_DEBUG("Leaving lg_gsm_list_files/n"); return GP_OK;}
开发者ID:CastorGemini,项目名称:libgphoto2,代码行数:58,
示例14: l859_connect/* * l859_connect - try hand shake with camera and establish connection */static int l859_connect(Camera *camera) { GPPortSettings settings; uint8_t bps; int ret; GP_DEBUG ("Connecting to a camera."); ret = l859_sendcmd(camera, L859_CMD_CONNECT); if (ret < GP_OK) return ret; if (l859_retrcmd(camera) == GP_ERROR) { if (l859_sendcmd(camera, L859_CMD_RESET) != GP_OK) return GP_ERROR; if (l859_sendcmd(camera, L859_CMD_CONNECT)!= GP_OK) return GP_ERROR; if (l859_retrcmd(camera) == GP_ERROR) return GP_ERROR; } switch (camera->pl->speed) { case 19200: bps = L859_CMD_SPEED_19200; break; case 57600: bps = L859_CMD_SPEED_57600; break; case 115200: bps = L859_CMD_SPEED_115200; break; default: bps = L859_CMD_SPEED_DEFAULT; break; } if (bps != L859_CMD_SPEED_DEFAULT) { if (l859_sendcmd(camera, bps) != GP_OK) return GP_ERROR; gp_port_get_settings(camera->port, &settings); settings.serial.speed = camera->pl->speed; gp_port_set_settings(camera->port, settings); if (l859_retrcmd(camera) == GP_ERROR) return GP_ERROR; } if (l859_sendcmd(camera, L859_CMD_INIT) != GP_OK) return GP_ERROR; if (l859_retrcmd(camera) == GP_ERROR) return GP_ERROR; GP_DEBUG ("Camera connected successfully."); return GP_OK;}
开发者ID:mejedi,项目名称:Gphoto2.framework,代码行数:60,
示例15: pre_funcstatic intpre_func (Camera *camera, GPContext *context){ int r; unsigned int i; GPPortSettings settings; GP_DEBUG ("Initializing connection..."); CR (gp_port_get_settings (camera->port, &settings)); CR (fuji_ping (camera, context)); if (!camera->pl->speed) { /* Set to the highest possible speed. */ for (i = 0; Speeds[i].bit_rate; i++) { r = fuji_set_speed (camera, Speeds[i].speed, NULL); if (r >= 0) break; } /* * Change the port's speed and check if the camera is * still there. */ settings.serial.speed = Speeds[i].bit_rate; CR (gp_port_set_settings (camera->port, settings)); GP_DEBUG("Pinging to check new speed %i.", Speeds[i].bit_rate); CR (fuji_ping (camera, context)); } else { /* User specified a speed. Check if the speed is possible */ for (i = 0; Speeds[i].bit_rate; i++) if (Speeds[i].bit_rate == camera->pl->speed) break; if (!Speeds[i].bit_rate) { gp_context_error (context, _("Bit rate %ld is not " "supported."), camera->pl->speed); return (GP_ERROR_NOT_SUPPORTED); } /* Change the speed if necessary. */ if (camera->pl->speed != Speeds[i].bit_rate) { CR (fuji_set_speed (camera, Speeds[i].speed, context)); /* * Change the port's speed and check if the camera is * still there. */ settings.serial.speed = Speeds[i].bit_rate; CR (gp_port_set_settings (camera->port, settings)); CR (fuji_ping (camera, context)); } } return (GP_OK);}
开发者ID:rajbot,项目名称:gphoto,代码行数:57,
示例16: zip_load_headerstatic int zip_load_header(gp_io *io, struct zip_local_header *header){ int ret; uint8_t byte; uint16_t zip_header[] = { 'P', 'K', GP_IO_BYTE, GP_IO_END }; if (gp_io_readf(io, zip_header, &byte) != 3) { GP_DEBUG(1, "Failed to read header"); return EIO; } switch (byte) { /* Central directory -> end of archive */ case 0x01: GP_DEBUG(1, "Reached end of the archive"); return EINVAL; break; /* File header */ case 0x03: break; default: GP_DEBUG(1, "Unexpected header PK%x", byte); return EIO; } uint16_t zip_local_header[] = { 0x04, GP_IO_L2, /* version */ GP_IO_L2, /* bit flags */ GP_IO_L2, /* compression type */ GP_IO_IGN | 4, GP_IO_L4, /* CRC */ GP_IO_L4, /* compressed size */ GP_IO_L4, /* uncompressed size */ GP_IO_L2, /* filename length */ GP_IO_L2, /* extra fields lenght */ GP_IO_END }; ret = gp_io_readf(io, zip_local_header, &header->ver, &header->flags, &header->comp_type, &header->crc, &header->comp_size, &header->uncomp_size, &header->fname_len, &header->extf_len); if (ret != 10) { GP_DEBUG(1, "Failed to read header"); return EIO; } return 0;}
开发者ID:gfxprim,项目名称:gfxprim,代码行数:57,
示例17: jl2005c_get_pic_data_sizeintjl2005c_get_pic_data_size (CameraPrivateLibrary *priv, Info *table, int n){ int size; GP_DEBUG("table[16 * n + 7] = %02X/n", table[16 * n + 7]); size = table[0x10 * n + 6] * 0x100 | table[0x10 * n + 7]; size *= priv->blocksize; GP_DEBUG("size = 0x%x = %d/n", size, size); return (size);}
开发者ID:JohnChu,项目名称:Snoopy,代码行数:10,
示例18: parse_x11_paramsstatic int parse_x11_params(char *params, GP_Size *w, GP_Size *h, enum GP_BackendX11Flags *flags){ char *param; if (!params) return 0; do { param = params; params = next_param(params); if (!strcasecmp(param, "use_root")) { *flags |= GP_X11_USE_ROOT_WIN; GP_DEBUG(1, "X11: Using root window"); continue; } if (!strcasecmp(param, "create_root")) { *flags |= GP_X11_CREATE_ROOT_WIN; GP_DEBUG(1, "X11: Creating root window"); continue; } if (!strcasecmp(param, "disable_shm")) { *flags |= GP_X11_DISABLE_SHM; GP_DEBUG(1, "X11: Disabling SHM"); continue; } if (!strcasecmp(param, "fs")) { *flags |= GP_X11_FULLSCREEN; GP_DEBUG(1, "X11: Enabling fullscreen"); continue; } /* * Accepts only string with format "intxint" or "intXint" */ int sw, sh; unsigned int n; if (sscanf(param, "%i%*[xX]%i%n", &sw, &sh, &n) == 2 && n == strlen(param)) { *w = sw; *h = sh; continue; } GP_WARN("X11: Invalid parameters '%s'", param); errno = EINVAL; return 1; } while (params); return 0;}
开发者ID:gfxprim,项目名称:gfxprim,代码行数:55,
示例19: camera_initintcamera_init(Camera *camera, GPContext *context){ GPPortSettings settings; int ret = 0; /* First, set up all the function pointers */ camera->functions->manual = camera_manual; camera->functions->summary = camera_summary; camera->functions->about = camera_about; camera->functions->exit = camera_exit; GP_DEBUG ("Initializing the camera/n"); ret = gp_port_get_settings(camera->port,&settings); if (ret < 0) return ret; switch (camera->port->type) { case GP_PORT_SERIAL: return ( GP_ERROR ); case GP_PORT_USB: settings.usb.config = 1; settings.usb.altsetting = 0; settings.usb.interface = 0; /* inep 0x84 used to initialize. Then switch to 0x82! */ settings.usb.inep = 0x84; settings.usb.outep = 0x03; break; default: return ( GP_ERROR ); } ret = gp_port_set_settings(camera->port,settings); if (ret < 0) return ret; GP_DEBUG("interface = %i/n", settings.usb.interface); GP_DEBUG("inep = %x/n", settings.usb.inep); GP_DEBUG("outep = %x/n", settings.usb.outep); /* Tell the CameraFilesystem where to get lists from */ gp_filesystem_set_funcs (camera->fs, &fsfuncs, camera); camera->pl = malloc (sizeof (CameraPrivateLibrary)); if (!camera->pl) return GP_ERROR_NO_MEMORY; memset (camera->pl, 0, sizeof (CameraPrivateLibrary)); /* Connect to the camera */ camera->pl->total_data_in_camera=0; camera->pl->data_to_read = 0; camera->pl->bytes_put_away = 0; camera->pl->data_reg_opened = 0; camera->pl->data_cache = NULL; camera->pl->init_done = 0; jl2005c_init (camera,camera->port, camera->pl); return GP_OK;}
开发者ID:jcoenraadts,项目名称:libgphoto2,代码行数:55,
示例20: dlink_dsc350f_postprocessing_and_flip_both |