bellamybj

PtpChdk.h

Aug 6th, 2012
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.59 KB | None | 0 0
  1. //http://www.mweerden.net/download/chdk-ptp/libptp-chdk.patch
  2.  
  3. #ifndef __PTPCHDK_H__
  4. #define __PTPCHDK_H__
  5.  
  6. #include <inttypes.h>
  7. #include <avr/pgmspace.h>
  8.  
  9. #include <ptp.h>
  10.  
  11. const char msg_Chdk                                     [] PROGMEM = "CHDK";
  12.  
  13. // CHDK Operation code
  14. #define PTP_OC_CHDK                                     0x9999
  15.  
  16. class PtpChdk: public PTP
  17. {
  18. public:
  19.   PtpChdk(USB *pusb, PTPStateHandlers *s);
  20.  
  21.   enum {
  22.     PTP_CHDK_Shutdown = 0,    // param2 is 0 (hard), 1 (soft), 2 (reboot) or 3 (reboot fw update)
  23.                               // if param2 == 3, then filename of fw update is send as data (empty for default)
  24.     PTP_CHDK_GetMemory,       // param2 is base address (not NULL; circumvent by taking 0xFFFFFFFF and size+1)
  25.                               // param3 is size (in bytes)
  26.                               // return data is memory block
  27.     PTP_CHDK_SetMemoryLong,   // param2 is address
  28.                               // param3 is value
  29.     PTP_CHDK_CallFunction,    // data is array of function pointer and (long) arguments  (max: 10 args)
  30.                               // return param1 is return value
  31.     PTP_CHDK_GetPropCase,     // param2 is base id
  32.                               // param3 is number of properties
  33.                               // return data is array of longs
  34.     PTP_CHDK_GetParamData,    // param2 is base id
  35.                               // param3 is number of parameters
  36.                               // return data is sequence of strings prefixed by their length (as long)
  37.     PTP_CHDK_TempData,        // data is data to be stored for later
  38.     PTP_CHDK_UploadFile,      // data is 4-byte length of filename, followed by filename and contents
  39.     PTP_CHDK_DownloadFile,    // preceded by PTP_CHDK_TempData with filename
  40.                               // return data are file contents
  41.     PTP_CHDK_SwitchMode,      // param2 is 0 (playback) or 1 (record)
  42.     PTP_CHDK_ExecuteLUA,      // data is script to be executed
  43.   } ptp_chdk_command;
  44.  
  45.   uint16_t shutdownHard(uint32_t params[]);
  46.   uint16_t shutdownSoft(uint32_t params[]);
  47.   uint16_t reboot(uint32_t params[]);
  48.   uint16_t rebootFwUpdate(char *path);
  49.   char* getMemory(int start, int num);
  50.   uint16_t setMemoryLong(int addr, int val);
  51.   uint16_t call(int *args, int size, int *ret);
  52.   uint16_t* getPropcase(int start, int num);
  53.   char* getParamdata(int start, int num);
  54.   uint16_t upload(char *local_fn, char *remote_fn);
  55.   uint16_t download(char *remote_fn, char *local_fn);
  56.   uint16_t switchMode(int mode);
  57.   uint16_t execLua(char *script);
  58.  
  59. };
  60.  
  61.  
  62. #endif // __PTPCHDK_H__
Advertisement
Add Comment
Please, Sign In to add comment