Changeset 1097


Ignore:
Timestamp:
03/20/11 23:56:41 (2 years ago)
Author:
reyalP
Message:

ptpcam ptp.h cleanup, improve script-status and script-support output

Location:
branches/reyalp-ptp/tools/ptpcam
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/reyalp-ptp/tools/ptpcam/ptp.h

    r1084 r1097  
    920920                            // all other bits and params are reserved for future use 
    921921  PTP_CHDK_ReadScriptMsg,   // read next message from camera script system 
    922                             // return param1 is message type: none, script error, script return, user, TODO chdk console data 
    923                             // return param2 is message subtype: for script return and users this is chdk_ptp_type, for error it may be an error code (TBD) 
     922                            // return param1 is chdk_ptp_s_msg_type 
     923                            // return param2 is message subtype: 
     924                            //   for script return and users this is ptp_chdk_script_data_type 
     925                            //   for error it may be an error ptp_chdk_script_error_type 
    924926                            // return param3 is script id of script that generated the message 
    925927                            // return param4 is length of the message data 
    926928                            // return data is message. 
    927                             // A minum of 4 bytes of zeros is returned if there would not be data otherwise 
     929                            // A minimum of 4 bytes of zeros is returned if there would not be data otherwise 
    928930  PTP_CHDK_WriteScriptMsg,  // write a message for scripts running on camera 
    929931                            // input param2 is target script id, 0=don't care. Messages for a non-running script will be discarded 
    930932                            // data length is handled by ptp data phase 
    931933                            // input messages do not have type or subtype, they are always a string destined for the script (similar to USER/string) 
    932                             // output param1 is status (OK,queue full,wrong script,script not running) 
     934                            // output param1 is ptp_chdk_script_msg_status 
    933935} ptp_chdk_command; 
    934936 
     
    940942  PTP_CHDK_TYPE_INTEGER, 
    941943  PTP_CHDK_TYPE_STRING, // NOTE tables currently returned as string 
    942 } ptp_chdk_type; 
     944} ptp_chdk_script_data_type; 
    943945 
    944946// TempData flags 
     
    960962 
    961963// message types 
    962 #define PTP_CHDK_S_MSGTYPE_NONE  0 // no messages waiting 
    963 #define PTP_CHDK_S_MSGTYPE_ERR   1 // error message 
    964 #define PTP_CHDK_S_MSGTYPE_RET   2 // script return value 
    965 #define PTP_CHDK_S_MSGTYPE_USER  3 // message queued by script 
     964enum { 
     965    PTP_CHDK_S_MSGTYPE_NONE = 0, // no messages waiting 
     966    PTP_CHDK_S_MSGTYPE_ERR,         // error message 
     967    PTP_CHDK_S_MSGTYPE_RET,      // script return value 
     968    PTP_CHDK_S_MSGTYPE_USER,     // message queued by script 
     969// TODO chdk console data ? 
     970} ptp_chdk_script_msg_type; 
    966971 
    967972// error subtypes for PTP_CHDK_S_MSGTYPE_ERR and script startup status 
    968 #define PTP_CHDK_S_ERRTYPE_NONE    0 
    969 #define PTP_CHDK_S_ERRTYPE_COMPILE 1 
    970 #define PTP_CHDK_S_ERRTYPE_RUN     2 
     973enum { 
     974    PTP_CHDK_S_ERRTYPE_NONE = 0, 
     975    PTP_CHDK_S_ERRTYPE_COMPILE, 
     976    PTP_CHDK_S_ERRTYPE_RUN, 
     977} ptp_chdk_script_error_type; 
    971978 
    972979// message status 
    973 #define PTP_CHDK_S_MSGSTATUS_OK     0 // queued ok 
    974 #define PTP_CHDK_S_MSGSTATUS_NOTRUN 1 // no script is running 
    975 #define PTP_CHDK_S_MSGSTATUS_QFULL  2 // queue is full 
    976 #define PTP_CHDK_S_MSGSTATUS_BADID  3 // specified ID is not running 
     980enum { 
     981    PTP_CHDK_S_MSGSTATUS_OK = 0, // queued ok 
     982    PTP_CHDK_S_MSGSTATUS_NOTRUN, // no script is running 
     983    PTP_CHDK_S_MSGSTATUS_QFULL,  // queue is full 
     984    PTP_CHDK_S_MSGSTATUS_BADID,  // specified ID is not running 
     985} ptp_chdk_script_msg_status; 
    977986 
    978987int ptp_chdk_shutdown_hard(PTPParams* params, PTPDeviceInfo* deviceinfo); 
  • branches/reyalp-ptp/tools/ptpcam/ptpcam.c

    r1084 r1097  
    26982698      if ( ptp_chdk_get_script_support(&params,&params.deviceinfo,&status) ) 
    26992699      { 
    2700         printf("script-support:%x\n",status); 
     2700        printf("script-support:0x%x lua=%s\n",status,(status & PTP_CHDK_SCRIPT_SUPPORT_LUA) ? "yes":"no"); 
    27012701      } 
    27022702    } else if ( !strcmp("script-status",buf) ) 
     
    27052705      if ( ptp_chdk_get_script_status(&params,&params.deviceinfo,&status) ) 
    27062706      { 
    2707         printf("script-running:%x\n",status); 
     2707        printf("script-status:0x%x run=%s msg=%s\n",status, 
     2708                (status & PTP_CHDK_SCRIPT_STATUS_RUN) ? "yes":"no", 
     2709                (status & PTP_CHDK_SCRIPT_STATUS_MSG) ? "yes":"no"); 
    27082710      } 
    27092711    } else if ( !strcmp("getm",buf) ) 
Note: See TracChangeset for help on using the changeset viewer.