camlib
Documentation for camlib is still a work-in-progress
Loading...
Searching...
No Matches
camlib.h File Reference
#include <stdio.h>
#include <stdint.h>
#include <pthread.h>
#include "ptp.h"
#include <unistd.h>
#include "cl_data.h"
#include "cl_backend.h"
#include "cl_ops.h"
#include "cl_enum.h"
#include "cl_bind.h"

Go to the source code of this file.

Classes

struct  PtpPropAvail
 Linked list to handle currently possible values for a property. More...
 
struct  PtpRuntime
 Holds all camlib instance info. More...
 
struct  PtpGenericEvent
 Generic event / property change. More...
 
struct  PtpCommand
 Generic PTP command structure - accepted by operation API. More...
 
struct  PtpArray
 Generic Struct for arrays. More...
 

Macros

#define PTP_TIMEOUT   1000
 
#define CAMLIB_WAIT_MS   1000
 
#define CAMLIB_SLEEP(ms)
 
#define CAMLIB_DEFAULT_SIZE   1000000
 
#define CAMLIB_INCLUDE_IMPL
 
#define ptp_get_last_transaction(...)
 
#define ptp_generic_new(...)
 
#define ptp_generic_close(...)
 
#define ptp_generic_reset(...)
 
#define ptp_generic_init(...)
 
#define ptp_generic_send(...)
 
#define ptp_generic_send_data(...)
 

Typedefs

typedef void ptp_object_found_callback(struct PtpRuntime *r, struct PtpObjectInfo *oi, void *arg)
 

Enumerations

enum  PtpGeneralError {
  PTP_OK = 0 , PTP_NO_DEVICE = -1 , PTP_NO_PERM = -2 , PTP_OPEN_FAIL = -3 ,
  PTP_OUT_OF_MEM = -4 , PTP_IO_ERR = -5 , PTP_RUNTIME_ERR = -6 , PTP_UNSUPPORTED = -7 ,
  PTP_CHECK_CODE = -8 , PTP_CANCELED = -9
}
 Camlib library errors, not PTP return codes.
 
enum  PtpLiveViewType {
  PTP_LV_NONE = 0 , PTP_LV_EOS = 1 , PTP_LV_CANON = 2 , PTP_LV_ML = 3 ,
  PTP_LV_EOS_ML_BMP = 4
}
 
enum  PtpVendors {
  PTP_DEV_EMPTY = 0 , PTP_DEV_EOS = 1 , PTP_DEV_CANON = 2 , PTP_DEV_NIKON = 3 ,
  PTP_DEV_SONY = 4 , PTP_DEV_FUJI = 5 , PTP_DEV_PANASONIC = 6
}
 Unique camera types - each type should have similar opcodes and behavior.
 
enum  ImageFormats {
  IMG_FORMAT_ETC = 0 , IMG_FORMAT_RAW = 1 , IMG_FORMAT_STD = 2 , IMG_FORMAT_HIGH = 3 ,
  IMG_FORMAT_RAW_JPEG = 4
}
 
enum  PtpConnType { PTP_IP = (1 << 0) , PTP_IP_USB = (1 << 1) , PTP_USB = (1 << 2) }
 Tells lib what backend and packet style to use.
 

Functions

void ptp_verbose_log (char *fmt,...)
 
 __attribute__ ((noreturn)) void ptp_panic(char *fmt
 
const char * ptp_perror (int rc)
 Evaluates PtpGeneralError into string message.
 
int ptp_write_unicode_string (char *dat, char *string)
 
int ptp_read_unicode_string (char *buffer, char *dat, int max)
 
int ptp_read_utf8_string (void *dat, char *string, int max)
 
int ptp_read_string (uint8_t *dat, char *string, int max)
 
int ptp_write_string (uint8_t *dat, char *string)
 
int ptp_write_utf8_string (void *dat, char *string)
 
int ptp_read_uint16_array (uint8_t *dat, uint16_t *buf, int max, int *length)
 
int ptp_read_uint16_array_s (uint8_t *bs, uint8_t *be, uint16_t *buf, int max, int *length)
 
int ptp_new_cmd_packet (struct PtpRuntime *r, struct PtpCommand *cmd)
 
int ptp_new_data_packet (struct PtpRuntime *r, struct PtpCommand *cmd, void *data, int data_length)
 
int ptpip_data_start_packet (struct PtpRuntime *r, int data_length)
 
int ptpip_data_end_packet (struct PtpRuntime *r, void *data, int data_length)
 
void ptp_update_transaction (struct PtpRuntime *r, int t)
 
void ptp_set_prop_avail_info (struct PtpRuntime *r, int code, int memb_size, int cnt, void *data)
 
void * ptp_dup_payload (struct PtpRuntime *r)
 
int ptp_dump (struct PtpRuntime *r)
 
struct ObjectCache * ptp_create_object_service (int *handles, int length, ptp_object_found_callback *callback, void *arg)
 
struct PtpObjectInfo * ptp_object_service_get (struct PtpRuntime *r, struct ObjectCache *oc, int handle)
 
struct PtpObjectInfo * ptp_object_service_get_index (struct PtpRuntime *r, struct ObjectCache *oc, int req_i)
 
int ptp_object_service_length (struct PtpRuntime *r, struct ObjectCache *oc)
 
int ptp_object_service_step (struct PtpRuntime *r, struct ObjectCache *oc)
 
void ptp_object_service_add_priority (struct PtpRuntime *r, struct ObjectCache *oc, int handle)
 

Macro Definition Documentation

◆ CAMLIB_SLEEP

#define CAMLIB_SLEEP ( ms)
Value:
usleep(ms * 1000)

◆ ptp_generic_close

#define ptp_generic_close ( ...)
Value:
ptp_close(__VA_ARGS__)

◆ ptp_generic_init

#define ptp_generic_init ( ...)
Value:
ptp_init(__VA_ARGS__)

◆ ptp_generic_new

#define ptp_generic_new ( ...)
Value:
ptp_new(__VA_ARGS__)

◆ ptp_generic_reset

#define ptp_generic_reset ( ...)
Value:
ptp_reset(__VA_ARGS__)

◆ ptp_generic_send

#define ptp_generic_send ( ...)
Value:
ptp_send(__VA_ARGS__)

◆ ptp_generic_send_data

#define ptp_generic_send_data ( ...)
Value:
ptp_send_data(__VA_ARGS__)

◆ ptp_get_last_transaction

#define ptp_get_last_transaction ( ...)
Value:
ptp_get_last_transaction_id(__VA_ARGS__)

Function Documentation

◆ ptp_dump()

int ptp_dump ( struct PtpRuntime * r)
Note
Debugging only